Commit Graph

191 Commits

Author SHA1 Message Date
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
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 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 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
Jonathan f6d6972b17 fix percents being output when not requested for submodels
tjunc using MWT algorithm
2022-07-22 12:25:06 -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
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
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
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 f213f4aa45 fix edge sharing
remove the "don't share edges if they have different contents" thing
2022-07-10 03:21:36 -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 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
Eric Wasylishen 97d360120b qbsp: use unique_ptr for node_t::facelist 2022-07-03 23:41:48 -06:00
Eric Wasylishen 40bba01b21 qbsp: brushbsp.cc import from qbsp3 2022-07-03 01:22:09 -06:00
Jonathan c1dc3cb7d8 Merge branch 'type-cleanup' into brushbsp
# Conflicts:
#	include/common/bspfile.hh
2022-06-28 04:13:26 -04: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
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 7b81702c08 qbsp: remove unneeded fields from side_t/face_t 2022-06-24 00:54:02 -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 038651fca6 qbsp: rename brush_t -> bspbrush_t for consistency with qbsp3 2022-06-24 00:01:02 -06:00
Eric Wasylishen 5fc6cbc95e qbsp: wip import MakeFaces from qbsp3 2022-06-19 16:04:54 -06:00
Eric Wasylishen af2dd987d8 qbsp: import BaseWindingForNode from qbsp3 2022-06-17 22:10:11 -06: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 c62480c337 consistency rename; mtexinfo_t -> maptexinfo_t 2022-06-16 09:35:08 -04:00
Jonathan 17656eff78 don't return string ref, since it can be modified after it's inserted because of the vector growing 2022-06-14 18:34:01 -04:00
Jonathan 7827885f0f add texturedef support
change Q2_CONTENTS_TRANSLUCENT parsing; remove it always, but if the surface doesn't have TRANS then swap it with DETAIL which is probably what they intended
2022-06-14 10:50:35 -04:00
Jonathan 4e2e1c9bb3 default filltype to auto, which uses outside for hullnum > 0 and inside otherwise (lower leaf & node counts) 2022-06-13 06:19:58 -04:00
Jonathan 4755f23efa re-implement inside filling (not working fully yet) 2022-06-13 01:44:06 -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 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 f8c227acbf Merge branch 'type-cleanup' into brushbsp 2022-05-18 23:17:40 -06:00
Jonathan b63eb11275 wadpath/xwadpath always take 1 argument 2022-05-18 17:50:05 -04:00