45 #define BOUNDARY_VERTEX_NONE -1
46 #define BOUNDARY_STEPS_NONE -1
57 SculptSession *ss,
int from_v,
int to_v,
bool is_duplicate,
void *userdata)
66 data->floodfill_steps[to_v] =
data->floodfill_steps[from_v] + 1;
69 data->floodfill_steps[to_v] =
data->floodfill_steps[from_v];
73 if (
data->floodfill_steps[to_v] <
data->boundary_initial_vertex_steps) {
74 data->boundary_initial_vertex_steps =
data->floodfill_steps[to_v];
75 data->boundary_initial_vertex = to_v;
81 return len_sq <
data->radius_sq;
87 const int initial_vertex,
92 return initial_vertex;
102 .boundary_initial_vertex_steps = INT_MAX,
103 .radius_sq = radius * radius,
124 GSet *included_vertices)
131 if (included_vertices) {
162 const int initial_vertex)
169 int neighbor_count = 0;
170 int boundary_vertex_count = 0;
176 boundary_vertex_count++;
184 if (neighbor_count <= 2) {
190 if (boundary_vertex_count > 2) {
210 SculptSession *ss,
int from_v,
int to_v,
bool is_duplicate,
void *userdata)
219 const float distance_boundary_to_dst = boundary->
distance ?
220 boundary->
distance[from_v] + edge_len :
231 const bool init_boundary_distances,
232 const int initial_boundary_index)
238 if (init_boundary_distances) {
256 .included_vertices = included_vertices,
289 const int initial_vertex,
299 for (
int i = 0; i < totvert; i++) {
316 if (has_duplicates) {
329 int num_propagation_steps = 0;
330 float accum_distance = 0.0f;
371 if (has_duplicates) {
404 num_propagation_steps++;
424 for (
int i = 0; i < totvert; i++) {
443 float falloff_distance = 0.0f;
444 float direction = 1.0f;
448 falloff_distance = boundary_distance;
451 const int div = boundary_distance / radius;
452 const float mod =
fmodf(boundary_distance, radius);
453 falloff_distance = div % 2 == 0 ?
mod : radius -
mod;
456 const int div = boundary_distance / radius;
457 const float mod =
fmodf(boundary_distance, radius);
458 falloff_distance = div % 2 == 0 ?
mod : radius -
mod;
460 if (((div - 1) & 2) == 0) {
470 brush, falloff_distance, radius);
476 const int initial_vertex,
489 ss, initial_vertex, radius);
509 const float boundary_radius = brush ? radius * (1.0f + brush->
boundary_offset) : radius;
535 totvert,
sizeof(
float[3]),
"pivot rotation axis");
538 for (
int i = 0; i < totvert; i++) {
555 for (
int i = 0; i < totvert; i++) {
571 for (
int i = 0; i < totvert; i++) {
581 for (
int i = 0; i < totvert; i++) {
594 boundary->
num_vertices,
sizeof(
float[3]),
"poly verts");
647 angle_factor =
floorf(angle_factor * 10) / 10.0f;
836 angle_factor =
floorf(angle_factor * 10) / 10.0f;
897 float coord_accum[3] = {0.0f, 0.0f, 0.0f};
898 int total_neighbors = 0;
909 if (total_neighbors == 0) {
915 mul_v3_v3fl(avg, coord_accum, 1.0f / total_neighbors);
1012 const float outline_col[3],
1013 const float outline_alpha)
typedef float(TangentPoint)[2]
float BKE_brush_curve_strength(const struct Brush *br, float p, 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_vert_tag_update_normal(PBVH *pbvh, int index)
void BKE_pbvh_parallel_range_settings(struct TaskParallelSettings *settings, bool use_threading, int totnode)
#define BLI_BITMAP_NEW(_num, _alloc_string)
#define BLI_BITMAP_ENABLE(_bitmap, _index)
GSet * BLI_gset_int_new_ex(const char *info, unsigned int nentries_reserve) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT
bool BLI_gset_haskey(const 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)
void BLI_gsqueue_free(GSQueue *queue)
GSQueue * BLI_gsqueue_new(size_t elem_size)
void BLI_gsqueue_push(GSQueue *queue, const void *item)
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)
void rotate_v3_v3v3fl(float r[3], const float p[3], const float axis[3], float angle)
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 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])
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(int start, 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)
ccl_device_inline float4 mask(const int4 &mask, const float4 &a)
T distance(const T &a, const T &b)
BLI_INLINE void flip_v3_v3(float out[3], const float in[3], const 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_orig_vert_data_init(SculptOrigVertData *data, Object *ob, PBVHNode *node, SculptUndoType type)
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)
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::@51 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 slide
struct SculptBoundary::@49 bend
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)