1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
5 * You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #ifndef mozilla_dom_XRRenderState_h_
8 #define mozilla_dom_XRRenderState_h_
10 #include "mozilla/DOMEventTargetHelper.h"
11 #include "mozilla/dom/WebXRBinding.h"
15 namespace mozilla::dom
{
18 class XRRenderState final
: public nsWrapperCache
{
20 NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(XRRenderState
)
21 NS_DECL_CYCLE_COLLECTION_NATIVE_WRAPPERCACHE_CLASS(XRRenderState
)
23 explicit XRRenderState(nsISupports
* aParent
, XRSession
* aSession
);
24 explicit XRRenderState(const XRRenderState
& aOther
);
26 void SetDepthNear(double aDepthNear
);
27 void SetDepthFar(double aDepthFar
);
28 void SetInlineVerticalFieldOfView(double aInlineVerticalFieldOfView
);
29 void SetBaseLayer(XRWebGLLayer
* aBaseLayer
);
32 nsISupports
* GetParentObject() const { return mParent
; }
33 JSObject
* WrapObject(JSContext
* aCx
,
34 JS::Handle
<JSObject
*> aGivenProto
) override
;
39 Nullable
<double> GetInlineVerticalFieldOfView();
40 XRWebGLLayer
* GetBaseLayer();
43 void SetOutputCanvas(HTMLCanvasElement
* aCanvas
);
44 HTMLCanvasElement
* GetOutputCanvas() const;
45 void SetCompositionDisabled(bool aCompositionDisabled
);
46 bool IsCompositionDisabled() const;
50 virtual ~XRRenderState() = default;
51 nsCOMPtr
<nsISupports
> mParent
;
52 RefPtr
<XRSession
> mSession
;
53 RefPtr
<XRWebGLLayer
> mBaseLayer
;
56 Nullable
<double> mInlineVerticalFieldOfView
;
57 // https://immersive-web.github.io/webxr/#xrrenderstate-output-canvas
58 RefPtr
<HTMLCanvasElement
> mOutputCanvas
;
59 // https://immersive-web.github.io/webxr/#xrrenderstate-composition-disabled
60 bool mCompositionDisabled
;
63 } // namespace mozilla::dom
65 #endif // mozilla_dom_XRRenderState_h_