Move the logic for checking cached edges into R_EmitCached edge to
simplify R_RenderFace (slightly).
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
Basically just skip to the next loop iteration if polygon is back facing
and reduce the indentation of the rest of the loop body.
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
Nicely gets rid of the pointer arithmetic elsewhere in the code.
Also revealed a bug I introduced recently - need to skip the last leaf bit
when ORing the PHS together. Also realised we can skip ORing phs set #1
since it's already all ones!
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
Probably the bigger win comes from skipping over big blocks of zeros 32/64
bits at a time, but it was neat to use the ffsl function in there to take
advantage of hardware instructions to find the next set bit (i.e. bsf on
x86).
Cleaned up the proliforation of "unsigned long" throughout the code and
replaced with the leafblock_t typedef.
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
Only of interest to someone working on the engine... could tune cache size
if use cases show it's worth it.
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
Uses unsigned long instead of byte so we don't need to cast between bytes
and int/long and we can use the long type for the bit tests as well. Had
to rewrite the decompress routine so that the bit order is correct within
the long words.
Things not as neat as I'd like on the QWSV side where the whole PVS/PHS
is decompressed - a bit too much pointer arithmetic to juggle but working
for now.
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
Instead of saving the PVS into a static buffer, save the leaf of the
client entity into the server_t struct and look up the PVS as needed. If
it is done frequently, the PVS cache should stop performance from
becoming too terrible.
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
Constify Mod_PointInLeaf and Mod_{Leaf,Fat}PVS functions. Set a consistent
argument ordering for each, putting the model first. Renamed a couple of
local variables along the way.
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
Re-implement SV_FatPVS as Mod_FatPVS and move to model.c. The buffer for
the FatPVS can then be allocated the appropraite size at map load time.
Also made the bitwise OR of vis data use unsigned long type for
(potentially) better efficiency.
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
No need to keep a separate hunk of memory for the novis data set, may as
well use the cache space. Also fix the memset to be all ones instead of
zeros.
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
At level load time, allocate space for decompressed visdata on the hunk.
Not sure that a cache is really necessary in the main case, but wanted to
add it to take care of other users (pr_cmds, sv_main, sv_ents) later.
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
A few pieces to this one:
- Convert "minmaxs" member in mnode_t and mleaf_t to vec3_t mins/maxs
- Constify BoxOnPlaneSide arguments
- Rip out the old frustum cull tests and replace with BOPS calls
Should be a small speed improvement, but hard to measure on a modern PC.
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
We already had BoxOnPlaneSide needing it in mathlib.h, but now that
clipplane_t also using it, move it from model.h to mathlib.h.
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
Thought I had some weird bug with vis info, leaf data or something but it
was just a lack of visedicts. Wicked.bsp now playable :)
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
Need a more thorough solution for this, but for now bump the lightmap
block and texture cache limits for recent "big" maps.
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
If not enough room in the send buffer, we silently drop messages about
particles and sounds. Get the byte counts right and make a comment about
this being done intentionally and that it's currently broken...
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>