mirror of
https://github.com/yquake2/yquake2remaster.git
synced 2024-11-26 06:20:48 +00:00
Ersten Teil des Renderers aufgeräumt
This commit is contained in:
parent
3f8d6e2dd7
commit
9f7cd534ff
5 changed files with 36 additions and 339 deletions
|
@ -202,9 +202,7 @@ gltmode_t gl_solid_modes[] = {
|
|||
{"GL_RGB5", GL_RGB5},
|
||||
{"GL_RGB4", GL_RGB4},
|
||||
{"GL_R3_G3_B2", GL_R3_G3_B2},
|
||||
#ifdef GL_RGB2_EXT
|
||||
{"GL_RGB2", GL_RGB2_EXT},
|
||||
#endif
|
||||
};
|
||||
|
||||
#define NUM_GL_SOLID_MODES (sizeof(gl_solid_modes) / sizeof (gltmode_t))
|
||||
|
@ -402,7 +400,6 @@ int Scrap_AllocBlock (int w, int h, int *x, int *y)
|
|||
}
|
||||
|
||||
return -1;
|
||||
// Sys_Error ("Scrap_AllocBlock: full");
|
||||
}
|
||||
|
||||
int scrap_uploads;
|
||||
|
@ -788,9 +785,6 @@ void R_FloodFillSkin( byte *skin, int skinwidth, int skinheight )
|
|||
filledcolor = 0;
|
||||
// attempt to find opaque black
|
||||
for (i = 0; i < 256; ++i)
|
||||
/* if (d_8to24table[i] == (255 << 0)) // alpha 1.0
|
||||
* ENDIAN problem, fix by xvi
|
||||
*/
|
||||
if (LittleLong(d_8to24table[i]) == (255 << 0)) // alpha 1.0
|
||||
{
|
||||
filledcolor = i;
|
||||
|
@ -801,7 +795,6 @@ void R_FloodFillSkin( byte *skin, int skinwidth, int skinheight )
|
|||
// can't fill to filled color or to transparent color (used as visited marker)
|
||||
if ((fillcolor == filledcolor) || (fillcolor == 255))
|
||||
{
|
||||
//printf( "not filling skin from %d to %d\n", fillcolor, filledcolor );
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1042,19 +1035,6 @@ qboolean GL_Upload32 (unsigned *data, int width, int height, qboolean mipmap)
|
|||
comp = samples;
|
||||
}
|
||||
|
||||
#if 0
|
||||
if (mipmap)
|
||||
gluBuild2DMipmaps (GL_TEXTURE_2D, samples, width, height, GL_RGBA, GL_UNSIGNED_BYTE, trans);
|
||||
else if (scaled_width == width && scaled_height == height)
|
||||
qglTexImage2D (GL_TEXTURE_2D, 0, comp, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, trans);
|
||||
else
|
||||
{
|
||||
gluScaleImage (GL_RGBA, width, height, GL_UNSIGNED_BYTE, trans,
|
||||
scaled_width, scaled_height, GL_UNSIGNED_BYTE, scaled);
|
||||
qglTexImage2D (GL_TEXTURE_2D, 0, comp, scaled_width, scaled_height, 0, GL_RGBA, GL_UNSIGNED_BYTE, scaled);
|
||||
}
|
||||
#else
|
||||
|
||||
if (scaled_width == width && scaled_height == height)
|
||||
{
|
||||
if (!mipmap)
|
||||
|
@ -1141,8 +1121,6 @@ qboolean GL_Upload32 (unsigned *data, int width, int height, qboolean mipmap)
|
|||
}
|
||||
}
|
||||
done: ;
|
||||
#endif
|
||||
|
||||
|
||||
if (mipmap)
|
||||
{
|
||||
|
@ -1165,22 +1143,6 @@ GL_Upload8
|
|||
Returns has_alpha
|
||||
===============
|
||||
*/
|
||||
/*
|
||||
static qboolean IsPowerOf2( int value )
|
||||
{
|
||||
int i = 1;
|
||||
|
||||
|
||||
while ( 1 )
|
||||
{
|
||||
if ( value == i )
|
||||
return true;
|
||||
if ( i > value )
|
||||
return false;
|
||||
i <<= 1;
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
qboolean GL_Upload8 (byte *data, int width, int height, qboolean mipmap, qboolean is_sky )
|
||||
{
|
||||
|
@ -1256,11 +1218,6 @@ image_t *GL_LoadPic (char *name, byte *pic, int width, int height, imagetype_t t
|
|||
{
|
||||
image_t *image;
|
||||
int i;
|
||||
#ifdef RETEX
|
||||
miptex_t *mt;
|
||||
int len;
|
||||
char s[128];
|
||||
#endif
|
||||
|
||||
// find a free image_t
|
||||
for (i=0, image=gltextures ; i<numgltextures ; i++,image++)
|
||||
|
@ -1285,23 +1242,6 @@ image_t *GL_LoadPic (char *name, byte *pic, int width, int height, imagetype_t t
|
|||
image->height = height;
|
||||
image->type = type;
|
||||
|
||||
#ifdef RETEX
|
||||
len = strlen(name);
|
||||
strcpy(s,name);
|
||||
|
||||
if (!strcmp(s+len-4, ".tga") || !strcmp(s+len-4, ".jpg") || !strcmp(s+len-4, ".png"))
|
||||
{
|
||||
s[len-3] = 'w'; s[len-2] = 'a'; s[len-1] = 'l';
|
||||
ri.FS_LoadFile (s, (void **)&mt); //load .wal file
|
||||
|
||||
if (mt) {
|
||||
image->width = LittleLong (mt->width);
|
||||
image->height = LittleLong (mt->height);
|
||||
ri.FS_FreeFile ((void *)mt);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (type == it_skin && bits == 8)
|
||||
R_FloodFillSkin(pic, width, height);
|
||||
|
||||
|
|
|
@ -43,14 +43,6 @@ void R_RenderDlight (dlight_t *light)
|
|||
rad = light->intensity * 0.35;
|
||||
|
||||
VectorSubtract (light->origin, r_origin, v);
|
||||
#if 0
|
||||
// FIXME?
|
||||
if (VectorLength (v) < rad)
|
||||
{ // view is inside the dlight
|
||||
V_AddBlend (light->color[0], light->color[1], light->color[2], light->intensity * 0.0003, v_blend);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
qglBegin (GL_TRIANGLE_FAN);
|
||||
qglColor3f (light->color[0]*0.2, light->color[1]*0.2, light->color[2]*0.2);
|
||||
|
@ -139,7 +131,7 @@ void R_MarkLights (dlight_t *light, int bit, mnode_t *node)
|
|||
return;
|
||||
}
|
||||
|
||||
// mark the polygons
|
||||
// mark the polygons
|
||||
surf = r_worldmodel->surfaces + node->firstsurface;
|
||||
for (i=0 ; i<node->numsurfaces ; i++, surf++)
|
||||
{
|
||||
|
@ -206,9 +198,9 @@ int RecursiveLightPoint (mnode_t *node, vec3_t start, vec3_t end)
|
|||
if (node->contents != -1)
|
||||
return -1; // didn't hit anything
|
||||
|
||||
// calculate mid point
|
||||
// calculate mid point
|
||||
|
||||
// FIXME: optimize for axial
|
||||
// FIXME: optimize for axial
|
||||
plane = node->plane;
|
||||
front = DotProduct (start, plane->normal) - plane->dist;
|
||||
back = DotProduct (end, plane->normal) - plane->dist;
|
||||
|
@ -222,7 +214,7 @@ int RecursiveLightPoint (mnode_t *node, vec3_t start, vec3_t end)
|
|||
mid[1] = start[1] + (end[1] - start[1])*frac;
|
||||
mid[2] = start[2] + (end[2] - start[2])*frac;
|
||||
|
||||
// go down front side
|
||||
// go down front side
|
||||
r = RecursiveLightPoint (node->children[side], start, mid);
|
||||
if (r >= 0)
|
||||
return r; // hit something
|
||||
|
@ -230,7 +222,7 @@ int RecursiveLightPoint (mnode_t *node, vec3_t start, vec3_t end)
|
|||
if ( (back < 0) == side )
|
||||
return -1; // didn't hit anuthing
|
||||
|
||||
// check for impact on this node
|
||||
// check for impact on this node
|
||||
VectorCopy (mid, lightspot);
|
||||
lightplane = plane;
|
||||
|
||||
|
@ -286,7 +278,7 @@ int RecursiveLightPoint (mnode_t *node, vec3_t start, vec3_t end)
|
|||
return 1;
|
||||
}
|
||||
|
||||
// go down back side
|
||||
// go down back side
|
||||
return RecursiveLightPoint (node->children[!side], mid, end);
|
||||
}
|
||||
|
||||
|
@ -473,7 +465,7 @@ void R_BuildLightMap (msurface_t *surf, byte *dest, int stride)
|
|||
if (size > (sizeof(s_blocklights)>>4) )
|
||||
ri.Sys_Error (ERR_DROP, "Bad s_blocklights size");
|
||||
|
||||
// set to full bright if no light data
|
||||
// set to full bright if no light data
|
||||
if (!surf->samples)
|
||||
{
|
||||
int maps;
|
||||
|
@ -569,11 +561,11 @@ void R_BuildLightMap (msurface_t *surf, byte *dest, int stride)
|
|||
}
|
||||
}
|
||||
|
||||
// add all the dynamic lights
|
||||
// add all the dynamic lights
|
||||
if (surf->dlightframe == r_framecount)
|
||||
R_AddDynamicLights (surf);
|
||||
|
||||
// put into texture format
|
||||
// put into texture format
|
||||
store:
|
||||
stride -= (smax<<2);
|
||||
bl = s_blocklights;
|
||||
|
|
|
@ -114,9 +114,6 @@ void GL_DrawAliasFrameLerp (dmdl_t *paliashdr, float backlerp)
|
|||
|
||||
order = (int *)((byte *)paliashdr + paliashdr->ofs_glcmds);
|
||||
|
||||
// glTranslatef (frame->translate[0], frame->translate[1], frame->translate[2]);
|
||||
// glScalef (frame->scale[0], frame->scale[1], frame->scale[2]);
|
||||
|
||||
if (currententity->flags & RF_TRANSLUCENT)
|
||||
alpha = currententity->alpha;
|
||||
else
|
||||
|
@ -160,7 +157,6 @@ void GL_DrawAliasFrameLerp (dmdl_t *paliashdr, float backlerp)
|
|||
qglEnableClientState( GL_VERTEX_ARRAY );
|
||||
qglVertexPointer( 3, GL_FLOAT, 16, s_lerped ); // padded for SIMD
|
||||
|
||||
// if ( currententity->flags & ( RF_SHELL_RED | RF_SHELL_GREEN | RF_SHELL_BLUE ) )
|
||||
// PMM - added double damage shell
|
||||
if ( currententity->flags & ( RF_SHELL_RED | RF_SHELL_GREEN | RF_SHELL_BLUE | RF_SHELL_DOUBLE | RF_SHELL_HALF_DAM) )
|
||||
{
|
||||
|
@ -225,10 +221,6 @@ void GL_DrawAliasFrameLerp (dmdl_t *paliashdr, float backlerp)
|
|||
|
||||
order += 3;
|
||||
|
||||
// normals and vertexes come from the frame list
|
||||
// l = shadedots[verts[index_xyz].lightnormalindex];
|
||||
|
||||
// qglColor4f (l* shadelight[0], l*shadelight[1], l*shadelight[2], alpha);
|
||||
qglArrayElement( index_xyz );
|
||||
|
||||
} while (--count);
|
||||
|
@ -290,14 +282,12 @@ void GL_DrawAliasFrameLerp (dmdl_t *paliashdr, float backlerp)
|
|||
}
|
||||
}
|
||||
|
||||
// if ( currententity->flags & ( RF_SHELL_RED | RF_SHELL_GREEN | RF_SHELL_BLUE ) )
|
||||
// PMM - added double damage shell
|
||||
if ( currententity->flags & ( RF_SHELL_RED | RF_SHELL_GREEN | RF_SHELL_BLUE | RF_SHELL_DOUBLE | RF_SHELL_HALF_DAM) )
|
||||
qglEnable( GL_TEXTURE_2D );
|
||||
}
|
||||
|
||||
|
||||
#if 1
|
||||
/*
|
||||
=============
|
||||
GL_DrawAliasShadow
|
||||
|
@ -352,24 +342,14 @@ void GL_DrawAliasShadow (dmdl_t *paliashdr, int posenum)
|
|||
do
|
||||
{
|
||||
// normals and vertexes come from the frame list
|
||||
/*
|
||||
point[0] = verts[order[2]].v[0] * frame->scale[0] + frame->translate[0];
|
||||
point[1] = verts[order[2]].v[1] * frame->scale[1] + frame->translate[1];
|
||||
point[2] = verts[order[2]].v[2] * frame->scale[2] + frame->translate[2];
|
||||
*/
|
||||
|
||||
memcpy( point, s_lerped[order[2]], sizeof( point ) );
|
||||
|
||||
point[0] -= shadevector[0]*(point[2]+lheight);
|
||||
point[1] -= shadevector[1]*(point[2]+lheight);
|
||||
point[2] = height;
|
||||
// height -= 0.001;
|
||||
qglVertex3fv (point);
|
||||
|
||||
order += 3;
|
||||
|
||||
// verts++;
|
||||
|
||||
} while (--count);
|
||||
|
||||
qglEnd ();
|
||||
|
@ -380,8 +360,6 @@ void GL_DrawAliasShadow (dmdl_t *paliashdr, int posenum)
|
|||
qglDisable(GL_STENCIL_TEST);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
** R_CullAliasModel
|
||||
*/
|
||||
|
@ -580,70 +558,6 @@ void R_DrawAliasModel (entity_t *e)
|
|||
if ( currententity->flags & RF_SHELL_BLUE )
|
||||
shadelight[2] = 1.0;
|
||||
}
|
||||
/*
|
||||
// PMM -special case for godmode
|
||||
if ( (currententity->flags & RF_SHELL_RED) &&
|
||||
(currententity->flags & RF_SHELL_BLUE) &&
|
||||
(currententity->flags & RF_SHELL_GREEN) )
|
||||
{
|
||||
for (i=0 ; i<3 ; i++)
|
||||
shadelight[i] = 1.0;
|
||||
}
|
||||
else if ( currententity->flags & ( RF_SHELL_RED | RF_SHELL_BLUE | RF_SHELL_DOUBLE ) )
|
||||
{
|
||||
VectorClear (shadelight);
|
||||
|
||||
if ( currententity->flags & RF_SHELL_RED )
|
||||
{
|
||||
shadelight[0] = 1.0;
|
||||
if (currententity->flags & (RF_SHELL_BLUE|RF_SHELL_DOUBLE) )
|
||||
shadelight[2] = 1.0;
|
||||
}
|
||||
else if ( currententity->flags & RF_SHELL_BLUE )
|
||||
{
|
||||
if ( currententity->flags & RF_SHELL_DOUBLE )
|
||||
{
|
||||
shadelight[1] = 1.0;
|
||||
shadelight[2] = 1.0;
|
||||
}
|
||||
else
|
||||
{
|
||||
shadelight[2] = 1.0;
|
||||
}
|
||||
}
|
||||
else if ( currententity->flags & RF_SHELL_DOUBLE )
|
||||
{
|
||||
shadelight[0] = 0.9;
|
||||
shadelight[1] = 0.7;
|
||||
}
|
||||
}
|
||||
else if ( currententity->flags & ( RF_SHELL_HALF_DAM | RF_SHELL_GREEN ) )
|
||||
{
|
||||
VectorClear (shadelight);
|
||||
// PMM - new colors
|
||||
if ( currententity->flags & RF_SHELL_HALF_DAM )
|
||||
{
|
||||
shadelight[0] = 0.56;
|
||||
shadelight[1] = 0.59;
|
||||
shadelight[2] = 0.45;
|
||||
}
|
||||
if ( currententity->flags & RF_SHELL_GREEN )
|
||||
{
|
||||
shadelight[1] = 1.0;
|
||||
}
|
||||
}
|
||||
}
|
||||
//PMM - ok, now flatten these down to range from 0 to 1.0.
|
||||
// max_shell_val = max(shadelight[0], max(shadelight[1], shadelight[2]));
|
||||
// if (max_shell_val > 0)
|
||||
// {
|
||||
// for (i=0; i<3; i++)
|
||||
// {
|
||||
// shadelight[i] = shadelight[i] / max_shell_val;
|
||||
// }
|
||||
// }
|
||||
// pmm
|
||||
*/
|
||||
else if ( currententity->flags & RF_FULLBRIGHT )
|
||||
{
|
||||
for (i=0 ; i<3 ; i++)
|
||||
|
@ -719,16 +633,16 @@ void R_DrawAliasModel (entity_t *e)
|
|||
}
|
||||
}
|
||||
|
||||
// =================
|
||||
// PGM ir goggles color override
|
||||
// =================
|
||||
// PGM ir goggles color override
|
||||
if ( r_newrefdef.rdflags & RDF_IRGOGGLES && currententity->flags & RF_IR_VISIBLE)
|
||||
{
|
||||
shadelight[0] = 1.0;
|
||||
shadelight[1] = 0.0;
|
||||
shadelight[2] = 0.0;
|
||||
}
|
||||
// PGM
|
||||
// =================
|
||||
// PGM
|
||||
// =================
|
||||
|
||||
shadedots = r_avertexnormal_dots[((int)(currententity->angles[1] * (SHADEDOT_QUANT / 360.0))) & (SHADEDOT_QUANT - 1)];
|
||||
|
||||
|
@ -825,21 +739,6 @@ void R_DrawAliasModel (entity_t *e)
|
|||
|
||||
qglPopMatrix ();
|
||||
|
||||
#if 0
|
||||
qglDisable( GL_CULL_FACE );
|
||||
qglPolygonMode( GL_FRONT_AND_BACK, GL_LINE );
|
||||
qglDisable( GL_TEXTURE_2D );
|
||||
qglBegin( GL_TRIANGLE_STRIP );
|
||||
for ( i = 0; i < 8; i++ )
|
||||
{
|
||||
qglVertex3fv( bbox[i] );
|
||||
}
|
||||
qglEnd();
|
||||
qglEnable( GL_TEXTURE_2D );
|
||||
qglPolygonMode( GL_FRONT_AND_BACK, GL_FILL );
|
||||
qglEnable( GL_CULL_FACE );
|
||||
#endif
|
||||
|
||||
if ( ( currententity->flags & RF_WEAPONMODEL ) && ( r_lefthand->value == 1.0F ) )
|
||||
{
|
||||
qglMatrixMode( GL_PROJECTION );
|
||||
|
@ -856,7 +755,6 @@ void R_DrawAliasModel (entity_t *e)
|
|||
if (currententity->flags & RF_DEPTHHACK)
|
||||
qglDepthRange (gldepthmin, gldepthmax);
|
||||
|
||||
//#if 1
|
||||
if (gl_shadows->value &&
|
||||
!(currententity->flags & (RF_TRANSLUCENT|RF_WEAPONMODEL|RF_NOSHADOW))) {
|
||||
qglPushMatrix ();
|
||||
|
@ -873,7 +771,6 @@ void R_DrawAliasModel (entity_t *e)
|
|||
qglDisable (GL_BLEND);
|
||||
qglPopMatrix ();
|
||||
}
|
||||
//#endif
|
||||
qglColor4f (1,1,1,1);
|
||||
}
|
||||
|
||||
|
|
|
@ -536,8 +536,6 @@ void CalcSurfaceExtents (msurface_t *s)
|
|||
s->texturemins[i] = bmins[i] * 16;
|
||||
s->extents[i] = (bmaxs[i] - bmins[i]) * 16;
|
||||
|
||||
// if ( !(tex->flags & TEX_SPECIAL) && s->extents[i] > 512 /* 256 */ )
|
||||
// ri.Sys_Error (ERR_DROP, "Bad surface extents");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -594,7 +592,7 @@ void Mod_LoadFaces (lump_t *l)
|
|||
|
||||
CalcSurfaceExtents (out);
|
||||
|
||||
// lighting info
|
||||
// lighting info
|
||||
|
||||
for (i=0 ; i<MAXLIGHTMAPS ; i++)
|
||||
out->styles[i] = in->styles[i];
|
||||
|
@ -604,7 +602,7 @@ void Mod_LoadFaces (lump_t *l)
|
|||
else
|
||||
out->samples = loadmodel->lightdata + i;
|
||||
|
||||
// set the drawing flags
|
||||
// set the drawing flags
|
||||
|
||||
if (out->texinfo->flags & SURF_WARP)
|
||||
{
|
||||
|
@ -702,7 +700,6 @@ void Mod_LoadLeafs (lump_t *l)
|
|||
dleaf_t *in;
|
||||
mleaf_t *out;
|
||||
int i, j, count, p;
|
||||
// glpoly_t *poly;
|
||||
|
||||
in = (void *)(mod_base + l->fileofs);
|
||||
if (l->filelen % sizeof(*in))
|
||||
|
@ -730,19 +727,6 @@ void Mod_LoadLeafs (lump_t *l)
|
|||
out->firstmarksurface = loadmodel->marksurfaces +
|
||||
LittleShort(in->firstleafface);
|
||||
out->nummarksurfaces = LittleShort(in->numleaffaces);
|
||||
|
||||
// gl underwater warp
|
||||
#if 0
|
||||
if (out->contents & (CONTENTS_WATER|CONTENTS_SLIME|CONTENTS_LAVA|CONTENTS_THINWATER) )
|
||||
{
|
||||
for (j=0 ; j<out->nummarksurfaces ; j++)
|
||||
{
|
||||
out->firstmarksurface[j]->flags |= SURF_UNDERWATER;
|
||||
for (poly = out->firstmarksurface[j]->polys ; poly ; poly=poly->next)
|
||||
poly->flags |= SURF_UNDERWATER;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -862,14 +846,13 @@ void Mod_LoadBrushModel (model_t *mod, void *buffer)
|
|||
if (i != BSPVERSION)
|
||||
ri.Sys_Error (ERR_DROP, "Mod_LoadBrushModel: %s has wrong version number (%i should be %i)", mod->name, i, BSPVERSION);
|
||||
|
||||
// swap all the lumps
|
||||
// swap all the lumps
|
||||
mod_base = (byte *)header;
|
||||
|
||||
for (i=0 ; i<sizeof(dheader_t)/4 ; i++)
|
||||
((int *)header)[i] = LittleLong ( ((int *)header)[i]);
|
||||
|
||||
// load into heap
|
||||
|
||||
// load into heap
|
||||
Mod_LoadVertexes (&header->lumps[LUMP_VERTEXES]);
|
||||
Mod_LoadEdges (&header->lumps[LUMP_EDGES]);
|
||||
Mod_LoadSurfedges (&header->lumps[LUMP_SURFEDGES]);
|
||||
|
@ -884,9 +867,9 @@ void Mod_LoadBrushModel (model_t *mod, void *buffer)
|
|||
Mod_LoadSubmodels (&header->lumps[LUMP_MODELS]);
|
||||
mod->numframes = 2; // regular and alternate animation
|
||||
|
||||
//
|
||||
// set up the submodels
|
||||
//
|
||||
//
|
||||
// set up the submodels
|
||||
//
|
||||
for (i=0 ; i<mod->numsubmodels ; i++)
|
||||
{
|
||||
model_t *starmod;
|
||||
|
@ -968,9 +951,9 @@ void Mod_LoadAliasModel (model_t *mod, void *buffer)
|
|||
if (pheader->num_frames <= 0)
|
||||
ri.Sys_Error (ERR_DROP, "model %s has no frames", mod->name);
|
||||
|
||||
//
|
||||
// load base s and t vertices (not used in gl version)
|
||||
//
|
||||
//
|
||||
// load base s and t vertices (not used in gl version)
|
||||
//
|
||||
pinst = (dstvert_t *) ((byte *)pinmodel + pheader->ofs_st);
|
||||
poutst = (dstvert_t *) ((byte *)pheader + pheader->ofs_st);
|
||||
|
||||
|
@ -980,9 +963,9 @@ void Mod_LoadAliasModel (model_t *mod, void *buffer)
|
|||
poutst[i].t = LittleShort (pinst[i].t);
|
||||
}
|
||||
|
||||
//
|
||||
// load triangle lists
|
||||
//
|
||||
//
|
||||
// load triangle lists
|
||||
//
|
||||
pintri = (dtriangle_t *) ((byte *)pinmodel + pheader->ofs_tris);
|
||||
pouttri = (dtriangle_t *) ((byte *)pheader + pheader->ofs_tris);
|
||||
|
||||
|
@ -995,9 +978,9 @@ void Mod_LoadAliasModel (model_t *mod, void *buffer)
|
|||
}
|
||||
}
|
||||
|
||||
//
|
||||
// load the frames
|
||||
//
|
||||
//
|
||||
// load the frames
|
||||
//
|
||||
for (i=0 ; i<pheader->num_frames ; i++)
|
||||
{
|
||||
pinframe = (daliasframe_t *) ((byte *)pinmodel
|
||||
|
@ -1153,9 +1136,9 @@ struct model_s *R_RegisterModel (char *name)
|
|||
pheader = (dmdl_t *)mod->extradata;
|
||||
for (i=0 ; i<pheader->num_skins ; i++)
|
||||
mod->skins[i] = GL_FindImage ((char *)pheader + pheader->ofs_skins + i*MAX_SKINNAME, it_skin);
|
||||
//PGM
|
||||
//PGM
|
||||
mod->numframes = pheader->num_frames;
|
||||
//PGM
|
||||
//PGM
|
||||
}
|
||||
else if (mod->type == mod_brush)
|
||||
{
|
||||
|
@ -1221,3 +1204,4 @@ void Mod_FreeAll (void)
|
|||
Mod_Free (&mod_known[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ along with this program; if not, write to the Free Software
|
|||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
*/
|
||||
// r_main.c
|
||||
|
||||
#include "header/local.h"
|
||||
|
||||
void R_Clear (void);
|
||||
|
@ -191,31 +191,12 @@ void R_DrawSpriteModel (entity_t *e)
|
|||
|
||||
// don't even bother culling, because it's just a single
|
||||
// polygon without a surface cache
|
||||
|
||||
psprite = (dsprite_t *)currentmodel->extradata;
|
||||
|
||||
#if 0
|
||||
if (e->frame < 0 || e->frame >= psprite->numframes)
|
||||
{
|
||||
ri.Con_Printf (PRINT_ALL, "no such sprite frame %i\n", e->frame);
|
||||
e->frame = 0;
|
||||
}
|
||||
#endif
|
||||
e->frame %= psprite->numframes;
|
||||
|
||||
frame = &psprite->frames[e->frame];
|
||||
|
||||
#if 0
|
||||
if (psprite->type == SPR_ORIENTED)
|
||||
{ // bullet marks on walls
|
||||
vec3_t v_forward, v_right, v_up;
|
||||
|
||||
AngleVectors (currententity->angles, v_forward, v_right, v_up);
|
||||
up = v_up;
|
||||
right = v_right;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{ // normal sprite
|
||||
up = vup;
|
||||
right = vright;
|
||||
|
@ -567,24 +548,6 @@ void R_SetFrustum (void)
|
|||
{
|
||||
int i;
|
||||
|
||||
#if 0
|
||||
/*
|
||||
** this code is wrong, since it presume a 90 degree FOV both in the
|
||||
** horizontal and vertical plane
|
||||
*/
|
||||
// front side is visible
|
||||
VectorAdd (vpn, vright, frustum[0].normal);
|
||||
VectorSubtract (vpn, vright, frustum[1].normal);
|
||||
VectorAdd (vpn, vup, frustum[2].normal);
|
||||
VectorSubtract (vpn, vup, frustum[3].normal);
|
||||
|
||||
// we theoretically don't need to normalize these vectors, but I do it
|
||||
// anyway so that debugging is a little easier
|
||||
VectorNormalize( frustum[0].normal );
|
||||
VectorNormalize( frustum[1].normal );
|
||||
VectorNormalize( frustum[2].normal );
|
||||
VectorNormalize( frustum[3].normal );
|
||||
#else
|
||||
// rotate VPN right by FOV_X/2 degrees
|
||||
RotatePointAroundVector( frustum[0].normal, vup, vpn, -(90-r_newrefdef.fov_x / 2 ) );
|
||||
// rotate VPN left by FOV_X/2 degrees
|
||||
|
@ -593,7 +556,6 @@ void R_SetFrustum (void)
|
|||
RotatePointAroundVector( frustum[2].normal, vright, vpn, 90-r_newrefdef.fov_y / 2 );
|
||||
// rotate VPN down by FOV_X/2 degrees
|
||||
RotatePointAroundVector( frustum[3].normal, vright, vpn, -( 90 - r_newrefdef.fov_y / 2 ) );
|
||||
#endif
|
||||
|
||||
for (i=0 ; i<4 ; i++)
|
||||
{
|
||||
|
@ -617,12 +579,12 @@ void R_SetupFrame (void)
|
|||
|
||||
r_framecount++;
|
||||
|
||||
// build the transformation matrix for the given view angles
|
||||
// build the transformation matrix for the given view angles
|
||||
VectorCopy (r_newrefdef.vieworg, r_origin);
|
||||
|
||||
AngleVectors (r_newrefdef.viewangles, vpn, vright, vup);
|
||||
|
||||
// current viewcluster
|
||||
// current viewcluster
|
||||
if ( !( r_newrefdef.rdflags & RDF_NOWORLDMODEL ) )
|
||||
{
|
||||
r_oldviewcluster = r_viewcluster;
|
||||
|
@ -720,7 +682,6 @@ void R_SetupGL (void)
|
|||
// set up projection matrix
|
||||
//
|
||||
screenaspect = (float)r_newrefdef.width/r_newrefdef.height;
|
||||
// yfov = 2*atan((float)r_newrefdef.height/r_newrefdef.width)*180/M_PI;
|
||||
qglMatrixMode(GL_PROJECTION);
|
||||
qglLoadIdentity ();
|
||||
MYgluPerspective (r_newrefdef.fov_y, screenaspect, 4, 4096);
|
||||
|
@ -737,9 +698,6 @@ void R_SetupGL (void)
|
|||
qglRotatef (-r_newrefdef.viewangles[1], 0, 0, 1);
|
||||
qglTranslatef (-r_newrefdef.vieworg[0], -r_newrefdef.vieworg[1], -r_newrefdef.vieworg[2]);
|
||||
|
||||
// if ( gl_state.camera_separation != 0 && gl_state.stereo_enabled )
|
||||
// qglTranslatef ( gl_state.camera_separation, 0, 0 );
|
||||
|
||||
qglGetFloatv (GL_MODELVIEW_MATRIX, r_world_matrix);
|
||||
|
||||
//
|
||||
|
@ -885,49 +843,6 @@ void R_SetGL2D (void)
|
|||
qglColor4f (1,1,1,1);
|
||||
}
|
||||
|
||||
#if 0 // Not used.
|
||||
static void GL_DrawColoredStereoLinePair( float r, float g, float b, float y )
|
||||
{
|
||||
qglColor3f( r, g, b );
|
||||
qglVertex2f( 0, y );
|
||||
qglVertex2f( vid.width, y );
|
||||
qglColor3f( 0, 0, 0 );
|
||||
qglVertex2f( 0, y + 1 );
|
||||
qglVertex2f( vid.width, y + 1 );
|
||||
}
|
||||
|
||||
static void GL_DrawStereoPattern( void )
|
||||
{
|
||||
int i;
|
||||
|
||||
if ( !( gl_config.renderer & GL_RENDERER_INTERGRAPH ) )
|
||||
return;
|
||||
|
||||
if ( !gl_state.stereo_enabled )
|
||||
return;
|
||||
|
||||
R_SetGL2D();
|
||||
|
||||
qglDrawBuffer( GL_BACK_LEFT );
|
||||
|
||||
for ( i = 0; i < 20; i++ )
|
||||
{
|
||||
qglBegin( GL_LINES );
|
||||
GL_DrawColoredStereoLinePair( 1, 0, 0, 0 );
|
||||
GL_DrawColoredStereoLinePair( 1, 0, 0, 2 );
|
||||
GL_DrawColoredStereoLinePair( 1, 0, 0, 4 );
|
||||
GL_DrawColoredStereoLinePair( 1, 0, 0, 6 );
|
||||
GL_DrawColoredStereoLinePair( 0, 1, 0, 8 );
|
||||
GL_DrawColoredStereoLinePair( 1, 1, 0, 10);
|
||||
GL_DrawColoredStereoLinePair( 1, 1, 0, 12);
|
||||
GL_DrawColoredStereoLinePair( 0, 1, 0, 14);
|
||||
qglEnd();
|
||||
|
||||
GLimp_EndFrame();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
====================
|
||||
R_SetLightLevel
|
||||
|
@ -1236,10 +1151,6 @@ int R_Init( void *hinstance, void *hWnd )
|
|||
ri.Cvar_Set( "scr_drawall", "0" );
|
||||
}
|
||||
|
||||
#if 0 && defined(__linux__)
|
||||
ri.Cvar_SetValue( "gl_finish", 1 );
|
||||
#endif
|
||||
|
||||
// MCD has buffering issues
|
||||
if ( gl_config.renderer == GL_RENDERER_MCD )
|
||||
{
|
||||
|
@ -1313,26 +1224,6 @@ int R_Init( void *hinstance, void *hWnd )
|
|||
ri.Con_Printf( PRINT_ALL, "...GL_EXT_point_parameters not found\n" );
|
||||
}
|
||||
|
||||
#ifdef __linux__
|
||||
if ( strstr( gl_config.extensions_string, "3DFX_set_global_palette" ))
|
||||
{
|
||||
if ( gl_ext_palettedtexture->value )
|
||||
{
|
||||
ri.Con_Printf( PRINT_ALL, "...using 3DFX_set_global_palette\n" );
|
||||
qgl3DfxSetPaletteEXT = ( void ( APIENTRY * ) (GLuint *) )qwglGetProcAddress( "gl3DfxSetPaletteEXT" );
|
||||
qglColorTableEXT = Fake_glColorTableEXT;
|
||||
}
|
||||
else
|
||||
{
|
||||
ri.Con_Printf( PRINT_ALL, "...ignoring 3DFX_set_global_palette\n" );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ri.Con_Printf( PRINT_ALL, "...3DFX_set_global_palette not found\n" );
|
||||
}
|
||||
#endif
|
||||
|
||||
if ( !qglColorTableEXT &&
|
||||
strstr( gl_config.extensions_string, "GL_EXT_paletted_texture" ) &&
|
||||
strstr( gl_config.extensions_string, "GL_EXT_shared_texture_palette" ) )
|
||||
|
@ -1403,13 +1294,6 @@ int R_Init( void *hinstance, void *hWnd )
|
|||
|
||||
GL_SetDefaultState();
|
||||
|
||||
/*
|
||||
** draw our stereo patterns
|
||||
*/
|
||||
#if 0 // commented out until H3D pays us the money they owe us
|
||||
GL_DrawStereoPattern();
|
||||
#endif
|
||||
|
||||
GL_InitImages ();
|
||||
Mod_Init ();
|
||||
R_InitParticleTexture ();
|
||||
|
@ -1774,5 +1658,5 @@ void Com_Printf (char *fmt, ...)
|
|||
|
||||
ri.Con_Printf (PRINT_ALL, "%s", text);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Reference in a new issue