MayaFlux 0.4.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 247 of file Forma.cpp.

253{
254 const uint64_t N = container->series_count() > 0
255 ? container->series_size(0)
256 : 0;
257
258 auto window = g_window_manager->create_window(
259 Core::WindowCreateInfo { .title = std::move(title), .width = width, .height = height });
260 window->show();
261
262 auto surface = create_surface(window, window->get_create_info().title);
263
264 if (spec.background_fn) {
265 auto bg = create_element<float>(
266 surface.layer(), window,
267 *spec.background_fn,
268 0.F,
269 Graphics::PrimitiveTopology::TRIANGLE_STRIP,
270 static_cast<size_t>(4) * Kakshya::VertexLayout::for_meshes().stride_bytes);
271
272 const auto bg_id = bg.element.id;
273 auto buf = internal::create_buffer_impl(window, spec.capacity_for(N), spec.topology);
274 auto mapped = Plot::place(surface, std::move(buf), spec, std::move(container));
275 surface.layer().relate(mapped.element.id, bg_id);
276 surface.layer().send_to_back(bg_id);
277
278 place_plot_adornments(surface, spec, mapped.element.id);
279
280 return { std::move(mapped), std::move(surface) };
281 }
282
283 auto buf = internal::create_buffer_impl(window, spec.capacity_for(N), spec.topology);
284 auto mapped = Plot::place(surface, std::move(buf), spec, std::move(container));
285
286 place_plot_adornments(surface, spec, mapped.element.id);
287
288 return { std::move(mapped), std::move(surface) };
289}
#define N(method_name, full_type_name)
Definition Creator.hpp:106
uint32_t width
Definition Decoder.cpp:59
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::Plot::SeriesSpec::background_fn, MayaFlux::Portal::Forma::Plot::SeriesSpec::capacity_for, MayaFlux::Portal::Forma::internal::create_buffer_impl(), create_surface(), MayaFlux::Kakshya::VertexLayout::for_meshes(), N, MayaFlux::Portal::Forma::Plot::place(), 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: