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

◆ setup_processors()

void MayaFlux::Buffers::VolumeGridBuffer::setup_processors ( ProcessingToken  token)
overridevirtual

Establish the processing chain without attaching any stage.

Parameters
tokenProcessing domain, typically GRAPHICS_BACKEND.

The volume declares no default processor and no stages of its own. Simulation identity is the sequence of processors the caller adds, not a property of this class.

When a SurfaceConfig was supplied at construction, two stages are appended: the field-to-corner-grid resample and the marching cubes extraction writing into this buffer's own vertex storage. Simulation stages added before this call keep their position ahead of them.

Reimplemented from MayaFlux::Buffers::VKBuffer.

Definition at line 221 of file VolumeGridBuffer.cpp.

222{
224 if (!chain) {
225 chain = std::make_shared<BufferProcessingChain>();
227 }
228 chain->set_preferred_token(token);
229
230 if (!m_surface) {
232 "VolumeGridBuffer: chain established, no extraction configured");
233 return;
234 }
235
236 auto self = std::dynamic_pointer_cast<VolumeGridBuffer>(shared_from_this());
237
238 m_surface_processor = std::make_shared<VolumeSurfaceProcessor>(
239 self, m_surface->field_name,
240 m_lattice.resampled(m_surface->resolution),
241 m_surface->threshold);
242
244 .get_service<Registry::Service::BufferService>();
245
246 m_counter_buf = std::make_shared<VKBuffer>(
247 sizeof(uint32_t), Usage::HOST_STORAGE, Kakshya::DataModality::UNKNOWN);
248 svc->initialize_buffer(m_counter_buf);
249
250 m_mesh_processor = std::make_shared<SDFMeshProcessor>(
253 m_surface->resolution.x, m_surface->resolution.y, m_surface->resolution.z, 0.0F);
254
255 const uint32_t max_vertices = m_surface_processor->worst_case_vertices();
256 auto layout = Kakshya::VertexLayout::for_meshes(sizeof(Kakshya::MeshVertex));
257 layout.vertex_count = max_vertices;
258 set_vertex_layout(layout);
259
260 m_surface_processor->set_processing_token(token);
261 m_mesh_processor->set_processing_token(token);
262
264 chain->add_processor(m_mesh_processor, self);
265
267 "VolumeGridBuffer: surfacing '{}' at {}x{}x{}, {} max vertices",
268 m_surface->field_name, m_surface->resolution.x, m_surface->resolution.y,
269 m_surface->resolution.z, max_vertices);
270
272 "VolumeGridBuffer: chain established, no stages attached");
273}
#define MF_INFO(comp, ctx,...)
#define MF_DEBUG(comp, ctx,...)
BufferProcessingChain * chain
void set_vertex_layout(const Kakshya::VertexLayout &layout)
Set vertex layout for this buffer.
Definition VKBuffer.cpp:453
std::shared_ptr< Buffers::BufferProcessingChain > get_processing_chain() override
Access the buffer's processing chain.
Definition VKBuffer.cpp:271
void set_default_processor(const std::shared_ptr< BufferProcessor > &processor) override
Set the buffer's default processor.
Definition VKBuffer.cpp:255
void set_processing_chain(const std::shared_ptr< BufferProcessingChain > &chain, bool force=false) override
Replace the buffer's processing chain.
Definition VKBuffer.cpp:276
std::optional< SurfaceConfig > m_surface
std::shared_ptr< VolumeSurfaceProcessor > m_surface_processor
std::shared_ptr< VKBuffer > m_counter_buf
Atomic vertex counter for the extraction stage.
std::shared_ptr< SDFMeshProcessor > m_mesh_processor
Interface * get_service()
Query for a backend service.
static BackendRegistry & instance()
Get the global registry instance.
@ Init
Engine/subsystem initialization.
@ Buffers
Buffers, Managers, processors and processing chains.
@ UNKNOWN
Unknown or undefined modality.
static VertexLayout for_meshes(uint32_t stride=60)
Factory: layout for MeshVertex (position, color, weight, uv, normal, tangent)
Lattice3D resampled(const glm::uvec3 &res) const noexcept
A lattice over the same bounds at a different resolution.
Definition Lattice.hpp:103
AABB3D bounds
Continuous extent subdivided.
Definition Lattice.hpp:27

References MayaFlux::Kinesis::Lattice3D::bounds, MayaFlux::Journal::Buffers, chain, MayaFlux::Kakshya::VertexLayout::for_meshes(), MayaFlux::Buffers::VKBuffer::get_processing_chain(), MayaFlux::Registry::BackendRegistry::get_service(), MayaFlux::Journal::Init, MayaFlux::Registry::BackendRegistry::instance(), m_counter_buf, m_lattice, m_mesh_processor, m_surface, m_surface_processor, MayaFlux::Kinesis::AABB3D::max, MF_DEBUG, MF_INFO, MayaFlux::Kinesis::AABB3D::min, MayaFlux::Kinesis::Lattice3D::resampled(), MayaFlux::Buffers::VKBuffer::set_default_processor(), MayaFlux::Buffers::VKBuffer::set_processing_chain(), MayaFlux::Buffers::VKBuffer::set_vertex_layout(), and MayaFlux::Kakshya::UNKNOWN.

+ Here is the call graph for this function: