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_XRView_h_
8 #define mozilla_dom_XRView_h_
10 #include "mozilla/DOMEventTargetHelper.h"
11 #include "mozilla/dom/WebXRBinding.h"
18 enum class XREye
: uint8_t;
19 class XRRigidTransform
;
21 class XRView final
: public nsWrapperCache
{
23 NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(XRView
)
24 NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(XRView
)
26 explicit XRView(nsISupports
* aParent
, const XREye
& aEye
);
28 void Update(const gfx::PointDouble3D
& aPosition
,
29 const gfx::QuaternionDouble
& aOrientation
,
30 const gfx::Matrix4x4
& aProjectionMatrix
);
32 nsISupports
* GetParentObject() const { return mParent
; }
33 JSObject
* WrapObject(JSContext
* aCx
,
34 JS::Handle
<JSObject
*> aGivenProto
) override
;
38 void GetProjectionMatrix(JSContext
* aCx
, JS::MutableHandle
<JSObject
*> aRetval
,
40 already_AddRefed
<XRRigidTransform
> GetTransform(ErrorResult
& aRv
);
45 nsCOMPtr
<nsISupports
> mParent
;
47 gfx::PointDouble3D mPosition
;
48 gfx::QuaternionDouble mOrientation
;
49 gfx::Matrix4x4 mProjectionMatrix
;
50 JS::Heap
<JSObject
*> mJSProjectionMatrix
;
51 bool mProjectionNeedsUpdate
= true;
52 RefPtr
<XRRigidTransform
> mTransform
;
56 } // namespace mozilla
58 #endif // mozilla_dom_XRView_h_