Browse Source

Please use invert node for now to match Blender behavior

Lubos Lenco 4 years ago
parent
commit
64097868cf
2 changed files with 3 additions and 15 deletions
  1. 3 9
      Sources/arm/shader/MaterialParser.hx
  2. 0 6
      Sources/arm/shader/NodesMaterial.hx

+ 3 - 9
Sources/arm/shader/MaterialParser.hx

@@ -495,8 +495,7 @@ class MaterialParser {
 			var tex = make_texture(node, tex_name);
 			if (tex != null) {
 				var color_space = node.buttons[1].default_value;
-				var invert_color = node.buttons[2].default_value == true;
-				var texstore = texture_store(node, tex, tex_name, color_space, invert_color);
+				var texstore = texture_store(node, tex, tex_name, color_space);
 				return '$texstore.rgb';
 			}
 			else {
@@ -1307,8 +1306,7 @@ class MaterialParser {
 			var tex = make_texture(node, tex_name);
 			if (tex != null) {
 				var color_space = node.buttons[1].default_value;
-				var invert_color = node.buttons[2].default_value == true;
-				var texstore = texture_store(node, tex, tex_name, color_space, invert_color);
+				var texstore = texture_store(node, tex, tex_name, color_space);
 				return '$texstore.a';
 			}
 		}
@@ -1678,7 +1676,7 @@ class MaterialParser {
 		return node_name(node) + "_store";
 	}
 
-	static function texture_store(node: TNode, tex: TBindTexture, tex_name: String, color_space : Int, invert_color = false): String {
+	static function texture_store(node: TNode, tex: TBindTexture, tex_name: String, color_space : Int): String {
 		matcon.bind_textures.push(tex);
 		curshader.context.add_elem("tex", "short2norm");
 		curshader.add_uniform("sampler2D " + tex_name);
@@ -1727,10 +1725,6 @@ class MaterialParser {
 		else if (color_space == 2) { // DirectX normal map to OpenGL normal map
 		    curshader.write('$tex_store.y = 1.0 - $tex_store.y;');
 		}
-
-		if (invert_color) {
-			curshader.write('$tex_store.rgb = 1.0 - $tex_store.rgb;');
-		}
 		return tex_store;
 	}
 

+ 0 - 6
Sources/arm/shader/NodesMaterial.hx

@@ -1252,12 +1252,6 @@ class NodesMaterial {
 						type: "ENUM",
 						default_value: 0,
 						data: [_tr("Linear"), _tr("sRGB"), _tr("DirectX Normal Map")]
-					},
-					{
-						name: _tr("Invert Color"),
-						type: "BOOL",
-						default_value: false,
-						output: 0
 					}
 				]
 			},