Commit Graph

383 Commits

Author SHA1 Message Date
Eric Wasylishen 1f723c94e6 light: entities: remove entity_t.target and entity_t.targetname 2016-07-06 14:26:14 -06:00
Eric Wasylishen 431a2077d5 light: entities: replace lighttargets array with a std::vector 2016-07-06 14:08:01 -06:00
Eric Wasylishen 47c0c7ccc9 light: entities: replace epairs with std::map 2016-07-06 13:42:32 -06:00
Eric Wasylishen e012a2c93e light: finish c++ifying 2016-07-06 13:14:06 -06:00
Eric Wasylishen 1c8e7e6585 light: remove use of c99 designated initializers since they're not in c++11 2016-07-06 00:13:30 -06:00
Eric Wasylishen 913d6f068c light: DirtTrace: return hitdist instead of hitpoint 2016-06-19 16:39:59 -06:00
Eric Wasylishen 1d3774a9e0 light: make DirtTrace take dir / dist instead of endpoint to reduce VectorNormalize calls 2016-06-19 15:38:09 -06:00
Eric Wasylishen 5054ced22d light: fix embree support 2016-06-17 21:21:30 -06:00
Eric Wasylishen 3b07fb3879 Revert "light: add cull_backfaces hack used by CalcPoints, to handle the case when a shadow-casting bmodel is obstructing the midpoint of a face."
This reverts commit 412e169ef6.
2016-06-10 13:16:15 -06:00
Eric Wasylishen 412e169ef6 light: add cull_backfaces hack used by CalcPoints, to handle the case when a shadow-casting bmodel is obstructing the midpoint of a face.
probably should be removed and CalcPoints made more robust.
2016-06-10 12:23:22 -06:00
Eric Wasylishen 7c3aa545bb light: sunlight refactoring 2016-06-09 00:47:59 -06:00
Eric Wasylishen dbae785404 light: refactor sunlight handling so command-line options can be adde 2016-06-08 22:08:00 -06:00
Eric Wasylishen 0e5438ab14 light: fix saving bogus lightmaps for non-lightmapped faces when -bounce is in use 2016-06-07 20:26:19 -06:00
Eric Wasylishen dba4739444 light: make Light_PointInSolid non-static 2016-05-30 20:53:05 -06:00
Eric Wasylishen 43ab4171d7 light: store bsp in lightsurf for convenience 2016-05-30 20:52:56 -06:00
Eric Wasylishen 280aadfbd8 light: add -debugface option for debugging CalcPoints 2016-05-30 00:15:07 -06:00
Eric Wasylishen 7f182cf107 light: lit water: receive light from either side of the face 2016-05-29 16:01:31 -06:00
Eric Wasylishen 21a4fd5287 light: allow disabling bounce on command line 2016-05-27 18:47:12 -06:00
Eric Wasylishen bb19618763 light: add -phong 0 flag to force phong shading to be disabled 2016-05-27 18:18:50 -06:00
Eric Wasylishen a4445bdd77 light: allow force-disabling dirtmapping at the command line 2016-05-27 17:52:56 -06:00
Eric Wasylishen af6b4aa375 light: remove useless -no_parse_escape_sequences flag 2016-05-27 15:51:33 -06:00
Eric Wasylishen b17e345087 light: remove broken -fence feature 2016-05-27 15:50:52 -06:00
Eric Wasylishen 30673903ed light: refactor dirt*SetOnCmdline variables 2016-05-27 15:22:32 -06:00
Eric Wasylishen ca0f0448fe light: only allow one debug mode at a time 2016-05-27 12:25:51 -06:00
Eric Wasylishen e290d844bf light: only shadow-casting faces generate bounce lights 2016-05-20 13:34:30 -06:00
Eric Wasylishen 55df37941c light: add -bouncecolorscale flag 2016-05-20 12:00:57 -06:00
Eric Wasylishen e0f8213cc9 common: add userinfo param to DiceWinding 2016-05-19 23:55:12 -06:00
Eric Wasylishen 7715310afe common: add AllocWindingEdges, FreeWindingEdges, PointInWindingEdges 2016-05-19 22:02:45 -06:00
Eric Wasylishen a6f4dad172 light, vis: move plane_t to mathlib.h 2016-05-19 15:26:30 -06:00
Eric Wasylishen 2cdc5e7c68 common: actually move WindingFromFace to polylib 2016-05-19 15:18:33 -06:00
Eric Wasylishen 45010089f3 light, common: move WindingFromFace to bspfile.c/h 2016-05-19 15:07:31 -06:00
Eric Wasylishen fff12697e5 light: move DicePatch to polylib.c 2016-05-19 15:03:21 -06:00
Eric Wasylishen a0f636a69a light: bounce: refactor to do in a second lighting pass 2016-05-19 02:53:18 -06:00
Eric Wasylishen a5356c161c light: bounce: scale bounced light by texture color 2016-05-14 20:51:21 -06:00
Eric Wasylishen f73b9de0b3 common: make VectorLength, VectorNormalize static inline 2016-05-13 21:10:00 -06:00
Eric Wasylishen d0480049e8 light: move TRACE_HIT_ constants to trace.c 2016-05-11 16:30:26 -06:00
Eric Wasylishen 7bd93cce37 light: move private BSP tracing stuff from light.h to trace.c 2016-05-11 16:23:02 -06:00
Eric Wasylishen 3fb8b7d1e5 light: delete -lightturb and related flags for generating lightmaps for TEX_SPECIAL textures.
mankrip's lit water implementation relies on qbsp splitting water, so this code is not needed.
2016-04-29 23:23:28 -06:00
Eric Wasylishen 72c47c1b56 light: bounce: refactor a bit 2016-04-29 18:11:14 -06:00
Eric Wasylishen 67a64f9be4 vis: support PRT1-AM portals generated by txqbsp-xt 2016-04-29 12:20:35 -06:00
Eric Wasylishen 2bca34265c light: use vis acceleration for bounce lights 2016-04-29 11:27:02 -06:00
Eric Wasylishen 713b92dcb5 light: preliminary bounce implementation 2016-04-27 19:19:29 -06:00
Eric Wasylishen d426c8d9da light: some setup for bounced lighting 2016-04-26 15:14:22 -06:00
Eric Wasylishen c58528499d light: when interpolating a normal that lies outside of a face, recursively look it up on adjacent faces 2016-04-26 00:29:50 -06:00
Eric Wasylishen f3132f342c light: Mod_LeafPvs: return whether we found a real pvs 2016-04-24 18:24:41 -06:00
Eric Wasylishen 318fc23481 light: implement "_bleed" light key.
"_bleed" "1" on a light entity skips the test that a light is on the front side of a face. useful for special effects.
2016-04-23 22:21:59 -06:00
Eric Wasylishen 5ac18e5c6f light: index some PVS info at startup 2016-04-22 20:11:59 -06:00
Eric Wasylishen d309aa02b0 light: refactor CalcPvs to calculate the face pvs in a cleaner way 2016-04-22 19:15:49 -06:00
Eric Wasylishen 338ceae8c8 light: add face to lightsurf struct 2016-04-21 00:13:31 -06:00
Eric Wasylishen 1ea4d52eab light: add -novis flag 2016-04-20 23:57:04 -06:00
Eric Wasylishen e1bad1bbd6 light: rewrite normal interpolation 2016-04-20 01:39:42 -06:00
Eric Wasylishen bc0e76f959 common: polylib: add WindingBounds from q2 tools. Add missing consts 2016-04-19 01:39:37 -06:00
Eric Wasylishen 8fd3f41b42 light: expose GetLightValue in entities.h 2016-04-19 01:28:33 -06:00
Eric Wasylishen 0c93c5c3d0 light: DirtTrace: add extra argument for hit face 2016-04-19 01:26:21 -06:00
Eric Wasylishen 2a4168f35c light: add _minlight_exclude bmodel key 2016-04-17 22:51:14 -06:00
Eric Wasylishen fff8cbffbc light: use vis data 2016-04-14 20:15:52 -06:00
Eric Wasylishen 321eac8aaa light: make PrintFaceInfo non static 2016-04-12 01:07:37 -06:00
Eric Wasylishen c86731ab58 light: make TriangleArea non static 2016-04-11 00:47:21 -06:00
Eric Wasylishen cf8e3fc935 light: augment DirtTrace with the hit plane 2016-04-10 22:30:42 -06:00
Eric Wasylishen 986334a86b light: unify "_anglescale" worldspawn key and "-anglescale" command line option, previously they were different.
Fix "-anglescale" command line option which was broken.
Make sunlight2 use the global anglescale setting.
2016-04-10 18:25:15 -06:00
Eric Wasylishen b6c9873289 light: return hit normal for DirtTrace 2016-04-10 15:27:21 -06:00
Eric Wasylishen 0a6708edb0 light: remove embree support 2016-04-10 14:43:37 -06:00
Eric Wasylishen d5a4e07deb common: fix VECT_MAX macro 2016-04-10 14:43:17 -06:00
Eric Wasylishen ab9be6bbf2 light: refactoring 2016-04-07 13:16:21 -06:00
Eric Wasylishen c9aad9d2ce light: Refactor CalcPoints, store whether a point is occluded 2016-04-06 18:29:24 -06:00
Eric Wasylishen a6a89db530 light: refactor tracelist to be a list of modelinfo_t instead of dmodel_t 2016-04-05 23:25:36 -06:00
Eric Wasylishen e11e9d5c1f light: embree support 2016-03-30 14:58:21 -06:00
Eric Wasylishen d2f1eb2b2b light: support _phong and _phong_angle on bmodels for compatibility with other qbsp's. 2016-03-05 22:51:17 -07:00
Eric Wasylishen 41972a376a qbsp, light: Strip texinfo flags other than TEX_SPECIAL.
Write extended ones to a "mapname.texinfo" file.
Support "_dirt" and "_minlight" flags on func_detail/group.
2016-03-05 00:26:54 -07:00
Eric Wasylishen 0b4c044473 light: fix dirtmapping traces 2016-03-04 20:40:14 -07:00
Eric Wasylishen 98a020fde7 vis: fix ambient sounds when using func_detail, broken in tyrutils-ericw-v0.15.3 2016-03-04 15:38:08 -07:00
Eric Wasylishen fec88c3186 light: fix build on MSVC 2016-03-02 19:21:30 -08:00
Eric Wasylishen 492d94c1fe light: new phong shading keys, "_phong_angle" and "_phong".
"_phong" "1" is a shortcut for "_phong_angle" "89".
"_phong_angle" sets the max angle in degrees between faces that will get smoothed.
2016-03-02 20:00:05 -07:00
Eric Wasylishen f641e93ca2 light: convert light.c to light.cc 2016-03-02 17:07:02 -07:00
Eric Wasylishen 4ed6db3020 light: add new TraceFaces API which gives accurate info on the first hit face of a trace.
Need to use this for: dirtmapping, fence textures, GI
2016-02-21 22:31:06 -07:00
Eric Wasylishen 4e74e530c0 light: dynamically allocate memory for lighting each face 2016-02-20 14:43:38 -07:00
Eric Wasylishen 22dd1726de light: move lightsurf_t etc. to header 2016-02-20 14:41:58 -07:00
Eric Wasylishen 1fd1637de1 light: add -phongdebug option 2016-02-15 20:27:03 -07:00
Eric Wasylishen 7128a8e956 code formatting, normalize most whitespace to 4 spaces 2016-02-15 16:20:29 -07:00
Eric Wasylishen 1630b8756e tyrutils-ericw-spike rebased on to 998c9d3acb 2016-02-15 16:16:37 -07:00
Eric Wasylishen a439f891a1 CalcPoints: Skip the trace if a PointContents says the point is already unobstructed.
Handles beveled walkways in telefragged.bsp which touch a wall along one edge, but don't split the wall.
Previously, the walkways were blocking most of the traces for the wall, messing up all of the wall sample points.
2016-02-11 22:38:23 -07:00
Eric Wasylishen 063786bf02 build: fix spurious errors in VS2015 IDE 2015-12-07 14:37:46 -08:00
Eric Wasylishen 420125cc67 replace tabs with spaces.
for FILE in $(find . -name "*.h" -or -name "*.c"); do cat $FILE | expand > temp; cat temp > $FILE; done
2015-12-07 15:08:48 -07:00
Eric Wasylishen c149ed2bf6 build: VS2015 support 2015-12-07 14:23:13 -07:00
Eric Wasylishen e6fcf3d6da light: add -surflight_dump option to export generated surface lights to a map file 2015-12-05 20:27:51 -07:00
Eric Wasylishen 81cefad71a light: handle surface lights on rotators 2015-12-05 20:07:20 -07:00
Eric Wasylishen 50b556993a light: experimental -parse_escape_sequences option to toggle \b escape sequence (toggles bold text) 2015-11-26 18:30:10 -07:00
Eric Wasylishen f154a00e3a light: fix "_mincolor" bmodel key which was only accepting 0-255
now accepts 0-1 or 0-255.
2015-11-20 14:27:25 -08:00
Eric Wasylishen d0fb0bd410 light: remove entity->fadedist, it was error-prone, and instead just check light level. it's only very slightly slower. 2015-10-25 23:18:17 -06:00
Eric Wasylishen 1e9a0ac2b3 light: add "-sunsamples" flag to control number of samples for _sunlight_penumbra and _sunlight2 2015-10-23 19:54:41 -06:00
Eric Wasylishen 545ba66ebc vis: Reuse each cluster's visdata for all leafs in the cluster 2015-10-20 02:26:35 -06:00
Eric Wasylishen 792a7eae6e vis: raise MAX_MAP_VISIBILITY to 128MB 2015-10-19 23:48:19 -06:00
Eric Wasylishen a3b985e721 hexen2 support, patch from Spike 2015-10-16 21:18:53 -06:00
Eric Wasylishen 46cbcfd12b light: add -dirtangle flag to control dirtmapping cone angle 2015-08-28 20:22:54 -06:00
Eric Wasylishen 3c918db489 light: add -onlyents switch 2015-08-20 12:14:13 -06:00
Eric Wasylishen 3005504fe5 vis, light: set low process priority on windows 2015-08-05 12:10:17 -06:00
Eric Wasylishen 5302a3b539 light: add -surflight_subdivide command line flag to control subdivision size 2015-08-05 12:10:14 -06:00
Eric Wasylishen e9f240b623 light: .lux file support from Spike 2015-07-09 16:34:12 -06:00
Eric Wasylishen e242a9c910 light: Add gamma control with -gamma flag and "_gamma" key 2015-07-09 16:33:07 -06:00
Eric Wasylishen 26a03ace45 light: optimization: avoid iterating over non-light entities in light thread. 2015-06-02 00:51:37 -06:00
Eric Wasylishen 54e7c2ab8e light: fence texture tracing 2015-04-27 00:26:42 -06:00
Eric Wasylishen 6fe67cd2fb light: allow setting _dist and _range in worldspawn 2015-04-25 20:46:00 -06:00
Eric Wasylishen ef471ee44f Support "_dirt" "-1" on bmodels to disable dirtmapping 2015-04-25 20:45:54 -06:00
Eric Wasylishen be8c42460c _sunlight2 (sky light, light dome) support from q3map2
_sunlight penumbra (deviance) from q3map2
light penumbra from q3map2
2015-04-25 20:45:44 -06:00
Eric Wasylishen 741d341332 Dirtmapping (ambient occlusion) from q3map2 2015-04-25 20:45:32 -06:00
Kevin Shanahan 50b78f3d61 qbsp, common: support both DP and RMQ variants of the BSP2 format
Turns out there are two types of "BSP2" format - one that I think was
created by MH and implemented in the RMQ project (this is the one I
implemented previously) and one by LordHavoc which exteneded the
coordinate limits beyond 32k, implemented in Darkplaces.  The
Darkplaces version of BSP2 will get the name BSP2 and the RMQ version,
which is more limited, will get the name BSP2rmq.

