Commit Graph

558 Commits

Author SHA1 Message Date
Eric Wasylishen 3acc48269e light: add lanczos filter 2017-02-07 14:27:51 -07:00
Eric Wasylishen 9246454bfc light: refactor some more stuff to GLM 2017-02-06 23:00:48 -07:00
Eric Wasylishen 7fdb77188c light: work-in-progress stuff 2017-02-06 21:57:49 -07:00
Eric Wasylishen 9330d2c087 light: rename Face_MakeInwardFacingEdgePlanes() to Face_AllocInwardFacingEdgePlanes()
do memory allocation inside the function.
2017-02-01 14:38:42 -07:00
Eric Wasylishen be3c84ec98 light: add a EdgePlanes_PointInside() function to bsputils.{hh,cc} 2017-02-01 14:38:42 -07:00
Eric Wasylishen c035907ff8 light: move Face_MakeInwardFacingEdgePlanes() to bsputils.{hh,cc} 2017-02-01 14:38:42 -07:00
Eric Wasylishen 29b420c7dd light: move Light_PointInSolid to bsputils.{hh,cc} 2017-02-01 14:38:42 -07:00
Eric Wasylishen b46cba40a4 light: entity warnings: print bbox for bmodel entities
fixes https://github.com/ericwa/tyrutils-ericw/issues/120
2016-11-24 17:10:15 -07:00
Eric Wasylishen cefadfa1f4 build: fix on MSVC 2013 2016-10-17 19:25:27 -07:00
Eric Wasylishen a6468984bf all: finish c++ification 2016-10-17 19:52:17 -06:00
Eric Wasylishen d9bb0be32e light: move Face_Contents to common 2016-10-17 17:37:28 -06:00
Eric Wasylishen 801d9652c0 common: add util function to get a face number 2016-09-20 00:01:15 -06:00
Eric Wasylishen 494f9bb050 common: make Q_assert inline 2016-09-18 15:44:04 -06:00
Eric Wasylishen 857b4402ad light: change assertions to Q_assert (so they are all enabled in release builds) 2016-09-18 15:41:56 -06:00
Eric Wasylishen b2fb764e36 common: new assertion macro used in all builds (debug/release) 2016-09-18 15:39:16 -06:00
Eric Wasylishen 33093151c6 common: ClipWinding: fix constness 2016-09-10 15:32:50 -06:00
Eric Wasylishen 687b1b20f6 light: bsp backend: fix and simplify Face_Contents to only look at texture names. it was broken when -splitspecial was used. 2016-09-09 13:04:53 -06:00
Eric Wasylishen 4fb903bd8e common: add more AABB functions 2016-08-09 17:56:55 -06:00
Eric Wasylishen 79525b9aee common: mathlib: add UniformPointOnSphere 2016-08-09 17:20:51 -06:00
Eric Wasylishen 0c63d61a60 common: mathlib: use EQUAL_EPSILON in AABBsDisjoint 2016-08-09 16:41:11 -06:00
Eric Wasylishen 0b6578e4b3 common: mathlib: add some AABB functions 2016-08-09 16:27:51 -06:00
Eric Wasylishen d3070a18a4 common: build fix (M_PI -> Q_PI) 2016-08-09 16:05:43 -06:00
Eric Wasylishen 4be2fe289e common: add RandomDir 2016-08-09 15:29:23 -06:00
Eric Wasylishen 68e1736ad1 light: move more stuff to bsputils.cc 2016-08-07 23:07:20 -06:00
Eric Wasylishen 486606eb88 light: rename GetSurfaceVertex to Face_VertexAtIndex 2016-08-07 22:57:45 -06:00
Eric Wasylishen 1a0fb22e40 light: move some helper functions to common/bsputils.{h,cc} 2016-08-07 22:55:44 -06:00
Eric Wasylishen 939778bd23 build: add snprintf wrapper from QuakeSpasm (vs2013 compat) 2016-08-06 15:47:40 -07:00
Eric Wasylishen 292d35879b build: restore mingw support 2016-08-05 04:07:01 -04:00
Eric Wasylishen 8429017ea4 common: add message to LoadBSPFile 2016-07-23 16:19:53 -06:00
Eric Wasylishen 335f54aa09 common: remove setting stack side for pthreads 2016-07-15 16:14:48 -06:00
Eric Wasylishen 78810fa765 common: fix COM_Parse const-ness 2016-07-06 17:06:28 -06:00
Eric Wasylishen afbc17d1ea qbsp, common: raise BOGUS_RANGE to 65536 2016-06-09 01:18:35 -06:00
Eric Wasylishen e0f8213cc9 common: add userinfo param to DiceWinding 2016-05-19 23:55:12 -06:00
Eric Wasylishen 4ea6b2ec00 common: fix broken WindingPlane 2016-05-19 23:53:14 -06:00
Eric Wasylishen 7715310afe common: add AllocWindingEdges, FreeWindingEdges, PointInWindingEdges 2016-05-19 22:02:45 -06:00
Eric Wasylishen 2cdc5e7c68 common: actually move WindingFromFace to polylib 2016-05-19 15:18:33 -06:00
Eric Wasylishen 45010089f3 light, common: move WindingFromFace to bspfile.c/h 2016-05-19 15:07:31 -06:00
Eric Wasylishen fff12697e5 light: move DicePatch to polylib.c 2016-05-19 15:03:21 -06:00
Eric Wasylishen f73b9de0b3 common: make VectorLength, VectorNormalize static inline 2016-05-13 21:10:00 -06:00
Eric Wasylishen bc0e76f959 common: polylib: add WindingBounds from q2 tools. Add missing consts 2016-04-19 01:39:37 -06:00
Eric Wasylishen 901e56f375 common: WriteBSPFile: log the filename being written 2016-03-31 18:12:11 -06:00
Eric Wasylishen e2dbd45b4f all: fix infinite loop in LoadFilePak when map can't be found 2016-02-25 14:08:00 -07:00
Eric Wasylishen b0777c2075 suppress compile warnings 2016-02-15 16:20:29 -07:00
Eric Wasylishen 1da64c0db4 Fix bspx lump padding logic 2016-02-15 16:20:29 -07:00
Eric Wasylishen 1630b8756e tyrutils-ericw-spike rebased on to 998c9d3acb 2016-02-15 16:16:37 -07: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 c149ed2bf6 build: VS2015 support 2015-12-07 14:23:13 -07:00
Eric Wasylishen a3b985e721 hexen2 support, patch from Spike 2015-10-16 21:18:53 -06:00
Eric Wasylishen 44bd1c4943 light: show execution time with tenths of a second 2015-09-12 18:54:26 -06:00
Eric Wasylishen 3005504fe5 vis, light: set low process priority on windows 2015-08-05 12:10:17 -06:00
Eric Wasylishen 985271f689 bsputil: display number of models 2015-04-29 16:07:14 -06:00
Eric Wasylishen 02196e2efa Makefile/CMakeLists.txt: factor out stack size setting to here. 2015-04-25 17:29:23 -06:00
Eric Wasylishen 15a4e160f2 threads.c: re-enable code to set the stack size on posix. Default stack size on OS X 10.10 isn't large enough 2015-02-05 11:39:15 -07:00
Kevin Shanahan 7019894003 common: output human readable version string in WriteBSP
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-09-30 12:26:56 +09: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 4b1e3aec1a light, vis, bsputil, bspinfo: Add BSP2 support
Add BSP2 support to the remaining utils.  Since these share the common
bspfile.[ch] files, it was more effort than is justifiable to break this
into multiple staged patches - so you just get this disgustingly big
commit instead.  Here is basically what was done:

 * Modify the bspdata_t struct with a union of the two bsp formats
 * Modify the tools to use bsp2_t for all internal processing
 * Split out the byte swapping routines for the different bsp data types
 * Add simple (although verbose) code to convert bsp29 <-> bsp2

