From c36de0f02e6a2b97124df9036a68129decfbb04f Mon Sep 17 00:00:00 2001 From: Kawe Mazidjatari <48657826+Mauler125@users.noreply.github.com> Date: Sat, 10 Aug 2024 00:48:32 +0200 Subject: [PATCH] Recast: add math function to perform scale after vectors are added This is not the same as rdVmad. --- src/thirdparty/recast/Shared/Include/SharedCommon.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/thirdparty/recast/Shared/Include/SharedCommon.h b/src/thirdparty/recast/Shared/Include/SharedCommon.h index 56c49b6e..b6c23cbf 100644 --- a/src/thirdparty/recast/Shared/Include/SharedCommon.h +++ b/src/thirdparty/recast/Shared/Include/SharedCommon.h @@ -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.