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

◆ make_mapped()

template<typename T >
Mapped< T > MayaFlux::Portal::Forma::make_mapped ( initial,
GeometryFn< T >  geometry,
std::shared_ptr< Buffers::FormaBuffer buffer 
)

Construct a Mapped<T> with a freshly allocated MappedState.

Parameters
initialStarting value.
geometryGeometry function producing vertex bytes from a value.
bufferVKBuffer whose raw bytes the geometry function writes into.
Returns
Ready-to-use Mapped. Register element with a Layer before first sync().

Definition at line 154 of file Mapped.hpp.

158{
159 auto st = std::make_shared<MappedState<T>>();
160 st->write(initial);
161
162 Element el;
163 el.buffer = std::move(buffer);
164
165 Mapped<T> m;
166 m.state = std::move(st);
167 m.geometry_fn = std::move(geometry);
168 m.element = std::move(el);
169 m.last_version = static_cast<Version>(-1);
170 return m;
171}
uint64_t Version
Version counter incremented on every value write.
Definition Mapped.hpp:18
std::shared_ptr< Buffers::FormaBuffer > buffer
Buffer whose rendered output occupies this region.
Definition Element.hpp:72
A bounded, renderable region on a window surface.
Definition Element.hpp:58
std::shared_ptr< MappedState< T > > state
Shared value carrier. External systems hold a copy of this ptr.
Definition Mapped.hpp:91
GeometryFn< T > geometry_fn
Geometry regeneration function. Set once at construction.
Definition Mapped.hpp:94
Element element
The Element registered with the Layer.
Definition Mapped.hpp:98
Version last_version
Last version seen by sync().
Definition Mapped.hpp:102
Infrastructure for a continuously-mapped value whose GPU geometry tracks it.
Definition Mapped.hpp:89

References MayaFlux::Portal::Forma::Element::buffer, MayaFlux::Portal::Forma::Mapped< T >::element, MayaFlux::Portal::Forma::Mapped< T >::geometry_fn, MayaFlux::Portal::Forma::Mapped< T >::last_version, and MayaFlux::Portal::Forma::Mapped< T >::state.