Browse Source

Merge branch 'master' of https://github.com/BabylonJS/Babylon.js

David Catuhe 7 years ago
parent
commit
c5e090a633

+ 50 - 10
src/Cameras/Inputs/babylon.arcRotateCameraGamepadInput.ts

@@ -1,18 +1,42 @@
 module BABYLON {
+    /**
+     * Manage the gamepad inputs to control an arc rotate camera.
+     * @see http://doc.babylonjs.com/how_to/customizing_camera_inputs
+     */
     export class ArcRotateCameraGamepadInput implements ICameraInput<ArcRotateCamera> {
-        camera: ArcRotateCamera;
+        /**
+         * Defines the camera the input is attached to.
+         */
+        public camera: ArcRotateCamera;
 
+        /**
+         * Defines the gamepad the input is gathering event from.
+         */
         public gamepad: Nullable<Gamepad>;
-        private _onGamepadConnectedObserver : Nullable<Observer<Gamepad>>;
-        private _onGamepadDisconnectedObserver : Nullable<Observer<Gamepad>>;
 
+        /**
+         * Defines the gamepad rotation sensiblity.
+         * This is the threshold from when rotation starts to be accounted for to prevent jittering.
+         */
         @serialize()
         public gamepadRotationSensibility = 80;
 
+        /**
+         * Defines the gamepad move sensiblity.
+         * This is the threshold from when moving starts to be accounted for for to prevent jittering.
+         */
         @serialize()
         public gamepadMoveSensibility = 40;
 
-        attachControl(element: HTMLElement, noPreventDefault?: boolean) {
+        private _onGamepadConnectedObserver : Nullable<Observer<Gamepad>>;
+        private _onGamepadDisconnectedObserver : Nullable<Observer<Gamepad>>;
+
+        /**
+         * Attach the input controls to a specific dom element to get the input from.
+         * @param element Defines the element the controls should be listened from
+         * @param noPreventDefault Defines whether event caught by the controls should call preventdefault() (https://developer.mozilla.org/en-US/docs/Web/API/Event/preventDefault)
+         */
+        public attachControl(element: HTMLElement, noPreventDefault?: boolean): void {
             let manager = this.camera.getScene().gamepadManager;
             this._onGamepadConnectedObserver = manager.onGamepadConnectedObservable.add((gamepad) => {
                 if (gamepad.type !== Gamepad.POSE_ENABLED) {
@@ -21,24 +45,32 @@ module BABYLON {
                         this.gamepad = gamepad;
                     }
                 }
-            });  
+            });
 
             this._onGamepadDisconnectedObserver = manager.onGamepadDisconnectedObservable.add((gamepad)=> {
                 if (this.gamepad === gamepad) {
                     this.gamepad = null;
                 }
-            });            
+            });
             
             this.gamepad = manager.getGamepadByType(Gamepad.XBOX);
         }
 
