Eric Wasylishen
c78b0396a9
light: fix wrong opacity of trans33/trans66 translucent shadows
...
- support _light_alpha key in q2 mode
- add q2 translucent shadows testmap
2022-10-19 00:00:47 -06:00
Jonathan
af2f88b93c
Merge branch 'brushbsp' of https://github.com/ericwa/ericw-tools into brushbsp
2022-09-21 05:35:18 -04:00
Jonathan
25cbbd42aa
fix phong calculation
...
obj output adjustment
2022-09-21 05:35:11 -04:00
Eric Wasylishen
acf334daee
cleanup: rename surfflags_t::is_skip to is_nodraw
...
This is a break to the .json format
2022-09-18 15:47:14 -06:00
Jonathan
6713fedcbc
allow changing a brushes' lightmap color scale with `lightcolorscale`
2022-09-10 19:04:17 -04:00
Jonathan
4ecd945587
use kmq2 flag instead of 33 | 66, which no engine supports
2022-09-10 07:49:06 -04:00
Jonathan
986f7da366
adjust default bouncescale to match older compiles
2022-09-03 14:06:11 -04:00
Jonathan
075481a36f
add -nocolor for TB, etc
...
fix crashes on vis and light for invalid options
fix TB and others not receiving output
2022-08-31 12:58:04 -04:00
Jonathan
3564f6085d
merge surface lighting and bounce code (wip)
2022-08-30 15:46:14 -04:00
Jonathan
c99addc41a
fix fastbounce lights being darker on extra2/4
...
use a more dynamic gate for non-fastbounce (slower but allows them to contribute)
2022-08-28 02:25:08 -04:00
Jonathan
384f74a0eb
add separate "surflightskyscale" to handle the scale of sky lights; to help with doubling up with _sun
...
allow setSetting to report errors
print warnings on invalid worldspawn key values for light
fix setting_mangle not handling "pitch yaw" or "pitch" correctly
2022-08-25 16:30:15 -04:00
Jonathan
5fb0d56da7
maxlight
...
# Conflicts:
# include/common/bspfile.hh
2022-08-24 21:50:11 -04:00
Jonathan
928b7f6e16
fix crashes with bounceextra/4
2022-08-24 12:03:05 -04:00
Jonathan
6345d6b616
add support for fast bounce lighting, which is the same as the old code
2022-08-21 22:12:41 -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
Eric Wasylishen
f3b9de57c6
build: add tbbmalloc
2022-08-09 00:19:39 -06: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
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
Eric Wasylishen
52dff47a86
fix linux build
2022-08-01 12:47:20 -06: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
Jonathan
d1c3b56e1d
don't jitter sun entities
2022-07-31 09:15:51 -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
91124d296f
fix mismatch in surface lighting cull calculation
2022-07-29 21:29:04 -04:00
Jonathan
ea5e7f5874
fix reported bounce light count
2022-07-29 13:27:31 -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
14ac139cce
fix race condition; map operator[] modifies if it doesn't exist
2022-07-29 09:42:11 -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
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
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
2357f4e660
remove test print
2022-07-22 23:00:54 -04:00
Jonathan
0561766bc9
fix overblown lighting if light color is specified for radiosity
2022-07-22 22:10:22 -04: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
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
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
d32d6ea81d
light: rename options -> light_options
2022-07-10 17:28:28 -06:00
Eric Wasylishen
050886f32c
tests: unify tests under one target
...
to ease sharing code. vis/light tests are going to need the testqbsp infrastructure.
2022-07-10 16:36:15 -06:00
Jonathan
4c68ba42d3
simplify sample again
2022-07-10 14:11:17 -04:00
Jonathan
a329c901c6
just use sample difference instead of trying to re-calculate it
2022-07-10 13:47:08 -04:00
Jonathan
2a70cafa32
kinda fix overbrightness? still needs work..
...
allow lmshift force on light
2022-07-10 13:31:38 -04:00
Jonathan
8fc089aa34
fix lmscale with bounce lighting
2022-07-09 23:09:02 -04:00
Jonathan
773d20052c
write out style numbers to verbose
2022-07-09 01:36:26 -04:00
Jonathan
865217c655
adjust final output warning
2022-07-09 01:36:26 -04:00
Jonathan
30bd8467c3
fix wrong boolean used for warning
2022-07-09 01:36:26 -04:00
Jonathan
0e4066f312
fix LMSTYLE containing 16-bit values sometimes
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
7f64c9dfeb
simplify saving
2022-07-09 01:36:25 -04:00
Jonathan
88905d4a69
secondary fix to lmstyle code
2022-07-09 01:36:25 -04:00
Jonathan
b1a30496c3
fix bspx_lightmap not getting output by bspinfo
...
fix LMSTYLE getting output when there's no need for it from -novanilla
2022-07-09 01:36:25 -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
Jonathan
fa2b67a365
fix blown out maps with extra/extra4 from bounce lighting
...
(cherry picked from commit 6295219a25 )
2022-07-05 20:06:57 -04:00
Jonathan
f4854ddb20
simplify minlight stuff
...
adjust scalar for surface lights so they are visible without bounce
2022-07-04 22:43:07 -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
Jonathan
a0d81372d1
improved path detection (and overriding) routines
...
(cherry picked from commit 32f33fb4b3 )
2022-07-03 18:23:40 -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
Jonathan
f089c5d145
fix bounced lighting
...
(cherry picked from commit 0baa788d7e )
2022-07-03 14:21:25 -04:00
Jonathan
5b8fbb660e
fix some weird maps with zero area faces trying to bounce
...
(cherry picked from commit b43e80911e )
2022-07-03 14:21:25 -04: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
022676fe63
fix AABB accumulation
2022-07-02 08:49:30 -04:00
Jonathan
feaa15b712
only generate bounds if rays is enabled
...
don't lightmap sky again
2022-07-02 08:49:26 -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
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
3b777a05a9
remove unnecessary init_palettes
2022-06-27 08:13:32 -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
Eric Wasylishen
22f0def4b1
update Catch2 to v3.0.1
2022-06-26 13:21:29 -06: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
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
062ff86a0d
cache texture pointers, saving expensive lookups per ray
2022-06-25 04:28:00 -04:00
Jonathan
b4583908af
slight speed improvement; these weren't inlining properly, they do now though
2022-06-25 04:20:24 -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
Jonathan
c7169e11ee
split LightFace into three distinct phases: Create, Light, and Save
2022-06-24 02:54:41 -04:00
Jonathan
4e73d9b196
remove unused struct
2022-06-23 23:45:55 -04:00
Jonathan
12a5c6555c
remove extra line
2022-06-23 23:29:11 -04:00
Jonathan
70d87a52d6
more pointers to vectors
2022-06-23 16:05:11 -04:00
Jonathan
1d21a33a3b
use a thread local static for `LightFace_CalculateDirt` so it's not continuously allocating/deallocating
2022-06-23 01:47:28 -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
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
383843a454
fix missing make_unique
2022-06-22 16:12:20 -04: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
827d382d5a
support color on surflights
2022-06-21 15:07:30 -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
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
2b43f2f0c6
slight speed up to compiling surf lights
2022-06-19 12:35:43 -04:00
Jonathan
51f2bc1ff0
fix visapprox rays crashing
...
fix visapprox rays to work with surface lights; it's slower than vis but it at least works now
2022-06-19 12:09:12 -04: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
e57633bbca
the old Safe read/writes are gonedy now
2022-06-16 20:22:03 -04:00
Jonathan
41ef66190f
consistency rename; gtexinfo_t -> mtexinfo_t
2022-06-16 09:36:31 -04: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
b2a0f8039e
remove dm/start/coop checking
...
remove entity target(name) checking; as mods and maps get more complex, this is best left up to the editors to use the FGD to report these things.
2022-06-13 07:10:53 -04:00
Jonathan
4a20305077
clean up light conditional
2022-06-12 06:38:29 -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
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
0d56c49d7a
remove hardcoded lightstyles max, use config option
2022-06-10 04:22:12 -04:00
Jonathan
19fafd9d46
don't add bounce lights that have no color
...
increase bounce scale a bit to match Q2 again
2022-06-03 14:59:06 -04:00
Eric Wasylishen
3d8da90eec
Merge branch 'type-cleanup' of https://github.com/Paril/ericw-tools into type-cleanup
2022-06-02 20:58:06 -06:00
Eric Wasylishen
5488f47eda
light: GetDirectLighting: fix wrong order in surfpointToLightDist calculation
2022-06-02 20:58:03 -06:00
Jonathan
a824b9436c
hardcode omnidirectional surface lights - seems closer to Q2's defaults
...
hardcode dot of 1.0 for surface lights
halve bounce data since the former changes blow out lighting a bit
2022-06-02 22:12:31 -04:00
Jonathan
464b87f095
remove a debugbreak
...
"fix" broken q2 maps
2022-06-02 10:23:39 -04:00
Jonathan
11f937f0ad
add mottling that was used for _minlight on objects in Q2 maps
...
fix _minlight for Q2
set up a few better defaults for Q2
temp-ish fix for areaportals
2022-06-02 01:05:41 -04: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
a4ebfab691
tests: fix case issue with catch includes
2022-05-15 13:19:46 -06:00
Eric Wasylishen
03d9df50e5
tests: don't include(CTest) as it generates unwanted targets
2022-05-15 12:43:35 -06:00
Eric Wasylishen
c925f7be74
test: convert test case macros to Catch2
2022-05-15 12:27:43 -06:00
Eric Wasylishen
28bea85d97
test: convert assertions to Catch2 format
2022-05-15 12:18:09 -06:00
Eric Wasylishen
9fe42ef6c7
test: swap GTest out in favour of Catch2
2022-05-15 12:00:50 -06:00
Eric Wasylishen
254310dc2c
tests: switch to Catch2 style
2022-05-15 11:20:02 -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
15a136a742
light/CMakeLists.txt: fix vcpkg builds
...
improve tbb12.dll hack, which is only desired for the embree binary releases
2022-05-12 00:25:18 -06:00
Eric Wasylishen
a1b8a38283
merge non-brush bsp specific changes from brushbsp branch
2022-05-11 01:58:53 -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
d763b2e336
build: support clang-cl
2022-05-10 21:39:58 -06:00
Eric Wasylishen
4042f1c7b9
light: fix compile after previous change
2022-05-09 23:27:33 -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
Bryan Haley
ccac9d4979
Add check for SSE2 in light.cc ( #328 )
2022-03-28 23:08:07 -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
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
466d9adaa6
light: fix backwards interpretation of _bouncecolorscale
2022-02-15 00:54:02 -07:00
Jonathan
77d0e58084
Fix broken SubdividePolygon
2022-02-08 17:23:42 -05:00
Jonathan
8dbb18cc94
Use stem() instead of filename() when we're only wanting to change filename without extension
2022-01-22 17:55:37 -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
07e7179c74
fix build
2022-01-15 18:51:33 -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
Eric Wasylishen
28b857cc2e
Merge branch 'master' into pr/322
2021-12-11 13:47:12 -07:00
Eric Wasylishen
6e96ae7cc2
light/CMakeLists.txt: make it non-fatal if the embree license isn't found
2021-12-11 13:25:09 -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
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
1ccbe9e12c
wrbrushes lump using streaming now
...
temp(?) fix for structural covered by detail
2021-10-25 19:24:07 -04:00
Jonathan
550cacef3f
Clean warnings
2021-10-25 13:46:04 -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
Jonathan
a5f8ecd471
VectorSubtract
2021-10-24 23:26:20 -04:00
Jonathan
f4c1d3d863
use TexSpaceToWorld since it seems to generate the same results anyways
2021-10-24 23:18:03 -04:00
Jonathan
e1771daf58
More-correct tangent calculation maybe
2021-10-24 17:45:28 -04:00
Jonathan
38a4f66bef
Move this to header since we may need it soon
2021-10-24 17:11:35 -04:00
Jonathan
11c3511605
new normal calculation cherry-picked from branch
...
Fix entdata not having its '\0'
don't write unnecessary extended texinfo
2021-10-24 15:21:26 -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
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
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
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
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
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
f0f7722909
light: fix build
2021-10-09 11:48:18 -06:00
Eric Wasylishen
9dcef7839a
common: remove dead code (mesh_t, octree)
2021-10-09 11:40:35 -06:00
Eric Wasylishen
4accc4d56b
light: remove incorrect assertion face->lightofs != -1
...
This can happen for Q1 with a solid black face
2021-10-09 00:13:23 -06: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
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
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
cb0c97e163
test_common.cc: fix build
2021-10-05 23:43:49 -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
Jonathan
f4fc8bc72b
Remove unused functions, fix math issues
...
MacOSX potential fix for __VA_ARGS__
2021-10-05 22:35:30 -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
4ad798e29c
Fix origin brushes
...
Fix merge stuff from qbsp-contentflags
2021-10-05 15:50:18 -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
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
2fc1e9099a
light: remove dead / non-working code for non-embree light tracing
2021-10-02 21:12:12 -06:00
Eric Wasylishen
8a7164791e
light: fix "don't do this on Q2" logic for 0 light faces
2021-10-02 21:00:45 -06: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
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
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
d5a647c6a3
trace_embree.cc: try <climits> for UCHAR_MAX
2021-09-22 23:08:06 -06:00
Eric Wasylishen
5cfe40d79a
trace_embree.cc: add missing <cstdint> include (for UCHAR_MAX)
2021-09-22 22:58:33 -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
Eric Wasylishen
6c19c3c927
Revert "Revert "Q2bsp VIS support ( #315 )""
...
This reverts commit 5465ab4ff6 .
2021-09-20 18:38:31 -06:00
Eric Wasylishen
405ce25913
Revert "Revert "Q2BSP + QBSP ( #313 )""
...
This reverts commit e9052f3002 .
2021-09-20 18:38:28 -06:00
Jonathan
2ebfdb096f
Remove COM_Parse, use parser_t
...
Game controls hull sizes now
2021-09-20 19:45:09 -04:00
Eric Wasylishen
a6f90438f6
build: fix homebrew build
2021-09-19 20:35:44 -06: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
e9052f3002
Revert "Q2BSP + QBSP ( #313 )"
...
This reverts commit eaa86c71c6 .
2021-09-19 14:58:34 -06:00
Eric Wasylishen
5465ab4ff6
Revert "Q2bsp VIS support ( #315 )"
...
This reverts commit 90973e1198 .
2021-09-19 14:56:25 -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
c575334dff
Fix testlight
2021-09-13 10:15:11 -04:00
Eric Wasylishen
28b4ec7f3f
ci: fix linux CI ( #321 )
2021-09-12 16:40:56 -06:00
Jonathan
c95a1e2ccb
q2 and bug fixes
...
# Conflicts:
# include/qbsp/qbsp.hh
# include/qbsp/winding.hh
# qbsp/brush.cc
# qbsp/csg4.cc
# qbsp/merge.cc
2021-09-12 08:34:01 -04:00
Eric Wasylishen
3f2d8c57c1
build: fix finding embree license with mac package
2021-09-12 01:30:20 -06:00
Eric Wasylishen
bd3452bfdc
build: simplify light build (embree handling)
2021-09-12 01:30:20 -06:00
Eric Wasylishen
3d9d167360
build: fix build-osx.sh
2021-09-11 13:12:25 -06:00
Jonathan
00efa6e67d
Fix operator<
...
Introduce gamedef, to reduce rewriting of data in bspversions
fix name of needs_subdivision
include value in texinfo, in prep for Q2
2021-09-07 01:41:32 -04:00
Jonathan
437459a4dd
Finish using game everywhere
2021-09-06 18:09:13 -04:00
Jonathan
3bc9b1b0f8
Instead of directly comparing BSP version pointers just for game type, I compacted quake2/hexen2 into a single enum.
...
Feature check in bspver for colored lightmaps, which replaces the many "version == q2 || version == qbism || version == hl".
2021-09-06 17:13:37 -04:00
Jonathan
8fd1d89b8d
Fix double-delete
...
Fix typo
2021-09-05 17:39:17 -04:00
Jonathan
dad0e61f63
Fix for texinfo/miptex searching routines
...
surf flags now use the "native + extended" format that will eventually be used for brush contents. Q1 output seems identical, haven't tested Q2 yet.
2021-09-05 16:56:29 -04:00
Jonathan
90973e1198
Q2bsp VIS support ( #315 )
...
* Add QBSP - the BSP2-esque variant to Q2BSP - to bspinfo, and all of its accompanying structures.
* pass around ident, since Q2 needs it - admittedly it's a bit ugly, but it works for now.
conversion for QBSP
* Fix light
* _qbsp_ -> _qbism_
* Introduced bspversion_t, a struct that holds pertinent information about different BSP versions and also acts as a tagged pointer type for direct comparisons. This makes a lot of code paths simpler. I'm not entirely set on the wordings or usages yet, and maybe we can stuff boolean flags inside of them for different behaviors (for instance Q2, QBism and HL would have the "colored lightmap" boolean set to true, which replaces the check-for-all-three in the lightmapper)
Swapped arguments to ConvertBSPFormat to have the conversion target last instead of first
Finished rename of qbsp -> qbism
Tested:
- bspinfo on various BSPs I had laying around (Q1, Q2, Qbism)
- bsputil converting between Q2 and Qbism, and that they loaded in engine/roundtripped properly
Not tested:
- vis/rad on anything major (I still can't run rad due to embree being weird)
- bsputil conversion of Q1-esque maps
* Q2 VIS
Almost working, just in-game is not 100% functional
* PHS! Q2 VIS!
* Fix missing loadversion assignment
Fix missing \n
* Implement q2bsp -> mbsp visdata copy
fix sky lighting to use arghrad compat
2021-08-31 22:38:12 -06:00
Eric Wasylishen
968a840e47
light: make a certain degenerate face non-fatal
...
seen compiling ad_sepulcher.map with qbism q2 tools
2021-08-29 20:43:55 -06:00
Jonathan
eaa86c71c6
Q2BSP + QBSP ( #313 )
...
* Add QBSP - the BSP2-esque variant to Q2BSP - to bspinfo, and all of its accompanying structures.
* pass around ident, since Q2 needs it - admittedly it's a bit ugly, but it works for now.
conversion for QBSP
* Fix light
* _qbsp_ -> _qbism_
* Introduced bspversion_t, a struct that holds pertinent information about different BSP versions and also acts as a tagged pointer type for direct comparisons. This makes a lot of code paths simpler. I'm not entirely set on the wordings or usages yet, and maybe we can stuff boolean flags inside of them for different behaviors (for instance Q2, QBism and HL would have the "colored lightmap" boolean set to true, which replaces the check-for-all-three in the lightmapper)
Swapped arguments to ConvertBSPFormat to have the conversion target last instead of first
Finished rename of qbsp -> qbism
Tested:
- bspinfo on various BSPs I had laying around (Q1, Q2, Qbism)
- bsputil converting between Q2 and Qbism, and that they loaded in engine/roundtripped properly
Not tested:
- vis/rad on anything major (I still can't run rad due to embree being weird)
- bsputil conversion of Q1-esque maps
2021-08-23 09:56:33 -06:00
Eric Wasylishen
3b17e577b5
build: fix linking to embree under vcpkg
2021-08-22 13:48:53 -06:00
Eric Wasylishen
2ff31d012e
light: fix all rays missing on debian/ubuntu's embree builds
2021-08-05 20:11:44 -06:00
Eric Wasylishen
ff5572f97d
light: log number of bounce lights at the end of MakeBounceLights
2021-07-13 22:47:53 -06:00
Eric Wasylishen
ffe90adc1c
light: improve logging
2021-05-21 22:01:09 -06:00
Eric Wasylishen
6ecdd444ca
light: optimize surface light generation
2021-05-21 22:01:09 -06:00
Eric Wasylishen
3f00d2fd00
light: add fixme
2021-05-21 20:47:25 -06:00
Eric Wasylishen
fbde6065fa
light: raise max verts in SubdividePolygon to 64 (for surface lights)
2021-04-11 20:57:30 -06:00
Eric Wasylishen
fea7849315
common: preserve order of key/value pairs
2021-02-10 00:05:53 -07:00
Eric Wasylishen
fcf0ebbbfe
build: upgrade googletest
2021-02-07 14:42:12 -07:00
Eric Wasylishen
b5fcdec19e
cleanup: remove "byte" typedef
2021-02-07 14:02:35 -07:00
Eric Wasylishen
f12e87f2b7
light: build fix. Glass/fence textures will need to be fixed.
2021-02-01 02:20:02 -07:00
Eric Wasylishen
9124653156
common: move EntData_ function to common
2021-01-30 21:11:25 -07:00
Eric Wasylishen
a8be516bf4
light: embree3 port
2021-01-02 02:21:03 -07:00
Eric Wasylishen
94c30afac4
light: refactoring necessary to support embree3
2021-01-01 23:48:22 -07:00
Eric Wasylishen
cce0fd98f9
light: document some intersection vs occlusion trace choices
2021-01-01 22:58:09 -07:00
Eric Wasylishen
09623934e8
light: q2: change sky lighting logic: only emit light if: sky flag set, light flag set, value nonzero
...
TODO: may need to use "value" more than just checking for nonzero
2021-01-01 00:30:40 -07:00
Eric Wasylishen
3b629f3ce9
light: fix q2 lightstyles
2021-01-01 00:14:52 -07:00