21 May 2018
This commit is contained in:
parent
05cbb432c2
commit
202f3dda91
|
@ -117,14 +117,14 @@ BRUSH MODELS
|
||||||
#define LUMP_FACEINFO 1 // landscape and lightmap resolution info
|
#define LUMP_FACEINFO 1 // landscape and lightmap resolution info
|
||||||
#define LUMP_CUBEMAPS 2 // cubemap description
|
#define LUMP_CUBEMAPS 2 // cubemap description
|
||||||
#define LUMP_VERTNORMALS 3 // phong shaded vertex normals
|
#define LUMP_VERTNORMALS 3 // phong shaded vertex normals
|
||||||
#define LUMP_VERTEX_LIGHT 4 // contain compressed light cubes per empty leafs
|
#define LUMP_LEAF_LIGHTING 4 // store vertex lighting for statics
|
||||||
#define LUMP_WORLDLIGHTS 5 // list of all the virtual and real lights (used to relight models in-game)
|
#define LUMP_WORLDLIGHTS 5 // list of all the virtual and real lights (used to relight models in-game)
|
||||||
#define LUMP_COLLISION 6 // physics engine collision hull dump
|
#define LUMP_COLLISION 6 // physics engine collision hull dump (userdata)
|
||||||
#define LUMP_AINODEGRAPH 7 // node graph that stored into the bsp
|
#define LUMP_AINODEGRAPH 7 // node graph that stored into the bsp (userdata)
|
||||||
#define LUMP_SHADOWMAP 8 // contains shadow map for direct light
|
#define LUMP_SHADOWMAP 8 // contains shadow map for direct light
|
||||||
#define LUMP_UNUSED1 9 // one lump reserved for me
|
#define LUMP_VERTEX_LIGHT 9 // store vertex lighting for statics
|
||||||
#define LUMP_UNUSED2 10 // one lump reserved for me
|
#define LUMP_UNUSED0 10 // one lump reserved for me
|
||||||
#define LUMP_UNUSED3 11 // one lump reserved for me
|
#define LUMP_UNUSED1 11 // one lump reserved for me
|
||||||
#define EXTRA_LUMPS 12 // count of the extra lumps
|
#define EXTRA_LUMPS 12 // count of the extra lumps
|
||||||
|
|
||||||
// texture flags
|
// texture flags
|
||||||
|
|
|
@ -211,7 +211,7 @@ typedef struct render_api_s
|
||||||
void (*GL_DrawParticles)( const struct ref_viewpass_s *rvp, qboolean trans_pass, float frametime );
|
void (*GL_DrawParticles)( const struct ref_viewpass_s *rvp, qboolean trans_pass, float frametime );
|
||||||
void (*EnvShot)( const float *vieworg, const char *name, qboolean skyshot, int shotsize ); // store skybox into gfx\env folder
|
void (*EnvShot)( const float *vieworg, const char *name, qboolean skyshot, int shotsize ); // store skybox into gfx\env folder
|
||||||
int (*SPR_LoadExt)( const char *szPicName, unsigned int texFlags ); // extended version of SPR_Load
|
int (*SPR_LoadExt)( const char *szPicName, unsigned int texFlags ); // extended version of SPR_Load
|
||||||
colorVec (*LightVec)( const float *start, const float *end, float *lightspot );
|
colorVec (*LightVec)( const float *start, const float *end, float *lightspot, float *lightvec );
|
||||||
struct mstudiotex_s *( *StudioGetTexture )( struct cl_entity_s *e );
|
struct mstudiotex_s *( *StudioGetTexture )( struct cl_entity_s *e );
|
||||||
const struct ref_overview_s *( *GetOverviewParms )( void );
|
const struct ref_overview_s *( *GetOverviewParms )( void );
|
||||||
const char *( *GetFileByIndex )( int fileindex );
|
const char *( *GetFileByIndex )( int fileindex );
|
||||||
|
|
|
@ -1226,6 +1226,12 @@ void CL_EmitEntities( void )
|
||||||
if( !cl.frames[cl.parsecountmod].valid )
|
if( !cl.frames[cl.parsecountmod].valid )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
// animate lightestyles
|
||||||
|
CL_RunLightStyles ();
|
||||||
|
|
||||||
|
// decay dynamic lights
|
||||||
|
CL_DecayLights ();
|
||||||
|
|
||||||
// compute last interpolation amount
|
// compute last interpolation amount
|
||||||
CL_UpdateFrameLerp ();
|
CL_UpdateFrameLerp ();
|
||||||
|
|
||||||
|
|
|
@ -2059,13 +2059,11 @@ void CL_ReadPackets( void )
|
||||||
if( cl.maxclients > 1 && cls.state == ca_active && !host_developer.value )
|
if( cl.maxclients > 1 && cls.state == ca_active && !host_developer.value )
|
||||||
Cvar_SetCheatState();
|
Cvar_SetCheatState();
|
||||||
#endif
|
#endif
|
||||||
// singleplayer never has connection timeout
|
|
||||||
if( NET_IsLocalAddress( cls.netchan.remote_address ))
|
|
||||||
return;
|
|
||||||
|
|
||||||
// hot precache and downloading resources
|
// hot precache and downloading resources
|
||||||
if( cls.signon == SIGNONS && cl.lastresourcecheck < host.realtime )
|
if( cls.signon == SIGNONS && cl.lastresourcecheck < host.realtime )
|
||||||
{
|
{
|
||||||
|
double checktime = Host_IsLocalGame() ? 0.1 : 1.0;
|
||||||
|
|
||||||
if( !cls.dl.custom && cl.resourcesneeded.pNext != &cl.resourcesneeded )
|
if( !cls.dl.custom && cl.resourcesneeded.pNext != &cl.resourcesneeded )
|
||||||
{
|
{
|
||||||
// check resource for downloading and precache
|
// check resource for downloading and precache
|
||||||
|
@ -2073,9 +2071,14 @@ void CL_ReadPackets( void )
|
||||||
CL_BatchResourceRequest( false );
|
CL_BatchResourceRequest( false );
|
||||||
cls.dl.custom = true;
|
cls.dl.custom = true;
|
||||||
}
|
}
|
||||||
cl.lastresourcecheck = host.realtime + 5.0f; // don't checking too often
|
|
||||||
|
cl.lastresourcecheck = host.realtime + checktime;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// singleplayer never has connection timeout
|
||||||
|
if( NET_IsLocalAddress( cls.netchan.remote_address ))
|
||||||
|
return;
|
||||||
|
|
||||||
// if in the debugger last frame, don't timeout
|
// if in the debugger last frame, don't timeout
|
||||||
if( host.frametime > 5.0f ) cls.netchan.last_received = Sys_DoubleTime();
|
if( host.frametime > 5.0f ) cls.netchan.last_received = Sys_DoubleTime();
|
||||||
|
|
||||||
|
@ -2774,12 +2777,6 @@ void Host_ClientFrame( void )
|
||||||
// update audio
|
// update audio
|
||||||
SND_UpdateSound ();
|
SND_UpdateSound ();
|
||||||
|
|
||||||
// animate lightestyles
|
|
||||||
CL_RunLightStyles ();
|
|
||||||
|
|
||||||
// decay dynamic lights
|
|
||||||
CL_DecayLights ();
|
|
||||||
|
|
||||||
// play avi-files
|
// play avi-files
|
||||||
SCR_RunCinematic ();
|
SCR_RunCinematic ();
|
||||||
|
|
||||||
|
|
|
@ -202,6 +202,9 @@ void SCR_RSpeeds( void )
|
||||||
Con_DrawString( x, y, p, color );
|
Con_DrawString( x, y, p, color );
|
||||||
y += height;
|
y += height;
|
||||||
|
|
||||||
|
// handle '\n\n'
|
||||||
|
if( *p == '\n' )
|
||||||
|
y += height;
|
||||||
if( end ) p = end + 1;
|
if( end ) p = end + 1;
|
||||||
else break;
|
else break;
|
||||||
} while( 1 );
|
} while( 1 );
|
||||||
|
|
|
@ -863,40 +863,44 @@ void R_AliasDynamicLight( cl_entity_t *ent, alight_t *plight )
|
||||||
VectorScale( lightDir, 2048.0f, vecEnd );
|
VectorScale( lightDir, 2048.0f, vecEnd );
|
||||||
VectorAdd( vecEnd, vecSrc, vecEnd );
|
VectorAdd( vecEnd, vecSrc, vecEnd );
|
||||||
|
|
||||||
light = R_LightVec( vecSrc, vecEnd, g_alias.lightspot );
|
light = R_LightVec( vecSrc, vecEnd, g_alias.lightspot, g_alias.lightvec );
|
||||||
|
|
||||||
VectorScale( lightDir, 2048.0f, vecEnd );
|
if( VectorIsNull( g_alias.lightvec ))
|
||||||
VectorAdd( vecEnd, vecSrc, vecEnd );
|
{
|
||||||
|
vecSrc[0] -= 16.0f;
|
||||||
|
vecSrc[1] -= 16.0f;
|
||||||
|
vecEnd[0] -= 16.0f;
|
||||||
|
vecEnd[1] -= 16.0f;
|
||||||
|
|
||||||
vecSrc[0] -= 16.0f;
|
gcolor = R_LightVec( vecSrc, vecEnd, NULL, NULL );
|
||||||
vecSrc[1] -= 16.0f;
|
grad[0] = ( gcolor.r + gcolor.g + gcolor.b ) / 768.0f;
|
||||||
vecEnd[0] -= 16.0f;
|
|
||||||
vecEnd[1] -= 16.0f;
|
|
||||||
|
|
||||||
gcolor = R_LightVec( vecSrc, vecEnd, NULL );
|
vecSrc[0] += 32.0f;
|
||||||
grad[0] = ( gcolor.r + gcolor.g + gcolor.b ) / 768.0f;
|
vecEnd[0] += 32.0f;
|
||||||
|
|
||||||
vecSrc[0] += 32.0f;
|
gcolor = R_LightVec( vecSrc, vecEnd, NULL, NULL );
|
||||||
vecEnd[0] += 32.0f;
|
grad[1] = ( gcolor.r + gcolor.g + gcolor.b ) / 768.0f;
|
||||||
|
|
||||||
gcolor = R_LightVec( vecSrc, vecEnd, NULL );
|
vecSrc[1] += 32.0f;
|
||||||
grad[1] = ( gcolor.r + gcolor.g + gcolor.b ) / 768.0f;
|
vecEnd[1] += 32.0f;
|
||||||
|
|
||||||
vecSrc[1] += 32.0f;
|
gcolor = R_LightVec( vecSrc, vecEnd, NULL, NULL );
|
||||||
vecEnd[1] += 32.0f;
|
grad[2] = ( gcolor.r + gcolor.g + gcolor.b ) / 768.0f;
|
||||||
|
|
||||||
gcolor = R_LightVec( vecSrc, vecEnd, NULL );
|
vecSrc[0] -= 32.0f;
|
||||||
grad[2] = ( gcolor.r + gcolor.g + gcolor.b ) / 768.0f;
|
vecEnd[0] -= 32.0f;
|
||||||
|
|
||||||
vecSrc[0] -= 32.0f;
|
gcolor = R_LightVec( vecSrc, vecEnd, NULL, NULL );
|
||||||
vecEnd[0] -= 32.0f;
|
grad[3] = ( gcolor.r + gcolor.g + gcolor.b ) / 768.0f;
|
||||||
|
|
||||||
gcolor = R_LightVec( vecSrc, vecEnd, NULL );
|
lightDir[0] = grad[0] - grad[1] - grad[2] + grad[3];
|
||||||
grad[3] = ( gcolor.r + gcolor.g + gcolor.b ) / 768.0f;
|
lightDir[1] = grad[1] + grad[0] - grad[2] - grad[3];
|
||||||
|
VectorNormalize( lightDir );
|
||||||
lightDir[0] = grad[0] - grad[1] - grad[2] + grad[3];
|
}
|
||||||
lightDir[1] = grad[1] + grad[0] - grad[2] - grad[3];
|
else
|
||||||
VectorNormalize( lightDir );
|
{
|
||||||
|
VectorCopy( g_alias.lightvec, lightDir );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
VectorSet( finalLight, light.r, light.g, light.b );
|
VectorSet( finalLight, light.r, light.g, light.b );
|
||||||
|
@ -1313,6 +1317,8 @@ static void R_AliasDrawLightTrace( cl_entity_t *e )
|
||||||
{
|
{
|
||||||
if( r_drawentities->value == 7 )
|
if( r_drawentities->value == 7 )
|
||||||
{
|
{
|
||||||
|
vec3_t origin;
|
||||||
|
|
||||||
pglDisable( GL_TEXTURE_2D );
|
pglDisable( GL_TEXTURE_2D );
|
||||||
pglDisable( GL_DEPTH_TEST );
|
pglDisable( GL_DEPTH_TEST );
|
||||||
|
|
||||||
|
@ -1322,6 +1328,13 @@ static void R_AliasDrawLightTrace( cl_entity_t *e )
|
||||||
pglVertex3fv( g_alias.lightspot );
|
pglVertex3fv( g_alias.lightspot );
|
||||||
pglEnd();
|
pglEnd();
|
||||||
|
|
||||||
|
pglBegin( GL_LINES );
|
||||||
|
pglColor3f( 0, 0.5, 1 );
|
||||||
|
VectorMA( g_alias.lightspot, -64.0f, g_alias.lightvec, origin );
|
||||||
|
pglVertex3fv( g_alias.lightspot );
|
||||||
|
pglVertex3fv( origin );
|
||||||
|
pglEnd();
|
||||||
|
|
||||||
pglPointSize( 5.0f );
|
pglPointSize( 5.0f );
|
||||||
pglColor3f( 1, 0, 0 );
|
pglColor3f( 1, 0, 0 );
|
||||||
pglBegin( GL_POINTS );
|
pglBegin( GL_POINTS );
|
||||||
|
@ -1429,11 +1442,16 @@ void R_DrawAliasModel( cl_entity_t *e )
|
||||||
R_AliasSetRemapColors( topcolor, bottomcolor );
|
R_AliasSetRemapColors( topcolor, bottomcolor );
|
||||||
}
|
}
|
||||||
|
|
||||||
pglTranslatef( m_pAliasHeader->scale_origin[0], m_pAliasHeader->scale_origin[1], m_pAliasHeader->scale_origin[2] );
|
|
||||||
|
|
||||||
if( tr.fFlipViewModel )
|
if( tr.fFlipViewModel )
|
||||||
|
{
|
||||||
|
pglTranslatef( m_pAliasHeader->scale_origin[0], -m_pAliasHeader->scale_origin[1], m_pAliasHeader->scale_origin[2] );
|
||||||
pglScalef( m_pAliasHeader->scale[0], -m_pAliasHeader->scale[1], m_pAliasHeader->scale[2] );
|
pglScalef( m_pAliasHeader->scale[0], -m_pAliasHeader->scale[1], m_pAliasHeader->scale[2] );
|
||||||
else pglScalef( m_pAliasHeader->scale[0], m_pAliasHeader->scale[1], m_pAliasHeader->scale[2] );
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
pglTranslatef( m_pAliasHeader->scale_origin[0], m_pAliasHeader->scale_origin[1], m_pAliasHeader->scale_origin[2] );
|
||||||
|
pglScalef( m_pAliasHeader->scale[0], m_pAliasHeader->scale[1], m_pAliasHeader->scale[2] );
|
||||||
|
}
|
||||||
|
|
||||||
anim = (int)(g_alias.time * 10) & 3;
|
anim = (int)(g_alias.time * 10) & 3;
|
||||||
skin = bound( 0, RI.currententity->curstate.skin, m_pAliasHeader->numskins - 1 );
|
skin = bound( 0, RI.currententity->curstate.skin, m_pAliasHeader->numskins - 1 );
|
||||||
|
|
|
@ -330,7 +330,7 @@ void R_AnimateLight( void );
|
||||||
void R_GetLightSpot( vec3_t lightspot );
|
void R_GetLightSpot( vec3_t lightspot );
|
||||||
void R_MarkLights( dlight_t *light, int bit, mnode_t *node );
|
void R_MarkLights( dlight_t *light, int bit, mnode_t *node );
|
||||||
void R_LightForPoint( const vec3_t point, color24 *ambientLight, qboolean invLight, qboolean useAmbient, float radius );
|
void R_LightForPoint( const vec3_t point, color24 *ambientLight, qboolean invLight, qboolean useAmbient, float radius );
|
||||||
colorVec R_LightVec( const vec3_t start, const vec3_t end, vec3_t lightspot );
|
colorVec R_LightVec( const vec3_t start, const vec3_t end, vec3_t lightspot, vec3_t lightvec );
|
||||||
int R_CountSurfaceDlights( msurface_t *surf );
|
int R_CountSurfaceDlights( msurface_t *surf );
|
||||||
colorVec R_LightPoint( const vec3_t p0 );
|
colorVec R_LightPoint( const vec3_t p0 );
|
||||||
int R_CountDlights( void );
|
int R_CountDlights( void );
|
||||||
|
|
|
@ -217,6 +217,7 @@ int R_CountSurfaceDlights( msurface_t *surf )
|
||||||
=======================================================================
|
=======================================================================
|
||||||
*/
|
*/
|
||||||
static vec3_t g_trace_lightspot;
|
static vec3_t g_trace_lightspot;
|
||||||
|
static vec3_t g_trace_lightvec;
|
||||||
static float g_trace_fraction;
|
static float g_trace_fraction;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -230,10 +231,11 @@ static qboolean R_RecursiveLightPoint( model_t *model, mnode_t *node, float p1f,
|
||||||
int i, map, side, size;
|
int i, map, side, size;
|
||||||
float ds, dt, s, t;
|
float ds, dt, s, t;
|
||||||
int sample_size;
|
int sample_size;
|
||||||
|
color24 *lm, *dm;
|
||||||
mextrasurf_t *info;
|
mextrasurf_t *info;
|
||||||
msurface_t *surf;
|
msurface_t *surf;
|
||||||
mtexinfo_t *tex;
|
mtexinfo_t *tex;
|
||||||
color24 *lm;
|
matrix3x4 tbn;
|
||||||
vec3_t mid;
|
vec3_t mid;
|
||||||
|
|
||||||
// didn't hit anything
|
// didn't hit anything
|
||||||
|
@ -306,6 +308,31 @@ static qboolean R_RecursiveLightPoint( model_t *model, mnode_t *node, float p1f,
|
||||||
lm = surf->samples + Q_rint( dt ) * smax + Q_rint( ds );
|
lm = surf->samples + Q_rint( dt ) * smax + Q_rint( ds );
|
||||||
g_trace_fraction = midf;
|
g_trace_fraction = midf;
|
||||||
size = smax * tmax;
|
size = smax * tmax;
|
||||||
|
dm = NULL;
|
||||||
|
|
||||||
|
if( surf->info->deluxemap )
|
||||||
|
{
|
||||||
|
vec3_t faceNormal;
|
||||||
|
|
||||||
|
if( FBitSet( surf->flags, SURF_PLANEBACK ))
|
||||||
|
VectorNegate( surf->plane->normal, faceNormal );
|
||||||
|
else VectorCopy( surf->plane->normal, faceNormal );
|
||||||
|
|
||||||
|
// compute face TBN
|
||||||
|
#if 1
|
||||||
|
Vector4Set( tbn[0], surf->info->lmvecs[0][0], surf->info->lmvecs[0][1], surf->info->lmvecs[0][2], 0.0f );
|
||||||
|
Vector4Set( tbn[1], -surf->info->lmvecs[1][0], -surf->info->lmvecs[1][1], -surf->info->lmvecs[1][2], 0.0f );
|
||||||
|
Vector4Set( tbn[2], faceNormal[0], faceNormal[1], faceNormal[2], 0.0f );
|
||||||
|
#else
|
||||||
|
Vector4Set( tbn[0], surf->info->lmvecs[0][0], -surf->info->lmvecs[1][0], faceNormal[0], 0.0f );
|
||||||
|
Vector4Set( tbn[1], surf->info->lmvecs[0][1], -surf->info->lmvecs[1][1], faceNormal[1], 0.0f );
|
||||||
|
Vector4Set( tbn[2], surf->info->lmvecs[0][2], -surf->info->lmvecs[1][2], faceNormal[2], 0.0f );
|
||||||
|
#endif
|
||||||
|
VectorNormalize( tbn[0] );
|
||||||
|
VectorNormalize( tbn[1] );
|
||||||
|
VectorNormalize( tbn[2] );
|
||||||
|
dm = surf->info->deluxemap + Q_rint( dt ) * smax + Q_rint( ds );
|
||||||
|
}
|
||||||
|
|
||||||
for( map = 0; map < MAXLIGHTMAPS && surf->styles[map] != 255; map++ )
|
for( map = 0; map < MAXLIGHTMAPS && surf->styles[map] != 255; map++ )
|
||||||
{
|
{
|
||||||
|
@ -324,6 +351,18 @@ static qboolean R_RecursiveLightPoint( model_t *model, mnode_t *node, float p1f,
|
||||||
cv->b += LightToTexGamma( lm->b ) * scale;
|
cv->b += LightToTexGamma( lm->b ) * scale;
|
||||||
}
|
}
|
||||||
lm += size; // skip to next lightmap
|
lm += size; // skip to next lightmap
|
||||||
|
|
||||||
|
if( dm != NULL )
|
||||||
|
{
|
||||||
|
vec3_t srcNormal, lightNormal;
|
||||||
|
float f = (1.0f / 255.0f);
|
||||||
|
|
||||||
|
VectorSet( srcNormal, (dm->r * f) * 2.0f - 1.0f, (dm->g * f) * 2.0f - 1.0f, (dm->b * f) * 2.0f - 1.0f );
|
||||||
|
Matrix3x4_VectorIRotate( tbn, srcNormal, lightNormal ); // turn to world space
|
||||||
|
VectorScale( lightNormal, (float)scale * -1.0f, lightNormal ); // turn direction from light
|
||||||
|
VectorAdd( g_trace_lightvec, lightNormal, g_trace_lightvec );
|
||||||
|
dm += size; // skip to next deluxmap
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -340,13 +379,14 @@ R_LightVec
|
||||||
check bspmodels to get light from
|
check bspmodels to get light from
|
||||||
=================
|
=================
|
||||||
*/
|
*/
|
||||||
colorVec R_LightVec( const vec3_t start, const vec3_t end, vec3_t lspot )
|
colorVec R_LightVec( const vec3_t start, const vec3_t end, vec3_t lspot, vec3_t lvec )
|
||||||
{
|
{
|
||||||
float last_fraction;
|
float last_fraction;
|
||||||
int i, maxEnts = 1;
|
int i, maxEnts = 1;
|
||||||
colorVec light, cv;
|
colorVec light, cv;
|
||||||
|
|
||||||
if( lspot ) VectorClear( lspot );
|
if( lspot ) VectorClear( lspot );
|
||||||
|
if( lvec ) VectorClear( lvec );
|
||||||
|
|
||||||
if( cl.worldmodel && cl.worldmodel->lightdata )
|
if( cl.worldmodel && cl.worldmodel->lightdata )
|
||||||
{
|
{
|
||||||
|
@ -354,7 +394,7 @@ colorVec R_LightVec( const vec3_t start, const vec3_t end, vec3_t lspot )
|
||||||
last_fraction = 1.0f;
|
last_fraction = 1.0f;
|
||||||
|
|
||||||
// get light from bmodels too
|
// get light from bmodels too
|
||||||
if( r_lighting_extended->value )
|
if( CVAR_TO_BOOL( r_lighting_extended ))
|
||||||
maxEnts = clgame.pmove->numphysent;
|
maxEnts = clgame.pmove->numphysent;
|
||||||
|
|
||||||
// check all the bsp-models
|
// check all the bsp-models
|
||||||
|
@ -383,6 +423,7 @@ colorVec R_LightVec( const vec3_t start, const vec3_t end, vec3_t lspot )
|
||||||
}
|
}
|
||||||
|
|
||||||
VectorClear( g_trace_lightspot );
|
VectorClear( g_trace_lightspot );
|
||||||
|
VectorClear( g_trace_lightvec );
|
||||||
g_trace_fraction = 1.0f;
|
g_trace_fraction = 1.0f;
|
||||||
|
|
||||||
if( !R_RecursiveLightPoint( pe->model, pnodes, 0.0f, 1.0f, &cv, start_l, end_l ))
|
if( !R_RecursiveLightPoint( pe->model, pnodes, 0.0f, 1.0f, &cv, start_l, end_l ))
|
||||||
|
@ -391,6 +432,7 @@ colorVec R_LightVec( const vec3_t start, const vec3_t end, vec3_t lspot )
|
||||||
if( g_trace_fraction < last_fraction )
|
if( g_trace_fraction < last_fraction )
|
||||||
{
|
{
|
||||||
if( lspot ) VectorCopy( g_trace_lightspot, lspot );
|
if( lspot ) VectorCopy( g_trace_lightspot, lspot );
|
||||||
|
if( lvec ) VectorNormalize2( g_trace_lightvec, lvec );
|
||||||
light.r = Q_min(( cv.r >> 7 ), 255 );
|
light.r = Q_min(( cv.r >> 7 ), 255 );
|
||||||
light.g = Q_min(( cv.g >> 7 ), 255 );
|
light.g = Q_min(( cv.g >> 7 ), 255 );
|
||||||
light.b = Q_min(( cv.b >> 7 ), 255 );
|
light.b = Q_min(( cv.b >> 7 ), 255 );
|
||||||
|
@ -420,5 +462,5 @@ colorVec R_LightPoint( const vec3_t p0 )
|
||||||
|
|
||||||
VectorSet( p1, p0[0], p0[1], p0[2] - 2048.0f );
|
VectorSet( p1, p0[0], p0[1], p0[2] - 2048.0f );
|
||||||
|
|
||||||
return R_LightVec( p0, p1, NULL );
|
return R_LightVec( p0, p1, NULL, NULL );
|
||||||
}
|
}
|
|
@ -280,13 +280,10 @@ void GL_BuildPolygonFromSurface( model_t *mod, msurface_t *fa )
|
||||||
float s, t;
|
float s, t;
|
||||||
glpoly_t *poly;
|
glpoly_t *poly;
|
||||||
|
|
||||||
// already created
|
if( !mod || !fa->texinfo || !fa->texinfo->texture )
|
||||||
if( !mod || fa->polys ) return;
|
|
||||||
|
|
||||||
if( !fa->texinfo || !fa->texinfo->texture )
|
|
||||||
return; // bad polygon ?
|
return; // bad polygon ?
|
||||||
|
|
||||||
if( fa->flags & SURF_CONVEYOR && fa->texinfo->texture->gl_texturenum != 0 )
|
if( FBitSet( fa->flags, SURF_CONVEYOR ) && fa->texinfo->texture->gl_texturenum != 0 )
|
||||||
{
|
{
|
||||||
glt = R_GetTexture( fa->texinfo->texture->gl_texturenum );
|
glt = R_GetTexture( fa->texinfo->texture->gl_texturenum );
|
||||||
tex = fa->texinfo->texture;
|
tex = fa->texinfo->texture;
|
||||||
|
@ -304,8 +301,12 @@ void GL_BuildPolygonFromSurface( model_t *mod, msurface_t *fa )
|
||||||
lnumverts = fa->numedges;
|
lnumverts = fa->numedges;
|
||||||
vertpage = 0;
|
vertpage = 0;
|
||||||
|
|
||||||
// draw texture
|
// detach if already created, reconstruct again
|
||||||
poly = Mem_Alloc( mod->mempool, sizeof( glpoly_t ) + ( lnumverts - 4 ) * VERTEXSIZE * sizeof( float ));
|
poly = fa->polys;
|
||||||
|
fa->polys = NULL;
|
||||||
|
|
||||||
|
// quake simple models (healthkits etc) need to be reconstructed their polys because LM coords has changed after the map change
|
||||||
|
poly = Mem_Realloc( mod->mempool, poly, sizeof( glpoly_t ) + ( lnumverts - 4 ) * VERTEXSIZE * sizeof( float ));
|
||||||
poly->next = fa->polys;
|
poly->next = fa->polys;
|
||||||
poly->flags = fa->flags;
|
poly->flags = fa->flags;
|
||||||
fa->polys = poly;
|
fa->polys = poly;
|
||||||
|
@ -1996,8 +1997,10 @@ void GL_CreateSurfaceLightmap( msurface_t *surf )
|
||||||
mextrasurf_t *info = surf->info;
|
mextrasurf_t *info = surf->info;
|
||||||
byte *base;
|
byte *base;
|
||||||
|
|
||||||
if( !cl.worldmodel->lightdata ) return;
|
if( !loadmodel->lightdata )
|
||||||
if( surf->flags & SURF_DRAWTILED )
|
return;
|
||||||
|
|
||||||
|
if( FBitSet( surf->flags, SURF_DRAWTILED ))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
sample_size = Mod_SampleSizeForFace( surf );
|
sample_size = Mod_SampleSizeForFace( surf );
|
||||||
|
|
|
@ -1688,40 +1688,44 @@ void R_StudioDynamicLight( cl_entity_t *ent, alight_t *plight )
|
||||||
VectorScale( lightDir, 2048.0f, vecEnd );
|
VectorScale( lightDir, 2048.0f, vecEnd );
|
||||||
VectorAdd( vecEnd, vecSrc, vecEnd );
|
VectorAdd( vecEnd, vecSrc, vecEnd );
|
||||||
|
|
||||||
light = R_LightVec( vecSrc, vecEnd, g_studio.lightspot );
|
light = R_LightVec( vecSrc, vecEnd, g_studio.lightspot, g_studio.lightvec );
|
||||||
|
|
||||||
VectorScale( lightDir, 2048.0f, vecEnd );
|
if( VectorIsNull( g_studio.lightvec ))
|
||||||
VectorAdd( vecEnd, vecSrc, vecEnd );
|
{
|
||||||
|
vecSrc[0] -= 16.0f;
|
||||||
|
vecSrc[1] -= 16.0f;
|
||||||
|
vecEnd[0] -= 16.0f;
|
||||||
|
vecEnd[1] -= 16.0f;
|
||||||
|
|
||||||
vecSrc[0] -= 16.0f;
|
gcolor = R_LightVec( vecSrc, vecEnd, NULL, NULL );
|
||||||
vecSrc[1] -= 16.0f;
|
grad[0] = ( gcolor.r + gcolor.g + gcolor.b ) / 768.0f;
|
||||||
vecEnd[0] -= 16.0f;
|
|
||||||
vecEnd[1] -= 16.0f;
|
|
||||||
|
|
||||||
gcolor = R_LightVec( vecSrc, vecEnd, NULL );
|
vecSrc[0] += 32.0f;
|
||||||
grad[0] = ( gcolor.r + gcolor.g + gcolor.b ) / 768.0f;
|
vecEnd[0] += 32.0f;
|
||||||
|
|
||||||
vecSrc[0] += 32.0f;
|
gcolor = R_LightVec( vecSrc, vecEnd, NULL, NULL );
|
||||||
vecEnd[0] += 32.0f;
|
grad[1] = ( gcolor.r + gcolor.g + gcolor.b ) / 768.0f;
|
||||||
|
|
||||||
gcolor = R_LightVec( vecSrc, vecEnd, NULL );
|
vecSrc[1] += 32.0f;
|
||||||
grad[1] = ( gcolor.r + gcolor.g + gcolor.b ) / 768.0f;
|
vecEnd[1] += 32.0f;
|
||||||
|
|
||||||
vecSrc[1] += 32.0f;
|
gcolor = R_LightVec( vecSrc, vecEnd, NULL, NULL );
|
||||||
vecEnd[1] += 32.0f;
|
grad[2] = ( gcolor.r + gcolor.g + gcolor.b ) / 768.0f;
|
||||||
|
|
||||||
gcolor = R_LightVec( vecSrc, vecEnd, NULL );
|
vecSrc[0] -= 32.0f;
|
||||||
grad[2] = ( gcolor.r + gcolor.g + gcolor.b ) / 768.0f;
|
vecEnd[0] -= 32.0f;
|
||||||
|
|
||||||
vecSrc[0] -= 32.0f;
|
gcolor = R_LightVec( vecSrc, vecEnd, NULL, NULL );
|
||||||
vecEnd[0] -= 32.0f;
|
grad[3] = ( gcolor.r + gcolor.g + gcolor.b ) / 768.0f;
|
||||||
|
|
||||||
gcolor = R_LightVec( vecSrc, vecEnd, NULL );
|
lightDir[0] = grad[0] - grad[1] - grad[2] + grad[3];
|
||||||
grad[3] = ( gcolor.r + gcolor.g + gcolor.b ) / 768.0f;
|
lightDir[1] = grad[1] + grad[0] - grad[2] - grad[3];
|
||||||
|
VectorNormalize( lightDir );
|
||||||
lightDir[0] = grad[0] - grad[1] - grad[2] + grad[3];
|
}
|
||||||
lightDir[1] = grad[1] + grad[0] - grad[2] - grad[3];
|
else
|
||||||
VectorNormalize( lightDir );
|
{
|
||||||
|
VectorCopy( g_studio.lightvec, lightDir );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
VectorSet( finalLight, light.r, light.g, light.b );
|
VectorSet( finalLight, light.r, light.g, light.b );
|
||||||
|
@ -2531,6 +2535,7 @@ static void R_StudioDrawAbsBBox( void )
|
||||||
TriVertex3fv( p[boxpnt[i][3]] );
|
TriVertex3fv( p[boxpnt[i][3]] );
|
||||||
}
|
}
|
||||||
TriEnd();
|
TriEnd();
|
||||||
|
TriRenderMode( kRenderNormal );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -3126,6 +3131,13 @@ void R_StudioRenderFinal( void )
|
||||||
pglVertex3fv( g_studio.lightspot );
|
pglVertex3fv( g_studio.lightspot );
|
||||||
pglEnd();
|
pglEnd();
|
||||||
|
|
||||||
|
pglBegin( GL_LINES );
|
||||||
|
pglColor3f( 0, 0.5, 1 );
|
||||||
|
VectorMA( g_studio.lightspot, -64.0f, g_studio.lightvec, origin );
|
||||||
|
pglVertex3fv( g_studio.lightspot );
|
||||||
|
pglVertex3fv( origin );
|
||||||
|
pglEnd();
|
||||||
|
|
||||||
pglPointSize( 5.0f );
|
pglPointSize( 5.0f );
|
||||||
pglColor3f( 1, 0, 0 );
|
pglColor3f( 1, 0, 0 );
|
||||||
pglBegin( GL_POINTS );
|
pglBegin( GL_POINTS );
|
||||||
|
|
|
@ -362,7 +362,7 @@ static int Mod_ArrayUsage( const char *szItem, int items, int maxitems, int item
|
||||||
|
|
||||||
Con_Printf( "%-12s %7i/%-7i %8i/%-8i (%4.1f%%) ", szItem, items, maxitems, items * itemsize, maxitems * itemsize, percentage );
|
Con_Printf( "%-12s %7i/%-7i %8i/%-8i (%4.1f%%) ", szItem, items, maxitems, items * itemsize, maxitems * itemsize, percentage );
|
||||||
|
|
||||||
if( percentage > 99.9f )
|
if( percentage > 99.99f )
|
||||||
Con_Printf( "^1SIZE OVERFLOW!!!^7\n" );
|
Con_Printf( "^1SIZE OVERFLOW!!!^7\n" );
|
||||||
else if( percentage > 95.0f )
|
else if( percentage > 95.0f )
|
||||||
Con_Printf( "^3SIZE DANGER!^7\n" );
|
Con_Printf( "^3SIZE DANGER!^7\n" );
|
||||||
|
@ -384,7 +384,7 @@ static int Mod_GlobUsage( const char *szItem, int itemstorage, int maxstorage )
|
||||||
|
|
||||||
Con_Printf( "%-15s %-12s %8i/%-8i (%4.1f%%) ", szItem, "[variable]", itemstorage, maxstorage, percentage );
|
Con_Printf( "%-15s %-12s %8i/%-8i (%4.1f%%) ", szItem, "[variable]", itemstorage, maxstorage, percentage );
|
||||||
|
|
||||||
if( percentage > 99.9f )
|
if( percentage > 99.99f )
|
||||||
Con_Printf( "^1SIZE OVERFLOW!!!^7\n" );
|
Con_Printf( "^1SIZE OVERFLOW!!!^7\n" );
|
||||||
else if( percentage > 95.0f )
|
else if( percentage > 95.0f )
|
||||||
Con_Printf( "^3SIZE DANGER!^7\n" );
|
Con_Printf( "^3SIZE DANGER!^7\n" );
|
||||||
|
|
|
@ -588,7 +588,7 @@ static void Netchan_CreateFragments_( netchan_t *chan, sizebuf_t *msg )
|
||||||
|
|
||||||
if( pbOut && uCompressedSize > 0 && uCompressedSize < uSourceSize )
|
if( pbOut && uCompressedSize > 0 && uCompressedSize < uSourceSize )
|
||||||
{
|
{
|
||||||
Con_DPrintf( "Compressing split packet (%d -> %d bytes)\n", uSourceSize, uCompressedSize );
|
Con_Reportf( "Compressing split packet (%d -> %d bytes)\n", uSourceSize, uCompressedSize );
|
||||||
memcpy( msg->pData, pbOut, uCompressedSize );
|
memcpy( msg->pData, pbOut, uCompressedSize );
|
||||||
MSG_SeekToBit( msg, uCompressedSize << 3, SEEK_SET );
|
MSG_SeekToBit( msg, uCompressedSize << 3, SEEK_SET );
|
||||||
}
|
}
|
||||||
|
|
Reference in New Issue