Explorar o código

h3d.mat.Pass can be culled

clementlandrin %!s(int64=2) %!d(string=hai) anos
pai
achega
0be273c580
Modificáronse 2 ficheiros con 4 adicións e 2 borrados
  1. 2 1
      h3d/mat/Pass.hx
  2. 2 1
      h3d/scene/RenderContext.hx

+ 2 - 1
h3d/mat/Pass.hx

@@ -18,6 +18,7 @@ class Pass {
 	var selfShadersCache : hxsl.ShaderList;
 	var shaders : hxsl.ShaderList;
 	var nextPass : Pass;
+	var culled : Bool = false;
 
 	@:bits(flags) public var enableLights : Bool;
 	/**
@@ -312,7 +313,7 @@ class Pass {
 		selfShadersCache = shaders;
 		if ( prev != null )
 			prev.next = selfShadersCache;
-		else 
+		else
 			selfShaders = shaders;
 		return selfShaders;
 	}

+ 2 - 1
h3d/scene/RenderContext.hx

@@ -45,7 +45,8 @@ class RenderContext extends h3d.impl.RenderContext {
 	public inline function emit( mat : h3d.mat.Material, obj, index = 0 ) {
 		var p = mat.mainPass;
 		while( p != null ) {
-			emitPass(p, obj).index = index;
+			if ( !p.culled )
+				emitPass(p, obj).index = index;
 			p = p.nextPass;
 		}
 	}