Commit Graph

742 Commits

Author SHA1 Message Date
Eric Wasylishen d1c4470fc1 light: add "-novis" to help listing 2016-06-04 22:22:22 -06:00
Eric Wasylishen 285e0f84af light: add warning for "_project_texture" missing texture 2016-06-01 20:35:55 -06:00
Eric Wasylishen ecea00cec2 light: tweaks to usage text 2016-06-01 17:38:30 -06:00
Eric Wasylishen 26fd4b6d28 light: tidy log message 2016-06-01 16:34:35 -06:00
Eric Wasylishen 72e07f82fb light: print message when visdata in use 2016-06-01 16:04:18 -06:00
Eric Wasylishen 45daf59df7 light: improve usage message. recognize -help flag. show usage when an unknown command given. 2016-06-01 13:55:41 -06:00
Eric Wasylishen 3e8d9b7dfd light: warn about gate > 1 2016-05-31 18:23:37 -06:00
Eric Wasylishen 826f44d8cf light: disable "interior verts" spam 2016-05-31 18:19:35 -06:00
Eric Wasylishen 2d0ede48cf light: FixLightOnFace: only check against model 0, otherwise triggers etc. are wrongly considered to block lights 2016-05-31 18:18:25 -06:00
Eric Wasylishen 5303dae5fc light: CalcPoints: reduce distance to 0.25 2016-05-30 20:53:52 -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 0b8ec4d169 light: CalcPoints: increase distance to pull back from obstructions to from 0.1 to 1.0.
fixes room corner seams on calcpointstest.map
2016-05-29 17:16:11 -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 0b5786ebef light: remove hack for lights on faces, now that we correct them properly 2016-05-28 15:18:58 -06:00
Eric Wasylishen 329d9ee512 light: correct lights directly on faces 2016-05-28 15:18:11 -06:00
Eric Wasylishen 92a9369bbc light: remove hack for lights directly on faces, was breaking phong shading. 2016-05-28 13:38:12 -06:00
Eric Wasylishen 496fc4d52e light: phong: reduce epsilon used for barycentric coordinates test. fixes interpolation on testphongtjunc.map 2016-05-27 22:06:17 -06:00
Eric Wasylishen a63a96e877 light: update usage text 2016-05-27 20:45:44 -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 d524b4c3ad light: fix parsing of command-line argument to -soft and -anglesense, when those are the last params 2016-05-27 15:43:24 -06:00
Eric Wasylishen 30673903ed light: refactor dirt*SetOnCmdline variables 2016-05-27 15:22:32 -06:00
Eric Wasylishen 35e92abfcf light: don't cast indirect light in phong/dirtdebug mode 2016-05-27 12:41:30 -06:00
Eric Wasylishen ca0f0448fe light: only allow one debug mode at a time 2016-05-27 12:25:51 -06:00
Eric Wasylishen 7687e4a927 light: fix normal interpolation outside the triangle when there are multiple choices of an edge to search across. 2016-05-21 20:29:17 -06:00
Eric Wasylishen e290d844bf light: only shadow-casting faces generate bounce lights 2016-05-20 13:34:30 -06:00
Eric Wasylishen 11ea23f6f2 light: don't delete litfile for -onlyents compile 2016-05-20 12:20:39 -06:00
Eric Wasylishen 55df37941c light: add -bouncecolorscale flag 2016-05-20 12:00:57 -06:00
Eric Wasylishen 4e69914cb2 light: skip dirt on bouncedebug 2016-05-20 02:18:14 -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 8db1f56a20 light: add Lightmap_ClearAll util function 2016-05-19 02:35:17 -06:00
Eric Wasylishen 2c73da0856 light: fix dirtmapping to use interpolated normals 2016-05-15 15:51:51 -06:00
Eric Wasylishen a5356c161c light: bounce: scale bounced light by texture color 2016-05-14 20:51:21 -06:00
Eric Wasylishen 199cba7349 light: few optimizations to bounce code 2016-05-13 23:16:36 -06:00
Eric Wasylishen f967b89cea light: remove broken hitpoint feature of TraceLine 2016-05-11 16:46:51 -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 1ed000cbde light: move DirtTrace to trace.c 2016-05-11 16:16:49 -06:00
Eric Wasylishen b1691cf10a light: don't do bounce lighting when dirtdebug/phongdebug are in use 2016-04-30 01:04:53 -06:00
Eric Wasylishen 5e7e409966 light: bounce: remove some dead code 2016-04-30 01:00:57 -06:00
Eric Wasylishen bd5a15fc82 Revert "light: bounce: handle 0 dist between bounce light and surface point"
This reverts commit d3b6adb955.
2016-04-30 00:59:51 -06:00
Eric Wasylishen d3b6adb955 light: bounce: handle 0 dist between bounce light and surface point 2016-04-30 00:44:01 -06:00
Eric Wasylishen f446ba1ddf light: bounce: use both bounce light normal angle, and receiving surface normal angle to scale bounced light 2016-04-30 00:26:08 -06:00
Eric Wasylishen a283a623ae light: bounce: refactoring 2016-04-30 00:24:50 -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 6ba2d99782 light: bounce: add some debug code 2016-04-29 22:52:33 -06:00
Eric Wasylishen bd68abad32 light: add LightWorld log header 2016-04-29 22:51:32 -06:00
Eric Wasylishen 99f6451741 light: bounce: don't generate bounce lights for "skip" texture 2016-04-29 22:43:42 -06:00
Eric Wasylishen ae082fccdb light: never generate lightmaps for "skip" texture 2016-04-29 22:43:12 -06:00
Eric Wasylishen b6fb5ecca2 light: fix bouncedebug 2016-04-29 21:21:47 -06:00
Eric Wasylishen afc43b0c55 light: make some functions non-static so they show up in profiling 2016-04-29 20:33:15 -06:00
Eric Wasylishen 83a5ef303d light: bounce: refactor light culling for speed 2016-04-29 18:43:57 -06:00
Eric Wasylishen 72c47c1b56 light: bounce: refactor a bit 2016-04-29 18:11:14 -06:00
Eric Wasylishen 6fe504760c light: don't compute regular lighting if we are doing -bouncedebug 2016-04-29 13:27:57 -06:00
Eric Wasylishen 9271a405d1 light: bounce: fix scaling of sunlight brightness 2016-04-29 13:06:40 -06:00
Eric Wasylishen ebf04ceb24 light: bounce: multithread MakeBounceLights 2016-04-29 11:40:10 -06:00
Eric Wasylishen 2bca34265c light: use vis acceleration for bounce lights 2016-04-29 11:27:02 -06:00
Eric Wasylishen 6459e53316 light: bounce: force a "gate" like cutoff for bounce lights 2016-04-28 23:18:49 -06:00
Eric Wasylishen 430c4b39b7 light: bounce: only scale by sending surface normal, not receiving.. seems to look better 2016-04-27 21:16:48 -06:00
Eric Wasylishen 713b92dcb5 light: preliminary bounce implementation 2016-04-27 19:19:29 -06:00
Eric Wasylishen 007696a734 light: fix face normal smoothing condition 2016-04-27 16:44:40 -06:00
Eric Wasylishen d426c8d9da light: some setup for bounced lighting 2016-04-26 15:14:22 -06:00
Eric Wasylishen e77c10d31d light: build polylib 2016-04-26 15:11:43 -06:00
Eric Wasylishen f65565ba62 light: don't do light behind plane test for curved surfaces. I broke lighting on pipes by changing this recently 2016-04-26 01:47:46 -06:00
Eric Wasylishen 11d7c4c44c light: fix build on travis 2016-04-26 01:13:42 -06:00
Eric Wasylishen a9ea9891bf light: calculate normals before correcting points, better results in concave areas 2016-04-26 01:10:15 -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 8c28413a31 light: obj export: only export model 0 2016-04-26 00:22:26 -06:00
Eric Wasylishen 239d9c14f2 light: fix vis acceleration on bmodels 2016-04-24 19:17:27 -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 b6116ff42a light: don't skip light-behind-plane test for phong shaded faces anymore 2016-04-23 00:26:07 -06:00
Eric Wasylishen 824c1b613c light: fix memory leak 2016-04-22 21:21:02 -06:00
Eric Wasylishen 5ac18e5c6f light: index some PVS info at startup 2016-04-22 20:11:59 -06:00
Eric Wasylishen 5000f9d352 light: only do sunlight raytracing in leafs that can see sky 2016-04-22 19:27:17 -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 3b7dbe42b0 light: fix broken vis optimization 2016-04-22 01:00:10 -06:00
Eric Wasylishen 169c89120a light: quick hack of 2nd sun. keys are "_sun2" "_sun2_mangle" "_sun2_color" 2016-04-21 01:05:48 -06:00
Eric Wasylishen 0a8965bae0 light: fix lighting with vis data 2016-04-21 00:22:35 -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 9cfb8c3fef light: make DecompressVis more robust 2016-04-20 14:53:33 -07:00
Eric Wasylishen 7ce9272f9d light: avoid c99 vla's, seems to be not supported on msvc 2016-04-20 01:53:06 -06:00
Eric Wasylishen e1bad1bbd6 light: rewrite normal interpolation 2016-04-20 01:39:42 -06:00
Eric Wasylishen 03df93851b light: phong shading: handle some sources of nan's 2016-04-19 19:33:49 -06:00
Eric Wasylishen 9560ba3901 light: speedup: don't calculate AO when using -phongdebug 2016-04-19 18:02:07 -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 b087f0f010 build: specify c99 2016-04-18 14:22:33 -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 32b48a443b light: track interior verts for normal interpolation (not used currently) 2016-04-14 15:13:01 -06:00
Eric Wasylishen 321eac8aaa light: make PrintFaceInfo non static 2016-04-12 01:07:37 -06:00
Eric Wasylishen c6d8aff03b light: guard against acos returning nan due to fp error in CalcualateVertexNormals 2016-04-11 01:49:02 -06:00
Eric Wasylishen ed6dfbaf76 light: disable obj exporter 2016-04-11 01:14:54 -06:00
Eric Wasylishen f2d33137ef light: PrintFaceInfo: also print the interpolated normals 2016-04-11 00:59:01 -06:00
Eric Wasylishen c86731ab58 light: make TriangleArea non static 2016-04-11 00:47:21 -06:00
Eric Wasylishen 8228bf979f light: obj exporter 2016-04-11 00:46:42 -06:00
Eric Wasylishen 37d0d14ccd light: fix phong shading debug code 2016-04-10 23:07:13 -06:00
Eric Wasylishen cf8e3fc935 light: augment DirtTrace with the hit plane 2016-04-10 22:30:42 -06:00
Eric Wasylishen ddbf55ac13 light: skip casting lights if -phongdebug or -dirtdebug are in use, gives a big speedup for those flags 2016-04-10 19:52:01 -06:00
Eric Wasylishen e395a755ab light: CalcPoint: correct point before interpolating normal 2016-04-10 19:42:24 -06:00
Eric Wasylishen 4207054709 light: avoid crash if no textures in bsp 2016-04-10 19:34:57 -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 9e2d54a9af light: handle bsp's with no textures 2016-04-10 15:39:49 -07:00
Eric Wasylishen f2a57d5b71 build: remove remaining embree stuff 2016-04-10 15:49:01 -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 4e34c48476 build: package embree license 2016-04-09 23:14:43 -06:00
Eric Wasylishen 5b2529ebd4 light: fix lighting on rotators, at least to the extent it was working before 2016-04-08 00:42:15 -06:00
Eric Wasylishen 7215b669f2 light: new CalcPoints implementation 2016-04-07 23:26:46 -06:00
Eric Wasylishen c135ab6b2b light: error if bsp->nummodels == 0 2016-04-07 23:26:23 -06:00
Eric Wasylishen e6f58ece0c Revert "light: phong shading: also weight by face area. this avoids cubes with rounded edges turning completely into blobs"
This reverts commit bbc95a1364.
2016-04-07 22:20:24 -06:00
Eric Wasylishen ecfa3c3e12 light: enable -parse_escape_sequences by default 2016-04-07 21:47:26 -06:00
Eric Wasylishen 82ff1dbd06 light: don't save lightmaps for "trigger" texture 2016-04-07 21:39:23 -06:00
Eric Wasylishen 96a8dc8c3d light: disable "Failed to calculate normal for vertex" warning because it was not really an error and causing spam
qbsp T-Juncs generate lots of colinear vertices I think?
2016-04-07 21:16:54 -06:00
Eric Wasylishen ab9be6bbf2 light: refactoring 2016-04-07 13:16:21 -06:00
Eric Wasylishen 0733499da5 light: fix for black corners on dirttest.map (test map from lunaran) 2016-04-06 22:38:09 -06:00
Eric Wasylishen 6fcf04a298 light: revert to older CalcPoints (push off hit normal) to fix artifacts in testlightonface.map 2016-04-06 19:15:19 -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 bbc95a1364 light: phong shading: also weight by face area. this avoids cubes with rounded edges turning completely into blobs 2016-04-05 15:00:12 -06:00
Eric Wasylishen a407b971bc light: rework LightFace_Entity to fully fix testlightonface.map 2016-04-05 12:52:44 -06:00
Eric Wasylishen aed29da060 light: tweak embree settings to fix "fireflies" 2016-04-05 12:27:51 -06:00
Eric Wasylishen 163b599900 light: tweak angle test for testlightonface.map. 2016-04-05 00:58:05 -06:00
Eric Wasylishen 47e7a981f6 light: get rid of unneeded unordered_set 2016-04-05 00:13:29 -06:00
Eric Wasylishen f315366f43 light: hack to fix lights exactly on faces 2016-04-04 23:58:12 -06:00
Eric Wasylishen 33ee7e35f7 light: delete .lit file before starting 2016-04-03 18:25:30 -06:00
Eric Wasylishen d53e67bf8a light: copy embree DLL's 2016-03-30 15:26:36 -07:00
Eric Wasylishen e11e9d5c1f light: embree support 2016-03-30 14:58:21 -06:00
Eric Wasylishen 34858ed243 light: fix sunlight + phong shading 2016-03-05 23:56:28 -07: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 1a48e5a24a light: fix issue with CalcPoints trace hitting a corner, spuriously setting tr.hitback, and returning the wrong hitpoint 2016-03-05 00:57:47 -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 72d7ce4231 light: handle degenerate triangles when smoothing normals 2016-03-03 12:38:03 -07:00
Eric Wasylishen d66857b5a0 light: try fixing cmake msvc build 2016-03-03 11:14:14 -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 3056971ae6 light: fix issue with lights within 1 unit of a face not casting light on that face
fixes https://github.com/ericwa/tyrutils-ericw/issues/10
2016-02-25 23:02:43 -07:00
Eric Wasylishen 48830f2b1a light: revert CalcPoints changes as it was causing light leaking in jam2_mfx
(points on the top edge of a face were crossing a wall, but ended up in the open so they were accepted as OK)
2016-02-25 15:34:07 -07:00
Eric Wasylishen ceec7b16c7 light: optimize TraceFaces 2016-02-22 22:11:12 -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 942c87a98b light: fix phong shading for sunlight 2016-02-16 19:16:42 -07:00
Eric Wasylishen ae04899ce5 light: make CalcPointNormal more robust; don't use micro-triangles (<1 unit area) for interpolating normals 2016-02-16 19:09:43 -07:00
Eric Wasylishen 465cb2a555 light: avoid NaN's due to rounding error when calculating angles for weighting normals 2016-02-15 20:28:05 -07:00
Eric Wasylishen 1fd1637de1 light: add -phongdebug option 2016-02-15 20:27:03 -07:00
Eric Wasylishen fdc1f25276 light: add phong shading debug function 2016-02-15 17:59:05 -07:00
Eric Wasylishen a515a13107 Lightmap_ForStyle: change back to taking a const lightsurf_t* 2016-02-15 16:20:29 -07:00
Eric Wasylishen 537937f0eb Lightmap_Soften: remove stack allocation 2016-02-15 16:20:29 -07:00
Eric Wasylishen e896f3126b entities.c: make SetWorldKeyValue / WorldKeyValue safer 2016-02-15 16:20:29 -07:00
Eric Wasylishen b0777c2075 suppress compile warnings 2016-02-15 16:20:29 -07:00
Eric Wasylishen b2687481d6 WriteLightmaps: revert to how I was getting the sample points 2016-02-15 16:20:29 -07:00
Eric Wasylishen 7128a8e956 code formatting, normalize most whitespace to 4 spaces 2016-02-15 16:20:29 -07:00
Eric Wasylishen 1f05b7976a fix wrong FindTexinfo call
fix Lightmap_ForStyle call
change M_PI to Q_PI
switch to Q_strncasecmp
2016-02-15 16:18:51 -07:00
Eric Wasylishen 1630b8756e tyrutils-ericw-spike rebased on to 998c9d3acb 2016-02-15 16:16:37 -07:00
Eric Wasylishen 9496991e60 LightFace_Min: allow delay 4 lights to use lightstyles 2016-02-14 20:45:56 -07:00
Eric Wasylishen 651e7ca827 CalcPoints: if NearWall() fails, first try fudging by 0.25 units in each direction 2016-02-11 23:30:21 -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 7a5c7bbf6b light: cleanup _sunlight3 code, support _sunlight3 without _sunlight2 properly 2015-12-10 14:58:49 -07:00
Eric Wasylishen 99d5a4d4f9 build: setup CPack to package binaries in a zip file 2015-12-09 16:23:36 -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 fe65004f17 light: test out _sunlight3 2015-12-05 21:40:15 -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 b3472d89e7 light: fix antilights which were broken with the light culling change 2015-11-07 11:58:07 -07:00
Eric Wasylishen 8e18933f5d light: silence "no model has face" warning 2015-10-25 23:41:19 -06: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 7f1beca6b4 light: add "_surface_spotlight" key for making surface lights into spotlights based on the surface normal 2015-10-25 22:35:29 -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 69fab3fc96 light: clean up SetupSkyDome 2015-10-23 18:31:39 -06:00
Eric Wasylishen c0d61d4147 light: cull light bounding sphere against surface bounding sphere before checking each surface point. gives a modest speedup. 2015-10-23 15:10:35 -06:00
Eric Wasylishen 244243b121 light: fix "-gate" (was calculating too-large bounding spheres for delay 2 lights.) 2015-10-23 01:36:16 -06:00
Eric Wasylishen d4d63efd87 light/trace.c: Adjust the trace algorithm to match that in q3map.
Fixes some weird artifacts I noticed when experimenting with lava surface lights in jam6_ericwtronyn.map
2015-09-25 00:13:25 -06:00
Eric Wasylishen 532704f54e light: fix duplicate surface lights being generated 2015-09-14 22:16:53 -06:00
Eric Wasylishen 1cf7af0c17 light: remove unused FaceArea function 2015-09-12 19:07:58 -06:00
Eric Wasylishen 8e29319309 light: avoid doing the trace twice when there is no obstruction 2015-09-12 18:53:56 -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 b345dccfe7 light: disable deviance if samples <= 1 or deviance <= 0. 2015-08-14 14:28:53 -06:00
Eric Wasylishen 79d1871e56 light: document -surflight_subdivide key 2015-08-10 10:04:25 -06:00
Eric Wasylishen 72a5885437 light: fix crash in "Bad texture axes on face:" error. Print more detailed face info. 2015-08-09 12:27:55 -06:00
Eric Wasylishen 18dce775dd light: fix lighting of rotatating entities (hiprotate). the model offset was not being used correctly.
todo: the trace code needs to take the model offset into account too, so shadow casting and self-shadowing are broken for hiprotate.
2015-08-08 21:37:58 -06:00
Eric Wasylishen b68ba8c983 light: average the color to get the value to write to the .bsp lightmap.
This avoids issues with some engines that require the lit and internal lightmap to have the same intensity. (MarkV, some QW engines).
Previously, if you used low-value colors (e.g. "0.2 0 0"), the .bsp lightmap and .lit file could have vastly different brightness.
2015-08-05 13:47:04 -06:00
Eric Wasylishen bc0e1778dc light: allow negative surface offsets for niche use 2015-08-05 12:10:17 -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 6004e1b94c light: log total number of lights including generated ones 2015-08-05 12:08:55 -06:00
Eric Wasylishen f24b1a1101 light: update usage text 2015-07-13 15:07:46 -06:00
Eric Wasylishen a56dad56c2 light: add logprint for "_anglescale"/"_anglesense" worldspawn key (to control angle sensitivity of sunlight) 2015-07-13 14:33:21 -06:00
Eric Wasylishen e9f240b623 light: .lux file support from Spike 2015-07-09 16:34:12 -06:00
Eric Wasylishen a219d3e0a0 light: WriteEntitiesToString: add explanation from Spike 2015-07-09 16:34:06 -06:00
Eric Wasylishen 6ca1c6957a light: fence texture tracing: fix handling of negative texture coords 2015-07-09 16:33:44 -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 4105bc505f light: optimization: avoid unnecessary memsets, from spike 2015-06-01 23:14:19 -06:00
Eric Wasylishen e0d3f872ff light: rewrite part of WriteLightmaps for more readable code 2015-05-31 12:27:40 -06:00
Eric Wasylishen c39971bb94 light: rename -dirty flag to -dirt for consistency 2015-05-19 12:11:17 -06:00
Eric Wasylishen ab78c07320 light: make fence texture tracing opt-in 2015-05-16 23:33:39 -06:00
Eric Wasylishen 1996bce56d light: support switchable lights with any light* classname, not just "light" 2015-05-15 09:54:19 -06:00
Eric Wasylishen 8bde00a732 light: ensure "_surface" value is case-insensitive 2015-05-14 17:42:26 -06:00
Eric Wasylishen 3a109ac84d build: split up cmake build system into subprojects.
-DDOUBLEVEC_T now correctly used for qbsp only.
2015-05-05 12:34:39 -06:00
Eric Wasylishen 86d3aa990d light: remove "Jittering" debug message 2015-05-04 14:13:18 -06:00
Eric Wasylishen 0a6d3f4167 light: fix hang when using _deviance, make _samples default to 16 when _deviance is set. 2015-05-01 02:17:29 -06:00
Eric Wasylishen d2840f4cba light: fix for always generating a .lit file when surface lights are used 2015-04-30 14:54:23 -06:00
Eric Wasylishen 54e7c2ab8e light: fence texture tracing 2015-04-27 00:26:42 -06:00
Eric Wasylishen a33c4b0136 light: surface light support via "_surface" "texturename" light key 2015-04-26 02:24:57 -06:00
Eric Wasylishen 59bb786880 light: remove unused bsp_origin constant 2015-04-25 21:18:28 -06:00
Eric Wasylishen aa5dfa8b19 light: respect "_dirt" "-1" bmodel key in -dirtdebug mode 2015-04-25 20:46:05 -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
Eric Wasylishen 2d5ea4fe73 light: accept _sunlight_mangle as an alternative for _sun_mangle 2015-03-27 00:35:28 -06:00
Eric Wasylishen 2cd885729a light: MatchTargets: disable copying 'style' key/value to the targeting entity. Don't see any reason why that would be done. 2015-03-27 00:33:32 -06:00
Eric Wasylishen c51326e8b0 trace.c: Undo part of cc36d8e that flipped the signs of ON_EPSILON for one of the checks in the TraceLine.
This fixes cracks in sunlight shadows spotted by Lunaran, and greatly improves the AO quality
2015-02-05 11:36:59 -07:00
Eric Wasylishen 11678eaa74 trace.c: fix bug in determining hitpoint->point 2015-02-05 11:35:15 -07:00
Eric Wasylishen 24c6b9524a _color support: support values in the range 0-1 by automatically scaling them to 0-255 2015-02-05 11:33:21 -07:00
Eric Wasylishen 4df394f9fe light: Increase precision of lightmap extents calculations
This bug is a counterpart to this bug in quakespasm:
   https://sourceforge.net/p/quakespasm/patches/15/

