Commit graph

2835 commits

Author SHA1 Message Date
Bill Currie
1e7cb8ee17 [vulkan] Implement lightmap updates for dlights
GL-Quake all over again, but the world is so much more alive with moving
lights, even if... rather stylized.

Closes #73.
2024-01-20 09:44:29 +09:00
Bill Currie
8c6bfe0984 [vulkan] Partially support dynamic lighting
Dynamic lighting via light styles now works, just actual dlights to go.
2024-01-19 15:45:04 +09:00
Bill Currie
63bec6d67f [scene] Add more entity component helper functions
Cleans up the code and removes more opportunities for UB.
2024-01-19 15:45:04 +09:00
Bill Currie
52f012cc11 [console] Flush any pending draw data
This takes care of a 5s hang when the engine aborts before the first
frame is rendered (for vulkan).
2024-01-19 15:45:04 +09:00
Bill Currie
4a99ef5723 [vulkan] Add a function to explicitly wait on a packet
It's not currently used, but it was very handy for finding where the
cause of the 5s hang was ***not***.
2024-01-19 15:45:04 +09:00
Bill Currie
3168550935 [vulkan] Upload lightmap data to the gpu and use it
The lightmaps aren't updated at all yet, so everything is static.
Figuring out how lightmap data gets to the gpu was a chore thanks to the
spaghetti in the bsp data, and then I'd forgotten that I was
pre-expanding the light data to rgb so wound up with weird lightmaps,
but without water or particles, demo1 is getting 5000fps at 800x450, and
it seems to be CPU limited.
2024-01-19 15:45:04 +09:00
Bill Currie
ec9e2c12b8 [vulkan] Implement skin support
Finally, quakeworld gets its *ahem* fancy skins. I'm not happy with how
skin loading is handled, but the whole model and skin support needs a
redesign.

Closes #74.
2024-01-15 19:07:33 +09:00
Bill Currie
fcd094ef04 [skin] Fix up dynamic library issues
And further clean up skin api.

It turns out that skin functions must all be in the render libs, and
this results in Skin_Set (was Skin_SetSkin) needs to be accessed via a
function pointer rather than directly :(
2024-01-15 15:26:09 +09:00
Bill Currie
d39630580e [skin] Get team colors working for model skins
This should actually get team colors working for all models, not just
player.mdl.
2024-01-15 14:59:11 +09:00
Bill Currie
346ed29f49 [skin] Implement top/bottom colors for gl
They don't work yet if the entity does not have an external skin.
2024-01-15 14:59:06 +09:00
Bill Currie
0539f07c1a [skin] Use an ECS registry to manage skins
This takes care of the double free and also cleans up a lot of the skin
api. However, the gl renderer lost top/bottom colors (for now). Vulkan
skins still don't work yet.
2024-01-15 14:56:37 +09:00
Bill Currie
739adad3d5 [skin] Clean up the API a little
Only the renderer-specific functions are in the plugin functions struct,
and only the client functions are global.
2024-01-13 13:42:03 +09:00
Bill Currie
6c03d72c26 [qw] Clean up player info processing
It should be much harder for a malicious server to crash the client
(there were a few holes in there still).

Also, set the fallback (server didn't specify) top/bottom colors to be
such that the default colors from the skin are used instead of white.
2024-01-13 13:22:52 +09:00
Bill Currie
119e9766b9 [iqm] Use 32-bit indices for large models
That is, those with more than 65520 vertices. Not properly supported for
sw or gl, and glsl isn't rendering properly for some reason (renderdoc
does see the meshes, though, so maybe depth or winding issues).
2024-01-09 13:36:46 +09:00
Bill Currie
3cd0703249 [ui] Implement scroll bars
There's a bit of nasty hard-coding around passages at the moment, but
the basics are working in a fairly generic way.
2024-01-09 09:12:29 +09:00
Bill Currie
c460d03371 [ui] Propagate passage view size to its container
This gets the container view sized properly such that the scroll box has
something to work with for determining how much the view can slide.
2024-01-08 11:18:21 +09:00
Bill Currie
97a83bf1ed [ui] Move passage paragraph placement into text handling
This allows the passage view to be sized properly during imui's layout
phase.
2024-01-08 10:27:17 +09:00
Bill Currie
585c47bc2d [ui] Use actual fractions for fractional values
Integral percentage is not always enough.
2024-01-07 12:03:22 +09:00
Bill Currie
2e00fd1165 [ui] Pass a data pointer to update functions 2024-01-07 11:58:01 +09:00
Bill Currie
aa5dc657fd [ui] Add some basic math ops for view_pos_t
Just add and subtract, but I got tired of having to write two lines of
code for such.
2024-01-06 19:38:20 +09:00
Bill Currie
082d00b6c3 [ui] Use the shaped text cache for passage text
This makes a pretty significant difference (~520us down to 80us) for
simple text passage, and even the first time is fast due to word
repetition.
2024-01-06 02:59:31 +09:00
Bill Currie
c2316a4173 [ui] Add support for passage views to imui
It was a right cow to get working at all due to the tangled mess of
dependencies between different hierarchies (switching to hierarchies as
components helpt), but other that some vertical positioning (paragraphs
and descenders), it's working fairly well now (and fairly quick other
than I think I need to ensure the shaping cache is used).
2024-01-05 16:34:18 +09:00
Bill Currie
0ed4df3fb9 [quakeio] Rework Qgetline to use dstring
This clears up its stray memory allocation, and incidentally makes it
thread-safe.
2024-01-05 11:50:48 +09:00
Bill Currie
860f48d541 Clean up about 12000 allocations
Some of them were actual leaks, but tracking memory should be a lot
easier now. However, there's a lot of room for optimization of
allocations (eg, recylcling of hierarchies. There is now 1 active
allocation (according to tracy) when nq exits: Qgetline's string buffer
(I think an api change is in order).
2024-01-05 11:50:48 +09:00
Bill Currie
bfa7c1722a [build] Implement tracy memory zones
This proved to be quite the challenge, and is probably rather fragile,
but it does seem to work, and might help with tracking down memory
leaks.
2024-01-05 11:50:48 +09:00
Bill Currie
60c22e8fda [ecs] Make hierarchy ownership of entities optional
I'm not sure this is what I want.
2024-01-05 11:50:48 +09:00
Bill Currie
f5ebc1083f [ecs] Pass the registry in to the component destroy function
This makes it possible for hierarchies to clean themselves up (by
deleting their entities (though that will cause other problems later
when the hierarchy doesn't own the entities)), thus plugging a memory
leak when parsing passage text.
2024-01-03 12:39:54 +09:00
Bill Currie
35eec0b2e5 [ecs] Implement hierarchies as components
The main goal of this change was to make it easier to tell when a
hierarchy has been deleted, but as a side benefit, it got rid of the use
of PR_RESMAP. Also, it's easy to track the number of hierarchies.

Unfortunately, it showed how brittle the component side of the ECS is
(scene and canvas registries assumed their components were the first (no
long the case), thus the sweeping changes).

Centerprint doesn't work (but it hasn't for a while).
2024-01-02 16:38:01 +09:00
Bill Currie
fc9c2fa544 [ui] Add a function to get root view from any view
This proved useful with canvas references.
2023-12-31 14:39:14 +09:00
Bill Currie
6b2bd02b14 [ui] Add a canvas reference component
It's used for finding the entity that has the actual canvas component
attached. Useful for sharing a single canvas between multiple view
hierarchies, and worked as a proof of concept for doing similar with
hierarchy references, and might work for properly destroying canvas
items (fills etc) when a view entity is deleted (if attached to every
view).
2023-12-31 14:15:05 +09:00
Bill Currie
9a74fb0a14 [ecs] Add basic entity and registry printing
Entities print their status and attached component names, registries
print their component counts for each pool.
2023-12-31 14:08:01 +09:00
Bill Currie
f5de553949 [ui] Take passage view parent parameter
I'm not sure this will be useful in imui, but it might in a retained
mode UI.
2023-12-28 16:43:31 +09:00
Bill Currie
4c704e9a2e [ecs] Give registries a name
This makes debugging a little easier when there are multiple ECS
registries. Currently, the name parameter must be a stable pointer.
2023-12-28 16:08:40 +09:00
Bill Currie
1a5b421933 [ruamoko] Share registry between gui and imui
I can't say I like there being a hard-coded registry, but gui and imui
need to agree on all aspects of the ECS registry they use.
2023-12-28 16:06:47 +09:00
Bill Currie
a50c1d0f81 [ui] Implement nested canvases
This is for scroll boxes (the nesting of canvases is for the clipping
they provide). There are some issues with automatic layout, but this
gets things mostly working, in particular the management of the link
between hierarchies as a canvas is always the root of its hierarchy.
2023-12-23 14:36:57 +09:00
Bill Currie
6faa78eaa1 [ui] Change draw order from 16-bit to 32-bit
With the scroll box work I'm doing, I realized 16 bits is a little
cramped. Although I doubt it would be that much of a problem, switching
to 32 bits turned out to be free because of alignment.
2023-12-23 14:31:58 +09:00
Bill Currie
34f16e10e4 [ui] Correct the spelling of imui_size_t
Really, just a stale comment from when I first started down the imui
path.
2023-12-23 14:26:50 +09:00
Bill Currie
7f1c20afa9 [ui] Implement window resizing
There are some rather iffy parts (windows can get too small), and the
drag bars are a little odd, but the concepts are working.
2023-12-22 18:22:21 +09:00
Bill Currie
650ea052ea [vulkan] Support clipping rectangles via scissor
Seems to work well. The other renderers have stubs because I don't feel
like implementing clipping for them. The gl and glsl wouldn't be too
difficult (need to handle the draw queues), but sw needs a fair bit of
work and I'm not sure it's worth the effort.
2023-12-22 18:17:09 +09:00
Bill Currie
1ca655c0d8 [ui] Clean up a lot of duplicate code
Much of the state handling was highly redundant (in particular, handling
entity and old_entity). This should make it easier to get dragable items
for window resizing.
2023-12-21 19:59:40 +09:00
Bill Currie
a300e2330d [ui] Make windows respect their size fields
If auto_fit is true, then the old behavior is retained.

This is actually better than the set size thing, but that's probably
still useful.
2023-12-21 19:57:02 +09:00
Bill Currie
4483368319 [ruamoko] Add bindings for imui
Things are a little clunky, but I've got a little window I can
manipulate in my test scene :)
2023-12-21 16:11:30 +09:00
Bill Currie
c5d27f5162 [client] Merge sbar into hud
This cleans up a lot of the twisted code between the two files. With the
rewrite of hud/sbar last year, there's really no separation between the
two.
2023-12-21 12:35:02 +09:00
Bill Currie
ba0cf5fa9b [cvar] Add toggle and reset functions
The toggle function is needed for handling listeners, and reset was done
as part of the API cleanup.

Also clean up some of the names and API.
2023-12-21 10:22:21 +09:00
Bill Currie
1266ede2b1 [zone] Make zone_error be like printf
It's so much nicer being able to just print normally.
2023-12-20 18:32:53 +09:00
Bill Currie
45a11bcc68 [math] Add a vector format macro
vec3_t is still a thing so printing it should be easy.
2023-12-19 20:08:39 +09:00
Bill Currie
2e9e247ca4 [vulkan] Use resource for allocating alias models
So far only the mesh data, so it doesn't make any difference to
allocations, but it's the first step to reducing memory object
allocation.
2023-12-19 03:28:29 +09:00
Bill Currie
bf4eedc1c6 [vulkan] Apply light cull info to light pvs
This makes a possible improvement to e1m3, only barely affects ad_tears,
but makes about 30% difference to gmsp3v2 (21fps to 27, and from 3300
leafs to 2700).
2023-12-18 21:07:57 +09:00
Bill Currie
394eae2284 [vulkan] Fix missing debug utils for 64-bit windows
My wordsize check was probably for 686 builds.
2023-12-17 22:41:18 +09:00
Bill Currie
2dd8eea0d9 [vulkan] Let's do the distcheck again 2023-12-17 18:45:02 +09:00