فهرست منبع

Merge branch 'master' of https://github.com/HeapsIO/heaps

LeoVgr 3 ماه پیش
والد
کامیت
1f19265cb6
4فایلهای تغییر یافته به همراه18 افزوده شده و 3 حذف شده
  1. 5 1
      h3d/scene/pbr/CapsuleLight.hx
  2. 3 0
      h3d/scene/pbr/Light.hx
  3. 5 1
      h3d/scene/pbr/PointLight.hx
  4. 5 1
      h3d/scene/pbr/SpotLight.hx

+ 5 - 1
h3d/scene/pbr/CapsuleLight.hx

@@ -91,10 +91,14 @@ class CapsuleLight extends Light {
 		// TODO optimize culling
 		s.r = range + length;
 
-		if( !ctx.camera.frustum.hasSphere(s) )
+		if( !inFrustum(ctx.camera.frustum) )
 			return;
 
 		super.emit(ctx);
 		ctx.emitPass(ctx.pbrLightPass, this);
 	}
+
+	override function inFrustum(frustum : h3d.col.Frustum) {
+		return frustum.hasSphere(s);
+	}
 }

+ 3 - 0
h3d/scene/pbr/Light.hx

@@ -41,4 +41,7 @@ class Light extends h3d.scene.Light {
 		return _color = v;
 	}
 
+	public function inFrustum(frustum : h3d.col.Frustum) {
+		return true;
+	}
 }

+ 5 - 1
h3d/scene/pbr/PointLight.hx

@@ -74,10 +74,14 @@ class PointLight extends Light {
 		s.z = absPos._43;
 		s.r = range;
 
-		if( !ctx.camera.frustum.hasSphere(s) )
+		if( !inFrustum(ctx.camera.frustum) )
 			return;
 
 		super.emit(ctx);
 		ctx.emitPass(ctx.pbrLightPass, this);
 	}
+
+	override function inFrustum(frustum : h3d.col.Frustum) {
+		return frustum.hasSphere(s);
+	}
 }

+ 5 - 1
h3d/scene/pbr/SpotLight.hx

@@ -143,10 +143,14 @@ class SpotLight extends Light {
 		s.z = absPos.tz + d.z;
 		s.r = range / 2.0;
 
-		if( !ctx.camera.frustum.hasSphere(s) )
+		if( !inFrustum(ctx.camera.frustum) )
 			return;
 
 		super.emit(ctx);
 		ctx.emitPass(ctx.pbrLightPass, this);
 	}
+
+	override function inFrustum(frustum : h3d.col.Frustum) {
+		return frustum.hasSphere(s);
+	}
 }