Пример #1
0
        void AddPreview(INode node)
        {
            var shaderData = new PreviewShaderData
            {
                node   = node,
                shader = m_UberShader
            };
            var renderData = new PreviewRenderData
            {
                shaderData    = shaderData,
                renderTexture = new RenderTexture(200, 200, 16, RenderTextureFormat.ARGB32, RenderTextureReadWrite.Default)
                {
                    hideFlags = HideFlags.HideAndDontSave
                },
            };

            renderData.renderTexture.Create();
            Set(m_Identifiers, node.tempId, node.tempId);
            Set(m_RenderDatas, node.tempId, renderData);
            node.RegisterCallback(OnNodeModified);

            var isMaster = node is IMasterNode;

            if (masterRenderData.shaderData == null &&
                (isMaster || node is SubGraphOutputNode))
            {
                masterRenderData.shaderData = shaderData;
                // If it's actually the master, clear the shader since it will be assigned
                // later. SubGraphOutputNode still needs the UberShader.
                if (isMaster)
                {
                    masterRenderData.shaderData.shader = null;
                }
            }

            m_NeedShaderUpdate = true;
        }
Пример #2
0
 void OnNodeModified(INode node, ModificationScope scope)
 {
     m_NeedShaderUpdate |= (scope == ModificationScope.Topological || scope == ModificationScope.Graph);
 }