From: Rudolf Polzer Date: Thu, 15 Sep 2011 19:19:39 +0000 (+0200) Subject: make runtime parameters for meta X-Git-Tag: xonotic-v0.6.0~67^2~4 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=9aa6996229ce0872d7e694e928339fee05c952e1;p=xonotic%2Fnetradiant.git make runtime parameters for meta --- diff --git a/tools/quake3/q3map2/bsp.c b/tools/quake3/q3map2/bsp.c index 79019792..414b92ad 100644 --- a/tools/quake3/q3map2/bsp.c +++ b/tools/quake3/q3map2/bsp.c @@ -856,6 +856,33 @@ int BSPMain( int argc, char **argv ) Sys_Printf( "Creating meta surfaces from brush faces\n" ); meta = qtrue; } + else if( !strcmp( argv[ i ], "-metaadequatescore" ) ) + { + metaAdequateScore = atoi( argv[ i + 1 ]); + if( metaAdequateScore < 0 ) + metaAdequateScore = -1; + i++; + if( metaAdequateScore >= 0 ) + Sys_Printf( "Setting ADEQUATE meta score to %d (see surface_meta.c)\n", metaGoodScore ); + } + else if( !strcmp( argv[ i ], "-metagoodscore" ) ) + { + metaGoodScore = atoi( argv[ i + 1 ]); + if( metaGoodScore < 0 ) + metaGoodScore = -1; + i++; + if( metaGoodScore >= 0 ) + Sys_Printf( "Setting GOOD meta score to %d (see surface_meta.c)\n", metaGoodScore ); + } + else if( !strcmp( argv[ i ], "-metamaxbboxdistance" ) ) + { + metaMaxBBoxDistance = atof( argv[ i + 1 ]); + if( metaMaxBBoxDistance < 0 ) + metaMaxBBoxDistance = -1; + i++; + if( metaMaxBBoxDistance >= 0 ) + Sys_Printf( "Setting meta maximum bounding box distance to %f\n", metaMaxBBoxDistance ); + } else if( !strcmp( argv[ i ], "-patchmeta" ) ) { Sys_Printf( "Creating meta surfaces from patches\n" ); diff --git a/tools/quake3/q3map2/q3map2.h b/tools/quake3/q3map2/q3map2.h index e912d15b..ce6367f2 100644 --- a/tools/quake3/q3map2/q3map2.h +++ b/tools/quake3/q3map2/q3map2.h @@ -2034,6 +2034,9 @@ Q_EXTERN qboolean debugPortals Q_ASSIGN( qfalse ); Q_EXTERN qboolean lightmapTriangleCheck Q_ASSIGN(qfalse); Q_EXTERN qboolean lightmapExtraVisClusterNudge Q_ASSIGN(qfalse); Q_EXTERN qboolean lightmapFill Q_ASSIGN(qfalse); +Q_EXTERN int metaAdequateScore Q_ASSIGN( -1 ); +Q_EXTERN int metaGoodScore Q_ASSIGN( -1 ); +Q_EXTERN float metaMaxBBoxDistance Q_ASSIGN( -1 ); #if Q3MAP2_EXPERIMENTAL_SNAP_NORMAL_FIX // Increasing the normalEpsilon to compensate for new logic in SnapNormal(), where diff --git a/tools/quake3/q3map2/surface_meta.c b/tools/quake3/q3map2/surface_meta.c index 7bdeecc5..7f7d0b74 100644 --- a/tools/quake3/q3map2/surface_meta.c +++ b/tools/quake3/q3map2/surface_meta.c @@ -1388,20 +1388,20 @@ returns the score of the triangle added #define AXIS_SCORE 100000 #define AXIS_MIN 100000 #define VERT_SCORE 10000 -#define SURFACE_SCORE 1000 +#define SURFACE_SCORE 1000 #define ST_SCORE 50 #define ST_SCORE2 (2 * (ST_SCORE)) -#define ADEQUATE_SCORE ((AXIS_MIN) + 1 * (VERT_SCORE)) -#define GOOD_SCORE ((AXIS_MIN) + 2 * (VERT_SCORE) + 4 * (ST_SCORE)) -#define PERFECT_SCORE ((AXIS_MIN) + 3 * (VERT_SCORE) + (SURFACE_SCORE) + 4 * (ST_SCORE)) -//#define MAX_BBOX_DISTANCE 16 +#define DEFAULT_ADEQUATE_SCORE ((AXIS_MIN) + 1 * (VERT_SCORE)) +#define DEFAULT_GOOD_SCORE ((AXIS_MIN) + 2 * (VERT_SCORE) + 4 * (ST_SCORE)) +#define PERFECT_SCORE ((AXIS_MIN) + 3 * (VERT_SCORE) + (SURFACE_SCORE) + 4 * (ST_SCORE)) + +#define ADEQUATE_SCORE (metaAdequateScore >= 0 ? metaAdequateScore : DEFAULT_ADEQUATE_SCORE) +#define GOOD_SCORE (metaGoodScore >= 0 ? metaGoodScore : DEFAULT_GOOD_SCORE) static int AddMetaTriangleToSurface( mapDrawSurface_t *ds, metaTriangle_t *tri, qboolean testAdd ) { -#if MAX_BBOX_DISTANCE > 0 vec3_t p; -#endif int i, score, coincident, ai, bi, ci, oldTexRange[ 2 ]; float lmMax; vec3_t mins, maxs; @@ -1438,34 +1438,35 @@ static int AddMetaTriangleToSurface( mapDrawSurface_t *ds, metaTriangle_t *tri, -#if MAX_BBOX_DISTANCE > 0 - if(ds->numIndexes > 0) + if(metaMaxBBoxDistance >= 0) { - VectorCopy( ds->mins, mins ); - VectorCopy( ds->maxs, maxs ); - mins[0] -= MAX_BBOX_DISTANCE; - mins[1] -= MAX_BBOX_DISTANCE; - mins[2] -= MAX_BBOX_DISTANCE; - maxs[0] += MAX_BBOX_DISTANCE; - maxs[1] += MAX_BBOX_DISTANCE; - maxs[2] += MAX_BBOX_DISTANCE; + if(ds->numIndexes > 0) + { + VectorCopy( ds->mins, mins ); + VectorCopy( ds->maxs, maxs ); + mins[0] -= metaMaxBBoxDistance; + mins[1] -= metaMaxBBoxDistance; + mins[2] -= metaMaxBBoxDistance; + maxs[0] += metaMaxBBoxDistance; + maxs[1] += metaMaxBBoxDistance; + maxs[2] += metaMaxBBoxDistance; #define CHECK_1D(mins, v, maxs) ((mins) <= (v) && (v) <= (maxs)) #define CHECK_3D(mins, v, maxs) (CHECK_1D((mins)[0], (v)[0], (maxs)[0]) && CHECK_1D((mins)[1], (v)[1], (maxs)[1]) && CHECK_1D((mins)[2], (v)[2], (maxs)[2])) - VectorCopy(metaVerts[ tri->indexes[ 0 ] ].xyz, p); - if(!CHECK_3D(mins, p, maxs)) - { - VectorCopy(metaVerts[ tri->indexes[ 1 ] ].xyz, p); + VectorCopy(metaVerts[ tri->indexes[ 0 ] ].xyz, p); if(!CHECK_3D(mins, p, maxs)) { - VectorCopy(metaVerts[ tri->indexes[ 2 ] ].xyz, p); + VectorCopy(metaVerts[ tri->indexes[ 1 ] ].xyz, p); if(!CHECK_3D(mins, p, maxs)) - return 0; + { + VectorCopy(metaVerts[ tri->indexes[ 2 ] ].xyz, p); + if(!CHECK_3D(mins, p, maxs)) + return 0; + } } - } #undef CHECK_3D #undef CHECK_1D + } } -#endif /* set initial score */ score = tri->surfaceNum == ds->surfaceNum ? SURFACE_SCORE : 0;