/* SPDX-FileCopyrightText: 2011-2022 Blender Foundation * * SPDX-License-Identifier: Apache-2.0 */ #pragma once #ifdef WITH_OPENVDB # include namespace openvdb { using Vec4fTree = tree::Tree4::Type; using Vec4fGrid = Grid; } // namespace openvdb CCL_NAMESPACE_BEGIN /* Convert to the few grid types we can render natively. */ openvdb::GridBase::ConstPtr openvdb_convert_to_known_type(const openvdb::GridBase::ConstPtr &grid); /* Apply operation to known grid types. */ template bool openvdb_grid_type_operation(const openvdb::GridBase::ConstPtr &grid, OpType &&op) { if (grid->isType()) { return op.template operator()( openvdb::gridConstPtrCast(grid)); } if (grid->isType()) { return op.template operator()( openvdb::gridConstPtrCast(grid)); } if (grid->isType()) { return op.template operator()( openvdb::gridConstPtrCast(grid)); } assert(0); return false; } /* Count number of channels in known types. */ int openvdb_num_channels(const openvdb::GridBase::ConstPtr &grid); CCL_NAMESPACE_END #endif