Commit Graph

2200 Commits

Author SHA1 Message Date
Kevin Shanahan 4cbbb44a23 light: minor tidy up of spot falloff check in SingleLightFace
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-02 11:30:49 +10:30
Kevin Shanahan c0ebc18d96 light: constify surf pointer in LightSingleFace
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-02 11:29:39 +10:30
Kevin Shanahan 453fd7fe31 light: better variable names in WriteLitFile
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-02 11:27:47 +10:30
Kevin Shanahan b746947595 light: use VecStr convenience function for log messages
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-02 11:27:10 +10:30
Kevin Shanahan 625fc2c61b common: add VecStr convenience function
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-02 11:25:40 +10:30
Kevin Shanahan a1e0f192c7 light: fix use of incorrect color for !nominlimit case
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-01 22:03:36 +10:30
Kevin Shanahan c458099ec7 light: implement the 4x4 oversampling option
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-01 17:26:44 +10:30
Kevin Shanahan 57a161afa2 light: place oversample points correctly around original
Looks like the original code biased these to one side, but the
oversampling will be more accurate if we evenly distribute the points
around the actual lightmap point.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-01 12:42:57 +10:30
Kevin Shanahan ad129c59da light: rename sunmangle variable as sunvec
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-01 11:58:50 +10:30
Kevin Shanahan f07007f8ad light: setup spotlight paramters once at load time
We were calculating these values for every light and for every surface,
which seems a little excessive... Also made the variable names a bit more
sensible - we had stored a direction vector, not the actual mangle values.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-01 11:50:57 +10:30
Kevin Shanahan 580b2912fb light: don't let negative lights on a new style count as a hit
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-01 10:58:11 +10:30
Kevin Shanahan a3ac989224 light: trivial VectorMA substituion
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-01 10:56:19 +10:30
Kevin Shanahan a8621afa55 changelog: catch up missed entries since v0.5
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-01 10:19:03 +10:30
Kevin Shanahan 8ce739fe3f light: remove bsp30 support and automatically generate .lit when needed
Check whether any of the entities have colored fields set and if so,
enable colored light output. Can still be overridden from the command line
if needed.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-01 10:07:53 +10:30
Kevin Shanahan 65b38c4952 build: add simple target for building OS X fat binaries
The "fatbin2" target isn't working yet since I don't have the right cross
compiler set up, but once I do then adding CC=foo to the $(MAKE) command
should be all that is needed.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-01 09:20:34 +10:30
Kevin Shanahan e0eabb1095 build: use the correct build dir variable for qbsp objects
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-01 09:19:42 +10:30
Kevin Shanahan 49e5d76273 build: add LDFLAGS from environment when linking
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-01 09:19:16 +10:30
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