|
MayaFlux 0.5.0
Digital-First Multimedia Processing Framework
|
| bool MayaFlux::IO::Detail::VDBArchive::read_dense_scalar | ( | size_t | index, |
| const glm::ivec3 & | region_min, | ||
| const glm::uvec3 & | resolution, | ||
| float | background, | ||
| std::vector< float > & | out, | ||
| bool * | precision_lost = nullptr |
||
| ) | const |
Materialize a scalar grid's cells over an explicit region.
region_min and resolution are expressed in the grid's own voxel-index space — the same space active_min/active_max in grid_summary() use. A cell not covered by any active leaf, and a cell whose index falls outside the region entirely, both take background. Output is resized to resolution.x*y*z elements and written x-fastest, z-slowest, matching Lattice3D and VolumeField's convention.
A grid whose leaf value type is not float is converted per-element via MayaFlux::try_convert; check grid_summary().narrowed beforehand to know whether that happened at all, or pass precision_lost to learn whether it happened losslessly. Every element that round-trips through float and back to the source type unchanged leaves it false; a single element that doesn't sets it true for the whole call. half is the one source type never marked lossy — float has strictly more precision in both exponent and mantissa, so widening it is always exact.
| precision_lost | Set to whether any narrowed element lost precision. Cleared to false at the start of the call if non-null; left untouched by a null pointer. |
Definition at line 734 of file VDBArchive.cpp.
References elem_size, index, m_last_error, m_state, name, out, precision_lost, region_min, and vt.