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