Esempio n. 1
0
            public bool VisitCastNode(CastNode node, CompilationState state)
            {
                var casting = true;

                switch (node.DataType)
                {
                case DataValueType.String:
                    state.Write("tostring");
                    break;

                case DataValueType.Integer:
                case DataValueType.Float:
                    state.Write("tonumber");
                    break;

                case DataValueType.Boolean:
                    return(BooleanCasting(state, node.Argument));

                default:
                    casting = false;
                    break;
                }

                if (casting)
                {
                    state.Write("(");
                }
                node.Argument.AcceptVisitor(this, state);
                if (casting)
                {
                    state.Write(")");
                }

                return(true);
            }
Esempio n. 2
0
        public ShapeVS()
        {
            Name             = "ShapeVS";
            Type             = ShaderType.Vertex;
            FeatureLevel     = FeatureLevel.VS_4_0_Level_9_1;
            KeyPart          = new TechniqueKey(vs: VertexShaderFlags.Position | VertexShaderFlags.Color);
            EnableSeparators = true;
            InputStruct      = Struct.VertexPositionColor;
            OutputStruct     = VSOut;

            ConstantBuffer cbScene    = CBPerFrame;
            ConstantBuffer cbInstance = CBPerInstance;

            Add(cbScene);
            Add(cbInstance);

            var nPosV3toV4 = CastNode.PositionV3toV4(InputStruct[Param.SemanticVariables.Position]);
            var mulPosWVP  = new MatrixMultiplyNode
            {
                Input1 = nPosV3toV4,
                Input2 = MatrixMultiplyNode.WorldViewProjection,
            };

            CustomOutputNode outputNode = new CustomOutputNode()
            {
                Output = OutputStruct
            };

            outputNode.RegisterField(Vector.ClipPosition, mulPosWVP, Shaders.Type.Float4);
            outputNode.RegisterField(Vector.Color, new ReferenceNode {
                Value = InputStruct[Param.SemanticVariables.Color]
            }, Shaders.Type.Float4);

            Result = outputNode;
        }
 public AstNode VisitCast(CastNode n)
 {
     Append("(");
     Visit(n.Type);
     Append(")");
     Visit(n.Right);
     return(n);
 }
Esempio n. 4
0
        private void InsertCastNode(CommonTree parent, int index, TypeInfo type)
        {
            CastNode newNode = new CastNode(new CommonToken(-1, "Cast"));

            newNode.Type = type;

            ReplaceNode(parent, index, newNode);
        }
Esempio n. 5
0
        private TypeInfo Visit(CastNode node, MethodBuilder builder, CodegenContext context)
        {
            var res = Visit(node.Expression as dynamic, builder, context);

            var convType = node.Type as SimpleType;

            builder.Convert(convType.SType);

            return(convType);
        }
Esempio n. 6
0
        protected Node WHILE()
        {
            Accept(TT.TT_IdentWHILE);

            //Entscheidungs Node
            Node decNode = Addition();

            if (decNode == null)
            {
#warning Script Implement Error Handling
                Console.WriteLine("Error - 27");
                return(null);
            }
            if (!decNode.IsContentNode)
            {
#warning Script Implement Error Handling
                Console.WriteLine("Error - 28");
                return(null);
            }
            ContentNode <bool> dec;
            if (decNode.ContentType == typeof(bool))
            {
                dec = (ContentNode <bool>)decNode;
            }
            else
            {
                if (decNode.ContentType == typeof(int))
                {
                    dec = new CastNode <bool, int>((ContentNode <int>)decNode);
                }
                else if (decNode.ContentType == typeof(double))
                {
                    dec = new CastNode <bool, double>((ContentNode <double>)decNode);
                }
                else
                {
                    dec = new CastNode <bool, string>((ContentNode <string>)decNode);
                }
            }

            Accept(TT.TT_ParenRight);
            Accept(TT.TT_BlockBegin);
            List <Node> nodes = new List <Node>();
            while (Current.TokenType != TT.TT_BlockEnd)
            {
                Node n = Input();
                if (n != null)
                {
                    nodes.Add(n);
                }
            }
            Accept(TT.TT_BlockEnd);

            return(new WHILENode(dec, nodes));
        }
