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

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

Issue 848053002: Adding WebVR interface to Blink (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fixed compiler warning treated as an error on Windows Created 5 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 side-by-side diff with in-line comments
Download patch
Index: Source/modules/vr/VREyeParameters.cpp
diff --git a/Source/modules/vr/VREyeParameters.cpp b/Source/modules/vr/VREyeParameters.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..d38edc3abbb0e840830c2838b1838adf39cef68c
--- /dev/null
+++ b/Source/modules/vr/VREyeParameters.cpp
@@ -0,0 +1,66 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "config.h"
+#include "modules/vr/VREyeParameters.h"
+
+namespace blink {
+
+namespace {
+
+void setDomPoint(DOMPoint* point, const blink::WebVRVector3& vec)
+{
+ point->setX(vec.x);
+ point->setY(vec.y);
+ point->setZ(vec.z);
+ point->setW(0.0);
+}
+
+} // 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);
+}
+
+void VREyeParameters::setFromWebVREyeParameters(const blink::WebVREyeParameters &state)
+{
+ m_minimumFieldOfView->setFromWebVRFieldOfView(state.minimumFieldOfView);
+ m_maximumFieldOfView->setFromWebVRFieldOfView(state.maximumFieldOfView);
+ m_recommendedFieldOfView->setFromWebVRFieldOfView(state.recommendedFieldOfView);
+ setDomPoint(m_eyeTranslation, state.eyeTranslation);
+
+ m_currentFieldOfView->setFromWebVRFieldOfView(state.recommendedFieldOfView);
+}
+
+void VREyeParameters::setCurrentFieldOfView(const blink::VRFieldOfView* fov)
+{
+ m_currentFieldOfView = new VRFieldOfView(*fov);
+}
+
+void VREyeParameters::setRenderRect(double x, double y, double width, double height)
+{
+ m_renderRect->setX(x);
+ m_renderRect->setY(y);
+ m_renderRect->setWidth(width);
+ m_renderRect->setHeight(height);
+}
+
+void VREyeParameters::trace(Visitor* visitor)
+{
+ visitor->trace(m_minimumFieldOfView);
+ visitor->trace(m_maximumFieldOfView);
+ visitor->trace(m_recommendedFieldOfView);
+ visitor->trace(m_eyeTranslation);
+ visitor->trace(m_currentFieldOfView);
+ visitor->trace(m_renderRect);
+}
+
+} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698