OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef VRFieldOfView_h |
| 6 #define VRFieldOfView_h |
| 7 |
| 8 #include "bindings/core/v8/ScriptWrappable.h" |
| 9 #include "modules/vr/VRFieldOfViewInit.h" |
| 10 #include "platform/heap/Handle.h" |
| 11 #include "public/platform/WebVR.h" |
| 12 #include "wtf/Forward.h" |
| 13 |
| 14 |
| 15 namespace blink { |
| 16 |
| 17 class VRFieldOfView final : public GarbageCollected<VRFieldOfView>, public Scrip
tWrappable { |
| 18 DEFINE_WRAPPERTYPEINFO(); |
| 19 public: |
| 20 static VRFieldOfView* create(const VRFieldOfViewInit& fov) |
| 21 { |
| 22 return new VRFieldOfView(fov); |
| 23 } |
| 24 |
| 25 VRFieldOfView() : m_upDegrees(0.0), m_downDegrees(0.0), m_leftDegrees(0.0),
m_rightDegrees(0.0) |
| 26 { |
| 27 } |
| 28 |
| 29 VRFieldOfView(double upDegrees, double rightDegrees, double downDegrees, dou
ble leftDegrees) |
| 30 : m_upDegrees(0.0) |
| 31 , m_downDegrees(0.0) |
| 32 , m_leftDegrees(0.0) |
| 33 , m_rightDegrees(0.0) |
| 34 { |
| 35 } |
| 36 |
| 37 explicit VRFieldOfView(const VRFieldOfViewInit& fov) |
| 38 : m_upDegrees(fov.upDegrees()) |
| 39 , m_downDegrees(fov.downDegrees()) |
| 40 , m_leftDegrees(fov.leftDegrees()) |
| 41 , m_rightDegrees(fov.rightDegrees()) |
| 42 { |
| 43 } |
| 44 |
| 45 explicit VRFieldOfView(const VRFieldOfView& fov) |
| 46 : m_upDegrees(fov.m_upDegrees) |
| 47 , m_downDegrees(fov.m_downDegrees) |
| 48 , m_leftDegrees(fov.m_leftDegrees) |
| 49 , m_rightDegrees(fov.m_rightDegrees) |
| 50 { |
| 51 } |
| 52 |
| 53 double upDegrees() const { return m_upDegrees; } |
| 54 double downDegrees() const { return m_downDegrees; } |
| 55 double leftDegrees() const { return m_leftDegrees; } |
| 56 double rightDegrees() const { return m_rightDegrees; } |
| 57 |
| 58 void setUpDegrees(double value) { m_upDegrees = value; } |
| 59 void setDownDegrees(double value) { m_downDegrees = value; } |
| 60 void setLeftDegrees(double value) { m_leftDegrees = value; } |
| 61 void setRightDegrees(double value) { m_rightDegrees = value; } |
| 62 |
| 63 void setFromWebVRFieldOfView(const blink::WebVRFieldOfView& fov) |
| 64 { |
| 65 m_upDegrees = fov.upDegrees; |
| 66 m_downDegrees = fov.downDegrees; |
| 67 m_leftDegrees = fov.leftDegrees; |
| 68 m_rightDegrees = fov.rightDegrees; |
| 69 } |
| 70 |
| 71 void setFromVRFieldOfView(const VRFieldOfView& fov) |
| 72 { |
| 73 m_upDegrees = fov.m_upDegrees; |
| 74 m_downDegrees = fov.m_downDegrees; |
| 75 m_leftDegrees = fov.m_leftDegrees; |
| 76 m_rightDegrees = fov.m_rightDegrees; |
| 77 } |
| 78 |
| 79 WebVRFieldOfView toWebVRFieldOfView() |
| 80 { |
| 81 WebVRFieldOfView fov; |
| 82 fov.upDegrees = m_upDegrees; |
| 83 fov.downDegrees = m_downDegrees; |
| 84 fov.leftDegrees = m_leftDegrees; |
| 85 fov.rightDegrees = m_rightDegrees; |
| 86 return fov; |
| 87 } |
| 88 |
| 89 virtual void trace(Visitor*) |
| 90 { |
| 91 } |
| 92 |
| 93 private: |
| 94 double m_upDegrees; |
| 95 double m_downDegrees; |
| 96 double m_leftDegrees; |
| 97 double m_rightDegrees; |
| 98 }; |
| 99 |
| 100 } // namespace blink |
| 101 |
| 102 #endif // VRFieldOfView_h |
OLD | NEW |