03 Aug 2009

This commit is contained in:
g-cont 2009-08-03 00:00:00 +04:00 committed by Alibek Omarov
parent fb60f161d6
commit d22bf723bb
58 changed files with 3872 additions and 1722 deletions

16
client/client.plg Normal file
View File

@ -0,0 +1,16 @@
<html>
<body>
<pre>
<h1>Build Log</h1>
<h3>
--------------------Configuration: client - Win32 Debug--------------------
</h3>
<h3>Command Lines</h3>
<h3>Results</h3>
client.dll - 0 error(s), 0 warning(s)
</pre>
</body>
</html>

View File

@ -298,7 +298,7 @@ client_sprite_t *SPR_GetList( const char *psz, int *piCount )
*piCount = iSprCount;
return NULL;
}
char *token;
const char *plist = pfile;
int depth = 0;
@ -564,7 +564,7 @@ void V_RenderPlaque( void )
const char *levelshot;
levelshot = CVAR_GET_STRING( "cl_levelshot_name" );
if( !strcmp( levelshot, "" )) levelshot = "$blackimage";
if( !strcmp( levelshot, "" )) levelshot = "*black";
// logo that shows up while upload next level
DrawImageRectangle( SPR_Load( levelshot ));

View File

@ -123,7 +123,7 @@ void CHud :: VidInit( void )
}
else
{
ALERT( at_warning, "hud.shader couldn't load\n" );
ALERT( at_warning, "hud.txt couldn't load\n" );
CVAR_SET_FLOAT( "hud_draw", 0 );
return;
}
@ -283,7 +283,7 @@ int CHud :: Redraw( float flTime )
if( !m_iIntermission )
{
if(( pList->p->m_iFlags & HUD_ACTIVE ) && !(m_iHideHUDDisplay & HIDEHUD_ALL ))
pList->p->Draw(flTime);
pList->p->Draw( flTime );
}
else
{

View File

@ -591,10 +591,11 @@ private:
// when the hud.txt and associated sprites are loaded. freed in ~CHud()
HSPRITE *m_rghSprites; // the sprites loaded from hud.txt
wrect_t *m_rgrcRects;
wrect_t nullRect;
char *m_rgszSpriteNames;
public:
HSPRITE GetSprite( int index ) { return (index < 0) ? 0 : m_rghSprites[index]; }
wrect_t& GetSpriteRect( int index ) { return m_rgrcRects[index]; }
wrect_t& GetSpriteRect( int index ) { return (index < 0) ? nullRect : m_rgrcRects[index]; }
int InitMessages( void ); // init hud messages
int GetSpriteIndex( const char *SpriteName );

View File

@ -226,7 +226,7 @@ void CL_AddDLights( void )
dl = cl_dlights;
for( i = 0; i < MAX_DLIGHTS; i++, dl++ )
{
if( dl->radius ) re->AddDynLight( dl->origin, dl->color, dl->radius );
if( dl->radius ) re->AddDynLight( dl->origin, dl->color, dl->radius, -1 );
}
}
@ -917,7 +917,7 @@ void CL_TestEntities( void )
================
CL_TestLights
If cl_testlights is set, create 32 lights models
if cl_testlights is set, create 32 lights models
================
*/
void CL_TestLights( void )
@ -944,7 +944,7 @@ void CL_TestLights( void )
dl.color[2] = (((i%6)+1) & 4)>>2;
dl.radius = 200;
if( !re->AddDynLight( dl.origin, dl.color, dl.radius ))
if( !re->AddDynLight( dl.origin, dl.color, dl.radius, -1 ))
break;
}
}

View File

