Commit graph

2097 commits

Author SHA1 Message Date
Bill Currie
25ac0ff303 [vulkan] Adapt the shaders for multi-view
Multi-view will be used for shadows and fisheye.
2023-02-14 13:24:47 +09:00
Bill Currie
9706d2d9ce [plist] Fix a typo in a comment 2023-02-14 12:45:04 +09:00
Bill Currie
d5b93c20b3 [plist] Pass array index/label to the parse function
I ran into the need to get at the label of labeled array element and the
best way seemed to be by setting the name field of the plfield_t item
passed to the parser function, and then found that PL_ParseSymtab
already does this. I then decided passing the array index would also be
good, and the offset field made sense.
2023-02-14 12:45:04 +09:00
Bill Currie
a561558748 [console] Switch to using a canvas for the console
While the console background is broken in that alpha doesn't work, it's
now rendered correctly in all renderers.
2023-01-22 03:45:50 +09:00
Bill Currie
89afcfcb6d [ui] Add a lateupdate component to canvas
Like update, the function takes just a view, but is useful for updates
that need to run after the other components are run.
2023-01-22 03:43:58 +09:00
Bill Currie
f0fab885d4 [ui] Get canvas into a usable state
Canvas_SortComponentPool now takes the raw canvas component id as it is
specialized to the canvas subpools.

Canvas_SetLen resizes the root view and then updates the hierarchy for
every canvas in the system.

Canvas_InitSys sets up the component system with the systems it needs
(canvas, view, text). This is required to ensure view_href is just past
the canvas components as it is needed for retrieving the actual canvas
component (and thus sub-pool range ids) from arbitrary views in the
canvas.

Entities are fetched with the correct offset from the pool entities.
2023-01-21 03:26:02 +09:00
Bill Currie
1c368724e8 [gib] Fix an struct forward declaration 2023-01-21 02:30:26 +09:00
Bill Currie
32cead5f88 [ui] Add a function to create a new canvas entity
The entity has only a canvas component and (root) view component
attached. The plan is to use it for screen-space canvases.
2023-01-20 15:57:29 +09:00
Bill Currie
873d400766 [scene] Remove scene_resources_t struct
It was made unnecessary by the ECS changes.
2023-01-20 15:53:51 +09:00
Bill Currie
68c7003991 [console] Separate loading and initialization
This will make it easy for client code to set up data needed by the
console before the console initializes. It already separates console
cvar setup and initialization, which has generally been a good thing.
2023-01-20 13:27:17 +09:00
Bill Currie
ae0b781818 [vulkan] Implement water warp
The separated output pass made the implementation very easy, as did
having most of the parts already in place.
2023-01-19 23:05:06 +09:00
Bill Currie
07d5749a4e [renderer] Make the core of SCR_UpdateScreen dynamic
This is a bit of a hack to allow me to work on vulkan's screen update
"pipeline" without having to mess with the other renderers, since it
turns out they're (currently) fundamentally incompatible.
2023-01-19 11:10:48 +09:00
Bill Currie
4e1ddaa964 [renderer] Add fitted pic rendering
The pic is scaled to fill the specified rect (then clipped to the
screen (effectively)). Done just for the console background for now, but
it will be used for slice-pics as well.

Not implemented for vulkan yet as I'm still thinking about the
descriptor management needed for the instanced rendering.

Making the conback rendering conditional gave an approximately 3% speed
boost to glsl with the GL stub (~12200fps to ~12550fps), for either
conback render method.
2023-01-17 11:33:47 +09:00
Bill Currie
31c1420682 [client] Further decouple screen and console
The wording might seem a little odd, but cl_screen is really the full 2D
client HUD while the console is completely independent of the client and
shouldn't know that the client even exists. Ideally, the resize events
would be handled by the canvas system, to which end this is a small
step.
2023-01-16 13:29:20 +09:00
Bill Currie
8833518826 [ecs] Support sorting subpools
Sorting the whole pool when subpools are in use could break the
subpools (very high probability, depending on the sort criteria and
subpool criteria).
2023-01-16 11:32:12 +09:00
Bill Currie
c8afad4d3d [vulkan] Make QFV_PacketCopyBuffer take destination offset
It's useful being able to update a subregion of a buffer (needed for the
quad drawing changes).
2023-01-11 11:34:22 +09:00
Bill Currie
b310ece7bd [vulkan] Clean up draw a little bit
It's just removing some functions that will never be implemented, and an
unnecessary field.
2023-01-09 13:31:53 +09:00
Bill Currie
b5912bba9b [ui] Clean up the canvas component
It turns out only the range ids are needed in the canvas component at
this stage, and moving the canvas system base into canvas_system_t makes
sense.
2022-12-21 01:54:10 +09:00
Bill Currie
6decbd18c4 [ui] Add a canvas system
This is the beginning of supporting 2d rendering in 3d space. The idea
is that a canvas can be in 2d orthographic space (not attached to any
entity with a 3d transform), or in 3d perspective space (attached to an
entity with a 3d transform, either as a child of the camera, or of some
object in 3d space).

It will replace the current HUD code when it's working.
2022-12-20 19:45:48 +09:00
Bill Currie
3a2877dd9a [ecs] Adjust subpool range type to return start,end
I found I needed the subrange start as well as the end, but I liked that
the subpools themselves used only the end of the range, so switching to
just a unint32_t for the value and adding a function to return a tuple
made sense. I had kept the struct because I thought I might want to
store additional information (eg, the entity "owning" the subpool), but
found that I didn't need such information as the systems using subpools
that way would have access to the entity by other means.

Interestingly, the change found a bug in subpool creation: I really
don't know why things worked before, but they work better now :)
2022-12-20 17:56:08 +09:00
Bill Currie
d67b8cdf05 [ecs] Add support for subpools
Subpools are for grouping components by some criterion. Any component
that has a rangeid callback will be grouped with other components that
return the same render id. Note that the ordering of components within a
group will be affected by adding a component into a group that comes
before that group (or removing a component).

Component pools can have multiple groups, added and removed dynamically,
but removing a group should (currently) be done only when empty.
2022-12-18 21:11:21 +09:00
Bill Currie
24a85dbadc [ui] Add a component set for passage hierarchy refs
While "set" is a tad strong (there's just the one component for now), I
had missed the changes when adding ECS systems. Fixes the segfault at
the end of demo1 (ie, when any center text is printed).
2022-12-16 18:12:38 +09:00
Bill Currie
41d25df0d2 [ui] Attach text views to passage entities
Instead of creating new entities for the text views. This approximately
halves the number of entities required to display flowed text, but also
tests the ability to have an entity in multiple hierarchies (the goal of
the ECS component and system changes).
2022-12-14 22:38:37 +09:00
Bill Currie
fdc0dba58b [ecs] Add a "system" stuct for parameter passing
The system struct bundles the registry and component base together,
making it easier to reuse systems in multiple registries, or really,
easier to separate one set of ECS system components from those of other
systems.
2022-12-14 22:28:45 +09:00
Bill Currie
b230fe18ce [ecs] Split component registration from pool creation
While this does require an extra call after registering components, it
allows for multiple component sets (ie, sub-systems) to be registered
before the component pools are created. The base id for the registered
component set is returned so it can be passed to the subsystem as
needed.
2022-12-13 22:58:44 +09:00
Bill Currie
3c4dccf801 [ecs] Organize headers and code
There's now a main ecs.h file that includes the sub-system headers,
removing the need to explicitly include several header files, but the
sub-systems are a less cluttered.
2022-12-13 15:31:35 +09:00
Bill Currie
1a56376f98 [scene,ui] Be more consistent with component enum names
Actual registry component counts are *_comp_count while hierarchy type
component counts are *_type_count.
2022-12-12 13:37:01 +09:00
Bill Currie
bb677a1a7c [ecs] Move href_comp into hierarchy_t
This means that the component id used for hierarchy references must be
passed to Hierarchy_New and Hierarchy_Copy, but does all an entity to
have more than one hierarchy, which is useful for canvases (hierarchies
of views) in the 3d world (the canvas root would have a 3d hierarchy
reference and a 2d (view) hierarchy reference).
2022-12-12 00:20:20 +09:00
Bill Currie
5668006087 [renderer] Replace Draw_FontString with Draw_Glyph
While Draw_Glyph does draw only one glyph at a time, it doesn't shape
the text every time, so is a major win for performance (especially
coupled with pre-shaped text).
2022-12-10 18:55:08 +09:00
Bill Currie
d98eb8abc6 [ui] Add support for setting text attributes
Font cannot be overridden yet, but script attributes (language, script
type, direction) and features can be set at all three levels in a
passage. Attributes on the root level act as defaults for the paragraph
and word levels, and paragraph attributes act as defaults for the word
level.
2022-12-09 18:46:26 +09:00
Bill Currie
b93ab95c47 [ruamoko] Add some builtins for passages and text
Just some basic implementation so I can test shaping of passage text.
2022-12-09 15:18:47 +09:00
Bill Currie
5fd510ade4 [ui] Add font to renderer when loading
This causes some problems with linking if libQFgui is linked with
libQFrenderer (which is necessary in the long run), but it seems
everything gets away with it for now (which, tbh, I don't like).
2022-12-08 16:57:45 +09:00
Bill Currie
95f55dfc34 [ui] Move text handling into gui lib
And add a function to process a passage into a set of views with glyphs.
The views can be flowed: they have flow gravity and their sizes set to
contain all the glyphs within each view (nominally, words). Nothing is
tested yet, and font rendering is currently broken completely.
2022-12-08 15:33:50 +09:00
Bill Currie
136bf882f6 [ui] Move font loading into new gui library
Font and text handling is very much part of user interface and at least
partially independent of rendering, but does fit it better with GUI than
genera UI (ie, both graphics and text mode), thus libQFgui as well as
libQFui are built in the ui directory.

The existing font related builtins have been moved into the ruamoko
client library.
2022-12-07 17:38:38 +09:00
Bill Currie
46967dbc05 [glsl] Implement font rendering
It's not the best code, but it does the job of getting the basics
working.
2022-12-06 01:18:01 +09:00
Bill Currie
022c49035f [gl] Add a function to load a tex_t image
In theory, it supports all the non-palette formats, but only luminance
and alpha (tex_l and tex_a) have been tested. Fixes the rather broken
glyph rendering.
2022-12-05 13:35:44 +09:00
Bill Currie
8e1bf69d5d [scene] Correct the calculation of world scale
World scale can only be approximate if non-uniform scales and
non-orthogonal rotations are involved, but it is still useful
information sometimes.

However, the calculation is expensive (needs a square root), so remove
world scale as a component and instead calculate it on an as-needed
basis because it is quite expensive to do for every transform when it is
used only by the legacy-GL alias model renderer.
2022-12-05 09:45:13 +09:00
Bill Currie
7c4ee70d9e [build] Fix windows builds
More bitrot.
2022-12-02 17:33:26 +09:00
Bill Currie
99b568c208 [build] Fix distcheck once again
Probably the hardest part of QF to maintain.
2022-12-02 17:10:04 +09:00
Bill Currie
17c3f12ba2 [vulkan] Add a cvar for oit fragment buffer size
My laptop can't have a buffer larger than 128MB, but 16M fragments wants
512MB. Also, someone running at 4k will probably want a larger buffer.
2022-12-02 13:34:33 +09:00
Bill Currie
1d84d54509 [vulkan] Add cvars to control vulkan 3d frame buffer size
Thanks to the 3d frame buffer output being separate from the swap chain,
it's possible to have a different frame buffer size from the window
size, allowing for a smaller buffer and thus my laptop can cope (mostly)
with the vulkan renderer.
2022-12-02 13:17:07 +09:00
Bill Currie
958b6ff1d8 [glsl] Implement line graph drawing
Finally :/
2022-12-02 10:51:41 +09:00
Bill Currie
966ef949c5 [vulkan] Move oit blending into compose subpass
I had debated putting the blending in the compose subpass or a separate
pass but went with the separate pass originally, but it turns out that
removing the separate pass gains 1-3% (5-15/545 fps in a timedemo of
demo1).
2022-12-01 23:03:55 +09:00
Bill Currie
00cade072c [vulkan] Implement order implement transparency
It's a bit flaky for particles, especially at higher frame rates, but
that's due to supporting only 64 overlapping pixels. A reasonable
solution is probably switching to a priority heap for the "sort" and
upping the limit.
2022-12-01 03:00:47 +09:00
Bill Currie
30b38d7f3f [vulkan] Implement particle rendering
They sort of kind of maybe try to work, but there's plenty wrong. I
suspect synchronization and probably other factors.
2022-11-28 10:21:20 +09:00
Bill Currie
d9b0ee22e6 [vulkan] Get particle compute pipelines running
I don't yet know whether they actually work (not rendering yet), but the
system isn't locking up, and shutdown is clean, so at least resources
are handled correctly.
2022-11-28 00:52:07 +09:00
Bill Currie
85d40123e7 [vulkan] Remove depth pass from 2d rendering
I realized afterwards it wasn't really want I want as it would mess with
things like water warp and other effects.
2022-11-27 00:35:38 +09:00
Bill Currie
3360578875 [vulkan] Rework render pass setup
This splits up render pass creation so that the creation of the various
resources can be tailored to the needs of the actual render pass
sub-system. In addition, it gets window resizing mostly working (just
some problems with incorrect rendering).
2022-11-26 23:26:35 +09:00
Bill Currie
87f99f9081 [vulkan] Limit shadow textures to 32
This is the minimum maximum count for sampled images, and with layered
shadow maps (with a minimum of 2048 layers supported), that's really way
more than enough.
2022-11-25 13:35:07 +09:00
Bill Currie
d673887bf1 [vulkan] Get two render pass rendering working
Things are a bit of a mess with interdependence between sub-module
initialization and render pass initialization, and window resizing is
broken, but the main render pass rendering to an image that is then
post-processed (currently just blitted) is working. This will make it
possible to implement fisheye and water warp (and other effects, of
course).
2022-11-25 11:07:08 +09:00
Bill Currie
7f25c43472 [vulkan] Make script support objects more private
This will help keep changes to the scripting system localized once
things are further cleaned up.
2022-11-24 23:44:07 +09:00
Bill Currie
2cee2f2ab8 [vulkan] Add a module to handle output
When working, this will handle the output to the swap-chain images and
any final post-processing effects (gamma correction, screen scaling,
etc). However, currently the screen is just black because the image
for getting the main render pass output isn't hooked up yet.
2022-11-22 17:47:36 +09:00
Bill Currie
0a3417d38e [vulkan] Add support for code-only render passes
Still very preliminary, but it allows for CPU-only passes to be added to
the tasks run for each frame.
2022-11-22 13:25:09 +09:00
Bill Currie
aac4c6ef7a [vulkan] Get multiple frame buffers working
Now each (high level) render pass can have its own frame buffer. The
current goal is to get the final output render pass to just transfer the
composed output to the swap chain image, potentially with scaling (my
laptop might be able to cope).
2022-11-21 17:25:55 +09:00
Bill Currie
82d1a6e6cd [vulkan] Do a depth pass for 2d objects
While the HUD and status bar don't cut out a lot of screen (normally),
they might start to make a difference when I get transparency working
properly. The main thing is this is a step towards pulling the 2d
rendering into another render pass so the main deferred pass is
world-only.
2022-11-21 02:29:03 +09:00
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
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
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
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
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
88e59e72c4 [scene] Make nullentity's id nullent
While an entity with a null registry is null regardless of the id,
setting the id to nullent is useful for other purposes.

Fixes the disappearing brush models in the vulkan renderer (it uses
entity id + 1 for indexing), and prevents similar issues in the future.
2022-11-13 14:35:47 +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
9bf506fec6 [ui] Implement View_Delete
As per the pre-ECS view code, the entire sub-hierarchy of views is
deleted along with the parent view.
2022-11-08 00:20:02 +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
57cd30fca3 [ecs] Move parent setting logic into hierarchy
It should have always been here, but when I first created the hierarchy
and transform objects, I didn't know where things would go. Having two
chunks of code for setting an entity's parent was too already too much,
and I expect to have other hierarchy types. Doesn't fix the issues
encountered with sbar, of course.
2022-11-05 17:54:49 +09:00
Bill Currie
472b6995b7 [ui] Set passage text object start and size
The text object covering the whole passage was not being initialized,
thus center print tried to print rubbish when (incorrectly) printing the
entire message.
2022-11-04 15:26:01 +09:00
Bill Currie
1d51c05f90 [ui] Make passage objects reusable
I had intended to do this for a while, but now that I want it for center
print strings, it was time to make the change.
2022-11-04 13:06:20 +09:00
Bill Currie
99e12872e5 [console] Get menu rendering working again
For certain values of working. The whole thing needs a rewrite but it's
nice that using an ECS doesn't force everything to conform to that
model.
2022-11-04 10:38:07 +09:00
Bill Currie
6b99697e82 [ui] Get flowed views working with ECS
I'm not particularly happy with the way onresize is handled, but at this
stage a better way of dealing with resizing views and getting the child
views to flow correctly hasn't come to mind. However, the system should
at least be usable.
2022-11-04 00:29:13 +09:00
Bill Currie
82d407e3c2 [nq] Get hud time and fps displays working
This includes moving the related cvars from botn nq and qw into the
client hud code. In addition, the hud code supports update and
update-once function components. The update component is for updates
that occur every frame, but update-once components (not used yet) are
for one-shot updates (eg, when a value updates very infrequently).
2022-11-03 14:46:44 +09:00
Bill Currie
817aeb334e [ui] Convert view_t to an ECS entity
Much of the nq/qw HUD system is quite broken, but the basic status bar
seems to be working nicely. As is the console (both client and server).
Possibly the biggest benefit is separating the rendering of HUD elements
from the updating of them, and much less traversing of invisible views
whose only purpose is to control the positioning of the visible views.

The view flow tests are currently disabled until I adapt the flow code
to ECS.

There seems to be a problem with view resizing in that some gravities
don't follow resizing correctly.
2022-11-01 00:40:52 +09:00
Bill Currie
cf911884c6 [ecs] Add support for sorting component pools
As the bookkeeping data is spread between three arrays, sorting a
component pool is not trivial and thus not something to duplicate around
the codebase.
2022-10-31 13:10:53 +09:00
Bill Currie
962319af09 [ecs] Make Ent_HasComponent more robust
It doesn't check that the entity itself is valid, but it does at least
check that the index fetched from the sparse array is valid. Fixes a
segfault when a valid entity never had the component.
2022-10-31 13:06:55 +09:00
Bill Currie
7c06012383 [util] Support custom swap function for heapsort
Sorting ECS component pools needs to swap multiple chunks of data for
each element being swapped, so the standard swap function isn't enough.
2022-10-31 10:52:03 +09:00
Bill Currie
45e47a6df0 [ui] Update passage code to use an ECS hierarchy
It's not quite complete in that entities need to be created for the
objects, and passage text object might get additional components in the
hierarchy, but the direct use of views has been replaced by the use of a
hierarchy object with the same tree structure, and now has text objects
for paragraphs and the entire passage.
2022-10-27 19:47:10 +09:00
Bill Currie
fa057cb121 [vulkan] Record resource memory size
It's useful mainly for information reports, but might be useful
elsewhere.
2022-10-27 11:32:00 +09:00
Bill Currie
6952f6860d [vulkan] Use the resource functions for shadow maps
Another step towards moving all resource creation into the one place.
The motivation for doing the change was getting my test scene to work
with only ambient lights or no lights at all.
2022-10-27 11:02:45 +09:00
Bill Currie
db7f8a461e [ecs] Move ECS core into its own library
While the libraries are probably getting a little out of hand, the
separation into its own directory is probably a good thing as an ECS
should not be tied to scenes. This should make the ECS more generally
useful.
2022-10-26 17:24:03 +09:00
Bill Currie
4df145d76a [scene] Improve entity component check
For a component to be on an entity, the entity id in the component
pool's dense array must match the entity.
2022-10-26 12:34:09 +09:00
Bill Currie
20c861027e [sw] Take advantage of the ECS for edge rendering
This fixes the segfault due to the world entity not actually existing,
without adding a world entity. It takes advantage of the ECS in that the
edge renderer needs only the world matrix, brush model pointer, and the
animation frame number (which is just 0/1 for brush models), thus the
inherent SOA of ECS helps out, though benchmarking is needed to see if
it made any real difference.

With this, all 4 renderers are working again.
2022-10-25 19:36:09 +09:00
Bill Currie
2a9fcf4f5f [renderer] Tidy up entity component access
Since entity_t has a pointer to the registry owning the entity, there's
no need to access a global to get at the registry. Also move component
getting closer to where it's used.
2022-10-25 12:53:30 +09:00
Bill Currie
5b0810f4c2 [scene] Make Ent_AddComponent more raw
It no longer initializes the new component. For that, use
Ent_SetComponent which will copy in the provided data or call the
component's create function if the data pointer is null (in which case,
Ent_SetComponent acts as Ent_SetComponent used to).
2022-10-25 11:41:14 +09:00
Bill Currie
8acd5c558b [scene] Make entity_t just an entity id for ECS
This puts the hierarchy (transform) reference, animation, visibility,
renderer, active, and old_origin data in separate components. There are
a few bugs (crashes on grenade explosions in gl/glsl/vulkan, immediately
in sw, reasons known, missing brush models in vulkan).

While quake doesn't really need an ECS, the direction I want to take QF
does, and it does seem to have improved memory bandwidth a little
(uncertain). However, there's a lot more work to go (especially fixing
the above bugs), but this seems to be a good start.
2022-10-23 22:24:36 +09:00
Bill Currie
de786ce197 [scene] Use hierref_t instead of transform_t in hierarchy
Hierarchies are now much closer to being more general in that they are
not tied to 3d transforms. This is a major step to moving the whole
entity/transform system into an ECS.
2022-10-22 13:04:07 +09:00
Bill Currie
b607fe0878 [scene] Add has/get component functions
And define nullent as 0 is a valid entity.
2022-10-21 19:12:20 +09:00
Bill Currie
06ccc3023b [scene] Start work on a full-on ECS system
That does feel a little redundant, but I think the System in ECS is
referring to the systems that run on the components, while the other
system is the support code for the ECS. Anyway...

This is based heavily on the information provided by @skipjack in his
github blog about EnTT. Currently, entity recycling and sparse arrays
for component pools have been implemented, and adding components to an
entity has been tested.
2022-10-16 18:29:25 +09:00
Bill Currie
0c54b0652b Abandon support for clang
The inconsistencies in clang's handling of casts was bad enough, and its
silliness with certain extensions, but discovering that it doesn't
support raw strings was just too much. Yes, it gives a 3s boost to qfvis
on gmsp3v2.bsp, but it's not worth the hassle.
2022-10-16 18:02:25 +09:00
Bill Currie
8ec4a18f5d [scene] Swtich from - to ~ for entity id index
It saves only 1 bit in the set, but it could save on allocations. Also
takes care of a FIXME :P
2022-10-15 14:48:39 +09:00
Bill Currie
6552d76a5f Clarify FIXME on qdefs.h include 2022-10-15 14:42:04 +09:00
Bill Currie
2c9da25e17 Clean up some FIXMEs and XXXs
They seemed to be generally unnecessary. Also fixes some typos in
related comments.
2022-10-15 14:40:29 +09:00
Bill Currie
8464d71264 [scene] Move hierarchies to an ECS-based system
This is the beginning of adding ECS to QF. While the previous iteration
of hierarchies was a start in the direction towards ECS, this pulls most
of the 3d-specific transform stuff out of the hierarchy "objects",
making all the matrices and vectors/quaternions actual components (in
the ECS sense). There's more work to be done with respect to the
transform and entity members of hierarchy_t (entity should probably go
away entirely, and transform should become hierref_t (or whatever its
final name becomes), but I wanted to get things working sooner than
later.

The motivation for the effort was to allow views to use hierarchy_t,
which should be possible once I get entity and transform sorted out.

I am really glad I already had automated tests for hierarchies, as
things proved to be a little tricky to get working due to forgetting why
certain things were there.
2022-10-10 02:00:33 +09:00
Bill Currie
f16fc15605 [scene] Correct some typos in hierarchy.h
Lost the y somewhere
2022-10-09 01:08:48 +09:00
Bill Currie
c9e7810864 [vulkan] Add resource memory offset to qfv_resobj_s
Its value on input is ignored. QFV_CreateResource writes the resource
object's offset relative to the beginning of the shared memory block.
Needed for the Draw overhaul.
2022-10-03 09:14:29 +09:00
Bill Currie
c028e15943 [vulkan] Add a couple of staging helper functions
I got tired of writing the same 13 or so lines of code over and over (it
actually put me off experimenting with Vulkan). Thus...

QFV_PacketCopyBuffer does the work of handling barriers and a (full
packet) copy from the staging buffer to a GPU buffer.

QFV_PacketCopyImage does a similar job, but for images. However, it
still needs a lot of work, but it does make getting a basic texture onto
the GPU much less of a hassle.

Both functions should make staging data much less error-prone.
2022-10-03 09:09:34 +09:00
Bill Currie
51b73eee73 [renderer] Add fontid to Draw_AddFont and Draw_FontString
It's not used yet, but the vulkan draw implementation will eventually
support multiple fonts being loaded (and rendered at a time).
2022-10-03 09:01:54 +09:00