qbsp will only create the BSP29 or BSP2 formats, but will cope with a
BSP2rmq format file for an -onlyents compile.  The rest of the tools
can use any of the three formats.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-09-28 11:48:37 +09:30
Kevin Shanahan 4b1e3aec1a light, vis, bsputil, bspinfo: Add BSP2 support
Add BSP2 support to the remaining utils.  Since these share the common
bspfile.[ch] files, it was more effort than is justifiable to break this
into multiple staged patches - so you just get this disgustingly big
commit instead.  Here is basically what was done:

 * Modify the bspdata_t struct with a union of the two bsp formats
 * Modify the tools to use bsp2_t for all internal processing
 * Split out the byte swapping routines for the different bsp data types
 * Add simple (although verbose) code to convert bsp29 <-> bsp2

Hundreds of lines added to bspfile.c, but mostly trivial stuff.  The tools
internally had little modification except to substitute the bsp2 type
names.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-09-25 15:18:50 +09:30
Kevin Shanahan e970bea8c7 common: save the bsp version in the bspdata struct
Adjust the Load and Write API functions as appropriate.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-08-22 13:25:47 +09:30
Kevin Shanahan 89abf25218 common: convert all tools to instanced bsp data
Transition all tools to access the BSP data via the bspdata struct instead
of the shared globals.  Remove the compatibility code from bspfile which
copied the global values to/from the instanced bspdata struct.

