Sfoglia il codice sorgente

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

borisrp 3 mesi fa
parent
commit
0eb62b34e8
1 ha cambiato i file con 2 aggiunte e 0 eliminazioni
  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);