-Lightshaders
-More experimental ambient bumpmapping (alternative to delux mapping)
This commit is contained in:
parent
f2fbd65a87
commit
13b971d1a5
1 changed files with 245 additions and 45 deletions
290
gl_bumpgf.c
290
gl_bumpgf.c
|
@ -35,6 +35,7 @@ If a light has a cubemap filter it requires 3 passes
|
||||||
#include "nvparse/nvparse.h"
|
#include "nvparse/nvparse.h"
|
||||||
|
|
||||||
//#define DELUX_DEBUG
|
//#define DELUX_DEBUG
|
||||||
|
//#define AMBIENT_BUMP
|
||||||
|
|
||||||
//<AWE> "diffuse_program_object" has to be defined static. Otherwise nameclash with "gl_bumpradeon.c".
|
//<AWE> "diffuse_program_object" has to be defined static. Otherwise nameclash with "gl_bumpradeon.c".
|
||||||
static GLuint diffuse_program_object;
|
static GLuint diffuse_program_object;
|
||||||
|
@ -42,11 +43,19 @@ static GLuint specularalias_program_object; //He he nice name to type a lot
|
||||||
static GLuint deluxCombiner;
|
static GLuint deluxCombiner;
|
||||||
static GLuint delux_program_object;
|
static GLuint delux_program_object;
|
||||||
|
|
||||||
|
#ifdef AMBIENT_BUMP
|
||||||
|
static GLuint ambientBumpTS;
|
||||||
|
static GLuint ambientBumpCombiner;
|
||||||
|
static GLuint ambientBumpCombiner2;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
void GF3_SetupTcMods(stage_t *s);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Pixel shader for diffuse bump mapping does diffuse bumpmapping with norm cube, self shadowing & dist attent in
|
Pixel shader for diffuse bump mapping does diffuse bumpmapping with norm cube, self shadowing & dist attent in
|
||||||
1 pass (thanx to the 4 texture units on a gf4)
|
1 pass (thanx to the 4 texture units on a gf4)
|
||||||
*/
|
*/
|
||||||
void GL_EnableDiffuseShaderGF3(const transform_t *tr, vec3_t lightOrig) {
|
void GL_EnableDiffuseShaderGF3(const transform_t *tr, vec3_t lightOrig, int stageIndex) {
|
||||||
|
|
||||||
//tex 0 = normal map
|
//tex 0 = normal map
|
||||||
//tex 1 = nomalization cube map (tangent space light vector)
|
//tex 1 = nomalization cube map (tangent space light vector)
|
||||||
|
@ -65,10 +74,24 @@ void GL_EnableDiffuseShaderGF3(const transform_t *tr, vec3_t lightOrig) {
|
||||||
glMatrixMode(GL_TEXTURE);
|
glMatrixMode(GL_TEXTURE);
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
glLoadIdentity();
|
glLoadIdentity();
|
||||||
if (currentshadowlight->filtercube) {
|
if (currentshadowlight->shader->numstages) {
|
||||||
glEnable(GL_TEXTURE_CUBE_MAP_ARB);
|
|
||||||
glBindTexture(GL_TEXTURE_CUBE_MAP_ARB, currentshadowlight->filtercube);
|
|
||||||
GL_SetupCubeMapMatrix(tr);
|
GL_SetupCubeMapMatrix(tr);
|
||||||
|
if (currentshadowlight->shader->stages[stageIndex].texture[0]->type == GL_TEXTURE_CUBE_MAP_ARB) {
|
||||||
|
glEnable(GL_TEXTURE_CUBE_MAP_ARB);
|
||||||
|
glBindTexture(GL_TEXTURE_CUBE_MAP_ARB, currentshadowlight->shader->stages[stageIndex].texture[0]->texnum);
|
||||||
|
} else {
|
||||||
|
glEnable(GL_TEXTURE_2D);
|
||||||
|
GL_BindAdvanced(currentshadowlight->shader->stages[stageIndex].texture[0]);
|
||||||
|
//Default = repeat the texture one time in the light's sphere
|
||||||
|
//Can be modified with the tcMod shader commands
|
||||||
|
glTranslatef(0.5,0.5,0.5);
|
||||||
|
glScalef(0.5,0.5,0.5);
|
||||||
|
glScalef(1.0f/(currentshadowlight->radiusv[0]),
|
||||||
|
1.0f/(currentshadowlight->radiusv[1]),
|
||||||
|
1.0f/(currentshadowlight->radiusv[2]));
|
||||||
|
|
||||||
|
}
|
||||||
|
GF3_SetupTcMods(¤tshadowlight->shader->stages[stageIndex]);
|
||||||
} else {
|
} else {
|
||||||
glEnable(GL_TEXTURE_3D);
|
glEnable(GL_TEXTURE_3D);
|
||||||
glBindTexture(GL_TEXTURE_3D, atten3d_texture_object);
|
glBindTexture(GL_TEXTURE_3D, atten3d_texture_object);
|
||||||
|
@ -164,7 +187,7 @@ void GL_EnableDiffuseShaderGF3(const transform_t *tr, vec3_t lightOrig) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GL_DisableDiffuseShaderGF3() {
|
void GL_DisableDiffuseShaderGF3(int stageIndex) {
|
||||||
|
|
||||||
qglCombinerParameteriNV(GL_NUM_GENERAL_COMBINERS_NV, 1);
|
qglCombinerParameteriNV(GL_NUM_GENERAL_COMBINERS_NV, 1);
|
||||||
|
|
||||||
|
@ -180,8 +203,11 @@ void GL_DisableDiffuseShaderGF3() {
|
||||||
glDisable(GL_TEXTURE_2D);
|
glDisable(GL_TEXTURE_2D);
|
||||||
|
|
||||||
GL_SelectTexture(GL_TEXTURE3_ARB);
|
GL_SelectTexture(GL_TEXTURE3_ARB);
|
||||||
if (currentshadowlight->filtercube) {
|
if (currentshadowlight->shader->numstages) {
|
||||||
glDisable(GL_TEXTURE_CUBE_MAP_ARB);
|
if (currentshadowlight->shader->stages[stageIndex].texture[0]->type == GL_TEXTURE_CUBE_MAP_ARB)
|
||||||
|
glDisable(GL_TEXTURE_CUBE_MAP_ARB);
|
||||||
|
else
|
||||||
|
glDisable(GL_TEXTURE_2D);
|
||||||
} else {
|
} else {
|
||||||
glDisable(GL_TEXTURE_3D);
|
glDisable(GL_TEXTURE_3D);
|
||||||
}
|
}
|
||||||
|
@ -195,7 +221,7 @@ void GL_DisableDiffuseShaderGF3() {
|
||||||
glDisable( GL_VERTEX_PROGRAM_NV );
|
glDisable( GL_VERTEX_PROGRAM_NV );
|
||||||
}
|
}
|
||||||
|
|
||||||
void GL_EnableSpecularShaderGF3(const transform_t *tr, vec3_t lightOrig, qboolean alias, qboolean packedGloss) {
|
void GL_EnableSpecularShaderGF3(const transform_t *tr, vec3_t lightOrig, int stageIndex, qboolean alias, qboolean packedGloss) {
|
||||||
|
|
||||||
vec3_t scaler = {0.5f, 0.5f, 0.5f};
|
vec3_t scaler = {0.5f, 0.5f, 0.5f};
|
||||||
float invrad = 1/currentshadowlight->radius;
|
float invrad = 1/currentshadowlight->radius;
|
||||||
|
@ -219,10 +245,23 @@ void GL_EnableSpecularShaderGF3(const transform_t *tr, vec3_t lightOrig, qboolea
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
glLoadIdentity();
|
glLoadIdentity();
|
||||||
|
|
||||||
if (currentshadowlight->filtercube) {
|
if (currentshadowlight->shader->numstages) {
|
||||||
glEnable(GL_TEXTURE_CUBE_MAP_ARB);
|
|
||||||
glBindTexture(GL_TEXTURE_CUBE_MAP_ARB, currentshadowlight->filtercube);
|
|
||||||
GL_SetupCubeMapMatrix(tr);
|
GL_SetupCubeMapMatrix(tr);
|
||||||
|
if (currentshadowlight->shader->stages[stageIndex].texture[0]->type == GL_TEXTURE_CUBE_MAP_ARB) {
|
||||||
|
glEnable(GL_TEXTURE_CUBE_MAP_ARB);
|
||||||
|
glBindTexture(GL_TEXTURE_CUBE_MAP_ARB, currentshadowlight->shader->stages[stageIndex].texture[0]->texnum);
|
||||||
|
} else {
|
||||||
|
glEnable(GL_TEXTURE_2D);
|
||||||
|
GL_BindAdvanced(currentshadowlight->shader->stages[stageIndex].texture[0]);
|
||||||
|
//Default = repeat the texture one time in the light's sphere
|
||||||
|
//Can be modified with the tcMod shader commands
|
||||||
|
glTranslatef(0.5,0.5,0.5);
|
||||||
|
glScalef(0.5,0.5,0.5);
|
||||||
|
glScalef(1.0f/(currentshadowlight->radiusv[0]),
|
||||||
|
1.0f/(currentshadowlight->radiusv[1]),
|
||||||
|
1.0f/(currentshadowlight->radiusv[2]));
|
||||||
|
}
|
||||||
|
GF3_SetupTcMods(¤tshadowlight->shader->stages[stageIndex]);
|
||||||
} else {
|
} else {
|
||||||
glEnable(GL_TEXTURE_3D);
|
glEnable(GL_TEXTURE_3D);
|
||||||
glBindTexture(GL_TEXTURE_3D, atten3d_texture_object);
|
glBindTexture(GL_TEXTURE_3D, atten3d_texture_object);
|
||||||
|
@ -448,10 +487,15 @@ void GF3_SetupTcMod(tcmod_t *tc) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GF3_SetupTcMods(stage_t *s) {
|
||||||
|
int i;
|
||||||
|
for (i=0; i<s->numtcmods; i++) {
|
||||||
|
GF3_SetupTcMod(&s->tcmods[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
void GF3_SetupSimpleStage(stage_t *s) {
|
void GF3_SetupSimpleStage(stage_t *s) {
|
||||||
tcmod_t *tc;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
if (s->type != STAGE_SIMPLE) {
|
if (s->type != STAGE_SIMPLE) {
|
||||||
Con_Printf("Non simple stage, in simple stage list");
|
Con_Printf("Non simple stage, in simple stage list");
|
||||||
|
@ -461,9 +505,7 @@ void GF3_SetupSimpleStage(stage_t *s) {
|
||||||
glMatrixMode(GL_TEXTURE);
|
glMatrixMode(GL_TEXTURE);
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
|
|
||||||
for (i=0; i<s->numtcmods; i++) {
|
GF3_SetupTcMods(s);
|
||||||
GF3_SetupTcMod(&s->tcmods[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (s->src_blend > -1) {
|
if (s->src_blend > -1) {
|
||||||
glBlendFunc(s->src_blend, s->dst_blend);
|
glBlendFunc(s->src_blend, s->dst_blend);
|
||||||
|
@ -550,9 +592,11 @@ void GF3_sendTriangleListTA(const vertexdef_t *verts, int *indecies, int numInde
|
||||||
|
|
||||||
void GF3_drawTriangleListBump (const vertexdef_t *verts, int *indecies, int numIndecies, shader_t *shader, const transform_t *tr) {
|
void GF3_drawTriangleListBump (const vertexdef_t *verts, int *indecies, int numIndecies, shader_t *shader, const transform_t *tr) {
|
||||||
|
|
||||||
|
int i, num;
|
||||||
|
|
||||||
if (!(shader->flags & SURF_PPLIGHT)) return;
|
if (!(shader->flags & SURF_PPLIGHT)) return;
|
||||||
|
|
||||||
if (currentshadowlight->filtercube) {
|
if (currentshadowlight->shader->numstages) {
|
||||||
//draw attent into dest alpha
|
//draw attent into dest alpha
|
||||||
GL_DrawAlpha();
|
GL_DrawAlpha();
|
||||||
GL_EnableAttentShaderGF3(currentshadowlight->origin);
|
GL_EnableAttentShaderGF3(currentshadowlight->origin);
|
||||||
|
@ -564,29 +608,36 @@ void GF3_drawTriangleListBump (const vertexdef_t *verts, int *indecies, int numI
|
||||||
}
|
}
|
||||||
glColor3fv(¤tshadowlight->color[0]);
|
glColor3fv(¤tshadowlight->color[0]);
|
||||||
|
|
||||||
|
num = (currentshadowlight->shader->numstages == 0) ? 1 : currentshadowlight->shader->numstages;
|
||||||
|
|
||||||
if ((shader->numglossstages > 0) && (shader->numbumpstages > 0)) {
|
if ((shader->numglossstages > 0) && (shader->numbumpstages > 0)) {
|
||||||
GL_EnableSpecularShaderGF3(tr,currentshadowlight->origin,true,(shader->glossstages[0].type == STAGE_GRAYGLOSS));
|
//FIXME: A lot of statechanges for every pass we could only rebind the texture (and some overhead like matrix setup,...)
|
||||||
//bind the correct texture
|
for(i=0; i<num; i++) {
|
||||||
GL_SelectTexture(GL_TEXTURE0_ARB);
|
GL_EnableSpecularShaderGF3(tr,currentshadowlight->origin,i,true,(shader->glossstages[0].type == STAGE_GRAYGLOSS));
|
||||||
GL_BindAdvanced(shader->bumpstages[0].texture[0]);
|
//bind the correct texture
|
||||||
|
GL_SelectTexture(GL_TEXTURE0_ARB);
|
||||||
|
GL_BindAdvanced(shader->bumpstages[0].texture[0]);
|
||||||
|
|
||||||
GL_SelectTexture(GL_TEXTURE2_ARB);
|
GL_SelectTexture(GL_TEXTURE2_ARB);
|
||||||
GL_BindAdvanced(shader->glossstages[0].texture[0]);
|
GL_BindAdvanced(shader->glossstages[0].texture[0]);
|
||||||
|
|
||||||
GF3_sendTriangleListTA(verts,indecies,numIndecies);
|
GF3_sendTriangleListTA(verts,indecies,numIndecies);
|
||||||
GL_DisableDiffuseShaderGF3();
|
GL_DisableDiffuseShaderGF3(i);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((shader->numcolorstages > 0) && (shader->numbumpstages > 0)) {
|
if ((shader->numcolorstages > 0) && (shader->numbumpstages > 0)) {
|
||||||
GL_EnableDiffuseShaderGF3(tr,currentshadowlight->origin);
|
for(i=0; i<num; i++) {
|
||||||
//bind the correct texture
|
GL_EnableDiffuseShaderGF3(tr,currentshadowlight->origin,i);
|
||||||
GL_SelectTexture(GL_TEXTURE0_ARB);
|
//bind the correct texture
|
||||||
GL_BindAdvanced(shader->bumpstages[0].texture[0]);
|
GL_SelectTexture(GL_TEXTURE0_ARB);
|
||||||
GL_SelectTexture(GL_TEXTURE2_ARB);
|
GL_BindAdvanced(shader->bumpstages[0].texture[0]);
|
||||||
GL_BindAdvanced(shader->colorstages[0].texture[0]);
|
GL_SelectTexture(GL_TEXTURE2_ARB);
|
||||||
|
GL_BindAdvanced(shader->colorstages[0].texture[0]);
|
||||||
|
|
||||||
GF3_sendTriangleListTA(verts,indecies,numIndecies);
|
GF3_sendTriangleListTA(verts,indecies,numIndecies);
|
||||||
GL_DisableDiffuseShaderGF3();
|
GL_DisableDiffuseShaderGF3(i);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -828,6 +879,142 @@ Generic world surfaces routines
|
||||||
|
|
||||||
**************************/
|
**************************/
|
||||||
|
|
||||||
|
#ifdef AMBIENT_BUMP
|
||||||
|
|
||||||
|
gltexture_t *cubetex = NULL;
|
||||||
|
|
||||||
|
void GF3_sendSurfacesAmbient(msurface_t **surfs, int numSurfaces) {
|
||||||
|
int i;
|
||||||
|
glpoly_t *p;
|
||||||
|
msurface_t *surf;
|
||||||
|
float packed_normal [3];
|
||||||
|
static float trans[3] = {0.5, 0.5, 0.5};
|
||||||
|
vec3_t newtan, newbin, newnrm;
|
||||||
|
float *oldtan, *oldbin, *oldnrm;
|
||||||
|
|
||||||
|
for (i=0; i<numSurfaces; i++) {
|
||||||
|
surf = surfs[i];
|
||||||
|
if (surf->visframe != r_framecount)
|
||||||
|
continue;
|
||||||
|
p = surf->polys;
|
||||||
|
|
||||||
|
oldtan = &surf->tangent[0];
|
||||||
|
oldbin = &surf->binormal[0];
|
||||||
|
oldnrm = &surf->plane->normal[0];
|
||||||
|
|
||||||
|
//Transpose: gives tangent->object
|
||||||
|
newtan[0] = oldtan[0];
|
||||||
|
newtan[1] = -oldbin[0];
|
||||||
|
newtan[2] = oldnrm[0];
|
||||||
|
|
||||||
|
newbin[0] = oldtan[1];
|
||||||
|
newbin[1] = -oldbin[1];
|
||||||
|
newbin[2] = oldnrm[1];
|
||||||
|
|
||||||
|
newnrm[0] = oldtan[2];
|
||||||
|
newnrm[1] = -oldbin[2];
|
||||||
|
newnrm[2] = oldnrm[2];
|
||||||
|
|
||||||
|
qglMultiTexCoord3fvARB(GL_TEXTURE1_ARB, newtan);
|
||||||
|
qglMultiTexCoord3fvARB(GL_TEXTURE2_ARB, newbin);
|
||||||
|
qglMultiTexCoord3fvARB(GL_TEXTURE3_ARB, newnrm);
|
||||||
|
|
||||||
|
glDrawElements(GL_TRIANGLES, p->numindecies, GL_UNSIGNED_INT, &p->indecies[0]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void GF3_sendSurfacesAmbientBase(msurface_t **surfs, int numSurfaces) {
|
||||||
|
int i;
|
||||||
|
glpoly_t *p;
|
||||||
|
msurface_t *surf;
|
||||||
|
float packed_normal [3];
|
||||||
|
static float trans[3] = {0.5, 0.5, 0.5};
|
||||||
|
vec3_t newtan, newbin, newnrm;
|
||||||
|
float *oldtan, *oldbin, *oldnrm;
|
||||||
|
|
||||||
|
for (i=0; i<numSurfaces; i++) {
|
||||||
|
surf = surfs[i];
|
||||||
|
if (surf->visframe != r_framecount)
|
||||||
|
continue;
|
||||||
|
p = surf->polys;
|
||||||
|
|
||||||
|
if (surf->lightmaptexturenum < 0)
|
||||||
|
continue;
|
||||||
|
GL_Bind(lightmap_textures+surf->lightmaptexturenum);
|
||||||
|
|
||||||
|
glDrawElements(GL_TRIANGLES, p->numindecies, GL_UNSIGNED_INT, &p->indecies[0]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void GF3_TestAmbientBumps (vertexdef_t *verts, msurface_t **surfs, int numSurfaces, shader_t *shader) {
|
||||||
|
|
||||||
|
glGetError();
|
||||||
|
if (!cubetex) {
|
||||||
|
cubetex = GL_CacheTexture ("cubemaps/cube_", false, TEXTURE_CUBEMAP);
|
||||||
|
}
|
||||||
|
|
||||||
|
//Pass 1: Lightmap (= ambient occlusion) * colormap
|
||||||
|
|
||||||
|
qglClientActiveTextureARB(GL_TEXTURE1_ARB);
|
||||||
|
glTexCoordPointer(2, GL_FLOAT, verts->lightmapstride, verts->lightmapcoords);
|
||||||
|
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||||
|
|
||||||
|
if (shader->numcolorstages) {
|
||||||
|
if (shader->colorstages[0].numtextures)
|
||||||
|
GL_BindAdvanced(shader->colorstages[0].texture[0]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
glEnable(GL_REGISTER_COMBINERS_NV);
|
||||||
|
glCallList(ambientBumpCombiner2);
|
||||||
|
|
||||||
|
GL_EnableMultitexture();
|
||||||
|
|
||||||
|
GF3_sendSurfacesAmbientBase(surfs, numSurfaces);
|
||||||
|
|
||||||
|
GL_DisableMultitexture();
|
||||||
|
|
||||||
|
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||||
|
|
||||||
|
//Pass 2: Dependent lookup in cubemap
|
||||||
|
|
||||||
|
glEnable(GL_BLEND);
|
||||||
|
|
||||||
|
if (shader->numbumpstages) {
|
||||||
|
if (shader->bumpstages[0].numtextures)
|
||||||
|
GL_BindAdvanced(shader->bumpstages[0].texture[0]);
|
||||||
|
}
|
||||||
|
|
||||||
|
glEnable(GL_TEXTURE_SHADER_NV);
|
||||||
|
glCallList(ambientBumpTS);
|
||||||
|
|
||||||
|
glCallList(ambientBumpCombiner);
|
||||||
|
|
||||||
|
checkerror();
|
||||||
|
|
||||||
|
GL_SelectTexture(GL_TEXTURE3_ARB);
|
||||||
|
glEnable(GL_TEXTURE_CUBE_MAP_ARB);
|
||||||
|
glBindTexture(GL_TEXTURE_CUBE_MAP_ARB, cubetex->texnum);
|
||||||
|
|
||||||
|
glColor3ub(255,255,255);
|
||||||
|
|
||||||
|
glBlendFunc(GL_DST_COLOR, GL_ZERO);
|
||||||
|
|
||||||
|
GF3_sendSurfacesAmbient(surfs, numSurfaces);
|
||||||
|
|
||||||
|
glDisable(GL_TEXTURE_CUBE_MAP_ARB);
|
||||||
|
GL_SelectTexture(GL_TEXTURE0_ARB);
|
||||||
|
|
||||||
|
glDisable(GL_BLEND);
|
||||||
|
|
||||||
|
glDisable(GL_TEXTURE_SHADER_NV);
|
||||||
|
|
||||||
|
glDisable(GL_REGISTER_COMBINERS_NV);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
void GF3_sendSurfacesBase(msurface_t **surfs, int numSurfaces, qboolean bindLightmap) {
|
void GF3_sendSurfacesBase(msurface_t **surfs, int numSurfaces, qboolean bindLightmap) {
|
||||||
int i;
|
int i;
|
||||||
glpoly_t *p;
|
glpoly_t *p;
|
||||||
|
@ -910,7 +1097,11 @@ void GF3_drawSurfaceListBase (vertexdef_t *verts, msurface_t **surfs, int numSur
|
||||||
}
|
}
|
||||||
|
|
||||||
if (verts->lightmapcoords && (shader->flags & SURF_PPLIGHT)) {
|
if (verts->lightmapcoords && (shader->flags & SURF_PPLIGHT)) {
|
||||||
|
#ifdef AMBIENT_BUMP
|
||||||
|
|
||||||
|
GF3_TestAmbientBumps(verts, surfs, numSurfaces, shader);
|
||||||
|
|
||||||
|
#else
|
||||||
qglClientActiveTextureARB(GL_TEXTURE1_ARB);
|
qglClientActiveTextureARB(GL_TEXTURE1_ARB);
|
||||||
glTexCoordPointer(2, GL_FLOAT, verts->lightmapstride, verts->lightmapcoords);
|
glTexCoordPointer(2, GL_FLOAT, verts->lightmapstride, verts->lightmapcoords);
|
||||||
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
|
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||||
|
@ -923,7 +1114,6 @@ void GF3_drawSurfaceListBase (vertexdef_t *verts, msurface_t **surfs, int numSur
|
||||||
}
|
}
|
||||||
|
|
||||||
if (usedelux) {
|
if (usedelux) {
|
||||||
|
|
||||||
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
|
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||||
|
|
||||||
qglClientActiveTextureARB(GL_TEXTURE0_ARB);
|
qglClientActiveTextureARB(GL_TEXTURE0_ARB);
|
||||||
|
@ -1031,7 +1221,6 @@ void GF3_drawSurfaceListBase (vertexdef_t *verts, msurface_t **surfs, int numSur
|
||||||
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
|
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||||
|
|
||||||
qglClientActiveTextureARB(GL_TEXTURE1_ARB);
|
qglClientActiveTextureARB(GL_TEXTURE1_ARB);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (shader->numstages && shader->numcolorstages)
|
if (shader->numstages && shader->numcolorstages)
|
||||||
|
@ -1080,6 +1269,7 @@ void GF3_drawSurfaceListBase (vertexdef_t *verts, msurface_t **surfs, int numSur
|
||||||
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
|
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||||
GL_DisableMultitexture();
|
GL_DisableMultitexture();
|
||||||
qglClientActiveTextureARB(GL_TEXTURE0_ARB);
|
qglClientActiveTextureARB(GL_TEXTURE0_ARB);
|
||||||
|
#endif //Ambient bump
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!shader->cull) {
|
if (!shader->cull) {
|
||||||
|
@ -1227,13 +1417,15 @@ void GF3_sendSurfacesPlain(msurface_t **surfs, int numSurfaces) {
|
||||||
|
|
||||||
void GF3_drawSurfaceListBump (vertexdef_t *verts, msurface_t **surfs, int numSurfaces,const transform_t *tr) {
|
void GF3_drawSurfaceListBump (vertexdef_t *verts, msurface_t **surfs, int numSurfaces,const transform_t *tr) {
|
||||||
|
|
||||||
|
int i, num;
|
||||||
|
|
||||||
glVertexPointer(3, GL_FLOAT, verts->vertexstride, verts->vertices);
|
glVertexPointer(3, GL_FLOAT, verts->vertexstride, verts->vertices);
|
||||||
glEnableClientState(GL_VERTEX_ARRAY);
|
glEnableClientState(GL_VERTEX_ARRAY);
|
||||||
|
|
||||||
qglClientActiveTextureARB(GL_TEXTURE0_ARB);
|
qglClientActiveTextureARB(GL_TEXTURE0_ARB);
|
||||||
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
|
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||||
|
|
||||||
if (currentshadowlight->filtercube) {
|
if (currentshadowlight->shader->numstages) {
|
||||||
//draw attent into dest alpha
|
//draw attent into dest alpha
|
||||||
GL_DrawAlpha();
|
GL_DrawAlpha();
|
||||||
GL_EnableAttentShaderGF3(currentshadowlight->origin);
|
GL_EnableAttentShaderGF3(currentshadowlight->origin);
|
||||||
|
@ -1248,16 +1440,20 @@ void GF3_drawSurfaceListBump (vertexdef_t *verts, msurface_t **surfs, int numSur
|
||||||
}
|
}
|
||||||
glColor3fv(¤tshadowlight->color[0]);
|
glColor3fv(¤tshadowlight->color[0]);
|
||||||
|
|
||||||
|
num = (currentshadowlight->shader->numstages == 0) ? 1 : currentshadowlight->shader->numstages;
|
||||||
|
for (i=0; i<num; i++) {
|
||||||
|
GL_EnableSpecularShaderGF3(tr,currentshadowlight->origin, i, true,true);
|
||||||
|
glTexCoordPointer(2, GL_FLOAT, verts->texcoordstride, verts->texcoords);
|
||||||
|
GF3_sendSurfacesTA(surfs,numSurfaces, true);
|
||||||
|
GL_DisableDiffuseShaderGF3(i);
|
||||||
|
}
|
||||||
|
|
||||||
GL_EnableSpecularShaderGF3(tr,currentshadowlight->origin,true,true);
|
|
||||||
|
|
||||||
glTexCoordPointer(2, GL_FLOAT, verts->texcoordstride, verts->texcoords);
|
for (i=0; i<num; i++) {
|
||||||
GF3_sendSurfacesTA(surfs,numSurfaces, true);
|
GL_EnableDiffuseShaderGF3(tr,currentshadowlight->origin,i);
|
||||||
GL_DisableDiffuseShaderGF3();
|
GF3_sendSurfacesTA(surfs,numSurfaces, false);
|
||||||
|
GL_DisableDiffuseShaderGF3(i);
|
||||||
GL_EnableDiffuseShaderGF3(tr,currentshadowlight->origin);
|
}
|
||||||
GF3_sendSurfacesTA(surfs,numSurfaces, false);
|
|
||||||
GL_DisableDiffuseShaderGF3();
|
|
||||||
|
|
||||||
glDisableClientState(GL_VERTEX_ARRAY);
|
glDisableClientState(GL_VERTEX_ARRAY);
|
||||||
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
|
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||||
|
@ -1472,7 +1668,6 @@ void BUMP_InitGeforce3(void) {
|
||||||
qglLoadProgramNV( GL_VERTEX_PROGRAM_NV, specularalias_program_object,
|
qglLoadProgramNV( GL_VERTEX_PROGRAM_NV, specularalias_program_object,
|
||||||
strlen(vpSpecularAliasGF3), (const GLubyte *) vpSpecularAliasGF3);
|
strlen(vpSpecularAliasGF3), (const GLubyte *) vpSpecularAliasGF3);
|
||||||
|
|
||||||
|
|
||||||
qglGenProgramsNV( 1, &delux_program_object);
|
qglGenProgramsNV( 1, &delux_program_object);
|
||||||
|
|
||||||
qglLoadProgramNV( GL_VERTEX_PROGRAM_NV, delux_program_object,
|
qglLoadProgramNV( GL_VERTEX_PROGRAM_NV, delux_program_object,
|
||||||
|
@ -1500,6 +1695,11 @@ void BUMP_InitGeforce3(void) {
|
||||||
qglProgramParameter4fNV( GL_VERTEX_PROGRAM_NV, 20, 0.5, 0.5, 0.5, 0.5);
|
qglProgramParameter4fNV( GL_VERTEX_PROGRAM_NV, 20, 0.5, 0.5, 0.5, 0.5);
|
||||||
|
|
||||||
deluxCombiner = NV_LoadCombiner("hardware/delux.regcomb");
|
deluxCombiner = NV_LoadCombiner("hardware/delux.regcomb");
|
||||||
|
#ifdef AMBIENT_BUMP
|
||||||
|
ambientBumpTS = NV_LoadCombiner("hardware/ambientbump.ts");
|
||||||
|
ambientBumpCombiner = NV_LoadCombiner("hardware/ambientbump.regcomb");
|
||||||
|
ambientBumpCombiner2 = NV_LoadCombiner("hardware/ambientbump_2.regcomb");
|
||||||
|
#endif
|
||||||
|
|
||||||
//bind the correct stuff to the bump mapping driver
|
//bind the correct stuff to the bump mapping driver
|
||||||
gl_bumpdriver.drawSurfaceListBase = GF3_drawSurfaceListBase;
|
gl_bumpdriver.drawSurfaceListBase = GF3_drawSurfaceListBase;
|
||||||
|
|
Loading…
Reference in a new issue