Commit graph

1383 commits

Author SHA1 Message Date
Bill Currie
5bbb76194f Use stdlib.h instead of alloca.h.
While the manpage does say alloca.h, that's not very portable, it seems.
stdlib.h seems to be better (at least for mingw, anyway)
2013-01-10 21:54:37 +09:00
Bill Currie
751417ffb2 Rename R_RecursiveWorldNode to R_VisitWorldNodes.
Finally, the name reflects its actual purpose.
2013-01-07 19:59:49 +09:00
Bill Currie
a852eeb711 Remove the recursive versions of R_RecursiveWorldNode.
They seem to not be needed any more.
2013-01-07 19:57:21 +09:00
Bill Currie
9758302023 Fix sw and sw32's R_RecursiveWorldNode node stack.
I guess I had forgotten to make the node stack dynamically allocated for
these renderers. Now ITS works in all four renderers.
2013-01-07 19:51:36 +09:00
Bill Currie
43702580f5 Clear the texture element chain after drawing.
It was properly cleared after drawing water chains and sky chains, but I
had missed normal surfaces. It took the use of the same texture for both
normal surfaces and water surfaces to trigger the bug. Thanks go to Simon
'Sock' O'Callaghan and his In The Shadows mod.
2013-01-06 20:05:59 +09:00
Bill Currie
7206756952 Produce a vidmode list for developer output.
vidmode is starting to show its age. Modern X doesn't need a config file,
and when one is not available, the list of available resolutions is quite
strange. Time to look into randr support.
2013-01-01 15:13:27 +09:00
Bill Currie
6eb6b6c0ba Change pointer_t to unsigned and clean up the mess.
It doesn't make sense to have negative pointers. The size of the commit is
from enabling gcc's -Wtype-limits warning and cleaning up that mess too.
2012-12-21 21:53:13 +09:00
Bill Currie
cb259823af Scale the glsl crosshairs to match gl. 2012-12-12 21:37:55 +09:00
Bill Currie
f71affdfba Use exact texture coords for 2d pics in glsl.
Moving the texture coordinates in 1/4 pixel made a mess of the 2d pics
(very noticable on the round crosshair).
2012-12-12 21:34:37 +09:00
Bill Currie
a372efee5c Add a new crosshair.
Now all 4 slots of the crosshair table are used :)

Also, fix the offset for pic based crosshairs in glsl, and use just one
func for them.
2012-12-12 19:36:50 +09:00
Bill Currie
a12eb940f1 Remove the hard-coded bsp maximum depths.
The depth limits in the gl and glsl renderers and in the trace code really
bothered me, but then the fix hit me: at load-time, recurse the trees
normally and record the depth in the appropriate place. The node stacks can
then be allocated as necessary (I chose to add a paranoia buffer of 2, but
I expect the maximum depth will rarely be used).
2012-11-28 21:29:03 +09:00
Bill Currie
ec42bde527 Make hash tables more const correct.
And clean up the resulting mess :/
2012-10-27 11:44:31 +09:00
Ozkan Sezer
6e04fd5ff6 signed int viddef_t members
The attached patch (against quakeforge git) changes the [con]width,
[con]height, and most importantly the rowbytes members of viddef_t
from unsigned to signed int, like in q2.  This allows for a properly
negative vid.rowbytes which may be needed in, e.g. a DIB sections
windows driver if needed.  Along with it, I changed a few places
where unsigned int is used along with comparisons against the relevant
vid.* members.
One thing I am not 100% sure is the signedness requirements of
d_zrowbytes and d_zwidth: q2 has them as unsigned but I am not sure
whether that is because they are needed as unsigned or it was just an
oversight of the id developers. They do look like they should be OK
as signed int to me, though: comments?

