Commit Graph

1387 Commits

Author SHA1 Message Date
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
Jonathan 70f015a36c move func_areaportal and lmshift from bspbrush_t to mapbrush_t 2022-08-10 00:48:55 -04:00
Jonathan c0cec4e1ba Rewrite of 697e3325f8 2022-08-10 00:11:17 -04:00
Jonathan 44eff2d7b1 throw in percent logging for MakeTreePortals
when node_t converts to leaf, destroy anything on it by re-initializing it
2022-08-09 20:33:49 -04:00
Jonathan d6411cef01 remove AssertNoPortals - it's impossible for it to ever hit, and it's kind of expensive (~150ms for 60k portals) 2022-08-09 19:22:42 -04:00
Jonathan 697e3325f8 go back to vector for brush lists 2022-08-09 16:00:51 -04:00
Eric Wasylishen 55bdc88f9d polylib: use tbb::scalable_allocator for winding std::vector storage 2022-08-09 00:23:43 -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 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 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 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 f490878e97 remove old plane lock stuff
use spatial hash for planes
2022-08-08 00:58:56 -04:00
Jonathan 6787e60e14 Merge branch 'brushbsp-plane3-bevel' of https://github.com/ericwa/ericw-tools into brushbsp-plane3-bevel
# Conflicts:
#	include/qbsp/map.hh
2022-08-08 00:40:09 -04:00
Jonathan f5ef0f90f4 spatial hash using pareto for vertex positions 2022-08-08 00:39:53 -04:00
Eric Wasylishen 3ca9d23f1c qbsp: rewrite plane_hash to fix test failure on macOS 2022-08-07 21:19:31 -06: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 12abfb93cf qbsp: add fmt formatters for aabb_t, plane_type_t, qplane3, qbsp_plane_t 2022-08-07 16:58:52 -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 335db1c0e4 move map_source_location to parser as parser_source_location since the locations actually come from there rather than from the map; now the parser keeps track of the location, so it's a bit easier to follow 2022-08-05 23:17:15 -04:00
Jonathan a1faa97f3f fix aabb::contains 2022-08-05 06:58:29 -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 c9eab719bc remove old code
add visible on mapface_t although it's unused
2022-08-03 13:26: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 98610982c9 export the final dbrush_t right in ExportBrushList_r instead of doing it ahead of time 2022-08-03 05:09:39 -04:00
Jonathan 58d1e5230e remove hullbrush_t; just directly work via the bspbrush_t since we have the bevels pre-calculated in mapbrush_t
track the mapbrush we were created from in bspbrush_t; we use this later for outputting the collision brush for q2bsp. bevels are busted though..
2022-08-03 04:47:50 -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 9ca28dff61 bevel 2022-08-02 19:48:17 -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 4c6d952841 plane hashing 2022-08-02 17:44:14 -04:00
Jonathan a75f4239e3 node_t planenum 2022-08-02 16:04:48 -04:00
Jonathan 46a643c3f0 face_t using planenum 2022-08-02 15:45:06 -04:00
Jonathan 1d729ba573 side_t using planenums 2022-08-02 14:55:38 -04:00
Jonathan 1ad0eb530d going back to using planenums, but going for the qbsp3-esque system 2022-08-02 14:17:59 -04:00
Jonathan 93655913c0 Merge branch 'brushbsp' of https://github.com/ericwa/ericw-tools into brushbsp
# Conflicts:
#	include/qbsp/qbsp.hh
2022-08-02 06:24:46 -04:00
Jonathan dd287f30d4 Merge branch 'brushbsp-midsplit' into brushbsp 2022-08-02 06:09:28 -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 8476e2861c this all matches release now 2022-08-02 04:29:36 -04:00
Eric Wasylishen e05a2bdf75 qbsp: "-add additional.map" feature 2022-08-01 19:13:10 -06: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 52dff47a86 fix linux build 2022-08-01 12:47:20 -06: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
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
Jonathan e60babdb9c add q3map2-style -blocksize option, using the same algorithm from it. it's optional and disabled by default.
pass through the "use mid split" boolean again
remove node_t::side; appeared to be unused in our current code, and needs to be removed anyways to support the other plane splitters
re-introduce ChooseMidPlaneFromList, but comment it out as it currently fails on a lot of BSPs.
2022-07-30 06:39:14 -04:00
Jonathan d8fd13d481 use <= gating for brightness for surface and bounce lighting, since these can often be very small values (provides a moderate speed increase as well, counter-balancing the next change)
bounce lighting generates a grid of bounces rather than a single light, improving lighting in conditions with larger faces or where the midpoint is blocked by other geometry
2022-07-29 22:26:07 -04:00
Jonathan 85f25bbc78 Q2-specific fix; -1 lightmaps are always fullbright, which can cause actual full-dark areas to be full bright by mistake 2022-07-29 10:40:02 -04: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 d33acbe12c remove snapvertices cmd 2022-07-28 09:25:19 -04:00
Jonathan 1d8a0c1df3 clang-format pass 2022-07-28 06:14:54 -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 c9935aaa38 hook up merge and subdivide stats 2022-07-27 23:02:09 -04:00
Jonathan 1f1388b2dd remove the type assertions 2022-07-27 22:49:41 -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 f6d6972b17 fix percents being output when not requested for submodels
tjunc using MWT algorithm
2022-07-22 12:25:06 -04:00
Jonathan f1f11e6f3b Merge branch 'brushbsp' of https://github.com/ericwa/ericw-tools into brushbsp 2022-07-19 08:42:13 -04:00
Jonathan 989788cf71 add a switch to optimize compiles for no software mode (mainly for Q2)
fix tjunc 3 vert faces being destroyed
2022-07-19 08:41:59 -04:00
Eric Wasylishen 6025585f01 switch from std::any to class hierarchy for content_stats_t
Fixes bogus (huge integers) content stats reporting on macOS (also fix tjunc stats reporting)

