|
MayaFlux 0.4.0
Digital-First Multimedia Processing Framework
|
| Mapped< T > MayaFlux::Portal::Forma::create_element | ( | Surface & | surface, |
| GeometryFn< T > | geom, | ||
| T | initial, | ||
| Graphics::PrimitiveTopology | topology = Graphics::PrimitiveTopology::TRIANGLE_STRIP, |
||
| std::function< float(T)> | project = {} |
||
| ) |
Build a FormaBuffer, register it, construct a Mapped<T>, add the element to surface's layer, and register it with the application Bridge.
Surface-accepting overload of create_element. Reads the layer and window from surface; everything else matches the existing (Layer&, Window) overload.
After registration, one sync() is run so that bounds_hint and contains populated by the geometry function are visible on the Element before the first frame. This removes the manual
boilerplate seen at fader-style call sites: those values now arrive directly from the geometry function on construction. The geometry function remains the user's; the sync is the same one that runs every frame.
| T | MappedState value type. |
| surface | Canvas to register the element on. |
| geom | Geometry function producing vertex bytes from T. |
| initial | Starting value written into MappedState. |
| topology | Primitive topology for the FormaBuffer. |
| project | Optional T -> float projection for outbound readers. |
Definition at line 333 of file Forma.hpp.