WIP: Brush assets project #106303

Draft
Julian Eisel wants to merge 392 commits from brush-assets-project into main

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.
1 changed files with 5 additions and 16 deletions
Showing only changes of commit f0e840375e - Show all commits

View File

@ -1636,24 +1636,13 @@ const float *SCULPT_brush_frontface_normal_from_falloff_shape(SculptSession *ss,
return ss->cache->view_normal; return ss->cache->view_normal;
} }
static float frontface(const Brush *br, static float frontface(const Brush &brush, const float3 &view_normal, const float3 &normal)
const float3 &sculpt_normal,
const float3 &no,
const float3 &fno)
{ {
using namespace blender; using namespace blender;
if (!(br->flag & BRUSH_FRONTFACE)) { if (!(brush.flag & BRUSH_FRONTFACE)) {
return 1.0f; return 1.0f;
} }
return std::max(math::dot(normal, view_normal), 0.0f);
float dot;
if (no) {
dot = math::dot(no, sculpt_normal);
}
else {
dot = math::dot(fno, sculpt_normal);
}
return dot > 0.0f ? dot : 0.0f;
} }
#if 0 #if 0
@ -2400,7 +2389,7 @@ float SCULPT_brush_strength_factor(
/* Falloff curve. */ /* Falloff curve. */
avg *= BKE_brush_curve_strength(brush, final_len, cache->radius); avg *= BKE_brush_curve_strength(brush, final_len, cache->radius);
avg *= frontface(brush, cache->view_normal, vno, fno); avg *= frontface(*brush, cache->view_normal, vno ? vno : fno);
/* Paint mask. */ /* Paint mask. */
avg *= 1.0f - mask; avg *= 1.0f - mask;
@ -2435,7 +2424,7 @@ void SCULPT_brush_strength_color(
/* Falloff curve. */ /* Falloff curve. */
const float falloff = BKE_brush_curve_strength(brush, final_len, cache->radius) * const float falloff = BKE_brush_curve_strength(brush, final_len, cache->radius) *
frontface(brush, cache->view_normal, vno, fno); frontface(*brush, cache->view_normal, vno ? vno : fno);
/* Paint mask. */ /* Paint mask. */
const float paint_mask = 1.0f - mask; const float paint_mask = 1.0f - mask;