浏览代码

export textureColor

ncannasse 11 年之前
父节点
当前提交
72fa7c64f7
共有 1 个文件被更改,包括 7 次插入2 次删除
  1. 7 2
      h3d/shader/AnimatedTexture.hx

+ 7 - 2
h3d/shader/AnimatedTexture.hx

@@ -26,6 +26,8 @@ class AnimatedTexture extends hxsl.Shader {
 
 		@private var blendFactor : Float;
 
+		var textureColor : Vec4;
+
 		function vertex() {
 
 			var frame = (global.time - startTime) * speed;
@@ -40,9 +42,12 @@ class AnimatedTexture extends hxsl.Shader {
 			calculatedUV2 = input.uv + delta;
 		}
 
+		function __init__fragment() {
+			textureColor = mix( texture.get(calculatedUV) , texture.get(calculatedUV2), blendFactor);
+		}
+
 		function fragment() {
-			var c = mix( texture.get(calculatedUV) , texture.get(calculatedUV2), blendFactor);
-			pixelColor *= c;
+			pixelColor *= textureColor;
 		}
 
 	};