Commit Graph

110 Commits

Author SHA1 Message Date
Eric Wasylishen 063786bf02 build: fix spurious errors in VS2015 IDE 2015-12-07 14:37:46 -08:00
Eric Wasylishen 420125cc67 replace tabs with spaces.
for FILE in $(find . -name "*.h" -or -name "*.c"); do cat $FILE | expand > temp; cat temp > $FILE; done
2015-12-07 15:08:48 -07:00
Eric Wasylishen 0ec1c96a06 build: fix warning 2015-12-07 14:40:44 -07:00
Eric Wasylishen c149ed2bf6 build: VS2015 support 2015-12-07 14:23:13 -07:00
Eric Wasylishen 44e1eccca6 qbsp: change detail handling, from qbsp-xt.
MidSplit now does two passes (structural/detail), like ChoosePlaneFromList.
Now, the first pass will pick among planes that have at least one structural face, and zero or more detail faces.
The second pass will pick among planes that have no structural faces, and zero or more detail faces.

This fixes the hull 1 leak in telefragged.map introduced when I added txqbsp's maxNodeSize feature,
and also reduces the cluster and portal count in jam6_ericwtronyn.map a bit.
2015-10-18 14:28:36 -06:00
Eric Wasylishen a3b985e721 hexen2 support, patch from Spike 2015-10-16 21:18:53 -06:00
Eric Wasylishen a75de817b1 qbsp: add -epsilon option to set ON_EPSILON, from txqbsp-xt 2015-09-27 00:53:55 -06:00
Eric Wasylishen 3322ffb8f3 qbsp: add -maxnodesize option from txqbsp-xt. Defaults to on, nodes with a bbox with any dimension exceeding 1024. 2015-09-16 21:31:44 -06:00
Eric Wasylishen ed66ed112e qbsp: fix texture offset on rotate_object, so they match in the editor. Added "-oldrottex" flag to revert to old behaviour. From txqbsp-xt. 2015-04-29 16:07:07 -06:00
Eric Wasylishen d77a7d768c qbsp: switch to hardcoded MAX_MAP_PLANES. counting unique planes was slow 2015-04-25 23:09:35 -06:00
Kevin Shanahan 06583de238 qbsp: save line number information when generating faces
To improve debug messages, save the line number of the faces as we
generate them and in the case of hull generation, save a pointer back
to the source brush.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2014-02-13 15:55:23 +10:30
Kevin Shanahan f9d1f50cf3 qbsp: increase MAXEDGES from 32 to 64
Should still be enough stack space... I think.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-12-24 19:04:57 +10:30
Kevin Shanahan 50b78f3d61 qbsp, common: support both DP and RMQ variants of the BSP2 format
Turns out there are two types of "BSP2" format - one that I think was
created by MH and implemented in the RMQ project (this is the one I
implemented previously) and one by LordHavoc which exteneded the
coordinate limits beyond 32k, implemented in Darkplaces.  The
Darkplaces version of BSP2 will get the name BSP2 and the RMQ version,
which is more limited, will get the name BSP2rmq.

qbsp will only create the BSP29 or BSP2 formats, but will cope with a
BSP2rmq format file for an -onlyents compile.  The rest of the tools
can use any of the three formats.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-09-28 11:48:37 +09:30
Kevin Shanahan 5facda6ff9 common: constify vec3_origin
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-08-20 13:30:05 +09:30
Kevin Shanahan 083dc9fda1 qbsp: add output of faces and edges using bsp2 format
Won't produce a working bsp2 file yet, but if you ask for bsp2 on the
command line now, faces and edges will be output in bsp2 format.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-08-19 16:20:55 +09:30
Kevin Shanahan 9c3613e47f qbsp: duplicate the MemSizes array for the two BSP formats
Kind of taking a step backwards here to where we were, but make the
MemSizes array dynamically changable so that we can switch out and
allocate BSP2 sized elements when we want to write a file in that format.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-08-19 14:36:40 +09:30
Kevin Shanahan 330d5270dd qbsp: separate out bspfile.h from qbsp.h
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-08-19 09:46:23 +09:30
Kevin Shanahan e3a5b57ba4 qbsp: add "-forcegoodtree" command line option
Normally we build a fast, unoptimized bsp tree for the world before
culling outside surfaces.  This command line switch forces the use of
the more expensive algorithm for this processing stage.  Seems to have
a positive effect on the final BSP in terms of reduced marksurfaces
and smaller file size, at the expense of longer processing time.

