]> git.xonotic.org Git - xonotic/netradiant.git/commitdiff
Merge commit '9c4c8b725fdca551dc9379b77ebd9c498d0c6f28' into master-merge
authorThomas Debesse <dev@illwieckz.net>
Mon, 20 Jun 2022 02:25:08 +0000 (04:25 +0200)
committerThomas Debesse <dev@illwieckz.net>
Mon, 20 Jun 2022 02:25:08 +0000 (04:25 +0200)
Makefile
libs/mathlib.h
libs/mathlib/mathlib.c
radiant/brushmanip.cpp
tools/quake3/q3map2/bsp.c
tools/quake3/q3map2/light.c
tools/quake3/q3map2/light_bounce.c
tools/quake3/q3map2/light_trace.c
tools/quake3/q3map2/map.c
tools/quake3/q3map2/model.c
tools/quake3/q3map2/q3map2.h

index 4f1fc2e8a270332a039e76ce816e2956381dfd69..82653f830236eae69fa45afa5dd729b04bcc9cce 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -498,7 +498,7 @@ endif
 %.o: %.c $(if $(findstring $(DEPEND_ON_MAKEFILE),yes),$(wildcard Makefile*),) | dependencies-check
        $(CC) $< $(CFLAGS) $(CFLAGS_COMMON) $(CPPFLAGS_EXTRA) $(CPPFLAGS_COMMON) $(CPPFLAGS) $(TARGET_ARCH) -c -o $@
 
-
+$(INSTALLDIR)/q3map2.$(EXE): LDFLAGS_EXTRA := -Wl,--large-address-aware
 $(INSTALLDIR)/q3map2.$(EXE): LIBS_EXTRA := $(LIBS_XML) $(LIBS_GLIB) $(LIBS_PNG) $(LIBS_JPEG) $(LIBS_WEBP) $(LIBS_ZLIB)
 $(INSTALLDIR)/q3map2.$(EXE): CPPFLAGS_EXTRA := $(CPPFLAGS_XML) $(CPPFLAGS_GLIB) $(CPPFLAGS_PNG) $(CPPFLAGS_JPEG) $(CPPFLAGS_WEBP) -Itools/quake3/common -Ilibs -Iinclude
 $(INSTALLDIR)/q3map2.$(EXE): \
index 64f3f6e43d8db5e2019fc4410d859483fbd20f73..fb135b8ae0de4d4797f5cdf3eb7f838f6d3e1a86 100644 (file)
@@ -101,7 +101,13 @@ void _CrossProduct( vec3_t v1, vec3_t v2, vec3_t cross );
 // I need this define in order to test some of the regression tests from time to time.
 // This define affect the precision of VectorNormalize() function only.
 #define MATHLIB_VECTOR_NORMALIZE_PRECISION_FIX 1
-vec_t VectorNormalize( const vec3_t in, vec3_t out );
+vec_t VectorAccurateNormalize( const vec3_t in, vec3_t out );
+vec_t VectorFastNormalize( const vec3_t in, vec3_t out );
+#if MATHLIB_VECTOR_NORMALIZE_PRECISION_FIX
+#define VectorNormalize VectorAccurateNormalize
+#else
+#define VectorNormalize VectorFastNormalize
+#endif
 vec_t ColorNormalize( const vec3_t in, vec3_t out );
 void VectorInverse( vec3_t v );
 void VectorPolar( vec3_t v, float radius, float theta, float phi );
index da26a92072ec95c865506ec30ab3e5bfea404f70..9b530e2d487c557b8be48c84b7f4c1484a003c08 100644 (file)
@@ -153,9 +153,7 @@ void _VectorCopy( vec3_t in, vec3_t out ){
        out[2] = in[2];
 }
 
