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

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: 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
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_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.
6 #define DEVICE_VR_DEVICE_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(Matf* mat);
14 void DEVICE_VR_EXPORT TranslateM(const Matf& mat,
15 const gfx::Vector3dF& translation,
16 Matf* out);
17 void DEVICE_VR_EXPORT ScaleM(const Matf& mat,
18 const gfx::Vector3dF& scale,
19 Matf* out);
20
21 gfx::Vector3dF DEVICE_VR_EXPORT MatrixVectorMul(const Matf& m,
22 const gfx::Vector3dF& v);
23 gfx::Vector3dF DEVICE_VR_EXPORT MatrixVectorRotate(const Matf& m,
24 const gfx::Vector3dF& v);
25 void DEVICE_VR_EXPORT MatrixMul(const Matf& matrix1,
26 const Matf& matrix2,
27 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.
28 void DEVICE_VR_EXPORT PerspectiveMatrixFromView(const gfx::RectF& fov,
29 float z_near,
30 float z_far,
31 Matf* out);
cjgrant 2017/04/11 13:44:40 Same here.
mthiesse 2017/04/11 14:46:44 Acknowledged.
32
33 // Provides the direction the head is looking towards as a 3x1 unit vector.
34 gfx::Vector3dF DEVICE_VR_EXPORT GetForwardVector(const Matf& matrix);
35
36 gfx::Vector3dF DEVICE_VR_EXPORT GetTranslation(const Matf& matrix);
37
38 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.
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_DEVICE_VR_MATH_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698