@ -557,6 +557,7 @@ void PF_loadcredits( void )
if(!creditsBuffer)
{
Msg( "load credits\n" );
// load credits if needed
creditsBuffer = FS_LoadFile( s, &count );
if( count )

16
engine/engine.plg Normal file
View File

@ -0,0 +1,16 @@
<html>
<body>
<pre>
<h1>Build Log</h1>
<h3>
--------------------Configuration: engine - Win32 Debug--------------------
</h3>
<h3>Command Lines</h3>
<h3>Results</h3>
engine.dll - 0 error(s), 0 warning(s)
</pre>
</body>
</html>

View File

@ -245,6 +245,7 @@ typedef struct
{
bool initialized; // sv_init has completed
double realtime; // always increasing, no clamping, etc
double timestart; // just for profiling
char mapname[CS_SIZE]; // current mapname
char comment[CS_SIZE]; // map name, e.t.c.

View File

@ -513,6 +513,8 @@ void SV_PutClientInServer( edict_t *ent )
SV_LinkEdict( ent ); // m_pmatrix calculated here, so we need call this before pe->CreatePlayer
ent->pvServerData->physbody = pe->CreatePlayer( ent, SV_GetModelPtr( ent ), ent->v.origin, ent->v.m_pmatrix );
Mem_EmptyPool( svgame.temppool ); // all tempstrings can be freed now
MsgDev( D_INFO, "level loaded at %g sec\n", Sys_DoubleTime() - svs.timestart );
}
/*
@ -739,10 +741,11 @@ void SV_BeginDownload_f( sv_client_t *cl )
if( !allow_download->integer || !cl->download )
{
MsgDev( D_ERROR, "SV_BeginDownload_f: couldn't download %s to %s\n", name, cl->name );
if( cl->download ) cl->download = NULL;
if( cl->download ) Mem_Free( cl->download );
MSG_WriteByte( &cl->netchan.message, svc_download );
MSG_WriteShort( &cl->netchan.message, -1 );
MSG_WriteByte( &cl->netchan.message, 0 );
cl->download = NULL;
return;
}

View File

@ -160,6 +160,7 @@ void SV_SpawnServer( const char *server, const char *savename )
Msg( "SpawnServer [%s]\n", server );
svs.timestart = Sys_DoubleTime ();
svs.spawncount++; // any partially connected client will be restarted
sv.state = ss_dead;
Host_SetServerState( sv.state );

View File

@ -64,9 +64,9 @@ typedef struct imglib_s
const saveformat_t *saveformats;
// current 2d image state
int width;
int height;
byte depth; // num layers in
word width;
word height;
word depth; // num layers in
byte num_mips; // build mipmaps
uint type; // main type switcher
uint flags; // additional image flags
@ -499,7 +499,7 @@ extern const bpc_desc_t PFDesc[];
void Image_RoundDimensions( int *scaled_width, int *scaled_height );
byte *Image_ResampleInternal( const void *indata, int inwidth, int inheight, int outwidth, int outheight, int intype );
byte *Image_FlipInternal( const byte *in, int *srcwidth, int *srcheight, int type, int flags );
byte *Image_FlipInternal( const byte *in, word *srcwidth, word *srcheight, int type, int flags );
void Image_FreeImage( rgbdata_t *pack );
void Image_Save( const char *filename, rgbdata_t *pix );
size_t Image_DXTGetLinearSize( int type, int width, int height, int depth, int rgbcount );

View File

@ -43,7 +43,7 @@ bool Image_LoadBMP( const char *name, const byte *buffer, size_t filesize )
// bogus file header check
if( bhdr.reserved0 != 0 ) return false;
if( memcmp(bhdr.id, "BM", 2 ))
if( memcmp( bhdr.id, "BM", 2 ))
{
MsgDev( D_ERROR, "Image_LoadBMP: only Windows-style BMP files supported (%s)\n", name );
return false;

View File

@ -1447,7 +1447,7 @@ void Image_SetPixelFormat( int width, int height, int depth )
image.SizeOfPlane = image.bps * image.curheight;
image.SizeOfData = image.SizeOfPlane * image.curdepth;
// NOTE: size of current miplevel or cubemap side, not total (filesize - sizeof(header))
// NOTE: size of current miplevel or cubemap side, not total (filesize - sizeof( header ))
image.SizeOfFile = Image_DXTGetLinearSize( image.type, width, height, depth, image.bits_count / 8 );
}
@ -2224,12 +2224,13 @@ bool Image_DecompressRGBA( uint target, int level, int intformat, uint width, ui
switch( PFDesc[intformat].format )
{
case PF_RGB_16:
for( i = 0, col = (color16 *)fin; i < width * height; i++, col += sizeof( color16 ))
for( i = 0, col = (color16 *)fin; i < width * height; i++ )
{
fout[(i<<2)+0] = col->r << 3;
fout[(i<<2)+1] = col->g << 2;
fout[(i<<2)+2] = col->b << 3;
fout[(i<<2)+3] = 255;
col += sizeof( color16 );
}
break;
case PF_RGB_24:
@ -2273,13 +2274,14 @@ bool Image_DecompressRGBA( uint target, int level, int intformat, uint width, ui
void Image_DecompressDDS( const byte *buffer, uint target )
{
int i, size = 0;
int w = image.curwidth;
int h = image.curheight;
int d = image.curdepth;
int i, size = 0;
int w = image.curwidth;
int h = image.curheight;
int d = image.curdepth;
// filter by cubemap side
if( image.filter != CB_HINT_NO && image.filter != target ) return;
if( image.filter != CB_HINT_NO && image.filter != target )
return;
switch( image.type )
{
@ -2315,7 +2317,7 @@ void Image_DecompressDDS( const byte *buffer, uint target )
default: Sys_Error( "Image_DecompressDDS: unknown image format\n" );
}
for( i = 0; i < image.cur_mips; i++, buffer += size )
for( i = 0; i < image.cur_mips; i++ )
{
Image_SetPixelFormat( w, h, d );
size = image.SizeOfFile;
@ -2323,6 +2325,7 @@ void Image_DecompressDDS( const byte *buffer, uint target )
if(!image.decompress( target, i, image.type, w, h, size, buffer ))
break; // there were errors
w = (w+1)>>1, h = (h+1)>>1, d = (d+1)>>1; // calc size of next mip
buffer += size;
}
}
@ -2351,7 +2354,6 @@ bool Image_ForceDecompress( void )
case PF_ATI1N: return true; // hey, how called your OpenGL extension, ATI ?
case PF_ATI2N: return true;
}
return false;
}

View File

@ -310,7 +310,7 @@ int jpeg_readmarkers( void )
void jpeg_decompress( void )
{
// decompress jpeg file (Baseline algorithm)
// decompress jpeg file (baseline algorithm)
register int x, y, i, j, k, l, c;
int X, Y, H, V, plane, scaleh[3], scalev[3];
static float vector[64], dct[64];

View File

@ -125,7 +125,7 @@ void Image_Reset( void )
rgbdata_t *ImagePack( void )
{
rgbdata_t *pack = Mem_Alloc( Sys.imagepool, sizeof(rgbdata_t));
rgbdata_t *pack = Mem_Alloc( Sys.imagepool, sizeof( rgbdata_t ));
if( image.cubemap && image.num_sides != 6 )
{
@ -158,6 +158,7 @@ rgbdata_t *ImagePack( void )
pack->bitsCount = image.bits_count;
pack->flags = image.flags;
pack->palette = image.palette;
return pack;
}
@ -355,7 +356,10 @@ rgbdata_t *FS_LoadImage( const char *filename, const byte *buffer, size_t size )
{
com.snprintf( sidename, MAX_STRING, "%s%s.%s", loadname, cmap->type[i].suf, format->ext );
if( FS_AddSideToPack( sidename, cmap->type[i].flags )) // process flags to flip some sides
{
Mem_Free( f );
break; // loaded
}
}
Mem_Free( f );
}

View File

@ -62,12 +62,12 @@ bool Image_LoadPCX( const char *name, const byte *buffer, size_t filesize )
for (x = 0; x < image.width && fin < enddata;)
{
dataByte = *fin++;
if(dataByte >= 0xC0)
if( dataByte >= 0xC0 )
{
if (fin >= enddata) break;
if( fin >= enddata ) break;
x2 = x + (dataByte & 0x3F);
dataByte = *fin++;
if (x2 > image.width) x2 = image.width; // technically an error
if( x2 > image.width ) x2 = image.width; // technically an error
while(x < x2) pix[x++] = dataByte;
}
else pix[x++] = dataByte;

View File

@ -12,31 +12,31 @@ Image_LoadTGA
*/
bool Image_LoadTGA( const char *name, const byte *buffer, size_t filesize )
{
int x, y, pix_inc, row_inc;
int red, green, blue, alpha;
int runlen, alphabits;
byte *p, *pixbuf;
const byte *fin, *enddata;
byte palette[256*4];
int i, columns, rows, row_inc, row, col;
byte *buf_p, *pixbuf, *targa_rgba;
byte palette[256][4], red = 0, green = 0, blue = 0, alpha = 0;
int readpixelcount, pixelcount;
bool compressed;
tga_t targa_header;
if( filesize < sizeof( tga_t ))
return false;
fin = buffer;
enddata = fin + filesize;
buf_p = (byte *)buffer;
targa_header.id_length = *buf_p++;
targa_header.colormap_type = *buf_p++;
targa_header.image_type = *buf_p++;
targa_header.id_length = *fin++;
targa_header.colormap_type = *fin++;
targa_header.image_type = *fin++;
targa_header.colormap_index = BuffLittleShort( fin ); fin += 2;
targa_header.colormap_length = BuffLittleShort( fin ); fin += 2;
targa_header.colormap_size = *fin++;
targa_header.x_origin = BuffLittleShort( fin ); fin += 2;
targa_header.y_origin = BuffLittleShort( fin ); fin += 2;
targa_header.width = image.width = BuffLittleShort( fin ); fin += 2;
targa_header.height = image.height = BuffLittleShort( fin );fin += 2;
targa_header.colormap_index = buf_p[0] + buf_p[1] * 256; buf_p += 2;
targa_header.colormap_length = buf_p[0] + buf_p[1] * 256; buf_p += 2;
targa_header.colormap_size = *buf_p; buf_p += 1;
targa_header.x_origin = LittleShort( *((short *)buf_p )); buf_p += 2;
targa_header.y_origin = LittleShort( *((short *)buf_p )); buf_p += 2;
targa_header.width = image.width = LittleShort(*((short *)buf_p)); buf_p += 2;
targa_header.height = image.height = LittleShort(*((short *)buf_p)); buf_p += 2;
targa_header.pixel_size = *buf_p++;
targa_header.attributes = *buf_p++;
if( targa_header.id_length != 0 ) buf_p += targa_header.id_length; // skip TARGA image comment
// check for tga file
if(!Image_ValidSize( name )) return false;
@ -45,328 +45,155 @@ bool Image_LoadTGA( const char *name, const byte *buffer, size_t filesize )
image.num_mips = 1;
image.type = PF_RGBA_32; // always exctracted to 32-bit buffer
targa_header.pixel_size = *fin++;
targa_header.attributes = *fin++;
// end of header
// skip TARGA image comment ( usually 0 bytes )
fin += targa_header.id_length;
// read/skip the colormap if present (note: according to the TARGA spec it
// can be present even on truecolor or greyscale images, just not used by
// the image data)
if( targa_header.colormap_type )
if( targa_header.image_type == 1 || targa_header.image_type == 9 )
{
if( targa_header.colormap_length > 256 )
// uncompressed colormapped image
if( targa_header.pixel_size != 8 )
{
MsgDev( D_ERROR, "Image_LoadTGA: only up to 256 colormap_length supported\n" );
MsgDev( D_WARN, "Image_LoadTGA: (%s) Only 8 bit images supported for type 1 and 9\n", name );
return false;
}
if( targa_header.colormap_length != 256 )
{
MsgDev( D_WARN, "Image_LoadTGA: (%s) Only 8 bit colormaps are supported for type 1 and 9\n", name );
return false;
}
if( targa_header.colormap_index )
{
MsgDev( D_ERROR, "Image_LoadTGA: colormap_index not supported\n" );
MsgDev( D_WARN, "Image_LoadTGA: (%s) colormap_index is not supported for type 1 and 9\n", name );
return false;
}
if( targa_header.colormap_size == 24 )
{
for( x = 0; x < targa_header.colormap_length; x++ )
for( i = 0; i < targa_header.colormap_length; i++ )
{
palette[x*4+2] = *fin++;
palette[x*4+1] = *fin++;
palette[x*4+0] = *fin++;
palette[x*4+3] = 255;
palette[i][2] = *buf_p++;
palette[i][1] = *buf_p++;
palette[i][0] = *buf_p++;
palette[i][3] = 255;
}
}
else if( targa_header.colormap_size == 32 )
{
for( x = 0; x < targa_header.colormap_length; x++ )
for( i = 0; i < targa_header.colormap_length; i++ )
{
palette[x*4+2] = *fin++;
palette[x*4+1] = *fin++;
palette[x*4+0] = *fin++;
palette[x*4+3] = *fin++;
palette[i][2] = *buf_p++;
palette[i][1] = *buf_p++;
palette[i][0] = *buf_p++;
palette[i][3] = *buf_p++;
}
}
else
{
Msg("Image_LoadTGA: Only 32 and 24 bit colormap_size supported\n");
MsgDev( D_WARN, "Image_LoadTGA: (%s) only 24 and 32 bit colormaps are supported for type 1 and 9\n", name );
return false;
}
}
// check our pixel_size restrictions according to image_type
switch (targa_header.image_type & ~8)
else if( targa_header.image_type == 2 || targa_header.image_type == 10 )
{
case 2:
if( targa_header.pixel_size != 24 && targa_header.pixel_size != 32 )
// uncompressed or RLE compressed RGB
if( targa_header.pixel_size != 32 && targa_header.pixel_size != 24 )
{
MsgDev(D_ERROR, "LoadTGA: (%s) have unsupported pixel size '%d', for type '%d'\n", name, targa_header.pixel_size, targa_header.image_type );
MsgDev( D_WARN, "Image_LoadTGA: (%s) Only 32 or 24 bit images supported for type 2 and 10\n", name );
return false;
}
break;
case 3:
// set up a palette to make the loader easier
for( x = 0; x < 256; x++ )
{
palette[x*4+2] = x;
palette[x*4+1] = x;
palette[x*4+0] = x;
palette[x*4+3] = 255;
}
// fall through to colormap case
case 1:
}
else if( targa_header.image_type == 3 || targa_header.image_type == 11 )
{
// uncompressed greyscale
if( targa_header.pixel_size != 8 )
{
MsgDev( D_ERROR, "Image_LoadTGA: only 8bit pixel size for type 1, 3, 9, and 11 images supported\n" );
MsgDev( D_WARN, "Image_LoadTGA: (%s) Only 8 bit images supported for type 3 and 11\n", name );
return false;
}
break;
default:
MsgDev(D_ERROR, "Image_LoadTGA: (%s) is unsupported image type '%i'\n", name, targa_header.image_type );
return false;
}
if( targa_header.attributes & 0x10 )
{
MsgDev( D_WARN, "Image_LoadTGA: (%s): top right and bottom right origin are not supported\n", name );
return false;
}
columns = targa_header.width;
rows = targa_header.height;
// number of attribute bits per pixel, we only support 0 or 8
alphabits = targa_header.attributes & 0x0F;
if( alphabits != 8 && alphabits != 0 )
{
MsgDev( D_WARN, "LoadTGA: (%s) have invalid attributes '%i'\n", name, alphabits );
return false;
}
image.flags |= alphabits ? IMAGE_HAS_ALPHA : 0;
image.size = image.width * image.height * 4;
image.rgba = Mem_Alloc( Sys.imagepool, image.size );
targa_rgba = image.rgba = Mem_Alloc( Sys.imagepool, image.size );
// If bit 5 of attributes isn't set, the image has been stored from bottom to top
if(!(targa_header.attributes & 0x20))
// if bit 5 of attributes isn't set, the image has been stored from bottom to top
if( targa_header.attributes & 0x20 )
{
pixbuf = image.rgba + (image.height - 1) * image.width * 4;
row_inc = -image.width * 4 * 2;
pixbuf = targa_rgba;
row_inc = 0;
}
else
{
pixbuf = image.rgba;
row_inc = 0;
pixbuf = targa_rgba + ( rows - 1 ) * columns * 4;
row_inc = -columns * 4 * 2;
}
x = y = 0;
red = green = blue = alpha = 255;
pix_inc = 1;
if((targa_header.image_type & ~8) == 2) pix_inc = targa_header.pixel_size / 8;
switch( targa_header.image_type )
compressed = ( targa_header.image_type == 9 || targa_header.image_type == 10 || targa_header.image_type == 11 );
for( row = col = 0; row < rows; )
{
case 1: // colormapped, uncompressed
case 3: // greyscale, uncompressed
if( fin + image.width * image.height * pix_inc > enddata )
break;
for( y = 0; y < image.height; y++, pixbuf += row_inc )
{
for( x = 0; x < image.width; x++ )
{
p = palette + *fin++ * 4;
*pixbuf++ = p[0];
*pixbuf++ = p[1];
*pixbuf++ = p[2];
*pixbuf++ = p[3];
}
}
break;
case 2:
// BGR or BGRA, uncompressed
if( fin + image.width * image.height * pix_inc > enddata )
break;
if( targa_header.pixel_size == 32 && alphabits )
{
for( y = 0;y < image.height;y++, pixbuf += row_inc )
{
for( x = 0;x < image.width;x++, fin += pix_inc )
{
*pixbuf++ = fin[2];
*pixbuf++ = fin[1];
*pixbuf++ = fin[0];
*pixbuf++ = fin[3];
pixelcount = 0x10000;
readpixelcount = 0x10000;
if( fin[2] != fin[1] || fin[1] != fin[0] )
image.flags |= IMAGE_HAS_COLOR;
}
}
}
else // 24 bits
if( compressed )
{
for( y = 0; y < image.height; y++, pixbuf += row_inc )
{
for( x = 0;x < image.width; x++, fin += pix_inc )
{
*pixbuf++ = fin[2];
*pixbuf++ = fin[1];
*pixbuf++ = fin[0];
*pixbuf++ = 255;
if( fin[2] != fin[1] || fin[1] != fin[0] )
image.flags |= IMAGE_HAS_COLOR;
}
}
pixelcount = *buf_p++;
if( pixelcount & 0x80 ) // run-length packet
readpixelcount = 1;
pixelcount = 1 + ( pixelcount & 0x7f );
}
break;
case 9: // colormapped, RLE
case 11: // greyscale, RLE
for( y = 0; y < image.height; y++, pixbuf += row_inc )
while( pixelcount-- && ( row < rows ) )
{
for( x = 0; x < image.width; )
if( readpixelcount-- > 0 )
{
if( fin >= enddata ) break; // error - truncated file
runlen = *fin++;
if( runlen & 0x80 )
switch( targa_header.image_type )
{
// RLE - all pixels the same color
runlen += 1 - 0x80;
if( fin + pix_inc > enddata )
break; // error - truncated file
if( x + runlen > image.width )
break; // error - line exceeds width
p = palette + *fin++ * 4;
red = p[0];
green = p[1];
blue = p[2];
alpha = p[3];
for( ; runlen--; x++ )
case 1:
case 9:
// colormapped image
blue = *buf_p++;
red = palette[blue][0];
green = palette[blue][1];
alpha = palette[blue][3];
blue = palette[blue][2];
if( alpha != 255 ) image.flags |= IMAGE_HAS_ALPHA;
break;
case 2:
case 10:
// 24 or 32 bit image
blue = *buf_p++;
green = *buf_p++;
red = *buf_p++;
alpha = 255;
if( targa_header.pixel_size == 32 )
{
*pixbuf++ = red;
*pixbuf++ = green;
*pixbuf++ = blue;
*pixbuf++ = alpha;
}
}
else
{
// uncompressed - all pixels different color
runlen++;
if( fin + pix_inc * runlen > enddata )
break; // error - truncated file
if( x + runlen > image.width )
break; // error - line exceeds width
for( ; runlen--; x++ )
{
p = palette + *fin++ * 4;
*pixbuf++ = p[0];
*pixbuf++ = p[1];
*pixbuf++ = p[2];
*pixbuf++ = p[3];
if( p[0] != p[1] || p[1] != p[2] )
image.flags |= IMAGE_HAS_COLOR;
alpha = *buf_p++;
if( alpha != 255 )
image.flags |= IMAGE_HAS_ALPHA;
}
break;
case 3:
case 11:
// greyscale image
blue = green = red = *buf_p++;
alpha = 255;
break;
}
}
}
break;
case 10:
// BGR or BGRA, RLE
if( targa_header.pixel_size == 32 && alphabits )
{
for( y = 0; y < image.height; y++, pixbuf += row_inc )
{
for (x = 0; x < image.width; )
{
if( fin >= enddata ) break; // error - truncated file
runlen = *fin++;
if( runlen & 0x80 )
{
// RLE - all pixels the same color
runlen += 1 - 0x80;
if( fin + pix_inc > enddata ) break; // error - truncated file
if( x + runlen > image.width) break; // error - line exceeds width
red = fin[2];
green = fin[1];
blue = fin[0];
alpha = fin[3];
fin += pix_inc;
for( ; runlen--; x++)
{
*pixbuf++ = red;
*pixbuf++ = green;
*pixbuf++ = blue;
*pixbuf++ = alpha;
}
}
else
{
// uncompressed - all pixels different color
runlen++;
if( fin + pix_inc * runlen > enddata ) break; // error - truncated file
if( x + runlen > image.width ) break; // error - line exceeds width
for( ;runlen--; x++, fin += pix_inc )
{
*pixbuf++ = fin[2];
*pixbuf++ = fin[1];
*pixbuf++ = fin[0];
*pixbuf++ = fin[3];
if( fin[2] != fin[1] || fin[1] != fin[0] )
image.flags |= IMAGE_HAS_COLOR;
}
}
}
if( red != green || green != blue )
image.flags |= IMAGE_HAS_COLOR;
*pixbuf++ = red;
*pixbuf++ = green;
*pixbuf++ = blue;
*pixbuf++ = alpha;
if( ++col == columns )
{
// run spans across rows
row++;
col = 0;
pixbuf += row_inc;
}
}
else
{
for( y = 0; y < image.height; y++, pixbuf += row_inc )
{
for (x = 0; x < image.width; )
{
if( fin >= enddata ) break; // error - truncated file
runlen = *fin++;
if( runlen & 0x80 )
{
// RLE - all pixels the same color
runlen += 1 - 0x80;
if( fin + pix_inc > enddata ) break; // error - truncated file
if( x + runlen > image.width )break; // error - line exceeds width
red = fin[2];
green = fin[1];
blue = fin[0];
alpha = 255;
fin += pix_inc;
for( ;runlen--; x++ )
{
*pixbuf++ = red;
*pixbuf++ = green;
*pixbuf++ = blue;
*pixbuf++ = alpha;
}
}
else
{
// uncompressed - all pixels different color
runlen++;
if( fin + pix_inc * runlen > enddata ) break; // error - truncated file
if( x + runlen > image.width ) break; // error - line exceeds width
for ( ; runlen--; x++, fin += pix_inc)
{
*pixbuf++ = fin[2];
*pixbuf++ = fin[1];
*pixbuf++ = fin[0];
*pixbuf++ = 255;
if( fin[2] != fin[1] || fin[1] != fin[0] )
image.flags |= IMAGE_HAS_COLOR;
}
}
}
}
}
break;
// unknown image_type
default: return false;
}
return true;
}

View File

@ -615,12 +615,12 @@ bool Image_Copy8bitRGBA( const byte *in, byte *out, int pixels )
if( !image.d_currentpal )
{
MsgDev(D_ERROR,"Image_Copy8bitRGBA: no palette set\n");
MsgDev( D_ERROR, "Image_Copy8bitRGBA: no palette set\n" );
return false;
}
if( !in )
{
MsgDev(D_ERROR,"Image_Copy8bitRGBA: no input image\n");
MsgDev( D_ERROR, "Image_Copy8bitRGBA: no input image\n" );
return false;
}
@ -1181,11 +1181,11 @@ byte *Image_FloodInternal( const byte *indata, int inwidth, int inheight, int ou
Image_Flip
================
*/
byte *Image_FlipInternal( const byte *in, int *srcwidth, int *srcheight, int type, int flags )
byte *Image_FlipInternal( const byte *in, word *srcwidth, word *srcheight, int type, int flags )
{
int i, x, y;
int width = *srcwidth;
int height = *srcheight;
word width = *srcwidth;
word height = *srcheight;
int samples = PFDesc[type].bpp;
bool flip_x = ( flags & IMAGE_FLIP_X ) ? true : false;
bool flip_y = ( flags & IMAGE_FLIP_Y ) ? true : false;
@ -1290,6 +1290,7 @@ rgbdata_t *Image_DecompressInternal( rgbdata_t *pic )
case PF_RGBA_GN:
case PF_RGBA_32:
case PF_ABGR_128F:
pic->type = PF_RGBA_32;
return pic; // just change type
}
@ -1303,15 +1304,17 @@ rgbdata_t *Image_DecompressInternal( rgbdata_t *pic )
image.num_mips = 0; // clear mipcount
buf = image.rgba;
for( i = 0, offset = 0; i < numsides; i++, buf += offset )
for( i = 0, offset = 0; i < numsides; i++ )
{
Image_SetPixelFormat( image.curwidth, image.curheight, image.curdepth );
offset = image.SizeOfFile; // move pointer
Image_DecompressDDS( buf, target + i );
buf += offset;
}
// now we can change type to RGBA
if( image.filter != CB_HINT_NO ) image.flags &= ~IMAGE_CUBEMAP; // side extracted
if( image.filter != CB_HINT_NO )
image.flags &= ~IMAGE_CUBEMAP; // side extracted
image.type = PF_RGBA_32;
FS_FreeImage( pic ); // free original

View File

@ -111,7 +111,7 @@ size_t Image_VTFCalcMipmapSize( vtf_t *hdr, int mipNum )
================
Image_VTFCalcImageSize
main image size not included header or lowres
main image size without header and lowres
================
*/
size_t Image_VTFCalcImageSize( vtf_t *hdr, bool oldformat )
@ -201,7 +201,7 @@ void Image_VTFSwapBuffer( vtf_t *hdr, const byte *input, size_t input_size, bool
Mem_Copy((byte *)input, image.tempbuffer, out_size );
if( ignore_mips ) image.num_mips = 1;
if( texture ) Mem_Free( texture );
image.size = out_size; // merge out size
image.size = out_size; // merge out size (minus envmap or identical)
}
/*
@ -235,7 +235,8 @@ bool Image_LoadVTF( const char *name, const byte *buffer, size_t filesize )
}
i = LittleLong( vtf.ver_minor );
if( i == VTF_SUBVERSION0 && vtf.hdr_size == 64 ) oldformat = true; // 7.0 hasn't envmap for cubemap images
if( i == VTF_SUBVERSION0 && vtf.hdr_size == 64 )
oldformat = true; // 7.0 hasn't envmap for cubemap images
// all other subversions are valid
image.width = LittleShort( vtf.width );

View File

@ -154,12 +154,12 @@ bool Image_LoadWAL( const char *name, const byte *buffer, size_t filesize )
int i, flags, value, contents; // wal additional parms
const byte *fin;
if( filesize < (int)sizeof(wal))
if( filesize < (int)sizeof( wal ))
{
MsgDev( D_ERROR, "Image_LoadWAL: file (%s) have invalid size\n", name );
return false;
}
Mem_Copy( &wal, buffer, sizeof(wal));
Mem_Copy( &wal, buffer, sizeof( wal ));
flags = LittleLong(wal.flags);
value = LittleLong(wal.value);
@ -215,7 +215,7 @@ bool Image_LoadFLT( const char *name, const byte *buffer, size_t filesize )
if( Sys.app_name == HOST_NORMAL && !fs_wadsupport->integer )
return false;
if(filesize < (int)sizeof(flat))
if(filesize < (int)sizeof( flat ))
{
MsgDev( D_ERROR, "Image_LoadFLAT: file (%s) have invalid size\n", name );
return false;
@ -322,7 +322,7 @@ bool Image_LoadLMP( const char *name, const byte *buffer, size_t filesize )
else
{
fin = (byte *)buffer;
Mem_Copy(&lmp, fin, sizeof(lmp));
Mem_Copy( &lmp, fin, sizeof( lmp ));
image.width = LittleLong( lmp.width );
image.height = LittleLong( lmp.height );
rendermode = LUMP_NORMAL;
@ -379,11 +379,11 @@ bool Image_LoadMIP( const char *name, const byte *buffer, size_t filesize )
return false;
}
Mem_Copy( &mip, buffer, sizeof(mip));
image.width = LittleLong(mip.width);
image.height = LittleLong(mip.height);
Mem_Copy( &mip, buffer, sizeof( mip ));
image.width = LittleLong( mip.width );
image.height = LittleLong( mip.height );
if(!Image_ValidSize( name )) return false;
for(i = 0; i < 4; i++) ofs[i] = LittleLong(mip.offsets[i]);
for( i = 0; i < 4; i++ ) ofs[i] = LittleLong( mip.offsets[i] );
pixels = image.width * image.height;
image.depth = 1;

64
launch/launch.plg Normal file
View File

@ -0,0 +1,64 @@
<html>
<body>
<pre>
<h1>Build Log</h1>
<h3>
--------------------Configuration: launch - Win32 Release--------------------
</h3>
<h3>Command Lines</h3>
Creating temporary file "C:\DOCUME~1\MIKE~1.MIK\LOCALS~1\Temp\RSPC7.tmp" with contents
[
/nologo /MD /W3 /GX /O2 /I "./" /I "imagelib" /I "../public" /I "../common" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /Fo"..\temp\launch\!release/" /Fd"..\temp\launch\!release/" /FD /c
"D:\Xash3D\src_main\launch\memlib.c"
]
Creating command line "cl.exe @C:\DOCUME~1\MIKE~1.MIK\LOCALS~1\Temp\RSPC7.tmp"
Creating temporary file "C:\DOCUME~1\MIKE~1.MIK\LOCALS~1\Temp\RSPC8.tmp" with contents
[
zlib.lib png.lib user32.lib gdi32.lib advapi32.lib winmm.lib /nologo /dll /pdb:none /machine:I386 /nodefaultlib:"libc.lib" /out:"..\temp\launch\!release/launch.dll" /implib:"..\temp\launch\!release/launch.lib" /libpath:"./imagelib" /opt:nowin98
"\Xash3D\src_main\temp\launch\!release\cmd.obj"
"\Xash3D\src_main\temp\launch\!release\console.obj"
"\Xash3D\src_main\temp\launch\!release\cpuinfo.obj"
"\Xash3D\src_main\temp\launch\!release\crclib.obj"
"\Xash3D\src_main\temp\launch\!release\cvar.obj"
"\Xash3D\src_main\temp\launch\!release\export.obj"
"\Xash3D\src_main\temp\launch\!release\filesystem.obj"
"\Xash3D\src_main\temp\launch\!release\img_bmp.obj"
"\Xash3D\src_main\temp\launch\!release\img_dds.obj"
"\Xash3D\src_main\temp\launch\!release\img_jpg.obj"
"\Xash3D\src_main\temp\launch\!release\img_main.obj"
"\Xash3D\src_main\temp\launch\!release\img_pcx.obj"
"\Xash3D\src_main\temp\launch\!release\img_png.obj"
"\Xash3D\src_main\temp\launch\!release\img_tga.obj"
"\Xash3D\src_main\temp\launch\!release\img_utils.obj"
"\Xash3D\src_main\temp\launch\!release\img_vtf.obj"
"\Xash3D\src_main\temp\launch\!release\img_wad.obj"
"\Xash3D\src_main\temp\launch\!release\memlib.obj"
"\Xash3D\src_main\temp\launch\!release\network.obj"
"\Xash3D\src_main\temp\launch\!release\parselib.obj"
"\Xash3D\src_main\temp\launch\!release\patch.obj"
"\Xash3D\src_main\temp\launch\!release\stdlib.obj"
"\Xash3D\src_main\temp\launch\!release\system.obj"
"\Xash3D\src_main\temp\launch\!release\utils.obj"
]
Creating command line "link.exe @C:\DOCUME~1\MIKE~1.MIK\LOCALS~1\Temp\RSPC8.tmp"
Creating temporary file "C:\DOCUME~1\MIKE~1.MIK\LOCALS~1\Temp\RSPC9.bat" with contents
[
@echo off
copy \Xash3D\src_main\temp\launch\!release\launch.dll "D:\Xash3D\bin\launch.dll"
]
Creating command line "C:\DOCUME~1\MIKE~1.MIK\LOCALS~1\Temp\RSPC9.bat"
Compiling...
memlib.c
Linking...
Creating library ..\temp\launch\!release/launch.lib and object ..\temp\launch\!release/launch.exp
<h3>Output Window</h3>
Performing Custom Build Step on \Xash3D\src_main\temp\launch\!release\launch.dll
‘ª®¯¨à®¢ ­® ä ©«®¢: 1.
<h3>Results</h3>
launch.dll - 0 error(s), 0 warning(s)
</pre>
</body>
</html>

View File

@ -1408,9 +1408,10 @@ void _mem_printlist( size_t minallocationsize )
Mem_Check();
Msg("memory pool list:\n"" ^3size name\n");
for (pool = poolchain; pool; pool = pool->next)
for( pool = poolchain; pool; pool = pool->next )
{
Msg("%5luk (%5luk actual) %s (%+3li byte change)\n", (dword) ((pool->totalsize + 1023) / 1024), (dword)((pool->realsize + 1023) / 1024), pool->name, (long)pool->totalsize - pool->lastchecksize );
// poolnames can contain color symbols, make sure what color is reset
Msg( "%5luk (%5luk actual) %s (^7%+3li byte change)\n", (dword) ((pool->totalsize + 1023) / 1024), (dword)((pool->realsize + 1023) / 1024), pool->name, (long)pool->totalsize - pool->lastchecksize );
pool->lastchecksize = pool->totalsize;
for( mem = pool->chain; mem; mem = mem->next )
if( mem->size >= minallocationsize )

View File

@ -467,10 +467,16 @@ void BSP_LoadPlanes( lump_t *l )
for( i = 0; i < count; i++, in++, out++ )
{
for( j = 0; j < 3; j++ )
out->normal[j] = LittleFloat(in->normal[j]);
out->signbits = 0;
out->type = PLANE_NONAXIAL;
for( j = 0; j < 3; j++ )
{
out->normal[j] = LittleFloat( in->normal[j] );
if( out->normal[j] < 0.0f ) out->signbits |= (1<<j);
if( out->normal[j] == 1.0f ) out->type = j;
}
out->dist = LittleFloat( in->dist );
PlaneClassify( out ); // automatic plane classify
}
}

View File

@ -119,24 +119,6 @@ typedef struct trace_s
};
} trace_t;
_inline void PlaneClassify( cplane_t *p )
{
// for optimized plane comparisons
if( p->normal[0] == 1 || p->normal[0] == -1 )
p->type = PLANE_X;
else if( p->normal[1] == 1 || p->normal[1] == -1 )
p->type = PLANE_Y;
else if( p->normal[2] == 1 || p->normal[2] == -1 )
p->type = PLANE_Z;
else p->type = 3; // needs alternate calc
// for BoxOnPlaneSide
p->signbits = 0;
if( p->normal[0] < 0 ) p->signbits |= 1;
if( p->normal[1] < 0 ) p->signbits |= 2;
if( p->normal[2] < 0 ) p->signbits |= 4;
}
/*
=================
CategorizePlane

View File

@ -372,12 +372,12 @@ typedef enum
typedef struct rgbdata_s
{
int width; // image width
int height; // image height
word depth; // multi-layer volume
word width; // image width
word height; // image height
word depth; // multi-layer volume
byte numMips; // mipmap count
byte bitsCount; // RGB bits count
word type; // compression type
uint type; // compression type
uint flags; // misc image flags
byte *palette; // palette if present
byte *buffer; // image buffer

View File

@ -586,7 +586,7 @@ typedef struct
========================================================================
*/
#define IDMD3HEADER (('3'<<24)+('P'<<16)+('D'<<8)+'I') // little-endian "IDP3"
#define ALIASMODHEADER (('3'<<24)+('P'<<16)+('D'<<8)+'I') // little-endian "IDP3"
#define MD3_ALIAS_VERSION 15
#define MD3_ALIAS_MAX_LODS 4
@ -667,119 +667,6 @@ typedef struct
int ofs_end;
} dmd3header_t;
/*
========================================================================
.SKM and .SKP models file formats
========================================================================
*/
#define SKMHEADER (('1'<<24)+('M'<<16)+('K'<<8)+'S') // little-endian "SKM1"
#define SKM_MAX_NAME 64
#define SKM_MAX_MESHES 32
#define SKM_MAX_FRAMES 65536
#define SKM_MAX_TRIS 65536
#define SKM_MAX_VERTS (SKM_MAX_TRIS * 3)
#define SKM_MAX_BONES 256
#define SKM_MAX_SHADERS 256
#define SKM_MAX_FILESIZE 16777216
#define SKM_MAX_ATTACHMENTS SKM_MAX_BONES
#define SKM_MAX_LODS 4
// model format related flags
#define SKM_BONEFLAG_ATTACH 1
#define SKM_MODELTYPE 2 // (hierarchical skeletal pose)
typedef struct
{
char id[4]; // SKMHEADER
uint type;
uint filesize; // size of entire model file
uint num_bones;
uint num_meshes;
// this offset is relative to the file
uint ofs_meshes;
} dskmheader_t;
// there may be more than one of these
typedef struct
{
// these offsets are relative to the file
char shadername[SKM_MAX_NAME]; // name of the shader to use
char meshname[SKM_MAX_NAME];
uint num_verts;
uint num_tris;
uint num_references;
uint ofs_verts;
uint ofs_texcoords;
uint ofs_indices;
uint ofs_references;
} dskmmesh_t;
// one or more of these per vertex
typedef struct
{
float origin[3]; // vertex location (these blend)
float influence; // influence fraction (these must add up to 1)
float normal[3]; // surface normal (these blend)
uint bonenum; // number of the bone
} dskmbonevert_t;
// variable size, parsed sequentially
typedef struct
{
uint numweights;
// immediately followed by 1 or more ddpmbonevert_t structures
dskmbonevert_t verts[1];
} dskmvertex_t;
typedef struct
{
float st[2];
} dskmcoord_t;
typedef struct
{
char id[4]; // SKMHEADER
uint type;
uint filesize; // size of entire model file
uint num_bones;
uint num_frames;
// these offsets are relative to the file
uint ofs_bones;
uint ofs_frames;
} dskpheader_t;
// one per bone
typedef struct
{
// name examples: upperleftarm leftfinger1 leftfinger2 hand, etc
char name[SKM_MAX_NAME];
signed int parent; // parent bone number
uint flags; // flags for the bone
} dskpbone_t;
typedef struct
{
float quat[4];
float origin[3];
} dskpbonepose_t;
// immediately followed by bone positions for the frame
typedef struct
{
// name examples: idle_1 idle_2 idle_3 shoot_1 shoot_2 shoot_3, etc
char name[SKM_MAX_NAME];
uint ofs_bonepositions;
} dskpframe_t;
/*
==============================================================================
SAVE FILE

View File

@ -70,7 +70,7 @@ typedef struct render_exp_s
// prepare frame to rendering
bool (*AddRefEntity)( edict_t *pRefEntity, int ed_type, float lerp );
bool (*AddDynLight)( vec3_t org, vec3_t color, float intensity );
bool (*AddDynLight)( vec3_t org, vec3_t color, float intensity, shader_t shader );
bool (*AddPolygon)( const poly_t *poly );
bool (*AddLightStyle)( int stylenum, vec3_t color );
void (*ClearScene)( void );

View File

@ -72,279 +72,6 @@ static void Mod_AliasBuildMeshesForFrame0( ref_model_t *mod )
}
}
#ifdef QUAKE2_JUNK
/*
==============================================================================
MD2 MODELS
==============================================================================
*/
/*
=================
Mod_AliasCalculateVertexNormals
=================
*/
static void Mod_AliasCalculateVertexNormals( int numElems, elem_t *elems, int numVerts, maliasvertex_t *v )
{
int i, j, k, vertRemap[MD2_MAX_VERTS];
vec3_t dir1, dir2, normal, trnormals[MD2_MAX_TRIANGLES];
int numUniqueVerts, uniqueVerts[MD2_MAX_VERTS];
byte latlongs[MD2_MAX_VERTS][2];
// count unique verts
for( i = 0, numUniqueVerts = 0; i < numVerts; i++ )
{
for( j = 0; j < numUniqueVerts; j++ )
{
if( VectorCompare( v[uniqueVerts[j]].point, v[i].point ) )
{
vertRemap[i] = j;
break;
}
}
if( j == numUniqueVerts )
{
vertRemap[i] = numUniqueVerts;
uniqueVerts[numUniqueVerts++] = i;
}
}
for( i = 0, j = 0; i < numElems; i += 3, j++ )
{
// calculate two mostly perpendicular edge directions
VectorSubtract( v[elems[i+0]].point, v[elems[i+1]].point, dir1 );
VectorSubtract( v[elems[i+2]].point, v[elems[i+1]].point, dir2 );
// we have two edge directions, we can calculate a third vector from
// them, which is the direction of the surface normal
CrossProduct( dir1, dir2, trnormals[j] );
VectorNormalize( trnormals[j] );
}
// sum all triangle normals
for( i = 0; i < numUniqueVerts; i++ )
{
VectorClear( normal );
for( j = 0, k = 0; j < numElems; j += 3, k++ )
{
if( vertRemap[elems[j+0]] == i || vertRemap[elems[j+1]] == i || vertRemap[elems[j+2]] == i )
VectorAdd( normal, trnormals[k], normal );
}
VectorNormalize( normal );
NormToLatLong( normal, latlongs[i] );
}
// copy normals back
for( i = 0; i < numVerts; i++ )
*(short *)v[i].latlong = *(short *)latlongs[vertRemap[i]];
}
/*
=================
Mod_LoadAliasMD2Model
=================
*/
void Mod_LoadAliasMD2Model( ref_model_t *mod, ref_model_t *parent, void *buffer )
{
int i, j, k;
int version, framesize;
float skinwidth, skinheight;
int numverts, numelems;
int indremap[MD2_MAX_TRIANGLES*3];
elem_t ptempelem[MD2_MAX_TRIANGLES*3], ptempstelem[MD2_MAX_TRIANGLES*3];
dmd2_t *pinmodel;
dstvert_t *pinst;
dtriangle_t *pintri;
daliasframe_t *pinframe;
elem_t *poutelem;
maliasmodel_t *poutmodel;
maliasmesh_t *poutmesh;
vec2_t *poutcoord;
maliasframe_t *poutframe;
maliasvertex_t *poutvertex;
maliasskin_t *poutskin;
pinmodel = ( dmd2_t * )buffer;
version = LittleLong( pinmodel->version );
framesize = LittleLong( pinmodel->framesize );
if( version != MD2_ALIAS_VERSION )
Host_Error( ERR_DROP, "%s has wrong version number (%i should be %i)",
mod->name, version, MD2_ALIAS_VERSION );
mod->type = mod_alias;
mod->aliasmodel = poutmodel = Mod_Malloc( mod, sizeof( maliasmodel_t ) );
mod->radius = 0;
ClearBounds( mod->mins, mod->maxs );
// byte swap the header fields and sanity check
skinwidth = LittleLong( pinmodel->skinwidth );
skinheight = LittleLong( pinmodel->skinheight );
if( skinwidth <= 0 )
Host_Error( ERR_DROP, "model %s has invalid skin width", mod->name );
if( skinheight <= 0 )
Host_Error( ERR_DROP, "model %s has invalid skin height", mod->name );
poutmodel->numframes = LittleLong( pinmodel->num_frames );
poutmodel->numskins = LittleLong( pinmodel->num_skins );
if( poutmodel->numframes > MD2_MAX_FRAMES )
Host_Error( ERR_DROP, "model %s has too many frames", mod->name );
else if( poutmodel->numframes <= 0 )
Host_Error( ERR_DROP, "model %s has no frames", mod->name );
if( poutmodel->numskins > MD2_MAX_SKINS )
Host_Error( ERR_DROP, "model %s has too many skins", mod->name );
else if( poutmodel->numskins < 0 )
Host_Error( ERR_DROP, "model %s has invalid number of skins", mod->name );
poutmodel->numtags = 0;
poutmodel->tags = NULL;
poutmodel->nummeshes = 1;
poutmesh = poutmodel->meshes = Mod_Malloc( mod, sizeof( maliasmesh_t ) );
Q_strncpyz( poutmesh->name, "default", MD3_MAX_PATH );
poutmesh->numverts = LittleLong( pinmodel->num_xyz );
poutmesh->numtris = LittleLong( pinmodel->num_tris );
if( poutmesh->numverts <= 0 )
Host_Error( "model %s has no vertices\n", mod->name );
else if( poutmesh->numverts > MD2_MAX_VERTS )
Host_Error( "model %s has too many vertices\n", mod->name );
if( poutmesh->numtris > MD2_MAX_TRIANGLES )
Host_Error( "model %s has too many triangles\n", mod->name );
else if( poutmesh->numtris <= 0 )
Host_Error( "model %s has no triangles\n", mod->name );
numelems = poutmesh->numtris * 3;
poutelem = poutmesh->elems = Mod_Malloc( mod, numelems * sizeof( elem_t ) );
//
// load triangle lists
//
pintri = ( dtriangle_t * )( ( byte * )pinmodel + LittleLong( pinmodel->ofs_tris ) );
pinst = ( dstvert_t * ) ( ( byte * )pinmodel + LittleLong( pinmodel->ofs_st ) );
for( i = 0, k = 0; i < poutmesh->numtris; i++, k += 3 )
{
for( j = 0; j < 3; j++ )
{
ptempelem[k+j] = ( elem_t )LittleShort( pintri[i].index_xyz[j] );
ptempstelem[k+j] = ( elem_t )LittleShort( pintri[i].index_st[j] );
}
}
//
// build list of unique vertexes
//
numverts = 0;
memset( indremap, -1, MD2_MAX_TRIANGLES * 3 * sizeof( int ) );
for( i = 0; i < numelems; i++ )
{
if( indremap[i] != -1 )
continue;
// remap duplicates
for( j = i + 1; j < numelems; j++ )
{
if( ( ptempelem[j] == ptempelem[i] )
&& ( pinst[ptempstelem[j]].s == pinst[ptempstelem[i]].s )
&& ( pinst[ptempstelem[j]].t == pinst[ptempstelem[i]].t ) )
{
indremap[j] = i;
poutelem[j] = numverts;
}
}
// add unique vertex
indremap[i] = i;
poutelem[i] = numverts++;
}
MsgDev( "%s: remapped %i verts to %i (%i tris)\n", mod->name, poutmesh->numverts, numverts, poutmesh->numtris );
poutmesh->numverts = numverts;
//
// load base s and t vertices
//
poutcoord = poutmesh->stArray = Mod_Malloc( mod, numverts * sizeof( vec2_t ) );
for( i = 0; i < numelems; i++ )
{
if( indremap[i] == i )
{
poutcoord[poutelem[i]][0] = ( (float)LittleShort( pinst[ptempstelem[i]].s ) + 0.5 ) / skinwidth;
poutcoord[poutelem[i]][1] = ( (float)LittleShort( pinst[ptempstelem[i]].t ) + 0.5 ) / skinheight;
}
}
//
// load the frames
//
poutframe = poutmodel->frames = Mod_Malloc( mod, poutmodel->numframes * ( sizeof( maliasframe_t ) + numverts * sizeof( maliasvertex_t ) ) );
poutvertex = poutmesh->vertexes = ( maliasvertex_t *)( ( byte * )poutframe + poutmodel->numframes * sizeof( maliasframe_t ) );
for( i = 0; i < poutmodel->numframes; i++, poutframe++, poutvertex += numverts )
{
pinframe = ( daliasframe_t * )( ( byte * )pinmodel + LittleLong( pinmodel->ofs_frames ) + i * framesize );
for( j = 0; j < 3; j++ )
{
poutframe->scale[j] = LittleFloat( pinframe->scale[j] );
poutframe->translate[j] = LittleFloat( pinframe->translate[j] );
}
for( j = 0; j < numelems; j++ )
{ // verts are all 8 bit, so no swapping needed
if( indremap[j] == j )
{
poutvertex[poutelem[j]].point[0] = (short)pinframe->verts[ptempelem[j]].v[0];
poutvertex[poutelem[j]].point[1] = (short)pinframe->verts[ptempelem[j]].v[1];
poutvertex[poutelem[j]].point[2] = (short)pinframe->verts[ptempelem[j]].v[2];
}
}
Mod_AliasCalculateVertexNormals( numelems, poutelem, numverts, poutvertex );
VectorCopy( poutframe->translate, poutframe->mins );
VectorMA( poutframe->translate, 255, poutframe->scale, poutframe->maxs );
poutframe->radius = RadiusFromBounds( poutframe->mins, poutframe->maxs );
mod->radius = max( mod->radius, poutframe->radius );
AddPointToBounds( poutframe->mins, mod->mins, mod->maxs );
AddPointToBounds( poutframe->maxs, mod->mins, mod->maxs );
}
//
// build S and T vectors for frame 0
//
Mod_AliasBuildMeshesForFrame0( mod );
// register all skins
poutskin = poutmodel->skins = Mod_Malloc( mod, poutmodel->numskins * sizeof( maliasskin_t ) );
for( i = 0; i < poutmodel->numskins; i++, poutskin++ )
{
if( LittleLong( pinmodel->ofs_skins ) == -1 )
continue;
poutskin->shader = R_RegisterSkin( ( char * )pinmodel + LittleLong( pinmodel->ofs_skins ) + i*MD2_MAX_SKINNAME );
}
mod->touchFrame = tr.registration_sequence; // register model
}
#endif
/*
==============================================================================
@ -469,9 +196,9 @@ void Mod_LoadAliasMD3Model( ref_model_t *mod, ref_model_t *parent, const void *b
poutmesh = poutmodel->meshes = ( maliasmesh_t * )buf;
for( i = 0; i < poutmodel->nummeshes; i++, poutmesh++ )
{
if( pinmesh->id != IDMD3HEADER )
if( pinmesh->id != ALIASMODHEADER )
Host_Error( "mesh %s in model %s has wrong id (%s should be %s)\n",
pinmesh->name, mod->name, pinmesh->id, IDMD3HEADER );
pinmesh->name, mod->name, pinmesh->id, ALIASMODHEADER );
com.strncpy( poutmesh->name, pinmesh->name, MD3_MAX_PATH );
@ -505,7 +232,8 @@ void Mod_LoadAliasMD3Model( ref_model_t *mod, ref_model_t *parent, const void *b
poutskin = poutmesh->skins = ( maliasskin_t * )buf; buf += sizeof( maliasskin_t ) * poutmesh->numskins;
for( j = 0; j < poutmesh->numskins; j++, pinskin++, poutskin++ )
{
poutskin->shader = R_RegisterSkin( pinskin->name );
FS_StripExtension( pinskin->name );
poutskin->shader = R_LoadShader( pinskin->name, SHADER_ALIAS, false, 0, SHADER_INVALID );
R_DeformvBBoxForShader( poutskin->shader, ebbox );
}
@ -1006,10 +734,6 @@ bool R_CullAliasModel( ref_entity_t *e )
shader = R_FindShaderForSkinFile( e->customSkin, mesh->name );
else if( e->customShader )
shader = e->customShader;
#ifdef QUAKE2_JUNK
else if( ( e->skinNum >= 0 ) && ( e->skinNum < aliasmodel->numskins ) )
shader = aliasmodel->skins[e->skinNum].shader;
#endif
else if( mesh->numskins )
{
for( j = 0; j < mesh->numskins; j++ )
@ -1089,10 +813,6 @@ void R_AddAliasModelToList( ref_entity_t *e )
shader = R_FindShaderForSkinFile( e->customSkin, mesh->name );
else if( e->customShader )
shader = e->customShader;
#ifdef QUAKE2_JUNK
else if( ( e->skinNum >= 0 ) && ( e->skinNum < aliasmodel->numskins ) )
shader = aliasmodel->skins[e->skinNum].shader;
#endif
else if( mesh->numskins )
{
for( j = 0; j < mesh->numskins; j++ )

View File

@ -22,22 +22,22 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "mathlib.h"
#include "quatlib.h"
#define FTABLE_SIZE_POW 10
#define FTABLE_SIZE ( 1<<FTABLE_SIZE_POW )
#define FTABLE_CLAMP( x ) ( ( (unsigned int)( ( x )*FTABLE_SIZE ) & ( FTABLE_SIZE-1 ) ) )
#define FTABLE_EVALUATE( table, x ) ( ( table )[FTABLE_CLAMP( x )] )
#define FTABLE_SIZE_POW 10
#define FTABLE_SIZE ( 1<<FTABLE_SIZE_POW )
#define FTABLE_CLAMP( x ) (((uint)( ( x )*FTABLE_SIZE ) & ( FTABLE_SIZE-1 )))
#define FTABLE_EVALUATE( table, x ) (( table )[FTABLE_CLAMP( x )] )
static float r_sintable[FTABLE_SIZE];
static float r_sintableByte[256];
static float r_triangletable[FTABLE_SIZE];
static float r_squaretable[FTABLE_SIZE];
static float r_sawtoothtable[FTABLE_SIZE];
static float r_inversesawtoothtable[FTABLE_SIZE];
static float r_sintable[FTABLE_SIZE];
static float r_sintableByte[256];
static float r_triangletable[FTABLE_SIZE];
static float r_squaretable[FTABLE_SIZE];
static float r_sawtoothtable[FTABLE_SIZE];
static float r_inversesawtoothtable[FTABLE_SIZE];
#define NOISE_SIZE 256
#define NOISE_VAL( a ) r_noiseperm[( a ) & ( NOISE_SIZE - 1 )]
#define NOISE_INDEX( x, y, z, t ) NOISE_VAL( x + NOISE_VAL( y + NOISE_VAL( z + NOISE_VAL( t ) ) ) )
#define NOISE_LERP( a, b, w ) ( a * ( 1.0f - w ) + b * w )
#define NOISE_SIZE 256
#define NOISE_VAL( a ) r_noiseperm[( a ) & ( NOISE_SIZE - 1 )]
#define NOISE_INDEX( x, y, z, t ) NOISE_VAL( x + NOISE_VAL( y + NOISE_VAL( z + NOISE_VAL( t ) ) ) )
#define NOISE_LERP( a, b, w ) ( a * ( 1.0f - w ) + b * w )
static float r_noisetable[NOISE_SIZE];
static int r_noiseperm[NOISE_SIZE];
@ -49,7 +49,6 @@ elem_t inElemsArray[MAX_ARRAY_ELEMENTS];
vec2_t inCoordsArray[MAX_ARRAY_VERTS];
vec2_t inLightmapCoordsArray[LM_STYLES][MAX_ARRAY_VERTS];
rgba_t inColorsArray[LM_STYLES][MAX_ARRAY_VERTS];
vec2_t tUnitCoordsArray[MAX_TEXTURE_UNITS][MAX_ARRAY_VERTS];
elem_t *elemsArray;
@ -76,8 +75,8 @@ static int r_lightmapStyleNum[MAX_TEXTURE_UNITS];
static superLightStyle_t *r_superLightStyle;
static const meshbuffer_t *r_currentMeshBuffer;
static unsigned int r_currentDlightBits;
static unsigned int r_currentShadowBits;
static uint r_currentDlightBits;
static uint r_currentShadowBits;
static const ref_shader_t *r_currentShader;
static double r_currentShaderTime;
static int r_currentShaderState;
@ -119,6 +118,7 @@ void R_BackendInit( void )
r_triangleOutlines = false;
R_ClearArrays();
R_InitVertexBuffers();
R_BackendResetPassMask();
@ -228,6 +228,7 @@ R_BackendShutdown
*/
void R_BackendShutdown( void )
{
R_ShutdownVertexBuffers ();
}
/*
@ -428,19 +429,17 @@ R_LockArrays
*/
void R_LockArrays( int numverts )
{
if( r_arraysLocked )
return;
if( r_arraysLocked ) return;
if( !GL_Support( R_ARB_VERTEX_BUFFER_OBJECT_EXT ))
R_UpdateVertexBuffer( tr.vertexBuffer, vertsArray, numverts * sizeof( vec4_t ));
pglVertexPointer( 3, GL_FLOAT, 16, tr.vertexBuffer->pointer );
if( r_features & MF_ENABLENORMALS )
{
pglVertexPointer( 3, GL_FLOAT, 16, vertsArray );
if( r_features & MF_ENABLENORMALS )
{
r_normalsEnabled = true;
pglEnableClientState( GL_NORMAL_ARRAY );
pglNormalPointer( GL_FLOAT, 16, normalsArray );
}
r_normalsEnabled = true;
R_UpdateVertexBuffer( tr.normalBuffer, normalsArray, numverts * sizeof( vec4_t ));
pglEnableClientState( GL_NORMAL_ARRAY );
pglNormalPointer( GL_FLOAT, 16, tr.normalBuffer->pointer );
}
if( GL_Support( R_CUSTOM_VERTEX_ARRAY_EXT ))
@ -509,16 +508,15 @@ void R_FlushArrays( void )
else if( r_backacc.numColors > 1 )
{
pglEnableClientState( GL_COLOR_ARRAY );
if( !GL_Support( R_ARB_VERTEX_BUFFER_OBJECT_EXT ))
pglColorPointer( 4, GL_UNSIGNED_BYTE, 0, colorArray );
R_UpdateVertexBuffer( tr.colorsBuffer, colorArray, r_backacc.numVerts * sizeof( rgba_t ));
pglColorPointer( 4, GL_UNSIGNED_BYTE, 0, tr.colorsBuffer->pointer );
}
if( r_drawelements->integer || glState.in2DMode || RI.refdef.rdflags & RDF_NOWORLDMODEL )
{
if( GL_Support( R_DRAW_RANGEELEMENTS_EXT ))
pglDrawRangeElementsEXT( GL_TRIANGLES, 0, r_backacc.numVerts, r_backacc.numElems, GL_UNSIGNED_INT, elemsArray );
else
pglDrawElements( GL_TRIANGLES, r_backacc.numElems, GL_UNSIGNED_INT, elemsArray );
else pglDrawElements( GL_TRIANGLES, r_backacc.numElems, GL_UNSIGNED_INT, elemsArray );
}
if( r_backacc.numColors > 1 )
@ -934,22 +932,15 @@ static bool R_VertexTCBase( const ref_stage_t *pass, int unit, mat4x4_t matrix )
case TCGEN_BASE:
GL_DisableAllTexGens();
if( !GL_Support( R_ARB_VERTEX_BUFFER_OBJECT_EXT ))
{
pglTexCoordPointer( 2, GL_FLOAT, 0, coordsArray );
return true;
}
break;
R_UpdateVertexBuffer( tr.tcoordBuffer[unit], coordsArray, r_backacc.numVerts * sizeof( vec2_t ));
pglTexCoordPointer( 2, GL_FLOAT, 0, tr.tcoordBuffer[unit]->pointer );
return true;
case TCGEN_LIGHTMAP:
GL_DisableAllTexGens();
if( !GL_Support( R_ARB_VERTEX_BUFFER_OBJECT_EXT ))
{
pglTexCoordPointer( 2, GL_FLOAT, 0, lightmapCoordsArray[r_lightmapStyleNum[unit]] );
return true;
}
break;
R_UpdateVertexBuffer( tr.tcoordBuffer[unit], lightmapCoordsArray[r_lightmapStyleNum[unit]], r_backacc.numVerts * sizeof( vec2_t ));
pglTexCoordPointer( 2, GL_FLOAT, 0, tr.tcoordBuffer[unit]->pointer );
return true;
case TCGEN_ENVIRONMENT:
{
float depth, *n;
@ -977,12 +968,9 @@ static bool R_VertexTCBase( const ref_stage_t *pass, int unit, mat4x4_t matrix )
GL_DisableAllTexGens();
if( !GL_Support( R_ARB_VERTEX_BUFFER_OBJECT_EXT ))
{
pglTexCoordPointer( 2, GL_FLOAT, 0, tUnitCoordsArray[unit] );
return true;
}
break;
R_UpdateVertexBuffer( tr.tcoordBuffer[unit], tUnitCoordsArray, r_backacc.numVerts * sizeof( vec2_t ));
pglTexCoordPointer( 2, GL_FLOAT, 0, tr.tcoordBuffer[unit]->pointer );
return true;
}
case TCGEN_VECTOR:
@ -1143,34 +1131,23 @@ static bool R_VertexTCBase( const ref_stage_t *pass, int unit, mat4x4_t matrix )
GL_DisableAllTexGens();
if( !GL_Support( R_ARB_VERTEX_BUFFER_OBJECT_EXT ))
{
pglTexCoordPointer( 2, GL_FLOAT, 0, tUnitCoordsArray[unit] );
return false;
}
break;
R_UpdateVertexBuffer( tr.tcoordBuffer[unit], tUnitCoordsArray, r_backacc.numVerts * sizeof( vec2_t ));
pglTexCoordPointer( 2, GL_FLOAT, 0, tr.tcoordBuffer[unit]->pointer );
return false;
}
case TCGEN_SVECTORS:
GL_DisableAllTexGens();
if( !GL_Support( R_ARB_VERTEX_BUFFER_OBJECT_EXT ))
{
pglTexCoordPointer( 4, GL_FLOAT, 0, sVectorsArray );
return true;
}
break;
R_UpdateVertexBuffer( tr.tcoordBuffer[unit], sVectorsArray, r_backacc.numVerts * sizeof( vec4_t ));
pglTexCoordPointer( 4, GL_FLOAT, 0, tr.tcoordBuffer[unit]->pointer );
return true;
case TCGEN_PROJECTION_SHADOW:
GL_SetTexCoordArrayMode( 0 );
GL_DisableAllTexGens();
Matrix4_Multiply( r_currentCastGroup->worldviewProjectionMatrix, RI.objectMatrix, matrix );
break;
default:
break;
default: break;
}
return identityMatrix;
}
@ -1268,9 +1245,8 @@ static void R_BindShaderpass( const ref_stage_t *pass, texture_t *tex, int unit
tex = R_ShaderpassTex( pass, unit );
GL_Bind( unit, tex );
if( unit && !pass->program )
pglEnable( GL_TEXTURE_2D );
GL_SetTexCoordArrayMode( ( tex->flags & TF_CUBEMAP ? GL_TEXTURE_CUBE_MAP_ARB : GL_TEXTURE_COORD_ARRAY ) );
if( unit && !pass->program ) pglEnable( GL_TEXTURE_2D );
GL_SetTexCoordArrayMode( ( tex->flags & TF_CUBEMAP ? GL_TEXTURE_CUBE_MAP_ARB : GL_TEXTURE_COORD_ARRAY ));
identityMatrix = R_VertexTCBase( pass, unit, result );
@ -2805,8 +2781,7 @@ static void R_DrawTriangles( void )
if( GL_Support( R_DRAW_RANGEELEMENTS_EXT ))
pglDrawRangeElementsEXT( GL_TRIANGLES, 0, r_backacc.numVerts, r_backacc.numElems, GL_UNSIGNED_INT, elemsArray );
else
pglDrawElements( GL_TRIANGLES, r_backacc.numElems, GL_UNSIGNED_INT, elemsArray );
else pglDrawElements( GL_TRIANGLES, r_backacc.numElems, GL_UNSIGNED_INT, elemsArray );
}
/*
@ -2825,9 +2800,7 @@ static void R_DrawNormals( void )
for( i = 0; i < r_backacc.numVerts; i++ )
{
pglVertex3fv( vertsArray[i] );
pglVertex3f( vertsArray[i][0] + normalsArray[i][0],
vertsArray[i][1] + normalsArray[i][1],
vertsArray[i][2] + normalsArray[i][2] );
pglVertex3f( vertsArray[i][0] + normalsArray[i][0], vertsArray[i][1] + normalsArray[i][1], vertsArray[i][2] + normalsArray[i][2] );
}
pglEnd();
}

View File

@ -31,9 +31,7 @@ enum
VBO_VERTS,
VBO_NORMALS,
VBO_COLORS,
// VBO_INDEXES,
VBO_TC0,
VBO_ENDMARKER
};
@ -55,24 +53,27 @@ extern vec4_t *sVectorsArray;
extern vec2_t *coordsArray;
extern vec2_t *lightmapCoordsArray[LM_STYLES];
extern rgba_t colorArray[MAX_ARRAY_VERTS];
extern int r_numVertexBufferObjects;
extern GLuint r_vertexBufferObjects[MAX_VERTEX_BUFFER_OBJECTS];
extern int r_features;
//===================================================================
typedef struct ref_buffer_s
{
byte *pointer;
int size;
uint usage;
uint bufNum;
} ref_buffer_t;
typedef struct
{
uint numVerts;
uint numElems;
uint numColors;
uint numVerts;
uint numElems;
uint numColors;
uint c_totalVerts;
uint c_totalTris;
uint c_totalFlushes;
uint c_totalKeptLocks;
uint c_totalVerts;
uint c_totalTris;
uint c_totalFlushes;
uint c_totalKeptLocks;
} ref_backacc_t;
typedef struct
@ -80,6 +81,14 @@ typedef struct
// renderer global variables
int registration_sequence;
// vbo stuff
int numVertexBufferObjects;
ref_buffer_t vertexBufferObjects[MAX_VERTEX_BUFFER_OBJECTS];
ref_buffer_t *vertexBuffer;
ref_buffer_t *normalBuffer;
ref_buffer_t *colorsBuffer;
ref_buffer_t *tcoordBuffer[MAX_TEXTURE_UNITS];
// builtin textures
texture_t *cinTexture; // cinematic texture
texture_t *portaltexture1; // portal view
@ -98,6 +107,7 @@ typedef struct
texture_t *lightmapTextures[MAX_TEXTURES];
// builtin shaders
ref_shader_t *defaultShader; // generic black texture
} ref_globals_t;
extern ref_globals_t tr;
@ -121,6 +131,11 @@ void R_BackendResetPassMask( void );
void R_DrawPhysDebug( void );
void R_InitVertexBuffers( void );
void R_ShutdownVertexBuffers( void );
ref_buffer_t *R_AllocVertexBuffer( size_t size, GLuint usage );
void R_UpdateVertexBuffer( ref_buffer_t *vertexBuffer, const void *data, size_t size );
void R_LockArrays( int numverts );
void R_UnlockArrays( void );
void R_UnlockArrays( void );
@ -386,14 +401,15 @@ typedef struct
bool initializedMedia;
int activeTMU;
GLuint *currentTextures;
GLenum *currentEnvModes;
bool *texIdentityMatrix;
int *genSTEnabled; // 0 - disabled, OR 1 - S, OR 2 - T, OR 4 - R
int *texCoordArrayMode; // 0 - disabled, 1 - enabled, 2 - cubemap
GLuint currentTextures[MAX_TEXTURE_UNITS];
GLenum currentEnvModes[MAX_TEXTURE_UNITS];
GLboolean texIdentityMatrix[MAX_TEXTURE_UNITS];
GLint genSTEnabled[MAX_TEXTURE_UNITS]; // 0 - disabled, OR 1 - S, OR 2 - T, OR 4 - R
GLint texCoordArrayMode[MAX_TEXTURE_UNITS]; // 0 - disabled, 1 - enabled, 2 - cubemap
vec4_t draw_color;
kRenderMode_t draw_rendermode; // rendermode for drawing
int draw_frame; // will be reset after each drawing
kRenderMode_t draw_rendermode; // rendermode for drawing
int draw_frame; // will be reset after each drawing
int faceCull;
int frontFace;

2845
render/r_backend.old Normal file

File diff suppressed because it is too large Load Diff

View File

@ -377,7 +377,6 @@ static void R_Bloom_GeneratexDiamonds( void )
scale = r_bloom_intensity->value * 0.5f;
break;
default:
// case 8:
k = 4;
diamond = &Diamond8x[0][0];
scale = r_bloom_intensity->value * 0.3f;

View File

@ -276,10 +276,6 @@ void R_SetTextureParameters( void )
for( i = 0, texture = r_textures; i < r_numTextures; i++, texture++ )
{
if( !texture->texnum ) continue; // free slot
continue;
GL_Bind( GL_TEXTURE0, texture );
if( texture->flags & TF_DEPTHMAP )
@ -558,13 +554,10 @@ static void R_TextureFormat( texture_t *tex, bool compress )
}
}
void R_RoundImageDimensions( int *width, int *height, int *depth )
void R_RoundImageDimensions( int *width, int *height, int *depth, bool force )
{
int scaledWidth, scaledHeight, scaledDepth;
if( GL_Support( R_ARB_TEXTURE_NPOT_EXT ))
return; // nothing to resample
if( *depth > 1 && !GL_Support( R_TEXTURE_3D_EXT ))
return; // nothing to resample
@ -572,10 +565,13 @@ void R_RoundImageDimensions( int *width, int *height, int *depth )
scaledHeight = *height;
scaledDepth = *depth;
// find nearest power of two, rounding down if desired
scaledWidth = NearestPOW( scaledWidth, gl_round_down->integer );
scaledHeight = NearestPOW( scaledHeight, gl_round_down->integer );
scaledDepth = NearestPOW( scaledDepth, gl_round_down->integer );
if( force || !GL_Support( R_ARB_TEXTURE_NPOT_EXT ))
{
// find nearest power of two, rounding down if desired
scaledWidth = NearestPOW( scaledWidth, gl_round_down->integer );
scaledHeight = NearestPOW( scaledHeight, gl_round_down->integer );
scaledDepth = NearestPOW( scaledDepth, gl_round_down->integer );
}
if( image_desc.tflags & TF_SKYSIDE )
{
@ -874,7 +870,7 @@ bool R_GetPixelFormat( const char *name, rgbdata_t *pic, uint tex_flags )
else image_desc.texType = TEX_GENERIC;
// calc immediate buffers
R_RoundImageDimensions( &w, &h, &d );
R_RoundImageDimensions( &w, &h, &d, false );
image_desc.source = Mem_Alloc( r_imagepool, s * 4 ); // source buffer
image_desc.scaled = Mem_Alloc( r_imagepool, w * h * d * 4 ); // scaled buffer
@ -1541,6 +1537,37 @@ static rgbdata_t *R_IncludeDepthmap( rgbdata_t *in1, rgbdata_t *in2 )
return in1;
}
/*
================
R_ClearPixels
clear specified area: color or alpha
================
*/
static rgbdata_t *R_ClearPixels( rgbdata_t *in, bool clearAlpha )
{
int i;
byte *pic;
// make sure what we processing RGBA images
in = R_ForceImageToRGBA( in );
pic = in->buffer;
if( clearAlpha )
{
for( i = 0; i < in->width * in->height && in->flags & IMAGE_HAS_ALPHA; i++ )
pic[(i<<2)+3] = 0xFF;
}
else
{
// clear color or greyscale image otherwise
for( i = 0; i < in->width * in->height; i++ )
pic[(i<<2)+0] = pic[(i<<2)+1] = pic[(i<<2)+2] = 0xFF;
}
return in;
}
/*
=================
R_ParseAdd
@ -2528,6 +2555,7 @@ static rgbdata_t *R_ParseDepthmap( script_t *script, int *samples, texFlags_t *f
return NULL;
}
*samples = 3;
pic2 = R_LoadImage( script, token.string, NULL, 0, &samples2, flags );
if( !pic2 ) return pic1; // don't free normalmap
@ -2558,6 +2586,65 @@ static rgbdata_t *R_ParseDepthmap( script_t *script, int *samples, texFlags_t *f
return R_IncludeDepthmap( pic1, pic2 );
}
/*
=================
R_ParseClearPixels
=================
*/
static rgbdata_t *R_ParseClearPixels( script_t *script, int *samples, texFlags_t *flags )
{
token_t token;
rgbdata_t *pic;
bool clearAlpha;
Com_ReadToken( script, 0, &token );
if( com.stricmp( token.string, "(" ))
{
MsgDev( D_WARN, "expected '(', found '%s' instead for 'clearPixels'\n", token.string );
return NULL;
}
if( !Com_ReadToken( script, SC_ALLOW_PATHNAMES, &token ))
{
MsgDev( D_WARN, "missing parameters for 'clearPixels'\n" );
return NULL;
}
pic = R_LoadImage( script, token.string, NULL, 0, samples, flags );
if( !pic ) return NULL;
Com_ReadToken( script, 0, &token );
if( !com.stricmp( token.string, "alpha" ))
{
Com_ReadToken( script, 0, &token );
clearAlpha = true;
}
else if( !com.stricmp( token.string, "color" ))
{
Com_ReadToken( script, 0, &token );
clearAlpha = false;
}
else if( !com.stricmp( token.string, ")" ))
{
Com_SaveToken( script, &token );
clearAlpha = false; // clear color as default
}
else Com_ReadToken( script, 0, &token ); // skip unknown token
if( com.stricmp( token.string, ")" ))
{
MsgDev( D_WARN, "expected ')', found '%s' instead for 'clearPixels'\n", token.string );
FS_FreeImage( pic );
return NULL;
}
*samples = clearAlpha ? 3 : 1;
if( clearAlpha ) *flags &= ~TF_ALPHA;
*flags &= ~TF_INTENSITY;
return R_ClearPixels( pic, clearAlpha );
}
/*
=================
R_LoadImage
@ -2595,6 +2682,8 @@ static rgbdata_t *R_LoadImage( script_t *script, const char *name, const byte *b
return R_ParseSmoothNormals( script, samples, flags );
else if( !com.stricmp( name, "mergeDepthmap" ))
return R_ParseDepthmap( script, samples, flags );
else if( !com.stricmp( name, "clearPixels" ))
return R_ParseClearPixels( script, samples, flags );
else if( !com.stricmp( name, "Studio" ))
return R_ParseStudioSkin( script, samples, flags );
else if( !com.stricmp( name, "Sprite" ))
@ -2661,7 +2750,15 @@ void GL_GenerateMipmaps( const byte *buffer, texture_t *tex, int side )
void GL_TexFilter( texture_t *tex )
{
// set texture filter
if( tex->flags & TF_NOMIPMAP )
if( tex->flags & TF_DEPTHMAP )
{
pglTexParameteri( tex->target, GL_TEXTURE_MIN_FILTER, r_textureDepthFilter );
pglTexParameteri( tex->target, GL_TEXTURE_MAG_FILTER, r_textureDepthFilter );
if( GL_Support( R_ANISOTROPY_EXT ))
pglTexParameterf( tex->target, GL_TEXTURE_MAX_ANISOTROPY_EXT, 1.0f );
}
else if( tex->flags & TF_NOMIPMAP )
{
pglTexParameteri( tex->target, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
pglTexParameteri( tex->target, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
@ -2717,7 +2814,7 @@ static void R_UploadTexture( rgbdata_t *pic, texture_t *tex )
tex->width = tex->srcWidth;
tex->height = tex->srcHeight;
R_RoundImageDimensions( &tex->width, &tex->height, &tex->depth );
R_RoundImageDimensions( &tex->width, &tex->height, &tex->depth, false );
// check if it should be compressed
if( !gl_compress_textures->integer || (tex->flags & TF_UNCOMPRESSED))
@ -2734,7 +2831,6 @@ static void R_UploadTexture( rgbdata_t *pic, texture_t *tex )
case PF_DXT5: tex->format = GL_COMPRESSED_RGBA_S3TC_DXT5_EXT; break;
default: dxtformat = false; break;
}
pglGenTextures( 1, &tex->texnum );
GL_Bind( GL_TEXTURE0, tex );
@ -3357,7 +3453,7 @@ static rgbdata_t *R_InitCoronaTexture( int *flags, int *samples )
R_InitScreenTexture
==================
*/
static void R_InitScreenTexture( texture_t **texture, const char *name, int id, int screenWidth, int screenHeight, int size, int flags, int samples )
static void R_InitScreenTexture( texture_t **ptr, const char *name, int id, int screenWidth, int screenHeight, int size, int flags, int samples )
{
int limit;
int width, height;
@ -3367,43 +3463,36 @@ static void R_InitScreenTexture( texture_t **texture, const char *name, int id,
limit = glConfig.max_2d_texture_size;
if( size ) limit = min( limit, size );
if( GL_Support( R_ARB_TEXTURE_NPOT_EXT ))
{
width = min( screenWidth, limit );
height = min( screenHeight, limit );
}
else
{
limit = min( limit, min( screenWidth, screenHeight ));
for( size = 2; size <= limit; size <<= 1 );
width = height = size >> 1;
}
limit = min( limit, min( screenWidth, screenHeight ));
for( size = 2; size <= limit; size <<= 1 );
width = height = size >> 1;
if( !( *texture ) || ( *texture )->width != width || ( *texture )->height != height )
if( !(*ptr) || (*ptr)->width != width || (*ptr)->height != height )
{
byte *data = NULL;
if( !*texture )
if( !*ptr )
{
string uploadName;
string name;
com.snprintf( uploadName, sizeof( uploadName ), "***%s%i***", name, id );
com.snprintf( name, sizeof( name ), "***%s%i***", name, id );
r_screen.width = width;
r_screen.height = height;
r_screen.depth = r_screen.numMips = 1;
r_screen.type = PF_RGB_24;
r_screen.buffer = data;
r_screen.depth = r_screen.numMips = 1;
r_screen.size = width * height * samples;
*texture = R_LoadTexture( uploadName, &r_screen, samples, flags );
*ptr = R_LoadTexture( name, &r_screen, samples, flags );
return;
}
GL_Bind( 0, *texture );
( *texture )->width = width;
( *texture )->height = height;
R_Upload32( &data, width, height, flags, &( ( *texture )->width ), &( ( *texture )->height ),
&( ( *texture )->samples ), false );
GL_Bind( 0, *ptr );
(*ptr)->width = width;
(*ptr)->height = height;
R_RoundImageDimensions(&((*ptr)->width), &((*ptr)->height), &((*ptr)->depth), true );
pglTexImage2D( GL_TEXTURE_2D, 0, (*ptr)->format, (*ptr)->width, (*ptr)->height, 0, GL_RGB, GL_UNSIGNED_BYTE, NULL );
GL_TexFilter( *ptr );
}
}
@ -3643,254 +3732,4 @@ void R_ShutdownImages( void )
r_numTextures = 0;
tr.portaltexture1 = NULL;
tr.portaltexture2 = NULL;
}
// to be removed
/*
===============
R_UploadFormat
===============
*/
static int R_UploadFormat( int samples, bool noCompress )
{
int bits = r_texturebits->integer;
if( GL_Support( R_TEXTURE_COMPRESSION_EXT ) && !noCompress )
{
if( samples == 3 )
return GL_COMPRESSED_RGB_ARB;
return GL_COMPRESSED_RGBA_ARB;
}
if( samples == 3 )
{
if( bits == 16 )
return GL_RGB5;
else if( bits == 32 )
return GL_RGB8;
return GL_RGB;
}
if( bits == 16 )
return GL_RGBA4;
else if( bits == 32 )
return GL_RGBA8;
return GL_RGBA;
}
/*
===============
R_Upload32
===============
*/
void R_Upload32( byte **data, int width, int height, int flags, int *upload_width, int *upload_height, int *samples, bool subImage )
{
int i, c, comp, format;
int target, target2;
int numTextures;
uint *scaled = NULL;
int scaledWidth, scaledHeight;
Com_Assert( samples == NULL );
if( GL_Support( R_ARB_TEXTURE_NPOT_EXT ))
{
scaledWidth = width;
scaledHeight = height;
}
else
{
for( scaledWidth = 1; scaledWidth < width; scaledWidth <<= 1 );
for( scaledHeight = 1; scaledHeight < height; scaledHeight <<= 1 );
}
if( flags & TF_SKYSIDE )
{
// let people sample down the sky textures for speed
scaledWidth >>= r_skymip->integer;
scaledHeight >>= r_skymip->integer;
}
else if( !( flags & TF_NOPICMIP ) )
{
// let people sample down the world textures for speed
scaledWidth >>= r_picmip->integer;
scaledHeight >>= r_picmip->integer;
}
// don't ever bother with > maxSize textures
if( flags & TF_CUBEMAP )
{
numTextures = 6;
target = GL_TEXTURE_CUBE_MAP_ARB;
target2 = GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB;
scaledWidth = bound( 1, scaledWidth, glConfig.max_cubemap_texture_size );
scaledHeight = bound( 1, scaledHeight, glConfig.max_cubemap_texture_size );
}
else
{
numTextures = 1;
target = GL_TEXTURE_2D;
target2 = GL_TEXTURE_2D;
scaledWidth = bound( 1, scaledWidth, glConfig.max_2d_texture_size );
scaledHeight = bound( 1, scaledHeight, glConfig.max_2d_texture_size );
}
if( upload_width )
*upload_width = scaledWidth;
if( upload_height )
*upload_height = scaledHeight;
// scan the texture for any non-255 alpha
if( flags & ( TF_NORGB|TF_NOALPHA ) )
{
byte *scan;
if( flags & TF_NORGB )
{
for( i = 0; i < numTextures && data[i]; i++ )
{
scan = ( byte * )data[i];
for( c = width * height; c > 0; c--, scan += 4 )
scan[0] = scan[1] = scan[2] = 255;
}
}
else if( *samples == 4 )
{
for( i = 0; i < numTextures && data[i]; i++ )
{
scan = ( byte * )data[i] + 3;
for( c = width * height; c > 0; c--, scan += 4 )
*scan = 255;
}
*samples = 3;
}
}
if( flags & TF_DEPTHMAP )
{
comp = GL_DEPTH_COMPONENT;
format = GL_DEPTH_COMPONENT;
}
else
{
comp = R_UploadFormat( *samples, flags & TF_UNCOMPRESSED );
format = GL_RGBA;
}
if( flags & TF_DEPTHMAP )
{
pglTexParameteri( target, GL_TEXTURE_MIN_FILTER, r_textureDepthFilter );
pglTexParameteri( target, GL_TEXTURE_MAG_FILTER, r_textureDepthFilter );
if( GL_Support( R_ANISOTROPY_EXT ))
pglTexParameteri( target, GL_TEXTURE_MAX_ANISOTROPY_EXT, 1 );
}
else if( !( flags & TF_NOMIPMAP ) )
{
pglTexParameteri( target, GL_TEXTURE_MIN_FILTER, r_textureMinFilter );
pglTexParameteri( target, GL_TEXTURE_MAG_FILTER, r_textureMagFilter );
if( GL_Support( R_ANISOTROPY_EXT ))
pglTexParameterf( target, GL_TEXTURE_MAX_ANISOTROPY_EXT, gl_texture_anisotropy->value );
}
else
{
pglTexParameteri( target, GL_TEXTURE_MIN_FILTER, r_textureMagFilter );
pglTexParameteri( target, GL_TEXTURE_MAG_FILTER, r_textureMagFilter );
if( GL_Support( R_ANISOTROPY_EXT ))
pglTexParameterf( target, GL_TEXTURE_MAX_ANISOTROPY_EXT, 1.0f );
}
// clamp if required
if( !( flags & TF_CLAMP ) )
{
pglTexParameteri( target, GL_TEXTURE_WRAP_S, GL_REPEAT );
pglTexParameteri( target, GL_TEXTURE_WRAP_T, GL_REPEAT );
}
else if( GL_Support( R_CLAMPTOEDGE_EXT ))
{
pglTexParameteri( target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE );
pglTexParameteri( target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE );
}
else
{
pglTexParameteri( target, GL_TEXTURE_WRAP_S, GL_CLAMP );
pglTexParameteri( target, GL_TEXTURE_WRAP_T, GL_CLAMP );
}
if(( scaledWidth == width ) && ( scaledHeight == height ) && ( flags & TF_NOMIPMAP ))
{
if( subImage )
{
for( i = 0; i < numTextures; i++, target2++ )
pglTexSubImage2D( target2, 0, 0, 0, scaledWidth, scaledHeight, format, GL_UNSIGNED_BYTE, data[i] );
}
else
{
for( i = 0; i < numTextures; i++, target2++ )
pglTexImage2D( target2, 0, comp, scaledWidth, scaledHeight, 0, format, GL_UNSIGNED_BYTE, data[i] );
}
}
else
{
bool driverMipmap = GL_Support( R_SGIS_MIPMAPS_EXT ) && !(flags & TF_CUBEMAP);
for( i = 0; i < numTextures; i++, target2++ )
{
unsigned int *mip;
if( scaledWidth == width && scaledHeight == height && driverMipmap )
{
mip = (uint *)(data[i]);
}
else
{
mip = NULL;
// resample the texture
if( data[i] )
{
R_ResampleTexture( data[i], width, height, scaledWidth, scaledHeight, false );
mip = (uint *)image_desc.scaled;
}
}
// automatic mipmaps generation
if( !( flags & TF_NOMIPMAP ) && mip && driverMipmap )
pglTexParameteri( target2, GL_GENERATE_MIPMAP_SGIS, GL_TRUE );
if( subImage )
pglTexSubImage2D( target2, 0, 0, 0, scaledWidth, scaledHeight, format, GL_UNSIGNED_BYTE, mip );
else
pglTexImage2D( target2, 0, comp, scaledWidth, scaledHeight, 0, format, GL_UNSIGNED_BYTE, mip );
// mipmaps generation
if( !( flags & TF_NOMIPMAP ) && mip && !driverMipmap )
{
int w, h;
int miplevel = 0;
w = scaledWidth;
h = scaledHeight;
while( w > 1 || h > 1 )
{
R_BuildMipMap( (byte *)mip, w, h, false );
w >>= 1;
h >>= 1;
if( w < 1 )
w = 1;
if( h < 1 )
h = 1;
miplevel++;
if( subImage )
pglTexSubImage2D( target2, miplevel, 0, 0, w, h, format, GL_UNSIGNED_BYTE, mip );
else
pglTexImage2D( target2, miplevel, comp, w, h, 0, format, GL_UNSIGNED_BYTE, mip );
}
}
}
}
}

View File

@ -76,11 +76,9 @@ typedef enum
TF_DEPTHMAP = BIT(5), // custom texture filter used
TF_INTENSITY = BIT(5),
TF_ALPHA = BIT(6),
TF_NORGB = BIT(7), // QFusion legacy. convert to funcs?
TF_NOALPHA = BIT(8),
TF_SKYSIDE = BIT(9),
TF_CLAMP = BIT(10),
TF_NOMIPMAP = BIT(11),
TF_SKYSIDE = BIT(7),
TF_CLAMP = BIT(8),
TF_NOMIPMAP = BIT(9),
} texFlags_t;
#define TF_CINEMATIC ( TF_NOPICMIP|TF_UNCOMPRESSED|TF_CLAMP|TF_NOMIPMAP )
@ -298,6 +296,7 @@ extern cvar_t *r_lerpmodels;
extern cvar_t *r_ignorehwgamma;
extern cvar_t *r_overbrightbits;
extern cvar_t *r_mapoverbrightbits;
extern cvar_t *r_vertexbuffers;
extern cvar_t *r_lefthand;
extern cvar_t *r_physbdebug;
extern cvar_t *r_check_errors;
@ -504,7 +503,6 @@ void R_TextureList_f( void );
void R_SetTextureParameters( void );
void R_ShowTextures( void );
void R_Upload32( byte **data, int width, int height, int flags, int *upload_width, int *upload_height, int *samples, bool subImage );
texture_t *R_LoadTexture( const char *name, rgbdata_t *pic, int samples, texFlags_t flags );
texture_t *R_FindTexture( const char *name, const byte *buf, size_t size, texFlags_t flags );
@ -668,8 +666,9 @@ msurface_t *R_TransformedTraceLine( trace_t *tr, const vec3_t start, const vec3_
//
// r_register.c
//
void R_Restart( void );
void R_Shutdown( bool verbose );
void R_NewMap( void );
bool R_Init( bool full );
void R_Shutdown( bool full );
//
// r_opengl.c
@ -701,16 +700,6 @@ struct skinfile_s *R_SkinFile_Load( const char *name );
struct skinfile_s *R_RegisterSkinFile( const char *name );
ref_shader_t *R_FindShaderForSkinFile( const struct skinfile_s *skinfile, const char *meshname );
//
// r_skm.c
//
bool R_CullSkeletalModel( ref_entity_t *e );
void R_AddSkeletalModelToList( ref_entity_t *e );
void R_DrawSkeletalModel( const meshbuffer_t *mb );
float R_SkeletalModelBBox( ref_entity_t *e, vec3_t mins, vec3_t maxs );
int R_SkeletalGetBoneInfo( const ref_model_t *mod, int bonenum, char *name, size_t name_size, int *flags );
void R_SkeletalGetBonePose( const ref_model_t *mod, int bonenum, int frame, bonepose_t *bonepose );
//
// r_warp.c
//

View File

@ -691,7 +691,6 @@ static void R_PushCorona( const meshbuffer_t *mb )
R_PushMesh( &spr_mesh, MF_NOCULL | MF_TRIFAN | shader->features );
}
#ifdef QUAKE2_JUNK
/*
=================
R_PushSpriteModel
@ -709,7 +708,6 @@ bool R_PushSpriteModel( const meshbuffer_t *mb )
return R_PushSprite( mb, e->rotation, frame->origin_x, frame->origin_x - frame->width, frame->height - frame->origin_y, -frame->origin_y );
}
#endif
/*
=================
@ -734,7 +732,6 @@ bool R_PushSpritePoly( const meshbuffer_t *mb )
return R_PushSprite( mb, e->rotation, -e->radius, e->radius, e->radius, -e->radius );
}
#ifdef QUAKE2_JUNK
/*
=================
R_AddSpriteModelToList
@ -775,7 +772,6 @@ static void R_AddSpriteModelToList( ref_entity_t *e )
if( mb )
mb->shaderkey |= ( bound( 1, 0x4000 - (unsigned int)dist, 0x4000 - 1 ) << 12 );
}
#endif
/*
=================
@ -1005,13 +1001,15 @@ static void R_SetupFrustum( void )
for( i = 0; i < 4; i++ )
{
RI.frustum[i].type = PLANE_NONAXIAL;
RI.frustum[i].dist = DotProduct( RI.viewOrigin, RI.frustum[i].normal );
PlaneClassify( &RI.frustum[i] );
RI.frustum[i].signbits = SignbitsForPlane( &RI.frustum[i] );
}
VectorMA( RI.viewOrigin, RI.farClip, RI.vpn, farPoint );
RI.frustum[i].type = PLANE_NONAXIAL;
RI.frustum[i].dist = DotProduct( farPoint, RI.frustum[i].normal );
PlaneClassify( &RI.frustum[i] );
RI.frustum[i].signbits = SignbitsForPlane( &RI.frustum[i] );
}
/*
@ -1362,10 +1360,8 @@ static void R_CategorizeEntities( void )
if( !( RI.currententity->renderfx & ( RF_NOSHADOW|RF_PLANARSHADOW ) ) )
R_AddShadowCaster( RI.currententity ); // build groups and mark shadow casters
break;
#ifdef QUAKE2_JUNK
case mod_sprite:
break;
#endif
default:
Host_Error( "%s: bad modeltype\n", RI.currentmodel->name );
break;
@ -1405,18 +1401,15 @@ static void R_CullEntities( void )
culled = R_CullAliasModel( e );
break;
case mod_studio:
culled = R_CullSkeletalModel( e );
culled = true;
break;
case mod_brush:
culled = R_CullBrushModel( e );
break;
#ifdef QUAKE2_JUNK
case mod_sprite:
culled = false;
break;
#endif
default:
break;
default: break;
}
break;
case RT_SPRITE:
@ -1517,16 +1510,12 @@ add:
R_AddAliasModelToList( e );
break;
case mod_studio:
R_AddSkeletalModelToList( e );
break;
#ifdef QUAKE2_JUNK
case mod_sprite:
if( !shadowmap )
R_AddSpriteModelToList( e );
break;
#endif
default:
break;
default: break;
}
break;
case RT_SPRITE:
@ -2390,19 +2379,21 @@ bool R_AddEntityToScene( edict_t *pRefEntity, int ed_type, float lerpfrac )
return result;
}
bool R_AddDynamicLight( vec3_t org, vec3_t color, float intensity )
bool R_AddDynamicLight( vec3_t org, vec3_t color, float intensity, shader_t handle )
{
dlight_t *dl;
dlight_t *dl;
ref_shader_t *shader;
if(( r_numDlights >= MAX_DLIGHTS ) || (intensity == 0) || ( VectorIsNull( color )))
return false;
if( handle < 0 || handle > MAX_SHADERS || !(shader = &r_shaders[handle])->name)
shader = NULL;
dl = &r_dlights[r_numDlights++];
VectorCopy( org, dl->origin );
VectorCopy( color, dl->color );
dl->intensity = intensity * DLIGHT_SCALE;
dl->shader = NULL; // FIXME;
dl->shader = shader;
R_LightBounds( org, dl->intensity, dl->mins, dl->maxs );

View File

@ -295,6 +295,37 @@ void AdjustFov( float *fov_x, float *fov_y, float width, float height, bool lock
else *fov_y = y;
}
/*
=================
SignbitsForPlane
fast box on planeside test
=================
*/
int SignbitsForPlane( const cplane_t *out )
{
int bits, i;
for( i = bits = 0; i < 3; i++ )
if( out->normal[i] < 0.0f ) bits |= 1<<i;
return bits;
}
/*
=================
PlaneTypeForNormal
=================
*/
int PlaneTypeForNormal( const vec3_t normal )
{
// NOTE: should these have an epsilon around 1.0?
if( normal[0] >= 1.0f ) return PLANE_X;
if( normal[1] >= 1.0f ) return PLANE_Y;
if( normal[2] >= 1.0f ) return PLANE_Z;
return PLANE_NONAXIAL;
}
/*
=================
PlaneFromPoints
@ -309,7 +340,4 @@ void PlaneFromPoints( vec3_t verts[3], cplane_t *plane )
CrossProduct( v2, v1, plane->normal );
VectorNormalize( plane->normal );
plane->dist = DotProduct( verts[0], plane->normal );
// FIXME: needs to a plane classify ?
//PlaneClassify( plane );
}

View File

@ -26,7 +26,7 @@ extern const mat4x4_t mat4x4_identity;
void Matrix4_Identity( mat4x4_t m );
void Matrix4_Copy( const mat4x4_t m1, mat4x4_t m2 );
bool Matrix4_Compare( const mat4x4_t m1, const mat4x4_t m2 );
bool Matrix4_Compare( const mat4x4_t m1, const mat4x4_t m2 );
void Matrix4_Multiply( const mat4x4_t m1, const mat4x4_t m2, mat4x4_t out );
void Matrix4_MultiplyFast( const mat4x4_t m1, const mat4x4_t m2, mat4x4_t out );
void Matrix4_Rotate( mat4x4_t m, vec_t angle, vec_t x, vec_t y, vec_t z );
@ -46,5 +46,7 @@ void Matrix4_Stretch2D( mat4x4_t m, vec_t s, vec_t t );
float CalcFov( float fov_x, float width, float height );
void AdjustFov( float *fov_x, float *fov_y, float width, float height, bool lock_x );
void PlaneFromPoints( vec3_t verts[3], cplane_t *plane );
int SignbitsForPlane( const cplane_t *out );
int PlaneTypeForNormal( const vec3_t normal );
#endif /*__R_MATH_H__*/

View File

@ -174,6 +174,107 @@ static void R_ISortMeshBuffers( meshbuffer_t *meshes, int num_meshes )
}
}
/*
=======================================================================
VERTEX BUFFERS
=======================================================================
*/
/*
=================
R_UpdateVertexBuffer
=================
*/
void R_UpdateVertexBuffer( ref_buffer_t *vertexBuffer, const void *data, size_t size )
{
if( !GL_Support( R_ARB_VERTEX_BUFFER_OBJECT_EXT ))
{
vertexBuffer->pointer = (char *)data;
return;
}
if( !r_vertexbuffers->integer )
{
vertexBuffer->pointer = (char *)data;
pglBindBufferARB( GL_ARRAY_BUFFER_ARB, 0 );
return;
}
vertexBuffer->pointer = NULL;
pglBindBufferARB( GL_ARRAY_BUFFER_ARB, vertexBuffer->bufNum );
pglBufferSubDataARB( GL_ARRAY_BUFFER_ARB, 0, size, data );
}
/*
=================
R_AllocVertexBuffer
=================
*/
ref_buffer_t *R_AllocVertexBuffer( size_t size, GLuint usage )
{
ref_buffer_t *vertexBuffer;
if( tr.numVertexBufferObjects == MAX_VERTEX_BUFFER_OBJECTS )
Host_Error( "RB_AllocVertexBuffer: MAX_VERTEX_BUFFER_OBJECTS limit exceeds\n" );
vertexBuffer = &tr.vertexBufferObjects[tr.numVertexBufferObjects++];
vertexBuffer->pointer = NULL;
vertexBuffer->size = size;
vertexBuffer->usage = usage;
if(!GL_Support( R_ARB_VERTEX_BUFFER_OBJECT_EXT ))
return vertexBuffer;
pglGenBuffersARB( 1, &vertexBuffer->bufNum );
pglBindBufferARB( GL_ARRAY_BUFFER_ARB, vertexBuffer->bufNum );
pglBufferDataARB( GL_ARRAY_BUFFER_ARB, vertexBuffer->size, NULL, vertexBuffer->usage );
return vertexBuffer;
}
/*
=================
R_InitVertexBuffers
=================
*/
void R_InitVertexBuffers( void )
{
int i;
tr.vertexBuffer = R_AllocVertexBuffer( MAX_ARRAY_VERTS * sizeof( vec4_t ), GL_STREAM_DRAW_ARB );
tr.colorsBuffer = R_AllocVertexBuffer( MAX_ARRAY_VERTS * sizeof( rgba_t ), GL_STREAM_DRAW_ARB );
tr.normalBuffer = R_AllocVertexBuffer( MAX_ARRAY_VERTS * sizeof( vec4_t ), GL_STREAM_DRAW_ARB );
for( i = 0; i < MAX_TEXTURE_UNITS; i++ )
tr.tcoordBuffer[i] = R_AllocVertexBuffer( MAX_ARRAY_VERTS * sizeof( vec4_t ), GL_STREAM_DRAW_ARB );
}
/*
=================
R_ShutdownVertexBuffers
=================
*/
void R_ShutdownVertexBuffers( void )
{
ref_buffer_t *vertexBuffer;
int i;
if( !GL_Support( R_ARB_VERTEX_BUFFER_OBJECT_EXT ))
{
Mem_Set( tr.vertexBufferObjects, 0, sizeof( tr.vertexBufferObjects ));
tr.numVertexBufferObjects = 0;
return;
}
pglBindBufferARB( GL_ARRAY_BUFFER_ARB, 0 );
for( i = 0, vertexBuffer = tr.vertexBufferObjects; i < tr.numVertexBufferObjects; i++, vertexBuffer++ )
pglDeleteBuffersARB( 1, &vertexBuffer->bufNum );
Mem_Set( tr.vertexBufferObjects, 0, sizeof( tr.vertexBufferObjects ));
tr.numVertexBufferObjects = 0;
}
/*
=================
R_ReAllocMeshList
@ -364,7 +465,6 @@ static void R_BatchMeshBuffer( const meshbuffer_t *mb, const meshbuffer_t *nextm
case mod_alias:
R_DrawAliasModel( mb );
break;
#ifdef QUAKE2_JUNK
case mod_sprite:
R_PushSpriteModel( mb );
@ -372,9 +472,7 @@ static void R_BatchMeshBuffer( const meshbuffer_t *mb, const meshbuffer_t *nextm
R_TranslateForEntity( RI.currententity );
R_RenderMeshBuffer( mb );
break;
#endif
case mod_studio:
R_DrawSkeletalModel( mb );
break;
default:
Com_Assert( 1 ); // shut up compiler

View File

@ -88,7 +88,6 @@ static int loadmodel_numshaderrefs;
static mshaderref_t *loadmodel_shaderrefs;
void Mod_LoadAliasMD3Model( ref_model_t *mod, ref_model_t *parent, const void *buffer );
void Mod_LoadSkeletalModel( ref_model_t *mod, ref_model_t *parent, const void *buffer );
void Mod_LoadBrushModel( ref_model_t *mod, ref_model_t *parent, const void *buffer );
ref_model_t *Mod_LoadModel( ref_model_t *mod, bool crash );
@ -102,8 +101,7 @@ static byte *mod_mempool;
static modelformatdescriptor_t mod_supportedformats[] =
{
{ IDMD3HEADER, MD3_ALIAS_MAX_LODS, Mod_LoadAliasMD3Model }, // Quake III Arena .md3 models
{ SKMHEADER, SKM_MAX_LODS, Mod_LoadSkeletalModel }, // Skeletal models
{ ALIASMODHEADER, MD3_ALIAS_MAX_LODS, Mod_LoadAliasMD3Model }, // Quake III Arena .md3 models
{ IDBSPMODHEADER, 0, Mod_LoadBrushModel }, // Quake III Arena .bsp models
{ RBBSPMODHEADER, 0, Mod_LoadBrushModel }, // SOF2 and JK2 .bsp models
{ QFBSPMODHEADER, 0, Mod_LoadBrushModel }, // QFusion .bsp models
@ -422,7 +420,7 @@ ref_model_t *Mod_ForName( const char *name, bool crash )
FS_StripExtension( shortname );
// load level-of-detail models
for( i = mod->numlods = 0; i < descr->maxLods; i++ )
for( mod->numlods = i = 0; i < descr->maxLods; i++ )
{
com.snprintf( lodname, sizeof( lodname ), "%s_%i.%s", shortname, i+1, ext );
buf = (uint *)FS_LoadFile( lodname, NULL );
@ -1322,7 +1320,7 @@ static void Mod_LoadFogs( const lump_t *l, const lump_t *brLump, const lump_t *b
for( i = 0; i < count; i++, in++, out++ )
{
out->shader = R_RegisterShader( in->shader );
out->shader = R_LoadShader( in->shader, SHADER_TEXTURE, false, 0, SHADER_INVALID );
p = LittleLong( in->brushnum );
if( p == -1 )
continue;
@ -2037,63 +2035,6 @@ void Mod_LoadBrushModel( ref_model_t *mod, ref_model_t *parent, const void *buff
else bmodel->numsubmodels = 0;
}
}
#ifdef QUAKE2_JUNK
/*
==============================================================================
SPRITE MODELS
==============================================================================
*/
/*
=================
Mod_LoadSpriteModel
=================
*/
void Mod_LoadSpriteModel( ref_model_t *mod, ref_model_t *parent, void *buffer )
{
int i;
dsprite_t *sprin;
smodel_t *sprout;
dsprframe_t *sprinframe;
sframe_t *sproutframe;
sprin = (dsprite_t *)buffer;
if( LittleLong( sprin->version ) != SPRITE_VERSION )
Host_Error( ERR_DROP, "%s has wrong version number (%i should be %i)",
mod->name, LittleLong( sprin->version ), SPRITE_VERSION );
mod->extradata = sprout = Mod_Malloc( mod, sizeof( smodel_t ) );
sprout->numframes = LittleLong( sprin->numframes );
sprinframe = sprin->frames;
sprout->frames = sproutframe = Mod_Malloc( mod, sizeof( sframe_t ) * sprout->numframes );
mod->radius = 0;
ClearBounds( mod->mins, mod->maxs );
// byte swap everything
for( i = 0; i < sprout->numframes; i++, sprinframe++, sproutframe++ )
{
sproutframe->width = LittleLong( sprinframe->width );
sproutframe->height = LittleLong( sprinframe->height );
sproutframe->origin_x = LittleLong( sprinframe->origin_x );
sproutframe->origin_y = LittleLong( sprinframe->origin_y );
sproutframe->shader = R_RegisterPic( sprinframe->name );
sproutframe->radius = sqrt( sproutframe->width * sproutframe->width + sproutframe->height * sproutframe->height );
mod->radius = max( mod->radius, sproutframe->radius );
}
mod->type = mod_sprite;
mod->touchFrame = tr.registration_sequence; // register model
}
#endif
//=============================================================================
/*
@ -2122,7 +2063,7 @@ void R_BeginRegistration( const char *mapname, const dvis_t *visData )
if( com.strcmp( r_models[0].name, fullname ))
{
Mod_FreeModel( &r_models[0] );
RI.surfmbuffers = NULL;
R_NewMap ();
}
else
{

View File

@ -243,73 +243,11 @@ typedef struct
/*
==============================================================================
SKELETAL MODELS
STUDIO MODELS
==============================================================================
*/
//
// in memory representation
//
#define SKM_MAX_WEIGHTS 4
//
// in memory representation
//
typedef struct
{
ref_shader_t *shader;
} mskskin_t;
typedef struct
{
char name[SKM_MAX_NAME];
float *influences;
unsigned int *bones;
unsigned int numverts;
vec4_t *xyzArray;
vec4_t *normalsArray;
vec2_t *stArray;
vec4_t *sVectorsArray;
unsigned int numtris;
elem_t *elems;
unsigned int numreferences;
unsigned int *references;
mskskin_t skin;
} mskmesh_t;
typedef struct
{
char name[SKM_MAX_NAME];
signed int parent;
unsigned int flags;
} mskbone_t;
typedef struct
{
vec3_t mins, maxs;
float radius;
bonepose_t *boneposes;
} mskframe_t;
typedef struct
{
unsigned int numbones;
mskbone_t *bones;
unsigned int nummeshes;
mskmesh_t *meshes;
unsigned int numframes;
mskframe_t *frames;
bonepose_t *invbaseposes;
} mskmodel_t;
/*
==============================================================================
@ -317,32 +255,27 @@ SPRITE MODELS
==============================================================================
*/
#ifdef QUAKE2_JUNK
//
// in memory representation
//
typedef struct
{
int width, height;
int origin_x, origin_y; // raster coordinates inside pic
int width, height;
int origin_x, origin_y; // raster coordinates inside pic
char name[SPRITE_MAX_NAME];
ref_shader_t *shader;
char name[64];
ref_shader_t *shader;
float mins[3], maxs[3];
float radius;
float mins[3], maxs[3];
float radius;
} sframe_t;
typedef struct
{
int numframes;
int numframes;
sframe_t *frames;
} smodel_t;
#endif
//===================================================================
//
@ -379,18 +312,15 @@ void R_InitModels( void );
void R_ShutdownModels( void );
void Mod_ClearAll( void );
ref_model_t *Mod_ForName( const char *name, bool crash );
ref_model_t *Mod_ForName( const char *name, bool crash );
mleaf_t *Mod_PointInLeaf( float *p, ref_model_t *model );
byte *Mod_ClusterPVS( int cluster, ref_model_t *model );
uint Mod_Handle( ref_model_t *mod );
ref_model_t *Mod_ForHandle( unsigned int elem );
unsigned int Mod_Handle( ref_model_t *mod );
ref_model_t *Mod_ForHandle( unsigned int elem );
#define Mod_Malloc( mod, size ) Mem_Alloc( ( mod )->mempool, size )
#define Mod_Malloc( mod, size ) Mem_Alloc(( mod )->mempool, size )
#define Mod_Free( data ) Mem_Free( data )
void Mod_StripLODSuffix( char *name );
void Mod_Modellist_f( void );
#endif /*__R_MODEL_H__*/

View File

@ -502,11 +502,11 @@ int R_GetClippedFragments( const vec3_t origin, float radius, vec3_t axis[3], in
VectorCopy( axis[i], fragmentPlanes[i*2].normal );
fragmentPlanes[i*2].dist = d - radius;
PlaneClassify( &fragmentPlanes[i*2] );
fragmentPlanes[i*2].type = PlaneTypeForNormal( fragmentPlanes[i*2].normal );
VectorNegate( axis[i], fragmentPlanes[i*2+1].normal );
fragmentPlanes[i*2+1].dist = -d - radius;
PlaneClassify( &fragmentPlanes[i*2+1] );
fragmentPlanes[i*2+1].type = PlaneTypeForNormal( fragmentPlanes[i*2+1].normal );
}
R_RecursiveFragmentNode ();

View File

@ -22,14 +22,15 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "r_local.h"
#define APPLICATION "Xash3D"
#define MAX_GLSL_PROGRAMS 1024
#define APPLICATION "Xash3D"
#define MAX_GLSL_PROGRAMS 1024
#define R_GLSLProgramCopyString( str ) com.stralloc( r_glslProgramsPool, str, __FILE__, __LINE__ )
typedef struct
{
int bit;
const char *define;
const char *suffix;
int bit;
const char *define;
const char *suffix;
} glsl_feature_t;
typedef struct
@ -77,9 +78,9 @@ R_InitGLSLPrograms
*/
void R_InitGLSLPrograms( void )
{
int features = 0;
int features = 0;
memset( r_glslprograms, 0, sizeof( r_glslprograms ) );
Mem_Set( r_glslprograms, 0, sizeof( r_glslprograms ));
if( !GL_Support( R_SHADER_GLSL100_EXT ))
return;
@ -109,21 +110,6 @@ void R_InitGLSLPrograms( void )
R_RegisterGLSLProgram( DEFAULT_GLSL_OUTLINE_PROGRAM, r_defaultOutlineGLSLProgram, 0|features );
}
/*
================
R_GLSLProgramCopyString
================
*/
static char *R_GLSLProgramCopyString( const char *in )
{
char *out;
out = Mem_Alloc( r_glslProgramsPool, ( strlen( in ) + 1 ) );
strcpy( out, in );
return out;
}
/*
================
R_DeleteGLSLProgram
@ -151,7 +137,7 @@ static void R_DeleteGLSLProgram( glsl_program_t *program )
if( program->name )
Mem_Free( program->name );
memset( program, 0, sizeof( glsl_program_t ) );
Mem_Set( program, 0, sizeof( glsl_program_t ));
}
/*
@ -1008,10 +994,10 @@ R_ProgramList_f
*/
void R_ProgramList_f( void )
{
int i;
int i;
glsl_program_t *program;
string fullName;
const char **header;
string fullName;
const char **header;
Msg( "------------------\n" );
for( i = 0, program = r_glslprograms; i < MAX_GLSL_PROGRAMS; i++, program++ )
@ -1020,7 +1006,7 @@ void R_ProgramList_f( void )
break;
com.strncpy( fullName, program->name, sizeof( fullName ) );
header = R_ProgramFeatures2Defines( program->features, fullName, sizeof( fullName ) );
header = R_ProgramFeatures2Defines( program->features, fullName, sizeof( fullName ));
Msg( " %3i %s\n", i+1, fullName );
}
@ -1118,16 +1104,11 @@ R_GetProgramUniformLocations
*/
static void R_GetProgramUniformLocations( glsl_program_t *program )
{
int i;
int locBaseTexture,
locNormalmapTexture,
locGlossTexture,
locDecalTexture,
locLightmapTexture[LM_STYLES],
locDuDvMapTexture,
locReflectionTexture,
locRefractionTexture,
locShadowmapTexture;
int i;
int locBaseTexture, locNormalmapTexture, locGlossTexture;
int locDecalTexture, locLightmapTexture[LM_STYLES];
int locDuDvMapTexture, locReflectionTexture;
int locRefractionTexture, locShadowmapTexture;
char uniformName[128];
program->locEyeOrigin = pglGetUniformLocationARB( program->object, "EyeOrigin" );
@ -1174,25 +1155,17 @@ static void R_GetProgramUniformLocations( glsl_program_t *program )
program->locProjDistance = pglGetUniformLocationARB( program->object, "ProjDistance" );
if( locBaseTexture >= 0 )
pglUniform1iARB( locBaseTexture, 0 );
if( locDuDvMapTexture >= 0 )
pglUniform1iARB( locDuDvMapTexture, 0 );
if( locBaseTexture >= 0 ) pglUniform1iARB( locBaseTexture, 0 );
if( locDuDvMapTexture >= 0 ) pglUniform1iARB( locDuDvMapTexture, 0 );
if( locNormalmapTexture >= 0 )
pglUniform1iARB( locNormalmapTexture, 1 );
if( locGlossTexture >= 0 )
pglUniform1iARB( locGlossTexture, 2 );
if( locDecalTexture >= 0 )
pglUniform1iARB( locDecalTexture, 3 );
if( locNormalmapTexture >= 0 ) pglUniform1iARB( locNormalmapTexture, 1 );
if( locGlossTexture >= 0 ) pglUniform1iARB( locGlossTexture, 2 );
if( locDecalTexture >= 0 ) pglUniform1iARB( locDecalTexture, 3 );
if( locReflectionTexture >= 0 )
pglUniform1iARB( locReflectionTexture, 2 );
if( locRefractionTexture >= 0 )
pglUniform1iARB( locRefractionTexture, 3 );
if( locReflectionTexture >= 0 ) pglUniform1iARB( locReflectionTexture, 2 );
if( locRefractionTexture >= 0 ) pglUniform1iARB( locRefractionTexture, 3 );
if( locShadowmapTexture >= 0 )
pglUniform1iARB( locShadowmapTexture, 0 );
if( locShadowmapTexture >= 0 ) pglUniform1iARB( locShadowmapTexture, 0 );
for( i = 0; i < LM_STYLES; i++ )
{
@ -1208,8 +1181,8 @@ R_ShutdownGLSLPrograms
*/
void R_ShutdownGLSLPrograms( void )
{
int i;
glsl_program_t *program;
int i;
glsl_program_t *program;
if( !r_glslProgramsPool )
return;
@ -1225,4 +1198,4 @@ void R_ShutdownGLSLPrograms( void )
}
Mem_FreePool( &r_glslProgramsPool );
}
}

