Blender V4.3
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
5#pragma once
6
7#include "BLI_span.hh"
8
10
11#ifdef WITH_OPENVDB
12# include <openvdb/openvdb.h>
13#endif
14
15struct Mesh;
16
17namespace blender::bke {
18
26
27#ifdef WITH_OPENVDB
28
32struct OpenVDBMeshData {
33 std::vector<openvdb::Vec3s> verts;
34 std::vector<openvdb::Vec3I> tris;
35 std::vector<openvdb::Vec4I> quads;
36 bool is_empty() const
37 {
38 return verts.empty();
39 }
40};
41
42Mesh *volume_to_mesh(const openvdb::GridBase &grid,
43 const VolumeToMeshResolution &resolution,
44 float threshold,
45 float adaptivity);
46
47Mesh *volume_grid_to_mesh(const openvdb::GridBase &grid, float threshold, float adaptivity);
48
49struct VolumeToMeshDataResult {
50 OpenVDBMeshData data;
51 std::string error;
52};
53
58VolumeToMeshDataResult volume_to_mesh_data(const openvdb::GridBase &grid,
59 const VolumeToMeshResolution &resolution,
60 float threshold,
61 float adaptivity);
62
68void fill_mesh_from_openvdb_data(Span<openvdb::Vec3s> vdb_verts,
69 Span<openvdb::Vec3I> vdb_tris,
70 Span<openvdb::Vec4I> vdb_quads,
71 int vert_offset,
72 int face_offset,
73 int loop_offset,
74 MutableSpan<float3> vert_positions,
75 MutableSpan<int> face_offsets,
76 MutableSpan<int> corner_verts);
77
78#endif
79
80} // namespace blender::bke
VolumeToMeshResolutionMode
static float verts[][3]
static void error(const char *str)
union blender::bke::VolumeToMeshResolution::@73 settings