protected static void SetupMaterial(CLYT Layout, int MatId) { var mat = Layout.Materials.Materials[MatId]; mat.ApplyAlphaCompareBlendMode(); for (int o = 0; o < mat.TexMaps.Length; o++) { Gl.glActiveTexture(Gl.GL_TEXTURE0 + o); Gl.glBindTexture(Gl.GL_TEXTURE_2D, MatId * 4 + o + 1); Gl.glEnable(Gl.GL_TEXTURE_2D); } if (mat.TexMaps.Length == 0) { Gl.glActiveTexture(Gl.GL_TEXTURE0); Gl.glColor4f(1, 1, 1, 1); Gl.glBindTexture(Gl.GL_TEXTURE_2D, MatId * 4 + 1); Gl.glEnable(Gl.GL_TEXTURE_2D); } Gl.glMatrixMode(Gl.GL_TEXTURE); for (int o = 0; o < mat.TexCoordGens.Length; o++) { Gl.glActiveTexture(Gl.GL_TEXTURE0 + o); Gl.glLoadIdentity(); //if ((int)mat.TexCoordGens[o].Source < 4) //{ mat1.MaterialEntry.TexMatrix srt = mat.TexMatrices[o]; //(int)mat.TexCoordGens[o].Source]; Gl.glTranslatef(0.5f, 0.5f, 0.0f); Gl.glRotatef(srt.Rotation, 0.0f, 0.0f, 1.0f); Gl.glScalef(srt.Scale.X, srt.Scale.Y, 1.0f); Gl.glTranslatef(srt.Translation.X / srt.Scale.X - 0.5f, srt.Translation.Y / srt.Scale.Y - 0.5f, 0.0f); //} //else //{ //} } Gl.glMatrixMode(Gl.GL_MODELVIEW); mat.GlShader.Enable(); }
protected static void SetupMaterial(CLYT Layout, int MatId) { var mat = Layout.Materials.Materials[MatId]; mat.ApplyAlphaCompareBlendMode(); for (int o = 0; o < mat.TexMaps.Length; o++) { GL.ActiveTexture(TextureUnit.Texture0 + o); GL.BindTexture(TextureTarget.Texture2D, MatId * 4 + o + 1); GL.Enable(EnableCap.Texture2D); } if (mat.TexMaps.Length == 0) { GL.ActiveTexture(TextureUnit.Texture0); GL.Color4(1, 1, 1, 1); GL.BindTexture(TextureTarget.Texture2D, MatId * 4 + 1); GL.Enable(EnableCap.Texture2D); } GL.MatrixMode(MatrixMode.Texture); for (int o = 0; o < mat.TexCoordGens.Length; o++) { GL.ActiveTexture(TextureUnit.Texture0 + o); GL.LoadIdentity(); //if ((int)mat.TexCoordGens[o].Source < 4) //{ mat1.MaterialEntry.TexMatrix srt = mat.TexMatrices[o]; //(int)mat.TexCoordGens[o].Source]; GL.Translate(0.5f, 0.5f, 0.0f); GL.Rotate(srt.Rotation, 0.0f, 0.0f, 1.0f); GL.Scale(srt.Scale.X, srt.Scale.Y, 1.0f); GL.Translate(srt.Translation.X / srt.Scale.X - 0.5f, srt.Translation.Y / srt.Scale.Y - 0.5f, 0.0f); //} //else //{ //} } GL.MatrixMode(MatrixMode.Modelview); mat.GlShader.Enable(); }