Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/sculpt_paint/sculpt.c
| Show First 20 Lines • Show All 2,366 Lines • ▼ Show 20 Lines | float SCULPT_brush_strength_factor(SculptSession *ss, | ||||
| const float mask, | const float mask, | ||||
| const int vertex_index, | const int vertex_index, | ||||
| const int thread_id) | const int thread_id) | ||||
| { | { | ||||
| StrokeCache *cache = ss->cache; | StrokeCache *cache = ss->cache; | ||||
| const Scene *scene = cache->vc->scene; | const Scene *scene = cache->vc->scene; | ||||
| const MTex *mtex = &br->mtex; | const MTex *mtex = &br->mtex; | ||||
| float avg = 1.0f; | float avg = 1.0f; | ||||
| float rgba[4]; | |||||
| float point[3]; | float point[3]; | ||||
| sub_v3_v3v3(point, brush_point, cache->plane_offset); | sub_v3_v3v3(point, brush_point, cache->plane_offset); | ||||
| if (!mtex->tex) { | if (!mtex->tex) { | ||||
| avg = 1.0f; | avg = 1.0f; | ||||
| } | } | ||||
| else if (mtex->brush_map_mode == MTEX_MAP_MODE_3D) { | else if (mtex->brush_map_mode == MTEX_MAP_MODE_3D) { | ||||
| /* Get strength by feeding the vertex location directly into a texture. */ | /* Get strength by feeding the vertex location directly into a texture. */ | ||||
| avg = BKE_brush_sample_tex_3d(scene, br, point, rgba, 0, ss->tex_pool); | BKE_brush_sample_tex_intensity(scene, br, 1, &point, &avg, 0, ss->tex_pool); | ||||
| } | } | ||||
| else { | else { | ||||
| float symm_point[3], point_2d[2]; | float symm_point[3], point_2d[2]; | ||||
| /* Quite warnings. */ | /* Quite warnings. */ | ||||
| float x = 0.0f, y = 0.0f; | float x = 0.0f, y = 0.0f; | ||||
| /* If the active area is being applied for symmetry, flip it | /* If the active area is being applied for symmetry, flip it | ||||
| * across the symmetry axis and rotate it back to the original | * across the symmetry axis and rotate it back to the original | ||||
| Show All 24 Lines | if (mtex->brush_map_mode == MTEX_MAP_MODE_AREA) { | ||||
| y += br->mtex.ofs[1]; | y += br->mtex.ofs[1]; | ||||
| avg = paint_get_tex_pixel(&br->mtex, x, y, ss->tex_pool, thread_id); | avg = paint_get_tex_pixel(&br->mtex, x, y, ss->tex_pool, thread_id); | ||||
| avg += br->texture_sample_bias; | avg += br->texture_sample_bias; | ||||
| } | } | ||||
| else { | else { | ||||
| const float point_3d[3] = {point_2d[0], point_2d[1], 0.0f}; | const float point_3d[3] = {point_2d[0], point_2d[1], 0.0f}; | ||||
| avg = BKE_brush_sample_tex_3d(scene, br, point_3d, rgba, 0, ss->tex_pool); | BKE_brush_sample_tex_intensity(scene, br, 1, &point_3d, &avg, 0, ss->tex_pool); | ||||
| } | } | ||||
| } | } | ||||
| /* Hardness. */ | /* Hardness. */ | ||||
| float final_len = len; | float final_len = len; | ||||
| const float hardness = cache->paint_brush.hardness; | const float hardness = cache->paint_brush.hardness; | ||||
| float p = len / cache->radius; | float p = len / cache->radius; | ||||
| if (p < hardness) { | if (p < hardness) { | ||||
| ▲ Show 20 Lines • Show All 3,464 Lines • Show Last 20 Lines | |||||