Commit graph

2205 commits

Author SHA1 Message Date
Bill Currie
3b0dcd2cdc [vulkan] Connect the shadow pass to the renderers
It's only partially complete, but R_VisitWorldNodes is now run for both
the main pass and the shadow auxiliary pass.
2023-07-27 16:09:33 +09:00
Bill Currie
123bf14784 [scene] Add a leaf component to lights
Regular leaf number for positional lights, 0 for directional, and ~0 for
ambient.
2023-07-27 15:50:53 +09:00
Bill Currie
6c631693bd [vulkan] Clean out old command buffers from bsp
Missed from the render job cleanup.
2023-07-24 19:13:43 +09:00
Bill Currie
f4d6a41901 [vulkan] Hook up a shadow render job step
It doesn't do much yet, but did help in getting light ids working.
2023-07-24 19:13:43 +09:00
Bill Currie
05f0fe9204 [scene] Add a render-internal lightid component
The vulkan shadow code needs to associate extra information with the
lights, but I don't want such renderer-specific data in the scene.
2023-07-24 19:11:18 +09:00
Bill Currie
31cf3ed248 [vulkan] Register external attachments
This is along the lines of what I originally intended, but now I need
more than just the swapchain (which is now registered by vulkan_output).
2023-07-24 19:11:18 +09:00
Bill Currie
72f6048a20 [scene] Put lights into the bsp tree via efrags
This eliminates the O(N^2) (N = map leaf count) operation of finding
visible lights and will later allow for finer culling of the lights as
they can be tested against the leaf volume (which they currently are
not as this was just getting things going). However, this has severely
hurt ad_tears' performance (I suspect due to the extreme number of
leafs), but the speed seems to be very steady. Hopefully, reconstructing
the vis clusters will help (I imagine it will help in many places, not
just lights).
2023-07-22 17:53:07 +09:00
Bill Currie
99c6c58e25 [vulkan] Expose pipeline disable controls
Finally, runtime control of the debug pipelines (and all the rest, but
that might come in handy at some stage).
2023-07-21 19:45:54 +09:00
Bill Currie
a9fb1e5720 [ui] Remove IMUI_FlexibleSpace prototype
The function doesn't exist and likely never will.
2023-07-21 12:35:56 +09:00
Bill Currie
fde1ef0159 [vulkan] Add infinite plane rendering
The grid calculations are modified from those of Inigo Quilez
(https://iquilezles.org/articles/filterableprocedurals/), but give very
nice results: when thin enough, the lines fade out nicely instead of
producing crazy moire patterns. Though currently disabled, the default
planes are the xy, yz and zx planes with colored axes.
2023-07-21 11:59:25 +09:00
Bill Currie
6e9f50ffe4 [vid] Ensure window size gets sent after init
This fixes a pile of window size related issues I've seen for a while,
but most importantly, some nastiness with division by 0 and segfaults.
2023-07-14 11:57:36 +09:00
Bill Currie
bf3d57cdbf [ui] Return whether events to imui were consumed
Needed for non-ui handling of events (eg, mouse interaction with the
main screen).
2023-07-14 11:25:50 +09:00
Bill Currie
21a9cbc61b [ui] Implement a basic menu system
Menus within menu contexts automatically create menu items for the
sub-menu, and menus collapse when leaf menus are select.
2023-07-13 23:16:26 +09:00
Bill Currie
a6fa10b24d [vulkan] Show timings for the job and steps
No real surprises anywhere other than how long things can take at random
times.
2023-07-13 18:33:31 +09:00
Bill Currie
9289e26211 [vulkan] Add a very simple job window
It shows the list of steps in the render job, but acts as something for
testing.
2023-07-13 15:41:49 +09:00
Bill Currie
1490379c04 [renderer] Add a debug_ui render function
The idea is the UI system can call into the renderer without knowing
anything about the renderer, and the renderer can do what it pleases to
create UI elements in the correct context (passes as a parameter).
2023-07-13 14:22:31 +09:00
Bill Currie
6d7e1064ec [ui] Support anchoring and extending panels
Panels can be anchored to a widget in another hierarchy, allowing for
things like cascading menus. They can also be extended via referencing
them by name, allowing for subsystems to add items to an already panel
(eg, extending a menu).
2023-07-13 14:22:31 +09:00
Bill Currie
1404b85846 [ui] Give panels/windows a group offset
This allows for finer control of render order and thus layering (will be
important for menus).
2023-07-12 10:17:43 +09:00
Bill Currie
d0d39ecee0 [renderer] Allow the camera to be overridden
Necessary for a debug camera.
2023-07-12 00:47:40 +09:00
Bill Currie
4522264c57 [ui] Fix an include order issue
Concrete sized arrays need concrete types.
2023-07-11 12:04:32 +09:00
Bill Currie
1b89598b28 [renderer] Clean up SCR_UpdateScreen a little
SCR_UpdateScreen_Legacy now takes only the screen functions pointer (it
didn't need camera or realtime), and the camera sizzle code has been
moved into one place to make cleaning it up easier (when I get around to
auditing AngleVectors etc).
2023-07-11 11:41:14 +09:00
Bill Currie
24b5066760 [ui] Implement panel widgets and use for windows
The intent is to use them for menus, tooltips and anything else along
those lines, but windows was a good starting point (and puts a border
along the top of the window too).
2023-07-11 10:04:07 +09:00
Bill Currie
48cc4db45d [ui] Give windows a small border
It's currently hard-coded to black, but it makes the windows much easier
to see when overlapping.
2023-07-10 22:10:04 +09:00
Bill Currie
4e7bd11415 [build] Clean up make distcheck issues 2023-07-10 11:12:22 +09:00
Bill Currie
79e4a5f6a8 [ui] Add the concept of draw order to canvases
Canvas draw order is sorted by group then order within the group. As a
fallback, the canvas entity id is used to keep the sort stable, but
that's only as stable as the ids themselves (if the canvases are
destroyed and recreated, the ids may switch around).
2023-07-09 23:27:26 +09:00
Bill Currie
c2d68f5495 [ui] Avoid creating a subpool for the canvas component
It's never used and just not needed.
2023-07-09 22:22:05 +09:00
Bill Currie
f359f47e54 [ui] Add a formatted label (like printf)
Formatted printing is just too handy, and having to use va all the time
is a bit of a pain.
2023-07-09 12:10:28 +09:00
Bill Currie
a8b80c4be5 [ui] Delete subpools when a canvas is deleted
Yet another finger in the memory dyke.
2023-07-09 12:06:08 +09:00
Bill Currie
ad9e85b8d4 [ui] Access the canvas visibility flag safely
That wasn't so well thought out as adding fields before the flag made
for some rather interesting behavior.
2023-07-09 11:49:05 +09:00
Bill Currie
bf05da26cc [ui] Make Canvas_SetLen operate on only one canvas
I plan on using sub-canvases to fix the imui window overlap issue and
don't want the windows being affected by (eg) hud canvas size changes.
2023-07-08 20:56:40 +09:00
Bill Currie
c32ffce886 [ecs] Add a function to move a subpool to be the last
This has use when the order of components in the pool affects draw order
(or has other significance), especially at the subpool level. I plan to
use it for fixing overlapping windows in imui.
2023-07-08 19:55:37 +09:00
Bill Currie
79ab2f7ba7 [ui] Add a shaped text cache system
Shaped text is cached using all the shaping parameters as well as the
text itself as a key. This makes text shaping a non-issue for imui when
the text is stable, taking my simple test from 120fps to 1000fps
(optimized build).
2023-07-08 11:15:51 +09:00
Bill Currie
0360e33a00 [ecs] Add "tree mode" to hierarchies
As I had long suspected, building large hierarchies is fiendishly
expensive (at least O(N^2)). However, this is because the hierarchies
are structured such that adding high-level nodes results in a lot of
copying due to the flattened (breadth-first) layout (which does make for
excellent breadth-first performance when working with a hierarchy).

Using tree mode allows adding new nodes to be O(1) (I guess O(N) for the
size of the sub-tree being added, but that's not supported yet) and
costs only an additional 8 bytes per node. Switching from flat mode to
tree mode is very cheap as only the additional tree-related indices need
to be fixed up (they're almost entirely ignored in flat mode). Switching
from tree to flat mode is a little more expensive as the entire tree
needs to be copied, but it seems to be an O(N) (size of the tree).

With this, building the style editor window went from about 25% to about
5% (and most of that is realloc!), with a 1.3% cost for switching from
tree mode to flat mode.

There's still a lot of work to do (supporting removal and tree inserts).
2023-07-07 14:42:49 +09:00
Bill Currie
d4b11923b9 [ui] Add inactive labels and a style api
Labels are always good and the style api allows pushing/popping and
modifying the current style.
2023-07-06 19:34:48 +09:00
Bill Currie
08cd03e632 [ui] Allow the parent layout rules to be modified
This makes it easy to control whether a window is a fixed size or fits
its children (or any other scheme, though those are the two most
likely).
2023-07-06 19:24:23 +09:00
Bill Currie
df40a50b91 [ui] Implement dragable collapsible windows
And of course, closable.
2023-07-06 12:21:14 +09:00
Bill Currie
a6e75b7617 [ui] Add a very basic style system
Nothing can be changed at the moment, but it actually looks a little
like a UI.
2023-07-06 01:27:46 +09:00
Bill Currie
b34d3cae91 [ui] Rename the imui size control enumerators
I didn't particularly like the "kind" in the name. I'm not super happy
with percent, but it will do for now.
2023-07-06 00:15:34 +09:00
Bill Currie
0fab830be6 [ui] Implement auto-expand layout
By default, horizontal and vertical layouts expand to fill their parent
in their on-axis direction (horizontally for horizontal layouts), but
fit to their child views in their off-axis.

Flexible space views take advantage of auto-expansion, pushing sibling
views such that the grandparent view is filled on the parent view's
on-axis, and the parent view is filled by the space in the parent view's
off-axis. Flexible views currently have a background fill, allowing them
to provide background filling of the overall view with minimal overdraw
(ancestor views don't need to have any fill at all).
2023-07-05 19:33:00 +09:00
Bill Currie
104fba13a6 [ui] Add a text color component
Despite the current rendering API taking only byte color, the component
holds a uint32_t to allow for rgba color when I figure out a suitable
API.
2023-07-04 17:17:16 +09:00
Bill Currie
6701f921a4 [ecs] Add a function to safely get a component
It returns null if the entity is invalid or doesn't have the component.
Useful when the component is optional.
2023-07-04 16:48:15 +09:00
Bill Currie
5000004f7d [util] Integrate sys_mem into the build
Nicely, all that was needed was a couple of includes and renaming the
functions.
2023-07-04 14:39:36 +09:00
Bill Currie
403cf72f52 [ui] Implement a layout stack and radio buttons
Also, remove an intermittent double free caused by deleting views that
have already been deleted.
2023-07-04 01:31:04 +09:00
Bill Currie
6fa016e23b [vulkan] Delay main render resizes by 2s
This makes window resizing a little more responsive (though it could be
better yet (maybe, could be an X11 limitation)).
2023-07-03 23:38:57 +09:00
Bill Currie
e37b477739 [ui] Implement checkbox
Simplistic, but it works. Also cleaned up some of the repetitive code.
2023-07-03 23:33:15 +09:00
Bill Currie
cd4791c5d3 [vulkan] Get window resize working again
The biggest change was splitting up the job resources into
per-render-pass resources, allowing individual render passes to
reallocate their resources without affecting any others. After that, it
was just getting translucency and capture working after a window resize.
2023-07-03 20:05:27 +09:00
Bill Currie
6d823cca84 [ui] Rebuild the hierarchy every frame
This takes care of element order stability. It did need reworking the
mouse tracking code (including adding an active flag to views), but now
buttons seem to work correctly.
2023-07-03 03:52:07 +09:00
Bill Currie
0b6e8b60bd [ecs] Add a component rotation function
This allows rotation of components within the array. I'm not sure if
it's what I want, but it was an interesting exercise anyway.
2023-07-03 01:40:26 +09:00
Bill Currie
1caa9ed8c3 [build] Ensure generated progs headers get installed 2023-07-02 17:23:44 +09:00
Bill Currie
e98cd1355d [ui] Implement auto-layout
TextContent seems redundant at this stage since a text view is always
sized to its content, and PercentOfParent doesn't work yet. Pixels
definitely works and Null seems to work in that it does no sizing or
positioning. Vertical layout is supported but not yet tested, similar
for ChildrenSum, but I can have two buttons side by side.
2023-07-02 15:04:22 +09:00