浏览代码

- Fix pointlight culling

ShiroSmith 7 年之前
父节点
当前提交
3505d80963
共有 1 个文件被更改,包括 4 次插入3 次删除
  1. 4 3
      h3d/scene/pbr/PointLight.hx

+ 4 - 3
h3d/scene/pbr/PointLight.hx

@@ -31,15 +31,16 @@ class PointLight extends Light {
 	}
 
 	override function sync(ctx) {
+		super.sync(ctx);
 
 		if(ctx.computingStatic && (shadows.mode == Static ||  shadows.mode == Mixed)){
 			culled = false; // Always render for baking
 		}
 		else{
 			var sphereVolume = new h3d.col.Sphere();
-			sphereVolume.x = pbr.lightPos.x;
-			sphereVolume.y = pbr.lightPos.y;
-			sphereVolume.z = pbr.lightPos.z;
+			sphereVolume.x = absPos.tx;
+			sphereVolume.y = absPos.ty;
+			sphereVolume.z = absPos.tz;
 			sphereVolume.r = this.range;
 			culled = !ctx.camera.getFrustum().hasSphere(sphereVolume);
 		}