Commit Graph

12659 Commits

Author SHA1 Message Date
Bill Currie 2a9566d380 [qwaq] Handle memory alignment for windows builds 2022-03-05 14:17:48 +09:00
Bill Currie 73444c3b7a [ruamoko] Give the scene resource block a rua prefix
No effect on the code itself, but it makes debugging much easier when
there aren't two very different structs with the same name.
2022-03-05 02:05:59 +09:00
Bill Currie d69355f521 [renderer] Support multiple entity queues
While there's currently only the one still, this will allow the entities
to be multiply queued for multi-pass rendering (eg, shadows). As the
avoidance of putting an entity in the same queue more than once relies
on the entity id, all entities now come from the scene (which is stored
in cl_world in the client code for nq and qw), thus the extensive
changes in the clients.
2022-03-05 02:05:39 +09:00
Bill Currie 6573acbc74 [qw] Fix some segfaults in chase mode
And unconditionally allow chase cam when playing demos.
2022-03-05 01:14:43 +09:00
Bill Currie 6ec8e29429 [scene] Track hierarchies instead of root transforms
The root transform of each hierarchy can be extracted from the first
transform of the list in the hierarchy, so no information is lost. The
main reason for the change is I discovered (obvious in hindsight) that
deleting root transforms was O(n) due to keeping them in an array, thus
the use of a linked list (I don't expect a hierarchy to be in more than
one such list), and I didn't want the transforms to be in a linked list.
2022-03-04 06:43:30 +09:00
Bill Currie 7906db5a37 [client] Set camera rotation for chase mode 1
With the change in cl_view separating chase cam updates from
first-person updates, the auto-rotation of the camera was lost.
2022-03-02 19:13:58 +09:00
Bill Currie f296cb897e [renderer] Make draw order a little more consistent
GL and GLSL were drawing the view model after particles instead of
before. For GL, this is likely due to avoiding fog affecting the view
model (which I think is not the right thing to do), and GLSL due to
copying GL (because I had no idea at the time). This makes the two
renderers consistent with the software renderers, and might even speed
things up a little as that's one less set of blends to do when the
particles are covered by the view model (I don't expect much
difference).
2022-03-02 16:29:40 +09:00
Bill Currie ae6970a005 [renderer] Split entity queue into per-model-type
While I doubt the difference is all that significant, this should speed
up entity rendering because it cuts out a lot of branching, and
eliminates scanning the same list multiple times only to not do anything
for large chunks of the list.
2022-03-02 15:00:32 +09:00
Bill Currie ab91d73635 [scene] Use scene resources for the main hierarchy block
This will reduce the memory churn when creating hierarchies as
transforms switch between being root and child.
2022-03-02 10:49:41 +09:00
Bill Currie b210f01837 [scene] Manage scene roots in transform
Since transforms now know the scene to which they belong, and they know
when they are root and when not, getting the transform code to manage
the scene roots is the best way to keep the list of root transforms
consistent.
2022-03-02 10:43:52 +09:00
Bill Currie 54c3b4cc53 [client] Get the chase camera working with input
It turns out cam_controls is for pointing the player model in the
direction of movement rather than controlling the camera (I should add
proper camera controls).
2022-03-01 16:07:04 +09:00
Bill Currie ee3c9fa59f [client] Sort out the chase mode input FIXME
It's messing with player motion (so not working properly), but at least
now it compiles, I can get it working.
2022-03-01 15:31:00 +09:00
Bill Currie 8407e3acd1 [client] Make input axes accessible and add camera axes
And clean up the names (viewdelta_position_forward -> in_move_forward).
2022-03-01 15:15:33 +09:00
Bill Currie 7c07118541 [mathlib] Clean up AngleVectors comment
I finally spent the time to work out what it was trying to say. Still
not sure it's clear, but what is clear is that there was probably some
disagreement at Id about the orientation of the world.
2022-03-01 14:52:45 +09:00
Bill Currie 1859ff233d [client] Fix the chase cameras
They no longer spin like crazy. I don't know how, but I must have broken
something over the years as I'm sure Seth had the code working (and I
seem to remember seeing it working). In the process, clean up a lot of
the angle mess.
2022-03-01 14:44:53 +09:00
Bill Currie 5b08ee768c [client] Clean up chase camera code
It's a lot easier to read (and see the difference between modes 2 and 3)
with all the ifs removed, and the state is properly is chasestate_t now
(though not handled properly on level reset etc).
2022-03-01 13:49:14 +09:00
Bill Currie 43a329dcb5 [client] Get the basic chase camera working
The more advanced modes are rather broken (continuous spinning), but
they may have been for a while. The bulk of the various changes were due
to renaming viewstate's origin and angles to make their meaning more
explicit.
2022-03-01 11:43:23 +09:00
Bill Currie fb83d87a0e Fix some distcheck issues
Just keeping up with myself.
2022-03-01 10:12:50 +09:00
Bill Currie 457c73967b [sound] Correct "default" listener origin
Position vectors need to be homogeneous, I forgot that when doing the
change.
2022-03-01 01:02:11 +09:00
Bill Currie 57dd4494cc [renderer] Pass in a camera transform
More r_data cleanup. Things could be better still, but this is a start.
2022-02-28 16:59:38 +09:00
Bill Currie ca9e8a3b68 [client] Pass time into locs_draw
This avoids unnecessary access to r_data.
2022-02-28 16:57:43 +09:00
Bill Currie 2477a44d15 [client] Move cshift info from viddef to viewstate
It makes much more sense for cshift state to be in viewstate because it
is very much an effect rather than anything specific to a renderer.
2022-02-28 16:55:12 +09:00
Bill Currie 7d059a0b56 [client] Merge nq and qw cl_view
They've been near-identical for years, now they're only one. It proved
necessary to start merging the HUD code which for now is just a few cvar
declarations (not even init), but that should be a separate set of
commits.
2022-02-28 12:12:51 +09:00
Bill Currie aac9069d9f [nq,qw] Clean up cl_view's use of the client struct
This is a huge step towards merging cl_view.
2022-02-25 16:54:45 +09:00
Bill Currie f04459f03f [nq,qw] Clean up some bogus diffs in cl_view
The diffs were caused by white space and a redundant line.
2022-02-25 11:39:11 +09:00
Bill Currie e920abe142 [glsl] Adjust view/projection matrices for consistency
The actual view and projection matrices are now consistent with vulkan,
with the vulkan-gl disparity moved into adjustment matrices. The goal is
to allow the same camera data and code to be used in all renderers. The
extra matrix multiplication shouldn't be too expensive as it occurs only
when the field of view (not often, under user control) or near and far
clip distances (very rarely) change.
2022-02-25 10:50:53 +09:00
Bill Currie 5ad7c0fbd6 [scene] Add a camera object
It holds the data for a basic 3d camera (transform, fov, near and far
clip). Not used yet as there is much work to be done in cleaning up the
client code.
2022-02-25 10:41:50 +09:00
Bill Currie deff95f490 [client] Merge chase camera and much of input
Handling of view angles is a little hacky at the moment, but this gets
the chase camera code and most of the common input code into one place,
which will make cleaning up the camera code much easier.
2022-02-22 15:51:28 +09:00
Bill Currie 2615953e17 [scene] Move transform getters into inline functions 2022-02-21 08:33:41 +09:00
Bill Currie e67ec84db9 [vulkan] Use simpler projection and z_up matrices
While both matrices had positive determinants in the first place, I find
the projection matrix easier to understand without all the negatives,
and having quake-x/vulkan-z positively parallel in the z-up matrix makes
that a lot easier to think about.
2022-02-18 14:25:50 +09:00
Bill Currie cd26073b6a [vulkan] Update the sky matrix
Regardless of whether the sky is spinning or not, the matrix needs to be
updated with the current origin in order to get the direction vector
right in the shader. Also, it's in the update that the required x-y
plane rotation gets in so the skies move in the correct direction.
2022-02-18 13:29:41 +09:00
Bill Currie 7b0736e208 [sw,sw32] Fix broken software skies
All for an unfortunate unsigned promotion. I guess I just wasn't testing
the software renderers enough.
2022-02-18 13:07:05 +09:00
Bill Currie 981fcca76d [sw,sw32] Fix broken software skies
All for an unfortunate unsigned promotion. I guess I just wasn't testing
the software renderers enough.
2022-02-18 12:54:54 +09:00
Bill Currie a0c21069fa [vulkan] Bind the correct texture for sky boxes
That took way too long to find: just couldn't see it for looking.
2022-02-18 08:17:36 +09:00
Bill Currie 1447d9297d [vulkan] Fix incorrect bsp sky constant ids
I guess I got things a little tangled when cleaning up my bindless
attempt.
Fixes black default skies.
2022-02-18 08:17:36 +09:00
Bill Currie d75726dd22 [vulkan] Bind the correct texture for sky boxes
That took way too long to find: just couldn't see it for looking.
2022-02-18 01:17:25 +09:00
Bill Currie 2d2f14cd31 [vulkan] Fix incorrect bsp sky constant ids
I guess I got things a little tangled when cleaning up my bindless
attempt.
Fixes black default skies.
2022-02-18 01:15:38 +09:00
Bill Currie 4e229169ec [gamecode] Pass gcc's purity test again
I guess maybe that change might make a bigger difference than I thought,
gcc wasn't happy with it.
2022-02-15 08:59:01 +09:00
Bill Currie 550c0712d8 Fix a bunch of distcheck issues 2022-02-15 08:59:01 +09:00
Bill Currie 70af362562 [qfcc] Unify temp def, return value and parameter sizes
In working with vectors and matrices while testing the scene wrappers, I
found that there was a fair bit of confusion about how large something
could be. Return values can be up to 32 words (but qfcc wasn't aware of
that), parameters were limited to 4 words still (and possibly should be
for varargs), and temp defs were limited to 8 words (1 lvec4). Temps are
used for handling return values (at least when not optimizing) and thus
must be capable of holding a return value, and passing large arguments
through *formal* parameters should be allowed. It seems reasonable to
limit parameter sizes to return value sizes.

