61 #define BOUNDARY_VERTEX_NONE -1
62 #define BOUNDARY_STEPS_NONE -1
73 SculptSession *ss,
int from_v,
int to_v,
bool is_duplicate,
void *userdata)
82 data->floodfill_steps[to_v] =
data->floodfill_steps[from_v] + 1;
85 data->floodfill_steps[to_v] =
data->floodfill_steps[from_v];
89 if (
data->floodfill_steps[to_v] <
data->boundary_initial_vertex_steps) {
90 data->boundary_initial_vertex_steps =
data->floodfill_steps[to_v];
91 data->boundary_initial_vertex = to_v;
97 return len_sq <
data->radius_sq;
103 const int initial_vertex,
108 return initial_vertex;
118 .boundary_initial_vertex_steps = INT_MAX,
119 .radius_sq = radius * radius,
140 GSet *included_vertices)
147 if (included_vertices) {
178 const int initial_vertex)
185 int neighbor_count = 0;
186 int boundary_vertex_count = 0;
192 boundary_vertex_count++;
200 if (neighbor_count <= 2) {
206 if (boundary_vertex_count > 2) {
226 SculptSession *ss,
int from_v,
int to_v,
bool is_duplicate,
void *userdata)
235 const float distance_boundary_to_dst = boundary->
distance ?
236 boundary->
distance[from_v] + edge_len :
247 const bool init_boundary_distances,
248 const int initial_boundary_index)
254 if (init_boundary_distances) {
272 .included_vertices = included_vertices,
305 const int initial_vertex,
315 for (
int i = 0; i < totvert; i++) {
332 if (has_duplicates) {
345 int num_propagation_steps = 0;
346 float accum_distance = 0.0f;
387 if (has_duplicates) {
420 num_propagation_steps++;
440 for (
int i = 0; i < totvert; i++) {
459 float falloff_distance = 0.0f;
460 float direction = 1.0f;
464 falloff_distance = boundary_distance;
467 const int div = boundary_distance / radius;
468 const float mod =
fmodf(boundary_distance, radius);
469 falloff_distance = div % 2 == 0 ?
mod : radius -
mod;
472 const int div = boundary_distance / radius;
473 const float mod =
fmodf(boundary_distance, radius);
474 falloff_distance = div % 2 == 0 ?
mod : radius -
mod;
476 if (((div - 1) & 2) == 0) {
486 brush, falloff_distance, radius);
494 const int initial_vertex,
507 ss, initial_vertex, radius);
527 const float boundary_radius = brush ? radius * (1.0f + brush->
boundary_offset) : radius;
553 totvert, 3 *
sizeof(
float),
"pivot rotation axis");
555 totvert, 3 *
sizeof(
float),
"pivot positions");
557 for (
int i = 0; i < totvert; i++) {
574 for (
int i = 0; i < totvert; i++) {
590 for (
int i = 0; i < totvert; i++) {
600 for (
int i = 0; i < totvert; i++) {
613 boundary->
num_vertices,
sizeof(
float) * 3,
"poly verts");
666 angle_factor =
floorf(angle_factor * 10) / 10.0f;
857 angle_factor =
floorf(angle_factor * 10) / 10.0f;
918 float coord_accum[3] = {0.0f, 0.0f, 0.0f};
919 int total_neighbors = 0;
930 if (total_neighbors == 0) {
936 mul_v3_v3fl(avg, coord_accum, 1.0f / total_neighbors);
1034 const float outline_col[3],
1035 const float outline_alpha)
typedef float(TangentPoint)[2]
float BKE_brush_curve_strength(const struct Brush *br, float p, const float len)
General operations, lookup, etc. for blender objects.
struct Brush * BKE_paint_brush(struct Paint *paint)
A BVH for high poly meshes.
#define BKE_pbvh_vertex_iter_begin(pbvh, node, vi, mode)
PBVHType BKE_pbvh_type(const PBVH *pbvh)
#define BKE_pbvh_vertex_iter_end
void BKE_pbvh_parallel_range_settings(struct TaskParallelSettings *settings, bool use_threading, int totnode)
#define BLI_BITMAP_ENABLE(_bitmap, _index)
#define BLI_BITMAP_NEW(_tot, _alloc_string)
bool BLI_gset_haskey(GSet *gs, const void *key) ATTR_WARN_UNUSED_RESULT
void BLI_gset_free(GSet *gs, GSetKeyFreeFP keyfreefp)
bool BLI_gset_add(GSet *gs, void *key)
GSet * BLI_gset_int_new_ex(const char *info, const unsigned int nentries_reserve) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT
void BLI_gsqueue_free(GSQueue *queue)
void BLI_gsqueue_push(GSQueue *queue, const void *item)
GSQueue * BLI_gsqueue_new(const size_t elem_size)
void BLI_gsqueue_pop(GSQueue *queue, void *r_item)
bool BLI_gsqueue_is_empty(const GSQueue *queue)
void plane_from_point_normal_v3(float r_plane[4], const float plane_co[3], const float plane_no[3])
float dist_signed_to_plane_v3(const float p[3], const float plane[4])
float normal_poly_v3(float n[3], const float verts[][3], unsigned int nr)
MINLINE float len_v3v3(const float a[3], const float b[3]) ATTR_WARN_UNUSED_RESULT
MINLINE float normalize_v3(float r[3])
MINLINE float len_squared_v3v3(const float a[3], const float b[3]) ATTR_WARN_UNUSED_RESULT
MINLINE void sub_v3_v3v3(float r[3], const float a[3], const float b[3])
MINLINE void normal_short_to_float_v3(float r[3], const short n[3])
MINLINE void mul_v3_fl(float r[3], float f)
MINLINE void copy_v3_v3(float r[3], const float a[3])
MINLINE void add_v3_v3v3(float r[3], const float a[3], const float b[3])
MINLINE void cross_v3_v3v3(float r[3], const float a[3], const float b[3])
void rotate_v3_v3v3fl(float r[3], const float p[3], const float axis[3], const float angle)
MINLINE void madd_v3_v3v3fl(float r[3], const float a[3], const float b[3], float f)
MINLINE void zero_v3(float r[3])
MINLINE void mul_v3_v3fl(float r[3], const float a[3], float f)
MINLINE void add_v3_v3(float r[3], const float a[3])
void BLI_task_parallel_range(const int start, const int stop, void *userdata, TaskParallelRangeFunc func, const TaskParallelSettings *settings)
#define POINTER_FROM_INT(i)
@ BRUSH_BOUNDARY_DEFORM_GRAB
@ BRUSH_BOUNDARY_DEFORM_TWIST
@ BRUSH_BOUNDARY_DEFORM_BEND
@ BRUSH_BOUNDARY_DEFORM_EXPAND
@ BRUSH_BOUNDARY_DEFORM_INFLATE
@ BRUSH_BOUNDARY_DEFORM_SMOOTH
@ BRUSH_BOUNDARY_FALLOFF_CONSTANT
@ BRUSH_BOUNDARY_FALLOFF_LOOP
@ BRUSH_BOUNDARY_FALLOFF_LOOP_INVERT
@ BRUSH_BOUNDARY_FALLOFF_RADIUS
Object is a sort of wrapper for general info.
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble GLdouble GLdouble zFar _GL_VOID_RET _GL_UINT GLdouble *equation _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLenum GLfloat *v _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLfloat *values _GL_VOID_RET _GL_VOID GLushort *values _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLenum GLdouble *params _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_BOOL GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLushort pattern _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint GLdouble v1
void GPU_line_width(float width)
Read Guarded memory(de)allocation.
ATTR_WARN_UNUSED_RESULT const BMVert * v2
SIMD_FORCE_INLINE btScalar angle(const btVector3 &v) const
Return the angle between this and another vector.
IconTextureDrawCall normal
void *(* MEM_malloc_arrayN)(size_t len, size_t size, const char *str)
void(* MEM_freeN)(void *vmemh)
void *(* MEM_calloc_arrayN)(size_t len, size_t size, const char *str)
void *(* MEM_reallocN_id)(void *vmemh, size_t len, const char *str)
void *(* MEM_callocN)(size_t len, const char *str)
void flip_v3_v3(float out[3], const float in[3], const enum ePaintSymmetryFlags symm)
const float * SCULPT_vertex_co_get(SculptSession *ss, int index)
int SCULPT_vertex_count_get(SculptSession *ss)
void SCULPT_orig_vert_data_update(SculptOrigVertData *orig_data, PBVHVertexIter *iter)
void SCULPT_boundary_info_ensure(Object *object)
int SCULPT_active_vertex_get(SculptSession *ss)
int SCULPT_nearest_vertex_get(Sculpt *sd, Object *ob, const float co[3], float max_distance, bool use_original)
void SCULPT_floodfill_init(SculptSession *ss, SculptFloodFill *flood)
void SCULPT_floodfill_add_initial(SculptFloodFill *flood, int index)
const float * SCULPT_active_vertex_co_get(SculptSession *ss)
void SCULPT_vertex_random_access_ensure(SculptSession *ss)
bool SCULPT_vertex_visible_get(SculptSession *ss, int index)
float * SCULPT_brush_deform_target_vertex_co_get(SculptSession *ss, const int deform_target, PBVHVertexIter *iter)
void SCULPT_vertex_normal_get(SculptSession *ss, int index, float no[3])
bool SCULPT_vertex_is_boundary(const SculptSession *ss, const int index)
void SCULPT_floodfill_free(SculptFloodFill *flood)
bool SCULPT_stroke_is_first_brush_step_of_symmetry_pass(StrokeCache *cache)
char SCULPT_mesh_symmetry_xyz_get(Object *object)
bool SCULPT_check_vertex_pivot_symmetry(const float vco[3], const float pco[3], const char symm)
void SCULPT_floodfill_execute(SculptSession *ss, SculptFloodFill *flood, bool(*func)(SculptSession *ss, int from_v, int to_v, bool is_duplicate, void *userdata), void *userdata)
void SCULPT_orig_vert_data_init(SculptOrigVertData *data, Object *ob, PBVHNode *node)
float SCULPT_automasking_factor_get(AutomaskingCache *automasking, SculptSession *ss, int vert)
static void sculpt_boundary_falloff_factor_init(SculptSession *ss, SculptBoundary *boundary, Brush *brush, const float radius)
static void sculpt_boundary_preview_edge_add(SculptBoundary *boundary, const int v1, const int v2)
static bool boundary_initial_vertex_floodfill_cb(SculptSession *ss, int from_v, int to_v, bool is_duplicate, void *userdata)
static bool boundary_floodfill_cb(SculptSession *ss, int from_v, int to_v, bool is_duplicate, void *userdata)
void SCULPT_boundary_data_free(SculptBoundary *boundary)
#define BOUNDARY_STEPS_NONE
static void sculpt_boundary_slide_data_init(SculptSession *ss, SculptBoundary *boundary)
static void do_boundary_brush_smooth_task_cb_ex(void *__restrict userdata, const int n, const TaskParallelTLS *__restrict UNUSED(tls))
static int sculpt_boundary_get_closest_boundary_vertex(SculptSession *ss, const int initial_vertex, const float radius)
static void do_boundary_brush_slide_task_cb_ex(void *__restrict userdata, const int n, const TaskParallelTLS *__restrict UNUSED(tls))
#define BOUNDARY_VERTEX_NONE
static void sculpt_boundary_twist_data_init(SculptSession *ss, SculptBoundary *boundary)
void SCULPT_boundary_pivot_line_preview_draw(const uint gpuattr, SculptSession *ss)
static void do_boundary_brush_bend_task_cb_ex(void *__restrict userdata, const int n, const TaskParallelTLS *__restrict UNUSED(tls))
void SCULPT_do_boundary_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode)
static void do_boundary_brush_inflate_task_cb_ex(void *__restrict userdata, const int n, const TaskParallelTLS *__restrict UNUSED(tls))
struct BoundaryFloodFillData BoundaryFloodFillData
static void sculpt_boundary_index_add(SculptBoundary *boundary, const int new_index, const float distance, GSet *included_vertices)
struct BoundaryInitialVertexFloodFillData BoundaryInitialVertexFloodFillData
static int BOUNDARY_INDICES_BLOCK_SIZE
static void do_boundary_brush_twist_task_cb_ex(void *__restrict userdata, const int n, const TaskParallelTLS *__restrict UNUSED(tls))
static float sculpt_boundary_displacement_from_grab_delta_get(SculptSession *ss, SculptBoundary *boundary)
SculptBoundary * SCULPT_boundary_data_init(Object *object, Brush *brush, const int initial_vertex, const float radius)
static void sculpt_boundary_bend_data_init(SculptSession *ss, SculptBoundary *boundary)
static void do_boundary_brush_grab_task_cb_ex(void *__restrict userdata, const int n, const TaskParallelTLS *__restrict UNUSED(tls))
void SCULPT_boundary_edges_preview_draw(const uint gpuattr, SculptSession *ss, const float outline_col[3], const float outline_alpha)
static void sculpt_boundary_edit_data_init(SculptSession *ss, SculptBoundary *boundary, const int initial_vertex, const float radius)
static bool sculpt_boundary_is_vertex_in_editable_boundary(SculptSession *ss, const int initial_vertex)
static void sculpt_boundary_indices_init(SculptSession *ss, SculptBoundary *boundary, const bool init_boundary_distances, const int initial_boundary_index)
#define SCULPT_VERTEX_NEIGHBORS_ITER_BEGIN(ss, v_index, neighbor_iterator)
#define SCULPT_VERTEX_NEIGHBORS_ITER_END(neighbor_iterator)
#define SCULPT_VERTEX_DUPLICATES_AND_NEIGHBORS_ITER_BEGIN(ss, v_index, neighbor_iterator)
SculptBoundary * boundary
int boundary_initial_vertex
int boundary_initial_vertex_steps
struct CurveMapping * curve
int boundary_falloff_type
struct SculptSession * sculpt
int num_propagation_steps
struct SculptBoundary::@52 twist
int max_propagation_steps
struct SculptBoundaryEditInfo * edit_info
float initial_vertex_position[3]
float(* pivot_rotation_axis)[3]
float initial_pivot_position[3]
struct SculptBoundary::@50 bend
struct SculptBoundary::@51 slide
SculptBoundaryPreviewEdge * edges
float(* pivot_positions)[3]
SculptBoundary * boundary_preview
struct StrokeCache * cache
float initial_location[3]
struct SculptBoundary * boundaries[PAINT_SYMM_AREAS]
float grab_delta_symmetry[3]
AutomaskingCache * automasking
ccl_device_inline int mod(int x, int m)
ccl_device_inline float distance(const float2 &a, const float2 &b)
ccl_device_inline float4 mask(const int4 &mask, const float4 &a)