Commit Graph

191 Commits

Author SHA1 Message Date
Jonathan 674be0c812 Fix a few messages (missing newlines, period in wrong place)
Use fragments to store TJunction bits instead of having them in separate-but-chained faces
2022-01-25 03:23:39 -05:00
Jonathan dfd31d7441 make markfaces a vector to simplify usage 2022-01-25 00:13:12 -05:00
Jonathan be865bc5b8 Fix `face_get_contents` not handling hintskip properly
Simplify `Brush_GetContents` and use the first non-skip face as the base contents
Move period out of `LoadExternalMap` error message so it doesn't confuse the reader
Fix `WriteEntitiesToString` crashing on entities without any brushes (note: need a column/line on mapentity in future)
2022-01-23 23:18:59 -05:00
Jonathan e92b9f1ff9 Fix miscalculation for has_struct
Remove unused variable
2022-01-23 21:48:24 -05:00
Jonathan 75339df231 Simplify surface_t by using lists 2022-01-23 19:00:01 -05:00
Jonathan 5f81657621 move calculatesurfaceinfo into a member func 2022-01-23 00:46:11 -05:00
Jonathan 5dd2deba8e use custom type for two-sided things to simplify brain power (.front/.back is easier to process than [0]/[1]) 2022-01-23 00:26:58 -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 a937e3cdba qbsp: areaportal support 2021-10-27 22:51:43 -06:00
Jonathan c37ec80667 Implement game-agnostic Brush_GetContents 2021-10-26 09:13:48 -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 1bf6261826 constexpr/inline qv:: where appropriate
comment out rewrite test in bspinfo
updated tjunc code
2021-10-19 23:26:43 -04:00
Jonathan a7de4bdae2 Remove unused thingies
Use qplane3 where we can
2021-10-17 06:24:02 -04:00
Jonathan e974285fe7 Merge branch 'type-cleanup' of https://github.com/Paril/ericw-tools into type-cleanup 2021-10-12 13:52:53 -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
Eric Wasylishen c88274f806 qbsp: outside.cc: rewrite with outside -> in filling 2021-10-11 22:40:26 -06:00
Jonathan bd6bc0dc56 surfflags remap -> is_valid to match contentflags
warn on excessive key/value lengths, per-game
2021-10-11 19:45:55 -04:00
Jonathan eb4bcf96dc -includeskip for Q2RTX
Fix missing fmt include
Default nexttexinfo to -1 to match other tools
Fmt support for bspversion_t, use that instead of a static function
Cleanup write functions
2021-10-09 14:14:49 -04:00
Eric Wasylishen c54fea1e87 qbsp: face_t: use a std::vector for edges
shared_ptr of C arrays is not working on macOS,
but std::vector is also more correct semantically
2021-10-05 23:15:43 -06:00
Jonathan 52839d4e7f Run clang-format pass 2021-10-05 15:54:06 -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
Jonathan 792951792c some more cleanup 2021-10-02 05:56:45 -04:00
Jonathan 74bbce9eab First attempt at areaportals - sadly it seems like this method might not work with this compiler. 2021-09-28 13:17:27 -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 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 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 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 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
Jonathan 8cdb9ff6c4 Initial attempt at leafbrushes 2021-09-09 05:11:47 -04:00
Jonathan 9800f4f738 Mostly all native!! 2021-09-09 00:26:17 -04:00
Jonathan 004fcb57c1 Content flags type, splitting up native and compiler flags.
Extreme WIP and likely not working properly. Need to rid all direct .native usages and direct them through target_version->game
2021-09-07 06:13:17 -04:00
Jonathan c16bbf403d Change miptex thingies to handle const as the comment wishes they would
Use optional to properly indicate the intended purpose of optional/"unset" values rather than a magic number (also because for some reason outputnum was stuck at 0 even though it defaults to -1 and I didn't want to debug why)
beginning of Q2 contents
2021-09-07 03:24:16 -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 acc65953ce Use tie for mtexinfo too 2021-09-06 22:15:59 -04:00
Jonathan 9602772450 Use tie for operator</> of surfflags_t 2021-09-06 22:12:57 -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 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 5429655ce8 qbsp: move internal content types to bspfile.hh 2021-08-26 22:30:56 -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 890db18171 qbsp: use common's bspfile.hh 2021-08-24 00:31:16 -06:00
Eric Wasylishen ff7f8a1542 qbsp: add -nothreads debug option 2021-08-23 00:12:38 -06: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 a4c1ce6ff6 qbsp, light: support _lightignore on func_detail/group 2019-12-09 00:09:20 -07:00
Eric Wasylishen 79d3aa99de qbsp: fix relative paths for .wad files
Fixes #279
2019-10-27 19:03:45 -06:00
Shpoike 89365949bc Squashed commit of the following:
commit 8ca122916d
Author: Eric Wasylishen <ewasylishen@gmail.com>
Date:   Thu Jul 4 20:54:23 2019 -0600

    fix linker error (radlights is in 2 .cpp files)

commit 8f06fc9c8d
Author: Eric Wasylishen <ewasylishen@gmail.com>
Date:   Thu Jul 4 20:53:57 2019 -0600

    add clarification comment

commit 038a553fb0
Author: Eric Wasylishen <ewasylishen@gmail.com>
Date:   Thu Jul 4 20:30:27 2019 -0600

    fix tests compilation

commit 02e94ec507
Author: Eric Wasylishen <ewasylishen@gmail.com>
Date:   Thu Jul 4 19:59:25 2019 -0600

    hlbsp: use q_snprintf

commit 669a5a7911
Author: Eric Wasylishen <ewasylishen@gmail.com>
Date:   Thu Jul 4 19:56:21 2019 -0600

    Reformat

commit 6653760982
Merge: 347a455 ac3553c
Author: Eric Wasylishen <ewasylishen@gmail.com>
Date:   Thu Jul 4 19:28:06 2019 -0600

    Merge remote-tracking branch 'origin/master' into hlbsp

    # Conflicts:
    #	include/qbsp/qbsp.hh

commit 347a455102
Author: Shpoike <Shpoike@users.noreply.github.com>
Date:   Thu Mar 28 02:18:16 2019 +0000

    Misc HLBSP tweaks

    Added support for multiple -wadpath args.
    Added -xwadpath (for eg valve/*.wad to avoid bloat/license issues).
    Reworked hint brushes - the non-hint surfaces can use any name, just so long as they're not 'hint', for compat with zhlt.
    Support 'bevel' and 'null' textures for compat with zhlt.

commit 7fb22c7367
Author: Shpoike <Shpoike@users.noreply.github.com>
Date:   Thu Mar 28 01:59:42 2019 +0000

    Support for halflife-style .rad surface lights (probably too bright, but the basics work).

commit 2da504fb62
Author: Shpoike <Shpoike@users.noreply.github.com>
Date:   Thu Mar 28 01:56:27 2019 +0000

    Add minus-prefixed textures for halflife's randomised-textures feature, instead of getting crash-to-desktop errors when the map is loaded.

commit 6366199bdb
Author: Shpoike <Shpoike@users.noreply.github.com>
Date:   Thu Mar 21 04:51:24 2019 +0000

    First attempt at hlbsp output.
2019-07-04 21:08:17 -06:00
Eric Wasylishen b343b9504a qbsp, light: support _minlight_exclude on func_group, detail, etc. 2019-04-05 21:14:39 -06:00
Eric Wasylishen ad65449cef qbsp: add "-midsplitsurffraction n" option as an alt. to -maxnodesize
switch to midsplit if the node contains more than this fraction of the
model's total surfaces. Try 0.15 to 0.5. Works better than
maxNodeSize for maps with a 3D skybox (e.g. +-128K unit maps)
2019-02-11 00:52:38 -07:00
Eric Wasylishen 2df839cfc2 light: Add "_bounce" "-1" to disable bouncing for a func_detail/etc. 2019-01-22 00:02:46 -07:00
Eric Wasylishen 0ac4909396 qbsp: change outside.cc to not fill leafs that have faces that are
straddling in and out of the void.

Previously, we were just deleting these faces, leaving HOMs.
Keeping them but filling the leaf in as solid doesn't work either, because
if they are the only faces left in the leaf it messes up the content type
determination later.

Fixes test_tjunc01.map test case from Qmaster.
2019-01-19 21:56:05 -07:00
Eric Wasylishen 4a360989f3 qbsp: add -worldextent option for compiling large maps, default 65536 2018-12-24 01:53:08 -07:00
Eric Wasylishen f92b48a8cb qbsp: experimental _noclipfaces key 2018-03-13 12:23:41 -06:00
Eric Wasylishen 94dbd0a705 qbsp: _phong_angle_concave support 2018-01-30 01:20:38 -07:00
Eric Wasylishen 2ea0076160 qbsp: experimental func_illusionary_visblocker 2017-10-24 22:17:10 -07:00
Eric Wasylishen d4f3e5de65 qbsp: partially revert "csg: mirror faces, even for solid, to help leaf content assignment" and turn it into a flag
(comit a910dd861a)
fixes https://github.com/ericwa/tyrutils-ericw/issues/175 (swtest2.map)
2017-09-16 11:18:30 -06:00
Eric Wasylishen d195c0bd2a qbsp: add _mirrorinside key for func_water, etc. 2017-08-27 12:14:09 -06:00
Eric Wasylishen c300170752 qbsp: disable q3map stuff 2017-07-24 14:13:57 -06:00
Eric Wasylishen 39aa7dcd0f qbsp: add FilterStructuralBrushesIntoTree 2017-07-23 13:13:09 -06:00
Eric Wasylishen 5158b6d296 qbsp: add BoundBrush (from q3map) 2017-07-22 17:09:03 -06:00
Eric Wasylishen 1a15d5f0e9 qbsp: add -leaktest option (from q2) 2017-07-15 12:23:11 -06:00
Eric Wasylishen 0263f95e59 qbsp: add -expand flag from q3map for testing hull1 expansion 2017-07-11 17:54:28 -06:00
Eric Wasylishen 240d65f788 qbsp: outside.cc rewrite
- no more recursively traversing portals, as this can overflow the stack
- better outside filling and .pts file generation, inspired by q3map
  (do a bfs from all leafs with entities, storing the number of steps
   from an occupied leaf in each leaf. Then do a dfs from the outside node
   to the first entity we hit.)
- .por file writing was dropped for now, can be re-added later
2017-07-10 12:46:22 -06:00
Eric Wasylishen 01fa4a9f58 qbsp: set up test case for #158 2017-07-08 16:23:08 -06:00
Eric Wasylishen a4e3a3a887 Revert "qbsp: move node_t markfaces list to a std::vector"
This reverts commit 31df408333.
2017-07-05 18:10:56 -07:00
Eric Wasylishen 117f568cd7 qbsp: don't write unused texinfo.
also cleanup planes writing
2017-07-03 01:58:26 -06:00
Eric Wasylishen 31df408333 qbsp: move node_t markfaces list to a std::vector 2017-07-02 21:03:41 -06:00
Eric Wasylishen 0cba9c5138 qbsp: clarify node->children comment 2017-07-02 20:44:16 -06:00
Eric Wasylishen 80380fa7fd qbsp: drop ExportNodePlanes. Planes were already deduplicated by
FindPlanes.
2017-07-01 17:25:02 -06:00
Eric Wasylishen af264821b7 mathlib: factor out SetPlanePts 2017-06-20 14:39:15 -06:00
Eric Wasylishen 77f3da30bf qbsp: add func_detail_fence 2017-06-09 15:13:13 -06:00
Eric Wasylishen d01b740b5b qbsp: add -omitdetailwall and -omitdetailillusionary 2017-06-07 14:12:02 -06:00
Eric Wasylishen 44445becb8 qbsp: rename "_nosurfacefragment" to func_detail_wall 2017-06-05 16:22:15 -06:00
Eric Wasylishen ac78efed98 qbsp: func_detail rewrite.
- Fix corrupt VIS issues when using func_detail
- func_detail no longer seals the map.
- add func_detail_illusionary entity type
- add func_detail key "_nosurfacefragment"
2017-06-05 14:09:31 -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 30fb5ef446 qbsp.hh: clarify detail_separator comments 2017-06-01 19:40:00 -06:00
Eric Wasylishen 213e4b9f7d qbsp: add a -nodetail switch, for debugging func_detail issues 2017-05-31 23:23:53 -06:00
Eric Wasylishen f5d4cd9202 qbsp: add -forceprt1 option for generating a PRT1 to load in editors
This is for previewing the portals between clusters, since no editors
can load PRT2.
2017-05-31 23:18:04 -06:00
Eric Wasylishen 8f4b506608 qbsp: refactor cmake setup 2017-04-28 13:04:51 -06:00
Eric Wasylishen 64efc77055 qbsp: expose some stuff in qbsp.hh 2017-04-28 13:04:44 -06:00
Eric Wasylishen 3ec36f6550 qbsp: use common/cmdlib 2017-04-26 15:08:49 -06:00
Eric Wasylishen 8c89e128c7 qbsp: drop internal mathlib 2017-04-26 14:51:27 -06:00
Eric Wasylishen 1f7bd69385 qbsp: optimize FindTexinfo 2017-04-22 16:59:14 -06:00
Eric Wasylishen 43798edcfe qbsp: split out winding.hh 2017-04-20 20:09:24 -06:00
Eric Wasylishen 9034eb107a qbsp: move remaining headers to include directory 2017-04-20 19:52:06 -06:00