Fix broken CD_NORMAL interpolation callback (would generate non-unit vectors).
Even if the weights are normalized, the weighted sum of normalized vectors usually does **not** give a normalized vector (unless all source vectors are aligned). This probably was not a big issue in most cases, since we usually interpolate similar vectors here - but still!
This commit is contained in:
parent
cde725e26f
commit
f81ecf117f
|
@ -307,13 +307,16 @@ static void layerInterp_normal(
|
|||
const void **sources, const float *weights,
|
||||
const float *UNUSED(sub_weights), int count, void *dest)
|
||||
{
|
||||
/* Note: This is linear interpolation, which is not optimal for vectors.
|
||||
* Unfortunately, spherical interpolation of more than two values is hairy, so for now it will do... */
|
||||
float no[3] = {0.0f};
|
||||
|
||||
while (count--) {
|
||||
madd_v3_v3fl(no, (const float *)sources[count], weights[count]);
|
||||
}
|
||||
|
||||
copy_v3_v3((float *)dest, no);
|
||||
/* Weighted sum of normalized vectors will **not** be normalized, even if weights are. */
|
||||
normalize_v3_v3((float *)dest, no);
|
||||
}
|
||||
|
||||
static void layerCopyValue_normal(const void *source, void *dest, const int mixmode, const float mixfactor)
|
||||
|
|
Loading…
Reference in New Issue