Commit Graph

276 Commits

Author SHA1 Message Date
Jonathan 3ee28fc416 fix crash in light from bounce lighting storage
move bounce lights to a forwardly linked list
fix minlight affecting style 0 for switchables
2022-07-29 00:41:24 -04:00
Jonathan 1d8a0c1df3 clang-format pass 2022-07-28 06:14:54 -04:00
Jonathan da9546e260 change settings semantics to be simpler and more clear:
- no more "isLocked" - use getSource directly (locked is a confusing name)
- no more split parse/setValue functions. there's only one entry point each now, and all they do is pass along the source passed to it from its parser.
- no separate setters, use setValue(value, source)
- add a "game target" source, which is low priority and indicates to the user that the value would have been default but was changed to a better value for the game target
2022-07-14 09:03:59 -04:00
Eric Wasylishen d32d6ea81d light: rename options -> light_options 2022-07-10 17:28:28 -06:00
Jonathan 773d20052c write out style numbers to verbose 2022-07-09 01:36:26 -04:00
Jonathan 30bd8467c3 fix wrong boolean used for warning 2022-07-09 01:36:26 -04:00
Jonathan 56e1e2dde0 adjust lightstyle overrun warnings to be less annoying
fix potential overrun in lightstyle writing
2022-07-09 01:36:26 -04:00
Jonathan adc54dac61 fix bug with output of lmstyle/lmoffset lumps
bspinfo will output proper atlasses now
use faceextents_t everywhere
2022-07-08 02:06:07 -04:00
Jonathan 43c5e942b2 move faceextents_t & friends to common
use stb_image_write for PNGs for better compression on bsp.json
add in code for spitting out a lightmap from a face. doesn't support other styles and such yet.
2022-07-08 02:06:06 -04:00
Jonathan 705ab73169 rename light option `lmscale` to `lightmap_scale` to reflect its qbsp usage (a forced replacement of the "default" lightmap scale)
allow qbsp to be passed an `-lmscale` to facilitate a global lmscale change for BSPX
fix code paths for writing both lightmap sizes out

# Conflicts:
#	include/qbsp/qbsp.hh
2022-07-08 02:06:06 -04:00
Jonathan 14455e97e6 fix for Q2 phong values not applying properly
(cherry picked from commit 0d76e62846)
2022-07-06 19:33:07 -04:00
Jonathan f4854ddb20 simplify minlight stuff
adjust scalar for surface lights so they are visible without bounce
2022-07-04 22:43:07 -04:00
Jonathan 0483db5c55 remove sky visibility stuff; not necessary with the approx methods
show sky hits in light points stats
merge surface light stuff (minlight, etc)
default surface lights with radiosity to spotlight, to match Q2

(cherry picked from commit defa4cafce)
2022-07-04 20:47:06 -04:00
Jonathan 0bcd92300a bounce lighting fix
change defaults for Q2 to look a bit closer to how it looked before

(cherry picked from commit b8bb4cdd2a)
2022-07-03 14:21:25 -04:00
Jonathan f089c5d145 fix bounced lighting
(cherry picked from commit 0baa788d7e)
2022-07-03 14:21:25 -04:00
Jonathan cc16b886a4 move "points" instead of copying
pre-offset points
remove double calculation for pos/dir in lightface (didn't seem to have any visual effect on the output)
2022-07-02 08:49:34 -04:00
Jonathan 033a84cac8 cache anything related to triangle-face info in a single struct that we access per ray 2022-06-25 22:22:24 -04:00
Jonathan b4583908af slight speed improvement; these weren't inlining properly, they do now though 2022-06-25 04:20:24 -04:00
Jonathan 90c08ca1da move bounce lighting into a post-processing operation and split LightFace into Direct and Indirect 2022-06-24 04:33:08 -04:00
Jonathan c7169e11ee split LightFace into three distinct phases: Create, Light, and Save 2022-06-24 02:54:41 -04:00
Jonathan 1d21a33a3b use a thread local static for `LightFace_CalculateDirt` so it's not continuously allocating/deallocating 2022-06-23 01:47:28 -04:00
Jonathan e2c8594450 simplify sample stuff
don't clear lightmap if we haven't written to it yet
2022-06-23 01:25:01 -04:00
Jonathan eb50be92f8 use "resize" function to circumvent weird crashing issue 2022-06-22 22:55:05 -04:00
Jonathan 1d221d3999 only use Embree stuff 2022-06-22 22:23:48 -04:00
Jonathan cb3ef7b19f allow radlights to specify an entity dictionary instead (if the input is a .ent, it is an entity dict) which is more flexible 2022-06-22 17:03:00 -04:00
Jonathan 210d994445 cherry pick commit 96cd23761c from @Shpoike
Removed legacy switchable lightstyles limit (requires updated engines when exceeded). Added -facestyles argument that allows for >4 styles per face, as well as potentially increasing style indexes to 16bit for far far more switchable styles.
2022-06-21 15:35:39 -04:00
Jonathan 72914b4724 moving more raw pointers to vectors/smart pointers
support for radiosity _surface lights with `_surface_radiosity` key
allow lightstyles for _surface radiosity lights
bounce enabled by default on Q2
remove ValueForKey, use epairs directly
2022-06-21 13:41:51 -04:00
Jonathan c79e263753 simplify bspx code
remove old obj preview for wrnormals
2022-06-20 20:42:34 -04:00
Jonathan 51f2bc1ff0 fix visapprox rays crashing
fix visapprox rays to work with surface lights; it's slower than vis but it at least works now
2022-06-19 12:09:12 -04:00
Jonathan e366898796 re-introduce vis culling, mainly for Q2/surface lit maps
-novisapprox gone; replaced with -visapprox auto|none|vis|rays
2022-06-18 23:56:45 -04:00
Jonathan 41ef66190f consistency rename; gtexinfo_t -> mtexinfo_t 2022-06-16 09:36:31 -04:00
Jonathan 42c4060a64 canonize plane stuff into an enum type, remove duplicates
more macros into constexpr's
use options.epsilon directly instead of ON_EPSILON in qbsp
2022-06-10 04:43:56 -04:00
Eric Wasylishen 3d8da90eec Merge branch 'type-cleanup' of https://github.com/Paril/ericw-tools into type-cleanup 2022-06-02 20:58:06 -06:00
Eric Wasylishen 5488f47eda light: GetDirectLighting: fix wrong order in surfpointToLightDist calculation 2022-06-02 20:58:03 -06:00
Jonathan a824b9436c hardcode omnidirectional surface lights - seems closer to Q2's defaults
hardcode dot of 1.0 for surface lights
halve bounce data since the former changes blow out lighting a bit
2022-06-02 22:12:31 -04:00
Jonathan 464b87f095 remove a debugbreak
"fix" broken q2 maps
2022-06-02 10:23:39 -04:00
Jonathan 11f937f0ad add mottling that was used for _minlight on objects in Q2 maps
fix _minlight for Q2
set up a few better defaults for Q2
temp-ish fix for areaportals
2022-06-02 01:05:41 -04:00
Eric Wasylishen 4042f1c7b9 light: fix compile after previous change 2022-05-09 23:27:33 -06:00
Jonathan cc0e1a5561 move Face_IsLightmapped to light
Fix q2rtx, needs to include lightstyle for nodraw for emissive invisibles with lightstyles
fix wal (for the 900th time)
auto-set -nolighting for -q2rtx
2022-04-30 23:27:21 -04:00
Jonathan c81e9ace28 remove old threading code entirely
add new parallel logging stuff in common/parallel which wraps parallel_for(_each) and provides automatic percentage indicator
fix issue with light not pulling in settings
move logging stuff into its own namespace and simplify
2022-03-01 10:28:59 -05:00
Jonathan df92d9ce12
Command line args systems (#2)
* cmd

* cmake change for tbb DLLs
add in test for double-hyphens

* cmd

* game version

* settings!

* bsp texture usage
decompile fix for q1bsp

* finish up the options for qbsp

* light finished?

* finish up the few missing bits

* move scalar/int32 up

* Run clang-format pass

* natvis for our mathlib
use slightly faster storage for winding
fix light tests

* allow dictionary to be a base type

* re-run style

* Remove cfg_static
Fix options summary

* natvis for lockable_value<T>

* last-ish pass?

* format

* forgot last few lockables
2022-02-27 00:01:57 -05:00
Jonathan 0c827208ec Allow `-subdivide 0` to turn off subdivision
imglib now lives in common
fs 'load' split into two functions, where and load. the former allows you to query for and return archive & path for a given file, whereas the latter handles that for you.
use log verbose in light rather than own verbose flag
2021-11-21 15:08:02 -05:00
Jonathan 0e361f9323 Support for Q2BSP decompilation
- there's still a couple failure cases - specifically base1 in the outdoor area has a side that wasn't able to match to a face
- the clip brush at the start of base1 gets cut into a bunch of pieces because of the whole "check for texinfo, compare and split into multiple pieces" thing, but I'm pretty sure it's just one single brush - we need to ignore the splitting thing on clip brushes since they don't care about texture
- triggers don't pull in a temp texture
- origin brushes?
2021-10-27 17:56:56 -04:00
Jonathan e0ed70cc87 no more Vector! 2021-10-25 10:38:15 -04:00
Jonathan e1695ebfd3 VectorAdd & simplify TexDef_BSPToBrushPrimitives (needs testing) 2021-10-25 08:39:29 -04:00
Jonathan 38a4f66bef Move this to header since we may need it soon 2021-10-24 17:11:35 -04:00
Jonathan d0e557b9cb Fix BSPX on q2bsp
Fix normalize generating NaNs to match old behavior of generating zero on zero length
Remove extended texinfo file before potentially not writing new one
2021-10-24 06:56:31 -04:00
Jonathan 3c2ca93b0c normalizeInPlace no longer nodiscard since you might want to only normalize the ref
remove VectorNormalize
2021-10-23 13:34:12 -04:00
Jonathan fae69309a0 VectorLength 2021-10-23 13:24:25 -04:00
Jonathan 4dca2d7d07 VectorInverse, VectorSet, VectorClear gone 2021-10-23 13:15:38 -04:00