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

◆ create() [2/2]

template<typename T >
Mapped< T > MayaFlux::Portal::Forma::create ( Surface &  surface,
Geometry::Form< T >  form,
T  initial,
std::function< float(T)>  project = {} 
)

Realize a Form on surface.

Builds a buffer of its own and draws the Form as a slice of it with the Form's topology, registers the element, syncs so the geometry function's bounds_hint and contains reach the Layer before the first frame, then runs the Form's interaction wiring.

A bare GeometryFn converts to a Form, so this also serves as the simplest element construction path for a caller's own geometry.

Template Parameters
TMappedState value type.
Parameters
surfaceCanvas to register on.
formGeometry, topology and interaction.
initialStarting value written into MappedState.
projectOptional T to float projection for outbound readers.
Returns
Fully constructed Mapped<T>, wired.

Definition at line 64 of file Tend.hpp.

68 {})
69{
70 auto mapped = internal::atelier().create_element<T>(
71 surface, std::move(form.geometry), std::move(initial),
72 form.topology, std::move(project));
73
74 if (form.wire)
75 form.wire(surface.ctx(), mapped.element.id, mapped.state);
76
77 return mapped;
78}
GeometryFn< T > geometry
Writes vertex bytes for the current value.
Definition Geometry.hpp:85
std::function< void(Context &, uint32_t, std::shared_ptr< MappedState< T > >)> wire
Registers interaction against the realized element.
Definition Geometry.hpp:100
Graphics::PrimitiveTopology topology
Topology matching the vertex kind geometry writes.
Definition Geometry.hpp:88