]> de.git.xonotic.org Git - xonotic/netradiant.git/commitdiff
Merge commit 'ddee6cbe7c5fcbba52e7881a411f310809b867f9' into master-merge
authorThomas Debesse <dev@illwieckz.net>
Tue, 21 Jun 2022 04:10:48 +0000 (06:10 +0200)
committerThomas Debesse <dev@illwieckz.net>
Tue, 21 Jun 2022 04:10:48 +0000 (06:10 +0200)
tools/quake3/q3map2/bspfile_abstract.c
tools/quake3/q3map2/light_bounce.c
tools/quake3/q3map2/main.c
tools/quake3/q3map2/path_init.c
tools/quake3/q3map2/q3map2.h

index f49d93ee804314bdb456f237570185012f177dd5..0530fc1f4b1cf0afe92f64c7ed400825d8f982e9 100644 (file)
@@ -446,7 +446,12 @@ void PrintBSPFileSizes( void ){
        if ( numEntities <= 0 ) {
                ParseEntities();
        }
-
+       int patchCount = 0;
+       bspDrawSurface_t *s;
+       for ( s = bspDrawSurfaces; s != bspDrawSurfaces + numBSPDrawSurfaces; ++s ){
+               if ( s->surfaceType == MST_PATCH )
+                       ++patchCount;
+       }
        /* note that this is abstracted */
        Sys_Printf( "Abstracted BSP file components (*actual sizes may differ)\n" );
 
@@ -479,6 +484,8 @@ void PrintBSPFileSizes( void ){
 
        Sys_Printf( "%9d drawsurfaces  %9d *\n",
                                numBSPDrawSurfaces, (int) ( numBSPDrawSurfaces * sizeof( *bspDrawSurfaces ) ) );
+       Sys_Printf( "%9d patchsurfaces       \n",
+                               patchCount );
        Sys_Printf( "%9d drawverts     %9d *\n",
                                numBSPDrawVerts, (int) ( numBSPDrawVerts * sizeof( *bspDrawVerts ) ) );
        Sys_Printf( "%9d drawindexes   %9d\n",
index e738429008fbb6362e93ddf9e194419b14fd3e91..8cd6deadd281a8a395b0a158b7959d2ee3995aef 100644 (file)
@@ -435,13 +435,15 @@ static void RadSample( int lightmapNum, bspDrawSurface_t *ds, rawLightmap_t *lm,
 #define RADIOSITY_MIN               0.0001f
 #define RADIOSITY_CLIP_EPSILON      0.125f
 
+
+
 static void RadSubdivideDiffuseLight( int lightmapNum, bspDrawSurface_t *ds, rawLightmap_t *lm, shaderInfo_t *si,
-                                                                         float scale, float subdivide, qboolean original, radWinding_t *rw, clipWork_t *cw ){
+                                                                         float scale, float subdivide, radWinding_t *rw, clipWork_t *cw ){
        int i, style = 0;
        float dist, area, value;
        vec3_t mins, maxs, normal, d1, d2, cross, color, gradient;
        light_t         *light, *splash;
-       winding_t       *w;
+       winding_t       *w, *splash_w;
 
 
        /* dummy check */
@@ -470,8 +472,8 @@ static void RadSubdivideDiffuseLight( int lightmapNum, bspDrawSurface_t *ds, raw
                        RadClipWindingEpsilon( rw, normal, dist, RADIOSITY_CLIP_EPSILON, &front, &back, cw );
 
                        /* recurse */
-                       RadSubdivideDiffuseLight( lightmapNum, ds, lm, si, scale, subdivide, qfalse, &front, cw );
-                       RadSubdivideDiffuseLight( lightmapNum, ds, lm, si, scale, subdivide, qfalse, &back, cw );
+                       RadSubdivideDiffuseLight( lightmapNum, ds, lm, si, scale, subdivide, &front, cw );
+                       RadSubdivideDiffuseLight( lightmapNum, ds, lm, si, scale, subdivide, &back, cw );
                        return;
                }
        }
@@ -497,7 +499,7 @@ static void RadSubdivideDiffuseLight( int lightmapNum, bspDrawSurface_t *ds, raw
                /* if color gradient is too high, subdivide again */
                if ( subdivide > minDiffuseSubdivide &&
                         ( gradient[ 0 ] > RADIOSITY_MAX_GRADIENT || gradient[ 1 ] > RADIOSITY_MAX_GRADIENT || gradient[ 2 ] > RADIOSITY_MAX_GRADIENT ) ) {
-                       RadSubdivideDiffuseLight( lightmapNum, ds, lm, si, scale, ( subdivide / 2.0f ), qfalse, rw, cw );
+                       RadSubdivideDiffuseLight( lightmapNum, ds, lm, si, scale, ( subdivide / 2.0f ), rw, cw );
                        return;
                }
        }
@@ -586,27 +588,77 @@ static void RadSubdivideDiffuseLight( int lightmapNum, bspDrawSurface_t *ds, raw
                VectorMA( light->origin, 1.0f, light->normal, light->origin );
                light->dist = DotProduct( light->origin, normal );
 
-               /* optionally create a point backsplash light for first pass */
-               if ( original && si->backsplashFraction > 0 ) {
+#if 0
+               /* optionally create a point backsplash light */
+               if ( si->backsplashFraction > 0 ) {
+
                        /* allocate a new point light */
                        splash = safe_malloc0( sizeof( *splash ) );
+
                        splash->next = lights;
                        lights = splash;
 
+
                        /* set it up */
                        splash->flags = LIGHT_Q3A_DEFAULT;
                        splash->type = EMIT_POINT;
                        splash->photons = light->photons * si->backsplashFraction;
+
                        splash->fade = 1.0f;
                        splash->si = si;
                        VectorMA( light->origin, si->backsplashDistance, normal, splash->origin );
                        VectorCopy( si->color, splash->color );
+
                        splash->falloffTolerance = falloffTolerance;
                        splash->style = noStyles ? LS_NORMAL : light->style;
 
                        /* add to counts */
                        numPointLights++;
                }
+#endif
+
+#if 1
+               /* optionally create area backsplash light */
+               //if ( original && si->backsplashFraction > 0 ) {
+               if ( si->backsplashFraction > 0 && !( si->compileFlags & C_SKY ) ) {
+                       /* allocate a new area light */
+                       splash = safe_malloc( sizeof( *splash ) );
+                       memset( splash, 0, sizeof( *splash ) );
+                       ThreadLock();
+                       splash->next = lights;
+                       lights = splash;
+                       ThreadUnlock();
+
+                       /* set it up */
+                       splash->flags = LIGHT_AREA_DEFAULT;
+                       splash->type = EMIT_AREA;
+                       splash->photons = light->photons * 7.0f * si->backsplashFraction;
+                       splash->add = light->add * 7.0f * si->backsplashFraction;
+                       splash->fade = 1.0f;
+                       splash->si = si;
+                       VectorCopy( si->color, splash->color );
+                       VectorScale( splash->color, splash->add, splash->emitColor );
+                       splash->falloffTolerance = falloffTolerance;
+                       splash->style = noStyles ? LS_NORMAL : si->lightStyle;
+                       if ( splash->style < LS_NORMAL || splash->style >= LS_NONE ) {
+                               splash->style = LS_NORMAL;
+                       }
+
+                       /* create a regular winding */
+                       splash_w = AllocWinding( rw->numVerts );
+                       splash_w->numpoints = rw->numVerts;
+                       for ( i = 0; i < rw->numVerts; i++ )
+                               VectorMA( rw->verts[rw->numVerts - 1 - i].xyz, si->backsplashDistance, normal, splash_w->p[ i ] );
+                       splash->w = splash_w;
+
+                       VectorMA( light->origin, si->backsplashDistance, normal, splash->origin );
+                       VectorNegate( normal, splash->normal );
+            splash->dist = DotProduct( splash->origin, splash->normal );
+
+//                     splash->flags |= LIGHT_TWOSIDED;
+               }
+#endif
+
        }
        else
        {
@@ -645,7 +697,6 @@ static void RadSubdivideDiffuseLight( int lightmapNum, bspDrawSurface_t *ds, raw
 }
 
 
-
 /*
    RadLightForTriangles()
    creates unbounced diffuse lights for triangle soup (misc_models, etc)
@@ -684,7 +735,7 @@ void RadLightForTriangles( int num, int lightmapNum, rawLightmap_t *lm, shaderIn
                }
 
                /* subdivide into area lights */
-               RadSubdivideDiffuseLight( lightmapNum, ds, lm, si, scale, subdivide, qtrue, &rw, cw );
+               RadSubdivideDiffuseLight( lightmapNum, ds, lm, si, scale, subdivide, &rw, cw );
        }
 }
 
@@ -793,7 +844,7 @@ void RadLightForPatch( int num, int lightmapNum, rawLightmap_t *lm, shaderInfo_t
                                }
 
                                /* subdivide into area lights */
-                               RadSubdivideDiffuseLight( lightmapNum, ds, lm, si, scale, subdivide, qtrue, &rw, cw );
+                               RadSubdivideDiffuseLight( lightmapNum, ds, lm, si, scale, subdivide, &rw, cw );
                        }
 
                        /* generate 2 tris */
@@ -822,7 +873,7 @@ void RadLightForPatch( int num, int lightmapNum, rawLightmap_t *lm, shaderInfo_t
                                        }
 
                                        /* subdivide into area lights */
-                                       RadSubdivideDiffuseLight( lightmapNum, ds, lm, si, scale, subdivide, qtrue, &rw, cw );
+                                       RadSubdivideDiffuseLight( lightmapNum, ds, lm, si, scale, subdivide, &rw, cw );
                                }
                        }
                }
