Ejemplo n.º 1
0
        public void UpdateMaterial()
        {
            if (material == null)
            {
                material = SgtHelper.CreateTempMaterial("Cloudsphere (Generated)", SgtHelper.ShaderNamePrefix + "Cloudsphere");

                if (model != null)
                {
                    model.SetMaterial(material);
                }
            }

            var color = SgtHelper.Brighten(Color, Brightness);

            material.renderQueue = RenderQueue;

            material.SetColor("_Color", color);
            material.SetTexture("_MainTex", MainTex);
            material.SetTexture("_DepthTex", DepthTex);
            material.SetTexture("_LightingTex", LightingTex);

            if (Near == true)
            {
                SgtHelper.EnableKeyword("SGT_A", material);                 // Near

                material.SetTexture("_NearTex", NearTex);
                material.SetFloat("_NearScale", SgtHelper.Reciprocal(NearDistance));
            }
            else
            {
                SgtHelper.DisableKeyword("SGT_A", material);                 // Near
            }
        }
Ejemplo n.º 2
0
        public void UpdateMaterial()
        {
            renderedThisFrame = false;

            if (material == null)
            {
                material = SgtHelper.CreateTempMaterial("Cloudsphere (Generated)", SgtHelper.ShaderNamePrefix + "Cloudsphere");

                if (model != null)
                {
                    model.SetMaterial(material);
                }
            }

            var color = SgtHelper.Brighten(Color, Brightness);

            material.renderQueue = RenderQueue;

            material.SetColor(SgtShader._Color, color);
            material.SetTexture(SgtShader._CubeTex, MainTex);
            material.SetTexture(SgtShader._DepthTex, DepthTex);
            material.SetTexture(SgtShader._LightingTex, LightingTex);

            if (Near == true)
            {
                SgtHelper.EnableKeyword("SGT_A", material);                 // Near

                material.SetTexture(SgtShader._NearTex, NearTex);
                material.SetFloat(SgtShader._NearScale, SgtHelper.Reciprocal(NearDistance));
            }
            else
            {
                SgtHelper.DisableKeyword("SGT_A", material);                 // Near
            }

            if (Detail == true)
            {
                SgtHelper.EnableKeyword("SGT_B", material);                 // Detail

                material.SetTexture(SgtShader._DetailTex, DetailTex);
                material.SetFloat(SgtShader._DetailScale, DetailScale);
                material.SetFloat(SgtShader._DetailTiling, DetailTiling);
            }
            else
            {
                SgtHelper.DisableKeyword("SGT_B", material);                 // Detail
            }

            if (Softness > 0.0f)
            {
                SgtHelper.EnableKeyword("SGT_C", material);                 // Softness

                material.SetFloat(SgtShader._SoftParticlesFactor, SgtHelper.Reciprocal(Softness));
            }
            else
            {
                SgtHelper.DisableKeyword("SGT_C", material);                 // Softness
            }
        }