-vec_t VectorNormalize( const vec3_t in, vec3_t out ) {
-
-#if MATHLIB_VECTOR_NORMALIZE_PRECISION_FIX
+vec_t VectorAccurateNormalize( const vec3_t in, vec3_t out ) {
 
        // The sqrt() function takes double as an input and returns double as an
        // output according the the man pages on Debian and on FreeBSD.  Therefore,
@@ -179,26 +177,30 @@ vec_t VectorNormalize( const vec3_t in, vec3_t out ) {
        out[2] = (vec_t) ( z / length );
 
        return (vec_t) length;
+}
 
-#else
+vec_t VectorFastNormalize( const vec3_t in, vec3_t out ) {
 
-       vec_t length, ilength;
+       // SmileTheory: This is ioquake3's VectorNormalize2
+       //              for when accuracy matters less than speed
+       float length, ilength;
 
-       length = (vec_t)sqrt( in[0] * in[0] + in[1] * in[1] + in[2] * in[2] );
-       if ( length == 0 ) {
+       length = in[0] * in[0] + in[1] * in[1] + in[2] * in[2];
+
+       if ( length ) {
+               /* writing it this way allows gcc to recognize that rsqrt can be used */
+               ilength = 1 / (float)sqrt( length );
+               /* sqrt(length) = length * (1 / sqrt(length)) */
+               length *= ilength;
+               out[0] = in[0] * ilength;
+               out[1] = in[1] * ilength;
+               out[2] = in[2] * ilength;
+       }
+       else {
                VectorClear( out );
-               return 0;
        }
 
-       ilength = 1.0f / length;
-       out[0] = in[0] * ilength;
-       out[1] = in[1] * ilength;
-       out[2] = in[2] * ilength;
-
        return length;
-
-#endif
-
 }
 
 vec_t ColorNormalize( const vec3_t in, vec3_t out ) {
index 77baf50e40a55041a3654ead1ce92410fc56a3f2..d424bb2be84874bb3ae9b3a52aa20731457cfc68 100644 (file)
@@ -895,6 +895,9 @@ filter_brush_any_face g_filter_brush_liquids( &g_filter_face_liquids );
 filter_face_shader g_filter_face_hint( "textures/common/hint" );
 filter_brush_any_face g_filter_brush_hint( &g_filter_face_hint );
 
+filter_face_shader g_filter_face_hintlocal( "textures/common/hintlocal" );
+filter_brush_any_face g_filter_brush_hintlocal( &g_filter_face_hintlocal );
+
 filter_face_shader g_filter_face_hint_q2( "textures/hint" );
 filter_brush_any_face g_filter_brush_hint_q2( &g_filter_face_hint_q2 );
 
@@ -939,6 +942,7 @@ void BrushFilters_construct(){
        add_face_filter( g_filter_face_caulk_ja, EXCLUDE_CAULK );
        add_brush_filter( g_filter_brush_liquids, EXCLUDE_LIQUIDS );
        add_brush_filter( g_filter_brush_hint, EXCLUDE_HINTSSKIPS );
+       add_brush_filter( g_filter_brush_hintlocal, EXCLUDE_HINTSSKIPS );
        add_brush_filter( g_filter_brush_hint_q2, EXCLUDE_HINTSSKIPS );
        add_brush_filter( g_filter_brush_hint_ja, EXCLUDE_HINTSSKIPS );
        add_brush_filter( g_filter_brush_subtlehint, EXCLUDE_HINTSSKIPS );
index a5032b7bef670c07528f8a6a78ec301d27e4e41f..0f62ba14bf5e14124db5312ae6197c5a414ce171 100644 (file)
@@ -319,6 +319,10 @@ void ProcessWorldModel( const char *portalFilePath, const char *lineFilePath ){
        /* check for patches with adjacent edges that need to lod together */
        PatchMapDrawSurfs( e );
 
+       if ( debugClip ) {
+               AddTriangleModels( e );
+       }
+
        /* build an initial bsp tree using all of the sides of all of the structural brushes */
        faces = MakeStructuralBSPFaceList( entities[ 0 ].brushes );
        tree = FaceBSP( faces );
@@ -387,7 +391,9 @@ void ProcessWorldModel( const char *portalFilePath, const char *lineFilePath ){
        FloodAreas( tree );
 
        /* create drawsurfs for triangle models */
-       AddTriangleModels( e );
+       if ( !debugClip ) {
+               AddTriangleModels( e );
+       }
 
        /* create drawsurfs for surface models */
        AddEntitySurfaceModels( e );
@@ -981,6 +987,14 @@ int BSPMain( int argc, char **argv ){
                        Sys_Printf( "Debug portal surfaces enabled\n" );
                        debugPortals = qtrue;
                }
+               else if ( !strcmp( argv[ i ], "-debugclip" ) ) {
+                       Sys_Printf( "Debug model clip enabled\n" );
+                       debugClip = qtrue;
+               }
+               else if ( !strcmp( argv[ i ], "-snapmodelclip" ) ) {
+                       Sys_Printf( "Snapping model clip enabled\n" );
+                       snapModelClip = qtrue;
+               }
                else if ( !strcmp( argv[ i ], "-sRGBtex" ) ) {
                        texturesRGB = qtrue;
                        Sys_Printf( "Textures are in sRGB\n" );
index dd5554f81fd24db4d2eaeca9dbfbd93420594723..1d8cfb5e2a574afb189f205369ab33a32c90281f 100644 (file)
@@ -717,7 +717,7 @@ float PointToPolygonFormFactor( const vec3_t point, const vec3_t normal, const w
        for ( i = 0; i < w->numpoints; i++ )
        {
                VectorSubtract( w->p[ i ], point, dirs[ i ] );
-               VectorNormalize( dirs[ i ], dirs[ i ] );
+               VectorFastNormalize( dirs[ i ], dirs[ i ] );
        }
 
        /* duplicate first vertex to avoid mod operation */
@@ -743,7 +743,7 @@ float PointToPolygonFormFactor( const vec3_t point, const vec3_t normal, const w
                angle = acos( dot );
 
                CrossProduct( dirs[ i ], dirs[ j ], triVector );
-               if ( VectorNormalize( triVector, triNormal ) < 0.0001f ) {
+               if ( VectorFastNormalize( triVector, triNormal ) < 0.0001f ) {
                        continue;
                }
 
@@ -2301,6 +2301,19 @@ int LightMain( int argc, char **argv ){
                        Sys_Printf( "No lightmaps yo\n" );
                }
 
+               else if ( !strcmp( argv[ i ], "-bouncecolorratio" ) ) {
+                       f = atof( argv[ i + 1 ] );
+                       bounceColorRatio *= f;
+                       if ( bounceColorRatio > 1 ) {
+                               bounceColorRatio = 1;
+                       }
+                       if ( bounceColorRatio < 0 ) {
+                               bounceColorRatio = 0;
+                       }
+                       Sys_Printf( "Bounce color ratio set to %f\n", bounceColorRatio );
+                       i++;
+               }
+
                else if ( !strcmp( argv[ i ], "-bouncescale" ) ) {
                        f = atof( argv[ i + 1 ] );
                        bounceScale *= f;
@@ -2825,7 +2838,7 @@ int LightMain( int argc, char **argv ){
                        if ( ( atof( argv[ i + 1 ] ) != 0 ) && ( atof( argv[ i + 1 ] )) < 1 ) {
                                noVertexLighting = ( atof( argv[ i + 1 ] ) );
                                i++;
-                               Sys_Printf( "Setting vertex lighting globally to %d\n", noVertexLighting );
+                               Sys_Printf( "Setting vertex lighting globally to %f\n", noVertexLighting );
                        }
                        else{
                                Sys_Printf( "Disabling vertex lighting\n" );
index 3245ad5380a473f465ef94da5e42143b00afc9cb..18d1f0a4c236650d2de4e718fe58ca581efdde24 100644 (file)
@@ -263,7 +263,7 @@ qboolean RadSampleImage( byte *pixels, int width, int height, float st[ 2 ], flo
 #define SAMPLE_GRANULARITY  6
 
 static void RadSample( int lightmapNum, bspDrawSurface_t *ds, rawLightmap_t *lm, shaderInfo_t *si, radWinding_t *rw, vec3_t average, vec3_t gradient, int *style ){
-       int i, j, k, l, v, x, y, samples;
+       int i, j, k, l, v, x, y, samples, avgcolor;
        vec3_t color, mins, maxs;
        vec4_t textureColor;
        float alpha, alphaI, bf;
@@ -297,8 +297,10 @@ static void RadSample( int lightmapNum, bspDrawSurface_t *ds, rawLightmap_t *lm,
                                VectorCopy( si->averageColor, textureColor );
                                textureColor[ 4 ] = 255.0f;
                        }
+                       avgcolor = ( textureColor[ 0 ] + textureColor[ 1 ] + textureColor[ 2 ] ) / 3;
                        for ( i = 0; i < 3; i++ )
-                               color[ i ] = ( textureColor[ i ] / 255 ) * ( rw->verts[ samples ].color[ lightmapNum ][ i ] / 255.0f );
+                               color[ i ] = ( ( textureColor[ i ] * bounceColorRatio + ( avgcolor * ( 1 - bounceColorRatio ) ) ) / 255 ) * ( rw->verts[ samples ].color[ lightmapNum ][ i ] / 255.0f );
+//                             color[ i ] = ( textureColor[ i ] / 255 ) * ( rw->verts[ samples ].color[ lightmapNum ][ i ] / 255.0f );
 
                        AddPointToBounds( color, mins, maxs );
                        VectorAdd( average, color, average );
@@ -381,9 +383,11 @@ static void RadSample( int lightmapNum, bspDrawSurface_t *ds, rawLightmap_t *lm,
                                                        VectorCopy( si->averageColor, textureColor );
                                                        textureColor[ 4 ] = 255;
                                                }
-                                               for ( i = 0; i < 3; i++ )
-                                                       color[ i ] = ( textureColor[ i ] / 255 ) * ( radLuxel[ i ] / 255 );
-
+                                               avgcolor = ( textureColor[ 0 ] + textureColor[ 1 ] + textureColor[ 2 ] ) / 3;
+                                               for ( l = 0; l < 3; l++ ){
+                                                       color[ l ] = ( ( textureColor[ l ] * bounceColorRatio + ( avgcolor * ( 1 - bounceColorRatio ) ) ) / 255 ) * ( radLuxel[ l ] / 255 );
+                                               //Sys_Printf( "%i %i %i %i %i \n", (int) textureColor[ 0 ], (int) textureColor[ 1 ], (int) textureColor[ 2 ], (int) avgcolor, (int) color[ i ] );
+                                               }
                                                AddPointToBounds( color, mins, maxs );
                                                VectorAdd( average, color, average );
 
index f58bd4ac4a9db93a1a3183d507b4f56d74c35091..f9afbf7833f779b7c3bc4e6ac8da2ff064220a2a 100644 (file)
@@ -1614,103 +1614,132 @@ qboolean TraceWinding( traceWinding_t *tw, trace_t *trace ){
 /*
    TraceLine_r()
    returns qtrue if something is hit and tracing can stop
+
+   SmileTheory: made half-iterative
  */
 
-static qboolean TraceLine_r( int nodeNum, vec3_t origin, vec3_t end, trace_t *trace ){
+#define TRACELINE_R_HALF_ITERATIVE 1
+
+#if TRACELINE_R_HALF_ITERATIVE
+static qboolean TraceLine_r( int nodeNum, const vec3_t start, const vec3_t end, trace_t *trace )
+#else
+static qboolean TraceLine_r( int nodeNum, const vec3_t origin, const vec3_t end, trace_t *trace )
+#endif
+{
        traceNode_t     *node;
        int side;
        float front, back, frac;
-       vec3_t mid;
+       vec3_t origin, mid;
        qboolean r;
 
+#if TRACELINE_R_HALF_ITERATIVE
+       VectorCopy( start, origin );
 
-       /* bogus node number means solid, end tracing unless testing all */
-       if ( nodeNum < 0 ) {
-               VectorCopy( origin, trace->hit );
-               trace->passSolid = qtrue;
-               return qtrue;
-       }
+       while ( 1 )
+#endif
+       {
+               /* bogus node number means solid, end tracing unless testing all */
+               if ( nodeNum < 0 ) {
+                       VectorCopy( origin, trace->hit );
+                       trace->passSolid = qtrue;
+                       return qtrue;
+               }
 
-       /* get node */
-       node = &traceNodes[ nodeNum ];
+               /* get node */
+               node = &traceNodes[ nodeNum ];
 
-       /* solid? */
-       if ( node->type == TRACE_LEAF_SOLID ) {
-               VectorCopy( origin, trace->hit );
-               trace->passSolid = qtrue;
-               return qtrue;
-       }
+               /* solid? */
+               if ( node->type == TRACE_LEAF_SOLID ) {
+                       VectorCopy( origin, trace->hit );
+                       trace->passSolid = qtrue;
+                       return qtrue;
+               }
 
-       /* leafnode? */
-       if ( node->type < 0 ) {
-               /* note leaf and return */
-               if ( node->numItems > 0 && trace->numTestNodes < MAX_TRACE_TEST_NODES ) {
-                       trace->testNodes[ trace->numTestNodes++ ] = nodeNum;
+               /* leafnode? */
+               if ( node->type < 0 ) {
+                       /* note leaf and return */
+                       if ( node->numItems > 0 && trace->numTestNodes < MAX_TRACE_TEST_NODES ) {
+                               trace->testNodes[ trace->numTestNodes++ ] = nodeNum;
+                       }
+                       return qfalse;
                }
-               return qfalse;
-       }
 
-       /* ydnar 2003-09-07: don't test branches of the bsp with nothing in them when testall is enabled */
-       if ( trace->testAll && node->numItems == 0 ) {
-               return qfalse;
-       }
+               /* ydnar 2003-09-07: don't test branches of the bsp with nothing in them when testall is enabled */
+               if ( trace->testAll && node->numItems == 0 ) {
+                       return qfalse;
+               }
 
-       /* classify beginning and end points */
-       switch ( node->type )
-       {
-       case PLANE_X:
-               front = origin[ 0 ] - node->plane[ 3 ];
-               back = end[ 0 ] - node->plane[ 3 ];
-               break;
+               /* classify beginning and end points */
+               switch ( node->type )
+               {
+               case PLANE_X:
+                       front = origin[ 0 ] - node->plane[ 3 ];
+                       back = end[ 0 ] - node->plane[ 3 ];
+                       break;
 
-       case PLANE_Y:
-               front = origin[ 1 ] - node->plane[ 3 ];
-               back = end[ 1 ] - node->plane[ 3 ];
-               break;
+               case PLANE_Y:
+                       front = origin[ 1 ] - node->plane[ 3 ];
+                       back = end[ 1 ] - node->plane[ 3 ];
+                       break;
 
-       case PLANE_Z:
-               front = origin[ 2 ] - node->plane[ 3 ];
-               back = end[ 2 ] - node->plane[ 3 ];
-               break;
+               case PLANE_Z:
+                       front = origin[ 2 ] - node->plane[ 3 ];
+                       back = end[ 2 ] - node->plane[ 3 ];
+                       break;
 
-       default:
-               front = DotProduct( origin, node->plane ) - node->plane[ 3 ];
-               back = DotProduct( end, node->plane ) - node->plane[ 3 ];
-               break;
-       }
+               default:
+                       front = DotProduct( origin, node->plane ) - node->plane[ 3 ];
+                       back = DotProduct( end, node->plane ) - node->plane[ 3 ];
+                       break;
+               }
 
-       /* entirely in front side? */
-       if ( front >= -TRACE_ON_EPSILON && back >= -TRACE_ON_EPSILON ) {
-               return TraceLine_r( node->children[ 0 ], origin, end, trace );
-       }
+               /* entirely in front side? */
+               if ( front >= -TRACE_ON_EPSILON && back >= -TRACE_ON_EPSILON ) {
+#if TRACELINE_R_HALF_ITERATIVE
+                       nodeNum = node->children[ 0 ];
+                       continue;
+#else
+                       return TraceLine_r( node->children[ 0 ], origin, end, trace );
+#endif
+               }
 
-       /* entirely on back side? */
-       if ( front < TRACE_ON_EPSILON && back < TRACE_ON_EPSILON ) {
-               return TraceLine_r( node->children[ 1 ], origin, end, trace );
-       }
+               /* entirely on back side? */
+               if ( front < TRACE_ON_EPSILON && back < TRACE_ON_EPSILON ) {
+#if TRACELINE_R_HALF_ITERATIVE
+                       nodeNum = node->children[ 1 ];
+                       continue;
+#else
+                       return TraceLine_r( node->children[ 1 ], origin, end, trace );
+#endif
+               }
 
-       /* select side */
-       side = front < 0;
+               /* select side */
+               side = front < 0;
 
-       /* calculate intercept point */
-       frac = front / ( front - back );
-       mid[ 0 ] = origin[ 0 ] + ( end[ 0 ] - origin[ 0 ] ) * frac;
-       mid[ 1 ] = origin[ 1 ] + ( end[ 1 ] - origin[ 1 ] ) * frac;
-       mid[ 2 ] = origin[ 2 ] + ( end[ 2 ] - origin[ 2 ] ) * frac;
+               /* calculate intercept point */
+               frac = front / ( front - back );
+               mid[ 0 ] = origin[ 0 ] + ( end[ 0 ] - origin[ 0 ] ) * frac;
+               mid[ 1 ] = origin[ 1 ] + ( end[ 1 ] - origin[ 1 ] ) * frac;
+               mid[ 2 ] = origin[ 2 ] + ( end[ 2 ] - origin[ 2 ] ) * frac;
 
-       /* fixme: check inhibit radius, then solid nodes and ignore */
+               /* fixme: check inhibit radius, then solid nodes and ignore */
 
-       /* set trace hit here */
-       //%     VectorCopy( mid, trace->hit );
+               /* set trace hit here */
+               //%     VectorCopy( mid, trace->hit );
 
-       /* trace first side */
-       r = TraceLine_r( node->children[ side ], origin, mid, trace );
-       if ( r ) {
-               return r;
-       }
+               /* trace first side */
+               if ( TraceLine_r( node->children[ side ], origin, mid, trace ) ) {
+                       return qtrue;
+               }
 
-       /* trace other side */
-       return TraceLine_r( node->children[ !side ], mid, end, trace );
+               /* trace other side */
+#if TRACELINE_R_HALF_ITERATIVE
+               nodeNum = node->children[ !side ];
+               VectorCopy( mid, origin );
+#else
+               return TraceLine_r( node->children[ !side ], mid, end, trace );
+#endif
+       }
 }
 
 
@@ -1787,7 +1816,7 @@ void TraceLine( trace_t *trace ){
 
 float SetupTrace( trace_t *trace ){
        VectorSubtract( trace->end, trace->origin, trace->displacement );
-       trace->distance = VectorNormalize( trace->displacement, trace->direction );
+       trace->distance = VectorFastNormalize( trace->displacement, trace->direction );
        VectorCopy( trace->origin, trace->hit );
        return trace->distance;
 }
index 5336c9c5bc0ce96be089b78c0a25cc2a50c98b54..08d0a56899bf74c98c7319115220a353696b7c7f 100644 (file)
@@ -237,7 +237,7 @@ qboolean SnapNormal( vec3_t normal ){
    snaps a plane to normal/distance epsilons
  */
 
-void SnapPlane( vec3_t normal, vec_t *dist, vec3_t center ){
+void SnapPlane( vec3_t normal, vec_t *dist ){
 // SnapPlane disabled by LordHavoc because it often messes up collision
 // brushes made from triangles of embedded models, and it has little effect
 // on anything else (axial planes are usually derived from snapped points)
@@ -326,7 +326,12 @@ int FindFloatPlane( vec3_t innormal, vec_t dist, int numPoints, vec3_t *points )
 
        VectorCopy( innormal, normal );
 #if Q3MAP2_EXPERIMENTAL_SNAP_PLANE_FIX
-       SnapPlaneImproved( normal, &dist, numPoints, (const vec3_t *) points );
+       if ( !doingModelClip ) {
+               SnapPlaneImproved( normal, &dist, numPoints, (const vec3_t *) points );
+       }
+       if ( doingModelClip && snapModelClip ) {
+               SnapPlane( normal, &dist );
+       }
 #else
        SnapPlane( normal, &dist );
 #endif
index 1b88f3273b4b32c2758034a16ef008ac26d686cb..8f70094a89ba1f6bef39a15a63e4ed8357b2dc83 100644 (file)
@@ -650,8 +650,15 @@ void InsertModel( const char *name, int skin, int frame, m4x4_t transform, remap
                                                /* set up brush sides */
                                                buildBrush->numsides = 5;
                                                buildBrush->sides[ 0 ].shaderInfo = si;
-                                               for ( j = 1; j < buildBrush->numsides; j++ )
-                                                       buildBrush->sides[ j ].shaderInfo = NULL;  // don't emit these faces as draw surfaces, should make smaller BSPs; hope this works
+                                               for ( j = 1; j < buildBrush->numsides; j++ ) {
+                                                       if ( debugClip ) {
+                                                               buildBrush->sides[ 0 ].shaderInfo = ShaderInfoForShader( "debugclip2" );
+                                                               buildBrush->sides[ j ].shaderInfo = ShaderInfoForShader( "debugclip" );
+                                                       }
+                                                       else {
+                                                               buildBrush->sides[ j ].shaderInfo = NULL;  // don't emit these faces as draw surfaces, should make smaller BSPs; hope this works
+                                                       }
+                                               }
 
                                                buildBrush->sides[ 0 ].planenum = FindFloatPlane( plane, plane[ 3 ], 3, points );
                                                buildBrush->sides[ 1 ].planenum = FindFloatPlane( pa, pa[ 3 ], 2, &points[ 1 ] ); // pa contains points[1] and points[2]
@@ -712,6 +719,8 @@ void AddTriangleModels( entity_t *e ){
        /* note it */
        Sys_FPrintf( SYS_VRB, "--- AddTriangleModels ---\n" );
 
+       doingModelClip = qtrue;
+
        /* get current brush entity targetname */
        if ( e == entities ) {
                targetName = "";
@@ -959,4 +968,6 @@ void AddTriangleModels( entity_t *e ){
                        remap = remap2;
                }
        }
+
+       doingModelClip = qfalse;
 }
index 267a0e6601651f7e07b9174924acdf0d4f9932f3..509cb9270ec810ab8a91cda1ce01e665a180d806 100644 (file)
@@ -2058,7 +2058,8 @@ Q_EXTERN float jitters[ MAX_JITTERS ];
 
 /*can't code*/
 Q_EXTERN qboolean doingBSP Q_ASSIGN( qfalse );
-
+Q_EXTERN qboolean doingModelClip Q_ASSIGN( qfalse );
+Q_EXTERN qboolean snapModelClip Q_ASSIGN( qfalse );
 
 /* commandline arguments */
 Q_EXTERN qboolean nocmdline Q_ASSIGN( qfalse );
@@ -2099,6 +2100,7 @@ Q_EXTERN qboolean emitFlares Q_ASSIGN( qfalse );
 Q_EXTERN qboolean debugSurfaces Q_ASSIGN( qfalse );
 Q_EXTERN qboolean debugInset Q_ASSIGN( qfalse );
 Q_EXTERN qboolean debugPortals Q_ASSIGN( qfalse );
+Q_EXTERN qboolean debugClip Q_ASSIGN( qfalse );                        /* debug model autoclipping */
 Q_EXTERN qboolean lightmapTriangleCheck Q_ASSIGN( qfalse );
 Q_EXTERN qboolean lightmapExtraVisClusterNudge Q_ASSIGN( qfalse );
 Q_EXTERN qboolean lightmapFill Q_ASSIGN( qfalse );
@@ -2358,6 +2360,7 @@ Q_EXTERN float spotScale Q_ASSIGN( 7500.0f );
 Q_EXTERN float areaScale Q_ASSIGN( 0.25f );
 Q_EXTERN float skyScale Q_ASSIGN( 1.0f );
 Q_EXTERN float bounceScale Q_ASSIGN( 0.25f );
+Q_EXTERN float bounceColorRatio Q_ASSIGN( 1.0f );
 Q_EXTERN float vertexglobalscale Q_ASSIGN( 1.0f );
 
 /* jal: alternative angle attenuation curve */