index 557cf5d65dacdd15e1a5542c7c46a0374551fbe3..0c8799e8162c4b582082ffdfbbcdeef7e2987ef5 100644 (file)
@@ -2211,7 +2211,7 @@ int main( int argc, char **argv ){
 
        /* check if we have enough options left to attempt something */
        if ( argc < 2 ) {
-               Error( "Usage: %s [general options] [options] mapfile", argv[ 0 ] );
+               Error( "Usage: %s [general options] [options] mapfile\n%s -help for help", argv[ 0 ] , argv[ 0 ] );
        }
 
        /* fixaas */
index 9bc5dd340c75c414b55001c41d0a53fb6f5047a6..c9f26b32c706180c50accfc5c37a567ff9baaa60 100644 (file)
@@ -111,7 +111,7 @@ void LokiInitPaths( char *argv0 ){
                /* set home path */
                homePath = home;
        }
-       else {
+       else{
                home = homePath;
        }
 
@@ -188,6 +188,7 @@ void LokiInitPaths( char *argv0 ){
                                path++;
                        }
 
+
                        /* concatenate */
                        if ( last > ( path + 1 ) ) {
                                // +1 hack: Q_strncat calls Q_strncpyz that expects a len including '\0'
@@ -361,7 +362,7 @@ void AddHomeBasePath( char *path ){
                if ( access( temp, X_OK ) == 0 ) {
                        if ( customHomePath == qfalse ) {
                                tempHomePath = xdgDataHomePath;
-                       }
+       }
                        path = path + 1;
                }
                #endif // GDEF_OS_XDG
index 720dec29053fc042f0541d74295b7e0cc0d053cf..e644cc8be83d94971d63b1d0e6342cde8b5993cd 100644 (file)
@@ -1887,6 +1887,11 @@ void                        ExportEntities( void );
 int                         ExportEntitiesMain( int argc, char **argv );
 
 
+/* exportents.c */
+void                        ExportEntities( void );
+int                         ExportEntitiesMain( int argc, char **argv );
+
+
 /* image.c */
 void                        ImageFree( image_t *image );
 image_t                     *ImageFind( const char *filename );