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_XRFrame_h_
8 #define mozilla_dom_XRFrame_h_
10 #include "mozilla/DOMEventTargetHelper.h"
11 #include "mozilla/dom/WebXRBinding.h"
15 namespace mozilla::dom
{
17 class XRFrameOfReference
;
21 class XRReferenceSpace
;
26 class XRFrame final
: public nsWrapperCache
{
28 NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(XRFrame
)
29 NS_DECL_CYCLE_COLLECTION_NATIVE_WRAPPERCACHE_CLASS(XRFrame
)
31 explicit XRFrame(nsISupports
* aParent
, XRSession
* aXRSession
);
33 void StartAnimationFrame();
34 void EndAnimationFrame();
35 void StartInputSourceEvent();
36 void EndInputSourceEvent();
39 nsISupports
* GetParentObject() const { return mParent
; }
40 JSObject
* WrapObject(JSContext
* aCx
,
41 JS::Handle
<JSObject
*> aGivenProto
) override
;
45 already_AddRefed
<XRViewerPose
> GetViewerPose(
46 const XRReferenceSpace
& aReferenceSpace
, ErrorResult
& aRv
);
47 already_AddRefed
<XRPose
> GetPose(const XRSpace
& aSpace
,
48 const XRSpace
& aBaseSpace
, ErrorResult
& aRv
);
49 gfx::Matrix4x4
ConstructInlineProjection(float aFov
, float aAspect
,
50 float aNear
, float aFar
);
53 virtual ~XRFrame() = default;
55 nsCOMPtr
<nsISupports
> mParent
;
56 RefPtr
<XRSession
> mSession
;
61 } // namespace mozilla::dom
63 #endif // mozilla_dom_XRFrame_h_