Commit graph

4301 commits

Author SHA1 Message Date
Bill Currie
410fecd67b [client] Fix the transform memory leak
The transforms aren't actually freed at the end (more work), but at
least they aren't lost any more, though one is still lost for the
viewent (weapon). The obvious fix didn't work.
2021-03-21 23:05:13 +09:00
Bill Currie
ce2ffac078 [entity] Free all memory in the unit test
Now I know that deleting transforms works properly.
2021-03-21 22:33:57 +09:00
Bill Currie
56cf181a11 [gamecode] Make PR_RESMAP macros more function-like
I never liked that some of the macros needed the type as a parameter
(yay typeof and __auto_type) or those that returned a value hid the
return statement so they couldn't be used in assignments.
2021-03-21 21:26:36 +09:00
Bill Currie
003910612a [entity] Fix tests for changed forward/right
I had forgotten that Quake has forward as +X and right as -Y (still a
right-handed system, just that with X forward, Y points left).
2021-03-21 20:45:43 +09:00
Bill Currie
cc4167668c Fix a pile of leaks and uninit errors
Still "some" more to go: a pile to do with transforms and temporary
entities, and a nasty one with host_cbuf. There's also all the static
block-alloc lists :/
2021-03-21 19:56:17 +09:00
Bill Currie
a3c1b2e992 [util] Rename qfplist.[ch]
The name is a hold-over from before the current quakeforge tree and the
QF include directory.
2021-03-21 16:13:03 +09:00
Bill Currie
66e6627780 [vulkan] Use the correct character data
I got tired of not being able to read 90% of quake's output :P
2021-03-21 11:37:36 +09:00
Bill Currie
6e0cc59e8f [util] Make wad lump failure a soft error
Can't recover from an error if the program is swept out from underneath
you.
2021-03-21 11:36:18 +09:00
Bill Currie
7650df3400 [model] Handle brush models with empty texture slots
It seems some maps have some empty texture slots (eg, e1m2).
2021-03-21 10:08:44 +09:00
Bill Currie
0a79348ce9 [vulkan] Tweak the lighting to look a bit better
Reduced the gamma correction a bit and increased the intensity of
dynamic lights. Not sure the latter is correct, but it looks much
better.
2021-03-20 19:15:06 +09:00
Bill Currie
cadea27577 [vulkan] Disable lightmap support
Hopefully, it won't be needed.
2021-03-20 18:02:27 +09:00
Bill Currie
0246e55983 [vulkan] Support colored lights
Now my dizzy map looks like it used to (more or less, possibly too dark,
but I suspect I used some command-line settings to qflight).
2021-03-20 16:50:37 +09:00
Bill Currie
dccd6989b2 [vulkan] Implement gamma correction
Currently hard-coded to 0.67 (1/1.5), but it does the job for now.
2021-03-20 16:50:11 +09:00
Bill Currie
bab3e0720f [vulkan] Implement real-time lighting
Light styles and shadows aren't implemented yet.

The map's entities are used to create the lights, and the PVS used to
determine which lights might be visible (ie, the surfaces they light).
That could do with some more improvements (eg, checking if a leaf is
outside a spotlight's cone), but the concept seems to work.
2021-03-20 16:08:44 +09:00
Bill Currie
e0eacf4014 [model] Make set and mix versions of Mod_LeafPVS
The re-entrant version was a good start, but being able to mix while
decompressing saves having to have a temporary buffer somewhere.
2021-03-20 16:06:15 +09:00
Bill Currie
e3444b726f [model] Add a re-entrant Mod_LeafPVS
Double benefit, actually: faster when building a fat PVS (don't need to
copy as much) and can be used in multiple threads. Also, default visiblity
can be set, and the buffer size has its own macro.
2021-03-20 12:13:58 +09:00
Bill Currie
0ace799b27 [util] Support commands with a data parameter
Useful for avoiding a pile of wrapper functions that merely pass on
command-specific data to the actual implementation. Used to clean up the
wrappers in nq and qw cl_input.c
2021-03-20 03:56:16 +09:00
Bill Currie
8f7d6b1d02 [vulkan] Initialize skins
This allows the qw client to run with Vulkan.
2021-03-20 00:08:21 +09:00
Bill Currie
5bf21931c7 [renderer] Remove more old fields from entity_t
The only transform related field remaining is old_origin. This also
brings the renderer closer to using simd (lots of stuff to fix still,
though).
2021-03-20 00:08:21 +09:00
Bill Currie
5158cc5527 [util] Add normal and magnitude float vector functions 2021-03-19 11:09:57 +09:00
Bill Currie
2015474468 Move and clean up clview.h
Redundant or dead prototypes deleted, and the client/view.h seems a good
place for the file.
2021-03-12 11:48:53 +09:00
Bill Currie
8466de2325 [client] Use vec4_t in entity_state_t
And clean up the mess (sort of:P)
2021-03-11 16:19:49 +09:00
Bill Currie
36761192a6 [qw] Partially clean up muzzle flash handling
It needs some more work (see FIXME in the code).
2021-03-11 15:23:35 +09:00
Bill Currie
abaccbec53 [client] Move qw's loc code into client
This makes the location code available to nq (not used yet) but more
importantly moves some definitely client-side code into the right place.
2021-03-11 11:53:38 +09:00
Bill Currie
b8267f2edd [client] Merge nq/qw entity effects code 2021-03-11 11:25:04 +09:00
Bill Currie
c05a15dec5 [glsl] Use vec4f_t in a few more places
No idea if it makes a noticeable speed difference, but it makes a huge
readability difference.
2021-03-10 21:17:34 +09:00
Bill Currie
62cce7f98c [gl] Remove some more warts
seeing ptexels and pixels together is very confusing
2021-03-10 21:15:53 +09:00
Bill Currie
169e0192f2 [gl] Use the correct value for sqrt(0.5)
707106781 looks right, but isn't quite.
2021-03-10 19:06:15 +09:00
Bill Currie
56d84ef63e [gl] Fix the compressed sprites
Seems to be an ancient bug.
2021-03-10 18:35:35 +09:00
Bill Currie
693225a16f [util] Add a fixme for a comment
The code itself is fine, but the comment is rubbish because it's
confusing, though essentially correct.
2021-03-10 18:05:12 +09:00
Bill Currie
098ceed5ff [client] Merge nq and qw temp entity handling
This finally gets cl_tent merged away.
2021-03-10 18:04:18 +09:00
Bill Currie
fbc1bd9f6e [renderer] Clean up entity_t to a certain extent
This is the first step towards component-based entities.

There's still some transform-related stuff in the struct that needs to
be moved, but it's all entirely client related (rather than renderer)
and will probably go into a "client" component. Also, the current
components are directly included structs rather than references as I
didn't want to deal with the object management at this stage.

As part of the process (because transforms use simd) this also starts
the process of moving QF to using simd for vectors and matrices. There's
now a mess of simd and sisd code mixed together, but it works
surprisingly well together.
2021-03-10 00:01:41 +09:00
Bill Currie
3230270ae3 [entity] Start work on a new entity library
The plan is to have a fully component based entity system. This adds
hierarchical transforms. Not particularly useful for quake itself at
this stage, but it will allow for much more flexibility later on,
especially when QuakeForge becomes more general-purpose.
2021-03-09 11:39:41 +09:00
Bill Currie
2c5742a076 [renderer] Remove some variable warts
Ugh, Hungarian notation is still lurking...
2021-03-09 11:37:47 +09:00
Bill Currie
4a97bc3ba5 [util] Create simd quaternion to matrix function
This seems to be pretty close to as fast as it gets (might be able to do
better with some shuffles of the negation constants instead of loading
separate constants).
2021-03-04 17:45:10 +09:00
Bill Currie
0366b72d4a [vulkan] remove the fps printing
Now that pixels are rendered, there's no need to print the fps
separately as the in-game display works quite nicely.
2021-03-03 18:16:27 +09:00
Bill Currie
4d8ce22c17 [vulkan] Load the map's lights into an array
It's not used yet as work needs to be done to better support generic
entities, but this is the next step to real-time lighting (though, to be
honest, I expect it will be too slow to be usable).
2021-03-03 18:14:16 +09:00
Bill Currie
e3762d8f38 [util] Make plist mostly null-safe
The main purpose is to allow fluent-style:
    const char *targetname = PL_String (PL_ObjectForKey (entity, "targetname"));
    if (targetname && !PL_ObjectForKey (targets, targetname)) {
        PL_D_AddObject (targets, targetname, entity);
    }

[note: the above is iffy due to ownership of entity, but the code from
which the above comes works around the issue]
2021-03-03 18:01:35 +09:00
Bill Currie
eb0aa2dcea [renderer] Clean up most globals in efrags
There's still the memory management itself to clean up, but the main
code no longer uses any static/global variables (holdover from when the
function was recursive rather).
2021-03-03 16:34:16 +09:00
Bill Currie
45c0255643 [util] Add simd 4x4 matrix functions
Currently just add, subtract, multiply (m m and m v).
2021-03-03 16:34:16 +09:00
Bill Currie
9617bbef97 [build] Create static libs for render targets
The static libs are used to build the plugins, but make it easy to use
only those modules needed for tests. Fixes the link error when running
"make check" with non-static plugins.
2021-03-03 16:34:16 +09:00
Bill Currie
407ea15e35 [util] Fix some test bitrot 2021-03-02 15:05:19 +09:00
Bill Currie
fd97bb1456 [vulkan] Implement linear falloff
It's possibly too bright, but it might be the lights themselves. Still,
it looks better than the no-falloff implementation.
2021-02-25 16:11:47 +09:00
Bill Currie
33575f93d5 [vulkan] Implement deferred lighting for dlights
Static lights are yet to come (so the screen is black most of the time),
but dynamic lights work very nicely (and look very good) despite the
falloff being incorrect.
2021-02-25 15:51:54 +09:00
Bill Currie
918c3af095 [vulkan] Add a position buffer to the g-buffer
While I could reconstruct the position from the screen coords and depth,
this is easier and good enough for now. Reconstruction is an
optimization thing.
2021-02-25 13:46:33 +09:00
Bill Currie
4eb07220cd [util] Make plists more const-correct 2021-02-25 11:55:25 +09:00
Bill Currie
6c1d6666b4 [vulkan] Actually write the alias g-buffer commands
It seems to help for some reason.
2021-02-24 20:24:46 +09:00
Bill Currie
10a1b99a92 [vulkan] Implement lighting and compose passes
Lighting doesn't actually do lights yet, but it's producing pixels.
Translucent seems to be working (2d draw uses it), and compose seems to
be working.
2021-02-24 19:58:31 +09:00
Bill Currie
9229b67633 [vulkan] Clean up the new render pass and framebuffers 2021-02-24 16:27:56 +09:00
Bill Currie
e6ecf5e855 [vulkan] Fix up commands for deferred rendering
Nothing gets output yet (lighting and composite passes not implemented),
but everything passes validation until exit (not destroying everything).
2021-02-23 15:43:02 +09:00