浏览代码

added alphaMapScroll

ncannasse 11 年之前
父节点
当前提交
4bdc6caf8c
共有 1 个文件被更改,包括 2 次插入1 次删除
  1. 2 1
      h3d/mat/MeshMaterial.hx

+ 2 - 1
h3d/mat/MeshMaterial.hx

@@ -52,6 +52,7 @@ private class MeshShader extends h3d.impl.Shader {
 		var hasZBias : Bool;
 		var hasZBias : Bool;
 		
 		
 		var alphaMap : Texture;
 		var alphaMap : Texture;
+		var alphaMapScroll : Float2;
 		var hasAlphaMap : Bool;
 		var hasAlphaMap : Bool;
 		
 		
 		var lightSystem : Param < {
 		var lightSystem : Param < {
@@ -196,7 +197,7 @@ private class MeshShader extends h3d.impl.Shader {
 			} else {
 			} else {
 				var c = tex.get(tuv.xy,type=isDXT1 ? 1 : isDXT5 ? 2 : 0);
 				var c = tex.get(tuv.xy,type=isDXT1 ? 1 : isDXT5 ? 2 : 0);
 				if( fog != null ) c.a *= talpha;
 				if( fog != null ) c.a *= talpha;
-				if( hasAlphaMap ) c.a *= alphaMap.get(tuv.xy,type=isDXT1 ? 1 : isDXT5 ? 2 : 0).b;
+				if( hasAlphaMap ) c.a *= alphaMap.get(alphaMapScroll != null ? tuv + alphaMapScroll : tuv.xy,type=isDXT1 ? 1 : isDXT5 ? 2 : 0).b;
 				if( killAlpha ) kill(c.a - killAlphaThreshold);
 				if( killAlpha ) kill(c.a - killAlphaThreshold);
 				if( hasBlend ) c.rgb = c.rgb * (1 - tblend) + tblend * blendTexture.get(tuv.xy,type=isDXT1 ? 1 : isDXT5 ? 2 : 0).rgb;
 				if( hasBlend ) c.rgb = c.rgb * (1 - tblend) + tblend * blendTexture.get(tuv.xy,type=isDXT1 ? 1 : isDXT5 ? 2 : 0).rgb;
 				if( colorAdd != null ) c += colorAdd;
 				if( colorAdd != null ) c += colorAdd;