Commit Graph

35 Commits

Author SHA1 Message Date
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 fec6d64bf1 light: be more consistent with lightmap/colormap variable names
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-03 20:14:09 +10:30
Kevin Shanahan 0420f83ab9 light: rename scaledLight -> GetLightValue
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-03 13:51:33 +10:30
Kevin Shanahan fc90cfdff4 light: use fadedist instead of scaledDistance()
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-03 13:46:31 +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 8b1a501087 light: trivial tidy up
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-03 13:26:28 +10:30
Kevin Shanahan f5e7e594e4 light: remove redundant ray trace in SingleLightFace
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-03 13:05:11 +10:30
Kevin Shanahan 4879c7e874 light: use TestLine instead of CastRay for LOS test
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-03 13:00:22 +10:30
Kevin Shanahan 888494f0c1 light: test spotlight cone before ray tracing
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-03 12:56:10 +10:30
Kevin Shanahan bea0f0f983 light: bsp_origin is just zero, don't need rel vector
May as well keep dist as the actual distance and just call ScaledDistance
twice (poor function name, btw - it's effectively the equivalent of the
"fade gate" stuff)

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-03 12:50:01 +10:30
Kevin Shanahan f075de2fb5 light: re-organise lightinfo_t structure
Rename member lightmapcolors -> colormaps
Remove unused member surfnum
Re-order things so the data lumps are together at the end.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-02 13:39:03 +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 4cbbb44a23 light: minor tidy up of spot falloff check in SingleLightFace
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-02 11:30:49 +10:30
Kevin Shanahan c0ebc18d96 light: constify surf pointer in LightSingleFace
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-02 11:29:39 +10:30
Kevin Shanahan b746947595 light: use VecStr convenience function for log messages
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-02 11:27:10 +10:30
Kevin Shanahan a1e0f192c7 light: fix use of incorrect color for !nominlimit case
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-01 22:03:36 +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 57a161afa2 light: place oversample points correctly around original
Looks like the original code biased these to one side, but the
oversampling will be more accurate if we evenly distribute the points
around the actual lightmap point.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-01 12:42:57 +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 580b2912fb light: don't let negative lights on a new style count as a hit
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-01 10:58:11 +10:30
Kevin Shanahan a3ac989224 light: trivial VectorMA substituion
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-01 10:56:19 +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 725fffbd7a light: fix off-by-one error in MAX_LIGHTMAPS check
I guess this bug has been here a long time. This was preventing us from
using all four available lightmaps in most cases. Now fixed!

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-02-28 15:51:28 +10:30
Kevin Shanahan d8b7e08683 light: tidy up the FixMinlight function
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-02-28 14:31:33 +10:30
Kevin Shanahan 5c4e6d4f0b light: trivial, remove old comment
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-02-28 11:46:47 +10:30
Kevin Shanahan 70fceb5218 light: also pass colors into SingleLightFace
No more games with save/modify/restore on the entity->lightcolor.
Could have actually caused nasty races in the multithreaded case.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-02-28 10:44:05 +10:30
Kevin Shanahan e8764f5492 light: pass colors into SkyLightFace
Stop playing silly games with saving, modifying and restoring the global
sunlight_color. A couple of variable naming changes in lightface and use
an entity pointer instead of always indexing into the global array.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-02-28 10:32:30 +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 1c8137d400 light: remove stale comment about MAXLIGHTMAPS
Yes, it really is 4.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2012-12-20 20:15:54 +10:30
Kevin Shanahan ef6c4c30c5 light: remove unused accounting variable
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2012-12-20 20:15:40 +10:30
Kevin Shanahan c51eb01291 light: remove workaround for old compiler bug
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2012-12-20 20:15:10 +10:30
Tyrann ad964e7f28 trivial: remove some redundant assignments and unused variables 2012-01-06 21:34:47 +10:30
Tyrann 2c2f3c8eb6 Import initial sources 2006-08-28 23:58:10 +09:30