Open HexyWitch opened 5 months ago
I will happily provide a PR for this if it's a desired change!
This addresses #17 as well but in a more general way that allows other rendering hooks. But the API is a bit more complex than the one proposed in that issue.
@HexyWitch We've been experimenting on this issue (perhaps not the approach described here, though) for wgpu over at https://github.com/automancy/yakui
Still not in a stage able to be extracted into a PR (we've been ironing out issues...) but worth looking at?
Motivation
Right now yakui really wants to manage its own meshes, textures, and paint calls. It would be useful to be able to hook an external renderer into yakui for custom widgets.
Use cases
API Proposal (rough)
Seeing yakui as primarily a layout engine and API for building UI, I think the right API for this is an extension API. Rather than packing more types of rendering and widget features into yakui itself.
In
PaintDom
addition toalso support
PaintCall
will then be restructured to include user calls:The existing render backends (
yakui-vulkan
,yakui-wgpu
) ignore any User calls for their standard paint methods and just draw internal ones, making the API change non-breaking and opt-in.An example of how
yakui-vulkan
would be extended to support user calls can look like:API Usage example
Short example of how the API would be used to render models with a separate renderer, using yakui-vulkan: