02 Dec 2017
This commit is contained in:
parent
fadd7a95d4
commit
ed59113f71
|
@ -138,6 +138,7 @@ BRUSH MODELS
|
|||
// texture flags
|
||||
#define TEX_SPECIAL BIT( 0 ) // sky or slime, no lightmap or 256 subdivision
|
||||
#define TEX_WORLD_LUXELS BIT( 1 ) // alternative lightmap matrix will be used (luxels per world units instead of luxels per texels)
|
||||
#define TEX_AXIAL_LUXELS BIT( 2 ) // force world luxels to axial positive scales
|
||||
|
||||
// ambient sound types
|
||||
enum
|
||||
|
|
|
@ -224,11 +224,12 @@ static vec3_t g_trace_lightspot;
|
|||
R_RecursiveLightPoint
|
||||
=================
|
||||
*/
|
||||
static qboolean R_RecursiveLightPoint( model_t *model, mnode_t *node, float p1f, float p2f, colorVec *cv, const vec3_t start, const vec3_t end )
|
||||
static qboolean R_RecursiveLightPoint( model_t *model, mnode_t *node, float p1f, float p2f, colorVec *cv, const vec3_t start, const vec3_t end, qboolean debug )
|
||||
{
|
||||
float front, back, frac, midf;
|
||||
int i, map, side, size, s, t;
|
||||
float sample_size;
|
||||
int i, map, side, size;
|
||||
float ds, dt, s, t;
|
||||
int sample_size;
|
||||
mextrasurf_t *info;
|
||||
msurface_t *surf;
|
||||
mtexinfo_t *tex;
|
||||
|
@ -248,7 +249,7 @@ static qboolean R_RecursiveLightPoint( model_t *model, mnode_t *node, float p1f,
|
|||
|
||||
side = front < 0;
|
||||
if(( back < 0 ) == side )
|
||||
return R_RecursiveLightPoint( model, node->children[side], p1f, p2f, cv, start, end );
|
||||
return R_RecursiveLightPoint( model, node->children[side], p1f, p2f, cv, start, end, debug );
|
||||
|
||||
frac = front / ( front - back );
|
||||
|
||||
|
@ -256,7 +257,7 @@ static qboolean R_RecursiveLightPoint( model_t *model, mnode_t *node, float p1f,
|
|||
midf = p1f + ( p2f - p1f ) * frac;
|
||||
|
||||
// co down front side
|
||||
if( R_RecursiveLightPoint( model, node->children[side], p1f, midf, cv, start, mid ))
|
||||
if( R_RecursiveLightPoint( model, node->children[side], p1f, midf, cv, start, mid, debug ))
|
||||
return true; // hit something
|
||||
|
||||
if(( back < 0 ) == side )
|
||||
|
@ -271,16 +272,24 @@ static qboolean R_RecursiveLightPoint( model_t *model, mnode_t *node, float p1f,
|
|||
|
||||
for( i = 0; i < node->numsurfaces; i++, surf++ )
|
||||
{
|
||||
int smax, tmax;
|
||||
|
||||
tex = surf->texinfo;
|
||||
info = surf->info;
|
||||
|
||||
if( FBitSet( surf->flags, SURF_DRAWTILED ))
|
||||
continue; // no lightmaps
|
||||
|
||||
s = DotProduct( mid, info->lmvecs[0] ) + info->lmvecs[0][3] - info->lightmapmins[0];
|
||||
t = DotProduct( mid, info->lmvecs[1] ) + info->lmvecs[1][3] - info->lightmapmins[1];
|
||||
s = DotProduct( mid, info->lmvecs[0] ) + info->lmvecs[0][3];
|
||||
t = DotProduct( mid, info->lmvecs[1] ) + info->lmvecs[1][3];
|
||||
|
||||
if(( s < 0 || s > info->lightextents[0] ) || ( t < 0 || t > info->lightextents[1] ))
|
||||
if( s < info->lightmapmins[0] || t < info->lightmapmins[1] )
|
||||
continue;
|
||||
|
||||
ds = s - info->lightmapmins[0];
|
||||
dt = t - info->lightmapmins[1];
|
||||
|
||||
if ( ds > info->lightextents[0] || dt > info->lightextents[1] )
|
||||
continue;
|
||||
|
||||
cv->r = cv->g = cv->b = cv->a = 0;
|
||||
|
@ -289,12 +298,14 @@ static qboolean R_RecursiveLightPoint( model_t *model, mnode_t *node, float p1f,
|
|||
return true;
|
||||
|
||||
sample_size = Mod_SampleSizeForFace( surf );
|
||||
s /= sample_size;
|
||||
t /= sample_size;
|
||||
smax = (info->lightextents[0] / sample_size) + 1;
|
||||
tmax = (info->lightextents[1] / sample_size) + 1;
|
||||
ds /= sample_size;
|
||||
dt /= sample_size;
|
||||
|
||||
lm = surf->samples + (t * ((info->lightextents[0] / (int)sample_size) + 1) + s);
|
||||
size = ((info->lightextents[0] / (int)sample_size) + 1) * ((info->lightextents[1] / sample_size) + 1);
|
||||
lm = surf->samples + Q_rint( dt ) * smax + Q_rint( ds );
|
||||
g_trace_fraction = midf;
|
||||
size = smax * tmax;
|
||||
|
||||
for( map = 0; map < MAXLIGHTMAPS && surf->styles[map] != 255; map++ )
|
||||
{
|
||||
|
@ -319,7 +330,7 @@ static qboolean R_RecursiveLightPoint( model_t *model, mnode_t *node, float p1f,
|
|||
}
|
||||
|
||||
// go down back side
|
||||
return R_RecursiveLightPoint( model, node->children[!side], midf, p2f, cv, mid, end );
|
||||
return R_RecursiveLightPoint( model, node->children[!side], midf, p2f, cv, mid, end, debug );
|
||||
}
|
||||
|
||||
int R_LightTraceFilter( physent_t *pe )
|
||||
|
@ -380,7 +391,7 @@ colorVec R_LightVec( const vec3_t start, const vec3_t end, vec3_t lspot )
|
|||
VectorClear( g_trace_lightspot );
|
||||
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, lspot != NULL ))
|
||||
continue; // didn't hit anything
|
||||
|
||||
if( g_trace_fraction < last_fraction )
|
||||
|
|
|
@ -3104,6 +3104,32 @@ void R_StudioRenderFinal( void )
|
|||
R_StudioDrawAttachments();
|
||||
}
|
||||
|
||||
if( r_drawentities->value == 7 )
|
||||
{
|
||||
vec3_t origin;
|
||||
|
||||
pglDisable( GL_TEXTURE_2D );
|
||||
pglDisable( GL_DEPTH_TEST );
|
||||
|
||||
Matrix3x4_OriginFromMatrix( g_studio.rotationmatrix, origin );
|
||||
|
||||
pglBegin( GL_LINES );
|
||||
pglColor3f( 1, 0.5, 0 );
|
||||
pglVertex3fv( origin );
|
||||
pglVertex3fv( g_studio.lightspot );
|
||||
pglEnd();
|
||||
|
||||
pglPointSize( 5.0f );
|
||||
pglColor3f( 1, 0, 0 );
|
||||
pglBegin( GL_POINTS );
|
||||
pglVertex3fv( g_studio.lightspot );
|
||||
pglEnd();
|
||||
pglPointSize( 1.0f );
|
||||
|
||||
pglEnable( GL_DEPTH_TEST );
|
||||
pglEnable( GL_TEXTURE_2D );
|
||||
}
|
||||
|
||||
R_StudioRestoreRenderer();
|
||||
}
|
||||
|
||||
|
|
|
@ -575,8 +575,11 @@ void Cmd_TokenizeString( char *text )
|
|||
|
||||
if( cmd_argc == 1 )
|
||||
cmd_args = text;
|
||||
|
||||
|
||||
host.com_ignorebracket = true;
|
||||
text = COM_ParseFile( text, cmd_token );
|
||||
host.com_ignorebracket = false;
|
||||
|
||||
if( !text ) return;
|
||||
|
||||
if( cmd_argc < MAX_CMD_TOKENS )
|
||||
|
|
|
@ -131,7 +131,10 @@ interpert this character as single
|
|||
*/
|
||||
static int COM_IsSingleChar( char c )
|
||||
{
|
||||
if( c == '{' || c == '}' || c == ')' || c == '(' || c == '\'' || c == ',' )
|
||||
if( c == '{' || c == '}' || c == '\'' || c == ',' )
|
||||
return true;
|
||||
|
||||
if( !host.com_ignorebracket && ( c == ')' || c == '(' ))
|
||||
return true;
|
||||
|
||||
if( host.com_handlecolon && c == ':' )
|
||||
|
|
|
@ -324,6 +324,7 @@ typedef struct host_parm_s
|
|||
qboolean allow_cheats; // this host will allow cheating
|
||||
qboolean con_showalways; // show console always (developer and dedicated)
|
||||
qboolean com_handlecolon; // allow COM_ParseFile to handle colon as single char
|
||||
qboolean com_ignorebracket; // allow COM_ParseFile to ignore () as single char
|
||||
qboolean change_game; // initialize when game is changed
|
||||
qboolean mouse_visible; // vgui override cursor control
|
||||
qboolean input_enabled; // vgui override mouse & keyboard input
|
||||
|
@ -409,7 +410,6 @@ int FS_UnGetc( file_t *file, byte c );
|
|||
void FS_StripExtension( char *path );
|
||||
long FS_Tell( file_t *file );
|
||||
qboolean FS_Eof( file_t *file );
|
||||
void FS_Purge( file_t *file );
|
||||
int FS_Close( file_t *file );
|
||||
int FS_Getc( file_t *file );
|
||||
qboolean FS_Eof( file_t *file );
|
||||
|
|
|
@ -106,7 +106,6 @@ typedef struct searchpath_s
|
|||
byte *fs_mempool;
|
||||
searchpath_t *fs_searchpaths = NULL; // chain
|
||||
searchpath_t fs_directpath; // static direct path
|
||||
char fs_rootdir[MAX_SYSPATH]; // engine root directory
|
||||
char fs_basedir[MAX_SYSPATH]; // base game directory
|
||||
char fs_gamedir[MAX_SYSPATH]; // game current directory
|
||||
char fs_writedir[MAX_SYSPATH]; // path that game allows to overwrite, delete and rename files (and create new of course)
|
||||
|
@ -124,6 +123,7 @@ static qboolean FS_SysFolderExists( const char *path );
|
|||
static long FS_SysFileTime( const char *filename );
|
||||
static char W_TypeFromExt( const char *lumpname );
|
||||
static const char *W_ExtFromType( char lumptype );
|
||||
static void FS_Purge( file_t* file );
|
||||
|
||||
/*
|
||||
=============================================================================
|
||||
|
@ -1703,7 +1703,6 @@ static searchpath_t *FS_FindFile( const char *name, int *index, qboolean gamedir
|
|||
{
|
||||
searchpath_t *search;
|
||||
char *pEnvPath;
|
||||
pack_t *pak;
|
||||
|
||||
// search through the path, one element at a time
|
||||
for( search = fs_searchpaths; search; search = search->next )
|
||||
|
@ -1715,6 +1714,7 @@ static searchpath_t *FS_FindFile( const char *name, int *index, qboolean gamedir
|
|||
if( search->pack )
|
||||
{
|
||||
int left, right, middle;
|
||||
pack_t *pak;
|
||||
|
||||
pak = search->pack;
|
||||
|
||||
|
@ -1867,11 +1867,13 @@ file_t *FS_OpenReadFile( const char *filename, const char *mode, qboolean gamedi
|
|||
return NULL; // let W_LoadFile get lump correctly
|
||||
else if( pack_ind < 0 )
|
||||
{
|
||||
// found in the filesystem?
|
||||
char path [MAX_SYSPATH];
|
||||
|
||||
// found in the filesystem?
|
||||
Q_sprintf( path, "%s%s", search->filename, filename );
|
||||
return FS_SysOpen( path, mode );
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
|
@ -511,6 +511,25 @@ int Mod_SampleSizeForFace( msurface_t *surf )
|
|||
return LM_SAMPLE_SIZE;
|
||||
}
|
||||
|
||||
static void MakeAxial( vec3_t normal )
|
||||
{
|
||||
int i, type;
|
||||
|
||||
for( type = 0; type < 3; type++ )
|
||||
{
|
||||
if( fabs( normal[type] ) > 0.9999f )
|
||||
break;
|
||||
}
|
||||
|
||||
// make positive and pure axial
|
||||
for( i = 0; i < 3 && type != 3; i++ )
|
||||
{
|
||||
if( i == type )
|
||||
normal[i] = 1.0f;
|
||||
else normal[i] = 0.0f;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
==================
|
||||
Mod_SampleSizeForFace
|
||||
|
@ -541,6 +560,12 @@ static void Mod_LightMatrixFromTexMatrix( const mtexinfo_t *tx, float lmvecs[2][
|
|||
VectorNormalize( lmvecs[0] );
|
||||
VectorNormalize( lmvecs[1] );
|
||||
|
||||
if( FBitSet( tx->flags, TEX_AXIAL_LUXELS ))
|
||||
{
|
||||
MakeAxial( lmvecs[0] );
|
||||
MakeAxial( lmvecs[1] );
|
||||
}
|
||||
|
||||
// put the lighting origin at center the poly
|
||||
VectorScale( lmvecs[0], (1.0 / lmscale), lmvecs[0] );
|
||||
VectorScale( lmvecs[1], -(1.0 / lmscale), lmvecs[1] );
|
||||
|
@ -656,7 +681,7 @@ void Mod_Init( void )
|
|||
{
|
||||
com_studiocache = Mem_AllocPool( "Studio Cache" );
|
||||
mod_studiocache = Cvar_Get( "r_studiocache", "1", FCVAR_ARCHIVE, "enables studio cache for speedup tracing hitboxes" );
|
||||
r_wadtextures = Cvar_Get( "r_wadtextures", "0", 0, "completely ignore textures in the wad-files if disabled" );
|
||||
r_wadtextures = Cvar_Get( "r_wadtextures", "0", 0, "completely ignore textures in the bsp-file if enabled" );
|
||||
|
||||
Cmd_AddCommand( "mapstats", Mod_PrintBSPFileSizes_f, "show stats for currently loaded map" );
|
||||
Cmd_AddCommand( "modellist", Mod_Modellist_f, "display loaded models list" );
|
||||
|
@ -2079,7 +2104,7 @@ static void Mod_LoadEntities( const dlump_t *l )
|
|||
Q_strcat( wadstring, ";" );
|
||||
|
||||
// parse wad pathes
|
||||
for (pszWadFile = strtok( wadstring, ";" ); pszWadFile != NULL; pszWadFile = strtok( NULL, ";" ))
|
||||
for( pszWadFile = strtok( wadstring, ";" ); pszWadFile != NULL; pszWadFile = strtok( NULL, ";" ))
|
||||
{
|
||||
COM_FixSlashes( pszWadFile );
|
||||
FS_FileBase( pszWadFile, wadlist.wadnames[wadlist.count++] );
|
||||
|
|
Reference in New Issue