Mostly the changes just involved passing along the bspdata struct to the
various functions which needed to reference the data.  TraceLine and
MakeTNodes in light got some extra changes so that we cache the node
dplane pointer and remove the need to pass the bspdata struct to every
trace operation!

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-08-22 11:01:08 +09:30
Kevin Shanahan d0617760f5 common: add the ability to pass an arg to spawned threads
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-08-20 19:27:40 +09:30
Kevin Shanahan 6ddb109dde light: convert WriteLitFile to use the bspdata struct
Avoids reference to global LightDataSize.  Need to move writing the lit
file above the call to WriteBSPFile, since that will do the byte swapping.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-08-20 15:23:04 +09:30
Kevin Shanahan 5facda6ff9 common: constify vec3_origin
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-08-20 13:30:05 +09:30
Kevin Shanahan 51419621ec common: add the bsp2/bsp29 data types
Rename the default bsp29 data types and add the bsp2 data types to
the common bspfile.h.  Propogate the bsp29 names into the other tools as
simple renames for now.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-08-20 13:25:16 +09:30
Kevin Shanahan 0092347789 common: use stdint types in the common bspfile.h
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-08-20 12:25:51 +09:30
Kevin Shanahan 69c86e59b8 common: move AMBIENT and MAXLIGHTMAP definitions
Keep the ambient sound definitions near the leaf and lightmaps limit near
the face definition.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-08-20 12:20:57 +09:30
Kevin Shanahan 42bcf2da7c common: rename HEADER_LUMPS -> BSP_LUMPS
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-08-20 09:30:26 +09:30
Kevin Shanahan 9a2cd81b8c common: add the bsp version defines to bspfile.h
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-08-20 09:18:26 +09:30
Kevin Shanahan 12e24085c1 light: always calculate color values for light samples
Simplify the code by removing the if (colored) conditionals from the
code path.  CPU cost is insignificant compared to tracing the rays.
As before, only write the lit file if colored lights are detected or
the use explicity requests it.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-07-03 13:03:27 +09:30
Kevin Shanahan a0fc4cab3e light: remove (now) unused MAXLIGHTS define
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-07-03 11:49:07 +09:30
Kevin Shanahan 9ea5aaa1db vis: tidy up definitions of LogLeaf/LogWinding
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-05-08 11:32:57 +09:30
Kevin Shanahan c0d03cba32 vis: constify source argument to copy winding
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-05-08 11:32:12 +09:30
Kevin Shanahan 723a3f140e common: fix missing stdarg include in log.h
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-24 09:02:20 +09:30
Kevin Shanahan 75666712e7 common: create logprint_silent to replace qbsp's msgFile
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-23 14:59:37 +09:30
Kevin Shanahan bbbb3ff859 common: use stdbool in threads.c, log.c so cmdlib isn't needed
The only thing used by log.c was the qboolean definition, so just use
stdbool internally instead.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-23 14:44:14 +09:30
Kevin Shanahan c3bf54e494 common: add printf attribute to Error() declaration in cmdlib.h
Fix a number of warnings now generated as a result.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-23 14:39:44 +09:30
Kevin Shanahan b484603871 trivial: remove old comment about removing plane type
On disk formats are pretty final at this point...

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-20 16:58:54 +09:30
Kevin Shanahan d14793f7ab common: make LoadBSPFile take a bspdata struct
No longer update the globals in this function - make the callers do it
instead.