If the precision of the calculation in WorldToTexCoord done by ‘light’
is significantly different than the precision of the same calculation
in the engine, you can get corrupted lightmaps. The problem affects
light when it’s built as something other than vanilla 32-bit
x86. (e.g. x86_64 on a mac).

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2014-06-30 12:58:30 +09:30
Kevin Shanahan d68748d1d8 light: fix minlight clamping for coloured lights
Colours need to be scaled correctly by the light intensity.
Thanks to Mechtech for reporting this issue.

Reported-by: Paul R <automan1001@yahoo.com>
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2014-02-15 18:56:44 +10: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 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 1612d60a5f light: keep debug helper for dumping face info
Used this to help with debugging, but may as well keep it around for
future debugging rather than implement it all over again next time.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-08-18 16:52:19 +09:30
Kevin Shanahan 23591535b4 light: show face area for bad texture axis error
Often these errors are caused by super small faces on brushes, show the
area of the offending face to make it more obvious if that is the case.
Kind of lost in the diff, but moved the TriArea, etc. functions up and
added FaceArea() and then augmented the error message.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-08-03 16:47:15 +09:30
Kevin Shanahan c94414f288 light: allocate one extra lightmap to simplify handling overflow
Rather than allocating the overflow map within each function and
having to handle it as a special case in each, we always allocate the
extra lightmap in the base LightFace function and use common helper
functions to handle allocation and warning on overflow.

