MayaFlux 0.4.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 143 of file Mapped.hpp.

147{
148 auto st = std::make_shared<MappedState<T>>();
149 st->write(initial);
150
151 Element el;
152 el.buffer = std::move(buffer);
153
154 Mapped<T> m;
155 m.state = std::move(st);
156 m.geometry_fn = std::move(geometry);
157 m.element = std::move(el);
158 m.last_version = static_cast<Version>(-1);
159 return m;
160}
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.