diff --git a/include/light/light.h b/include/light/light.h index 56cd1b2c..9722e353 100644 --- a/include/light/light.h +++ b/include/light/light.h @@ -146,6 +146,7 @@ extern byte *lux_filebase; extern int oversample; extern qboolean write_litfile; extern qboolean write_luxfile; +extern qboolean onlyents; void SetupDirt(); diff --git a/light/light.c b/light/light.c index 700eb37d..3251b38a 100644 --- a/light/light.c +++ b/light/light.c @@ -74,6 +74,7 @@ const dmodel_t *const *tracelist; int oversample = 1; qboolean write_litfile = false; qboolean write_luxfile = false; +qboolean onlyents = false; void GetFileSpace(byte **lightdata, byte **colordata, byte **deluxdata, int size) @@ -359,6 +360,9 @@ main(int argc, const char **argv) surflight_subdivide = atof( argv[ ++i ] ); surflight_subdivide = qmin(qmax(surflight_subdivide, 64.0f), 2048.0f); logprint( "Using surface light subdivision size of %f\n", surflight_subdivide); + } else if ( !strcmp( argv[ i ], "-onlyents" ) ) { + onlyents = true; + logprint( "Onlyents mode enabled\n" ); } else if (argv[i][0] == '-') Error("Unknown option \"%s\"", argv[i]); else @@ -370,7 +374,7 @@ main(int argc, const char **argv) " [-light num] [-addmin] [-anglescale|-anglesense]\n" " [-dist n] [-range n] [-gate n] [-lit] [-lux]\n" " [-dirt] [-dirtdebug] [-dirtmode n] [-dirtdepth n] [-dirtscale n] [-dirtgain n]\n" - " [-soft [n]] [-fence] [-gamma n] [-surflight_subdivide n] bspfile\n"); + " [-soft [n]] [-fence] [-gamma n] [-surflight_subdivide n] [-onlyents] bspfile\n"); exit(1); } @@ -407,22 +411,24 @@ main(int argc, const char **argv) LoadEntities(bsp); - if (dirty) - SetupDirt(); + if (!onlyents) { + if (dirty) + SetupDirt(); - MakeTnodes(bsp); - modelinfo = malloc(bsp->nummodels * sizeof(*modelinfo)); - FindModelInfo(bsp); - LightWorld(bsp); - free(modelinfo); + MakeTnodes(bsp); + modelinfo = malloc(bsp->nummodels * sizeof(*modelinfo)); + FindModelInfo(bsp); + LightWorld(bsp); + free(modelinfo); + + if (write_litfile) + WriteLitFile(bsp, source, LIT_VERSION); + if (write_luxfile) + WriteLuxFile(bsp, source, LIT_VERSION); + } WriteEntitiesToString(bsp); - if (write_litfile) - WriteLitFile(bsp, source, LIT_VERSION); - if (write_luxfile) - WriteLuxFile(bsp, source, LIT_VERSION); - /* Convert data format back if necessary */ if (loadversion != BSP2VERSION) ConvertBSPFormat(loadversion, &bspdata); diff --git a/man/light.1 b/man/light.1 index 460510a2..25fc6008 100644 --- a/man/light.1 +++ b/man/light.1 @@ -80,6 +80,10 @@ Generate a .lux file storing average incoming light directions for surfaces. Usa .IP "\fB\-surflight_subdivide [n]\fP" Configure spacing of all surface lights. Default 128 units. Minimum setting: 64 / max 2048. In the future I'd like to make this configurable per-surface-light. +.IP "\fB\-onlyents\fP" +Updates the entities lump in the bsp. You should run this after running qbsp with -onlyents, +if your map uses any switchable lights. All this does is assign style numbers to each +switchable light. .SH "MODEL ENTITY KEYS" @@ -111,7 +115,7 @@ an angle specified by the "_sun_mangle" key. Default 0. .IP "\fB""_anglescale"" ""n""\fP | \fB""_anglesense"" ""n""\fP" Set the scaling of sunlight brightness due to the angle of incidence with a -surface (more detailed explanation in the "_anglescale" light entity key +surface (more detailed explanation in the "_anglescale" light entity key below). .IP "\fB""_sunlight_mangle"" ""x y z""\fP | \fB""_sun_mangle"" ""x y z""\fP" @@ -200,7 +204,7 @@ blocks the light from another model surface. This can be a better compromise for moving models than full shadowing. Default 0. .IP "\fB""_dirt"" ""n""\fP" -For brush models, -1 prevents dirtmapping on the brush model. Useful it the +For brush models, -1 prevents dirtmapping on the brush model. Useful it the bmodel touches or sticks into the world, and you want to those ares from turning black. Default 0. @@ -300,7 +304,7 @@ Number of lights to use for "_deviance". Default 16 (only used if Makes surfaces with the given texture name emit light, by using this light as a template which is copied across those surfaces. Lights are spaced about 128 units (though possibly closer due to bsp splitting) apart and positioned 2 units above -the surfaces. +the surfaces. .IP "\fB""_surface_offset"" ""n""\fP" Controls the offset lights are placed above surfaces for "_surface". Default 2.