Commit Graph

821 Commits

Author SHA1 Message Date
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 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 04e88085b6 Fix concave angle being clamped incorrectly
Use abs for phongdebug - matches q2rtx and seems to look nicer overall
Fix lightsurf snormal being calculated wrong
2021-10-22 04:22:54 -04:00
Jonathan 443be60a74 Compress texinfo a bit 2021-10-22 03:50:15 -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 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 46ea7b4822 Merge branch 'type-cleanup' of https://github.com/Paril/ericw-tools into type-cleanup 2021-10-19 16:39:49 -04:00
Jonathan c11ad63358
Merge branch 'ericwa:master' into type-cleanup 2021-10-19 16:39:38 -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 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 c88274f806 qbsp: outside.cc: rewrite with outside -> in filling 2021-10-11 22:40:26 -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 134c286b5e qbsp: fix spurious leak in base1.map 2021-10-11 13:48:17 -06:00
Eric Wasylishen 41d125c32e qbsp: add _omitbrushes to tell qbsp to discard all brushes in a func_ 2021-10-10 12:25:47 -06:00
Jonathan e2ba8d7b5a fNoclip not required for Q2 any more 2021-10-10 14:12:02 -04: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
Eric Wasylishen a1609ae1e6 qbsp: add _omitbrushes to tell qbsp to discard all brushes in a func_ 2021-10-09 15:22:27 -06: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 bf8f00df01 build: don't compile qbsp + light twice 2021-10-08 20:30:18 -06:00
Eric Wasylishen 34b6462641 build: build common as a static library 2021-10-08 20:08:26 -06:00
Eric Wasylishen e8b943cf90 build: remove DOUBLEVEC_T (unused now) 2021-10-08 19:47:32 -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 cfee292e5f qbsp: use fmt to print portals 2021-10-08 00:44:34 -06:00
Eric Wasylishen 9610841dd7 qbsp: use fmt to print "origin" keys for rotators 2021-10-07 23:52:30 -06:00
Eric Wasylishen 532b35c5bf qbsp: insert new epairs at the end of an entity 2021-10-07 20:06:20 -06:00
Eric Wasylishen 681a916348 qbsp: wad.cc: zero out data after \0 in dmiptex_t.name
This is just for consistency with the cleanup branch which is also doing this
2021-10-07 00:31:11 -06:00
Eric Wasylishen f6e9ba4eb2 qbsp: drop mapentity_t::epair_order and std::map for epairs
just store as a std::vector of pairs. Lookups aren't done much in qbsp
so linear search performance should be fine.

epair_order approach gets messy because we sometimes add epairs
2021-10-06 18:26:25 -06:00
Eric Wasylishen ca7002cb38 qbsp: preserve .map file order of epairs 2021-10-06 17:58:20 -06:00
Eric Wasylishen 9b19828530 qbsp: avoid triggering MSVC std::vector access bounds check
even though we're just taking the address with &, face->edges[face->w.size()]
was accessing an out-of-bounds element
2021-10-06 16:44:14 -06:00
Eric Wasylishen 0d06489016 qbsp: change HashVec to inline (fixing macOS build) 2021-10-06 16:38:24 -06: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 a84de6a2d6 csg4.cc: don't use alloca inside loop
it's crashing in release builds on macOS..
not sure exactly why, but it's also leaking stack
since none of them are freed until the function exits
2021-10-06 01:02:03 -06:00
Eric Wasylishen 22145327e6 qbsp: fix use-reference-after-vector-resize 2021-10-06 00:19:47 -06:00
Eric Wasylishen 097f033eb8 testqbsp: fix build 2021-10-05 23:41:43 -06:00
Eric Wasylishen fd28067b5c fix gcc errors about reference to temporary 2021-10-05 23:28:33 -06:00
Eric Wasylishen 33745c3cb8 clang /macOS: un-constexpr things that were erroring
neither clang nor gcc like the qvec(Args..) constructor
being constexpr.

GCC's error says:
error: member ‘qvec<3, double>::v’ must be initialized by mem-initializer in ‘constexpr’ constructor
2021-10-05 23:18:52 -06:00
Eric Wasylishen c54fea1e87 qbsp: face_t: use a std::vector for edges
shared_ptr of C arrays is not working on macOS,
but std::vector is also more correct semantically
2021-10-05 23:15:43 -06:00
Jonathan 52839d4e7f Run clang-format pass 2021-10-05 15:54:06 -04:00
Jonathan 4ad798e29c Fix origin brushes
Fix merge stuff from qbsp-contentflags
2021-10-05 15:50:18 -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
Eric Wasylishen a91bc56aaa qbsp: outside.cc: match original behaviour 2021-10-05 01:07:26 -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 ee8ee57cc1 qbsp: delete brushbsp.cc 2021-10-03 20:13:21 -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
Eric Wasylishen 2560603f9b qbsp: csg4.cc: bring closer to original behaviour 2021-10-03 12:32:50 -06:00
Eric Wasylishen f0d12fc8f3 qbsp: Brush_LoadEntity: bring closer to the original code 2021-10-03 12:02:52 -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
Eric Wasylishen b78553d81b qbsp: outside.cc: match original behaviour 2021-10-03 00:22:51 -06:00
Eric Wasylishen 9e9e21eaae qbsp: move BSPX BRUSHLIST struct types out to bspfile.hh 2021-10-02 17:57:31 -06: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
Eric Wasylishen ddf2a36d39 qbsp: make func_detail_wall an alias for func_detail_fence 2021-10-01 23:18:27 -06:00
Eric Wasylishen 690ac8d24e qbsp: Brush_GetContents_Q1: fix _mirrorinside 2021-10-01 21:19:18 -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 74bbce9eab First attempt at areaportals - sadly it seems like this method might not work with this compiler. 2021-09-28 13:17:27 -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 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 b36c428bef brush.cc: attempt to fix test failures 2021-09-25 21:13:42 -06:00
Eric Wasylishen 5a1cb66308 brush.cc: fix sorting of clip brushes 2021-09-25 19:04:47 -06:00
Eric Wasylishen 54d7f50b38 brush.cc: clear CFLAGS_CLIP on bmodels to match old behaviour 2021-09-25 18:04:57 -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
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 ed37289290 Store extended limits format in bspversion 2021-09-23 14:42:56 -04:00
Eric Wasylishen b3258611c9 brush.cc: AdjustContentsFromName: fix all liquids getting set to water 2021-09-23 00:04:45 -06:00
Eric Wasylishen 70aa7ebcdb writebsp.cc: remove unneeded memset
map.exported_texinfos.push_back({}); will push a zeroed gtexinfo_t.
2021-09-22 22:34:36 -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 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 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
Jonathan 4e7542b111 Clang format pass
typedef -> using
include guards -> pragma once
typedef struct x { } y; -> struct y { }
some fixes to extremely old code that shouldn't be required any more
2021-09-14 02:32:26 -04:00
Jonathan f89d5534b6 yay I can test tests now 2021-09-13 11:24:40 -04:00
Jonathan 4944ea36c7 set game on tests 2021-09-13 11:15:08 -04:00
Jonathan 75c303b503 last fix :( 2021-09-13 11:03:10 -04:00
Jonathan e3378432ff Fix test_qbsp (needs proper fixes, this is just a temp one) 2021-09-13 10:24:14 -04:00