Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGaia Clary <gaia.clary@machinimatrix.org>2019-05-28 23:08:23 +0300
committerGaia Clary <gaia.clary@machinimatrix.org>2019-06-03 00:00:57 +0300
commit0bcf29b8cd9dc2c99f3f63c7761fe9e1223641ef (patch)
treeb16f5aa57f4204004d2ff97275cf3eb4cd39b18d /source/blender/collada/BCMath.cpp
parentd04622e427c2e017fd6ea0c9a915168cee40c798 (diff)
refactor: use Quat and BCQuat instead of float[4] arrays for Quaternions (wip)
Diffstat (limited to 'source/blender/collada/BCMath.cpp')
-rw-r--r--source/blender/collada/BCMath.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/source/blender/collada/BCMath.cpp b/source/blender/collada/BCMath.cpp
index a07d1e735ff..31f8bd1c2bc 100644
--- a/source/blender/collada/BCMath.cpp
+++ b/source/blender/collada/BCMath.cpp
@@ -20,6 +20,24 @@
#include "BCMath.h"
#include "BlenderContext.h"
+void BCQuat::rotate_to(Matrix &mat_to)
+{
+ Quat qd;
+ Matrix matd;
+ Matrix mati;
+ Matrix mat_from;
+
+ quat_to_mat4(mat_from, q);
+
+ /* Calculate the difference matrix matd between mat_from and mat_to */
+ invert_m4_m4(mati, mat_from);
+ mul_m4_m4m4(matd, mati, mat_to);
+
+ mat4_to_quat(qd, matd);
+
+ mul_qt_qtqt(q, qd, q); /* rotate to the final rotation to mat_to */
+}
+
BCMatrix::BCMatrix(const BCMatrix &mat)
{
set_transform(mat.matrix);