Commit Graph

1399 Commits

Author SHA1 Message Date
Eric Wasylishen 284e5f1dec light: remove some Q_asserts on hot path 2023-02-07 00:26:37 -07:00
Eric Wasylishen 74f149627a light: finish implementing lightgrid_samples_t::add() to use lowest brightness slot 2023-02-05 21:52:25 -07:00
Eric Wasylishen 2cc513848b light: write styles into the experimental lightgrid lump 2023-02-05 17:16:57 -07:00
Eric Wasylishen 999806f150 light: experimenting with generating a lightgrid
currently a hardcoded 64^3 grid in a LIGHTGRID bspx lump
non-finalized, likely going to change the lump
2023-02-03 01:17:52 -07:00
Eric Wasylishen 13481438e7 light: use DecompressAllVis() for getting visdata 2023-01-30 19:57:20 -07:00
Eric Wasylishen f0852092ac bsputils: prototype DecompressAllVis 2023-01-30 19:56:46 -07:00
Eric Wasylishen 8f49cf3894 refactor: Mod_Q1BSP_DecompressVis -> DecompressVis 2023-01-30 19:56:40 -07:00
Eric Wasylishen 912dd0cdeb vis: migrate CalcPHS from DecompressRow to Mod_Q1BSP_DecompressVis 2023-01-30 19:56:37 -07:00
Eric Wasylishen e490eb3ade refactor: move Mod_Q1BSP_DecompressVis to bsputils.cc 2023-01-30 19:56:34 -07:00
Eric Wasylishen 85e394a0ea light: cleanup unused function declarations 2023-01-30 19:56:15 -07:00
Eric Wasylishen 302d600f4c qbsp: strip _tb_ keys, convert __TB_empty to skip 2023-01-30 00:28:31 -07:00
Eric Wasylishen 9edad10b0f common: add convenience version of EntData_Parse 2023-01-30 00:08:45 -07:00
Eric Wasylishen 91c678254a light: tweaks to _cone support in q2 2023-01-08 19:57:25 -07:00
Jonathan df5f894726 fix _cone in Q2 2023-01-08 20:03:06 -05:00
Eric Wasylishen a9a11159f4 light: add _surface_minlight_scale light key
for tweaking minlight given to faces matching surface light templates.

minlight = _surface_minlight_scale * light

lower default from 64 to 1 in q1 mode
2022-12-30 23:06:28 -07:00
Eric Wasylishen fe5ce3765a test: add a few more area-related assertions 2022-12-21 20:56:18 -07:00
Eric Wasylishen 8f79f6a972 vis: rename portal_t -> visportal_t
fixes symbol collision causing crashes on macOS
2022-12-21 01:03:03 -07:00
Eric Wasylishen 3d0c756b4f light: fix minlight color on surface lights
- extra `* 255` was unnecessary, setting_color already does this
- don't use qvec3b as it was causing colors to wrap around the 0..255 range
2022-12-20 23:44:21 -07:00
Eric Wasylishen f652af9c7d bsputils: add .lit loader 2022-12-20 22:46:20 -07:00
Eric Wasylishen 35fe26b7a6 qbsp: fix FindTargetEntity (was breaking hiprotate) 2022-12-19 00:55:20 -07:00
Jonathan d5e29a1c90 add _nofill key, which causes an entity to not count as an entity for the purposes of occupancy (for lights in walls, etc)
add _nonudge key, to disabling nudging of lights "stuck" inside walls
2022-12-15 04:30:22 -05:00
Eric Wasylishen 82aa1e4396 light: make "_light_alpha 0" behave as expected (invisible to light) 2022-12-14 21:46:36 -07:00
Eric Wasylishen 8aa49699f8 light: rename channel mask keys
models:
_object_channel_mask

lights:
_light_channel_mask
_shadow_channel_mask
2022-12-13 23:20:27 -07:00
Eric Wasylishen 92d5c75424 light: experimental light channel mask feature 2022-12-13 19:13:58 -07:00
Eric Wasylishen 54e598c5fb light: clean up dead code 2022-12-12 18:02:33 -07:00
Eric Wasylishen 63cac32f88 light: quick experiment with a _light_group feature for lights that only affect linked bmodels 2022-12-11 15:36:08 -07:00
Eric Wasylishen 331dbfc20d vis: refactor output_group and advanced_group to avoid name clash with light 2022-12-08 21:32:39 -07:00
Eric Wasylishen 2ff9eda020 vis: refactor winding_t -> viswinding_t 2022-12-08 21:29:22 -07:00
Eric Wasylishen 642c4b589c tests: add vis_main() taking std::vector 2022-12-08 21:27:37 -07:00
Eric Wasylishen a70c8f4835 light: fix artifacting with translucent shadows
Embree is allowed to call the filter function more than necessary.
The previous implementation had side effects that would cause
the translucent shadows to get darker in this case.

As a limitation, we're back to only allowing 1 layer of glass per ray.
2022-12-07 00:23:26 -07:00
Eric Wasylishen 185d12996b Merge branch 'brushbsp' of https://github.com/ericwa/ericw-tools into brushbsp 2022-12-06 15:19:46 -07:00
Eric Wasylishen eae434736a light: support _minlightMottle on worldspawn 2022-12-06 15:18:16 -07:00
Jonathan 15b9a78fd1 fix gate being incorrect
add surflight grouping
fix minlight on color'd _surface lights
2022-12-05 20:35:44 -05:00
Eric Wasylishen e73aa29dd1 light: adjust epsilon to fix q2_light_flush.map test case 2022-12-04 00:10:01 -07:00
Eric Wasylishen f66e4790a4 qbsp/light: add no_phong texinfo flag (currently not used/exposed) 2022-12-01 01:16:17 -07:00
Eric Wasylishen 1065adecc6 qbsp/light: implement _phong_group key, equivalent to Q2 "value" field 2022-12-01 00:25:05 -07:00
Eric Wasylishen 9fa9124404 light: redesign Q2 phong check
- always do angle check
- always do gamedef specific exclusions (e.g. warping surfflags don't phong with non-warping)
- if Q2 style phong is requested, but Q1 is not in use, use the default phong angle
- always do smoothing group ID check (preparation for supporting this in Q1 mode via a key)
2022-11-30 23:24:51 -07:00
Eric Wasylishen 96bdf141bb light: block phong if certain surfflag bits differ between the two faces
this prevents liquids from phonging with solids
2022-11-30 22:15:58 -07:00
Eric Wasylishen 04adb17b1b qbsp: fix -nodetail in q2 mode 2022-11-21 00:10:26 -07:00
Eric Wasylishen 5d3fab75b6 light: allow .wal_json metadata to contain "light": [ r, g, b ] to override emissive color
Use this to fix the "emissive lights" test case so it can run on CI without any texture data
2022-11-20 23:01:05 -07:00
Eric Wasylishen 37ced86cec tests: fix light settings not clearing across tests 2022-11-19 19:02:55 -07:00
Eric Wasylishen 0c4aab737d light: fix angled emissive surfaces not shining on adjacent faces 2022-11-19 14:57:56 -07:00
Eric Wasylishen c9111b2a6c
Merge pull request #337 from TTimo/colorcodes
Enable support for ANSI color codes on Windows 10 and newer, without …
2022-11-19 09:10:24 -08:00
Eric Wasylishen 9ab4ea8176 Move SetConsoleMode() call to logging::preinitialize(); helper
Don't do ENABLE_VIRTUAL_TERMINAL_INPUT as it breaks arrow key history
navigation in Windows Terminal after running one of the ericw-tools exe's.
2022-11-19 10:05:14 -07:00
Eric Wasylishen 4c218f5e91 common: factor out LMSCALE_DEFAULT = 16.0; 2022-11-15 23:52:34 -07:00
Eric Wasylishen 37b901a915 fmtlib 7.1.3 -> 9.1.0 2022-11-13 18:55:35 -07:00
Eric Wasylishen d28f97e655 cmdlib: use <bit> include unconditionally 2022-11-12 20:10:58 -07:00
Eric Wasylishen d7acd046c3 light/qbsp: add _surflight_rescale key 2022-11-12 17:07:02 -07:00
Eric Wasylishen a5125583fa light: clear global data so light can run multiple times per process 2022-11-11 16:52:07 -07:00
Eric Wasylishen 74269a0269 light: new Mottle implementation based on world-space "value noise" 2022-11-08 22:18:54 -07:00
Jonathan 66d7ae98e5 half memory usage for lightmaps & ray colors 2022-11-06 02:21:11 -05:00
Eric Wasylishen ca0efbf3d3 light: wip -world_units_per_luxel and DECOUPLED_LM BSPX lump 2022-11-03 02:39:15 -06:00
Eric Wasylishen eb2d697cef faceextents_t: refactor to store world <-> lm matrices rather than tex space <-> lm 2022-11-02 09:39:20 -06:00
Eric Wasylishen 1f01b65873 faceextents_t: rename texextents/texmins 2022-11-02 09:27:41 -06:00
Eric Wasylishen 02202b81bb faceextents_t: move texmins out of structure 2022-11-02 09:21:42 -06:00
Eric Wasylishen f3cc0907c8 faceextents_t: refactor to remove lightmapshift member 2022-11-02 00:56:23 -06:00
Eric Wasylishen c39ee38454 qvec: add 3x3 matrix inverse, row major factory method 2022-11-02 00:32:06 -06:00
Eric Wasylishen 388cd39821 common: parser: fix compile time of parser_source_location 2022-10-31 23:06:20 -06:00
Eric Wasylishen 0924423c20 light: header -> source move 2022-10-31 21:21:28 -06:00
Eric Wasylishen 39aacc89ef light: docs updates 2022-10-31 00:26:57 -06:00
Eric Wasylishen 383266762d light: lightsurf_t: remove texorg member 2022-10-30 19:40:26 -06:00
Eric Wasylishen 728fafde8c light: remove dead code 2022-10-30 18:00:48 -06:00
Eric Wasylishen da5910e732 tests: first steps on a light test case 2022-10-30 15:32:41 -06:00
Eric Wasylishen 35ffc00462 all: add LIGHT_/QBSP_/VIS_ prefixes to epsilons where necessary 2022-10-30 15:08:10 -06:00
Eric Wasylishen f9fc0fc478 light: remove dead code 2022-10-30 12:49:32 -06:00
Eric Wasylishen 34f32f851c common, qbsp: more functions moved from header -> source 2022-10-26 23:29:54 -06:00
Eric Wasylishen ba3befca9b qbsp: exportobj: re-add bspbrush_t::container version 2022-10-23 19:20:19 -06:00
Eric Wasylishen a950d2fcb7 qbsp: add exportobj.hh header 2022-10-23 19:20:19 -06:00
Eric Wasylishen 87ae7d63fa qbsp: restore a variation on CSGFaces 2022-10-23 19:20:10 -06:00
Eric Wasylishen 501ced4bfe qbsp: restore func_detail_wall support 2022-10-21 18:33:38 -06:00
Eric Wasylishen 636b376577 squash brushbsp-compilation-speedup branch
move function implementations out of headers
2022-10-21 18:00:58 -06:00
Eric Wasylishen 2a9393cc54 bspbrush_t: add contains_point() query 2022-10-05 23:49:34 -06:00
Jonathan 315ab418d2 fix warning
only enable the clock counter errors in debug
2022-10-02 16:20:27 -04:00
Eric Wasylishen 72ad52647b cmdlib.hh: add missing include 2022-09-30 00:37:18 -06:00
Eric Wasylishen df46f7af82 cmdlib.hh: add missing include 2022-09-30 00:36:03 -06:00
Eric Wasylishen 45fae91a0f cmdlib.hh: add missing include 2022-09-30 00:34:56 -06:00
Eric Wasylishen cb3467b049 log.hh: add missing include 2022-09-30 00:34:17 -06:00
Eric Wasylishen 1726f95484 use <fmt/core.h> instead of <fmt/format.h>
Should lighten compile times.

The only loss here is we'll no longer inherit e.g. "float" format specifiers for qvec3f.
2022-09-29 19:49:48 -06:00
Eric Wasylishen acf334daee cleanup: rename surfflags_t::is_skip to is_nodraw
This is a break to the .json format
2022-09-18 15:47:14 -06:00
Eric Wasylishen 8ee39cf874 qbsp: CountLeafs: also measure avg/max bsp height 2022-09-17 19:53:49 -06:00
Eric Wasylishen 9c46699b60 qbsp: experiment with fixing micro-leaks 2022-09-12 02:10:04 -06:00
Eric Wasylishen c90c16ee45 qbsp: add -debugleafvolumes 2022-09-12 00:36:33 -06:00
Eric Wasylishen a926e5c397 qbsp: add -debugbspbrushes 2022-09-12 00:18:32 -06:00
Eric Wasylishen 4567f9b4b9 qbsp: add -debugleak for saving more info about leaks 2022-09-11 23:56:29 -06:00
Eric Wasylishen ae37a4e667 qbsp: write .leak.prt files in addition to .pts to aid leak debugging 2022-09-11 20:35:51 -06:00
Jonathan 6713fedcbc allow changing a brushes' lightmap color scale with `lightcolorscale` 2022-09-10 19:04:17 -04:00
Jonathan 4ecd945587 use kmq2 flag instead of 33 | 66, which no engine supports 2022-09-10 07:49:06 -04:00
Eric Wasylishen b19527c3fd qbsp: don't use brush sides to texture a portal if they're not coplanar 2022-09-08 21:20:49 -06:00
Jonathan b77dfbc7f9 Merge branch 'brushbsp' of https://github.com/ericwa/ericw-tools into brushbsp 2022-08-31 12:58:56 -04:00
Jonathan 075481a36f add -nocolor for TB, etc
fix crashes on vis and light for invalid options
fix TB and others not receiving output
2022-08-31 12:58:04 -04:00
Jonathan 3564f6085d merge surface lighting and bounce code (wip) 2022-08-30 15:46:14 -04:00
Eric Wasylishen 88a88882a9 qbsp: initialize 'visible' in CreateBrushWindings 2022-08-28 23:15:49 -06:00
Eric Wasylishen 3856dffc0a qbsp: compilation speedup: isolate pareto in map.cc 2022-08-28 18:10:01 -06:00
Eric Wasylishen 7df6310d32 qbsp: init brush sides to visible
improves the quality of the first BSP build
2022-08-27 23:36:58 -06:00
Jonathan b305ddaed9 port over the visible = true setting for hint sides 2022-08-25 21:45:33 -04:00
Jonathan f581c071e8 fix merge 2022-08-25 19:02:26 -04:00
Jonathan 4a85131f45 fix sky_surface being multiplied by 255 twice (normalize it as a color first) 2022-08-25 16:47:10 -04:00
Jonathan 384f74a0eb add separate "surflightskyscale" to handle the scale of sky lights; to help with doubling up with _sun
allow setSetting to report errors
print warnings on invalid worldspawn key values for light
fix setting_mangle not handling "pitch yaw" or "pitch" correctly
2022-08-25 16:30:15 -04:00
Jonathan 5fb0d56da7 maxlight
# Conflicts:
#	include/common/bspfile.hh
2022-08-24 21:50:11 -04:00
Jonathan 1ce5c5a7b1 combine flood + emit areaportals into a single step, since they won't ever be run not together
add stats for edges and faces
2022-08-24 12:02:56 -04:00
Jonathan e14f42caba emit edges and faces together instead of in two passes 2022-08-22 13:40:47 -04:00
Jonathan f6601a7c85 clean up the output table for BSPs
add a specialized stream buffer which just tracks how much would be written to it; used to get the output size of the texture lump, since that's no longer tracked
display dmodel byte size
display BSPX lumps a bit differently (no need to repeat BSPX per line)
add header to both lists, to make it more obvious what's coming up
2022-08-22 13:02:58 -04:00
Jonathan 6345d6b616 add support for fast bounce lighting, which is the same as the old code 2022-08-21 22:12:41 -04:00
Jonathan e7ae158a10 split up BrushBSP and CountLeafs stat prints 2022-08-21 21:54:16 -04:00
Jonathan fe41b1ae1b fix format error for Q1 contents
re-introduce chop since it may be a key to the puzzle for hullnums
allow caller to do full fragmentation, add option to force it
fix BrushGE causing liquids, etc to be cut up
2022-08-21 16:16:09 -04:00
Jonathan 2d8827e031 Revert "Q3 didn't need chop, we don't either!"
This reverts commit f57ecaf599.

# Conflicts:
#	include/qbsp/brushbsp.hh
2022-08-21 15:04:26 -04:00
Jonathan 282c5ec69f stat printing adjustments 2022-08-21 15:01:45 -04:00
Jonathan 1aaa513368 collapse certain map face issues into loggable warning stats to lessen maps spamming warnings on things that legacy compilers allow
adjust the wording of certain warning messages
don't display face crunching on bmodels/hulls by default
2022-08-20 20:13:27 -04:00
Eric Wasylishen c0c146d47c bsputil: move decompiler to common 2022-08-19 20:49:34 -06:00
Jonathan 84870cf366 since tree_t only exists as a type that only allocates heap memory, we don't need to wrap it in a unique_ptr; this also allows the vectors to keep their memory on the next pass, which may improve performance for huge maps
removed tree_t parameter from functions that don't need it
pass reference to tree_t instead of ptr
use an enum instead of std::optional<bool> for the ternary value to store split type, since it's more explicit and obvious now what the three values do
2022-08-19 15:15:53 -04:00
Jonathan 69aad26097 move & document bevel boolean
don't report invalid winding more than once
ceil the extents, so we don't get weird values like "world extents calculated to 5082.29327318318"
2022-08-19 13:46:37 -04:00
Jonathan 057ae544c4 use references in places where we know it's non-null 2022-08-19 12:11:35 -04:00
Jonathan f57ecaf599 Q3 didn't need chop, we don't either! 2022-08-18 19:47:34 -04:00
Jonathan 48c6b7a370 decouple extra and bounce extra; this allows you to still use extra4 but not have to wait like 16x longer for bounce lights to work 2022-08-18 07:35:06 -04:00
Jonathan 424e3ee110 remove unused portal_t::face, unused
rename and re-type a few things to use twosided
2022-08-17 09:10:58 -04:00
Jonathan 9e764d8035 document some stuff
remove mapface_t::value and mapface_t::flags; they are duplicated by texinfo
add mapface_t::get_texinfo and face_t::get_texinfo so that you can fetch them easier
2022-08-17 07:30:31 -04:00
Jonathan 95c728a5b6 fix legacy bevel bug
pushing up changes for Q1 hulls just in case we ever want these back
2022-08-16 13:52:30 -04:00
Eric Wasylishen f62136e04d qbsp: wip fixing -expand feature 2022-08-16 01:36:09 -06:00
Eric Wasylishen f5a8bc7b99 bsputils: add a helper struct for checking clipnode identity 2022-08-15 23:06:00 -06:00
Jonathan 027c45d608 Merge branch 'brushbsp' of https://github.com/ericwa/ericw-tools into brushbsp 2022-08-15 06:13:38 -04:00
Jonathan f7b8f85ece use an optional<uint8_t> to store hull number, which gets rid of special -1 collision hull number.
fixed no-hull always chopping even with chop off
2022-08-15 06:13:30 -04:00
Jonathan 20f5d73a3c always use inside filling for auto
allow details in hulls
use std::optional for an optional-esque value
2022-08-15 04:53:36 -04:00
Jonathan 97665d15a9 fix slight mistype in Brush_LoadEntity
make ~settings_container virtual so light_t can be freed properly
reset visible to false on all brush sides
2022-08-15 03:37:38 -04:00
Eric Wasylishen c2be045f65 qbsp: add WriteDebugTreePortalFile 2022-08-15 00:34:18 -06:00
Eric Wasylishen 854e1f48f5 qbsp: rewrite/fix hull and bmodel logging with new -loghulls and -logbmodels flags 2022-08-14 12:40:42 -06:00
Jonathan 2fe8ef2182 Merge branch 'brushbsp' of https://github.com/ericwa/ericw-tools into brushbsp 2022-08-14 07:33:49 -04:00
Jonathan 781a772d8a move immediately instead of splicing after construction (probably compiles to the same code but whatever)
don't add all of the `result_portals_onnode` one at a time; just directly copy-elision the result.
2022-08-14 07:33:41 -04:00
Eric Wasylishen e7adc1108a qbsp: reset more settings between test cases 2022-08-13 20:38:57 -06:00
Jonathan de7c8b42b4 fix hybrid at() 2022-08-13 20:57:58 -04:00
Eric Wasylishen 9baf161fc0 work around macos bug (std::atomic_size_t::value_type missing) 2022-08-13 13:12:23 -06:00
Eric Wasylishen 1844f0810f fix linux build 2022-08-13 12:40:11 -06:00
Jonathan da5b40ce73 since buildportal_t is small and being stored in an std::list (which already stores them in nodes that require allocation & non-moving locations) we don't need to wrap them in unique_ptr; this saves a malloc/free per buildportal_t 2022-08-13 08:24:13 -04:00
Jonathan 2059835a47 use a more optimized version of SplitBrush for CheckPlaneAgainstVolume that doesn't require allocating/freeing a lot of memory 2022-08-13 06:39:30 -04:00
Jonathan 6d66e6d5cf group together # of clipped faces, to reduce console spam of Q1 maps
always allow midplane split for hulls
2022-08-12 21:38:41 -04:00
Eric Wasylishen 06a116670b winding_t: make non-copyable 2022-08-12 02:06:23 -06:00
Jonathan 8b9c1bd784 fix missing includes 2022-08-12 02:42:52 -04:00
Jonathan ea38e5eeb7 fix missing move
fix clip_back causing extra copies
2022-08-12 02:03:00 -04:00
Jonathan bf162c7a86 allow explicit calling of percent_clock so it can be simplified a bit
add more timers in a few spots
by default, display percent timers but don't display elapsed for non-verbose stuff (bmodels); this is so it still shows that it's "working" instead of just showing blank for large maps, give user an idea on progress for certain stuff
merge all "side not found"s into a single line
time `FillOutside`
time `ProcessMapBrushes`
time `Brush_LoadEntity`
2022-08-12 01:30:04 -04:00
Jonathan 4bf2ab338c allowing logging::percent to handle indeterminate values
fix logging::percent getting stomped in multi-threaded operations
add new stats facility to make creating lists of single-use stats easier to manage
fix SplitBrush storing a bunch of extra stats for ChopBrushes
2022-08-11 20:33:12 -04:00
Eric Wasylishen afc8d74873 build fix 2022-08-10 23:59:02 -06:00
Jonathan 0db1e0fc01 add chop control to settings
only chop if desired or if hull is -1 or > 0 since those can be chopped without affecting visuals
farewell, shared_lock
fix brush contents issue
2022-08-11 00:27:28 -04:00
Jonathan 4b4a1738fd more partial revert 2022-08-10 23:06:37 -04:00
Jonathan 02e80645e6 partial revert of 097b564cc6 2022-08-10 22:43:42 -04:00
Jonathan eb7c65362c fix typo
assume non-sourced sides are non-visible
2022-08-10 22:27:40 -04:00
Jonathan 6ab037b03a implement ChopBrushes 2022-08-10 22:12:23 -04:00
Jonathan 097b564cc6 remove bspbrush_t::original; it is no longer required since mapbrush_t is what the output is being written to
use some explicit types (bspbrush_t::ptr for pointer, bspbrush_t::container for container of pointers, and bspbrush_t::make_ptr to create one) so that we can swap it out with different pointers easier later
swap out bspbrush_t::ptr from unique_ptr to shared_ptr; it's not important yet, but it does not increase compilation time and will allow us to pass things to functions like SplitBrush without destroying the original as long as we still have a reference to it somewhere (important for ChopBrushes)
add get_positive_plane to mapface_t
instead of creating a whole copy of the bspbrush_t list, BrushBSP now just creates copies of the shared_ptrs which are then filtered down the tree; the originals are never modified by SplitBrushList and friends, only split into new brushes, so this is safe from what I can tell
portals now directly reference the mapface_ts
original_brushes now directly reference the mapbrush_ts
early exit in `BrushBSP` if brush list is empty (moved to top)
2022-08-10 16:02:16 -04:00
Jonathan faf9173f10 remove file_order; we can infer this from the pointers now
remove unnecessary early microbrush check, use microbrush option value on later one
2022-08-10 02:22:32 -04:00
Jonathan bca6bda7c3 move `visible` to mapface_t since we only need to store one boolean for it 2022-08-10 01:29:34 -04:00
Jonathan 74dcb1454e remove mapface_t::visible, it's unused 2022-08-10 00:55:10 -04:00
Jonathan 834838ed72 move lmshift to mapface_t
store original mapface_t that a face_t was generated from
2022-08-10 00:53:58 -04:00