mirror of
https://github.com/TTimo/GtkRadiant.git
synced 2025-01-25 02:41:22 +00:00
some stuff by 27:
- better BSP tree splitting (experimental, option -altsplit) - also compare shaders when sorting surfaces (should give slightly more fps) - misc_model spawnflag 32: set vertex alpha from vertex color (for terrain blending) git-svn-id: svn://svn.icculus.org/netradiant/trunk@240 61c419a2-8eb2-4b30-bcec-8cead039b335
This commit is contained in:
parent
79605bbc69
commit
23807ef4b3
5 changed files with 61 additions and 10 deletions
|
@ -842,6 +842,11 @@ int BSPMain( int argc, char **argv ){
|
||||||
Sys_Printf( "Debug portal surfaces enabled\n" );
|
Sys_Printf( "Debug portal surfaces enabled\n" );
|
||||||
debugPortals = qtrue;
|
debugPortals = qtrue;
|
||||||
}
|
}
|
||||||
|
else if( !strcmp( argv[ i ], "-altsplit" ) )
|
||||||
|
{
|
||||||
|
Sys_Printf( "Alternate BSP splitting (by 27) enabled\n" );
|
||||||
|
bspAlternateSplitWeights = qtrue;
|
||||||
|
}
|
||||||
else if ( !strcmp( argv[ i ], "-bsp" ) ) {
|
else if ( !strcmp( argv[ i ], "-bsp" ) ) {
|
||||||
Sys_Printf( "-bsp argument unnecessary\n" );
|
Sys_Printf( "-bsp argument unnecessary\n" );
|
||||||
}
|
}
|
||||||
|
|
|
@ -88,8 +88,8 @@ static void SelectSplitPlaneNum( node_t *node, face_t *list, int *splitPlaneNum,
|
||||||
vec3_t normal;
|
vec3_t normal;
|
||||||
float dist;
|
float dist;
|
||||||
int planenum;
|
int planenum;
|
||||||
|
float sizeBias;
|
||||||
|
|
||||||
/* ydnar: set some defaults */
|
/* ydnar: set some defaults */
|
||||||
*splitPlaneNum = -1; /* leaf */
|
*splitPlaneNum = -1; /* leaf */
|
||||||
*compileFlags = 0;
|
*compileFlags = 0;
|
||||||
|
@ -148,11 +148,30 @@ static void SelectSplitPlaneNum( node_t *node, face_t *list, int *splitPlaneNum,
|
||||||
back++;
|
back++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
value = 5 * facing - 5 * splits; // - abs(front-back);
|
|
||||||
if ( plane->type < 3 ) {
|
if(bspAlternateSplitWeights)
|
||||||
value += 5; // axial is better
|
{
|
||||||
|
// from 27
|
||||||
|
|
||||||
|
//Bigger is better
|
||||||
|
sizeBias=WindingArea(split->w);
|
||||||
|
|
||||||
|
//Base score = 20000 perfectly balanced
|
||||||
|
value = 20000-(abs(front-back));
|
||||||
|
value -= plane->counter;// If we've already used this plane sometime in the past try not to use it again
|
||||||
|
value -= facing ; // if we're going to have alot of other surfs use this plane, we want to get it in quickly.
|
||||||
|
value -= splits*5; //more splits = bad
|
||||||
|
value += sizeBias*10; //We want a huge score bias based on plane size
|
||||||
}
|
}
|
||||||
value += split->priority; // prioritize hints higher
|
else
|
||||||
|
{
|
||||||
|
value = 5*facing - 5*splits; // - abs(front-back);
|
||||||
|
if ( plane->type < 3 ) {
|
||||||
|
value+=5; // axial is better
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
value += split->priority; // prioritize hints higher
|
||||||
|
|
||||||
if ( value > bestValue ) {
|
if ( value > bestValue ) {
|
||||||
bestValue = value;
|
bestValue = value;
|
||||||
|
@ -168,6 +187,8 @@ static void SelectSplitPlaneNum( node_t *node, face_t *list, int *splitPlaneNum,
|
||||||
/* set best split data */
|
/* set best split data */
|
||||||
*splitPlaneNum = bestSplit->planenum;
|
*splitPlaneNum = bestSplit->planenum;
|
||||||
*compileFlags = bestSplit->compileFlags;
|
*compileFlags = bestSplit->compileFlags;
|
||||||
|
|
||||||
|
if (*splitPlaneNum>-1) mapplanes[ *splitPlaneNum ].counter++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -324,6 +345,11 @@ tree_t *FaceBSP( face_t *list ) {
|
||||||
}
|
}
|
||||||
Sys_FPrintf( SYS_VRB, "%9d faces\n", count );
|
Sys_FPrintf( SYS_VRB, "%9d faces\n", count );
|
||||||
|
|
||||||
|
for( i = 0; i < nummapplanes; i++)
|
||||||
|
{
|
||||||
|
mapplanes[ i ].counter=0;
|
||||||
|
}
|
||||||
|
|
||||||
tree->headnode = AllocNode();
|
tree->headnode = AllocNode();
|
||||||
VectorCopy( tree->mins, tree->headnode->mins );
|
VectorCopy( tree->mins, tree->headnode->mins );
|
||||||
VectorCopy( tree->maxs, tree->headnode->maxs );
|
VectorCopy( tree->maxs, tree->headnode->maxs );
|
||||||
|
|
|
@ -865,6 +865,14 @@ static int CompareSurfaceInfo( const void *a, const void *b ){
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* 27: then shader! */
|
||||||
|
if ( aInfo->si < bInfo->si ) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
else if ( aInfo->si > bInfo->si ) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
/* then lightmap sample size */
|
/* then lightmap sample size */
|
||||||
if ( aInfo->sampleSize < bInfo->sampleSize ) {
|
if ( aInfo->sampleSize < bInfo->sampleSize ) {
|
||||||
return 1;
|
return 1;
|
||||||
|
|
|
@ -389,10 +389,20 @@ void InsertModel( char *name, int frame, m4x4_t transform, remap_t *remap, shade
|
||||||
{
|
{
|
||||||
dv->lightmap[ j ][ 0 ] = 0.0f;
|
dv->lightmap[ j ][ 0 ] = 0.0f;
|
||||||
dv->lightmap[ j ][ 1 ] = 0.0f;
|
dv->lightmap[ j ][ 1 ] = 0.0f;
|
||||||
dv->color[ j ][ 0 ] = color[ 0 ];
|
if(spawnFlags & 32) // spawnflag 32: model color -> alpha hack
|
||||||
dv->color[ j ][ 1 ] = color[ 1 ];
|
{
|
||||||
dv->color[ j ][ 2 ] = color[ 2 ];
|
dv->color[ j ][ 0 ] = 255.0f;
|
||||||
dv->color[ j ][ 3 ] = color[ 3 ];
|
dv->color[ j ][ 1 ] = 255.0f;
|
||||||
|
dv->color[ j ][ 2 ] = 255.0f;
|
||||||
|
dv->color[ j ][ 3 ] = color[ 0 ] * 0.3f + color[ 1 ] * 0.59f + color[ 2 ] * 0.11f;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dv->color[ j ][ 0 ] = color[ 0 ];
|
||||||
|
dv->color[ j ][ 1 ] = color[ 1 ];
|
||||||
|
dv->color[ j ][ 2 ] = color[ 2 ];
|
||||||
|
dv->color[ j ][ 3 ] = color[ 3 ];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -801,6 +801,7 @@ typedef struct plane_s
|
||||||
vec3_t normal;
|
vec3_t normal;
|
||||||
vec_t dist;
|
vec_t dist;
|
||||||
int type;
|
int type;
|
||||||
|
int counter;
|
||||||
struct plane_s *hash_chain;
|
struct plane_s *hash_chain;
|
||||||
}
|
}
|
||||||
plane_t;
|
plane_t;
|
||||||
|
@ -1946,6 +1947,7 @@ Q_EXTERN qboolean nofog Q_ASSIGN( qfalse );
|
||||||
Q_EXTERN qboolean noHint Q_ASSIGN( qfalse ); /* ydnar */
|
Q_EXTERN qboolean noHint Q_ASSIGN( qfalse ); /* ydnar */
|
||||||
Q_EXTERN qboolean renameModelShaders Q_ASSIGN( qfalse ); /* ydnar */
|
Q_EXTERN qboolean renameModelShaders Q_ASSIGN( qfalse ); /* ydnar */
|
||||||
Q_EXTERN qboolean skyFixHack Q_ASSIGN( qfalse ); /* ydnar */
|
Q_EXTERN qboolean skyFixHack Q_ASSIGN( qfalse ); /* ydnar */
|
||||||
|
Q_EXTERN qboolean bspAlternateSplitWeights Q_ASSIGN( qfalse ); /* 27 */
|
||||||
|
|
||||||
Q_EXTERN int patchSubdivisions Q_ASSIGN( 8 ); /* ydnar: -patchmeta subdivisions */
|
Q_EXTERN int patchSubdivisions Q_ASSIGN( 8 ); /* ydnar: -patchmeta subdivisions */
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue