diff --git a/polymer/eduke32/build/include/polymer.h b/polymer/eduke32/build/include/polymer.h index e489aea33..5830a1cd3 100644 --- a/polymer/eduke32/build/include/polymer.h +++ b/polymer/eduke32/build/include/polymer.h @@ -74,6 +74,7 @@ typedef enum { PR_BIT_MIRROR_MAP, PR_BIT_FOG, PR_BIT_GLOW_MAP, + PR_BIT_PROJECTION_MAP, PR_BIT_SHADOW_MAP, PR_BIT_LIGHT_MAP, PR_BIT_SPOT_LIGHT, @@ -137,9 +138,10 @@ typedef struct s_prrograminfo { GLint uniform_mirrorMap; // PR_BIT_GLOW_MAP GLint uniform_glowMap; + // PR_BIT_PROJECTION_MAP + GLint uniform_shadowProjMatrix; // PR_BIT_SHADOW_MAP GLint uniform_shadowMap; - GLint uniform_shadowProjMatrix; // PR_BIT_LIGHT_MAP GLint uniform_lightMap; // PR_BIT_SPOT_LIGHT @@ -333,134 +335,134 @@ static void polymer_initrendertargets(int32_t count); // the following from gle/vvector.h -/* ========================================================== */ -/* determinant of matrix - * - * Computes determinant of matrix m, returning d - */ - -#define DETERMINANT_3X3(d,m) \ -{ \ - d = m[0][0] * (m[1][1]*m[2][2] - m[1][2] * m[2][1]); \ - d -= m[0][1] * (m[1][0]*m[2][2] - m[1][2] * m[2][0]); \ - d += m[0][2] * (m[1][0]*m[2][1] - m[1][1] * m[2][0]); \ -} - -/* ========================================================== */ -/* i,j,th cofactor of a 4x4 matrix - * - */ - -#define COFACTOR_4X4_IJ(fac,m,i,j) \ -{ \ - int ii[4], jj[4], k; \ - \ - /* compute which row, columnt to skip */ \ - for (k=0; kmirrormap = 0; // PR_BIT_GLOW_MAP material->glowmap = 0; - // PR_BIT_SHADOW_MAP + // PR_BIT_PROJECTION_MAP material->mdspritespace = GL_FALSE; } @@ -3934,9 +3945,12 @@ static int32_t polymer_bindmaterial(_prmaterial material, int16_t* lights, // PR_BIT_SHADOW_MAP if (prlights[lights[curlight]].rtindex != -1) { programbits |= prprogrambits[PR_BIT_SHADOW_MAP].bit; - // PR_BIT_LIGHT_MAP - if (prlights[lights[curlight]].lightmap) - programbits |= prprogrambits[PR_BIT_LIGHT_MAP].bit; + programbits |= prprogrambits[PR_BIT_PROJECTION_MAP].bit; + } + // PR_BIT_LIGHT_MAP + if (prlights[lights[curlight]].lightmap) { + programbits |= prprogrambits[PR_BIT_LIGHT_MAP].bit; + programbits |= prprogrambits[PR_BIT_PROJECTION_MAP].bit; } } } @@ -4163,8 +4177,8 @@ static int32_t polymer_bindmaterial(_prmaterial material, int16_t* lights, bglUniform3fvARB(prprograms[programbits].uniform_spotDir, 1, dir); bglUniform2fvARB(prprograms[programbits].uniform_spotRadius, 1, indir); - // PR_BIT_SHADOW_MAP - if (programbits & prprogrambits[PR_BIT_SHADOW_MAP].bit) + // PR_BIT_PROJECTION_MAP + if (programbits & prprogrambits[PR_BIT_PROJECTION_MAP].bit) { GLfloat matrix[16]; @@ -4178,13 +4192,18 @@ static int32_t polymer_bindmaterial(_prmaterial material, int16_t* lights, bglLoadIdentity(); bglMatrixMode(GL_MODELVIEW); - bglActiveTextureARB(texunit + GL_TEXTURE0_ARB); - bglBindTexture(prrts[prlights[lights[curlight]].rtindex].target, prrts[prlights[lights[curlight]].rtindex].z); - - bglUniform1iARB(prprograms[programbits].uniform_shadowMap, texunit); bglUniformMatrix4fvARB(prprograms[programbits].uniform_shadowProjMatrix, 1, GL_FALSE, matrix); - texunit++; + // PR_BIT_SHADOW_MAP + if (programbits & prprogrambits[PR_BIT_SHADOW_MAP].bit) + { + bglActiveTextureARB(texunit + GL_TEXTURE0_ARB); + bglBindTexture(prrts[prlights[lights[curlight]].rtindex].target, prrts[prlights[lights[curlight]].rtindex].z); + + bglUniform1iARB(prprograms[programbits].uniform_shadowMap, texunit); + + texunit++; + } // PR_BIT_LIGHT_MAP if (programbits & prprogrambits[PR_BIT_LIGHT_MAP].bit) @@ -4388,11 +4407,16 @@ static void polymer_compileprogram(int32_t programbits) prprograms[programbits].uniform_glowMap = bglGetUniformLocationARB(program, "glowMap"); } + // PR_BIT_PROJECTION_MAP + if (programbits & prprogrambits[PR_BIT_PROJECTION_MAP].bit) + { + prprograms[programbits].uniform_shadowProjMatrix = bglGetUniformLocationARB(program, "shadowProjMatrix"); + } + // PR_BIT_SHADOW_MAP if (programbits & prprogrambits[PR_BIT_SHADOW_MAP].bit) { prprograms[programbits].uniform_shadowMap = bglGetUniformLocationARB(program, "shadowMap"); - prprograms[programbits].uniform_shadowProjMatrix = bglGetUniformLocationARB(program, "shadowProjMatrix"); } // PR_BIT_LIGHT_MAP