82 position_data.deform(translations, verts);
117 const float strength,
153 tls.neighbor_offsets,
156 tls.new_positions.resize(verts.
size());
174 tls.new_positions.resize(positions.
size());
192 tls.new_positions.resize(verts.
size());
224 const float strength = std::clamp(ss.
cache->
bstrength, -1.0f, 1.0f);
228 switch (
pbvh.type()) {
253 SubdivCCG &subdiv_ccg = *
object.runtime->sculpt_session->subdiv_ccg;
277 pbvh.tag_positions_changed(node_mask);
278 pbvh.flush_bounds_to_parents();
292 switch (
pbvh.type()) {
304 calc_translations_faces(positions_eval,
322 calc_translations_grids(subdiv_ccg,
nodes[i], tls, translations);
333 calc_translations_bmesh(
nodes[i], tls, translations);
A BVH for high poly meshes.
Object is a sort of wrapper for general info.
#define PRF_scope(category)
Span< T > as_span() const
void reinitialize(const int64_t new_size)
constexpr int64_t size() const
constexpr Span< T > as_span() const
constexpr int64_t size() const
void foreach_index(Fn &&fn, Mode mode=exec_mode::serial) const
pbvh::Tree * pbvh_get(Object &object)
IndexMask search_nodes(const Tree &pbvh, IndexMaskMemory &memory, FunctionRef< bool(const Node &)> filter_fn)
void update_node_bounds_bmesh(BMeshNode &node)
void update_node_bounds_mesh(Span< float3 > positions, MeshNode &node)
Span< float3 > vert_normals_eval(const Depsgraph &depsgraph, const Object &object_orig)
void update_node_bounds_grids(int grid_area, Span< float3 > positions, GridsNode &node)
Span< float3 > vert_positions_eval(const Depsgraph &depsgraph, const Object &object_orig)
static void calc_translations_faces(const Span< float3 > vert_positions, const OffsetIndices< int > faces, const Span< int > corner_verts, const GroupedSpan< int > vert_to_face_map, const Span< bool > hide_poly, const bke::pbvh::MeshNode &node, LocalData &tls, const MutableSpan< float3 > all_translations)
static void calc_translations_grids(const SubdivCCG &subdiv_ccg, const bke::pbvh::GridsNode &node, LocalData &tls, const MutableSpan< float3 > all_translations)
static void calc_translations_bmesh(const bke::pbvh::BMeshNode &node, LocalData &tls, const MutableSpan< float3 > all_translations)
static void calc_bmesh(const Depsgraph &depsgraph, const Sculpt &sd, const Brush &brush, Object &object, bke::pbvh::BMeshNode &node, LocalData &tls, MutableSpan< float > layer_displacement_factor)
static void calc_grids(const Depsgraph &depsgraph, const Sculpt &sd, const Brush &brush, Object &object, const bool use_persistent_base, const Span< float3 > persistent_base_positions, const Span< float3 > persistent_base_normals, bke::pbvh::GridsNode &node, LocalData &tls, MutableSpan< float > layer_displacement_factor)
static void calc_faces(const Depsgraph &depsgraph, const Sculpt &sd, const Brush &brush, const MeshAttributeData &attribute_data, const Span< float3 > vert_normals, const bool use_persistent_base, const Span< float3 > persistent_base_positions, const Span< float3 > persistent_base_normals, Object &object, bke::pbvh::MeshNode &node, MutableSpan< float > layer_displacement_factor, const PositionDeformData &position_data)
void do_enhance_details_brush(const Depsgraph &depsgraph, const Sculpt &sd, Object &object, const IndexMask &node_mask)
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 average_data_grids(const SubdivCCG &subdiv_ccg, const Span< T > src, const Span< int > grids, const MutableSpan< T > dst)
void neighbor_position_average_bmesh(const Set< BMVert *, 0 > &verts, const MutableSpan< float3 > new_positions)
MutableSpan< float3 > gather_grids_positions(const SubdivCCG &subdiv_ccg, const Span< int > grids, Vector< float3 > &positions)
void calc_smooth_translations(const Depsgraph &depsgraph, const Object &object, const IndexMask &node_mask, const MutableSpan< float3 > translations)
void scatter_data_bmesh(Span< T > node_data, const Set< BMVert *, 0 > &verts, MutableSpan< T > dst)
void gather_bmesh_positions(const Set< BMVert *, 0 > &verts, MutableSpan< float3 > positions)
void gather_data_grids(const SubdivCCG &subdiv_ccg, Span< T > src, Span< int > grids, MutableSpan< T > node_data)
void vert_random_access_ensure(Object &object)
void calc_factors_common_grids(const Depsgraph &depsgraph, const Brush &brush, const Object &object, Span< float3 > positions, const bke::pbvh::GridsNode &node, Vector< float > &r_factors, Vector< float > &r_distances)
GroupedSpan< int > calc_vert_neighbors(OffsetIndices< int > faces, Span< int > corner_verts, GroupedSpan< int > vert_to_face, Span< bool > hide_poly, Span< int > verts, Vector< int > &r_offset_data, Vector< int > &r_data)
bool node_fully_masked_or_hidden(const bke::pbvh::Node &node)
int vertex_count_get(const Object &object)
void gather_data_bmesh(Span< T > src, const Set< BMVert *, 0 > &verts, MutableSpan< T > node_data)
void scale_translations(MutableSpan< float3 > translations, Span< float > factors)
void calc_factors_common_mesh_indexed(const Depsgraph &depsgraph, const Brush &brush, const Object &object, const MeshAttributeData &attribute_data, Span< float3 > vert_positions, Span< float3 > vert_normals, const bke::pbvh::MeshNode &node, MutableSpan< float > factors, MutableSpan< float > distances)
void scale_factors(MutableSpan< float > factors, float strength)
void translations_from_new_positions(Span< float3 > new_positions, Span< int > verts, Span< float3 > old_positions, MutableSpan< float3 > translations)
void clip_and_lock_translations(const Sculpt &sd, const SculptSession &ss, Span< float3 > positions, Span< int > verts, MutableSpan< float3 > translations)
void scatter_data_mesh(Span< T > src, Span< int > indices, MutableSpan< T > dst)
void apply_translations(Span< float3 > translations, Span< int > verts, MutableSpan< float3 > positions)
void gather_data_mesh(Span< T > src, Span< int > indices, MutableSpan< T > dst)
void scatter_data_grids(const SubdivCCG &subdiv_ccg, Span< T > node_data, Span< int > grids, MutableSpan< T > dst)
void calc_factors_common_bmesh(const Depsgraph &depsgraph, const Brush &brush, const Object &object, Span< float3 > positions, bke::pbvh::BMeshNode &node, Vector< float > &r_factors, Vector< float > &r_distances)
constexpr ParallelGrainSize grain_size(int grain_size)
BMesh const char void * data
const Brush * BKE_paint_brush_for_read(const Paint *paint)
const Set< BMVert *, 0 > & BKE_pbvh_bmesh_node_unique_verts(bke::pbvh::BMeshNode *node)
ed::sculpt_paint::StrokeCache * cache
Array< float3 > positions
VArraySpan< bool > hide_poly
Array< float3 > detail_directions
Vector< float > distances
Vector< float3 > positions
Vector< float3 > translations
Vector< int > neighbor_data
Vector< float3 > positions
Vector< int > neighbor_offsets
Vector< float3 > new_positions
Vector< float > distances
Vector< float3 > translations