bspinfo no longer refers to the globals at all.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-20 16:51:45 +09:30
Kevin Shanahan 35024bfa7d common: make dtexdata a union
Just having one base pointer was kind of annoying because you have to cast
to get to the lump offsets, then cast to byte * to find the miptex, etc.
Now we can access the same pointer using the correct types in each case.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-20 16:34:30 +09:30
Kevin Shanahan 37a3a98eff common: make WriteBSPFile take a bspdata struct as input
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-20 15:52:31 +09:30
Kevin Shanahan 6bf97a2cb0 common: convert PrintBSPFileSizes to use the bspdata struct
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-20 13:27:25 +09:30
Kevin Shanahan 89074e10e9 common: create a struct for instanced bsp data
I'd like to be able to control visibility of the global bsp data as well
as having the ability to load two bsp files and do comparisons, etc.  Set
up a structure to hold all the bsp data and a couple of helper functions
to enable a smooth transition for the utils.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-20 12:00:07 +09:30
Kevin Shanahan d7611d6b1b common: change loadfile argument to avoid casts in callers
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-20 10:26:08 +09:30
Kevin Shanahan df0aa44310 common: create a lumpspec structure with lump data names/sizes
Copylump now doesn't need the size passed in, just the type.  Also, pass
the file header into CopyLump while we're at it.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-20 10:21:53 +09:30
Kevin Shanahan f20033fdd7 light: dynamically allocate entities and entstring
Removes the MAX_MAP_ENTITIES and MAX_MAP_ENTSTRING limitations by
counting how much space we will need before parsing/writing.

Now that I look at it, I'm not sure why we should even be re-writing
the entity string in the new bsp file, but I'll leave that behaviour
alone... for now.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-18 09:45:52 +09:30
Kevin Shanahan 4625245b09 light: implement the -addmin command line parameter
Makes minlight additive rather than just bringing low levels up to the
minimum.  Not entirely identical to the bjp implementation as it seems to
treat local minlights in some strange ways, but in most cases the
behaviour should be identical.

Added missing help text for -anglescale|-anglesense parameters too.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-04 15:55:58 +10:30
Kevin Shanahan 9c8cbfd601 vis: add the -noambient* options to disable auto ambient sounds
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-28 08:28:47 +10:30
Kevin Shanahan 636a94f260 light: implemented _anglescale key (AKA "_angelsense")
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-15 21:27:14 +10:30
Kevin Shanahan 4abc7d31b7 light: remove the old -compress option
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-15 20:43:12 +10:30
Kevin Shanahan cc8477c6d9 light: implement -soft command line option
Add the -soft command line option which implements post-processing on
the lightmap surface to blend adjacent samples together to smooth out
hard shadow lines.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-14 11:28:22 +10:30
Kevin Shanahan 1dc62b426a common: add VecStrf debugging helper and increase buffers to 8
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-13 12:57:56 +10:30
Kevin Shanahan cc36d8eadc light: rewrite light tracing function and update callers
Substantial changes to TestLineOrSky which now becomes TraceLine to
more conveniently trace lines through the BSP and, terminate the trace
on specific contents and return information about the termination
point.

