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

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

Issue 2816833002: VR: Fix dynamic resizing webVR page, revert FOV calculation changes. (Closed)
Patch Set: Correct diffbase 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 | « chrome/browser/android/vr_shell/vr_shell_gl.cc ('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
1 // Copyright 2016 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef DEVICE_VR_VR_MATH_H_ 5 #ifndef DEVICE_VR_VR_MATH_H_
6 #define DEVICE_VR_VR_MATH_H_ 6 #define DEVICE_VR_VR_MATH_H_
7 7
8 #include "device/vr/vr_export.h" 8 #include "device/vr/vr_export.h"
9 #include "device/vr/vr_types.h" 9 #include "device/vr/vr_types.h"
10 10
11 namespace vr { 11 namespace vr {
12 12
13 void DEVICE_VR_EXPORT SetIdentityM(Mat4f* mat); 13 void DEVICE_VR_EXPORT SetIdentityM(Mat4f* mat);
14 void DEVICE_VR_EXPORT TranslateM(const Mat4f& mat, 14 void DEVICE_VR_EXPORT TranslateM(const Mat4f& mat,
15 const gfx::Vector3dF& translation, 15 const gfx::Vector3dF& translation,
16 Mat4f* out); 16 Mat4f* out);
17 void DEVICE_VR_EXPORT ScaleM(const Mat4f& mat, 17 void DEVICE_VR_EXPORT ScaleM(const Mat4f& mat,
18 const gfx::Vector3dF& scale, 18 const gfx::Vector3dF& scale,
19 Mat4f* out); 19 Mat4f* out);
20 20
21 gfx::Vector3dF DEVICE_VR_EXPORT MatrixVectorMul(const Mat4f& m, 21 gfx::Vector3dF DEVICE_VR_EXPORT MatrixVectorMul(const Mat4f& m,
22 const gfx::Vector3dF& v); 22 const gfx::Vector3dF& v);
23 gfx::Vector3dF DEVICE_VR_EXPORT MatrixVectorRotate(const Mat4f& m, 23 gfx::Vector3dF DEVICE_VR_EXPORT MatrixVectorRotate(const Mat4f& m,
24 const gfx::Vector3dF& v); 24 const gfx::Vector3dF& v);
25 void DEVICE_VR_EXPORT MatrixMul(const Mat4f& matrix1, 25 void DEVICE_VR_EXPORT MatrixMul(const Mat4f& matrix1,
26 const Mat4f& matrix2, 26 const Mat4f& matrix2,
27 Mat4f* out); 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 28
33 // Provides the direction the head is looking towards as a 3x1 unit vector. 29 // Provides the direction the head is looking towards as a 3x1 unit vector.
34 gfx::Vector3dF DEVICE_VR_EXPORT GetForwardVector(const Mat4f& matrix); 30 gfx::Vector3dF DEVICE_VR_EXPORT GetForwardVector(const Mat4f& matrix);
35 31
36 gfx::Vector3dF DEVICE_VR_EXPORT GetTranslation(const Mat4f& matrix); 32 gfx::Vector3dF DEVICE_VR_EXPORT GetTranslation(const Mat4f& matrix);
37 33
38 void DEVICE_VR_EXPORT QuatToMatrix(const Quatf& quat, Mat4f* out); 34 void DEVICE_VR_EXPORT QuatToMatrix(const Quatf& quat, Mat4f* out);
39 35
40 // Normalize a vector, and return its original length. 36 // Normalize a vector, and return its original length.
41 float DEVICE_VR_EXPORT NormalizeVector(gfx::Vector3dF* vec); 37 float DEVICE_VR_EXPORT NormalizeVector(gfx::Vector3dF* vec);
42 38
43 void DEVICE_VR_EXPORT NormalizeQuat(Quatf* quat); 39 void DEVICE_VR_EXPORT NormalizeQuat(Quatf* quat);
44 40
45 Quatf DEVICE_VR_EXPORT QuatFromAxisAngle(const RotationAxisAngle& axis_angle); 41 Quatf DEVICE_VR_EXPORT QuatFromAxisAngle(const RotationAxisAngle& axis_angle);
46 42
47 gfx::Point3F DEVICE_VR_EXPORT GetRayPoint(const gfx::Point3F& rayOrigin, 43 gfx::Point3F DEVICE_VR_EXPORT GetRayPoint(const gfx::Point3F& rayOrigin,
48 const gfx::Vector3dF& rayVector, 44 const gfx::Vector3dF& rayVector,
49 float scale); 45 float scale);
50 46
51 // Angle between the vectors' projections to the XZ plane. 47 // Angle between the vectors' projections to the XZ plane.
52 bool DEVICE_VR_EXPORT XZAngle(const gfx::Vector3dF& vec1, 48 bool DEVICE_VR_EXPORT XZAngle(const gfx::Vector3dF& vec1,
53 const gfx::Vector3dF& vec2, 49 const gfx::Vector3dF& vec2,
54 float* angle); 50 float* angle);
55 51
56 } // namespace vr 52 } // namespace vr
57 53
58 #endif // DEVICE_VR_VR_MATH_H_ 54 #endif // DEVICE_VR_VR_MATH_H_
OLDNEW
« no previous file with comments | « chrome/browser/android/vr_shell/vr_shell_gl.cc ('k') | device/vr/vr_math.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698