60 using type_traits =
typename bke::VolumeGridTraits<bool>;
61 using TreeType =
typename type_traits::TreeType;
62 using GridType = openvdb::Grid<TreeType>;
64 auto openvdb_grid = GridType::create(
false );
76 if (resolution.x <= 0 || resolution.y <= 0 || resolution.z <= 0) {
82 if (bounds_min.x >= bounds_max.x || bounds_min.y >= bounds_max.y || bounds_min.z >= bounds_max.z)
85 TIP_(
"Bounding box volume must be greater than 0"));
90 const int3 grid_max_inclusive = grid_min_inclusive + resolution - 1;
91 const openvdb::math::CoordBBox bbox(
92 {grid_min_inclusive.x, grid_min_inclusive.y, grid_min_inclusive.z},
93 {grid_max_inclusive.x, grid_max_inclusive.y, grid_max_inclusive.z});
94 openvdb_grid->tree().denseFill(bbox,
true,
true);
99 TIP_(
"Volume scale is lower than permitted by OpenVDB"));
104 openvdb_grid->transform().postScale(openvdb::math::Vec3d(scale_fac.x, scale_fac.y, scale_fac.z));
106 openvdb_grid->transform().postTranslate(
107 openvdb::math::Vec3d(translation.x, translation.y, translation.z));
110 params.
set_output(
"Topology"_ustr, bke::GVolumeGrid(std::move(topology_grid)));