Commit Graph

5574 Commits

Author SHA1 Message Date
Bill Currie 40b319bf42 [vulkan] Support swizzles in resource image views
Using swizzles in an image view allows the same shader to be used with
different image "types" (eg, color vs coverage).

Of course, this needed to abandon QFV_CreateImageView, but that is
likely for the best.
2022-11-20 15:31:23 +09:00
Bill Currie 534d5367de [vulkan] Use linear sampling for glyphs
This requires having padding around the glyphs to avoid texel leak, but
as the atlas is created at runtime, it's possible to get the padding in.
2022-11-20 03:59:01 +09:00
Bill Currie 4cbacc1149 [vulkan] Remove the pic texel offsets
It turns out that nearest filtering doesn't need any offsets to avoid
texel leaks so long as the screen isn't also offset. With this, the 2d
rendering looks good at any scale (minus the inherent blockiness).
2022-11-20 01:26:14 +09:00
Bill Currie 4ff3ca104d [gl] Make conchars use nearest sampling
Linear sampling in a texture atlas (which is what conchars is) requires
the use of border pixels to avoid pixel leakage.
2022-11-20 01:21:45 +09:00
Bill Currie e0b9e118a0 [renderer] Remove the 1/2 pixel shift of the 2d screen
It seemed like a good idea at the time, but it exacerbates pixel leakage
in atlas textures that have no border pixels (even in nearest sampling
modes).
2022-11-20 01:17:09 +09:00
Bill Currie 7e442a9019 [renderer] Correct crosshair sizes
I'm pretty sure they're meant to be 8x8 and not 16x16. Certainly they're
a tad large at 16x16 when using scaled 2d.
2022-11-20 00:50:59 +09:00
Bill Currie 2a8c12426d [sw] Ensure the view model has a visibility component
The rest of the system won't add one automatically (since entity
creation no longer does), but the alias and iqm rendering code expect
there to be one. Fixes a segfault when starting a scene (demo etc).
2022-11-19 14:06:24 +09:00
Bill Currie b59505b7c1 [glsl] Remove glpic_t struct
It hasn't been necessary for a long time and is a tad misleading as all
it does is wrap a pointer to subpic_t.
2022-11-19 00:41:52 +09:00
Bill Currie ae200e4e40 [renderer] Compensate for scale in cross-hair placement
I was wondering where it had gone (south east, actually).
2022-11-18 11:23:32 +09:00
Bill Currie 2a1255de59 [renderer] Make cross hair data easier to see in code
It is rather hard to pick out an image from a mass of 0xff and 0xfe.
2022-11-18 11:11:38 +09:00
Bill Currie bffe9413b7 [vulkan] Add support for 9-slice rendering
There's no API yet as I need to look into the handling of qpic_t before
I can get any of this into the other renderers (or even vulkan, for that
matter).

However, the current design for slice rendering is based on glyphs (ie,
using instances and vertex pulling), with 3 strips of 3 quads, 16 verts,
and 26 indices (2 reset). Hacky testing seems to work, but real tests
need the API.
2022-11-18 09:44:01 +09:00
Bill Currie b1d7bad2e3 [renderer] Move call to R_ClearEfrags to SCR_NewScene
Probably more such should be moved, but efrags is on my mind. There's no
need for the call to be spread through all the renderers.
2022-11-17 22:12:41 +09:00
Bill Currie 06f410b0b6 [renderer] Clear the visibility components on scene reset
I don't know why it didn't happen during the demo loop, but going from
the start map to e1m1 caused a segfault due to the efrags for a lava
ball getting double freed (however, I do think it might be because the
ball passed through at least two leafs, while entities in the demos did
not). The double free was because SCR_NewScene (indirectly) freed all
the efrags without removing them from entities, and then the client code
deleting the entities caused the visibility components to get deleted
and thus the efrags freed a second time. Using ECS_RemoveEntities on the
visibility component ensures the entities don't have a visibility
component to remove when they are later deleted.
2022-11-17 22:12:41 +09:00
Bill Currie ac0079f872 [ecs] Add a function to remove a component from all entities
While simple component pools can be cleared simply by zeroing their
counts, ones that have a delete function need that function to be called
for all the components in the pool otherwise leaks can happen.
2022-11-17 21:49:38 +09:00
Bill Currie 387f17dc0c [scene] Add a color map component
It's currently used only by the vulkan renderer, as it's the only
renderer that can make good use of it for alias models, but now vulkan
show shirt/pants colors (finally).
2022-11-15 15:30:35 +09:00
Bill Currie a28488d2e1 [vulkan] Move both alias color maps into the one layer
This cuts down on the memory requirements for skins by 25%, and
simplifies the shader a bit more, too. While at it, I made alias skins
nominally compatible with bsp textures: layer 0 is color, 1 is emissive,
and 2 is the color map (emissive was on 3).
2022-11-15 13:09:41 +09:00
Bill Currie 668f7f2cd2 [vulkan] Use palette lookups for top/bottom colors
As the RGB curves for many of the color rows are not linearly related,
my idea of scaling the brightest color in the row just didn't work.
Using a masked palette lookup works much better as it allows any curves.
Also, because the palette is uploaded as a grid and the coordinates are
calculated on the CPU, the system is extendable beyond 8-bit palettes.

This isn't quite complete as the top and bottom colors are still in
separate layers but their indices and masks can fit in just one, but
this requires reworking the texture setup (for another commit).
2022-11-15 11:53:07 +09:00
Bill Currie 4d7f72948d [vulkan] Correct alias g-buffer push-constants
For whatever reason, I had added an extra 4 bytes to the fragment
shader's push-constants. It took me a while to figure out why renderdoc
wouldn't stop complaining about me not writing enough data.
2022-11-15 09:28:34 +09:00
Bill Currie 2e21ca4b9a [vulkan] Upload palette as a 16x16 image
It turns out my approach to alias skin coloring just doesn't work for
the quake data due to the color curves not having a linear relationship,
especially the bottom colors.
2022-11-15 09:26:17 +09:00
Bill Currie 251e47f4d6 [vulkan] Add a function to update texture contents
It works on only one layer and one mip, and assumes the provided texture
data is compatible with the image, but does support sub-image updates
(x, y location as parameters, width and height in the texture data).
2022-11-15 09:18:26 +09:00
Bill Currie 8fa6167a57 [vid] Add a function to set the palette and colormap
Mostly for qwaq as it uses the default VGA palette but I need to do some
testing with the quake palette.
2022-11-14 19:39:55 +09:00
Bill Currie 7c53a68ad7 [scene] Move efrag code from renderer to scene
While culling is very much part of rendering, it's more scene related
than renderer related.

Fixes the transform test failing to link.
2022-11-14 12:43:33 +09:00
Bill Currie 053c2c47db [vulkan] Double alias top/bottom color values
The bright end of the color map is actually twice the palette value, but
I didn't understand this when I came up with the shirt/pants color
scheme for vulkan. However, the skin texture can store only 0..1, so the
mapping to 0..2 needs to be done in the shader. It looks like it works
at least better: the gold key at the end of demo1 doesn't look as bleh,
though I do get some weird colors still on ogres etc.
2022-11-14 11:35:26 +09:00
Bill Currie 9f6c367fce [console] Resurrect console scaling
Currently only for gl/glsl/vulkan. However, rather than futzing with
con_width and con_height (and trying to guess good values), con_scale
(currently an integer) gives consistent pixel scaling regardless of
window size.
2022-11-14 09:49:13 +09:00
Bill Currie 0e64f959e2 [scene] Move visibility management into scene code
Well, sort of: it's still really in the renderer, but now calling
R_AddEfrags automatically updates the visibility structure as necessary,
and deleting an entity cleans up the efrags automatically. I wanted this
over twenty years ago.
2022-11-13 15:08:18 +09:00
Bill Currie 767b39b7bd [client] Implement the scoreboards and spectator
This gets the status bar/hud back into function state.
2022-11-13 04:15:26 +09:00
Bill Currie 47fb887724 [vulkan] Implement Draw_TileClear
The status bar doesn't look right without it when it's supposed to be
there.
2022-11-13 04:15:26 +09:00
Bill Currie 2d3c2da64d [qfcc] Support advanced progs again
The support for the new vector types broke compiling code using
--advanced. Thus it's necessary to ensure vector constants are
float-type and vec3 and vec4 are treated as vector and quaternion, which
meant resurrecting the old vector expression code for v6p progs.
2022-11-12 20:04:19 +09:00
Bill Currie bbd2cdb8c8 [console] Check for curses before calling updaters
If curses isn't being used, then there are no entities and thus no
components to run. Fixes a segfault when running a server without curses
enabled.
2022-11-12 14:37:42 +09:00
Bill Currie 1a9ec15a41 [client] Include hud overlay in hud_debug 2022-11-12 01:50:31 +09:00
Bill Currie 0d9b475759 [client] Implement finale overlay and death-solo
Deathmatch overlay isn't working properly for end of level or death in
qw.
2022-11-12 01:47:17 +09:00
Bill Currie 749a110b76 [util] Check share path too when filling file lists
This fixes maplist showing only those maps in the user directory.
However, no checking is done for duplicate files due to earlier search
paths overriding later paths.
2022-11-11 22:05:10 +09:00
Bill Currie 5333c78f7a [client] Implement rogue's team (ctf) face
I don't like that teamplay is just a local cvar that doesn't get set by
the server.
2022-11-11 19:41:47 +09:00
Bill Currie 7b167b2f35 [client] Implement rogue inventory bar switching
And fix rogue ammo icons.
2022-11-11 18:27:51 +09:00
Bill Currie acedc906dd [client] Implement hipnotic and rogue items
This involved disabling sigils for hipnotic and rogue (not used),
adjusting the number of items views, and moving the two keys views for
hipnotic. Rogue is not yet using the correct status bar pics.
2022-11-11 15:18:31 +09:00
Bill Currie a91ae7aeb9 [client] Implement hipnotic and rogue weapon views
The functionality of the hipnotic and rogue weapon power-ups is now done
by a various mappings instead of separate functions. In theory, this
should make things more flexible, but most importantly, there's a lot
less code duplication.
2022-11-11 13:00:40 +09:00
Bill Currie 017bba8869 [client] Fix some view placement and buffer sizes 2022-11-10 21:27:49 +09:00
Bill Currie c6b79d49a4 [client] Fix incorrect function component setup
Need to pass the address of the pointer :/
2022-11-10 21:23:04 +09:00
Bill Currie 2fb5b67012 [vulkan] Implement line graph rendering
I should probably just use the line rendering for all renderers and pull
the graph drawing out to the client code.
2022-11-10 21:19:01 +09:00
Bill Currie 74e64d7228 [client] Implement sbar flashes for items
Sigils can't be flashed as they don't have any animations provided, and
they're not normally as critical. I don't know why items weren't
flashed, but since the pics are there, might as well use them (and the
flashing keys do look pretty good).
2022-11-10 15:35:14 +09:00
Bill Currie 39074ba3c1 [qw] Implement hud ping and pl indicators
As well as the periodic update of pings when the scoreboard or hud ping
are shown.
2022-11-10 15:34:31 +09:00
Bill Currie d9b231e2aa [util] Return null for missing wad lumps
Segfaults are not good when a lump can't be found as it makes error
checking difficult.
2022-11-10 14:44:08 +09:00
Bill Currie e0fa853f47 [client] Implement the update functions
nq's frags don't update properly yet, and there's still a lot of
optimization to sort out, but it seems to be fairly usable again.
2022-11-10 01:35:33 +09:00
Bill Currie 1b90f2320e [client] Extend sbar's api
I think this makes the purpose of the functions more clear and makes the
protocol logic less dependent on the meaning of some of the updates.
Most of the update functions are not fully implemented yet.
2022-11-09 19:41:59 +09:00
Bill Currie 73e62de2fb [client] Clean up sbar's globals access
I had forgotten that the cl structs in nq and qw were different layouts,
which resulted in qw's sbar/hud being quite broken. Rather than messing
with the structs, I decided it would be far better in the long run to
clean up sbar's access to the cl struct and the few other nq/qw specific
globals it used. There are still plenty of bugs to fix, but now almost
everything is in the one place.
2022-11-09 19:38:54 +09:00
Bill Currie 34f0a59441 [client] Merge sbar
At long last, the status bar code is now shared between nq and qw. There
are many bugs to fix, but at least now they're all in the one place.
2022-11-08 17:42:27 +09:00
Bill Currie 24d8d864a2 [ecs] Optionally delete entities on hierarchy removal
Useful for deleting an entire sub-hierarchy of entities.
2022-11-08 00:16:29 +09:00
Bill Currie ddd6c958a9 [ecs] Fix parent index updates when removing sub-hierarchies
In the end, it was removal of the old entries that corrupted the parent
indices. Very nicely, most of the fixes involved removing code. Taking
advantage of the ECS to debug the hierarchies was fun, and the resulting
colorized entity names helped no end.
2022-11-06 23:04:40 +09:00
Bill Currie 1130919049 [ecs] Add a simplified test of the sbar hierarchy
Even 37 objects is a lot, but it's a whole lot better than 180. Most
importantly, it reproduces the problem, which seems to be not all parent
indices getting updated. The child indices seem to be working nice, as
do the reference object indices (ie, the entity components). I suspect
its the parent indices getting corrupted that cause problems on the
second switch of the hud/sbar cvar as the parent indices are used to
find the child indices that need to be updated.
2022-11-06 20:04:34 +09:00
Bill Currie cf6b4efe5d [ecs] Colorize hierarchy test output
Just the tiniest bit of color goes a long way to spotting issues.
2022-11-06 20:03:29 +09:00