MayaFlux 0.4.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ bind() [4/4]

void MayaFlux::Portal::Forma::Bridge::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.

Spawns a GraphicsRoutine that reads node->get_last_output() every tick, applies project, and writes into the element's MappedState. Node must be processed externally (EXTERNAL mode read). Replaces any existing inbound binding on this element.

Parameters
idElement id (from Layer::add / Mapped::element.id).
nodeNode to read from.
projectOptional double -> float projection. Identity if empty.

Definition at line 38 of file Bridge.cpp.

42{
43 auto reader = project
44 ? std::function<float()>([n = std::move(node), p = std::move(project)] {
45 return p(n->get_last_output());
46 })
47 : std::function<float()>([n = std::move(node)] {
48 return static_cast<float>(n->get_last_output());
49 });
50
51 spawn_inbound(id, std::move(reader));
52}

References spawn_inbound().

+ Here is the call graph for this function: