Some cleanup

This commit is contained in:
jpaana 2004-03-24 00:20:55 +00:00
parent 7e5d433eea
commit df5b42137c

View file

@ -1276,7 +1276,9 @@ void ARB_drawTriangleListBump (const vertexdef_t *verts, int *indecies,
4 normal 4 normal
5 (position for fragment shader, generated in vertex shader) 5 (position for fragment shader, generated in vertex shader)
*/ */
void ARB_AddDeluxPass(vertexdef_t *verts, int *indecies, int numIndecies, shader_t *shader, int lightmapIndex) { void ARB_AddDeluxPass(vertexdef_t *verts, int *indecies, int numIndecies,
shader_t *shader, int lightmapIndex)
{
// Setup blending // Setup blending
if (shader->numstages && shader->numcolorstages) if (shader->numstages && shader->numcolorstages)
{ {
@ -1291,7 +1293,9 @@ void ARB_AddDeluxPass(vertexdef_t *verts, int *indecies, int numIndecies, shader
glEnable(GL_BLEND); glEnable(GL_BLEND);
glBlendFunc(GL_ONE, GL_ONE); glBlendFunc(GL_ONE, GL_ONE);
} }
} else { }
else
{
glDisable(GL_BLEND); glDisable(GL_BLEND);
} }
SH_SetupAlphaTest(shader); SH_SetupAlphaTest(shader);
@ -1367,7 +1371,9 @@ void ARB_AddDeluxPass(vertexdef_t *verts, int *indecies, int numIndecies, shader
GL_SelectTexture(GL_TEXTURE0_ARB); GL_SelectTexture(GL_TEXTURE0_ARB);
} }
void ARB_AddLightmapPass(vertexdef_t *verts, int *indecies, int numIndecies, shader_t *shader, int lightmapIndex) { void ARB_AddLightmapPass(vertexdef_t *verts, int *indecies, int numIndecies,
shader_t *shader, int lightmapIndex)
{
if (shader->numstages && shader->numcolorstages) if (shader->numstages && shader->numcolorstages)
{ {
if (shader->colorstages[0].src_blend >= 0) if (shader->colorstages[0].src_blend >= 0)
@ -1422,7 +1428,9 @@ void ARB_AddLightmapPass(vertexdef_t *verts, int *indecies, int numIndecies, sha
GL_SelectTexture(GL_TEXTURE0_ARB); GL_SelectTexture(GL_TEXTURE0_ARB);
} }
void ARB_AddLVertexColorPass(vertexdef_t *verts, int *indecies, int numIndecies, shader_t *shader) { void ARB_AddLVertexColorPass(vertexdef_t *verts, int *indecies,
int numIndecies, shader_t *shader)
{
if (shader->numstages && shader->numcolorstages) if (shader->numstages && shader->numcolorstages)
{ {
if (shader->colorstages[0].src_blend >= 0) if (shader->colorstages[0].src_blend >= 0)
@ -1469,9 +1477,9 @@ void ARB_drawTriangleListBase (vertexdef_t *verts, int *indecies,
{ {
int i; int i;
if (!shader->cull) { if (!shader->cull)
glDisable(GL_CULL_FACE); glDisable(GL_CULL_FACE);
}
glColor3ub(255,255,255); glColor3ub(255,255,255);
//Setup vertex arrays //Setup vertex arrays
@ -1500,17 +1508,24 @@ void ARB_drawTriangleListBase (vertexdef_t *verts, int *indecies,
else else
ARB_AddLightmapPass(verts, indecies, numIndecies, shader, lightmapIndex); ARB_AddLightmapPass(verts, indecies, numIndecies, shader, lightmapIndex);
//Use vertex colors or just black //Use vertex colors or just black
} else { }
else
{
if (!IsNullDriver(verts->colors) && (shader->flags & SURF_PPLIGHT)) if (!IsNullDriver(verts->colors) && (shader->flags & SURF_PPLIGHT))
{ {
ARB_AddLVertexColorPass(verts, indecies, numIndecies, shader); ARB_AddLVertexColorPass(verts, indecies, numIndecies, shader);
} else if (shader->flags & SURF_PPLIGHT) { }
if (shader->colorstages[0].src_blend >= 0) { else
{
if (shader->flags & SURF_PPLIGHT)
{
if (shader->colorstages[0].src_blend >= 0)
{
glBlendFunc(shader->colorstages[0].src_blend, shader->colorstages[0].dst_blend); glBlendFunc(shader->colorstages[0].src_blend, shader->colorstages[0].dst_blend);
glEnable(GL_BLEND); glEnable(GL_BLEND);
} else {
glDisable(GL_BLEND);
} }
else
glDisable(GL_BLEND);
glColor3f(0,0,0); glColor3f(0,0,0);
glDisable(GL_TEXTURE_2D); glDisable(GL_TEXTURE_2D);
@ -1518,6 +1533,7 @@ void ARB_drawTriangleListBase (vertexdef_t *verts, int *indecies,
glEnable(GL_TEXTURE_2D); glEnable(GL_TEXTURE_2D);
} }
} }
}
qglClientActiveTextureARB(GL_TEXTURE0_ARB); qglClientActiveTextureARB(GL_TEXTURE0_ARB);
glDisableClientState(GL_TEXTURE_COORD_ARRAY); glDisableClientState(GL_TEXTURE_COORD_ARRAY);
@ -1525,9 +1541,8 @@ void ARB_drawTriangleListBase (vertexdef_t *verts, int *indecies,
glDisable(GL_BLEND); glDisable(GL_BLEND);
glDisable(GL_ALPHA_TEST); glDisable(GL_ALPHA_TEST);
if (!shader->cull) { if (!shader->cull)
glEnable(GL_CULL_FACE); glEnable(GL_CULL_FACE);
}
} }
/************************* /*************************
@ -1764,7 +1779,8 @@ void ARB_drawSurfaceListBase (vertexdef_t* verts, msurface_t** surfs,
glDisable(GL_BLEND); glDisable(GL_BLEND);
} }
void ARB_sendSurfacesTA(msurface_t** surfs, int numSurfaces, const transform_t *tr, const lightobject_t *lo) void ARB_sendSurfacesTA(msurface_t** surfs, int numSurfaces,
const transform_t *tr, const lightobject_t *lo)
{ {
int i,j; int i,j;
glpoly_t *p; glpoly_t *p;
@ -1867,7 +1883,8 @@ void ARB_sendSurfacesTA(msurface_t** surfs, int numSurfaces, const transform_t *
void ARB_drawSurfaceListBump (vertexdef_t *verts, msurface_t **surfs, void ARB_drawSurfaceListBump (vertexdef_t *verts, msurface_t **surfs,
int numSurfaces,const transform_t *tr, const lightobject_t *lo) int numSurfaces,const transform_t *tr,
const lightobject_t *lo)
{ {
GL_VertexPointer(3, GL_FLOAT, verts->vertexstride, verts->vertices); GL_VertexPointer(3, GL_FLOAT, verts->vertexstride, verts->vertices);
glEnableClientState(GL_VERTEX_ARRAY); glEnableClientState(GL_VERTEX_ARRAY);
@ -1910,7 +1927,8 @@ void BUMP_InitARB(void)
} }
void BindGlareShader(void) { void BindGlareShader(void)
{
glEnable(GL_VERTEX_PROGRAM_ARB); glEnable(GL_VERTEX_PROGRAM_ARB);
qglBindProgramARB( GL_VERTEX_PROGRAM_ARB, vertex_programs[V_BLUR_PROGRAM] ); qglBindProgramARB( GL_VERTEX_PROGRAM_ARB, vertex_programs[V_BLUR_PROGRAM] );
glEnable(GL_FRAGMENT_PROGRAM_ARB); glEnable(GL_FRAGMENT_PROGRAM_ARB);
@ -1918,7 +1936,8 @@ void BindGlareShader(void) {
} }
void UnbindGlareShader(void) { void UnbindGlareShader(void)
{
glDisable(GL_FRAGMENT_PROGRAM_ARB); glDisable(GL_FRAGMENT_PROGRAM_ARB);
glDisable(GL_VERTEX_PROGRAM_ARB); glDisable(GL_VERTEX_PROGRAM_ARB);
} }