Esempio n. 7
0
 public void Visit(CastNode node)
 {
     visitor.OnVisit((n, v) =>
     {
         var r = n as CastNode;
         if (r != null && r.GetCastType() == node.GetCastType())
         {
             Result = IsSameChildren(r, node);
         }
     });
     reference.Visit(visitor);
 }
        /// <summary>
        /// create a new Casting node
        /// </summary>
        /// <param name="graph"></param>
        /// <param name="input"></param>
        /// <param name="output"></param>
        /// <param name="pos"></param>
        /// <returns></returns>
        public static NodeBase CreateNode(NodeGraph graph, VarType input, VarType output, Vector2 pos)
        {
            CastNode res = null;

            if (graph != null)
            {
                res = ScriptableObject.CreateInstance <CastNode>();
                res.Initialize();
                res.Construct(input, output);
                InitNode(res, graph, pos);
            }
            return(res);
        }
Esempio n. 9
0
        public SkyboxVS()
        {
            Name             = "SkyboxVS";
            Type             = ShaderType.Vertex;
            KeyPart          = new TechniqueKey(vs: VertexShaderFlags.Position | VertexShaderFlags.Normal | VertexShaderFlags.TextureUVW);
            FeatureLevel     = FeatureLevel.VS_4_0_Level_9_1;
            EnableSeparators = true;
            InputStruct      = Struct.VertexPositionNormalTextureUVW;
            OutputStruct     = VSOutput;

            Add(CBStatic);
            Add(Structs.ConstantBuffer.CBPerFrame);

            IVariable position = InputStruct[Param.SemanticVariables.ObjectPosition];
            IVariable texture  = InputStruct[Param.SemanticVariables.Texture];

            CastNode nV3toV4 = new CastNode
            {
                Input = new SwizzleNode {
                    Input = new ReferenceNode {
                        Value = position
                    }, Swizzle = new[] { Swizzle.X, Swizzle.Y, Swizzle.Z, Swizzle.Null }
                },
                Output = new Vector {
                    Type = Shaders.Type.Float4, Name = "vPosition"
                },
                Mask      = new[] { "0", "0", "0", "1" },
                IsVerbose = true
            };

            MatrixMultiplyNode mulPosWVP = new MatrixMultiplyNode
            {
                Input1 = nV3toV4,
                Input2 = MatrixMultiplyNode.WorldViewProjection,
                Output = new Vector {
                    Type = Shaders.Type.Float4, Name = "vSkyBoxPosition",
                },
            };

            Result = new PhongVSOutputNode
            {
                Position = new SwizzleNode {
                    Input = mulPosWVP, Swizzle = new[] { Swizzle.X, Swizzle.Y, Swizzle.W, Swizzle.W }
                },
                Texture = new ReferenceNode {
                    Value = texture
                },
                Output = OutputStruct
            };
        }
Esempio n. 10
0
        protected Node IdentCast()
        {
            string name = ((TokenWithContent <string>)Current).Content;

            Accept(TT.TT_IdentCast);

            Node a = Addition();

            if (a == null)
            {
#warning Script Implement Error Handling
                Console.WriteLine("Error - 15");
                return(null);
            }
            if (!a.IsContentNode)
            {
#warning Script Implement Error Handling
                Console.WriteLine("Error - 16");
                return(null);
            }

            Node con = null;
            switch (name)
            {
            case "INT":
                if (a.ContentType == typeof(double))
                {
                    con = new CastNode <int, double>((ContentNode <double>)a);
                }
                else
                {
                    //Int muss nicht auf int gecastet werden
                    con = a;
                }
                break;

            case "DOUBLE":
                if (a.ContentType == typeof(int))
                {
                    con = new CastNode <double, int>((ContentNode <int>)a);
                }
                else
                {
                    con = a;
                }
                break;
            }
            Accept(TT.TT_ParenRight);
            return(con);
        }
