Add divide operations for Vec3.

This commit is contained in:
feserr
2020-05-15 07:52:21 +01:00
committed by Бранимир Караџић
parent 0455026c42
commit 3106681f02
2 changed files with 26 additions and 0 deletions

View File

@@ -492,6 +492,26 @@ namespace bx
};
}
inline BX_CONSTEXPR_FUNC Vec3 div(const Vec3 _a, const Vec3 _b)
{
return
{
_a.x / _b.x,
_a.y / _b.y,
_a.z / _b.z,
};
}
inline BX_CONSTEXPR_FUNC Vec3 div(const Vec3 _a, float _b)
{
return
{
_a.x / _b,
_a.y / _b,
_a.z / _b,
};
}
inline BX_CONSTEXPR_FUNC Vec3 mad(const Vec3 _a, const float _b, const Vec3 _c)
{
return add(mul(_a, _b), _c);

View File

@@ -327,6 +327,12 @@ namespace bx
///
BX_CONSTEXPR_FUNC Vec3 mul(const Vec3 _a, float _b);
///
BX_CONSTEXPR_FUNC Vec3 div(const Vec3 _a, const Vec3 _b);
///
BX_CONSTEXPR_FUNC Vec3 div(const Vec3 _a, float _b);
///
BX_CONSTEXPR_FUNC Vec3 mad(const Vec3 _a, const float _b, const Vec3 _c);