Commit Graph

245 Commits

Author SHA1 Message Date
Eric Wasylishen bd0556cf22 light: switch to new Face_Centroid 2017-02-09 00:17:22 -07:00
Eric Wasylishen f09cadbc76 light: switch to new world space <-> texture space code 2017-02-08 17:51:22 -07:00
Eric Wasylishen 90bf0134de common: move vec3_t_to_glm() to mathlib.hh 2017-02-08 15:01:03 -07:00
Eric Wasylishen 3acc48269e light: add lanczos filter 2017-02-07 14:27:51 -07:00
Eric Wasylishen 4813bf6aa2 common: remove unused function 2017-02-07 11:44:02 -07:00
Eric Wasylishen 9246454bfc light: refactor some more stuff to GLM 2017-02-06 23:00:48 -07:00
Eric Wasylishen f018b7324d light: refactor phong shading to use GLM 2017-02-06 22:50:56 -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 fbeba25bd1 light: read _mincolor from .texinfo file 2016-11-02 17:23:25 -06:00
Eric Wasylishen a6468984bf all: finish c++ification 2016-10-17 19:52:17 -06:00
Eric Wasylishen 64ec89312d common: Add Q_assert_unreachable() 2016-10-17 18:16:23 -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 b2fb764e36 common: new assertion macro used in all builds (debug/release) 2016-09-18 15:39:16 -06:00
Eric Wasylishen 073ede98c7 light: when there are too many lightstyles on a face, sort them by descending average brightness and take the top 4
previous behaviour was random, which made needlessly ugly artifacts.
2016-09-18 15:12:57 -06:00
Eric Wasylishen 33093151c6 common: ClipWinding: fix constness 2016-09-10 15:32:50 -06:00
Eric Wasylishen b849a79c3f light: move GetDir to mathlib 2016-08-11 14:16:23 -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 0b6578e4b3 common: mathlib: add some AABB functions 2016-08-09 16:27:51 -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 a807204fe6 build: vs2013 compat changes 2016-08-06 15:37:00 -07:00
Eric Wasylishen 78810fa765 common: fix COM_Parse const-ness 2016-07-06 17:06:28 -06:00
Eric Wasylishen e0f8213cc9 common: add userinfo param to DiceWinding 2016-05-19 23:55:12 -06:00
Eric Wasylishen 7715310afe common: add AllocWindingEdges, FreeWindingEdges, PointInWindingEdges 2016-05-19 22:02:45 -06:00
Eric Wasylishen a6f4dad172 light, vis: move plane_t to mathlib.h 2016-05-19 15:26:30 -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 d5a4e07deb common: fix VECT_MAX macro 2016-04-10 14:43:17 -06:00
Eric Wasylishen 41972a376a qbsp, light: Strip texinfo flags other than TEX_SPECIAL.
Write extended ones to a "mapname.texinfo" file.
Support "_dirt" and "_minlight" flags on func_detail/group.
2016-03-05 00:26:54 -07:00
Eric Wasylishen fec88c3186 light: fix build on MSVC 2016-03-02 19:21:30 -08:00
Eric Wasylishen 492d94c1fe light: new phong shading keys, "_phong_angle" and "_phong".
"_phong" "1" is a shortcut for "_phong_angle" "89".
"_phong_angle" sets the max angle in degrees between faces that will get smoothed.
2016-03-02 20:00:05 -07:00
Eric Wasylishen f641e93ca2 light: convert light.c to light.cc 2016-03-02 17:07:02 -07:00
Eric Wasylishen 7128a8e956 code formatting, normalize most whitespace to 4 spaces 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 063786bf02 build: fix spurious errors in VS2015 IDE 2015-12-07 14:37:46 -08: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 792a7eae6e vis: raise MAX_MAP_VISIBILITY to 128MB 2015-10-19 23:48:19 -06:00
Eric Wasylishen a3b985e721 hexen2 support, patch from Spike 2015-10-16 21:18:53 -06:00
Eric Wasylishen 3005504fe5 vis, light: set low process priority on windows 2015-08-05 12:10:17 -06:00
Eric Wasylishen 741d341332 Dirtmapping (ambient occlusion) from q3map2 2015-04-25 20:45:32 -06:00
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 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 0092347789 common: use stdint types in the common bspfile.h
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-08-20 12:25:51 +09:30
Kevin Shanahan 69c86e59b8 common: move AMBIENT and MAXLIGHTMAP definitions
Keep the ambient sound definitions near the leaf and lightmaps limit near
the face definition.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-08-20 12:20:57 +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 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 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 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 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 b484603871 trivial: remove old comment about removing plane type
On disk formats are pretty final at this point...

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-20 16:58:54 +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 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 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 f20033fdd7 light: dynamically allocate entities and entstring
Removes the MAX_MAP_ENTITIES and MAX_MAP_ENTSTRING limitations by
counting how much space we will need before parsing/writing.

Now that I look at it, I'm not sure why we should even be re-writing
the entity string in the new bsp file, but I'll leave that behaviour
alone... for now.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-18 09:45:52 +09:30
Kevin Shanahan cc8477c6d9 light: implement -soft command line option
Add the -soft command line option which implements post-processing on
the lightmap surface to blend adjacent samples together to smooth out
hard shadow lines.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-14 11:28:22 +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 7b36c6fd2f build: query git for version info and print consistently for each util
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-07 14:26:14 +10:30
Kevin Shanahan a8d8150791 light: implement the -gate option
Precalculate the distance at which lights will fade to zero brightness.
For lights with inverse falloff, use the gate value to determine the
cut-off distance.  Use this value to cull samples and avoid the ray
tracing overhead.

Hopefully not too controversially, I am going to default this to "on" with
a gate value of 0.001. Unless you have > 1000 lights contributing
fractional light values across your map, this is not going to make any
visible difference.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-03 13:36:52 +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 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 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 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 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 686d4451b8 vis: thread the base portal vis
Make the base portal vis thread safe and run on multiple threads. Use the
common thread progress indicator code.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2012-12-26 11:27:29 +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 e100c9642b common: add prinf format attribute to logprint/logvprint
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2012-12-17 13:02:19 +10:30
Tyrann ce369bfdd6 Use offsetof() consistently
And include stddef.h where we do use it
2012-01-06 21:32:53 +10:30
Tyrann d20e0cc8d4 Mark cmdlib's Error() function noreturn
Reduces compiler warning noise
2012-01-06 21:00:41 +10:30
Tyrann 2c2f3c8eb6 Import initial sources 2006-08-28 23:58:10 +09:30