Ejemplo n.º 1
0
        public void Compile(ProgramGraph graph, CompilerOutputInfo info)
        {
            if (!(info is ShaderOutputInfo))
            {
                return;
            }
            ShaderOutputInfo outputInfo = info as ShaderOutputInfo;

            RegisterDict = new Dictionary <string, int>();
            for (int i = 0; i < graph.getMaxDepth(); i++)
            {
                foreach (Vertex v in graph.getVerticesForLayer(i))
                {
                    foreach (NodeItem outputItem in v.Data.Items.Where(item => item.Output.Enabled))
                    {
                        if (outputItem.OutputData is ShaderTypes.sampler2D)
                        {
                            ShaderTypes.sampler2D Sampler = (ShaderTypes.sampler2D)outputItem.OutputData;
                            if (!RegisterDict.ContainsKey(Sampler.path))
                            {
                                RegisterDict.Add(Sampler.path, RegisterDict.Count);
                            }
                        }
                    }
                }
            }
            mCompiler = new HLSLCompiler(new Dictionary <object, string>(), RegisterDict);
            WritePostFxScript(outputInfo);
            if (mCompiler == null)
            {
                return;
            }
            mCompiler.Compile(graph, outputInfo);
        }
Ejemplo n.º 2
0
        public Node CreateNode()
        {
            Node textureNode = new Node(GetNodeName());

            NodeItem imageItem = new Graph.Items.NodeImageItem(Properties.Resources.DefaultImage, 64, 64, false, true, null, new[] { typeof(ShaderTypes.sampler2D) })
            {
                Tag = "out"
            };

            textureNode.AddItem(imageItem);

            ShaderTypes.sampler2D sampler = new ShaderTypes.sampler2D();
            sampler.path         = "./DefaultImage.png";
            imageItem.OutputData = sampler;
            SetImage(textureNode, sampler.path);

            textureNode.ParentModule = this;

            return(textureNode);
        }