TraceLine also more correcly handles the cases where points are close
enough to the node planes to be considered "on-node" to ensure we get
a good intersection point back, when requested.

Finally, the algorithm for making the small adjustments to surface
points in CalcPoints has been changed so if the surface point can't
see the midpoint, we find the obscuring surface and move the surface
point just above that. Seems to work better and eliminates some (but
not quite all - midpoint is still not quite the ideal point to use)
random black spots.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-12 16:40:16 +10:30
Kevin Shanahan 359ddfa41e light: remove nominlimit option and negative color value support
"nominlimit" is a more sensible default - people expect negative
lights to be able to subtract from minlight. The negative colors never
really worked properly and there's not really any worthwhile use for
the (that I know of).

Hopefully nobody will be too upset by these two changes to the old
behaviour.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-10 20:24:19 +10:30
Kevin Shanahan e8d640f88f light: use lightsample_t for minlight and sunlight
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-10 18:42:35 +10:30
Kevin Shanahan f82562f9e4 light: use lightsample_t for entity light values
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-10 18:28:00 +10:30
Kevin Shanahan d57e7d50fd light: use lightsample_t for modelinfo->minlight
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-10 17:17:42 +10:30
Kevin Shanahan eb92d5eac1 light: remove a couple of unneeded function declarations from header
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-09 19:18:36 +10:30
Kevin Shanahan 3749cfa734 light: pass the dface pointer into lightface
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-09 19:14:33 +10:30
Kevin Shanahan d6ef23453a light: implement self shadowing option for brush models
Brush models can now self shadow without casting shadows on their
environment, using the "_shadowself" entity key.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-08 15:02:36 +10:30
Kevin Shanahan a6e42ab860 light: implement brush model entity shadows
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-08 11:37:36 +10:30
Kevin Shanahan b4387359a4 light: implement minlighting for bmodels
Collect the appropriate keys from the models at load time and pass them
into the minlighting function (if > world minlight).

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-07 18:22:25 +10:30
Kevin Shanahan 33b4ba2040 light: remove the never-used nolightface array
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-07 15:18:36 +10:30
Kevin Shanahan 7b36c6fd2f build: query git for version info and print consistently for each util
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-07 14:26:14 +10:30
Kevin Shanahan 4063d8aade light: implement the _softangle key for spotlights
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-03 21:37:21 +10:30
Kevin Shanahan a8d8150791 light: implement the -gate option
Precalculate the distance at which lights will fade to zero brightness.
For lights with inverse falloff, use the gate value to determine the
cut-off distance.  Use this value to cull samples and avoid the ray
tracing overhead.

Hopefully not too controversially, I am going to default this to "on" with
a gate value of 0.001. Unless you have > 1000 lights contributing
fractional light values across your map, this is not going to make any
visible difference.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-03 13:36:52 +10:30
Kevin Shanahan 052805c4ca light: fix race in allocation of white/coloured lightmap data
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-02 12:18:54 +10:30
Kevin Shanahan 9b470d126b light: make targetent pointer const
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-02 12:17:57 +10:30
Kevin Shanahan 625fc2c61b common: add VecStr convenience function
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-02 11:25:40 +10:30
Kevin Shanahan c458099ec7 light: implement the 4x4 oversampling option
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-01 17:26:44 +10:30
Kevin Shanahan ad129c59da light: rename sunmangle variable as sunvec
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-01 11:58:50 +10:30
Kevin Shanahan f07007f8ad light: setup spotlight paramters once at load time
We were calculating these values for every light and for every surface,
which seems a little excessive... Also made the variable names a bit more
sensible - we had stored a direction vector, not the actual mangle values.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-01 11:50:57 +10:30
Kevin Shanahan 8ce739fe3f light: remove bsp30 support and automatically generate .lit when needed
Check whether any of the entities have colored fields set and if so,
enable colored light output. Can still be overridden from the command line
if needed.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-01 10:07:53 +10:30
Kevin Shanahan 8f3d28c2ac light: implement delay 4 and 5 as in visbjp light
Implement the two extra light attenuation formulae that were added to
Benjt Jardrup's light util (http://user.tninet.se/~xir870k/readmevis.txt).

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-02-28 16:16:34 +10:30
Kevin Shanahan 599742310b light: use an enum for light attenuation formulae
And warn if we are given a formula number we don't know about.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-02-27 17:13:53 +10:30
Kevin Shanahan c0f9b19868 vis: add detail brush / prt2 support
First pass at detail support as implemented in tyr-qbsp, using the PRT2
file format (hopefully nobody else already decided to use that?)

