Commit Graph

122 Commits

Author SHA1 Message Date
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 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 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 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
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 2ff31d012e light: fix all rays missing on debian/ubuntu's embree builds 2021-08-05 20:11:44 -06: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 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 b6e6688ab4 light: use RTC_SCENE_HIGH_QUALITY. Fixes leaking through a joint
between 2 ceiling faces in a test case from 4LT
2020-08-20 18:02:38 -06:00
Eric Wasylishen b35cb8eb7e light: fixes for bjptools skip faces (which have no associated model) 2020-08-20 12:08:46 -06:00
Eric Wasylishen a0e7f1eccb light: refactor last commit's std::pair to a custom struct 2020-08-04 18:05:54 -06:00
Eric Wasylishen 1b53d458f4 light: support bounce and switchable shadows
fixes #251
2020-08-03 23:53:07 -06:00
Eric Wasylishen 060c44bd02 light: move function 2019-12-28 22:47:15 -07:00
Eric Wasylishen d6136c154d light: add _light_alpha func_group key for making faces translucent for
light
2019-12-28 21:48:33 -07:00
Eric Wasylishen cf66248261 light: add update to use rtcOccluded1Ex missed in last commit 2019-10-28 01:19:20 -06:00
Eric Wasylishen 4456020b30 light: remove 65536 ray limit, fixes #276 2019-10-28 01:12:23 -06:00
Eric Wasylishen dca61f8bc2 light: fix "unexpected geomID" error with bounce 2019-10-10 09:14:35 -06:00
Eric Wasylishen 70336339ca light: fix "_suntexture" interaction with -bounce 2019-10-09 00:59:49 -06:00
Eric Wasylishen ba7bdf86a1 light: increase max sky distance to 1M 2019-04-20 12:27:27 -06:00
MaxED 07447a633e Rewritten parts of surface light logic. Should resemble qrad3 looks a bit more now...
Added "surflightscale", "surflightbouncescale" and "surflightsubdivision" cmdline/worldspawn settings.
Fixed: a face should not be skipped when it has both sky and nodraw texinfo flags.
Fixed some non-windows compilation errors.
2018-05-25 14:59:22 +03:00
MaxED 0661098bc5 Quake 2 support: area lights, palette/texture loading, transparent/sky/fence face flags. 2018-05-08 15:50:01 +03:00
Eric Wasylishen 8813d272cb common, light, vis: change from bsp2_t to mbsp_t 2017-10-01 22:32:20 -06:00
Eric Wasylishen 6f07303504 light: implement _shadowworldonly, fix _shadowself which was broken 2017-06-27 14:48:27 -06:00
Eric Wasylishen 4dcfc12f50 light: refactor _shadowself handling 2017-06-26 17:42:50 -06:00
Eric Wasylishen 6e707130be light: rename dynamic shadow stuff to switchshadstyle" for QC,
and "_switchableshadow" for the mapper.
2017-06-26 13:41:24 -06:00
Eric Wasylishen b71f769c0a light: experimental support for switchable bmodel shadows:
Current specs/limitations:
- only supported for sunlight and regular lights
- enabled with "_dynamicshadow" "1"
- writes the lightstyle to a "dynshadowstyle" entity key, hardcoded
- only handles one dynamic occluder for a given lightmap sample
- styled lights passing through a dynamic occluder turn non-styled
2017-06-25 20:06:46 -06:00
Eric Wasylishen ea099775ef qbsp, light: allow _shadow -1 to disable shadows from func_detail 2017-06-05 14:01:12 -06:00
Eric Wasylishen 880ad3b381 bpsutil, common, light, vis: bounds check bsp->dfaces access 2017-03-18 16:31:52 -06:00
Eric Wasylishen 686696c362 light: Palette_GetColor: return glm vector 2017-03-12 15:41:52 -06:00
Eric Wasylishen 102bdc49f0 light: drop IntersectSingleModel api 2017-03-12 15:06:07 -06:00
Eric Wasylishen 63e8f42c87 light: ray stream api: allow getting hit face 2017-03-07 13:37:52 -07:00
Eric Wasylishen 2a17b4bccf build fix 2017-02-12 11:54:52 -07:00
Eric Wasylishen 6a99a70773 light: liquid faces on shadow casting bmodels should cast shadows 2016-11-04 23:42:58 -06:00
Eric Wasylishen 8284eba493 light: hack to fix bounce + glass shadows (not implemented, but don't crash) 2016-11-04 01:08:03 -06:00
Eric Wasylishen 4f530fadb9 light: tweak the glass tinting again 2016-11-03 18:11:58 -06:00
Eric Wasylishen a4afa749b7 light: tweak glass interaction with light 2016-11-03 17:24:27 -06:00
Eric Wasylishen 3b65ad592a light: glass: only pick up the glass color when the ray exits the glass 2016-11-03 15:21:29 -06:00
Eric Wasylishen 91fcfe5b9a light: use glass texture colors to tint rays 2016-11-03 02:26:53 -06:00
Eric Wasylishen 3d98dd70de light: first draft of semi-opaque shadows for glass 2016-11-03 01:52:00 -06:00
Eric Wasylishen a6468984bf all: finish c++ification 2016-10-17 19:52:17 -06:00
Eric Wasylishen fab8d87416 light: ensure sky textures are detected case-insensitive 2016-10-17 17:47:08 -06:00
Eric Wasylishen 857b4402ad light: change assertions to Q_assert (so they are all enabled in release builds) 2016-09-18 15:41:56 -06:00
Eric Wasylishen c7d210dc3a light: special case support for skip-textured bmodels in the embree backend.
It only supports bmodels where all the faces are skipped
2016-09-10 18:32:22 -06:00
Eric Wasylishen 9111d8df9f light: log embree version 2016-09-02 14:59:43 -06:00
Eric Wasylishen ed43b29489 light: store normal contribution in ray stream 2016-08-12 11:51:27 -06:00
Eric Wasylishen 68e1736ad1 light: move more stuff to bsputils.cc 2016-08-07 23:07:20 -06:00
Eric Wasylishen a807204fe6 build: vs2013 compat changes 2016-08-06 15:37:00 -07:00
Eric Wasylishen 7029ed5713 light: clean headers 2016-08-04 16:32:04 -06:00
Eric Wasylishen fcc54c547f light: change CalcPoints to only trace the model the face belongs to 2016-08-04 12:24:07 -06:00
Eric Wasylishen 707ae70fe1 light: don't use c99 designated initializers (msvc compat) 2016-07-30 00:47:43 -06:00
Eric Wasylishen 882348ac0a light: use embree ray stream api 2016-07-30 00:40:45 -06:00
Eric Wasylishen 6bb842cd47 light: refactor tracelist and selfshadowlist to be std::vector 2016-07-29 15:56:48 -06:00
Eric Wasylishen f4a363b416 light: make DirtTrace return a hittype_t 2016-07-27 13:07:50 -06:00
Eric Wasylishen e012a2c93e light: finish c++ifying 2016-07-06 13:14:06 -06:00
Eric Wasylishen a7e9d9bba4 light: embree: fix for liquid faces casting shadows! 2016-06-30 14:14:28 -06:00
Eric Wasylishen 913d6f068c light: DirtTrace: return hitdist instead of hitpoint 2016-06-19 16:39:59 -06:00
Eric Wasylishen 1d3774a9e0 light: make DirtTrace take dir / dist instead of endpoint to reduce VectorNormalize calls 2016-06-19 15:38:09 -06:00
Eric Wasylishen cfe3553ac6 light: embree: disable robust flags 2016-06-17 21:21:30 -06:00
Eric Wasylishen 5054ced22d light: fix embree support 2016-06-17 21:21:30 -06:00
Eric Wasylishen 6fcf04a298 light: revert to older CalcPoints (push off hit normal) to fix artifacts in testlightonface.map 2016-04-06 19:15:19 -06:00
Eric Wasylishen a6a89db530 light: refactor tracelist to be a list of modelinfo_t instead of dmodel_t 2016-04-05 23:25:36 -06:00
Eric Wasylishen aed29da060 light: tweak embree settings to fix "fireflies" 2016-04-05 12:27:51 -06:00
Eric Wasylishen 47e7a981f6 light: get rid of unneeded unordered_set 2016-04-05 00:13:29 -06:00
Eric Wasylishen e11e9d5c1f light: embree support 2016-03-30 14:58:21 -06:00