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

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

Issue 2736593002: Update API to latest spec : Remove VRFrameData#timestamp (Closed)
Patch Set: modify mock-vr-service.js Created 3 years, 9 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
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 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 out[10] = (a30 * b04 - a31 * b02 + a33 * b00) * det; 160 out[10] = (a30 * b04 - a31 * b02 + a33 * b00) * det;
161 out[11] = (a21 * b02 - a20 * b04 - a23 * b00) * det; 161 out[11] = (a21 * b02 - a20 * b04 - a23 * b00) * det;
162 out[12] = (a11 * b07 - a10 * b09 - a12 * b06) * det; 162 out[12] = (a11 * b07 - a10 * b09 - a12 * b06) * det;
163 out[13] = (a00 * b09 - a01 * b07 + a02 * b06) * det; 163 out[13] = (a00 * b09 - a01 * b07 + a02 * b06) * det;
164 out[14] = (a31 * b01 - a30 * b03 - a32 * b00) * det; 164 out[14] = (a31 * b01 - a30 * b03 - a32 * b00) * det;
165 out[15] = (a20 * b03 - a21 * b01 + a22 * b00) * det; 165 out[15] = (a20 * b03 - a21 * b01 + a22 * b00) * det;
166 166
167 return true; 167 return true;
168 }; 168 };
169 169
170 VRFrameData::VRFrameData() : m_timestamp(0.0) { 170 VRFrameData::VRFrameData() {
171 m_leftProjectionMatrix = DOMFloat32Array::create(16); 171 m_leftProjectionMatrix = DOMFloat32Array::create(16);
172 m_leftViewMatrix = DOMFloat32Array::create(16); 172 m_leftViewMatrix = DOMFloat32Array::create(16);
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 m_timestamp = pose->timestamp;
184
185 // Build the projection matrices 183 // Build the projection matrices
186 projectionFromFieldOfView(m_leftProjectionMatrix, leftEye->fieldOfView(), 184 projectionFromFieldOfView(m_leftProjectionMatrix, leftEye->fieldOfView(),
187 depthNear, depthFar); 185 depthNear, depthFar);
188 projectionFromFieldOfView(m_rightProjectionMatrix, rightEye->fieldOfView(), 186 projectionFromFieldOfView(m_rightProjectionMatrix, rightEye->fieldOfView(),
189 depthNear, depthFar); 187 depthNear, depthFar);
190 188
191 // Build the view matrices 189 // Build the view matrices
192 matrixfromRotationTranslation(m_leftViewMatrix, pose->orientation, 190 matrixfromRotationTranslation(m_leftViewMatrix, pose->orientation,
193 pose->position); 191 pose->position);
194 matrixTranslate(m_leftViewMatrix, leftEye->offset()); 192 matrixTranslate(m_leftViewMatrix, leftEye->offset());
(...skipping 14 matching lines...) Expand all
209 207
210 DEFINE_TRACE(VRFrameData) { 208 DEFINE_TRACE(VRFrameData) {
211 visitor->trace(m_leftProjectionMatrix); 209 visitor->trace(m_leftProjectionMatrix);
212 visitor->trace(m_leftViewMatrix); 210 visitor->trace(m_leftViewMatrix);
213 visitor->trace(m_rightProjectionMatrix); 211 visitor->trace(m_rightProjectionMatrix);
214 visitor->trace(m_rightViewMatrix); 212 visitor->trace(m_rightViewMatrix);
215 visitor->trace(m_pose); 213 visitor->trace(m_pose);
216 } 214 }
217 215
218 } // namespace blink 216 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/modules/vr/VRFrameData.h ('k') | third_party/WebKit/Source/modules/vr/VRFrameData.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698