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

◆ create() [1/2]

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

Realize a Form on surface as a slice of batch.

Like create(), but the element draws into a slice of the shared buffer instead of a buffer of its own, with the Form's topology. Make the buffer with create_buffer() and pass it to every Form that should draw together; the Form's capacity is not used, the batch grows. A Form that needs its own buffer, such as one scissored by a Scrollable, uses create() instead.

Template Parameters
TMappedState value type.
Parameters
surfaceCanvas to register on.
batchShared buffer from create_buffer().
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 28 of file Tend.hpp.

33 {})
34{
35 auto mapped = internal::atelier().create_element<T>(
36 surface, FormaTarget::slice_of(batch, form.topology),
37 std::move(form.geometry), std::move(initial), std::move(project));
38
39 if (form.wire)
40 form.wire(surface.ctx(), mapped.element.id, mapped.state);
41
42 return mapped;
43}
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