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

Unified Diff: third_party/WebKit/Source/modules/vr/VREyeParameters.cpp

Issue 1918143007: Updated Blink WebVR interfaces to WebVR v1 spec (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@webvr_mojo
Patch Set: Fixed layout test Created 4 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/modules/vr/VREyeParameters.cpp
diff --git a/third_party/WebKit/Source/modules/vr/VREyeParameters.cpp b/third_party/WebKit/Source/modules/vr/VREyeParameters.cpp
index f8861774b76b6ca3c19ece69a76a608e4d86a12e..472238fe47441c809f6560010dfba5ea5a73bc76 100644
--- a/third_party/WebKit/Source/modules/vr/VREyeParameters.cpp
+++ b/third_party/WebKit/Source/modules/vr/VREyeParameters.cpp
@@ -3,54 +3,41 @@
// found in the LICENSE file.
#include "modules/vr/VREyeParameters.h"
+#include "public/platform/modules/vr/WebVR.h"
namespace blink {
namespace {
-void setDomPoint(DOMPoint* point, const WebVRVector3& vec)
+void setVecToFloat32Array(DOMFloat32Array* out, const WebVRVector3& vec)
{
- point->setX(vec.x);
- point->setY(vec.y);
- point->setZ(vec.z);
- point->setW(1.0);
+ out->data()[0] = vec.x;
+ out->data()[1] = vec.y;
+ out->data()[2] = vec.z;
}
} // namespace
VREyeParameters::VREyeParameters()
{
- m_minimumFieldOfView = new VRFieldOfView();
- m_maximumFieldOfView = new VRFieldOfView();
- m_recommendedFieldOfView = new VRFieldOfView();
- m_eyeTranslation = DOMPoint::create(0, 0, 0, 0);
-
- m_currentFieldOfView = new VRFieldOfView();
- m_renderRect = DOMRect::create(0, 0, 0, 0);
+ m_offset = DOMFloat32Array::create(3);
+ m_fieldOfView = new VRFieldOfView();
+ m_renderWidth = 0;
+ m_renderHeight = 0;
}
-void VREyeParameters::setFromWebVREyeParameters(const WebVREyeParameters &state)
+void VREyeParameters::update(const WebVREyeParameters &eye_parameters)
{
- // FIXME: We should expose proper min/max FOV eventually but for now set the
- // min/max equal to the recommended FOV to reduce need for synchronous
- // queries and reduce rendering complexity.
- m_minimumFieldOfView->setFromWebVRFieldOfView(state.recommendedFieldOfView);
- m_maximumFieldOfView->setFromWebVRFieldOfView(state.recommendedFieldOfView);
- m_recommendedFieldOfView->setFromWebVRFieldOfView(state.recommendedFieldOfView);
- setDomPoint(m_eyeTranslation, state.eyeTranslation);
-
- m_currentFieldOfView->setFromWebVRFieldOfView(state.recommendedFieldOfView);
- m_renderRect = DOMRect::create(state.renderRect.x, state.renderRect.y, state.renderRect.width, state.renderRect.height);
+ setVecToFloat32Array(m_offset.get(), eye_parameters.eyeTranslation);
+ m_fieldOfView->setFromWebVRFieldOfView(eye_parameters.recommendedFieldOfView);
+ m_renderWidth = eye_parameters.renderRect.width;
+ m_renderHeight = eye_parameters.renderRect.height;
}
DEFINE_TRACE(VREyeParameters)
{
- visitor->trace(m_minimumFieldOfView);
- visitor->trace(m_maximumFieldOfView);
- visitor->trace(m_recommendedFieldOfView);
- visitor->trace(m_eyeTranslation);
- visitor->trace(m_currentFieldOfView);
- visitor->trace(m_renderRect);
+ visitor->trace(m_offset);
+ visitor->trace(m_fieldOfView);
}
} // namespace blink
« no previous file with comments | « third_party/WebKit/Source/modules/vr/VREyeParameters.h ('k') | third_party/WebKit/Source/modules/vr/VREyeParameters.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698