13# include <openvdb/openvdb.h>
25using LeafNodeMask = openvdb::util::NodeMask<3u>;
27using GetVoxelsFn = FunctionRef<void(MutableSpan<openvdb::Coord> r_voxels)>;
32using ProcessLeafFn = FunctionRef<void(
const LeafNodeMask &leaf_node_mask,
33 const openvdb::CoordBBox &leaf_bbox,
34 GetVoxelsFn get_voxels_fn)>;
38using ProcessTilesFn = FunctionRef<void(Span<openvdb::CoordBBox>
tiles)>;
43using ProcessVoxelsFn = FunctionRef<void(Span<openvdb::Coord> voxels)>;
49void parallel_grid_topology_tasks(
const openvdb::MaskTree &mask_tree,
50 ProcessLeafFn process_leaf_fn,
51 ProcessVoxelsFn process_voxels_fn,
52 ProcessTilesFn process_tiles_fn);
54template<
typename Gr
idT>
62template<
typename Fn>
inline void to_typed_grid(
const openvdb::GridBase &grid_base, Fn &&fn)
65 BKE_volume_grid_type_to_static_type(grid_type, [&](
auto type_tag) {
66 using GridT =
typename decltype(type_tag)::type;
67 if constexpr (is_supported_grid_type<GridT>) {
68 fn(
static_cast<const GridT &
>(grid_base));
76template<
typename Fn>
inline void to_typed_grid(openvdb::GridBase &grid_base, Fn &&fn)
79 BKE_volume_grid_type_to_static_type(grid_type, [&](
auto type_tag) {
80 using GridT =
typename decltype(type_tag)::type;
81 if constexpr (is_supported_grid_type<GridT>) {
82 fn(
static_cast<GridT &
>(grid_base));
91openvdb::GridBase::Ptr create_grid_with_topology(
const openvdb::MaskTree &topology,
92 const openvdb::math::Transform &
transform,
96void set_grid_values(openvdb::GridBase &grid_base, GSpan values, Span<openvdb::Coord> voxels);
102void set_tile_values(openvdb::GridBase &grid_base, GSpan values, Span<openvdb::CoordBBox>
tiles);
108void set_mask_leaf_buffer_from_bools(openvdb::BoolGrid &grid,
110 const IndexMask &index_mask,
111 Span<openvdb::Coord> voxels);
113void set_grid_background(openvdb::GridBase &grid_base,
const GPointer value);
116void prune_inactive(openvdb::GridBase &grid_base);
#define BLI_assert_unreachable()
SIMD_FORCE_INLINE btVector3 transform(const btVector3 &point) const
ccl_gpu_kernel_postfix ccl_global KernelWorkTile * tiles
VolumeGridType get_type(const VolumeGridData &grid)
constexpr bool is_same_any_v