Axiom assumes that there are seperate vertex and fragment programs to deal with but GLSL has one program object that represents the active vertex and fragment shader objects during a rendering state. GLSL Vertex and fragment shader objects are compiled seperately and then attached to a program object and then the program object is linked. Since Ogre can only handle one vertex program and one fragment program being active in a pass, the GLSL Link Program Manager does the same. The GLSL Link program manager acts as a state machine and activates a program object based on the active vertex and fragment program. Previously created program objects are stored along with a unique key in a hash_map for quick retrieval the next time the program object is required.
Inheritance: IDisposable
 /// <summary>
 ///     Internal constructor.  This class cannot be instantiated externally.
 /// </summary>
 internal GLSLLinkProgramManager()
 {
     if (instance == null)
     {
         instance = this;
     }
 }
		/// <summary>
		///     Internal constructor.  This class cannot be instantiated externally.
		/// </summary>
		internal GLSLLinkProgramManager()
		{
			if ( instance == null )
			{
				instance = this;
			}

            typeEnumMap = new Dictionary<string, int>
            {
                {"float", Gl.GL_FLOAT},
                {"vec2", Gl.GL_FLOAT_VEC2},
                {"vec3", Gl.GL_FLOAT_VEC3},
                {"vec4", Gl.GL_FLOAT_VEC4},
                {"sampler1D", Gl.GL_SAMPLER_1D},
                {"sampler2D", Gl.GL_SAMPLER_2D},
                {"sampler3D", Gl.GL_SAMPLER_3D},
                {"samplerCube", Gl.GL_SAMPLER_CUBE},
                {"sampler1DShadow", Gl.GL_SAMPLER_1D_SHADOW},
                {"sampler2DShadow", Gl.GL_SAMPLER_2D_SHADOW},
                {"int", Gl.GL_INT},
                {"ivec2", Gl.GL_INT_VEC2},
                {"ivec3", Gl.GL_INT_VEC3},
                {"ivec4", Gl.GL_INT_VEC4},
                {"mat2", Gl.GL_FLOAT_MAT2},
                {"mat3", Gl.GL_FLOAT_MAT3},
                {"mat4", Gl.GL_FLOAT_MAT4},
                // GL 2.1
                {"mat2x2", Gl.GL_FLOAT_MAT2},
                {"mat3x3", Gl.GL_FLOAT_MAT3},
                {"mat4x4", Gl.GL_FLOAT_MAT4},
                {"mat2x3", Gl.GL_FLOAT_MAT2x3},
                {"mat3x2", Gl.GL_FLOAT_MAT3x2},
                {"mat3x4", Gl.GL_FLOAT_MAT3x4},
                {"mat4x3", Gl.GL_FLOAT_MAT4x3},
                {"mat2x4", Gl.GL_FLOAT_MAT2x4},
                {"mat4x2", Gl.GL_FLOAT_MAT4x2},
            };
		}
Esempio n. 3
0
        /// <summary>
        ///     Internal constructor.  This class cannot be instantiated externally.
        /// </summary>
        internal GLSLLinkProgramManager()
        {
            if (instance == null)
            {
                instance = this;
            }

            this.typeEnumMap = new Dictionary <string, int>
            {
                {
                    "float", Gl.GL_FLOAT
                },
                {
                    "vec2", Gl.GL_FLOAT_VEC2
                },
                {
                    "vec3", Gl.GL_FLOAT_VEC3
                },
                {
                    "vec4", Gl.GL_FLOAT_VEC4
                },
                {
                    "sampler1D", Gl.GL_SAMPLER_1D
                },
                {
                    "sampler2D", Gl.GL_SAMPLER_2D
                },
                {
                    "sampler3D", Gl.GL_SAMPLER_3D
                },
                {
                    "samplerCube", Gl.GL_SAMPLER_CUBE
                },
                {
                    "sampler1DShadow", Gl.GL_SAMPLER_1D_SHADOW
                },
                {
                    "sampler2DShadow", Gl.GL_SAMPLER_2D_SHADOW
                },
                {
                    "int", Gl.GL_INT
                },
                {
                    "ivec2", Gl.GL_INT_VEC2
                },
                {
                    "ivec3", Gl.GL_INT_VEC3
                },
                {
                    "ivec4", Gl.GL_INT_VEC4
                },
                {
                    "mat2", Gl.GL_FLOAT_MAT2
                },
                {
                    "mat3", Gl.GL_FLOAT_MAT3
                },
                {
                    "mat4", Gl.GL_FLOAT_MAT4
                },
                // GL 2.1
                {
                    "mat2x2", Gl.GL_FLOAT_MAT2
                },
                {
                    "mat3x3", Gl.GL_FLOAT_MAT3
                },
                {
                    "mat4x4", Gl.GL_FLOAT_MAT4
                },
                {
                    "mat2x3", Gl.GL_FLOAT_MAT2x3
                },
                {
                    "mat3x2", Gl.GL_FLOAT_MAT3x2
                },
                {
                    "mat3x4", Gl.GL_FLOAT_MAT3x4
                },
                {
                    "mat4x3", Gl.GL_FLOAT_MAT4x3
                },
                {
                    "mat2x4", Gl.GL_FLOAT_MAT2x4
                },
                {
                    "mat4x2", Gl.GL_FLOAT_MAT4x2
                },
            };
        }
Esempio n. 4
0
 /// <summary>
 ///     Default constructor.
 /// </summary>
 internal GLSLProgramFactory()
 {
     // instantiate the singleton
     this.glslLinkProgramMgr = new GLSLLinkProgramManager();
 }
 /// <summary>
 ///     Internal constructor.  This class cannot be instantiated externally.
 /// </summary>
 internal GLSLLinkProgramManager()
 {
     if (instance == null) {
         instance = this;
     }
 }
 /// <summary>
 ///     Default constructor.
 /// </summary>
 internal GLSLProgramFactory()
 {
     // instantiate the singleton
     glslLinkProgramMgr = new GLSLLinkProgramManager();
 }