Explorar el Código

correctly naming private and interfaces

Raanan Weber hace 5 años
padre
commit
a453089dcd

+ 35 - 35
src/Cameras/XR/features/WebXRAnchorSystem.ts

@@ -1,4 +1,4 @@
-import { WebXRFeature, WebXRFeaturesManager } from '../webXRFeaturesManager';
+import { IWebXRFeature, WebXRFeaturesManager } from '../webXRFeaturesManager';
 import { WebXRSessionManager } from '../webXRSessionManager';
 import { Observable, Observer } from '../../../Misc/observable';
 import { Matrix } from '../../../Maths/math.vector';
@@ -12,7 +12,7 @@ const Name = "xr-anchor-system";
 /**
  * Configuration options of the anchor system
  */
-export interface WebXRAnchorSystemOptions {
+export interface IWebXRAnchorSystemOptions {
     /**
      * a node that will be used to convert local to world coordinates
      */
@@ -31,7 +31,7 @@ export interface WebXRAnchorSystemOptions {
 /**
  * A babylon container for an XR Anchor
  */
-export interface WebXRAnchor {
+export interface IWebXRAnchor {
     /**
      * A babylon-assigned ID for this anchor
      */
@@ -54,7 +54,7 @@ let anchorIdProvider = 0;
  * will use the frame to create an anchor and not the session or a detected plane
  * For further information see https://github.com/immersive-web/anchors/
  */
-export class WebXRAnchorSystem implements WebXRFeature {
+export class WebXRAnchorSystem implements IWebXRFeature {
 
     /**
      * The module's name
@@ -70,32 +70,32 @@ export class WebXRAnchorSystem implements WebXRFeature {
     /**
      * Observers registered here will be executed when a new anchor was added to the session
      */
-    public onAnchorAddedObservable: Observable<WebXRAnchor> = new Observable();
+    public onAnchorAddedObservable: Observable<IWebXRAnchor> = new Observable();
     /**
      * Observers registered here will be executed when an existing anchor updates
      * This can execute N times every frame
      */
-    public onAnchorUpdatedObservable: Observable<WebXRAnchor> = new Observable();
+    public onAnchorUpdatedObservable: Observable<IWebXRAnchor> = new Observable();
     /**
      * Observers registered here will be executed when an anchor was removed from the session
      */
-    public onAnchorRemovedObservable: Observable<WebXRAnchor> = new Observable();
+    public onAnchorRemovedObservable: Observable<IWebXRAnchor> = new Observable();
 
     private _planeDetector: WebXRPlaneDetector;
     private _hitTestModule: WebXRHitTestLegacy;
 
     private _enabled: boolean = false;
     private _attached: boolean = false;
-    private _trackedAnchors: Array<WebXRAnchor> = [];
+    private _trackedAnchors: Array<IWebXRAnchor> = [];
     private _lastFrameDetected: XRAnchorSet = new Set();
     private _observerTracked: Nullable<Observer<XRFrame>>;
 
     /**
      * constructs a new anchor system
-     * @param xrSessionManager an instance of WebXRSessionManager
-     * @param options configuration object for this feature
+     * @param _xrSessionManager an instance of WebXRSessionManager
+     * @param _options configuration object for this feature
      */
-    constructor(private xrSessionManager: WebXRSessionManager, private options: WebXRAnchorSystemOptions = {}) {
+    constructor(private _xrSessionManager: WebXRSessionManager, private _options: IWebXRAnchorSystemOptions = {}) {
     }
 
     /**
@@ -105,7 +105,7 @@ export class WebXRAnchorSystem implements WebXRFeature {
      */
     public setPlaneDetector(planeDetector: WebXRPlaneDetector, enable: boolean = true) {
         this._planeDetector = planeDetector;
-        this.options.usePlaneDetection = enable;
+        this._options.usePlaneDetection = enable;
     }
 
     /**
@@ -123,8 +123,8 @@ export class WebXRAnchorSystem implements WebXRFeature {
      * @returns true if successful.
      */
     attach(): boolean {
-        this._observerTracked = this.xrSessionManager.onXRFrameObservable.add(() => {
-            const frame = this.xrSessionManager.currentFrame;
+        this._observerTracked = this._xrSessionManager.onXRFrameObservable.add(() => {
+            const frame = this._xrSessionManager.currentFrame;
             if (!this._attached || !this._enabled || !frame) { return; }
             // const timestamp = this.xrSessionManager.currentTimestamp;
 
@@ -138,19 +138,19 @@ export class WebXRAnchorSystem implements WebXRFeature {
                 // now check for new ones
                 trackedAnchors.forEach((xrAnchor) => {
                     if (!this._lastFrameDetected.has(xrAnchor)) {
-                        const newAnchor: Partial<WebXRAnchor> = {
+                        const newAnchor: Partial<IWebXRAnchor> = {
                             id: anchorIdProvider++,
                             xrAnchor: xrAnchor
                         };
-                        const plane = this.updateAnchorWithXRFrame(xrAnchor, newAnchor, frame);
+                        const plane = this._updateAnchorWithXRFrame(xrAnchor, newAnchor, frame);
                         this._trackedAnchors.push(plane);
                         this.onAnchorAddedObservable.notifyObservers(plane);
                     } else {
                         // updated?
-                        if (xrAnchor.lastChangedTime === this.xrSessionManager.currentTimestamp) {
-                            let index = this.findIndexInAnchorArray(xrAnchor);
+                        if (xrAnchor.lastChangedTime === this._xrSessionManager.currentTimestamp) {
+                            let index = this._findIndexInAnchorArray(xrAnchor);
                             const anchor = this._trackedAnchors[index];
-                            this.updateAnchorWithXRFrame(xrAnchor, anchor, frame);
+                            this._updateAnchorWithXRFrame(xrAnchor, anchor, frame);
                             this.onAnchorUpdatedObservable.notifyObservers(anchor);
                         }
                     }
@@ -159,8 +159,8 @@ export class WebXRAnchorSystem implements WebXRFeature {
             }
         });
 
-        if (this.options.addAnchorOnSelect) {
-            this.xrSessionManager.session.addEventListener('select', this.onSelect, false);
+        if (this._options.addAnchorOnSelect) {
+            this._xrSessionManager.session.addEventListener('select', this._onSelect, false);
         }
 
         this._attached = true;
@@ -176,10 +176,10 @@ export class WebXRAnchorSystem implements WebXRFeature {
     detach(): boolean {
         this._attached = false;
 
-        this.xrSessionManager.session.removeEventListener('select', this.onSelect);
+        this._xrSessionManager.session.removeEventListener('select', this._onSelect);
 
         if (this._observerTracked) {
-            this.xrSessionManager.onXRFrameObservable.remove(this._observerTracked);
+            this._xrSessionManager.onXRFrameObservable.remove(this._observerTracked);
         }
 
         return true;
@@ -195,8 +195,8 @@ export class WebXRAnchorSystem implements WebXRFeature {
         this.onAnchorUpdatedObservable.clear();
     }
 
-    private onSelect = (event: XRInputSourceEvent) => {
-        if (!this.options.addAnchorOnSelect) {
+    private _onSelect = (event: XRInputSourceEvent) => {
+        if (!this._options.addAnchorOnSelect) {
             return;
         }
         const onResults = (results: XRHitResult[]) => {
@@ -212,7 +212,7 @@ export class WebXRAnchorSystem implements WebXRFeature {
         if (this._hitTestModule && !this._hitTestModule.options.testOnPointerDownOnly) {
             onResults(this._hitTestModule.lastNativeXRHitResults);
         }
-        WebXRHitTestLegacy.XRHitTestWithSelectEvent(event, this.xrSessionManager.referenceSpace).then(onResults);
+        WebXRHitTestLegacy.XRHitTestWithSelectEvent(event, this._xrSessionManager.referenceSpace).then(onResults);
 
         // API will soon change, will need to use the plane
         this._planeDetector;
@@ -226,35 +226,35 @@ export class WebXRAnchorSystem implements WebXRFeature {
      * @returns a promise the fulfills when the anchor was created
      */
     public addAnchorAtRigidTransformation(xrRigidTransformation: XRRigidTransform, anchorCreator?: XRAnchorCreator): Promise<XRAnchor> {
-        const creator = anchorCreator || this.xrSessionManager.session;
-        return creator.createAnchor(xrRigidTransformation, this.xrSessionManager.referenceSpace);
+        const creator = anchorCreator || this._xrSessionManager.session;
+        return creator.createAnchor(xrRigidTransformation, this._xrSessionManager.referenceSpace);
     }
 
-    private updateAnchorWithXRFrame(xrAnchor: XRAnchor, anchor: Partial<WebXRAnchor>, xrFrame: XRFrame): WebXRAnchor {
+    private _updateAnchorWithXRFrame(xrAnchor: XRAnchor, anchor: Partial<IWebXRAnchor>, xrFrame: XRFrame): IWebXRAnchor {
         // matrix
-        const pose = xrFrame.getPose(xrAnchor.anchorSpace, this.xrSessionManager.referenceSpace);
+        const pose = xrFrame.getPose(xrAnchor.anchorSpace, this._xrSessionManager.referenceSpace);
         if (pose) {
             const mat = anchor.transformationMatrix || new Matrix();
             Matrix.FromArrayToRef(pose.transform.matrix, 0, mat);
-            if (!this.xrSessionManager.scene.useRightHandedSystem) {
+            if (!this._xrSessionManager.scene.useRightHandedSystem) {
                 mat.toggleModelMatrixHandInPlace();
             }
             anchor.transformationMatrix = mat;
-            if (!this.options.worldParentNode) {
+            if (!this._options.worldParentNode) {
                 // Logger.Warn("Please provide a world parent node to apply world transformation");
             } else {
-                mat.multiplyToRef(this.options.worldParentNode.getWorldMatrix(), mat);
+                mat.multiplyToRef(this._options.worldParentNode.getWorldMatrix(), mat);
             }
         }
 
-        return <WebXRAnchor>anchor;
+        return <IWebXRAnchor>anchor;
     }
 
     /**
      * avoiding using Array.find for global support.
      * @param xrAnchor the plane to find in the array
      */
-    private findIndexInAnchorArray(xrAnchor: XRAnchor) {
+    private _findIndexInAnchorArray(xrAnchor: XRAnchor) {
         for (let i = 0; i < this._trackedAnchors.length; ++i) {
             if (this._trackedAnchors[i].xrAnchor === xrAnchor) {
                 return i;

+ 10 - 10
src/Cameras/XR/features/WebXRBackgroundRemover.ts

@@ -1,4 +1,4 @@
-import { WebXRFeaturesManager, WebXRFeature } from "../webXRFeaturesManager";
+import { WebXRFeaturesManager, IWebXRFeature } from "../webXRFeaturesManager";
 import { WebXRSessionManager } from '../webXRSessionManager';
 import { AbstractMesh } from '../../../Meshes/abstractMesh';
 import { Observable } from '../../../Misc/observable';
@@ -8,7 +8,7 @@ const Name = "xr-background-remover";
 /**
  * Options interface for the background remover plugin
  */
-export interface WebXRBackgroundRemoverOptions {
+export interface IWebXRBackgroundRemoverOptions {
     /**
      * don't disable the environment helper
      */
@@ -36,7 +36,7 @@ export interface WebXRBackgroundRemoverOptions {
 /**
  * A module that will automatically disable background meshes when entering AR and will enable them when leaving AR.
  */
-export class WebXRBackgroundRemover implements WebXRFeature {
+export class WebXRBackgroundRemover implements IWebXRFeature {
 
     /**
      * The module's name
@@ -56,14 +56,14 @@ export class WebXRBackgroundRemover implements WebXRFeature {
 
     /**
      * constructs a new background remover module
-     * @param xrSessionManager the session manager for this module
+     * @param _xrSessionManager the session manager for this module
      * @param options read-only options to be used in this module
      */
-    constructor(private xrSessionManager: WebXRSessionManager,
+    constructor(private _xrSessionManager: WebXRSessionManager,
         /**
          * read-only options to be used in this module
          */
-        public readonly options: WebXRBackgroundRemoverOptions = {}) {
+        public readonly options: IWebXRBackgroundRemoverOptions = {}) {
 
     }
 
@@ -74,7 +74,7 @@ export class WebXRBackgroundRemover implements WebXRFeature {
      * @returns true if successful.
      */
     attach(): boolean {
-        this.setBackgroundState(false);
+        this._setBackgroundState(false);
 
         return true;
     }
@@ -86,13 +86,13 @@ export class WebXRBackgroundRemover implements WebXRFeature {
      * @returns true if successful.
      */
     detach(): boolean {
-        this.setBackgroundState(true);
+        this._setBackgroundState(true);
 
         return true;
     }
 
-    private setBackgroundState(newState: boolean) {
-        const scene = this.xrSessionManager.scene;
+    private _setBackgroundState(newState: boolean) {
+        const scene = this._xrSessionManager.scene;
         if (!this.options.ignoreEnvironmentHelper) {
             if (this.options.environmentHelperRemovalFlags) {
                 if (this.options.environmentHelperRemovalFlags.skyBox) {

+ 18 - 18
src/Cameras/XR/features/WebXRHitTestLegacy.ts

@@ -1,4 +1,4 @@
-import { WebXRFeature, WebXRFeaturesManager } from '../webXRFeaturesManager';
+import { IWebXRFeature, WebXRFeaturesManager } from '../webXRFeaturesManager';
 import { WebXRSessionManager } from '../webXRSessionManager';
 import { Observable, Observer } from '../../../Misc/observable';
 import { Vector3, Matrix } from '../../../Maths/math.vector';
@@ -15,7 +15,7 @@ const WebXRHitTestModuleName = "xr-hit-test";
 /**
  * Options used for hit testing
  */
-export interface WebXRHitTestOptions {
+export interface IWebXRHitTestOptions {
     /**
      * Only test when user interacted with the scene. Default - hit test every frame
      */
@@ -29,7 +29,7 @@ export interface WebXRHitTestOptions {
 /**
  * Interface defining the babylon result of raycasting/hit-test
  */
-export interface WebXRHitResult {
+export interface IWebXRHitResult {
     /**
      * The native hit test result
      */
@@ -45,7 +45,7 @@ export interface WebXRHitResult {
  * Hit test (or raycasting) is used to interact with the real world.
  * For further information read here - https://github.com/immersive-web/hit-test
  */
-export class WebXRHitTestLegacy implements WebXRFeature {
+export class WebXRHitTestLegacy implements IWebXRFeature {
 
     /**
      * The module's name
@@ -93,18 +93,18 @@ export class WebXRHitTestLegacy implements WebXRFeature {
     /**
      * Triggered when new babylon (transformed) hit test results are available
      */
-    public onHitTestResultObservable: Observable<WebXRHitResult[]> = new Observable();
+    public onHitTestResultObservable: Observable<IWebXRHitResult[]> = new Observable();
 
     /**
      * Creates a new instance of the (legacy version) hit test feature
-     * @param xrSessionManager an instance of WebXRSessionManager
+     * @param _xrSessionManager an instance of WebXRSessionManager
      * @param options options to use when constructing this feature
      */
-    constructor(private xrSessionManager: WebXRSessionManager,
+    constructor(private _xrSessionManager: WebXRSessionManager,
         /**
          * options to use when constructing this feature
          */
-        public readonly options: WebXRHitTestOptions = {}) { }
+        public readonly options: IWebXRHitTestOptions = {}) { }
 
     private _onSelectEnabled = false;
     private _xrFrameObserver: Nullable<Observer<XRFrame>>;
@@ -123,19 +123,19 @@ export class WebXRHitTestLegacy implements WebXRFeature {
      */
     attach(): boolean {
         if (this.options.testOnPointerDownOnly) {
-            this.xrSessionManager.session.addEventListener('select', this.onSelect, false);
+            this._xrSessionManager.session.addEventListener('select', this._onSelect, false);
         } else {
             // we are in XR space!
             const origin = new Vector3(0, 0, 0);
             // in XR space z-forward is negative
             const direction = new Vector3(0, 0, -1);
             const mat = new Matrix();
-            this._xrFrameObserver = this.xrSessionManager.onXRFrameObservable.add((frame) => {
+            this._xrFrameObserver = this._xrSessionManager.onXRFrameObservable.add((frame) => {
                 // make sure we do nothing if (async) not attached
                 if (!this._attached) {
                     return;
                 }
-                let pose = frame.getViewerPose(this.xrSessionManager.referenceSpace);
+                let pose = frame.getViewerPose(this._xrSessionManager.referenceSpace);
                 if (!pose) {
                     return;
                 }
@@ -146,7 +146,7 @@ export class WebXRHitTestLegacy implements WebXRFeature {
                 direction.normalize();
                 let ray = new XRRay((<DOMPointReadOnly>{ x: origin.x, y: origin.y, z: origin.z, w: 0 }),
                     (<DOMPointReadOnly>{ x: direction.x, y: direction.y, z: direction.z, w: 0 }));
-                WebXRHitTestLegacy.XRHitTestWithRay(this.xrSessionManager.session, ray, this.xrSessionManager.referenceSpace).then(this.onHitTestResults);
+                WebXRHitTestLegacy.XRHitTestWithRay(this._xrSessionManager.session, ray, this._xrSessionManager.referenceSpace).then(this._onHitTestResults);
             });
         }
         this._attached = true;
@@ -163,19 +163,19 @@ export class WebXRHitTestLegacy implements WebXRFeature {
     detach(): boolean {
         // disable select
         this._onSelectEnabled = false;
-        this.xrSessionManager.session.removeEventListener('select', this.onSelect);
+        this._xrSessionManager.session.removeEventListener('select', this._onSelect);
         if (this._xrFrameObserver) {
-            this.xrSessionManager.onXRFrameObservable.remove(this._xrFrameObserver);
+            this._xrSessionManager.onXRFrameObservable.remove(this._xrFrameObserver);
             this._xrFrameObserver = null;
         }
         this._attached = false;
         return true;
     }
 
-    private onHitTestResults = (xrResults: XRHitResult[]) => {
+    private _onHitTestResults = (xrResults: XRHitResult[]) => {
         const mats = xrResults.map((result) => {
             let mat = Matrix.FromArray(result.hitMatrix);
-            if (!this.xrSessionManager.scene.useRightHandedSystem) {
+            if (!this._xrSessionManager.scene.useRightHandedSystem) {
                 mat.toggleModelMatrixHandInPlace();
             }
             // if (this.options.coordinatesSpace === Space.WORLD) {
@@ -193,11 +193,11 @@ export class WebXRHitTestLegacy implements WebXRFeature {
     }
 
     // can be done using pointerdown event, and xrSessionManager.currentFrame
-    private onSelect = (event: XRInputSourceEvent) => {
+    private _onSelect = (event: XRInputSourceEvent) => {
         if (!this._onSelectEnabled) {
             return;
         }
-        WebXRHitTestLegacy.XRHitTestWithSelectEvent(event, this.xrSessionManager.referenceSpace);
+        WebXRHitTestLegacy.XRHitTestWithSelectEvent(event, this._xrSessionManager.referenceSpace);
     }
 
     /**

+ 29 - 29
src/Cameras/XR/features/WebXRPlaneDetector.ts

@@ -1,4 +1,4 @@
-import { WebXRFeaturesManager, WebXRFeature } from '../webXRFeaturesManager';
+import { WebXRFeaturesManager, IWebXRFeature } from '../webXRFeaturesManager';
 import { TransformNode } from '../../../Meshes/transformNode';
 import { WebXRSessionManager } from '../webXRSessionManager';
 import { Observable, Observer } from '../../../Misc/observable';
@@ -10,7 +10,7 @@ const Name = "xr-plane-detector";
 /**
  * Options used in the plane detector module
  */
-export interface WebXRPlaneDetectorOptions {
+export interface IWebXRPlaneDetectorOptions {
     /**
      * The node to use to transform the local results to world coordinates
      */
@@ -21,7 +21,7 @@ export interface WebXRPlaneDetectorOptions {
  * A babylon interface for a webxr plane.
  * A Plane is actually a polygon, built from N points in space
  */
-export interface WebXRPlane {
+export interface IWebXRPlane {
     /**
      * a babylon-assigned ID for this polygon
      */
@@ -47,7 +47,7 @@ let planeIdProvider = 0;
  * The plane detector is used to detect planes in the real world when in AR
  * For more information see https://github.com/immersive-web/real-world-geometry/
  */
-export class WebXRPlaneDetector implements WebXRFeature {
+export class WebXRPlaneDetector implements IWebXRFeature {
 
     /**
      * The module's name
@@ -63,35 +63,35 @@ export class WebXRPlaneDetector implements WebXRFeature {
     /**
      * Observers registered here will be executed when a new plane was added to the session
      */
-    public onPlaneAddedObservable: Observable<WebXRPlane> = new Observable();
+    public onPlaneAddedObservable: Observable<IWebXRPlane> = new Observable();
     /**
      * Observers registered here will be executed when a plane is no longer detected in the session
      */
-    public onPlaneRemovedObservable: Observable<WebXRPlane> = new Observable();
+    public onPlaneRemovedObservable: Observable<IWebXRPlane> = new Observable();
     /**
      * Observers registered here will be executed when an existing plane updates (for example - expanded)
      * This can execute N times every frame
      */
-    public onPlaneUpdatedObservable: Observable<WebXRPlane> = new Observable();
+    public onPlaneUpdatedObservable: Observable<IWebXRPlane> = new Observable();
 
     private _enabled: boolean = false;
     private _attached: boolean = false;
-    private _detectedPlanes: Array<WebXRPlane> = [];
+    private _detectedPlanes: Array<IWebXRPlane> = [];
     private _lastFrameDetected: XRPlaneSet = new Set();
     private _observerTracked: Nullable<Observer<XRFrame>>;
 
     /**
      * construct a new Plane Detector
-     * @param xrSessionManager an instance of xr Session manager
-     * @param options configuration to use when constructing this feature
+     * @param _xrSessionManager an instance of xr Session manager
+     * @param _options configuration to use when constructing this feature
      */
-    constructor(private xrSessionManager: WebXRSessionManager, private options: WebXRPlaneDetectorOptions = {}) {
-        if (this.xrSessionManager.session) {
-            this.xrSessionManager.session.updateWorldTrackingState({ planeDetectionState: { enabled: true } });
+    constructor(private _xrSessionManager: WebXRSessionManager, private _options: IWebXRPlaneDetectorOptions = {}) {
+        if (this._xrSessionManager.session) {
+            this._xrSessionManager.session.updateWorldTrackingState({ planeDetectionState: { enabled: true } });
             this._enabled = true;
         } else {
-            this.xrSessionManager.onXRSessionInit.addOnce(() => {
-                this.xrSessionManager.session.updateWorldTrackingState({ planeDetectionState: { enabled: true } });
+            this._xrSessionManager.onXRSessionInit.addOnce(() => {
+                this._xrSessionManager.session.updateWorldTrackingState({ planeDetectionState: { enabled: true } });
                 this._enabled = true;
             });
         }
@@ -105,8 +105,8 @@ export class WebXRPlaneDetector implements WebXRFeature {
      */
     attach(): boolean {
 
-        this._observerTracked = this.xrSessionManager.onXRFrameObservable.add(() => {
-            const frame = this.xrSessionManager.currentFrame;
+        this._observerTracked = this._xrSessionManager.onXRFrameObservable.add(() => {
+            const frame = this._xrSessionManager.currentFrame;
             if (!this._attached || !this._enabled || !frame) { return; }
             // const timestamp = this.xrSessionManager.currentTimestamp;
 
@@ -120,20 +120,20 @@ export class WebXRPlaneDetector implements WebXRFeature {
                 // now check for new ones
                 detectedPlanes.forEach((xrPlane) => {
                     if (!this._lastFrameDetected.has(xrPlane)) {
-                        const newPlane: Partial<WebXRPlane> = {
+                        const newPlane: Partial<IWebXRPlane> = {
                             id: planeIdProvider++,
                             xrPlane: xrPlane,
                             polygonDefinition: []
                         };
-                        const plane = this.updatePlaneWithXRPlane(xrPlane, newPlane, frame);
+                        const plane = this._updatePlaneWithXRPlane(xrPlane, newPlane, frame);
                         this._detectedPlanes.push(plane);
                         this.onPlaneAddedObservable.notifyObservers(plane);
                     } else {
                         // updated?
-                        if (xrPlane.lastChangedTime === this.xrSessionManager.currentTimestamp) {
+                        if (xrPlane.lastChangedTime === this._xrSessionManager.currentTimestamp) {
                             let index = this.findIndexInPlaneArray(xrPlane);
                             const plane = this._detectedPlanes[index];
-                            this.updatePlaneWithXRPlane(xrPlane, plane, frame);
+                            this._updatePlaneWithXRPlane(xrPlane, plane, frame);
                             this.onPlaneUpdatedObservable.notifyObservers(plane);
                         }
                     }
@@ -156,7 +156,7 @@ export class WebXRPlaneDetector implements WebXRFeature {
         this._attached = false;
 
         if (this._observerTracked) {
-            this.xrSessionManager.onXRFrameObservable.remove(this._observerTracked);
+            this._xrSessionManager.onXRFrameObservable.remove(this._observerTracked);
         }
 
         return true;
@@ -172,25 +172,25 @@ export class WebXRPlaneDetector implements WebXRFeature {
         this.onPlaneUpdatedObservable.clear();
     }
 
-    private updatePlaneWithXRPlane(xrPlane: XRPlane, plane: Partial<WebXRPlane>, xrFrame: XRFrame): WebXRPlane {
+    private _updatePlaneWithXRPlane(xrPlane: XRPlane, plane: Partial<IWebXRPlane>, xrFrame: XRFrame): IWebXRPlane {
         plane.polygonDefinition = xrPlane.polygon.map((xrPoint) => {
-            const rightHandedSystem = this.xrSessionManager.scene.useRightHandedSystem ? 1 : -1;
+            const rightHandedSystem = this._xrSessionManager.scene.useRightHandedSystem ? 1 : -1;
             return new Vector3(xrPoint.x, xrPoint.y, xrPoint.z * rightHandedSystem);
         });
         // matrix
-        const pose = xrFrame.getPose(xrPlane.planeSpace, this.xrSessionManager.referenceSpace);
+        const pose = xrFrame.getPose(xrPlane.planeSpace, this._xrSessionManager.referenceSpace);
         if (pose) {
             const mat = plane.transformationMatrix || new Matrix();
             Matrix.FromArrayToRef(pose.transform.matrix, 0, mat);
-            if (!this.xrSessionManager.scene.useRightHandedSystem) {
+            if (!this._xrSessionManager.scene.useRightHandedSystem) {
                 mat.toggleModelMatrixHandInPlace();
             }
             plane.transformationMatrix = mat;
-            if (this.options.worldParentNode) {
-                mat.multiplyToRef(this.options.worldParentNode.getWorldMatrix(), mat);
+            if (this._options.worldParentNode) {
+                mat.multiplyToRef(this._options.worldParentNode.getWorldMatrix(), mat);
             }
         }
-        return <WebXRPlane>plane;
+        return <IWebXRPlane>plane;
     }
 
     /**

+ 12 - 12
src/Cameras/XR/webXRFeaturesManager.ts

@@ -4,7 +4,7 @@ import { IDisposable } from '../../scene';
 /**
  * Defining the interface required for a (webxr) feature
  */
-export interface WebXRFeature extends IDisposable {
+export interface IWebXRFeature extends IDisposable {
     /**
      * Attach the feature to the session
      * Will usually be called by the features manager
@@ -24,7 +24,7 @@ export interface WebXRFeature extends IDisposable {
 /**
  * Defining the constructor of a feature. Used to register the modules.
  */
-export type WebXRFeatureConstructor = (xrSessionManager: WebXRSessionManager, options?: any) => (() => WebXRFeature);
+export type WebXRFeatureConstructor = (xrSessionManager: WebXRSessionManager, options?: any) => (() => IWebXRFeature);
 
 /**
  * The WebXR features manager is responsible of enabling or disabling features required for the current XR session.
@@ -71,7 +71,7 @@ export class WebXRFeaturesManager implements IDisposable {
      * @param options optional options provided to the module.
      * @returns a function that, when called, will return a new instance of this feature
      */
-    public static ConstructFeature(featureName: string, version: number = 1, xrSessionManager: WebXRSessionManager, options?: any): (() => WebXRFeature) {
+    public static ConstructFeature(featureName: string, version: number = 1, xrSessionManager: WebXRSessionManager, options?: any): (() => IWebXRFeature) {
         const constructorFunction = this._AvailableFeatures[featureName][version];
         if (!constructorFunction) {
             // throw an error? return nothing?
@@ -119,7 +119,7 @@ export class WebXRFeaturesManager implements IDisposable {
 
     private _features: {
         [name: string]: {
-            featureImplementation: WebXRFeature,
+            featureImplementation: IWebXRFeature,
             version: number,
             enabled: boolean,
             attached: boolean
@@ -129,11 +129,11 @@ export class WebXRFeaturesManager implements IDisposable {
     /**
      * constructs a new features manages.
      *
-     * @param xrSessionManager an instance of WebXRSessionManager
+     * @param _xrSessionManager an instance of WebXRSessionManager
      */
-    constructor(private xrSessionManager: WebXRSessionManager) {
+    constructor(private _xrSessionManager: WebXRSessionManager) {
         // when session starts / initialized - attach
-        this.xrSessionManager.onXRSessionInit.add(() => {
+        this._xrSessionManager.onXRSessionInit.add(() => {
             this.getEnabledFeatures().forEach((featureName) => {
                 const feature = this._features[featureName];
                 if (feature.enabled && !feature.attached) {
@@ -143,7 +143,7 @@ export class WebXRFeaturesManager implements IDisposable {
         });
 
         // when session ends - detach
-        this.xrSessionManager.onXRSessionEnded.add(() => {
+        this._xrSessionManager.onXRSessionEnded.add(() => {
             this.getEnabledFeatures().forEach((featureName) => {
                 const feature = this._features[featureName];
                 if (feature.enabled && feature.attached) {
@@ -163,7 +163,7 @@ export class WebXRFeaturesManager implements IDisposable {
      * @param attachIfPossible if set to true (default) the feature will be automatically attached, if it is currently possible
      * @returns a new constructed feature or throws an error if feature not found.
      */
-    public enableFeature(featureName: string | { Name: string }, version: number | string = 'latest', moduleOptions: any = {}, attachIfPossible: boolean = true): WebXRFeature {
+    public enableFeature(featureName: string | { Name: string }, version: number | string = 'latest', moduleOptions: any = {}, attachIfPossible: boolean = true): IWebXRFeature {
         const name = typeof featureName === 'string' ? featureName : featureName.Name;
         let versionToLoad = 0;
         if (typeof version === 'string') {
@@ -181,7 +181,7 @@ export class WebXRFeaturesManager implements IDisposable {
         // check if already initialized
         const feature = this._features[name];
         if (!feature || !feature.featureImplementation || feature.version !== versionToLoad) {
-            const constructFunction = WebXRFeaturesManager.ConstructFeature(name, versionToLoad, this.xrSessionManager, moduleOptions);
+            const constructFunction = WebXRFeaturesManager.ConstructFeature(name, versionToLoad, this._xrSessionManager, moduleOptions);
             if (!constructFunction) {
                 // report error?
                 throw new Error(`feature not found - ${name}`);
@@ -203,7 +203,7 @@ export class WebXRFeaturesManager implements IDisposable {
         }
 
         // if session started already, request and enable
-        if (this.xrSessionManager.session && !feature.attached && attachIfPossible) {
+        if (this._xrSessionManager.session && !feature.attached && attachIfPossible) {
             // enable feature
             this.attachFeature(name);
         }
@@ -265,7 +265,7 @@ export class WebXRFeaturesManager implements IDisposable {
      * @param featureName the name of the feature to load
      * @returns the feature class, if found
      */
-    public getEnabledFeature(featureName: string): WebXRFeature {
+    public getEnabledFeature(featureName: string): IWebXRFeature {
         return this._features[featureName] && this._features[featureName].featureImplementation;
     }