Vector displacement for the sculpting draw brush #104481
|
@ -2719,9 +2719,14 @@ void SCULPT_brush_strength_color(struct SculptSession *ss,
|
|||
mul_v4_fl(r_rgba, masks_combined);
|
||||
}
|
||||
|
||||
void SCULPT_calc_vertex_displacement(SculptSession *ss, float rgba[4], float out_offset[3])
|
||||
void SCULPT_calc_vertex_displacement(SculptSession *ss, const struct Brush *brush, float rgba[4], float out_offset[3])
|
||||
{
|
||||
rgba[2] *= ss->cache->bstrength;
|
||||
mul_v3_fl(rgba, ss->cache->bstrength);
|
||||
|
||||
rgba[0] *= 1.0f / (brush->mtex.size[0] == 0.0f ? 1.0f : brush->mtex.size[0] * brush->mtex.size[0]);
|
||||
robin.hohni marked this conversation as resolved
|
||||
rgba[1] *= 1.0f / (brush->mtex.size[1] == 0.0f ? 1.0f : brush->mtex.size[1] * brush->mtex.size[1]);
|
||||
rgba[2] *= 1.0f / (brush->mtex.size[2] == 0.0f ? 1.0f : brush->mtex.size[2] * brush->mtex.size[2]);
|
||||
|
||||
mul_mat3_m4_v3(ss->cache->brush_local_mat_inv, rgba);
|
||||
|
||||
if (ss->cache->radial_symmetry_pass) {
|
||||
|
|
|
@ -280,7 +280,7 @@ static void do_draw_brush_task_cb_ex(void *__restrict userdata,
|
|||
thread_id,
|
||||
&automask_data,
|
||||
r_rgba);
|
||||
SCULPT_calc_vertex_displacement(ss, r_rgba, proxy[vd.i]);
|
||||
SCULPT_calc_vertex_displacement(ss, brush, r_rgba, proxy[vd.i]);
|
||||
}
|
||||
else {
|
||||
float fade = SCULPT_brush_strength_factor(ss,
|
||||
|
|
|
@ -1273,7 +1273,7 @@ void SCULPT_brush_strength_color(struct SculptSession *ss,
|
|||
/**
|
||||
* Calculates the vertex offset for a single vertex depending on the brush setting rgb as vector displacement.
|
||||
*/
|
||||
void SCULPT_calc_vertex_displacement(SculptSession *ss, float rgba[3], float out_offset[3]);
|
||||
void SCULPT_calc_vertex_displacement(SculptSession *ss, const struct Brush *brush, float rgba[3], float out_offset[3]);
|
||||
|
||||
/**
|
||||
* Tilts a normal by the x and y tilt values using the view axis.
|
||||
|
|
Loading…
Reference in New Issue
For readability would suggest to first square the size, and then do the inf check using
math::safe_divide
. Seems we currently don't have a safe divide in math for 2 vector types.rgba[i] *= math::safe_divide(1.0f, POW2(brush->mtex.size[i]));
perhaps?Thanks for the hint! Made a commit :)