Sanitize texture coordinate usage in the GPU program. That allows normal and glow maps to benefit from the diffuse map scale.

git-svn-id: https://svn.eduke32.com/eduke32@1280 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
plagman 2009-03-28 15:54:25 +00:00
parent 83fc79300e
commit fe8775cb21

View file

@ -198,7 +198,6 @@ _prprogrambit prprogrambits[PR_BIT_COUNT] = {
" //TBN = mat3(gl_NormalMatrix * T, gl_NormalMatrix * B, gl_NormalMatrix * N);\n" " //TBN = mat3(gl_NormalMatrix * T, gl_NormalMatrix * B, gl_NormalMatrix * N);\n"
" matTBN = gl_NormalMatrix * mat3(T, B, N);\n" " matTBN = gl_NormalMatrix * mat3(T, B, N);\n"
"\n" "\n"
" gl_TexCoord[texCoord++] = gl_MultiTexCoord0;\n"
" isNormalMapped = 1;\n" " isNormalMapped = 1;\n"
"\n", "\n",
// frag_def // frag_def
@ -206,7 +205,7 @@ _prprogrambit prprogrambits[PR_BIT_COUNT] = {
"varying mat3 matTBN;\n" "varying mat3 matTBN;\n"
"\n", "\n",
// frag_prog // frag_prog
" normalTexel = texture2D(normalMap, gl_TexCoord[texCoord++].st);\n" " normalTexel = texture2D(normalMap, gl_TexCoord[0].st);\n"
" isNormalMapped = 1;\n" " isNormalMapped = 1;\n"
" TBN = matTBN;\n" " TBN = matTBN;\n"
"\n", "\n",
@ -217,13 +216,13 @@ _prprogrambit prprogrambits[PR_BIT_COUNT] = {
"uniform vec2 diffuseScale;\n" "uniform vec2 diffuseScale;\n"
"\n", "\n",
// vert_prog // vert_prog
" gl_TexCoord[texCoord++] = vec4(diffuseScale, 1.0, 1.0) * gl_MultiTexCoord0;\n" " gl_TexCoord[0] = vec4(diffuseScale, 1.0, 1.0) * gl_MultiTexCoord0;\n"
"\n", "\n",
// frag_def // frag_def
"uniform sampler2D diffuseMap;\n" "uniform sampler2D diffuseMap;\n"
"\n", "\n",
// frag_prog // frag_prog
" diffuseTexel = texture2D(diffuseMap, gl_TexCoord[texCoord++].st);\n" " diffuseTexel = texture2D(diffuseMap, gl_TexCoord[0].st);\n"
" if (isLightingPass == 0)\n" " if (isLightingPass == 0)\n"
" result *= diffuseTexel;\n" " result *= diffuseTexel;\n"
"\n", "\n",
@ -297,15 +296,14 @@ _prprogrambit prprogrambits[PR_BIT_COUNT] = {
// vert_def // vert_def
"", "",
// vert_prog // vert_prog
" gl_TexCoord[texCoord++] = gl_MultiTexCoord0;\n" "",
"\n",
// frag_def // frag_def
"uniform sampler2D glowMap;\n" "uniform sampler2D glowMap;\n"
"\n", "\n",
// frag_prog // frag_prog
" vec4 glowTexel;\n" " vec4 glowTexel;\n"
"\n" "\n"
" glowTexel = texture2D(glowMap, gl_TexCoord[texCoord++].st);\n" " glowTexel = texture2D(glowMap, gl_TexCoord[0].st);\n"
" result = vec4((result.rgb * (1.0 - glowTexel.a)) + (glowTexel.rgb * glowTexel.a), result.a);\n" " result = vec4((result.rgb * (1.0 - glowTexel.a)) + (glowTexel.rgb * glowTexel.a), result.a);\n"
"\n", "\n",
}, },
@ -416,11 +414,13 @@ _prprogrambit prprogrambits[PR_BIT_COUNT] = {
// vert_def // vert_def
"void main(void)\n" "void main(void)\n"
"{\n" "{\n"
" int texCoord = 0;\n" " int texCoord = 1;\n"
" vec4 curVertex = gl_Vertex;\n" " vec4 curVertex = gl_Vertex;\n"
" vec3 curNormal = gl_Normal;\n" " vec3 curNormal = gl_Normal;\n"
" int isNormalMapped = 0;\n" " int isNormalMapped = 0;\n"
" mat3 TBN;\n" " mat3 TBN;\n"
"\n"
" gl_TexCoord[0] = gl_MultiTexCoord0;\n"
"\n", "\n",
// vert_prog // vert_prog
" gl_Position = gl_ModelViewProjectionMatrix * curVertex;\n" " gl_Position = gl_ModelViewProjectionMatrix * curVertex;\n"
@ -428,7 +428,7 @@ _prprogrambit prprogrambits[PR_BIT_COUNT] = {
// frag_def // frag_def
"void main(void)\n" "void main(void)\n"
"{\n" "{\n"
" int texCoord = 0;\n" " int texCoord = 1;\n"
" vec4 result = vec4(1.0, 1.0, 1.0, 1.0);\n" " vec4 result = vec4(1.0, 1.0, 1.0, 1.0);\n"
" vec4 diffuseTexel = vec4(1.0, 1.0, 1.0, 1.0);\n" " vec4 diffuseTexel = vec4(1.0, 1.0, 1.0, 1.0);\n"
" vec4 normalTexel;\n" " vec4 normalTexel;\n"