Example #1
0
        public static TreeNode GetAllTypeNode()
        {
            TypesB1Node nodeType = new TypesB1Node();

            nodeType.Text = nodeType.KNXMainNumber + "." + nodeType.KNXSubNumber + " " + nodeType.Name;

            nodeType.Nodes.Add(SwitchNode.GetTypeNode());
            nodeType.Nodes.Add(BoolNode.GetTypeNoe());
            nodeType.Nodes.Add(EnableNode.GetTypeNode());
            nodeType.Nodes.Add(RampNode.GetTypeNode());
            nodeType.Nodes.Add(AlarmNode.GetTypeNode());
            nodeType.Nodes.Add(BinaryValueNode.GetTypeNode());
            nodeType.Nodes.Add(StepNode.GetTypeNode());
            nodeType.Nodes.Add(UpDownNode.GetTypeNode());
            nodeType.Nodes.Add(OpenCloseNode.GetTypeNode());
            nodeType.Nodes.Add(StartNode.GetTypeNode());
            nodeType.Nodes.Add(StateNode.GetTypeNode());
            nodeType.Nodes.Add(InvertNode.GetTypeNode());
            nodeType.Nodes.Add(DimSendStyleNode.GetTypeNode());
            nodeType.Nodes.Add(InputSourceNode.GetTypeNode());
            nodeType.Nodes.Add(ResetNode.GetTypeNode());
            nodeType.Nodes.Add(AckNode.GetTypeNode());
            nodeType.Nodes.Add(TriggerNode.GetTypeNode());
            nodeType.Nodes.Add(OccupancyNode.GetTypeNode());
            nodeType.Nodes.Add(WindowDoorNode.GetTypeNode());
            nodeType.Nodes.Add(LogicalFunctionNode.GetTypeNode());
            nodeType.Nodes.Add(SceneABNode.GetTypeNode());
            nodeType.Nodes.Add(ShutterBlindsModeNode.GetTypeNode());
            nodeType.Nodes.Add(HeatCoolNode.GetTypeNode());

            return(nodeType);
        }
Example #2
0
    void AddInvertNode()
    {
        BaseNode pn = new InvertNode();

        pn.name = "new Invert Node";

        nodeList.Add(pn);
        Repaint();
    }
Example #3
0
        public override NodeViewModel CreateModel()
        {
            ModifierNode result = null;

            switch (modifyType)
            {
            case ModifyType.Abs:
                result = new AbsNode();
                break;

            case ModifyType.Clamp:
                var clampNode = new ClampNode();
                (clampNode.Lower.Editor as FloatEditorViewModel).Value = lower;
                (clampNode.Upper.Editor as FloatEditorViewModel).Value = upper;
                result = clampNode;
                break;

            case ModifyType.Exponent:
                var exponentNode = new ExponentNode();
                (exponentNode.Exponent.Editor as FloatEditorViewModel).Value = exponent;
                result = exponentNode;
                break;

            case ModifyType.Invert:
                result = new InvertNode();
                break;

            case ModifyType.ScaleBias:
                var scaleBiasNode = new ScaleBiasNode();
                (scaleBiasNode.Scale.Editor as FloatEditorViewModel).Value = scale;
                (scaleBiasNode.Bias.Editor as FloatEditorViewModel).Value  = bias;
                result = scaleBiasNode;
                break;

            case ModifyType.Scale2d:
                var scale2dNode = new Scale2DNode();
                (scale2dNode.Scale2d.Editor as ValueEditorViewModel <Vector2>).Value = scale2d;
                result = scale2dNode;
                break;

            case ModifyType.Curve:
                result = new CurveNode();
                // TODO
                break;

            case ModifyType.Terrace:
                result = new TerraceNode();
                // TODO
                break;
            }

            result.Name     = name;
            result.Position = pos;

            return(result);
        }
Example #4
0
        public void test_failure()
        {
            var testNode = new InvertNode(
                "testNode",
                failureNode.Object);

            Assert.AreEqual(testNode.Execute(bContext.Object), true);

            failureNode.Verify(x => x.Execute(bContext.Object));
        }
Example #5
0
        public void test_success()
        {
            var testNode = new InvertNode(
                "testNode",
                successNode.Object);

            Assert.AreEqual(testNode.Execute(bContext.Object), false);

            successNode.Verify(x => x.Execute(bContext.Object));
        }
Example #6
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
            };
        }