Blender V5.3
util/nanovdb.h
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: Contributors to the OpenVDB Project
2 * SPDX-FileCopyrightText: 2025 Blender Foundation
3 *
4 * SPDX-License-Identifier: Apache-2.0 */
5
6#pragma once
7
8#ifdef WITH_NANOVDB
9
10# include <openvdb/openvdb.h>
11
12# define NANOVDB_USE_OPENVDB
13
14/* The NanoVDB main header focuses on only defining the most crucial components (e.g., data
15 * structures and accessors). It manages and streams the raw memory buffer of a NanoVDB grid.
16 * It is therefore safe to include it to make version checks and to make decisions like
17 * enabling TBB. At least for now. */
18# include <nanovdb/NanoVDB.h>
19
20# if NANOVDB_MAJOR_VERSION_NUMBER > 32 || \
21 (NANOVDB_MAJOR_VERSION_NUMBER == 32 && NANOVDB_MINOR_VERSION_NUMBER >= 9)
22# define NANOVDB_USE_TBB
23# endif
24
25# if NANOVDB_MAJOR_VERSION_NUMBER > 32 || \
26 (NANOVDB_MAJOR_VERSION_NUMBER == 32 && NANOVDB_MINOR_VERSION_NUMBER >= 7)
27# include <nanovdb/GridHandle.h>
28# else
29# include <nanovdb/util/GridHandle.h>
30# endif
31
33
34/* Convert NanoVDB to OpenVDB mask grid that represents just the topology. */
35openvdb::MaskGrid::Ptr nanovdb_to_openvdb_mask(const nanovdb::GridHandle<> &handle);
36
37/* Convert OpenVDB to NanoVDB grid. */
38nanovdb::GridHandle<> openvdb_to_nanovdb(const openvdb::GridBase::ConstPtr &grid,
39 const int precision,
40 const float clipping);
41
43
44#endif
#define CCL_NAMESPACE_END