We lose a tiny bit of debugging info here about the specific light
that made the surface overflow MAXLIGHTSTYLES, but that never gave us
all the sources, only the last one encountered.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-07-10 13:47:58 +09:30
Kevin Shanahan 35bf3f4232 light: factor out adding and clamping of light samples
Simple functions, but just helps to tidy up the bodies of the other
LightFace functions and makes sure we're handling light & colours
consistently across each (we weren't in the case of coloured local
minlights, previously).

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-07-08 15:42:50 +09:30
Kevin Shanahan e09c1f8e2a light: rename FixMinLight -> LightFace_Min
Move away from the "Fix" naming ~ it's not a fix, we're applying the
minimum lighting values as requested.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-07-08 13:30:38 +09:30
Kevin Shanahan 23f8f1a35e light: unify allocation of new face light styles
Factor out the allocation of new light styles - slightly increases the
code size, but we get two benefits; first is that we now don't
allocate the style 0 lightmap unless we actually need it; second, we
get warnings if sunlight or minlight is unable to be applied due to
lack of a style 0 lightmap.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-07-04 14:29:47 +09:30
Kevin Shanahan f498ed5ec3 light: pass the sun direction vector into LightFace_Sky
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-07-03 16:32:03 +09:30
Kevin Shanahan ca78568cae light: rename SkyLightFace -> LightFace_Sky
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-07-03 14:55:56 +09:30
Kevin Shanahan 7abfeb35da light: rename SingleLightFace -> LightFace_Entity
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-07-03 14:54:21 +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 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 5082e3ffaa light: reduce "no model has face" to a warning
Since the newskip.exe tool leaves the faces in the bsp but removes
references, we will just skip over lighting such faces.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-22 13:11:22 +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 022b927d79 trivial: fix typo in error message
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-19 15:08:55 +09:30
Kevin Shanahan 4275149cee light: improve "bad surface extents" error info
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-19 14:59:35 +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 c193c18d5b make -gate affect linear falloff lights as well
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-06 13:25:11 +10:30
Kevin Shanahan ee2dc38f71 light: make command line set sun anglescale as well
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-06 08:35:38 +10: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 b4ff9663cc build: add ability to compile for WIN64 using MinGW64
Fix a few minor int<->pointer size warnings.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-15 21:49:16 +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 31484a8bcd light: remove comment about removing texmins, etc. from surfinfo_t
A relatively small amount of state to keep, just leave it there rather
than inventing any more types to pass around. Now that lightmap_t,
surfinfo_t & texorg_t are separate, I'm less concerned.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-13 11:59:48 +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 46277eec41 light: fix -nominlimit option causing extra bright lighting
This option has been broken for a while, because we only dealt with
positive vs. negative colours and didn't properly handle the light
intensity.

All this messing around to try and correctly handle negative colors
seems just stupid. I might have to remove support for that in
future... is there really any good use for it?

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-10 17:07:14 +10:30
Kevin Shanahan f2395a3dd3 light: re-arrange lightdata_t structure into array of lightmap_t
More messing with data structures. Now a single sample has a
brightness and colour component and a lightmap structure captures all
the non-surface lightmap data.

The pointer arithmetic for iterating over the supersamples in
WriteLightmaps is perhaps a little silly, but it works well enough. It
might be smarter to generate the sample points in a different order
instead. Maybe later.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-10 15:45:06 +10:30
Kevin Shanahan f7e76f16b6 light: factor out writing light data from LightFace
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-10 09:37:33 +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 5dce6ccc30 light: factor out init of lightsurf and lightdata
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-09 19:04:44 +10:30
Kevin Shanahan a919ad08bc light: split lightinfo_t into surface information and lightmap data
A lot of churn for a small gain, but now the surface information is
separate from the lightmap data. And we can pass the surface
information around via a const pointer.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-09 17:34:31 +10:30
Kevin Shanahan ea440c6da0 light: factor out WorldToTexCoord as a serparte function
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-09 16:36:57 +10:30
Kevin Shanahan 63393eee8e light: define a plane_t structure and use for lightinfo_t
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-09 15:58:26 +10:30
Kevin Shanahan fda3b230f9 light: lightinfo_t structure cleanup, part 1
The big lightinfo_t structure includes a lot of things that are only
loosely related and not used together. Start the cleanup by pulling
out the texture coordinate tranformation data that is used to generate
the surface sample points.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-09 15:38:52 +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 dc39137874 light: make shadow bmodels block sunlight too
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-08 13:47:20 +10:30
Kevin Shanahan feda78b4a3 light: compile fix
Incomplete commit for bmodel shadows change.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-08 13:28:50 +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 b7c2fd437f light: replace last CastRay user with TestLine and remove
We never made use of the length argument returned.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-08 09:14:02 +10:30
Kevin Shanahan 2964d31016 light: fix truncated light values due to integer division
Since minlight is an integer, need to either cast to float or ensure
promotion by writing the 255 constants as 255.0f. Not all of these are
needed, but just be consistent across the code.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-07 18:25:00 +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 e734671b03 light: remove unneeded faceoffset argument from {Single,Sky}LightFace
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-07 16:21:42 +10:30
Kevin Shanahan 44a0bd3660 light: pass minlight/colour values into FixMinlight
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-07 16:13:43 +10:30
Kevin Shanahan 34050c2bd9 light: replace faceoffset with modeloffset
Not much point worrying about the offset of each face when it's only
per-model. This sets us up for using other per-model info...

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-07 15:47:30 +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 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 310e28e12a light: use uintptr_t for aligning light data in memory
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-03 12:32:32 +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 453fd7fe31 light: better variable names in WriteLitFile
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-02 11:27:47 +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 54a5890217 light: lift light entity field checks into separate function
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-02-27 21:13:53 +10:30
Kevin Shanahan 854c7b4bb9 light: trivial variable rename
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-02-27 21:13:12 +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 22ca3262f0 light: remove alloc argument to LightStyleForTargetname()
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-02-27 15:59:03 +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 8d4bbbe3dc light: use the common threads progress indicator
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-02-07 21:12:53 +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 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 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
Kevin Shanahan 6fab0a5358 light: make pthreads support work
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2012-12-20 20:14:39 +10:30
Tyrann ad964e7f28 trivial: remove some redundant assignments and unused variables 2012-01-06 21:34:47 +10:30
Tyrann bcb8e0990d [PATCH] light: increase MAX_TSTACK
Managed to hit this limitation recently, so bump it up.

Signed-off-by: Tyrann <tyrann@disenchant.net>
2008-01-19 21:21:20 +10:30
Tyrann 8a7304a54d [PATCH] TyrUtils v0.4
Quick release to fix the ongoing saga that is my crappy .lit coloured lighting
support. I really did test it this time...

I bumped the qbsp version as well, just to track the utils "package" version.

Signed-off-by: Tyrann <tyrann@disenchant.net>
2007-09-25 11:18:00 +09:30
Tyrann a97a880bd0 [PATCH] light: fix alignment (again) on lit data
I really should do more testing before I embarress myself by releasing stuff
so obviously broken. Use the right pointer to align lit_filebase against.

Signed-off-by: Tyrann <tyrann@disenchant.net>
2007-09-25 06:32:10 +09:30
Tyrann 20008a120a [PATCH] light: update version number
Signed-off-by: Tyrann <tyrann@disenchant.net>
2007-09-23 16:54:59 +09:30
Tyrann 9209eec0a1 [PATCH] light: Fix litfile memory allocation
Gah! Brown paper bag material here. Memory for the Lit data was never getting
allocated and writes were happening in no man's land off the end of the
lightdata area.

Signed-off-by: Tyrann <tyrann@disenchant.net>
2007-09-23 16:46:22 +09:30
Tyrann 2c2f3c8eb6 Import initial sources 2006-08-28 23:58:10 +09:30