Commit Graph

269 Commits

Author SHA1 Message Date
Kevin Shanahan 647fc86402 TyrUtils v0.5
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-02-26 09:39:32 +10:30
Kevin Shanahan d1652c8be5 add a changelog and prep for release
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-02-25 16:07:20 +10:30
Kevin Shanahan 7e624ed336 docs: Add some documentation for qbsp, vis and update light
Add some manpage-like documentation for the three main compile utils.
Some updates for README.txt to ready for a new release.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-02-25 15:56:31 +10:30
Kevin Shanahan c0f9b19868 vis: add detail brush / prt2 support
First pass at detail support as implemented in tyr-qbsp, using the PRT2
file format (hopefully nobody else already decided to use that?)

Because the "leaf" terminology is pervasive across the source, I've left
it there for now (so "leaf" usually now means "cluster") and added a few
variables with the "_real" suffix when they actually mean the real leafs
and not the clusters which vis still calls leafs. A bit disgusting, but it
actually works so I'll go through and clean up naming, etc. later.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-02-25 12:32:35 +10:30
Kevin Shanahan 3e12ff141d vis: pass the input buffer length into CompressRow
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-02-25 12:26:19 +10:30
Kevin Shanahan a473fedcc9 qbsp: keep portals on top node of detail cluster
Took a while to find this - need to make sure that we actually count and
write out the portals which get attached to the top node of a detail
cluster (with ->detail_separator set true).

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-02-25 12:21:49 +10:30
Kevin Shanahan 19a8dc29c4 qbsp: calculate a useful contents value for detail clusters
Update PortalThru() to take the portal as it's argument, then we can
examine the two nodes on either side of the cluster. The nodes could
either be leafs or clusters.

Walk the detail clusters recursively and if the contents are all the same,
return that, otherwise if there is some empty space, leave it as empty.
Similarly, if there is some water, return water, etc. Basically non-solids
take precedence over solids in calculating the contents of the cluster.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-02-25 12:05:41 +10:30
Kevin Shanahan e39fa9bff8 qbsp: write a -1 terminator to each clustermap line
Kind of messy but necessary to either write the number of entries at the
start of the line or write a terminator for vis' fscanf style of parsing
to work easily on the .prt file. Writing a terminator is easier for the
way qbsp is currently set up, so do that.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-02-25 12:03:26 +10:30
Kevin Shanahan 15ab7386ff qbsp: implement the clustermap for PRT2 files
Now that I've done this I realise there could be a more compact
representation by just specifying the number of leafs per cluster, since
leaves are sequentially numbered... but this format is okay as well. And
easy to parse, etc.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-02-24 12:35:44 +10:30
Kevin Shanahan 0835b01da5 qbsp: write portals to a new file format if using detail clusters
Fairly simple extension of the original "PRT1" format; the first four
lines are:

Identifier := "PRT2"
Number of Leafs := INTEGER
Number of Clusters := INTEGER
Number of Portals := INTEGER

Followed by one line for each portal made up of the following, separated
by whitespace:

Number of points on the portal winding := INTEGER
Cluster Number on the front side of the portal := INTEGER
Cluster Number on the back side of the portal := INTEGER
For each point, a coordinate in the format ( x y z ), where x, y, z are FLOATs.

After the portal descriptions, there will be one line for each cluster
which lists the leaf numbers included in that cluster.

LEAF1 LEAF2 LEAF3 ...

I should probably write this up in BNF somewhere, but it's pretty straight
forward.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-02-24 12:00:35 +10:30
Kevin Shanahan 520a8bbfdf qbsp: fix comment in PortalThru helper
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-02-24 11:59:48 +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 383726df9f qbsp: always set the detail_separator flag on bsp nodes
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-02-23 20:46:57 +10:30
Kevin Shanahan 4efab46b86 qbsp: rename poorly named SameContent() function as PortalThru()
The test here was really to see if we need to add a portal between two
adjacent leafs with the given content. Rename and re-arrange the code a
little to make it a bit easier to read.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-02-23 20:18:25 +10:30
Kevin Shanahan 8134601ef3 qbsp: misc naming and comment cleanups for CutNodePortals_r
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-02-22 21:06:23 +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 d9e73cf194 qbsp: constify arguments to FaceSide()
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-02-22 16:03:41 +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 32b94e4843 qbsp: more local variable renaming in solidbsp.c
No more surfaces called 'p' (not sure why I ever used that).

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-02-22 15:42:49 +10:30
Kevin Shanahan 5abd0e369c qbsp: separate the bsp split plane selection into two passes
All non-detail surfaces are considered and used before any detail
surfaces.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-02-22 14:29:44 +10:30
Kevin Shanahan 5275c24393 qbsp: clearer local variable names for Choose{,Mid}PlaneFromList
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-02-22 14:03:25 +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 66feee616f qbsp: maintain proper precendence ordering of brushes
Need to be a little more careful to order brushes correctly when adding
detail to the worldspawn. CSGFaces assumes that the brushes are ordered
such that earlier brushes have chunks carved out of them by any later
brushes that intersect them.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-02-22 10:43:05 +10:30
Kevin Shanahan 1b3a8b049f qbsp: only set planenum for face allocations of one element
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-02-21 15:10:33 +10:30
Kevin Shanahan e922d6a395 qbsp: trivial change to detail brush stat output
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-02-21 14:17:31 +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 d77f2a35c1 qbsp: tidy up output for Brush_LoadEntity
Pull the progress output up into the caller (not ideal) to deal with the
fact we are making extra calls to load the detail entities for the
worldspawn.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-02-21 14:13:46 +10:30
Kevin Shanahan bbcb4263d2 qbsp: don't write detail entity key/values to bsp
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-02-21 11:32:15 +10:30
Kevin Shanahan 6894518485 qbsp: don't allocate bmodel space for detail entities
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-02-21 11:31:22 +10:30
Kevin Shanahan 6bc1df862a qbsp: don't assign model keys for func_detail entities
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-02-21 11:30:27 +10:30
Kevin Shanahan 2f016cbb09 qbsp: treat func_detail entities as additional brushes for worldspawn
The first step towards supporting detail brushes for Quake 1. This gives
us a way to add detail brushes to a map within the existing mapping tools. A
mapper can simply add a definition for a "func_detail" entity to their
editor and create func_detail entities.

Of course, currently they will behave exactly like world brushes. Future
patches will start to treat them differently.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-02-20 16:41:51 +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
Kevin Shanahan e1c52985a2 qbsp: move brush contents logic up into Brush_LoadEntity
Now LoadBrush doesn't need to know about entities anymore.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-02-20 15:53:21 +10:30
Kevin Shanahan 3989b1b28d qbsp: factor out logic for deciding brush contents by texture name
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-02-20 15:40:28 +10:30
Kevin Shanahan edbd84c5ae qbsp: hoist FixRotateOrigin up into Brush_LoadEntity
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-02-20 15:19:01 +10:30
Kevin Shanahan bb9b11921a qbsp: Lift bsp model rotate origin up one level into LoadBrush
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-02-20 15:11:27 +10:30
Kevin Shanahan 54acacb2c2 qbsp: make ValueForKey return empty string if key not found
Less error prone as it's usually followed by a strn?cmp or something.
Callers that were relying on null checks updated.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-02-20 14:39:38 +10:30
Kevin Shanahan 746a210f2a qbsp: remove hullnum global and pass to CreateSingleHull()
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-02-18 11:01:11 +10:30
Kevin Shanahan 53e61c28ca qbsp: pass hullnum into ExportClipNodes()
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-02-18 10:33:28 +10:30
Kevin Shanahan 27252d9104 qbsp: pass hullnum into PortalizeWorld()
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-02-18 10:32:55 +10:30
Kevin Shanahan e943a14944 qbsp: pass hullnum down into FillOutSide()
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-02-18 10:27:13 +10:30
Kevin Shanahan ef4e53b735 qbsp: pass hullnum into Brush_LoadEntity()
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-02-18 09:51:33 +10:30
Kevin Shanahan 9e4f207d3e qbsp: trivial argument rename for FreeBrushsetBrushes in header
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-02-17 21:37:34 +10:30
Kevin Shanahan cfde5514dd qbsp: remove comment about regenerating dplane_t->type
The on disk format is set at this stage.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-02-17 21:36:13 +10:30
Kevin Shanahan d152382691 qbsp: constify FindPlane plane argument
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-02-17 21:35:22 +10:30
Kevin Shanahan 04c8c73ef6 qbsp: make Plane{,Inv}Equal take two planes as arguments
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-02-17 21:34:47 +10:30