Merge branch 'blender-v2.93-release'

This commit is contained in:
Campbell Barton 2021-04-21 00:21:29 +10:00
commit 2c1a2c9a99
3 changed files with 15 additions and 3 deletions

View File

@ -1065,6 +1065,7 @@ static void curve_to_mesh_eval_ensure(Object *object)
Curve *curve = (Curve *)object->data;
Curve remapped_curve = *curve;
Object remapped_object = *object;
remapped_object.runtime.bb = NULL;
remapped_object.data = &remapped_curve;
/* Clear all modifiers for the bevel object.
@ -1077,6 +1078,7 @@ static void curve_to_mesh_eval_ensure(Object *object)
Object bevel_object = {{NULL}};
if (remapped_curve.bevobj != NULL) {
bevel_object = *remapped_curve.bevobj;
bevel_object.runtime.bb = NULL;
BLI_listbase_clear(&bevel_object.modifiers);
remapped_curve.bevobj = &bevel_object;
}
@ -1085,6 +1087,7 @@ static void curve_to_mesh_eval_ensure(Object *object)
Object taper_object = {{NULL}};
if (remapped_curve.taperobj != NULL) {
taper_object = *remapped_curve.taperobj;
taper_object.runtime.bb = NULL;
BLI_listbase_clear(&taper_object.modifiers);
remapped_curve.taperobj = &taper_object;
}
@ -1107,6 +1110,10 @@ static void curve_to_mesh_eval_ensure(Object *object)
BKE_object_eval_assign_data(&remapped_object, &mesh_eval->id, true);
}
MEM_SAFE_FREE(remapped_object.runtime.bb);
MEM_SAFE_FREE(taper_object.runtime.bb);
MEM_SAFE_FREE(bevel_object.runtime.bb);
BKE_object_free_curve_cache(&bevel_object);
BKE_object_free_curve_cache(&taper_object);
}

View File

@ -210,14 +210,14 @@ void occlusion_eval(OcclusionData data,
bool early_out = (inverted != 0.0) ? (max_v4(abs(data.horizons)) == 0.0) :
(min_v4(abs(data.horizons)) == M_PI);
if (early_out) {
visibility = dot(N, Ng) * 0.5 + 0.5;
visibility = saturate(dot(N, Ng) * 0.5 + 0.5);
visibility = min(visibility, data.custom_occlusion);
if ((int(aoSettings) & USE_BENT_NORMAL) == 0) {
bent_normal = N;
}
else {
bent_normal = normalize(N + Ng);
bent_normal = safe_normalize(N + Ng);
}
return;
}
@ -283,7 +283,9 @@ void occlusion_eval(OcclusionData data,
bent_normal = N;
}
else {
bent_normal = normalize(mix(bent_normal, N, sqr(sqr(sqr(visibility)))));
/* Note: using pow(visibility, 6.0) produces NaN (see T87369). */
float tmp = saturate(pow6(visibility));
bent_normal = normalize(mix(bent_normal, N, tmp));
}
}

View File

@ -91,6 +91,9 @@ vec2 sqr(vec2 a) { return a * a; }
vec3 sqr(vec3 a) { return a * a; }
vec4 sqr(vec4 a) { return a * a; }
/* Use manual powers for fixed powers. pow() can have unpredicatble results on some implementations.
* (see T87369, T87541) */
float pow6(float x) { return sqr(sqr(x) * x); }
float pow8(float x) { return sqr(sqr(sqr(x))); }
float len_squared(vec3 a) { return dot(a, a); }