ソースを参照

Add divide operations for Vec3.

feserr 5 年 前
コミット
3106681f02
2 ファイル変更26 行追加0 行削除
  1. 20 0
      include/bx/inline/math.inl
  2. 6 0
      include/bx/math.h

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

@@ -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);

+ 6 - 0
include/bx/math.h

@@ -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);