Parcourir la source

Prevent GPUMeshBatch emit when its culling collider is not in the frustum.

borisrp il y a 3 mois
Parent
commit
0eb62b34e8
1 fichiers modifiés avec 2 ajouts et 0 suppressions
  1. 2 0
      h3d/scene/GPUMeshBatch.hx

+ 2 - 0
h3d/scene/GPUMeshBatch.hx

@@ -250,6 +250,8 @@ class GPUMeshBatch extends MeshBatch {
 	function addComputeShaders( pass : h3d.mat.Pass ) {}
 
 	override function emit(ctx:RenderContext) {
+		if ( cullingCollider != null && !cullingCollider.inFrustum(ctx.camera.frustum) )
+			return;
 		super.emit(ctx);
 		if ( commandBuffer != null && instanceCount > 0) {
 			var computeShader = computePass.getShader(h3d.shader.InstanceIndirect.InstanceIndirectBase);