Commit Graph

3171 Commits

Author SHA1 Message Date
Bill Currie f3884c659c Finish alias skin loading and load vertex data into GL. 2012-01-01 23:55:27 +09:00
Bill Currie f18cd65526 Implement the "cache" in Draw_CachePic. 2011-12-31 20:36:24 +09:00
Bill Currie 3eae8426e6 Implement in-game screenshots. 2011-12-31 17:24:20 +09:00
Bill Currie d8dbfa9c24 Create WritePNGqfs so screenshots can be written as png. 2011-12-31 17:23:32 +09:00
Bill Currie 718595db45 Implement sprite rendering.
Sprite interpolation seems to work, even :) (maybe)
2011-12-31 14:39:33 +09:00
Bill Currie 091e16f9d2 Bring in GL's R_RecursiveWorldNode as R_VisiteWorldNodes.
No surface queuing is done, but entities get queued.
2011-12-31 14:33:20 +09:00
Bill Currie ea2ae1436c Fix some bugs in the new matrix functions/macros. 2011-12-31 13:20:31 +09:00
Bill Currie 55e53b796d Make a start on getting sprites rendering.
The plan is to do interpolated sprites based on a discussion I had with
LordHavoc about them: blending between the two sprite frames. He didn't
mention it, but it looks like blending between the sprite frames' verts is
necessary too.
2011-12-30 21:11:59 +09:00
Bill Currie 16f84cd496 Hopefully get the 3d view and projection transforms setup. 2011-12-30 21:10:24 +09:00
Bill Currie 20d93466c7 Frag some magic numbers.
More annoying than hipnotic's gremlins.
2011-12-30 21:07:35 +09:00
Bill Currie 35bf957d08 Add a 4x4 matrix type and some functions for it. 2011-12-30 20:11:53 +09:00
Bill Currie edb05fdfce Rename Vector3Scale and QuatCompScale.
They are now VectorCompMult and QuatCompMult.
2011-12-30 20:04:55 +09:00
Bill Currie bcdcd7b36d Implement sprint glsl loading.
That was... easy.
2011-12-30 09:36:57 +09:00
Bill Currie a87a60a6fd Flush the text buffer before drawing conback or menus.
Ok, now really done until I notice something else (I forgot this one
momentarily).
2011-12-29 18:23:09 +09:00
Bill Currie 047b7bcc32 Implement Draw_TileClear.
With this, 2d seems to be finished. YAY.
2011-12-29 18:15:15 +09:00
Bill Currie a1035aafe9 Implement Draw_TextBox. 2011-12-29 17:51:31 +09:00
Bill Currie 2b44a25c6b Flush console text after each screen function.
This on its own doesn't fix menus being overwritten with console text, but
it's an important step.
2011-12-29 11:26:14 +09:00
Bill Currie 9fec4d5be0 Implement Draw_Fill.
Almost there with 2d.
2011-12-29 11:25:27 +09:00
Bill Currie 9d0ed6b885 Fix the missing text.
Silly case and paste error cleared out my text vertex array prematurely.
2011-12-29 08:47:32 +09:00
Bill Currie bece72e746 Use a quick hack to get colored crosshairs working. 2011-12-28 21:45:20 +09:00
Bill Currie e69a583f1b Work around a bug in mesa.
Since I'm not specifying the api when creating my context, mesa is giving
me GL2. This is fair enough, but in GL2, vertex attribute 0 is the vertex
position. This too, is fair enough. The problem is, mesa is assigning 0 to
my vcolor attribute and thus I can't set it. The work around is simply to
swap the declaration order of vcolor and vertex (this really shouldn't work
eiter, I suspect).
2011-12-28 20:43:56 +09:00
Bill Currie 6a44978a0f Fix reading of GL_CURRENT_VERTEX_ATTRIB.
Turns out it returns a vec4. oops.
2011-12-28 20:41:26 +09:00
Bill Currie 4e7af5c3e0 Add a function to dump the info for all attribute arrays. 2011-12-28 14:27:59 +09:00
Bill Currie 411ab8f359 Be noisy when resolving uniforms and attributes. 2011-12-28 12:58:26 +09:00
Bill Currie be9530afb6 Dump a lot of info about shader programs.
New developer bit: SYS_GLSL (2048).
2011-12-28 12:40:28 +09:00
Bill Currie b657905c83 Bring in Despair's gl error checking from the gl renderer. 2011-12-28 09:05:36 +09:00
Bill Currie 151cc05882 Add support for vertex colors.
As I need to control the alpha, they're sent as rgba rather than quake
palette indices. Text works well. All other 2d stuff does not :(.
2011-12-28 09:04:26 +09:00
Bill Currie b943b6d6e8 Implement crosshairs, mostly.
Colored crosshairs aren't supported yet (next).
2011-12-27 17:59:58 +09:00
Bill Currie db8573b774 Make the cross-hair data sharable between renderers. 2011-12-26 21:43:15 +09:00
Bill Currie 705d07fa39 Implement most of the 2d rendering functions.
textbox, crosshair, tileclear, fill and fadescreen are the remaining
functions.

There's a problem with 2d icons being drawn over the text (instead of
under), but I'll leave that for later.
2011-12-26 20:33:40 +09:00
Bill Currie e2a8de33cc First real texture support function for glsl. 2011-12-26 18:34:51 +09:00
Bill Currie 42034acc03 Organize the text program data.
Also, rename the charmap uniform in quake2d.frag as it's more generic than
that.
2011-12-26 18:00:55 +09:00
Bill Currie 2ccfbb0c1c Move the shader program code into vid_common_glsl.
Much more useful in the long run.
2011-12-26 17:17:29 +09:00
Bill Currie 5bed38dcd9 Rename quaketxt.frag to quake2d.frag.
It's actually fairly generic for 2d rendering (no lighting, palette lookup)
2011-12-26 17:11:31 +09:00
Bill Currie f78db6c570 Clean up the generated shader files. 2011-12-26 16:39:02 +09:00
Bill Currie d743c6c55f Make a clean break heading for GLES compatibility.
Add GLSL directory to QF and use it for all gsls based code (instead of
GL). defines.h, types.h and funcs.h are derived from gl2.h from khronos.

