Commit Graph

63 Commits

Author SHA1 Message Date
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 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 24168c8e40 clang pass 2022-08-02 21:57:33 -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 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 41ef66190f consistency rename; gtexinfo_t -> mtexinfo_t 2022-06-16 09:36:31 -04: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
Eric Wasylishen a12427b47d decompile: fix --decompile-ignore-brushes 2022-06-06 00:07:39 -06:00
Eric Wasylishen c2b39a6502 decompile: fix texture name crash with missing texinfo 2022-06-06 00:07:37 -06:00
Eric Wasylishen fe31e1c1ce bsputil: add --decompile-ignore-brushes option for visualizing leafs in q2 maps 2022-06-06 00:07:31 -06:00
Jonathan 26b654779d don't output the three Q2 params for non-Q2 maps being fed through decompile 2022-05-18 16:43:14 -04:00
Jonathan df92d9ce12
Command line args systems (#2)
* cmd

* cmake change for tbb DLLs
add in test for double-hyphens

* cmd

* game version

* settings!

* bsp texture usage
decompile fix for q1bsp

* finish up the options for qbsp

* light finished?

* finish up the few missing bits

* move scalar/int32 up

* Run clang-format pass

* natvis for our mathlib
use slightly faster storage for winding
fix light tests

* allow dictionary to be a base type

* re-run style

* Remove cfg_static
Fix options summary

* natvis for lockable_value<T>

* last-ish pass?

* format

* forgot last few lockables
2022-02-27 00:01:57 -05:00
Jonathan 5c4b2c7323 Fix q1 decompile 2022-02-16 18:32:21 -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 07e7179c74 fix build 2022-01-15 18:51:33 -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
Jonathan 5e4454e832 Don't do texture detection on Q2 since brushsides hold textures 2021-11-02 23:13:14 -04:00
Eric Wasylishen 8174fabdc6 decompile.cpp: Q2: clip the polyhedrons and output winding vertices 2021-11-02 20:02:20 -06:00
Jonathan 88a4cf0b37 Fix texture offset for origin brushes 2021-10-31 22:27:36 -04:00
Jonathan 1da176c2b7 Merge branch 'type-cleanup' of https://github.com/Paril/ericw-tools into type-cleanup
# Conflicts:
#	bsputil/decompile.cpp
#	include/common/polylib.hh
2021-10-31 19:31:19 -04:00
Jonathan 1a1b4bdfb1 Re-ordered code to be easier to follow and write out all at once rather than doing it per-step 2021-10-31 19:28:52 -04:00
Eric Wasylishen d766ceb77d decompile.cpp: don't do SplitDifferentTexturedPartsOfBrush on Q2 2021-10-31 17:16:16 -06:00
Eric Wasylishen 8838cf093b decompile: support --decompile-geomonly for Q2 2021-10-31 16:33:40 -06:00
Jonathan ea58a6b289 Merge branch 'type-cleanup' of https://github.com/Paril/ericw-tools into type-cleanup 2021-10-29 19:49:35 -04:00
Eric Wasylishen 69943865e7 decompile: fix not finding faces (Q2). Unsure of exact location of the previous bug. 2021-10-29 17:49:06 -06:00
Jonathan ceee1a8ecf support for origin brushes 2021-10-29 19:42:29 -04:00
Jonathan 4759c649f4 Q2 decompile 2021-10-29 18:50:18 -04: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 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 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 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 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 5cf82ee023 qbsp: restore use of options.worldExtent
should fix minor precision differences in .prt files
2021-10-08 19:04:11 -06:00
Jonathan 52839d4e7f Run clang-format pass 2021-10-05 15:54:06 -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
Jonathan 792951792c some more cleanup 2021-10-02 05:56:45 -04: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 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 6ff2d67d12 major C++-esque change to BSP conversion:
- main mbsp types are declared first in the files, and types that were single-member are now not structs
- conversion is handled by the sub-types themselves. Currently no diagnostic for *what* members overflow, but, overflow is handled via thrown exceptions on all overflowable members
- aabb type is used where appropriate now, simplifying a few areas
2021-09-22 17:30:46 -04:00
Jonathan 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 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 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
Eric Wasylishen 03e1171039 decompile: fix some warnings 2021-02-07 00:49:25 -07:00
Eric Wasylishen fcb0da5190 decompile: add a simplifed --decompile-geomonly mode 2021-02-07 00:30:49 -07:00
Eric Wasylishen c1a479c8ff decompile: optimize by doing the RemoveRedundantPlanes in parallel 2021-02-06 22:01:58 -07:00