Marked experimental for now, as it may be removed later (either by
making this behaviour the default or removing it altogether).

Credit to Rebb from func_msgboard for implementing this tweak first in
his qbsp util.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-06-25 13:59:24 +09:30
Kevin Shanahan 83b54b90f7 qbsp: improve calculation of allocation for dmiptexlump
Use offsetof for the count/offsets and tidy up the local comments
while we're at it.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-06-24 14:00:58 +09:30
Kevin Shanahan 7a65efbc00 qbsp: define offsetof to builtin if not defined
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-06-24 13:58:58 +09:30
Kevin Shanahan ff9bb3eab0 qbsp: tweak T_EPSILON to be greater than EQUAL_EPSILON
The way wedge_t and wvert_t were hashed and compared was resulting in
FixFaceEdges being able to get stuck in a loop adding verticies to a face
if two consecutive verticies were very close to EQUAL_EPSILON apart.
Avoid these problems by tweaking T_EPSILON to be slightly wider than
EQUAL_EPSILON.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-06-23 14:22:13 +09:30
Kevin Shanahan 6d6a787185 qbsp: comment wvert_t and wedge_t structures
Took me some time to work out what this was all representing and that t
was the parameter to the parametric equations of the edge's line in 3-d
space.  May as well make it easier for others and my future self.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-06-23 14:20:54 +09:30
Kevin Shanahan 4c6142e97f qbsp: use the common logfile code
Not too intrusive, since the Message() layer still acts as a shim
here.  Most of the changes are for the Makefile.  Qbsp now links to
the threading code as a result, but no thread support... yet!

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-23 15:48:32 +09:30
Kevin Shanahan bf9bc549d2 qbsp: remove unneccessary extern from function declarations
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-23 14:41:54 +09:30
Kevin Shanahan 347020879d qbsp: rename Error_() to Error()
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-22 20:21:17 +09:30
Kevin Shanahan 51bed53570 qbsp: remove remaining enum errors
Remove the enum Error() function and global error strings as well.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-22 20:15:09 +09:30
Kevin Shanahan 30caae09e5 qbsp: re-factor ParseBrush into smaller pieces
Factor out some of the processing involved with parsing a brush.  When
checking for duplicate planes, use the same "PlaneEqual" functions as
used in brush.c.

Replace the enum style errors with the new Error_ function for all of
map.c so the error string is at the call site.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-22 17:33:16 +09:30
Kevin Shanahan 39ccae145a qbsp: create an Error() function similar to the other tools
Call it Error_() for now while I work on transitioning away from the
arrays of global strings hidden away by error enums.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-22 11:40:22 +09:30
Kevin Shanahan 3dc06c6f21 qbsp: add a -noskip option for troubleshooting skip related problems
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-19 09:48:43 +09:30
Kevin Shanahan 6f33083868 qbsp: get rid of global 'validfaces' plane->face map
Only used in two places and not a whole lot of calls, so just allocate the
map while it's needed and free it afterwards. There is no relationship
between the two users, so no need to share a common block of memory.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-07 13:13:37 +10:30
Kevin Shanahan b11e671254 qbsp: pass plane-to-face hash into BuildSurfaces
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-07 13:02:58 +10:30
Kevin Shanahan 6b25dbd2cc qbsp: add hint brush support
Similar to the skip texture handling, add miptex flags, handle
appropriately in CSGFaces and SolidBSP, then remove the surfaces before
writing out the bsp.

