52 switch (
brush.slide_deform_type) {
71 const float3 &neighbor_position,
76 if (
math::dot(dir, neighbor_dir) > 0.0f) {
77 translation += neighbor_dir *
math::dot(dir, neighbor_disp);
89 const float3 &dir = translations[i];
91 float3 final_translation(0);
92 for (
const int neighbor : vert_neighbors[i]) {
96 translations[i] = final_translation;
108 const int node_start = i * key.
grid_area;
109 const int grid = grids[i];
114 const int vert = start + offset;
115 const int node_vert = node_start + offset;
118 const float3 &dir = translations[node_vert];
128 float3 final_translation(0);
134 translations[node_vert] = final_translation;
147 for (
BMVert *vert : verts) {
149 const float3 &dir = translations[i];
151 float3 final_translation(0);
156 translations[i] = final_translation;
200 tls.neighbor_offsets,
209 position_data.deform(translations, verts);
297 switch (
pbvh.type()) {
326 SubdivCCG &subdiv_ccg = *
object.runtime->sculpt_session->subdiv_ccg;
350 pbvh.tag_positions_changed(node_mask);
351 pbvh.flush_bounds_to_parents();
A BVH for high poly meshes.
Object is a sort of wrapper for general info.
#define PRF_scope(category)
MutableSpan< T > as_mutable_span()
constexpr IndexRange()=default
constexpr int64_t size() const
constexpr void fill(const T &value) const
constexpr int64_t size() const
constexpr IndexRange index_range() const
void foreach_index(Fn &&fn, Mode mode=exec_mode::serial) const
pbvh::Tree * pbvh_get(Object &object)
void update_node_bounds_bmesh(BMeshNode &node)
void update_node_bounds_mesh(Span< float3 > positions, MeshNode &node)
void update_node_bounds_grids(int grid_area, Span< float3 > positions, GridsNode &node)
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)
static BLI_NOINLINE void calc_neighbor_influence(const Span< float3 > vert_positions, const Span< float3 > positions, const GroupedSpan< int > vert_neighbors, const MutableSpan< float3 > translations)
static void add_neighbor_influence(const float3 &position, const float3 &dir, const float3 &neighbor_position, float3 &translation)
static BLI_NOINLINE void calc_translation_directions(const Brush &brush, const StrokeCache &cache, const Span< float3 > positions, const MutableSpan< float3 > r_translations)
void do_topology_slide_brush(const Depsgraph &depsgraph, const Sculpt &sd, Object &object, const IndexMask &node_mask)
MutableSpan< float3 > gather_grids_positions(const SubdivCCG &subdiv_ccg, const Span< int > grids, Vector< float3 > &positions)
void calc_factors_common_from_orig_data_grids(const Depsgraph &depsgraph, const Brush &brush, const Object &object, Span< float3 > positions, Span< float3 > normals, const bke::pbvh::GridsNode &node, Vector< float > &r_factors, Vector< float > &r_distances)
void gather_bmesh_positions(const Set< BMVert *, 0 > &verts, MutableSpan< float3 > positions)
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)
Vector< BMVert *, 64 > BMeshNeighborVerts
void calc_factors_common_from_orig_data_mesh(const Depsgraph &depsgraph, const Brush &brush, const Object &object, const MeshAttributeData &attribute_data, Span< float3 > positions, Span< float3 > normals, const bke::pbvh::MeshNode &node, MutableSpan< float > r_factors, MutableSpan< float > r_distances)
bool stroke_is_first_brush_step_of_symmetry_pass(const StrokeCache &cache)
void orig_position_data_gather_bmesh(const BMLog &bm_log, const Set< BMVert *, 0 > &verts, MutableSpan< float3 > positions, MutableSpan< float3 > normals)
void scale_translations(MutableSpan< float3 > translations, Span< float > factors)
void scale_factors(MutableSpan< float > factors, float strength)
void clip_and_lock_translations(const Sculpt &sd, const SculptSession &ss, Span< float3 > positions, Span< int > verts, MutableSpan< float3 > translations)
Span< BMVert * > vert_neighbors_get_bmesh(BMVert &vert, BMeshNeighborVerts &r_neighbors)
void apply_translations(Span< float3 > translations, Span< int > verts, MutableSpan< float3 > positions)
OrigPositionData orig_position_data_get_mesh(const Object &object, const bke::pbvh::MeshNode &node)
void gather_data_mesh(Span< T > src, Span< int > indices, MutableSpan< T > dst)
OrigPositionData orig_position_data_get_grids(const Object &object, const bke::pbvh::GridsNode &node)
void calc_factors_common_from_orig_data_bmesh(const Depsgraph &depsgraph, const Brush &brush, const Object &object, Span< float3 > positions, Span< float3 > normals, bke::pbvh::BMeshNode &node, Vector< float > &r_factors, Vector< float > &r_distances)
constexpr ParallelGrainSize grain_size(int grain_size)
T dot(const QuaternionBase< T > &a, const QuaternionBase< T > &b)
MatBase< T, NumCol, NumRow > normalize(const MatBase< T, NumCol, NumRow > &a)
@ BRUSH_SLIDE_DEFORM_EXPAND
@ BRUSH_SLIDE_DEFORM_DRAG
@ BRUSH_SLIDE_DEFORM_PINCH
CCGKey BKE_subdiv_ccg_key_top_level(const SubdivCCG &subdiv_ccg)
void BKE_subdiv_ccg_neighbor_coords_get(const SubdivCCG &subdiv_ccg, const SubdivCCGCoord &coord, bool include_duplicates, SubdivCCGNeighbors &r_neighbors)
BMesh const char void * data
int CCG_grid_xy_to_index(const int grid_size, const int x, const int y)
const Brush * BKE_paint_brush_for_read(const Paint *paint)
VecBase< float, 3 > float3
const Set< BMVert *, 0 > & BKE_pbvh_bmesh_node_unique_verts(bke::pbvh::BMeshNode *node)
ed::sculpt_paint::StrokeCache * cache
int to_index(const CCGKey &key) const
SubdivCCGNeighborCoords coords
Array< float3 > positions
VArraySpan< bool > hide_poly
float3 last_location_symm
Vector< float > distances
Vector< float3 > positions
Vector< float3 > translations
Vector< float3 > positions
Vector< float > distances
Vector< int > neighbor_offsets
Vector< int > neighbor_data
Vector< float3 > translations