Changes to support the new render drivers
This commit is contained in:
parent
332a2d3e6f
commit
2758179d5a
2 changed files with 252 additions and 283 deletions
60
gl_rmain.c
60
gl_rmain.c
|
@ -86,9 +86,7 @@ refdef_t r_refdef;
|
||||||
|
|
||||||
mleaf_t *r_viewleaf, *r_oldviewleaf;
|
mleaf_t *r_viewleaf, *r_oldviewleaf;
|
||||||
|
|
||||||
texture_t *r_notexture_mip;
|
int d_lghtstylevalue[256]; // 8.8 fraction of base light value
|
||||||
|
|
||||||
int d_lightstylevalue[256]; // 8.8 fraction of base light value
|
|
||||||
|
|
||||||
|
|
||||||
void R_MarkLeaves (void);
|
void R_MarkLeaves (void);
|
||||||
|
@ -162,7 +160,7 @@ cvar_t fog_end = {"fog_end","700"};
|
||||||
cvar_t gl_fog = {"gl_fog","1"};
|
cvar_t gl_fog = {"gl_fog","1"};
|
||||||
cvar_t fog_waterfog = {"fog_waterfog","1"};
|
cvar_t fog_waterfog = {"fog_waterfog","1"};
|
||||||
float fog_color[4];
|
float fog_color[4];
|
||||||
cvar_t r_tangentscale = {"r_tangentscale","16"};
|
cvar_t r_tangentscale = {"r_tangentscale","1"};
|
||||||
|
|
||||||
|
|
||||||
mirrorplane_t mirrorplanes[NUM_MIRROR_PLANES];
|
mirrorplane_t mirrorplanes[NUM_MIRROR_PLANES];
|
||||||
|
@ -224,7 +222,7 @@ int CL_PointContents (vec3_t p)
|
||||||
{
|
{
|
||||||
int cont;
|
int cont;
|
||||||
|
|
||||||
cont = CM_PointContents(p,0);
|
cont = CM_PointContents(cl.worldmodel,p,0);
|
||||||
//cont = SV_HullPointContents (&cl.worldmodel->hulls[0], 0, p);
|
//cont = SV_HullPointContents (&cl.worldmodel->hulls[0], 0, p);
|
||||||
/*
|
/*
|
||||||
if (cont <= CONTENTS_CURRENT_0 && cont >= CONTENTS_CURRENT_DOWN)
|
if (cont <= CONTENTS_CURRENT_0 && cont >= CONTENTS_CURRENT_DOWN)
|
||||||
|
@ -909,7 +907,8 @@ void R_DrawAliasSurface (aliashdr_t *paliashdr, float bright, aliasframeinstant_
|
||||||
|
|
||||||
if (!busy_caustics) {
|
if (!busy_caustics) {
|
||||||
anim = (int)(cl.time*10) & 3;
|
anim = (int)(cl.time*10) & 3;
|
||||||
GL_Bind(paliashdr->gl_texturenum[currententity->skinnum][anim]);
|
if (paliashdr->shader->numcolorstages > 0)
|
||||||
|
GL_Bind(paliashdr->shader->colorstages[0].texture[0]->texnum);
|
||||||
|
|
||||||
// we can't dynamically colormap textures, so they are cached
|
// we can't dynamically colormap textures, so they are cached
|
||||||
// seperately for the players. Heads are just uncolored.
|
// seperately for the players. Heads are just uncolored.
|
||||||
|
@ -925,7 +924,7 @@ void R_DrawAliasSurface (aliashdr_t *paliashdr, float bright, aliasframeinstant_
|
||||||
if (gl_wireframe.value) {
|
if (gl_wireframe.value) {
|
||||||
glDisable(GL_TEXTURE_2D);
|
glDisable(GL_TEXTURE_2D);
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
if ( gl_truform.value )
|
if ( gl_truform.value )
|
||||||
{
|
{
|
||||||
glEnable(GL_PN_TRIANGLES_ATI);
|
glEnable(GL_PN_TRIANGLES_ATI);
|
||||||
|
@ -934,7 +933,7 @@ void R_DrawAliasSurface (aliashdr_t *paliashdr, float bright, aliasframeinstant_
|
||||||
qglPNTrianglesiATI(GL_PN_TRIANGLES_TESSELATION_LEVEL_ATI, gl_truform_tesselation.value);
|
qglPNTrianglesiATI(GL_PN_TRIANGLES_TESSELATION_LEVEL_ATI, gl_truform_tesselation.value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
glColor3f(bright, bright, bright);
|
glColor3f(bright, bright, bright);
|
||||||
//if (busy_caustics)
|
//if (busy_caustics)
|
||||||
|
@ -945,6 +944,7 @@ void R_DrawAliasSurface (aliashdr_t *paliashdr, float bright, aliasframeinstant_
|
||||||
if ( !busy_caustics )
|
if ( !busy_caustics )
|
||||||
{
|
{
|
||||||
anim = (int)(cl.time*10) & 3;
|
anim = (int)(cl.time*10) & 3;
|
||||||
|
/*
|
||||||
if ( paliashdr->gl_lumatex[currententity->skinnum][anim] != 0)
|
if ( paliashdr->gl_lumatex[currententity->skinnum][anim] != 0)
|
||||||
{
|
{
|
||||||
glFogfv(GL_FOG_COLOR, color_black);
|
glFogfv(GL_FOG_COLOR, color_black);
|
||||||
|
@ -968,6 +968,7 @@ void R_DrawAliasSurface (aliashdr_t *paliashdr, float bright, aliasframeinstant_
|
||||||
glDisable(GL_BLEND);
|
glDisable(GL_BLEND);
|
||||||
glFogfv(GL_FOG_COLOR, fog_color);
|
glFogfv(GL_FOG_COLOR, fog_color);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((sh_showtangent.value) && (!busy_caustics)) {
|
if ((sh_showtangent.value) && (!busy_caustics)) {
|
||||||
|
@ -1064,7 +1065,9 @@ void R_DrawAliasModel (float bright)
|
||||||
VectorAdd (currententity->origin,paliashdr->maxs, maxs);
|
VectorAdd (currententity->origin,paliashdr->maxs, maxs);
|
||||||
|
|
||||||
if (!R_CullBox (mins, maxs)) */
|
if (!R_CullBox (mins, maxs)) */
|
||||||
R_DrawAliasSurface (paliashdr, bright, aliasframeinstant);
|
// R_DrawAliasSurface (paliashdr, bright, aliasframeinstant);
|
||||||
|
R_DrawAliasAmbient(paliashdr, aliasframeinstant);
|
||||||
|
|
||||||
aliasframeinstant = aliasframeinstant->_next;
|
aliasframeinstant = aliasframeinstant->_next;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1145,9 +1148,10 @@ void R_DrawAmbientEntities ()
|
||||||
case mod_alias:
|
case mod_alias:
|
||||||
R_DrawAmbientAlias (R_DrawAliasModel);
|
R_DrawAmbientAlias (R_DrawAliasModel);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case mod_brush:
|
case mod_brush:
|
||||||
glColor3f(sh_lightmapbright.value,sh_lightmapbright.value,sh_lightmapbright.value);
|
glColor3f(sh_lightmapbright.value,sh_lightmapbright.value,sh_lightmapbright.value);
|
||||||
R_DrawBrushModel(currententity);
|
R_DrawBrushModelAmbient(currententity);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -1171,7 +1175,7 @@ R_DrawEntitiesOnList
|
||||||
|
|
||||||
Post multiply the textures with the frame buff.
|
Post multiply the textures with the frame buff.
|
||||||
=============
|
=============
|
||||||
*/
|
*//*
|
||||||
void R_DrawEntitiesOnList (void)
|
void R_DrawEntitiesOnList (void)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
@ -1196,7 +1200,7 @@ void R_DrawEntitiesOnList (void)
|
||||||
|
|
||||||
case mod_brush:
|
case mod_brush:
|
||||||
//glColor3f(1.0,1.0,1.0);
|
//glColor3f(1.0,1.0,1.0);
|
||||||
//R_DrawBrushModel (currententity);
|
///_DrawBrushModel (currententity);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -1225,7 +1229,7 @@ void R_DrawEntitiesOnList (void)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
*/
|
||||||
/*
|
/*
|
||||||
=============
|
=============
|
||||||
R_MarkEntitiesOnList
|
R_MarkEntitiesOnList
|
||||||
|
@ -1347,6 +1351,7 @@ void R_DrawLightSprites (void)
|
||||||
int i;
|
int i;
|
||||||
vec3_t dist;
|
vec3_t dist;
|
||||||
float colorscale;
|
float colorscale;
|
||||||
|
transform_t trans;
|
||||||
|
|
||||||
if (!cg_showentities.value)
|
if (!cg_showentities.value)
|
||||||
return;
|
return;
|
||||||
|
@ -1374,7 +1379,10 @@ void R_DrawLightSprites (void)
|
||||||
-currentshadowlight->origin[1],
|
-currentshadowlight->origin[1],
|
||||||
-currentshadowlight->origin[2]);
|
-currentshadowlight->origin[2]);
|
||||||
*/
|
*/
|
||||||
GL_SetupCubeMapMatrix(true);
|
VectorCopy(currententity->origin,trans.origin);
|
||||||
|
VectorCopy(currententity->angles,trans.angles);
|
||||||
|
trans.scale[0] = trans.scale[1] = trans.scale[2] = 1.0f;
|
||||||
|
GL_SetupCubeMapMatrix(&trans);
|
||||||
|
|
||||||
GL_EnableColorShader (false);
|
GL_EnableColorShader (false);
|
||||||
for (i=0 ; i<cl_numlightvisedicts ; i++)
|
for (i=0 ; i<cl_numlightvisedicts ; i++)
|
||||||
|
@ -2286,14 +2294,16 @@ void R_RenderScene (void)
|
||||||
|
|
||||||
R_DrawFullbrightSprites();
|
R_DrawFullbrightSprites();
|
||||||
|
|
||||||
if (skytexturenum >= 0) {
|
|
||||||
glColor3f(1,1,1);
|
if (skyshadernum >= 0) {
|
||||||
R_DrawSkyChain (cl.worldmodel->textures[skytexturenum]->texturechain);
|
//glColor3f(1,1,1);
|
||||||
cl.worldmodel->textures[skytexturenum]->texturechain = NULL;
|
//R_DrawSkyChain (cl.worldmodel->mapshaders[skyshadernum]);
|
||||||
|
cl.worldmodel->mapshaders[skyshadernum].texturechain = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
R_DrawCaustics();
|
// R_DrawCaustics();
|
||||||
|
DrawBlendedTextureChains();
|
||||||
|
|
||||||
//Removed to fix particle & water bug (see R_RenderView) - Eradicator
|
//Removed to fix particle & water bug (see R_RenderView) - Eradicator
|
||||||
//R_DrawParticles (); //to fix the particles triangles showing up after water
|
//R_DrawParticles (); //to fix the particles triangles showing up after water
|
||||||
|
@ -2337,11 +2347,9 @@ void R_ClearMirrorChains()
|
||||||
mirrorplanes[i].chain = NULL;
|
mirrorplanes[i].chain = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i=0 ; i<cl.worldmodel->numtextures ; i++)
|
for (i=0 ; i<cl.worldmodel->nummapshaders ; i++)
|
||||||
{
|
{
|
||||||
if (!cl.worldmodel->textures[i])
|
cl.worldmodel->mapshaders[i].texturechain = NULL;
|
||||||
continue;
|
|
||||||
cl.worldmodel->textures[i]->texturechain = NULL;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2604,7 +2612,7 @@ void R_SetupMirrorShader(msurface_t *surf,mirrorplane_t *mir) {
|
||||||
glTexEnvf (GL_TEXTURE_ENV, GL_COMBINE_RGB_ARB, GL_REPLACE);
|
glTexEnvf (GL_TEXTURE_ENV, GL_COMBINE_RGB_ARB, GL_REPLACE);
|
||||||
|
|
||||||
GL_EnableMultitexture();
|
GL_EnableMultitexture();
|
||||||
GL_Bind(surf->texinfo->texture->gl_texturenum);
|
//SHADERS GL_Bind(surf->texinfo->texture->gl_texturenum);
|
||||||
|
|
||||||
//No colormaps: Color maps are bound on tmu 0 so disable it
|
//No colormaps: Color maps are bound on tmu 0 so disable it
|
||||||
//and let tu1 modulate itself with the light map brightness
|
//and let tu1 modulate itself with the light map brightness
|
||||||
|
@ -2615,7 +2623,7 @@ void R_SetupMirrorShader(msurface_t *surf,mirrorplane_t *mir) {
|
||||||
glTexEnvf (GL_TEXTURE_ENV, GL_COMBINE_RGB_ARB, GL_INTERPOLATE_ARB);
|
glTexEnvf (GL_TEXTURE_ENV, GL_COMBINE_RGB_ARB, GL_INTERPOLATE_ARB);
|
||||||
glTexEnvf (GL_TEXTURE_ENV, GL_OPERAND2_RGB_ARB, GL_SRC_ALPHA);
|
glTexEnvf (GL_TEXTURE_ENV, GL_OPERAND2_RGB_ARB, GL_SRC_ALPHA);
|
||||||
|
|
||||||
GL_Bind(surf->texinfo->texture->gl_texturenum);
|
//SHADERS GL_Bind(surf->texinfo->texture->gl_texturenum);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2846,7 +2854,7 @@ void R_RenderView (void)
|
||||||
to avoid effection fog on the water. A particle draw is done after the water
|
to avoid effection fog on the water. A particle draw is done after the water
|
||||||
draw to make sure particles are rendered over the surface of the water. - Eradicator*/
|
draw to make sure particles are rendered over the surface of the water. - Eradicator*/
|
||||||
|
|
||||||
R_DrawWaterSurfaces ();
|
// R_DrawWaterSurfaces ();
|
||||||
R_DrawMirrorSurfaces ();
|
R_DrawMirrorSurfaces ();
|
||||||
|
|
||||||
// More fog right here :)
|
// More fog right here :)
|
||||||
|
|
443
gl_rsurf.c
443
gl_rsurf.c
|
@ -28,7 +28,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
int lightmap_bytes; // 1, 2, or 4
|
int lightmap_bytes; // 1, 2, or 4
|
||||||
|
|
||||||
int lightmap_textures;
|
int lightmap_textures = 0;
|
||||||
|
|
||||||
unsigned blocklights[18*18];
|
unsigned blocklights[18*18];
|
||||||
|
|
||||||
|
@ -111,6 +111,8 @@ int R_AllocateVertexInTemp(vec3_t pos, float texture [2], float lightmap[2], byt
|
||||||
tempVertices[numTempVertices].color[i] = color[i];
|
tempVertices[numTempVertices].color[i] = color[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
globalVertexTable = tempVertices;
|
||||||
|
|
||||||
numTempVertices++;
|
numTempVertices++;
|
||||||
return numTempVertices-1;
|
return numTempVertices-1;
|
||||||
}
|
}
|
||||||
|
@ -337,7 +339,7 @@ R_TextureAnimation
|
||||||
|
|
||||||
Returns the proper texture for a given time and base texture
|
Returns the proper texture for a given time and base texture
|
||||||
===============
|
===============
|
||||||
*/
|
*//*
|
||||||
texture_t *R_TextureAnimation (texture_t *base)
|
texture_t *R_TextureAnimation (texture_t *base)
|
||||||
{
|
{
|
||||||
int reletive;
|
int reletive;
|
||||||
|
@ -366,7 +368,7 @@ texture_t *R_TextureAnimation (texture_t *base)
|
||||||
|
|
||||||
return base;
|
return base;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
=============================================================
|
=============================================================
|
||||||
|
@ -951,7 +953,7 @@ PENTA: Modifications
|
||||||
*/
|
*/
|
||||||
void R_RenderBrushPoly (msurface_t *fa)
|
void R_RenderBrushPoly (msurface_t *fa)
|
||||||
{
|
{
|
||||||
texture_t *t;
|
shader_t *s;
|
||||||
glpoly_t *p;
|
glpoly_t *p;
|
||||||
int i;
|
int i;
|
||||||
float *v;
|
float *v;
|
||||||
|
@ -962,10 +964,12 @@ void R_RenderBrushPoly (msurface_t *fa)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*if (!busy_caustics)*/ {
|
//if (!busy_caustics)
|
||||||
t = R_TextureAnimation (fa->texinfo->texture);
|
{
|
||||||
|
s = fa->shader->shader;
|
||||||
GL_SelectTexture(GL_TEXTURE0_ARB);
|
GL_SelectTexture(GL_TEXTURE0_ARB);
|
||||||
GL_Bind (t->gl_texturenum);
|
if (s->numcolorstages > 0)
|
||||||
|
GL_Bind(s->colorstages[0].texture[0]->texnum);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fa->flags & SURF_DRAWTURB)
|
if (fa->flags & SURF_DRAWTURB)
|
||||||
|
@ -981,7 +985,8 @@ void R_RenderBrushPoly (msurface_t *fa)
|
||||||
glNormal3fv(&fa->plane->normal[0]);
|
glNormal3fv(&fa->plane->normal[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*if (!busy_caustics)*/ {
|
//if (!busy_caustics)
|
||||||
|
{
|
||||||
GL_SelectTexture(GL_TEXTURE1_ARB);
|
GL_SelectTexture(GL_TEXTURE1_ARB);
|
||||||
GL_Bind (lightmap_textures + fa->lightmaptexturenum);
|
GL_Bind (lightmap_textures + fa->lightmaptexturenum);
|
||||||
}
|
}
|
||||||
|
@ -1005,7 +1010,7 @@ R_RenderBrushPoly
|
||||||
|
|
||||||
PENTA:
|
PENTA:
|
||||||
================
|
================
|
||||||
*/
|
*//*
|
||||||
void R_RenderBrushPolyLuma (msurface_t *fa)
|
void R_RenderBrushPolyLuma (msurface_t *fa)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
@ -1035,7 +1040,7 @@ void R_RenderBrushPolyLuma (msurface_t *fa)
|
||||||
glEnd ();
|
glEnd ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
||||||
|
@ -1183,13 +1188,13 @@ void R_MirrorChain (msurface_t *s)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#if 0
|
//#if 0
|
||||||
/*
|
/*
|
||||||
================
|
================
|
||||||
R_DrawWaterSurfaces
|
R_DrawWaterSurfaces
|
||||||
PENTA: Modifications
|
PENTA: Modifications
|
||||||
================
|
================
|
||||||
*/
|
*//*
|
||||||
void R_DrawWaterSurfaces (void)
|
void R_DrawWaterSurfaces (void)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
@ -1230,25 +1235,25 @@ void R_DrawWaterSurfaces (void)
|
||||||
glColor4f (1,1,1,1);
|
glColor4f (1,1,1,1);
|
||||||
glDisable (GL_BLEND);
|
glDisable (GL_BLEND);
|
||||||
}
|
}
|
||||||
#else
|
#else*/
|
||||||
/*
|
/*
|
||||||
================
|
================
|
||||||
R_DrawWaterSurfaces
|
R_DrawWaterSurfaces
|
||||||
|
|
||||||
PENTA: Modifications
|
PENTA: Modifications
|
||||||
================
|
================
|
||||||
*/
|
*//*
|
||||||
void R_DrawWaterSurfaces (void)
|
void R_DrawWaterSurfaces (void)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
msurface_t *s;
|
msurface_t *s;
|
||||||
texture_t *t;
|
texture_t *t;
|
||||||
|
|
||||||
/*
|
|
||||||
/*PENTA: we always draw water at the end of the frame
|
//PENTA: we always draw water at the end of the frame
|
||||||
if (r_wateralpha.value == 1.0 && gl_texsort.value)
|
//if (r_wateralpha.value == 1.0 && gl_texsort.value)
|
||||||
return;
|
// return;
|
||||||
*/
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// go back to the world matrix
|
// go back to the world matrix
|
||||||
|
@ -1276,17 +1281,17 @@ void R_DrawWaterSurfaces (void)
|
||||||
glColor4f (1,1,1,1);
|
glColor4f (1,1,1,1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*if (!gl_texsort.value) {
|
///*if (!gl_texsort.value) {
|
||||||
if (!waterchain)
|
// if (!waterchain)
|
||||||
return;
|
// return;
|
||||||
|
//
|
||||||
for ( s = waterchain ; s ; s=s->texturechain) {
|
// for ( s = waterchain ; s ; s=s->texturechain) {
|
||||||
GL_Bind (s->texinfo->texture->gl_texturenum);
|
// GL_Bind (s->texinfo->texture->gl_texturenum);
|
||||||
EmitWaterPolys (s);
|
// EmitWaterPolys (s);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
waterchain = NULL;
|
// waterchain = NULL;
|
||||||
} else */{
|
// } else {
|
||||||
|
|
||||||
for (i=0 ; i<cl.worldmodel->numtextures ; i++)
|
for (i=0 ; i<cl.worldmodel->numtextures ; i++)
|
||||||
{
|
{
|
||||||
|
@ -1348,7 +1353,7 @@ void R_DrawWaterSurfaces (void)
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
*/
|
||||||
/*
|
/*
|
||||||
================
|
================
|
||||||
DrawTextureChains
|
DrawTextureChains
|
||||||
|
@ -1361,9 +1366,10 @@ void DrawTextureChains (void)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
msurface_t *s;
|
msurface_t *s;
|
||||||
texture_t *t, *tani;
|
mapshader_t *sh;
|
||||||
|
shader_t *shani;
|
||||||
qboolean found = false;
|
qboolean found = false;
|
||||||
mcurve_t *curve;
|
mesh_t *mesh;
|
||||||
|
|
||||||
//glBlendFunc(GL_ZERO,GL_SRC_COLOR);
|
//glBlendFunc(GL_ZERO,GL_SRC_COLOR);
|
||||||
//glEnable(GL_BLEND);
|
//glEnable(GL_BLEND);
|
||||||
|
@ -1372,7 +1378,7 @@ void DrawTextureChains (void)
|
||||||
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
|
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
|
||||||
glColor3f(sh_lightmapbright.value,sh_lightmapbright.value,sh_lightmapbright.value);
|
glColor3f(sh_lightmapbright.value,sh_lightmapbright.value,sh_lightmapbright.value);
|
||||||
|
|
||||||
GL_EnableMultitexture();
|
/* GL_EnableMultitexture();
|
||||||
if (sh_colormaps.value) {
|
if (sh_colormaps.value) {
|
||||||
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
|
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
|
||||||
} else {
|
} else {
|
||||||
|
@ -1387,7 +1393,7 @@ void DrawTextureChains (void)
|
||||||
glTexEnvf (GL_TEXTURE_ENV, GL_SOURCE1_RGB_ARB, GL_TEXTURE);
|
glTexEnvf (GL_TEXTURE_ENV, GL_SOURCE1_RGB_ARB, GL_TEXTURE);
|
||||||
glTexEnvf (GL_TEXTURE_ENV, GL_COMBINE_RGB_ARB, GL_MODULATE);
|
glTexEnvf (GL_TEXTURE_ENV, GL_COMBINE_RGB_ARB, GL_MODULATE);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
if (gl_wireframe.value) {
|
if (gl_wireframe.value) {
|
||||||
|
@ -1399,41 +1405,42 @@ void DrawTextureChains (void)
|
||||||
|
|
||||||
causticschain = NULL; //clear chain here
|
causticschain = NULL; //clear chain here
|
||||||
|
|
||||||
R_EnableVertexTable(VERTEX_TEXTURE | VERTEX_LIGHTMAP);
|
//R_EnableVertexTable(VERTEX_TEXTURE | VERTEX_LIGHTMAP);
|
||||||
|
|
||||||
for (i=0 ; i<cl.worldmodel->numtextures ; i++)
|
for (i=0 ; i<cl.worldmodel->nummapshaders ; i++)
|
||||||
{
|
{
|
||||||
t = cl.worldmodel->textures[i];
|
sh = &cl.worldmodel->mapshaders[i];
|
||||||
if (!t)
|
if (!sh)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
s = t->texturechain;
|
s = sh->texturechain;
|
||||||
if (!s)
|
if (!s)
|
||||||
continue;
|
continue;
|
||||||
|
/*
|
||||||
found = true;
|
found = true;
|
||||||
|
|
||||||
if (i == skytexturenum) {
|
if (i == skyshadernum) {
|
||||||
continue;
|
continue;
|
||||||
//R_DrawSkyChain (s);
|
//R_DrawSkyChain (s);
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
else if (i == mirrortexturenum && r_mirroralpha.value != 1.0)
|
|
||||||
{
|
|
||||||
R_MirrorChain (s);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
*/
|
*/
|
||||||
|
//else if (i == mirrortexturenum && r_mirroralpha.value != 1.0)
|
||||||
|
//{
|
||||||
|
// R_MirrorChain (s);
|
||||||
|
// continue;
|
||||||
|
//}
|
||||||
|
|
||||||
//else
|
//else
|
||||||
{
|
/* {
|
||||||
|
|
||||||
//PENTA: water at end of frame
|
//PENTA: water at end of frame
|
||||||
if (s->flags & SURF_DRAWTURB)
|
if (s->flags & SURF_DRAWTURB)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
GL_SelectTexture(GL_TEXTURE0_ARB);
|
GL_SelectTexture(GL_TEXTURE0_ARB);
|
||||||
tani = R_TextureAnimation (s->texinfo->texture);
|
shani = s->shader->shader;
|
||||||
GL_Bind (tani->gl_texturenum);
|
if (shani->numcolorstages > 0)
|
||||||
|
GL_Bind(shani->colorstages[0].texture[0]->texnum);
|
||||||
|
|
||||||
//Do the ambient pass
|
//Do the ambient pass
|
||||||
//now with arrays!
|
//now with arrays!
|
||||||
|
@ -1448,7 +1455,7 @@ void DrawTextureChains (void)
|
||||||
GL_SelectTexture(GL_TEXTURE0_ARB);
|
GL_SelectTexture(GL_TEXTURE0_ARB);
|
||||||
|
|
||||||
//Has this texture a luma texture then add it
|
//Has this texture a luma texture then add it
|
||||||
|
/*
|
||||||
if (t->gl_lumitex) {
|
if (t->gl_lumitex) {
|
||||||
//vec3_t color_black = {0.0, 0.0, 0.0};
|
//vec3_t color_black = {0.0, 0.0, 0.0};
|
||||||
glFogfv(GL_FOG_COLOR, color_black);
|
glFogfv(GL_FOG_COLOR, color_black);
|
||||||
|
@ -1475,8 +1482,8 @@ void DrawTextureChains (void)
|
||||||
glDisable(GL_BLEND);
|
glDisable(GL_BLEND);
|
||||||
glFogfv(GL_FOG_COLOR, fog_color);
|
glFogfv(GL_FOG_COLOR, fog_color);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
s = t->texturechain;
|
/* s = sh->texturechain;
|
||||||
//Make cauistics list
|
//Make cauistics list
|
||||||
while (s) {
|
while (s) {
|
||||||
msurface_t *olds;
|
msurface_t *olds;
|
||||||
|
@ -1490,25 +1497,105 @@ void DrawTextureChains (void)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
t->texturechain = NULL;
|
//if (!(s->flags & (SURF_DRAWSKY | SURF_DRAWTURB)))
|
||||||
|
if (!IsShaderBlended(sh->shader)) {
|
||||||
|
R_DrawWorldAmbientChain(sh->texturechain);
|
||||||
|
sh->texturechain = NULL;
|
||||||
}
|
}
|
||||||
R_DisableVertexTable(VERTEX_TEXTURE | VERTEX_LIGHTMAP);
|
}
|
||||||
|
|
||||||
|
|
||||||
|
for (i=0 ; i<cl.worldmodel->nummapshaders ; i++)
|
||||||
|
{
|
||||||
|
sh = &cl.worldmodel->mapshaders[i];
|
||||||
|
mesh = sh->meshchain;
|
||||||
|
|
||||||
|
if (!mesh)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (!IsShaderBlended(mesh->shader->shader)) {
|
||||||
|
while (mesh) {
|
||||||
|
R_DrawMeshAmbient(mesh);
|
||||||
|
mesh = mesh->next;
|
||||||
|
}
|
||||||
|
sh->meshchain = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//R_DisableVertexTable(VERTEX_TEXTURE | VERTEX_LIGHTMAP);
|
||||||
GL_SelectTexture(GL_TEXTURE1_ARB);
|
GL_SelectTexture(GL_TEXTURE1_ARB);
|
||||||
GL_DisableMultitexture();
|
GL_DisableMultitexture();
|
||||||
//glDisable(GL_BLEND);
|
//glDisable(GL_BLEND);
|
||||||
glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||||
glDepthMask (1);
|
glDepthMask (1);
|
||||||
|
}
|
||||||
|
|
||||||
curve = curvechain;
|
void DrawBlendedTextureChains (void)
|
||||||
i = 0;
|
{
|
||||||
while (curve) {
|
int i;
|
||||||
CS_DrawAmbient(curve);
|
msurface_t *s;
|
||||||
curve = curve->next;
|
mapshader_t *sh;
|
||||||
i++;
|
shader_t *shani;
|
||||||
if (i > 1000) { Con_Printf("Badloop\n"); break; }
|
qboolean found = false;
|
||||||
|
mesh_t *mesh;
|
||||||
|
|
||||||
|
glDepthMask (1);
|
||||||
|
//GL_DisableMultitexture();
|
||||||
|
/*glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
|
||||||
|
glColor3f(sh_lightmapbright.value,sh_lightmapbright.value,sh_lightmapbright.value);
|
||||||
|
|
||||||
|
if (gl_wireframe.value) {
|
||||||
|
GL_SelectTexture(GL_TEXTURE0_ARB);
|
||||||
|
glDisable(GL_TEXTURE_2D);
|
||||||
|
GL_SelectTexture(GL_TEXTURE1_ARB);
|
||||||
|
glDisable(GL_TEXTURE_2D);
|
||||||
}
|
}
|
||||||
curvechain = NULL;
|
*/
|
||||||
|
|
||||||
|
causticschain = NULL; //clear chain here
|
||||||
|
|
||||||
|
//R_EnableVertexTable(VERTEX_TEXTURE | VERTEX_LIGHTMAP);
|
||||||
|
|
||||||
|
for (i=0 ; i<cl.worldmodel->nummapshaders ; i++)
|
||||||
|
{
|
||||||
|
sh = &cl.worldmodel->mapshaders[i];
|
||||||
|
if (!sh)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
s = sh->texturechain;
|
||||||
|
if (!s)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
|
||||||
|
if (IsShaderBlended(sh->shader)) {
|
||||||
|
R_DrawWorldAmbientChain(sh->texturechain);
|
||||||
|
sh->texturechain = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i=0 ; i<cl.worldmodel->nummapshaders ; i++)
|
||||||
|
{
|
||||||
|
sh = &cl.worldmodel->mapshaders[i];
|
||||||
|
mesh = sh->meshchain;
|
||||||
|
|
||||||
|
if (!mesh)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (IsShaderBlended(mesh->shader->shader)) {
|
||||||
|
while (mesh) {
|
||||||
|
R_DrawMeshAmbient(mesh);
|
||||||
|
mesh = mesh->next;
|
||||||
|
}
|
||||||
|
sh->meshchain = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//R_DisableVertexTable(VERTEX_TEXTURE | VERTEX_LIGHTMAP);
|
||||||
|
//GL_SelectTexture(GL_TEXTURE1_ARB);
|
||||||
|
//GL_DisableMultitexture();
|
||||||
|
glDisable(GL_BLEND);
|
||||||
|
glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||||
|
glDepthMask (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void R_DrawBrushModelCaustics (entity_t *e);
|
void R_DrawBrushModelCaustics (entity_t *e);
|
||||||
|
@ -1618,7 +1705,7 @@ R_DrawBrushModel
|
||||||
|
|
||||||
PENTA: Modifications
|
PENTA: Modifications
|
||||||
=================
|
=================
|
||||||
*/
|
*//*
|
||||||
void R_DrawBrushModel (entity_t *e)
|
void R_DrawBrushModel (entity_t *e)
|
||||||
{
|
{
|
||||||
vec3_t mins, maxs;
|
vec3_t mins, maxs;
|
||||||
|
@ -1627,7 +1714,7 @@ void R_DrawBrushModel (entity_t *e)
|
||||||
mplane_t *pplane;
|
mplane_t *pplane;
|
||||||
model_t *clmodel;
|
model_t *clmodel;
|
||||||
qboolean rotated;
|
qboolean rotated;
|
||||||
texture_t *t;
|
shader_t *s;
|
||||||
|
|
||||||
//bright = 1;
|
//bright = 1;
|
||||||
|
|
||||||
|
@ -1738,7 +1825,8 @@ void R_DrawBrushModel (entity_t *e)
|
||||||
R_RenderBrushPoly (psurf);
|
R_RenderBrushPoly (psurf);
|
||||||
//}
|
//}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
/*
|
||||||
// if luma, draw it too
|
// if luma, draw it too
|
||||||
psurf = &clmodel->surfaces[clmodel->firstmodelsurface];
|
psurf = &clmodel->surfaces[clmodel->firstmodelsurface];
|
||||||
//vec3_t color_black = {0.0, 0.0, 0.0};
|
//vec3_t color_black = {0.0, 0.0, 0.0};
|
||||||
|
@ -1764,11 +1852,11 @@ void R_DrawBrushModel (entity_t *e)
|
||||||
GL_SelectTexture(GL_TEXTURE1_ARB);
|
GL_SelectTexture(GL_TEXTURE1_ARB);
|
||||||
glDisable(GL_BLEND);
|
glDisable(GL_BLEND);
|
||||||
glFogfv(GL_FOG_COLOR, fog_color);
|
glFogfv(GL_FOG_COLOR, fog_color);
|
||||||
|
*//*
|
||||||
GL_DisableMultitexture();
|
GL_DisableMultitexture();
|
||||||
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
|
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
|
||||||
glPopMatrix ();
|
glPopMatrix ();
|
||||||
}
|
}*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
=================
|
=================
|
||||||
|
@ -1918,7 +2006,9 @@ e->angles[0] = -e->angles[0]; // stupid quake bug
|
||||||
R_RotateForEntity (e);
|
R_RotateForEntity (e);
|
||||||
e->angles[0] = -e->angles[0]; // stupid quake bug
|
e->angles[0] = -e->angles[0]; // stupid quake bug
|
||||||
|
|
||||||
//Draw model with specified ambient color
|
R_DrawBrushAmbient(e);
|
||||||
|
|
||||||
|
/* //Draw model with specified ambient color
|
||||||
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
|
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -1941,6 +2031,7 @@ e->angles[0] = -e->angles[0]; // stupid quake bug
|
||||||
|
|
||||||
//R_BlendLightmaps (); nope no lightmaps
|
//R_BlendLightmaps (); nope no lightmaps
|
||||||
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
|
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
|
||||||
|
*/
|
||||||
glPopMatrix ();
|
glPopMatrix ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1968,7 +2059,7 @@ void R_RecursiveWorldNode (mnode_t *node)
|
||||||
mplane_t *plane;
|
mplane_t *plane;
|
||||||
msurface_t *surf, **mark;
|
msurface_t *surf, **mark;
|
||||||
mleaf_t *pleaf;
|
mleaf_t *pleaf;
|
||||||
mcurve_t *curve;
|
mesh_t *mesh;
|
||||||
double dot;
|
double dot;
|
||||||
|
|
||||||
if (node->contents == CONTENTS_SOLID)
|
if (node->contents == CONTENTS_SOLID)
|
||||||
|
@ -2044,7 +2135,7 @@ void R_RecursiveWorldNode (mnode_t *node)
|
||||||
mark++;
|
mark++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
if (((*mark)->flags & SURF_DRAWTURB) && ((*mark)->flags & SURF_MIRROR)) {
|
if (((*mark)->flags & SURF_DRAWTURB) && ((*mark)->flags & SURF_MIRROR)) {
|
||||||
mark++;
|
mark++;
|
||||||
continue;
|
continue;
|
||||||
|
@ -2054,9 +2145,9 @@ void R_RecursiveWorldNode (mnode_t *node)
|
||||||
mark++;
|
mark++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
(*mark)->texturechain = (*mark)->texinfo->texture->texturechain;
|
(*mark)->texturechain = (*mark)->shader->texturechain;
|
||||||
(*mark)->texinfo->texture->texturechain = (*mark);
|
(*mark)->shader->texturechain = (*mark);
|
||||||
|
|
||||||
if (!((*mark)->flags & (SURF_DRAWSKY | SURF_DRAWTURB))) {
|
if (!((*mark)->flags & (SURF_DRAWSKY | SURF_DRAWTURB))) {
|
||||||
(*mark)->polys->chain = lightmap_polys[(*mark)->lightmaptexturenum];
|
(*mark)->polys->chain = lightmap_polys[(*mark)->lightmaptexturenum];
|
||||||
|
@ -2069,16 +2160,16 @@ void R_RecursiveWorldNode (mnode_t *node)
|
||||||
} while (--c);
|
} while (--c);
|
||||||
}
|
}
|
||||||
|
|
||||||
c = pleaf->firstcurve;
|
c = pleaf->firstmesh;
|
||||||
//if (pleaf->numcurves) Con_Printf("Numcurves %i\n",pleaf->numcurves);
|
//if (pleaf->numcurves) Con_Printf("Numcurves %i\n",pleaf->numcurves);
|
||||||
for (i=0; i<pleaf->numcurves; i++) {
|
for (i=0; i<pleaf->nummeshes; i++) {
|
||||||
curve = &cl.worldmodel->curves[cl.worldmodel->leafcurves[c+i]];
|
mesh = &cl.worldmodel->meshes[cl.worldmodel->leafmeshes[c+i]];
|
||||||
|
|
||||||
if (curve->visframe == r_framecount) continue;
|
if (mesh->visframe == r_framecount) continue;
|
||||||
curve->visframe = r_framecount;
|
mesh->visframe = r_framecount;
|
||||||
|
|
||||||
curve->next = curvechain;
|
mesh->next = mesh->shader->meshchain;
|
||||||
curvechain = curve;
|
mesh->shader->meshchain = mesh;
|
||||||
//Con_Printf("AddCurve\n");
|
//Con_Printf("AddCurve\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2119,7 +2210,9 @@ void R_RecursiveWorldNode (mnode_t *node)
|
||||||
|
|
||||||
// recurse down the children, front side first
|
// recurse down the children, front side first
|
||||||
R_RecursiveWorldNode (node->children[side]);
|
R_RecursiveWorldNode (node->children[side]);
|
||||||
|
R_RecursiveWorldNode (node->children[!side]);
|
||||||
|
|
||||||
|
/*
|
||||||
// draw stuff
|
// draw stuff
|
||||||
c = node->numsurfaces;
|
c = node->numsurfaces;
|
||||||
|
|
||||||
|
@ -2146,6 +2239,7 @@ void R_RecursiveWorldNode (mnode_t *node)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (surf->flags & SURF_MIRROR) {
|
if (surf->flags & SURF_MIRROR) {
|
||||||
|
|
||||||
//PENTA the SURF_UNDERWATER check is needed so that we dont draw glass
|
//PENTA the SURF_UNDERWATER check is needed so that we dont draw glass
|
||||||
|
@ -2168,15 +2262,15 @@ void R_RecursiveWorldNode (mnode_t *node)
|
||||||
}
|
}
|
||||||
|
|
||||||
// if sorting by texture, just store it out
|
// if sorting by texture, just store it out
|
||||||
/*if (gl_texsort.value)
|
//if (gl_texsort.value)
|
||||||
{*/
|
//{
|
||||||
|
|
||||||
// add the surface to the proper texture chain
|
// add the surface to the proper texture chain
|
||||||
//if (!mirror
|
//if (!mirror
|
||||||
//|| surf->texinfo->texture != cl.worldmodel->textures[mirrortexturenum])
|
//|| surf->texinfo->texture != cl.worldmodel->textures[mirrortexturenum])
|
||||||
//{
|
//{
|
||||||
surf->texturechain = surf->texinfo->texture->texturechain;
|
surf->texturechain = surf->shader->texturechain;
|
||||||
surf->texinfo->texture->texturechain = surf;
|
surf->shader->texturechain = surf;
|
||||||
//}
|
//}
|
||||||
|
|
||||||
|
|
||||||
|
@ -2190,24 +2284,24 @@ void R_RecursiveWorldNode (mnode_t *node)
|
||||||
lightmap_polys[surf->lightmaptexturenum] = surf->polys;
|
lightmap_polys[surf->lightmaptexturenum] = surf->polys;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
} else if (surf->flags & SURF_DRAWSKY) {
|
//} else if (surf->flags & SURF_DRAWSKY) {
|
||||||
surf->texturechain = skychain;
|
// surf->texturechain = skychain;
|
||||||
skychain = surf;
|
// skychain = surf;
|
||||||
} else if (surf->flags & SURF_DRAWTURB) {
|
//} else if (surf->flags & SURF_DRAWTURB) {
|
||||||
surf->texturechain = waterchain;
|
// surf->texturechain = waterchain;
|
||||||
waterchain = surf;
|
// waterchain = surf;
|
||||||
} else
|
//} else
|
||||||
R_DrawSequentialPoly (surf);
|
// R_DrawSequentialPoly (surf);
|
||||||
*/
|
//
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
// recurse down the back side
|
// recurse down the back side
|
||||||
R_RecursiveWorldNode (node->children[!side]);
|
//R_RecursiveWorldNode (node->children[!side]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -2401,13 +2495,14 @@ model_t *currentmodel;
|
||||||
int nColinElim;
|
int nColinElim;
|
||||||
|
|
||||||
//PENTA: temporaly storage for polygons that use an edge
|
//PENTA: temporaly storage for polygons that use an edge
|
||||||
|
/*
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int used; //how many polygons use this edge
|
int used; //how many polygons use this edge
|
||||||
glpoly_t *poly[2]; //pointer to the polygons who use this edge
|
glpoly_t *poly[2]; //pointer to the polygons who use this edge
|
||||||
} temp_connect_t;
|
} temp_connect_t;
|
||||||
|
|
||||||
temp_connect_t *tempEdges;
|
temp_connect_t *tempEdges;
|
||||||
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
================
|
================
|
||||||
|
@ -2416,7 +2511,7 @@ SetupSurfaceConnectivity
|
||||||
|
|
||||||
Setup the neighour pointers of this surface's polygon.
|
Setup the neighour pointers of this surface's polygon.
|
||||||
================
|
================
|
||||||
*/
|
*//*
|
||||||
void SetupSurfaceConnectivity(msurface_t *surf)
|
void SetupSurfaceConnectivity(msurface_t *surf)
|
||||||
{
|
{
|
||||||
int i,j,lindex;
|
int i,j,lindex;
|
||||||
|
@ -2439,14 +2534,14 @@ void SetupSurfaceConnectivity(msurface_t *surf)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
/*
|
/*
|
||||||
================
|
================
|
||||||
PENTA:
|
PENTA:
|
||||||
PrintTempEdges
|
PrintTempEdges
|
||||||
|
|
||||||
================
|
================
|
||||||
*/
|
*//*
|
||||||
void PrintTempEdges()
|
void PrintTempEdges()
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
@ -2459,7 +2554,7 @@ void PrintTempEdges()
|
||||||
Con_Printf("moord en brand %d\n",tempEdge->used);
|
Con_Printf("moord en brand %d\n",tempEdge->used);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
/*
|
/*
|
||||||
================
|
================
|
||||||
BuildPolyFromSurface
|
BuildPolyFromSurface
|
||||||
|
@ -2467,7 +2562,7 @@ BuildPolyFromSurface
|
||||||
Creer polygons van de lijst van surfaces om
|
Creer polygons van de lijst van surfaces om
|
||||||
gemakkelijk aan opengl te geven
|
gemakkelijk aan opengl te geven
|
||||||
================
|
================
|
||||||
*/
|
*//*
|
||||||
void BuildPolyFromSurface (msurface_t *fa)
|
void BuildPolyFromSurface (msurface_t *fa)
|
||||||
{
|
{
|
||||||
int i, lindex, lnumverts;
|
int i, lindex, lnumverts;
|
||||||
|
@ -2555,7 +2650,7 @@ void BuildPolyFromSurface (msurface_t *fa)
|
||||||
poly->numverts = lnumverts;
|
poly->numverts = lnumverts;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
/*
|
/*
|
||||||
========================
|
========================
|
||||||
GL_CreateSurfaceLightmap
|
GL_CreateSurfaceLightmap
|
||||||
|
@ -2610,138 +2705,9 @@ void GL_BuildLightmaps (void)
|
||||||
gl_lightmap_format = GL_RGB;
|
gl_lightmap_format = GL_RGB;
|
||||||
lightmap_bytes = 4;
|
lightmap_bytes = 4;
|
||||||
|
|
||||||
/*
|
|
||||||
gl_lightmap_format = GL_LUMINANCE;
|
|
||||||
|
|
||||||
// default differently on the Permedia
|
|
||||||
if (isPermedia)
|
|
||||||
gl_lightmap_format = GL_RGBA;
|
|
||||||
|
|
||||||
if (COM_CheckParm ("-lm_1"))
|
|
||||||
gl_lightmap_format = GL_LUMINANCE;
|
|
||||||
if (COM_CheckParm ("-lm_a"))
|
|
||||||
gl_lightmap_format = GL_ALPHA;
|
|
||||||
if (COM_CheckParm ("-lm_i"))
|
|
||||||
gl_lightmap_format = GL_INTENSITY;
|
|
||||||
if (COM_CheckParm ("-lm_2"))
|
|
||||||
gl_lightmap_format = GL_RGBA4;
|
|
||||||
if (COM_CheckParm ("-lm_4"))
|
|
||||||
gl_lightmap_format = GL_RGBA;
|
|
||||||
|
|
||||||
switch (gl_lightmap_format)
|
|
||||||
{
|
|
||||||
case GL_RGBA:
|
|
||||||
lightmap_bytes = 4;
|
|
||||||
break;
|
|
||||||
case GL_RGBA4:
|
|
||||||
lightmap_bytes = 2;
|
|
||||||
break;
|
|
||||||
case GL_LUMINANCE:
|
|
||||||
case GL_INTENSITY:
|
|
||||||
case GL_ALPHA:
|
|
||||||
lightmap_bytes = 1;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
/*
|
|
||||||
for (j=1 ; j<MAX_MODELS ; j++)
|
|
||||||
{
|
|
||||||
m = cl.model_precache[j];
|
|
||||||
if (!m)
|
|
||||||
break;
|
|
||||||
if (m->name[0] == '*')
|
|
||||||
continue;
|
|
||||||
|
|
||||||
r_pcurrentvertbase = m->vertexes;
|
|
||||||
currentmodel = m;
|
|
||||||
|
|
||||||
//PENTA: Allocate storage for our edge table
|
|
||||||
tempEdges = Hunk_TempAlloc(m->numedges * sizeof(temp_connect_t));
|
|
||||||
|
|
||||||
//clear tempedges
|
|
||||||
for (i=0; i<m->numedges; i++) {
|
|
||||||
tempEdges[i].used = 0;
|
|
||||||
tempEdges[i].poly[0] = NULL;
|
|
||||||
tempEdges[i].poly[1] = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
for (i=0 ; i<m->numsurfaces ; i++)
|
|
||||||
{
|
|
||||||
//GL_CreateSurfaceLightmap (m->surfaces + i);
|
|
||||||
if ( m->surfaces[i].flags & SURF_DRAWTURB )
|
|
||||||
continue;
|
|
||||||
#ifndef QUAKE2
|
|
||||||
if ( m->surfaces[i].flags & SURF_DRAWSKY )
|
|
||||||
continue;
|
|
||||||
#endif
|
|
||||||
// BuildPolyFromSurface (m->surfaces + i);
|
|
||||||
}
|
|
||||||
|
|
||||||
//PENTA: we now have the connectivity in tempEdges now store it in the polygons
|
|
||||||
for (i=0 ; i<m->numsurfaces ; i++)
|
|
||||||
{
|
|
||||||
if ( m->surfaces[i].flags & SURF_DRAWTURB )
|
|
||||||
continue;
|
|
||||||
#ifndef QUAKE2
|
|
||||||
if ( m->surfaces[i].flags & SURF_DRAWSKY )
|
|
||||||
continue;
|
|
||||||
#endif
|
|
||||||
// SetupSurfaceConnectivity (m->surfaces + i);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
Con_Printf("Connectivity calculated\n");
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
PENTA: Normalize texture coordinate s/t's since we now use them as tangent space
|
|
||||||
*/
|
|
||||||
for (j=1 ; j<MAX_MODELS ; j++)
|
|
||||||
{
|
|
||||||
mtexinfo_t *texinfos;
|
|
||||||
|
|
||||||
m = cl.model_precache[j];
|
|
||||||
if (!m)
|
|
||||||
break;
|
|
||||||
if (m->name[0] == '*')
|
|
||||||
continue;
|
|
||||||
|
|
||||||
texinfos = m->texinfo;
|
|
||||||
for (i=0; i<m->numtexinfo; i++) {
|
|
||||||
VectorNormalize(texinfos[i].vecs[0]);
|
|
||||||
VectorNormalize(texinfos[i].vecs[1]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
if (!gl_texsort.value)
|
|
||||||
GL_SelectTexture(GL_TEXTURE1_ARB);
|
|
||||||
*/
|
|
||||||
|
|
||||||
//
|
|
||||||
// upload all lightmaps that were filled
|
|
||||||
//
|
|
||||||
for (i=0 ; i<cl.worldmodel->numlightmaps ; i++)
|
for (i=0 ; i<cl.worldmodel->numlightmaps ; i++)
|
||||||
{
|
{
|
||||||
/*
|
Con_Printf("Lightmap %i\n",i);
|
||||||
if (!allocated[i][0])
|
|
||||||
break; // no more used
|
|
||||||
lightmap_modified[i] = false;
|
|
||||||
lightmap_rectchange[i].l = BLOCK_WIDTH;
|
|
||||||
lightmap_rectchange[i].t = BLOCK_HEIGHT;
|
|
||||||
lightmap_rectchange[i].w = 0;
|
|
||||||
lightmap_rectchange[i].h = 0;
|
|
||||||
GL_Bind(lightmap_textures + i);
|
|
||||||
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
|
||||||
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
|
||||||
glTexImage2D (GL_TEXTURE_2D, 0, lightmap_bytes
|
|
||||||
, BLOCK_WIDTH, BLOCK_HEIGHT, 0,
|
|
||||||
gl_lightmap_format, GL_UNSIGNED_BYTE, lightmaps+i*BLOCK_WIDTH*BLOCK_HEIGHT*lightmap_bytes);
|
|
||||||
*/
|
|
||||||
Con_Printf("Loadlightmap %i\n",i);
|
|
||||||
GL_Bind(lightmap_textures + i);
|
GL_Bind(lightmap_textures + i);
|
||||||
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||||
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||||
|
@ -2751,10 +2717,5 @@ void GL_BuildLightmaps (void)
|
||||||
cl.worldmodel->lightdata+(i*LIGHTMAP_WIDTH*LIGHTMAP_WIDTH*3));
|
cl.worldmodel->lightdata+(i*LIGHTMAP_WIDTH*LIGHTMAP_WIDTH*3));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
if (!gl_texsort.value)
|
|
||||||
GL_SelectTexture(GL_TEXTURE0_ARB);
|
|
||||||
*/
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue