Commit Graph

85 Commits

Author SHA1 Message Date
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 057ae544c4 use references in places where we know it's non-null 2022-08-19 12:11:35 -04:00
Eric Wasylishen 6eab754ca3 qbsp: reset onnode at the beginning of BrushBSP 2022-08-18 22:26:33 -06:00
Jonathan f57ecaf599 Q3 didn't need chop, we don't either! 2022-08-18 19:47:34 -04:00
Jonathan 40b04b9518 use alloca instead of thread-local static 2022-08-13 20:30:51 -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 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
Jonathan f851fac655 speed up compilation - we don't need to make a copy of node->volume going into SplitBrush now 2022-08-11 02:58:49 -04:00
Jonathan f17ce185f6 Merge branch 'brushbsp' of https://github.com/ericwa/ericw-tools into brushbsp 2022-08-11 00:27:36 -04: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
Eric Wasylishen 1f3bf6edbc qbsp: log BrushBSP function name 2022-08-10 21:45:08 -06:00
Jonathan 129dedb268 reset onnode between BrushBSP passes 2022-08-10 23:28:16 -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 f8f0e903a2 Merge branch 'brushbsp' of https://github.com/ericwa/ericw-tools into brushbsp 2022-08-10 01:14:59 -04:00
Eric Wasylishen c9a1d9f096 qbsp: don't store leafnode->volume once the leaf is created 2022-08-09 23:14:20 -06:00
Jonathan 70f015a36c move func_areaportal and lmshift from bspbrush_t to mapbrush_t 2022-08-10 00:48:55 -04:00
Jonathan 697e3325f8 go back to vector for brush lists 2022-08-09 16:00:51 -04:00
Eric Wasylishen 67a376ad18 qbsp: BuildTree_r: avoid copying node->volume 2022-08-09 00:51:18 -06:00
Eric Wasylishen 30b529b70f qbsp: keep a pool of node_t's in tree_t in a tbb::concurrent_vector
rather than using std::unique_ptr recursively in nodes
2022-08-08 23:43:36 -06:00
Jonathan 189f70ca30 add in-place versions of union and expand to help with inlining 2022-08-08 22:43:10 -04:00
Jonathan 5b56ecfb28 remove extraneous warnings when they don't matter 2022-08-08 16:01:16 -04:00
Jonathan b3fbf8841d allow update_bounds to tell the caller that a brush may have been destroyed 2022-08-08 15:50:23 -04:00
Jonathan a9b1fa2461 speed up SplitBrush a tiny bit by reserving side count 2022-08-08 01:29:56 -04:00
Jonathan 2abdeb2616 remove Face_Plane since we can directly access the real plane now
speed up CreateBrushWindings slightly since we know where the inverted plane is stored
2022-08-08 01:06:50 -04:00
Jonathan d2cfc0d025 use planenum in SplitBrush and friends 2022-08-08 01:01:49 -04:00
Jonathan d9a3abfba7 remove blocksize now that midplane is working
don't re-fetch plane being exported since we know its id already
2022-08-07 21:48:22 -04:00
Eric Wasylishen 0357db911c qbsp: remove unnecessary copy in SplitBrushList 2022-08-07 15:42:43 -06:00
Jonathan 4ec30e02a2 remove "brushes" from mapentity_t - it is now local to the ProcessEntity process
"node_t::original_brushes" is now only used during construction and cleared on Prune; original_mapbrushes is used to track the map brushes on nodes post-construction
calculate and cache contents on mapbrush_t
2022-08-06 19:28:17 -04:00
Jonathan c6fabb290d clean up stat printing a bit 2022-08-05 09:08:33 -04:00
Jonathan 627428756c track a shared pointer for `map_source_location` instead of memory pointer, so that we can allocate it as we go
use it for brushes and faces
2022-08-04 15:37:37 -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 ec62a0e8d0 move in the rest of the missing code back into LoadBrush
fix bug with c_brushesremoved brushes
move & CreateBrushWindings use where required
store the source face we made a bspbrush_t side from
fix test issue
2022-08-03 12:35:47 -04:00
Jonathan 24168c8e40 clang pass 2022-08-02 21:57:33 -04:00
Jonathan 5f35575c02 remove map.faces and map.brushes; now, brushes are stored inline in mapentity_t, and faces are stored inline in mapbrush_t
calculate brush bounds (and winding) and add bevels after all of the rest of the map has loaded, so that it has proper world extents
calculate world extents right after the map is loaded
2022-08-02 20:59:08 -04:00
Jonathan a75f4239e3 node_t planenum 2022-08-02 16:04:48 -04:00
Jonathan e57aa36e2e use stats rather than logging every time these specific instances occur
restore the "how close the match is" block
2022-08-02 15:18:53 -04:00
Jonathan 1d729ba573 side_t using planenums 2022-08-02 14:55:38 -04:00
Jonathan 8476e2861c this all matches release now 2022-08-02 04:29:36 -04:00
Jonathan cc9dd986c6 adopt parent node bounds if a leaf is unbounded now too
move midsplitbrushes into same group as blocksize
always return a split rather than erroring
list out which method is used of the three
2022-08-01 15:51:57 -04:00
Eric Wasylishen 1751733ddc qbsp: add experimental MidSplit re-implementation, enabled by default 2022-08-01 12:30:04 -06:00
Jonathan 755a9e65ca use std::set instead of vector for original_brushes since we need them implicitly sorted and no dupes
parallelize PruneNodes_R and CalcTreeBounds_r
2022-08-01 13:19:50 -04:00