remove -texrange business (assuming it's not relevant for decades)
optimize -meta (shave off 1/3 in worst case)
This commit is contained in:
parent
8d71aea059
commit
160c1d33db
|
|
@ -23,7 +23,7 @@
|
|||
td.formatted_questions { text-align: left; white-space: normal}
|
||||
td.formatted_questions ol { margin-top: 0px; margin-bottom: 0px; }
|
||||
</style>
|
||||
<link href="stylesheet.css" media="screen" rel="stylesheet" type="text/css" />
|
||||
<link href="stylesheet.css" media="screen" rel="stylesheet" type="text/css" />
|
||||
<!-- page specific tags -->
|
||||
|
||||
<link href="scm.css" media="screen" rel="stylesheet" type="text/css" />
|
||||
|
|
@ -34,11 +34,11 @@ td.formatted_questions ol { margin-top: 0px; margin-bottom: 0px; }
|
|||
<div id="account">
|
||||
<ul><li><a href="/login" class="login">Войти</a></li>
|
||||
<li><a href="/account/register" class="register">Регистрация</a></li></ul> </div>
|
||||
|
||||
|
||||
<ul><li><a href="/" class="home">Домашняя страница</a></li>
|
||||
<li><a href="/projects" class="projects">Проекты</a></li>
|
||||
<li><a href="http://www.redmine.org/guide" class="help">Помощь</a></li></ul></div>
|
||||
|
||||
|
||||
<div id="header">
|
||||
<div id="quick-search">
|
||||
<form action="/search/index/netradiant" method="get">
|
||||
|
|
@ -46,11 +46,11 @@ td.formatted_questions ol { margin-top: 0px; margin-bottom: 0px; }
|
|||
<a href="/search/index/netradiant" accesskey="4">Поиск</a>:
|
||||
<input accesskey="f" class="small" id="q" name="q" size="20" type="text" />
|
||||
</form>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<h1>NetRadiant</h1>
|
||||
|
||||
|
||||
<div id="main-menu">
|
||||
<ul><li><a href="/projects/netradiant" class="overview">Просмотр</a></li>
|
||||
<li><a href="/projects/netradiant/activity" class="activity">Активность</a></li>
|
||||
|
|
@ -66,8 +66,8 @@ td.formatted_questions ol { margin-top: 0px; margin-bottom: 0px; }
|
|||
</div>
|
||||
|
||||
<div class="" id="main">
|
||||
<div id="sidebar">
|
||||
|
||||
<div id="sidebar">
|
||||
|
||||
<h3>Wiki</h3>
|
||||
|
||||
<a href="/projects/netradiant/wiki">Стартовая страница</a><br />
|
||||
|
|
@ -75,11 +75,11 @@ td.formatted_questions ol { margin-top: 0px; margin-bottom: 0px; }
|
|||
<a href="/projects/netradiant/wiki/Date_index">История страниц</a><br />
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div id="content">
|
||||
|
||||
|
||||
<div class="contextual">
|
||||
|
||||
|
||||
|
|
@ -156,7 +156,6 @@ td.formatted_questions ol { margin-top: 0px; margin-bottom: 0px; }
|
|||
<li><strong><code>-skyfix</code>:</strong> Turn sky box into six surfaces to work around ATI problems</li>
|
||||
<li><strong><code>-snap</code> N:</strong> Snap brush bevel planes to the given number of units</li>
|
||||
<li><strong><code>-tempname</code> filename.map:</strong> Read the MAP file from the given file name</li>
|
||||
<li><strong><code>-texrange</code> N:</strong> Limit per-surface texture range to the given number of units, and subdivide surfaces like with <code>q3map_tessSize</code> if this is not met</li>
|
||||
<li><strong><code>-verboseentities</code>:</strong> Enable <code>-v</code> only for map entities, not for the world</li>
|
||||
</ul>
|
||||
|
||||
|
|
@ -365,13 +364,13 @@ td.formatted_questions ol { margin-top: 0px; margin-bottom: 0px; }
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
<div style="clear:both;"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="ajax-indicator" style="display:none;"><span>Загрузка...</span></div>
|
||||
|
||||
|
||||
<div id="footer">
|
||||
Powered by <a href="http://www.redmine.org/">Redmine</a> © 2006-2010 Jean-Philippe Lang
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -27,15 +27,13 @@ struct MinMax___
|
|||
{
|
||||
BasicVector3<T> mins;
|
||||
BasicVector3<T> maxs;
|
||||
MinMax___(){
|
||||
clear();
|
||||
MinMax___() : mins( std::numeric_limits<T>::max() ), maxs( std::numeric_limits<T>::lowest() ) {
|
||||
}
|
||||
template<typename U>
|
||||
MinMax___( const BasicVector3<U>& min, const BasicVector3<U>& max ) : mins( min ), maxs( max ){
|
||||
}
|
||||
void clear(){
|
||||
mins.x() = mins.y() = mins.z() = std::numeric_limits<T>::max();
|
||||
maxs.x() = maxs.y() = maxs.z() = std::numeric_limits<T>::lowest();
|
||||
*this = MinMax___();
|
||||
}
|
||||
bool valid() const {
|
||||
return mins.x() < maxs.x() && mins.y() < maxs.y() && mins.z() < maxs.z();
|
||||
|
|
|
|||
|
|
@ -802,11 +802,6 @@ int BSPMain( int argc, char **argv ){
|
|||
}
|
||||
i++;
|
||||
}
|
||||
else if ( striEqual( argv[ i ], "-texrange" ) ) {
|
||||
texRange = std::max( 0, atoi( argv[ i + 1 ] ) );
|
||||
i++;
|
||||
Sys_Printf( "Limiting per-surface texture range to %d texels\n", texRange );
|
||||
}
|
||||
else if ( striEqual( argv[ i ], "-nohint" ) ) {
|
||||
Sys_Printf( "Hint brushes disabled\n" );
|
||||
noHint = true;
|
||||
|
|
|
|||
|
|
@ -135,7 +135,6 @@ void HelpBsp()
|
|||
{"-sRGBcolor", "Treat shader and light entity colors as sRGB colorspace"},
|
||||
{"-sRGBtex", "Treat textures as sRGB colorspace"},
|
||||
{"-tempname <filename.map>", "Read the MAP file from the given file name"},
|
||||
{"-texrange <N>", "Limit per-surface texture range to the given number of units, and subdivide surfaces like with `q3map_tessSize` if this is not met"},
|
||||
{"-verboseentities", "Enable `-v` only for map entities, not for the world"},
|
||||
};
|
||||
HelpOptions("BSP Stage", 0, 80, bsp, std::size(bsp));
|
||||
|
|
|
|||
|
|
@ -942,10 +942,6 @@ struct mapDrawSurface_t
|
|||
/* ydnar: shadow group support */
|
||||
int castShadows, recvShadows;
|
||||
|
||||
/* ydnar: texture coordinate range monitoring for hardware with limited texcoord precision (in texel space) */
|
||||
Vector2 bias;
|
||||
int texMins[ 2 ], texMaxs[ 2 ], texRange[ 2 ];
|
||||
|
||||
/* ydnar: for patches */
|
||||
float longestCurve;
|
||||
int maxIterations;
|
||||
|
|
@ -1680,7 +1676,6 @@ mapDrawSurface_t *AllocDrawSurface( ESurfaceType type );
|
|||
void FinishSurface( mapDrawSurface_t *ds );
|
||||
void StripFaceSurface( mapDrawSurface_t *ds );
|
||||
void MaxAreaFaceSurface( mapDrawSurface_t *ds );
|
||||
bool CalcSurfaceTextureRange( mapDrawSurface_t *ds );
|
||||
Vector3 CalcLightmapAxis( const Vector3& normal );
|
||||
void ClassifySurfaces( int numSurfs, mapDrawSurface_t *ds );
|
||||
void ClassifyEntitySurfaces( entity_t *e );
|
||||
|
|
@ -2022,7 +2017,6 @@ Q_EXTERN int maxSurfaceVerts Q_ASSIGN( 999 ); /* ydnar */
|
|||
Q_EXTERN int maxSurfaceIndexes Q_ASSIGN( 6000 ); /* ydnar */
|
||||
Q_EXTERN float npDegrees Q_ASSIGN( 0.0f ); /* ydnar: nonplanar degrees */
|
||||
Q_EXTERN int bevelSnap Q_ASSIGN( 0 ); /* ydnar: bevel plane snap */
|
||||
Q_EXTERN int texRange Q_ASSIGN( 0 );
|
||||
Q_EXTERN bool flat Q_ASSIGN( false );
|
||||
Q_EXTERN bool meta Q_ASSIGN( false );
|
||||
Q_EXTERN bool patchMeta Q_ASSIGN( false );
|
||||
|
|
|
|||
|
|
@ -133,11 +133,10 @@ mapDrawSurface_t *CloneSurface( mapDrawSurface_t *src, shaderInfo_t *si ){
|
|||
}
|
||||
|
||||
/* copy indexes */
|
||||
if ( ds->numIndexes <= 0 ) {
|
||||
return ds;
|
||||
if ( ds->numIndexes > 0 ) {
|
||||
ds->indexes = safe_malloc( ds->numIndexes * sizeof( *ds->indexes ) );
|
||||
memcpy( ds->indexes, src->indexes, ds->numIndexes * sizeof( *ds->indexes ) );
|
||||
}
|
||||
ds->indexes = safe_malloc( ds->numIndexes * sizeof( *ds->indexes ) );
|
||||
memcpy( ds->indexes, src->indexes, ds->numIndexes * sizeof( *ds->indexes ) );
|
||||
|
||||
/* return the surface */
|
||||
return ds;
|
||||
|
|
@ -316,25 +315,12 @@ void TidyEntitySurfaces( entity_t *e ){
|
|||
|
||||
|
||||
|
||||
/*
|
||||
CalcSurfaceTextureRange() - ydnar
|
||||
calculates the clamped texture range for a given surface, returns true if it's within [-texRange,texRange]
|
||||
*/
|
||||
|
||||
bool CalcSurfaceTextureRange( mapDrawSurface_t *ds ){
|
||||
int i, j, v, size[ 2 ];
|
||||
|
||||
|
||||
/* try to early out */
|
||||
if ( ds->numVerts <= 0 ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
static Vector2 CalcSurfaceTextureBias( const mapDrawSurface_t *ds ){
|
||||
/* walk the verts and determine min/max st values */
|
||||
Vector2 mins( 999999, 999999 ), maxs( -999999, -999999 );
|
||||
for ( i = 0; i < ds->numVerts; i++ )
|
||||
Vector2 mins( 999999, 999999 ), maxs( -999999, -999999 ), bias;
|
||||
for ( int i = 0; i < ds->numVerts; i++ )
|
||||
{
|
||||
for ( j = 0; j < 2; j++ )
|
||||
for ( int j = 0; j < 2; j++ )
|
||||
{
|
||||
value_minimize( mins[ j ], ds->verts[ i ].st[ j ] );
|
||||
value_maximize( maxs[ j ], ds->verts[ i ].st[ j ] );
|
||||
|
|
@ -342,45 +328,10 @@ bool CalcSurfaceTextureRange( mapDrawSurface_t *ds ){
|
|||
}
|
||||
|
||||
/* clamp to integer range and calculate surface bias values */
|
||||
for ( j = 0; j < 2; j++ )
|
||||
ds->bias[ j ] = -floor( 0.5f * ( mins[ j ] + maxs[ j ] ) );
|
||||
for ( int i = 0; i < 2; i++ )
|
||||
bias[ i ] = floor( 0.5f * ( mins[ i ] + maxs[ i ] ) );
|
||||
|
||||
/* find biased texture coordinate mins/maxs */
|
||||
size[ 0 ] = ds->shaderInfo->shaderWidth;
|
||||
size[ 1 ] = ds->shaderInfo->shaderHeight;
|
||||
ds->texMins[ 0 ] = 999999;
|
||||
ds->texMins[ 1 ] = 999999;
|
||||
ds->texMaxs[ 0 ] = -999999;
|
||||
ds->texMaxs[ 1 ] = -999999;
|
||||
for ( i = 0; i < ds->numVerts; i++ )
|
||||
{
|
||||
for ( j = 0; j < 2; j++ )
|
||||
{
|
||||
v = ( ds->verts[ i ].st[ j ] + ds->bias[ j ] ) * size[ j ];
|
||||
value_minimize( ds->texMins[ j ], v );
|
||||
value_maximize( ds->texMaxs[ j ], v );
|
||||
}
|
||||
}
|
||||
|
||||
/* calc ranges */
|
||||
for ( j = 0; j < 2; j++ )
|
||||
ds->texRange[ j ] = ( ds->texMaxs[ j ] - ds->texMins[ j ] );
|
||||
|
||||
/* if range is zero, then assume unlimited precision */
|
||||
if ( texRange == 0 ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
/* within range? */
|
||||
for ( j = 0; j < 2; j++ )
|
||||
{
|
||||
if ( ds->texMins[ j ] < -texRange || ds->texMaxs[ j ] > texRange ) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/* within range */
|
||||
return true;
|
||||
return bias;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -1273,20 +1224,15 @@ static void SubdivideFace_r( entity_t *e, const brush_t& brush, const side_t& si
|
|||
*/
|
||||
|
||||
void SubdivideFaceSurfaces( entity_t *e ){
|
||||
int i, j, numBaseDrawSurfs, fogNum;
|
||||
mapDrawSurface_t *ds;
|
||||
float range, size, subdivisions, s2;
|
||||
|
||||
|
||||
/* note it */
|
||||
Sys_FPrintf( SYS_VRB, "--- SubdivideFaceSurfaces ---\n" );
|
||||
|
||||
/* walk the list of surfaces */
|
||||
numBaseDrawSurfs = numMapDrawSurfs;
|
||||
for ( i = e->firstDrawSurf; i < numBaseDrawSurfs; i++ )
|
||||
const int numBaseDrawSurfs = numMapDrawSurfs;
|
||||
for ( int i = e->firstDrawSurf; i < numBaseDrawSurfs; i++ )
|
||||
{
|
||||
/* get surface */
|
||||
ds = &mapDrawSurfs[ i ];
|
||||
mapDrawSurface_t *ds = &mapDrawSurfs[ i ];
|
||||
|
||||
/* only subdivide brush sides */
|
||||
if ( ds->type != ESurfaceType::Face || ds->mapBrush == NULL || ds->sideRef == NULL || ds->sideRef->side == NULL ) {
|
||||
|
|
@ -1308,39 +1254,14 @@ void SubdivideFaceSurfaces( entity_t *e ){
|
|||
continue;
|
||||
}
|
||||
|
||||
/* do texture coordinate range check */
|
||||
ClassifySurfaces( 1, ds );
|
||||
if ( !CalcSurfaceTextureRange( ds ) ) {
|
||||
/* calculate subdivisions texture range (this code is shit) */
|
||||
range = std::max( ds->texRange[ 0 ], ds->texRange[ 1 ] );
|
||||
size = ds->minmax.maxs[ 0 ] - ds->minmax.mins[ 0 ];
|
||||
for ( j = 1; j < 3; j++ )
|
||||
value_maximize( size, ds->minmax.maxs[ j ] - ds->minmax.mins[ j ] );
|
||||
subdivisions = ( size / range ) * texRange;
|
||||
subdivisions = ceil( subdivisions / 2 ) * 2;
|
||||
for ( j = 1; j < 8; j++ )
|
||||
{
|
||||
s2 = ceil( (float) texRange / j );
|
||||
if ( fabs( subdivisions - s2 ) <= 4.0 ) {
|
||||
subdivisions = s2;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else{
|
||||
subdivisions = si->subdivisions;
|
||||
}
|
||||
|
||||
/* get subdivisions from shader */
|
||||
if ( si->subdivisions > 0 ) {
|
||||
value_minimize( subdivisions, si->subdivisions );
|
||||
}
|
||||
const float subdivisions = si->subdivisions;
|
||||
if ( subdivisions < 1.0f ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
/* preserve fog num */
|
||||
fogNum = ds->fogNum;
|
||||
const int fogNum = ds->fogNum;
|
||||
|
||||
/* make a winding and free the surface */
|
||||
winding_t w = WindingFromDrawSurf( ds );
|
||||
|
|
@ -2843,18 +2764,18 @@ void MakeFogHullSurfs( entity_t *e, const char *shader ){
|
|||
*/
|
||||
|
||||
void BiasSurfaceTextures( mapDrawSurface_t *ds ){
|
||||
/* calculate the surface texture bias */
|
||||
CalcSurfaceTextureRange( ds );
|
||||
|
||||
/* don't bias globaltextured shaders */
|
||||
if ( ds->shaderInfo->globalTexture ) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* calculate the surface texture bias */
|
||||
const Vector2 bias = CalcSurfaceTextureBias( ds );
|
||||
|
||||
/* bias the texture coordinates */
|
||||
for ( int i = 0; i < ds->numVerts; i++ )
|
||||
{
|
||||
ds->verts[ i ].st += ds->bias;
|
||||
ds->verts[ i ].st -= bias;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -33,13 +33,7 @@
|
|||
|
||||
|
||||
|
||||
#define LIGHTMAP_EXCEEDED -1
|
||||
#define S_EXCEEDED -2
|
||||
#define T_EXCEEDED -3
|
||||
#define ST_EXCEEDED -4
|
||||
#define UNSUITABLE_TRIANGLE -10
|
||||
#define VERTS_EXCEEDED -1000
|
||||
#define INDEXES_EXCEEDED -2000
|
||||
|
||||
#define GROW_META_VERTS 1024
|
||||
#define GROW_META_TRIANGLES 1024
|
||||
|
|
@ -1318,18 +1312,10 @@ int AddMetaVertToSurface( mapDrawSurface_t *ds, bspDrawVert_t *dv1, int *coincid
|
|||
#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, bool testAdd ){
|
||||
int i, score, coincident, ai, bi, ci, oldTexRange[ 2 ];
|
||||
float lmMax;
|
||||
bool inTexRange;
|
||||
mapDrawSurface_t old;
|
||||
static int AddMetaTriangleToSurface( mapDrawSurface_t *ds, metaTriangle_t *tri, MinMax& texMinMax, bool testAdd ){
|
||||
int i, score, coincident, ai, bi, ci;
|
||||
|
||||
|
||||
/* overflow check */
|
||||
if ( ds->numIndexes >= maxSurfaceIndexes ) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* test the triangle */
|
||||
if ( ds->entityNum != tri->entityNum ) { /* ydnar: added 2002-07-06 */
|
||||
return 0;
|
||||
|
|
@ -1379,7 +1365,7 @@ static int AddMetaTriangleToSurface( mapDrawSurface_t *ds, metaTriangle_t *tri,
|
|||
}
|
||||
|
||||
/* preserve old drawsurface if this fails */
|
||||
memcpy( &old, ds, sizeof( *ds ) );
|
||||
mapDrawSurface_t old( *ds );
|
||||
|
||||
/* attempt to add the verts */
|
||||
coincident = 0;
|
||||
|
|
@ -1404,12 +1390,12 @@ static int AddMetaTriangleToSurface( mapDrawSurface_t *ds, metaTriangle_t *tri,
|
|||
|
||||
/* check lightmap bounds overflow (after at least 1 triangle has been added) */
|
||||
if ( !( ds->shaderInfo->compileFlags & C_VERTEXLIT ) &&
|
||||
ds->numIndexes > 0 && vector3_length( ds->lightmapAxis ) != 0.0f &&
|
||||
ds->numIndexes > 0 && ds->lightmapAxis != g_vector3_identity &&
|
||||
( !VectorCompare( ds->minmax.mins, minmax.mins ) || !VectorCompare( ds->minmax.maxs, minmax.maxs ) ) ) {
|
||||
/* set maximum size before lightmap scaling (normally 2032 units) */
|
||||
/* 2004-02-24: scale lightmap test size by 2 to catch larger brush faces */
|
||||
/* 2004-04-11: reverting to actual lightmap size */
|
||||
lmMax = ( ds->sampleSize * ( ds->shaderInfo->lmCustomWidth - 1 ) );
|
||||
const float lmMax = ( ds->sampleSize * ( ds->shaderInfo->lmCustomWidth - 1 ) );
|
||||
for ( i = 0; i < 3; i++ )
|
||||
{
|
||||
if ( ( minmax.maxs[ i ] - minmax.mins[ i ] ) > lmMax ) {
|
||||
|
|
@ -1420,28 +1406,33 @@ static int AddMetaTriangleToSurface( mapDrawSurface_t *ds, metaTriangle_t *tri,
|
|||
}
|
||||
|
||||
/* check texture range overflow */
|
||||
oldTexRange[ 0 ] = ds->texRange[ 0 ];
|
||||
oldTexRange[ 1 ] = ds->texRange[ 1 ];
|
||||
inTexRange = CalcSurfaceTextureRange( ds );
|
||||
MinMax newTexMinMax( texMinMax );
|
||||
{
|
||||
newTexMinMax.extend( Vector3( metaVerts[ tri->indexes[ 0 ] ].st ) );
|
||||
newTexMinMax.extend( Vector3( metaVerts[ tri->indexes[ 1 ] ].st ) );
|
||||
newTexMinMax.extend( Vector3( metaVerts[ tri->indexes[ 2 ] ].st ) );
|
||||
if( texMinMax.surrounds( newTexMinMax ) ){
|
||||
score += 4 * ST_SCORE;
|
||||
}
|
||||
else{
|
||||
const Vector2 wh( ds->shaderInfo->shaderWidth, ds->shaderInfo->shaderHeight );
|
||||
BasicVector2<int> oldTexRange( ( texMinMax.maxs - texMinMax.mins ).vec2() * wh );
|
||||
BasicVector2<int> newTexRange( ( newTexMinMax.maxs - newTexMinMax.mins ).vec2() * wh );
|
||||
/* score texture range */
|
||||
if ( newTexRange[ 0 ] <= oldTexRange[ 0 ] ) {
|
||||
score += ST_SCORE2;
|
||||
}
|
||||
else if ( oldTexRange[ 1 ] > oldTexRange[ 0 ] ) {
|
||||
score += ST_SCORE;
|
||||
}
|
||||
|
||||
if ( !inTexRange && ds->numIndexes > 0 ) {
|
||||
memcpy( ds, &old, sizeof( *ds ) );
|
||||
return UNSUITABLE_TRIANGLE;
|
||||
}
|
||||
|
||||
/* score texture range */
|
||||
if ( ds->texRange[ 0 ] <= oldTexRange[ 0 ] ) {
|
||||
score += ST_SCORE2;
|
||||
}
|
||||
else if ( ds->texRange[ 0 ] > oldTexRange[ 0 ] && oldTexRange[ 1 ] > oldTexRange[ 0 ] ) {
|
||||
score += ST_SCORE;
|
||||
}
|
||||
|
||||
if ( ds->texRange[ 1 ] <= oldTexRange[ 1 ] ) {
|
||||
score += ST_SCORE2;
|
||||
}
|
||||
else if ( ds->texRange[ 1 ] > oldTexRange[ 1 ] && oldTexRange[ 0 ] > oldTexRange[ 1 ] ) {
|
||||
score += ST_SCORE;
|
||||
if ( newTexRange[ 1 ] <= oldTexRange[ 1 ] ) {
|
||||
score += ST_SCORE2;
|
||||
}
|
||||
else if ( oldTexRange[ 0 ] > oldTexRange[ 1 ] ) {
|
||||
score += ST_SCORE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -1475,22 +1466,16 @@ static int AddMetaTriangleToSurface( mapDrawSurface_t *ds, metaTriangle_t *tri,
|
|||
}
|
||||
}
|
||||
|
||||
/* add the triangle indexes */
|
||||
if ( ds->numIndexes < maxSurfaceIndexes ) {
|
||||
ds->indexes[ ds->numIndexes++ ] = ai;
|
||||
}
|
||||
if ( ds->numIndexes < maxSurfaceIndexes ) {
|
||||
ds->indexes[ ds->numIndexes++ ] = bi;
|
||||
}
|
||||
if ( ds->numIndexes < maxSurfaceIndexes ) {
|
||||
ds->indexes[ ds->numIndexes++ ] = ci;
|
||||
}
|
||||
|
||||
/* check index overflow */
|
||||
if ( ds->numIndexes >= maxSurfaceIndexes ) {
|
||||
if ( ds->numIndexes + 3 > maxSurfaceIndexes ) {
|
||||
memcpy( ds, &old, sizeof( *ds ) );
|
||||
return 0;
|
||||
}
|
||||
else{ /* add the triangle indexes */
|
||||
ds->indexes[ ds->numIndexes++ ] = ai;
|
||||
ds->indexes[ ds->numIndexes++ ] = bi;
|
||||
ds->indexes[ ds->numIndexes++ ] = ci;
|
||||
}
|
||||
|
||||
/* sanity check the indexes */
|
||||
if ( ds->numIndexes >= 3 &&
|
||||
|
|
@ -1506,15 +1491,16 @@ static int AddMetaTriangleToSurface( mapDrawSurface_t *ds, metaTriangle_t *tri,
|
|||
}
|
||||
else
|
||||
{
|
||||
/* copy bounds back to surface */
|
||||
/* store new bounds */
|
||||
ds->minmax = minmax;
|
||||
texMinMax = newTexMinMax;
|
||||
|
||||
/* mark triangle as used */
|
||||
tri->si = NULL;
|
||||
}
|
||||
|
||||
/* add a side reference */
|
||||
ds->sideRef = AllocSideRef( tri->side, ds->sideRef );
|
||||
/* add a side reference */
|
||||
ds->sideRef = AllocSideRef( tri->side, ds->sideRef );
|
||||
}
|
||||
|
||||
/* return to sender */
|
||||
return score;
|
||||
|
|
@ -1571,13 +1557,10 @@ static void MetaTrianglesToSurface( int numPossibles, metaTriangle_t *possibles,
|
|||
|
||||
ds->minmax.clear();
|
||||
|
||||
/* clear verts/indexes */
|
||||
memset( verts, 0, sizeof( *verts ) * maxSurfaceVerts );
|
||||
memset( indexes, 0, sizeof( *indexes ) * maxSurfaceIndexes );
|
||||
|
||||
MinMax texMinMax;
|
||||
|
||||
/* add the first triangle */
|
||||
if ( AddMetaTriangleToSurface( ds, seed, false ) ) {
|
||||
if ( AddMetaTriangleToSurface( ds, seed, texMinMax, false ) ) {
|
||||
( *numAdded )++;
|
||||
}
|
||||
|
||||
|
|
@ -1610,14 +1593,14 @@ static void MetaTrianglesToSurface( int numPossibles, metaTriangle_t *possibles,
|
|||
}
|
||||
|
||||
/* score this triangle */
|
||||
score = AddMetaTriangleToSurface( ds, test, true );
|
||||
score = AddMetaTriangleToSurface( ds, test, texMinMax, true );
|
||||
if ( score > bestScore ) {
|
||||
best = j;
|
||||
bestScore = score;
|
||||
|
||||
/* if we have a score over a certain threshold, just use it */
|
||||
if ( bestScore >= GOOD_SCORE ) {
|
||||
if ( AddMetaTriangleToSurface( ds, &possibles[ best ], false ) ) {
|
||||
if ( AddMetaTriangleToSurface( ds, &possibles[ best ], texMinMax, false ) ) {
|
||||
( *numAdded )++;
|
||||
}
|
||||
|
||||
|
|
@ -1631,7 +1614,7 @@ static void MetaTrianglesToSurface( int numPossibles, metaTriangle_t *possibles,
|
|||
|
||||
/* add best candidate */
|
||||
if ( best >= 0 && bestScore > ADEQUATE_SCORE ) {
|
||||
if ( AddMetaTriangleToSurface( ds, &possibles[ best ], false ) ) {
|
||||
if ( AddMetaTriangleToSurface( ds, &possibles[ best ], texMinMax, false ) ) {
|
||||
( *numAdded )++;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user