Example #1
0
        public GLSLESProgramCommon(GLSLESGpuProgram vertexProgram, GLSLESGpuProgram fragmentProgram)
        {
            this.vertexProgram        = vertexProgram;
            this.fragmentProgram      = fragmentProgram;
            this.uniformRefsBuilt     = false;
            this.linked               = 0;
            this.triedToLinkAndFailed = false;

            //init customAttributeIndexes
            for (int i = 0; i < 9; i++)
            {
                for (int j = 0; j < Configuration.Config.MaxTextureCoordSets; j++)
                {
                    this.customAttribues[i, j] = NullCustomAttributesIndex;
                }
            }

            //Initialize the attribute to semantic map
            this.semanticTypeMap.Add("vertex", VertexElementSemantic.Position);
            this.semanticTypeMap.Add("blendWeights", VertexElementSemantic.BlendWeights);
            this.semanticTypeMap.Add("normal", VertexElementSemantic.Normal);
            this.semanticTypeMap.Add("colour", VertexElementSemantic.Diffuse);
            this.semanticTypeMap.Add("secondary_colour", VertexElementSemantic.Specular);
            this.semanticTypeMap.Add("blendIndices", VertexElementSemantic.BlendIndices);
            this.semanticTypeMap.Add("tangent", VertexElementSemantic.Tangent);
            this.semanticTypeMap.Add("binormal", VertexElementSemantic.Binormal);
            this.semanticTypeMap.Add("uv", VertexElementSemantic.TexCoords);

            if ((vertexProgram == null || fragmentProgram == null) && false)                 //!Core.Root.Instance.RenderSystem.Capabilities.HasCapability(Capabilities.SeperateShaderObjects))
            {
                throw new Core.AxiomException("Attempted to create a shader program without both a vertex and fragment program");
            }
        }
		public GLSLESProgramCommon( GLSLESGpuProgram vertexProgram, GLSLESGpuProgram fragmentProgram )
		{
			this.vertexProgram = vertexProgram;
			this.fragmentProgram = fragmentProgram;
			this.uniformRefsBuilt = false;
			this.linked = 0;
			this.triedToLinkAndFailed = false;

			//init customAttributeIndexes
			for ( int i = 0; i < 9; i++ )
			{
				for ( int j = 0; j < Configuration.Config.MaxTextureCoordSets; j++ )
				{
					this.customAttribues[ i, j ] = NullCustomAttributesIndex;
				}
			}

			//Initialize the attribute to semantic map
			this.semanticTypeMap.Add( "vertex", VertexElementSemantic.Position );
			this.semanticTypeMap.Add( "blendWeights", VertexElementSemantic.BlendWeights );
			this.semanticTypeMap.Add( "normal", VertexElementSemantic.Normal );
			this.semanticTypeMap.Add( "colour", VertexElementSemantic.Diffuse );
			this.semanticTypeMap.Add( "secondary_colour", VertexElementSemantic.Specular );
			this.semanticTypeMap.Add( "blendIndices", VertexElementSemantic.BlendIndices );
			this.semanticTypeMap.Add( "tangent", VertexElementSemantic.Tangent );
			this.semanticTypeMap.Add( "binormal", VertexElementSemantic.Binormal );
			this.semanticTypeMap.Add( "uv", VertexElementSemantic.TexCoords );

			if ( ( vertexProgram == null || fragmentProgram == null ) && false ) //!Core.Root.Instance.RenderSystem.Capabilities.HasCapability(Capabilities.SeperateShaderObjects))
			{
				throw new Core.AxiomException( "Attempted to create a shader program without both a vertex and fragment program" );
			}
		}
 public void OptimizeShaderSource(GLSLESGpuProgram gpuProgram)
 {
     /*Port Notes
      * As best I can reckon' OpenTK doesn't support the kind of optimization done in Ogre
      * I figure this is okay, seeing as Ogre checks for #if optimize, and it seems to be off by default
      */
 }
Example #4
0
 public GLSLESLinkProgram(GLSLESGpuProgram vertexProgram, GLSLESGpuProgram fragmentProgram)
     : base(vertexProgram, fragmentProgram)
 {
     if (vertexProgram == null || fragmentProgram == null)
     {
         throw new Core.AxiomException("Attempted to create a shader program without both a vertex and fragment program.");
     }
 }
