Browse Source

added global.time for 2d context

ncannasse 10 năm trước cách đây
mục cha
commit
e52f14242c
2 tập tin đã thay đổi với 2 bổ sung0 xóa
  1. 1 0
      h2d/RenderContext.hx
  2. 1 0
      h3d/shader/Base2d.hx

+ 1 - 0
h2d/RenderContext.hx

@@ -61,6 +61,7 @@ class RenderContext extends h3d.impl.RenderContext {
 		curY = 0;
 		curY = 0;
 		curWidth = s2d.width;
 		curWidth = s2d.width;
 		curHeight = s2d.height;
 		curHeight = s2d.height;
+		manager.globals.set("time", time);
 		// todo : we might prefer to auto-detect this by running a test and capturing its output
 		// todo : we might prefer to auto-detect this by running a test and capturing its output
 		baseShader.pixelAlign = #if flash true #else false #end;
 		baseShader.pixelAlign = #if flash true #else false #end;
 		baseShader.halfPixelInverse.set(0.5 / engine.width, 0.5 / engine.height);
 		baseShader.halfPixelInverse.set(0.5 / engine.width, 0.5 / engine.height);

+ 1 - 0
h3d/shader/Base2d.hx

@@ -15,6 +15,7 @@ class Base2d extends hxsl.Shader {
 			var color : Vec4;
 			var color : Vec4;
 		};
 		};
 
 
+		@global var time : Float;
 		@param var zValue : Float;
 		@param var zValue : Float;
 		@param var texture : Sampler2D;
 		@param var texture : Sampler2D;