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

Side by Side Diff: third_party/WebKit/Source/modules/vr/VRFrameData.cpp

Issue 2407413002: Fixed depth range of WebVR projection matrices (Closed)
Patch Set: Created 4 years, 2 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 | « no previous file | no next file » | 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 #include "modules/vr/VRFrameData.h" 5 #include "modules/vr/VRFrameData.h"
6 6
7 #include "modules/vr/VREyeParameters.h" 7 #include "modules/vr/VREyeParameters.h"
8 #include "modules/vr/VRPose.h" 8 #include "modules/vr/VRPose.h"
9 9
10 #include <cmath> 10 #include <cmath>
(...skipping 20 matching lines...) Expand all
31 out[0] = xScale; 31 out[0] = xScale;
32 out[1] = 0.0f; 32 out[1] = 0.0f;
33 out[2] = 0.0f; 33 out[2] = 0.0f;
34 out[3] = 0.0f; 34 out[3] = 0.0f;
35 out[4] = 0.0f; 35 out[4] = 0.0f;
36 out[5] = yScale; 36 out[5] = yScale;
37 out[6] = 0.0f; 37 out[6] = 0.0f;
38 out[7] = 0.0f; 38 out[7] = 0.0f;
39 out[8] = -((leftTan - rightTan) * xScale * 0.5); 39 out[8] = -((leftTan - rightTan) * xScale * 0.5);
40 out[9] = ((upTan - downTan) * yScale * 0.5); 40 out[9] = ((upTan - downTan) * yScale * 0.5);
41 out[10] = depthFar / (depthNear - depthFar); 41 out[10] = (depthNear + depthFar) / (depthNear - depthFar);
42 out[11] = -1.0f; 42 out[11] = -1.0f;
43 out[12] = 0.0f; 43 out[12] = 0.0f;
44 out[13] = 0.0f; 44 out[13] = 0.0f;
45 out[14] = (depthFar * depthNear) / (depthNear - depthFar); 45 out[14] = (2 * depthFar * depthNear) / (depthNear - depthFar);
46 out[15] = 0.0f; 46 out[15] = 0.0f;
47 } 47 }
48 48
49 // Create a matrix from a rotation and translation. 49 // Create a matrix from a rotation and translation.
50 void matrixfromRotationTranslation(DOMFloat32Array* outArray, 50 void matrixfromRotationTranslation(DOMFloat32Array* outArray,
51 const mojo::WTFArray<float>& rotation, 51 const mojo::WTFArray<float>& rotation,
52 const mojo::WTFArray<float>& translation) { 52 const mojo::WTFArray<float>& translation) {
53 // Quaternion math 53 // Quaternion math
54 float x = rotation.is_null() ? 0.0f : rotation[0]; 54 float x = rotation.is_null() ? 0.0f : rotation[0];
55 float y = rotation.is_null() ? 0.0f : rotation[1]; 55 float y = rotation.is_null() ? 0.0f : rotation[1];
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 211
212 DEFINE_TRACE(VRFrameData) { 212 DEFINE_TRACE(VRFrameData) {
213 visitor->trace(m_leftProjectionMatrix); 213 visitor->trace(m_leftProjectionMatrix);
214 visitor->trace(m_leftViewMatrix); 214 visitor->trace(m_leftViewMatrix);
215 visitor->trace(m_rightProjectionMatrix); 215 visitor->trace(m_rightProjectionMatrix);
216 visitor->trace(m_rightViewMatrix); 216 visitor->trace(m_rightViewMatrix);
217 visitor->trace(m_pose); 217 visitor->trace(m_pose);
218 } 218 }
219 219
220 } // namespace blink 220 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698