fixes for the new backend.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@418 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
parent
bef51071a6
commit
a0bf669e3e
13 changed files with 606 additions and 279 deletions
|
@ -600,7 +600,6 @@ static galiastexnum_t *GL_ChooseSkin(galiasinfo_t *inf, char *modelname, entity_
|
|||
GL_Bind(texnums->base);
|
||||
glTexImage2D (GL_TEXTURE_2D, 0, gl_solid_format, scaled_width, scaled_height, 0, GL_RGBA, GL_UNSIGNED_BYTE, pixels);
|
||||
|
||||
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
|
||||
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
|
||||
|
@ -623,7 +622,6 @@ static galiastexnum_t *GL_ChooseSkin(galiasinfo_t *inf, char *modelname, entity_
|
|||
GL_Bind(texnums->fullbright);
|
||||
glTexImage2D (GL_TEXTURE_2D, 0, gl_alpha_format, scaled_width, scaled_height, 0, GL_RGBA, GL_UNSIGNED_BYTE, pixels);
|
||||
|
||||
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
|
||||
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
}
|
||||
|
@ -790,6 +788,8 @@ void GL_DrawAliasMesh (mesh_t *mesh, int texnum)
|
|||
|
||||
GL_Bind(texnum);
|
||||
|
||||
GL_TexEnv(GL_MODULATE);
|
||||
|
||||
glVertexPointer(3, GL_FLOAT, 16, mesh->xyz_array);
|
||||
glEnableClientState( GL_VERTEX_ARRAY );
|
||||
|
||||
|
@ -804,6 +804,8 @@ void GL_DrawAliasMesh (mesh_t *mesh, int texnum)
|
|||
glColorPointer(4, GL_UNSIGNED_BYTE, 0, mesh->colors_array);
|
||||
glEnableClientState( GL_COLOR_ARRAY );
|
||||
}
|
||||
else
|
||||
glDisableClientState( GL_COLOR_ARRAY );
|
||||
|
||||
glEnableClientState( GL_TEXTURE_COORD_ARRAY );
|
||||
glTexCoordPointer(2, GL_FLOAT, 0, mesh->st_array);
|
||||
|
@ -975,7 +977,7 @@ void R_DrawGAliasModel (entity_t *e)
|
|||
*/
|
||||
|
||||
GL_DisableMultitexture();
|
||||
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
|
||||
GL_TexEnv(GL_MODULATE);
|
||||
if (gl_smoothmodels.value)
|
||||
glShadeModel (GL_SMOOTH);
|
||||
if (gl_affinemodels.value)
|
||||
|
@ -1023,6 +1025,7 @@ void R_DrawGAliasModel (entity_t *e)
|
|||
else
|
||||
{
|
||||
glDisable(GL_BLEND);
|
||||
glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
}
|
||||
// glEnable (GL_ALPHA_TEST);
|
||||
|
||||
|
@ -1127,6 +1130,7 @@ void R_DrawGAliasModel (entity_t *e)
|
|||
if (qglPNTrianglesfATI && gl_ati_truform.value)
|
||||
glEnable(GL_PN_TRIANGLES_ATI);
|
||||
|
||||
memset(&mesh, 0, sizeof(mesh));
|
||||
while(inf)
|
||||
{
|
||||
R_GAliasBuildMesh(&mesh, inf, e->frame, e->oldframe, e->lerptime, e->alpha);
|
||||
|
@ -1154,7 +1158,7 @@ void R_DrawGAliasModel (entity_t *e)
|
|||
|
||||
R_IBrokeTheArrays();
|
||||
|
||||
R_PushMesh(&mesh, skin->shader->features|MF_COLORS);
|
||||
R_PushMesh(&mesh, skin->shader->features | MF_NONBATCHED | MF_COLORS);
|
||||
|
||||
R_RenderMeshBuffer ( &mb, false );
|
||||
}
|
||||
|
@ -1221,7 +1225,7 @@ glColor3f(0,0,1);
|
|||
glDisable(GL_BLEND);
|
||||
|
||||
glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
|
||||
GL_TexEnv(GL_REPLACE);
|
||||
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
|
||||
|
@ -1349,7 +1353,7 @@ void R_DrawGAliasModelLighting (entity_t *e)
|
|||
VectorNormalize (shadevector);
|
||||
|
||||
GL_DisableMultitexture();
|
||||
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
|
||||
GL_TexEnv(GL_MODULATE);
|
||||
if (gl_smoothmodels.value)
|
||||
glShadeModel (GL_SMOOTH);
|
||||
if (gl_affinemodels.value)
|
||||
|
@ -1382,7 +1386,7 @@ void R_DrawGAliasModelLighting (entity_t *e)
|
|||
if (gl_ati_truform.value)
|
||||
glDisable(GL_PN_TRIANGLES_ATI);
|
||||
|
||||
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
|
||||
GL_TexEnv(GL_REPLACE);
|
||||
|
||||
glShadeModel (GL_FLAT);
|
||||
if (gl_affinemodels.value)
|
||||
|
|
|
@ -34,8 +34,8 @@ void GL_MBind( GLenum target, int texnum )
|
|||
{
|
||||
GL_SelectTexture( target );
|
||||
|
||||
// if ( gl_state.currenttextures[texnum-mtexid0] == texnum )
|
||||
// return;
|
||||
if ( gl_state.currenttextures[gl_state.currenttmu] == texnum )
|
||||
return;
|
||||
|
||||
gl_state.currenttextures[gl_state.currenttmu] = texnum;
|
||||
bindTexFunc (GL_TEXTURE_2D, texnum);
|
||||
|
@ -51,9 +51,12 @@ void GL_Bind (int texnum)
|
|||
}
|
||||
void GL_BindType (int type, int texnum)
|
||||
{
|
||||
bindTexFunc (type, texnum);
|
||||
if (gl_state.currenttextures[gl_state.currenttmu] == texnum)
|
||||
return;
|
||||
gl_state.currenttextures[gl_state.currenttmu] = texnum;
|
||||
|
||||
gl_state.currenttextures[gl_state.currenttmu] = -1;
|
||||
|
||||
bindTexFunc (type, texnum);
|
||||
}
|
||||
|
||||
//vid restarted.
|
||||
|
@ -402,7 +405,7 @@ static void Mesh_DrawPass(shaderpass_t *pass, mesh_t *mesh)
|
|||
GL_BindType(pass[p].texturetype, pass[p].anim_frames[0]);
|
||||
glEnable(pass[p].texturetype);
|
||||
|
||||
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, pass[p].envmode);
|
||||
GL_TexEnv(pass[p].envmode);
|
||||
if (pass[p].envmode == GL_COMBINE_ARB)
|
||||
{
|
||||
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_RGB_ARB, pass[p].combinesrc0);
|
||||
|
@ -425,7 +428,7 @@ static void Mesh_DrawPass(shaderpass_t *pass, mesh_t *mesh)
|
|||
{
|
||||
Mesh_DeformTextureCoords(mesh, pass);
|
||||
|
||||
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, pass->envmode);
|
||||
GL_TexEnv(pass->envmode);
|
||||
|
||||
GL_Bind(pass->anim_frames[0]);
|
||||
if (pass->texturetype != GL_TEXTURE_2D)
|
||||
|
@ -1059,6 +1062,7 @@ static float frand(void)
|
|||
R_BackendInit
|
||||
==============
|
||||
*/
|
||||
void R_IBrokeTheArrays(void);
|
||||
void R_BackendInit (void)
|
||||
{
|
||||
int i;
|
||||
|
@ -1089,10 +1093,7 @@ void R_BackendInit (void)
|
|||
r_arrays_locked = false;
|
||||
r_blocked = false;
|
||||
|
||||
qglVertexPointer( 3, GL_FLOAT, 16, vertexArray ); // padded for SIMD
|
||||
qglColorPointer( 4, GL_UNSIGNED_BYTE, 0, colorArray );
|
||||
|
||||
qglEnableClientState( GL_VERTEX_ARRAY );
|
||||
R_IBrokeTheArrays();
|
||||
|
||||
//FIZME: FTE already has some stuff along these lines, surly...
|
||||
// if ( !r_ignorehwgamma->value )
|
||||
|
@ -1122,8 +1123,10 @@ void R_BackendInit (void)
|
|||
}
|
||||
}
|
||||
|
||||
qboolean varrayactive;
|
||||
void R_IBrokeTheArrays(void)
|
||||
{
|
||||
varrayactive = true;
|
||||
qglVertexPointer( 3, GL_FLOAT, 16, vertexArray ); // padded for SIMD
|
||||
qglColorPointer( 4, GL_UNSIGNED_BYTE, 0, colorArray );
|
||||
|
||||
|
@ -1754,6 +1757,10 @@ int R_ShaderpassTex ( shaderpass_t *pass )
|
|||
{
|
||||
return lightmap_textures[r_lmtex];
|
||||
}
|
||||
/* else if ( (pass->flags & SHADER_PASS_DELUXMAP) && r_lmtex >= 0 )
|
||||
{
|
||||
return deluxmap_textures[r_lmtex];
|
||||
}*/
|
||||
|
||||
return pass->anim_frames[0] ? pass->anim_frames[0] : 0;
|
||||
}
|
||||
|
@ -2494,6 +2501,13 @@ void R_RenderMeshBuffer ( meshbuffer_t *mb, qboolean shadowpass )
|
|||
return;
|
||||
}
|
||||
|
||||
// R_IBrokeTheArrays();
|
||||
|
||||
// qglVertexPointer( 3, GL_FLOAT, 16, vertexArray ); // padded for SIMD
|
||||
// qglColorPointer( 4, GL_UNSIGNED_BYTE, 0, colorArray );
|
||||
|
||||
// qglEnableClientState( GL_VERTEX_ARRAY );
|
||||
|
||||
shader = mb->shader;
|
||||
r_lmtex = mb->infokey;
|
||||
|
||||
|
|
|
@ -54,6 +54,7 @@ static int filmtexture;
|
|||
extern cvar_t gl_nobind;
|
||||
extern cvar_t gl_max_size;
|
||||
extern cvar_t gl_picmip;
|
||||
extern cvar_t gl_picmip2d;
|
||||
extern cvar_t r_drawdisk;
|
||||
extern cvar_t gl_compress;
|
||||
extern cvar_t gl_font, gl_conback, gl_smoothfont;
|
||||
|
@ -1208,7 +1209,7 @@ void GLDraw_Crosshair(void)
|
|||
return;
|
||||
}
|
||||
glDisable (GL_BLEND);
|
||||
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
|
||||
GL_TexEnv(GL_MODULATE);
|
||||
|
||||
if (crosshair.value)
|
||||
{
|
||||
|
@ -1268,8 +1269,8 @@ void GLDraw_Crosshair(void)
|
|||
glEnd ();
|
||||
}
|
||||
|
||||
// glTexEnvf ( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE );
|
||||
// glTexEnvf ( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE );
|
||||
// GL_TexEnv ( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE );
|
||||
// GL_TexEnv ( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE );
|
||||
}
|
||||
|
||||
|
||||
|
@ -2297,9 +2298,17 @@ void GL_Upload32 (char *name, unsigned *data, int width, int height, qboolean m
|
|||
;
|
||||
}
|
||||
|
||||
TRACE(("dbg: GL_Upload32: %f\n", gl_picmip.value));
|
||||
scaled_width >>= (int)gl_picmip.value;
|
||||
scaled_height >>= (int)gl_picmip.value;
|
||||
if (mipmap)
|
||||
{
|
||||
TRACE(("dbg: GL_Upload32: %f\n", gl_picmip.value));
|
||||
scaled_width >>= (int)gl_picmip.value;
|
||||
scaled_height >>= (int)gl_picmip.value;
|
||||
}
|
||||
else
|
||||
{
|
||||
scaled_width >>= (int)gl_picmip2d.value;
|
||||
scaled_height >>= (int)gl_picmip2d.value;
|
||||
}
|
||||
|
||||
TRACE(("dbg: GL_Upload32: %f\n", gl_max_size.value));
|
||||
if (gl_max_size.value)
|
||||
|
@ -2466,8 +2475,17 @@ void GL_Upload8Grey (unsigned char*data, int width, int height, qboolean mipmap
|
|||
;
|
||||
}
|
||||
|
||||
scaled_width >>= (int)gl_picmip.value;
|
||||
scaled_height >>= (int)gl_picmip.value;
|
||||
if (mipmap)
|
||||
{
|
||||
TRACE(("dbg: GL_Upload8Grey: %f\n", gl_picmip.value));
|
||||
scaled_width >>= (int)gl_picmip.value;
|
||||
scaled_height >>= (int)gl_picmip.value;
|
||||
}
|
||||
else
|
||||
{
|
||||
scaled_width >>= (int)gl_picmip2d.value;
|
||||
scaled_height >>= (int)gl_picmip2d.value;
|
||||
}
|
||||
|
||||
if (gl_max_size.value)
|
||||
{
|
||||
|
@ -2682,8 +2700,17 @@ void GL_UploadBump(qbyte *data, int width, int height, qboolean mipmap) {
|
|||
;
|
||||
}
|
||||
|
||||
scaled_width >>= (int)gl_picmip.value;
|
||||
scaled_height >>= (int)gl_picmip.value;
|
||||
if (mipmap)
|
||||
{
|
||||
TRACE(("dbg: GL_UploadBump: %f\n", gl_picmip.value));
|
||||
scaled_width >>= (int)gl_picmip.value;
|
||||
scaled_height >>= (int)gl_picmip.value;
|
||||
}
|
||||
else
|
||||
{
|
||||
scaled_width >>= (int)gl_picmip2d.value;
|
||||
scaled_height >>= (int)gl_picmip2d.value;
|
||||
}
|
||||
|
||||
if (gl_max_size.value)
|
||||
{
|
||||
|
@ -2809,8 +2836,17 @@ void GL_Upload8_EXT (qbyte *data, int width, int height, qboolean mipmap, qbool
|
|||
;
|
||||
}
|
||||
|
||||
scaled_width >>= (int)gl_picmip.value;
|
||||
scaled_height >>= (int)gl_picmip.value;
|
||||
if (mipmap)
|
||||
{
|
||||
TRACE(("dbg: GL_Upload8_EXT: %f\n", gl_picmip.value));
|
||||
scaled_width >>= (int)gl_picmip.value;
|
||||
scaled_height >>= (int)gl_picmip.value;
|
||||
}
|
||||
else
|
||||
{
|
||||
scaled_width >>= (int)gl_picmip2d.value;
|
||||
scaled_height >>= (int)gl_picmip2d.value;
|
||||
}
|
||||
|
||||
if (gl_max_size.value)
|
||||
{
|
||||
|
|
|
@ -506,7 +506,7 @@ void R_DrawHLModel(entity_t *curent)
|
|||
if (sequence->motiontype)
|
||||
model.frame = sequence->numframes-1;
|
||||
|
||||
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
|
||||
GL_TexEnv(GL_MODULATE);
|
||||
|
||||
if (curent->alpha<1)
|
||||
{
|
||||
|
@ -593,7 +593,7 @@ void R_DrawHLModel(entity_t *curent)
|
|||
|
||||
glPopMatrix();
|
||||
|
||||
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
|
||||
GL_TexEnv(GL_REPLACE);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -123,7 +123,7 @@ void GLR_NetGraph (void)
|
|||
NET_TIMINGS, NET_GRAPHHEIGHT, 0, GL_RGBA,
|
||||
GL_UNSIGNED_BYTE, ngraph_pixels);
|
||||
|
||||
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
|
||||
GL_TexEnv(GL_MODULATE);
|
||||
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -412,11 +412,15 @@ void GLQ3_LightGrid(vec3_t point, vec3_t res_diffuse, vec3_t res_ambient, vec3_t
|
|||
res_dir[2] = 0.1;
|
||||
}
|
||||
|
||||
if (!lg)
|
||||
// if (!lg)
|
||||
{
|
||||
res_ambient[0] = 255;
|
||||
res_ambient[1] = 255;
|
||||
res_ambient[2] = 255;
|
||||
res_ambient[0] = 64;
|
||||
res_ambient[1] = 64;
|
||||
res_ambient[2] = 64;
|
||||
|
||||
res_diffuse[0] = 192;
|
||||
res_diffuse[1] = 192;
|
||||
res_diffuse[2] = 192;
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -2083,7 +2083,7 @@ void GLR_DrawWaterSurfaces (void)
|
|||
glEnable (GL_BLEND);
|
||||
glDisable (GL_ALPHA_TEST);
|
||||
glColor4f (1,1,1,r_wateralphaval);
|
||||
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
|
||||
GL_TexEnv(GL_MODULATE);
|
||||
}
|
||||
|
||||
if (gl_waterripples.value)
|
||||
|
@ -2104,8 +2104,6 @@ void GLR_DrawWaterSurfaces (void)
|
|||
continue;
|
||||
if ( !(s->flags & SURF_DRAWTURB ) )
|
||||
continue;
|
||||
|
||||
// set modulate mode explicitly
|
||||
|
||||
GL_Bind (t->gl_texturenum);
|
||||
|
||||
|
@ -2116,7 +2114,7 @@ void GLR_DrawWaterSurfaces (void)
|
|||
}
|
||||
|
||||
if (r_wateralphaval < 1.0) {
|
||||
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
|
||||
GL_TexEnv(GL_REPLACE);
|
||||
|
||||
glColor4f (1,1,1,1);
|
||||
glDisable (GL_BLEND);
|
||||
|
@ -2132,7 +2130,29 @@ static void GLR_DrawAlphaSurface(msurface_t *s)
|
|||
{
|
||||
glPushMatrix();
|
||||
R_RotateForEntity(s->ownerent);
|
||||
#ifdef Q3SHADERS
|
||||
if (s->texinfo->texture->shader)
|
||||
{
|
||||
meshbuffer_t mb;
|
||||
mb.dlightbits = 0;
|
||||
mb.entity = s->ownerent;
|
||||
mb.shader = s->texinfo->texture->shader;
|
||||
mb.sortkey = 0;
|
||||
|
||||
mb.infokey = s->lightmaptexturenum;
|
||||
mb.mesh = s->mesh;
|
||||
mb.fog = s->fog;
|
||||
currententity = s->ownerent;
|
||||
if (s->mesh)
|
||||
{
|
||||
R_PushMesh(s->mesh, mb.shader->features|MF_NONBATCHED);
|
||||
R_RenderMeshBuffer ( &mb, false );
|
||||
}
|
||||
|
||||
glPopMatrix();
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
GL_Bind(s->texinfo->texture->gl_texturenum);
|
||||
|
||||
if (s->texinfo->flags & SURF_TRANS33)
|
||||
|
@ -2153,10 +2173,10 @@ static void GLR_DrawAlphaSurface(msurface_t *s)
|
|||
int i;
|
||||
float *v;
|
||||
glpoly_t *p;
|
||||
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
|
||||
GL_TexEnv(GL_REPLACE);
|
||||
GL_EnableMultitexture();
|
||||
GL_Bind(lightmap_textures[s->lightmaptexturenum]);
|
||||
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_BLEND);
|
||||
GL_TexEnv(GL_BLEND);
|
||||
p = s->polys;
|
||||
|
||||
glColor4f (1,1,1,1);
|
||||
|
@ -2209,16 +2229,12 @@ void GLR_DrawAlphaSurfaces (void)
|
|||
//
|
||||
|
||||
glLoadMatrixf (r_world_matrix);
|
||||
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
|
||||
GL_TexEnv(GL_MODULATE);
|
||||
|
||||
glEnable(GL_ALPHA_TEST);
|
||||
glDisable(GL_BLEND);
|
||||
if (cl.worldmodel && (cl.worldmodel->fromgame == fg_quake3|| cl.worldmodel->fromgame == fg_quake2))
|
||||
if (cl.worldmodel && (cl.worldmodel->fromgame == fg_quake2))
|
||||
{ //this is a mahoosive hack.
|
||||
//we need to use different blending modes for lights and 'rugs'...
|
||||
//we could do this by seeing if a texture includes alpha - rug, or if it's fully solid - light.
|
||||
if (cl.worldmodel->fromgame == fg_quake3)
|
||||
glBlendFunc (GL_ONE, GL_ONE_MINUS_SRC_COLOR);
|
||||
glDepthMask(0); //this makes no difference to the cheating.
|
||||
|
||||
glDisable(GL_ALPHA_TEST);
|
||||
|
@ -2250,10 +2266,10 @@ void GLR_DrawAlphaSurfaces (void)
|
|||
float *v;
|
||||
glpoly_t *p;
|
||||
GL_Bind(s->texinfo->texture->gl_texturenum);
|
||||
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
|
||||
GL_TexEnv(GL_REPLACE);
|
||||
GL_EnableMultitexture();
|
||||
GL_Bind(lightmap_textures[s->lightmaptexturenum]);
|
||||
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_BLEND);
|
||||
GL_TexEnv(GL_BLEND);
|
||||
p = s->polys;
|
||||
|
||||
|
||||
|
@ -2297,7 +2313,7 @@ void GLR_DrawAlphaSurfaces (void)
|
|||
RQ_RenderDistAndClear();
|
||||
glDepthMask(1);
|
||||
|
||||
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
|
||||
GL_TexEnv(GL_REPLACE);
|
||||
|
||||
glColor4f (1,1,1,1);
|
||||
glDisable (GL_BLEND);
|
||||
|
@ -2468,13 +2484,13 @@ static void DrawTextureChains (model_t *model, float alpha, vec3_t relativelight
|
|||
glEnable(GL_TEXTURE_2D);
|
||||
|
||||
//Set up texture environment to do (tex0 dot tex1)*color
|
||||
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_ARB);
|
||||
GL_TexEnv(GL_COMBINE_ARB);
|
||||
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_RGB_ARB, GL_TEXTURE);
|
||||
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB_ARB, GL_REPLACE);
|
||||
|
||||
qglActiveTextureARB(GL_TEXTURE1_ARB);
|
||||
|
||||
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_ARB);
|
||||
GL_TexEnv(GL_COMBINE_ARB);
|
||||
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_RGB_ARB, GL_TEXTURE);
|
||||
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE1_RGB_ARB, GL_PREVIOUS_ARB);
|
||||
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB_ARB, GL_DOT3_RGB_ARB);
|
||||
|
|
|
@ -1894,7 +1894,7 @@ int R_LoadShader ( char *name, int type )
|
|||
|
||||
s->numpasses = 1;
|
||||
s->numdeforms = 0;
|
||||
s->flags = SHADER_NOPICMIP|SHADER_NOMIPMAPS;
|
||||
s->flags = SHADER_NOPICMIP|SHADER_NOMIPMAPS|SHADER_BLEND;
|
||||
s->features = MF_STCOORDS|MF_COLORS;
|
||||
s->sort = SHADER_SORT_ADDITIVE;
|
||||
s->registration_sequence = 1;//fizme: registration_sequence;
|
||||
|
|
|
@ -1099,7 +1099,7 @@ LONG WINAPI GLMainWndProc (
|
|||
if (!vid_initializing)
|
||||
Key_Event (MapKey(lParam), true);
|
||||
break;
|
||||
|
||||
|
||||
case WM_KEYUP:
|
||||
case WM_SYSKEYUP:
|
||||
if (!vid_initializing)
|
||||
|
|
|
@ -323,7 +323,10 @@ void EmitSkyPolys (msurface_t *fa)
|
|||
if (fa->mesh)
|
||||
{
|
||||
fa->mesh->colors_array = NULL;
|
||||
glDisable(GL_TEXTURE_2D);
|
||||
glColor3f(0,0,0);
|
||||
GL_DrawAliasMesh(fa->mesh, 1);
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -1628,6 +1628,264 @@ int Doom_PointContents(hull_t *hull, vec3_t p)
|
|||
return FTECONTENTS_EMPTY;
|
||||
}
|
||||
|
||||
#define NEWTRACES
|
||||
#ifdef NEWTRACES
|
||||
static qboolean ispoint;
|
||||
static void ClipToBlockMap(hull_t *hull, int block, vec3_t start, vec3_t end, trace_t *trace)
|
||||
{
|
||||
unsigned short *linedefs;
|
||||
dlinedef_t *ld;
|
||||
plane_t *lp;
|
||||
float planedist;
|
||||
|
||||
float d1, d2; //distance start, end
|
||||
|
||||
|
||||
trace->endpos[0] = end[0];
|
||||
trace->endpos[1] = end[1];
|
||||
trace->endpos[2] = end[2];
|
||||
|
||||
trace->fraction = 1;
|
||||
|
||||
for(linedefs = (short*)blockmapl + blockmapofs[block]+1; *linedefs != 0xffff; linedefs++)
|
||||
{
|
||||
ld = linedefsl + *linedefs;
|
||||
|
||||
lp = lineplanes + *linedefs;
|
||||
|
||||
if (ispoint)
|
||||
planedist = lp->dist;
|
||||
else
|
||||
{ //figure out how far to move the plane out by (tracebox instead of tracecylinder
|
||||
vec3_t ofs;
|
||||
int j;
|
||||
for (j=0 ; j<2 ; j++)
|
||||
{
|
||||
if (lp->normal[j] < 0)
|
||||
ofs[j] = hull->clip_maxs[j];
|
||||
else
|
||||
ofs[j] = hull->clip_mins[j];
|
||||
}
|
||||
ofs[2] = 0;
|
||||
planedist = lp->dist - DotProduct (ofs, lp->normal);
|
||||
}
|
||||
|
||||
d1 = DotProduct(lp->normal, start) - (planedist);
|
||||
d2 = DotProduct(lp->normal, end) - (planedist);
|
||||
if (d1 > 0 && d2 > 0)
|
||||
continue; //both points on the front side.
|
||||
|
||||
if (d1 < 0 && d2 < 0)
|
||||
continue; //both points on the back side.
|
||||
}
|
||||
}
|
||||
|
||||
static int numinsectors;
|
||||
static int insector[8];
|
||||
static trace_t *trace_trace;
|
||||
static hull_t *trace_hull;
|
||||
static vec3_t trace_end;
|
||||
static vec3_t trace_start;
|
||||
static qboolean EnterSector(int secnum, float z)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < numinsectors; i++)
|
||||
if (insector[i] == secnum)
|
||||
return true; //erm. already in this one
|
||||
|
||||
if (i == sizeof(insector)/sizeof(insector[0]))
|
||||
{
|
||||
Con_DPrintf("Trace was in too many sectors\n");
|
||||
return false; //you're not allowed to enter
|
||||
}
|
||||
if (z + trace_hull->clip_mins[2] < sectorm[secnum].floorheight) //was outside
|
||||
return false;
|
||||
if (z + trace_hull->clip_mins[2] > sectorm[secnum].ceilingheight) //was outside
|
||||
return false;
|
||||
|
||||
insector[i] = secnum;
|
||||
return true; //yay, the trace entered a big enough hole!
|
||||
}
|
||||
void LeaveSector(int secnum, float x, float y)
|
||||
{
|
||||
float z;
|
||||
|
||||
int i;
|
||||
for (i = 0; i < numinsectors; i++)
|
||||
if (insector[i] == secnum)
|
||||
{
|
||||
//switch with last.
|
||||
insector[i] = insector[numinsectors-1];
|
||||
numinsectors--;
|
||||
|
||||
//z at x,y
|
||||
if (trace_end[0]-trace_start[0])
|
||||
z = (trace_end[2]-trace_start[2])/(trace_end[0]-trace_start[0]);
|
||||
else if (trace_end[1]-trace_start[1])
|
||||
z = (trace_end[2]-trace_start[2])/(trace_end[1]-trace_start[1]);
|
||||
else
|
||||
{ //was a vertical trace.
|
||||
z = trace_end[2];
|
||||
}
|
||||
if (z > sectorm[secnum].ceilingheight)
|
||||
{
|
||||
z = sectorm[secnum].ceilingheight;
|
||||
if (z < trace_trace->endpos[2])
|
||||
{
|
||||
trace_trace->endpos[0] -= (trace_end[0]-trace_start[0])/(z-trace_start[0]);
|
||||
trace_trace->endpos[1] -= (trace_end[1]-trace_start[1])/(z-trace_start[1]);
|
||||
trace_trace->endpos[2] = z;
|
||||
}
|
||||
}
|
||||
if (z < sectorm[secnum].floorheight)
|
||||
{
|
||||
z = sectorm[secnum].floorheight;
|
||||
if (z < trace_trace->endpos[2])
|
||||
{
|
||||
trace_trace->endpos[0] -= (trace_end[0]-trace_start[0])/(z-trace_start[0]);
|
||||
trace_trace->endpos[1] -= (trace_end[1]-trace_start[1])/(z-trace_start[1]);
|
||||
trace_trace->endpos[2] = z;
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
Con_DPrintf("Trace wasn't in sector\n");
|
||||
}
|
||||
|
||||
void Doom_ClipToInitialNode(int nodenum)
|
||||
{
|
||||
int s;
|
||||
int seg;
|
||||
ddoomnode_t *node;
|
||||
if (nodenum & NODE_IS_SSECTOR)
|
||||
{
|
||||
nodenum -= NODE_IS_SSECTOR;
|
||||
for (seg = ssectorsl[nodenum].first; seg < ssectorsl[nodenum].first + ssectorsl[nodenum].segcount; seg++)
|
||||
if (segsl[seg].linedef != 0xffff)
|
||||
break;
|
||||
|
||||
s = sidedefsm[linedefsl[segsl[seg].linedef].sidedef[segsl[seg].direction]].sector;
|
||||
|
||||
if (!EnterSector(s, trace_start[2]))
|
||||
{ //clipped by floor
|
||||
trace_trace->fraction = 0;
|
||||
trace_trace->allsolid = trace_trace->startsolid = true;
|
||||
trace_trace->endpos[0] = trace_start[0];
|
||||
trace_trace->endpos[1] = trace_start[1];
|
||||
trace_trace->endpos[2] = trace_start[2]; //yeah, we do mean this - startsolid
|
||||
// if (IS_NAN(trace->endpos[2]))
|
||||
// Con_Printf("Nanny\n");
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
node = nodel + nodenum;
|
||||
|
||||
if (node->x1lower+trace_hull->clip_mins[0] <= trace_start[0] && node->x1upper+trace_hull->clip_maxs[0] >= trace_start[0])
|
||||
if (node->y1lower+trace_hull->clip_mins[1] <= trace_start[1] && node->y1upper+trace_hull->clip_maxs[1] >= trace_start[1])
|
||||
Doom_ClipToInitialNode(node->node1);
|
||||
|
||||
if (node->x2lower+trace_hull->clip_mins[0] <= trace_start[0] && node->x2upper+trace_hull->clip_maxs[0] >= trace_start[0])
|
||||
if (node->y2lower+trace_hull->clip_mins[1] <= trace_start[1] && node->y2upper+trace_hull->clip_maxs[1] >= trace_start[1])
|
||||
Doom_ClipToInitialNode(node->node2);
|
||||
|
||||
}
|
||||
|
||||
void Doom_ClipToInitialSectors(void)
|
||||
{
|
||||
Doom_ClipToInitialNode(nodec-1);
|
||||
/*
|
||||
ddoomnode_t *node;
|
||||
plane_t *plane;
|
||||
int num;
|
||||
int seg;
|
||||
float d;
|
||||
num = nodec-1;
|
||||
while (1)
|
||||
{
|
||||
if (num & NODE_IS_SSECTOR)
|
||||
{
|
||||
num -= NODE_IS_SSECTOR;
|
||||
for (seg = ssectorsl[num].first; seg < ssectorsl[num].first + ssectorsl[num].segcount; seg++)
|
||||
if (segsl[seg].linedef != 0xffff)
|
||||
break;
|
||||
|
||||
return sidedefsm[linedefsl[segsl[seg].linedef].sidedef[segsl[seg].direction]].sector;
|
||||
}
|
||||
|
||||
node = nodel + num;
|
||||
plane = nodeplanes + num;
|
||||
|
||||
// if (plane->type < 3)
|
||||
// d = p[plane->type] - plane->dist;
|
||||
// else
|
||||
d = DotProduct (plane->normal, p) - plane->dist;
|
||||
if (d < 0)
|
||||
num = node->node2;
|
||||
else
|
||||
num = node->node1;
|
||||
}
|
||||
|
||||
return num;
|
||||
*/
|
||||
}
|
||||
qboolean Doom_RecursiveHullCheck (hull_t *hull, int num, float p1f, float p2f, vec3_t start, vec3_t end, trace_t *trace)
|
||||
{
|
||||
int bmi;
|
||||
ispoint = !hull->clip_mins[0] && !hull->clip_mins[1] && !hull->clip_maxs[0] && !hull->clip_maxs[1];
|
||||
|
||||
trace->allsolid = trace->startsolid = false;
|
||||
trace->contents = FTECONTENTS_EMPTY;
|
||||
|
||||
|
||||
trace_trace = trace;
|
||||
trace_hull = hull;
|
||||
trace_end[0] = end[0];
|
||||
trace_end[1] = end[1];
|
||||
trace_end[2] = end[2];
|
||||
trace_start[0] = start[0];
|
||||
trace_start[1] = start[1];
|
||||
trace_start[2] = start[2];
|
||||
|
||||
|
||||
|
||||
Doom_ClipToInitialNode(nodec-1);
|
||||
|
||||
if (trace->allsolid) //started outside gamespace
|
||||
return trace->fraction==1;
|
||||
|
||||
//clip to the blockmap.
|
||||
//blockmap is 128*128
|
||||
bmi = ((int)start[0] - blockmapl->xorg)/128 + (((int)start[1] - blockmapl->yorg)/128)*blockmapl->columns;
|
||||
if (end[0] - start[0] > 0)
|
||||
{
|
||||
if (end[1] - start[1] > 0)
|
||||
{
|
||||
ClipToBlockMap(hull, bmi, start, end, trace);
|
||||
}
|
||||
else
|
||||
{
|
||||
trace->endpos[0] = start[0];
|
||||
trace->endpos[1] = start[1];
|
||||
trace->endpos[2] = start[2];
|
||||
|
||||
trace->fraction = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
trace->endpos[0] = start[0];
|
||||
trace->endpos[1] = start[1];
|
||||
trace->endpos[2] = start[2];
|
||||
|
||||
trace->fraction = 0;
|
||||
}
|
||||
|
||||
return trace->fraction==1;
|
||||
}
|
||||
|
||||
#else
|
||||
qboolean Doom_RecursiveHullCheck (hull_t *hull, int num, float p1f, float p2f, vec3_t start, vec3_t p2, trace_t *trace)
|
||||
{
|
||||
#define TRACESTEP 16
|
||||
|
@ -1643,8 +1901,11 @@ qboolean Doom_RecursiveHullCheck (hull_t *hull, int num, float p1f, float p2f, v
|
|||
int j;
|
||||
|
||||
float clipfrac;
|
||||
qboolean ispoint;
|
||||
#define DIST_EPSILON (0.03125)
|
||||
|
||||
ispoint = !hull->clip_mins[0] && !hull->clip_mins[1] && !hull->clip_maxs[0] && !hull->clip_maxs[1];
|
||||
|
||||
// Con_Printf("%i\n", sec1);
|
||||
|
||||
if (start[2] < sectorm[sec1].floorheight-hull->clip_mins[2]) //whoops, started outside... ?
|
||||
|
@ -1715,7 +1976,7 @@ qboolean Doom_RecursiveHullCheck (hull_t *hull, int num, float p1f, float p2f, v
|
|||
|
||||
lp = lineplanes + *linedefs;
|
||||
|
||||
if (1)
|
||||
if (!ispoint)
|
||||
{ //figure out how far to move the plane out by
|
||||
for (j=0 ; j<2 ; j++)
|
||||
{
|
||||
|
@ -2014,6 +2275,7 @@ qboolean Doom_RecursiveHullCheck (hull_t *hull, int num, float p1f, float p2f, v
|
|||
//Con_Printf("total = %f\n", trace->fraction);
|
||||
return trace->fraction==1;
|
||||
}
|
||||
#endif
|
||||
|
||||
void Doom_SetHullFuncs(hull_t *hull)
|
||||
{
|
||||
|
|
|
@ -198,7 +198,8 @@ typedef struct shader_s {
|
|||
SHADER_ENTITY_MERGABLE = 1 << 9,
|
||||
SHADER_VIDEOMAP = 1 << 10,
|
||||
SHADER_DEPTHWRITE = 1 << 11,
|
||||
SHADER_AGEN_PORTAL = 1 << 12
|
||||
SHADER_AGEN_PORTAL = 1 << 12,
|
||||
SHADER_BLEND = 1 << 13 //blend or alphatest (not 100% opaque).
|
||||
} flags;
|
||||
|
||||
shaderpass_t passes[SHADER_PASS_MAX];
|
||||
|
|
Loading…
Reference in a new issue