|
MayaFlux 0.5.0
Digital-First Multimedia Processing Framework
|
| bool MayaFlux::IO::relaxation_grid_positions | ( | const std::shared_ptr< Buffers::RelaxationGridBuffer > & | grid, |
| float | extent, | ||
| std::vector< glm::vec3 > & | positions, | ||
| std::vector< uint64_t > & | ids | ||
| ) |
Generate the fixed grid positions and cell ids a RelaxationGridBuffer's cells occupy, for feeding SpatialCache::write() with PrimitiveTopology::POINT_LIST.
Matches exactly the row-major, cell-center-sampled layout its own emit shaders use (data/shaders/relax_vertex_emit.comp, relax_scalar_emit.comp): cell (col, row) at linear index row*width+col samples at ((col+0.5)/width, (row+0.5)/height), remapped to [-extent, extent] on both axes, z always 0.
Positions and ids are fixed for a given width/height/extent: a RelaxationGridBuffer's topology never changes generation to generation, only its cell state does (obtained separately via RelaxationGridBuffer::request_snapshot()/snapshot_source(), whose raw bytes only the caller can correctly reinterpret, since state format varies by rule: a single float, a uint32 automaton state, a vec2 reaction-diffusion pair, or anything else a rule shader defines). Call once and reuse the result across every sample of a capture rather than regenerating it per frame.
ids are the cell's own linear index, so a consumer can track one cell's identity across samples even though every other field about it changes generation to generation.
| grid | Source buffer, for width/height. |
| extent | NDC half-span. Match whatever was set via RelaxationEmitProcessor::set_extent(); default 1.0 matches RelaxationEmitProcessor::EmitParams's own default. |
| positions | Output, resized to grid->get_cell_count(). |
| ids | Output, resized to grid->get_cell_count(). |
Definition at line 123 of file SpatialExport.cpp.
References MayaFlux::Journal::FileIO, height, MayaFlux::Journal::IO, MF_ERROR, and width.
Referenced by MayaFlux::IO::RelaxationGridCapture::RelaxationGridCapture().
Here is the caller graph for this function: