Commit Graph

608 Commits

Author SHA1 Message Date
Jonathan b01fddf7f1 More Q2 support 2021-09-04 18:49:01 -04:00
Eric Wasylishen 047bc1299a qbsp: fix tests 2021-09-01 01:19:24 -06:00
Eric Wasylishen 54d9e08033 qbsp: handle target bsp version 2021-09-01 00:42:30 -06:00
Eric Wasylishen 3cbf54749e qbsp: fix -onlyents 2021-08-31 23:53:40 -06:00
Eric Wasylishen 2e09ad509b Merge remote-tracking branch 'origin/master' into qbsp-use-common 2021-08-31 22:40:51 -06: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 a75ad998e7 common: clean up Hexen II handling 2021-08-30 01:05:18 -06:00
Eric Wasylishen 5429655ce8 qbsp: move internal content types to bspfile.hh 2021-08-26 22:30:56 -06:00
Eric Wasylishen bafea15753 Merge branch 'master' into qbsp-use-common 2021-08-26 21:14:49 -06:00
Eric Wasylishen 8beda9a039 common, qbsp: make Error() noreturn 2021-08-26 20:22:45 -06:00
Eric Wasylishen 8a1bc3ef20 qbsp: refactor clipnode writing (changes .bsp output)
- drop reshuffling feature from ExportClipNodes
  As far as I can tell, the only purpose of this was to keep clipnodes
  for a given model contiguous within the lump (i.e. keep the different
  hulls contiguous).

  Vanilla qbsp didn't appear to have done this, and the code was
  unmaintainable/complex, so I'm dropping the feature.
2021-08-26 20:22:39 -06:00
Eric Wasylishen 899b2b8384 qbsp: drop MemSize stuff 2021-08-24 22:51:44 -06:00
Eric Wasylishen 208a9610ad qbsp: delete bspfile.cc/hh 2021-08-24 22:23:24 -06:00
Eric Wasylishen 50a16fa2bf qbsp: use common to write bsp
NOTE: produces almost binary-identical e1m1.bsp as last commit, the only
difference is due to the old QBSP using ascii space as a padding byte,
and common using \0
2021-08-24 01:29:21 -06:00
Eric Wasylishen 890db18171 qbsp: use common's bspfile.hh 2021-08-24 00:31:16 -06:00
Eric Wasylishen 00cdc2924a qbsp: fix name conflict with miptex_t (qbsp used it as a std::string alias) 2021-08-24 00:25:10 -06:00
Eric Wasylishen 09d7b6e73f common: transfer comments from qbsp's bspfile.hh 2021-08-24 00:17:47 -06:00
Eric Wasylishen e0710859fb qbsp: remove mapentity_t::lumps 2021-08-23 23:25:31 -06:00
Eric Wasylishen c55112b47f qbsp: refactor lmshifts lump export 2021-08-23 23:18:43 -06:00
Eric Wasylishen 490e71bb1a qbsp: remove cTotal 2021-08-23 22:50:03 -06:00
Eric Wasylishen a7fd04af12 qbsp: refactor texdata writing 2021-08-23 22:44:22 -06:00
Eric Wasylishen 6a7e59026c qbsp: refactor entities lump writing 2021-08-23 22:20:08 -06:00
Eric Wasylishen 561ffffb9b qbsp: refactor model writing 2021-08-23 21:01:49 -06:00
Eric Wasylishen f59bc08db8 qbsp: refactor face writing 2021-08-23 20:16:40 -06:00
Eric Wasylishen a0bdbf89d1 qbsp: refactor surfedges writing 2021-08-23 19:52:46 -06:00
Eric Wasylishen 8147b97dc6 qbsp: refactor vertexes writing 2021-08-23 19:45:31 -06:00
Eric Wasylishen f4700f978d qbsp: refactor edges writing 2021-08-23 19:36:41 -06:00
Eric Wasylishen 671bacf30c qbsp: refactor clipnode writing (changes .bsp output)
- drop reshuffling feature from ExportClipNodes
  As far as I can tell, the only purpose of this was to keep clipnodes
  for a given model contiguous within the lump (i.e. keep the different
  hulls contiguous).

  Vanilla qbsp didn't appear to have done this, and the code was
  unmaintainable/complex, so I'm dropping the feature.
2021-08-23 18:05:37 -06:00
Eric Wasylishen 382a725f2b qbsp: refactor writing of leafs, nodes, marksurfaces lump
- only support bsp29 for now
2021-08-23 18:02:05 -06:00
Eric Wasylishen 24fc2ffc6a qbsp: refactor plane lump writing 2021-08-23 18:02:05 -06:00
Eric Wasylishen 460428d099 qbsp: refactor texinfo lump writing 2021-08-23 18:02:05 -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 ff7f8a1542 qbsp: add -nothreads debug option 2021-08-23 00:12:38 -06:00
Eric Wasylishen 29652b4a7a qbsp: fix some threading issues with solidbsp.cc stats 2021-08-23 00:00:01 -06:00
Eric Wasylishen a618e5f5b5 common: assert(0) on Q_assert failure for better debugger experience 2021-08-22 23:27:05 -06:00
Eric Wasylishen f7256907d5 common: fix build of bsputils.cc with double == vec_t 2021-08-22 15:12:19 -06:00
Eric Wasylishen d6c888bee9 vis add -nostate debug option, skips loading from state file 2021-08-15 13:22:57 -06:00
Eric Wasylishen 72885addf1 common: fix build failure 2021-03-23 21:17:09 -06:00
Eric Wasylishen fea7849315 common: preserve order of key/value pairs 2021-02-10 00:05:53 -07:00
Eric Wasylishen b5fcdec19e cleanup: remove "byte" typedef 2021-02-07 14:02:35 -07:00
Eric Wasylishen cc116a4729 decompile: restore coplanar faces 2021-02-06 16:19:15 -07:00
Eric Wasylishen 86a644680a qvec: add constructor to extend a vector 2021-02-06 14:11:01 -07:00
Eric Wasylishen f0e2f4ba96 common: small tweaks: CopyWinding accepts null, document face side 2021-02-05 22:26:13 -07:00
Eric Wasylishen 708d3eccd3 qvec: add unary minus 2021-02-04 22:00:55 -07:00
Eric Wasylishen 0cdd2f97ab common: revert Face_Miptex change, it was breaking reading of
Q1 texture names. TODO: fix this properly?
2021-01-31 01:27:01 -07:00
Eric Wasylishen 9124653156 common: move EntData_ function to common 2021-01-30 21:11:25 -07:00
Eric Wasylishen d4aa42f0ab bsputil: decompiler wip 2021-01-30 14:49:18 -07:00
Eric Wasylishen 94c30afac4 light: refactoring necessary to support embree3 2021-01-01 23:48:22 -07:00
Eric Wasylishen 00e41688c3 light: quake2: arghrad-compatible phong support
(set face "value" to the same non-zero number, have light flag unset)
2020-12-31 12:39:17 -07:00
Eric Wasylishen 2d15d20410 light: q2: avoid black seams on geometry near sky 2020-12-29 15:58:40 -07:00