Commit Graph

82 Commits

Author SHA1 Message Date
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 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 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 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
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
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