OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 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 VRDisplay_h |
| 6 #define VRDisplay_h |
| 7 |
| 8 #include "bindings/core/v8/ScriptWrappable.h" |
| 9 #include "core/dom/Document.h" |
| 10 #include "core/dom/FrameRequestCallback.h" |
| 11 #include "modules/vr/VRDisplayCapabilities.h" |
| 12 #include "modules/vr/VRLayer.h" |
| 13 #include "platform/heap/Handle.h" |
| 14 #include "public/platform/WebGraphicsContext3DProvider.h" |
| 15 #include "public/platform/WebThread.h" |
| 16 #include "public/platform/modules/vr/WebVR.h" |
| 17 #include "wtf/Forward.h" |
| 18 #include "wtf/text/WTFString.h" |
| 19 |
| 20 namespace gpu { |
| 21 namespace gles2 { |
| 22 class GLES2Interface; |
| 23 } |
| 24 } |
| 25 |
| 26 namespace blink { |
| 27 |
| 28 class NavigatorVR; |
| 29 class VRController; |
| 30 class VREyeParameters; |
| 31 class VRStageParameters; |
| 32 class VRPose; |
| 33 |
| 34 class WebGLRenderingContextBase; |
| 35 |
| 36 enum VREye { |
| 37 VREyeNone, |
| 38 VREyeLeft, |
| 39 VREyeRight |
| 40 }; |
| 41 |
| 42 class VRDisplay final : public GarbageCollectedFinalized<VRDisplay>, public Scri
ptWrappable, public WebThread::TaskObserver { |
| 43 DEFINE_WRAPPERTYPEINFO(); |
| 44 public: |
| 45 ~VRDisplay(); |
| 46 |
| 47 unsigned displayId() const { return m_displayId; } |
| 48 const String& displayName() const { return m_displayName; } |
| 49 |
| 50 VRDisplayCapabilities* capabilities() const { return m_capabilities; } |
| 51 VRStageParameters* stageParameters() const { return m_stageParameters; } |
| 52 |
| 53 bool isConnected() const { return m_isConnected; } |
| 54 bool isPresenting() const { return m_isPresenting; } |
| 55 |
| 56 VRPose* getPose(); |
| 57 VRPose* getImmediatePose(); |
| 58 void resetPose(); |
| 59 |
| 60 VREyeParameters* getEyeParameters(const String&); |
| 61 |
| 62 int requestAnimationFrame(FrameRequestCallback*); |
| 63 void cancelAnimationFrame(int id); |
| 64 |
| 65 ScriptPromise requestPresent(ScriptState*, const HeapVector<VRLayer>& layers
); |
| 66 ScriptPromise exitPresent(ScriptState*); |
| 67 |
| 68 HeapVector<VRLayer> getLayers(); |
| 69 |
| 70 void submitFrame(VRPose*); |
| 71 |
| 72 DECLARE_VIRTUAL_TRACE(); |
| 73 |
| 74 protected: |
| 75 friend class VRDisplayCollection; |
| 76 |
| 77 VRDisplay(NavigatorVR*); |
| 78 |
| 79 void updateFromWebVRDevice(const WebVRDevice&); |
| 80 |
| 81 VRController* controller(); |
| 82 |
| 83 private: |
| 84 // TaskObserver implementation. |
| 85 void didProcessTask() override; |
| 86 void willProcessTask() override { } |
| 87 |
| 88 Member<NavigatorVR> m_navigatorVR; |
| 89 unsigned m_displayId; |
| 90 String m_displayName; |
| 91 bool m_isConnected; |
| 92 bool m_isPresenting; |
| 93 bool m_canUpdateFramePose; |
| 94 unsigned m_compositorHandle; |
| 95 Member<VRDisplayCapabilities> m_capabilities; |
| 96 Member<VRStageParameters> m_stageParameters; |
| 97 Member<VREyeParameters> m_eyeParametersLeft; |
| 98 Member<VREyeParameters> m_eyeParametersRight; |
| 99 Member<VRPose> m_framePose; |
| 100 }; |
| 101 |
| 102 using VRDisplayVector = HeapVector<Member<VRDisplay>>; |
| 103 |
| 104 } // namespace blink |
| 105 |
| 106 #endif // VRDisplay_h |
OLD | NEW |