Commit Graph

69 Commits

Author SHA1 Message Date
Eric Wasylishen 7608a78b44 style: use std::min/std::max/std::clamp and remove using 2023-08-07 15:42:29 -06:00
Eric Wasylishen db42b2116a use std::abs in remaining places that were using C abs() 2023-08-07 15:23:12 -06:00
Fabian e099c292b0
Use std::abs instead of abs() from C standard library (#369)
abs() from C standard library operates on integers, which is almost certainly not what was intended.
2023-08-06 11:08:06 -06:00
Eric Wasylishen b17633f746 cleanup: set PackConstructorInitializers: Never 2023-02-20 10:23:59 -07:00
Eric Wasylishen eda6155844 cleanup: run ./clang-format-all.sh
clang-format version 15.0.7
2023-02-18 22:59:43 -07:00
Eric Wasylishen f5fad41402 light: add debug visualization for octree lightgrid 2023-02-12 16:35:46 -07: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 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 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
Jonathan de7c8b42b4 fix hybrid at() 2022-08-13 20:57:58 -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
Eric Wasylishen 06a116670b winding_t: make non-copyable 2022-08-12 02:06:23 -06:00
Jonathan ea38e5eeb7 fix missing move
fix clip_back causing extra copies
2022-08-12 02:03:00 -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 55bdc88f9d polylib: use tbb::scalable_allocator for winding std::vector storage 2022-08-09 00:23:43 -06:00
Jonathan 1c6b2e5a95 fix duplicate plane test 2022-08-08 21:27:42 -04:00
Jonathan 426668701e clip_back/clip_front to match ChopWindingInPlace
simplify constructors for winding heap
use std::vector again for mapentity_t since it's being copied because of the std::list
2022-08-08 21:08:27 -04:00
Jonathan 8b7a1c21c9 use vector instead of raw heap for winding_storage_heap_t 2022-08-08 20:09:41 -04:00
Jonathan 9af74ce083 store linenum on mapbrush_t; add new location type, but not using it yet, for later so we can track more complex locations (external/-add maps, etc)
add extra sanity checking to polylib
adjust some warnings to be clearer and not indicate that the world will break
add sanity check to update_bounds, and don't add empty windings to the bounds
2022-08-04 12:05:04 -04:00
Jonathan 24168c8e40 clang pass 2022-08-02 21:57:33 -04:00
Jonathan e14c2772a6 add ability for winding storages to reserve memory (for clip mainly, so it doesn't need to allocate on each addition; we know the winding will have at least the input number of points) 2022-08-02 18:10:20 -04:00
Jonathan 53adb9fed5 split winding_base_t into two types, so that we can switch out the backing storage
default winding_t for the main polylib to use heap-based, exact-memory-usage-only, winding
2022-08-02 06:09:20 -04:00
Jonathan 1d8a0c1df3 clang-format pass 2022-07-28 06:14:54 -04:00
Eric Wasylishen b37d29ee33 common: rename side_t -> planeside_t (side_t is used by qbsp3) 2022-06-24 00:16:46 -06:00
Jonathan 579140067f expose vector.size() using a subtype to not pollute winding_base_t 2022-06-23 18:42:38 -04:00
Jonathan 3ac1d02624 fix missing noexcept
explicit initialization in some cases for vis winding_t's parameters
more vector
2022-06-23 17:02:18 -04:00
Jonathan 9354fc8148 reserve as much as we currently have allocated rather than only exactly how much is coming up 2022-06-19 19:22:34 -04:00
Jonathan cd77b1a7e6 use vector as overflow instead of secondary storage for winding 2022-06-19 19:17:52 -04:00
Jonathan b21920841d revert some of the vis stuff, but re-implement it in a more working state 2022-06-18 18:36:09 -04:00
Jonathan b0dad9d01d save a few more cycles by just using raw pointers. it's a bit uglier, but this is hard to represent with shared_ptr and I think it was the wrong choice anyways since the ownership chain is difficult to represent in a shared_ptr here. 2022-06-17 14:56:17 -04:00
Eric Wasylishen 259d95e47c testqbsp: add a first portal test 2022-06-17 01:53:08 -06:00
Jonathan 8f50108b5e slight optimization for winding_t: use memcpy directly. the copy constructor can't automatically optimize it into a memcpy because of the iterator wrapper.
use side_t where appropriate
add a shared lock to map.planes, and hide the original vector to prevent non-locked read/writes
move MakeSkipTexinfo to the beginning of the operation - make a global skip texinfo as the first texinfo. it will get culled out later if need be.
re-enable ChooseMidPlaneFromList; seems to work, but maybe there's a test that is failing that is the reason it was if'd out?
enable parallelization of PartitionBrushes since map.planes is lockable now
2022-06-05 22:52:02 -04:00
Jonathan ad85489580 fix windings > N being initialized wrongly 2022-05-15 21:07:35 -04:00
Eric Wasylishen a1b8a38283 merge non-brush bsp specific changes from brushbsp branch 2022-05-11 01:58:53 -06:00
Jonathan f5cda68416 clean up percent stuff
comment out "didn't split" message
fix winding resize
merge phong loops together
2022-03-07 14:49:50 -05:00
Jonathan 6baea3bc03 Fix three bugs that slipped by for cmdargs
Remove old threading code, use tbb internally
2022-02-27 04:09:28 -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 15484b55f8 Use better tjunction vertex addition
Parallel MergeAll
Allow modifyable iterators from polylib; resizing may invalidate them however
2022-01-28 09:45:29 -05:00
Eric Wasylishen 19dbc1c1c8 polylib: fix compile error with clang 2022-01-25 19:55:07 -07:00
Jonathan ff2ff5c87f fix emplace UB 2022-01-25 04:21:07 -05:00
Jonathan c9f2502118 Fix swap 2022-01-20 19:50:05 -05:00
Jonathan 008d6db056 Fix detail for Q2 maps
Simplify winding::flip
Add an assert that a generated surface has a non-empty bounds (have a map that generates a face with 0,0,0 bounds)
2022-01-20 19:25:58 -05:00
Jonathan 0cca14d1b2 Fix bug in bitangent calculation - thank you AlexP
Allow `calc_sides` to skip writing outputs if they are not required, & return counts since they are constant sized
2022-01-20 16:35:56 -05:00
Eric Wasylishen d5497a675d polylib.hh: remove verts >= 3 assertion in from_face 2021-10-31 17:12:03 -06: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 a21be0362c replace VectorCompare, CrossProduct, DotProduct
qv::dot handles inputs a bit more gracefully now
plane::distance_to for distance checks, and dplane has the fast version
2021-10-21 23:25:19 -04:00
Jonathan a7de4bdae2 Remove unused thingies
Use qplane3 where we can
2021-10-17 06:24:02 -04:00
Eric Wasylishen 5cf82ee023 qbsp: restore use of options.worldExtent
should fix minor precision differences in .prt files
2021-10-08 19:04:11 -06:00
Jonathan e72934de81 Hopefully resolve clang warnings here now
Fix iterator wrapper
Fix >= <= tuple<T&> operators
2021-10-05 23:24:05 -04:00
Jonathan a2edc09018 Resolve GCC wanting `template` before emplacements 2021-10-05 22:54:25 -04:00