Commit Graph

2237 Commits

Author SHA1 Message Date
Kevin Shanahan f7e76f16b6 light: factor out writing light data from LightFace
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-10 09:37:33 +10:30
Kevin Shanahan eb92d5eac1 light: remove a couple of unneeded function declarations from header
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-09 19:18:36 +10:30
Kevin Shanahan 3749cfa734 light: pass the dface pointer into lightface
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-09 19:14:33 +10:30
Kevin Shanahan 5dce6ccc30 light: factor out init of lightsurf and lightdata
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-09 19:04:44 +10:30
Kevin Shanahan a919ad08bc light: split lightinfo_t into surface information and lightmap data
A lot of churn for a small gain, but now the surface information is
separate from the lightmap data. And we can pass the surface
information around via a const pointer.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-09 17:34:31 +10:30
Kevin Shanahan ea440c6da0 light: factor out WorldToTexCoord as a serparte function
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-09 16:36:57 +10:30
Kevin Shanahan 63393eee8e light: define a plane_t structure and use for lightinfo_t
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-09 15:58:26 +10:30
Kevin Shanahan fda3b230f9 light: lightinfo_t structure cleanup, part 1
The big lightinfo_t structure includes a lot of things that are only
loosely related and not used together. Start the cleanup by pulling
out the texture coordinate tranformation data that is used to generate
the surface sample points.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-09 15:38:52 +10:30
Kevin Shanahan 3ab6d59429 light: remove old experimental sun code
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-08 15:08:48 +10:30
Kevin Shanahan d6ef23453a light: implement self shadowing option for brush models
Brush models can now self shadow without casting shadows on their
environment, using the "_shadowself" entity key.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-08 15:02:36 +10:30
Kevin Shanahan dc39137874 light: make shadow bmodels block sunlight too
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-08 13:47:20 +10:30
Kevin Shanahan feda78b4a3 light: compile fix
Incomplete commit for bmodel shadows change.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-08 13:28:50 +10:30
Kevin Shanahan a6e42ab860 light: implement brush model entity shadows
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-08 11:37:36 +10:30
Kevin Shanahan b7c2fd437f light: replace last CastRay user with TestLine and remove
We never made use of the length argument returned.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-08 09:14:02 +10:30
Kevin Shanahan b6b7aca665 TyrUtils v0.6
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-07 18:33:19 +10:30
Kevin Shanahan 2964d31016 light: fix truncated light values due to integer division
Since minlight is an integer, need to either cast to float or ensure
promotion by writing the 255 constants as 255.0f. Not all of these are
needed, but just be consistent across the code.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-07 18:25:00 +10:30
Kevin Shanahan b4387359a4 light: implement minlighting for bmodels
Collect the appropriate keys from the models at load time and pass them
into the minlighting function (if > world minlight).

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-07 18:22:25 +10:30
Kevin Shanahan e734671b03 light: remove unneeded faceoffset argument from {Single,Sky}LightFace
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-07 16:21:42 +10:30
Kevin Shanahan 44a0bd3660 light: pass minlight/colour values into FixMinlight
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-07 16:13:43 +10:30
Kevin Shanahan 34050c2bd9 light: replace faceoffset with modeloffset
Not much point worrying about the offset of each face when it's only
per-model. This sets us up for using other per-model info...

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-07 15:47:30 +10:30
Kevin Shanahan 33b4ba2040 light: remove the never-used nolightface array
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-07 15:18:36 +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 e94d2b5cdd qbsp: Rework CopyFacesToOutside as CopyBrushFaces
New version returns the list of copied faces. This was the last user of
the inside and outside globals outside of CSGFaces, so they now move onto
the local stack there.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-07 14:01:47 +10:30
Kevin Shanahan 83c0fd541a qbsp: Rename KeepInsideFaces as SaveInside Faces
The list onto which to save the faces is now passed in instead of
implicitly using the global outside list.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-07 13:48:23 +10:30
Kevin Shanahan 3d45b05040 qbsp: readability improvements for CSGFaces
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-07 13:38:37 +10:30
Kevin Shanahan 6f33083868 qbsp: get rid of global 'validfaces' plane->face map
Only used in two places and not a whole lot of calls, so just allocate the
map while it's needed and free it afterwards. There is no relationship
between the two users, so no need to share a common block of memory.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-07 13:13:37 +10:30
Kevin Shanahan b11e671254 qbsp: pass plane-to-face hash into BuildSurfaces
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-07 13:02:58 +10:30
Kevin Shanahan cd043e53f4 qbsp: rework SaveOutside as SaveFacesToPlaneList
We pass in the face list and the plane map to link the faces to. Update
the comments to make it clearer what the function actually does.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-07 12:47:43 +10:30
Kevin Shanahan c6895c28c8 qbsp: Rework ClipInside to take inside/outside lists as arguments
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-07 12:08:39 +10:30
Kevin Shanahan faeb3d6942 qbsp: rework CheckInside function as RemoveOutsideFaces
Pass the inside and outside lists in rather than implicitly manipulating
the global lists.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-07 11:27:53 +10:30
Kevin Shanahan ba6d8e18a8 qbsp: misc naming changes to csg4.c
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-07 10:35:57 +10:30
Kevin Shanahan 406acb62d1 qbsp: fix underwater hint brushes
At load time we defaulted to CONTENTS_EMPTY, but if part or all of the
brush lies underwater, then inherit the water contents type.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-07 07:25:29 +10:30
Kevin Shanahan 7fa24021c8 qbsp: move the hint split check to the correct place
Check that the hint face would actually get split before we discount the
candidate split plane...

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-06 22:44:41 +10:30
Kevin Shanahan 6b25dbd2cc qbsp: add hint brush support
Similar to the skip texture handling, add miptex flags, handle
appropriately in CSGFaces and SolidBSP, then remove the surfaces before
writing out the bsp.

