瀏覽代碼

AnimatedTexture: fix float precision issues causing glitches on WebGL

trethaller 4 年之前
父節點
當前提交
a51738fdfc
共有 1 個文件被更改,包括 1 次插入1 次删除
  1. 1 1
      h3d/shader/AnimatedTexture.hx

+ 1 - 1
h3d/shader/AnimatedTexture.hx

@@ -32,7 +32,7 @@ class AnimatedTexture extends hxsl.Shader {
 		function vertex() {
 			var frame = (global.time - startTime) * speed + float(int(startFrame));
 			blendFactor = frame.fract();
-			frame -= blendFactor;
+			frame = floor(frame);
 			if( loop ) frame %= totalFrames else frame = min(frame, totalFrames - 1);
 			var nextFrame = if( loop ) (frame + 1) % totalFrames else min(frame + 1, totalFrames - 1);