Unified naming and support for video textures
This commit is contained in:
parent
cf8ae86c64
commit
4625e7fe6f
2 changed files with 58 additions and 62 deletions
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
Copyright (C) 2001-2002 Charles Hollemeersch
|
||||
Copyright (C) 2002-2003 Jarno Paananen
|
||||
Parhelia version Copyright (C) 2002-2003 Jarno Paananen
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
|
@ -312,7 +312,7 @@ extern PFNGLGETLOCALCONSTANTINTEGERVEXTPROC qglGetLocalConstantIntegervEXT;
|
|||
extern PFNGLGETLOCALCONSTANTFLOATVEXTPROC qglGetLocalConstantFloatvEXT;
|
||||
|
||||
|
||||
void GL_CreateShadersParhelia()
|
||||
void Parhelia_CreateShaders()
|
||||
{
|
||||
GLuint mvp, modelview, zcomp, tempvec;
|
||||
GLuint texturematrix;
|
||||
|
@ -900,7 +900,7 @@ void GL_CreateShadersParhelia()
|
|||
Pixel shader for diffuse bump mapping does diffuse bumpmapping with norm
|
||||
cube, self shadowing & dist attent in 1 pass
|
||||
*/
|
||||
void GL_EnableDiffuseShaderParhelia(const transform_t *tr, vec3_t lightOrig)
|
||||
void Parhelia_EnableDiffuseShader(const transform_t *tr, vec3_t lightOrig)
|
||||
{
|
||||
float invrad = 1/currentshadowlight->radius;
|
||||
|
||||
|
@ -956,7 +956,7 @@ void GL_EnableDiffuseShaderParhelia(const transform_t *tr, vec3_t lightOrig)
|
|||
|
||||
}
|
||||
|
||||
void GL_DisableDiffuseShaderParhelia()
|
||||
void Parhelia_DisableDiffuseShader()
|
||||
{
|
||||
//tex 0 = normal map
|
||||
//tex 1 = normalization cube map (tangent space light vector)
|
||||
|
@ -987,8 +987,8 @@ void GL_DisableDiffuseShaderParhelia()
|
|||
GL_SelectTexture(GL_TEXTURE0_ARB);
|
||||
}
|
||||
|
||||
void GL_EnableSpecularShaderParhelia(const transform_t *tr, vec3_t lightOrig,
|
||||
qboolean alias)
|
||||
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;
|
||||
|
@ -1042,12 +1042,7 @@ void GL_EnableSpecularShaderParhelia(const transform_t *tr, vec3_t lightOrig,
|
|||
|
||||
}
|
||||
|
||||
/*
|
||||
GL_DisableSpecularShaderParhelia() ??
|
||||
Same as GL_DisableDiffuseShaderParhelia()
|
||||
*/
|
||||
|
||||
void GL_EnableAttentShaderParhelia(vec3_t lightOrig)
|
||||
void Parhelia_EnableAttentShader(vec3_t lightOrig)
|
||||
{
|
||||
float invrad = 1/currentshadowlight->radius;
|
||||
glMatrixMode(GL_TEXTURE);
|
||||
|
@ -1065,7 +1060,7 @@ void GL_EnableAttentShaderParhelia(vec3_t lightOrig)
|
|||
glBindTexture(GL_TEXTURE_3D, atten3d_texture_object);
|
||||
}
|
||||
|
||||
void GL_DisableAttentShaderParhelia()
|
||||
void Parhelia_DisableAttentShader()
|
||||
{
|
||||
glPopMatrix();
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
|
@ -1219,9 +1214,9 @@ void Parhelia_drawTriangleListBump (const vertexdef_t *verts, int *indecies,
|
|||
{
|
||||
//draw attent into dest alpha
|
||||
GL_DrawAlpha();
|
||||
GL_EnableAttentShaderParhelia(currentshadowlight->origin);
|
||||
Parhelia_EnableAttentShader(currentshadowlight->origin);
|
||||
Parhelia_sendTriangleListWV(verts,indecies,numIndecies);
|
||||
GL_DisableAttentShaderParhelia();
|
||||
Parhelia_DisableAttentShader();
|
||||
GL_ModulateAlphaDrawColor();
|
||||
}
|
||||
else
|
||||
|
@ -1230,7 +1225,7 @@ void Parhelia_drawTriangleListBump (const vertexdef_t *verts, int *indecies,
|
|||
}
|
||||
glColor3fv(¤tshadowlight->color[0]);
|
||||
|
||||
GL_EnableSpecularShaderParhelia(tr,currentshadowlight->origin,true);
|
||||
Parhelia_EnableSpecularShader(tr,currentshadowlight->origin,true);
|
||||
//bind the correct texture
|
||||
GL_SelectTexture(GL_TEXTURE0_ARB);
|
||||
if (shader->numbumpstages > 0)
|
||||
|
@ -1240,9 +1235,9 @@ void Parhelia_drawTriangleListBump (const vertexdef_t *verts, int *indecies,
|
|||
GL_Bind(shader->colorstages[0].texture[0]->texnum);
|
||||
|
||||
Parhelia_sendTriangleListTA(verts,indecies,numIndecies);
|
||||
GL_DisableDiffuseShaderParhelia();
|
||||
Parhelia_DisableDiffuseShader();
|
||||
|
||||
GL_EnableDiffuseShaderParhelia(tr,currentshadowlight->origin);
|
||||
Parhelia_EnableDiffuseShader(tr,currentshadowlight->origin);
|
||||
//bind the correct texture
|
||||
GL_SelectTexture(GL_TEXTURE0_ARB);
|
||||
if (shader->numbumpstages > 0)
|
||||
|
@ -1252,11 +1247,12 @@ void Parhelia_drawTriangleListBump (const vertexdef_t *verts, int *indecies,
|
|||
GL_Bind(shader->colorstages[0].texture[0]->texnum);
|
||||
|
||||
Parhelia_sendTriangleListTA(verts,indecies,numIndecies);
|
||||
GL_DisableDiffuseShaderParhelia();
|
||||
Parhelia_DisableDiffuseShader();
|
||||
}
|
||||
|
||||
void Parhelia_drawTriangleListBase (vertexdef_t *verts, int *indecies,
|
||||
int numIndecies, shader_t *shader)
|
||||
int numIndecies, shader_t *shader,
|
||||
int lightMapIndex)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
@ -1603,12 +1599,12 @@ void Parhelia_drawSurfaceListBump (vertexdef_t *verts, msurface_t **surfs,
|
|||
{
|
||||
//draw attent into dest alpha
|
||||
GL_DrawAlpha();
|
||||
GL_EnableAttentShaderParhelia(currentshadowlight->origin);
|
||||
Parhelia_EnableAttentShader(currentshadowlight->origin);
|
||||
|
||||
glTexCoordPointer(3, GL_FLOAT, verts->vertexstride, verts->vertices);
|
||||
Parhelia_sendSurfacesPlain(surfs,numSurfaces);
|
||||
|
||||
GL_DisableAttentShaderParhelia();
|
||||
Parhelia_DisableAttentShader();
|
||||
GL_ModulateAlphaDrawColor();
|
||||
}
|
||||
else
|
||||
|
@ -1617,15 +1613,15 @@ void Parhelia_drawSurfaceListBump (vertexdef_t *verts, msurface_t **surfs,
|
|||
}
|
||||
glColor3fv(¤tshadowlight->color[0]);
|
||||
|
||||
GL_EnableSpecularShaderParhelia(tr,currentshadowlight->origin,true);
|
||||
Parhelia_EnableSpecularShader(tr,currentshadowlight->origin,true);
|
||||
|
||||
glTexCoordPointer(2, GL_FLOAT, verts->texcoordstride, verts->texcoords);
|
||||
Parhelia_sendSurfacesTA(surfs,numSurfaces);
|
||||
GL_DisableDiffuseShaderParhelia();
|
||||
Parhelia_DisableDiffuseShader();
|
||||
|
||||
GL_EnableDiffuseShaderParhelia(tr,currentshadowlight->origin);
|
||||
Parhelia_EnableDiffuseShader(tr,currentshadowlight->origin);
|
||||
Parhelia_sendSurfacesTA(surfs,numSurfaces);
|
||||
GL_DisableDiffuseShaderParhelia();
|
||||
Parhelia_DisableDiffuseShader();
|
||||
|
||||
glDisableClientState(GL_VERTEX_ARRAY);
|
||||
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||
|
@ -1674,8 +1670,7 @@ void BUMP_InitParhelia(void)
|
|||
|
||||
if ( gl_cardtype != PARHELIA ) return;
|
||||
|
||||
GL_CreateShadersParhelia();
|
||||
|
||||
Parhelia_CreateShaders();
|
||||
|
||||
//bind the correct stuff to the bump mapping driver
|
||||
gl_bumpdriver.drawSurfaceListBase = Parhelia_drawSurfaceListBase;
|
||||
|
|
|
@ -123,7 +123,7 @@ void checkerror()
|
|||
|
||||
extern void * GL_GetProcAddress (const char *theName, qboolean theSafeMode);
|
||||
|
||||
qboolean GL_LookupRadeonSymbols (void)
|
||||
qboolean Radeon_LookupSymbols (void)
|
||||
{
|
||||
qglGenFragmentShadersATI = GL_GetProcAddress ("glGenFragmentShadersATI", false);
|
||||
qglBindFragmentShaderATI = GL_GetProcAddress ("glBindFragmentShaderATI", false);
|
||||
|
@ -247,7 +247,7 @@ qboolean GL_LookupRadeonSymbols (void)
|
|||
|
||||
#endif /* __APPLE__ || MACOSX */
|
||||
|
||||
void GL_CreateShadersRadeon()
|
||||
void Radeon_CreateShaders()
|
||||
{
|
||||
float scaler[4] = {0.5f, 0.5f, 0.5f, 0.5f};
|
||||
int i;
|
||||
|
@ -844,7 +844,7 @@ void GL_CreateShadersRadeon()
|
|||
}
|
||||
|
||||
|
||||
void GL_DisableDiffuseShaderRadeon()
|
||||
void Radeon_DisableBumpShader()
|
||||
{
|
||||
//tex 0 = normal map
|
||||
//tex 1 = normalization cube map (tangent space light vector)
|
||||
|
@ -878,8 +878,8 @@ void GL_DisableDiffuseShaderRadeon()
|
|||
GL_SelectTexture(GL_TEXTURE0_ARB);
|
||||
}
|
||||
|
||||
void GL_EnableDiffuseSpecularShaderRadeon(const transform_t *tr,
|
||||
vec3_t lightOrig, qboolean alias)
|
||||
void Radeon_EnableBumpShader(const transform_t *tr, vec3_t lightOrig,
|
||||
qboolean alias)
|
||||
{
|
||||
GLfloat temp[4];
|
||||
float invrad = 1/currentshadowlight->radius;
|
||||
|
@ -969,21 +969,21 @@ void Radeon_SetupTcMod(tcmod_t *tc)
|
|||
{
|
||||
switch (tc->type)
|
||||
{
|
||||
case TCMOD_ROTATE:
|
||||
glTranslatef(0.5,0.5,0.0);
|
||||
glRotatef(cl.time * tc->params[0],0,0,1);
|
||||
glTranslatef(-0.5, -0.5, 0.0);
|
||||
break;
|
||||
case TCMOD_SCROLL:
|
||||
glTranslatef(cl.time * tc->params[0], cl.time * tc->params[1], 0.0);
|
||||
break;
|
||||
case TCMOD_SCALE:
|
||||
glScalef(tc->params[0],tc->params[1],1.0);
|
||||
break;
|
||||
case TCMOD_STRETCH:
|
||||
//PENTA: fixme
|
||||
glScalef(1.0, 1.0, 1.0);
|
||||
break;
|
||||
case TCMOD_ROTATE:
|
||||
glTranslatef(0.5,0.5,0.0);
|
||||
glRotatef(cl.time * tc->params[0],0,0,1);
|
||||
glTranslatef(-0.5, -0.5, 0.0);
|
||||
break;
|
||||
case TCMOD_SCROLL:
|
||||
glTranslatef(cl.time * tc->params[0], cl.time * tc->params[1], 0.0);
|
||||
break;
|
||||
case TCMOD_SCALE:
|
||||
glScalef(tc->params[0],tc->params[1],1.0);
|
||||
break;
|
||||
case TCMOD_STRETCH:
|
||||
//PENTA: fixme
|
||||
glScalef(1.0, 1.0, 1.0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1020,7 +1020,7 @@ void Radeon_SetupSimpleStage(stage_t *s)
|
|||
}
|
||||
|
||||
if ((s->numtextures > 0) && (s->texture[0]))
|
||||
GL_Bind(s->texture[0]->texnum);
|
||||
GL_BindAdvanced(s->texture[0]);
|
||||
}
|
||||
|
||||
/************************
|
||||
|
@ -1103,21 +1103,22 @@ void Radeon_drawTriangleListBump (const vertexdef_t *verts, int *indecies,
|
|||
GL_AddColor();
|
||||
glColor3fv(¤tshadowlight->color[0]);
|
||||
|
||||
GL_EnableDiffuseSpecularShaderRadeon(tr,currentshadowlight->origin,true);
|
||||
Radeon_EnableBumpShader(tr,currentshadowlight->origin,true);
|
||||
//bind the correct texture
|
||||
GL_SelectTexture(GL_TEXTURE0_ARB);
|
||||
if (shader->numbumpstages > 0)
|
||||
GL_Bind(shader->bumpstages[0].texture[0]->texnum);
|
||||
GL_BindAdvanced(shader->bumpstages[0].texture[0]);
|
||||
GL_SelectTexture(GL_TEXTURE3_ARB);
|
||||
if (shader->numcolorstages > 0)
|
||||
GL_Bind(shader->colorstages[0].texture[0]->texnum);
|
||||
GL_BindAdvanced(shader->colorstages[0].texture[0]);
|
||||
|
||||
Radeon_sendTriangleListTA(verts,indecies,numIndecies);
|
||||
GL_DisableDiffuseShaderRadeon();
|
||||
Radeon_DisableBumpShader();
|
||||
}
|
||||
|
||||
void Radeon_drawTriangleListBase (vertexdef_t *verts, int *indecies,
|
||||
int numIndecies, shader_t *shader)
|
||||
int numIndecies, shader_t *shader,
|
||||
int lightMapIndex)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
@ -1169,7 +1170,7 @@ void Radeon_drawTriangleListBase (vertexdef_t *verts, int *indecies,
|
|||
if (shader->numcolorstages)
|
||||
{
|
||||
if (shader->colorstages[0].numtextures)
|
||||
GL_Bind(shader->colorstages[0].texture[0]->texnum);
|
||||
GL_BindAdvanced(shader->colorstages[0].texture[0]);
|
||||
|
||||
if (shader->colorstages[0].alphatresh > 0)
|
||||
{
|
||||
|
@ -1289,7 +1290,7 @@ void Radeon_drawSurfaceListBase (vertexdef_t* verts, msurface_t** surfs,
|
|||
if (shader->numcolorstages)
|
||||
{
|
||||
if (shader->colorstages[0].numtextures)
|
||||
GL_Bind(shader->colorstages[0].texture[0]->texnum);
|
||||
GL_BindAdvanced(shader->colorstages[0].texture[0]);
|
||||
|
||||
if (shader->colorstages[0].alphatresh > 0)
|
||||
{
|
||||
|
@ -1364,10 +1365,10 @@ void Radeon_sendSurfacesTA(msurface_t** surfs, int numSurfaces)
|
|||
//bind the correct texture
|
||||
GL_SelectTexture(GL_TEXTURE0_ARB);
|
||||
if (shader->numbumpstages > 0)
|
||||
GL_Bind(shader->bumpstages[0].texture[0]->texnum);
|
||||
GL_BindAdvanced(shader->bumpstages[0].texture[0]);
|
||||
GL_SelectTexture(GL_TEXTURE3_ARB);
|
||||
if (shader->numcolorstages > 0)
|
||||
GL_Bind(shader->colorstages[0].texture[0]->texnum);
|
||||
GL_BindAdvanced(shader->colorstages[0].texture[0]);
|
||||
lastshader = shader;
|
||||
}
|
||||
|
||||
|
@ -1463,11 +1464,11 @@ void Radeon_drawSurfaceListBump (vertexdef_t *verts, msurface_t **surfs,
|
|||
GL_AddColor();
|
||||
glColor3fv(¤tshadowlight->color[0]);
|
||||
|
||||
GL_EnableDiffuseSpecularShaderRadeon(tr,currentshadowlight->origin,true);
|
||||
Radeon_EnableBumpShader(tr,currentshadowlight->origin,true);
|
||||
|
||||
glTexCoordPointer(2, GL_FLOAT, verts->texcoordstride, verts->texcoords);
|
||||
Radeon_sendSurfacesTA(surfs,numSurfaces);
|
||||
GL_DisableDiffuseShaderRadeon();
|
||||
Radeon_DisableBumpShader();
|
||||
|
||||
glDisableClientState(GL_VERTEX_ARRAY);
|
||||
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||
|
@ -1514,8 +1515,8 @@ void BUMP_InitRadeon(void)
|
|||
const GLubyte *errString;
|
||||
|
||||
if ( gl_cardtype != RADEON ) return;
|
||||
|
||||
GL_CreateShadersRadeon();
|
||||
|
||||
Radeon_CreateShaders();
|
||||
|
||||
|
||||
//bind the correct stuff to the bump mapping driver
|
||||
|
|
Loading…
Reference in a new issue