Inheritance: UnityEditor.Rendering.BuiltIn.ShaderGraph.BuiltInBaseShaderGUI
Ejemplo n.º 1
0
        public override void ProcessPreviewMaterial(Material material)
        {
            if (target.allowMaterialOverride)
            {
                // copy our target's default settings into the material
                // (technically not necessary since we are always recreating the material from the shader each time,
                // which will pull over the defaults from the shader definition)
                // but if that ever changes, this will ensure the defaults are set
                material.SetFloat(Property.Surface(), (float)target.surfaceType);
                material.SetFloat(Property.Blend(), (float)target.alphaMode);
                material.SetFloat(Property.AlphaClip(), target.alphaClip ? 1.0f : 0.0f);
                material.SetFloat(Property.Cull(), (int)target.renderFace);
                material.SetFloat(Property.ZWriteControl(), (float)target.zWriteControl);
                material.SetFloat(Property.ZTest(), (float)target.zTestMode);
            }

            // We always need these properties regardless of whether the material is allowed to override
            // Queue control & offset enable correct automatic render queue behavior
            // Control == 0 is automatic, 1 is user-specified render queue
            material.SetFloat(Property.QueueOffset(), 0.0f);
            material.SetFloat(Property.QueueControl(), (float)BuiltInBaseShaderGUI.QueueControl.Auto);

            // call the full unlit material setup function
            BuiltInUnlitGUI.UpdateMaterial(material);
        }
Ejemplo n.º 2
0
        public override void ProcessPreviewMaterial(Material material)
        {
            // copy our target's default settings into the material
            // (technically not necessary since we are always recreating the material from the shader each time,
            // which will pull over the defaults from the shader definition)
            // but if that ever changes, this will ensure the defaults are set
            material.SetFloat(Property.Surface(), (float)target.surfaceType);
            material.SetFloat(Property.Blend(), (float)target.alphaMode);
            material.SetFloat(Property.AlphaClip(), target.alphaClip ? 1.0f : 0.0f);
            material.SetFloat(Property.Cull(), (int)target.renderFace);
            material.SetFloat(Property.ZWriteControl(), (float)target.zWriteControl);
            material.SetFloat(Property.ZTest(), (float)target.zTestMode);

            // call the full unlit material setup function
            BuiltInUnlitGUI.UpdateMaterial(material);
        }