Lightly tested, but seems to do all the right things.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-06 16:58:14 +10:30
Kevin Shanahan 151370b06a qbsp: Split FreeInside into FreeFaces and KeepInsideFaces
FreeInside was a strange name, since depending on the arguments we
actually wanted to keep the faces.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-06 16:25:12 +10:30
Kevin Shanahan 744f542203 qbsp: fix handling of leak files
Previously, leak files would only be written for a leak in hull 2. This is
actually pretty bad because a small leak in hull 0 or 1 might not show up
in hull 2 and you would never get a leak file to chase it down.

Place a flag in the global mapdata to indicate whether we have written a
leak file or not so we only write for the first hull that leaks. Hullnum
is no longer needed as a parameter to RecursiveFillOutside, so remove
that from the fillparms struct.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-06 09:45:29 +10:30
Kevin Shanahan 4fea8f28b5 qbsp: place outside filling number into mapdata global
Remove the (file) global fillmark from outside.c and place into the global
mapadata. Pass the fillmark into RecursiveFillOutside as a read-only
parameter instead.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-06 09:39:15 +10:30
Kevin Shanahan 462792e03b qbsp: rename node member valid->fillmark
This is not a yes/no flag it's an integer mark to see if we have visited
the node within the same fill pass.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-06 08:45:47 +10:30
Kevin Shanahan 75ef5aa9d8 qbsp: trivial rename of local ent variables to entity
Somewhat self indulgent, but this reads easier to me now.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-05 15:34:52 +10:30
Kevin Shanahan 926cf8eb95 qbsp: return first face number from MakeFaceEdges and pass to ExportDrawNodes
Removes another global variable.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-05 15:17:40 +10:30
Kevin Shanahan fe89facbd0 qbsp: rename face->texturenum to texinfo
Since it is an index into the global texinfo, not miptex.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-05 14:34:02 +10:30
Kevin Shanahan 4ff4acb8c5 qbsp: create a skip flag for SKIP textures
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-05 12:01:15 +10:30
Kevin Shanahan 08ef637d97 qbsp: assign vis cluster numbers to leafs
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-02-24 09:26:37 +10:30
Kevin Shanahan 49376dce50 qbsp: don't generate portals on detail splits
Also, compile fix for incomplete commit da3aa26ee.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-02-24 09:23:51 +10:30
Kevin Shanahan 3123d51db5 qbsp: make num_visportals local to portals.c
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-02-23 20:49:14 +10:30
Kevin Shanahan a86e38e5b1 qbsp: misc const correctness improvements for windings
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-02-22 21:04:38 +10:30
Kevin Shanahan da3aa26ee5 qbsp: flag when a surface/node is a detail separator
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-02-22 15:57:47 +10:30
Kevin Shanahan 996042482b qbsp: rename FreeBrushsetBrushes -> FreeBrushes
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-02-22 13:57:34 +10:30
Kevin Shanahan 146986e74a qbsp: propogate contents flags into faces during csg stage
This will allow us to properly order the bsp nodes/leafs containing detail
brushes.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-02-22 11:08:12 +10:30
Kevin Shanahan 341fe08630 qbsp: add contents flag field for brushes and flag detail brushes
During conversion from map brushes to bsp brushes, set the brush detail
flag for later use in CSGFaces().

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-02-21 14:15:25 +10:30
Kevin Shanahan 918333cfe9 qbsp: Enable loading brushes from one entity into another
Make Brush_LoadEntity() take a source and destination entity arguments. In
order for this to work, intialisation is done before calling and then the
BSP brushes generated from the source entity's map brushes are added to
whatever is already in the destination entity.

Reasons for doing this will become obvious with the following patch! :)

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-02-20 16:38:43 +10:30
Kevin Shanahan a5ac09fbd1 qbsp: fix missing declaration of CONTENTS_CLIP from previous patch
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-02-20 16:22:22 +10:30