Index: device/vr/vr_math.h |
diff --git a/device/vr/vr_math.h b/device/vr/vr_math.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..d7230be04fa3e0caba1e3ec5d4551199af9a8d56 |
--- /dev/null |
+++ b/device/vr/vr_math.h |
@@ -0,0 +1,58 @@ |
+// Copyright 2016 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef DEVICE_VR_DEVICE_VR_MATH_H_ |
cjgrant
2017/04/11 13:44:40
DEVICE_VR_VR_MATH_H_ (other files as well).
mthiesse
2017/04/11 14:46:43
Done.
|
+#define DEVICE_VR_DEVICE_VR_MATH_H_ |
+ |
+#include "device/vr/vr_export.h" |
+#include "device/vr/vr_types.h" |
+ |
+namespace vr { |
+ |
+void DEVICE_VR_EXPORT SetIdentityM(Matf* mat); |
+void DEVICE_VR_EXPORT TranslateM(const Matf& mat, |
+ const gfx::Vector3dF& translation, |
+ Matf* out); |
+void DEVICE_VR_EXPORT ScaleM(const Matf& mat, |
+ const gfx::Vector3dF& scale, |
+ Matf* out); |
+ |
+gfx::Vector3dF DEVICE_VR_EXPORT MatrixVectorMul(const Matf& m, |
+ const gfx::Vector3dF& v); |
+gfx::Vector3dF DEVICE_VR_EXPORT MatrixVectorRotate(const Matf& m, |
+ const gfx::Vector3dF& v); |
+void DEVICE_VR_EXPORT MatrixMul(const Matf& matrix1, |
+ const Matf& matrix2, |
+ Matf* out); |
cjgrant
2017/04/11 13:44:40
Here we're returning a new matrix. Possibly just
mthiesse
2017/04/11 14:46:44
Acknowledged.
|
+void DEVICE_VR_EXPORT PerspectiveMatrixFromView(const gfx::RectF& fov, |
+ float z_near, |
+ float z_far, |
+ Matf* out); |
cjgrant
2017/04/11 13:44:40
Same here.
mthiesse
2017/04/11 14:46:44
Acknowledged.
|
+ |
+// Provides the direction the head is looking towards as a 3x1 unit vector. |
+gfx::Vector3dF DEVICE_VR_EXPORT GetForwardVector(const Matf& matrix); |
+ |
+gfx::Vector3dF DEVICE_VR_EXPORT GetTranslation(const Matf& matrix); |
+ |
+void DEVICE_VR_EXPORT QuatToMatrix(const Quatf& quat, Matf* out); |
cjgrant
2017/04/11 13:44:40
And here.
mthiesse
2017/04/11 14:46:44
Acknowledged.
|
+ |
+// Normalize a vector, and return its original length. |
+float DEVICE_VR_EXPORT NormalizeVector(gfx::Vector3dF* vec); |
+ |
+void DEVICE_VR_EXPORT NormalizeQuat(Quatf* quat); |
+ |
+Quatf DEVICE_VR_EXPORT QuatFromAxisAngle(const RotationAxisAngle& axis_angle); |
+ |
+gfx::Point3F DEVICE_VR_EXPORT GetRayPoint(const gfx::Point3F& rayOrigin, |
+ const gfx::Vector3dF& rayVector, |
+ float scale); |
+ |
+// Angle between the vectors' projections to the XZ plane. |
+bool DEVICE_VR_EXPORT XZAngle(const gfx::Vector3dF& vec1, |
+ const gfx::Vector3dF& vec2, |
+ float* angle); |
+ |
+} // namespace vr |
+ |
+#endif // DEVICE_VR_DEVICE_VR_MATH_H_ |