random tweaks
This commit is contained in:
parent
b68cbfd78b
commit
902fb46938
|
|
@ -23,6 +23,7 @@
|
|||
#define INCLUDED_DRAGPLANES_H
|
||||
|
||||
#include "selectable.h"
|
||||
#include "cullable.h"
|
||||
#include "selectionlib.h"
|
||||
#include "math/aabb.h"
|
||||
#include "math/line.h"
|
||||
|
|
@ -46,41 +47,7 @@ inline Vector3 translation_from_local( const Vector3& translation, const Matrix4
|
|||
)
|
||||
);
|
||||
}
|
||||
#if 0
|
||||
namespace{
|
||||
// https://www.gamedev.net/forums/topic/230443-initializing-array-member-objects-in-c/?page=2
|
||||
class ObservedSelectables6x {
|
||||
ObservedSelectable m_selectable0, m_selectable1, m_selectable2, m_selectable3, m_selectable4, m_selectable5;
|
||||
|
||||
// array of 6 pointers to ObservedSelectable members of ObservedSelectables6x
|
||||
static ObservedSelectable ObservedSelectables6x::* const array[6];
|
||||
|
||||
public:
|
||||
ObservedSelectables6x( const SelectionChangeCallback& onchanged ) :
|
||||
m_selectable0( onchanged ),
|
||||
m_selectable1( onchanged ),
|
||||
m_selectable2( onchanged ),
|
||||
m_selectable3( onchanged ),
|
||||
m_selectable4( onchanged ),
|
||||
m_selectable5( onchanged ) {
|
||||
}
|
||||
ObservedSelectable& operator[]( std::size_t idx ) {
|
||||
return this->*array[idx];
|
||||
}
|
||||
const ObservedSelectable& operator[]( std::size_t idx ) const {
|
||||
return this->*array[idx];
|
||||
}
|
||||
};
|
||||
|
||||
// Parse this
|
||||
ObservedSelectable ObservedSelectables6x::* const ObservedSelectables6x::array[6] = { &ObservedSelectables6x::m_selectable0,
|
||||
&ObservedSelectables6x::m_selectable1,
|
||||
&ObservedSelectables6x::m_selectable2,
|
||||
&ObservedSelectables6x::m_selectable3,
|
||||
&ObservedSelectables6x::m_selectable4,
|
||||
&ObservedSelectables6x::m_selectable5 };
|
||||
} //namespace
|
||||
#endif
|
||||
|
||||
class DragPlanes
|
||||
{
|
||||
|
|
@ -387,10 +354,7 @@ Matrix4 evaluateTransform( const Vector3& translation ) const {
|
|||
class ScaleRadius {
|
||||
ObservedSelectable m_selectable;
|
||||
public:
|
||||
static Matrix4& m_model() {
|
||||
static Matrix4 model;
|
||||
return model;
|
||||
}
|
||||
static inline Matrix4 m_model;
|
||||
|
||||
ScaleRadius( const SelectionChangeCallback& onchanged ) :
|
||||
m_selectable( onchanged ) {
|
||||
|
|
@ -402,7 +366,7 @@ public:
|
|||
m_selectable.setSelected( selected );
|
||||
}
|
||||
void selectPlanes( Selector& selector, SelectionTest& test, const PlaneCallback& selectedPlaneCallback ) {
|
||||
m_model() = test.getVolume().GetModelview();
|
||||
m_model = test.getVolume().GetModelview();
|
||||
Selector_add( selector, m_selectable );
|
||||
selectedPlaneCallback( Plane3( 2, 0, 0, 0 ) );
|
||||
}
|
||||
|
|
@ -410,7 +374,7 @@ public:
|
|||
const float len = vector3_length( translation );
|
||||
if( len == 0 )
|
||||
return 0;
|
||||
Vector3 tra = matrix4_transformed_direction( m_model(), translation );
|
||||
Vector3 tra = matrix4_transformed_direction( m_model, translation );
|
||||
vector3_normalise( tra );
|
||||
return tra[0] * len;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1319,11 +1319,10 @@ public:
|
|||
|
||||
|
||||
|
||||
namespace {
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// check FBO completeness
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
bool checkFramebufferStatus() {
|
||||
inline bool checkFramebufferStatus() {
|
||||
// check FBO status
|
||||
GLenum status = glCheckFramebufferStatus( GL_FRAMEBUFFER );
|
||||
switch( status ) {
|
||||
|
|
@ -1365,7 +1364,6 @@ bool checkFramebufferStatus() {
|
|||
}
|
||||
}
|
||||
|
||||
} //namespace
|
||||
|
||||
class FBO
|
||||
{
|
||||
|
|
|
|||
|
|
@ -269,11 +269,8 @@ winding_t *BaseWindingForPlane( vec3_t normal, vec_t dist ){
|
|||
==================
|
||||
*/
|
||||
winding_t *CopyWinding( winding_t *w ){
|
||||
int size;
|
||||
winding_t *c;
|
||||
|
||||
c = AllocWinding( w->numpoints );
|
||||
size = (int)( (winding_t *)0 )->p[w->numpoints];
|
||||
winding_t *c = AllocWinding( w->numpoints );
|
||||
const size_t size = (size_t)( (winding_t *)0 )->p[w->numpoints];
|
||||
memcpy( c, w, size );
|
||||
return c;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -318,12 +318,9 @@ node_t *AllocNode( void ){
|
|||
================
|
||||
*/
|
||||
bspbrush_t *AllocBrush( int numsides ){
|
||||
bspbrush_t *bb;
|
||||
int c;
|
||||
|
||||
c = (int)&( ( (bspbrush_t *)0 )->sides[numsides] );
|
||||
bb = malloc( c );
|
||||
memset( bb, 0, c );
|
||||
const size_t size = (size_t)&( ( (bspbrush_t *)0 )->sides[numsides] );
|
||||
bspbrush_t *bb = malloc( size );
|
||||
memset( bb, 0, size );
|
||||
if ( numthreads == 1 ) {
|
||||
c_active_brushes++;
|
||||
}
|
||||
|
|
@ -373,16 +370,12 @@ void FreeBrushList( bspbrush_t *brushes ){
|
|||
==================
|
||||
*/
|
||||
bspbrush_t *CopyBrush( bspbrush_t *brush ){
|
||||
bspbrush_t *newbrush;
|
||||
int size;
|
||||
int i;
|
||||
const size_t size = (size_t)&( ( (bspbrush_t *)0 )->sides[brush->numsides] );
|
||||
|
||||
size = (int)&( ( (bspbrush_t *)0 )->sides[brush->numsides] );
|
||||
|
||||
newbrush = AllocBrush( brush->numsides );
|
||||
bspbrush_t *newbrush = AllocBrush( brush->numsides );
|
||||
memcpy( newbrush, brush, size );
|
||||
|
||||
for ( i = 0 ; i < brush->numsides ; i++ )
|
||||
for ( int i = 0 ; i < brush->numsides ; i++ )
|
||||
{
|
||||
if ( brush->sides[i].winding ) {
|
||||
newbrush->sides[i].winding = CopyWinding( brush->sides[i].winding );
|
||||
|
|
|
|||
|
|
@ -75,15 +75,12 @@ void PlaneFromWinding( winding_t *w, plane_t *plane ){
|
|||
==================
|
||||
*/
|
||||
winding_t *NewWinding( int points ){
|
||||
winding_t *w;
|
||||
int size;
|
||||
|
||||
if ( points > MAX_POINTS_ON_WINDING ) {
|
||||
Error( "NewWinding: %i points", points );
|
||||
}
|
||||
|
||||
size = (int)( (winding_t *)0 )->points[points];
|
||||
w = malloc( size );
|
||||
const size_t size = (size_t)( (winding_t *)0 )->points[points];
|
||||
winding_t *w = malloc( size );
|
||||
memset( w, 0, size );
|
||||
|
||||
return w;
|
||||
|
|
|
|||
|
|
@ -87,7 +87,7 @@ void MakeTnode( int nodenum ){
|
|||
void MakeTnodes( dmodel_t *bm ){
|
||||
// 32 byte align the structs
|
||||
tnodes = malloc( ( numnodes + 1 ) * sizeof( tnode_t ) );
|
||||
tnodes = (tnode_t *)( ( (int)tnodes + 31 ) & ~31 );
|
||||
tnodes = (tnode_t *)( ( (size_t)tnodes + 31 ) & ~31 );
|
||||
tnode_p = tnodes;
|
||||
|
||||
MakeTnode( 0 );
|
||||
|
|
|
|||
|
|
@ -650,7 +650,7 @@ void Cmd_Mip( void ){
|
|||
//
|
||||
// dword align the size
|
||||
//
|
||||
while ( (int)lump_p & 3 )
|
||||
while ( (size_t)lump_p & 3 )
|
||||
*lump_p++ = 0;
|
||||
|
||||
//
|
||||
|
|
|
|||
|
|
@ -86,48 +86,48 @@ static struct
|
|||
tokenType_t token;
|
||||
} Keywords[] =
|
||||
{
|
||||
"model", TK_MODEL,
|
||||
"mesh", TK_MESH,
|
||||
"vertices", TK_VERTICES,
|
||||
"edges", TK_EDGES,
|
||||
"position", TK_POSITION,
|
||||
"polygons", TK_POLYGONS,
|
||||
"nodes", TK_NODES,
|
||||
"rotation", TK_ROTATION,
|
||||
"scaling", TK_SCALING,
|
||||
"translation", TK_TRANSLATION,
|
||||
"vertex", TK_VERTEX,
|
||||
"HRCH", TK_HRCH,
|
||||
"Softimage", TK_SOFTIMAGE,
|
||||
"material", TK_MATERIAL,
|
||||
"spline", TK_SPLINE,
|
||||
{ "model", TK_MODEL },
|
||||
{ "mesh", TK_MESH },
|
||||
{ "vertices", TK_VERTICES },
|
||||
{ "edges", TK_EDGES },
|
||||
{ "position", TK_POSITION },
|
||||
{ "polygons", TK_POLYGONS },
|
||||
{ "nodes", TK_NODES },
|
||||
{ "rotation", TK_ROTATION },
|
||||
{ "scaling", TK_SCALING },
|
||||
{ "translation", TK_TRANSLATION },
|
||||
{ "vertex", TK_VERTEX },
|
||||
{ "HRCH", TK_HRCH },
|
||||
{ "Softimage", TK_SOFTIMAGE },
|
||||
{ "material", TK_MATERIAL },
|
||||
{ "spline", TK_SPLINE },
|
||||
|
||||
"Named", TK_C_NAMED,
|
||||
"object", TK_OBJECT,
|
||||
"Tri", TK_C_TRI,
|
||||
"Vertices", TK_C_VERTICES,
|
||||
"Faces", TK_C_FACES,
|
||||
"Vertex", TK_C_VERTEX,
|
||||
"list", TK_LIST,
|
||||
"Face", TK_C_FACE,
|
||||
{ "Named", TK_C_NAMED },
|
||||
{ "object", TK_OBJECT },
|
||||
{ "Tri", TK_C_TRI },
|
||||
{ "Vertices", TK_C_VERTICES },
|
||||
{ "Faces", TK_C_FACES },
|
||||
{ "Vertex", TK_C_VERTEX },
|
||||
{ "list", TK_LIST },
|
||||
{ "Face", TK_C_FACE },
|
||||
|
||||
"Hexen", TK_C_HEXEN,
|
||||
"Triangles", TK_C_TRIANGLES,
|
||||
"Version", TK_C_VERSION,
|
||||
"faces", TK_FACES,
|
||||
"face", TK_FACE,
|
||||
"origin", TK_ORIGIN,
|
||||
{ "Hexen", TK_C_HEXEN },
|
||||
{ "Triangles", TK_C_TRIANGLES },
|
||||
{ "Version", TK_C_VERSION },
|
||||
{ "faces", TK_FACES },
|
||||
{ "face", TK_FACE },
|
||||
{ "origin", TK_ORIGIN },
|
||||
|
||||
"DK_clusters", TK_CLUSTERS,
|
||||
"DK_cluster_ncvs", TK_NUM_CLUSTER_VERTICES,
|
||||
"name", TK_NAME,
|
||||
"DK_cluster_name", TK_CLUSTER_NAME,
|
||||
"DK_cluster_state", TK_CLUSTER_STATE,
|
||||
{ "DK_clusters", TK_CLUSTERS },
|
||||
{ "DK_cluster_ncvs", TK_NUM_CLUSTER_VERTICES },
|
||||
{ "name", TK_NAME },
|
||||
{ "DK_cluster_name", TK_CLUSTER_NAME },
|
||||
{ "DK_cluster_state", TK_CLUSTER_STATE },
|
||||
|
||||
"actor_data", TK_ACTOR_DATA,
|
||||
"uvTexture", TK_UVTEXTURE,
|
||||
{ "actor_data", TK_ACTOR_DATA },
|
||||
{ "uvTexture", TK_UVTEXTURE },
|
||||
|
||||
NULL, -1
|
||||
{ NULL, -1 }
|
||||
};
|
||||
|
||||
static char *TokenNames[] =
|
||||
|
|
|
|||
|
|
@ -227,7 +227,7 @@ static void WriteModelFile( FILE *modelouthandle ){
|
|||
byte buffer[MAX_FM_VERTS * 4 + 128];
|
||||
float v;
|
||||
IntListNode_t *current, *toFree;
|
||||
qboolean framesWritten = false;
|
||||
int framesWritten = 0;
|
||||
size_t temp,size = 0;
|
||||
|
||||
// probably should do this dynamically one of these days
|
||||
|
|
@ -465,7 +465,7 @@ static void WriteModelFile( FILE *modelouthandle ){
|
|||
}
|
||||
|
||||
if ( !num_groups ) { // joints are stored with regular verts for compressed models
|
||||
framesWritten = true;
|
||||
framesWritten = 1;
|
||||
|
||||
temp = sizeof( int ); // change this to a byte
|
||||
memcpy( data + size, &framesWritten, temp );
|
||||
|
|
|
|||
|
|
@ -1555,7 +1555,6 @@ void GrabJointedFrame( char *frame ){
|
|||
void GrabGlobals( char *frame ){
|
||||
char file1[1024];
|
||||
char *framefile;
|
||||
frame_t *fr;
|
||||
|
||||
framefile = FindFrameFile( frame );
|
||||
|
||||
|
|
@ -1566,7 +1565,7 @@ void GrabGlobals( char *frame ){
|
|||
|
||||
printf( "grabbing %s\n", file1 );
|
||||
|
||||
fr = &g_frames[model.num_frames - 1]; // last frame read in
|
||||
//frame_t *fr = &g_frames[model.num_frames - 1]; // last frame read in
|
||||
|
||||
LoadGlobals( file1 );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -856,7 +856,6 @@ void GrabSkeletalFrame( char *frame ){
|
|||
void GrabModelTransform( char *frame ){
|
||||
char file1[1024];
|
||||
char *framefile;
|
||||
fmframe_t *fr;
|
||||
|
||||
framefile = FindFrameFile( frame );
|
||||
|
||||
|
|
@ -867,7 +866,7 @@ void GrabModelTransform( char *frame ){
|
|||
|
||||
// printf ("grabbing %s\n", file1);
|
||||
|
||||
fr = &g_frames[fmheader.num_frames - 1]; // last frame read in
|
||||
//fmframe_t *fr = &g_frames[fmheader.num_frames - 1]; // last frame read in
|
||||
|
||||
LoadModelTransform( file1 );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -63,6 +63,12 @@ struct MinMax___
|
|||
return point.x() >= mins.x() && point.y() >= mins.y() && point.z() >= mins.z()
|
||||
&& point.x() <= maxs.x() && point.y() <= maxs.y() && point.z() <= maxs.z();
|
||||
}
|
||||
// true, if point is within the bounds expanded by epsilon
|
||||
template<typename U, typename E>
|
||||
bool test( const BasicVector3<U>& point, const E epsilon ) const {
|
||||
return point.x() >= mins.x() - epsilon && point.y() >= mins.y() - epsilon && point.z() >= mins.z() - epsilon
|
||||
&& point.x() <= maxs.x() + epsilon && point.y() <= maxs.y() + epsilon && point.z() <= maxs.z() + epsilon;
|
||||
}
|
||||
// true, if there is an intersection
|
||||
template<typename U>
|
||||
bool test( const MinMax___<U>& other ) const {
|
||||
|
|
@ -166,6 +172,7 @@ template<typename P, typename V>
|
|||
bool PlaneFromPoints( Plane3___<P>& plane, const BasicVector3<V>& p0, const BasicVector3<V>& p1, const BasicVector3<V>& p2 ) {
|
||||
plane.normal() = vector3_cross( p2 - p0, p1 - p0 );
|
||||
if ( VectorNormalize( plane.normal() ) == 0 ) {
|
||||
plane.dist() = 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -247,8 +247,7 @@ int pk3BSPMain( int argc, char **argv ){
|
|||
/* extract map name */
|
||||
const CopiedString nameOFmap( PathFilename( source ) );
|
||||
|
||||
bool drawsurfSHs[numBSPShaders];
|
||||
memset( drawsurfSHs, 0, sizeof( drawsurfSHs ) );
|
||||
bool drawsurfSHs[numBSPShaders] = { 0 };
|
||||
|
||||
for ( i = 0; i < numBSPDrawSurfaces; ++i ){
|
||||
drawsurfSHs[ bspDrawSurfaces[i].shaderNum ] = true;
|
||||
|
|
@ -920,8 +919,7 @@ int repackBSPMain( int argc, char **argv ){
|
|||
/* extract map name */
|
||||
const CopiedString nameOFmap( PathFilename( source ) );
|
||||
|
||||
bool drawsurfSHs[numBSPShaders];
|
||||
memset( drawsurfSHs, 0, sizeof( drawsurfSHs ) );
|
||||
bool drawsurfSHs[numBSPShaders] = { 0 };
|
||||
|
||||
for ( i = 0; i < numBSPDrawSurfaces; ++i ){
|
||||
drawsurfSHs[ bspDrawSurfaces[i].shaderNum ] = true;
|
||||
|
|
|
|||
|
|
@ -210,8 +210,8 @@ int AnalyzeBSP( int argc, char **argv ){
|
|||
lump = (byte*) header + offset;
|
||||
lumpInt = LittleLong( (int) *( (int*) lump ) );
|
||||
lumpFloat = LittleFloat( (float) *( (float*) lump ) );
|
||||
memcpy( lumpString, (char*) lump, ( (size_t)length < sizeof( lumpString ) ? (size_t)length : sizeof( lumpString ) - 1 ) );
|
||||
lumpString[ sizeof( lumpString ) - 1 ] = '\0';
|
||||
memcpy( lumpString, (char*) lump, std::min( (size_t)length, std::size( lumpString ) - 1 ) );
|
||||
lumpString[ std::size( lumpString ) - 1 ] = '\0';
|
||||
|
||||
/* print basic lump info */
|
||||
Sys_Printf( "Lump: %d\n", i );
|
||||
|
|
|
|||
|
|
@ -736,7 +736,7 @@ static void ProjectDecalOntoTriangles( decalProjector_t *dp, mapDrawSurface_t *d
|
|||
*/
|
||||
|
||||
void MakeEntityDecals( entity_t *e ){
|
||||
int i, j, k, f, fOld, start;
|
||||
int i, j, f, fOld, start;
|
||||
decalProjector_t dp;
|
||||
mapDrawSurface_t *ds;
|
||||
Vector3 identityAxis[ 3 ] = { g_vector3_axis_x, g_vector3_axis_y, g_vector3_axis_z };
|
||||
|
|
@ -780,12 +780,7 @@ void MakeEntityDecals( entity_t *e ){
|
|||
}
|
||||
|
||||
/* bounds check */
|
||||
for ( k = 0; k < 3; k++ )
|
||||
if ( ds->minmax.mins[ k ] >= ( dp.center[ k ] + dp.radius ) ||
|
||||
ds->minmax.maxs[ k ] <= ( dp.center[ k ] - dp.radius ) ) {
|
||||
break;
|
||||
}
|
||||
if ( k < 3 ) {
|
||||
if ( !ds->minmax.test( dp.center, dp.radius ) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -632,8 +632,8 @@ int FogForBounds( const MinMax& minmax, float epsilon ){
|
|||
brush_t *brush = mapFogs[ i ].brush;
|
||||
|
||||
/* get bounds */
|
||||
const MinMax fogMinmax( brush->minmax.mins - Vector3( epsilon, epsilon, epsilon ),
|
||||
brush->minmax.maxs + Vector3( epsilon, epsilon, epsilon ) );
|
||||
const MinMax fogMinmax( brush->minmax.mins - Vector3().set( epsilon ),
|
||||
brush->minmax.maxs + Vector3().set( epsilon ) );
|
||||
/* check against bounds */
|
||||
if( !minmax.test( fogMinmax ) ){
|
||||
continue; /* no overlap */
|
||||
|
|
|
|||
|
|
@ -1239,11 +1239,7 @@ void MapRawLightmap( int rawLightmapNum ){
|
|||
{
|
||||
info = &surfaceInfos[ lightSurfaces[ lm->firstLightSurface + n ] ];
|
||||
minmax.extend( info->minmax );
|
||||
MinMax minmax2 = info->minmax;
|
||||
const float TOL = info->sampleSize + 2;
|
||||
minmax2.mins -= Vector3( TOL, TOL, TOL );
|
||||
minmax2.maxs += Vector3( TOL, TOL, TOL );
|
||||
if( minmax2.test( origin ) ){
|
||||
if( info->minmax.test( origin, info->sampleSize + 2 ) ){
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1279,7 +1279,7 @@ void StitchSurfaceLightmaps( void ){
|
|||
sampleSize = 0.5f * std::min( a->actualSampleSize, b->actualSampleSize );
|
||||
|
||||
/* test bounding box */
|
||||
if ( !MinMax( b->minmax.mins - Vector3().set( sampleSize ), b->minmax.maxs + Vector3().set( sampleSize ) ).test( origin ) ) {
|
||||
if ( !b->minmax.test( origin, sampleSize ) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
@ -2386,7 +2386,6 @@ void StoreSurfaceLightmaps( bool fastAllocate ){
|
|||
int style, lightmapNum, lightmapNum2;
|
||||
float samples, occludedSamples;
|
||||
Vector3 sample, occludedSample, dirSample;
|
||||
MinMax colorMinmax;
|
||||
byte *lb;
|
||||
int numUsed, numTwins, numTwinLuxels, numStored;
|
||||
float lmx, lmy, efficiency;
|
||||
|
|
@ -2576,7 +2575,7 @@ void StoreSurfaceLightmaps( bool fastAllocate ){
|
|||
|
||||
/* setup */
|
||||
lm->used = 0;
|
||||
colorMinmax.clear();
|
||||
MinMax colorMinmax;
|
||||
|
||||
/* clean up and store into bsp luxels */
|
||||
for ( y = 0; y < lm->h; y++ )
|
||||
|
|
|
|||
|
|
@ -385,7 +385,6 @@ void PatchMapDrawSurfs( entity_t *e ){
|
|||
mapDrawSurface_t *ds;
|
||||
int patchCount, groupCount;
|
||||
bspDrawVert_t *v1, *v2;
|
||||
MinMax bounds;
|
||||
byte *bordering;
|
||||
|
||||
parseMesh_t *meshes[ MAX_MAP_DRAW_SURFS ];
|
||||
|
|
@ -461,8 +460,7 @@ void PatchMapDrawSurfs( entity_t *e ){
|
|||
GrowGroup_r( scan, i, patchCount, meshes, bordering, group );
|
||||
|
||||
/* bound them */
|
||||
|
||||
bounds.clear();
|
||||
MinMax bounds;
|
||||
for ( j = 0; j < patchCount; j++ )
|
||||
{
|
||||
if ( group[ j ] ) {
|
||||
|
|
|
|||
|
|
@ -175,7 +175,6 @@ void PrintPortal( portal_t *p ){
|
|||
*/
|
||||
#define SIDESPACE 8
|
||||
void MakeHeadnodePortals( tree_t *tree ){
|
||||
Vector3 bounds[2];
|
||||
int i, j, n;
|
||||
portal_t *p, *portals[6];
|
||||
plane_t bplanes[6];
|
||||
|
|
@ -184,14 +183,11 @@ void MakeHeadnodePortals( tree_t *tree ){
|
|||
node = tree->headnode;
|
||||
|
||||
// pad with some space so there will never be null volume leafs
|
||||
for ( i = 0 ; i < 3 ; i++ )
|
||||
{
|
||||
bounds[0][i] = tree->minmax.mins[i] - SIDESPACE;
|
||||
bounds[1][i] = tree->minmax.maxs[i] + SIDESPACE;
|
||||
if ( bounds[0][i] >= bounds[1][i] ) {
|
||||
const MinMax bounds( tree->minmax.mins - Vector3().set( SIDESPACE ),
|
||||
tree->minmax.maxs + Vector3().set( SIDESPACE ) );
|
||||
if ( !bounds.valid() ) {
|
||||
Error( "Backwards tree volume" );
|
||||
}
|
||||
}
|
||||
|
||||
tree->outside_node.planenum = PLANENUM_LEAF;
|
||||
tree->outside_node.brushlist = NULL;
|
||||
|
|
@ -210,12 +206,12 @@ void MakeHeadnodePortals( tree_t *tree ){
|
|||
memset( pl, 0, sizeof( *pl ) );
|
||||
if ( j ) {
|
||||
pl->normal()[i] = -1;
|
||||
pl->dist() = -bounds[j][i];
|
||||
pl->dist() = -bounds.maxs[i];
|
||||
}
|
||||
else
|
||||
{
|
||||
pl->normal()[i] = 1;
|
||||
pl->dist() = bounds[j][i];
|
||||
pl->dist() = bounds.mins[i];
|
||||
}
|
||||
p->plane = *pl;
|
||||
p->winding = BaseWindingForPlane( pl->plane );
|
||||
|
|
|
|||
|
|
@ -1330,7 +1330,7 @@ void SubdivideFaceSurfaces( entity_t *e, tree_t *tree ){
|
|||
range = std::max( ds->texRange[ 0 ], ds->texRange[ 1 ] );
|
||||
size = ds->minmax.maxs[ 0 ] - ds->minmax.mins[ 0 ];
|
||||
for ( j = 1; j < 3; j++ )
|
||||
size = std::max( size, ds->minmax.maxs[ j ] - ds->minmax.mins[ 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++ )
|
||||
|
|
|
|||
|
|
@ -1374,11 +1374,9 @@ static int AddMetaTriangleToSurface( mapDrawSurface_t *ds, metaTriangle_t *tri,
|
|||
|
||||
|
||||
if ( metaMaxBBoxDistance >= 0 && ds->numIndexes > 0 ) {
|
||||
const MinMax minmax( ds->minmax.mins - Vector3().set( metaMaxBBoxDistance ),
|
||||
ds->minmax.maxs + Vector3().set( metaMaxBBoxDistance ) );
|
||||
if( !minmax.test( metaVerts[ tri->indexes[ 0 ] ].xyz )
|
||||
&& !minmax.test( metaVerts[ tri->indexes[ 1 ] ].xyz )
|
||||
&& !minmax.test( metaVerts[ tri->indexes[ 2 ] ].xyz ) )
|
||||
if( !ds->minmax.test( metaVerts[ tri->indexes[ 0 ] ].xyz, metaMaxBBoxDistance )
|
||||
&& !ds->minmax.test( metaVerts[ tri->indexes[ 1 ] ].xyz, metaMaxBBoxDistance )
|
||||
&& !ds->minmax.test( metaVerts[ tri->indexes[ 2 ] ].xyz, metaMaxBBoxDistance ) )
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user