Lightly tested, but seems to do all the right things.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-06 16:58:14 +10:30
Kevin Shanahan 151370b06a qbsp: Split FreeInside into FreeFaces and KeepInsideFaces
FreeInside was a strange name, since depending on the arguments we
actually wanted to keep the faces.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-06 16:25:12 +10:30
Kevin Shanahan b7d4127583 qbsp: delay creation of .pts and .por files until needed
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-06 14:47:06 +10:30
Kevin Shanahan 1e4d4225d6 qbsp: pull the .por and .pts file pointers into leakstate
That should be the last of the outside.c globals.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-06 14:14:42 +10:30
Kevin Shanahan 18cc6cc809 qbsp: get rid of globals v1 and v2 in outside.c
Used for working with leak lines - just pass them on the stack instead.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-06 13:43:47 +10:30
Kevin Shanahan 47f55c8186 qbsp: misc trivial stylistic changes to outside.c
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-06 13:30:07 +10:30
Kevin Shanahan a7e0ad3889 qbsp: trivial cleanups to WriteLeakNode
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-06 13:11:46 +10:30
Kevin Shanahan 2eb9c36e28 qbsp: use pointer to entity instead of index in leakstate
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-06 13:06:51 +10:30
Kevin Shanahan fb8852dddf qbsp: consolidate leak state into single struct
Now consolidate the leak state into a single leakstate_t struct. Rename
the leaks/numleaks/maxleaks members as portals/numportals/maxportals for
improved clarity. What was numportals previously is now numwritten.

Outleafs is now returned from the FillOutside_r function instead of
passing in a struct or int to be incremented by the function.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-06 12:51:36 +10:30
Kevin Shanahan 6b50c2e5ac qbsp: Separate finding leaks from outside filling
Finding leaks carries a lot more state which is not needed for the final
outside fill stage, so let's separate the two. Get rid of fillparms_t
since the only thing left was the fillmark.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-06 12:31:20 +10:30
Kevin Shanahan 0aa5cf42d0 qbsp: move backdraw counter into the bspleak struct
Only related to the leak files, not filling.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-06 11:56:44 +10:30
Kevin Shanahan 6cc26fe878 qbsp: numportals parm is more accurately maxleaks
It seems clearer now that the numportals parameter is actually used to
check that the number of leak portals we accumulate doesn't exceed the
allocated memory. Update the structs to reflect that.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-06 11:51:00 +10:30
Kevin Shanahan 7dbee11b78 qbsp: move leaknode into the bspleak struct
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-06 11:40:26 +10:30
Kevin Shanahan 2bc8a01a31 qbsp: free the leaks array after writing leak file
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-06 11:32:04 +10:30
Kevin Shanahan bd827266a8 qbsp: move pLeaks and numleaks into the bspleak struct
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-06 11:31:22 +10:30
Kevin Shanahan 54de345635 qbsp: encapsulate bspleak state in separate struct
Move the 'firstone' global into the bspleak state as a flag to indicate
whether the header has been written yet, since that's why the flag exists.
Move numportals and hit_occupied (renamed to "entity") in there as well to
keep leak related data all together.

MarkLeakTrail now directly increments bspleak->numportals so doesn't need
to return a value indicating what was written.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-06 10:58:25 +10:30
Kevin Shanahan 9f2691e3b6 qbsp: fix name of .por file in output
Was showing up as blah.prt.por because we had messed with the filename to
remove the prt file previously.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-06 10:22:31 +10:30