-        detachControl(element: Nullable<HTMLElement>) {
+        /**
+         * Detach the current controls from the specified dom element.
+         * @param element Defines the element to stop listening the inputs from
+         */
+        public detachControl(element: Nullable<HTMLElement>): void {
             this.camera.getScene().gamepadManager.onGamepadConnectedObservable.remove(this._onGamepadConnectedObserver);            
             this.camera.getScene().gamepadManager.onGamepadDisconnectedObservable.remove(this._onGamepadDisconnectedObserver);
             this.gamepad = null;
         }
 
-        checkInputs() {
+        /**
+         * Update the current camera state depending on the inputs that have been used this frame.
+         * This is a dynamically created lambda to avoid the performance penalty of looping for inputs in the render loop.
+         */
+        public checkInputs(): void {
             if (this.gamepad) {
                 var camera = this.camera;
                 var RSValues = this.gamepad.rightStick;
@@ -70,11 +102,19 @@ module BABYLON {
             }
         }
 
-        getClassName(): string {
+        /**
+         * Gets the class name of the current intput.
+         * @returns the class name
+         */
+        public getClassName(): string {
             return "ArcRotateCameraGamepadInput";
         }
 
-        getSimpleName() {
+        /**
+         * Get the friendly name associated with the input class.
+         * @returns the input friendly name
+         */
+        public getSimpleName(): string {
             return "gamepad";
         }        
     }

+ 64 - 8
src/Cameras/Inputs/babylon.arcRotateCameraKeyboardMoveInput.ts

@@ -1,32 +1,67 @@
 module BABYLON {
+    /**
+     * Manage the keyboard inputs to control the movment of an arc rotate camera.
+     * @see http://doc.babylonjs.com/how_to/customizing_camera_inputs
+     */
     export class ArcRotateCameraKeyboardMoveInput implements ICameraInput<ArcRotateCamera> {
-        camera: ArcRotateCamera;
-        private _keys = new Array<number>();
-        
+        /**
+         * Defines the camera the input is attached to.
+         */
+        public camera: ArcRotateCamera;
+
+        /**
+         * Defines the list of key codes associated with the up action (increase alpha)
+         */
         @serialize()
         public keysUp = [38];
 
+        /**
+         * Defines the list of key codes associated with the down action (decrease alpha)
+         */
         @serialize()
         public keysDown = [40];
 
+        /**
+         * Defines the list of key codes associated with the left action (increase beta)
+         */
         @serialize()
         public keysLeft = [37];
 
+        /**
+         * Defines the list of key codes associated with the right action (decrease beta)
+         */
         @serialize()
         public keysRight = [39];
 
+        /**
+         * Defines the list of key codes associated with the reset action.
+         * Those keys reset the camera to its last stored state (with the method camera.storeState())
+         */
         @serialize()
         public keysReset = [220];
 
+        /**
+         * Defines the panning sensibility of the inputs.
+         * (How fast is the camera paning)
+         */
         @serialize()
         public panningSensibility: number = 50.0;
 
+        /**
+         * Defines the zooming sensibility of the inputs.
+         * (How fast is the camera zooming)
+         */
         @serialize()
         public zoomingSensibility: number = 25.0;
 
+        /**
+         * Defines wether maintaining the alt key down switch the movment mode from
+         * orientation to zoom.
+         */
         @serialize()
         public useAltToZoom: boolean = true;
 
+        private _keys = new Array<number>();
         private _ctrlPressed: boolean;
         private _altPressed: boolean;
         private _onCanvasBlurObserver: Nullable<Observer<Engine>>;
@@ -34,7 +69,12 @@ module BABYLON {
         private _engine: Engine;
         private _scene: Scene;
 
-        public attachControl(element: HTMLElement, noPreventDefault?: boolean) {
+        /**
+         * Attach the input controls to a specific dom element to get the input from.
+         * @param element Defines the element the controls should be listened from
+         * @param noPreventDefault Defines whether event caught by the controls should call preventdefault() (https://developer.mozilla.org/en-US/docs/Web/API/Event/preventDefault)
+         */
+        public attachControl(element: HTMLElement, noPreventDefault?: boolean): void {
             if (this._onCanvasBlurObserver) {
                 return;
             }
@@ -93,6 +133,10 @@ module BABYLON {
             });    
         }
 
+        /**
+         * Detach the current controls from the specified dom element.
+         * @param element Defines the element to stop listening the inputs from
+         */
         public detachControl(element: Nullable<HTMLElement>) {
             if (this._scene) {
                 if (this._onKeyboardObserver) {
@@ -108,7 +152,11 @@ module BABYLON {
             this._keys = [];
         }
 
-        public checkInputs() {
+        /**
+         * Update the current camera state depending on the inputs that have been used this frame.
+         * This is a dynamically created lambda to avoid the performance penalty of looping for inputs in the render loop.
+         */
+        public checkInputs(): void {
             if (this._onKeyboardObserver){
                 var camera = this.camera;
 
@@ -153,11 +201,19 @@ module BABYLON {
             }
         }
 
-        getClassName(): string {
+        /**
+         * Gets the class name of the current intput.
+         * @returns the class name
+         */
+        public getClassName(): string {
             return "ArcRotateCameraKeyboardMoveInput";
         }
-        
-        getSimpleName(){
+
+        /**
+         * Get the friendly name associated with the input class.
+         * @returns the input friendly name
+         */
+        public getSimpleName(): string{
             return "keyboard";
         }
     }

+ 35 - 8
src/Cameras/Inputs/babylon.arcRotateCameraMouseWheelInput.ts

@@ -1,10 +1,17 @@
 module BABYLON {
+    /**
+     * Manage the mouse wheel inputs to control an arc rotate camera.
+     * @see http://doc.babylonjs.com/how_to/customizing_camera_inputs
+     */
     export class ArcRotateCameraMouseWheelInput implements ICameraInput<ArcRotateCamera> {
-        camera: ArcRotateCamera;
-
-        private _wheel: Nullable<(p: PointerInfo, s: EventState) => void>;
-        private _observer: Nullable<Observer<PointerInfo>>;
+        /**
+         * Defines the camera the input is attached to.
+         */
+        public camera: ArcRotateCamera;
 
+        /**
+         * Gets or Set the mouse wheel precision or how fast is the camera zooming.
+         */
         @serialize()
         public wheelPrecision = 3.0;
 
@@ -15,7 +22,15 @@ module BABYLON {
         @serialize()
         public wheelDeltaPercentage = 0;
 
-        public attachControl(element: HTMLElement, noPreventDefault?: boolean) {
+        private _wheel: Nullable<(p: PointerInfo, s: EventState) => void>;
+        private _observer: Nullable<Observer<PointerInfo>>;
+
+        /**
+         * Attach the input controls to a specific dom element to get the input from.
+         * @param element Defines the element the controls should be listened from
+         * @param noPreventDefault Defines whether event caught by the controls should call preventdefault() (https://developer.mozilla.org/en-US/docs/Web/API/Event/preventDefault)
+         */
+        public attachControl(element: HTMLElement, noPreventDefault?: boolean): void {
             this._wheel = (p, s) => {
                 //sanity check - this should be a PointerWheel event.
                 if (p.type !== PointerEventTypes.POINTERWHEEL) return;
@@ -50,7 +65,11 @@ module BABYLON {
             this._observer = this.camera.getScene().onPointerObservable.add(this._wheel, PointerEventTypes.POINTERWHEEL);
         }
 
-        public detachControl(element: Nullable<HTMLElement>) {
+        /**
+         * Detach the current controls from the specified dom element.
+         * @param element Defines the element to stop listening the inputs from
+         */
+        public detachControl(element: Nullable<HTMLElement>): void {
             if (this._observer && element) {
                 this.camera.getScene().onPointerObservable.remove(this._observer);
                 this._observer = null;
@@ -58,11 +77,19 @@ module BABYLON {
             }
         }
 
-        getClassName(): string {
+        /**
+         * Gets the class name of the current intput.
+         * @returns the class name
+         */
+        public getClassName(): string {
             return "ArcRotateCameraMouseWheelInput";
         }
 
-        getSimpleName() {
+        /**
+         * Get the friendly name associated with the input class.
+         * @returns the input friendly name
+         */
+        public getSimpleName(): string {
             return "mousewheel";
         }
     }

+ 55 - 7
src/Cameras/Inputs/babylon.arcRotateCameraPointersInput.ts

@@ -1,16 +1,35 @@
 module BABYLON {
+    /**
+     * Manage the pointers inputs to control an arc rotate camera.
+     * @see http://doc.babylonjs.com/how_to/customizing_camera_inputs
+     */
     export class ArcRotateCameraPointersInput implements ICameraInput<ArcRotateCamera> {
-        camera: ArcRotateCamera;
+        /**
+         * Defines the camera the input is attached to.
+         */
+        public camera: ArcRotateCamera;
 
+        /**
+         * Defines the buttons associated with the input to handle camera move.
+         */
         @serialize()
         public buttons = [0, 1, 2];
 
+        /**
+         * Defines the pointer angular sensibility  along the X axis or how fast is the camera rotating.
+         */
         @serialize()
         public angularSensibilityX = 1000.0;
 
+        /**
+         * Defines the pointer angular sensibility along the Y axis or how fast is the camera rotating.
+         */
         @serialize()
         public angularSensibilityY = 1000.0;
 
+        /**
+         * Defines the pointer pinch precision or how fast is the camera zooming.
+         */
         @serialize()
         public pinchPrecision = 12.0;
 
@@ -21,18 +40,30 @@ module BABYLON {
         @serialize()
         public pinchDeltaPercentage = 0;
 
+        /**
+         * Defines the pointer panning sensibility or how fast is the camera moving.
+         */
         @serialize()
         public panningSensibility: number = 1000.0;
 
+        /**
+         * Defines whether panning (2 fingers swipe) is enabled through multitouch.
+         */
         @serialize()
         public multiTouchPanning: boolean = true;
 
+        /**
+         * Defines whether panning is enabled for both pan (2 fingers swipe) and zoom (pinch) through multitouch.
+         */
         @serialize()
         public multiTouchPanAndZoom: boolean = true;
 
-        private _isPanClick: boolean = false;
+        /**
+         * Revers pinch action direction.
+         */
         public pinchInwards = true;
-
+        
+        private _isPanClick: boolean = false;
         private _pointerInput: (p: PointerInfo, s: EventState) => void;
         private _observer: Nullable<Observer<PointerInfo>>;
         private _onMouseMove: Nullable<(e: MouseEvent) => any>;
@@ -42,7 +73,12 @@ module BABYLON {
         private _onLostFocus: Nullable<(e: FocusEvent) => any>;
         private _onContextMenu: Nullable<(e: PointerEvent) => void>;
 
-        public attachControl(element: HTMLElement, noPreventDefault?: boolean) {
+        /**
+         * Attach the input controls to a specific dom element to get the input from.
+         * @param element Defines the element the controls should be listened from
+         * @param noPreventDefault Defines whether event caught by the controls should call preventdefault() (https://developer.mozilla.org/en-US/docs/Web/API/Event/preventDefault)
+         */
+        public attachControl(element: HTMLElement, noPreventDefault?: boolean): void {
             var engine = this.camera.getEngine();
             var cacheSoloPointer: Nullable<{ x: number, y: number, pointerId: number, type: any }>; // cache pointer object for better perf on camera rotation
             var pointA: Nullable<{ x: number, y: number, pointerId: number, type: any }> = null;
@@ -314,7 +350,11 @@ module BABYLON {
             ]);
         }
 
-        public detachControl(element: Nullable<HTMLElement>) {
+        /**
+         * Detach the current controls from the specified dom element.
+         * @param element Defines the element to stop listening the inputs from
+         */
+        public detachControl(element: Nullable<HTMLElement>): void {
             if (this._onLostFocus) {
                 Tools.UnregisterTopRootEvents([
                     { name: "blur", handler: this._onLostFocus }
@@ -353,11 +393,19 @@ module BABYLON {
             }
         }
 
-        getClassName(): string {
+        /**
+         * Gets the class name of the current intput.
+         * @returns the class name
+         */
+        public getClassName(): string {
             return "ArcRotateCameraPointersInput";
         }
 
-        getSimpleName() {
+        /**
+         * Get the friendly name associated with the input class.
+         * @returns the input friendly name
+         */
+        public getSimpleName(): string {
             return "pointers";
         }
     }

+ 48 - 6
src/Cameras/Inputs/babylon.arcRotateCameraVRDeviceOrientationInput.ts

@@ -1,9 +1,27 @@
 module BABYLON {
+    /**
+     * Manage the device orientation inputs (gyroscope) to control an arc rotate camera.
+     * @see http://doc.babylonjs.com/how_to/customizing_camera_inputs
+     */
     export class ArcRotateCameraVRDeviceOrientationInput implements ICameraInput<ArcRotateCamera> {
-        camera: ArcRotateCamera;
+        /**
+         * Defines the camera the input is attached to.
+         */
+        public camera: ArcRotateCamera;
 
+        /**
+         * Defines a correction factor applied on the alpha value retrieved from the orientation events.
+         */
         public alphaCorrection = 1;
+
+        /**
+         * Defines a correction factor applied on the beta value retrieved from the orientation events.
+         */
         public betaCorrection = 1;
+
+        /**
+         * Defines a correction factor applied on the gamma value retrieved from the orientation events.
+         */
         public gammaCorrection = 1;
 
         private _alpha = 0;
@@ -12,11 +30,19 @@ module BABYLON {
 
         private _deviceOrientationHandler: () => void;
 
+        /**
+         * Instantiate a new ArcRotateCameraVRDeviceOrientationInput.
+         */
         constructor() {
             this._deviceOrientationHandler = this._onOrientationEvent.bind(this);
         }
 
-        attachControl(element: HTMLElement, noPreventDefault?: boolean) {
+        /**
+         * Attach the input controls to a specific dom element to get the input from.
+         * @param element Defines the element the controls should be listened from
+         * @param noPreventDefault Defines whether event caught by the controls should call preventdefault() (https://developer.mozilla.org/en-US/docs/Web/API/Event/preventDefault)
+         */
+        public attachControl(element: HTMLElement, noPreventDefault?: boolean): void {
             this.camera.attachControl(element, noPreventDefault);
             window.addEventListener("deviceorientation", this._deviceOrientationHandler);
         }
@@ -33,7 +59,11 @@ module BABYLON {
             this._dirty = true;
         }
 
-        public checkInputs() {
+        /**
+         * Update the current camera state depending on the inputs that have been used this frame.
+         * This is a dynamically created lambda to avoid the performance penalty of looping for inputs in the render loop.
+         */
+        public checkInputs(): void {
             if (this._dirty) {
                 this._dirty = false;
 
@@ -46,15 +76,27 @@ module BABYLON {
             }
         }
 
-        detachControl(element: Nullable<HTMLElement>) {
+        /**
+         * Detach the current controls from the specified dom element.
+         * @param element Defines the element to stop listening the inputs from
+         */
+        public detachControl(element: Nullable<HTMLElement>): void {
             window.removeEventListener("deviceorientation", this._deviceOrientationHandler);
         }
 
-        getClassName(): string {
+        /**
+         * Gets the class name of the current intput.
+         * @returns the class name
+         */
+        public getClassName(): string {
             return "ArcRotateCameraVRDeviceOrientationInput";
         }
 
-        getSimpleName() {
+        /**
+         * Get the friendly name associated with the input class.
+         * @returns the input friendly name
+         */
+        public getSimpleName(): string {
             return "VRDeviceOrientation";
         }
     }

+ 1 - 1
src/Cameras/babylon.arcRotateCamera.ts

@@ -150,7 +150,7 @@
         //-- begin properties for backward compatibility for inputs
 
         /**
-         * Gets or Set the pointer angular sensibility  along the X axis  or how fast is the camera rotating.
+         * Gets or Set the pointer angular sensibility  along the X axis or how fast is the camera rotating.
          */
         public get angularSensibilityX(): number {
             var pointers = <ArcRotateCameraPointersInput>this.inputs.attached["pointers"];

+ 25 - 0
src/Cameras/babylon.arcRotateCameraInputsManager.ts

@@ -1,24 +1,49 @@
 module BABYLON {
+    /**
+     * Default Inputs manager for the ArcRotateCamera.
+     * It groups all the default supported inputs for ease of use.
+     * @see http://doc.babylonjs.com/how_to/customizing_camera_inputs
+     */
     export class ArcRotateCameraInputsManager extends CameraInputsManager<ArcRotateCamera> {
+        /**
+         * Instantiates a new ArcRotateCameraInputsManager.
+         * @param camera Defines the camera the inputs belong to
+         */
         constructor(camera: ArcRotateCamera) {
             super(camera);
         }
 
+        /**
+         * Add mouse wheel input support to the input manager.
+         * @returns the current input manager
+         */
         public addMouseWheel(): ArcRotateCameraInputsManager {
             this.add(new ArcRotateCameraMouseWheelInput());
             return this;
         }
 
+        /**
+         * Add pointers input support to the input manager.
+         * @returns the current input manager
+         */
         public addPointers(): ArcRotateCameraInputsManager {
             this.add(new ArcRotateCameraPointersInput());
             return this;
         }
 
+        /**
+         * Add keyboard input support to the input manager.
+         * @returns the current input manager
+         */
         public addKeyboard(): ArcRotateCameraInputsManager {
             this.add(new ArcRotateCameraKeyboardMoveInput());
             return this;
         }
 
+        /**
+         * Add orientation input support to the input manager.
+         * @returns the current input manager
+         */
         public addVRDeviceOrientation(): ArcRotateCameraInputsManager {
             this.add(new ArcRotateCameraVRDeviceOrientationInput());
             return this;

+ 121 - 15
src/Cameras/babylon.cameraInputsManager.ts

@@ -1,27 +1,98 @@
 module BABYLON {
+    /**
+     * This is a list of all the different input types that are available in the application.
+     * Fo instance: ArcRotateCameraGamepadInput...
+     */
     export var CameraInputTypes = {};
 
+    /**
+     * This is the contract to implement in order to create a new input class.
+     * Inputs are dealing with listening to user actions and moving the camera accordingly.
+     */
     export interface ICameraInput<TCamera extends Camera> {
+        /**
+         * Defines the camera the input is attached to.
+         */
         camera: Nullable<TCamera>;
+        /**
+         * Gets the class name of the current intput.
+         * @returns the class name
+         */
         getClassName(): string;
+        /**
+         * Get the friendly name associated with the input class.
+         * @returns the input friendly name
+         */
         getSimpleName(): string;
-        attachControl: (element: HTMLElement, noPreventDefault?: boolean) => void;
-        detachControl: (element: Nullable<HTMLElement>) => void;
+        /**
+         * Attach the input controls to a specific dom element to get the input from.
+         * @param element Defines the element the controls should be listened from
+         * @param noPreventDefault Defines whether event caught by the controls should call preventdefault() (https://developer.mozilla.org/en-US/docs/Web/API/Event/preventDefault)
+         */
+        attachControl(element: HTMLElement, noPreventDefault?: boolean): void;
+        /**
+         * Detach the current controls from the specified dom element.
+         * @param element Defines the element to stop listening the inputs from
+         */
+        detachControl(element: Nullable<HTMLElement>): void;
+        /**
+         * Update the current camera state depending on the inputs that have been used this frame.
+         * This is a dynamically created lambda to avoid the performance penalty of looping for inputs in the render loop.
+         */
         checkInputs?: () => void;
     }
 
+    /**
+     * Represents a map of input types to input instance or input index to input instance.
+     */
     export interface CameraInputsMap<TCamera extends Camera> {
+        /**
+         * Accessor to the input by input type.
+         */
         [name: string]: ICameraInput<TCamera>;
+        /**
+         * Accessor to the input by input index.
+         */
         [idx: number]: ICameraInput<TCamera>;
     }
 
+    /**
+     * This represents the input manager used within a camera.
+     * It helps dealing with all the different kind of input attached to a camera.
+     * @see http://doc.babylonjs.com/how_to/customizing_camera_inputs
+     */
     export class CameraInputsManager<TCamera extends Camera> {
-        attached: CameraInputsMap<TCamera>;
+        /**
+         * Defines the list of inputs attahed to the camera.
+         */
+        public attached: CameraInputsMap<TCamera>;
+
+        /**
+         * Defines the dom element the camera is collecting inputs from.
+         * This is null if the controls have not been attached.
+         */
         public attachedElement: Nullable<HTMLElement>;
+
+        /**
+         * Defines whether event caught by the controls should call preventdefault() (https://developer.mozilla.org/en-US/docs/Web/API/Event/preventDefault)
+         */
         public noPreventDefault: boolean;
-        camera: TCamera;
-        checkInputs: () => void;
 
+        /**
+         * Defined the camera the input manager belongs to.
+         */
+        public camera: TCamera;
+
+        /**
+         * Update the current camera state depending on the inputs that have been used this frame.
+         * This is a dynamically created lambda to avoid the performance penalty of looping for inputs in the render loop.
+         */
+        public checkInputs: () => void;
+
+        /**
+         * Instantiate a new Camera Input Manager.
+         * @param camera Defines the camera the input manager blongs to
+         */
         constructor(camera: TCamera) {
             this.attached = {};
             this.camera = camera;
@@ -33,7 +104,7 @@ module BABYLON {
          * @see http://doc.babylonjs.com/how_to/customizing_camera_inputs
          * @param input camera input method
          */
-        public add(input: ICameraInput<TCamera>) {
+        public add(input: ICameraInput<TCamera>): void {
             var type = input.getSimpleName();
             if (this.attached[type]) {
                 Tools.Warn("camera input of type " + type + " already exists on camera");
@@ -54,12 +125,13 @@ module BABYLON {
                 input.attachControl(this.attachedElement);
             }
         }
+
         /**
          * Remove a specific input method from a camera
          * example: camera.inputs.remove(camera.inputs.attached.mouse);
          * @param inputToRemove camera input method
          */
-        public remove(inputToRemove: ICameraInput<TCamera>) {
+        public remove(inputToRemove: ICameraInput<TCamera>): void {
             for (var cam in this.attached) {
                 var input = this.attached[cam];
                 if (input === inputToRemove) {
@@ -71,7 +143,12 @@ module BABYLON {
             }
         }
 
-        public removeByType(inputType: string) {
+        /**
+         * Remove a specific input type from a camera
+         * example: camera.inputs.remove("ArcRotateCameraGamepadInput");
+         * @param inputType the type of the input to remove
+         */
+        public removeByType(inputType: string): void {
             for (var cam in this.attached) {
                 var input = this.attached[cam];
                 if (input.getClassName() === inputType) {
@@ -91,13 +168,22 @@ module BABYLON {
             }
         }
 
-        public attachInput(input: ICameraInput<TCamera>) {
+        /**
+         * Attach the input controls to the currently attached dom element to listen the events from.
+         * @param input Defines the input to attach
+         */
+        public attachInput(input: ICameraInput<TCamera>): void {
             if (this.attachedElement) {
                 input.attachControl(this.attachedElement, this.noPreventDefault);
             }
         }
 
-        public attachElement(element: HTMLElement, noPreventDefault: boolean = false) {
+        /**
+         * Attach the current manager inputs controls to a specific dom element to listen the events from.
+         * @param element Defines the dom element to collect the events from
+         * @param noPreventDefault Defines whether event caught by the controls should call preventdefault() (https://developer.mozilla.org/en-US/docs/Web/API/Event/preventDefault)
+         */
+        public attachElement(element: HTMLElement, noPreventDefault: boolean = false): void {
             if (this.attachedElement) {
                 return;
             }
@@ -111,7 +197,12 @@ module BABYLON {
             }
         }
 
-        public detachElement(element: HTMLElement, disconnect = false) {
+        /**
+         * Detach the current manager inputs controls from a specific dom element.
+         * @param element Defines the dom element to collect the events from
+         * @param disconnect Defines whether the input should be removed from the current list of attached inputs
+         */
+        public detachElement(element: HTMLElement, disconnect = false): void {
             if (this.attachedElement !== element) {
                 return;
             }
@@ -127,7 +218,11 @@ module BABYLON {
             this.attachedElement = null;
         }
 
-        public rebuildInputCheck() {
+        /**
+         * Rebuild the dynamic inputCheck function from the current list of 
+         * defined inputs in the manager.
+         */
+        public rebuildInputCheck(): void {
             this.checkInputs = () => { };
 
             for (var cam in this.attached) {
@@ -141,7 +236,7 @@ module BABYLON {
         /**
          * Remove all attached input methods from a camera
          */
-        public clear() {
+        public clear(): void {
             if (this.attachedElement) {
                 this.detachElement(this.attachedElement, true);
             }
@@ -150,7 +245,13 @@ module BABYLON {
             this.checkInputs = () => { };
         }
 
-        public serialize(serializedCamera: any) {
+        /**
+         * Serialize the current input manager attached to a camera.
+         * This ensures than once parsed, 
+         * the input associated to the camera will be identical to the current ones
+         * @param serializedCamera Defines the camera serialization JSON the input serialization should write to
+         */
+        public serialize(serializedCamera: any): void {
             var inputs: { [key: string]: any } = {};
             for (var cam in this.attached) {
                 var input = this.attached[cam];
@@ -161,7 +262,12 @@ module BABYLON {
             serializedCamera.inputsmgr = inputs;
         }
 
-        public parse(parsedCamera: any) {
+        /**
+         * Parses an input manager serialized JSON to restore the previous list of inputs
+         * and states associated to a camera.
+         * @param parsedCamera Defines the JSON to parse
+         */
+        public parse(parsedCamera: any): void {
             var parsedInputs = parsedCamera.inputsmgr;
             if (parsedInputs) {
                 this.clear();

+ 4 - 0
src/Gamepad/babylon.gamepadSceneComponent.ts

@@ -37,6 +37,10 @@ module BABYLON {
     }
 
     export interface ArcRotateCameraInputsManager {
+        /**
+         * Adds gamepad input support to the ArcRotateCamera InputManager.
+         * @returns the camera inputs manager
+         */
         addGamepad(): ArcRotateCameraInputsManager;
     }