Commit Graph

1301 Commits

Author SHA1 Message Date
Eric Wasylishen 712f413ac8 light: LIGHTGRID lump: change packing of sample points 2023-02-05 22:03:07 -07:00
Eric Wasylishen 74f149627a light: finish implementing lightgrid_samples_t::add() to use lowest brightness slot 2023-02-05 21:52:25 -07:00
Eric Wasylishen 2ad437b9e5 light: remove debug spam 2023-02-05 21:46:03 -07:00
Eric Wasylishen 8b38b7d45f light: LIGHTGRID lump: remove special case for 1 lightstyle maps 2023-02-05 21:30:34 -07:00
Eric Wasylishen 2cc513848b light: write styles into the experimental lightgrid lump 2023-02-05 17:16:57 -07:00
Eric Wasylishen 89fa416708 light: new experimental iteration on LIGHTGRID lump 2023-02-05 01:23:04 -07:00
Eric Wasylishen ffdca9b1a4 light: fix GetSurfaceLighting returning negative values 2023-02-04 02:10:32 -07:00
Eric Wasylishen cc8a50631d light: lightgrid,: try averaging incoming light from 6 directions on a cube 2023-02-04 01:02:28 -07:00
Eric Wasylishen fb17ee1218 light: add a LightFace_ScaleAndClamp equivalent for the lightgrid 2023-02-03 23:56:46 -07:00
Eric Wasylishen 357452d6fc light: don't delete lights between DirectLightFace and MakeBounceLights
the light grid code needs them later
2023-02-03 01:52:19 -07:00
Eric Wasylishen 999806f150 light: experimenting with generating a lightgrid
currently a hardcoded 64^3 grid in a LIGHTGRID bspx lump
non-finalized, likely going to change the lump
2023-02-03 01:17:52 -07:00
Eric Wasylishen 13481438e7 light: use DecompressAllVis() for getting visdata 2023-01-30 19:57:20 -07:00
Eric Wasylishen 8f49cf3894 refactor: Mod_Q1BSP_DecompressVis -> DecompressVis 2023-01-30 19:56:40 -07:00
Eric Wasylishen e490eb3ade refactor: move Mod_Q1BSP_DecompressVis to bsputils.cc 2023-01-30 19:56:34 -07:00
Eric Wasylishen d2db75ee81 light: Mod_Q1BSP_DecompressVis: port safety check from DecompressRow 2023-01-30 19:56:24 -07:00
Eric Wasylishen 9edad10b0f common: add convenience version of EntData_Parse 2023-01-30 00:08:45 -07:00
Eric Wasylishen ad77f8fc57 Revert "light: remove unnecessary/confusing scale factor on sunlight direction"
This reverts commit 94dcccf662.
2023-01-29 16:33:30 -07:00
Eric Wasylishen 94dcccf662 light: remove unnecessary/confusing scale factor on sunlight direction 2023-01-29 15:20:42 -07:00
Jonathan 531a0d781f fix crash on bad texel fetch from scaled textures 2023-01-29 14:01:07 -05:00
Eric Wasylishen 6ede7925bc light: apply model offset to embree meshes
Fixes shadows in incorrect places when using shadow-casting rotators
Fixes https://github.com/ericwa/ericw-tools/issues/326
2023-01-24 20:18:14 -07:00
Eric Wasylishen fa8af3845b light: fix default _sunlight angle to be pointing straight down 2023-01-24 00:52:28 -07:00
Jonathan 36b8b21990 set -wrnormals by default on -q2rtx
inherit -phong from worldspawn
2023-01-18 15:49:51 -05:00
Eric Wasylishen c109712079 light: fix spots in AO map in certain cases when combined with phong
The previous GetUpRtVecs (get tangent/bitangent) was not handling normals very near 0,0,1
whereas qv::MakeTangentAndBitangentUnnormalized does
2023-01-16 22:37:28 -07:00
Eric Wasylishen e520c96e28 light: CalcPoints: switch to jitter method for fixing luxels touching world
The previous method involved geometrically shrinking all sides of a face by 1 unit,
and snapping the luxel to the shrunken face. The problem is this could end up moving
the luxel a lot (e.g. 4 units) into vastly different lighting, causing lightmap artifacts.

Jitter method moves the luxel only +/- 0.5 units currently.
2023-01-16 02:01:45 -07:00
Eric Wasylishen 6697beb607 fix _cone default in q2 maps 2023-01-08 20:01:34 -07:00
Eric Wasylishen 91c678254a light: tweaks to _cone support in q2 2023-01-08 19:57:25 -07:00
Jonathan df5f894726 fix _cone in Q2 2023-01-08 20:03:06 -05:00
Eric Wasylishen a9a11159f4 light: add _surface_minlight_scale light key
for tweaking minlight given to faces matching surface light templates.

minlight = _surface_minlight_scale * light

lower default from 64 to 1 in q1 mode
2022-12-30 23:06:28 -07:00
Eric Wasylishen 3d0c756b4f light: fix minlight color on surface lights
- extra `* 255` was unnecessary, setting_color already does this
- don't use qvec3b as it was causing colors to wrap around the 0..255 range
2022-12-20 23:44:21 -07:00
Jonathan d5e29a1c90 add _nofill key, which causes an entity to not count as an entity for the purposes of occupancy (for lights in walls, etc)
add _nonudge key, to disabling nudging of lights "stuck" inside walls
2022-12-15 04:30:22 -05:00
Eric Wasylishen 82aa1e4396 light: make "_light_alpha 0" behave as expected (invisible to light) 2022-12-14 21:46:36 -07:00
Eric Wasylishen 8ce8b9233b light: _shadow_channel_mask defaults to _light_channel_mask if unset 2022-12-14 18:29:05 -07:00
Eric Wasylishen 513c47406b light: fix surface lights to check channel mask 2022-12-14 00:26:38 -07:00
Eric Wasylishen 287ac96363 light: fix sunlight to check object channel mask 2022-12-14 00:15:23 -07:00
Eric Wasylishen aca9820b03 light: don't bounce light for channel != 1 2022-12-13 23:59:58 -07:00
Eric Wasylishen ff73f13830 light: skip vis culling if lighting channels are used 2022-12-13 23:54:49 -07:00
Eric Wasylishen 00754e588e light: setting an _object_channel_mask implicitly enables shadow casting 2022-12-13 23:37:00 -07:00
Eric Wasylishen ea0ed34506 light: fix light bounds culling breaking channel masking
the bounds are only calculated for mask 1, so only apply bounds culling for lights on channel 1
2022-12-13 23:32:14 -07:00
Eric Wasylishen 8aa49699f8 light: rename channel mask keys
models:
_object_channel_mask

lights:
_light_channel_mask
_shadow_channel_mask
2022-12-13 23:20:27 -07:00
Eric Wasylishen 181d608c7a light: add missing RTC_SCENE_FLAG_CONTEXT_FILTER_FUNCTION now needed
also check channelmask/shadowmask in Embree_FilterFuncN
2022-12-13 20:04:22 -07:00
Eric Wasylishen 92d5c75424 light: experimental light channel mask feature 2022-12-13 19:13:58 -07:00
Eric Wasylishen 8728d982c3 light: remove more dead code 2022-12-13 18:59:35 -07:00
Eric Wasylishen 54e598c5fb light: clean up dead code 2022-12-12 18:02:33 -07:00
Eric Wasylishen 63cac32f88 light: quick experiment with a _light_group feature for lights that only affect linked bmodels 2022-12-11 15:36:08 -07:00
Eric Wasylishen bded0ab344 light: fix negative lights breaking when bounce in use 2022-12-10 15:10:36 -07:00
Eric Wasylishen 24f79d13bb light: recognize _cone as an alias for spotlight cone angle (q2 compat) 2022-12-09 00:59:49 -07:00
Eric Wasylishen a5b83e088b light: work around visblocking opaque liquids causing light artifacts with -visapprox vis
in cases when we actually want light to shine through these surfaces
2022-12-09 00:07:50 -07:00
Eric Wasylishen a70c8f4835 light: fix artifacting with translucent shadows
Embree is allowed to call the filter function more than necessary.
The previous implementation had side effects that would cause
the translucent shadows to get darker in this case.

As a limitation, we're back to only allowing 1 layer of glass per ray.
2022-12-07 00:23:26 -07:00
Jonathan cde7fd2908 add back in `_bouncestyled` in worldspawn; default to true on Q2 mode 2022-12-06 21:23:05 -05:00
Eric Wasylishen 185d12996b Merge branch 'brushbsp' of https://github.com/ericwa/ericw-tools into brushbsp 2022-12-06 15:19:46 -07:00
Eric Wasylishen eae434736a light: support _minlightMottle on worldspawn 2022-12-06 15:18:16 -07:00
Jonathan 15b9a78fd1 fix gate being incorrect
add surflight grouping
fix minlight on color'd _surface lights
2022-12-05 20:35:44 -05:00
Eric Wasylishen f66e4790a4 qbsp/light: add no_phong texinfo flag (currently not used/exposed) 2022-12-01 01:16:17 -07:00
Eric Wasylishen 1065adecc6 qbsp/light: implement _phong_group key, equivalent to Q2 "value" field 2022-12-01 00:25:05 -07:00
Eric Wasylishen 9fa9124404 light: redesign Q2 phong check
- always do angle check
- always do gamedef specific exclusions (e.g. warping surfflags don't phong with non-warping)
- if Q2 style phong is requested, but Q1 is not in use, use the default phong angle
- always do smoothing group ID check (preparation for supporting this in Q1 mode via a key)
2022-11-30 23:24:51 -07:00
Eric Wasylishen 96bdf141bb light: block phong if certain surfflag bits differ between the two faces
this prevents liquids from phonging with solids
2022-11-30 22:15:58 -07:00
Eric Wasylishen 5d3fab75b6 light: allow .wal_json metadata to contain "light": [ r, g, b ] to override emissive color
Use this to fix the "emissive lights" test case so it can run on CI without any texture data
2022-11-20 23:01:05 -07:00
Eric Wasylishen 37ced86cec tests: fix light settings not clearing across tests 2022-11-19 19:02:55 -07:00
Eric Wasylishen 0c4aab737d light: fix angled emissive surfaces not shining on adjacent faces 2022-11-19 14:57:56 -07:00
Eric Wasylishen c9111b2a6c
Merge pull request #337 from TTimo/colorcodes
Enable support for ANSI color codes on Windows 10 and newer, without …
2022-11-19 09:10:24 -08:00
Eric Wasylishen 9ab4ea8176 Move SetConsoleMode() call to logging::preinitialize(); helper
Don't do ENABLE_VIRTUAL_TERMINAL_INPUT as it breaks arrow key history
navigation in Windows Terminal after running one of the ericw-tools exe's.
2022-11-19 10:05:14 -07:00
Eric Wasylishen 4c218f5e91 common: factor out LMSCALE_DEFAULT = 16.0; 2022-11-15 23:52:34 -07:00
ttimo fb459253fe Enable support for ANSI color codes on Windows 10 and newer, without needing to enable system wide. Good for CreateProcess CREATE_NEW_CONSOLE situations. 2022-11-15 11:09:19 -06:00
Eric Wasylishen eb3dfe7952 ltface: use bilinear interpolation in WriteSingleLightmap_FromDecoupled 2022-11-15 00:50:11 -07:00
Eric Wasylishen 46d460277a ltface: support -world_units_per_luxel without -novanilla
first pass implementation - quality of vanilla LM is bad, due to nearest sampling
the decoupled lightmap
2022-11-14 23:58:31 -07:00
Eric Wasylishen c6b19fe6da light: implement -novanilla with -world_units_per_luxel
currently it's required because the non-novanilla path
isn't yet implemented
2022-11-14 00:30:37 -07:00
Eric Wasylishen 99e5f15d42 Revert "ci: use older embree/tbb which support Win8.1"
This reverts commit 50c4709d31.
2022-11-13 16:52:14 -07:00
Eric Wasylishen 50c4709d31 ci: use older embree/tbb which support Win8.1 2022-11-13 15:54:30 -07:00
Eric Wasylishen d7acd046c3 light/qbsp: add _surflight_rescale key 2022-11-12 17:07:02 -07:00
Eric Wasylishen a5125583fa light: clear global data so light can run multiple times per process 2022-11-11 16:52:07 -07:00
Eric Wasylishen 74269a0269 light: new Mottle implementation based on world-space "value noise" 2022-11-08 22:18:54 -07:00
Jonathan 66d7ae98e5 half memory usage for lightmaps & ray colors 2022-11-06 02:21:11 -05:00
Eric Wasylishen 221ea65efb light: fix -world_units_per_luxel on sloped faces 2022-11-03 23:45:47 -06:00
Eric Wasylishen ff54f86708 light: fix invisible shadow casters crash 2022-11-03 22:26:41 -06:00
Eric Wasylishen ca0efbf3d3 light: wip -world_units_per_luxel and DECOUPLED_LM BSPX lump 2022-11-03 02:39:15 -06:00
Eric Wasylishen 9edadf93cd light: CalcPoints: use faceextents_t::LMCoordToWorld 2022-11-02 01:16:36 -06:00
Eric Wasylishen 2bd2515792 all: cleanup unused includes (Clion - detect not directly used) 2022-10-31 21:37:34 -06:00
Eric Wasylishen 0924423c20 light: header -> source move 2022-10-31 21:21:28 -06:00
Eric Wasylishen ff5d48e5e1 light: CalcPoints: use faceextents_t::texCoordToWorld
this changes the "one unit in front of surface" from tex space to world space, which
makes more sense
2022-10-30 20:57:44 -06:00
Eric Wasylishen 383266762d light: lightsurf_t: remove texorg member 2022-10-30 19:40:26 -06:00
Eric Wasylishen 728fafde8c light: remove dead code 2022-10-30 18:00:48 -06:00
Eric Wasylishen da5910e732 tests: first steps on a light test case 2022-10-30 15:32:41 -06:00
Eric Wasylishen 35ffc00462 all: add LIGHT_/QBSP_/VIS_ prefixes to epsilons where necessary 2022-10-30 15:08:10 -06:00
Eric Wasylishen f9fc0fc478 light: remove dead code 2022-10-30 12:49:32 -06:00
Eric Wasylishen 636b376577 squash brushbsp-compilation-speedup branch
move function implementations out of headers
2022-10-21 18:00:58 -06:00
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