Text drawing now uses triangles instead of quads.
2011-12-26 16:08:55 +09:00
Bill Currie e6c6de3a2a Fix the palette uploading.
Ooooops :P
2011-12-26 10:41:16 +09:00
Bill Currie 7bd5ab882c Get text rendering working.
It comes out as a funky green (that's not in the quake palette!!!), but
it's mostly readable.
2011-12-26 10:16:16 +09:00
Bill Currie 9f5eacd1fb Try to get text rendering.
Still a black screen :(
2011-12-26 08:12:05 +09:00
Bill Currie c161a91d4a Split out and partially implement the screen code. 2011-12-26 08:09:47 +09:00
Bill Currie 1268830082 Split out the particle code. 2011-12-26 08:02:18 +09:00
Bill Currie 7d653f3676 Start work on outputting text.
The shaders now compile. No linking is done yet. Char quads are generated,
but not sent to the card.
2011-12-25 19:42:39 +09:00
Bill Currie 91afdcf064 Don't call init_box when not doing a box trace.
I took the opportunity to pass qf through callgrind. init_box was
surprisingly expensive, especially considering its results were never used.
2011-12-25 17:11:48 +09:00
Bill Currie 55a0ed49cd Build qw-client-glslx too.
I was asked about timedemo overkill (bigass1 currently gets 40kfps, haha),
so I had to add qw-client-glslx to the build.
2011-12-25 16:41:14 +09:00
Bill Currie 9df7370bcd Create some shaders for quake text.
Still nothing drawn, but this gets my shader scripts into C without me
having to look at ugly strings.
2011-12-25 15:53:12 +09:00
Bill Currie b7c90fa02d Load the quake palete as a texture.
256x1 rgba.
2011-12-25 13:53:52 +09:00
Bill Currie 99c490ce52 Get glsl running as a null renderer.
This means that nq-glslx can get through demo1, demo2, demo3 and bigass1
without crashing. However, nothing is rendered, so unless you like black,
it's not very interesting.
2011-12-25 13:02:26 +09:00
Bill Currie 2894689f71 Clean up mod_lightmap_bytes.
Just how many definitions do we need?
2011-12-25 13:02:26 +09:00
Bill Currie dcf2b14188 Implement alias model skin loading for glsl. 2011-12-25 13:02:26 +09:00
Bill Currie e62eb23f67 And do the real merge.
That drastically simplifies the processes of alias model loading for glsl :)
2011-12-25 11:04:03 +09:00
Bill Currie c0d37ddc1e Pseudo merge gl and sw Mod_LoadAliasGroup.
Interestingly, this didn't break gl alias model renderering (but then, it
does weird things to the data anyway).
2011-12-25 10:53:53 +09:00
Bill Currie 1f8db5fe3a Pseudo merge gl and sw Mod_LoadAliasFrame. 2011-12-25 10:34:29 +09:00
Bill Currie cc5140e3a1 Move min/max/bound and field_offset into better locations.
min/max bound into mathlib.h (they /are/ math functions, after all) and
field_offset into qtypes.h.
2011-12-24 10:04:33 +09:00
Bill Currie 59ef1eae9d Split out the floodfile code into its own file. 2011-12-23 19:01:31 +09:00
Bill Currie 6fe9557dae Put in the final pieces so nq-glslx can link.
Everything is still stubs. Trying to run nq-glslx results in a segfault :)
2011-12-23 12:52:55 +09:00
Bill Currie 53d89bf85a Clean up the mess around D_FlushCaches.
Create an R_ClearState and call that from the clients. It calls any
necessary functions itself.
2011-12-23 12:51:47 +09:00
Bill Currie 33c5320c0e Create stubs for most of the required render functions.
nq-glslx almost links. Just some suspicious references in host.c I want to
check before doing anything more.
2011-12-23 12:19:50 +09:00
Bill Currie 497461b4c2 Make a start on making a pure GLSL renderer.
For now, only nq-glslx will be built, but as there is no actual code, it
doesn't link. However, this gets the glsl stuff into the build system.
2011-12-23 12:19:13 +09:00
Bill Currie 858d95de58 Add a bunch more keys to the X11 clients.
Now, QF does something reasonable for every key on my keyboar for which X
gives us a keycode.
2011-12-19 16:37:48 +09:00
Bill Currie 87390f53b0 Z_Realloc() should zero-fill the expandded part of the mem
Patch from Ozkan Sezer (sezero). Thank you.
2011-12-19 09:45:46 +09:00
Bill Currie 52d9269867 Merge brush model with world model rendering.
With this, non-mtex global fog now works properly :).
2011-12-18 08:09:55 +09:00
Bill Currie a8e354536a Implement the instance surface allocation/freeing.
Not actually used yet, so it's harmless at this stage.
2011-12-17 19:42:19 +09:00
Bill Currie 87b78e5533 Move the surface chain links out of the surfaces.
The links are now in "instance surfaces". For non-instanced models (world,
doors, plats etc (ie, world and its sub-models)), there will be one
instance surface per model surface. However, for instanced models (ammo
boxes etc), there will be many, dynamically allocated (not yet
implemented). This commit gets the static instance surfaces working.
2011-12-17 19:14:14 +09:00
Bill Currie 9f0bdf7794 Add some comments. 2011-12-17 09:39:57 +09:00
Bill Currie 933120d44f Fake vertex arrays for text and particles.
Getting gl_vaelements_max -1 to work produced a rather nasty surprise :P
2011-12-16 20:09:05 +09:00
Bill Currie 5cd1f6f5cf Fix a GL version check snafu.
Thanks to MH (on inside3d.com) for pointing this out to me.
2011-12-16 09:43:22 +09:00
Bill Currie e67690a1a9 Restore the missing lightmaps in non-mtex mode.
I forgot to blend in the lightmaps in the fogless non-mtex path.
2011-12-16 09:21:39 +09:00
Bill Currie b2aa5ce554 Register the textures of other brush models; 2011-12-15 17:09:02 +09:00
Bill Currie 962451e2fe Create a list of texture chains.
This moves the texture chains out of the world model and into a separate
list, allowing other brush models to registter their textures.
2011-12-15 17:09:02 +09:00
Bill Currie d6a668d517 Split out chain_surface() from visit_node(). 2011-12-15 17:09:02 +09:00
Bill Currie 3eb859a88f Move the entity transform setup into the clients.
This has several benifits:
  o The silly issue with alias model pitches being backwards is kept out
    of the renderer (it's a quakec thing: entites do their pitch
    backwards, but originally, only alias models were rotated. Hipnotic
    did brush entity rotations in the correct direction).
  o Angle to frame vector conversions are done only when the entity's
    angles vector changes, rather than every frame. This avoids a lot of
    unnecessary trig function calls.
  o Once transformed, an entity's frame vectors are always available.
    However, the vectors are left handed rather than right handed (ie,
    forward/left/up instead of forward/right/up): just a matter of
    watching the sign. This avoids even more trig calls (flag models in
    qw).
  o This paves the way for merging brush entity surface rendering with the
    world model surface rendering (the actual goal of this patch).
  o This also paves the way for using quaternions to represent entity
    orientation, as that would be a protocol change.
