Added profiling code, added schematics, drawflat, and stuff
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@654 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
parent
d87030a911
commit
9db52890b2
15 changed files with 795 additions and 184 deletions
|
@ -1,4 +1,5 @@
|
||||||
#include "quakedef.h"
|
#include "quakedef.h"
|
||||||
|
#ifdef RGLQUAKE
|
||||||
#include "glquake.h"
|
#include "glquake.h"
|
||||||
#include "shader.h"
|
#include "shader.h"
|
||||||
#include "hash.h"
|
#include "hash.h"
|
||||||
|
@ -1001,12 +1002,23 @@ void GL_DrawAliasMesh_Sketch (mesh_t *mesh, int texnum)
|
||||||
glVertex3f( v1[0]+0.5*(rand()/(float)RAND_MAX-0.5),
|
glVertex3f( v1[0]+0.5*(rand()/(float)RAND_MAX-0.5),
|
||||||
v1[1]+0.5*(rand()/(float)RAND_MAX-0.5),
|
v1[1]+0.5*(rand()/(float)RAND_MAX-0.5),
|
||||||
v1[2]+0.5*(rand()/(float)RAND_MAX-0.5));
|
v1[2]+0.5*(rand()/(float)RAND_MAX-0.5));
|
||||||
|
glVertex3f( v2[0]+0.5*(rand()/(float)RAND_MAX-0.5),
|
||||||
|
v2[1]+0.5*(rand()/(float)RAND_MAX-0.5),
|
||||||
|
v2[2]+0.5*(rand()/(float)RAND_MAX-0.5));
|
||||||
|
|
||||||
glVertex3f( v2[0]+0.5*(rand()/(float)RAND_MAX-0.5),
|
glVertex3f( v2[0]+0.5*(rand()/(float)RAND_MAX-0.5),
|
||||||
v2[1]+0.5*(rand()/(float)RAND_MAX-0.5),
|
v2[1]+0.5*(rand()/(float)RAND_MAX-0.5),
|
||||||
v2[2]+0.5*(rand()/(float)RAND_MAX-0.5));
|
v2[2]+0.5*(rand()/(float)RAND_MAX-0.5));
|
||||||
glVertex3f( v3[0]+0.5*(rand()/(float)RAND_MAX-0.5),
|
glVertex3f( v3[0]+0.5*(rand()/(float)RAND_MAX-0.5),
|
||||||
v3[1]+0.5*(rand()/(float)RAND_MAX-0.5),
|
v3[1]+0.5*(rand()/(float)RAND_MAX-0.5),
|
||||||
v3[2]+0.5*(rand()/(float)RAND_MAX-0.5));
|
v3[2]+0.5*(rand()/(float)RAND_MAX-0.5));
|
||||||
|
|
||||||
|
glVertex3f( v3[0]+0.5*(rand()/(float)RAND_MAX-0.5),
|
||||||
|
v3[1]+0.5*(rand()/(float)RAND_MAX-0.5),
|
||||||
|
v3[2]+0.5*(rand()/(float)RAND_MAX-0.5));
|
||||||
|
glVertex3f( v1[0]+0.5*(rand()/(float)RAND_MAX-0.5),
|
||||||
|
v1[1]+0.5*(rand()/(float)RAND_MAX-0.5),
|
||||||
|
v1[2]+0.5*(rand()/(float)RAND_MAX-0.5));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
glEnd();
|
glEnd();
|
||||||
|
@ -3183,3 +3195,4 @@ void GLMod_LoadZymoticModel(model_t *mod, void *buffer)
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
|
@ -72,7 +72,7 @@ void GL_TexEnv( GLenum mode )
|
||||||
{
|
{
|
||||||
if ( mode != gl_state.texenvmode[gl_state.currenttmu] )
|
if ( mode != gl_state.texenvmode[gl_state.currenttmu] )
|
||||||
{
|
{
|
||||||
qglTexEnvf( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, mode );
|
qglTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, mode );
|
||||||
gl_state.texenvmode[gl_state.currenttmu] = mode;
|
gl_state.texenvmode[gl_state.currenttmu] = mode;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,6 +22,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
// vid buffer
|
// vid buffer
|
||||||
|
|
||||||
#include "quakedef.h"
|
#include "quakedef.h"
|
||||||
|
#ifdef RGLQUAKE
|
||||||
#include "glquake.h"
|
#include "glquake.h"
|
||||||
#include "shader.h"
|
#include "shader.h"
|
||||||
|
|
||||||
|
@ -1095,7 +1096,7 @@ void GLDraw_Character (int x, int y, unsigned int num)
|
||||||
if (y <= -8)
|
if (y <= -8)
|
||||||
return; // totally off screen
|
return; // totally off screen
|
||||||
|
|
||||||
|
#ifndef Q3SHADERS
|
||||||
num &= 255;
|
num &= 255;
|
||||||
|
|
||||||
row = num>>4;
|
row = num>>4;
|
||||||
|
@ -1104,7 +1105,6 @@ void GLDraw_Character (int x, int y, unsigned int num)
|
||||||
frow = row*0.0625;
|
frow = row*0.0625;
|
||||||
fcol = col*0.0625;
|
fcol = col*0.0625;
|
||||||
size = 0.0625;
|
size = 0.0625;
|
||||||
|
|
||||||
draw_mesh_xyz[0][0] = x;
|
draw_mesh_xyz[0][0] = x;
|
||||||
draw_mesh_xyz[0][1] = y;
|
draw_mesh_xyz[0][1] = y;
|
||||||
draw_mesh_st[0][0] = fcol;
|
draw_mesh_st[0][0] = fcol;
|
||||||
|
@ -1125,7 +1125,6 @@ void GLDraw_Character (int x, int y, unsigned int num)
|
||||||
draw_mesh_st[3][0] = fcol;
|
draw_mesh_st[3][0] = fcol;
|
||||||
draw_mesh_st[3][1] = frow+size;
|
draw_mesh_st[3][1] = frow+size;
|
||||||
|
|
||||||
#ifndef Q3SHADERS
|
|
||||||
if (num&CON_2NDCHARSETTEXT)
|
if (num&CON_2NDCHARSETTEXT)
|
||||||
GL_DrawMesh(&draw_mesh, NULL, char_tex2, 0);
|
GL_DrawMesh(&draw_mesh, NULL, char_tex2, 0);
|
||||||
else
|
else
|
||||||
|
@ -3348,3 +3347,4 @@ int GL_LoadPicTexture (qpic_t *pic)
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************/
|
/****************************************/
|
||||||
|
#endif
|
|
@ -23,6 +23,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
// on the same machine.
|
// on the same machine.
|
||||||
|
|
||||||
#include "quakedef.h"
|
#include "quakedef.h"
|
||||||
|
#ifdef RGLQUAKE
|
||||||
#include "glquake.h"
|
#include "glquake.h"
|
||||||
|
|
||||||
extern int gl_bumpmappingpossible;
|
extern int gl_bumpmappingpossible;
|
||||||
|
@ -3239,3 +3240,4 @@ void GLMod_Print (void)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
|
@ -222,7 +222,7 @@ typedef struct mfog_s
|
||||||
typedef struct msurface_s
|
typedef struct msurface_s
|
||||||
{
|
{
|
||||||
int visframe; // should be drawn when node is crossed
|
int visframe; // should be drawn when node is crossed
|
||||||
int shadowframe;
|
int shadowframe, lightframe;
|
||||||
|
|
||||||
mplane_t *plane;
|
mplane_t *plane;
|
||||||
int flags;
|
int flags;
|
||||||
|
|
|
@ -20,6 +20,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
// gl_ngraph.c
|
// gl_ngraph.c
|
||||||
|
|
||||||
#include "quakedef.h"
|
#include "quakedef.h"
|
||||||
|
#ifdef RGLQUAKE
|
||||||
#include "glquake.h"
|
#include "glquake.h"
|
||||||
|
|
||||||
extern qbyte *draw_chars; // 8*8 graphic characters
|
extern qbyte *draw_chars; // 8*8 graphic characters
|
||||||
|
@ -141,3 +142,4 @@ void GLR_NetGraph (void)
|
||||||
glEnd ();
|
glEnd ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
|
@ -23,6 +23,11 @@ extern cvar_t r_shadow_realtime_world;
|
||||||
extern int detailtexture;
|
extern int detailtexture;
|
||||||
//end header confict
|
//end header confict
|
||||||
|
|
||||||
|
extern cvar_t gl_schematics;
|
||||||
|
extern cvar_t r_drawflat;
|
||||||
|
extern cvar_t r_wallcolour;
|
||||||
|
extern cvar_t r_floorcolour;
|
||||||
|
|
||||||
extern lightmapinfo_t **lightmap;
|
extern lightmapinfo_t **lightmap;
|
||||||
|
|
||||||
extern model_t *currentmodel;
|
extern model_t *currentmodel;
|
||||||
|
@ -35,6 +40,7 @@ int r_shadowframe;
|
||||||
int shadowsurfcount;
|
int shadowsurfcount;
|
||||||
int shadowedgecount;
|
int shadowedgecount;
|
||||||
int shadowlightfaces;
|
int shadowlightfaces;
|
||||||
|
int shadowemittedeges;
|
||||||
|
|
||||||
int ppl_specular_fragmentprogram;
|
int ppl_specular_fragmentprogram;
|
||||||
|
|
||||||
|
@ -183,7 +189,7 @@ static void PPL_GenerateArraysBlinnCubeMap(msurface_t *surf)
|
||||||
varray_v[varray_vc].stw[1] = v[4];
|
varray_v[varray_vc].stw[1] = v[4];
|
||||||
varray_v[varray_vc].stl[0] = v[5];
|
varray_v[varray_vc].stl[0] = v[5];
|
||||||
varray_v[varray_vc].stl[1] = v[6];
|
varray_v[varray_vc].stl[1] = v[6];
|
||||||
VectorSubtract(cl.simorg[0], v, eye);
|
VectorSubtract(r_refdef.vieworg, v, eye);
|
||||||
VectorNormalize(eye);
|
VectorNormalize(eye);
|
||||||
VectorAdd(eye, (v+7), halfdir);
|
VectorAdd(eye, (v+7), halfdir);
|
||||||
// VectorCopy(eye, halfdir);
|
// VectorCopy(eye, halfdir);
|
||||||
|
@ -227,7 +233,7 @@ static void PPL_GenerateArraysBlinnCubeMap(msurface_t *surf)
|
||||||
varray_v[varray_vc].stw[1] = v[4];
|
varray_v[varray_vc].stw[1] = v[4];
|
||||||
varray_v[varray_vc].stl[0] = v[5];
|
varray_v[varray_vc].stl[0] = v[5];
|
||||||
varray_v[varray_vc].stl[1] = v[6];
|
varray_v[varray_vc].stl[1] = v[6];
|
||||||
VectorSubtract(cl.simorg[0], v, eye);
|
VectorSubtract(r_refdef.vieworg, v, eye);
|
||||||
VectorNormalize(eye);
|
VectorNormalize(eye);
|
||||||
VectorAdd(eye, (v+7), halfdir);
|
VectorAdd(eye, (v+7), halfdir);
|
||||||
varray_v[varray_vc].ncm[0] = DotProduct(surf->texinfo->vecs[0], halfdir);
|
varray_v[varray_vc].ncm[0] = DotProduct(surf->texinfo->vecs[0], halfdir);
|
||||||
|
@ -796,6 +802,28 @@ void PPL_LoadSpecularFragmentProgram(void)
|
||||||
//(diffuse*n.l + gloss*(n.h)^8)*lm
|
//(diffuse*n.l + gloss*(n.h)^8)*lm
|
||||||
//note excessive temp reuse...
|
//note excessive temp reuse...
|
||||||
"!!ARBfp1.0\n"
|
"!!ARBfp1.0\n"
|
||||||
|
#if 1
|
||||||
|
"PARAM c0 = {2, 1, 8, 0};\n"
|
||||||
|
"TEMP R0;\n"
|
||||||
|
"TEMP R1;\n"
|
||||||
|
"TEMP R2;\n"
|
||||||
|
"TEX R0.xyz, fragment.texcoord[0], texture[1], 2D;\n"
|
||||||
|
"TEX R1.xyz, fragment.texcoord[1], texture[3], 2D;\n"
|
||||||
|
"MAD R0.xyz, R0, c0.x, -c0.y;\n"
|
||||||
|
"MAD R1.xyz, R1, c0.x, -c0.y;\n"
|
||||||
|
"DP3 R0.w, R0, R1;\n"
|
||||||
|
"DP3 R1.x, fragment.texcoord[2], fragment.texcoord[2];\n"
|
||||||
|
"RSQ R1.x, R1.x;\n"
|
||||||
|
"MUL R1.xyz, R1.x, fragment.texcoord[2];\n"
|
||||||
|
"DP3 R0.x, R1, R0;\n"
|
||||||
|
"POW R0.x, R0.x, c0.z;\n"
|
||||||
|
"TEX R1.xyz, fragment.texcoord[0], texture[4], 2D;\n"
|
||||||
|
"TEX R2.xyz, fragment.texcoord[0], texture[0], 2D;\n"
|
||||||
|
"MUL R0.xyz, R0.x, R1;\n"
|
||||||
|
"MAD R0.xyz, R2, R0.w, R0;\n"
|
||||||
|
"TEX R1.xyz, fragment.texcoord[1], texture[2], 2D;\n"
|
||||||
|
"MUL result.color.xyz, R0, R1;\n"
|
||||||
|
#else
|
||||||
|
|
||||||
"OUTPUT ocol = result.color;\n"
|
"OUTPUT ocol = result.color;\n"
|
||||||
|
|
||||||
|
@ -845,6 +873,7 @@ void PPL_LoadSpecularFragmentProgram(void)
|
||||||
//multiply by inverse lm and output the result.
|
//multiply by inverse lm and output the result.
|
||||||
// "SUB lm.rgb, 1, lm;\n"
|
// "SUB lm.rgb, 1, lm;\n"
|
||||||
"MUL_SAT ocol.rgb, diff, lm;\n"
|
"MUL_SAT ocol.rgb, diff, lm;\n"
|
||||||
|
#endif
|
||||||
//that's all folks.
|
//that's all folks.
|
||||||
"END";
|
"END";
|
||||||
/*
|
/*
|
||||||
|
@ -1058,8 +1087,6 @@ static void PPL_BaseChain_Specular_8TMU(msurface_t *first, texture_t *tex)
|
||||||
|
|
||||||
// float fourhalffloats[4] = {0.5,0.5,0.5,0.5};
|
// float fourhalffloats[4] = {0.5,0.5,0.5,0.5};
|
||||||
|
|
||||||
glColorMask(1,1,1,1);
|
|
||||||
|
|
||||||
PPL_EnableVertexArrays();
|
PPL_EnableVertexArrays();
|
||||||
|
|
||||||
/* lets do things in parallel.
|
/* lets do things in parallel.
|
||||||
|
@ -1266,6 +1293,209 @@ rgb * lightmap -> rgb
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
//single textured.
|
||||||
|
static void PPL_BaseChain_Flat(msurface_t *first)
|
||||||
|
{
|
||||||
|
static vec_t wallcolour[4] = {0,0,0,1};
|
||||||
|
static vec_t floorcolour[4] = {0,0,0,1};
|
||||||
|
msurface_t *s;
|
||||||
|
int iswall = -1;
|
||||||
|
int vi=-1;
|
||||||
|
glRect_t *theRect;
|
||||||
|
|
||||||
|
if (r_wallcolour.modified)
|
||||||
|
{
|
||||||
|
char *s;
|
||||||
|
r_wallcolour.modified = false;
|
||||||
|
|
||||||
|
s = COM_Parse(r_wallcolour.string);
|
||||||
|
wallcolour[0] = atof(com_token);
|
||||||
|
s = COM_Parse(s);
|
||||||
|
wallcolour[1] = atof(com_token);
|
||||||
|
s = COM_Parse(s);
|
||||||
|
wallcolour[2] = atof(com_token);
|
||||||
|
}
|
||||||
|
if (r_floorcolour.modified)
|
||||||
|
{
|
||||||
|
char *s;
|
||||||
|
r_floorcolour.modified = false;
|
||||||
|
|
||||||
|
s = COM_Parse(r_floorcolour.string);
|
||||||
|
floorcolour[0] = atof(com_token);
|
||||||
|
s = COM_Parse(s);
|
||||||
|
floorcolour[1] = atof(com_token);
|
||||||
|
s = COM_Parse(s);
|
||||||
|
floorcolour[2] = atof(com_token);
|
||||||
|
}
|
||||||
|
|
||||||
|
PPL_EnableVertexArrays();
|
||||||
|
glEnable(GL_TEXTURE_2D);
|
||||||
|
GL_TexEnv(GL_MODULATE);
|
||||||
|
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||||
|
glTexCoordPointer(2, GL_FLOAT, sizeof(surfvertexarray_t), varray_v->stl);
|
||||||
|
|
||||||
|
for (s = first; s ; s=s->texturechain)
|
||||||
|
{
|
||||||
|
if (vi != s->lightmaptexturenum)
|
||||||
|
{
|
||||||
|
PPL_FlushArrays();
|
||||||
|
vi = s->lightmaptexturenum;
|
||||||
|
|
||||||
|
GL_Bind(lightmap_textures[vi] );
|
||||||
|
if (lightmap[vi]->modified)
|
||||||
|
{
|
||||||
|
lightmap[vi]->modified = false;
|
||||||
|
theRect = &lightmap[vi]->rectchange;
|
||||||
|
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, theRect->t,
|
||||||
|
LMBLOCK_WIDTH, theRect->h, gl_lightmap_format, GL_UNSIGNED_BYTE,
|
||||||
|
lightmap[vi]->lightmaps+(theRect->t) *LMBLOCK_WIDTH*lightmap_bytes);
|
||||||
|
theRect->l = LMBLOCK_WIDTH;
|
||||||
|
theRect->t = LMBLOCK_HEIGHT;
|
||||||
|
theRect->h = 0;
|
||||||
|
theRect->w = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((s->plane->normal[2]*s->plane->normal[2]) <= 0.5*0.5)
|
||||||
|
{
|
||||||
|
if (iswall != 0)
|
||||||
|
{
|
||||||
|
PPL_FlushArrays();
|
||||||
|
iswall=0;
|
||||||
|
glColor4fv(wallcolour);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (iswall != 1)
|
||||||
|
{
|
||||||
|
PPL_FlushArrays();
|
||||||
|
iswall=1;
|
||||||
|
glColor4fv(floorcolour);
|
||||||
|
}
|
||||||
|
PPL_GenerateArrays(s);
|
||||||
|
}
|
||||||
|
PPL_FlushArrays();
|
||||||
|
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||||
|
glColor3f(1,1,1);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void PPL_BaseChain_NPR_Sketch(msurface_t *first)
|
||||||
|
{
|
||||||
|
static vec_t wallcolour[4] = {0,0,0,1};
|
||||||
|
static vec_t floorcolour[4] = {0,0,0,1};
|
||||||
|
msurface_t *s;
|
||||||
|
int iswall = -1;
|
||||||
|
int vi=-10;
|
||||||
|
int i;
|
||||||
|
glRect_t *theRect;
|
||||||
|
|
||||||
|
static int textures[10];
|
||||||
|
|
||||||
|
GL_SelectTexture(GL_TEXTURE0_ARB);
|
||||||
|
if (r_drawflat.modified) //reload textures
|
||||||
|
{
|
||||||
|
r_drawflat.modified = false;
|
||||||
|
for (i = 0; i < sizeof(textures)/sizeof(textures[0]); i++)
|
||||||
|
{
|
||||||
|
textures[i] = Mod_LoadHiResTexture(va("sketch%i", i+1), true, false, false);
|
||||||
|
if (!textures[i])
|
||||||
|
{
|
||||||
|
int data[128*128];
|
||||||
|
FILE *file;
|
||||||
|
unsigned char *f;
|
||||||
|
int p;
|
||||||
|
|
||||||
|
file = fopen(va("textures/tex%i_3_128_128.raw", i+1), "rb");
|
||||||
|
|
||||||
|
if (file)
|
||||||
|
{
|
||||||
|
f = Hunk_TempAlloc(128*128*3);
|
||||||
|
if (fread(f, 128*3, 128, file) == 128)
|
||||||
|
{
|
||||||
|
for (p = 0; p < 128*128; p++)
|
||||||
|
data[p] = LittleLong(f[p*3] + (f[p*3+1]<<8) + (f[p*3+2]<<16) + (255<<24));
|
||||||
|
textures[i] = GL_LoadTexture32 (va("textures/tex%i_3_128_128.raw", i+1), 128, 128, data, true, false);
|
||||||
|
}
|
||||||
|
fclose(file);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
PPL_EnableVertexArrays();
|
||||||
|
|
||||||
|
//draw the surface properly
|
||||||
|
glEnable(GL_TEXTURE_2D);
|
||||||
|
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||||
|
glTexCoordPointer(2, GL_FLOAT, sizeof(surfvertexarray_t), varray_v->stw);
|
||||||
|
|
||||||
|
GL_TexEnv(GL_MODULATE);
|
||||||
|
|
||||||
|
GL_SelectTexture(GL_TEXTURE1_ARB);
|
||||||
|
GL_TexEnv(GL_MODULATE);
|
||||||
|
glEnable(GL_TEXTURE_2D);
|
||||||
|
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||||
|
glTexCoordPointer(2, GL_FLOAT, sizeof(surfvertexarray_t), varray_v->stl);
|
||||||
|
|
||||||
|
glColor3f(1,1,1);
|
||||||
|
for (s = first; s ; s=s->texturechain)
|
||||||
|
{
|
||||||
|
if (vi != s->lightmaptexturenum)
|
||||||
|
{
|
||||||
|
PPL_FlushArrays();
|
||||||
|
vi = s->lightmaptexturenum;
|
||||||
|
|
||||||
|
GL_MBind(GL_TEXTURE0_ARB, textures[rand()%10]);
|
||||||
|
|
||||||
|
if (vi < 0)
|
||||||
|
GL_MBind(GL_TEXTURE1_ARB, 0 );
|
||||||
|
else
|
||||||
|
{
|
||||||
|
GL_MBind(GL_TEXTURE1_ARB, lightmap_textures[vi] );
|
||||||
|
if (lightmap[vi]->modified)
|
||||||
|
{
|
||||||
|
lightmap[vi]->modified = false;
|
||||||
|
theRect = &lightmap[vi]->rectchange;
|
||||||
|
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, theRect->t,
|
||||||
|
LMBLOCK_WIDTH, theRect->h, gl_lightmap_format, GL_UNSIGNED_BYTE,
|
||||||
|
lightmap[vi]->lightmaps+(theRect->t) *LMBLOCK_WIDTH*lightmap_bytes);
|
||||||
|
theRect->l = LMBLOCK_WIDTH;
|
||||||
|
theRect->t = LMBLOCK_HEIGHT;
|
||||||
|
theRect->h = 0;
|
||||||
|
theRect->w = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
PPL_GenerateArrays(s);
|
||||||
|
}
|
||||||
|
PPL_FlushArrays();
|
||||||
|
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||||
|
glDisable(GL_TEXTURE_2D);
|
||||||
|
|
||||||
|
GL_SelectTexture(GL_TEXTURE0_ARB);
|
||||||
|
glDisable(GL_TEXTURE_2D);
|
||||||
|
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||||
|
|
||||||
|
glDisableClientState(GL_VERTEX_ARRAY);
|
||||||
|
glDisableClientState(GL_COLOR_ARRAY);
|
||||||
|
|
||||||
|
//draw some extra lines around the edge for added coolness.
|
||||||
|
glColor3f(0,0,0);
|
||||||
|
for (vi = 0; vi < 5; vi++)
|
||||||
|
{
|
||||||
|
for (s = first; s ; s=s->texturechain)
|
||||||
|
{
|
||||||
|
glBegin(GL_LINE_LOOP);
|
||||||
|
for (i=s->polys->numverts-1; i>=0; i--)
|
||||||
|
glVertex3f( s->polys->verts[i][0]+5*(rand()/(float)RAND_MAX-0.5),
|
||||||
|
s->polys->verts[i][1]+5*(rand()/(float)RAND_MAX-0.5),
|
||||||
|
s->polys->verts[i][2]+5*(rand()/(float)RAND_MAX-0.5));
|
||||||
|
glEnd();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
glEnable(GL_TEXTURE_2D);
|
||||||
|
}
|
||||||
|
|
||||||
static void PPL_BaseTextureChain(msurface_t *first)
|
static void PPL_BaseTextureChain(msurface_t *first)
|
||||||
{
|
{
|
||||||
extern cvar_t gl_bump, gl_specular;
|
extern cvar_t gl_bump, gl_specular;
|
||||||
|
@ -1369,7 +1599,14 @@ static void PPL_BaseTextureChain(msurface_t *first)
|
||||||
|
|
||||||
t = GLR_TextureAnimation (first->texinfo->texture);
|
t = GLR_TextureAnimation (first->texinfo->texture);
|
||||||
|
|
||||||
if (first->flags & SURF_DRAWTURB)
|
if (r_drawflat.value == 2)
|
||||||
|
{
|
||||||
|
if (gl_mtexarbable < 2) //shiesh!.
|
||||||
|
PPL_BaseChain_NoBump_1TMU(first, t);
|
||||||
|
else
|
||||||
|
PPL_BaseChain_NPR_Sketch(first);
|
||||||
|
}
|
||||||
|
else if (first->flags & SURF_DRAWTURB)
|
||||||
{
|
{
|
||||||
GL_DisableMultitexture();
|
GL_DisableMultitexture();
|
||||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||||
|
@ -1387,6 +1624,10 @@ static void PPL_BaseTextureChain(msurface_t *first)
|
||||||
{
|
{
|
||||||
PPL_BaseChain_NoLightmap(first, t);
|
PPL_BaseChain_NoLightmap(first, t);
|
||||||
}*/
|
}*/
|
||||||
|
else if (r_drawflat.value)
|
||||||
|
{
|
||||||
|
PPL_BaseChain_Flat(first); //who cares about texture? :/
|
||||||
|
}
|
||||||
else if (gl_mtexarbable < 2)
|
else if (gl_mtexarbable < 2)
|
||||||
{ //multitexture isn't supported.
|
{ //multitexture isn't supported.
|
||||||
PPL_BaseChain_NoBump_1TMU(first, t);
|
PPL_BaseChain_NoBump_1TMU(first, t);
|
||||||
|
@ -1660,7 +1901,7 @@ void PPL_BaseEntTextures(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef PPL
|
#ifdef PPL
|
||||||
static void PPL_GenerateLightArrays(msurface_t *surf, vec3_t relativelightorigin, dlight_t *light)
|
static void PPL_GenerateLightArrays(msurface_t *surf, vec3_t relativelightorigin, dlight_t *light, vec3_t colour)
|
||||||
{
|
{
|
||||||
glpoly_t *p;
|
glpoly_t *p;
|
||||||
int vi;
|
int vi;
|
||||||
|
@ -1694,9 +1935,9 @@ static void PPL_GenerateLightArrays(msurface_t *surf, vec3_t relativelightorigin
|
||||||
(lightdir[1])*(lightdir[1]) +
|
(lightdir[1])*(lightdir[1]) +
|
||||||
(lightdir[2])*(lightdir[2])) / light->radius);
|
(lightdir[2])*(lightdir[2])) / light->radius);
|
||||||
VectorNormalize(lightdir);
|
VectorNormalize(lightdir);
|
||||||
varray_v[varray_vc].stl[0] = light->color[0]*dist;
|
varray_v[varray_vc].stl[0] = colour[0]*dist;
|
||||||
varray_v[varray_vc].stl[1] = light->color[1]*dist;
|
varray_v[varray_vc].stl[1] = colour[1]*dist;
|
||||||
varray_v[varray_vc].stl[2] = light->color[2]*dist;
|
varray_v[varray_vc].stl[2] = colour[2]*dist;
|
||||||
varray_v[varray_vc].ncm[0] = DotProduct(lightdir, surf->texinfo->vecs[0]);
|
varray_v[varray_vc].ncm[0] = DotProduct(lightdir, surf->texinfo->vecs[0]);
|
||||||
varray_v[varray_vc].ncm[1] = -DotProduct(lightdir, surf->texinfo->vecs[1]);
|
varray_v[varray_vc].ncm[1] = -DotProduct(lightdir, surf->texinfo->vecs[1]);
|
||||||
varray_v[varray_vc].ncm[2] = DotProduct(lightdir, surf->normal);
|
varray_v[varray_vc].ncm[2] = DotProduct(lightdir, surf->normal);
|
||||||
|
@ -1716,9 +1957,9 @@ static void PPL_GenerateLightArrays(msurface_t *surf, vec3_t relativelightorigin
|
||||||
(lightdir[1])*(lightdir[1]) +
|
(lightdir[1])*(lightdir[1]) +
|
||||||
(lightdir[2])*(lightdir[2])) / light->radius);
|
(lightdir[2])*(lightdir[2])) / light->radius);
|
||||||
VectorNormalize(lightdir);
|
VectorNormalize(lightdir);
|
||||||
varray_v[varray_vc].stl[0] = light->color[0]*dist;
|
varray_v[varray_vc].stl[0] = colour[0]*dist;
|
||||||
varray_v[varray_vc].stl[1] = light->color[1]*dist;
|
varray_v[varray_vc].stl[1] = colour[1]*dist;
|
||||||
varray_v[varray_vc].stl[2] = light->color[2]*dist;
|
varray_v[varray_vc].stl[2] = colour[2]*dist;
|
||||||
varray_v[varray_vc].ncm[0] = DotProduct(lightdir, surf->texinfo->vecs[0]);
|
varray_v[varray_vc].ncm[0] = DotProduct(lightdir, surf->texinfo->vecs[0]);
|
||||||
varray_v[varray_vc].ncm[1] = -DotProduct(lightdir, surf->texinfo->vecs[1]);
|
varray_v[varray_vc].ncm[1] = -DotProduct(lightdir, surf->texinfo->vecs[1]);
|
||||||
varray_v[varray_vc].ncm[2] = DotProduct(lightdir, surf->normal);
|
varray_v[varray_vc].ncm[2] = DotProduct(lightdir, surf->normal);
|
||||||
|
@ -1743,9 +1984,9 @@ static void PPL_GenerateLightArrays(msurface_t *surf, vec3_t relativelightorigin
|
||||||
(lightdir[1])*(lightdir[1]) +
|
(lightdir[1])*(lightdir[1]) +
|
||||||
(lightdir[2])*(lightdir[2])) / light->radius);
|
(lightdir[2])*(lightdir[2])) / light->radius);
|
||||||
VectorNormalize(lightdir);
|
VectorNormalize(lightdir);
|
||||||
varray_v[varray_vc].stl[0] = light->color[0]*dist;
|
varray_v[varray_vc].stl[0] = colour[0]*dist;
|
||||||
varray_v[varray_vc].stl[1] = light->color[1]*dist;
|
varray_v[varray_vc].stl[1] = colour[1]*dist;
|
||||||
varray_v[varray_vc].stl[2] = light->color[2]*dist;
|
varray_v[varray_vc].stl[2] = colour[2]*dist;
|
||||||
varray_v[varray_vc].ncm[0] = DotProduct(lightdir, surf->texinfo->vecs[0]);
|
varray_v[varray_vc].ncm[0] = DotProduct(lightdir, surf->texinfo->vecs[0]);
|
||||||
varray_v[varray_vc].ncm[1] = -DotProduct(lightdir, surf->texinfo->vecs[1]);
|
varray_v[varray_vc].ncm[1] = -DotProduct(lightdir, surf->texinfo->vecs[1]);
|
||||||
varray_v[varray_vc].ncm[2] = DotProduct(lightdir, surf->normal);
|
varray_v[varray_vc].ncm[2] = DotProduct(lightdir, surf->normal);
|
||||||
|
@ -1754,7 +1995,7 @@ static void PPL_GenerateLightArrays(msurface_t *surf, vec3_t relativelightorigin
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PPL_LightTextures(model_t *model, vec3_t modelorigin, dlight_t *light)
|
void PPL_LightTextures(model_t *model, vec3_t modelorigin, dlight_t *light, vec3_t colour)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
msurface_t *s;
|
msurface_t *s;
|
||||||
|
@ -1866,7 +2107,7 @@ void PPL_LightTextures(model_t *model, vec3_t modelorigin, dlight_t *light)
|
||||||
if (DotProduct(s->plane->normal, relativelightorigin)-s->plane->dist > lightradius)
|
if (DotProduct(s->plane->normal, relativelightorigin)-s->plane->dist > lightradius)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
PPL_GenerateLightArrays(s, relativelightorigin, light);
|
PPL_GenerateLightArrays(s, relativelightorigin, light, colour);
|
||||||
}
|
}
|
||||||
PPL_FlushArrays();
|
PPL_FlushArrays();
|
||||||
}
|
}
|
||||||
|
@ -1896,7 +2137,7 @@ void PPL_LightTextures(model_t *model, vec3_t modelorigin, dlight_t *light)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void PPL_LightBModelTextures(entity_t *e, dlight_t *light)
|
void PPL_LightBModelTextures(entity_t *e, dlight_t *light, vec3_t colour)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
model_t *model = e->model;
|
model_t *model = e->model;
|
||||||
|
@ -1910,6 +2151,8 @@ void PPL_LightBModelTextures(entity_t *e, dlight_t *light)
|
||||||
R_RotateForEntity(e);
|
R_RotateForEntity(e);
|
||||||
glColor4f(1, 1, 1, 1);
|
glColor4f(1, 1, 1, 1);
|
||||||
|
|
||||||
|
PPL_EnableVertexArrays();
|
||||||
|
|
||||||
|
|
||||||
VectorSubtract(light->origin, e->origin, relativelightorigin);
|
VectorSubtract(light->origin, e->origin, relativelightorigin);
|
||||||
glShadeModel(GL_SMOOTH);
|
glShadeModel(GL_SMOOTH);
|
||||||
|
@ -1969,13 +2212,13 @@ void PPL_LightBModelTextures(entity_t *e, dlight_t *light)
|
||||||
|
|
||||||
GL_TexEnv(GL_MODULATE);
|
GL_TexEnv(GL_MODULATE);
|
||||||
glDisable(GL_TEXTURE_2D);
|
glDisable(GL_TEXTURE_2D);
|
||||||
qglActiveTextureARB(GL_TEXTURE1_ARB);
|
GL_SelectTexture(GL_TEXTURE1_ARB);
|
||||||
GL_TexEnv(GL_MODULATE);
|
GL_TexEnv(GL_MODULATE);
|
||||||
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
|
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||||
glDisable(GL_TEXTURE_CUBE_MAP_ARB);
|
glDisable(GL_TEXTURE_CUBE_MAP_ARB);
|
||||||
qglActiveTextureARB(GL_TEXTURE0_ARB);
|
GL_SelectTexture(GL_TEXTURE0_ARB);
|
||||||
|
|
||||||
|
|
||||||
qglClientActiveTextureARB(GL_TEXTURE0_ARB);
|
|
||||||
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
|
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||||
glTexCoordPointer(2, GL_FLOAT, sizeof(surfvertexarray_t), varray_v->stw);
|
glTexCoordPointer(2, GL_FLOAT, sizeof(surfvertexarray_t), varray_v->stw);
|
||||||
}
|
}
|
||||||
|
@ -2002,7 +2245,7 @@ void PPL_LightBModelTextures(entity_t *e, dlight_t *light)
|
||||||
if (DotProduct(s->plane->normal, relativelightorigin)-s->plane->dist > lightradius)
|
if (DotProduct(s->plane->normal, relativelightorigin)-s->plane->dist > lightradius)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
PPL_GenerateLightArrays(s, relativelightorigin, light);
|
PPL_GenerateLightArrays(s, relativelightorigin, light, colour);
|
||||||
}
|
}
|
||||||
PPL_FlushArrays();
|
PPL_FlushArrays();
|
||||||
}
|
}
|
||||||
|
@ -2020,25 +2263,25 @@ void PPL_LightBModelTextures(entity_t *e, dlight_t *light)
|
||||||
|
|
||||||
GL_TexEnv(GL_MODULATE);
|
GL_TexEnv(GL_MODULATE);
|
||||||
glDisable(GL_TEXTURE_2D);
|
glDisable(GL_TEXTURE_2D);
|
||||||
qglClientActiveTextureARB(GL_TEXTURE1_ARB);
|
|
||||||
|
GL_SelectTexture(GL_TEXTURE1_ARB);
|
||||||
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
|
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||||
qglClientActiveTextureARB(GL_TEXTURE0_ARB);
|
|
||||||
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
|
|
||||||
qglActiveTextureARB(GL_TEXTURE1_ARB);
|
|
||||||
GL_TexEnv(GL_MODULATE);
|
GL_TexEnv(GL_MODULATE);
|
||||||
glDisable(GL_TEXTURE_CUBE_MAP_ARB);
|
glDisable(GL_TEXTURE_CUBE_MAP_ARB);
|
||||||
qglActiveTextureARB(GL_TEXTURE0_ARB);
|
|
||||||
|
GL_SelectTexture(GL_TEXTURE0_ARB);
|
||||||
|
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||||
glDisable(GL_TEXTURE_2D);
|
glDisable(GL_TEXTURE_2D);
|
||||||
|
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
}
|
}
|
||||||
|
|
||||||
//draw the bumps on the models for each light.
|
//draw the bumps on the models for each light.
|
||||||
void PPL_DrawEntLighting(dlight_t *light)
|
void PPL_DrawEntLighting(dlight_t *light, vec3_t colour)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
PPL_LightTextures(cl.worldmodel, r_worldentity.origin, light);
|
PPL_LightTextures(cl.worldmodel, r_worldentity.origin, light, colour);
|
||||||
|
|
||||||
if (!r_drawentities.value)
|
if (!r_drawentities.value)
|
||||||
return;
|
return;
|
||||||
|
@ -2075,11 +2318,11 @@ void PPL_DrawEntLighting(dlight_t *light)
|
||||||
case mod_alias:
|
case mod_alias:
|
||||||
if (!varrayactive)
|
if (!varrayactive)
|
||||||
R_IBrokeTheArrays();
|
R_IBrokeTheArrays();
|
||||||
R_DrawGAliasModelLighting (currententity, light->origin, light->color, light->radius);
|
R_DrawGAliasModelLighting (currententity, light->origin, colour, light->radius);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case mod_brush:
|
case mod_brush:
|
||||||
PPL_LightBModelTextures (currententity, light);
|
PPL_LightBModelTextures (currententity, light, colour);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -2223,6 +2466,162 @@ void PPL_DrawEntFullBrights(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void PPL_SchematicsTextureChain(msurface_t *first)
|
||||||
|
{
|
||||||
|
extern int char_texture;
|
||||||
|
msurface_t *s;
|
||||||
|
int v1, v2;
|
||||||
|
float len;
|
||||||
|
unsigned char str[64];
|
||||||
|
int sl, c;
|
||||||
|
vec3_t dir;
|
||||||
|
vec3_t pos, v;
|
||||||
|
const float size = 0.0625;
|
||||||
|
float frow, fcol;
|
||||||
|
|
||||||
|
|
||||||
|
glEnable(GL_TEXTURE_2D);
|
||||||
|
GL_Bind(char_texture);
|
||||||
|
glEnable(GL_ALPHA_TEST);
|
||||||
|
|
||||||
|
if (qglPolygonOffset)
|
||||||
|
qglPolygonOffset(-1, 0);
|
||||||
|
glEnable(GL_POLYGON_OFFSET_FILL);
|
||||||
|
|
||||||
|
frow = rand()/(float)RAND_MAX;
|
||||||
|
frow=frow/2+0.5;
|
||||||
|
glColor3f(frow, frow, 0);
|
||||||
|
|
||||||
|
glBegin(GL_QUADS);
|
||||||
|
for (s = first; s ; s=s->texturechain)
|
||||||
|
{
|
||||||
|
for (v1 = 0; v1 < s->polys->numverts; v1++)
|
||||||
|
{
|
||||||
|
v2 = v1+1;
|
||||||
|
if (v2 == s->polys->numverts)
|
||||||
|
v2 = 0; //wrapped.
|
||||||
|
VectorSubtract(s->polys->verts[v1], s->polys->verts[v2], dir);
|
||||||
|
len = Length(dir);
|
||||||
|
VectorNormalize(dir);
|
||||||
|
sprintf(str, "%i", (len<1)?1:(int)len);
|
||||||
|
sl = strlen(str);
|
||||||
|
VectorMA(s->polys->verts[v2], len/2 + sl*4, dir, pos);
|
||||||
|
|
||||||
|
for (c = 0; c < sl; c++)
|
||||||
|
{
|
||||||
|
frow = (str[c]>>4)*size;
|
||||||
|
fcol = (str[c]&15)*size;
|
||||||
|
|
||||||
|
glTexCoord2f (fcol, frow + size);
|
||||||
|
glVertex3fv(pos);
|
||||||
|
VectorMA(pos, 8, s->normal, v);
|
||||||
|
glTexCoord2f (fcol, frow);
|
||||||
|
glVertex3fv(v);
|
||||||
|
VectorMA(pos, -8, dir, pos);
|
||||||
|
VectorMA(pos, 8, s->normal, v);
|
||||||
|
glTexCoord2f (fcol + size, frow);
|
||||||
|
glVertex3fv(v);
|
||||||
|
glTexCoord2f (fcol + size, frow + size);
|
||||||
|
glVertex3fv(pos);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
glEnd();
|
||||||
|
|
||||||
|
glDisable(GL_POLYGON_OFFSET_FILL);
|
||||||
|
glEnable(GL_POLYGON_OFFSET_LINE);
|
||||||
|
|
||||||
|
glDisable(GL_TEXTURE_2D);
|
||||||
|
|
||||||
|
glBegin(GL_LINES);
|
||||||
|
for (s = first; s ; s=s->texturechain)
|
||||||
|
{
|
||||||
|
for (v1 = 0; v1 < s->polys->numverts; v1++)
|
||||||
|
{
|
||||||
|
v2 = v1+1;
|
||||||
|
if (v2 == s->polys->numverts)
|
||||||
|
v2 = 0; //wrapped.
|
||||||
|
VectorSubtract(s->polys->verts[v2], s->polys->verts[v1], dir);
|
||||||
|
len = Length(dir);
|
||||||
|
VectorNormalize(dir);
|
||||||
|
sprintf(str, "%i", (len<1)?1:(int)len);
|
||||||
|
sl = strlen(str);
|
||||||
|
|
||||||
|
//left side. (find arrowhead part)
|
||||||
|
VectorMA(s->polys->verts[v1], 4, s->normal, pos);
|
||||||
|
|
||||||
|
VectorMA(pos, 4, dir, v);
|
||||||
|
VectorMA(v, -4, s->normal, v);
|
||||||
|
glVertex3fv(v);
|
||||||
|
glVertex3fv(pos);
|
||||||
|
|
||||||
|
VectorMA(v, 8, s->normal, v);
|
||||||
|
glVertex3fv(v);
|
||||||
|
glVertex3fv(pos);
|
||||||
|
|
||||||
|
glVertex3fv(pos);
|
||||||
|
VectorMA(pos, len/2 - sl*4, dir, pos);
|
||||||
|
glVertex3fv(pos);
|
||||||
|
|
||||||
|
|
||||||
|
VectorMA(s->polys->verts[v2], 4, s->normal, pos);
|
||||||
|
|
||||||
|
VectorMA(pos, 4, dir, v);
|
||||||
|
VectorMA(v, -4, s->normal, v);
|
||||||
|
glVertex3fv(v);
|
||||||
|
glVertex3fv(pos);
|
||||||
|
|
||||||
|
VectorMA(v, 8, s->normal, v);
|
||||||
|
glVertex3fv(v);
|
||||||
|
glVertex3fv(pos);
|
||||||
|
|
||||||
|
glVertex3fv(pos);
|
||||||
|
VectorMA(pos, -(len/2 - sl*4), dir, pos);
|
||||||
|
glVertex3fv(pos);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
glEnd();
|
||||||
|
glDisable(GL_POLYGON_OFFSET_LINE);
|
||||||
|
}
|
||||||
|
|
||||||
|
// :)
|
||||||
|
void PPL_Schematics(void)
|
||||||
|
{
|
||||||
|
int tn;
|
||||||
|
msurface_t *s;
|
||||||
|
texture_t *t;
|
||||||
|
model_t *model;
|
||||||
|
|
||||||
|
glColor3f(1,1,1);
|
||||||
|
|
||||||
|
glDepthMask(0); //don't bother writing depth
|
||||||
|
|
||||||
|
GL_TexEnv(GL_MODULATE);
|
||||||
|
|
||||||
|
glShadeModel(GL_FLAT);
|
||||||
|
|
||||||
|
glEnable(GL_BLEND);
|
||||||
|
glDisable(GL_TEXTURE_2D);
|
||||||
|
|
||||||
|
model = cl.worldmodel;
|
||||||
|
for (tn=0 ; tn<model->numtextures ; tn++)
|
||||||
|
{
|
||||||
|
t = model->textures[tn];
|
||||||
|
if (!t)
|
||||||
|
continue;
|
||||||
|
s = t->texturechain;
|
||||||
|
if (!s)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
PPL_SchematicsTextureChain(s);
|
||||||
|
|
||||||
|
t->texturechain=NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
GL_TexEnv(GL_REPLACE);
|
||||||
|
glDepthMask(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -2353,7 +2752,7 @@ void PPL_RecursiveWorldNode_r (mnode_t *node)
|
||||||
//is the light on the right side?
|
//is the light on the right side?
|
||||||
if (surf->flags & SURF_PLANEBACK)
|
if (surf->flags & SURF_PLANEBACK)
|
||||||
{//inverted normal.
|
{//inverted normal.
|
||||||
if (DotProduct(surf->plane->normal, lightorg)-surf->plane->dist <= -lightradius)
|
if (-DotProduct(surf->plane->normal, lightorg)+surf->plane->dist >= lightradius)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -2361,6 +2760,7 @@ void PPL_RecursiveWorldNode_r (mnode_t *node)
|
||||||
if (DotProduct(surf->plane->normal, lightorg)-surf->plane->dist >= lightradius)
|
if (DotProduct(surf->plane->normal, lightorg)-surf->plane->dist >= lightradius)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* if (fabs(surf->center[0] - lightorg[0]) > lightradius+surf->radius ||
|
/* if (fabs(surf->center[0] - lightorg[0]) > lightradius+surf->radius ||
|
||||||
fabs(surf->center[1] - lightorg[1]) > lightradius+surf->radius ||
|
fabs(surf->center[1] - lightorg[1]) > lightradius+surf->radius ||
|
||||||
fabs(surf->center[2] - lightorg[2]) > lightradius+surf->radius)
|
fabs(surf->center[2] - lightorg[2]) > lightradius+surf->radius)
|
||||||
|
@ -2372,6 +2772,7 @@ void PPL_RecursiveWorldNode_r (mnode_t *node)
|
||||||
for (v = 0; v < surf->numedges; v++)
|
for (v = 0; v < surf->numedges; v++)
|
||||||
{
|
{
|
||||||
int e, delta;
|
int e, delta;
|
||||||
|
shadowemittedeges++;
|
||||||
e = cl.worldmodel->surfedges[surf->firstedge+v];
|
e = cl.worldmodel->surfedges[surf->firstedge+v];
|
||||||
//negative edge means backwards edge.
|
//negative edge means backwards edge.
|
||||||
if (e < 0)
|
if (e < 0)
|
||||||
|
@ -2419,7 +2820,7 @@ void PPL_RecursiveWorldNode_r (mnode_t *node)
|
||||||
glVertexPointer(3, GL_FLOAT, sizeof(GLfloat)*VERTEXSIZE, p->verts[0]);
|
glVertexPointer(3, GL_FLOAT, sizeof(GLfloat)*VERTEXSIZE, p->verts[0]);
|
||||||
glDrawElements(GL_TRIANGLES, (p->numverts-2)*3, GL_UNSIGNED_INT, varray_i_polytotri);
|
glDrawElements(GL_TRIANGLES, (p->numverts-2)*3, GL_UNSIGNED_INT, varray_i_polytotri);
|
||||||
|
|
||||||
//back
|
//back (depth precision doesn't matter)
|
||||||
glBegin(GL_POLYGON);
|
glBegin(GL_POLYGON);
|
||||||
for (v = p->numverts-1; v >=0; v--)
|
for (v = p->numverts-1; v >=0; v--)
|
||||||
{
|
{
|
||||||
|
@ -2523,6 +2924,10 @@ void PPL_RecursiveWorldNodeQ2_r (mnode_t *node)
|
||||||
if (surf->shadowframe != r_shadowframe)
|
if (surf->shadowframe != r_shadowframe)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
if (surf->lightframe == r_shadowframe) //done this one!
|
||||||
|
continue;
|
||||||
|
surf->lightframe = r_shadowframe;
|
||||||
|
|
||||||
// if ((dot < 0) ^ !!(surf->flags & SURF_PLANEBACK))
|
// if ((dot < 0) ^ !!(surf->flags & SURF_PLANEBACK))
|
||||||
// continue; // wrong side
|
// continue; // wrong side
|
||||||
|
|
||||||
|
@ -2935,10 +3340,12 @@ void PPL_DrawBrushModel(dlight_t *dl, entity_t *e)
|
||||||
for (p = surf->polys; p; p=p->next)
|
for (p = surf->polys; p; p=p->next)
|
||||||
{
|
{
|
||||||
//front face
|
//front face
|
||||||
glBegin(GL_POLYGON);
|
glVertexPointer(3, GL_FLOAT, sizeof(p->verts[0]), p->verts[0]);
|
||||||
|
glDrawElements(GL_POLYGON, p->numverts, GL_UNSIGNED_INT, varray_i_forward);
|
||||||
|
/* glBegin(GL_POLYGON);
|
||||||
for (v = 0; v < p->numverts; v++)
|
for (v = 0; v < p->numverts; v++)
|
||||||
glVertex3fv(p->verts[v]);
|
glVertex3fv(p->verts[v]);
|
||||||
glEnd();
|
glEnd();*/
|
||||||
|
|
||||||
for (v = 0; v < p->numverts; v++)
|
for (v = 0; v < p->numverts; v++)
|
||||||
{
|
{
|
||||||
|
@ -3349,6 +3756,7 @@ void PPL_AddLight(dlight_t *dl)
|
||||||
int leaf;
|
int leaf;
|
||||||
qbyte *lvis;
|
qbyte *lvis;
|
||||||
qbyte *vvis;
|
qbyte *vvis;
|
||||||
|
vec3_t colour;
|
||||||
|
|
||||||
qbyte lvisb[MAX_MAP_LEAFS/8];
|
qbyte lvisb[MAX_MAP_LEAFS/8];
|
||||||
qbyte vvisb[MAX_MAP_LEAFS/8];
|
qbyte vvisb[MAX_MAP_LEAFS/8];
|
||||||
|
@ -3364,6 +3772,28 @@ void PPL_AddLight(dlight_t *dl)
|
||||||
maxs[1] = dl->origin[1] + dl->radius;
|
maxs[1] = dl->origin[1] + dl->radius;
|
||||||
maxs[2] = dl->origin[2] + dl->radius;
|
maxs[2] = dl->origin[2] + dl->radius;
|
||||||
|
|
||||||
|
colour[0] = dl->color[0];
|
||||||
|
colour[1] = dl->color[1];
|
||||||
|
colour[2] = dl->color[2];
|
||||||
|
if (dl->style)
|
||||||
|
{
|
||||||
|
if (cl_lightstyle[dl->style-1].colour & 1)
|
||||||
|
colour[0] *= d_lightstylevalue[dl->style-1]/255.0f;
|
||||||
|
else
|
||||||
|
colour[0] = 0;
|
||||||
|
if (cl_lightstyle[dl->style-1].colour & 2)
|
||||||
|
colour[1] *= d_lightstylevalue[dl->style-1]/255.0f;
|
||||||
|
else
|
||||||
|
colour[1] = 0;
|
||||||
|
if (cl_lightstyle[dl->style-1].colour & 4)
|
||||||
|
colour[2] *= d_lightstylevalue[dl->style-1]/255.0f;
|
||||||
|
else
|
||||||
|
colour[2] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (colour[0] < 0.1 && colour[1] < 0.1 && colour[2] < 0.1)
|
||||||
|
return; //just switch these off.
|
||||||
|
|
||||||
if (PPL_ScissorForBox(mins, maxs))
|
if (PPL_ScissorForBox(mins, maxs))
|
||||||
return; //was culled.
|
return; //was culled.
|
||||||
|
|
||||||
|
@ -3530,7 +3960,7 @@ void PPL_AddLight(dlight_t *dl)
|
||||||
lightorg[1] = dl->origin[1]+0.5;
|
lightorg[1] = dl->origin[1]+0.5;
|
||||||
lightorg[2] = dl->origin[2]+0.5;
|
lightorg[2] = dl->origin[2]+0.5;
|
||||||
|
|
||||||
PPL_DrawEntLighting(dl);
|
PPL_DrawEntLighting(dl, colour);
|
||||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||||
glDepthMask(1);
|
glDepthMask(1);
|
||||||
glDepthFunc(gldepthfunc);
|
glDepthFunc(gldepthfunc);
|
||||||
|
@ -3544,8 +3974,11 @@ void PPL_AddLight(dlight_t *dl)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
void GL_CheckTMUIs0(void);
|
||||||
|
|
||||||
void PPL_DrawWorld (void)
|
void PPL_DrawWorld (void)
|
||||||
{
|
{
|
||||||
|
RSpeedLocals();
|
||||||
dlight_t *l;
|
dlight_t *l;
|
||||||
#if 0
|
#if 0
|
||||||
dlight_t *lc, *furthestprev;
|
dlight_t *lc, *furthestprev;
|
||||||
|
@ -3562,19 +3995,28 @@ void PPL_DrawWorld (void)
|
||||||
// if (qglGetError())
|
// if (qglGetError())
|
||||||
// Con_Printf("GL Error before world\n");
|
// Con_Printf("GL Error before world\n");
|
||||||
//glColorMask(0,0,0,0);
|
//glColorMask(0,0,0,0);
|
||||||
|
|
||||||
|
RSpeedRemark();
|
||||||
TRACE(("dbg: calling PPL_BaseTextures\n"));
|
TRACE(("dbg: calling PPL_BaseTextures\n"));
|
||||||
PPL_BaseTextures(cl.worldmodel);
|
PPL_BaseTextures(cl.worldmodel);
|
||||||
|
RSpeedEnd(RSPEED_WORLD);
|
||||||
|
|
||||||
// if (qglGetError())
|
// if (qglGetError())
|
||||||
// Con_Printf("GL Error during base textures\n");
|
// Con_Printf("GL Error during base textures\n");
|
||||||
//glColorMask(1,1,1,1);
|
//glColorMask(1,1,1,1);
|
||||||
|
|
||||||
|
RSpeedRemark();
|
||||||
TRACE(("dbg: calling PPL_BaseEntTextures\n"));
|
TRACE(("dbg: calling PPL_BaseEntTextures\n"));
|
||||||
PPL_BaseEntTextures();
|
PPL_BaseEntTextures();
|
||||||
|
RSpeedEnd(RSPEED_ENTITIES);
|
||||||
|
|
||||||
// CL_NewDlightRGB(1, r_refdef.vieworg[0], r_refdef.vieworg[1]-16, r_refdef.vieworg[2]-24, 128, 1, 1, 1, 1);
|
// CL_NewDlightRGB(1, r_refdef.vieworg[0], r_refdef.vieworg[1]-16, r_refdef.vieworg[2]-24, 128, 1, 1, 1, 1);
|
||||||
|
|
||||||
// if (qglGetError())
|
// if (qglGetError())
|
||||||
// Con_Printf("GL Error on entities\n");
|
// Con_Printf("GL Error on entities\n");
|
||||||
|
|
||||||
#ifdef PPL
|
#ifdef PPL
|
||||||
|
RSpeedRemark();
|
||||||
if (r_shadows.value && glStencilFunc && gl_canstencil)
|
if (r_shadows.value && glStencilFunc && gl_canstencil)
|
||||||
{
|
{
|
||||||
if (cl.worldmodel->fromgame == fg_quake || cl.worldmodel->fromgame == fg_halflife || cl.worldmodel->fromgame == fg_quake2 /*|| cl.worldmodel->fromgame == fg_quake3*/)
|
if (cl.worldmodel->fromgame == fg_quake || cl.worldmodel->fromgame == fg_halflife || cl.worldmodel->fromgame == fg_quake2 /*|| cl.worldmodel->fromgame == fg_quake3*/)
|
||||||
|
@ -3661,21 +4103,37 @@ void PPL_DrawWorld (void)
|
||||||
|
|
||||||
glDisableClientState(GL_COLOR_ARRAY);
|
glDisableClientState(GL_COLOR_ARRAY);
|
||||||
}
|
}
|
||||||
|
RSpeedEnd(RSPEED_STENCILSHADOWS);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// if (qglGetError())
|
// if (qglGetError())
|
||||||
// Con_Printf("GL Error on shadow lighting\n");
|
// Con_Printf("GL Error on shadow lighting\n");
|
||||||
|
|
||||||
|
RSpeedRemark();
|
||||||
|
|
||||||
|
if (gl_schematics.value)
|
||||||
|
PPL_Schematics();
|
||||||
|
|
||||||
TRACE(("dbg: calling PPL_DrawEntFullBrights\n"));
|
TRACE(("dbg: calling PPL_DrawEntFullBrights\n"));
|
||||||
PPL_DrawEntFullBrights();
|
PPL_DrawEntFullBrights();
|
||||||
|
|
||||||
|
RSpeedEnd(RSPEED_FULLBRIGHTS);
|
||||||
|
|
||||||
// if (qglGetError())
|
// if (qglGetError())
|
||||||
// Con_Printf("GL Error on fullbrights/details\n");
|
// Con_Printf("GL Error on fullbrights/details\n");
|
||||||
|
|
||||||
// Con_Printf("%i %i %i\n", shadowsurfcount, shadowedgecount, shadowlightfaces);
|
// Con_Printf("%i %i(%i) %i\n", shadowsurfcount, shadowedgecount, shadowemittedeges, shadowlightfaces);
|
||||||
|
|
||||||
|
RQuantAdd(RQUANT_SHADOWFACES, shadowsurfcount);
|
||||||
|
RQuantAdd(RQUANT_SHADOWEDGES, shadowedgecount);
|
||||||
|
RQuantAdd(RQUANT_LITFACES, shadowlightfaces);
|
||||||
|
|
||||||
shadowsurfcount = 0;
|
shadowsurfcount = 0;
|
||||||
shadowedgecount = 0;
|
shadowedgecount = 0;
|
||||||
shadowlightfaces = 0;
|
shadowlightfaces = 0;
|
||||||
|
shadowemittedeges = 0;
|
||||||
|
|
||||||
|
GL_CheckTMUIs0();
|
||||||
|
|
||||||
R_IBrokeTheArrays();
|
R_IBrokeTheArrays();
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,6 +20,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
// r_light.c
|
// r_light.c
|
||||||
|
|
||||||
#include "quakedef.h"
|
#include "quakedef.h"
|
||||||
|
#ifdef RGLQUAKE
|
||||||
#include "glquake.h"
|
#include "glquake.h"
|
||||||
|
|
||||||
int r_dlightframecount;
|
int r_dlightframecount;
|
||||||
|
@ -906,4 +907,4 @@ void GLQ1BSP_LightPointValues(vec3_t point, vec3_t res_diffuse, vec3_t res_ambie
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
|
@ -20,6 +20,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
// r_main.c
|
// r_main.c
|
||||||
|
|
||||||
#include "quakedef.h"
|
#include "quakedef.h"
|
||||||
|
|
||||||
|
#ifdef RGLQUAKE
|
||||||
#include "glquake.h"
|
#include "glquake.h"
|
||||||
|
|
||||||
void R_RenderBrushPoly (msurface_t *fa);
|
void R_RenderBrushPoly (msurface_t *fa);
|
||||||
|
@ -196,6 +198,14 @@ void R_RotateForEntity (entity_t *e)
|
||||||
|
|
||||||
|
|
||||||
#if 1
|
#if 1
|
||||||
|
#if 0
|
||||||
|
{
|
||||||
|
void Matrix4_Multiply(float *a, float *b, float *out);
|
||||||
|
float new[16];
|
||||||
|
Matrix4_Multiply(m, r_world_matrix, new);
|
||||||
|
glLoadMatrixf(new);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
glMultMatrixf(m);
|
glMultMatrixf(m);
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
@ -809,6 +819,8 @@ void GLR_BrightenScreen (void)
|
||||||
extern float vid_gamma;
|
extern float vid_gamma;
|
||||||
float f;
|
float f;
|
||||||
|
|
||||||
|
RSpeedMark();
|
||||||
|
|
||||||
if (gl_contrast.value <= 1.0)
|
if (gl_contrast.value <= 1.0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -837,6 +849,8 @@ void GLR_BrightenScreen (void)
|
||||||
glEnable (GL_TEXTURE_2D);
|
glEnable (GL_TEXTURE_2D);
|
||||||
glDisable (GL_BLEND);
|
glDisable (GL_BLEND);
|
||||||
glColor3f(1, 1, 1);
|
glColor3f(1, 1, 1);
|
||||||
|
|
||||||
|
RSpeedEnd(RSPEED_PALETTEFLASHES);
|
||||||
}
|
}
|
||||||
|
|
||||||
int SignbitsForPlane (mplane_t *out)
|
int SignbitsForPlane (mplane_t *out)
|
||||||
|
@ -1582,9 +1596,15 @@ void GLR_RenderView (void)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if (gl_finish.value)
|
||||||
|
{
|
||||||
|
RSpeedMark();
|
||||||
|
glFinish ();
|
||||||
|
RSpeedEnd(RSPEED_FINISH);
|
||||||
|
}
|
||||||
|
|
||||||
if (r_speeds.value)
|
if (r_speeds.value)
|
||||||
{
|
{
|
||||||
glFinish ();
|
|
||||||
time1 = Sys_DoubleTime ();
|
time1 = Sys_DoubleTime ();
|
||||||
c_brush_polys = 0;
|
c_brush_polys = 0;
|
||||||
c_alias_polys = 0;
|
c_alias_polys = 0;
|
||||||
|
@ -1592,9 +1612,6 @@ void GLR_RenderView (void)
|
||||||
|
|
||||||
mirror = false;
|
mirror = false;
|
||||||
|
|
||||||
if (gl_finish.value)
|
|
||||||
glFinish ();
|
|
||||||
|
|
||||||
R_Clear ();
|
R_Clear ();
|
||||||
/*
|
/*
|
||||||
if (r_viewleaf)// && r_viewleaf->contents != CONTENTS_EMPTY)
|
if (r_viewleaf)// && r_viewleaf->contents != CONTENTS_EMPTY)
|
||||||
|
@ -1668,6 +1685,13 @@ void GLR_RenderView (void)
|
||||||
{
|
{
|
||||||
// glFinish ();
|
// glFinish ();
|
||||||
time2 = Sys_DoubleTime ();
|
time2 = Sys_DoubleTime ();
|
||||||
Con_Printf ("%3i ms %4i wpoly %4i epoly\n", (int)((time2-time1)*1000), c_brush_polys, c_alias_polys);
|
|
||||||
|
RQuantAdd(RQUANT_MSECS, (int)((time2-time1)*1000000));
|
||||||
|
|
||||||
|
RQuantAdd(RQUANT_WPOLYS, c_brush_polys);
|
||||||
|
RQuantAdd(RQUANT_EPOLYS, c_alias_polys);
|
||||||
|
// Con_Printf ("%3i ms %4i wpoly %4i epoly\n", (int)((time2-time1)*1000), c_brush_polys, c_alias_polys);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
|
@ -20,6 +20,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
// r_misc.c
|
// r_misc.c
|
||||||
|
|
||||||
#include "quakedef.h"
|
#include "quakedef.h"
|
||||||
|
#ifdef RGLQUAKE
|
||||||
#include "glquake.h"
|
#include "glquake.h"
|
||||||
#include "gl_draw.h"
|
#include "gl_draw.h"
|
||||||
|
|
||||||
|
@ -1023,4 +1024,4 @@ void D_FlushCaches (void)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
|
@ -20,6 +20,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
// r_surf.c: surface-related refresh code
|
// r_surf.c: surface-related refresh code
|
||||||
|
|
||||||
#include "quakedef.h"
|
#include "quakedef.h"
|
||||||
|
#ifdef RGLQUAKE
|
||||||
#include "glquake.h"
|
#include "glquake.h"
|
||||||
#include "shader.h"
|
#include "shader.h"
|
||||||
#include "renderque.h"
|
#include "renderque.h"
|
||||||
|
@ -1998,7 +1999,10 @@ void R_RenderDynamicLightmaps (msurface_t *fa)
|
||||||
if (fa->dlightframe == r_framecount // dynamic this frame
|
if (fa->dlightframe == r_framecount // dynamic this frame
|
||||||
|| fa->cached_dlight) // dynamic previously
|
|| fa->cached_dlight) // dynamic previously
|
||||||
{
|
{
|
||||||
|
RSpeedLocals();
|
||||||
dynamic:
|
dynamic:
|
||||||
|
RSpeedRemark();
|
||||||
|
|
||||||
lightmap[fa->lightmaptexturenum]->modified = true;
|
lightmap[fa->lightmaptexturenum]->modified = true;
|
||||||
|
|
||||||
smax = (fa->extents[0]>>4)+1;
|
smax = (fa->extents[0]>>4)+1;
|
||||||
|
@ -2047,6 +2051,8 @@ dynamic:
|
||||||
stainbase = lightmap[fa->lightmaptexturenum]->stainmaps;
|
stainbase = lightmap[fa->lightmaptexturenum]->stainmaps;
|
||||||
stainbase += (fa->light_t * LMBLOCK_WIDTH + fa->light_s) * 3;
|
stainbase += (fa->light_t * LMBLOCK_WIDTH + fa->light_s) * 3;
|
||||||
GLR_BuildLightMap (fa, base, luxbase, stainbase);
|
GLR_BuildLightMap (fa, base, luxbase, stainbase);
|
||||||
|
|
||||||
|
RSpeedEnd(RSPEED_DYNAMIC);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3164,6 +3170,7 @@ R_DrawWorld
|
||||||
|
|
||||||
void R_DrawWorld (void)
|
void R_DrawWorld (void)
|
||||||
{
|
{
|
||||||
|
RSpeedLocals();
|
||||||
entity_t ent;
|
entity_t ent;
|
||||||
|
|
||||||
memset (&ent, 0, sizeof(ent));
|
memset (&ent, 0, sizeof(ent));
|
||||||
|
@ -3185,6 +3192,8 @@ void R_DrawWorld (void)
|
||||||
R_ClearSkyBox ();
|
R_ClearSkyBox ();
|
||||||
//#endif
|
//#endif
|
||||||
|
|
||||||
|
RSpeedRemark();
|
||||||
|
|
||||||
#ifdef Q2BSPS
|
#ifdef Q2BSPS
|
||||||
if (ent.model->fromgame == fg_quake2 || ent.model->fromgame == fg_quake3)
|
if (ent.model->fromgame == fg_quake2 || ent.model->fromgame == fg_quake3)
|
||||||
{
|
{
|
||||||
|
@ -3212,6 +3221,8 @@ void R_DrawWorld (void)
|
||||||
#endif
|
#endif
|
||||||
GLR_RecursiveWorldNode (cl.worldmodel->nodes);
|
GLR_RecursiveWorldNode (cl.worldmodel->nodes);
|
||||||
|
|
||||||
|
RSpeedEnd(RSPEED_WORLDNODE);
|
||||||
|
|
||||||
TRACE(("dbg: calling PPL_DrawWorld\n"));
|
TRACE(("dbg: calling PPL_DrawWorld\n"));
|
||||||
// if (r_shadows.value >= 2 && gl_canstencil && gl_mtexable)
|
// if (r_shadows.value >= 2 && gl_canstencil && gl_mtexable)
|
||||||
PPL_DrawWorld();
|
PPL_DrawWorld();
|
||||||
|
@ -3500,6 +3511,7 @@ int GLFillBlock (int texnum, int w, int h, int x, int y)
|
||||||
|
|
||||||
//maybe someone screwed with my lightmap...
|
//maybe someone screwed with my lightmap...
|
||||||
memset(lightmap[i]->lightmaps, 255, LMBLOCK_HEIGHT*LMBLOCK_HEIGHT*3);
|
memset(lightmap[i]->lightmaps, 255, LMBLOCK_HEIGHT*LMBLOCK_HEIGHT*3);
|
||||||
|
if (cl.worldmodel->lightdata)
|
||||||
memcpy(lightmap[i]->lightmaps, cl.worldmodel->lightdata+3*LMBLOCK_HEIGHT*LMBLOCK_HEIGHT*i, LMBLOCK_HEIGHT*LMBLOCK_HEIGHT*3);
|
memcpy(lightmap[i]->lightmaps, cl.worldmodel->lightdata+3*LMBLOCK_HEIGHT*LMBLOCK_HEIGHT*i, LMBLOCK_HEIGHT*LMBLOCK_HEIGHT*3);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -3908,3 +3920,4 @@ void GL_BuildLightmaps (void)
|
||||||
GL_RGB, GL_UNSIGNED_BYTE, lightmap[i]->deluxmaps);
|
GL_RGB, GL_UNSIGNED_BYTE, lightmap[i]->deluxmaps);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
|
@ -21,6 +21,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
// screen.c -- master for refresh, status bar, console, chat, notify, etc
|
// screen.c -- master for refresh, status bar, console, chat, notify, etc
|
||||||
|
|
||||||
#include "quakedef.h"
|
#include "quakedef.h"
|
||||||
|
#ifdef RGLQUAKE
|
||||||
#include "glquake.h"
|
#include "glquake.h"
|
||||||
|
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
@ -44,152 +45,75 @@ extern int scr_chatmode;
|
||||||
extern cvar_t scr_chatmodecvar;
|
extern cvar_t scr_chatmodecvar;
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
==================
|
|
||||||
SCR_UpdateScreen
|
|
||||||
|
|
||||||
This is called every frame, and can also be called explicitly to flush
|
void RSpeedShow(void)
|
||||||
text to the screen.
|
|
||||||
|
|
||||||
WARNING: be very careful calling this from elsewhere, because the refresh
|
|
||||||
needs almost the entire 256k of stack space!
|
|
||||||
==================
|
|
||||||
*/
|
|
||||||
|
|
||||||
void GLSCR_UpdateScreen (void)
|
|
||||||
{
|
{
|
||||||
extern cvar_t gl_2dscale;
|
int i;
|
||||||
static float old2dscale=1;
|
static int samplerspeeds[RSPEED_MAX];
|
||||||
int uimenu;
|
static int samplerquant[RQUANT_MAX];
|
||||||
#ifdef TEXTEDITOR
|
char *RSpNames[RSPEED_MAX];
|
||||||
extern qboolean editormodal, editoractive;
|
char *RQntNames[RQUANT_MAX];
|
||||||
#endif
|
char *s;
|
||||||
if (block_drawing)
|
static int framecount;
|
||||||
|
|
||||||
|
if (!r_speeds.value)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (gl_2dscale.modified)
|
memset(RSpNames, 0, sizeof(RSpNames));
|
||||||
|
RSpNames[RSPEED_TOTALREFRESH] = "Total refresh";
|
||||||
|
RSpNames[RSPEED_CLIENT] = "Protocol and entity setup";
|
||||||
|
RSpNames[RSPEED_WORLDNODE] = "World walking";
|
||||||
|
RSpNames[RSPEED_WORLD] = "World rendering";
|
||||||
|
RSpNames[RSPEED_DYNAMIC] = "Lightmap updates";
|
||||||
|
RSpNames[RSPEED_PARTICLES] = "Particle physics and sorting";
|
||||||
|
RSpNames[RSPEED_PARTICLESDRAW] = "Particle drawing";
|
||||||
|
RSpNames[RSPEED_2D] = "2d elements";
|
||||||
|
RSpNames[RSPEED_SERVER] = "Server";
|
||||||
|
|
||||||
|
RSpNames[RSPEED_PALETTEFLASHES] = "Palette flashes";
|
||||||
|
RSpNames[RSPEED_STENCILSHADOWS] = "Stencil Shadows";
|
||||||
|
|
||||||
|
RSpNames[RSPEED_FULLBRIGHTS] = "World fullbrights";
|
||||||
|
|
||||||
|
RSpNames[RSPEED_FINISH] = "Waiting for card to catch up";
|
||||||
|
|
||||||
|
RQntNames[RQUANT_MSECS] = "Microseconds";
|
||||||
|
RQntNames[RQUANT_EPOLYS] = "Entity Polys";
|
||||||
|
RQntNames[RQUANT_WPOLYS] = "World Polys";
|
||||||
|
RQntNames[RQUANT_SHADOWFACES] = "Shadow Faces";
|
||||||
|
RQntNames[RQUANT_SHADOWEDGES] = "Shadow edges";
|
||||||
|
RQntNames[RQUANT_LITFACES] = "Lit faces";
|
||||||
|
|
||||||
|
for (i = 0; i < RSPEED_MAX; i++)
|
||||||
{
|
{
|
||||||
gl_2dscale.modified=false;
|
s = va("%i %-40s", samplerspeeds[i], RSpNames[i]);
|
||||||
if (gl_2dscale.value < 0) //lower would be wrong
|
Draw_String(vid.width-strlen(s)*8, i*8, s);
|
||||||
Cvar_Set(&gl_2dscale, "0");
|
}
|
||||||
if (gl_2dscale.value > 2) //anything higher is unreadable.
|
for (i = 0; i < RQUANT_MAX; i++)
|
||||||
Cvar_Set(&gl_2dscale, "2");
|
|
||||||
|
|
||||||
old2dscale = gl_2dscale.value;
|
|
||||||
vid.width = vid.conwidth = (glwidth - 320) * gl_2dscale.value + 320;
|
|
||||||
vid.height = vid.conheight = (glheight - 240) * gl_2dscale.value + 240;
|
|
||||||
|
|
||||||
//pretect against too small resolutions (possibly minimising task switches).
|
|
||||||
if (vid.width<320)
|
|
||||||
{
|
{
|
||||||
vid.width=320;
|
s = va("%i %-40s", samplerquant[i], RQntNames[i]);
|
||||||
vid.conwidth=320;
|
Draw_String(vid.width-strlen(s)*8, (i+RSPEED_MAX)*8, s);
|
||||||
}
|
}
|
||||||
if (vid.height<200)
|
|
||||||
|
if (framecount++>=100)
|
||||||
{
|
{
|
||||||
vid.height=200;
|
for (i = 0; i < RSPEED_MAX; i++)
|
||||||
vid.conheight=200;
|
|
||||||
}
|
|
||||||
|
|
||||||
vid.recalc_refdef = true;
|
|
||||||
Con_CheckResize();
|
|
||||||
|
|
||||||
#ifdef PLUGINS
|
|
||||||
Plug_ResChanged();
|
|
||||||
#endif
|
|
||||||
GL_Set2D();
|
|
||||||
}
|
|
||||||
|
|
||||||
vid.numpages = 2 + gl_triplebuffer.value;
|
|
||||||
|
|
||||||
scr_copytop = 0;
|
|
||||||
scr_copyeverything = 0;
|
|
||||||
|
|
||||||
if (scr_disabled_for_loading)
|
|
||||||
{
|
{
|
||||||
/* if (Sys_DoubleTime() - scr_disabled_time > 60 || key_dest != key_game)
|
samplerspeeds[i] = rspeeds[i];
|
||||||
|
rspeeds[i] = 0;
|
||||||
|
}
|
||||||
|
for (i = 0; i < RQUANT_MAX; i++)
|
||||||
{
|
{
|
||||||
scr_disabled_for_loading = false;
|
samplerquant[i] = rquant[i];
|
||||||
Con_Printf ("load failed.\n");
|
rquant[i] = 0;
|
||||||
}
|
}
|
||||||
else
|
framecount=0;
|
||||||
*/ {
|
|
||||||
GL_BeginRendering (&glx, &gly, &glwidth, &glheight);
|
|
||||||
SCR_DrawLoading ();
|
|
||||||
GL_EndRendering ();
|
|
||||||
GL_DoSwap();
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!scr_initialized || !con_initialized)
|
void SCR_DrawTwoDimensional(int uimenu)
|
||||||
return; // not initialized yet
|
|
||||||
|
|
||||||
uimenu = UI_MenuState();
|
|
||||||
|
|
||||||
|
|
||||||
if (oldsbar != cl_sbar.value) {
|
|
||||||
oldsbar = cl_sbar.value;
|
|
||||||
vid.recalc_refdef = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
GL_BeginRendering (&glx, &gly, &glwidth, &glheight);
|
|
||||||
|
|
||||||
#ifdef TEXTEDITOR
|
|
||||||
if (editormodal)
|
|
||||||
{
|
{
|
||||||
Editor_Draw();
|
RSpeedMark();
|
||||||
GLV_UpdatePalette ();
|
|
||||||
#if defined(_WIN32) && defined(RGLQUAKE)
|
|
||||||
Media_RecordFrame();
|
|
||||||
#endif
|
|
||||||
GLR_BrightenScreen();
|
|
||||||
GL_EndRendering ();
|
|
||||||
GL_DoSwap();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
if (Media_ShowFilm())
|
|
||||||
{
|
|
||||||
M_Draw(0);
|
|
||||||
GLV_UpdatePalette ();
|
|
||||||
#if defined(_WIN32) && defined(RGLQUAKE)
|
|
||||||
Media_RecordFrame();
|
|
||||||
#endif
|
|
||||||
GLR_BrightenScreen();
|
|
||||||
GL_EndRendering ();
|
|
||||||
GL_DoSwap();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// determine size of refresh window
|
|
||||||
//
|
|
||||||
if (oldfov != scr_fov.value)
|
|
||||||
{
|
|
||||||
oldfov = scr_fov.value;
|
|
||||||
vid.recalc_refdef = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (scr_chatmode != scr_chatmodecvar.value)
|
|
||||||
vid.recalc_refdef = true;
|
|
||||||
|
|
||||||
if (vid.recalc_refdef || scr_viewsize.modified)
|
|
||||||
SCR_CalcRefdef ();
|
|
||||||
|
|
||||||
//
|
|
||||||
// do 3D refresh drawing, and then update the screen
|
|
||||||
//
|
|
||||||
SCR_SetUpToDrawConsole ();
|
|
||||||
if (cl.worldmodel && uimenu != 1)
|
|
||||||
V_RenderView ();
|
|
||||||
else
|
|
||||||
GL_DoSwap();
|
|
||||||
|
|
||||||
GL_Set2D ();
|
|
||||||
|
|
||||||
GLR_BrightenScreen();
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// draw any areas not covered by the refresh
|
// draw any areas not covered by the refresh
|
||||||
//
|
//
|
||||||
|
@ -253,10 +177,176 @@ void GLSCR_UpdateScreen (void)
|
||||||
SCR_DrawConsole (false);
|
SCR_DrawConsole (false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RSpeedEnd(RSPEED_2D);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
==================
|
||||||
|
SCR_UpdateScreen
|
||||||
|
|
||||||
|
This is called every frame, and can also be called explicitly to flush
|
||||||
|
text to the screen.
|
||||||
|
|
||||||
|
WARNING: be very careful calling this from elsewhere, because the refresh
|
||||||
|
needs almost the entire 256k of stack space!
|
||||||
|
==================
|
||||||
|
*/
|
||||||
|
|
||||||
|
void GLSCR_UpdateScreen (void)
|
||||||
|
{
|
||||||
|
extern cvar_t gl_2dscale;
|
||||||
|
static float old2dscale=1;
|
||||||
|
int uimenu;
|
||||||
|
#ifdef TEXTEDITOR
|
||||||
|
extern qboolean editormodal, editoractive;
|
||||||
|
#endif
|
||||||
|
RSpeedMark();
|
||||||
|
|
||||||
|
if (block_drawing)
|
||||||
|
{
|
||||||
|
RSpeedEnd(RSPEED_TOTALREFRESH);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (gl_2dscale.modified)
|
||||||
|
{
|
||||||
|
gl_2dscale.modified=false;
|
||||||
|
if (gl_2dscale.value < 0) //lower would be wrong
|
||||||
|
Cvar_Set(&gl_2dscale, "0");
|
||||||
|
if (gl_2dscale.value > 2) //anything higher is unreadable.
|
||||||
|
Cvar_Set(&gl_2dscale, "2");
|
||||||
|
|
||||||
|
old2dscale = gl_2dscale.value;
|
||||||
|
vid.width = vid.conwidth = (glwidth - 320) * gl_2dscale.value + 320;
|
||||||
|
vid.height = vid.conheight = (glheight - 240) * gl_2dscale.value + 240;
|
||||||
|
|
||||||
|
//pretect against too small resolutions (possibly minimising task switches).
|
||||||
|
if (vid.width<320)
|
||||||
|
{
|
||||||
|
vid.width=320;
|
||||||
|
vid.conwidth=320;
|
||||||
|
}
|
||||||
|
if (vid.height<200)
|
||||||
|
{
|
||||||
|
vid.height=200;
|
||||||
|
vid.conheight=200;
|
||||||
|
}
|
||||||
|
|
||||||
|
vid.recalc_refdef = true;
|
||||||
|
Con_CheckResize();
|
||||||
|
|
||||||
|
#ifdef PLUGINS
|
||||||
|
Plug_ResChanged();
|
||||||
|
#endif
|
||||||
|
GL_Set2D();
|
||||||
|
}
|
||||||
|
|
||||||
|
vid.numpages = 2 + gl_triplebuffer.value;
|
||||||
|
|
||||||
|
scr_copytop = 0;
|
||||||
|
scr_copyeverything = 0;
|
||||||
|
|
||||||
|
if (scr_disabled_for_loading)
|
||||||
|
{
|
||||||
|
/* if (Sys_DoubleTime() - scr_disabled_time > 60 || key_dest != key_game)
|
||||||
|
{
|
||||||
|
scr_disabled_for_loading = false;
|
||||||
|
Con_Printf ("load failed.\n");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
*/ {
|
||||||
|
GL_BeginRendering (&glx, &gly, &glwidth, &glheight);
|
||||||
|
SCR_DrawLoading ();
|
||||||
|
GL_EndRendering ();
|
||||||
|
GL_DoSwap();
|
||||||
|
RSpeedEnd(RSPEED_TOTALREFRESH);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!scr_initialized || !con_initialized)
|
||||||
|
{
|
||||||
|
RSpeedEnd(RSPEED_TOTALREFRESH);
|
||||||
|
return; // not initialized yet
|
||||||
|
}
|
||||||
|
|
||||||
|
uimenu = UI_MenuState();
|
||||||
|
|
||||||
|
|
||||||
|
if (oldsbar != cl_sbar.value) {
|
||||||
|
oldsbar = cl_sbar.value;
|
||||||
|
vid.recalc_refdef = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
GL_BeginRendering (&glx, &gly, &glwidth, &glheight);
|
||||||
|
|
||||||
|
#ifdef TEXTEDITOR
|
||||||
|
if (editormodal)
|
||||||
|
{
|
||||||
|
Editor_Draw();
|
||||||
GLV_UpdatePalette ();
|
GLV_UpdatePalette ();
|
||||||
#if defined(_WIN32) && defined(RGLQUAKE)
|
#if defined(_WIN32) && defined(RGLQUAKE)
|
||||||
Media_RecordFrame();
|
Media_RecordFrame();
|
||||||
#endif
|
#endif
|
||||||
|
GLR_BrightenScreen();
|
||||||
|
GL_EndRendering ();
|
||||||
|
GL_DoSwap();
|
||||||
|
RSpeedEnd(RSPEED_TOTALREFRESH);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
if (Media_ShowFilm())
|
||||||
|
{
|
||||||
|
M_Draw(0);
|
||||||
|
GLV_UpdatePalette ();
|
||||||
|
#if defined(_WIN32) && defined(RGLQUAKE)
|
||||||
|
Media_RecordFrame();
|
||||||
|
#endif
|
||||||
|
GLR_BrightenScreen();
|
||||||
|
GL_EndRendering ();
|
||||||
|
GL_DoSwap();
|
||||||
|
RSpeedEnd(RSPEED_TOTALREFRESH);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// determine size of refresh window
|
||||||
|
//
|
||||||
|
if (oldfov != scr_fov.value)
|
||||||
|
{
|
||||||
|
oldfov = scr_fov.value;
|
||||||
|
vid.recalc_refdef = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (scr_chatmode != scr_chatmodecvar.value)
|
||||||
|
vid.recalc_refdef = true;
|
||||||
|
|
||||||
|
if (vid.recalc_refdef || scr_viewsize.modified)
|
||||||
|
SCR_CalcRefdef ();
|
||||||
|
|
||||||
|
//
|
||||||
|
// do 3D refresh drawing, and then update the screen
|
||||||
|
//
|
||||||
|
SCR_SetUpToDrawConsole ();
|
||||||
|
if (cl.worldmodel && uimenu != 1)
|
||||||
|
V_RenderView ();
|
||||||
|
else
|
||||||
|
GL_DoSwap();
|
||||||
|
|
||||||
|
GL_Set2D ();
|
||||||
|
|
||||||
|
GLR_BrightenScreen();
|
||||||
|
|
||||||
|
SCR_DrawTwoDimensional(uimenu);
|
||||||
|
|
||||||
|
GLV_UpdatePalette ();
|
||||||
|
#if defined(_WIN32) && defined(RGLQUAKE)
|
||||||
|
Media_RecordFrame();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
RSpeedEnd(RSPEED_TOTALREFRESH);
|
||||||
|
RSpeedShow();
|
||||||
|
|
||||||
GL_EndRendering ();
|
GL_EndRendering ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -286,3 +376,4 @@ char *GLVID_GetRGBInfo(int prepadbytes, int *truewidth, int *trueheight)
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
#include "quakedef.h"
|
#include "quakedef.h"
|
||||||
|
#ifdef RGLQUAKE
|
||||||
#include "glquake.h"
|
#include "glquake.h"
|
||||||
|
|
||||||
//standard 1.1 opengl calls
|
//standard 1.1 opengl calls
|
||||||
|
@ -428,3 +429,4 @@ void GL_Init(void *(*getglfunction) (char *name))
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int d_8to24rgbtable[256];
|
unsigned int d_8to24rgbtable[256];
|
||||||
|
#endif
|
||||||
|
|
|
@ -20,6 +20,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
// gl_vidnt.c -- NT GL vid component
|
// gl_vidnt.c -- NT GL vid component
|
||||||
|
|
||||||
#include "quakedef.h"
|
#include "quakedef.h"
|
||||||
|
#ifdef RGLQUAKE
|
||||||
#include "glquake.h"
|
#include "glquake.h"
|
||||||
#include "winquake.h"
|
#include "winquake.h"
|
||||||
#include "resource.h"
|
#include "resource.h"
|
||||||
|
@ -1391,3 +1392,4 @@ qboolean GLVID_Init (rendererstate_t *info, unsigned char *palette)
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
|
@ -20,6 +20,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
// gl_warp.c -- sky and water polygons
|
// gl_warp.c -- sky and water polygons
|
||||||
|
|
||||||
#include "quakedef.h"
|
#include "quakedef.h"
|
||||||
|
#ifdef RGLQUAKE
|
||||||
#include "glquake.h"
|
#include "glquake.h"
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
|
||||||
|
@ -1023,3 +1024,4 @@ void GLR_InitSky (texture_t *mt)
|
||||||
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue