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

◆ create_buffer()

std::shared_ptr< Buffers::FormaBuffer > MayaFlux::Portal::Forma::internal::Atelier::create_buffer ( Graphics::RenderConfig  render)

The single buffer construction path.

Registers a FormaBuffer with the stored BufferManager under GRAPHICS_BACKEND and sets up rendering. The buffer always triangulates with TRIANGLE_LIST: what it draws is expressed by the topology of the slices made on it with FormaTarget::slice_of. Line and point slices are milled into NDC ribbons whose scalar is a width in pixels of the window's height at creation.

Parameters
renderRender settings; build it with Surface::render_config. Its topology and triangulate are set here.

Definition at line 117 of file Atelier.cpp.

118{
119 if (!m_initialized) {
120 error<std::runtime_error>(Journal::Component::Portal, Journal::Context::API,
121 std::source_location::current(),
122 "Portal::Forma not initialized - cannot create buffer");
123 }
124
125 if (!render.target_window) {
126 error<std::invalid_argument>(Journal::Component::Portal, Journal::Context::API,
127 std::source_location::current(),
128 "Portal::Forma create_buffer requires a target window");
129 }
130
132 render.triangulate = true;
133
134 auto buf = std::make_shared<Buffers::FormaBuffer>(k_capacity_bytes, render.topology);
136
137 const auto height = std::max(render.target_window->get_create_info().height, 1U);
138 buf->setup_rendering(render);
139
140 if (auto processor = buf->get_render_processor()) {
141 Graphics::MillSpec spec = processor->get_mill_spec();
143 spec.width_scale = 2.0F / static_cast<float>(height);
144 processor->set_mill_spec(spec);
145 }
146 return buf;
147}
uint32_t height
std::shared_ptr< Buffers::BufferManager > m_buffer_manager
Definition Atelier.hpp:291
@ GRAPHICS_BACKEND
Standard graphics processing backend configuration.
@ API
API calls from external code.
@ Portal
High-level user-facing API layer.
constexpr size_t k_capacity_bytes
Definition Atelier.hpp:37
@ WorldPlane
Held in the XY plane, viewpoint ignored.

References MayaFlux::Journal::API, MayaFlux::Buffers::GRAPHICS_BACKEND, height, MayaFlux::Portal::Forma::internal::k_capacity_bytes, m_buffer_manager, m_initialized, MayaFlux::Journal::Portal, MayaFlux::Portal::Graphics::MillSpec::ribbon, MayaFlux::Portal::Graphics::RenderConfig::target_window, MayaFlux::Portal::Graphics::RenderConfig::topology, MayaFlux::Portal::Graphics::TRIANGLE_LIST, MayaFlux::Portal::Graphics::RenderConfig::triangulate, MayaFlux::Portal::Graphics::MillSpec::width_scale, and MayaFlux::Portal::Graphics::MillSpec::WorldPlane.

Referenced by MayaFlux::Portal::Forma::create_buffer(), MayaFlux::Portal::Forma::pick(), MayaFlux::Portal::Forma::Dropdown::place(), place_adornments(), and MayaFlux::Portal::Forma::plot().

+ Here is the caller graph for this function: