Commit Graph

1783 Commits

Author SHA1 Message Date
Kevin Shanahan 98ccc06ede qbsp: support Valve's version 220 map format
https://developer.valvesoftware.com/wiki/MAP_file_format

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-01 08:24:00 +10:30
Kevin Shanahan 8f3d28c2ac light: implement delay 4 and 5 as in visbjp light
Implement the two extra light attenuation formulae that were added to
Benjt Jardrup's light util (http://user.tninet.se/~xir870k/readmevis.txt).

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-02-28 16:16:34 +10:30
Kevin Shanahan 725fffbd7a light: fix off-by-one error in MAX_LIGHTMAPS check
I guess this bug has been here a long time. This was preventing us from
using all four available lightmaps in most cases. Now fixed!

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-02-28 15:51:28 +10:30
Kevin Shanahan d8b7e08683 light: tidy up the FixMinlight function
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-02-28 14:31:33 +10:30
Kevin Shanahan 5c4e6d4f0b light: trivial, remove old comment
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-02-28 11:46:47 +10:30
Kevin Shanahan 70fceb5218 light: also pass colors into SingleLightFace
No more games with save/modify/restore on the entity->lightcolor.
Could have actually caused nasty races in the multithreaded case.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-02-28 10:44:05 +10:30
Kevin Shanahan e8764f5492 light: pass colors into SkyLightFace
Stop playing silly games with saving, modifying and restoring the global
sunlight_color. A couple of variable naming changes in lightface and use
an entity pointer instead of always indexing into the global array.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-02-28 10:32:30 +10:30
Kevin Shanahan e8f5c6f18a qbsp: fix pedantic compiler warning for init using stack variable addresses
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-02-27 21:19:32 +10:30
Kevin Shanahan 54a5890217 light: lift light entity field checks into separate function
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-02-27 21:13:53 +10:30
Kevin Shanahan 854c7b4bb9 light: trivial variable rename
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-02-27 21:13:12 +10:30
Kevin Shanahan 599742310b light: use an enum for light attenuation formulae
And warn if we are given a formula number we don't know about.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-02-27 17:13:53 +10:30
Kevin Shanahan 22ca3262f0 light: remove alloc argument to LightStyleForTargetname()
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-02-27 15:59:03 +10:30
Kevin Shanahan 92ff448966 qbsp: parse texture rotation and shift as floats
Some editors will work with floating point rotations, so let them keep the
precise texture alignment written to the .map file.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-02-27 11:14:28 +10:30
Kevin Shanahan dcbad73b48 qbsp: add info on Radiant configuration for func_detail entities
Example taken from Scampie's .ent file posted to func:

  http://celephais.net/board/view_thread.php?id=60906

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-02-27 10:54:32 +10:30
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