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

◆ create_element() [2/2]

template<typename T >
Mapped< T > MayaFlux::Portal::Forma::create_element ( Surface &  surface,
GeometryFn< T >  geom,
T  initial,
Graphics::PrimitiveTopology  topology = Graphics::PrimitiveTopology::TRIANGLE_STRIP,
std::function< float(T)>  project = {} 
)

Build a FormaBuffer, register it, construct a Mapped<T>, add the element to surface's layer, and register it with the application Bridge.

Reads the layer and window from surface.

After registration, one sync() is run so that bounds_hint and contains populated by the geometry function are visible on the Element before the first frame. This removes the manual

layer->set_bounds(el.element.id, ...);
layer->set_contains(el.element.id, ...);

boilerplate seen at fader-style call sites: those values now arrive directly from the geometry function on construction. The geometry function remains the user's; the sync is the same one that runs every frame.

Template Parameters
TMappedState value type.
Parameters
surfaceCanvas to register the element on.
geomGeometry function producing vertex bytes from T.
initialStarting value written into MappedState.
topologyPrimitive topology for the FormaBuffer.
projectOptional T -> float projection for outbound readers.
Returns
Fully constructed Mapped<T> with element registered.

Definition at line 108 of file Tend.hpp.

113 {})
114{
115 return internal::atelier().create_element<T>(
116 surface, std::move(geom), std::move(initial), topology, std::move(project));
117}
PrimitiveTopology topology