24 Dec 2010
This commit is contained in:
parent
083ef114be
commit
8a73b2a3de
|
@ -106,6 +106,7 @@ typedef struct mnode_s
|
|||
typedef struct msurface_s msurface_t;
|
||||
typedef struct decal_s decal_t;
|
||||
|
||||
#if 0 // Original decal struct is temporare disabled
|
||||
// JAY: Compress this as much as possible
|
||||
struct decal_s
|
||||
{
|
||||
|
@ -119,6 +120,22 @@ struct decal_s
|
|||
|
||||
short entityIndex; // Entity this is attached to
|
||||
};
|
||||
#else
|
||||
struct decal_s
|
||||
{
|
||||
struct decal_s *pnext; // linked list for each surface
|
||||
struct msurface_s *psurface; // surface id for persistence / unlinking
|
||||
short texture; // decal image
|
||||
|
||||
vec3_t position; // location of the decal center in world space.
|
||||
vec3_t worldPos; // untransformed position, keep for serialization
|
||||
vec3_t saxis; // direction of the s axis in world space
|
||||
float dx, dy; // Offsets into surface texture
|
||||
float scale; // pixel scale
|
||||
short flags; // decal flags FDECAL_*
|
||||
short entityIndex; // entity this is attached to
|
||||
};
|
||||
#endif
|
||||
|
||||
typedef struct mleaf_s
|
||||
{
|
||||
|
|
|
@ -1634,6 +1634,8 @@ void CL_ParseTempEntity( sizebuf_t *msg )
|
|||
cl_entity_t *pEnt;
|
||||
dlight_t *dl;
|
||||
|
||||
decalIndex = modelIndex = entityIndex = 0;
|
||||
|
||||
// parse user message into buffer
|
||||
BF_ReadBytes( msg, pbuf, iSize );
|
||||
|
||||
|
@ -1895,8 +1897,7 @@ void CL_ParseTempEntity( sizebuf_t *msg )
|
|||
if( type == TE_DECALHIGH || type == TE_WORLDDECALHIGH )
|
||||
decalIndex += 256;
|
||||
pEnt = CL_GetEntityByIndex( entityIndex );
|
||||
modelIndex = (pEnt) ? pEnt->curstate.modelindex : 0;
|
||||
CL_DecalShoot( CL_DecalIndex( decalIndex ), entityIndex, modelIndex, pos, 0 );
|
||||
CL_DecalShoot( CL_DecalIndex( decalIndex ), entityIndex, 0, pos, 0 );
|
||||
break;
|
||||
case TE_FIZZ:
|
||||
entityIndex = BF_ReadShort( &buf );
|
||||
|
@ -1952,8 +1953,7 @@ void CL_ParseTempEntity( sizebuf_t *msg )
|
|||
entityIndex = BF_ReadShort( &buf );
|
||||
decalIndex = BF_ReadByte( &buf );
|
||||
pEnt = CL_GetEntityByIndex( entityIndex );
|
||||
modelIndex = (pEnt) ? pEnt->curstate.modelindex : 0;
|
||||
CL_DecalShoot( CL_DecalIndex( decalIndex ), entityIndex, modelIndex, pos, 0 );
|
||||
CL_DecalShoot( CL_DecalIndex( decalIndex ), entityIndex, 0, pos, 0 );
|
||||
CL_RicochetSound( pos );
|
||||
break;
|
||||
case TE_SPRAY:
|
||||
|
@ -1991,7 +1991,7 @@ void CL_ParseTempEntity( sizebuf_t *msg )
|
|||
pos[2] = BF_ReadCoord( &buf );
|
||||
entityIndex = BF_ReadShort( &buf );
|
||||
decalIndex = BF_ReadByte( &buf );
|
||||
CL_PlayerDecal( CL_DecalIndex( decalIndex ), entityIndex, pos, NULL );
|
||||
CL_PlayerDecal( CL_DecalIndex( decalIndex ), entityIndex, pos );
|
||||
break;
|
||||
case TE_BUBBLES:
|
||||
case TE_BUBBLETRAIL:
|
||||
|
@ -2422,12 +2422,9 @@ CL_DecalShoot
|
|||
normal temporary decal
|
||||
===============
|
||||
*/
|
||||
void CL_DecalShoot( HSPRITE hDecal, int entityIndex, int modelIndex, float *pos, int flags )
|
||||
void CL_DecalShoot( int textureIndex, int entityIndex, int modelIndex, float *pos, int flags )
|
||||
{
|
||||
rgba_t color;
|
||||
|
||||
Vector4Set( color, 255, 255, 255, 255 ); // don't use custom colors
|
||||
R_DecalShoot( hDecal, entityIndex, modelIndex, pos, NULL, flags, color );
|
||||
R_DecalShoot( textureIndex, entityIndex, modelIndex, pos, flags, NULL );
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -2437,17 +2434,9 @@ CL_PlayerDecal
|
|||
spray custom colored decal (clan logo etc)
|
||||
===============
|
||||
*/
|
||||
void CL_PlayerDecal( HSPRITE hDecal, int entityIndex, float *pos, byte *color )
|
||||
void CL_PlayerDecal( int textureIndex, int entityIndex, float *pos )
|
||||
{
|
||||
cl_entity_t *pEnt;
|
||||
int modelIndex = 0;
|
||||
rgb_t _clr = { 255, 255, 255 };
|
||||
|
||||
pEnt = CL_GetEntityByIndex( entityIndex );
|
||||
if( pEnt ) modelIndex = pEnt->curstate.modelindex;
|
||||
if( !color ) color = _clr;
|
||||
|
||||
R_DecalShoot( hDecal, entityIndex, modelIndex, pos, NULL, FDECAL_CUSTOM, color );
|
||||
R_DecalShoot( textureIndex, entityIndex, 0, pos, FDECAL_CUSTOM, NULL );
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -71,11 +71,12 @@ void CL_MultiGunshot( const vec3_t org, const vec3_t dir, const vec3_t noise, in
|
|||
void CL_FireField( float *org, int radius, int modelIndex, int count, int flags, float life );
|
||||
void CL_PlayerSprites( int client, int modelIndex, int count, int size );
|
||||
void CL_Sprite_WallPuff( struct tempent_s *pTemp, float scale );
|
||||
void CL_DebugParticle( const vec3_t pos, byte r, byte g, byte b );
|
||||
void CL_RicochetSound( const vec3_t pos );
|
||||
struct dlight_s *CL_AllocDlight( int key );
|
||||
struct dlight_s *CL_AllocElight( int key );
|
||||
void CL_UpadteFlashlight( cl_entity_t *pEnt );
|
||||
void CL_DecalShoot( HSPRITE hDecal, int entityIndex, int modelIndex, float *pos, int flags );
|
||||
void CL_DecalShoot( int textureIndex, int entityIndex, int modelIndex, float *pos, int flags );
|
||||
void CL_DecalRemoveAll( int textureIndex );
|
||||
int CL_DecalIndexFromName( const char *name );
|
||||
int CL_DecalIndex( int id );
|
||||
|
|
|
@ -645,8 +645,8 @@ int CL_AddEntity( int entityType, cl_entity_t *pEnt );
|
|||
void CL_WeaponAnim( int iAnim, int body );
|
||||
void CL_ClearEffects( void );
|
||||
void CL_TestLights( void );
|
||||
void CL_DecalShoot( HSPRITE hDecal, int entityIndex, int modelIndex, float *pos, int flags );
|
||||
void CL_PlayerDecal( HSPRITE hDecal, int entityIndex, float *pos, byte *color );
|
||||
void CL_DecalShoot( int textureIndex, int entityIndex, int modelIndex, float *pos, int flags );
|
||||
void CL_PlayerDecal( int textureIndex, int entityIndex, float *pos );
|
||||
void CL_QueueEvent( int flags, int index, float delay, event_args_t *args );
|
||||
void CL_PlaybackEvent( int flags, const edict_t *pInvoker, word eventindex, float delay, float *origin,
|
||||
float *angles, float fparam1, float fparam2, int iparam1, int iparam2, int bparam1, int bparam2 );
|
||||
|
|
|
@ -430,7 +430,7 @@ void GL_SetRenderMode( int mode )
|
|||
case kRenderNormal:
|
||||
default:
|
||||
state = GLSTATE_DEPTHWRITE;
|
||||
texEnv = GL_MODULATE;
|
||||
texEnv = GL_REPLACE;
|
||||
break;
|
||||
case kRenderTransColor:
|
||||
state = GLSTATE_SRCBLEND_DST_COLOR|GLSTATE_DSTBLEND_SRC_COLOR|GLSTATE_DEPTHWRITE;
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -15,6 +15,9 @@
|
|||
|
||||
extern byte *r_temppool;
|
||||
|
||||
#define BLOCK_WIDTH 128 // lightmap block width
|
||||
#define BLOCK_HEIGHT 128 // lightmap block height
|
||||
|
||||
#define MAX_TEXTURES 2048
|
||||
#define MAX_LIGHTMAPS 64
|
||||
#define SUBDIVIDE_SIZE 64
|
||||
|
@ -259,6 +262,14 @@ qboolean R_CullSphere( const vec3_t centre, const float radius, const uint clipf
|
|||
qboolean R_VisCullBox( const vec3_t mins, const vec3_t maxs );
|
||||
qboolean R_VisCullSphere( const vec3_t origin, float radius );
|
||||
|
||||
//
|
||||
// gl_decals.c
|
||||
//
|
||||
void R_InitDecals( void );
|
||||
void R_ShutdownDecals( void );
|
||||
void DrawSurfaceDecals( msurface_t *fa );
|
||||
void R_ClearDecals( void );
|
||||
|
||||
//
|
||||
// gl_draw.c
|
||||
//
|
||||
|
@ -540,6 +551,7 @@ extern convar_t *r_faceplanecull;
|
|||
extern convar_t *r_drawentities;
|
||||
extern convar_t *r_adjust_fov;
|
||||
extern convar_t *r_lefthand;
|
||||
extern convar_t *r_decals;
|
||||
extern convar_t *r_novis;
|
||||
extern convar_t *r_nocull;
|
||||
extern convar_t *r_lockpvs;
|
||||
|
|
|
@ -43,9 +43,6 @@ typically is a func_wall, func_breakable, func_ladder etc
|
|||
*/
|
||||
static qboolean R_StaticEntity( cl_entity_t *ent )
|
||||
{
|
||||
if( gl_test->integer )
|
||||
return false;
|
||||
|
||||
if( ent->curstate.rendermode != kRenderNormal )
|
||||
return false;
|
||||
|
||||
|
@ -503,7 +500,7 @@ void R_RotateForEntity( cl_entity_t *e )
|
|||
{
|
||||
float scale = 1.0f;
|
||||
|
||||
if( e == clgame.entities || R_StaticEntity( e ))
|
||||
if( e == clgame.entities || R_StaticEntity( e ) || gl_test->integer )
|
||||
{
|
||||
R_LoadIdentity();
|
||||
return;
|
||||
|
@ -528,7 +525,7 @@ void R_TranslateForEntity( cl_entity_t *e )
|
|||
{
|
||||
float scale = 1.0f;
|
||||
|
||||
if( e == clgame.entities || R_StaticEntity( e ))
|
||||
if( e == clgame.entities || R_StaticEntity( e ) || gl_test->integer )
|
||||
{
|
||||
R_LoadIdentity();
|
||||
return;
|
||||
|
|
|
@ -12,6 +12,8 @@ void R_NewMap( void )
|
|||
{
|
||||
int i;
|
||||
|
||||
R_ClearDecals(); // clear all level decals
|
||||
|
||||
GL_BuildLightmaps ();
|
||||
R_SetupSky( cl.refdef.movevars->skyName );
|
||||
|
||||
|
|
|
@ -1144,6 +1144,25 @@ void CL_FlickerParticles( const vec3_t org )
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
===============
|
||||
CL_DebugParticle
|
||||
|
||||
just for debug purposes
|
||||
===============
|
||||
*/
|
||||
void CL_DebugParticle( const vec3_t pos, byte r, byte g, byte b )
|
||||
{
|
||||
particle_t *p;
|
||||
|
||||
p = CL_AllocParticle( NULL );
|
||||
if( !p ) return;
|
||||
|
||||
VectorCopy( pos, p->org );
|
||||
p->die += 10.0f;
|
||||
p->color = CL_LookupColor( r, g, b );
|
||||
}
|
||||
|
||||
/*
|
||||
==============================================================
|
||||
|
||||
|
|
|
@ -9,9 +9,6 @@
|
|||
#include "cm_local.h"
|
||||
#include "mathlib.h"
|
||||
|
||||
#define BLOCK_WIDTH 128
|
||||
#define BLOCK_HEIGHT 128
|
||||
|
||||
typedef struct
|
||||
{
|
||||
qboolean lightmap_modified[MAX_LIGHTMAPS];
|
||||
|
@ -691,6 +688,7 @@ void R_RenderBrushPoly( msurface_t *fa )
|
|||
}
|
||||
|
||||
DrawGLPoly( fa->polys );
|
||||
DrawSurfaceDecals( fa );
|
||||
|
||||
// add the poly to the proper lightmap chain
|
||||
R_RenderDynamicLightmaps( fa );
|
||||
|
@ -1562,6 +1560,9 @@ void GL_BuildLightmaps( void )
|
|||
|
||||
for( j = 0; j < m->numsurfaces; j++ )
|
||||
{
|
||||
// clearing all decal chains
|
||||
m->surfaces[j].pdecals = NULL;
|
||||
|
||||
GL_CreateSurfaceLightmap( m->surfaces + j );
|
||||
|
||||
if( m->surfaces[i].flags & SURF_DRAWTURB )
|
||||
|
|
|
@ -845,7 +845,7 @@ void R_DrawSpriteModel( cl_entity_t *e )
|
|||
|
||||
r_stats.c_sprite_models_drawn++;
|
||||
|
||||
if( psprite->texFormat == SPR_ALPHTEST )
|
||||
if( psprite->texFormat == SPR_ALPHTEST && e->curstate.rendermode == kRenderTransAlpha )
|
||||
state |= GLSTATE_AFUNC_GE128|GLSTATE_DEPTHWRITE;
|
||||
|
||||
// select properly rendermode
|
||||
|
|
|
@ -1699,6 +1699,7 @@ static void R_StudioDrawPoints( void )
|
|||
{
|
||||
GL_SetRenderMode( g_iRenderMode );
|
||||
alpha = RI.currententity->curstate.renderamt * (1.0f / 255.0f);
|
||||
if( g_iRenderMode == kRenderNormal ) GL_TexEnv( GL_MODULATE );
|
||||
}
|
||||
|
||||
if(!( g_nFaceFlags & STUDIO_NF_CHROME ))
|
||||
|
|
|
@ -51,6 +51,7 @@ convar_t *r_faceplanecull;
|
|||
convar_t *r_drawentities;
|
||||
convar_t *r_adjust_fov;
|
||||
convar_t *r_lefthand;
|
||||
convar_t *r_decals;
|
||||
convar_t *r_novis;
|
||||
convar_t *r_nocull;
|
||||
convar_t *r_lockpvs;
|
||||
|
@ -1466,6 +1467,7 @@ void GL_InitCommands( void )
|
|||
r_fastsky = Cvar_Get( "r_fastsky", "0", CVAR_ARCHIVE, "enable algorhytm fo fast sky rendering (for old machines)" );
|
||||
r_drawentities = Cvar_Get( "r_drawentities", "1", CVAR_CHEAT|CVAR_ARCHIVE, "render entities" );
|
||||
r_lefthand = Cvar_Get( "hand", "0", CVAR_ARCHIVE, "viewmodel handedness" );
|
||||
r_decals = Cvar_Get( "r_decals", "4096", CVAR_ARCHIVE, "sets the maximum number of decals" );
|
||||
|
||||
gl_picmip = Cvar_Get( "gl_picmip", "0", CVAR_RENDERINFO|CVAR_LATCH_VIDEO, "reduces resolution of textures by powers of 2" );
|
||||
gl_skymip = Cvar_Get( "gl_skymip", "0", CVAR_RENDERINFO|CVAR_LATCH_VIDEO, "reduces resolution of skybox textures by powers of 2" );
|
||||
|
@ -1702,6 +1704,7 @@ qboolean R_Init( void )
|
|||
R_InitImages();
|
||||
R_SpriteInit();
|
||||
R_StudioInit();
|
||||
R_InitDecals();
|
||||
R_ClearScene();
|
||||
|
||||
// initialize screen
|
||||
|
@ -1734,6 +1737,7 @@ void R_Shutdown( void )
|
|||
|
||||
GL_RemoveCommands();
|
||||
R_ShutdownImages();
|
||||
R_ShutdownDecals();
|
||||
|
||||
Mem_FreePool( &r_temppool );
|
||||
|
||||
|
|
|
@ -71,7 +71,6 @@ void R_GetSpriteParms( int *frameWidth, int *frameHeight, int *numFrames, int cu
|
|||
void R_DrawStretchRaw( float x, float y, float w, float h, int cols, int rows, const byte *data, qboolean dirty );
|
||||
void R_DrawStretchPic( float x, float y, float w, float h, float s1, float t1, float s2, float t2, int texnum );
|
||||
qboolean R_SpeedsMessage( char *out, size_t size );
|
||||
int R_CreateDecalList( decallist_t *pList, qboolean changelevel );
|
||||
void R_SetupSky( const char *skyboxname );
|
||||
qboolean R_CullBox( const vec3_t mins, const vec3_t maxs, uint clipflags );
|
||||
qboolean R_WorldToScreen( const vec3_t point, vec3_t screen );
|
||||
|
@ -86,7 +85,7 @@ void GL_SetRenderMode( int mode );
|
|||
void R_RunViewmodelEvents( void );
|
||||
int R_GetSpriteTexture( const struct model_s *m_pSpriteModel, int frame );
|
||||
void R_LightForPoint( const vec3_t point, color24 *ambientLight, qboolean invLight, float radius );
|
||||
qboolean R_DecalShoot( int texture, int ent, int model, vec3_t pos, vec3_t saxis, int flags, rgba_t color );
|
||||
void R_DecalShoot( int textureIndex, int entityIndex, int modelIndex, vec3_t pos, int flags, vec3_t saxis );
|
||||
void R_RemoveEfrags( struct cl_entity_s *ent );
|
||||
void R_AddEfrags( struct cl_entity_s *ent );
|
||||
void R_DecalRemoveAll( int texture );
|
||||
|
|
|
@ -1369,7 +1369,6 @@ void Mod_CalcPHS( void )
|
|||
|
||||
// adjust compressed pas data to fit the size
|
||||
compressed_pas = Mem_Realloc( worldmodel->mempool, compressed_pas, total_size );
|
||||
Msg( "VIS size %s, PAS size %s\n", memprint( world.visdatasize ), memprint( total_size ));
|
||||
|
||||
// apply leaf pointers
|
||||
for( i = 0; i < worldmodel->numleafs; i++ )
|
||||
|
|
|
@ -170,7 +170,7 @@ typedef struct sv_client_s
|
|||
customization_t customization; // player customization linked list
|
||||
resource_t resource1;
|
||||
resource_t resource2; // <mapname.res> from client (server downloading)
|
||||
|
||||
|
||||
qboolean sendmovevars;
|
||||
qboolean sendinfo;
|
||||
|
||||
|
|
|
@ -920,7 +920,7 @@ void SV_PutClientInServer( edict_t *ent )
|
|||
{
|
||||
int viewEnt;
|
||||
|
||||
// copy signon buffer
|
||||
// resend the signon
|
||||
BF_WriteBits( &client->netchan.message, BF_GetData( &sv.signon ), BF_GetNumBitsWritten( &sv.signon ));
|
||||
|
||||
if( client->pViewEntity )
|
||||
|
|
|
@ -362,6 +362,7 @@ void LandmarkOrigin( SAVERESTOREDATA *pSaveData, vec3_t output, const char *pLan
|
|||
int EntityInSolid( edict_t *ent )
|
||||
{
|
||||
edict_t *pParent = ent->v.aiment;
|
||||
vec3_t point;
|
||||
|
||||
// if you're attached to a client, always go through
|
||||
if( SV_IsValidEdict( pParent ))
|
||||
|
@ -370,7 +371,8 @@ int EntityInSolid( edict_t *ent )
|
|||
return 0;
|
||||
}
|
||||
|
||||
return SV_TestEntityPosition( ent );
|
||||
VectorAverage( ent->v.absmin, ent->v.absmax, point );
|
||||
return (SV_PointContents( point ) == CONTENTS_SOLID);
|
||||
}
|
||||
|
||||
void ReapplyDecal( SAVERESTOREDATA *pSaveData, decallist_t *entry, qboolean adjacent )
|
||||
|
|
Reference in New Issue