Browse Source

use pixelColor for screenShader

ncannasse 7 năm trước cách đây
mục cha
commit
dd6c26ede6
2 tập tin đã thay đổi với 6 bổ sung8 xóa
  1. 1 8
      h3d/pass/Copy.hx
  2. 5 0
      h3d/shader/ScreenShader.hx

+ 1 - 8
h3d/pass/Copy.hx

@@ -4,15 +4,8 @@ private class CopyShader extends h3d.shader.ScreenShader {
 
 	static var SRC = {
 		@param var texture : Sampler2D;
-
-		var pixelColor : Vec4;
-
-		function __init__fragment() {
-			pixelColor = texture.get(calculatedUV);
-		}
-
 		function fragment() {
-			output.color = pixelColor;
+			pixelColor = texture.get(calculatedUV);
 		}
 	}
 }

+ 5 - 0
h3d/shader/ScreenShader.hx

@@ -13,8 +13,13 @@ class ScreenShader extends hxsl.Shader {
 			color : Vec4,
 		};
 
+		var pixelColor : Vec4;
 		var calculatedUV : Vec2;
 
+		function __init__() {
+			output.color = pixelColor;
+		}
+
 		function vertex() {
 			calculatedUV = input.uv;
 			output.position = vec4(input.position, 0, 1);