View File

@ -26,21 +26,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define MAX_POLY_VERTS 3000
#define MAX_POLYS 2048
// skm flags
#define SKM_ATTACHMENT_BONE 1
typedef struct
{
vec3_t axis[3];
vec3_t origin;
} orientation_t;
typedef struct
{
quat_t quat;
vec3_t origin;
} bonepose_t;
typedef struct
{
float rgb[3]; // 0.0 - 2.0
@ -132,13 +123,11 @@ typedef struct entity_s
vec3_t movedir; // forward vector that computed on a server
vec3_t origin, origin2;
vec3_t lightingOrigin;
bonepose_t *boneposes; // pretransformed boneposes for current frame
/*
** previous data for lerping
*/
int oldframe;
bonepose_t *oldboneposes; // pretransformed boneposes for old frame
/*
** texturing
@ -171,35 +160,22 @@ typedef struct entity_s
void R_ModelBounds( const struct ref_model_s *model, vec3_t mins, vec3_t maxs );
struct ref_model_s *R_RegisterModel( const char *name );
struct ref_shader_s *R_RegisterPic( const char *name );
struct ref_shader_s *R_RegisterShader( const char *name );
struct ref_shader_s *R_RegisterSkin( const char *name );
struct skinfile_s *R_RegisterSkinFile( const char *name );
void R_ClearScene( void );
void R_AddLightToScene( const vec3_t org, float intensity, float r, float g, float b, const struct ref_shader_s *shader );
bool R_AddPolyToScene( const poly_t *poly );
void R_AddLightStyleToScene( int style, float r, float g, float b );
void R_DrawStretchPic( float x, float y, float w, float h, float s1, float t1, float s2, float t2, shader_t shader );
void R_DrawStretchRaw( int x, int y, int w, int h, int cols, int rows, const byte *data, bool redraw );
void R_SetCustomColor( int num, int r, int g, int b );
void R_LightForOrigin( const vec3_t origin, vec3_t dir, vec4_t ambient, vec4_t diffuse, float radius );
bool R_LerpTag( orientation_t *orient, const struct ref_model_s *mod, int oldframe, int frame, float lerpfrac,
const char *name );
int R_SkeletalGetNumBones( const struct ref_model_s *mod, int *numFrames );
int R_SkeletalGetBoneInfo( const struct ref_model_s *mod, int bone, char *name, size_t name_size, int *flags );
void R_SkeletalGetBonePose( const struct ref_model_s *mod, int bone, int frame, bonepose_t *bonepose );
int R_GetClippedFragments( const vec3_t origin, float radius, vec3_t axis[3], int maxfverts, vec3_t *fverts,
int maxfragments, fragment_t *fragments );
void R_TransformVectorToScreen( const ref_params_t *rd, const vec3_t in, vec2_t out );
void R_ClearScene( void );
void R_AddLightToScene( const vec3_t org, float intensity, float r, float g, float b, const struct ref_shader_s *shader );
bool R_AddPolyToScene( const poly_t *poly );
void R_AddLightStyleToScene( int style, float r, float g, float b );
void R_DrawStretchPic( float x, float y, float w, float h, float s1, float t1, float s2, float t2, shader_t shader );
void R_DrawStretchRaw( int x, int y, int w, int h, int cols, int rows, const byte *data, bool redraw );
void R_SetCustomColor( int num, int r, int g, int b );
void R_LightForOrigin( const vec3_t origin, vec3_t dir, vec4_t ambient, vec4_t diffuse, float radius );
bool R_LerpTag( orientation_t *orient, const struct ref_model_s *mod, int oldframe, int frame, float lerpfrac, const char *name );
int R_GetClippedFragments( const vec3_t origin, float radius, vec3_t axis[3], int maxfverts, vec3_t *fverts,
int maxfragments, fragment_t *fragments );
void R_TransformVectorToScreen( const ref_params_t *rd, const vec3_t in, vec2_t out );
const char *R_SpeedsMessage( char *out, size_t size );
void GLimp_AppActivate( bool active );
// Xash renderer exports
bool R_Init( bool full );

View File

@ -41,6 +41,7 @@ cvar_t *r_ignorehwgamma;
cvar_t *r_check_errors;
cvar_t *r_overbrightbits;
cvar_t *r_mapoverbrightbits;
cvar_t *r_vertexbuffers;
cvar_t *r_flares;
cvar_t *r_flaresize;
cvar_t *r_flarefade;
@ -533,6 +534,7 @@ void GL_InitCommands( void )
r_ignorehwgamma = Cvar_Get( "r_ignorehwgamma", "0", CVAR_ARCHIVE|CVAR_LATCH_VIDEO, "ignore hardware gamma (e.g. not support)" );
r_overbrightbits = Cvar_Get( "r_overbrightbits", "1", CVAR_ARCHIVE|CVAR_LATCH_VIDEO, "renderer overbright bits" );
r_mapoverbrightbits = Cvar_Get( "r_mapoverbrightbits", "2", CVAR_ARCHIVE|CVAR_LATCH_VIDEO, "current map overbright bits" );
r_vertexbuffers = Cvar_Get( "r_vertexbuffers", "0", CVAR_ARCHIVE, "store vertex data in VBOs" );
r_detailtextures = Cvar_Get( "r_detailtextures", "1", CVAR_ARCHIVE, "enable or disable detail textures" );
r_flares = Cvar_Get( "r_flares", "0", CVAR_ARCHIVE, "enable flares rendering" );
@ -550,7 +552,7 @@ void GL_InitCommands( void )
r_fastsky = Cvar_Get( "r_fastsky", "0", CVAR_ARCHIVE, "enable algorhytem fo fast sky rendering (for old machines)" );
r_portalonly = Cvar_Get( "r_portalonly", "0", 0, "render only portals" );
r_portalmaps = Cvar_Get( "r_portalmaps", "1", CVAR_ARCHIVE|CVAR_LATCH_VIDEO, "use portal maps for portal rendering" );
r_portalmaps_maxtexsize = Cvar_Get( "r_portalmaps_maxtexsize", "800", CVAR_ARCHIVE, "portal maps texture dims" );
r_portalmaps_maxtexsize = Cvar_Get( "r_portalmaps_maxtexsize", "512", CVAR_ARCHIVE, "portal maps texture dims" );
r_allow_software = Cvar_Get( "r_allow_software", "0", 0, "allow OpenGL software emulation" );
r_3dlabs_broken = Cvar_Get( "r_3dlabs_broken", "1", CVAR_ARCHIVE, "3dLabs renderer issues" );
@ -650,7 +652,7 @@ void GL_InitBackend( void )
if(FS_GetParmFromCmdLine( "-dev", dev_level ))
glw_state.developer = com.atoi( dev_level );
GL_SetDefaultState(); // FIXME stupid name for allocate arrays
GL_SetDefaultState();
}
void GL_ShutdownBackend( void )
@ -800,21 +802,7 @@ GL_SetDefaultState
*/
static void GL_SetDefaultState( void )
{
// FIXME: dynamically allocate these?
static GLuint r_currentTextures[MAX_TEXTURE_UNITS];
static int r_currentEnvModes[MAX_TEXTURE_UNITS];
static bool r_texIdentityMatrix[MAX_TEXTURE_UNITS];
static int r_genSTEnabled[MAX_TEXTURE_UNITS];
static int r_texCoordArrayMode[MAX_TEXTURE_UNITS];
Mem_Set( &glState, 0, sizeof( glState ));
glState.currentTextures = r_currentTextures;
glState.currentEnvModes = r_currentEnvModes;
glState.texIdentityMatrix = r_texIdentityMatrix;
glState.genSTEnabled = r_genSTEnabled;
glState.texCoordArrayMode = r_texCoordArrayMode;
GL_SetDefaultTexState ();
glState.initializedMedia = false;
@ -1028,11 +1016,6 @@ void GL_InitExtensions( void )
Image_Init( NULL, flags );
glw_state.initialized = true;
// gl_ext_vertex_buffer_object is crashy..
// FIXME: QFusion render bug
Cvar_Set( "gl_vertex_buffer_object", "0" );
GL_SetExtension( R_ARB_VERTEX_BUFFER_OBJECT_EXT, false );
}
/*
@ -1136,4 +1119,26 @@ void R_Shutdown( bool full )
// shut down OS specific OpenGL stuff like contexts, etc.
R_Free_OpenGL();
}
}
/*
===============
R_NewMap
do some cleanup operations
===============
*/
void R_NewMap( void )
{
R_ShutdownOcclusionQueries();
R_FreeMeshLists();
R_InitMeshLists();
R_InitOcclusionQueries();
R_InitLightStyles(); // clear lightstyles
R_InitCustomColors(); // clear custom colors
GL_SetDefaultTexState ();
Mem_Set( &RI, 0, sizeof( refinst_t ));
}

View File

@ -1444,10 +1444,10 @@ static bool Shaderpass_NormalMap( ref_shader_t *shader, ref_stage_t *pass, scrip
static bool Shaderpass_Material( ref_shader_t *shader, ref_stage_t *pass, script_t *script )
{
int flags;
float bumpScale = 0;
string name;
token_t tok;
int flags;
float bumpScale = 0;
const char *name;
token_t tok;
if( !GL_Support( R_SHADER_GLSL100_EXT ))
{
@ -1469,17 +1469,24 @@ static bool Shaderpass_Material( ref_shader_t *shader, ref_stage_t *pass, script
pass->flags &= ~(SHADERSTAGE_ANIMFREQUENCY|SHADERSTAGE_FRAMES);
}
com.strncpy( name, tok.string, sizeof( name ));
flags = Shader_SetImageFlags( shader );
while( 1 )
{
if( !Com_ReadToken( script, SC_ALLOW_PATHNAMES2, &tok ))
break;
if( !Com_ReadToken( script, SC_ALLOW_PATHNAMES2, &tok ));
return false;
com.strncat( name, " ", sizeof( name ));
com.strncat( name, tok.string, sizeof( name ));
if( !com.stricmp( tok.string, "$rgb" ))
{
if( !Com_ReadToken( script, SC_ALLOW_PATHNAMES2, &tok ));
return false;
name = va( "clearPixels( \"%s\", alpha );", tok.string );
}
else if( !com.stricmp( tok.string, "$alpha" ))
{
if( !Com_ReadToken( script, SC_ALLOW_PATHNAMES2, &tok ));
return false;
name = va( "clearPixels( \"%s\", color );", tok.string );
}
else name = tok.string;
pass->textures[0] = Shader_FindImage( shader, name, flags );
if( pass->textures[0] == tr.defaultTexture )
@ -2398,6 +2405,11 @@ void R_ShaderDump_f( void )
Msg( "^1%s%s\n", name, cache->buffer );
}
void R_RegisterBuiltinShaders( void )
{
tr.defaultShader = R_LoadShader( "*black", SHADER_NOMIP, true, (TF_NOMIPMAP|TF_NOPICMIP), SHADER_UNKNOWN );
}
void R_InitShaders( void )
{
script_t *script;
@ -2432,6 +2444,8 @@ void R_InitShaders( void )
r_spriteFrequency = 0.0f;
r_numSpriteTextures = 0;
r_spriteRenderMode = kRenderNormal;
R_RegisterBuiltinShaders ();
}
void Shader_TouchImages( ref_shader_t *shader, bool free_unused )
@ -3518,14 +3532,14 @@ ref_shader_t *R_LoadShader( const char *name, int type, bool forceDefault, int a
shortname[length] = 0;
// see if already loaded
hashKey = Com_HashKey( name, SHADERS_HASH_SIZE );
hashKey = Com_HashKey( shortname, SHADERS_HASH_SIZE );
for( shader = r_shadersHash[hashKey]; shader; shader = shader->nextHash )
{
if( shader->type != type || ( shader->type == ignoreType ))
continue;
if( !com.stricmp( shader->name, name ))
if( !com.stricmp( shader->name, shortname ))
{
// prolonge registration
Shader_TouchImages( shader, false );
@ -3634,21 +3648,4 @@ void R_ShaderSetRenderMode( kRenderMode_t mode )
void R_ShaderAddSpriteIntervals( float interval )
{
r_spriteFrequency += interval;
}
// FIXME: get rid of this
ref_shader_t *R_RegisterPic( const char *name )
{
return R_LoadShader( name, SHADER_NOMIP, false, 0, SHADER_INVALID );
}
ref_shader_t *R_RegisterShader( const char *name )
{
return R_LoadShader( name, SHADER_TEXTURE, false, 0, SHADER_INVALID );
}
ref_shader_t *R_RegisterSkin( const char *name )
{
return R_LoadShader( name, SHADER_ALIAS, false, 0, SHADER_INVALID );
}
}

View File

@ -288,10 +288,18 @@ bool R_AddShadowCaster( ref_entity_t *ent )
r_numShadowGroups++;
add:
// get model bounds
if( ent->model->type == mod_alias )
switch( ent->model->type )
{
case mod_alias:
R_AliasModelBBox( ent, mins, maxs );
else
R_SkeletalModelBBox( ent, mins, maxs );
break;
case mod_studio:
break;
default:
VectorClear( mins );
VectorClear( maxs );
break;
}
for( i = 0; i < 3; i++ )
{

View File

@ -20,143 +20,23 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "r_local.h"
#define SkinFile_CopyString( str ) com.stralloc( r_skinsPool, str, __FILE__, __LINE__ )
typedef struct
{
char *meshname;
ref_shader_t *shader;
char *meshname;
ref_shader_t *shader;
} mesh_shader_pair_t;
typedef struct skinfile_s
{
char *name;
char *name;
mesh_shader_pair_t *pairs;
int numpairs;
int numpairs;
} skinfile_t;
static skinfile_t r_skinfiles[MAX_SKINFILES];
static byte *r_skinsPool;
// Com_ParseExt it's temporary stuff
#define MAX_TOKEN_CHARS 1024
char com_token[MAX_TOKEN_CHARS];
/*
==============
COM_ParseExt
Parse a token out of a string
==============
*/
char *COM_ParseExt( const char **data_p, bool nl )
{
int c;
int len;
const char *data;
bool newlines = false;
data = *data_p;
len = 0;
com_token[0] = 0;
if (!data)
{
*data_p = NULL;
return "";
}
// skip whitespace
skipwhite:
while ( (c = *data) <= ' ')
{
if (c == 0)
{
*data_p = NULL;
return "";
}
if (c == '\n')
newlines = true;
data++;
}
if ( newlines && !nl )
{
*data_p = data;
return com_token;
}
// skip // comments
if (c == '/' && data[1] == '/')
{
data += 2;
while (*data && *data != '\n')
data++;
goto skipwhite;
}
// skip /* */ comments
if (c == '/' && data[1] == '*')
{
data += 2;
while (1)
{
if (!*data)
break;
if (*data != '*' || *(data+1) != '/')
data++;
else
{
data += 2;
break;
}
}
goto skipwhite;
}
// handle quoted strings specially
if (c == '\"')
{
data++;
while (1)
{
c = *data++;
if (c=='\"' || !c)
{
if (len == MAX_TOKEN_CHARS)
len = 0;
com_token[len] = 0;
*data_p = data;
return com_token;
}
if (len < MAX_TOKEN_CHARS)
{
com_token[len] = c;
len++;
}
}
}
// parse a regular word
do
{
if (len < MAX_TOKEN_CHARS)
{
com_token[len] = c;
len++;
}
data++;
c = *data;
} while (c>32);
if (len == MAX_TOKEN_CHARS)
len = 0;
com_token[len] = 0;
*data_p = data;
return com_token;
}
static skinfile_t r_skinfiles[MAX_SKINFILES];
static byte *r_skinsPool;
/*
================
@ -166,23 +46,7 @@ R_InitSkinFiles
void R_InitSkinFiles( void )
{
r_skinsPool = Mem_AllocPool( "Skins" );
memset( r_skinfiles, 0, sizeof( r_skinfiles ) );
}
/*
================
SkinFile_CopyString
================
*/
static char *SkinFile_CopyString( const char *in )
{
char *out;
out = Mem_Alloc( r_skinsPool, ( strlen( in ) + 1 ) );
strcpy( out, in );
return out;
Mem_Set( r_skinfiles, 0, sizeof( r_skinfiles ));
}
/*
@ -192,15 +56,14 @@ SkinFile_FreeSkinFile
*/
static void SkinFile_FreeSkinFile( skinfile_t *skinfile )
{
int i;
int i;
for( i = 0; i < skinfile->numpairs; i++ )
Mem_Free( skinfile->pairs[i].meshname );
Mem_Free( skinfile->pairs );
Mem_Free( skinfile->name );
memset( skinfile, 0, sizeof( skinfile_t ) );
Mem_Set( skinfile, 0, sizeof( skinfile_t ));
}
/*
@ -232,33 +95,40 @@ SkinFile_ParseBuffer
*/
static int SkinFile_ParseBuffer( char *buffer, mesh_shader_pair_t *pairs )
{
int numpairs;
char *ptr, *t, *token;
int numpairs;
string skinname;
string meshname;
script_t *script;
token_t tok;
ptr = buffer;
script = Com_OpenScript( "skinfile", buffer, com.strlen( buffer ));
numpairs = 0;
while( ptr )
while( 1 )
{
token = COM_ParseExt( &ptr, false );
if( !token[0] )
continue;
t = strchr( token, ',' );
if( !t )
continue;
if( *( t+1 ) == '\0' || *( t+1 ) == '\n' )
continue;
if( !Com_ReadToken( script, SC_ALLOW_NEWLINES, &tok )) // skip tag
break;
if( !com.strcmp( tok.string, "," ))
{
if( !Com_ReadToken( script, SC_ALLOW_PATHNAMES, &tok ))
continue; // tag without shadername
com.strncpy( skinname, tok.string, sizeof( skinname ));
FS_StripExtension( skinname );
}
else
{
com.strncpy( meshname, tok.string, sizeof( meshname ));
continue; // waiting for ','
}
if( pairs )
{
*t = 0;
pairs[numpairs].meshname = SkinFile_CopyString( token );
pairs[numpairs].shader = R_RegisterSkin( token + strlen( token ) + 1 );
pairs[numpairs].meshname = SkinFile_CopyString( meshname );
pairs[numpairs].shader = R_LoadShader( skinname, SHADER_ALIAS, false, 0, SHADER_INVALID );
}
numpairs++;
}
Com_CloseScript( script );
return numpairs;
}

View File

@ -284,7 +284,8 @@ void Mod_LoadSkeletalModel( ref_model_t *mod, ref_model_t *parent, const void *b
com.strncpy( poutmesh->name, pinmesh->meshname, sizeof( poutmesh->name ) );
Mod_StripLODSuffix( poutmesh->name );
poutmesh->skin.shader = R_RegisterSkin( pinmesh->shadername );
FS_StripExtension( pinmesh->shadername );
poutmesh->skin.shader = R_LoadShader( pinmesh->shadername, SHADER_ALIAS, false, 0, SHADER_INVALID );
R_DeformvBBoxForShader( poutmesh->skin.shader, ebbox );
pinreferences = ( elem_t *)( ( byte * )pinmodel + LittleLong( pinmesh->ofs_references ) );

View File

@ -253,22 +253,12 @@ Draw dummy skybox side to prevent the HOM effect
*/
static void R_DrawBlackBottom( skydome_t *skydome )
{
int features;
ref_shader_t *shader;
int features;
// FIXME: register another shader instead maybe?
shader = R_OcclusionShader ();
features = shader->features;
features = tr.defaultShader->features;
if( r_shownormals->integer )
features |= MF_NORMALS;
// HACKHACK skies ought not to write to depth buffer
shader->flags &= ~SHADER_DEPTHWRITE;
shader->stages[0].glState &= ~GLSTATE_DEPTHWRITE;
R_DrawSkySide( skydome, 5, shader, features );
shader->stages[0].glState |= GLSTATE_DEPTHWRITE;
shader->flags |= SHADER_DEPTHWRITE;
R_DrawSkySide( skydome, 5, tr.defaultShader, features );
}
/*
@ -370,8 +360,7 @@ void R_DrawSky( ref_shader_t *shader )
for( i = 0; i < 5; i++ )
{
if( RI.skyMins[0][i] >= RI.skyMaxs[0][i] ||
RI.skyMins[1][i] >= RI.skyMaxs[1][i] )
if( RI.skyMins[0][i] >= RI.skyMaxs[0][i] || RI.skyMins[1][i] >= RI.skyMaxs[1][i] )
continue;
flush = true;
@ -382,9 +371,7 @@ void R_DrawSky( ref_shader_t *shader )
skydome->meshes[i].stArray = skydome->sphereStCoords[i];
R_PushMesh( &skydome->meshes[i], features );
}
if( flush )
R_RenderMeshBuffer( mbuffer );
if( flush ) R_RenderMeshBuffer( mbuffer );
}
if( skydome->nearboxShaders[0] )

View File

@ -335,10 +335,10 @@ R_RecursiveWorldNode
*/
static void R_RecursiveWorldNode( mnode_t *node, unsigned int clipflags, unsigned int dlightbits )
{
unsigned int i, newDlightbits;
unsigned int bit;
const cplane_t *clipplane;
mleaf_t *pleaf;
uint i, newDlightbits;
const cplane_t *clipplane;
int clipped;
mleaf_t *pleaf;
while( 1 )
{
@ -347,18 +347,16 @@ static void R_RecursiveWorldNode( mnode_t *node, unsigned int clipflags, unsigne
if( clipflags )
{
for( i = sizeof( RI.frustum )/sizeof( RI.frustum[0] ), bit = 1, clipplane = RI.frustum; i > 0; i--, bit<<=1, clipplane++ )
for( i = 0, clipplane = RI.frustum; i < 6; i++, clipplane++ )
{
if( clipflags & bit )
{
int clipped = BoxOnPlaneSide( node->mins, node->maxs, clipplane );
if( clipped == 2 )
return;
if( clipped == 1 )
clipflags &= ~bit; // node is entirely on screen
}
if(!(clipflags & (1<<i)))
continue;
clipped = BoxOnPlaneSide( node->mins, node->maxs, clipplane );
if( clipped == 2 ) return;
if( clipped == 1 ) clipflags &= ~(1<<i);
}
}
}
if( !node->plane )
break;
@ -368,16 +366,16 @@ static void R_RecursiveWorldNode( mnode_t *node, unsigned int clipflags, unsigne
{
float dist;
for( i = 0, bit = 1; i < r_numDlights; i++, bit <<= 1 )
for( i = 0; i < r_numDlights; i++ )
{
if( !( dlightbits & bit ) )
if( !( dlightbits & (1<<i)))
continue;
dist = PlaneDiff( r_dlights[i].origin, node->plane );
if( dist < -r_dlights[i].intensity )
dlightbits &= ~bit;
dlightbits &= ~(1<<i);
if( dist < r_dlights[i].intensity )
newDlightbits |= bit;
newDlightbits |= (1<<i);
}
}
@ -442,10 +440,10 @@ R_LinearShadowLeafs
*/
static void R_LinearShadowLeafs( void )
{
unsigned int i, j;
unsigned int cpf, bit;
const cplane_t *clipplane;
mleaf_t *pleaf;
uint i, j;
uint cpf;
const cplane_t *clipplane;
mleaf_t *pleaf;
for( j = r_worldbrushmodel->numleafs, pleaf = r_worldbrushmodel->leafs; j > 0; j--, pleaf++ )
{
@ -455,16 +453,15 @@ static void R_LinearShadowLeafs( void )
continue;
cpf = RI.clipFlags;
for( i = sizeof( RI.frustum )/sizeof( RI.frustum[0] ), bit = 1, clipplane = RI.frustum; i > 0; i--, bit<<=1, clipplane++ )
for( i = 0, clipplane = RI.frustum; i < 6; i++, clipplane++ )
{
int clipped = BoxOnPlaneSide( pleaf->mins, pleaf->maxs, clipplane );
if( clipped == 2 )
break;
if( clipped == 1 )
cpf &= ~bit; // leaf is entirely on screen
if( clipped == 2 ) break;
if( clipped == 1 ) cpf &= ~(1<<i);
}
if( !i ) {
if( !i )
{
R_MarkShadowLeafSurfaces( pleaf->firstVisSurface, cpf );
c_world_leafs++;
}

View File

@ -194,10 +194,6 @@ SOURCE=.\r_skin.c
# End Source File
# Begin Source File
SOURCE=.\r_skm.c
# End Source File
# Begin Source File
SOURCE=.\r_sky.c
# End Source File
# Begin Source File

View File

@ -6,6 +6,51 @@
--------------------Configuration: render - Win32 Debug--------------------
</h3>
<h3>Command Lines</h3>
Creating temporary file "C:\DOCUME~1\MIKE~1.MIK\LOCALS~1\Temp\RSPD5.tmp" with contents
[
/nologo /MDd /W3 /Gm /Gi /GX /ZI /Od /I "../public" /I "../common" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FR"..\temp\render\!debug/" /Fo"..\temp\render\!debug/" /Fd"..\temp\render\!debug/" /FD /c
"D:\Xash3D\src_main\render\r_image.c"
]
Creating command line "cl.exe @C:\DOCUME~1\MIKE~1.MIK\LOCALS~1\Temp\RSPD5.tmp"
Creating temporary file "C:\DOCUME~1\MIKE~1.MIK\LOCALS~1\Temp\RSPD6.tmp" with contents
[
msvcrtd.lib user32.lib gdi32.lib /nologo /subsystem:windows /dll /incremental:yes /pdb:"..\temp\render\!debug/render.pdb" /debug /machine:I386 /nodefaultlib:"msvcrt.lib" /out:"..\temp\render\!debug/render.dll" /implib:"..\temp\render\!debug/render.lib" /pdbtype:sept
"\Xash3D\src_main\temp\render\!debug\cin.obj"
"\Xash3D\src_main\temp\render\!debug\r_alias.obj"
"\Xash3D\src_main\temp\render\!debug\r_backend.obj"
"\Xash3D\src_main\temp\render\!debug\r_bloom.obj"
"\Xash3D\src_main\temp\render\!debug\r_cin.obj"
"\Xash3D\src_main\temp\render\!debug\r_cull.obj"
"\Xash3D\src_main\temp\render\!debug\r_draw.obj"
"\Xash3D\src_main\temp\render\!debug\r_image.obj"
"\Xash3D\src_main\temp\render\!debug\r_light.obj"
"\Xash3D\src_main\temp\render\!debug\r_main.obj"
"\Xash3D\src_main\temp\render\!debug\r_math.obj"
"\Xash3D\src_main\temp\render\!debug\r_mesh.obj"
"\Xash3D\src_main\temp\render\!debug\r_model.obj"
"\Xash3D\src_main\temp\render\!debug\r_opengl.obj"
"\Xash3D\src_main\temp\render\!debug\r_poly.obj"
"\Xash3D\src_main\temp\render\!debug\r_program.obj"
"\Xash3D\src_main\temp\render\!debug\r_register.obj"
"\Xash3D\src_main\temp\render\!debug\r_shader.obj"
"\Xash3D\src_main\temp\render\!debug\r_shadow.obj"
"\Xash3D\src_main\temp\render\!debug\r_skin.obj"
"\Xash3D\src_main\temp\render\!debug\r_sky.obj"
"\Xash3D\src_main\temp\render\!debug\r_surf.obj"
]
Creating command line "link.exe @C:\DOCUME~1\MIKE~1.MIK\LOCALS~1\Temp\RSPD6.tmp"
Creating temporary file "C:\DOCUME~1\MIKE~1.MIK\LOCALS~1\Temp\RSPD7.bat" with contents
[
@echo off
copy \Xash3D\src_main\temp\render\!debug\render.dll "D:\Xash3D\bin\render.dll"
]
Creating command line "C:\DOCUME~1\MIKE~1.MIK\LOCALS~1\Temp\RSPD7.bat"
Compiling...
r_image.c
Linking...
<h3>Output Window</h3>
Performing Custom Build Step on \Xash3D\src_main\temp\render\!debug\render.dll
‘ª®¯¨à®¢ ­® ä ©«®¢: 1.

View File

@ -1134,12 +1134,13 @@ const char *GetGameDescription( void )
{
char token[256];
char szbuffer[128];
char *pfile = (char *)LOAD_FILE( "gameinfo.txt", NULL );
char *afile, *pfile = (char *)LOAD_FILE( "gameinfo.txt", NULL );
memset( text, 0, sizeof( text ));
if( pfile )
{
afile = pfile;
while( pfile )
{
if( !stricmp( token, "title" ))
@ -1155,7 +1156,7 @@ const char *GetGameDescription( void )
}
pfile = COM_ParseFile( pfile, token );
}
COM_FreeFile( pfile );
COM_FreeFile( afile );
return text;
}
return "Half-Life";

View File

@ -1397,6 +1397,7 @@ void UTIL_PrecacheResourse( void )
char *pfile = (char *)LOAD_FILE( "scripts/precache.txt", NULL );
if( pfile )
{
char *afile = pfile;
while( pfile )
{
if( !stricmp( token, "entity" ))
@ -1436,7 +1437,7 @@ void UTIL_PrecacheResourse( void )
}
pfile = COM_ParseFile( pfile, token );
}
COM_FreeFile( pfile );
COM_FreeFile( afile );
}
}

View File

@ -3859,23 +3859,24 @@ void CBasePlayer::CheatImpulseCommands( int iImpulse )
{
gEvilImpulse101 = TRUE;
char *pfile = (char *)LOAD_FILE( "scripts/impulse101.txt", NULL );
int ItemName [256];
int ItemName[256];
int count = 0;
char token[32];
if(pfile)
if( pfile )
{
while ( pfile )
char *afile = pfile;
while( pfile )
{
//parsing impulse101.txt
pfile = COM_ParseFile(pfile, token);
if(strlen(token))
// parsing impulse101.txt
pfile = COM_ParseFile( pfile, token );
if(strlen( token ))
{
ItemName[ count ] = ALLOC_STRING( (char *)token );
ItemName[count] = ALLOC_STRING( (char *)token );
count++;
}
}
COM_FreeFile( pfile );
COM_FreeFile( afile );
for( int i = 0; i < count; i++ )
GiveNamedItem( (char *)STRING( ItemName[i]) );
}

100
server/server.plg Normal file
View File

@ -0,0 +1,100 @@
<html>
<body>
<pre>
<h1>Build Log</h1>
<h3>
--------------------Configuration: server - Win32 Debug--------------------
</h3>
<h3>Command Lines</h3>
Creating temporary file "C:\DOCUME~1\MIKE~1.MIK\LOCALS~1\Temp\RSPBB.tmp" with contents
[
/nologo /MDd /W3 /Gm /Gi /GX /ZI /Od /I "./" /I "ents" /I "game" /I "global" /I "monsters" /I "../common" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FR"..\temp\server\!debug/" /Fo"..\temp\server\!debug/" /Fd"..\temp\server\!debug/" /FD /c
"D:\Xash3D\src_main\server\global\client.cpp"
]
Creating command line "cl.exe @C:\DOCUME~1\MIKE~1.MIK\LOCALS~1\Temp\RSPBB.tmp"
Creating temporary file "C:\DOCUME~1\MIKE~1.MIK\LOCALS~1\Temp\RSPBC.tmp" with contents
[
msvcrtd.lib /nologo /subsystem:windows /dll /incremental:yes /pdb:"..\temp\server\!debug/server.pdb" /debug /machine:I386 /nodefaultlib:"libc.lib" /def:".\server.def" /out:"..\temp\server\!debug/server.dll" /implib:"..\temp\server\!debug/server.lib" /pdbtype:sept
"\Xash3D\src_main\temp\server\!debug\ai_sound.obj"
"\Xash3D\src_main\temp\server\!debug\animating.obj"
"\Xash3D\src_main\temp\server\!debug\animation.obj"
"\Xash3D\src_main\temp\server\!debug\apache.obj"
"\Xash3D\src_main\temp\server\!debug\barnacle.obj"
"\Xash3D\src_main\temp\server\!debug\barney.obj"
"\Xash3D\src_main\temp\server\!debug\basebrush.obj"
"\Xash3D\src_main\temp\server\!debug\baseentity.obj"
"\Xash3D\src_main\temp\server\!debug\basefunc.obj"
"\Xash3D\src_main\temp\server\!debug\basefx.obj"
"\Xash3D\src_main\temp\server\!debug\baseinfo.obj"
"\Xash3D\src_main\temp\server\!debug\baseitem.obj"
"\Xash3D\src_main\temp\server\!debug\baselogic.obj"
"\Xash3D\src_main\temp\server\!debug\basemonster.obj"
"\Xash3D\src_main\temp\server\!debug\basemover.obj"
"\Xash3D\src_main\temp\server\!debug\baseother.obj"
"\Xash3D\src_main\temp\server\!debug\basepath.obj"
"\Xash3D\src_main\temp\server\!debug\basephys.obj"
"\Xash3D\src_main\temp\server\!debug\baserockets.obj"
"\Xash3D\src_main\temp\server\!debug\basetank.obj"
"\Xash3D\src_main\temp\server\!debug\basetrigger.obj"
"\Xash3D\src_main\temp\server\!debug\baseutil.obj"
"\Xash3D\src_main\temp\server\!debug\baseweapon.obj"
"\Xash3D\src_main\temp\server\!debug\baseworld.obj"
"\Xash3D\src_main\temp\server\!debug\client.obj"
"\Xash3D\src_main\temp\server\!debug\combat.obj"
"\Xash3D\src_main\temp\server\!debug\decals.obj"
"\Xash3D\src_main\temp\server\!debug\defaultai.obj"
"\Xash3D\src_main\temp\server\!debug\dll_int.obj"
"\Xash3D\src_main\temp\server\!debug\flyingmonster.obj"
"\Xash3D\src_main\temp\server\!debug\game.obj"
"\Xash3D\src_main\temp\server\!debug\gamerules.obj"
"\Xash3D\src_main\temp\server\!debug\generic.obj"
"\Xash3D\src_main\temp\server\!debug\globals.obj"
"\Xash3D\src_main\temp\server\!debug\gman.obj"
"\Xash3D\src_main\temp\server\!debug\hassassin.obj"
"\Xash3D\src_main\temp\server\!debug\headcrab.obj"
"\Xash3D\src_main\temp\server\!debug\hgrunt.obj"
"\Xash3D\src_main\temp\server\!debug\leech.obj"
"\Xash3D\src_main\temp\server\!debug\legacy.obj"
"\Xash3D\src_main\temp\server\!debug\lights.obj"
"\Xash3D\src_main\temp\server\!debug\multiplay_gamerules.obj"
"\Xash3D\src_main\temp\server\!debug\nodes.obj"
"\Xash3D\src_main\temp\server\!debug\osprey.obj"
"\Xash3D\src_main\temp\server\!debug\parent.obj"
"\Xash3D\src_main\temp\server\!debug\player.obj"
"\Xash3D\src_main\temp\server\!debug\rat.obj"
"\Xash3D\src_main\temp\server\!debug\roach.obj"
"\Xash3D\src_main\temp\server\!debug\saverestore.obj"
"\Xash3D\src_main\temp\server\!debug\scientist.obj"
"\Xash3D\src_main\temp\server\!debug\scripted.obj"
"\Xash3D\src_main\temp\server\!debug\sfx.obj"
"\Xash3D\src_main\temp\server\!debug\singleplay_gamerules.obj"
"\Xash3D\src_main\temp\server\!debug\sound.obj"
"\Xash3D\src_main\temp\server\!debug\squadmonster.obj"
"\Xash3D\src_main\temp\server\!debug\talkmonster.obj"
"\Xash3D\src_main\temp\server\!debug\teamplay_gamerules.obj"
"\Xash3D\src_main\temp\server\!debug\turret.obj"
"\Xash3D\src_main\temp\server\!debug\utils.obj"
"\Xash3D\src_main\temp\server\!debug\weapon_generic.obj"
"\Xash3D\src_main\temp\server\!debug\zombie.obj"
]
Creating command line "link.exe @C:\DOCUME~1\MIKE~1.MIK\LOCALS~1\Temp\RSPBC.tmp"
Creating temporary file "C:\DOCUME~1\MIKE~1.MIK\LOCALS~1\Temp\RSPBD.bat" with contents
[
@echo off
copy \Xash3D\src_main\temp\server\!debug\server.dll "D:\Xash3D\bin\server.dll"
]
Creating command line "C:\DOCUME~1\MIKE~1.MIK\LOCALS~1\Temp\RSPBD.bat"
Compiling...
client.cpp
Linking...
<h3>Output Window</h3>
Performing Custom Build Step on \Xash3D\src_main\temp\server\!debug\server.dll
‘ª®¯¨à®¢ ­® ä ©«®¢: 1.
<h3>Results</h3>
server.dll - 0 error(s), 0 warning(s)
</pre>
</body>
</html>

View File

@ -11,9 +11,6 @@ fopen
âîçâðàùàë.
fopen çàâåøèâàåò ïðèëîæåíèå, äàæå åñëè ïåðåïóòàòü ìåñòàìè + è a, ïðè óñòàíîâêå ðåæèìà!
Memory Leaks:
Filesystem Pool ðàñòåò íà 4 êèëîáàéòà ïîñëå ñìåíû êàðòû
Îòëîæåííûå çàäà÷è:
1. Ïîääåðæêà loop äëÿ ogg vorbis
2. ïåðåïèñàòü studiomdl äëÿ èñïîëüçîâàíèÿ VFS
@ -98,7 +95,7 @@ Beta 13.12.08
64. ImageLoading from old render OK
65. envshot, skyshot swap angles to right pos
66. ShaderSystem from old render OK
67. fixup NPOT textures loading (screen textures)
67. fixup NPOT textures loading (screen textures) OK
68. add new shader types OK
69. implement oldareabits OK
70. repair fog texture OK
@ -107,9 +104,16 @@ Beta 13.12.08
73. shaders pasring OK
74. fixup 3D textures loading OK
75. ignore shader errors - just throw warnings OK
76. launch.dll ->release gl_invalid_enum
76. launch.dll ->release gl_invalid_enum OK
77. debug shader_free_unused mechanism OK
78. fix changemap errors
79. memory trash in render.dll
78. fix changemap errors OK
79. memory trash in render.dll OK
80. implement $rgb, $alpha OK
89. get rid of R_Upload32 OK
90. get rid of Com_ParseExt OK
91. Xash backend extensions
92. implement VBO OK
93. implement sky rotate
94. make default sky shader, R_SetupSky
95. support for custom tables (external)
96. implement sprite format

View File

@ -261,6 +261,7 @@ static bool S_LoadWAV( const char *name, byte **wav, wavinfo_t *info )
if( samples < info->samples )
{
MsgDev( D_ERROR, "S_LoadWAV: %s has a bad loop length\n", name );
Mem_Free( buffer );
return false;
}
}