Blender V5.0
BKE_volume_to_mesh.hh
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2023 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
8
9#pragma once
10
12#include "BLI_span.hh"
13
14#include "DNA_modifier_types.h"
15
16#ifdef WITH_OPENVDB
17# include <openvdb/openvdb.h>
18#endif
19
20struct Mesh;
21
22namespace blender::bke {
23
31
32#ifdef WITH_OPENVDB
33
37struct OpenVDBMeshData {
38 std::vector<openvdb::Vec3s> verts;
39 std::vector<openvdb::Vec3I> tris;
40 std::vector<openvdb::Vec4I> quads;
41 bool is_empty() const
42 {
43 return verts.empty();
44 }
45};
46
47Mesh *volume_to_mesh(const openvdb::GridBase &grid,
48 const VolumeToMeshResolution &resolution,
49 float threshold,
50 float adaptivity);
51
52Mesh *volume_grid_to_mesh(const openvdb::GridBase &grid, float threshold, float adaptivity);
53
54struct VolumeToMeshDataResult {
55 OpenVDBMeshData data;
56 std::string error;
57};
58
63VolumeToMeshDataResult volume_to_mesh_data(const openvdb::GridBase &grid,
64 const VolumeToMeshResolution &resolution,
65 float threshold,
66 float adaptivity);
67
73void fill_mesh_from_openvdb_data(Span<openvdb::Vec3s> vdb_verts,
74 Span<openvdb::Vec3I> vdb_tris,
75 Span<openvdb::Vec4I> vdb_quads,
76 int vert_offset,
77 int face_offset,
78 int loop_offset,
79 MutableSpan<float3> vert_positions,
80 MutableSpan<int> face_offsets,
81 MutableSpan<int> corner_verts);
82
83#endif
84
85} // namespace blender::bke
struct Mesh Mesh
VolumeToMeshResolutionMode
BMesh const char void * data
static float verts[][3]
static void error(const char *str)
union blender::bke::VolumeToMeshResolution::@103176042355372060356022076152214323072307172372 settings