619 Commits

Author SHA1 Message Date
Kevin Shanahan
2ad1bcabba progs: mark PF_break noreturn and call abort
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-01-16 17:55:23 +10:30
Kevin Shanahan
83be6de16d server: quick and dirty implementation of FitzQuake protocol
Not very well tested, but the loopback client works. Still missing entity
alpha, lerpfinish and a few other things.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-01-15 20:21:05 +10:30
Kevin Shanahan
ef14eecafe client: send 16-bit angles when server is fitzquake
This should now be all that is needed on the client side for FitzQuake
protocol (666) support.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-01-14 20:57:20 +10:30
Kevin Shanahan
1c842c0bac draw: trivial re-arrangement of long line
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-01-14 19:41:26 +10:30
Kevin Shanahan
7e9395bc49 render: add reminder to look at intersecting bmodels
Currently not supported by the software renderer. Intersecting bmodel
surfaces will behave weirdly (and people tend to assume it does work,
because glquake handle's it just fine).

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-01-14 19:41:26 +10:30
Kevin Shanahan
d951fa51c0 render: exit early if spanstate indicates no work to do
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-01-14 19:41:26 +10:30
Kevin Shanahan
03796f9042 render: more loop re-arrangement in R_LeadingEdge
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-01-14 19:41:26 +10:30
Kevin Shanahan
c117cbbb7f render: reduce indentation levels in R_LeadinEdge
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-01-14 19:41:26 +10:30
Kevin Shanahan
a5c2377abf render: use precalculated clipflags in R_DrawSubmodelPolygons
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-01-14 19:41:26 +10:30
Kevin Shanahan
f0f0c06cb0 draw: comment out some over-verbose debug info (for now)
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-01-14 18:48:31 +10:30
Kevin Shanahan
02602d562d render: check clipflags before BOPS test in R_CullSubmodelSurfaces
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-01-14 18:45:18 +10:30
Ozkan Sezer
b83f54b94c sound: fix off-by-one error in SND_InitScaletable
This really seems like a thinko to me.  Patch below.

snd_mix.c (SND_InitScaletable): fixed an off-by-one mistake in the
signed char conversion.

Signed-off-by: Ozkan Sezer <sezero@users.sourceforge.net>
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-01-14 18:38:31 +10:30
Kevin Shanahan
a011101a1b trivial: small cleanup in R_AddEfrags
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-01-08 16:06:46 +10:30
Kevin Shanahan
b16099cfc3 render: cull submodel polygons to the view frustum using bbox info
Pre-calculate the frustum clip flags and cull backward facing bmodel
faces. This takes advantage of the surface bbox info and gives a small
speedup on maps having large/complex submodels.

Restructured the main loop in R_DrawBEntitiesOnList so that there are a
few less levels of code indentation there.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-01-08 16:02:56 +10:30
Kevin Shanahan
9a9dbb5141 model: check surf->numedges at loadtime
...so we don't need to check while drawing.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-01-08 10:29:14 +10:30
Kevin Shanahan
1334ef1125 view: draw the view weapon model if fov > 90
Yes, it looks like crap but not really any worse than it looks in glquake.
Will do something to fix it at some stage...

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-01-08 10:04:15 +10:30
Kevin Shanahan
e047b8acd4 draw: rip out polygon based drawing code
Not used by the edge/span driver at all. If I ever discover I want it back
again... well it's in the commit history.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-01-08 08:38:11 +10:30
Kevin Shanahan
4ea17ced27 render: use a separate pass over the BSP tree for frustum culling
Pre-calculate frustum clip flags for each node/surface in the PVS by using
a separate walk of the tree before drawing. Doesn't seem to be any
measureable performance benefit, but it was nice to separate this step
from the drawing.

The BSP walk doesn't need to be ordered, so could be done iteratively with
no node stack.

I'm hoping I can apply this to submodels too without too much performance
impact for small models and with some benefit for large, complex models...

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-01-08 07:41:19 +10:30
Kevin Shanahan
afdbc25f00 draw: let R_EmitCachedEdge check the cache for the caller
Move the logic for checking cached edges into R_EmitCached edge to
simplify R_RenderFace (slightly).

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-01-08 07:36:43 +10:30
Kevin Shanahan
c243cbdf3f draw: tidy up some pointer arithmetic
Hopefully the compiler should optimise this just as well...

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-01-08 07:03:56 +10:30
Kevin Shanahan
c801b83eab win: Try to work around unstable timers on buggy multicore setups
Apparently there are still some problems with the performance counters on
some Windows systems due to BIOS or driver bugs.

 - http://www.quaddicted.com/forum/viewtopic.php?pid=405#p405
 - http://forums.inside3d.com/viewtopic.php?p=48051#p48051
 - http://forums.inside3d.com/viewtopic.php?p=36239

Found the MS recommendations for this, which says to set CPU affinity...
not so keen on that for now, so let's implement the workaround written up
by MH (thanks!)

Thanks Spirit (http://www.quaddicted.com/) for pointing out this problem.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-01-07 15:40:49 +10:30
Kevin Shanahan
929d6a47ec render: only re-mark surfaces when the pvs changes
Renamed R_MarkLeaves to R_MarkSurfaces (although it still marks the
leaves and nodes).

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-01-06 16:18:38 +10:30
Kevin Shanahan
70ed664c7d render: trivial cleanup in R_RecursiveClipBPoly
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-01-06 12:21:58 +10:30
Kevin Shanahan
6f0e13ebce render: cleanup in R_DrawSolidClippedSubModelPolygons
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>
2013-01-06 12:13:20 +10:30
Kevin Shanahan
6ab27d2636 build: fix build warning on OpenBSD in rb_tree.h
OpenBSD leaks it's RB_ROOT definition from <net/if.h>, so let's rename
ours to QRB_ROOT.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-01-06 10:46:57 +10:30
Kevin Shanahan
989860f7fe world: remove unused function SV_TestPlayerPosition
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-01-05 16:12:33 +10:30
Kevin Shanahan
83eb2378be world: make private functions static
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-01-05 16:12:04 +10:30
Kevin Shanahan
0fc770a2ec model: split out function to OR together leafbits
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-01-05 15:52:11 +10:30
Kevin Shanahan
7785dd4584 model: create a function to efficiently count leafbits
Instead of using the foreach macro.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-01-05 15:35:17 +10:30
Kevin Shanahan
389bb4acac model: add foreach_leafbit macro to iterate over one bits
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>
2013-01-05 12:35:21 +10:30
Kevin Shanahan
62ff8ea5b3 model: allocate the pvs cache after model loading completed
Just to tidy up the "hunk print" output.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-01-04 21:54:52 +10:30
Kevin Shanahan
510714db69 model: pass the hunk alloc name for GL_SubdivideSurface
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-01-04 21:54:04 +10:30
Kevin Shanahan
9ca1f1a972 model: add console command to check pvs cache hit/miss stats
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>
2013-01-04 19:00:08 +10:30
Kevin Shanahan
b5e1863636 model: define a leafbits type for use with PVS/PHS operations
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>
2013-01-04 18:36:50 +10:30
Kevin Shanahan
9934d75534 gl: get the r_novis pvs from the pvs cache
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-01-03 18:46:41 +10:30
Kevin Shanahan
30b140c7bd model: fix thinko in pvs cache search
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-01-03 18:27:24 +10:30
Kevin Shanahan
22f7a1821b server: remove static checkpvs buffer from PF_CheckClient
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>
2013-01-03 18:15:03 +10:30
Kevin Shanahan
30303ec00f model: trivial API consistency fixes
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>
2013-01-03 17:53:02 +10:30
Kevin Shanahan
3c40fcf6d4 model: move SV_FatPVS functionality to model.c
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>
2013-01-03 17:37:09 +10:30
Kevin Shanahan
9d2943d407 model: use the pvscache space for the novis pvs set
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>
2013-01-03 09:30:27 +10:30
Kevin Shanahan
c2b6405cad trivial: rename local variable in R_EmitCachedEdge
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-01-03 09:18:22 +10:30
Kevin Shanahan
c41be7010a progs: remove debugging printf from PR_SetString
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-01-03 09:17:17 +10:30
Kevin Shanahan
d0f1439cee model: allocate space for decompressed leaf vis on the hunk
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>
2013-01-02 19:07:28 +10:30
Kevin Shanahan
8bec64e9cf render: get rid of now unused frustum_indexes
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-01-02 15:19:29 +10:30
Kevin Shanahan
4dffa95aff render: use BoxOnPlaneSide for view frustum clip tests
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>
2013-01-02 15:09:36 +10:30
Kevin Shanahan
851608c290 render: set the signbits when setting up the frustum planes
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-01-02 14:04:07 +10:30
Kevin Shanahan
08e004721c mathlib: pull SignbitsForPlane into mathlib
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-01-02 13:55:07 +10:30
Kevin Shanahan
5a6da3adf0 mathlib: create PSIDE_* define for BoxOnPlaneSide return values
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-01-02 13:34:33 +10:30
Kevin Shanahan
82f178f89a draw: move the SIDE_* defines to drawhulls.c
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-01-02 12:33:02 +10:30
Kevin Shanahan
05b31ebd75 draw: use an mplane_t for the frustum clipping planes
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-01-02 11:07:38 +10:30