Blender V5.3
GEO_points_to_volume.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_generic_span.hh"
8#include "BLI_math_base.hh"
9#include "BLI_string_ref.hh"
10
11#include "GEO_grid_samplers.hh"
12
13#include "BKE_attribute.hh"
14#include "BKE_volume_enums.hh"
15#include "BKE_volume_grid.hh"
16
17namespace blender {
18
19struct Volume;
20
24
25namespace geometry {
26
30 Scalar = 0,
32 Vector = 1,
33};
34
36enum class KernelType {
40 Linear = 1,
42 Quadratic = 2,
44 Cubic = 3,
45};
46
50const CPPType &points_rasterize_grid_type(const PointRasterizeType rasterize_type);
51
52#ifdef WITH_OPENVDB
53
57bke::VolumeGridData *fog_volume_grid_add_from_points(Volume *volume,
58 StringRefNull name,
59 Span<float3> positions,
60 Span<float> radii,
61 float voxel_size,
62 float density);
63
64bke::VolumeGrid<float> points_to_sdf_grid(Span<float3> positions,
65 Span<float> radii,
66 float voxel_size);
67
69bool is_point_attribute_grid_supported(const CPPType &cpp_type);
70
74struct PointDataGridAttributeInfo {
75 StringRef name;
76 GSpan data;
77};
78
79using PointAttributeNameMap = Vector<std::pair<std::string, std::string>>;
80
81struct MappedPointDataGrid {
82 /* Point data grid. */
83 bke::GVolumeGrid grid;
84 /* Attribute pairs mapping original attribute names to internal identifiers.
85 * OpenVDB PointDataGrid does not allow certain characters in attribute names, so internal names
86 * are generated and mapped to original names. */
87 PointAttributeNameMap attribute_map;
88};
89
98MappedPointDataGrid points_to_point_data_grid(const Span<float3> positions,
99 const Span<PointDataGridAttributeInfo> attributes,
100 const float4x4 &transform);
101
111MappedPointDataGrid points_to_point_data_grid(const VArray<float3> positions,
112 const bke::AttributeAccessor &attributes,
113 const bke::AttributeFilter &attribute_filter,
114 const float4x4 &transform);
115
117struct PointRasterizeAttributeInfo {
118 StringRef name;
120};
121
137void points_rasterize(const MappedPointDataGrid &point_data_grid,
138 const KernelType kernel_type,
139 Span<PointRasterizeAttributeInfo> point_attributes,
140 const float4x4 &transform,
141 MutableSpan<bke::GVolumeGrid> r_attribute_grids);
142
143#endif
144} // namespace geometry
145} // namespace blender
const CPPType & points_rasterize_grid_type(const PointRasterizeType rasterize_type)
const CPPType & points_rasterize_attribute_type(const PointRasterizeType rasterize_type)
BMesh Iterators.
MatBase< float, 4, 4 > float4x4
BMesh const char void * data
float Scalar
Definition eigen_utils.h:28