61 for (
const int i :
verts.index_range()) {
84 const float height_rcp =
math::rcp(height);
87 const float3 &position = local_positions[
i];
88 if (position.z >= 0.0f) {
95 if (local_positions[
i].
z >= 0.0f) {
102 const float depth_rcp =
math::rcp(depth);
105 const float3 &position = local_positions[
i];
106 if (position.z < 0.0f) {
113 if (local_positions[
i].
z < 0.0f) {
135 if (!
ELEM(height, 1.0f, 0.0f)) {
137 if (local_positions[
i].
z > 0.0f) {
138 factors[
i] *= height;
143 if (!
ELEM(depth, 0.0f, 1.0f)) {
145 if (local_positions[
i].
z < 0.0f) {
176 const float strength,
182 factors[
i] *= local_positions[
i].z;
185 const float3 &offset = -plane_normal * radius * strength;
193 const float3 &plane_normal,
194 const float strength,
244 position_data.deform(translations,
verts);
252 const float3 &plane_normal,
253 const float strength,
309 const float3 &plane_normal,
310 const float strength,
365 const float3 &plane_normal,
366 const float3 &plane_center)
376 float3 normal = plane_normal;
377 float3 center = plane_center;
383 const float displace = ss.
cache->
radius * offset * (flip ? -1.0f : 1.0f);
384 center += normal * ss.
cache->
scale * displace;
409 std::swap(height, depth);
416 switch (pbvh.
type()) {
444 SubdivCCG &subdiv_ccg = *
object.sculpt->subdiv_ccg;
450 depsgraph, sd,
object, brush, mat, normal, strength, height, depth,
nodes[
i], tls);
460 depsgraph, sd,
object, brush, mat, normal, strength, height, depth,
nodes[
i], tls);
506 return {plane_mask, plane_center, plane_normal};
void BKE_brush_calc_curve_factors(eBrushCurvePreset preset, const CurveMapping *cumap, blender::Span< float > distances, float brush_radius, blender::MutableSpan< float > factors)
const Brush * BKE_paint_brush_for_read(const Paint *paint)
A BVH for high poly meshes.
const blender::Set< BMVert *, 0 > & BKE_pbvh_bmesh_node_unique_verts(blender::bke::pbvh::BMeshNode *node)
@ BRUSH_PLANE_INVERT_DISPLACEMENT
@ BRUSH_PLANE_SWAP_HEIGHT_AND_DEPTH
Object is a sort of wrapper for general info.
BPy_StructRNA * depsgraph
SIMD_FORCE_INLINE const btScalar & z() const
Return the z value.
void resize(const int64_t new_size)
constexpr int64_t size() const
constexpr IndexRange index_range() const
void tag_positions_changed(const IndexMask &node_mask)
Span< NodeT > nodes() const
void flush_bounds_to_parents()
void foreach_index(Fn &&fn) 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)
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)
static void calc_bmesh(const Depsgraph &depsgraph, const Sculpt &sd, Object &object, const Brush &brush, const float3 &direction, const float strength, bke::pbvh::BMeshNode &node, LocalData &tls)
static void calc_faces(const Depsgraph &depsgraph, const Sculpt &sd, const Brush &brush, const float4 &test_plane, const float strength, const MeshAttributeData &attribute_data, const Span< float3 > vert_normals, const bke::pbvh::MeshNode &node, Object &object, LocalData &tls, const PositionDeformData &position_data)
static void calc_grids(const Depsgraph &depsgraph, const Sculpt &sd, Object &object, const Brush &brush, const float4 &test_plane, const float strength, bke::pbvh::GridsNode &node, LocalData &tls)
static BLI_NOINLINE void fill_factor_from_hide_and_mask(const Mesh &mesh, const Span< int > face_indices, const MutableSpan< float > r_factors)
static void calc_translations(const float3 &plane_normal, const float radius, const float strength, const MutableSpan< float3 > local_positions, const MutableSpan< float > factors, const MutableSpan< float3 > r_translations)
static void scale_factors_by_height_and_depth(const float height, const float depth, const MutableSpan< float3 > local_positions, const MutableSpan< float > factors)
static void calc_grids(const Depsgraph &depsgraph, const Sculpt &sd, Object &object, const Brush &brush, const float4x4 &mat, const float3 &plane_normal, const float strength, const float height, const float depth, bke::pbvh::GridsNode &node, LocalData &tls)
static void calc_local_positions(const float4x4 &mat, const Span< int > verts, const Span< float3 > positions, const MutableSpan< float3 > local_positions)
static void calc_local_distances(const float height, const float depth, const MutableSpan< float3 > local_positions, const MutableSpan< float > distances)
static void calc_bmesh(const Depsgraph &depsgraph, const Sculpt &sd, Object &object, const Brush &brush, const float4x4 &mat, const float3 &plane_normal, const float strength, const float height, const float depth, bke::pbvh::BMeshNode &node, LocalData &tls)
static void calc_faces(const Depsgraph &depsgraph, const Sculpt &sd, const Brush &brush, const float4x4 &mat, const float3 &plane_normal, const float strength, const float height, const float depth, const MeshAttributeData &attribute_data, const Span< float3 > vert_normals, const bke::pbvh::MeshNode &node, Object &object, LocalData &tls, const PositionDeformData &position_data)
CursorSampleResult calc_node_mask(const Depsgraph &depsgraph, Object &ob, const Brush &brush, IndexMaskMemory &memory)
void do_plane_brush(const Depsgraph &depsgraph, const Sculpt &sd, Object &object, const IndexMask &node_mask, const float3 &plane_normal, const float3 &plane_center)
MutableSpan< float3 > gather_grids_positions(const SubdivCCG &subdiv_ccg, const Span< int > grids, Vector< float3 > &positions)
bool node_in_sphere(const bke::pbvh::Node &node, const float3 &location, const float radius_sq, const bool original)
void gather_bmesh_positions(const Set< BMVert *, 0 > &verts, MutableSpan< float3 > positions)
void apply_hardness_to_distances(float radius, float hardness, MutableSpan< float > distances)
bool node_fully_masked_or_hidden(const bke::pbvh::Node &node)
void filter_distances_with_radius(float radius, Span< float > distances, MutableSpan< float > factors)
void filter_region_clip_factors(const SculptSession &ss, Span< float3 > vert_positions, Span< int > verts, MutableSpan< float > factors)
void clip_and_lock_translations(const Sculpt &sd, const SculptSession &ss, Span< float3 > positions, Span< int > verts, MutableSpan< float3 > translations)
IndexMask gather_nodes(const bke::pbvh::Tree &pbvh, const eBrushFalloffShape falloff_shape, const bool use_original, const float3 &location, const float radius_sq, const std::optional< float3 > &ray_direction, IndexMaskMemory &memory)
void calc_brush_plane(const Depsgraph &depsgraph, const Brush &brush, Object &ob, const IndexMask &node_mask, float3 &r_area_no, float3 &r_area_co)
void apply_translations(Span< float3 > translations, Span< int > verts, MutableSpan< float3 > positions)
void calc_brush_texture_factors(const SculptSession &ss, const Brush &brush, Span< float3 > vert_positions, Span< int > vert, MutableSpan< float > factors)
float brush_plane_offset_get(const Brush &brush, const SculptSession &ss)
void calc_front_face(const float3 &view_normal, Span< float3 > normals, MutableSpan< float > factors)
void translations_from_offset_and_factors(const float3 &offset, Span< float > factors, MutableSpan< float3 > r_translations)
float3 tilt_apply_to_normal(const Object &object, const float4x4 &view_inverse, const float3 &normal, const float2 &tilt, const float tilt_strength)
T length(const VecBase< T, Size > &a)
CartesianBasis invert(const CartesianBasis &basis)
AxisSigned cross(const AxisSigned a, const AxisSigned b)
MatT from_scale(const VecBase< typename MatT::base_type, ScaleDim > &scale)
MatBase< T, NumCol, NumRow > normalize(const MatBase< T, NumCol, NumRow > &a)
void transform_points(const float4x4 &transform, MutableSpan< float3 > points, bool use_threading=true)
VecBase< T, 3 > transform_point(const CartesianBasis &basis, const VecBase< T, 3 > &v)
MatBase< float, 4, 4 > float4x4
VecBase< float, 3 > float3
float tilt_strength_factor
struct CurveMapping * curve_distance_falloff
int curve_distance_falloff_preset
struct SculptSession * sculpt
blender::ed::sculpt_paint::StrokeCache * cache
blender::Array< blender::float3 > positions
static MatBase identity()
Span< int > grids() const
Span< int > verts() const
VArraySpan< bool > hide_vert
std::unique_ptr< auto_mask::Cache > automasking
bool initial_direction_flipped
Vector< float > distances
Vector< float3 > positions
Vector< float3 > local_positions
Vector< float3 > translations
Vector< float > distances
Vector< float3 > positions
Vector< float3 > translations
Vector< float3 > local_positions