Hundreds of lines added to bspfile.c, but mostly trivial stuff.  The tools
internally had little modification except to substitute the bsp2 type
names.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-09-25 15:18:50 +09:30
Kevin Shanahan fbab3d4859 common: tidy up version check in LoadBSPFile
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-09-23 12:24:31 +09:30
Kevin Shanahan e970bea8c7 common: save the bsp version in the bspdata struct
Adjust the Load and Write API functions as appropriate.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-08-22 13:25:47 +09:30
Kevin Shanahan 89abf25218 common: convert all tools to instanced bsp data
Transition all tools to access the BSP data via the bspdata struct instead
of the shared globals.  Remove the compatibility code from bspfile which
copied the global values to/from the instanced bspdata struct.

Mostly the changes just involved passing along the bspdata struct to the
various functions which needed to reference the data.  TraceLine and
MakeTNodes in light got some extra changes so that we cache the node
dplane pointer and remove the need to pass the bspdata struct to every
trace operation!

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-08-22 11:01:08 +09:30
Kevin Shanahan d0617760f5 common: add the ability to pass an arg to spawned threads
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-08-20 19:27:40 +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 51419621ec common: add the bsp2/bsp29 data types
Rename the default bsp29 data types and add the bsp2 data types to
the common bspfile.h.  Propogate the bsp29 names into the other tools as
simple renames for now.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-08-20 13:25:16 +09:30
Kevin Shanahan 42bcf2da7c common: rename HEADER_LUMPS -> BSP_LUMPS
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-08-20 09:30:26 +09:30
Kevin Shanahan 9a2cd81b8c common: add the bsp version defines to bspfile.h
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-08-20 09:18:26 +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 d14793f7ab common: make LoadBSPFile take a bspdata struct
No longer update the globals in this function - make the callers do it
instead.