Esempio n. 11
0
        private ValInfo Visit(CastNode node)
        {
            ValInfo val = Visit(node.Expression);

            var type = node.Type as SimpleType;

            if (val == null)
            {
                return(null);
            }

            if (val.isConst && type != null)
            {
                object obj = null;

                switch (type.SType)
                {
                case SimpleTypeEnum.Bool:
                    obj = (bool)val.val;
                    break;

                case SimpleTypeEnum.Byte:
                    obj = (byte)val.val;
                    break;

                case SimpleTypeEnum.Char:
                    obj = (char)val.val;
                    break;

                case SimpleTypeEnum.Int:
                    obj = (int)val.val;
                    break;

                case SimpleTypeEnum.Float:
                    obj = (float)val.val;
                    break;

                case SimpleTypeEnum.Double:
                    obj = (double)val.val;
                    break;

                default:
                    throw new ArgumentOutOfRangeException();
                }

                return(new ValInfo(obj, type.SType, true));
            }

            return(new ValInfo());
        }
Esempio n. 12
0
        public void Visit(CastNode node)
        {
            var paren = node.GetPrecedence() < node.GetValue().GetPrecedence() || node.GetValue() is CastNode;

            if (paren)
            {
                source.Append("(");
            }
            node.GetValue().Visit(this);
            if (paren)
            {
                source.Append(")");
            }
            source.Append(" as " + node.GetCastType().Identifier);
        }
Esempio n. 13
0
        private TypeDescriptor Visit(CastNode node, Context context)
        {
            var expType     = Visit(node.Expression as dynamic, context);
            var convertType = context.GetType(node.TypeNode.TypeName);

            if (!TypeInfo.IsNumeric(expType.Type) || !TypeInfo.IsNumeric(convertType))
            {
                Log(
                    "Явное преобразование может применяться только для числовых типов",
                    node);

                return(TypeDescriptor.Undefined);
            }

            node.Type = convertType;

            return(new TypeDescriptor(false, convertType));
        }
        public SymConst Visit(CastNode node)
        {
            var castingConst = node.Expr.Accept(this);

            // Explicit casts are currently not allowed in const expr. The only available implicit cast is int -> double.
            switch (node.Type)
            {
            case SymDouble s:
                switch (castingConst)
                {
                case SymIntConst intConst:
                    return(new SymDoubleConst(intConst.Name, _symStack.SymDouble, intConst.Value, SymVarOrConst.SymLocTypeEnum.Global));

                case SymDoubleConst doubleConst:
                    return(castingConst);
                }
                break;
            }
            throw EvalException();
        }
            public bool VisitCastNode(CastNode node, CompilationState state)
            {
                switch (node.DataType)
                {
                case DataValueType.String:
                    state.Write("tostring");
                    break;

                case DataValueType.Integer:
                case DataValueType.Float:
                    state.Write("tonumber");
                    break;

                default: throw new LuaCompilationException($"Unsupported cast to '{node.DataType}'");
                }

                state.Write("(");
                node.Argument.AcceptVisitor(this, state);
                state.Write(")");

                return(true);
            }
 protected virtual void StripCast(CastNode node, HashSet <QueryMethod> additionalQueryMethods)
 {
     additionalQueryMethods.Add(new CastMethod(node.TargetType));
 }
