sebastien 7 gadi atpakaļ
vecāks
revīzija
2c0ac27aa0

+ 66 - 0
src/Cameras/VR/babylon.vrCameraMetrics.ts

@@ -1,27 +1,81 @@
 module BABYLON {
+    /**
+     * This represents all the required metrics to create a VR camera.
+     * @see http://doc.babylonjs.com/babylon101/cameras#device-orientation-camera
+     */
     export class VRCameraMetrics {
+        /**
+         * Define the horizontal resolution off the screen.
+         */
         public hResolution: number;
+        /**
+         * Define the vertical resolution off the screen.
+         */
         public vResolution: number;
+        /**
+         * Define the horizontal screen size.
+         */
         public hScreenSize: number;
+        /**
+         * Define the vertical screen size.
+         */
         public vScreenSize: number;
+        /**
+         * Define the vertical screen center position.
+         */
         public vScreenCenter: number;
+        /**
+         * Define the distance of the eyes to the screen.
+         */
         public eyeToScreenDistance: number;
+        /**
+         * Define the distance between both lenses
+         */
         public lensSeparationDistance: number;
+        /**
+         * Define the distance between both viewer's eyes.
+         */
         public interpupillaryDistance: number;
+        /**
+         * Define the distortion factor of the VR postprocess.
+         * Please, touch with care.
+         */
         public distortionK: number[];
+        /**
+         * Define the chromatic aberration correction factors for the VR post process.
+         */
         public chromaAbCorrection: number[];
+        /**
+         * Define the scale factor of the post process.
+         * The smaller the better but the slower.
+         */
         public postProcessScaleFactor: number;
+        /**
+         * Define an offset for the lens center.
+         */
         public lensCenterOffset: number;
+        /**
+         * Define if the current vr camera should compensate the distortion of the lense or not.
+         */
         public compensateDistortion = true;
 
+        /**
+         * Gets the rendering aspect ratio based on the provided resolutions.
+         */
         public get aspectRatio(): number {
             return this.hResolution / (2 * this.vResolution);
         }
 
+        /**
+         * Gets the aspect ratio based on the FOV, scale factors, and real screen sizes.
+         */
         public get aspectRatioFov(): number {
             return (2 * Math.atan((this.postProcessScaleFactor * this.vScreenSize) / (2 * this.eyeToScreenDistance)));
         }
 
+        /**
+         * @hidden
+         */
         public get leftHMatrix(): Matrix {
             var meters = (this.hScreenSize / 4) - (this.lensSeparationDistance / 2);
             var h = (4 * meters) / this.hScreenSize;
@@ -29,6 +83,9 @@
             return Matrix.Translation(h, 0, 0);
         }
 
+        /**
+         * @hidden
+         */
         public get rightHMatrix(): Matrix {
             var meters = (this.hScreenSize / 4) - (this.lensSeparationDistance / 2);
             var h = (4 * meters) / this.hScreenSize;
@@ -36,14 +93,23 @@
             return Matrix.Translation(-h, 0, 0);
         }
 
+        /**
+         * @hidden
+         */
         public get leftPreViewMatrix(): Matrix {
             return Matrix.Translation(0.5 * this.interpupillaryDistance, 0, 0);
         }
 
+        /**
+         * @hidden
+         */
         public get rightPreViewMatrix(): Matrix {
             return Matrix.Translation(-0.5 * this.interpupillaryDistance, 0, 0);
         }
 
+        /**
+         * Get the default VRMetrics based on the most generic setup.
+         */
         public static GetDefault(): VRCameraMetrics {
             var result = new VRCameraMetrics();
 

+ 19 - 0
src/Cameras/VR/babylon.vrDeviceOrientationArcRotateCamera.ts

@@ -3,8 +3,23 @@ module BABYLON {
         return () => new VRDeviceOrientationArcRotateCamera(name, 0, 0, 1.0, Vector3.Zero(), scene);
     });
 
+    /**
+     * Camera used to simulate VR rendering (based on ArcRotateCamera)
+     * @see http://doc.babylonjs.com/babylon101/cameras#vr-device-orientation-cameras
+     */
     export class VRDeviceOrientationArcRotateCamera extends ArcRotateCamera {
 
+        /**
+         * Creates a new VRDeviceOrientationArcRotateCamera
+         * @param name defines camera name
+         * @param alpha defines the camera rotation along the logitudinal axis
+         * @param beta defines the camera rotation along the latitudinal axis
+         * @param radius defines the camera distance from its target
+         * @param target defines the camera target
+         * @param scene defines the scene the camera belongs to
+         * @param compensateDistortion defines if the camera needs to compensate the lens distorsion
+         * @param vrCameraMetrics defines the vr metrics associated to the camera
+         */
         constructor(name: string, alpha: number, beta: number, radius: number, target: Vector3, scene: Scene, compensateDistortion = true, vrCameraMetrics: VRCameraMetrics = VRCameraMetrics.GetDefault()) {
             super(name, alpha, beta, radius, target, scene);
 
@@ -14,6 +29,10 @@ module BABYLON {
             this.inputs.addVRDeviceOrientation();
         }
 
+        /**
+         * Gets camera class name
+         * @returns VRDeviceOrientationArcRotateCamera
+         */
         public getClassName(): string {
             return "VRDeviceOrientationArcRotateCamera";
         }

+ 16 - 1
src/Cameras/VR/babylon.vrDeviceOrientationFreeCamera.ts

@@ -3,8 +3,20 @@ module BABYLON {
         return () => new VRDeviceOrientationFreeCamera(name, Vector3.Zero(), scene);
     });
 
+    /**
+     * Camera used to simulate VR rendering (based on FreeCamera)
+     * @see http://doc.babylonjs.com/babylon101/cameras#vr-device-orientation-cameras
+     */
     export class VRDeviceOrientationFreeCamera extends DeviceOrientationCamera {
 
+        /**
+         * 
+         * @param name 
+         * @param position 
+         * @param scene 
+         * @param compensateDistortion 
+         * @param vrCameraMetrics 
+         */
         constructor(name: string, position: Vector3, scene: Scene, compensateDistortion = true, vrCameraMetrics: VRCameraMetrics = VRCameraMetrics.GetDefault()) {
             super(name, position, scene);
 
@@ -12,7 +24,10 @@ module BABYLON {
             this.setCameraRigMode(Camera.RIG_MODE_VR, { vrCameraMetrics: vrCameraMetrics });
         }
 
-
+        /**
+         * Gets camera class name
+         * @returns VRDeviceOrientationFreeCamera
+         */
         public getClassName(): string {
             return "VRDeviceOrientationFreeCamera";
         }

+ 16 - 0
src/Cameras/VR/babylon.vrDeviceOrientationGamepadCamera.ts

@@ -3,14 +3,30 @@ module BABYLON {
         return () => new VRDeviceOrientationGamepadCamera(name, Vector3.Zero(), scene);
     });
 
+    /**
+     * Camera used to simulate VR rendering (based on VRDeviceOrientationFreeCamera)
+     * @see http://doc.babylonjs.com/babylon101/cameras#vr-device-orientation-cameras
+     */
     export class VRDeviceOrientationGamepadCamera extends VRDeviceOrientationFreeCamera {
 
+        /**
+         * 
+         * @param name 
+         * @param position 
+         * @param scene 
+         * @param compensateDistortion 
+         * @param vrCameraMetrics 
+         */
         constructor(name: string, position: Vector3, scene: Scene, compensateDistortion = true, vrCameraMetrics: VRCameraMetrics = VRCameraMetrics.GetDefault()) {
             super(name, position, scene, compensateDistortion, vrCameraMetrics);
             
             this.inputs.addGamepad();
         }
 
+        /**
+         * Gets camera class name
+         * @returns VRDeviceOrientationGamepadCamera
+         */
         public getClassName(): string {
             return "VRDeviceOrientationGamepadCamera";
         }