Example #1
0
        /**
         * @brief Create a variable according to type and value
         *
         * @param _type the string of the type
         * @param _value the string value
         *
         * @result the variable
         * */
        public static IEffectParameter CreateVariable(string _type, string _value)
        {
            IEffectParameter newVariable = null;

            if (_type == typeof(CatMatrix).ToString())
            {
                newVariable = new CatMatrix();
            }
            else if (_type == typeof(CatFloat).ToString())
            {
                newVariable = new CatFloat();
            }
            else if (_type == typeof(CatTexture).ToString())
            {
                newVariable = new CatTexture();
            }
            else if (_type == typeof(CatVector4).ToString())
            {
                newVariable = new CatVector4();
            }
            else if (_type == typeof(CatColor).ToString())
            {
                newVariable = new CatColor();
            }
            else
            {
                Debug.Assert(false, "No matching type found. type=" + _type + " value=" + _value);
            }
            if (newVariable != null && _value != null && _value != "")
            {
                newVariable.FromString(_value);
            }

            return(newVariable);
        }
Example #2
0
        public IEffectParameter ParameterClone()
        {
            CatTexture newTexture = new CatTexture();

            // do we need deep copy?
            newTexture.value = m_texture;
            return(newTexture);
        }