Commit Graph

171 Commits

Author SHA1 Message Date
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
Eric Wasylishen c1e52b0d62 qbsp: fix FindPortalSide generating unwanted mirrored inside faces
due to the `// see how close the match is` block being uncommented
2022-08-05 01:45:42 -06: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 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 da4c45d62f qbsp: fix crash on DM6 2022-08-01 12:13:21 -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
Jonathan 26a18d5cc3 add logging::header/funcheader to easily and consistently print function or "active routine" headers
add OOP percent_clock wrapper to make printing percents easier, not used yet
2022-08-01 09:35:21 -04:00
Eric Wasylishen aac9513417 qbsp: parallelize MakeTreePortals 2022-07-31 21:39:47 -06:00
Eric Wasylishen e1b6aba014 portals.cc: log number of tree portals 2022-07-30 00:29:54 -06:00
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 dd39bf9940 better print for areaportal warnings 2022-07-28 20:41:33 -04:00
Jonathan 1d8a0c1df3 clang-format pass 2022-07-28 06:14:54 -04:00
Jonathan e03d99d807 fix spacing 2022-07-28 05:59:06 -04:00
Jonathan d9a9046e46 fix some foot-guns with qbsp_plane_t - type is auto-set now 2022-07-28 05:51:55 -04:00
Jonathan 64cd39c229 add optional vertex snapping to match qbsp3 2022-07-28 03:56:12 -04:00
Jonathan 146f20f677 qbsp_plane_t is now used by other structures, and contains a faster epsilonEqual; since the majority of planes (especially nodes) are going to be axial, there's no need to use the slower full comparison when we can check if the axial component is ready. 2022-07-27 22:44:09 -04:00
Jonathan 9c73416594 Squashed commit of the following:
change temp-named planeside_ to plane_flipped

commit 8b3938f5069837e76504a16ffd019a8682fd4325
Author: Jonathan <jonno.5000@gmail.com>
Date:   Wed Jul 27 05:35:05 2022 -0400

    fix compile errors/warnings

commit 0c19a922490a332a084ceb65bbb88368fecb40a1
Merge: 31edc84e a2451a41
Author: Jonathan <jonno.5000@gmail.com>
Date:   Wed Jul 27 05:30:54 2022 -0400

    Merge branch 'brushbsp' into paril/brushbsp_plane2

    # Conflicts:
    #	qbsp/portals.cc
    #	qbsp/tree.cc

commit 31edc84e5a0f16196aacb4e465657954a523ccf9
Author: Jonathan <jonno.5000@gmail.com>
Date:   Wed Jul 27 02:55:52 2022 -0400

    use std::map for the two other hashes (edge/vertex) for speed

commit a9bb68b6ea203226d21f73d42558ffe388fc3051
Author: Jonathan <jonno.5000@gmail.com>
Date:   Wed Jul 27 02:31:45 2022 -0400

    remove final uses of FindPlane

commit 951a2b1977f813751c93417901a775a7a0cb77f4
Author: Jonathan <jonno.5000@gmail.com>
Date:   Wed Jul 27 02:01:19 2022 -0400

    only set flipped status if we actually flipped; this seems to have no affect in practice, but it was wrong in theory

commit 97610203bebb115391ef39ea2b5c6400b9ce2d89
Author: Jonathan <jonno.5000@gmail.com>
Date:   Wed Jul 27 01:56:19 2022 -0400

    remove FindPositivePlane

commit d424afbb2cfa32669883f5aafcf34555169eec3e
Author: Jonathan <jonno.5000@gmail.com>
Date:   Wed Jul 27 01:22:10 2022 -0400

    side_t uses plane and side_ now

commit af883bc111049a8c6fcb12c8c888e17f03cf30ff
Author: Jonathan <jonno.5000@gmail.com>
Date:   Wed Jul 27 00:46:52 2022 -0400

    face_t uses internal plane

commit 1cd776c89b683b0af0d8a642eee7e54b5f54b559
Author: Jonathan <jonno.5000@gmail.com>
Date:   Tue Jul 26 22:59:47 2022 -0400

    node_t using plane directly, pulling planenum in when necessary

commit 8b34312ef9c3d416c011f2694a34fb9d5eba4faa
Author: Jonathan <jonno.5000@gmail.com>
Date:   Tue Jul 26 22:22:28 2022 -0400

    remove PLANENUM_LEAF, use a boolean for the separation
2022-07-27 05:38:50 -04:00
Eric Wasylishen a2451a41fb qbsp: rewrite of q1 contents representation in bspfile.cc
use q2-like bitflags so we can represent mixes like (water | mist), which we need within the compiler
2022-07-27 02:31:49 -06:00
Jonathan 4e3739c751 use a reader/writer-esque lock (shared_mutex) instead of exclusive-only recursive lock to speed up plane stuff 2022-07-24 19:05:28 -04:00
Jonathan a435f67f13 fix outputting noisy stuff 2022-07-13 22:26:08 -04:00
Eric Wasylishen f86a5343fb qbsp: rename options -> qbsp_options 2022-07-10 17:30:00 -06:00
Eric Wasylishen ac80d11e69 qbsp: move FreeTreePortals to tree.cc 2022-07-04 00:26:28 -06:00
Eric Wasylishen 4ab4cb7dc8 qbsp: use unique_ptr for portal_t 2022-07-03 22:45:25 -06:00
Eric Wasylishen de68bee886 qbsp: move tree_t to tree.hh 2022-07-03 21:36:17 -06:00
Eric Wasylishen 40bba01b21 qbsp: brushbsp.cc import from qbsp3 2022-07-03 01:22:09 -06:00
Eric Wasylishen c7111cc99e qbsp: move FloodAreas to portals.cc for parity with qbsp3 2022-06-27 01:32:34 -06:00
Eric Wasylishen 5624f7012a qbsp: moving PortalThru->Portal_VisFlood, Portal_EntityFlood to portals.cc for qbsp3 parity
also fixes to both to match qbsp3
2022-06-27 01:13:21 -06:00
Eric Wasylishen afec0a947e qbsp: change bspbrush_t.sides from face_t to side_t 2022-06-24 00:43:40 -06:00
Eric Wasylishen fac5ea384d qbsp: rename bspbrush_t.faces to .sides 2022-06-24 00:21:55 -06:00
Eric Wasylishen b37d29ee33 common: rename side_t -> planeside_t (side_t is used by qbsp3) 2022-06-24 00:16:46 -06:00
Eric Wasylishen 4a1c5842a3 qbsp: rename solidbsp.cc -> brushbsp.cc for consistency with qbsp3 2022-06-24 00:08:12 -06:00
Eric Wasylishen 5c5e6e1ea7 qbsp: fix brush_clipping_order 2022-06-19 17:32:18 -06:00
Eric Wasylishen 4f3ca8c252 qbsp: wip import MarkVisibleSides from qbsp3 2022-06-19 16:04:54 -06:00
Eric Wasylishen 3492ef2b9e qbsp: fix invalid leaf bounds in MakeTreePortals_r 2022-06-18 16:13:00 -06:00
Eric Wasylishen b91973bae1 qbsp: remove old/unused portal code 2022-06-18 13:44:24 -06:00
Eric Wasylishen 8d5978dcc2 qbsp: switch to qbsp3 implementation for MakeTreePortals
Quick update to outside filling to remove cluster handling, because now we perform filling with
all leaf portals
2022-06-18 13:42:41 -06:00
Eric Wasylishen 158c65b056 Merge branch 'brushbsp' of https://github.com/ericwa/ericw-tools into brushbsp 2022-06-18 12:53:53 -06:00
Jonathan 7eedf52bf4 sync up BaseWinding checking
add constructor to aabb to construct from range
2022-06-18 14:33:16 -04:00
Eric Wasylishen 501ccda2d1 qbsp: don't attempt to parallelize portal generation 2022-06-18 11:46:40 -06:00
Eric Wasylishen 214a2550f4 qbsp: isolate portal_state_t in prtfile.cc 2022-06-18 00:32:40 -06:00
Eric Wasylishen 1fb5753f60 qbsp: import CreateVisPortals_r from qbsp3 2022-06-17 23:59:19 -06:00
Eric Wasylishen 65e6fafb3e qbsp: import MakeNodePortal, MakeTreePortals from qbsp3 2022-06-17 23:52:33 -06:00
Eric Wasylishen 7d3b5a9c3f qbsp: import SplitNodePortals from qbsp3 2022-06-17 22:34:36 -06:00
Eric Wasylishen af2dd987d8 qbsp: import BaseWindingForNode from qbsp3 2022-06-17 22:10:11 -06:00
Eric Wasylishen 3e2045479b qbsp: move .prt writing to prtfile.cc to align with qbsp3 2022-06-17 20:31:37 -06:00
Eric Wasylishen b8dcc7535e qbsp: rename FreeAllPortals -> FreeTreePortals_r 2022-06-15 23:27:39 -06:00
Eric Wasylishen dfb8d7c9fc qbsp: refactoring portal code towards qbsp3 2022-06-15 21:37:19 -06:00
Eric Wasylishen 3474dd00c5 qbsp: add portal_t::onnode, tree_t from qbsp3 2022-06-15 00:45:58 -06:00
Jonathan 12caf1bcd4 move transsky/transwater code into portal_can_see_through 2022-06-13 02:34:39 -04:00
Jonathan 54900cf7b6 move visblocker to a boolean 2022-06-12 01:02:31 -04:00
Eric Wasylishen 64159d92f1 Merge remote-tracking branch 'github-desktop-paril/type-cleanup' into brushbsp 2022-06-10 21:32:23 -06: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
Jonathan c5e864fca1 re-enable stuff
undo the shared lock stuff
2022-06-06 03:26:19 -04: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
Eric Wasylishen 016e9a89f2 qbsp: fix base1.map leak with epsilon hacks 2022-05-22 00:38:08 -06:00
Eric Wasylishen 6fafc19f74 qbsp: fix not clearing portals 2022-05-21 23:37:47 -06:00
Eric Wasylishen a1b8a38283 merge non-brush bsp specific changes from brushbsp branch 2022-05-11 01:58:53 -06:00
Eric Wasylishen b06736dea4 qbsp: fix leak in base1leak test 2022-05-05 01:01:33 -06:00
Eric Wasylishen 893b0b080e qbsp: move to unique_ptr<brush_t> vectors 2022-05-03 02:35:43 -06:00
Eric Wasylishen 81e0da4d62 qbsp: mark invisible sides on brush entities
fixes brush_clipping_order test failure
2022-05-01 00:01:11 -06:00
Eric Wasylishen 20a1b7b94b qbsp: szBSPName -> bsp_path, szMapName -> map_path 2022-04-17 13:41:23 -06:00
Eric Wasylishen 2c32177a69 qbsp: stop clobbering szBSPName 2022-04-17 13:36:19 -06:00
Eric Wasylishen 9d2f00a1b2 qbsp: tidying: move pWorldEnt() to mapdata_t 2022-04-11 00:13:42 -06:00
Eric Wasylishen b736704e5e qbsp.hh: remove portals.hh include 2022-04-09 23:28:12 -06:00
Eric Wasylishen 2e14909e84 qbsp.hh: remove map.hh include 2022-04-09 23:23:26 -06:00
Eric Wasylishen f71ae3658e qbsp.hh: remove solidbsp.hh include 2022-04-09 23:19:34 -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 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 d076920665 Revert "Instead of calculating brush extents globally, do it per brush creation"
This reverts commit 069720078f.
2022-01-27 01:52:08 -05:00
Jonathan 069720078f Instead of calculating brush extents globally, do it per brush creation
Use portal node bounds for extents
2022-01-27 01:03:38 -05:00
Eric Wasylishen a937e3cdba qbsp: areaportal support 2021-10-27 22:51:43 -06:00
Eric Wasylishen 6856789eef bspfile.cc: move "can't see through solid" to the top of portal_can_see_through
fixes LoadPortals: out of bounds leaf in portal 68 issue
2021-10-25 20:24:21 -06:00
Jonathan a5f8ecd471 VectorSubtract 2021-10-24 23:26:20 -04:00
Jonathan fae69309a0 VectorLength 2021-10-23 13:24:25 -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 cb3c81aaf8 vec3_t gonedy 2021-10-21 20:21:28 -04:00
Jonathan a7de4bdae2 Remove unused thingies
Use qplane3 where we can
2021-10-17 06:24:02 -04:00
Jonathan e974285fe7 Merge branch 'type-cleanup' of https://github.com/Paril/ericw-tools into type-cleanup 2021-10-12 13:52:53 -04:00
Jonathan e6fd6b653e A few more vec3_t -> qvec
qmat follows other type conventions (T, N, M) and is annotated differently so it's not as confusing to follow
Removed qmat::operator[] - it's not clear from calling it that it's column-major (as evidenced by the comments needing to explicitly make clear at call sites that it's column, not row), so I've collapsed them into two separate functions that explicitly fetch either a column or a row. This also ties them nicely into qvec<N>.
2021-10-12 12:03:59 -04:00
Eric Wasylishen c88274f806 qbsp: outside.cc: rewrite with outside -> in filling 2021-10-11 22:40:26 -06:00
Jonathan 52839d4e7f Run clang-format pass 2021-10-05 15:54:06 -04:00
Jonathan 7590230111 Merge remote-tracking branch 'remotes/origin/qbsp-contentflags' into type-cleanup
# Conflicts:
#	bspinfo/bspinfo.cc
#	common/bspfile.cc
#	include/common/bspfile.hh
#	qbsp/brush.cc
#	qbsp/csg4.cc
#	qbsp/portals.cc
#	qbsp/qbsp.cc
#	qbsp/solidbsp.cc
#	qbsp/surfaces.cc
#	qbsp/writebsp.cc
#	vis/vis.cc
2021-10-05 01:21:16 -04:00
Jonathan 0833d84a7a Calculate tangents and bitangents (need to clean this up)
Implement formatters for qvec
Add -nolighting, which skips all non-lightstyled lights
2021-10-05 01:07:13 -04:00
Eric Wasylishen 5b62f61b29 qbsp: revert contents handling to be closer to master 2021-10-04 20:39:47 -06:00
Eric Wasylishen 1ed4dc71ad Merge remote-tracking branch 'origin/master' into qbsp-contentflags 2021-10-03 20:04:19 -06:00
Eric Wasylishen 640befb4dc qbsp: write portals as binary to avoid line ending differences 2021-10-03 19:47:00 -06:00
Jonathan 792951792c some more cleanup 2021-10-02 05:56:45 -04:00
Jonathan cc932a96ee Fix BSP being invalid in Q2 if vis is not run
Fixes for skylight in Q2
Don't throw on invalid area
2021-09-27 22:40:43 -04:00
Jonathan a6f6cc2d15 qvec now has an empty default initializer, for speed purposes; fixed up places that relied on this behavior
simplified constructor for qvec(T...) that uses fold expressions
simplified rgba_miptex_t
fixed a lot of broken winding_base_t behavior
merged all winding types into winding_base_t
removed now-empty files
2021-09-27 20:44:15 -04:00
Jonathan 41b9a79e83 Merge branch 'qbsp-contentflags' into type-cleanup
# Conflicts:
#	bsputil/bsputil.cc
#	common/bspfile.cc
#	common/cmdlib.cc
#	include/common/bspfile.hh
#	include/common/cmdlib.hh
#	qbsp/brush.cc
#	qbsp/portals.cc
#	qbsp/writebsp.cc
#	vis/vis.cc
2021-09-23 18:42:25 -04:00
Eric Wasylishen 71189def47 qbsp: write correct .prt file for Q2 (PRT1 with clusters)
# Conflicts:
#	qbsp/portals.cc
2021-09-23 14:43:48 -04:00
Jonathan 6ff2d67d12 major C++-esque change to BSP conversion:
- main mbsp types are declared first in the files, and types that were single-member are now not structs
- conversion is handled by the sub-types themselves. Currently no diagnostic for *what* members overflow, but, overflow is handled via thrown exceptions on all overflowable members
- aabb type is used where appropriate now, simplifying a few areas
2021-09-22 17:30:46 -04:00
Jonathan 403bae7a7b Merge branch 'type-cleanup' of https://github.com/Paril/ericw-tools into type-cleanup
# Conflicts:
#	vis/vis.cc
2021-09-19 22:23:54 -04:00
Jonathan 49fd62b9f3 Lotta more file stuff. Have to think about fscanf though. 2021-09-19 22:20:39 -04:00
Jonathan 326626f127 Remove some old stuff
Cleanup/rework of logging system. I'm not too happy about it still, but, it's at least a bit easier to follow now.
Started cleanup of file-related stuff.
2021-09-19 18:17:28 -04:00
Eric Wasylishen ca0fbba4bf qbsp: write correct .prt file for Q2 (PRT1 with clusters) 2021-09-18 00:02:32 -06:00
Jonathan 1dd4df1b20 calloc/malloc/free -> new/new/delete (except for specific scenarios) 2021-09-14 11:39:12 -04:00