Commit Graph

584 Commits

Author SHA1 Message Date
Kevin Shanahan 12e24085c1 light: always calculate color values for light samples
Simplify the code by removing the if (colored) conditionals from the
code path.  CPU cost is insignificant compared to tracing the rays.
As before, only write the lit file if colored lights are detected or
the use explicity requests it.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-07-03 13:03:27 +09:30
Kevin Shanahan a0fc4cab3e light: remove (now) unused MAXLIGHTS define
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-07-03 11:49:07 +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 463ded9c14 update changelog
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-06-25 13:24:54 +09:30
Kevin Shanahan 7882af13a9 qbsp: replace global face list with local in tjunc_fix_r
Explicitly pass the face list around to be added to as needed instead
of implicit reference to the global 'newlist'.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-06-25 11:00:24 +09:30
Kevin Shanahan 06166f43d8 qbsp: allocate the superface for tjunc fixes dynamically
Remove the global static buffer and allocate the superface when
processing tjuncs.  Also check that we are not overflowing the buffer
before adding more vertices - probably something went wrong if this
ever overflows, so better to crash with a definite error than scribble
random memory.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-06-25 10:39:00 +09:30
Kevin Shanahan 53a340ff04 qbsp: trivial typo in comment
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-06-24 14:04:23 +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 3cfc4a27cc qbsp: access f->w through local pointer in SplitFaceForTjunc
No functional changes, just making the previous cleanup more consistent.
Pointer is non-const now, but no matter.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-06-23 14:19:50 +09:30
Kevin Shanahan 91ae3d16d9 qbsp: cleanups in SplitFaceForTjunc
Mainly tidy up long lines and rename dir/test variables to edgevec[2]
since these are the edge vectors we are testing the angles between.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-06-23 11:37:40 +09:30
Kevin Shanahan 72fd4caab7 qbsp: rename wedge_t locals from 'w' to 'edge'
Since 'w' is commonly used for a winding variable, this makes the code
harder to read.  Use the name 'edge' instead for these tjunc local types.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-06-23 11:35:28 +09:30
Kevin Shanahan 523f927b8e qbsp: trivial cleanups in FaceSide
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-06-23 10:56:41 +09:30
Kevin Shanahan 550b883de2 qbsp: more tjunc cleanups; braces and comments
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-06-22 20:59:42 +09:30
Kevin Shanahan 46c990c617 qbsp: trivial cleanups in SplitFaceForTjunc
Rename 'v' local to 'angle' and re-format some comments.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-06-22 20:58:31 +09:30
Kevin Shanahan e4367bc970 Merge branch 'master' of ssh://tuon.disenchant.net/~/scm/tyrutils 2013-05-08 11:34:58 +09:30
Kevin Shanahan 31cdb99ac6 vis: make leaf recursion a warning in LeafFlow
Make CheckStack return an error code if we have recursed and print
some information about the offending leaf/portals before continuing.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-05-08 11:33:35 +09:30
Kevin Shanahan 9ea5aaa1db vis: tidy up definitions of LogLeaf/LogWinding
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-05-08 11:32:57 +09:30
Kevin Shanahan c0d03cba32 vis: constify source argument to copy winding
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-05-08 11:32:12 +09:30
Kevin Shanahan 8939d1f6db qbsp: fix adding animated textures for alt-anim textured brushes
If brushes in the map are textured with alt-animations, and the second
character (i.e. the 'a' in +abutton) is lower case then we have the
lowercase texture name in the miptex list, but when we add alt textures we
use the uppercase, so it gets duplicated.  Duplicated animating textures
cause most engines to exit with an error.

Since the map file could use uppercase texture names as well, really we
should either be normalizing texture names to upper or lower case, or we
need to do case-insensitive matching - so I just changed to
case-insensitive matching.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-25 21:43:59 +09:30
Kevin Shanahan 59f53cf2fa bump version post-release
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-25 21:43:32 +09:30
Kevin Shanahan 2e74b15a08 TyrUtils v0.10
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-25 08:13:09 +09:30
Kevin Shanahan 54e0e55113 vis: fix missing vertex on clipped portals (argh!!!)
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-25 07:58:43 +09:30
Kevin Shanahan 7caeafb714 trivial: pad counts to 8 digits, sizes to 10 in output
Also do a quick sweep of the source and consistently use %d instead of
%i (no real difference, but just pick one).

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-24 15:18:01 +09:30
Kevin Shanahan 414d3dda51 qbsp: add fflush back for msgScree
Otherwise progress output doesn't show on unix terminals.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-24 15:05:07 +09:30
Kevin Shanahan 47d2b9841b qbsp: use 5 spaces instead of tab to pad msgStat
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-24 15:04:35 +09:30
Kevin Shanahan a78115fa2c doc: add documentation for bspinfo and bsputil
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-24 14:29:12 +09:30
Kevin Shanahan a9cfbbc3dc trivial: fix missing newline at end of usage output
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-24 14:26:21 +09:30
Kevin Shanahan 0ad7bac1d3 build: only move tar archive to target name on success
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-24 12:22:06 +09:30
Kevin Shanahan 45fa5a6e39 build: add a target for building source tarball from git
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-24 11:37:51 +09:30
Kevin Shanahan fc38e25074 post-release version bump
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-24 09:33:57 +09:30
Kevin Shanahan d42b6a062c TyrUtils v0.9
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-24 09:05:15 +09:30
Kevin Shanahan 723a3f140e common: fix missing stdarg include in log.h
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-24 09:02:20 +09:30
Kevin Shanahan 280df62f55 qbsp: fix MidpointWinding bug, which fixes the bad leak lines!
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-24 08:54:26 +09:30
Kevin Shanahan 653daa111a qbsp: invert sense of fillnode side initialisation
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-24 07:02:38 +09:30
Kevin Shanahan 1e39a7e614 qbsp: factor out leafnode intersection from LineIntersect_r
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-24 07:01:37 +09:30
Kevin Shanahan 4543817f59 qbsp: use a memset to simplify leakstate initialization
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-24 07:00:34 +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 75666712e7 common: create logprint_silent to replace qbsp's msgFile
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-23 14:59:37 +09:30
Kevin Shanahan b1650d0036 common: temporary hack for Error() definition in threads.c
Qbsp now uses exactly the same Error() function spec, so just hack
around clashes in the cmdlib.h header for now by defining Error()
locally and removing the cmdlib.h include.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-23 14:46:15 +09:30
Kevin Shanahan bbbb3ff859 common: use stdbool in threads.c, log.c so cmdlib isn't needed
The only thing used by log.c was the qboolean definition, so just use
stdbool internally instead.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-23 14:44:14 +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 c3bf54e494 common: add printf attribute to Error() declaration in cmdlib.h
Fix a number of warnings now generated as a result.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-23 14:39:44 +09:30
Kevin Shanahan 37f87a28be vis, qbsp: improve robustness of ClipWinding/DivideWinding
Carry over some correctness fixes from recent changes to vis into the
qbsp versions of ClipWinding and make the implementations more
consistent overall.

Most importantly:
* Ensure we always have allocated one extra dists/sides slot for wrap around
* Check we have space for a new vertex every time we try to add one

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-23 14:00:31 +09:30
Kevin Shanahan dddae057d6 TyrUtils v0.8
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-23 09:40:05 +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 ea5e46f9df qbsp: replace error enums in surfaces.c, solidbsp.c
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-22 19:16:53 +09:30