A Book "Renderable" System
hammy275 opened this issue ยท 3 comments
Would be a refactor of the written book Immersive.
The idea is that the builder system is given a list of "renderables" and a list of BoundingBox
es, in some abstracted coordinate system, then the "builder" would do the actual hard work of putting it on the page.
Besides the details of course, I still need to think on how page turning would work.
This would serve to make things like #164 and #343 easier to implement.
Not a fan of the builder system here, as that seems overly-complex. I do think genericizing things to a "Renderable" system is good, though.
So as it turns out, my book code is an absolute mess, and it basically needs a rewrite for this system to work. As a bonus, the lectern is unique among Immersives from the fact that it runs ticking code server-side to show Immersive interactions to other players while still also doing custom rendering, which no other Immersive actually does.
BookInteractable
Holds information for an individual element that has an interactable hitbox for a book.
getOBB(ClientBookData data, PosRot hand, PosRot other)
: Get the OBB for this book interactable.onInteract(ClientBookData data, PosRot hand, PosRot other)
: Called when this OBB is interacted with. Only one interaction can happen, and this is intentionally called after completing iteration of allBookInteractables
in-case the list ofBookInteractable
s needs updating.
BookRenderable
Holds information for rendering in the book. The PoseStack
work has been done for handling rotation before this is called.
renderLeft(PoseStack stack, ClientBookData data, PosRot hand, PosRot other)
: Function called to render the left page.renderRight(PoseStack stack, ClientBookData data, PosRot hand, PosRot other)
: Function called to render the right page.
CommonBookData
Holds the data relevant to a book both server-side and client-side. Handles page turning.
ClientBookData extends CommonBookData
Holds the data relevant to a book client-side. Handles everything in CommonBookData
, BookInteractables
s, and rendering (including BookRenderable
s).