浏览代码

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

borisrp 3 月之前
父节点
当前提交
0eb62b34e8
共有 1 个文件被更改,包括 2 次插入0 次删除
  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);