==
Note from Bill Currie: I had to do some extra changes as many
signed/unsigned comparisons were somehow missed.
2012-10-21 09:00:50 +09:00
Bill Currie
709da6e7d7 Rotate the skybox -90 degrees on the z axis (gl)
Now gl and glsl match again, and quake's skies are now "correct" (assuming
fitzquake is the standard).
2012-09-13 08:36:28 +09:00
Bill Currie
14f089d08e Correct the orientation of the skybox (for glsl).
It turns out the expected orientation of the sky cube is exactly that of
Blender's default cube looked at from the front view (num-1) and the front
face being the nearest face. This put's Marcher's sun nicely in the view
when exiting the cave.
2012-09-12 19:06:07 +09:00
Bill Currie
536ee48a97 Some minor skybox improvements suggested by mh.
Rearrange the sky_suffix and sky_coords arrays and remove the sky_target
array such that the faces can be loaded using
GL_TEXTURE_CUBE_MAP_POSITIVE_X + i (apparently certain drivers break if
the faces aren't loaded in the correct order).

Also, the nomalization of the direction vector in the fragment isn't
necessary.
2012-09-12 15:20:35 +09:00
Bill Currie
433d9d138b Hook up the pointfile loader in glsl.
I was always wondering what that was for (never bothered looking at the
command registration, I guess :P).
2012-09-12 09:54:24 +09:00
Bill Currie
a37c5465e1 First step for BSP2 support. DOES NOT WORK!
All of the nastiness is hidden in bspfile.c (including the old bsp29
specific data types). However, the conversions between bsp29 and bsp2 are
implemented but not yet hooked up properly. This commit just gets the data
structures in place and the obvious changes necessary to the rest of the
engine to get it to compile, plus a few obvious "make it work" changes.
2012-09-07 16:09:24 +09:00
Bill Currie
d6a1daaf30 Force a refdef update when nearclip or farclip change. 2012-08-29 09:55:17 +09:00
Bill Currie
78f7604efc Evil hack to handle duplicated sdl key syms. 2012-08-18 21:44:51 +09:00
Bill Currie
9250eb83bf Yet more char index issues.
Should be getting near the end of these as qfcc tries to link in my hacked
up tree :)
2012-08-18 21:42:49 +09:00
Bill Currie
5b054dd98b Add "slow grav" for smoke.
Removes one more set of hard codings from particle types.
2012-08-12 11:42:18 +09:00
Bill Currie
5a5b31bae4 Correct the direction of pt_fire particles.
sub_grav() was accelerating the particle in the wrong direction. Down being
+ve gravity caused a bit of confusion (though it was a c&p error).
2012-08-10 13:56:01 +09:00
Bill Currie
372defc1be Support up to 128 dlights.
More or less as per MH's tut, but really just finishing something that
should have been done years ago.
2012-07-21 13:58:54 +09:00
Bill Currie
7d8b0f96d6 Correct the fog distance calculations.
It turns out the pixel's z coord is correctly obtailed by
gl_FragCoord.z/gl_FragCoord.w.
2012-07-17 19:10:10 +09:00
Bill Currie
c4309e7abc Correct the fog blend calculation for transparency.
The incoming pixel's alpha should not be affected by fog. This fixes the
ugly square smoke particles in foggy maps.
2012-07-17 19:08:36 +09:00
Bill Currie
a7327acb80 Set up shadevector for gl alias models.
The setup had been lost at some stage, thus shadows were always directly
under the entity. Unlike the original quake shadow code, the vector is
correctly transformed into the entity's space.
2012-07-17 17:10:48 +09:00
Bill Currie
fbc0ad59df Implement gl shadows for pure triangle alias models.
I finally found the cause of Despair's gl shadows non-rendering+segfault...
the shadow code expected triangle fans and strips but was getting simple
triangles. Oops.
2012-07-17 16:11:42 +09:00
Sander van Dijk
3c04de1116 Better default vid_gamma value. 2012-07-17 06:30:01 +09:00
Bill Currie
134f9b0e9e Force pr_keys.c to get linked in.
Nothing in the main program currently uses Key_Progs_Init, so the object
file wasn't getting pulled into the link. However, it's quite necessary for
the client console plugin :/
2012-07-16 18:18:13 +09:00
Bill Currie
8333e6578c Fix non-static sw renderer for 32bit x86.
Yet another undefined symbol caused by iqm support. This time caused by
asm/not asm.
2012-07-15 22:34:00 +09:00
Bill Currie
0f34ab8762 Move pr_keys.c from console to video/targets.
It wasn't very accessible/usable in the client console plugin.
2012-07-15 07:39:50 +09:00
Bill Currie
f9c6eacb84 Really fix sw32 renderer loading.
It seems I never tested the sw32 renderer in a non-static build since I put
in IQM support.
2012-07-15 07:30:17 +09:00
Bill Currie
fd6b5edb73 Don't set triangle draw type in sw32 iqm renderer.
It's not used and causes link errors (I never noticed on my system).
2012-07-14 19:48:57 +09:00
Bill Currie
fcf7150c62 Remove some old renderer specific files. 2012-07-14 07:32:53 +09:00
Bill Currie
6fe32103ea Do a bit of bound() usage auditing.
While these seem to be mostly harmless, having function calls in the
bounded value can be nasty.
2012-07-12 19:33:51 +09:00
Bill Currie
a822a683cd Fix the inverted lighting for sw32.
LordHavoc had made lighting positive for sw32, but I had done something in
the plugin code that broke that (probably something to do with the
colormap loading). Going back to id's original code fixes the issue.
2012-07-12 18:15:45 +09:00
Bill Currie
12319cfcdf Revert "Slightly reducde the number of calls to glUniformMatrix4fv."
This reverts commit e170f4ee75.

