MayaFlux 0.5.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches
MayaFlux::Buffers::RaymarchProcessor Class Reference

Stages a scalar field and its march parameters onto the buffer a RenderProcessor draws, so the fragment stage integrates the field through a proxy volume. More...

#include <RaymarchProcessor.hpp>

+ Inheritance diagram for MayaFlux::Buffers::RaymarchProcessor:
+ Collaboration diagram for MayaFlux::Buffers::RaymarchProcessor:

Classes

struct  MarchParams
 Parameter block staged as a push constant fragment. More...
 

Public Types

using FieldSource = std::function< vk::Buffer()>
 Callable resolving the handle to sample this cycle.
 

Public Member Functions

const Kinesis::Lattice3Dget_lattice () const
 The lattice the sampled field is stored over.
 
const MarchParamsget_params () const
 The staged parameter block.
 
void on_attach (const std::shared_ptr< Buffer > &buffer) override
 Called when this processor is attached to a buffer.
 
void processing_function (const std::shared_ptr< Buffer > &buffer) override
 The core processing function that must be implemented by derived classes.
 
 RaymarchProcessor (FieldSource source, size_t field_bytes, Kinesis::Lattice3D lattice, uint32_t set=1, uint32_t binding=0)
 Construct a march staging processor.
 
void set_absorption (float absorption)
 Set the extinction coefficient.
 
void set_density_scale (float scale)
 Set the multiplier applied to every sample before integration.
 
void set_emission (float emission)
 Set the emissive strength.
 
void set_emission_ramp (const glm::vec3 &cool, const glm::vec3 &hot)
 Set the emission colours interpolated by sample value.
 
void set_max_steps (uint32_t steps)
 Set the sample count along the longest ray through the volume.
 
void set_step_scale (float scale)
 Set the step length as a fraction of one cell.
 
void set_threshold (float threshold)
 Set the sample value below which a step contributes nothing.
 
 ~RaymarchProcessor () override=default
 
- Public Member Functions inherited from MayaFlux::Buffers::BufferProcessor
virtual ProcessingToken get_processing_token () const
 Gets the current processing token for this buffer.
 
virtual bool is_compatible_with (const std::shared_ptr< Buffer > &) const
 Checks if this processor can handle the specified buffer type.
 
virtual void on_detach (const std::shared_ptr< Buffer > &)
 Called when this processor is detached from a buffer.
 
void process (const std::shared_ptr< Buffer > &buffer)
 Applies a computational transformation to the data in the provided buffer.
 
virtual void set_processing_token (ProcessingToken token)
 Gets the preferred processing backend for this processor.
 
virtual ~BufferProcessor ()=default
 Virtual destructor for proper cleanup of derived classes.
 

Private Member Functions

void stage_descriptor (const std::shared_ptr< VKBuffer > &buffer, vk::Buffer handle)
 Insert or replace the descriptor entry for the field handle.
 
void stage_params (const std::shared_ptr< VKBuffer > &buffer)
 Insert or replace the push constant fragment.
 
void write_lattice_params ()
 Write the lattice-derived words of the parameter block.
 

Private Attributes

uint32_t m_binding
 
size_t m_field_bytes
 
Kinesis::Lattice3D m_lattice
 
MarchParams m_params {}
 
uint32_t m_set
 
FieldSource m_source
 

Additional Inherited Members

- Protected Member Functions inherited from MayaFlux::Buffers::VKBufferProcessor
void ensure_initialized (const std::shared_ptr< VKBuffer > &buffer)
 
void initialize_buffer_service ()
 
void initialize_compute_service ()
 
- Protected Attributes inherited from MayaFlux::Buffers::VKBufferProcessor
Registry::Service::BufferServicem_buffer_service = nullptr
 
Registry::Service::ComputeServicem_compute_service = nullptr
 
- Protected Attributes inherited from MayaFlux::Buffers::BufferProcessor
ProcessingToken m_processing_token { ProcessingToken::AUDIO_BACKEND }
 

Detailed Description

Stages a scalar field and its march parameters onto the buffer a RenderProcessor draws, so the fragment stage integrates the field through a proxy volume.

Dispatches nothing and records no commands. Each cycle it resolves a vk::Buffer from its field source, writes a DescriptorBindingInfo for it into the attached buffer's pipeline context, and writes its parameter block as a staged push constant fragment. RenderProcessor unifies both into the pipeline it builds and updates the descriptor before binding the set, which is the designed path for handing resources to the renderer without a processor of its own.

The field source is a callable rather than a handle because a double-buffered field's read slot moves whenever an upstream stage swaps. Calling it fresh each cycle picks that up. It is also what keeps this class free of any dependency on VolumeGridBuffer: any callable returning a valid handle to a float array of the lattice's cell count works, whatever owns it.

Set 1 binding 0 by default. Set 0 is the engine's ViewTransform reservation and cannot be used.

Definition at line 32 of file RaymarchProcessor.hpp.


The documentation for this class was generated from the following files: