Blender V5.0
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_set.hh"
14
15#include "BKE_subdiv_ccg.hh"
16
17struct BMVert;
18struct Object;
19struct SubdivCCG;
20struct SubdivCCGCoord;
21namespace blender::bke {
22enum class AttrDomain : int8_t;
23}
24
26
31void bmesh_four_neighbor_average(float avg[3], const float3 &direction, const BMVert *v);
32
33void neighbor_color_average(OffsetIndices<int> faces,
34 Span<int> corner_verts,
35 GroupedSpan<int> vert_to_face_map,
36 GSpan color_attribute,
37 bke::AttrDomain color_domain,
38 GroupedSpan<int> vert_neighbors,
39 MutableSpan<float4> smooth_colors);
40
42 Span<int> corner_verts,
43 BitSpan boundary_verts,
44 const SubdivCCG &subdiv_ccg,
45 Span<int> grids,
46 Span<float> factors,
47 MutableSpan<float3> new_positions);
49 Span<int> corner_verts,
50 BitSpan boundary_verts,
51 const SubdivCCG &subdiv_ccg,
52 Span<int> grids,
53 MutableSpan<float3> new_positions);
54
55void neighbor_position_average_bmesh(const Set<BMVert *, 0> &verts,
56 MutableSpan<float3> new_positions);
57void neighbor_position_average_interior_bmesh(const Set<BMVert *, 0> &verts,
58 Span<float> factors,
59 MutableSpan<float3> new_positions);
60void neighbor_position_average_interior_bmesh(const Set<BMVert *, 0> &verts,
61 MutableSpan<float3> new_positions);
62
63template<typename T>
64void neighbor_data_average_mesh(Span<T> src, GroupedSpan<int> vert_neighbors, MutableSpan<T> dst);
65
66template<typename T>
68 Span<int> verts,
69 GroupedSpan<int> vert_neighbors,
70 MutableSpan<T> dst);
71
72template<typename T>
73void average_data_grids(const SubdivCCG &subdiv_ccg,
74 Span<T> src,
75 Span<int> grids,
76 MutableSpan<T> dst);
77
78template<typename T>
79void average_data_bmesh(Span<T> src, const Set<BMVert *, 0> &verts, MutableSpan<T> dst);
80
81/* Average the data in the argument span across vertex neighbors. */
82void blur_geometry_data_array(const Object &object, int iterations, MutableSpan<float> data);
83
84/* Surface Smooth Brush. */
85
86void surface_smooth_laplacian_step(Span<float3> positions,
87 Span<float3> orig_positions,
88 Span<float3> average_positions,
89 float alpha,
90 MutableSpan<float3> laplacian_disp,
91 MutableSpan<float3> translations);
92void surface_smooth_displace_step(Span<float3> laplacian_disp,
93 Span<float3> average_laplacian_disp,
94 float beta,
95 MutableSpan<float3> translations);
96
97void calc_relaxed_translations_faces(Span<float3> vert_positions,
98 Span<float3> vert_normals,
99 OffsetIndices<int> faces,
100 Span<int> corner_verts,
101 GroupedSpan<int> vert_to_face_map,
102 BitSpan boundary_verts,
103 Span<int> face_sets,
104 Span<bool> hide_poly,
105 bool filter_boundary_face_sets,
106 Span<int> verts,
107 Span<float> factors,
108 MutableSpan<float3> translations);
109void calc_relaxed_translations_grids(const SubdivCCG &subdiv_ccg,
110 OffsetIndices<int> faces,
111 Span<int> corner_verts,
112 Span<int> face_sets,
113 GroupedSpan<int> vert_to_face_map,
114 BitSpan boundary_verts,
115 Span<int> grids,
116 bool filter_boundary_face_sets,
117 Span<float> factors,
118 MutableSpan<float3> translations);
119void calc_relaxed_translations_bmesh(const Set<BMVert *, 0> &verts,
120 Span<float3> positions,
121 const int face_set_offset,
122 bool filter_boundary_face_sets,
123 Span<float> factors,
124 MutableSpan<float3> translations);
125
126} // namespace blender::ed::sculpt_paint::smooth
struct Object Object
BMesh const char void * data
ATTR_WARN_UNUSED_RESULT const BMVert * v
static float verts[][3]
ccl_device_inline float beta(const float x, const float y)
Definition math_base.h:661
static char faces[256]
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 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 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)
static float3 average_positions(const CCGKey &key, const Span< float3 > positions, const Span< SubdivCCGCoord > coords)
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_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 Span< int > grids, const bool filter_boundary_face_sets, const Span< float > factors, const MutableSpan< float3 > translations)
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 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 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_position_average_bmesh(const Set< BMVert *, 0 > &verts, const MutableSpan< float3 > new_positions)
VecBase< float, 3 > float3