Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4)

Side by Side Diff: device/vr/vr_math.h

Issue 2814443004: Refactor VR math off of GVR types, onto gfx types where possible. (Closed)
Patch Set: Fix tests Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « device/vr/vr_export.h ('k') | device/vr/vr_math.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef DEVICE_VR_VR_MATH_H_
6 #define DEVICE_VR_VR_MATH_H_
7
8 #include "device/vr/vr_export.h"
9 #include "device/vr/vr_types.h"
10
11 namespace vr {
12
13 void DEVICE_VR_EXPORT SetIdentityM(Mat4f* mat);
14 void DEVICE_VR_EXPORT TranslateM(const Mat4f& mat,
15 const gfx::Vector3dF& translation,
16 Mat4f* out);
17 void DEVICE_VR_EXPORT ScaleM(const Mat4f& mat,
18 const gfx::Vector3dF& scale,
19 Mat4f* out);
20
21 gfx::Vector3dF DEVICE_VR_EXPORT MatrixVectorMul(const Mat4f& m,
22 const gfx::Vector3dF& v);
23 gfx::Vector3dF DEVICE_VR_EXPORT MatrixVectorRotate(const Mat4f& m,
24 const gfx::Vector3dF& v);
25 void DEVICE_VR_EXPORT MatrixMul(const Mat4f& matrix1,
26 const Mat4f& matrix2,
27 Mat4f* out);
28 void DEVICE_VR_EXPORT PerspectiveMatrixFromView(const gfx::RectF& fov,
29 float z_near,
30 float z_far,
31 Mat4f* out);
32
33 // Provides the direction the head is looking towards as a 3x1 unit vector.
34 gfx::Vector3dF DEVICE_VR_EXPORT GetForwardVector(const Mat4f& matrix);
35
36 gfx::Vector3dF DEVICE_VR_EXPORT GetTranslation(const Mat4f& matrix);
37
38 void DEVICE_VR_EXPORT QuatToMatrix(const Quatf& quat, Mat4f* out);
39
40 // Normalize a vector, and return its original length.
41 float DEVICE_VR_EXPORT NormalizeVector(gfx::Vector3dF* vec);
42
43 void DEVICE_VR_EXPORT NormalizeQuat(Quatf* quat);
44
45 Quatf DEVICE_VR_EXPORT QuatFromAxisAngle(const RotationAxisAngle& axis_angle);
46
47 gfx::Point3F DEVICE_VR_EXPORT GetRayPoint(const gfx::Point3F& rayOrigin,
48 const gfx::Vector3dF& rayVector,
49 float scale);
50
51 // Angle between the vectors' projections to the XZ plane.
52 bool DEVICE_VR_EXPORT XZAngle(const gfx::Vector3dF& vec1,
53 const gfx::Vector3dF& vec2,
54 float* angle);
55
56 } // namespace vr
57
58 #endif // DEVICE_VR_VR_MATH_H_
OLDNEW
« no previous file with comments | « device/vr/vr_export.h ('k') | device/vr/vr_math.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698