bspinfo no longer refers to the globals at all.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-20 16:51:45 +09:30
Kevin Shanahan 35024bfa7d common: make dtexdata a union
Just having one base pointer was kind of annoying because you have to cast
to get to the lump offsets, then cast to byte * to find the miptex, etc.
Now we can access the same pointer using the correct types in each case.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-20 16:34:30 +09:30
Kevin Shanahan 37a3a98eff common: make WriteBSPFile take a bspdata struct as input
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-20 15:52:31 +09:30
Kevin Shanahan 6bf97a2cb0 common: convert PrintBSPFileSizes to use the bspdata struct
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-20 13:27:25 +09:30
Kevin Shanahan 3e660b291a common: zero the bsp structure before calling CopyLump
Stops CopyLump from trying to free using random pointers.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-20 13:24:09 +09:30
Kevin Shanahan bc0de585ff common: fix use after free in LoadBSPFile
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-20 13:23:34 +09:30
Kevin Shanahan 23d938a822 common: fix reference to plane data in SwapBSPFile
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-20 13:22:31 +09:30
Kevin Shanahan d4aba2ce58 common: convert LoadBSPFile to work on a bspdata struct internally
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-20 12:44:48 +09:30
Kevin Shanahan 00850d9db8 common: convert SwapBSPFile to work on a bspdata_t struct
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-20 12:02:09 +09:30
Kevin Shanahan 89074e10e9 common: create a struct for instanced bsp data
I'd like to be able to control visibility of the global bsp data as well
as having the ability to load two bsp files and do comparisons, etc.  Set
up a structure to hold all the bsp data and a couple of helper functions
to enable a smooth transition for the utils.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-20 12:00:07 +09:30
Kevin Shanahan 0258b441c1 common: use a swap type enum for SwapBSPFile
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-20 11:25:18 +09:30
Kevin Shanahan 5943c71c98 common: pass file handle and header into AddLump
Instead of passing parameters via globals.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-20 10:53:34 +09:30
Kevin Shanahan d7611d6b1b common: change loadfile argument to avoid casts in callers
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-20 10:26:08 +09:30
Kevin Shanahan df0aa44310 common: create a lumpspec structure with lump data names/sizes
Copylump now doesn't need the size passed in, just the type.  Also, pass
the file header into CopyLump while we're at it.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-20 10:21:53 +09:30
Kevin Shanahan 9580d04f45 common: minor cleanups in SwapBSPFile
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-20 07:43:24 +09:30
Kevin Shanahan 207f5c6386 common: interrupt thread progress before printing error
Still racy, but better than printing on the same line as the progress
indicator line...

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-19 15:00:21 +09:30
Ozkan Sezer 828a34a959 common: fix undefined array reference behavior in SwapBSPFile
Thanks to a -Waggressive-loop-optimizations warning from gcc-4.8:

common/bspfile.c: In function 'SwapBSPFile':
common/bspfile.c:121:41: warning: iteration 4u invokes undefined behavior [-Waggressive-loop-optimizations]
      texinfo[i].vecs[0][j] = LittleFloat(texinfo[i].vecs[0][j]);
                                         ^
common/bspfile.c:120:2: note: containing loop
  for (j = 0; j < 8; j++)
  ^

Signed-off-by: Ozkan Sezer <sezero@users.sourceforge.net>
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-14 09:12:31 +09:30
Ozkan Sezer 3eff2401a9 common: fix parsing quoted strings when EOF is reached mid-string
Signed-off-by: Ozkan Sezer <sezero@users.sourceforge.net>
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-14 09:05:58 +09:30
Ozkan Sezer 4a80c38081 common: add support for C-style /*..*/ comments
Signed-off-by: Ozkan Sezer <sezero@users.sourceforge.net>
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-14 09:03:54 +09:30
Kevin Shanahan b4ff9663cc build: add ability to compile for WIN64 using MinGW64
Fix a few minor int<->pointer size warnings.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-15 21:49:16 +10:30
Kevin Shanahan 1dc62b426a common: add VecStrf debugging helper and increase buffers to 8
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-13 12:57:56 +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 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 5bb5c576f4 common: constify init_log filename argument
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-02-11 20:10:17 +10:30
Kevin Shanahan fb3966eb02 common: use lockless logprint for Error() function
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-02-09 16:36:35 +10:30
Kevin Shanahan f1dcf001ab common: don't interrupt thread progress when no threads running
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-02-08 16:51:36 +10:30
Kevin Shanahan a56030fad0 common: make logprint properly interrupt the thread progress display
Logprint will notify the threads code that the progress meter has been
interrupted and the progress meter will re-print the next time it needs to
be updated.

Unfortunately this makes all the utils depend on the thread code, but not
a big issue.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-02-08 16:37:48 +10:30
Kevin Shanahan 742fa4b6e5 common: fix progress indicator when start > 0
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-02-08 15:09:45 +10:30
Kevin Shanahan 3382f9ca96 common: catch up thread progress bar if not starting from zero
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-02-07 21:14:14 +10:30
Kevin Shanahan 3e20dae28e common: add start arg to RunThreadsOn to set initial progress
In case we are not starting work from 0, allow this to be set...

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-02-07 20:51:04 +10:30
Kevin Shanahan 853761d0d6 common: remove pacifier argument from RunThreadsOn
Set to true everywhere, just use it unconditionally.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-02-07 20:46:33 +10:30
Kevin Shanahan 37a9935643 common: remove commented out "less portable" timing code
Precise timing is not important for the job vis does.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-02-07 19:36:16 +10:30
Kevin Shanahan 498286faa1 common: output thread progress in 2% increments
Provides a bit more granularity than the old meter which only updated
every 10%.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-01-18 17:49:08 +10:30
Kevin Shanahan c5ecfad903 common: flush stdout after printing log messages
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-01-18 17:48:51 +10:30
Kevin Shanahan ecb66fb2aa vis: convert full vis to use the thread progress code
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2012-12-26 14:01:26 +10:30
Kevin Shanahan 557a1faf20 common: make the common thread code usable on Win32/Linux
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2012-12-26 09:33:50 +10:30
Kevin Shanahan f85b221da6 common: fix varargs use in log{,v}print
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2012-12-17 13:02:41 +10:30
Tyrann ce369bfdd6 Use offsetof() consistently
And include stddef.h where we do use it
2012-01-06 21:32:53 +10:30
Ozkan Sezer 4b4da3e2d7 [PATCH] common: SetQdirFromPath fixes and documentation
Add somewhat better documentation for SetQdirFromPath which is actually a
painful functionality. Fixes a couple of corner cases like where the given
path contains no separator characters.

Signed-off-by: O.Sezer <sezero@users.sourceforge.net>
Edited-by: Tyrann <tyrann@disenchant.net>

Signed-off-by: Tyrann <tyrann@disenchant.net>
2007-09-08 21:04:50 +09:30
Ozkan Sezer 32d0cd9417 [PATCH] common: fixed a minor bug in ExpandPath of tyrutils
Signed-off-by: O.Sezer <sezero@users.sourceforge.net>
Signed-off-by: Tyrann <tyrann@disenchant.net>
2007-09-08 20:40:47 +09:30
Tyrann 2c2f3c8eb6 Import initial sources 2006-08-28 23:58:10 +09:30