Because the "leaf" terminology is pervasive across the source, I've left
it there for now (so "leaf" usually now means "cluster") and added a few
variables with the "_real" suffix when they actually mean the real leafs
and not the clusters which vis still calls leafs. A bit disgusting, but it
actually works so I'll go through and clean up naming, etc. later.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-02-25 12:32:35 +10:30
Kevin Shanahan ea836f6b0b light: constify light's version of ValueForKey()
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-02-11 20:10:47 +10:30
Kevin Shanahan 5bb5c576f4 common: constify init_log filename argument
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-02-11 20:10:17 +10:30
Kevin Shanahan 4161d10a68 vis: add saving and resuming of vis state to/from disk
Inspired by the implementation of Benjt Jardrup, save the current state of
the vis job to disc at regular intervals so that we can resume from that
point in case the computer needs to be rebooted/shutdown or crash/power
issues occur.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-02-09 16:40:37 +10:30
Kevin Shanahan a56030fad0 common: make logprint properly interrupt the thread progress display
Logprint will notify the threads code that the progress meter has been
interrupted and the progress meter will re-print the next time it needs to
be updated.

Unfortunately this makes all the utils depend on the thread code, but not
a big issue.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-02-08 16:37:48 +10:30
Kevin Shanahan 3e20dae28e common: add start arg to RunThreadsOn to set initial progress
In case we are not starting work from 0, allow this to be set...

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-02-07 20:51:04 +10:30
Kevin Shanahan 853761d0d6 common: remove pacifier argument from RunThreadsOn
Set to true everywhere, just use it unconditionally.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-02-07 20:46:33 +10:30
Kevin Shanahan 6ea82e47b0 vis: remove some code from old threads implementation
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-01-19 12:37:32 +10:30
Kevin Shanahan 815fd70265 vis: use leafbits_t struct and helpers to represent vis bit strings
Importing parts of this from TyrQuake - means that the base type used for
managing the bit vectors is unsigned long. Not really a performance win or
anything here, just a bit nicer to not have to cast from (byte *) to
(long *) - just adds a little extra work before writing out the compressed
data.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-01-19 12:12:47 +10:30
Kevin Shanahan 0192b3d732 vis: remove the MAX_PORTALS limit
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2012-12-26 17:49:20 +10:30
Kevin Shanahan ecb66fb2aa vis: convert full vis to use the thread progress code
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2012-12-26 14:01:26 +10:30
Kevin Shanahan 686d4451b8 vis: thread the base portal vis
Make the base portal vis thread safe and run on multiple threads. Use the
common thread progress indicator code.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2012-12-26 11:27:29 +10:30
Kevin Shanahan 7ee8bc183b light: use the common threads code
Make light use the common threads code.
The common progress indicator code is still not used.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2012-12-26 09:35:26 +10:30
Kevin Shanahan 557a1faf20 common: make the common thread code usable on Win32/Linux
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2012-12-26 09:33:50 +10:30
Kevin Shanahan a10316d7c9 vis: rename vstatus to pstatus
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2012-12-25 21:28:20 +10:30
Kevin Shanahan 6fab0a5358 light: make pthreads support work
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2012-12-20 20:14:39 +10:30
Kevin Shanahan e100c9642b common: add prinf format attribute to logprint/logvprint
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2012-12-17 13:02:19 +10:30
Tyrann ce369bfdd6 Use offsetof() consistently
And include stddef.h where we do use it
2012-01-06 21:32:53 +10:30
Tyrann d20e0cc8d4 Mark cmdlib's Error() function noreturn
Reduces compiler warning noise
2012-01-06 21:00:41 +10:30
Tyrann 2c2f3c8eb6 Import initial sources 2006-08-28 23:58:10 +09:30