67 float avg[3] = {0.0f, 0.0f, 0.0f};
69 int neighbor_count = 0;
91 if (neighbor_count <= 2) {
110 float avg_co[3] = {0.0f, 0.0f, 0.0f};
121 BMVert *v_other = (
e->v1 ==
v) ?
e->v2 :
e->v1;
129 float fac =
dot_v3v3(vec, direction);
130 fac = fac * fac - 0.5f;
157 float avg[3] = {0.0f, 0.0f, 0.0f};
195 float avg[4] = {0.0f, 0.0f, 0.0f, 0.0f};
225 CLAMP(bstrength, -1.0f, 1.0f);
229 ss, &test,
data->brush->falloff_shape);
233 if (!sculpt_brush_test_sq_fn(&test, vd.
co)) {
272 totvert, 3 *
sizeof(
float),
"details directions");
274 for (
int i = 0; i < totvert; i++) {
301 const bool smooth_mask =
data->smooth_mask;
302 float bstrength =
data->strength;
306 CLAMP(bstrength, 0.0f, 1.0f);
310 ss, &test,
data->brush->falloff_shape);
315 if (!sculpt_brush_test_sq_fn(&test, vd.
co)) {
325 smooth_mask ? 0.0f : (vd.
mask ? *vd.
mask : 0.0f),
330 val *=
fade * bstrength;
335 float avg[3], val[3];
353 const bool smooth_mask)
358 const int max_iterations = 4;
359 const float fract = 1.0f / max_iterations;
361 int iteration,
count;
364 CLAMP(bstrength, 0.0f, 1.0f);
366 count = (int)(bstrength * max_iterations);
367 last = max_iterations * (bstrength -
count *
fract);
377 for (iteration = 0; iteration <=
count; iteration++) {
378 const float strength = (iteration !=
count) ? 1.0f : last;
385 .smooth_mask = smooth_mask,
386 .strength = strength,
419 float (*laplacian_disp)[3],
421 const float origco[3],
424 float laplacian_smooth_co[3];
425 float weigthed_o[3], weigthed_q[3], d[3];
431 sub_v3_v3v3(laplacian_disp[v_index], laplacian_smooth_co, d);
438 float (*laplacian_disp)[3],
443 float b_avg[3] = {0.0f, 0.0f, 0.0f};
444 float b_current_vertex[3];
461 void *__restrict userdata,
const int n,
const TaskParallelTLS *__restrict tls)
474 ss, &test,
data->brush->falloff_shape);
481 if (!sculpt_brush_test_sq_fn(&test, vd.
co)) {
506 void *__restrict userdata,
const int n,
const TaskParallelTLS *__restrict tls)
518 ss, &test,
data->brush->falloff_shape);
522 if (!sculpt_brush_test_sq_fn(&test, vd.
co)) {
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)
MINLINE float clamp_f(float value, float min, float max)
MINLINE void mul_v4_v4fl(float r[3], const float a[4], float f)
MINLINE void add_v4_v4(float r[4], const float a[4])
MINLINE void copy_v4_v4(float r[4], const float a[4])
MINLINE void madd_v3_v3fl(float r[3], const float a[3], float f)
MINLINE float normalize_v3(float r[3])
MINLINE void sub_v3_v3(float r[3], const float a[3])
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 float dot_v3v3(const float a[3], const float b[3]) ATTR_WARN_UNUSED_RESULT
MINLINE void add_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(const int start, const int stop, void *userdata, TaskParallelRangeFunc func, const TaskParallelSettings *settings)
int BLI_task_parallel_thread_id(const TaskParallelTLS *tls)
_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 type
Read Guarded memory(de)allocation.
Group RGB to Bright Vector Camera CLAMP
#define BM_ITER_ELEM(ele, iter, data, itype)
BLI_INLINE bool BM_edge_is_boundary(const BMEdge *e) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
ATTR_WARN_UNUSED_RESULT const BMVert const BMEdge * e
ATTR_WARN_UNUSED_RESULT const BMVert * v
static CCL_NAMESPACE_BEGIN const double alpha
void *(* MEM_malloc_arrayN)(size_t len, size_t size, const char *str)
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)
SculptBrushTestFn SCULPT_brush_test_init_with_falloff_shape(SculptSession *ss, SculptBrushTest *test, char falloff_shape)
void SCULPT_vertex_random_access_ensure(SculptSession *ss)
bool SCULPT_vertex_is_boundary(const SculptSession *ss, const int index)
float SCULPT_brush_strength_factor(SculptSession *ss, const Brush *br, const float brush_point[3], const float len, const short vno[3], const float fno[3], const float mask, const int vertex_index, const int thread_id)
const float * SCULPT_vertex_color_get(SculptSession *ss, int index)
float SCULPT_vertex_mask_get(SculptSession *ss, int index)
bool SCULPT_stroke_is_first_brush_step(StrokeCache *cache)
void SCULPT_clip(Sculpt *sd, SculptSession *ss, float co[3], const float val[3])
void SCULPT_orig_vert_data_init(SculptOrigVertData *data, Object *ob, PBVHNode *node)
#define SCULPT_VERTEX_NEIGHBORS_ITER_BEGIN(ss, v_index, neighbor_iterator)
bool(* SculptBrushTestFn)(SculptBrushTest *test, const float co[3])
#define SCULPT_VERTEX_NEIGHBORS_ITER_END(neighbor_iterator)
void SCULPT_surface_smooth_laplacian_step(SculptSession *ss, float *disp, const float co[3], float(*laplacian_disp)[3], const int v_index, const float origco[3], const float alpha)
static void SCULPT_enhance_details_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, const int totnode)
static void SCULPT_do_surface_smooth_brush_displace_task_cb_ex(void *__restrict userdata, const int n, const TaskParallelTLS *__restrict tls)
void SCULPT_do_smooth_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode)
void SCULPT_neighbor_coords_average(SculptSession *ss, float result[3], int index)
float SCULPT_neighbor_mask_average(SculptSession *ss, int index)
void SCULPT_surface_smooth_displace_step(SculptSession *ss, float *co, float(*laplacian_disp)[3], const int v_index, const float beta, const float fade)
void SCULPT_smooth(Sculpt *sd, Object *ob, PBVHNode **nodes, const int totnode, float bstrength, const bool smooth_mask)
static void do_enhance_details_brush_task_cb_ex(void *__restrict userdata, const int n, const TaskParallelTLS *__restrict tls)
void SCULPT_do_surface_smooth_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode)
static void SCULPT_do_surface_smooth_brush_laplacian_task_cb_ex(void *__restrict userdata, const int n, const TaskParallelTLS *__restrict tls)
void SCULPT_neighbor_coords_average_interior(SculptSession *ss, float result[3], int index)
void SCULPT_neighbor_color_average(SculptSession *ss, float result[4], int index)
void SCULPT_bmesh_four_neighbor_average(float avg[3], float direction[3], BMVert *v)
static void do_smooth_brush_task_cb_ex(void *__restrict userdata, const int n, const TaskParallelTLS *__restrict tls)
int surface_smooth_iterations
float surface_smooth_current_vertex
float surface_smooth_shape_preservation
struct SculptSession * sculpt
struct MeshElemMap * pmap
struct StrokeCache * cache
float(* surface_smooth_laplacian_disp)[3]
float(* detail_directions)[3]
CCL_NAMESPACE_BEGIN ccl_device float fade(float t)
ccl_device_inline float beta(float x, float y)