Blender V5.3
sculpt_smooth.hh
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2024 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
8
9#pragma once
10
11#include "BLI_generic_span.hh"
12#include "BLI_offset_indices.hh"
13#include "BLI_ordered_edge.hh"
14#include "BLI_set.hh"
15
16#include "BKE_subdiv_ccg.hh"
17
18namespace blender {
19
20struct BMVert;
21struct Object;
22struct SubdivCCG;
23struct SubdivCCGCoord;
24namespace bke {
25enum class AttrDomain : int8_t;
26}
27
29
34void bmesh_four_neighbor_average(float avg[3], const float3 &direction, const BMVert *v);
35
36void neighbor_color_average(OffsetIndices<int> faces,
37 Span<int> corner_verts,
38 GroupedSpan<int> vert_to_face_map,
39 GSpan color_attribute,
40 bke::AttrDomain color_domain,
41 GroupedSpan<int> vert_neighbors,
42 MutableSpan<float4> smooth_colors);
43
44void neighbor_position_average_interior_grids(OffsetIndices<int> faces,
45 Span<int> corner_verts,
46 BitSpan boundary_verts,
47 const Set<OrderedEdge> &boundary_edges,
48 const SubdivCCG &subdiv_ccg,
49 Span<int> grids,
50 Span<float> factors,
51 MutableSpan<float3> new_positions);
52void neighbor_position_average_interior_grids(OffsetIndices<int> faces,
53 Span<int> corner_verts,
54 BitSpan boundary_verts,
55 const Set<OrderedEdge> &boundary_edges,
56 const SubdivCCG &subdiv_ccg,
57 Span<int> grids,
58 MutableSpan<float3> new_positions);
59
60void neighbor_position_average_bmesh(const Set<BMVert *, 0> &verts,
61 MutableSpan<float3> new_positions);
62void neighbor_position_average_interior_bmesh(const Set<BMVert *, 0> &verts,
63 Span<float> factors,
64 MutableSpan<float3> new_positions);
65void neighbor_position_average_interior_bmesh(const Set<BMVert *, 0> &verts,
66 MutableSpan<float3> new_positions);
67
68template<typename T>
69void neighbor_data_average_mesh(Span<T> src, GroupedSpan<int> vert_neighbors, MutableSpan<T> dst);
70
71template<typename T>
73 Span<int> verts,
74 GroupedSpan<int> vert_neighbors,
75 MutableSpan<T> dst);
76
77template<typename T>
78void average_data_grids(const SubdivCCG &subdiv_ccg,
79 Span<T> src,
80 Span<int> grids,
81 MutableSpan<T> dst);
82
83template<typename T>
84void average_data_bmesh(Span<T> src, const Set<BMVert *, 0> &verts, MutableSpan<T> dst);
85
86/* Average the data in the argument span across vertex neighbors. */
87void blur_geometry_data_array(const Object &object, int iterations, MutableSpan<float> data);
88
89/* Surface Smooth Brush. */
90
91void surface_smooth_laplacian_step(Span<float3> positions,
92 Span<float3> orig_positions,
93 Span<float3> average_positions,
94 float alpha,
95 MutableSpan<float3> laplacian_disp,
96 MutableSpan<float3> translations);
97void surface_smooth_displace_step(Span<float3> laplacian_disp,
98 Span<float3> average_laplacian_disp,
99 float beta,
100 MutableSpan<float3> translations);
101
102void calc_relaxed_translations_faces(Span<float3> vert_positions,
103 Span<float3> vert_normals,
104 OffsetIndices<int> faces,
105 Span<int> corner_verts,
106 GroupedSpan<int> vert_to_face_map,
107 BitSpan boundary_verts,
108 const Set<OrderedEdge> &boundary_edges,
109 Span<int> face_sets,
110 Span<bool> hide_poly,
111 bool filter_boundary_face_sets,
112 Span<int> verts,
113 Span<float> factors,
114 MutableSpan<float3> translations);
115void calc_relaxed_translations_grids(const SubdivCCG &subdiv_ccg,
116 OffsetIndices<int> faces,
117 Span<int> corner_verts,
118 Span<int> face_sets,
119 GroupedSpan<int> vert_to_face_map,
120 BitSpan boundary_verts,
121 const Set<OrderedEdge> &boundary_edges,
122 Span<int> grids,
123 bool filter_boundary_face_sets,
124 Span<float> factors,
125 MutableSpan<float3> translations);
126void calc_relaxed_translations_bmesh(const Set<BMVert *, 0> &verts,
127 Span<float3> positions,
128 const int face_set_offset,
129 bool filter_boundary_face_sets,
130 Span<float> factors,
131 MutableSpan<float3> translations);
132
133} // namespace ed::sculpt_paint::smooth
134
135} // namespace blender
ccl_device_inline float beta(const float x, const float y)
Definition math_base.h:708
void average_data_bmesh(const Span< T > src, const Set< BMVert *, 0 > &verts, const MutableSpan< T > dst)
void neighbor_position_average_interior_grids(const OffsetIndices< int > faces, const Span< int > corner_verts, const BitSpan boundary_verts, const Set< OrderedEdge > &boundary_edges, const SubdivCCG &subdiv_ccg, const Span< int > grids, const MutableSpan< float3 > new_positions)
void neighbor_data_average_mesh(const Span< T > src, const GroupedSpan< int > vert_neighbors, const MutableSpan< T > dst)
void neighbor_color_average(const OffsetIndices< int > faces, const Span< int > corner_verts, const GroupedSpan< int > vert_to_face_map, const GSpan color_attribute, const bke::AttrDomain color_domain, const GroupedSpan< int > vert_neighbors, const MutableSpan< float4 > smooth_colors)
void calc_relaxed_translations_faces(const Span< float3 > vert_positions, const Span< float3 > vert_normals, const OffsetIndices< int > faces, const Span< int > corner_verts, const GroupedSpan< int > vert_to_face_map, const BitSpan boundary_verts, const Set< OrderedEdge > &boundary_edges, const Span< int > face_sets, const Span< bool > hide_poly, const bool filter_boundary_face_sets, const Span< int > verts, const Span< float > factors, const MutableSpan< float3 > translations)
void neighbor_data_average_mesh_check_loose(const Span< T > src, const Span< int > verts, const GroupedSpan< int > vert_neighbors, const MutableSpan< T > dst)
void neighbor_position_average_interior_bmesh(const Set< BMVert *, 0 > &verts, const Span< float > factors, const MutableSpan< float3 > new_positions)
void surface_smooth_laplacian_step(const Span< float3 > positions, const Span< float3 > orig_positions, const Span< float3 > average_positions, const float alpha, MutableSpan< float3 > laplacian_disp, MutableSpan< float3 > translations)
void surface_smooth_displace_step(const Span< float3 > laplacian_disp, const Span< float3 > average_laplacian_disp, const float beta, const MutableSpan< float3 > translations)
void bmesh_four_neighbor_average(float avg[3], const float3 &direction, const BMVert *v)
void average_data_grids(const SubdivCCG &subdiv_ccg, const Span< T > src, const Span< int > grids, const MutableSpan< T > dst)
void blur_geometry_data_array(const Object &object, const int iterations, const MutableSpan< float > data)
void calc_relaxed_translations_bmesh(const Set< BMVert *, 0 > &verts, const Span< float3 > positions, const int face_set_offset, const bool filter_boundary_face_sets, const Span< float > factors, const MutableSpan< float3 > translations)
void neighbor_position_average_bmesh(const Set< BMVert *, 0 > &verts, const MutableSpan< float3 > new_positions)
void calc_relaxed_translations_grids(const SubdivCCG &subdiv_ccg, const OffsetIndices< int > faces, const Span< int > corner_verts, const Span< int > face_sets, const GroupedSpan< int > vert_to_face_map, const BitSpan boundary_verts, const Set< OrderedEdge > &boundary_edges, const Span< int > grids, const bool filter_boundary_face_sets, const Span< float > factors, const MutableSpan< float3 > translations)
BMesh Iterators.
ATTR_WARN_UNUSED_RESULT const BMVert * v
BMesh const char void * data
VecBase< float, 3 > float3
signed char int8_t
Definition BKE_text.h:76