having the non-copyable std::atomic<size_t> inside a std::any which must
be copyable was problematic

IMO this is slightly better because it lets us use non-copyable types
2022-07-18 20:13:33 -06:00
Jonathan b6153e3084 use make_unique where appropriate
use unordered_map/set where ordering isn't important (faster for searching and smaller footprint)
2022-07-18 20:16:50 -04:00
Jonathan acac6cb720 add in a "validator" setting which is just a thin wrapper to another setting type allowing for an additional validation step
simplify the face structure; now, "fragments" just mean the output windings (if you opt out of tjunction fixing, then there will only be 1 fragment with the same values as original_vertices)
move MakeTangentAndBitangentUnnormalized to qvec.hh since we will use it later
-tjunc allows for more fine-grained control now (-notjunc still exists)
-maxedges now throws if you specify a bad value (1 and 2)
remove the checks to OmitFaces - we can tell if a face was omitted because it will have an empty winding
remove static variables from tjunc
2022-07-16 10:45:24 -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
Jonathan feb6055b07 remove errors pertaining to MAXEDGES (except on output) since we dynamically expand now
allow command line to specify maxedges
default maxedges to 0 (no limit) for Quake II
2022-07-14 04:57:52 -04:00
Jonathan ae4c5cd365 change face output to be slightly more robust
fix tjunc multithreading; added `original_vertices` which is a copy of the `output_vertices` that is safe for tjunc to read from since tjunc writes to the former
2022-07-14 01:56:18 -04:00
Jonathan 8240d753ee Merge branch 'brushbsp' of https://github.com/ericwa/ericw-tools into brushbsp 2022-07-13 04:35:46 -04:00
Jonathan d9dc54d267 remove vertex rounding
fix vertex hash not including negative axis points
use angle instead of zero-area triangle
2022-07-13 04:35:42 -04:00
Eric Wasylishen d38a65c709 qbsp: revert sidespace to 24 2022-07-13 00:29:45 -06:00
Jonathan 0fb1b429a8 finish tjunc algorithm - can now retopologize by splitting fans up
lower zero-area triangle epsilon
2022-07-12 17:43:25 -04:00
Jonathan 1aa2a9b250 Merge branch 'brushbsp' of https://github.com/ericwa/ericw-tools into brushbsp
# Conflicts:
#	qbsp/qbsp.cc
2022-07-11 01:41:10 -04:00
Jonathan f98dd05f56 new, simpler qbsp3-esque TJunc code;
- currently uses naive brute force approach to finding vertices on faces
- simplify 'face fragments', which now only need to contain vertex indices since they are already emitted
2022-07-11 01:40:10 -04:00
Eric Wasylishen f86a5343fb qbsp: rename options -> qbsp_options 2022-07-10 17:30:00 -06:00
Eric Wasylishen d32d6ea81d light: rename options -> light_options 2022-07-10 17:28:28 -06:00
Eric Wasylishen b7969eee49 vis: rename options -> vis_options 2022-07-10 17:26:55 -06:00
Jonathan 2a70cafa32 kinda fix overbrightness? still needs work..
allow lmshift force on light
2022-07-10 13:31:38 -04:00
Jonathan b30d200543 remove `entity` from functions that no longer need it
EmitVertices as its own phase
2022-07-10 12:50:16 -04:00
Jonathan 17112d3683 Merge branch 'brushbsp' of https://github.com/ericwa/ericw-tools into brushbsp 2022-07-10 03:21:44 -04:00
Jonathan f213f4aa45 fix edge sharing
remove the "don't share edges if they have different contents" thing
2022-07-10 03:21:36 -04:00
Eric Wasylishen 5da679d699 qbsp: trim some legacy comments/code 2022-07-10 00:15:25 -06:00
Eric Wasylishen d590e3d940 qbsp: move MakeBspBrushList to csg.cc for qbsp3 parity 2022-07-09 23:44:22 -06:00
Jonathan 8fc089aa34 fix lmscale with bounce lighting 2022-07-09 23:09:02 -04:00
Jonathan 865217c655 adjust final output 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 2b0a04a188 fix spacing 2022-07-08 02:07:01 -04:00
Jonathan 5f37159224 allow disabling auto-upgrade, in the case where you don't want it to keep trying to output a BSP2/QBSP when it won't work in your target engine(s)
# Conflicts:
#	include/qbsp/qbsp.hh
2022-07-08 02:06:12 -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
Eric Wasylishen 20ca6d2ef9 qbsp: add sphere bounds for bspbrush_t 2022-07-05 00:20:57 -06:00
Jonathan 6caee83eb2 remove old string parse stuff since we don't use it any more (the "parse the rest" method)
(cherry picked from commit fb3ff5decd)
2022-07-04 20:47:11 -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
Eric Wasylishen 92aa55db8f qbsp: clean up some dead code 2022-07-04 01:15:17 -06:00
Eric Wasylishen ac80d11e69 qbsp: move FreeTreePortals to tree.cc 2022-07-04 00:26:28 -06:00
Eric Wasylishen fce258a7b7 qbsp: csg4.cc -> csg.cc 2022-07-04 00:17:18 -06:00
Eric Wasylishen 296426f526 qbsp: use unique_ptr for tree_t 2022-07-03 23:48:00 -06:00
Eric Wasylishen 97d360120b qbsp: use unique_ptr for node_t::facelist 2022-07-03 23:41:48 -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 a6312753a4 fix clang build 2022-07-03 20:45:35 -06:00
Jonathan a0d81372d1 improved path detection (and overriding) routines
(cherry picked from commit 32f33fb4b3)
2022-07-03 18:23:40 -04:00
Jonathan 3527dcf39b Merge branch 'brushbsp' of https://github.com/ericwa/ericw-tools into brushbsp 2022-07-03 14:21:39 -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
Eric Wasylishen 40bba01b21 qbsp: brushbsp.cc import from qbsp3 2022-07-03 01:22:09 -06: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 f7016d1af0 Merge branch 'brushbsp' of https://github.com/ericwa/ericw-tools into brushbsp 2022-06-30 05:24:53 -04:00
Jonathan 9f734ff976 Merge branch 'type-cleanup' into brushbsp
# Conflicts:
#	common/bspfile.cc
#	include/common/bspfile.hh
#	light/trace.cc
2022-06-30 05:23:05 -04:00
Eric Wasylishen 2127209955 qbsp: add CreateBrushWindings from qbsp3 2022-06-30 00:31:42 -06:00
Jonathan 410106ff90 fix uninitialized memory 2022-06-29 14:27:00 -04:00
Jonathan 03ee5c52e8 add an entry point for specifically loading meta-only file formats, like .wal; used for discerning replacements from their source material (since replacements are often larger than the default, we need the scale info)
add a new meta format, which is just a JSON representation of the metadata contained in a .wal
simplify texture loading in `light`
fix `light` not handling replacement textures very well
string_iequals take string_view like the others
move averageColor to be alongside pixel data, where it belongs
2022-06-29 12:59:33 -04:00
Jonathan 292d5afb5e Merge branch 'brushbsp' of https://github.com/ericwa/ericw-tools into brushbsp 2022-06-28 06:08:04 -04:00
Jonathan c1dc3cb7d8 Merge branch 'type-cleanup' into brushbsp
# Conflicts:
#	include/common/bspfile.hh
2022-06-28 04:13:26 -04:00
Eric Wasylishen 1693bb3877 qbsp: side_t doesn't need sphere culling 2022-06-28 02:01:41 -06:00
Eric Wasylishen b21e245d99 qbsp: surface.cc -> faces.cc 2022-06-28 00:23:47 -06:00
Eric Wasylishen eb1f7acc02 qbsp: move PruneNodes to tree.cc for qbsp3 alignment 2022-06-28 00:06:18 -06:00
Jonathan 44c50717c3 move generic image loading routine to `img`
move light-specific "load textures from BSP" routine to light
fix a couple bugs with external wad textures (there should always be at least a 40-byte miptex in there)
light can now load external textures
move -paths to common settings
fix bug with missing texture not filling miptex name
2022-06-28 01:37:12 -04:00
Jonathan c23b7d2ec9 allow Quake-likes to load textures similarly to Q2 (finding best place to load them from)
allow Quake and Q2 to handle other texture formats (mainly just TGA for now)
2022-06-27 11:30:28 -04:00
Jonathan bf1cb56e5a fix build
add setting to control file priority
2022-06-27 10:41:24 -04:00
Jonathan cf04f644e0 Merge branch 'type-cleanup' into brushbsp
# Conflicts:
#	common/bspinfo.cc
#	include/common/bspfile.hh
#	include/qbsp/map.hh
#	include/qbsp/wad.hh
#	qbsp/wad.cc
2022-06-27 06:44:45 -04:00
Jonathan 510023e089 step 1 of finishing the rewrite I started of the image subsystems.
- for Quake-likes, WADs will be added as file system archives directly when the first brush is encountered since the wad key is ready to go by that point.
- after loading the .map and before constructing the BSP, what I call secondary textures (animation frames for Quake-likes) are added to the list, and the BSP's miptex data is filled.
- BSP miptex data is now opaque to the BSP process; the BSP simply copies the raw miptex information from the input. This simplifies the BSP structures and reading/writing routines.
- the img subsystem supports reading from raw miptexes now, although in practice this only happens for Quake-likes atm
- instead of a "wal cache", maps now have a "meta cache" which stores the metadata information for all games instead of just Quake II
- texture meta can now be ref'd out rather than needing to be copied every time (mainly only a gain for the std::string)
- wad.cc/wad.hh is gone; wads are now pushed into the filesystem archive
- fixed broken wad_archive
- fs subsystem iterated on a little bit; supports marking archives as external (only used for wads currently; see `LoadTextureData`)
- load_tga has better error handling
- add in foot-gun protection to the BSP readers; now they assert on failure to read instead of silently propagating that error throughout the rest of the process
- bsputil uses img stuff now, so it should handle palettes better
2022-06-27 03:58:23 -04:00
Eric Wasylishen c7111cc99e qbsp: move FloodAreas to portals.cc for parity with qbsp3 2022-06-27 01:32:34 -06:00
Eric Wasylishen 92dd54c0b1 bspfile: fix is_any_solid() implementation to be just (contents.native & Q2_CONTENTS_SOLID) 2022-06-27 01:19:31 -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
Jonathan 2264de71a2 Revert "very slight speedup (~3% improvement) on normalize; don't sqrt if we don't need to (rare), and use multiplication instead of division"
This reverts commit 8fe525f5b2.
2022-06-26 01:24:47 -04:00
Jonathan 00485553f3 / should be * 2022-06-26 01:22:03 -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 8fe525f5b2 very slight speedup (~3% improvement) on normalize; don't sqrt if we don't need to (rare), and use multiplication instead of division 2022-06-25 20:56:08 -04:00
Jonathan a4c304272a use floats for dealing with ray info, for consistency (and to avoid a bunch of float->double casts)
use raydir from hit point rather than calculating it twice
2022-06-25 04:47:26 -04:00
Jonathan 8b1472dfd1 Merge branch 'brushbsp' of https://github.com/ericwa/ericw-tools into brushbsp 2022-06-24 04:33:14 -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
Eric Wasylishen aabd1c27dc qbsp: face_t: make contents, lmshifts single sided
side_t: same, also remove contents (unused)
2022-06-24 01:14:11 -06:00
Eric Wasylishen 2452d5edda Merge branch 'brushbsp' of https://github.com/ericwa/ericw-tools into brushbsp 2022-06-24 00:54:55 -06:00
Jonathan c7169e11ee split LightFace into three distinct phases: Create, Light, and Save 2022-06-24 02:54:41 -04:00
Eric Wasylishen 7b81702c08 qbsp: remove unneeded fields from side_t/face_t 2022-06-24 00:54:02 -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 7e4169f001 qbsp: add a placeholder side_t that's just a copy of fae_t 2022-06-24 00:18:19 -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 038651fca6 qbsp: rename brush_t -> bspbrush_t for consistency with qbsp3 2022-06-24 00:01:02 -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 1718512b09 remove unnecessary "uncompressed_q2" - can just be a single buffer now
another ptr->vector
2022-06-23 17:08:50 -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 ee596f3ff1 use vector for vis state
set autoclean default to true, make it invertable
2022-06-23 16:18:52 -04:00
Jonathan 70d87a52d6 more pointers to vectors 2022-06-23 16:05:11 -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 c6521aa0b6 move aligned allocator to cmdlib 2022-06-23 00:39:28 -04:00
Jonathan 436a9183e7 use aligned allocator for rays 2022-06-22 23:42:38 -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 3f75bb4039 put ExportObj behind an option 2022-06-22 18:13:56 -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 6f6185e1a3 use unique_ptr for leafbits allocations 2022-06-22 16:04:55 -04:00
Jonathan b725b32c66 fix compile 2022-06-22 15:50:38 -04:00
Jonathan dfdd568974 use unique_ptr 2022-06-22 14:43:53 -04:00
Jonathan 3fbdfa2a36 allow removing the vis file if completed 2022-06-21 20:46:46 -04:00
Eric Wasylishen 40f370dbd5 Merge branch 'portalfaces' into brushbsp 2022-06-21 16:25:19 -06:00
Jonathan e97ad64bdc allow a global override to enable radiosity mode on _surface
allow Q2-style rads and Q1-style rads to be added together; also mimic the behavior of _surface which loads multiple lights for a single surface
2022-06-21 17:29:26 -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
Eric Wasylishen 57473f7b4a Merge branch 'brushbsp' into portalfaces 2022-06-21 01:45:14 -06:00
Eric Wasylishen 1c4b90a032 qbsp: fix detail_illusionary_noclipfaces_intersecting 2022-06-20 20:53:56 -06:00
Jonathan df3e6d3988 remove Little* funcs, not used any more
remove byteswap as it wasn't used any more
re-introduce imemstream and omemstream to make it harder to accidentally use the wrong operators
add dynamic padding stream manipulator
use memstreams for BSPX
2022-06-20 21:39:08 -04:00
Jonathan c79e263753 simplify bspx code
remove old obj preview for wrnormals
2022-06-20 20:42:34 -04:00
Jonathan 4163ab80cf Merge branch 'brushbsp' of https://github.com/ericwa/ericw-tools into brushbsp 2022-06-19 19:23:04 -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
Eric Wasylishen 4f3ca8c252 qbsp: wip import MarkVisibleSides from qbsp3 2022-06-19 16:04:54 -06:00
Eric Wasylishen 5fc6cbc95e qbsp: wip import MakeFaces from qbsp3 2022-06-19 16:04:54 -06:00
Eric Wasylishen c91bf3fc8d qbsp: add missing include 2022-06-19 16:04:29 -06: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 b54e72a184 re-implement the vis changes 2022-06-18 18:42:00 -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 dfa1282d40 simplify/c++-ize CompressRow code and related areas (less allocations overall) 2022-06-18 18:25:23 -04:00
Jonathan ea985eb5ac Merge branch 'brushbsp' of https://github.com/ericwa/ericw-tools into brushbsp 2022-06-18 17:29:13 -04:00
Jonathan ac05a7ecf6 Revert "simplify/c++-ize CompressRow code and related areas (less allocations overall)"
This reverts commit 46aaa81ffd.
2022-06-18 17:29:07 -04:00
Eric Wasylishen b91973bae1 qbsp: remove old/unused portal code 2022-06-18 13:44:24 -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 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 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
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
Jonathan c3bb07acaa ~33% speed improvement on vis by using already-allocated memory for the vis stack 2022-06-17 13:53:35 -04:00
Jonathan 46aaa81ffd simplify/c++-ize CompressRow code and related areas (less allocations overall) 2022-06-17 12:06:37 -04:00
Jonathan 238a7b8fa7 document FACENORMALS lump 2022-06-17 10:59:24 -04:00
Eric Wasylishen 259d95e47c testqbsp: add a first portal test 2022-06-17 01:53:08 -06:00
Eric Wasylishen 0edd52517a testqbsp: read .prt files back in 2022-06-16 23:22:15 -06:00
Eric Wasylishen f6309a91cb vis: move .prt reader to common 2022-06-16 21:55:03 -06:00
Eric Wasylishen a746506d6a clang-cl build fix 2022-06-16 20:54:15 -04:00
Jonathan 0b67acd4ba Merge branch 'brushbsp' of https://github.com/ericwa/ericw-tools into brushbsp
# Conflicts:
#	include/common/bspfile.hh
2022-06-16 20:22:36 -04:00
Jonathan e57633bbca the old Safe read/writes are gonedy now 2022-06-16 20:22:03 -04:00
Eric Wasylishen b164b7b250 bspfile: fix bad optional access on Q1 maps 2022-06-16 17:14:40 -06:00
Eric Wasylishen 83271c5dac Merge branch 'brushbsp' of https://github.com/ericwa/ericw-tools into brushbsp 2022-06-16 17:06:45 -06:00
Jonathan 5855ab3528 Merge branch 'brushbsp' of https://github.com/ericwa/ericw-tools into brushbsp 2022-06-16 12:06:45 -04:00
Jonathan d872514b56 split bspfile.hh into multiple files which store the respective BSP info for the different BSP types; bspfile_generic stores the upper-most data (the superset of all BSP types), whereas the individual files contain the subsets. 2022-06-16 12:06:37 -04:00
Jonathan 740ab24626 bspx stuff into its own file
change the printing to be less redundant on BSP version
2022-06-16 10:59:22 -04:00
Jonathan f53a6a19fe move extended_texinfo_t to qbsp, since it's only used during compilation and not related to the BSP file 2022-06-16 09:50:00 -04:00
Jonathan 41ef66190f consistency rename; gtexinfo_t -> mtexinfo_t 2022-06-16 09:36:31 -04:00
Jonathan 617cd3b089 consistency rename; texdata_t -> maptexdata_t 2022-06-16 09:35:46 -04:00
Jonathan c62480c337 consistency rename; mtexinfo_t -> maptexinfo_t 2022-06-16 09:35:08 -04: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
Jonathan 8afcc54b74 move making contents valid from brush parsing into gamedef 2022-06-15 09:07:37 -04:00
Eric Wasylishen 3474dd00c5 qbsp: add portal_t::onnode, tree_t from qbsp3 2022-06-15 00:45:58 -06:00