Blender V5.3
sculpt_boundary.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#pragma once
9
10#include <memory>
11
12#include "BLI_array.hh"
13#include "BLI_bit_span.hh"
14#include "BLI_map.hh"
16#include "BLI_offset_indices.hh"
17#include "BLI_ordered_edge.hh"
18#include "BLI_set.hh"
19#include "BLI_span.hh"
20#include "BLI_vector.hh"
21
22#include "BKE_paint.hh"
23
24#include "DNA_mesh_types.h"
25
26namespace blender {
27
28struct Brush;
29struct BMVert;
30struct Depsgraph;
31struct Object;
32struct Sculpt;
34struct SculptSession;
35struct SubdivCCG;
36struct SubdivCCGCoord;
37namespace bke::pbvh {
38class Node;
39}
40
42
44 /* Vertex indices of the active boundary. */
46
47 /* Distance from a vertex in the boundary to initial vertex indexed by vertex index, taking into
48 * account the length of all edges between them. Any vertex that is not in the boundary will have
49 * a distance of 0. */
51
52 /* Data for drawing the preview. */
54
55 /* Initial vertex index in the boundary which is closest to the current sculpt active vertex. */
57
58 /* Vertex that at max_propagation_steps from the boundary and closest to the original active
59 * vertex that was used to initialize the boundary. This is used as a reference to check how much
60 * the deformation will go into the mesh and to calculate the strength of the brushes. */
62
63 /* Stores the initial positions of the pivot and boundary initial vertex as they may be deformed
64 * during the brush action. This allows to use them as a reference positions and vectors for some
65 * brush effects. */
67
68 /* Maximum number of topology steps that were calculated from the boundary. */
70
71 /* Indexed by vertex index, contains the topology information needed for boundary deformations.
72 */
73 struct {
74 /* Vertex index from where the topology propagation reached this vertex. */
76
77 /* How many steps were needed to reach this vertex from the boundary. */
79
80 /* Strength that is used to deform this vertex. */
83
84 /* Bend Deform type. */
89
90 /* Slide Deform type. */
94
95 /* Twist Deform type. */
100};
101
107void ensure_boundary_info(Object &object);
109
115bool vert_is_boundary(GroupedSpan<int> vert_to_face_map,
116 Span<bool> hide_poly,
117 BitSpan boundary_verts,
118 int vert);
120 Span<int> corner_verts,
121 BitSpan boundary_verts,
122 const Set<OrderedEdge> &boundary_edges,
123 const SubdivCCG &subdiv_ccg,
124 SubdivCCGCoord vert);
125bool vert_is_boundary(BMVert *vert);
126
131std::unique_ptr<SculptBoundary> data_init(const Depsgraph &depsgraph,
132 Object &object,
133 const Brush *brush,
134 int initial_vert,
135 float radius);
136std::unique_ptr<SculptBoundary> data_init_mesh(const Depsgraph &depsgraph,
137 Object &object,
138 const Brush *brush,
139 int initial_vert,
140 float radius);
141std::unique_ptr<SculptBoundary> data_init_grids(Object &object,
142 const Brush *brush,
143 SubdivCCGCoord initial_vert,
144 float radius);
145std::unique_ptr<SculptBoundary> data_init_bmesh(Object &object,
146 const Brush *brush,
147 BMVert *initial_vert,
148 float radius);
149std::unique_ptr<SculptBoundaryPreview> preview_data_init(const Depsgraph &depsgraph,
150 Object &object,
151 const Brush *brush,
152 float radius);
153
154void edges_preview_draw(uint gpuattr,
155 SculptSession &ss,
156 const float outline_col[3],
157 float outline_alpha);
159
160void do_boundary_brush(const Depsgraph &depsgraph,
161 const Sculpt &sd,
162 Object &object,
163 const IndexMask &node_mask);
164
165} // namespace ed::sculpt_paint::boundary
166
167} // namespace blender
void pivot_line_preview_draw(const uint gpuattr, SculptSession &ss)
std::unique_ptr< SculptBoundary > data_init_bmesh(Object &object, const Brush *brush, BMVert *initial_vert, const float radius)
std::unique_ptr< SculptBoundaryPreview > preview_data_init(const Depsgraph &depsgraph, Object &object, const Brush *brush, const float radius)
SculptBoundaryInfoCache create_boundary_info(const Mesh &mesh)
Definition sculpt.cc:599
std::unique_ptr< SculptBoundary > data_init(const Depsgraph &depsgraph, Object &object, const Brush *brush, const int initial_vert, const float radius)
void edges_preview_draw(const uint gpuattr, SculptSession &ss, const float outline_col[3], const float outline_alpha)
std::unique_ptr< SculptBoundary > data_init_mesh(const Depsgraph &depsgraph, Object &object, const Brush *brush, const int initial_vert, const float radius)
void do_boundary_brush(const Depsgraph &depsgraph, const Sculpt &sd, Object &ob, const IndexMask &node_mask)
void ensure_boundary_info(Object &object)
Definition sculpt.cc:588
std::unique_ptr< SculptBoundary > data_init_grids(Object &object, const Brush *brush, const SubdivCCGCoord initial_vert, const float radius)
bool vert_is_boundary(const GroupedSpan< int > vert_to_face_map, const Span< bool > hide_poly, const BitSpan boundary_verts, const int vert)
Definition sculpt.cc:620
BMesh Iterators.
unsigned int uint
Definition BKE_text.h:55
VecBase< float, 3 > float3
Vector< std::pair< float3, float3 > > edges
struct blender::ed::sculpt_paint::boundary::SculptBoundary::@106214271235334006054336306317206226324367136255 slide
struct blender::ed::sculpt_paint::boundary::SculptBoundary::@365033310352110033323233351015372214170115306132 twist
struct blender::ed::sculpt_paint::boundary::SculptBoundary::@116131077265303162322121273037276001112016225204 bend
struct blender::ed::sculpt_paint::boundary::SculptBoundary::@142333050112305321110312115363030156116315012035 edit_info