13# include <openvdb/openvdb.h>
14# include <openvdb/points/PointDataGrid.h>
32bke::VolumeGridData *BKE_volume_grid_add_vdb(
Volume &volume,
34 openvdb::GridBase::Ptr vdb_grid);
36void BKE_volume_metadata_set(
Volume &volume, openvdb::MetaMap::Ptr
metadata);
38std::optional<Bounds<float3>> BKE_volume_grid_bounds(openvdb::GridBase::ConstPtr grid);
45openvdb::GridBase::ConstPtr BKE_volume_grid_shallow_transform(openvdb::GridBase::ConstPtr grid,
48float4x4 BKE_volume_transform_to_blender(
const openvdb::math::Transform &
transform);
49openvdb::math::Transform BKE_volume_transform_to_openvdb(
const float4x4 &
transform);
51template<
typename OpType>
52auto BKE_volume_grid_type_operation(
const VolumeGridType grid_type, OpType &&op)
56 return op.template operator()<openvdb::FloatGrid>();
58 return op.template operator()<openvdb::Vec3fGrid>();
60 return op.template operator()<openvdb::BoolGrid>();
62 return op.template operator()<openvdb::DoubleGrid>();
64 return op.template operator()<openvdb::Int32Grid>();
66 return op.template operator()<openvdb::Int64Grid>();
68 return op.template operator()<openvdb::Vec3IGrid>();
70 return op.template operator()<openvdb::Vec3dGrid>();
72 return op.template operator()<openvdb::MaskGrid>();
74 return op.template operator()<openvdb::points::PointDataGrid>();
81 return op.template operator()<openvdb::FloatGrid>();
85inline void BKE_volume_grid_type_to_static_type(
const VolumeGridType grid_type, Fn &&
fn)
89 return fn.template operator()<openvdb::FloatGrid>();
91 return fn.template operator()<openvdb::Vec3fGrid>();
93 return fn.template operator()<openvdb::BoolGrid>();
95 return fn.template operator()<openvdb::DoubleGrid>();
97 return fn.template operator()<openvdb::Int32Grid>();
99 return fn.template operator()<openvdb::Int64Grid>();
101 return fn.template operator()<openvdb::Vec3IGrid>();
103 return fn.template operator()<openvdb::Vec3dGrid>();
105 return fn.template operator()<openvdb::MaskGrid>();
107 return fn.template operator()<openvdb::points::PointDataGrid>();
115inline bool BKE_volume_grid_type_to_blender_value_type(
const VolumeGridType grid_type, Fn &&
fn)
119 fn.template operator()<
float>();
125 fn.template operator()<
bool>();
128 fn.template operator()<
double>();
131 fn.template operator()<
int>();
137 fn.template operator()<
int3>();
150openvdb::GridBase::Ptr BKE_volume_grid_create_with_changed_resolution(
151 const VolumeGridType grid_type,
const openvdb::GridBase &old_grid,
float resolution_factor);
#define BLI_assert_unreachable()
#define BLI_assert_msg(a, msg)
MatBase< float, 4, 4 > float4x4
VecBase< int32_t, 3 > int3
@ VOLUME_GRID_VECTOR_FLOAT
@ VOLUME_GRID_VECTOR_DOUBLE
VecBase< double, 3 > double3
VecBase< float, 3 > float3