bbox lighting

This commit is contained in:
jpaana 2003-05-05 04:25:34 +00:00
parent 8908e5908e
commit cc1812b018
3 changed files with 15 additions and 33 deletions

View file

@ -850,8 +850,6 @@ void ARB_DisableBumpShader(shader_t* shader)
void ARB_EnableBumpShader(const transform_t *tr, vec3_t lightOrig,
qboolean alias, shader_t* shader)
{
float invrad = 1/currentshadowlight->radius;
//tex 0 = normal map
//tex 1 = color map
//tex 2 = attenuation
@ -870,7 +868,9 @@ void ARB_EnableBumpShader(const transform_t *tr, vec3_t lightOrig,
glTranslatef(0.5,0.5,0.5);
glScalef(0.5,0.5,0.5);
glScalef(invrad, invrad, invrad);
glScalef(1.0f/(currentshadowlight->radiusv[0]),
1.0f/(currentshadowlight->radiusv[1]),
1.0f/(currentshadowlight->radiusv[2]));
glTranslatef(-lightOrig[0], -lightOrig[1], -lightOrig[2]);
glGetError();
@ -1046,9 +1046,6 @@ void ARB_drawTriangleListBump (const vertexdef_t *verts, int *indecies,
int numIndecies, shader_t *shader,
const transform_t *tr)
{
int foo;
void* foo2;
glEnableClientState(GL_VERTEX_ARRAY);
glVertexPointer(3, GL_FLOAT, verts->vertexstride, verts->vertices);

View file

@ -902,8 +902,6 @@ void Parhelia_CreateShaders()
*/
void Parhelia_EnableDiffuseShader(const transform_t *tr, vec3_t lightOrig)
{
float invrad = 1/currentshadowlight->radius;
//tex 0 = normal map
//tex 1 = normalization cube map (tangent space light vector)
//tex 2 = color map
@ -945,7 +943,9 @@ void Parhelia_EnableDiffuseShader(const transform_t *tr, vec3_t lightOrig)
glTranslatef(0.5,0.5,0.5);
glScalef(0.5,0.5,0.5);
glScalef(invrad, invrad, invrad);
glScalef(1.0f/(currentshadowlight->radiusv[0]),
1.0f/(currentshadowlight->radiusv[1]),
1.0f/(currentshadowlight->radiusv[2]));
glTranslatef(-lightOrig[0], -lightOrig[1], -lightOrig[2]);
qglBindFragShaderMTX( fragment_shaders );
@ -991,7 +991,6 @@ void Parhelia_EnableSpecularShader(const transform_t *tr, vec3_t lightOrig,
qboolean alias)
{
vec3_t scaler = {0.5f, 0.5f, 0.5f};
float invrad = 1/currentshadowlight->radius;
glEnable(GL_VERTEX_SHADER_EXT);
qglBindVertexShaderEXT( vertex_shaders+1 );
checkerror();
@ -1031,7 +1030,9 @@ void Parhelia_EnableSpecularShader(const transform_t *tr, vec3_t lightOrig,
glTranslatef(0.5,0.5,0.5);
glScalef(0.5,0.5,0.5);
glScalef(invrad, invrad, invrad);
glScalef(1.0f/(currentshadowlight->radiusv[0]),
1.0f/(currentshadowlight->radiusv[1]),
1.0f/(currentshadowlight->radiusv[2]));
glTranslatef(-lightOrig[0], -lightOrig[1], -lightOrig[2]);
qglBindFragShaderMTX( fragment_shaders + 2 );
@ -1044,13 +1045,14 @@ void Parhelia_EnableSpecularShader(const transform_t *tr, vec3_t lightOrig,
void Parhelia_EnableAttentShader(vec3_t lightOrig)
{
float invrad = 1/currentshadowlight->radius;
glMatrixMode(GL_TEXTURE);
glPushMatrix();
glLoadIdentity();
glTranslatef(0.5,0.5,0.5);
glScalef(0.5,0.5,0.5);
glScalef(invrad, invrad, invrad);
glScalef(1.0f/(currentshadowlight->radiusv[0]),
1.0f/(currentshadowlight->radiusv[1]),
1.0f/(currentshadowlight->radiusv[2]));
glTranslatef(-lightOrig[0],
-lightOrig[1],
-lightOrig[2]);

View file

@ -882,7 +882,6 @@ void Radeon_EnableBumpShader(const transform_t *tr, vec3_t lightOrig,
qboolean alias)
{
GLfloat temp[4];
float invrad = 1/currentshadowlight->radius;
//tex 0 = normal map
//tex 1 = normalization cube map (tangent space light vector)
@ -940,7 +939,9 @@ void Radeon_EnableBumpShader(const transform_t *tr, vec3_t lightOrig,
glTranslatef(0.5,0.5,0.5);
glScalef(0.5,0.5,0.5);
glScalef(invrad, invrad, invrad);
glScalef(1.0f/(currentshadowlight->radiusv[0]),
1.0f/(currentshadowlight->radiusv[1]),
1.0f/(currentshadowlight->radiusv[2]));
glTranslatef(-lightOrig[0], -lightOrig[1], -lightOrig[2]);
GL_SelectTexture(GL_TEXTURE0_ARB);
@ -1376,15 +1377,6 @@ void Radeon_sendSurfacesTA(msurface_t** surfs, int numSurfaces)
qglMultiTexCoord3fvARB(GL_TEXTURE1_ARB, &surf->tangent[0]);
qglMultiTexCoord3fvARB(GL_TEXTURE2_ARB, &surf->binormal[0]);
qglMultiTexCoord3fvARB(GL_TEXTURE3_ARB, &surf->plane->normal[0]);
/*
glBegin(GL_POLYGON);
v = (float *)(&globalVertexTable[surf->polys->firstvertex]);
for (j=0; j<p->numverts; j++, v+= VERTEXSIZE) {
qglMultiTexCoord2fARB(GL_TEXTURE0_ARB, v[3], v[4]);
glVertex3fv(&v[0]);
}
glEnd();
*/
glDrawElements(GL_TRIANGLES, p->numindecies, GL_UNSIGNED_INT, &p->indecies[0]);
}
@ -1435,15 +1427,6 @@ void Radeon_sendSurfacesPlain(msurface_t** surfs, int numSurfaces)
}
lastshader = shader;
}
/*
glBegin(GL_POLYGON);
v = (float *)(&globalVertexTable[surf->polys->firstvertex]);
for (j=0; j<p->numverts; j++, v+= VERTEXSIZE) {
//qglMultiTexCoord2fARB(GL_TEXTURE0_ARB, v[3], v[4]);
glVertex3fv(&v[0]);
}
glEnd();
*/
glDrawElements(GL_TRIANGLES, p->numindecies, GL_UNSIGNED_INT,
&p->indecies[0]);
}