OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 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 #ifndef VRHardwareUnit_h | 5 #ifndef VRHardwareUnit_h |
6 #define VRHardwareUnit_h | 6 #define VRHardwareUnit_h |
7 | 7 |
8 #include "modules/vr/VRFieldOfView.h" | 8 #include "modules/vr/VRFieldOfView.h" |
9 #include "modules/vr/VRPositionState.h" | 9 #include "modules/vr/VRPositionState.h" |
10 #include "platform/heap/Handle.h" | 10 #include "platform/heap/Handle.h" |
11 #include "wtf/text/WTFString.h" | 11 #include "wtf/text/WTFString.h" |
12 | 12 |
13 namespace blink { | 13 namespace blink { |
14 | 14 |
15 class VRController; | 15 class VRController; |
16 class VRDevice; | 16 class VRDevice; |
17 class HMDVRDevice; | 17 class HMDVRDevice; |
18 class NavigatorVRDevice; | 18 class NavigatorVRDevice; |
19 class PositionSensorVRDevice; | 19 class PositionSensorVRDevice; |
20 | 20 |
21 enum VREye { | 21 enum VREye { |
22 VREyeLeft, | 22 VREyeLeft, |
23 VREyeRight, | 23 VREyeRight, |
24 VREyeNone, | 24 VREyeNone, |
25 }; | 25 }; |
26 | 26 |
27 class VRHardwareUnit : public GarbageCollectedFinalized<VRHardwareUnit> { | 27 class VRHardwareUnit : public GarbageCollectedFinalized<VRHardwareUnit> { |
28 public: | 28 public: |
29 explicit VRHardwareUnit(VRController*); | 29 explicit VRHardwareUnit(NavigatorVRDevice*); |
30 virtual ~VRHardwareUnit(); | 30 virtual ~VRHardwareUnit(); |
31 | 31 |
32 void updateFromWebVRDevice(const WebVRDevice&); | 32 void updateFromWebVRDevice(const WebVRDevice&); |
33 | 33 |
34 void addDevicesToVector(HeapVector<Member<VRDevice>>&); | 34 void addDevicesToVector(HeapVector<Member<VRDevice>>&); |
35 | 35 |
36 virtual unsigned index() const { return m_index; } | 36 virtual unsigned index() const { return m_index; } |
37 const String& hardwareUnitId() const { return m_hardwareUnitId; } | 37 const String& hardwareUnitId() const { return m_hardwareUnitId; } |
38 | 38 |
39 unsigned frameIndex() const { return m_frameIndex; } | 39 unsigned frameIndex() const { return m_frameIndex; } |
40 | 40 |
41 VRController* controller(); | 41 VRController* controller(); |
42 | 42 |
43 // VRController queries | 43 // VRController queries |
44 VRPositionState* getSensorState(); | 44 VRPositionState* getSensorState(); |
45 | 45 |
46 HMDVRDevice* hmd() const { return m_hmd; } | 46 HMDVRDevice* hmd() const { return m_hmd; } |
47 PositionSensorVRDevice* positionSensor() const { return m_positionSensor; } | 47 PositionSensorVRDevice* positionSensor() const { return m_positionSensor; } |
48 | 48 |
49 DECLARE_VIRTUAL_TRACE(); | 49 DECLARE_VIRTUAL_TRACE(); |
50 | 50 |
51 private: | 51 private: |
52 unsigned m_index; | 52 unsigned m_index; |
53 String m_hardwareUnitId; | 53 String m_hardwareUnitId; |
54 unsigned m_nextDeviceId; | 54 unsigned m_nextDeviceId; |
55 | 55 |
56 unsigned m_frameIndex; | 56 unsigned m_frameIndex; |
57 | 57 |
58 Member<VRController> m_controller; | 58 Member<NavigatorVRDevice> m_navigatorVRDevice; |
59 Member<VRPositionState> m_positionState; | 59 Member<VRPositionState> m_positionState; |
60 | 60 |
61 // Device types | 61 // Device types |
62 Member<HMDVRDevice> m_hmd; | 62 Member<HMDVRDevice> m_hmd; |
63 Member<PositionSensorVRDevice> m_positionSensor; | 63 Member<PositionSensorVRDevice> m_positionSensor; |
64 }; | 64 }; |
65 | 65 |
66 } // namespace blink | 66 } // namespace blink |
67 | 67 |
68 #endif // VRHardwareUnit_h | 68 #endif // VRHardwareUnit_h |
OLD | NEW |