| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |