51 float avg[3] = {0.0f, 0.0f, 0.0f};
53 int neighbor_count = 0;
75 if (neighbor_count <= 2 && is_boundary) {
92 float avg_co[3] = {0.0f, 0.0f, 0.0f};
103 BMVert *v_other = (
e->v1 ==
v) ?
e->v2 :
e->v1;
111 float fac =
dot_v3v3(vec, direction);
112 fac = fac * fac - 0.5f;
139 float avg[3] = {0.0f, 0.0f, 0.0f};
177 float avg[4] = {0.0f, 0.0f, 0.0f, 0.0f};
211 CLAMP(bstrength, -1.0f, 1.0f);
215 ss, &test,
data->brush->falloff_shape);
219 if (!sculpt_brush_test_sq_fn(&test, vd.
co)) {
258 totvert,
sizeof(
float[3]),
"details directions");
260 for (
int i = 0; i < totvert; i++) {
288 float bstrength =
data->strength;
292 CLAMP(bstrength, 0.0f, 1.0f);
296 ss, &test,
data->brush->falloff_shape);
301 if (!sculpt_brush_test_sq_fn(&test, vd.
co)) {
316 val *=
fade * bstrength;
321 float avg[3], val[3];
344 const int max_iterations = 4;
345 const float fract = 1.0f / max_iterations;
347 int iteration,
count;
350 CLAMP(bstrength, 0.0f, 1.0f);
352 count = (int)(bstrength * max_iterations);
353 last = max_iterations * (bstrength -
count *
fract);
363 for (iteration = 0; iteration <=
count; iteration++) {
364 const float strength = (iteration !=
count) ? 1.0f : last;
372 .strength = strength,
405 float (*laplacian_disp)[3],
407 const float origco[3],
410 float laplacian_smooth_co[3];
411 float weigthed_o[3], weigthed_q[3], d[3];
417 sub_v3_v3v3(laplacian_disp[v_index], laplacian_smooth_co, d);
424 float (*laplacian_disp)[3],
429 float b_avg[3] = {0.0f, 0.0f, 0.0f};
430 float b_current_vertex[3];
447 void *__restrict userdata,
const int n,
const TaskParallelTLS *__restrict tls)
460 ss, &test,
data->brush->falloff_shape);
467 if (!sculpt_brush_test_sq_fn(&test, vd.
co)) {
492 void *__restrict userdata,
const int n,
const TaskParallelTLS *__restrict tls)
504 ss, &test,
data->brush->falloff_shape);
508 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_vert_tag_update_normal(PBVH *pbvh, int index)
void BKE_pbvh_parallel_range_settings(struct TaskParallelSettings *settings, bool use_threading, int totnode)
#define BLI_assert_msg(a, msg)
MINLINE float clamp_f(float value, float min, float max)
MINLINE void add_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 mul_v4_v4fl(float r[4], const float a[4], 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(int start, 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 Output data from inside of a node group A color picker Mix two input colors RGB to Convert a color s luminance to a grayscale value Generate a normal vector and a dot product Bright Control the brightness and contrast of the input color Vector Map an input vectors to used to fine tune the interpolation of the input Camera Retrieve information about the camera and how it relates to the current shading point s position 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
void *(* MEM_malloc_arrayN)(size_t len, size_t size, const char *str)
static float smooth_mask(float x, float y)
thread_local int thread_id
CCL_NAMESPACE_BEGIN ccl_device float fade(float t)
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)
SculptBrushTestFn SCULPT_brush_test_init_with_falloff_shape(SculptSession *ss, SculptBrushTest *test, char falloff_shape)
float SCULPT_brush_strength_factor(SculptSession *ss, const Brush *br, const float brush_point[3], const float len, const float vno[3], const float fno[3], const float mask, const int vertex_index, const int thread_id)
void SCULPT_vertex_random_access_ensure(SculptSession *ss)
void SCULPT_vertex_color_get(const SculptSession *ss, int index, float r_color[4])
bool SCULPT_vertex_is_boundary(const SculptSession *ss, const 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])
#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_device_inline float beta(float x, float y)