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

◆ create_element() [1/2]

template<typename T >
Mapped< T > MayaFlux::Portal::Forma::create_element ( Layer layer,
std::shared_ptr< Core::Window window,
GeometryFn< T >  geom,
initial,
Graphics::PrimitiveTopology  topology = Graphics::PrimitiveTopology::TRIANGLE_STRIP,
size_t  capacity = internal::k_capacity_bytes,
std::function< float(T)>  project = {} 
)

Build a FormaBuffer, register it, construct a Mapped<T>, and add the element to layer.

BufferManager is taken from the stored initialize() state. Returns the fully constructed Mapped<T>. The caller holds it. element.id is stable and can be passed to Context callbacks and Bridge.

Template Parameters
TMappedState value type: float, glm::vec2, etc.
Parameters
layerLayer to register the element on.
windowTarget window for rendering.
geomGeometry function producing vertex bytes from T.
initialStarting value written into MappedState.
topologyPrimitive topology for the FormaBuffer.
capacityInitial FormaBuffer capacity in bytes.
projectOptional T -> float projection for outbound readers.
Returns
Fully constructed Mapped<T> with element registered in layer.

Definition at line 245 of file Forma.hpp.

252 {})
253{
254 return internal::atelier().create_element<T>(
255 layer, std::move(window), std::move(geom), std::move(initial),
256 topology, capacity, std::move(project));
257}