MayaFlux 0.5.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 196 of file VolumeGridBuffer.cpp.

197{
199 if (!chain) {
200 chain = std::make_shared<BufferProcessingChain>();
202 }
203 chain->set_preferred_token(token);
204
205 if (!m_surface) {
207 "VolumeGridBuffer: chain established, no extraction configured");
208 return;
209 }
210
211 auto self = std::dynamic_pointer_cast<VolumeGridBuffer>(shared_from_this());
212
213 m_surface_processor = std::make_shared<VolumeSurfaceProcessor>(
214 self, m_surface->field_name,
215 m_lattice.resampled(m_surface->resolution),
216 m_surface->threshold);
217
219 .get_service<Registry::Service::BufferService>();
220
221 m_counter_buf = std::make_shared<VKBuffer>(
222 sizeof(uint32_t), Usage::HOST_STORAGE, Kakshya::DataModality::UNKNOWN);
223 svc->initialize_buffer(m_counter_buf);
224
225 m_mesh_processor = std::make_shared<SDFMeshProcessor>(
228 m_surface->resolution.x, m_surface->resolution.y, m_surface->resolution.z, 0.0F);
229
230 const uint32_t max_vertices = m_surface_processor->worst_case_vertices();
231 auto layout = Kakshya::VertexLayout::for_meshes(sizeof(Kakshya::MeshVertex));
232 layout.vertex_count = max_vertices;
233 set_vertex_layout(layout);
234
235 m_surface_processor->set_processing_token(token);
236 m_mesh_processor->set_processing_token(token);
237
239 chain->add_processor(m_mesh_processor, self);
240
242 "VolumeGridBuffer: surfacing '{}' at {}x{}x{}, {} max vertices",
243 m_surface->field_name, m_surface->resolution.x, m_surface->resolution.y,
244 m_surface->resolution.z, max_vertices);
245
247 "VolumeGridBuffer: chain established, no stages attached");
248}
#define MF_INFO(comp, ctx,...)
#define MF_DEBUG(comp, ctx,...)
void set_vertex_layout(const Kakshya::VertexLayout &layout)
Set vertex layout for this buffer.
Definition VKBuffer.cpp:387
std::shared_ptr< Buffers::BufferProcessingChain > get_processing_chain() override
Access the buffer's processing chain.
Definition VKBuffer.cpp:263
void set_default_processor(const std::shared_ptr< BufferProcessor > &processor) override
Set the buffer's default processor.
Definition VKBuffer.cpp:247
void set_processing_chain(const std::shared_ptr< BufferProcessingChain > &chain, bool force=false) override
Replace the buffer's processing chain.
Definition VKBuffer.cpp:268
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.
Tendency< A, C > chain(const Tendency< A, B > &first, const Tendency< B, C > &second)
Sequential composition: evaluate first, feed result into second.
Definition Tendency.hpp:82
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, 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: