Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/sculpt_paint/sculpt_paint_color.c
| Show First 20 Lines • Show All 124 Lines • ▼ Show 20 Lines | static void do_paint_brush_task_cb_ex(void *__restrict userdata, | ||||
| color_buffer = BKE_pbvh_node_color_buffer_get(data->nodes[n]); | color_buffer = BKE_pbvh_node_color_buffer_get(data->nodes[n]); | ||||
| SculptBrushTest test; | SculptBrushTest test; | ||||
| SculptBrushTestFn sculpt_brush_test_sq_fn = SCULPT_brush_test_init_with_falloff_shape( | SculptBrushTestFn sculpt_brush_test_sq_fn = SCULPT_brush_test_init_with_falloff_shape( | ||||
| ss, &test, data->brush->falloff_shape); | ss, &test, data->brush->falloff_shape); | ||||
| const int thread_id = BLI_task_parallel_thread_id(tls); | const int thread_id = BLI_task_parallel_thread_id(tls); | ||||
| float brush_color[4] = {0.0f, 0.0f, 0.0f, 1.0f}; | |||||
| copy_v3_v3(brush_color, BKE_brush_color_get(ss->scene, brush)); | |||||
| BKE_pbvh_vertex_iter_begin(ss->pbvh, data->nodes[n], vd, PBVH_ITER_UNIQUE) | BKE_pbvh_vertex_iter_begin(ss->pbvh, data->nodes[n], vd, PBVH_ITER_UNIQUE) | ||||
| { | { | ||||
| SCULPT_orig_vert_data_update(&orig_data, &vd); | SCULPT_orig_vert_data_update(&orig_data, &vd); | ||||
| bool affect_vertex = false; | bool affect_vertex = false; | ||||
| float distance_to_stroke_location = 0.0f; | float distance_to_stroke_location = 0.0f; | ||||
| if (brush->tip_roundness < 1.0f) { | if (brush->tip_roundness < 1.0f) { | ||||
| affect_vertex = SCULPT_brush_test_cube(&test, vd.co, data->mat, brush->tip_roundness); | affect_vertex = SCULPT_brush_test_cube(&test, vd.co, data->mat, brush->tip_roundness); | ||||
| Show All 22 Lines | if (affect_vertex) { | ||||
| const float hash_noise = BLI_hash_int_01(ss->cache->density_seed * 1000 * vd.index); | const float hash_noise = BLI_hash_int_01(ss->cache->density_seed * 1000 * vd.index); | ||||
| if (hash_noise > density) { | if (hash_noise > density) { | ||||
| noise = density * hash_noise; | noise = density * hash_noise; | ||||
| fade = fade * noise; | fade = fade * noise; | ||||
| } | } | ||||
| } | } | ||||
| /* Brush paint color, brush test falloff and flow. */ | /* Brush paint color, brush test falloff and flow. */ | ||||
| float paint_color[4] = {brush->rgb[0], brush->rgb[1], brush->rgb[2], 1.0f}; | float paint_color[4]; | ||||
| float wet_mix_color[4]; | float wet_mix_color[4]; | ||||
| float buffer_color[4]; | float buffer_color[4]; | ||||
| mul_v4_fl(paint_color, fade * brush->flow); | mul_v4_v4fl(paint_color, brush_color, fade * brush->flow); | ||||
| mul_v4_v4fl(wet_mix_color, data->wet_mix_sampled_color, fade * brush->flow); | mul_v4_v4fl(wet_mix_color, data->wet_mix_sampled_color, fade * brush->flow); | ||||
| /* Interpolate with the wet_mix color for wet paint mixing. */ | /* Interpolate with the wet_mix color for wet paint mixing. */ | ||||
| blend_color_interpolate_float(paint_color, paint_color, wet_mix_color, brush->wet_mix); | blend_color_interpolate_float(paint_color, paint_color, wet_mix_color, brush->wet_mix); | ||||
| blend_color_mix_float(color_buffer->color[vd.i], color_buffer->color[vd.i], paint_color); | blend_color_mix_float(color_buffer->color[vd.i], color_buffer->color[vd.i], paint_color); | ||||
| /* Final mix over the original color using brush alpha. */ | /* Final mix over the original color using brush alpha. */ | ||||
| mul_v4_v4fl(buffer_color, color_buffer->color[vd.i], brush->alpha); | mul_v4_v4fl(buffer_color, color_buffer->color[vd.i], brush->alpha); | ||||
| ▲ Show 20 Lines • Show All 288 Lines • Show Last 20 Lines | |||||