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
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
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
92dd54c0b1
bspfile: fix is_any_solid() implementation to be just (contents.native & Q2_CONTENTS_SOLID)
2022-06-27 01:19:31 -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
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
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
c6521aa0b6
move aligned allocator to cmdlib
2022-06-23 00:39:28 -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
b725b32c66
fix compile
2022-06-22 15:50:38 -04:00
Jonathan
dfdd568974
use unique_ptr
2022-06-22 14:43:53 -04:00
Eric Wasylishen
40f370dbd5
Merge branch 'portalfaces' into brushbsp
2022-06-21 16:25:19 -06: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
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
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
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
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
Jonathan
7eedf52bf4
sync up BaseWinding checking
...
add constructor to aabb to construct from range
2022-06-18 14:33:16 -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
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
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
8afcc54b74
move making contents valid from brush parsing into gamedef
2022-06-15 09:07:37 -04:00
Eric Wasylishen
0c24e7bbd0
clang-cl build fix
2022-06-14 20:18:06 -06:00
Jonathan
eedabe6f1c
fix bugs
2022-06-14 18:38:22 -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
78b979d670
Merge branch 'type-cleanup' into brushbsp
...
# Conflicts:
# include/light/entities.hh
# qbsp/brush.cc
# qbsp/map.cc
2022-06-14 17:19:30 -04:00
Jonathan
d24ea4922a
entdict cleanup
2022-06-14 17:18:13 -04:00
Jonathan
f1fd0bd30f
Merge branch 'brushbsp' of https://github.com/ericwa/ericw-tools into brushbsp
2022-06-14 10:50:54 -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
Eric Wasylishen
a309e8467b
testmaps: add qbsp_q1_sealing.map
2022-06-14 00:44:50 -06:00
Jonathan
12caf1bcd4
move transsky/transwater code into portal_can_see_through
2022-06-13 02:34:39 -04:00
Jonathan
98682f41fa
move brush/leaf counts into gamedef
...
(Q2 stores every combo currently, old code kept in case we want to use that instead)
2022-06-12 03:35:44 -04:00
Jonathan
1a88b46e8c
RemapContentsForExport moved into gamedef
...
simplified gamedef stuff by checking which functions were still necessary, and no need to pass extended flags through at all now
detail type moved into Q1
2022-06-12 02:24:27 -04:00
Jonathan
54900cf7b6
move visblocker to a boolean
2022-06-12 01:02:31 -04:00
Jonathan
13bf99a7f3
fix test cases (implement equals(game) properly, and `is_empty` is false depending on get_content_type for Q2 now)
...
remove unnecessary condition from Q2 contents_are_empty since areaportals are already considered a valid non-empty type via get_content_type
2022-06-11 09:19:51 -04:00
Jonathan
10676603e9
move clip & origin into game-specific code
...
remove hint from brush; hint is technically a surface flag rather than a content flag, so we can infer it from the sides rather than needing to store it as a unique flag (we could still cache the result somewhere but this makes it consistent between q1 and q2)
2022-06-11 08:29:55 -04:00
Jonathan
b33e792458
move clip-own-typeness over to gamedef & contentflags (fixes Q2 edge case with a solid version of a type bordering a translucent version)
2022-06-11 06:01:36 -04:00
Jonathan
e61998dd54
Merge branch 'brushbsp' of https://github.com/ericwa/ericw-tools into brushbsp
...
# Conflicts:
# qbsp/surfaces.cc
2022-06-11 05:43:29 -04:00
Jonathan
8b4f9f5480
move mirrorinside to gamedef
2022-06-11 05:37:50 -04:00
Eric Wasylishen
5372c4a568
qbsp: fix q2 liquids not mirrored
2022-06-10 23:29:28 -06:00
Eric Wasylishen
64159d92f1
Merge remote-tracking branch 'github-desktop-paril/type-cleanup' into brushbsp
2022-06-10 21:32:23 -06:00
Eric Wasylishen
fc5f1573ef
qbsp: simplify ShouldClipbrushEatBrush
...
fixes lavaclip test case
2022-06-10 20:00:42 -06:00
Eric Wasylishen
d4f1707cdb
qbsp: proper merging of Q2 contents
2022-06-10 19:19:00 -06:00
Jonathan
812797f7ed
enable lighting for warp/sky in Q2
...
simplify bitflag definitions
change nudging light warning to make more sense
another #define -> constexpr pass
2022-06-10 06:29:14 -04:00
Jonathan
5b4660fa63
simplify crc code
2022-06-10 04:47:10 -04: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
Eric Wasylishen
3c4f798e97
qbsp: add create_detail_illusionary/fence/solid_contents
2022-06-10 01:07:20 -06:00
Eric Wasylishen
8c1095715c
qbsp: refactor out is_detail(int32_t types = CFLAGS_DETAIL_MASK) since it's going to depend on game now
2022-06-09 23:48:26 -06:00
Eric Wasylishen
47aa1f7476
qbsp: replace is_detail() with is_any_detail(options.target_game)
2022-06-09 23:32:33 -06:00
Eric Wasylishen
33f1681261
bspfile.hh: updates to content type constants docs
2022-06-08 01:03:39 -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
Eric Wasylishen
e3ee12e985
Merge branch 'type-cleanup' into brushbsp
2022-06-03 23:44:03 -06:00
Eric Wasylishen
b6c421d30e
bspfile.hh: #define -> constexpr for content flags
2022-06-03 20:12:04 -06:00
Jonathan
65852ef042
adjust settings_set to only accept one token per entry
...
radlights is now a set (only loads one though)
2022-06-01 20:42:06 -04:00
Eric Wasylishen
0f2ea5333d
move CompressRow/DecompressRow from vis to common
2022-05-24 21:01:41 -06:00
Eric Wasylishen
25b390aafe
qbsp: merge original brush lists when merging leafs in PruneNodes
2022-05-21 16:05:22 -06:00
Eric Wasylishen
b21b7466ce
Merge branch 'type-cleanup' into brushbsp
2022-05-16 21:33:57 -06:00
Jonathan
ad85489580
fix windings > N being initialized wrongly
2022-05-15 21:07:35 -04:00
Eric Wasylishen
8fe5d9d694
common: adjust formatting of usage line
...
-remove version hash as it's printed above
-rename `usage` variable to `programDescription`
2022-05-15 17:44:17 -06:00
Eric Wasylishen
6f1ca3c79d
Merge branch 'type-cleanup' into brushbsp
2022-05-15 14:02:42 -06:00
Jonathan
d9c6e52bd3
Merge branch 'type-cleanup' of https://github.com/Paril/ericw-tools into type-cleanup
2022-05-15 10:09:41 -04:00
Jonathan
e2512372c3
fix -convert not working properly for Q2 maps
...
begin code for alias files
2022-05-15 10:09:38 -04:00
Eric Wasylishen
c82741ff8a
Merge branch 'type-cleanup' into brushbsp
2022-05-15 00:46:49 -06:00
Eric Wasylishen
9c806d2d15
settings: don't call exit(0) in printHelp() as it's problematic for tests
2022-05-14 18:11:14 -06:00
Eric Wasylishen
ba37ae3a54
move serialize_bsp() to common/bspinfo.cc
2022-05-14 14:54:21 -06:00
Eric Wasylishen
4957622c50
Merge branch 'type-cleanup' into brushbsp
2022-05-13 01:24:14 -06:00
Jonathan
59db5bfdc5
Merge branch 'type-cleanup' of https://github.com/Paril/ericw-tools into type-cleanup
...
# Conflicts:
# include/qbsp/qbsp.hh
# qbsp/map.cc
# qbsp/qbsp.cc
2022-05-11 09:50:46 -04:00
Jonathan
cbdb5c0c73
slight bit of cleaning
2022-05-11 09:46:39 -04:00
Eric Wasylishen
a1b8a38283
merge non-brush bsp specific changes from brushbsp branch
2022-05-11 01:58:53 -06:00
Eric Wasylishen
4a711908c8
Merge branch 'pr/322' into brushbsp
2022-05-11 00:29:58 -06:00
Eric Wasylishen
6e3bb91d98
build: fix build on macOS/clang
2022-05-11 00:21:14 -06:00
Eric Wasylishen
e9abb212bb
settings: allow setting_enum to parse numeric representation of enums
...
use it for light forumla. disallow enums in setting_numeric.
2022-05-10 22:55:41 -06:00
Eric Wasylishen
d390ac2030
build: restore !enum check on setting_numeric constructor and boolValue()
...
with non-MSVC workaround
2022-05-10 22:08:41 -06:00
Eric Wasylishen
abc799554d
build: fix all clang-cl warnings
2022-05-10 21:57:17 -06:00
Eric Wasylishen
d763b2e336
build: support clang-cl
2022-05-10 21:39:58 -06:00
Eric Wasylishen
66ba184083
Merge branch 'type-cleanup' into brushbsp
2022-05-10 00:47:41 -06:00
Eric Wasylishen
0c4833226a
settings: implement reset(). Fix setting_mangle::copyFrom()
...
We can't use the string serialization/deserialization trick because setting_mangle transforms
the value upon parsing
2022-05-10 00:43:22 -06:00
Eric Wasylishen
081d63a64c
settings: add setting_container::copyFrom, setting_base::copyFrom
...
disable copy constructors on setting_container/setting_base, which were previously available but broken
2022-05-09 22:32:09 -06:00
Eric Wasylishen
4021d71700
polylib: make operator[] un-bounds-checked
2022-05-08 15:20:21 -06:00
Eric Wasylishen
1df848cfc1
testqbsp: areaportal test
2022-05-04 17:47:14 -06:00
Eric Wasylishen
e0d0d5246f
aabb: add disjoint_or_touching
2022-05-03 19:22:14 -06:00
Eric Wasylishen
ec20072440
testqbsp: expand q2 detail test
2022-05-02 20:24:18 -06:00
Eric Wasylishen
fa97116d12
testqbsp: wip markfaces test
2022-05-02 02:13:54 -06:00
Eric Wasylishen
3a30891476
testqbsp: add more detail_illusionary tests
2022-05-01 21:44:58 -06:00
Eric Wasylishen
59684a1c5d
Merge remote-tracking branch 'Paril/type-cleanup' into brushbsp
2022-05-01 01:21:01 -06:00
Eric Wasylishen
13612f18d0
qbsp: factor out 'chops' condition in BrushGE
2022-05-01 00:48:58 -06:00
Jonathan
cc0e1a5561
move Face_IsLightmapped to light
...
Fix q2rtx, needs to include lightstyle for nodraw for emissive invisibles with lightstyles
fix wal (for the 900th time)
auto-set -nolighting for -q2rtx
2022-04-30 23:27:21 -04:00
Eric Wasylishen
fb59c2e950
bspfile.hh: q1 contents from #defines to constexpr
...
now prints properly in GTest assertions
2022-04-28 00:47:34 -06:00
Eric Wasylishen
10fbfff20d
qbsp: liquids are higher priority than detail_illsuionary
2022-04-27 01:26:56 -06:00
Eric Wasylishen
d2c7412a44
testqbsp: proper test for detail_doesnt_remove_world_nodes
2022-04-26 19:08:44 -06:00
Eric Wasylishen
8731dcb469
bspfile.hh: remove covered_native
2022-04-26 01:23:36 -06:00
Eric Wasylishen
1a0b4c0733
qbsp: more covered_native stuff to remove
2022-04-25 22:01:10 -06:00
Eric Wasylishen
9977c14a2f
bspfile: add gamedef_t::contents_seals_map()
2022-04-25 18:40:55 -06:00
Eric Wasylishen
28c9cda561
Merge remote-tracking branch 'Paril/type-cleanup' into brushbsp
2022-04-17 13:46:50 -06:00
Jonathan
91310ef6b8
Merge branch 'type-cleanup' of https://github.com/Paril/ericw-tools into type-cleanup
2022-04-16 22:20:35 -04:00
Jonathan
6080e7fc5d
a bit of q2rtx stuff
2022-04-16 10:28:46 -04:00
Eric Wasylishen
24ca07188c
log: use ANSI colors for strings containing "warning" or "error"
2022-04-03 14:16:22 -06:00
Eric Wasylishen
a0fbfdbad5
log: use ANSI colors for strings containing "warning" or "error"
2022-04-03 12:56:11 -06:00
Eric Wasylishen
a019088c2f
Merge branch 'type-cleanup' into brushbsp
2022-04-02 21:05:46 -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
a479a5ddfb
use case-insensitive natsort for discoverArchives
...
add two other logging control bools, which -quiet now redirect to
add -lowpriority for CPU priority (on Windows)
2022-02-28 09:20:35 -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
Eric Wasylishen
658d807052
qbsp: finish re-adding CSG code
2022-02-21 12:35:27 -07:00
Eric Wasylishen
3b348af301
qbsp: wip mirroring faces
2022-02-21 00:47:57 -07:00
xDShot
5780ce4bd6
Include some headers for brushbsp branch files ( #325 )
...
* include <vector> for std::vector definition
* include <algorithm> for std::clamp definition
2022-02-19 11:17:20 -07:00
Eric Wasylishen
8531286777
qbsp: replace `-nothreads` with `-threads 1` for consistency with light/vis
2022-01-30 17:50:21 -07: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
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
Jonathan
93505a88b2
Merge branch 'type-cleanup' of https://github.com/Paril/ericw-tools into type-cleanup
2022-01-26 18:03:36 -05:00
Jonathan
571e7337fc
Fix the temporary hintskip detection and finally move it to gamedef
...
Dynamic extent calculation - turned on by default - will automatically determine the extents used for winding_from_plane beforehand. On a 50kb .map file it only takes about 10ms, so for the majority of maps it should be instantaneous.
2022-01-26 18:03:31 -05:00
Eric Wasylishen
19dbc1c1c8
polylib: fix compile error with clang
2022-01-25 19:55:07 -07:00
Jonathan
0414c77c19
Use copies rather than moving for conversion, so that graceful upgrades are graceful again
2022-01-25 04:49:20 -05:00
Jonathan
ff2ff5c87f
fix emplace UB
2022-01-25 04:21:07 -05:00
Jonathan
5dd2deba8e
use custom type for two-sided things to simplify brain power (.front/.back is easier to process than [0]/[1])
2022-01-23 00:26:58 -05:00
Jonathan
68424edb8d
introduce a flag for whether the target game supports bmodels with contents
...
move the check in SubdivideFace so that it can early-exit if subdivision isn't even enabled
2022-01-21 00:51:06 -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
Jonathan
10fa97e6b8
Use string_view where appropriate for parser, add some additional constructors for ease of use
2022-01-16 04:17:06 -05:00
Eric Wasylishen
4e94c7bab3
bspfile: fix UB reinterpret_cast causing ASan to complain on macOS
2022-01-15 22:40:03 -07:00
Eric Wasylishen
f02bbca0c7
parser: fix reading past end of buffer
2022-01-15 18:31:35 -07:00
Jonathan
3d9277b711
Merge branch 'type-cleanup' of https://github.com/Paril/ericw-tools into type-cleanup
2021-12-20 14:51:20 -05:00
Jonathan
e2d64e0e5d
FS simplification
...
Fix transparency calculation (33% is 33% opacity, not 33% transparency)
2021-12-20 14:51:14 -05:00
Eric Wasylishen
5c7a490fea
qv::PolyArea: return 0 for degenerate polygons
2021-12-15 23:12:48 -07:00
Jonathan
0c827208ec
Allow `-subdivide 0` to turn off subdivision
...
imglib now lives in common
fs 'load' split into two functions, where and load. the former allows you to query for and return archive & path for a given file, whereas the latter handles that for you.
use log verbose in light rather than own verbose flag
2021-11-21 15:08:02 -05:00
Jonathan
8cadf06d81
New FS!
...
First FS test: use it for decompile for Q2 to prevent unnecessary suffixes
2021-11-05 19:25:37 -04: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
c37ec80667
Implement game-agnostic Brush_GetContents
2021-10-26 09:13:48 -04:00
Jonathan
2bdfdc90cc
Fix disjoint
2021-10-25 19:39:18 -04:00
Jonathan
3f27b11bf9
Fix qv::min/qv::max
2021-10-25 19:37:18 -04:00
Jonathan
1ccbe9e12c
wrbrushes lump using streaming now
...
temp(?) fix for structural covered by detail
2021-10-25 19:24:07 -04:00
Jonathan
e401136b4d
Merge branch 'type-cleanup' of https://github.com/Paril/ericw-tools into type-cleanup
2021-10-25 10:38:32 -04:00
Jonathan
e0ed70cc87
no more Vector!
2021-10-25 10:38:15 -04:00
Jonathan
e1695ebfd3
VectorAdd & simplify TexDef_BSPToBrushPrimitives (needs testing)
2021-10-25 08:39:29 -04:00
Eric Wasylishen
02d3284045
bspfile: get rid of default implementations of contents_are_empty/solid/sky
2021-10-25 00:05:11 -06:00
Eric Wasylishen
71c5501ef0
qvec: revert plane3::operator- change.
...
not worth trying to maintain all of the inconsistent special cases of the old code.
2021-10-24 16:20:52 -06:00
Eric Wasylishen
72b39bc576
qplane3::operator-: implement "inverting" the normal as 0 - normal
...
to avoid introducing -0, for consistency with the old code, which tended to flip normals this way.
2021-10-24 14:47:02 -06:00
Jonathan
3456f62a90
Smaller equalExact (probably should just get rid of this tbh)
...
Fix for ClosestPointOnLine
2021-10-24 14:20:24 -04:00
Jonathan
bfc854efcb
base64 bmp images for texture debug
...
Fix qv::length
2021-10-24 13:55:27 -04:00
Jonathan
d0e557b9cb
Fix BSPX on q2bsp
...
Fix normalize generating NaNs to match old behavior of generating zero on zero length
Remove extended texinfo file before potentially not writing new one
2021-10-24 06:56:31 -04:00
Jonathan
5f40d5a7ae
Fix segfault
2021-10-24 05:09:47 -04:00
Jonathan
3c2ca93b0c
normalizeInPlace no longer nodiscard since you might want to only normalize the ref
...
remove VectorNormalize
2021-10-23 13:34:12 -04:00
Jonathan
fae69309a0
VectorLength
2021-10-23 13:24:25 -04:00
Jonathan
7c661a3759
distance-squared
2021-10-23 13:22:32 -04:00
Jonathan
865fbb0745
VectorMA
2021-10-23 13:20:43 -04:00
Jonathan
4dca2d7d07
VectorInverse, VectorSet, VectorClear gone
2021-10-23 13:15:38 -04:00
Jonathan
c607c0d98f
Fix extraneous maybe_unused's
...
Fix qmat::row
2021-10-23 09:34:33 -04:00
Jonathan
74253fd189
Fixed Unix/Clang compilation
...
Adjusted makefile to work with both clang and msvc on win32
Removed "WIN32", use the standard _WIN32 instead
Fixed bad VectorCopy's
Use qvec4b instead of special color_rgba type
qvec now follows built-in type procedures for handling operators; this means that (qvec3i + qvec3f) will now properly produce a float, as one would expect, instead of adding the float to the integers without casting to the common type.
2021-10-23 07:35:41 -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
fdeb7d34f5
missing file
2021-10-21 20:05:17 -04:00
Jonathan
84b4388f4b
Added a deprecation sniffer so I can find problematic areas later
...
Revert tjunc fixes
Add -notjunc to match other editors
Rid Light_Add since it's too simple
2021-10-20 04:27:22 -04:00
Jonathan
1bf6261826
constexpr/inline qv:: where appropriate
...
comment out rewrite test in bspinfo
updated tjunc code
2021-10-19 23:26:43 -04:00
Jonathan
95b47db922
More qmat/qvec where appropriate
...
Add a json.hh file which includes common JSON serialization types
surfflags_t::extended uses booleans instead of a bitflag for simplicity
JSON serialization for surfflags
2021-10-19 21:15:00 -04:00
Jonathan
a7de4bdae2
Remove unused thingies
...
Use qplane3 where we can
2021-10-17 06:24:02 -04:00
Jonathan
fd18fc154c
Fix various warnings by testing a clang-cl compile
2021-10-12 14:39:15 -04:00
Jonathan
c6393abdd9
Fix for qmat::qmat
2021-10-12 13:56:36 -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
e1290fd0f4
Snap normals/tangents/bitangents written from WriteNormals to save some bits
...
Texvec inherits mat<2, 4> now, since it's the most logical type for it to be based on.
2021-10-12 13:52:47 -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
b68b370147
bspfile: replace 'abstract' with '= 0' (abstract seems to be a C++/CLI keyword?)
2021-10-11 23:22:19 -06:00
Jonathan
6ec134a1f0
Merge branch 'type-cleanup' of https://github.com/Paril/ericw-tools into type-cleanup
2021-10-11 19:46:04 -04:00
Jonathan
bd6bc0dc56
surfflags remap -> is_valid to match contentflags
...
warn on excessive key/value lengths, per-game
2021-10-11 19:45:55 -04:00
Eric Wasylishen
a60581c99a
qvec: fix undefined behaviour in PolyCentroid
2021-10-11 12:59:37 -06:00
Eric Wasylishen
fe99d69d07
qvec: implement Google Test formatter
2021-10-11 12:55:06 -06:00
Eric Wasylishen
feb57abbe2
qvec.hh: build fix
...
qvec3f is defined lower in the file
2021-10-11 12:19:39 -06:00
Jonathan
01b8abf93c
Removed a lot of unused functions
...
Moved vector-related operations from mathlib to qvec, moved a few into qv::
Use clamp/max/min directly instead of #define'ing them
Move a few single-use functions directly above their usages
2021-10-10 14:04:09 -04:00
Jonathan
a8d5125321
Merge branch 'type-cleanup' of https://github.com/Paril/ericw-tools into type-cleanup
2021-10-09 14:14:54 -04:00
Jonathan
eb4bcf96dc
-includeskip for Q2RTX
...
Fix missing fmt include
Default nexttexinfo to -1 to match other tools
Fmt support for bspversion_t, use that instead of a static function
Cleanup write functions
2021-10-09 14:14:49 -04:00
Eric Wasylishen
9dcef7839a
common: remove dead code (mesh_t, octree)
2021-10-09 11:40:35 -06:00
Eric Wasylishen
76d0dae890
mathlib: GLM_InterpolateNormal: quick hack to fix build of testlight
2021-10-08 19:31:06 -06: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
1b1679fa22
normals are now a special tuple-ish type, so that we can calculate tangents and bitangents for Q2RTX if requested (currently it always does it, but we can fix that later)
...
always emit texinfo for q2 brush sides
2021-10-08 14:17:48 -04:00
Eric Wasylishen
d40e79ae29
mathlib: revert Q_rint to match master
...
The one on master returns 0 ==Q_rint(-0)
whereas the std::rint returns -0 == Q_rint(-0)
2021-10-07 19:08:34 -06:00
Jonathan
aa2a94e0a7
Uninitialized values aren't constexpr, changing these default constructors to inline
2021-10-06 03:43:30 -04:00
Jonathan
16d3bcc7c7
Revert "clang /macOS: un-constexpr things that were erroring"
...
This reverts commit 33745c3cb8 .
Value-initialize v which removes the need for the bottom `if constexpr` expression.
2021-10-06 03:42:46 -04:00
Eric Wasylishen
fd28067b5c
fix gcc errors about reference to temporary
2021-10-05 23:28:33 -06:00
Eric Wasylishen
07b24cce79
qvec: fix mat * mat on clang/gcc
2021-10-05 23:12:02 -06:00
Jonathan
cb9d90744f
More constexpr
2021-10-05 23:49:15 -04:00
Jonathan
75bcccada1
Fix more unused value warnings
...
Fix operator >= and <= for tuple of arrays
2021-10-05 23:40:40 -04: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
ca0111ce5d
Fix missing unordered_map
...
Maybe fix for tons of -Wunused-value
2021-10-05 23:00:13 -04:00
Jonathan
a2edc09018
Resolve GCC wanting `template` before emplacements
2021-10-05 22:54:25 -04:00
Jonathan
b4afc32e2b
Fix winding_edges using old get() name
...
Another attempted fix at VA_ARGS
Fix missing typename prefix
2021-10-05 22:44:13 -04:00
Jonathan
f4fc8bc72b
Remove unused functions, fix math issues
...
MacOSX potential fix for __VA_ARGS__
2021-10-05 22:35:30 -04:00
Jonathan
37cb535f1a
implement MSVC-style setp
2021-10-05 22:05:35 -04:00
Jonathan
81b7fbf916
Fix MSVC extension for setp
...
Fix PointsAlongLine
2021-10-05 21:38:04 -04: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
Jonathan
037c587352
Merge remote-tracking branch 'remotes/origin/qbsp-contentflags' into type-cleanup
...
# Conflicts:
# bspinfo/bspinfo.cc
# include/common/bspfile.hh
# include/light/light.hh
# include/light/trace.hh
# light/light.cc
# light/ltface.cc
# light/trace.cc
# qbsp/brush.cc
# qbsp/csg4.cc
# qbsp/outside.cc
# qbsp/qbsp.cc
2021-10-03 13:08:50 -04:00
Jonathan
ae4512da2c
BSPX structurization and cleanup
...
Some more vec3_t removals
A bunch of float -> vec_t in light
Simplified construction of lockables
mapdata_t writes directly to an mbsp instead of vector copies
2021-10-03 12:16:13 -04:00
Jonathan
792951792c
some more cleanup
2021-10-02 05:56:45 -04:00
Eric Wasylishen
59e71d7600
Merge branch 'master' into qbsp-contentflags
2021-10-01 23:39:12 -06:00
Jonathan
9d828d2085
Structured texture data!
...
Move vis decompress/compress back to vis since phs is handled there now too
Fix missing textures in Q1BSP
Comment areaportaling for now
2021-09-30 11:33:04 -04:00
Jonathan
1a5dc9934f
Remove span offset code - the compression ratio was not worth it
...
Allow Q2-esque maps to compile under Q1 modes
Use Q2tools-adapted version of AddBrushBevels for compiling brush sides
Extended limits overflow code displays member that overflowed now, for debugging
2021-09-28 02:10:01 -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
b205127e81
Fix exactEmpty
...
Simplify output_dir
2021-09-27 21:03:24 -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
87d31e6d4f
A lot of type-y stuff here:
...
- bsp store vectors now
- vis stored in a way that is compatible with both Q2 and Q1
- binary reading of stuff, so swapping is done at load time now
- vis cleanup, although there's still a lot of raw long modification that should get simplified later
2021-09-25 23:58:02 -04:00
Eric Wasylishen
8ff65cc05a
bspinfo: JSON export of BSPX BRUSHLIST lump
2021-09-25 16:54:14 -06:00
Eric Wasylishen
f1744118e2
qbsp: move BSPX BRUSHLIST struct types out to bspfile.hh
2021-09-25 15:42:42 -06:00
Eric Wasylishen
f7c0c80a26
qbsp, light: allow _minlight to go up to 510 instead of 255 on func_detail/etc.
2021-09-25 13:11:15 -06: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
Jonathan
ed37289290
Store extended limits format in bspversion
2021-09-23 14:42:56 -04:00
Eric Wasylishen
4c5d8b99f9
add missing <tuple> include (for std::tie)
2021-09-22 22:32:37 -06: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
Eric Wasylishen
80a4aa1b97
Merge branch 'master' into qbsp-contentflags
2021-09-22 00:12:27 -06:00
Jonathan
2ebfdb096f
Remove COM_Parse, use parser_t
...
Game controls hull sizes now
2021-09-20 19:45:09 -04:00
Jonathan
9f1f575761
Parser simplification and classification
...
Hulls stored in game definitions
2021-09-20 16:24:38 -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
Jonathan
17606fde4b
Use variant instead of having all BSP types allocated at once (even though they are smol)
...
Move ownership of pointers to the bsp structures themselves for now.
2021-09-16 11:52:37 -04:00
Jonathan
e8bd554cc0
winding_t is now a C++ type - a hybrid stack/heap array.
...
In preparation for converting all of the vec_t[3] to qvec's, the Vector routines are now templated and work with any type that provides indexing operators.
Polylib.cc is gone, since this all needs to be in header now
qvec can now implicitly convert from T[N]
constexpr where appropriate
static inline -> inline
side_t is now an enum, moved into mathlib
2021-09-16 03:10:51 -04:00
Jonathan
1dd4df1b20
calloc/malloc/free -> new/new/delete (except for specific scenarios)
2021-09-14 11:39:12 -04:00
Jonathan
eb6bb81d61
use the C++ includes
...
stdbool not required
_vsnprintf and _snprintf are standard in MSVC since 2015, so I just use them directly now. They'll be replaced by std::fmt later anyways.
use <thread> for threading, instead of pthreads/windows.h thread directly
2021-09-14 08:46:03 -04:00
Jonathan
7f8d2cfb49
Fix single line functions
2021-09-14 02:56:44 -04:00