Materialize a vector grid's cells over an explicit region.
As read_dense_scalar, for a grid whose leaf value type is vec3f, vec3d or vec3i. Non-vec3f types are converted component-wise via MayaFlux::try_convert; precision_lost is set if any of the three components of any element lost precision.
- Returns
- False if index is out of range, the grid is scalar-typed, or resolution has a zero axis. Call last_error() for detail.
Definition at line 783 of file VDBArchive.cpp.
790{
792 m_last_error =
"read_dense_vector: grid index out of range";
793 return false;
794 }
795 if (resolution.x == 0 || resolution.y == 0 || resolution.z == 0) {
797 return false;
798 }
799
800 const tvdb_grid_t& grid =
m_state->read_file.grids[
index];
801 const tvdb_value_type_t
vt = leaf_value_type(grid);
802
803 if (!is_vector_type(
vt)) {
805 m_last_error =
"read_dense_vector: grid '" + std::string(
name ?
name :
"") +
"' is scalar-typed";
806 return false;
807 }
810 m_last_error =
"read_dense_vector: grid has an unsupported leaf value type";
811 return false;
812 }
813
816 }
817
818 out.assign(
static_cast<size_t>(resolution.x) * resolution.y * resolution.z, background);
819
820 DenseVectorCtx ctx {};
822 ctx.region_max =
region_min + glm::ivec3(resolution);
827
828 tvdb_grid_visit_leaves(&grid, dense_vector_visit, &ctx);
829 return true;
830}
std::vector< float > * out
std::string m_last_error
Set from the const read-path accessors too.
std::unique_ptr< State > m_state
References elem_size, index, m_last_error, m_state, name, out, precision_lost, region_min, and vt.