It turns out I messed up something in the patch. I noticed the problem
while playing digs04.bsp: many sub-model surfaces, particularly those with
animated textures, were not being transformed correctly. As this patch did
not make a large performance difference, it's probably better to just
revert it. I might revisit it later.
2012-07-11 08:12:57 +09:00
Bill Currie
ede65fb28c Use the correct source for the backtile width/height.
Yay, no more garbage on the screen :)
2012-07-09 15:56:51 +09:00
Bill Currie
5014825b39 Fix the backtile for glsl.
Since the backtile is loaded into a scrap and used as a subtexture, we
can't use GL's texture wrapping, thus do the wrapping ourselves. There are
some minor issues with the wrong part of the scrap being drawn: need to
investigate where the bug is (vrect, make_quad, etc).
2012-07-09 15:11:03 +09:00
Bill Currie
37260018a2 Acutally use the vertex colors for alias models.
Thanks to Spirit trying QF on nvidia drivers, the missing attributes were
found. Now he shouldn't get gl errors :)
2012-07-08 16:52:13 +09:00
Bill Currie
a6d9f5d931 Fix a parallel make issue. 2012-07-06 12:35:50 +09:00
Bill Currie
dbbd6f4535 Fix a couple of missing particle function pointers.
Discovered while getting the location markers working again.
2012-07-06 10:18:05 +09:00
Bill Currie
ef9e8d05c4 Avoid some unnecessary state changes.
Doesn't make much difference but it doesn't hurt.
2012-07-03 18:20:32 +09:00
Bill Currie
ee1cb24e3d Move the call to R_SetFrustum to gl_R_SetupFrame.
This was meant to be part of the previous commit, but I forgot to write the
file :P
2012-07-03 16:08:12 +09:00
Bill Currie
a8e0bcabf9 Call R_SetFrustum in all renderers.
It turns out glsl, sw and sw32 weren't getting any benefit from R_CullBox
because the frustum wasn't setup :P. Get another 8% out of bigass1
(174->184fps). bigass1 now runs 2x as fast as it did before I started this
optimisation run :)
2012-07-03 15:57:33 +09:00
Bill Currie
e58cd75660 Bound r_maxdlights properly.
QF's implementation doesn't support more than 32 dlights (32 bit int).
2012-07-03 15:27:48 +09:00
Bill Currie
eefefb79b0 Rename char_queue to draw_queue. 2012-07-03 14:45:16 +09:00
Bill Currie
b25de4d995 Rewrite the 2d code to use a scrap.
This severely reduces the calles to BindTexture, and more importantly,
glUseProgram, EnableVertexAttribArray etc. The biggest changes are:

 o  icons and text are all in the one giant texture
 o  icons and text are mixed in the one queue

This gave ~9% speedup for bigass1 (159->174fps).
2012-07-03 13:38:35 +09:00
Bill Currie
df35b22af4 Parameterize the linear filtering of scrap textures. 2012-07-03 12:10:24 +09:00