Browse Source

Added Vec3 mad.

Branimir Karadžić 7 years ago
parent
commit
e35f29b647
2 changed files with 8 additions and 0 deletions
  1. 5 0
      include/bx/inline/math.inl
  2. 3 0
      include/bx/math.h

+ 5 - 0
include/bx/inline/math.inl

@@ -404,6 +404,11 @@ namespace bx
 		};
 		};
 	}
 	}
 
 
+	inline constexpr BX_CONST_FUNC Vec3 mad(const Vec3& _a, const Vec3& _b, const Vec3& _c)
+	{
+		return add(mul(_a, _b), _c);
+	}
+
 	inline constexpr BX_CONST_FUNC float dot(const Vec3&  _a, const Vec3&  _b)
 	inline constexpr BX_CONST_FUNC float dot(const Vec3&  _a, const Vec3&  _b)
 	{
 	{
 		return _a.x*_b.x + _a.y*_b.y + _a.z*_b.z;
 		return _a.x*_b.x + _a.y*_b.y + _a.z*_b.z;

+ 3 - 0
include/bx/math.h

@@ -291,6 +291,9 @@ namespace bx
 	///
 	///
 	constexpr BX_CONST_FUNC Vec3 mul(const Vec3&  _a, float _b);
 	constexpr BX_CONST_FUNC Vec3 mul(const Vec3&  _a, float _b);
 
 
+	///
+	constexpr BX_CONST_FUNC Vec3 mad(const Vec3& _a, const Vec3& _b, const Vec3& _c);
+
 	///
 	///
 	constexpr BX_CONST_FUNC float dot(const Vec3&  _a, const Vec3&  _b);
 	constexpr BX_CONST_FUNC float dot(const Vec3&  _a, const Vec3&  _b);