Răsfoiți Sursa

Added depth input to shadergraph

Clement Espeute 1 an în urmă
părinte
comite
6cd26d3c9d
2 a modificat fișierele cu 5 adăugiri și 0 ștergeri
  1. 2 0
      hide/view/shadereditor/ShaderEditor.hx
  2. 3 0
      hrt/shgraph/ShaderInput.hx

+ 2 - 0
hide/view/shadereditor/ShaderEditor.hx

@@ -44,9 +44,11 @@ class PreviewShaderBase extends hxsl.Shader {
 		var projectedPosition : Vec4;
 		var transformedNormal : Vec3;
 		var fakeNormal : Vec3;
+		var depth : Float;
 
 
 		function __init__() {
+			depth = 0.0;
 			relativePosition = vec3(input.position, 0.0);
 			transformedPosition = vec3(input.position, 0.0);
 			projectedPosition = vec4(input.position, 0.0, 0.0);

+ 3 - 0
hrt/shgraph/ShaderInput.hx

@@ -132,10 +132,13 @@ class ShaderInput extends ShaderNode {
 		"projectedPosition" => {display: "Position (View Space)", v: { parent: null, id: 0, kind: Local, name: "projectedPosition", type: TVec(4, VFloat) }},
 		"normal" => {display: "Normal (Object Space)", v: { parent: null, id: 0, kind: Local, name: "input.normal", type: TVec(3, VFloat) }},
 		"transformedNormal" => {display: "Normal (World Space)", v: { parent: null, id: 0, kind: Local, name: "transformedNormal", type: TVec(3, VFloat) }},
+		"depth" => {display: "Depth", v: {parent: null, id: 0, kind: Local, name: "depth", type: TFloat}},
+
 		"metalness" => {display: "Metalness", v: {parent: null,id: 0,kind: Local,name: "metalness",type: TFloat}},
 		"roughness" => {display: "Roughness", v: {parent: null, id: 0, kind: Local, name: "roughness", type: TFloat}},
 		"emissive" => {display: "Emissive", v: {parent: null, id: 0, kind: Local, name: "emissive", type: TFloat}},
 		"occlusion" => {display: "Occlusion", v: {parent: null, id: 0, kind: Local, name: "occlusion", type: TFloat}},
+
 		// "position" => {display: "Source Position", v: { parent: null, id: 0, kind: Input, name: "input.position", type: TVec(3, VFloat) }},
 		// "color" => 	{display: "Source Vertex Color", v: { parent: null, id: 0, kind: Input, name: "input.color", type: TVec(3, VFloat) }},
 		"uv" => {display: "Source UV", v: { parent: null, id: 0, kind: Input, name: "input.uv", type: TVec(2, VFloat) }},