ソースを参照

Fixed wrong implementation of Quat multiplication

Obeyed Clang format rules
shaderbeast 6 年 前
コミット
041b97e5b2
1 ファイル変更4 行追加4 行削除
  1. 4 4
      src/core/Quat.cpp

+ 4 - 4
src/core/Quat.cpp

@@ -247,10 +247,10 @@ void Quat::operator-=(const Quat &q) {
 }
 
 void Quat::operator*=(const Quat &q) {
-	x *= q.x;
-	y *= q.y;
-	z *= q.z;
-	w *= q.w;
+	set(w * q.x + x * q.w + y * q.z - z * q.y,
+			w * q.y + y * q.w + z * q.x - x * q.z,
+			w * q.z + z * q.w + x * q.y - y * q.x,
+			w * q.w - x * q.x - y * q.y - z * q.z);
 }
 
 void Quat::operator*=(const real_t &s) {