ref: soft: cleanup dead, commented out code and global variables

This commit is contained in:
Alibek Omarov
2026-03-16 23:34:43 +05:00
parent e76528d929
commit 9a25768617
20 changed files with 514 additions and 1767 deletions

View File

@@ -118,41 +118,8 @@ Cull the beam by bbox
*/
qboolean GAME_EXPORT R_BeamCull( const vec3_t start, const vec3_t end, qboolean pvsOnly )
{
vec3_t mins, maxs;
int i;
// culling is undone in ref_soft
return false;
/*
for( i = 0; i < 3; i++ )
{
if( start[i] < end[i] )
{
mins[i] = start[i];
maxs[i] = end[i];
}
else
{
mins[i] = end[i];
maxs[i] = start[i];
}
// don't let it be zero sized
if( mins[i] == maxs[i] )
maxs[i] += 1.0f;
}
// check bbox
if( gEngfuncs.Mod_BoxVisible( mins, maxs, Mod_GetCurrentVis( )))
{
if( pvsOnly || !R_CullBox( mins, maxs ))
{
// beam is visible
return false;
}
}
// beam is culled
return true;
*/
}
/*

View File

@@ -27,25 +27,19 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
vec3_t r_entorigin; // the currently rendering entity in world
// coordinates
float entity_rotation[3][3];
static float entity_rotation[3][3];
int r_currentbkey;
typedef enum {touchessolid, drawnode, nodrawnode} solidstate_t;
#define MAX_BMODEL_VERTS 1000 // 12K
#define MAX_BMODEL_EDGES 2000 // 24K
static mvertex_t *pbverts;
static bedge_t *pbedges;
static int numbverts, numbedges;
static mvertex_t *pfrontenter, *pfrontexit;
static qboolean makeclippededge;
/*
================
R_ConcatRotations

View File

@@ -62,7 +62,45 @@ static void GAME_EXPORT CL_FillRGBA( int rendermode, float _x, float _y, float _
Draw_Fill( _x, _y, _w, _h );
}
void Mod_UnloadTextures( model_t *mod );
static void Mod_BrushUnloadTextures( model_t *mod )
{
int i;
gEngfuncs.Con_Printf( "Unloading world\n" );
tr.map_unload = true;
for( i = 0; i < mod->numtextures; i++ )
{
texture_t *tx = mod->textures[i];
if( !tx || tx->gl_texturenum == tr.defaultTexture )
continue; // free slot
GL_FreeTexture( tx->gl_texturenum ); // main texture
GL_FreeTexture( tx->fb_texturenum ); // luma texture
}
}
static void Mod_UnloadTextures( model_t *mod )
{
Assert( mod != NULL );
switch( mod->type )
{
case mod_studio:
// Mod_StudioUnloadTextures( mod->cache.data );
break;
case mod_alias:
// Mod_AliasUnloadTextures( mod->cache.data );
break;
case mod_brush:
Mod_BrushUnloadTextures( mod );
break;
case mod_sprite:
Mod_SpriteUnloadTextures( mod->cache.data );
break;
default: gEngfuncs.Host_Error( "%s: unsupported type %d\n", __func__, mod->type );
}
}
static qboolean GAME_EXPORT Mod_ProcessRenderData( model_t *mod, qboolean create, const byte *buf, size_t buffersize )
{
@@ -173,12 +211,10 @@ static int GL_RefGetParm( int parm, int arg )
static void GAME_EXPORT R_GetDetailScaleForTexture( int texture, float *xScale, float *yScale )
{
image_t *glt = R_GetTexture( texture );
// details are not implemented in ref_soft
if( xScale )
*xScale = glt->xscale;
if( yScale )
*yScale = glt->yscale;
if( xScale ) *xScale = 0.0f;
if( yScale ) *yScale = 0.0f;
}
static void GAME_EXPORT R_GetExtraParmsForTexture( int texture, byte *red, byte *green, byte *blue, byte *density )
@@ -231,49 +267,6 @@ static const byte * GAME_EXPORT GL_TextureData( unsigned int texnum )
return NULL;
}
static void Mod_BrushUnloadTextures( model_t *mod )
{
int i;
gEngfuncs.Con_Printf( "Unloading world\n" );
tr.map_unload = true;
for( i = 0; i < mod->numtextures; i++ )
{
texture_t *tx = mod->textures[i];
if( !tx || tx->gl_texturenum == tr.defaultTexture )
continue; // free slot
GL_FreeTexture( tx->gl_texturenum ); // main texture
GL_FreeTexture( tx->fb_texturenum ); // luma texture
}
}
void Mod_UnloadTextures( model_t *mod )
{
int i, j;
Assert( mod != NULL );
switch( mod->type )
{
case mod_studio:
// Mod_StudioUnloadTextures( mod->cache.data );
break;
case mod_alias:
// Mod_AliasUnloadTextures( mod->cache.data );
break;
case mod_brush:
Mod_BrushUnloadTextures( mod );
break;
case mod_sprite:
Mod_SpriteUnloadTextures( mod->cache.data );
break;
default: gEngfuncs.Host_Error( "%s: unsupported type %d\n", __func__, mod->type );
}
}
static void GAME_EXPORT R_ProcessEntData( qboolean allocate, cl_entity_t *entities, unsigned int max_entities )
{
tr.entities = entities;

View File

@@ -380,13 +380,11 @@ static float *R_DecalVertsClip( decal_t *pDecal, msurface_t *surf, int texture,
static void R_DecalVertsLight( float *v, msurface_t *surf, int vertCount )
{
float s, t;
mtexinfo_t *tex;
mextrasurf_t *info = surf->info;
float sample_size;
int j;
sample_size = gEngfuncs.Mod_SampleSizeForFace( surf );
tex = surf->texinfo;
for( j = 0; j < vertCount; j++, v += VERTEXSIZE )
{

View File

@@ -257,17 +257,6 @@ R_DrawStretchRaw
*/
void GAME_EXPORT R_DrawStretchRaw( float x, float y, float w, float h, int cols, int rows, const byte *data, qboolean dirty )
{
byte *raw = NULL;
image_t *tex;
raw = (byte *)data;
// pglDisable( GL_BLEND );
// pglDisable( GL_ALPHA_TEST );
// pglTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE );
tex = R_GetTexture( tr.cinTexture );
GL_Bind( XASH_TEXTURE0, tr.cinTexture );
}
/*
@@ -277,14 +266,6 @@ R_UploadStretchRaw
*/
void GAME_EXPORT R_UploadStretchRaw( int texture, int cols, int rows, int width, int height, const byte *data )
{
byte *raw = NULL;
image_t *tex;
raw = (byte *)data;
tex = R_GetTexture( texture );
GL_Bind( GL_KEEP_UNIT, texture );
tex->width = cols;
tex->height = rows;
}
/*

View File

@@ -39,15 +39,11 @@ int r_currentkey;
int current_iv;
int edge_head_u_shift20, edge_tail_u_shift20;
static int edge_head_u_shift20, edge_tail_u_shift20;
static void (*pdrawfunc)( void );
static void (*pdrawfunc)( void );
edge_t edge_head;
edge_t edge_tail;
edge_t edge_aftertail;
edge_t edge_sentinel;
static edge_t edge_head, edge_tail, edge_aftertail, edge_sentinel;
static float fv;
@@ -766,17 +762,13 @@ D_CalcGradients
*/
static void D_CalcGradients( msurface_t *pface )
{
mplane_t *pplane;
float mipscale;
vec3_t p_temp1;
vec3_t p_saxis, p_taxis;
float t;
pplane = pface->plane;
mipscale = 1.0f / (float)( 1 << miplevel );
if( pface->texinfo->flags & TEX_WORLD_LUXELS )
{
TransformVector( pface->texinfo->vecs[0], p_saxis );

View File

@@ -50,6 +50,7 @@ DebugCallback
For ARB_debug_output
========================
*/
#if GLDEBUG
static void APIENTRY GL_DebugOutput( GLuint source, GLuint type, GLuint id, GLuint severity, GLint length, const GLcharARB *message, GLvoid *userParam )
{
switch( type )
@@ -71,10 +72,9 @@ static void APIENTRY GL_DebugOutput( GLuint source, GLuint type, GLuint id, GLui
break;
}
}
#endif // GLDEBUG
static unsigned short *glbuf;
static int tex;
#define LOAD( x ) p ## x = gEngfuncs.GL_GetProcAddress(#x ); \
gEngfuncs.Con_Printf(#x " : %p\n", p ## x )
@@ -192,28 +192,6 @@ static void *R_Lock_GL1( void )
return glbuf;
}
static void R_Unlock_GL1( void )
{
pglTexImage2D( GL_TEXTURE_2D, 0, GL_RGB, vid.width, vid.height, 0, GL_RGB, GL_UNSIGNED_SHORT_5_6_5, glbuf );
// gEngfuncs.Con_Printf("%d\n",pglGetError());
pglBegin( GL_QUADS );
pglTexCoord2f( 0, 0 );
pglVertex2f( 0, 0 );
pglTexCoord2f( 1, 0 );
pglVertex2f( 1, 0 );
pglTexCoord2f( 1, 1 );
pglVertex2f( 1, 1 );
pglTexCoord2f( 0, 1 );
pglVertex2f( 0, 1 );
pglEnd();
gEngfuncs.GL_SwapBuffers();
}
static void R_Unlock_GLES1( void )
{
pglTexImage2D( GL_TEXTURE_2D, 0, GL_RGB, vid.width, vid.height, 0, GL_RGB, GL_UNSIGNED_SHORT_5_6_5, glbuf );
@@ -222,33 +200,6 @@ static void R_Unlock_GLES1( void )
gEngfuncs.GL_SwapBuffers();
}
static qboolean R_CreateBuffer_GL1( int width, int height, uint *stride, uint *bpp, uint *r, uint *g, uint *b )
{
pglViewport( 0, 0, width, height );
pglMatrixMode( GL_PROJECTION );
pglLoadIdentity();
pglOrtho( 0, 1, 1, 0, -99999, 99999 );
pglMatrixMode( GL_MODELVIEW );
pglLoadIdentity();
pglEnable( GL_TEXTURE_2D );
pglTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST );
pglTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST );
if( glbuf )
Mem_Free( glbuf );
glbuf = Mem_Malloc( r_temppool, width * height * 2 );
*stride = width;
*bpp = 2;
*r = MASK( 5 ) << ( 6 + 5 );
*g = MASK( 6 ) << 5;
*b = MASK( 5 );
return true;
}
static qboolean R_CreateBuffer_GLES1( int width, int height, uint *stride, uint *bpp, uint *r, uint *g, uint *b )
{
float data[] = {
@@ -346,49 +297,14 @@ static void R_Unlock_GLES3( void )
static qboolean R_CreateBuffer_GLES3( int width, int height, uint *stride, uint *bpp, uint *r, uint *g, uint *b )
{
float data[] = {
// quad verts match texcoords
0, 0,
1, 0,
1, 1,
0, 1,
};
GLuint vbo, pbo, fbo, to;
GLuint pbo, fbo, to;
// shitty fbo does not work without texture objects :(
pglGenTextures( 1, &to );
pglBindTexture( GL_TEXTURE_2D, to );
pglViewport( 0, 0, width, height );
/*
pglMatrixMode( GL_PROJECTION );
pglLoadIdentity();
// project 0..1 to screen size
pglOrtho( 0, 1, 1, 0, -99999, 99999 );
pglMatrixMode( GL_MODELVIEW );
pglLoadIdentity();
pglEnable( GL_TEXTURE_2D );
pglTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST );
pglTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST );
if( vbo )
pglDeleteBuffers( 1,&vbo );
if( pbo )
pglDeleteBuffers( 1,&pbo );
*/
// pglGenBuffers( 1,&vbo );
pglGenBuffers( 1, &pbo );
// pglBindBuffer( GL_ARRAY_BUFFER_ARB, vbo );
// pglBufferData( GL_ARRAY_BUFFER_ARB, sizeof(data), data, GL_STATIC_DRAW_ARB );
// pglEnableClientState( GL_VERTEX_ARRAY );
// pglEnableClientState( GL_TEXTURE_COORD_ARRAY );
// pglVertexPointer( 2, GL_FLOAT, 8, 0 );
// pglTexCoordPointer( 2, GL_FLOAT, 8, 0 );
// pglBindBuffer( GL_ARRAY_BUFFER_ARB, 0 );
pglBindBuffer( GL_PIXEL_UNPACK_BUFFER, pbo );
pglBufferData( GL_PIXEL_UNPACK_BUFFER, width * height * 2, 0, GL_STREAM_DRAW_ARB );
@@ -399,9 +315,6 @@ static qboolean R_CreateBuffer_GLES3( int width, int height, uint *stride, uint
pglFramebufferTexture2D( GL_READ_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, to, 0 );
pglBindFramebuffer( GL_DRAW_FRAMEBUFFER, 0 );
// pglColor4f( 1, 1, 1, 1 );
*stride = width;
*bpp = 2;
*r = MASK( 5 ) << ( 6 + 5 );
@@ -411,8 +324,6 @@ static qboolean R_CreateBuffer_GLES3( int width, int height, uint *stride, uint
return true;
}
static int FIRST_BIT( uint mask )
{
uint i;
@@ -502,14 +413,13 @@ static void R_BuildBlendMaps( void )
{
unsigned int r1, g1, b1;
unsigned int r2, g2, b2;
unsigned int i, j;
unsigned int i;
FOR_EACH_COLOR( 1 ) FOR_EACH_COLOR( 2 )
{
unsigned int r, g, b;
unsigned short index1 = r1 << ( 2 + 3 ) | g1 << 2 | b1;
unsigned short index2 = ( r2 << ( 2 + 3 ) | g2 << 2 | b2 ) << 8;
unsigned int a;
r = r1 + r2;
g = g1 + g2;

View File

@@ -42,10 +42,7 @@ GL_Bind
*/
void GAME_EXPORT GL_Bind( int tmu, unsigned int texnum )
{
image_t *image;
image = &r_images[texnum];
// vid.rendermode = kRenderNormal;
image_t *image = &r_images[texnum];
if( vid.rendermode == kRenderNormal )
{
@@ -77,48 +74,6 @@ void GAME_EXPORT GL_Bind( int tmu, unsigned int texnum )
r_affinetridesc.skinheight = image->height;
}
/*
=================
GL_ApplyTextureParams
=================
*/
void GL_ApplyTextureParams( image_t *tex )
{
Assert( tex != NULL );
}
/*
=================
GL_UpdateTextureParams
=================
*/
static void GL_UpdateTextureParams( int iTexture )
{
image_t *tex = &r_images[iTexture];
Assert( tex != NULL );
if( !tex->pixels )
return; // free slot
GL_Bind( XASH_TEXTURE0, iTexture );
}
/*
=================
R_SetTextureParameters
=================
*/
void R_SetTextureParameters( void )
{
int i;
// change all the existing mipmapped texture objects
for( i = 0; i < r_numImages; i++ )
GL_UpdateTextureParams( i );
}
/*
==================
GL_CalcTextureSize
@@ -129,32 +84,6 @@ static size_t GL_CalcTextureSize( int width, int height, int depth )
return width * height * 2;
}
static int GL_CalcMipmapCount( image_t *tex, qboolean haveBuffer )
{
int width, height;
int mipcount;
Assert( tex != NULL );
if( !haveBuffer )
return 1;
// generate mip-levels by user request
if( FBitSet( tex->flags, TF_NOMIPMAP ))
return 1;
// mip-maps can't exceeds 4
for( mipcount = 0; mipcount < 4; mipcount++ )
{
width = Q_max( 1, ( tex->width >> mipcount ));
height = Q_max( 1, ( tex->height >> mipcount ));
if( width == 1 && height == 1 )
break;
}
return mipcount + 1;
}
/*
================
GL_SetTextureDimensions
@@ -186,38 +115,6 @@ static void GL_SetTextureDimensions( image_t *tex, int width, int height, int de
tex->depth = Q_max( 1, depth );
}
/*
===============
GL_SetTextureTarget
===============
*/
static void GL_SetTextureTarget( image_t *tex, rgbdata_t *pic )
{
Assert( pic != NULL );
Assert( tex != NULL );
// correct depth size
pic->depth = Q_max( 1, pic->depth );
tex->numMips = 0; // begin counting
// correct mip count
pic->numMips = Q_max( 1, pic->numMips );
}
/*
===============
GL_SetTextureFormat
===============
*/
static void GL_SetTextureFormat( image_t *tex, pixformat_t format, int channelMask )
{
qboolean haveColor = ( channelMask & IMAGE_HAS_COLOR );
qboolean haveAlpha = ( channelMask & IMAGE_HAS_ALPHA );
Assert( tex != NULL );
// tex->transparent = !!( channelMask & IMAGE_HAS_ALPHA );
}
/*
=================
GL_ResampleTexture
@@ -310,78 +207,6 @@ byte *GL_ResampleTexture( const byte *source, int inWidth, int inHeight, int out
return scaledImage;
}
/*
=================
GL_BoxFilter3x3
box filter 3x3
=================
*/
static void GL_BoxFilter3x3( byte *out, const byte *in, int w, int h, int x, int y )
{
int r = 0, g = 0, b = 0, a = 0;
int count = 0, acount = 0;
int i, j, u, v;
const byte *pixel;
for( i = 0; i < 3; i++ )
{
u = ( i - 1 ) + x;
for( j = 0; j < 3; j++ )
{
v = ( j - 1 ) + y;
if( u >= 0 && u < w && v >= 0 && v < h )
{
pixel = &in[( u + v * w ) * 4];
if( pixel[3] != 0 )
{
r += pixel[0];
g += pixel[1];
b += pixel[2];
a += pixel[3];
acount++;
}
}
}
}
if( acount == 0 )
acount = 1;
out[0] = r / acount;
out[1] = g / acount;
out[2] = b / acount;
// out[3] = (int)( SimpleSpline( ( a / 12.0f ) / 255.0f ) * 255 );
}
/*
=================
GL_ApplyFilter
Apply box-filter to 1-bit alpha
=================
*/
static byte *GL_ApplyFilter( const byte *source, int width, int height )
{
byte *in = (byte *)source;
byte *out = (byte *)source;
int i;
if( ENGINE_GET_PARM( PARM_QUAKE_COMPATIBLE ))
return in;
for( i = 0; source && i < width * height; i++, in += 4 )
{
if( in[0] == 0 && in[1] == 0 && in[2] == 0 && in[3] == 0 )
GL_BoxFilter3x3( in, source, width, height, i % width, i / width );
}
return out;
}
/*
=================
GL_BuildMipMap
@@ -484,12 +309,10 @@ upload texture into video memory
static qboolean GL_UploadTexture( image_t *tex, rgbdata_t *pic )
{
byte *buf, *data;
size_t texsize, size;
size_t texsize;
uint width, height;
uint i, j, numSides;
uint offset = 0;
uint i, j;
qboolean normalMap = false;
const byte *bufend;
int mipCount;
tex->fogParams[0] = pic->fogParams[0];
@@ -497,7 +320,6 @@ static qboolean GL_UploadTexture( image_t *tex, rgbdata_t *pic )
tex->fogParams[2] = pic->fogParams[2];
tex->fogParams[3] = pic->fogParams[3];
GL_SetTextureDimensions( tex, pic->width, pic->height, pic->depth );
GL_SetTextureFormat( tex, pic->type, pic->flags );
// gEngfuncs.Con_Printf("%s %d %d\n", tex->name, tex->width, tex->height );
@@ -509,7 +331,7 @@ static qboolean GL_UploadTexture( image_t *tex, rgbdata_t *pic )
buf = pic->buffer;
mipCount = 4; // GL_CalcMipmapCount( tex, ( buf != NULL ));
mipCount = 4;
// NOTE: only single uncompressed textures can be resamples, no mips, no layers, no sides
if((( pic->width != tex->width ) || ( pic->height != tex->height )))
@@ -517,27 +339,17 @@ static qboolean GL_UploadTexture( image_t *tex, rgbdata_t *pic )
else
data = buf;
// if( !ImageCompressed( pic->type ) && !FBitSet( tex->flags, TF_NOMIPMAP ) && FBitSet( pic->flags, IMAGE_ONEBIT_ALPHA ))
// data = GL_ApplyFilter( data, tex->width, tex->height );
// mips will be auto-generated if desired
for( j = 0; j < mipCount; j++ )
{
int x, y;
width = Q_max( 1, ( tex->width >> j ));
height = Q_max( 1, ( tex->height >> j ));
texsize = GL_CalcTextureSize( width, height, tex->depth );
size = gEngfuncs.Image_CalcImageSize( pic->type, width, height, tex->depth );
// GL_TextureImageRAW( tex, i, j, width, height, tex->depth, pic->type, data );
// increase size to workaround triangle renderer bugs
// it seems to assume memory readable. maybe it was pointed to WAD?
// tex->pixels[j] = (byte*)Mem_Calloc( r_temppool, width * height * sizeof(pixel_t) + 1024 ) + 512;
tex->pixels[j] = (pixel_t *)Mem_Calloc( r_temppool, width * height * sizeof( pixel_t ));
// memset( (byte*)tex->pixels[j] - 512, 0xFF, 512 );
// memset( (byte*)tex->pixels[j] + width * height * sizeof(pixel_t), 0xFF, 512 );
if( j == 0 && tex->flags & TF_HAS_ALPHA )
tex->alpha_pixels = (pixel_t *)Mem_Calloc( r_temppool, width * height * sizeof( pixel_t ));
@@ -571,8 +383,6 @@ static qboolean GL_UploadTexture( image_t *tex, rgbdata_t *pic )
tex->size += texsize;
tex->numMips++;
// GL_CheckTexImageError( tex );
}
return true;
@@ -844,7 +654,6 @@ int GAME_EXPORT GL_LoadTexture( const char *name, const byte *buf, size_t size,
return 0;
}
GL_ApplyTextureParams( tex ); // update texture filter, wrap etc
gEngfuncs.FS_FreeImage( pic ); // release source texture
// NOTE: always return texnum as index in array or engine will stop work !!!
@@ -900,7 +709,6 @@ int GAME_EXPORT GL_LoadTextureFromBuffer( const char *name, rgbdata_t *pic, texF
return 0;
}
GL_ApplyTextureParams( tex ); // update texture filter, wrap etc
return( tex - r_images );
}
@@ -1043,7 +851,6 @@ void GAME_EXPORT GL_ProcessTexture( int texnum, float gamma, int topColor, int b
gEngfuncs.Image_Process( &pic, topColor, bottomColor, flags, 0.0f );
GL_UploadTexture( image, pic );
GL_ApplyTextureParams( image ); // update texture filter, wrap etc
gEngfuncs.FS_FreeImage( pic );
}
@@ -1256,7 +1063,6 @@ void R_InitImages( void )
r_numImages = 1;
// validate cvars
R_SetTextureParameters();
GL_CreateInternalTextures();
gEngfuncs.Cmd_AddCommand( "texturelist", R_TextureList_f, "display loaded textures list" );

View File

@@ -176,9 +176,6 @@ void R_PushDlights( void )
if( l->die < gp_cl->time || !l->radius )
continue;
// if( GL_FrustumCullSphere( &RI.frustum, l->origin, l->radius, 15 ))
// continue;
R_MarkLights( l, 1 << i, RI.currentmodel->nodes );
}
}
@@ -208,7 +205,6 @@ static qboolean R_RecursiveLightPoint( model_t *model, mnode_t *node, float p1f,
color24 *lm, *dm;
mextrasurf_t *info;
msurface_t *surf;
mtexinfo_t *tex;
matrix3x4 tbn;
vec3_t mid;
mnode_t *children[2];
@@ -256,7 +252,6 @@ static qboolean R_RecursiveLightPoint( model_t *model, mnode_t *node, float p1f,
{
int smax, tmax;
tex = surf->texinfo;
info = surf->info;
if( FBitSet( surf->flags, SURF_DRAWTILED ))

View File

@@ -95,26 +95,6 @@ extern poolhandle_t r_temppool;
#define MOVE_BIT( s, f, t ) ( GET_BIT( s, f ) << t )
/*
skins will be outline flood filled and mip mapped
pics and sprites with alpha will be outline flood filled
pic won't be mip mapped
model skin
sprite frame
wall texture
pic
*/
typedef enum
{
it_skin,
it_sprite,
it_wall,
it_pic,
it_sky
} imagetype_t;
// ===================================================================
typedef unsigned short pixel_t;
@@ -355,11 +335,6 @@ typedef struct image_s
// debug info
size_t size; // upload size for debug targets
// detail textures stuff
float xscale;
float yscale;
imagetype_t type;
pixel_t *pixels[4]; // mip levels
pixel_t *alpha_pixels; // mip levels
@@ -394,7 +369,6 @@ void R_UploadStretchRaw( int texture, int cols, int rows, int width, int height,
// gl_image.c
//
void R_SetTextureParameters( void );
image_t *R_GetTexture( unsigned int texnum );
#define GL_LoadTextureInternal( name, pic, flags ) GL_LoadTextureFromBuffer( name, pic, flags, false )
#define GL_UpdateTextureInternal( name, pic, flags ) GL_LoadTextureFromBuffer( name, pic, flags, true )
@@ -406,7 +380,6 @@ int GL_CreateTexture( const char *name, int width, int height, const void *buffe
int GL_CreateTextureArray( const char *name, int width, int height, int depth, const void *buffer, texFlags_t flags );
void GL_ProcessTexture( int texnum, float gamma, int topColor, int bottomColor );
void GL_UpdateTexSize( int texnum, int width, int height, int depth );
void GL_ApplyTextureParams( image_t *tex );
int GL_FindTexture( const char *name );
void GL_FreeTexture( unsigned int texnum );
const char *GL_Target( unsigned int target );
@@ -1008,7 +981,6 @@ extern int r_screenwidth;
extern int sintable[1280];
extern int intsintable[1280];
extern int blanktable[1280]; // PGM
extern surf_t *surfaces, *surface_p, *surf_max;

View File

@@ -362,16 +362,6 @@ qboolean GAME_EXPORT R_AddEntity( struct cl_entity_s *clent, int type )
return true;
}
/*
=============
R_Clear
=============
*/
static void R_Clear( int bitMask )
{
memset( vid.buffer, 0, vid.width * vid.height * 2 );
}
// =============================================================================
/*
===============
@@ -512,81 +502,6 @@ static void R_SetupFrame( void )
R_SetupFrameQ();
}
/*
=============
R_RecursiveFindWaterTexture
using to find source waterleaf with
watertexture to grab fog values from it
=============
*/
static image_t *R_RecursiveFindWaterTexture( const mnode_t *node, const mnode_t *ignore, qboolean down )
{
image_t *tex = NULL;
mnode_t *children[2];
// assure the initial node is not null
// we could check it here, but we would rather check it
// outside the call to get rid of one additional recursion level
Assert( node != NULL );
// ignore solid nodes
if( node->contents == CONTENTS_SOLID )
return NULL;
if( node->contents < 0 )
{
mleaf_t *pleaf;
msurface_t **mark;
int i, c;
// ignore non-liquid leaves
if( node->contents != CONTENTS_WATER && node->contents != CONTENTS_LAVA && node->contents != CONTENTS_SLIME )
return NULL;
// find texture
pleaf = (mleaf_t *)node;
mark = pleaf->firstmarksurface;
c = pleaf->nummarksurfaces;
for( i = 0; i < c; i++, mark++ )
{
if(( *mark )->flags & SURF_DRAWTURB && ( *mark )->texinfo && ( *mark )->texinfo->texture )
return R_GetTexture(( *mark )->texinfo->texture->gl_texturenum );
}
// texture not found
return NULL;
}
// this is a regular node
// traverse children
node_children( children, node, WORLDMODEL );
if( children[0] && ( children[0] != ignore ))
{
tex = R_RecursiveFindWaterTexture( children[0], node, true );
if( tex ) return tex;
}
if( children[1] && ( children[1] != ignore ))
{
tex = R_RecursiveFindWaterTexture( children[1], node, true );
if( tex ) return tex;
}
// for down recursion, return immediately
if( down )
return NULL;
// texture not found, step up if any
if( node->parent )
return R_RecursiveFindWaterTexture( node->parent, node, false );
// top-level node, bail out
return NULL;
}
/*
=============
R_DrawEntitiesOnList
@@ -968,7 +883,7 @@ R_DrawBEntitiesOnList
*/
void R_DrawBrushModel( cl_entity_t *pent )
{
int i, clipflags;
int clipflags;
vec3_t oldorigin;
vec3_t mins, maxs;
float minmaxs[6];
@@ -1250,10 +1165,6 @@ void GAME_EXPORT R_BeginFrame( qboolean clearScene )
// draw buffer stuff
// pglDrawBuffer( GL_BACK );
// update texture parameters
// if( FBitSet( gl_texture_nearest->flags|gl_lightmap_nearest->flags|gl_texture_anisotropy->flags|gl_texture_lodbias->flags, FCVAR_CHANGED ))
// R_SetTextureParameters();
gEngfuncs.CL_ExtraUpdate();
}
@@ -1476,7 +1387,6 @@ static void R_InitTurb( void )
for( i = 0; i < 1280; i++ )
{
sintable[i] = AMP + sin( i * 3.14159 * 2 / CYCLE ) * AMP;
intsintable[i] = AMP2 + sin( i * 3.14159 * 2 / CYCLE ) * AMP2; // AMP2, not 20
blanktable[i] = 0; // PGM
}
}

View File

@@ -151,46 +151,6 @@ void Matrix4x4_CreateRotate( matrix4x4 out, float angle, float x, float y, float
out[3][3] = 1.0f;
}
static void Matrix4x4_CreateScale( matrix4x4 out, float x )
{
out[0][0] = x;
out[0][1] = 0.0f;
out[0][2] = 0.0f;
out[0][3] = 0.0f;
out[1][0] = 0.0f;
out[1][1] = x;
out[1][2] = 0.0f;
out[1][3] = 0.0f;
out[2][0] = 0.0f;
out[2][1] = 0.0f;
out[2][2] = x;
out[2][3] = 0.0f;
out[3][0] = 0.0f;
out[3][1] = 0.0f;
out[3][2] = 0.0f;
out[3][3] = 1.0f;
}
static void Matrix4x4_CreateScale3( matrix4x4 out, float x, float y, float z )
{
out[0][0] = x;
out[0][1] = 0.0f;
out[0][2] = 0.0f;
out[0][3] = 0.0f;
out[1][0] = 0.0f;
out[1][1] = y;
out[1][2] = 0.0f;
out[1][3] = 0.0f;
out[2][0] = 0.0f;
out[2][1] = 0.0f;
out[2][2] = z;
out[2][3] = 0.0f;
out[3][0] = 0.0f;
out[3][1] = 0.0f;
out[3][2] = 0.0f;
out[3][3] = 1.0f;
}
void Matrix4x4_ConcatTranslate( matrix4x4 out, float x, float y, float z )
{
matrix4x4 base, temp;

View File

@@ -127,33 +127,8 @@ check tracer bbox
*/
static qboolean CL_CullTracer( particle_t *p, const vec3_t start, const vec3_t end )
{
vec3_t mins, maxs;
int i;
// culling is undone in ref_soft
return false;
/*
// compute the bounding box
for( i = 0; i < 3; i++ )
{
if( start[i] < end[i] )
{
mins[i] = start[i];
maxs[i] = end[i];
}
else
{
mins[i] = end[i];
maxs[i] = start[i];
}
// don't let it be zero sized
if( mins[i] == maxs[i] )
{
maxs[i] += gTracerSize[p->type] * 2.0f;
}
}
// check bbox
return R_CullBox( mins, maxs );*/
}
/*
@@ -297,7 +272,6 @@ void GAME_EXPORT CL_DrawParticlesExternal( const ref_viewpass_t *rvp, qboolean t
R_SetupRefParams( rvp );
R_SetupFrustum();
// R_SetupGL( false ); // don't touch GL-states
// setup PVS for frame
memcpy( RI.visbytes, tr.visbytes, gpGlobals->visbytes );

File diff suppressed because it is too large Load Diff

View File

@@ -29,26 +29,18 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define FULLY_CLIPPED_CACHED 0x80000000
#define FRAMECOUNT_MASK 0x7FFFFFFF
unsigned int cacheoffset;
int c_faceclip; // number of faces clipped
clipplane_t *entity_clipplanes;
clipplane_t world_clipplanes[16];
medge16_t *r_pedge;
qboolean r_leftclipped, r_rightclipped;
static unsigned int cacheoffset;
static int c_faceclip; // number of faces clipped
static medge16_t *r_pedge;
static qboolean r_leftclipped, r_rightclipped;
static qboolean makeleftedge, makerightedge;
qboolean r_nearzionly;
static qboolean r_nearzionly;
int sintable[1280];
int intsintable[1280];
int blanktable[1280]; // PGM
mvertex_t r_leftenter, r_leftexit;
mvertex_t r_rightenter, r_rightexit;
static mvertex_t r_leftenter, r_leftexit;
static mvertex_t r_rightenter, r_rightexit;
typedef struct
{
@@ -56,52 +48,12 @@ typedef struct
int ceilv;
} evert_t;
int r_emitted;
float r_nearzi;
float r_u1, r_v1, r_lzi1;
int r_ceilv1;
static int r_emitted;
static float r_nearzi;
static float r_u1, r_v1, r_lzi1;
static int r_ceilv1;
qboolean r_lastvertvalid;
int r_skyframe;
msurface_t *r_skyfaces;
mplane_t r_skyplanes[6];
mtexinfo_t r_skytexinfo[6];
mvertex_t *r_skyverts;
medge16_t *r_skyedges;
int *r_skysurfedges;
// I just copied this data from a box map...
int skybox_planes[12] = {2, -128, 0, -128, 2, 128, 1, 128, 0, 128, 1, -128};
int box_surfedges[24] = { 1, 2, 3, 4, -1, 5, 6, 7, 8, 9, -6, 10, -2, -7, -9, 11,
12, -3, -11, -8, -12, -10, -5, -4};
int box_edges[24] = { 1, 2, 2, 3, 3, 4, 4, 1, 1, 5, 5, 6, 6, 2, 7, 8, 8, 6, 5, 7, 8, 3, 7, 4};
int box_faces[6] = {0, 0, 2, 2, 2, 0};
vec3_t box_vecs[6][2] = {
{ {0, -1, 0}, {-1, 0, 0} },
{ {0, 1, 0}, {0, 0, -1} },
{ {0, -1, 0}, {1, 0, 0} },
{ {1, 0, 0}, {0, 0, -1} },
{ {0, -1, 0}, {0, 0, -1} },
{ {-1, 0, 0}, {0, 0, -1} }
};
float box_verts[8][3] = {
{-1, -1, -1},
{-1, 1, -1},
{1, 1, -1},
{1, -1, -1},
{-1, -1, 1},
{-1, 1, 1},
{1, -1, 1},
{1, 1, 1}
};
// down, west, up, north, east, south
// {"rt", "bk", "lf", "ft", "up", "dn"};
static qboolean r_lastvertvalid;
/*
================

View File

@@ -36,7 +36,7 @@ int alpha;
D_DrawTurbulent8Span
=============
*/
void D_DrawTurbulent8Span( void )
static void D_DrawTurbulent8Span( void )
{
int sturb, tturb;

View File

@@ -332,182 +332,6 @@ mspriteframe_t *R_GetSpriteFrame( const model_t *pModel, int frame, float yaw )
return pspriteframe;
}
/*
================
R_GetSpriteFrameInterpolant
NOTE: we using prevblending[0] and [1] for holds interval
between frames where are we lerping
================
*/
static float R_GetSpriteFrameInterpolant( cl_entity_t *ent, mspriteframe_t **oldframe, mspriteframe_t **curframe )
{
msprite_t *psprite;
mspritegroup_t *pspritegroup;
int i, j, numframes, frame;
float lerpFrac, time, jtime, jinterval;
float *pintervals, fullinterval, targettime;
int m_fDoInterp;
psprite = ent->model->cache.data;
frame = (int)ent->curstate.frame;
lerpFrac = 1.0f;
// misc info
m_fDoInterp = ( ent->curstate.effects & EF_NOINTERP ) ? false : true;
if( frame < 0 )
{
frame = 0;
}
else if( frame >= psprite->numframes )
{
gEngfuncs.Con_Reportf( S_WARN "%s: no such frame %d (%s)\n", __func__, frame, ent->model->name );
frame = psprite->numframes - 1;
}
if( psprite->frames[frame].type == FRAME_SINGLE )
{
if( m_fDoInterp )
{
if( ent->latched.prevblending[0] >= psprite->numframes || psprite->frames[ent->latched.prevblending[0]].type != FRAME_SINGLE )
{
// this can be happens when rendering switched between single and angled frames
// or change model on replace delta-entity
ent->latched.prevblending[0] = ent->latched.prevblending[1] = frame;
ent->latched.sequencetime = gp_cl->time;
lerpFrac = 1.0f;
}
if( ent->latched.sequencetime < gp_cl->time )
{
if( frame != ent->latched.prevblending[1] )
{
ent->latched.prevblending[0] = ent->latched.prevblending[1];
ent->latched.prevblending[1] = frame;
ent->latched.sequencetime = gp_cl->time;
lerpFrac = 0.0f;
}
else
lerpFrac = ( gp_cl->time - ent->latched.sequencetime ) * 11.0f;
}
else
{
ent->latched.prevblending[0] = ent->latched.prevblending[1] = frame;
ent->latched.sequencetime = gp_cl->time;
lerpFrac = 0.0f;
}
}
else
{
ent->latched.prevblending[0] = ent->latched.prevblending[1] = frame;
lerpFrac = 1.0f;
}
if( ent->latched.prevblending[0] >= psprite->numframes )
{
// reset interpolation on change model
ent->latched.prevblending[0] = ent->latched.prevblending[1] = frame;
ent->latched.sequencetime = gp_cl->time;
lerpFrac = 0.0f;
}
// get the interpolated frames
if( oldframe )
*oldframe = psprite->frames[ent->latched.prevblending[0]].frameptr;
if( curframe )
*curframe = psprite->frames[frame].frameptr;
}
else if( psprite->frames[frame].type == FRAME_GROUP )
{
pspritegroup = (mspritegroup_t *)psprite->frames[frame].frameptr;
pintervals = pspritegroup->intervals;
numframes = pspritegroup->numframes;
fullinterval = pintervals[numframes - 1];
jinterval = pintervals[1] - pintervals[0];
time = gp_cl->time;
jtime = 0.0f;
// when loading in Mod_LoadSpriteGroup, we guaranteed all interval values
// are positive, so we don't have to worry about division by zero
targettime = time - ((int)( time / fullinterval )) * fullinterval;
// LordHavoc: since I can't measure the time properly when it loops from numframes - 1 to 0,
// i instead measure the time of the first frame, hoping it is consistent
for( i = 0, j = numframes - 1; i < ( numframes - 1 ); i++ )
{
if( pintervals[i] > targettime )
break;
j = i;
jinterval = pintervals[i] - jtime;
jtime = pintervals[i];
}
if( m_fDoInterp )
lerpFrac = ( targettime - jtime ) / jinterval;
else
j = i; // no lerping
// get the interpolated frames
if( oldframe )
*oldframe = pspritegroup->frames[j];
if( curframe )
*curframe = pspritegroup->frames[i];
}
else if( psprite->frames[frame].type == FRAME_ANGLED )
{
// e.g. doom-style sprite monsters
float yaw = ent->angles[YAW];
int angleframe = (int)( Q_rint(( RI.viewangles[1] - yaw + 45.0f ) / 360 * 8 ) - 4 ) & 7;
if( m_fDoInterp )
{
if( ent->latched.prevblending[0] >= psprite->numframes || psprite->frames[ent->latched.prevblending[0]].type != FRAME_ANGLED )
{
// this can be happens when rendering switched between single and angled frames
// or change model on replace delta-entity
ent->latched.prevblending[0] = ent->latched.prevblending[1] = frame;
ent->latched.sequencetime = gp_cl->time;
lerpFrac = 1.0f;
}
if( ent->latched.sequencetime < gp_cl->time )
{
if( frame != ent->latched.prevblending[1] )
{
ent->latched.prevblending[0] = ent->latched.prevblending[1];
ent->latched.prevblending[1] = frame;
ent->latched.sequencetime = gp_cl->time;
lerpFrac = 0.0f;
}
else
lerpFrac = ( gp_cl->time - ent->latched.sequencetime ) * ent->curstate.framerate;
}
else
{
ent->latched.prevblending[0] = ent->latched.prevblending[1] = frame;
ent->latched.sequencetime = gp_cl->time;
lerpFrac = 0.0f;
}
}
else
{
ent->latched.prevblending[0] = ent->latched.prevblending[1] = frame;
lerpFrac = 1.0f;
}
pspritegroup = (mspritegroup_t *)psprite->frames[ent->latched.prevblending[0]].frameptr;
if( oldframe )
*oldframe = pspritegroup->frames[angleframe];
pspritegroup = (mspritegroup_t *)psprite->frames[frame].frameptr;
if( curframe )
*curframe = pspritegroup->frames[angleframe];
}
return lerpFrac;
}
/*
================
R_CullSpriteModel
@@ -616,7 +440,6 @@ R_DrawSpriteQuad
static void R_DrawSpriteQuad( mspriteframe_t *frame, vec3_t org, vec3_t v_right, vec3_t v_up, float scale )
{
vec3_t point;
image_t *image;
r_stats.c_sprite_polys++;
/*image = R_GetTexture(frame->gl_texturenum);
@@ -644,55 +467,6 @@ static void R_DrawSpriteQuad( mspriteframe_t *frame, vec3_t org, vec3_t v_right,
TriEnd();
}
static qboolean R_SpriteHasLightmap( cl_entity_t *e, int texFormat )
{
if( !r_sprite_lighting->value )
return false;
if( texFormat != SPR_ALPHTEST )
return false;
if( e->curstate.effects & EF_FULLBRIGHT )
return false;
if( e->curstate.renderamt <= 127 )
return false;
switch( e->curstate.rendermode )
{
case kRenderNormal:
case kRenderTransAlpha:
case kRenderTransTexture:
break;
default:
return false;
}
return true;
}
/*
=================
R_SpriteAllowLerping
=================
*/
static qboolean R_SpriteAllowLerping( cl_entity_t *e, msprite_t *psprite )
{
if( !r_sprite_lerping->value )
return false;
if( psprite->numframes <= 1 )
return false;
if( psprite->texFormat != SPR_ADDITIVE )
return false;
if( e->curstate.rendermode == kRenderNormal || e->curstate.rendermode == kRenderTransAlpha )
return false;
return true;
}
/*
=================
R_DrawSpriteModel
@@ -700,14 +474,13 @@ R_DrawSpriteModel
*/
void R_DrawSpriteModel( cl_entity_t *e )
{
mspriteframe_t *frame = NULL, *oldframe = NULL;
mspriteframe_t *frame = NULL;
msprite_t *psprite;
model_t *model;
int i, type;
float angle, dot, sr, cr;
float lerp = 1.0f, ilerp, scale;
float angle, dot, sr, cr, scale;
vec3_t v_forward, v_right, v_up;
vec3_t origin, color, color2;
vec3_t origin, color;
if( RI.params & RP_ENVVIEW )
return;
@@ -763,21 +536,7 @@ void R_DrawSpriteModel( cl_entity_t *e )
color[2] = 1.0f;
}
if( R_SpriteHasLightmap( e, psprite->texFormat ))
{
colorVec lightColor = R_LightPoint( origin );
// FIXME: collect light from dlights?
color2[0] = (float)lightColor.r * ( 1.0f / 255.0f );
color2[1] = (float)lightColor.g * ( 1.0f / 255.0f );
color2[2] = (float)lightColor.b * ( 1.0f / 255.0f );
// NOTE: sprites with 'lightmap' looks ugly when alpha func is GL_GREATER 0.0
// pglAlphaFunc( GL_GREATER, 0.5f );
}
if( R_SpriteAllowLerping( e, psprite ))
lerp = R_GetSpriteFrameInterpolant( e, &oldframe, &frame );
else
frame = oldframe = R_GetSpriteFrame( model, e->curstate.frame, e->angles[YAW] );
frame = R_GetSpriteFrame( model, e->curstate.frame, e->angles[YAW] );
type = psprite->type;
@@ -824,31 +583,8 @@ void R_DrawSpriteModel( cl_entity_t *e )
// if( psprite->facecull == SPR_CULL_NONE )
// GL_Cull( GL_NONE );
if( oldframe == frame )
{
// draw the single non-lerped frame
_TriColor4f( color[0], color[1], color[2], tr.blend );
GL_Bind( XASH_TEXTURE0, frame->gl_texturenum );
R_DrawSpriteQuad( frame, origin, v_right, v_up, scale );
}
else
{
// draw two combined lerped frames
lerp = bound( 0.0f, lerp, 1.0f );
ilerp = 1.0f - lerp;
if( ilerp != 0.0f )
{
_TriColor4f( color[0], color[1], color[2], tr.blend * ilerp );
GL_Bind( XASH_TEXTURE0, oldframe->gl_texturenum );
R_DrawSpriteQuad( oldframe, origin, v_right, v_up, scale );
}
if( lerp != 0.0f )
{
_TriColor4f( color[0], color[1], color[2], tr.blend * lerp );
GL_Bind( XASH_TEXTURE0, frame->gl_texturenum );
R_DrawSpriteQuad( frame, origin, v_right, v_up, scale );
}
}
// draw the single non-lerped frame
_TriColor4f( color[0], color[1], color[2], tr.blend );
GL_Bind( XASH_TEXTURE0, frame->gl_texturenum );
R_DrawSpriteQuad( frame, origin, v_right, v_up, scale );
}

View File

@@ -33,18 +33,6 @@ typedef struct
CVAR_DEFINE_AUTO( r_shadows, "0", 0, "draw ugly shadows" );
static const vec3_t hullcolor[8] =
{
{ 1.0f, 1.0f, 1.0f },
{ 1.0f, 0.5f, 0.5f },
{ 0.5f, 1.0f, 0.5f },
{ 1.0f, 1.0f, 0.5f },
{ 0.5f, 0.5f, 1.0f },
{ 1.0f, 0.5f, 1.0f },
{ 0.5f, 1.0f, 1.0f },
{ 1.0f, 1.0f, 1.0f },
};
typedef struct sortedmesh_s
{
mstudiomesh_t *mesh;
@@ -1548,7 +1536,7 @@ static void R_StudioEntityLight( alight_t *lightinfo )
float minstrength, dist2, f, r2;
float lstrength[MAX_LOCALLIGHTS];
cl_entity_t *ent = RI.currententity;
vec3_t mid, origin, pos;
vec3_t mid, origin;
dlight_t *el;
g_studio.numlocallights = 0;
@@ -1580,7 +1568,6 @@ static void R_StudioEntityLight( alight_t *lightinfo )
VectorCopy( ent->origin, el->origin );
}
VectorCopy( el->origin, pos );
VectorSubtract( origin, el->origin, mid );
f = DotProduct( mid, mid );
@@ -1959,7 +1946,6 @@ generic path
*/
static void R_StudioDrawNormalMesh( short *ptricmds, vec3_t *pstudionorms, float s, float t )
{
float *lv;
int i;
while(( i = *( ptricmds++ )))
@@ -1993,7 +1979,6 @@ generic path
*/
static void R_StudioDrawFloatMesh( short *ptricmds, vec3_t *pstudionorms )
{
float *lv;
int i;
while(( i = *( ptricmds++ )))
@@ -2602,70 +2587,6 @@ static int pfnIsHardware( void )
return 1; // 0 is Software, 1 is OpenGL, 2 is Direct3D
}
/*
===============
R_StudioDrawPointsShadow
===============
*/
static void R_StudioDrawPointsShadow( void )
{
float *av, height;
float vec_x, vec_y;
mstudiomesh_t *pmesh;
vec3_t point;
int i, k;
if( FBitSet( RI.currententity->curstate.effects, EF_NOSHADOW ))
return;
// if( glState.stencilEnabled )
// pglEnable( GL_STENCIL_TEST );
height = g_studio.lightspot[2] + 1.0f;
vec_x = -g_studio.lightvec[0] * 8.0f;
vec_y = -g_studio.lightvec[1] * 8.0f;
for( k = 0; k < m_pSubModel->nummesh; k++ )
{
short *ptricmds;
pmesh = (mstudiomesh_t *)((byte *)m_pStudioHeader + m_pSubModel->meshindex ) + k;
ptricmds = (short *)((byte *)m_pStudioHeader + pmesh->triindex );
r_stats.c_studio_polys += pmesh->numtris;
while(( i = *( ptricmds++ )))
{
if( i < 0 )
{
TriBegin( TRI_TRIANGLE_FAN );
i = -i;
}
else
{
TriBegin( TRI_TRIANGLE_STRIP );
}
for( ; i > 0; i--, ptricmds += 4 )
{
av = g_studio.verts[ptricmds[0]];
point[0] = av[0] - ( vec_x * ( av[2] - g_studio.lightspot[2] ));
point[1] = av[1] - ( vec_y * ( av[2] - g_studio.lightspot[2] ));
point[2] = g_studio.lightspot[2] + 1.0f;
TriVertex3fv( point );
}
TriEnd();
}
}
// if( glState.stencilEnabled )
// pglDisable( GL_STENCIL_TEST );
}
/*
===============
GL_StudioSetRenderMode

View File

@@ -24,18 +24,17 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
drawsurf_t r_drawsurf;
uint lightleft, sourcesstep, blocksize, sourcetstep;
uint lightdelta, lightdeltastep;
uint lightright, lightleftstep, lightrightstep, blockdivshift;
unsigned blockdivmask;
void *prowdestbase;
pixel_t *pbasesource;
int surfrowbytes; // used by ASM files
unsigned *r_lightptr;
int r_stepback;
int r_lightwidth;
int r_numhblocks, r_numvblocks;
pixel_t *r_source, *r_sourcemax;
static uint lightleft, blocksize, sourcetstep;
static uint lightright, lightleftstep, lightrightstep, blockdivshift;
static unsigned blockdivmask;
static void *prowdestbase;
static pixel_t *pbasesource;
static int surfrowbytes; // used by ASM files
static unsigned *r_lightptr;
static int r_stepback;
static int r_lightwidth;
static int r_numhblocks, r_numvblocks;
static pixel_t *r_source, *r_sourcemax;
void R_DrawSurfaceBlock8_mip0( void );
void R_DrawSurfaceBlock8_mip1( void );
@@ -56,11 +55,12 @@ static void (*surfmiptable[4])( void ) = {
// void R_BuildLightMap (void);
extern unsigned blocklights[10240]; // allow some very large lightmaps
float surfscale;
qboolean r_cache_thrash; // set if surface cache is thrashing
static float surfscale;
static qboolean r_cache_thrash; // set if surface cache is thrashing
int sc_size;
surfcache_t *sc_rover, *sc_base;
static int sc_size;
surfcache_t *sc_rover;
static surfcache_t *sc_base;
static int rtable[MOD_FRAMES][MOD_FRAMES];
@@ -253,57 +253,6 @@ void GL_InitRandomTable( void )
gEngfuncs.COM_SetRandomSeed( 0 );
}
/*
===============
R_TextureAnim
Returns the proper texture for a given time and base texture, do not process random tiling
===============
*/
static texture_t *R_TextureAnim( texture_t *b )
{
texture_t *base = b;
int count, reletive;
if( RI.currententity->curstate.frame )
{
if( base->alternate_anims )
base = base->alternate_anims;
}
if( !base->anim_total )
return base;
if( base->name[0] == '-' )
{
return b; // already tiled
}
else
{
int speed;
// Quake1 textures uses 10 frames per second
if( FBitSet( R_GetTexture( base->gl_texturenum )->flags, TF_QUAKEPAL ))
speed = 10;
else
speed = 20;
reletive = (int)( gp_cl->time * speed ) % base->anim_total;
}
count = 0;
while( base->anim_min > reletive || base->anim_max <= reletive )
{
base = base->anim_next;
if( !base || ++count > MOD_FRAMES )
return b;
}
return base;
}
/*
===============
R_TextureAnimation

View File

@@ -9,9 +9,9 @@ affinetridesc_t r_affinetridesc;
int r_aliasblendcolor;
float aliastransform[3][4];
float aliasworldtransform[3][4];
float aliasoldworldtransform[3][4];
static float aliastransform[3][4];
static float aliasworldtransform[3][4];
static float aliasoldworldtransform[3][4];
float s_ziscale;
static vec3_t s_alias_forward, s_alias_right, s_alias_up;
@@ -27,9 +27,6 @@ float r_avertexnormals[NUMVERTEXNORMALS][3] = {
void R_AliasSetUpTransform( void );
void R_AliasProjectAndClipTestFinalVert( finalvert_t *fv );
void R_AliasTransformFinalVerts( int numpoints, finalvert_t *fv, dtrivertx_t *oldv, dtrivertx_t *newv );
/*
================
R_AliasCheckBBox