Daniele Bartolini 10 سال پیش
والد
کامیت
487c9c8529
3فایلهای تغییر یافته به همراه22 افزوده شده و 17 حذف شده
  1. 4 4
      src/core/math/vector2.h
  2. 10 6
      src/core/math/vector3.h
  3. 8 7
      src/core/math/vector4.h

+ 4 - 4
src/core/math/vector2.h

@@ -45,10 +45,10 @@ inline Vector2& operator*=(Vector2& a, float k)
 /// Negates @a a and returns the result.
 inline Vector2 operator-(const Vector2& a)
 {
-	Vector2 res;
-	res.x = -a.x;
-	res.y = -a.y;
-	return res;
+	Vector2 v;
+	v.x = -a.x;
+	v.y = -a.y;
+	return v;
 }
 
 /// Adds the vector @a a to @a b and returns the result.

+ 10 - 6
src/core/math/vector3.h

@@ -49,11 +49,11 @@ inline Vector3& operator*=(Vector3& a, float k)
 /// Negates @a a and returns the result.
 inline Vector3 operator-(const Vector3& a)
 {
-	Vector3 res;
-	res.x = -a.x;
-	res.y = -a.y;
-	res.z = -a.z;
-	return res;
+	Vector3 v;
+	v.x = -a.x;
+	v.y = -a.y;
+	v.z = -a.z;
+	return v;
 }
 
 /// Adds the vector @a a to @a b and returns the result.
@@ -99,7 +99,11 @@ inline float dot(const Vector3& a, const Vector3& b)
 /// Returns the cross product between the vectors @a a and @a b.
 inline Vector3 cross(const Vector3& a, const Vector3& b)
 {
-	return vector3(a.y * b.z - a.z * b.y, a.z * b.x - a.x * b.z, a.x * b.y - a.y * b.x);
+	Vector3 v;
+	v.x = a.y * b.z - a.z * b.y;
+	v.y = a.z * b.x - a.x * b.z;
+	v.z = a.x * b.y - a.y * b.x;
+	return v;
 }
 
 /// Returns the squared length of @a a.

+ 8 - 7
src/core/math/vector4.h

@@ -63,12 +63,12 @@ inline Vector4& operator*=(Vector4& a, float k)
 /// Negates @a a and returns the result.
 inline Vector4 operator-(const Vector4& a)
 {
-	Vector4 res;
-	res.x = -a.x;
-	res.y = -a.y;
-	res.z = -a.z;
-	res.w = -a.w;
-	return res;
+	Vector4 v;
+	v.x = -a.x;
+	v.y = -a.y;
+	v.z = -a.z;
+	v.w = -a.w;
+	return v;
 }
 
 /// Adds the vector @a a to @a b and returns the result.
@@ -105,7 +105,8 @@ inline bool operator==(const Vector4& a, const Vector4& b)
 	return fequal(a.x, b.x)
 		&& fequal(a.y, b.y)
 		&& fequal(a.z, b.z)
-		&& fequal(a.w, b.w);
+		&& fequal(a.w, b.w)
+		;
 }
 
 /// Returns the dot product between the vectors @a a and @a b.