Recast: add math function to perform scale after vectors are added

This is not the same as rdVmad.
This commit is contained in:
Kawe Mazidjatari 2024-08-10 00:48:32 +02:00
parent 66b5ae4084
commit c36de0f02e

View File

@ -139,6 +139,18 @@ inline void rdVmad(float* dest, const float* v1, const float* v2, const float s)
dest[2] = v1[2]+v2[2]*s;
}
/// Performs a scaled vector addition. ((@p v1 + @p v2) * @p s)
/// @param[out] dest The result vector. [(x, y, z)]
/// @param[in] v1 The base vector. [(x, y, z)]
/// @param[in] v2 The vector to add to @p v1. [(x, y, z)]
/// @param[in] s The amount to scale the addition result of @p v1 and @p v2.
inline void rdVsad(float* dest, const float* v1, const float* v2, const float s)
{
dest[0] = (v1[0]+v2[0])*s;
dest[1] = (v1[1]+v2[1])*s;
dest[2] = (v1[2]+v2[2])*s;
}
/// Performs a linear interpolation between two vectors. (@p v1 toward @p v2)
/// @param[out] dest The result vector. [(x, y, x)]
/// @param[in] v1 The starting vector.