Example #5
0
		public GLSLESLinkProgram( GLSLESGpuProgram vertexProgram, GLSLESGpuProgram fragmentProgram )
			: base( vertexProgram, fragmentProgram )
		{
			if ( vertexProgram == null || fragmentProgram == null )
			{
				throw new Core.AxiomException( "Attempted to create a shader program without both a vertex and fragment program." );
			}
		}
        public GLSLESProgramManagerCommon()
        {
            this.activeVertexGpuProgram   = null;
            this.activeFragmentGpuProgram = null;

            this.typeEnumMap = new Dictionary <string, GLenum>();
            //Fill in the relationship between type names and enums
            this.typeEnumMap.Add("float", GLenum.Float);
            this.typeEnumMap.Add("vec2", GLenum.FloatVec2);
            this.typeEnumMap.Add("vec3", GLenum.FloatVec3);
            this.typeEnumMap.Add("vec4", GLenum.FloatVec4);
            this.typeEnumMap.Add("sampler2D", GLenum.Sampler2D);
            this.typeEnumMap.Add("samplerCube", GLenum.SamplerCube);
            //typeEnumMap.Add("sampler2DShadow", GLenum.sh
            this.typeEnumMap.Add("int", GLenum.Int);
            this.typeEnumMap.Add("ivec2", GLenum.IntVec2);
            this.typeEnumMap.Add("ivec3", GLenum.IntVec3);
            this.typeEnumMap.Add("ivec4", GLenum.IntVec4);
            this.typeEnumMap.Add("mat2", GLenum.FloatMat2);
            this.typeEnumMap.Add("mat3", GLenum.FloatMat3);
            this.typeEnumMap.Add("mat4", GLenum.FloatMat4);
        }
		public GLSLESProgramPipeline( GLSLESGpuProgram vertexProgram, GLSLESGpuProgram fragmentProgram )
			: base( vertexProgram, fragmentProgram )
		{
			throw new Core.AxiomException( "This class should never be instantied, use GLSLESLinkProgram instead" );
		}
		public void OptimizeShaderSource( GLSLESGpuProgram gpuProgram )
		{
			/*Port Notes
			 * As best I can reckon' OpenTK doesn't support the kind of optimization done in Ogre
			 * I figure this is okay, seeing as Ogre checks for #if optimize, and it seems to be off by default
			 */
		}
		public GLSLESProgramManagerCommon()
		{
			this.activeVertexGpuProgram = null;
			this.activeFragmentGpuProgram = null;

			this.typeEnumMap = new Dictionary<string, GLenum>();
			//Fill in the relationship between type names and enums
			this.typeEnumMap.Add( "float", GLenum.Float );
			this.typeEnumMap.Add( "vec2", GLenum.FloatVec2 );
			this.typeEnumMap.Add( "vec3", GLenum.FloatVec3 );
			this.typeEnumMap.Add( "vec4", GLenum.FloatVec4 );
			this.typeEnumMap.Add( "sampler2D", GLenum.Sampler2D );
			this.typeEnumMap.Add( "samplerCube", GLenum.SamplerCube );
			//typeEnumMap.Add("sampler2DShadow", GLenum.sh
			this.typeEnumMap.Add( "int", GLenum.Int );
			this.typeEnumMap.Add( "ivec2", GLenum.IntVec2 );
			this.typeEnumMap.Add( "ivec3", GLenum.IntVec3 );
			this.typeEnumMap.Add( "ivec4", GLenum.IntVec4 );
			this.typeEnumMap.Add( "mat2", GLenum.FloatMat2 );
			this.typeEnumMap.Add( "mat3", GLenum.FloatMat3 );
			this.typeEnumMap.Add( "mat4", GLenum.FloatMat4 );
		}
Example #10
0
 public GLSLESProgramPipeline(GLSLESGpuProgram vertexProgram, GLSLESGpuProgram fragmentProgram)
     : base(vertexProgram, fragmentProgram)
 {
     throw new Core.AxiomException("This class should never be instantied, use GLSLESLinkProgram instead");
 }