2011-12-15 17:09:01 +09:00
Bill Currie f6ebb78140 More GL_Init_Common() cleanup.
Move the call to GL_Common_Init_Cvars() out of the block of check calls.
2011-12-15 17:09:01 +09:00
Bill Currie 51aaee5c3b Put that OpenGL error message to rest.
The error was quite valid: setting GL_TEXTURE_MAX_ANISOTROPY_EXT to 0 is
incorrect. The problem was caused by the call to glTexParameterf being
before the gl_anisotropy cvar was initialized. Thus, move all of the setup
code in GL_Init_Common() to after all the checks and, more importantly,
after the call to GL_Common_Init_Cvars().
2011-12-15 17:09:01 +09:00
Bill Currie da552e33e7 Remove execinfo checks.
It seems we no longer need it (if we ever really did).
2011-12-13 21:25:41 +09:00
Bill Currie 4b515a961b Back out the fitzquake lerp changes.
That's not the direction I wish to take the renderer.
2011-12-13 17:01:15 +09:00
Bill Currie b05be59ea0 Fix alias models in non-mtex fog.
It turns out that due to the way we do fullbrights, nothing special needs
to be done to get the fullbright texture blended with the model even when
fog is enabled.
2011-12-12 17:08:22 +09:00
Bill Currie 8e531a58c2 Get global fog working for multi-pass rendering.
For the world textures, anyway. Entity multi-pass rendering still needs to
be verified.
2011-12-12 17:08:22 +09:00
Bill Currie 206199652a Fix a stray CFLAGS.
Should be AM_CFLAGS.
2011-12-10 20:45:33 +09:00
Bill Currie c3d41326b3 Do key dest changing properly.
key_demo wasn't so well thought out. This seems to be much better (and nq
is known to be working nicely).
2011-12-10 16:14:25 +09:00
Bill Currie 16c8b2a18d Use the new demo imt.
There are some problems with menus and the console messing up the key_dest
state (they assume console/menu or game, nothing else), but otherwise
things seem to work.
2011-12-10 15:18:50 +09:00
Bill Currie 3ae17e4d37 Fix a silly omission.
Must not check for IMT_MOD bindings when using IMT_CONSOLE etc.
2011-12-10 14:49:56 +09:00
Bill Currie 81a16c925b Add IMT_DEMO for demo playback bindings.
This will allow special key bindings for use during demo playback without
interfering with normal keys.
2011-12-10 14:21:12 +09:00
Bill Currie 14d8e8669f Rework the legacy bind/unbind commands.
in_bind_imt is now gone. I guess mercury was right in that it was a poor
design. However, it was (and still is necessary) to support "bind" and
"unbind". Now, instead, they work only with the IMT_MOD table. IMT_MOD sits
below IMT_0 in the imt hierarchy. If the key is not bound in IMT_0+, then
IMT_MOD will be checked. This way, "bind" and "unbind" can never mess with
a user's more sophisticated binding setup.
2011-12-10 13:56:02 +09:00
Bill Currie 49451eea80 Use the new menu/console bingings.
Now, the console toggle will always work (so long as the console is
toggleable in the first place).
2011-12-10 13:24:32 +09:00
Bill Currie d9d56760e1 Add cvars to control the keys for menus and console.
The backquote is not always usable for toggling the console, and the new
bind system doesn't automatically bind a key to both game and console imts
(by design). Thus create a cvar that allows the "always works" console
toggle to be specified in eg $fs_globalcfg. While I'm at it, do one for the
menus, too.
2011-12-10 13:24:32 +09:00
Jeff Teunissen 361255cf31 Ruamoko: New math constants, some new math functions
Also, switch all of the math builtins functions we use from Rua to the
ones that accept and return floats, avoiding conversions to/from double.
2011-12-09 22:36:41 -05:00
Bill Currie 2edac1a438 Nuke a sprintf. 2011-12-08 22:16:59 +09:00
Bill Currie 1c82956dd7 net_udp.c FIONREAD fix from Ozkan Sezer.
net_udp.c: Fixed FIONREAD ioctl to take an int* argument instead of an
unsigned long*.
2011-12-08 21:50:55 +09:00
Bill Currie 8aa5a8139c Split out the portal sanity tests.
With this, the portal code can be tested separately, including the freeing
of the portal information.
2011-12-08 14:59:35 +09:00
Bill Currie f9877ce0e0 Add a function to free a hull's portal information. 2011-12-08 14:58:08 +09:00
Bill Currie d3cf5c4b75 Beg for mmap access.
If the default sound device does not support mmap access, retry with
plughw. However, assume the user knows best and do not retry if snd_device
has been set to anything, including "default".

QF alsa support now works out of the box with pulseaudio.
2011-12-08 11:32:33 +09:00
Bill Currie 45288a1a7f Fix the ghastly sound quality.
Due to quake's original sound engine using a push model, the actual place
to which the sound data should be written is not necessarily where the
"hardware" dma cursor is, but rather where the last write finished off.
Thus, the correct output location is indicated by snd_paintedtime rather
than snd_shm->framepos.
2011-12-08 11:02:19 +09:00
Bill Currie fceed07d0b Tidy up my diagrams. 2011-12-08 08:45:53 +09:00
Bill Currie 9f32004599 Add a fixme.
I've had enough of this for the moment, but I'm pretty sure the test needs
some more consideration, and I'll probably forget about it if I don't mark
it.
2011-12-07 17:27:13 +09:00
Bill Currie 2a27db146e Use a bit of epsilon in trace_contents().
All tests pass again.
2011-12-07 15:35:19 +09:00
Bill Currie 66dffef936 Get trace_to_leaf working a little better.
I think the recursion decision needs a little more work, but this gets the
current tests working (though there's still a failure due to fp math).
2011-12-07 15:31:33 +09:00
Bill Currie ccbc69a7f5 Carve out some more cave and add some more tests.
One of them even breaks the code :)
2011-12-07 13:31:21 +09:00
Bill Currie 4ed8b69e24 Check the cross product length before testing its direction.
This fixes the bogus portal crossings.
2011-12-07 12:20:04 +09:00
Bill Currie 5af88d33fe Trace to the current portal rather than the portal's plane. 2011-12-07 12:17:51 +09:00
Bill Currie 9d2914474c Fix the edge vectors when bounding the portal points. 2011-12-07 12:16:58 +09:00