fix introduced problems

This commit is contained in:
Garux 2021-02-28 12:04:52 +03:00
parent 9857bb955b
commit 9446aeca8e
5 changed files with 10 additions and 11 deletions

View File

@ -27,6 +27,9 @@ struct MinMax___
mins.x() = mins.y() = mins.z() = std::numeric_limits<T>::max(); mins.x() = mins.y() = mins.z() = std::numeric_limits<T>::max();
maxs.x() = maxs.y() = maxs.z() = std::numeric_limits<T>::lowest(); maxs.x() = maxs.y() = maxs.z() = std::numeric_limits<T>::lowest();
} }
bool valid() const {
return mins.x() < maxs.x() && mins.y() < maxs.y() && mins.z() < maxs.z();
}
template<typename U> template<typename U>
void extend( const BasicVector3<U>& point ){ void extend( const BasicVector3<U>& point ){
for ( size_t i = 0; i < 3; ++i ){ for ( size_t i = 0; i < 3; ++i ){

View File

@ -113,7 +113,7 @@ static void CreateSunLight( sun_t *sun ){
light->style = noStyles ? LS_NORMAL : sun->style; light->style = noStyles ? LS_NORMAL : sun->style;
/* set the light's position out to infinity */ /* set the light's position out to infinity */
light->origin = -direction * ( MAX_WORLD_COORD * 8.0f ); /* MAX_WORLD_COORD * 2.0f */ light->origin = direction * ( MAX_WORLD_COORD * 8.0f ); /* MAX_WORLD_COORD * 2.0f */
/* set the facing to be the inverse of the sun direction */ /* set the facing to be the inverse of the sun direction */
light->normal = -direction; light->normal = -direction;

View File

@ -1120,10 +1120,8 @@ static void ParseShaderFile( const char *filename ){
GetTokenAppend( shaderText, false ); amp = atof( token ); GetTokenAppend( shaderText, false ); amp = atof( token );
/* calculate */ /* calculate */
const Vector3 mins = amt * base; si->minmax.mins = amt * base;
const Vector3 maxs = amt * amp + mins; si->minmax.maxs = amt * amp + si->minmax.mins;
si->minmax.mins += mins;
si->minmax.maxs += maxs;
} }
} }

View File

@ -1999,10 +1999,7 @@ int FilterWindingIntoTree_r( winding_t *w, mapDrawSurface_t *ds, node_t *node ){
si = ds->shaderInfo; si = ds->shaderInfo;
/* ydnar: is this the head node? */ /* ydnar: is this the head node? */
if ( node->parent == NULL && si != NULL && if ( node->parent == NULL && si != NULL && si->minmax.valid() ) {
( si->minmax.mins[ 0 ] != 0.0f || si->minmax.maxs[ 0 ] != 0.0f ||
si->minmax.mins[ 1 ] != 0.0f || si->minmax.maxs[ 1 ] != 0.0f ||
si->minmax.mins[ 2 ] != 0.0f || si->minmax.maxs[ 2 ] != 0.0f ) ) {
static bool warned = false; static bool warned = false;
if ( !warned ) { if ( !warned ) {
Sys_Warning( "this map uses the deformVertexes move hack\n" ); Sys_Warning( "this map uses the deformVertexes move hack\n" );

View File

@ -560,7 +560,7 @@ void BeginModel( void ){
} }
/* ydnar: lightgrid mins/maxs */ /* ydnar: lightgrid mins/maxs */
if ( lgMinmax.mins[ 0 ] < 99999 ) { if ( lgMinmax.valid() ) {
/* use lightgrid bounds */ /* use lightgrid bounds */
mod->minmax = lgMinmax; mod->minmax = lgMinmax;
} }
@ -572,7 +572,8 @@ void BeginModel( void ){
/* note size */ /* note size */
Sys_FPrintf( SYS_VRB, "BSP bounds: { %f %f %f } { %f %f %f }\n", minmax.mins[0], minmax.mins[1], minmax.mins[2], minmax.maxs[0], minmax.maxs[1], minmax.maxs[2] ); Sys_FPrintf( SYS_VRB, "BSP bounds: { %f %f %f } { %f %f %f }\n", minmax.mins[0], minmax.mins[1], minmax.mins[2], minmax.maxs[0], minmax.maxs[1], minmax.maxs[2] );
Sys_FPrintf( SYS_VRB, "Lightgrid bounds: { %f %f %f } { %f %f %f }\n", lgMinmax.mins[0], lgMinmax.mins[1], lgMinmax.mins[2], lgMinmax.maxs[0], lgMinmax.maxs[1], lgMinmax.maxs[2] ); if ( lgMinmax.valid() )
Sys_FPrintf( SYS_VRB, "Lightgrid bounds: { %f %f %f } { %f %f %f }\n", lgMinmax.mins[0], lgMinmax.mins[1], lgMinmax.mins[2], lgMinmax.maxs[0], lgMinmax.maxs[1], lgMinmax.maxs[2] );
/* set firsts */ /* set firsts */
mod->firstBSPSurface = numBSPDrawSurfaces; mod->firstBSPSurface = numBSPDrawSurfaces;