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 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 m_rightProjectionMatrix = DOMFloat32Array::create(16); | 173 m_rightProjectionMatrix = DOMFloat32Array::create(16); |
174 m_rightViewMatrix = DOMFloat32Array::create(16); | 174 m_rightViewMatrix = DOMFloat32Array::create(16); |
175 m_pose = VRPose::create(); | 175 m_pose = VRPose::create(); |
176 } | 176 } |
177 | 177 |
178 bool VRFrameData::update(const device::mojom::blink::VRPosePtr& pose, | 178 bool VRFrameData::update(const device::mojom::blink::VRPosePtr& pose, |
179 VREyeParameters* leftEye, | 179 VREyeParameters* leftEye, |
180 VREyeParameters* rightEye, | 180 VREyeParameters* rightEye, |
181 float depthNear, | 181 float depthNear, |
182 float depthFar) { | 182 float depthFar) { |
183 if (!pose) | |
184 return false; | |
185 | |
186 m_timestamp = pose->timestamp; | 183 m_timestamp = pose->timestamp; |
187 | 184 |
188 // Build the projection matrices | 185 // Build the projection matrices |
189 projectionFromFieldOfView(m_leftProjectionMatrix, leftEye->fieldOfView(), | 186 projectionFromFieldOfView(m_leftProjectionMatrix, leftEye->fieldOfView(), |
190 depthNear, depthFar); | 187 depthNear, depthFar); |
191 projectionFromFieldOfView(m_rightProjectionMatrix, rightEye->fieldOfView(), | 188 projectionFromFieldOfView(m_rightProjectionMatrix, rightEye->fieldOfView(), |
192 depthNear, depthFar); | 189 depthNear, depthFar); |
193 | 190 |
194 // Build the view matrices | 191 // Build the view matrices |
195 matrixfromRotationTranslation(m_leftViewMatrix, pose->orientation, | 192 matrixfromRotationTranslation(m_leftViewMatrix, pose->orientation, |
(...skipping 16 matching lines...) Expand all Loading... |
212 | 209 |
213 DEFINE_TRACE(VRFrameData) { | 210 DEFINE_TRACE(VRFrameData) { |
214 visitor->trace(m_leftProjectionMatrix); | 211 visitor->trace(m_leftProjectionMatrix); |
215 visitor->trace(m_leftViewMatrix); | 212 visitor->trace(m_leftViewMatrix); |
216 visitor->trace(m_rightProjectionMatrix); | 213 visitor->trace(m_rightProjectionMatrix); |
217 visitor->trace(m_rightViewMatrix); | 214 visitor->trace(m_rightViewMatrix); |
218 visitor->trace(m_pose); | 215 visitor->trace(m_pose); |
219 } | 216 } |
220 | 217 |
221 } // namespace blink | 218 } // namespace blink |
OLD | NEW |