Пример #1
0
        public void GenerateBaseData(bool render3D = true)
        {
            SF_Blit.mat.SetVector("_OutputMask", Vector4.one);

            SF_Blit.currentNode = node;

            if (uniform)
            {
                BlitUniform();
                return;
            }

            if (SF_Settings.nodeRenderMode == NodeRenderMode.Viewport)
            {
                SF_Blit.RenderUsingViewport(texture, node.GetBlitShaderPath());
            }
            else
            {
                if (render3D)
                {
                    SF_Blit.RenderUsingViewport(texture, node.GetBlitShaderPath());
                }
                else
                {
                    SF_Blit.Render(texture, node.GetBlitShaderPath());
                }
            }
        }
Пример #2
0
        // When evaluating nodes, run the overridden operator from the node itself
        public void Combine(/*SF_NodePreview a, SF_NodePreview b */)
        {
            // Check if it can combine first
            if (!node.CanEvaluate())
            {
                Debug.LogError("Cannot evaluate");
                Fill(Color.black);
                return;
            }

            CompCount = node.GetEvaluatedComponentCount();

            // It can combine! Since this node is dynamic, adapt its component count
            //CompCount = Mathf.Max( a.CompCount, b.CompCount );


            uniform = node.IsUniformOutput();

            // Combine the node textures, unless we're quickloading or don't want to load them

            dataUniform = node.EvalCPU();

            SF_Blit.currentNode = node;

            //if( uniform ) {
            //BlitUniform();
            //} else {
            string shaderPath = node.GetBlitShaderPath();

            Texture[] inputTextures = node.ConnectedInputs.Select(x => x.inputCon.node.texture.GetTextureByOutputType(x.inputCon.outputChannel)).ToArray();
            string[]  inputNames    = node.ConnectedInputs.Select(x => x.strID).ToArray();
            //OutChannel[] inputChannels = node.ConnectedInputs.Select( x => x.inputCon.outputChannel ).ToArray();
            if (SF_Settings.nodeRenderMode == NodeRenderMode.Viewport)
            {
                SF_Blit.RenderUsingViewport(texture, shaderPath, inputNames, inputTextures);
            }
            else if (SF_Settings.nodeRenderMode == NodeRenderMode.Mixed)
            {
                SF_Blit.Render(texture, shaderPath, inputNames, inputTextures);
            }

            //}



            /*
             * if(!SF_Parser.quickLoad && SF_Settings.DrawNodePreviews) {
             *      for( int y = 0; y < SF_NodeData.RES; y++ ) {
             *              for( int x = 0; x < SF_NodeData.RES; x++ ) {
             *                      Color retVector = node.NodeOperator( x, y );
             *                      for( int c = 0; c < 4; c++ ) {
             *                              data[x, y, c] = retVector[c];
             *                      }
             *              }
             *      }
             * }*
             *
             * // Combine uniform
             * /*for( int i = 0; i < 4; i++ ) {
             *      dataUniform[i] = node.NodeOperator( 0, 0, i );
             * }*/
        }