Example #1
0
        public void SetColor(int hash, Color value)
        {
            SerializedPassProperty result = null;

            if (!propertiesById.TryGetValue(hash, out result))
            {
                Debug.LogError("The property " + hash + " doesn't exist. Use string overload to create one.");
                return;
            }

            if (result.PropertyType != PropertyType.Color)
            {
                Debug.LogError("The property " + hash + " is not a color property");
                return;
            }

            result.ColorValue = value;
        }
Example #2
0
        public Color GetColor(int hash)
        {
            SerializedPassProperty result = null;

            if (!propertiesById.TryGetValue(hash, out result))
            {
                Debug.LogError("The property " + hash + " doesn't exist");
                return(Color.black);
            }

            if (result.PropertyType == PropertyType.Color)
            {
                return(result.ColorValue);
            }
            else
            {
                return(Color.black);
            }
        }
Example #3
0
        public void SetFloat(int hash, float value)
        {
            propertiesIsDirty = true;
            SerializedPassProperty result = null;

            if (!propertiesById.TryGetValue(hash, out result))
            {
                Debug.LogError("The property " + hash + " doesn't exist. Use string overload to create one.");
                return;
            }

            if (result.PropertyType != PropertyType.Float)
            {
                Debug.LogError("The property " + hash + " is not a float property");
                return;
            }

            result.FloatValue = value;
        }
Example #4
0
        public void SetColor(string name, Color value)
        {
            SerializedPassProperty result = null;

            if (!propertiesByName.TryGetValue(name, out result))
            {
                result = new SerializedPassProperty();
                result.PropertyType = PropertyType.Color;
                propertiesByName.Add(name, result);
                propertiesById.Add(Shader.PropertyToID(name), result);
            }

            if (result.PropertyType != PropertyType.Color)
            {
                Debug.LogError("The property " + name + " is not a color property.");
                return;
            }

            result.ColorValue = value;
        }
Example #5
0
        public Color GetColor(string name)
        {
            SerializedPassProperty result = null;

            if (!propertiesByName.TryGetValue(name, out result))
            {
                Debug.LogError("The property " + name + " doesn't exist");
                return(Color.black);
            }

            if (result.PropertyType == PropertyType.Color)
            {
                return(result.ColorValue);
            }
            else
            {
                Debug.LogError("The property " + name + " is not a color property");
                return(Color.black);
            }
        }
Example #6
0
        public void SetFloat(string name, float value)
        {
            SerializedPassProperty result = null;

            if (!propertiesByName.TryGetValue(name, out result))
            {
                result = new SerializedPassProperty();
                result.PropertyType = PropertyType.Float;
                propertiesByName.Add(name, result);
                propertiesById.Add(Shader.PropertyToID(name), result);
            }

            if (result.PropertyType != PropertyType.Float)
            {
                Debug.LogError("The property " + name + " is not a float property");
                return;
            }

            result.FloatValue = value;
        }
Example #7
0
        public float GetFloat(int hash)
        {
            SerializedPassProperty result = null;

            if (!propertiesById.TryGetValue(hash, out result))
            {
                Debug.LogError("The property " + hash + " is doesn't exist");
                return(0.0f);
            }

            if (result.PropertyType == PropertyType.Float || result.PropertyType == PropertyType.Range)
            {
                return(result.FloatValue);
            }
            else
            {
                Debug.LogError("The property " + hash + " is not a float property");
                return(0.0f);
            }
        }
Example #8
0
        public float GetFloat(string name)
        {
            SerializedPassProperty result = null;

            if (!propertiesByName.TryGetValue(name, out result))
            {
                Debug.LogError("The property " + name + " doesn't exist");
                return(0.0f);
            }

            if (result.PropertyType == PropertyType.Float || result.PropertyType == PropertyType.Range)
            {
                return(result.FloatValue);
            }
            else
            {
                Debug.LogError("The property " + name + " is not a float property");
                return(0.0f);
            }
        }
Example #9
0
        public Vector4 GetVector(int hash)
        {
            SerializedPassProperty result = null;

            if (!propertiesById.TryGetValue(hash, out result))
            {
                Debug.LogError("The property " + hash + " doesn't exist");
                return(Vector4.zero);
            }

            if (result.PropertyType == PropertyType.Vector)
            {
                return(result.VectorValue);
            }
            else
            {
                Debug.LogError("The property " + hash + " is not a vector property");
                return(Vector4.zero);
            }
        }
Example #10
0
        public Vector4 GetVector(string name)
        {
            SerializedPassProperty result = null;

            if (!propertiesByName.TryGetValue(name, out result))
            {
                Debug.LogError("The property " + name + " doesn't exist");
                return(Vector4.zero);
            }

            if (result.PropertyType == PropertyType.Vector)
            {
                return(result.VectorValue);
            }
            else
            {
                Debug.LogError("The property " + name + " is not a vector property");
                return(Vector4.zero);
            }
        }