Explorar o código

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

borisrp hai 3 meses
pai
achega
0eb62b34e8
Modificáronse 1 ficheiros con 2 adicións e 0 borrados
  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 ) {}
 	function addComputeShaders( pass : h3d.mat.Pass ) {}
 
 
 	override function emit(ctx:RenderContext) {
 	override function emit(ctx:RenderContext) {
+		if ( cullingCollider != null && !cullingCollider.inFrustum(ctx.camera.frustum) )
+			return;
 		super.emit(ctx);
 		super.emit(ctx);
 		if ( commandBuffer != null && instanceCount > 0) {
 		if ( commandBuffer != null && instanceCount > 0) {
 			var computeShader = computePass.getShader(h3d.shader.InstanceIndirect.InstanceIndirectBase);
 			var computeShader = computePass.getShader(h3d.shader.InstanceIndirect.InstanceIndirectBase);