A temp and a move are still used for large return values (4x4 matrix),
but that's an optimization issue: the code itself is at least correct.
2022-02-15 08:39:20 +09:00
Bill Currie 4f436e8245 [scene] Correct a comment
While the plethora of orientations for a reference frame is somewhat
annoying, having an incorrect description of the frame is much more
annoying.
2022-02-15 06:46:01 +09:00
Bill Currie 54f0af854b [ruamoko] Wrap the transform fuctions
Except for get/set name as I'm still pondering strings.
2022-02-15 00:06:39 +09:00
Bill Currie ba3879c6e0 [scene] Make transforms owned by the scene
This actually has at least two benefits: the transform id is managed by
the scene and thus does not need separate management by the Ruamoko
wrapper functions, and better memory handling of the transform objects.
Another benefit that isn't realized yet is that this is a step towards
breaking the renderers free of quake and quakeworld: although the
clients don't actually use the scene yet, it will be a good place to
store the rendering information (functions to run, etc).
2022-02-14 20:01:36 +09:00
Bill Currie f0c35e541a [ruamoko] Pass some more purity tests
Separate because I want to cherry-pick the other commit.
2022-02-14 19:56:56 +09:00
Bill Currie e58d53d4b6 [gamecode] Pass gcc's purity test again
I guess maybe that change might make a bigger difference than I thought,
gcc wasn't happy with it.
2022-02-14 19:30:50 +09:00
Bill Currie 59044d3827 Fix a bunch of distcheck issues 2022-02-14 19:28:19 +09:00
Bill Currie afbca54faf [ruamoko] Add wrappers for the existing scene functions
I've run into a bit of an issue with transform management (really, just
need to make them owned by the scene, but that means creating a scene
for quake and quakeworld).
2022-02-14 16:43:10 +09:00
Bill Currie f6ac614e09 [scene] Add functions for scene and entity create/delete
Scene creation was already there, but now can be deleted, as can
entities.
2022-02-14 16:41:38 +09:00
Bill Currie f3559cedb0 [qwaq] Plug a file handle leak
Forgot to call Qclose in load_file.
2022-02-14 14:41:14 +09:00
Bill Currie 4d491a444d [gamecode] Fix handling of undefined builtins
The setup of the function descriptor for undefined builtins was
incomplete and led to the progs running code at address 0. It didn't end
well.
2022-02-14 14:28:19 +09:00