|
MayaFlux 0.4.0
Digital-First Multimedia Processing Framework
|
Two-way binding orchestrator for Forma elements. More...
#include <Bridge.hpp>
Collaboration diagram for MayaFlux::Portal::Forma::Bridge:Classes | |
| class | Binding |
| Non-owning handle for all bind/write/unbind operations on one element. More... | |
| struct | ElementRecord |
Public Member Functions | |
| template<typename T > | |
| Binding | at (const std::shared_ptr< MappedState< T > > &state) |
| Return a Binding handle resolved from a MappedState. | |
| Binding | at (uint32_t id) |
Return a Binding handle for the element registered under id. | |
| template<typename T > | |
| void | bind (std::shared_ptr< MappedState< T > > state, std::function< float()> source) |
| template<typename T > | |
| void | bind (std::shared_ptr< MappedState< T > > state, std::shared_ptr< Nodes::Node > node, std::function< float(double)> project={}) |
| void | bind (uint32_t id, std::function< float()> source) |
| Drive element value from an arbitrary per-frame callable. | |
| void | bind (uint32_t id, std::shared_ptr< Nodes::Node > node, std::function< float(double)> project={}) |
| Drive element value from a Node's output each frame. | |
| Bridge (Bridge &&)=delete | |
| Bridge (const Bridge &)=delete | |
| Bridge (Vruta::TaskScheduler &scheduler, Buffers::BufferManager &buffer_manager) | |
| Bridge & | operator= (Bridge &&)=delete |
| Bridge & | operator= (const Bridge &)=delete |
| template<typename T > | |
| void | register_element (Mapped< T > mapped, std::function< float(T)> project={}) |
| Register a fully constructed Mapped<T> and own its sync loop. | |
| template<typename T > | |
| void | register_element (std::shared_ptr< MappedState< T > > state, uint32_t id, std::shared_ptr< Buffers::FormaBuffer > buffer, std::function< float(T)> project={}) |
| Register a MappedState<T> so that MappedState overloads and outbound bindings can resolve to the correct element id and reader. | |
| void | spawn_sync (uint32_t id, std::function< void()> sync_fn) |
Spawn a per-frame GraphicsRoutine that calls sync_fn each tick. | |
| template<typename T > | |
| void | unbind (std::shared_ptr< MappedState< T > > state) |
| void | unbind (uint32_t id) |
| Cancel all inbound and outbound bindings for an element. | |
| template<typename T > | |
| void | write (std::shared_ptr< MappedState< T > > state, std::function< void(std::span< const float >)> sink) |
| template<typename T > | |
| void | write (std::shared_ptr< MappedState< T > > state, std::shared_ptr< Buffers::AudioWriteProcessor > target) |
| template<typename T > | |
| void | write (std::shared_ptr< MappedState< T > > state, std::shared_ptr< Buffers::DataWriteProcessor > target) |
| template<typename T > | |
| void | write (std::shared_ptr< MappedState< T > > state, std::shared_ptr< Buffers::VKBuffer > target_buffer, const std::string &shader_path, const std::string &descriptor_name, uint32_t binding_index, uint32_t set, Portal::Graphics::DescriptorRole role=Portal::Graphics::DescriptorRole::UNIFORM) |
| template<typename T > | |
| void | write (std::shared_ptr< MappedState< T > > state, std::shared_ptr< Buffers::VKBuffer > target_buffer, const std::string &shader_path, uint32_t offset, size_t size=sizeof(float)) |
| template<typename T > | |
| void | write (std::shared_ptr< MappedState< T > > state, std::shared_ptr< Nodes::Constant > node) |
| void | write (uint32_t id, const std::shared_ptr< Buffers::VKBuffer > &target_buffer, const std::string &shader_path, const std::string &descriptor_name, uint32_t binding_index, uint32_t set, Portal::Graphics::DescriptorRole role=Portal::Graphics::DescriptorRole::UNIFORM) |
Route element value to a descriptor binding on target_buffer. | |
| void | write (uint32_t id, const std::shared_ptr< Buffers::VKBuffer > &target_buffer, const std::string &shader_path, uint32_t offset, size_t size=sizeof(float)) |
| Route element value to a push constant slot on a ShaderProcessor. | |
| void | write (uint32_t id, std::function< void(std::span< const float >)> sink) |
| Route element bulk value to a caller-supplied sink each frame. | |
| void | write (uint32_t id, std::shared_ptr< Buffers::AudioWriteProcessor > target) |
| Route element value to an AudioWriteProcessor each frame. | |
| void | write (uint32_t id, std::shared_ptr< Buffers::DataWriteProcessor > target) |
| Route element value to a DataWriteProcessor each frame. | |
| void | write (uint32_t id, std::shared_ptr< Nodes::Constant > node) |
| Route element value into a Constant node via set_constant(). | |
| ~Bridge () | |
Private Member Functions | |
| void | cancel_inbound (ElementRecord &rec) |
| void | cancel_outbound (ElementRecord &rec) |
| std::string | make_task_name (uint32_t id, const char *suffix) const |
| void | spawn_inbound (uint32_t id, std::function< float()> source) |
Private Attributes | |
| Buffers::BufferManager & | m_buffer_manager |
| uint32_t | m_next_id { 0 } |
| std::unordered_map< uint32_t, ElementRecord > | m_records |
| Vruta::TaskScheduler & | m_scheduler |
Two-way binding orchestrator for Forma elements.
One Bridge instance serves the full application. It owns all inbound GraphicsRoutine tasks and all outbound FormaBindingsProcessor instances. Layer and Context are created via the Forma free functions and passed in — Bridge does not own or create them.
Inbound (what drives an element's MappedState each frame):
Outbound (where the element's value goes each frame):
All overloads also accept shared_ptr<MappedState<T>> in place of the element id. These resolve to the state->id. duplicated logic.
Usage:
Definition at line 65 of file Bridge.hpp.