Blender V5.3
blender::ed::sculpt_paint::brushes::scene_project_cc Namespace Reference

Classes

struct  LocalData

Functions

static float absolute_min_distance (const float d1, const float d2)
static void object_raycast (const ProjectBrushTarget &project_target, const bool bidirectional, const float3 &normal, const Span< float3 > positions, const Span< float > factors, const MutableSpan< float3 > ray_origins, const MutableSpan< float > best_hit_distances)
static void scene_raycast (const Span< ProjectBrushTarget > project_targets, const bool bidirectional, const float minimum_distance, const float3 &normal, const Span< float3 > positions, const Span< float > factors, const MutableSpan< float3 > ray_origins, const MutableSpan< float > r_hit_distances)
static void calc_translations (const float3 &normal, const Span< float > factors, const Span< float > hit_distances, const MutableSpan< float3 > r_translations)
static float3 calc_normal (const Brush &brush, const StrokeCache &cache)
static void calc_faces (const Depsgraph &depsgraph, const Sculpt &sd, const Brush &brush, const bool bidirectional, const float3 &normal, const MeshAttributeData &attribute_data, const Span< float3 > vert_normals, const bke::pbvh::MeshNode &node, Object &object, const PositionDeformData &position_data)
static void calc_grids (const Depsgraph &depsgraph, const Sculpt &sd, Object &object, const Brush &brush, const bool bidirectional, const float3 &normal, const bke::pbvh::GridsNode &node, LocalData &tls)
static void calc_bmesh (const Depsgraph &depsgraph, const Sculpt &sd, Object &object, const Brush &brush, const bool bidirectional, const float3 &normal, bke::pbvh::BMeshNode &node, LocalData &tls)

Function Documentation

◆ absolute_min_distance()

float blender::ed::sculpt_paint::brushes::scene_project_cc::absolute_min_distance ( const float d1,
const float d2 )
inlinestatic

Definition at line 65 of file scene_project.cc.

◆ calc_bmesh()

void blender::ed::sculpt_paint::brushes::scene_project_cc::calc_bmesh ( const Depsgraph & depsgraph,
const Sculpt & sd,
Object & object,
const Brush & brush,
const bool bidirectional,
const float3 & normal,
bke::pbvh::BMeshNode & node,
LocalData & tls )
static

Definition at line 299 of file scene_project.cc.

◆ calc_faces()

void blender::ed::sculpt_paint::brushes::scene_project_cc::calc_faces ( const Depsgraph & depsgraph,
const Sculpt & sd,
const Brush & brush,
const bool bidirectional,
const float3 & normal,
const MeshAttributeData & attribute_data,
const Span< float3 > vert_normals,
const bke::pbvh::MeshNode & node,
Object & object,
const PositionDeformData & position_data )
static

Definition at line 212 of file scene_project.cc.

◆ calc_grids()

void blender::ed::sculpt_paint::brushes::scene_project_cc::calc_grids ( const Depsgraph & depsgraph,
const Sculpt & sd,
Object & object,
const Brush & brush,
const bool bidirectional,
const float3 & normal,
const bke::pbvh::GridsNode & node,
LocalData & tls )
static

Definition at line 261 of file scene_project.cc.

◆ calc_normal()

float3 blender::ed::sculpt_paint::brushes::scene_project_cc::calc_normal ( const Brush & brush,
const StrokeCache & cache )
static

Definition at line 199 of file scene_project.cc.

◆ calc_translations()

void blender::ed::sculpt_paint::brushes::scene_project_cc::calc_translations ( const float3 & normal,
const Span< float > factors,
const Span< float > hit_distances,
const MutableSpan< float3 > r_translations )
static

Definition at line 188 of file scene_project.cc.

◆ object_raycast()

void blender::ed::sculpt_paint::brushes::scene_project_cc::object_raycast ( const ProjectBrushTarget & project_target,
const bool bidirectional,
const float3 & normal,
const Span< float3 > positions,
const Span< float > factors,
const MutableSpan< float3 > ray_origins,
const MutableSpan< float > best_hit_distances )
static

Casts rays from the vertices of the active object to the target object, using the given normal as the ray direction. Updates best_hit_distances with the minimum absolute hit distance found against this target object.

It should be noted that:

  1. The BVH of the target object, used for raycasting, expects the ray to be expressed in the coordinate system of the target object.
  2. The hit distance is best thought as a parametric distance, and does not depend on the coordinate system used.

Explanation for the latter point:

Mathematically, if the ray hits the target object, then there exists a point Q on the surface of the target object such that:

Q = P + dN

where P is the position of the vertex that casts the ray, N is the normal, and d is a non-negative real number representing the distance.

Suppose that M is a transformation matrix. Multiplying both sides by M, we get:

MQ = M(P + dN)

and by linearity:

MQ = MP + dMN

Therefore, d also represents the parametric distance in the new coordinate system.

Definition at line 102 of file scene_project.cc.

◆ scene_raycast()

void blender::ed::sculpt_paint::brushes::scene_project_cc::scene_raycast ( const Span< ProjectBrushTarget > project_targets,
const bool bidirectional,
const float minimum_distance,
const float3 & normal,
const Span< float3 > positions,
const Span< float > factors,
const MutableSpan< float3 > ray_origins,
const MutableSpan< float > r_hit_distances )
static

Casts rays from the active object's positions to find the closest hits with the target objects in the scene, storing distances in r_hit_distances.

Definition at line 155 of file scene_project.cc.