Esempio n. 17
0
        public WireframeVS()
        {
            Name             = "WireframeVS";
            Type             = ShaderType.Vertex;
            KeyPart          = new TechniqueKey(vs: VertexShaderFlags.Position | VertexShaderFlags.Normal | VertexShaderFlags.TextureUV | VertexShaderFlags.Barycentric);
            FeatureLevel     = FeatureLevel.VS_4_0_Level_9_1;
            EnableSeparators = true;
            InputStruct      = VertexPositionNormalBarycentric;
            OutputStruct     = VertexPositionTextureIntensityBarycentricOut;

            ConstantBuffer cbFrame    = CBPerFrame;
            ConstantBuffer cbInstance = CBPerInstance;

            Add(cbFrame);
            Add(cbInstance);

            IVariable position       = InputStruct[Param.SemanticVariables.ObjectPosition];
            IVariable lightDirection = cbFrame[Param.Vectors.LightDirection];
            IVariable normal         = InputStruct[Param.SemanticVariables.Normal];
            IVariable texture        = InputStruct[Param.SemanticVariables.Texture];
            IVariable barycentric    = InputStruct[Param.SemanticVariables.Barycentric];

            CastNode nV3toV4 = new CastNode
            {
                Input = new SwizzleNode {
                    Input = new ReferenceNode {
                        Value = position
                    }, Swizzle = new[] { Swizzle.X, Swizzle.Y, Swizzle.Z, Swizzle.Null }
                },
                Output = new Vector {
                    Type = Shaders.Type.Float4, Name = "vPosition"
                },
                Mask      = new[] { "0", "0", "0", "1" },
                IsVerbose = true
            };

            MatrixMultiplyNode mulPosWVP = new MatrixMultiplyNode
            {
                Input1 = nV3toV4,
                Input2 = MatrixMultiplyNode.WorldViewProjection,
                Output = new Vector()
                {
                    Type = Shaders.Type.Float4, Name = "vClipPosition"
                },
                IsVerbose = true
            };

            MultiplyNode perspectiveCorrection = new MultiplyNode()
            {
                Input1 = new ReferenceNode()
                {
                    Value = barycentric
                },
                Input2 = new SwizzleNode()
                {
                    Input   = mulPosWVP,
                    Swizzle = new Swizzle[] { Swizzle.W, }
                }
            };

            BinaryFunctionNode dotLightNormal = new BinaryFunctionNode
            {
                Input1 = new ReferenceNode {
                    Value = lightDirection
                },
                Input2 = new ReferenceNode {
                    Value = normal
                },
                Function = HlslIntrinsics.Dot
            };

            BinaryFunctionNode maxIntensity = new BinaryFunctionNode
            {
                Input1 = dotLightNormal,
                Input2 = new ScalarNode()
                {
                    Value = 0.3f
                },
                Function = HlslIntrinsics.Max
            };

            CustomOutputNode outputNode = new CustomOutputNode()
            {
                Output = OutputStruct
            };

            outputNode.RegisterField(Vector.ClipPosition, mulPosWVP, Shaders.Type.Float4);
            outputNode.RegisterField(Param.SemanticVariables.Intensity, Semantics.Intensity, maxIntensity, Shaders.Type.Float3);
            outputNode.RegisterField(Vector.TextureUV, new ReferenceNode {
                Value = texture
            }, Shaders.Type.Float2);
            outputNode.RegisterField(Param.SemanticVariables.Barycentric, Semantics.Barycentric, perspectiveCorrection, Shaders.Type.Float3);

            Result = outputNode;
        }
 protected virtual QueryNode VisitCast(CastNode node, AzureQueryOptimizerState state)
 {
     return((QueryNode) new CastNode(this.Visit(node.SourceNode, state), node.TargetType));
 }
Esempio n. 19
0
        protected Node FOR()
        {
            Accept(TT.TT_IdentFOR);

            //Init Node
            Node init = VariableAssignment();

            if (init == null)
            {
#warning Script Implement Error Handling
                Console.WriteLine("Error - 21");
                return(null);
            }
            Accept(TT.TT_Semicolon);

            //Entscheidungs Node
            Node decNode = Addition();
            if (decNode == null)
            {
#warning Script Implement Error Handling
                Console.WriteLine("Error - 22");
                return(null);
            }
            if (!decNode.IsContentNode)
            {
#warning Script Implement Error Handling
                Console.WriteLine("Error - 23");
                return(null);
            }
            ContentNode <bool> dec;
            if (decNode.ContentType == typeof(bool))
            {
                dec = (ContentNode <bool>)decNode;
            }
            else
            {
                if (decNode.ContentType == typeof(int))
                {
                    dec = new CastNode <bool, int>((ContentNode <int>)decNode);
                }
                else if (decNode.ContentType == typeof(double))
                {
                    dec = new CastNode <bool, double>((ContentNode <double>)decNode);
                }
                else
                {
                    dec = new CastNode <bool, string>((ContentNode <string>)decNode);
                }
            }
            Accept(TT.TT_Semicolon);

            //Iter Node
            Node iter = VariableAssignment();
            if (iter == null)
            {
#warning Script Implement Error Handling
                Console.WriteLine("Error - 24");
                return(null);
            }
            Accept(TT.TT_ParenRight);
            Accept(TT.TT_BlockBegin);
            List <Node> nodes = new List <Node>();
            while (Current.TokenType != TT.TT_BlockEnd)
            {
                Node n = Input();
                if (n != null)
                {
                    nodes.Add(n);
                }
            }
            Accept(TT.TT_BlockEnd);

            return(new FORNode(init, dec, iter, nodes));
        }
Esempio n. 20
0
 public virtual AstNode VisitCast(CastNode n)
 {
     Visit(n.Type);
     Visit(n.Right);
     return(n);
 }
Esempio n. 21
0
        protected Node IF()
        {
            Accept(TT.TT_IdentIF);

            Node a = Addition();

            if (a == null)
            {
#warning Script Implement Error Handling
                Console.WriteLine("Error - 25");
                return(null);
            }
            if (!a.IsContentNode)
            {
#warning Script Implement Error Handling
                Console.WriteLine("Error - 26");
                return(null);
            }

            ContentNode <bool> dec;
            if (a.ContentType == typeof(bool))
            {
                dec = (ContentNode <bool>)a;
            }
            else
            {
                if (a.ContentType == typeof(int))
                {
                    dec = new CastNode <bool, int>((ContentNode <int>)a);
                }
                else if (a.ContentType == typeof(double))
                {
                    dec = new CastNode <bool, double>((ContentNode <double>)a);
                }
                else
                {
                    dec = null;
                }
            }

            Accept(TT.TT_ParenRight);
            Accept(TT.TT_BlockBegin);

            List <Node> ifnodes = new List <Node>();
            while (Current.TokenType != TT.TT_BlockEnd)
            {
                Node n = Input();
                if (n != null)
                {
                    ifnodes.Add(n);
                }
            }
            Accept(TT.TT_BlockEnd);

            if (Current.TokenType == TT.TT_IdentElse)
            {
                Accept(TT.TT_IdentElse);
                Accept(TT.TT_BlockBegin);
                List <Node> elsenodes = new List <Node>();
                while (Current.TokenType != TT.TT_BlockEnd)
                {
                    Node n = Input();
                    if (n != null)
                    {
                        elsenodes.Add(n);
                    }
                }
                Accept(TT.TT_BlockEnd);
                return(new IFNode(dec, ifnodes, elsenodes));
            }

            return(new IFNode(dec, ifnodes));
        }
Esempio n. 22
0
        public PhongInstanceVS()
        {
            Name             = "PhongInstanceVS";
            Type             = ShaderType.Vertex;
            KeyPart          = new TechniqueKey(vs: VertexShaderFlags.Position | VertexShaderFlags.Normal | VertexShaderFlags.TextureUV | VertexShaderFlags.InstanceWorld);
            FeatureLevel     = FeatureLevel.VS_4_0_Level_9_3;
            EnableSeparators = true;
            var instanceStruct = Struct.VertexPositionNormalTexture;

            instanceStruct.Add(Matrix.EntityInstanceWorld);

            InputStruct  = instanceStruct;
            OutputStruct = Struct.VertexPositionNormalTextureOut;

            Structs.ConstantBuffer cbFrame = ConstantBuffer.CBPerFrame;
            Add(cbFrame);

            IVariable position = InputStruct[Param.SemanticVariables.ObjectPosition];
            IVariable normal   = InputStruct[Param.SemanticVariables.Normal];
            IVariable texture  = InputStruct[Param.SemanticVariables.Texture];

            CastNode nV3toV4 = new CastNode
            {
                Input = new SwizzleNode {
                    Input = new ReferenceNode {
                        Value = position
                    }, Swizzle = new[] { Swizzle.X, Swizzle.Y, Swizzle.Z, Swizzle.Null }
                },
                Output = new Vector {
                    Type = Shaders.Type.Float4, Name = "vPosition"
                },
                Mask      = new[] { "0", "0", "0", "1" },
                IsVerbose = true
            };

            ReferenceNode mWorld = new ReferenceNode
            {
                Value  = InputStruct[Param.SemanticVariables.InstanceWorld],
                Output = new Matrix {
                    Type = Shaders.Type.Matrix, Name = "mWorld",
                },
                IsVerbose = true
            };

            MatrixMultiplyNode m1m2 = new MatrixMultiplyNode
            {
                Input1 = mWorld,
                Input2 = new ReferenceNode {
                    Value = Matrix.CameraView
                },
            };

            MatrixMultiplyNode mulWVP = new MatrixMultiplyNode
            {
                Input1 = m1m2,
                Input2 = new ReferenceNode {
                    Value = Matrix.CameraProjection
                },
                IsVerbose = true
            };

            MatrixMultiplyNode mulPosWVP = new MatrixMultiplyNode
            {
                Input1 = nV3toV4,
                Input2 = mulWVP,
            };

            MatrixMultiplyNode mulWP = new MatrixMultiplyNode
            {
                Input1 = nV3toV4,
                Input2 = mWorld,
            };

            MatrixMultiplyNode mulNormal = new MatrixMultiplyNode
            {
                Input1 = new ReferenceNode {
                    Value = normal
                },
                Input2 = CastNode.CastWorldFloat3x3((Matrix)mWorld.Output, "mWorld3x3")
            };

            Result = new PhongVSOutputNode
            {
                Position      = mulPosWVP,
                WorldPosition = mulWP,
                Normal        = mulNormal,
                Texture       = new ReferenceNode {
                    Value = texture
                },
                Output = OutputStruct
            };
        }
Esempio n. 23
0
        public PhongVS()
        {
            Name             = "PhongVS";
            Type             = ShaderType.Vertex;
            KeyPart          = new TechniqueKey(vs: VertexShaderFlags.Position | VertexShaderFlags.Normal | VertexShaderFlags.TextureUV);
            FeatureLevel     = FeatureLevel.VS_4_0_Level_9_1;
            EnableSeparators = true;
            InputStruct      = Struct.VertexPositionNormalTexture;
            OutputStruct     = Struct.VertexPositionNormalTextureOut;

            Structs.ConstantBuffer cbFrame    = ConstantBuffer.CBPerFrame;
            Structs.ConstantBuffer cbInstance = CBPerInstance;
            Add(cbFrame);
            Add(cbInstance);

            IVariable position = InputStruct[Param.SemanticVariables.ObjectPosition];
            IVariable normal   = InputStruct[Param.SemanticVariables.Normal];
            IVariable texture  = InputStruct[Param.SemanticVariables.Texture];


            CastNode nV3toV4 = new CastNode
            {
                Input = new SwizzleNode {
                    Input = new ReferenceNode {
                        Value = position
                    }, Swizzle = new[] { Swizzle.X, Swizzle.Y, Swizzle.Z, Swizzle.Null }
                },
                Output = new Vector {
                    Type = Shaders.Type.Float4, Name = "vPosition"
                },
                Mask      = new[] { "0", "0", "0", "1" },
                IsVerbose = true
            };

            MatrixMultiplyNode mulPosWVP = new MatrixMultiplyNode
            {
                Input1 = nV3toV4,
                Input2 = MatrixMultiplyNode.WorldViewProjection,
            };

            MatrixMultiplyNode mulWP = new MatrixMultiplyNode
            {
                Input1 = nV3toV4,
                Input2 = new ReferenceNode {
                    Value = Matrix.EntityWorld
                },
            };

            MatrixMultiplyNode mulNormal = new MatrixMultiplyNode
            {
                Input1 = new ReferenceNode {
                    Value = normal
                },
                Input2 = CastNode.WorldInverseTransposeFloat3x3
            };

            Result = new PhongVSOutputNode
            {
                Position      = mulPosWVP,
                WorldPosition = mulWP,
                Normal        = mulNormal,
                Texture       = new ReferenceNode {
                    Value = texture
                },
                Output = OutputStruct
            };
        }
 protected virtual QueryNode VisitCast(CastNode node, ElasticSearchQueryOptimizerState state)
 {
     return(new CastNode(Visit(node.SourceNode, state), node.TargetType));
 }
Esempio n. 25
0
        public PhongPS()
        {
            Name             = "PhongPS";
            Type             = ShaderType.Pixel;
            KeyPart          = new TechniqueKey(ps: PixelShaderFlags.Diffuse | PixelShaderFlags.Specular);
            FeatureLevel     = FeatureLevel.PS_4_0_Level_9_1;
            EnableSeparators = true;
            var input = Struct.VertexPositionNormalTextureOut;

            input.Name   = "input";
            InputStruct  = input;
            OutputStruct = Struct.PixelShaderOutput;

            Structs.ConstantBuffer cbStatic   = CBLight;
            Structs.ConstantBuffer cbFrame    = CBFrame;
            Structs.ConstantBuffer cbInstance = ConstantBuffer.CBMaterial;

            Struct pointLight = (Struct)cbStatic[Param.Struct.PointLight];
            Struct material   = (Struct)cbInstance[Param.Struct.Material];

            Add(cbStatic);
            Add(cbFrame);
            Add(cbInstance);

            CastNode vWorldPos = new CastNode
            {
                Input = new SwizzleNode {
                    Input = new ReferenceNode {
                        Value = InputStruct[Param.SemanticVariables.WorldPosition]
                    }
                    , Swizzle = new[] { Swizzle.X, Swizzle.Y, Swizzle.Z }
                },
                Output = new Vector {
                    Type = Shaders.Type.Float3, Name = "vWorldPos",
                },
                IsVerbose = true
            };

            SubtractionNode vLightDirection = new SubtractionNode
            {
                Input1 = new ReferenceNode {
                    Value = pointLight[Param.Light.Position]
                },
                Input2 = vWorldPos,
            };

            SubtractionNode vViewDirection = new SubtractionNode
            {
                Input1 = new ReferenceNode {
                    Value = cbFrame[Param.Vectors.CameraPosition]
                },
                Input2 = vWorldPos,
            };

            ReferenceNode nNormal = new ReferenceNode {
                Value = InputStruct[Param.SemanticVariables.Normal]
            };

            UnaryFunctionNode normalizeNormal = new UnaryFunctionNode
            {
                Input1   = nNormal,
                Function = HlslIntrinsics.Normalize,
                Output   = new Vector {
                    Type = nNormal.Output.Type, Name = "vNormal"
                },
                IsVerbose = true,
            };

            UnaryFunctionNode normalizeViewDirection = new UnaryFunctionNode
            {
                Input1   = vViewDirection,
                Function = HlslIntrinsics.Normalize,
                Output   = new Vector {
                    Type = vViewDirection.Output.Type, Name = "vViewDirection"
                },
                IsVerbose = true,
            };

            UnaryFunctionNode normalizeLightDirection = new UnaryFunctionNode
            {
                Input1   = vLightDirection,
                Function = HlslIntrinsics.Normalize,
                Output   = new Vector {
                    Type = vLightDirection.Output.Type, Name = "vLightDirection"
                },
                IsVerbose = true,
            };

            InvertNode vLightDirectionInv = new InvertNode
            {
                Input = normalizeLightDirection,
                //Output = new Vector { Type = Shaders.Type.Float3, Name = "vLightDirection" },
            };

            PhongLightingNode nPhongLighting = new PhongLightingNode
            {
                Light = new ReferenceNode {
                    Value = pointLight
                },
                Material = new ReferenceNode {
                    Value = material
                },
                ViewDirection  = normalizeViewDirection,
                Normal         = normalizeNormal,
                LightDirection = vLightDirectionInv,
                Specular       = true,
            };

            Result = new PSOutputNode
            {
                FinalColor = nPhongLighting,
                Output     = OutputStruct
            };
        }