예제 #1
0
        // Update the hidden properties based on the exposed ones.
        void UpdateHiddenProperties(Material material)
        {
            // Color balance
            var temp = material.GetFloat("_Temperature");
            var tint = material.GetFloat("_Tint");

            material.SetVector("_ColorBalance", ProcAmp.CalculateColorBalance(temp, tint));

            // Key color
            var ycgco = ProcAmp.RGB2YCgCo(material.GetColor("_KeyColor"));

            material.SetVector("_KeyCgCo", new Vector2(ycgco.y, ycgco.z));

            // Trimming
            var trim = material.GetVector("_Trim");

            material.SetVector("_TrimParams", new Vector4(
                                   trim.x, trim.w, 1 / (1 - trim.x - trim.z), 1 / (1 - trim.y - trim.w)
                                   ));

            if (material.GetFloat("_Opacity") == 1 && material.GetFloat("_Keying") == 0)
            {
                // Opaque
                material.SetInt("_SrcBlend", (int)BlendMode.One);
                material.SetInt("_DstBlend", (int)BlendMode.Zero);
                material.SetInt("_ZWrite", 1);
                material.SetOverrideTag("RenderType", "");
                material.renderQueue = -1;
            }
            else
            {
                // Transparent
                material.SetInt("_SrcBlend", (int)BlendMode.SrcAlpha);
                material.SetInt("_DstBlend", (int)BlendMode.OneMinusSrcAlpha);
                material.SetInt("_ZWrite", 0);
                material.SetOverrideTag("RenderType", "Transparent");
                material.renderQueue = (int)RenderQueue.Transparent;
            }
        }
 private void Start()
 {
     pa            = GetComponent <ProcAmp>();
     isInDebugMode = pa.isInDebugMode;
 }