Blender V5.3
sculpt_automask.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 "BKE_paint.hh"
13
14#include "BLI_array.hh"
15#include "BLI_offset_indices.hh"
16#include "BLI_set.hh"
17
18#include "DNA_brush_enums.h"
19
20namespace blender {
21
22struct BMVert;
23struct Brush;
24struct CurveMapping;
25struct Depsgraph;
26struct Object;
27struct Sculpt;
28struct SculptSession;
29namespace bke::pbvh {
30struct MeshNode;
31struct GridsNode;
32struct BMeshNode;
33} // namespace bke::pbvh
34
36
51
52struct Cache {
54
57
58 enum class OcclusionValue : int8_t {
59 Unknown = 0,
60 Visible = 1,
61 Occluded = 2,
62 };
63
73
80
92 void calc_cavity_factor(const Depsgraph &depsgraph,
93 const Object &object,
94 const IndexMask &node_mask);
95};
96
101const Cache *active_cache_get(const SculptSession &ss);
102
109std::unique_ptr<Cache> cache_init(const Depsgraph &depsgraph,
110 const Paint &paint,
111 const Brush *brush,
112 Object &ob);
113
115Cache &filter_cache_ensure(const Depsgraph &depsgraph, const Paint &paint, Object &ob);
117Cache &stroke_cache_ensure(const Depsgraph &depsgraph,
118 const Paint &paint,
119 const Brush *brush,
120 Object &ob);
121
122bool mode_enabled(const Sculpt &sd, const Brush *br, eAutomasking_flag mode);
123bool is_enabled(const Paint &paint, const Object &object, const Brush *br);
124
128void calc_vert_factors(const Depsgraph &depsgraph,
129 const Object &object,
130 const Cache &automasking,
132 Span<int> verts,
133 MutableSpan<float> factors);
134inline void calc_vert_factors(const Depsgraph &depsgraph,
135 const Object &object,
136 const Cache *cache,
138 Span<int> verts,
139 MutableSpan<float> factors)
140{
142 if (cache) {
143 calc_vert_factors(depsgraph, object, *cache, node, verts, factors);
144 }
145}
146void calc_grids_factors(const Depsgraph &depsgraph,
147 const Object &object,
148 const Cache &automasking,
150 Span<int> grids,
151 MutableSpan<float> factors);
152inline void calc_grids_factors(const Depsgraph &depsgraph,
153 const Object &object,
154 const Cache *cache,
156 Span<int> grids,
157 MutableSpan<float> factors)
158{
159 if (cache) {
160 calc_grids_factors(depsgraph, object, *cache, node, grids, factors);
161 }
162}
163void calc_vert_factors(const Depsgraph &depsgraph,
164 const Object &object,
165 const Cache &automasking,
167 const Set<BMVert *, 0> &verts,
168 MutableSpan<float> factors);
169inline void calc_vert_factors(const Depsgraph &depsgraph,
170 const Object &object,
171 const Cache *cache,
173 const Set<BMVert *, 0> &verts,
174 MutableSpan<float> factors)
175{
176 if (cache) {
177 calc_vert_factors(depsgraph, object, *cache, node, verts, factors);
178 }
179}
180
188void calc_interpolated_face_factors(const Depsgraph &depsgraph,
189 const Object &object,
190 OffsetIndices<int> faces,
191 Span<int> corner_verts,
192 const Cache &automasking,
194 Span<int> face_indices,
195 MutableSpan<float> factors);
196
197} // namespace ed::sculpt_paint::auto_mask
198
199} // namespace blender
#define PRF_scope(category)
std::unique_ptr< Cache > cache_init(const Depsgraph &depsgraph, const Paint &paint, const Brush *brush, Object &ob)
const Cache * active_cache_get(const SculptSession &ss)
Cache & stroke_cache_ensure(const Depsgraph &depsgraph, const Paint &paint, const Brush *brush, Object &ob)
bool is_enabled(const Paint &paint, const Object &object, const Brush *br)
void calc_vert_factors(const Depsgraph &depsgraph, const Object &object, const Cache &automasking, const bke::pbvh::MeshNode &node, Span< int > verts, MutableSpan< float > factors)
void calc_grids_factors(const Depsgraph &depsgraph, const Object &object, const Cache &automasking, const bke::pbvh::GridsNode &node, Span< int > grids, MutableSpan< float > factors)
void calc_interpolated_face_factors(const Depsgraph &depsgraph, const Object &object, OffsetIndices< int > faces, Span< int > corner_verts, const Cache &automasking, const bke::pbvh::MeshNode &node, Span< int > face_indices, MutableSpan< float > factors)
bool mode_enabled(const Sculpt &sd, const Brush *br, eAutomasking_flag mode)
Cache & filter_cache_ensure(const Depsgraph &depsgraph, const Paint &paint, Object &ob)
BMesh Iterators.
signed char int8_t
Definition BKE_text.h:76
void calc_cavity_factor(const Depsgraph &depsgraph, const Object &object, const IndexMask &node_mask)
std::array< int, PAINT_SYMM_AREAS > initial_island_nr