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

◆ plot()

MAYAFLUX_API std::pair< Mapped< std::shared_ptr< Kakshya::PlotContainer > >, Surface > MayaFlux::Portal::Forma::plot ( std::string  title,
uint32_t  width,
uint32_t  height,
std::shared_ptr< Kakshya::PlotContainer container,
Plot::SeriesSpec  spec 
)

Create a live plot in a new window.

Creates the window, shows it, constructs the Surface, builds the FormaBuffer from the spec capacity and topology, and calls Plot::place. Returns the Mapped<shared_ptr<PlotContainer>> from Plot::place, plus the Surface owning the window and layer.

Parameters
titleWindow title.
widthWindow width in pixels.
heightWindow height in pixels.
containerReady PlotContainer from Plot::source().build().
specSeriesSpec from Plot::series()...done().
Returns
Pair of { Mapped<shared_ptr<PlotContainer>>, Surface } for the created plot.

Definition at line 107 of file Forma.cpp.

113{
114 const uint64_t N = container->series_count() > 0
115 ? container->series_size(0)
116 : 0;
117
118 auto& atelier = internal::atelier();
119
120 auto window = atelier.create_window(
121 Core::WindowCreateInfo { .title = std::move(title), .width = width, .height = height });
122
123 auto surface = atelier.create_surface(window, window->get_create_info().title);
124
125 if (spec.background_fn) {
126 auto bg = atelier.create_element<float>(
127 surface.layer(), window,
128 *spec.background_fn,
129 0.F,
130 Graphics::PrimitiveTopology::TRIANGLE_STRIP,
131 static_cast<size_t>(4) * Kakshya::VertexLayout::for_meshes().stride_bytes);
132
133 const auto bg_id = bg.element.id;
134 auto buf = atelier.create_buffer(window, spec.capacity_for(N), spec.topology);
135 auto mapped = Plot::place(surface, std::move(buf), spec, std::move(container));
136 surface.layer().relate(mapped.element.id, bg_id);
137 surface.layer().send_to_back(bg_id);
138
139 internal::atelier().place_adornments(surface, spec, mapped.element.id);
140
141 return { std::move(mapped), std::move(surface) };
142 }
143
144 auto buf = atelier.create_buffer(window, spec.capacity_for(N), spec.topology);
145 auto mapped = Plot::place(surface, std::move(buf), spec, std::move(container));
146
147 internal::atelier().place_adornments(surface, spec, mapped.element.id);
148
149 return { std::move(mapped), std::move(surface) };
150}
#define N(method_name, full_type_name)
Definition Creator.hpp:106
uint32_t width
uint32_t height
std::shared_ptr< Buffers::FormaBuffer > create_buffer(std::shared_ptr< Core::Window > window, size_t capacity, Graphics::PrimitiveTopology topology, const std::string &texture_binding={}, std::vector< std::pair< std::string, std::shared_ptr< Core::VKImage > > > additional_textures={})
Capacity-explicit FormaBuffer construction.
Definition Atelier.cpp:108
std::shared_ptr< Core::Window > create_window(const Core::WindowCreateInfo &info)
Create a window through the stored WindowManager and show it.
Definition Atelier.cpp:101
Mapped< T > create_element(Layer &layer, std::shared_ptr< Core::Window > window, GeometryFn< T > geom, T initial, Graphics::PrimitiveTopology topology=Graphics::PrimitiveTopology::TRIANGLE_STRIP, size_t capacity=k_capacity_bytes, std::function< float(T)> project={})
Build a FormaBuffer, construct a Mapped<T>, register the element on layer, and register it with the B...
Definition Atelier.hpp:146
Surface create_surface(std::shared_ptr< Core::Window > window, std::string name)
create_layer plus ownership of the window, as a Surface.
Definition Atelier.cpp:146
std::string title
Window title/identifier.
Configuration for creating a single window instance.
std::optional< GeometryFn< float > > background_fn
std::function< size_t(uint64_t sample_count)> capacity_for

References MayaFlux::Portal::Forma::internal::atelier(), MayaFlux::Portal::Forma::Plot::SeriesSpec::background_fn, MayaFlux::Portal::Forma::Plot::SeriesSpec::capacity_for, MayaFlux::Portal::Forma::internal::Atelier::create_buffer(), MayaFlux::Portal::Forma::internal::Atelier::create_element(), MayaFlux::Portal::Forma::internal::Atelier::create_surface(), MayaFlux::Portal::Forma::internal::Atelier::create_window(), MayaFlux::Kakshya::VertexLayout::for_meshes(), height, N, MayaFlux::Portal::Forma::Plot::place(), MayaFlux::Portal::Forma::internal::Atelier::place_adornments(), MayaFlux::Kakshya::VertexLayout::stride_bytes, MayaFlux::Core::WindowCreateInfo::title, MayaFlux::Portal::Forma::Plot::SeriesSpec::topology, MayaFlux::Portal::Graphics::TRIANGLE_STRIP, and width.

+ Here is the call graph for this function: