ソースを参照

actionManager can be created automatically

David Catuhe 9 年 前
コミット
8854ff2b00

ファイルの差分が大きいため隠しています
+ 23 - 23
dist/preview release/babylon.core.js


ファイルの差分が大きいため隠しています
+ 2998 - 2727
dist/preview release/babylon.d.ts


ファイルの差分が大きいため隠しています
+ 38 - 38
dist/preview release/babylon.js


ファイルの差分が大きいため隠しています
+ 654 - 22
dist/preview release/babylon.max.js


ファイルの差分が大きいため隠しています
+ 38 - 38
dist/preview release/babylon.noworker.js


+ 9 - 7
src/Cameras/VR/babylon.webVRCamera.js

@@ -13,8 +13,6 @@ var BABYLON;
             this._hmdDevice = null;
             this._hmdDevice = null;
             this._sensorDevice = null;
             this._sensorDevice = null;
             this._cacheState = null;
             this._cacheState = null;
-            this._cacheQuaternion = new BABYLON.Quaternion();
-            this._cacheRotation = BABYLON.Vector3.Zero();
             this._vrEnabled = false;
             this._vrEnabled = false;
             var metrics = BABYLON.VRCameraMetrics.GetDefault();
             var metrics = BABYLON.VRCameraMetrics.GetDefault();
             metrics.compensateDistortion = compensateDistortion;
             metrics.compensateDistortion = compensateDistortion;
@@ -46,11 +44,10 @@ var BABYLON;
         WebVRFreeCamera.prototype._checkInputs = function () {
         WebVRFreeCamera.prototype._checkInputs = function () {
             if (this._vrEnabled) {
             if (this._vrEnabled) {
                 this._cacheState = this._sensorDevice.getState();
                 this._cacheState = this._sensorDevice.getState();
-                this._cacheQuaternion.copyFromFloats(this._cacheState.orientation.x, this._cacheState.orientation.y, this._cacheState.orientation.z, this._cacheState.orientation.w);
-                this._cacheQuaternion.toEulerAnglesToRef(this._cacheRotation);
-                this.rotation.x = -this._cacheRotation.x;
-                this.rotation.y = -this._cacheRotation.y;
-                this.rotation.z = this._cacheRotation.z;
+                this.rotationQuaternion.copyFrom(this._cacheState.orientation);
+                //Flip in XY plane
+                this.rotationQuaternion.z *= -1;
+                this.rotationQuaternion.w *= -1;
             }
             }
             _super.prototype._checkInputs.call(this);
             _super.prototype._checkInputs.call(this);
         };
         };
@@ -68,6 +65,11 @@ var BABYLON;
             _super.prototype.detachControl.call(this, element);
             _super.prototype.detachControl.call(this, element);
             this._vrEnabled = false;
             this._vrEnabled = false;
         };
         };
+        WebVRFreeCamera.prototype.requestVRFullscreen = function (requestPointerlock) {
+            if (!this._hmdDevice)
+                return;
+            this.getEngine().switchFullscreen(requestPointerlock, { vrDisplay: this._hmdDevice });
+        };
         WebVRFreeCamera.prototype.getTypeName = function () {
         WebVRFreeCamera.prototype.getTypeName = function () {
             return "WebVRFreeCamera";
             return "WebVRFreeCamera";
         };
         };

+ 18 - 2
src/Materials/babylon.colorCurves.js

@@ -53,6 +53,7 @@ var BABYLON;
              */
              */
             set: function (value) {
             set: function (value) {
                 this._globalHue = value;
                 this._globalHue = value;
+                this._dirty = true;
             },
             },
             enumerable: true,
             enumerable: true,
             configurable: true
             configurable: true
@@ -73,6 +74,7 @@ var BABYLON;
              */
              */
             set: function (value) {
             set: function (value) {
                 this._globalDensity = value;
                 this._globalDensity = value;
+                this._dirty = true;
             },
             },
             enumerable: true,
             enumerable: true,
             configurable: true
             configurable: true
@@ -91,6 +93,7 @@ var BABYLON;
              */
              */
             set: function (value) {
             set: function (value) {
                 this._globalSaturation = value;
                 this._globalSaturation = value;
+                this._dirty = true;
             },
             },
             enumerable: true,
             enumerable: true,
             configurable: true
             configurable: true
@@ -109,6 +112,7 @@ var BABYLON;
              */
              */
             set: function (value) {
             set: function (value) {
                 this._highlightsHue = value;
                 this._highlightsHue = value;
+                this._dirty = true;
             },
             },
             enumerable: true,
             enumerable: true,
             configurable: true
             configurable: true
@@ -129,6 +133,7 @@ var BABYLON;
              */
              */
             set: function (value) {
             set: function (value) {
                 this._highlightsDensity = value;
                 this._highlightsDensity = value;
+                this._dirty = true;
             },
             },
             enumerable: true,
             enumerable: true,
             configurable: true
             configurable: true
@@ -147,6 +152,7 @@ var BABYLON;
              */
              */
             set: function (value) {
             set: function (value) {
                 this._highlightsSaturation = value;
                 this._highlightsSaturation = value;
+                this._dirty = true;
             },
             },
             enumerable: true,
             enumerable: true,
             configurable: true
             configurable: true
@@ -165,6 +171,7 @@ var BABYLON;
              */
              */
             set: function (value) {
             set: function (value) {
                 this._highlightsExposure = value;
                 this._highlightsExposure = value;
+                this._dirty = true;
             },
             },
             enumerable: true,
             enumerable: true,
             configurable: true
             configurable: true
@@ -183,6 +190,7 @@ var BABYLON;
              */
              */
             set: function (value) {
             set: function (value) {
                 this._midtonesHue = value;
                 this._midtonesHue = value;
+                this._dirty = true;
             },
             },
             enumerable: true,
             enumerable: true,
             configurable: true
             configurable: true
@@ -203,6 +211,7 @@ var BABYLON;
              */
              */
             set: function (value) {
             set: function (value) {
                 this._midtonesDensity = value;
                 this._midtonesDensity = value;
+                this._dirty = true;
             },
             },
             enumerable: true,
             enumerable: true,
             configurable: true
             configurable: true
@@ -221,6 +230,7 @@ var BABYLON;
              */
              */
             set: function (value) {
             set: function (value) {
                 this._midtonesSaturation = value;
                 this._midtonesSaturation = value;
+                this._dirty = true;
             },
             },
             enumerable: true,
             enumerable: true,
             configurable: true
             configurable: true
@@ -239,6 +249,7 @@ var BABYLON;
              */
              */
             set: function (value) {
             set: function (value) {
                 this._midtonesExposure = value;
                 this._midtonesExposure = value;
+                this._dirty = true;
             },
             },
             enumerable: true,
             enumerable: true,
             configurable: true
             configurable: true
@@ -257,6 +268,7 @@ var BABYLON;
              */
              */
             set: function (value) {
             set: function (value) {
                 this._shadowsHue = value;
                 this._shadowsHue = value;
+                this._dirty = true;
             },
             },
             enumerable: true,
             enumerable: true,
             configurable: true
             configurable: true
@@ -277,6 +289,7 @@ var BABYLON;
              */
              */
             set: function (value) {
             set: function (value) {
                 this._shadowsDensity = value;
                 this._shadowsDensity = value;
+                this._dirty = true;
             },
             },
             enumerable: true,
             enumerable: true,
             configurable: true
             configurable: true
@@ -295,6 +308,7 @@ var BABYLON;
              */
              */
             set: function (value) {
             set: function (value) {
                 this._shadowsSaturation = value;
                 this._shadowsSaturation = value;
+                this._dirty = true;
             },
             },
             enumerable: true,
             enumerable: true,
             configurable: true
             configurable: true
@@ -313,6 +327,7 @@ var BABYLON;
              */
              */
             set: function (value) {
             set: function (value) {
                 this._shadowsExposure = value;
                 this._shadowsExposure = value;
+                this._dirty = true;
             },
             },
             enumerable: true,
             enumerable: true,
             configurable: true
             configurable: true
@@ -324,6 +339,7 @@ var BABYLON;
          */
          */
         ColorCurves.Bind = function (colorCurves, effect) {
         ColorCurves.Bind = function (colorCurves, effect) {
             if (colorCurves._dirty) {
             if (colorCurves._dirty) {
+                colorCurves._dirty = false;
                 // Fill in global info.
                 // Fill in global info.
                 colorCurves.getColorGradingDataToRef(colorCurves._globalHue, colorCurves._globalDensity, colorCurves._globalSaturation, colorCurves._globalExposure, colorCurves._globalCurve);
                 colorCurves.getColorGradingDataToRef(colorCurves._globalHue, colorCurves._globalDensity, colorCurves._globalSaturation, colorCurves._globalExposure, colorCurves._globalCurve);
                 // Compute highlights info.
                 // Compute highlights info.
@@ -360,7 +376,7 @@ var BABYLON;
          */
          */
         ColorCurves.prototype.getColorGradingDataToRef = function (hue, density, saturation, exposure, result) {
         ColorCurves.prototype.getColorGradingDataToRef = function (hue, density, saturation, exposure, result) {
             if (hue == null) {
             if (hue == null) {
-                return null;
+                return;
             }
             }
             hue = ColorCurves.clamp(hue, 0, 360);
             hue = ColorCurves.clamp(hue, 0, 360);
             density = ColorCurves.clamp(density, -100, 100);
             density = ColorCurves.clamp(density, -100, 100);
@@ -524,6 +540,6 @@ var BABYLON;
             BABYLON.serialize()
             BABYLON.serialize()
         ], ColorCurves.prototype, "_midtonesExposure", void 0);
         ], ColorCurves.prototype, "_midtonesExposure", void 0);
         return ColorCurves;
         return ColorCurves;
-    }());
+    })();
     BABYLON.ColorCurves = ColorCurves;
     BABYLON.ColorCurves = ColorCurves;
 })(BABYLON || (BABYLON = {}));
 })(BABYLON || (BABYLON = {}));

+ 9 - 9
src/Materials/babylon.colorCurves.ts

@@ -10,15 +10,15 @@
         
         
         private _dirty = true;
         private _dirty = true;
         
         
-        private _tempColor = new BABYLON.Color4(0, 0, 0, 0);
+        private _tempColor = new Color4(0, 0, 0, 0);
         
         
-        private _globalCurve = new BABYLON.Color4(0, 0, 0, 0);
-        private _highlightsCurve = new BABYLON.Color4(0, 0, 0, 0);
-        private _midtonesCurve = new BABYLON.Color4(0, 0, 0, 0);
-        private _shadowsCurve = new BABYLON.Color4(0, 0, 0, 0);
+        private _globalCurve = new Color4(0, 0, 0, 0);
+        private _highlightsCurve = new Color4(0, 0, 0, 0);
+        private _midtonesCurve = new Color4(0, 0, 0, 0);
+        private _shadowsCurve = new Color4(0, 0, 0, 0);
         
         
-        private _positiveCurve = new BABYLON.Color4(0, 0, 0, 0);
-        private _negativeCurve = new BABYLON.Color4(0, 0, 0, 0);
+        private _positiveCurve = new Color4(0, 0, 0, 0);
+        private _negativeCurve = new Color4(0, 0, 0, 0);
         
         
         @serialize()
         @serialize()
         private _globalHue = 30;
         private _globalHue = 30;
@@ -386,7 +386,7 @@
          */
          */
         private getColorGradingDataToRef(hue: number, density: number, saturation: number, exposure: number, result: Color4) : void {
         private getColorGradingDataToRef(hue: number, density: number, saturation: number, exposure: number, result: Color4) : void {
             if (hue == null) {
             if (hue == null) {
-                return null;
+                return;
             }
             }
 
 
             hue = ColorCurves.clamp(hue, 0, 360);
             hue = ColorCurves.clamp(hue, 0, 360);
@@ -439,7 +439,7 @@
          * @param brightness The brightness (B) input.
          * @param brightness The brightness (B) input.
          * @result An RGBA color represented as Vector4.
          * @result An RGBA color represented as Vector4.
          */
          */
-        private static fromHSBToRef(hue: number, saturation: number, brightness: number, result: BABYLON.Color4): void {
+        private static fromHSBToRef(hue: number, saturation: number, brightness: number, result: Color4): void {
             var h: number = ColorCurves.clamp(hue, 0, 360);
             var h: number = ColorCurves.clamp(hue, 0, 360);
             var s: number = ColorCurves.clamp(saturation / 100, 0, 1);
             var s: number = ColorCurves.clamp(saturation / 100, 0, 1);
             var v: number = ColorCurves.clamp(brightness / 100, 0, 1);
             var v: number = ColorCurves.clamp(brightness / 100, 0, 1);

+ 18 - 0
src/Materials/babylon.pbrMaterial.js

@@ -62,6 +62,7 @@ var BABYLON;
             this.CAMERATONEMAP = false;
             this.CAMERATONEMAP = false;
             this.CAMERACONTRAST = false;
             this.CAMERACONTRAST = false;
             this.CAMERACOLORGRADING = false;
             this.CAMERACOLORGRADING = false;
+            this.CAMERACOLORCURVES = false;
             this.OVERLOADEDVALUES = false;
             this.OVERLOADEDVALUES = false;
             this.OVERLOADEDSHADOWVALUES = false;
             this.OVERLOADEDSHADOWVALUES = false;
             this.USESPHERICALFROMREFLECTIONMAP = false;
             this.USESPHERICALFROMREFLECTIONMAP = false;
@@ -153,6 +154,13 @@ var BABYLON;
             this.cameraColorGradingTexture = null;
             this.cameraColorGradingTexture = null;
             this._cameraColorGradingScaleOffset = new BABYLON.Vector4(1.0, 1.0, 0.0, 0.0);
             this._cameraColorGradingScaleOffset = new BABYLON.Vector4(1.0, 1.0, 0.0, 0.0);
             this._cameraColorGradingInfos = new BABYLON.Vector4(1.0, 1.0, 0.0, 0.0);
             this._cameraColorGradingInfos = new BABYLON.Vector4(1.0, 1.0, 0.0, 0.0);
+            /**
+             * The color grading curves provide additional color adjustmnent that is applied after any color grading transform (3D LUT).
+             * They allow basic adjustment of saturation and small exposure adjustments, along with color filter tinting to provide white balance adjustment or more stylistic effects.
+             * These are similar to controls found in many professional imaging or colorist software. The global controls are applied to the entire image. For advanced tuning, extra controls are provided to adjust the shadow, midtone and highlight areas of the image;
+             * corresponding to low luminance, medium luminance, and high luminance areas respectively.
+             */
+            this.cameraColorCurves = null;
             this._cameraInfos = new BABYLON.Vector4(1.0, 1.0, 0.0, 0.0);
             this._cameraInfos = new BABYLON.Vector4(1.0, 1.0, 0.0, 0.0);
             this._microsurfaceTextureLods = new BABYLON.Vector2(0.0, 0.0);
             this._microsurfaceTextureLods = new BABYLON.Vector2(0.0, 0.0);
             /**
             /**
@@ -618,6 +626,9 @@ var BABYLON;
             if (this.cameraExposure != 1) {
             if (this.cameraExposure != 1) {
                 this._defines.CAMERATONEMAP = true;
                 this._defines.CAMERATONEMAP = true;
             }
             }
+            if (this.cameraColorCurves) {
+                this._defines.CAMERACOLORCURVES = true;
+            }
             if (this.overloadedShadeIntensity != 1 ||
             if (this.overloadedShadeIntensity != 1 ||
                 this.overloadedShadowIntensity != 1) {
                 this.overloadedShadowIntensity != 1) {
                 this._defines.OVERLOADEDSHADOWVALUES = true;
                 this._defines.OVERLOADEDSHADOWVALUES = true;
@@ -783,6 +794,7 @@ var BABYLON;
                 ];
                 ];
                 var samplers = ["albedoSampler", "ambientSampler", "opacitySampler", "reflectionCubeSampler", "reflection2DSampler", "emissiveSampler", "reflectivitySampler", "bumpSampler", "lightmapSampler", "refractionCubeSampler", "refraction2DSampler",
                 var samplers = ["albedoSampler", "ambientSampler", "opacitySampler", "reflectionCubeSampler", "reflection2DSampler", "emissiveSampler", "reflectivitySampler", "bumpSampler", "lightmapSampler", "refractionCubeSampler", "refraction2DSampler",
                     "cameraColorGrading2DSampler"];
                     "cameraColorGrading2DSampler"];
+                BABYLON.ColorCurves.PrepareUniforms(uniforms);
                 BABYLON.MaterialHelper.PrepareUniformsAndSamplersList(uniforms, samplers, this._defines, this.maxSimultaneousLights);
                 BABYLON.MaterialHelper.PrepareUniformsAndSamplersList(uniforms, samplers, this._defines, this.maxSimultaneousLights);
                 this._effect = scene.getEngine().createEffect(shaderName, attribs, uniforms, samplers, join, fallbacks, this.onCompiled, this.onError, { maxSimultaneousLights: this.maxSimultaneousLights });
                 this._effect = scene.getEngine().createEffect(shaderName, attribs, uniforms, samplers, join, fallbacks, this.onCompiled, this.onError, { maxSimultaneousLights: this.maxSimultaneousLights });
             }
             }
@@ -967,6 +979,9 @@ var BABYLON;
                 this._cameraInfos.x = this.cameraExposure;
                 this._cameraInfos.x = this.cameraExposure;
                 this._cameraInfos.y = this.cameraContrast;
                 this._cameraInfos.y = this.cameraContrast;
                 this._effect.setVector4("vCameraInfos", this._cameraInfos);
                 this._effect.setVector4("vCameraInfos", this._cameraInfos);
+                if (this.cameraColorCurves) {
+                    BABYLON.ColorCurves.Bind(this.cameraColorCurves, this._effect);
+                }
                 this._overloadedIntensity.x = this.overloadedAmbientIntensity;
                 this._overloadedIntensity.x = this.overloadedAmbientIntensity;
                 this._overloadedIntensity.y = this.overloadedAlbedoIntensity;
                 this._overloadedIntensity.y = this.overloadedAlbedoIntensity;
                 this._overloadedIntensity.z = this.overloadedReflectivityIntensity;
                 this._overloadedIntensity.z = this.overloadedReflectivityIntensity;
@@ -1109,6 +1124,9 @@ var BABYLON;
             BABYLON.serializeAsTexture()
             BABYLON.serializeAsTexture()
         ], PBRMaterial.prototype, "cameraColorGradingTexture", void 0);
         ], PBRMaterial.prototype, "cameraColorGradingTexture", void 0);
         __decorate([
         __decorate([
+            BABYLON.serializeAsColorCurves()
+        ], PBRMaterial.prototype, "cameraColorCurves", void 0);
+        __decorate([
             BABYLON.serializeAsColor3()
             BABYLON.serializeAsColor3()
         ], PBRMaterial.prototype, "overloadedAmbient", void 0);
         ], PBRMaterial.prototype, "overloadedAmbient", void 0);
         __decorate([
         __decorate([

+ 21 - 0
src/Math/babylon.math.js

@@ -251,6 +251,27 @@ var BABYLON;
             result.a = this.a * scale;
             result.a = this.a * scale;
             return this;
             return this;
         };
         };
+        /**
+          * Multipy an RGBA Color4 value by another and return a new Color4 object
+          * @param color The Color4 (RGBA) value to multiply by
+          * @returns A new Color4.
+          */
+        Color4.prototype.multiply = function (color) {
+            return new Color4(this.r * color.r, this.g * color.g, this.b * color.b, this.a * color.a);
+        };
+        /**
+         * Multipy an RGBA Color4 value by another and push the result in a reference value
+         * @param color The Color4 (RGBA) value to multiply by
+         * @param result The Color4 (RGBA) to fill the result in
+         * @returns the result Color4.
+         */
+        Color4.prototype.multiplyToRef = function (color, result) {
+            result.r = this.r * color.r;
+            result.g = this.g * color.g;
+            result.b = this.b * color.b;
+            result.a = this.a * color.a;
+            return result;
+        };
         Color4.prototype.toString = function () {
         Color4.prototype.toString = function () {
             return "{R: " + this.r + " G:" + this.g + " B:" + this.b + " A:" + this.a + "}";
             return "{R: " + this.r + " G:" + this.g + " B:" + this.b + " A:" + this.a + "}";
         };
         };

+ 21 - 0
src/Mesh/babylon.abstractMesh.js

@@ -171,6 +171,27 @@ var BABYLON;
             enumerable: true,
             enumerable: true,
             configurable: true
             configurable: true
         });
         });
+        Object.defineProperty(AbstractMesh.prototype, "actionManager", {
+            /**
+             * This scene's action manager
+             * @type {BABYLON.ActionManager}
+            */
+            get: function () {
+                if (!this._actionManager) {
+                    this.actionManager = new BABYLON.ActionManager(this.getScene());
+                }
+                return this._actionManager;
+            },
+            /**
+             * This scene's action manager
+             * @type {BABYLON.ActionManager}
+            */
+            set: function (value) {
+                this._actionManager = value;
+            },
+            enumerable: true,
+            configurable: true
+        });
         Object.defineProperty(AbstractMesh.prototype, "skeleton", {
         Object.defineProperty(AbstractMesh.prototype, "skeleton", {
             get: function () {
             get: function () {
                 return this._skeleton;
                 return this._skeleton;

+ 21 - 1
src/Mesh/babylon.abstractMesh.ts

@@ -95,7 +95,6 @@
         public renderingGroupId = 0;
         public renderingGroupId = 0;
         public material: Material;
         public material: Material;
         public receiveShadows = false;
         public receiveShadows = false;
-        public actionManager: ActionManager;
         public renderOutline = false;
         public renderOutline = false;
         public outlineColor = Color3.Red();
         public outlineColor = Color3.Red();
         public outlineWidth = 0.02;
         public outlineWidth = 0.02;
@@ -117,6 +116,27 @@
 
 
         public alwaysSelectAsActiveMesh = false;
         public alwaysSelectAsActiveMesh = false;
 
 
+        // Actions
+        private _actionManager: ActionManager;
+        /**
+         * This scene's action manager
+         * @type {BABYLON.ActionManager}
+        */
+        public get actionManager(): ActionManager {
+            if (!this._actionManager) {
+                this.actionManager = new ActionManager(this.getScene());
+            }
+
+            return this._actionManager;
+        }
+        /**
+         * This scene's action manager
+         * @type {BABYLON.ActionManager}
+        */
+        public set actionManager(value: ActionManager) {
+            this._actionManager = value;
+        }
+
         // Physics
         // Physics
         public physicsImpostor: BABYLON.PhysicsImpostor;
         public physicsImpostor: BABYLON.PhysicsImpostor;
         //Deprecated, Legacy support
         //Deprecated, Legacy support

+ 12 - 1
src/Tools/babylon.decorators.js

@@ -36,6 +36,10 @@ var BABYLON;
         return generateSerializableMember(6, sourceName); // mesh reference member
         return generateSerializableMember(6, sourceName); // mesh reference member
     }
     }
     BABYLON.serializeAsMeshReference = serializeAsMeshReference;
     BABYLON.serializeAsMeshReference = serializeAsMeshReference;
+    function serializeAsColorCurves(sourceName) {
+        return generateSerializableMember(7, sourceName); // color curves
+    }
+    BABYLON.serializeAsColorCurves = serializeAsColorCurves;
     var SerializationHelper = (function () {
     var SerializationHelper = (function () {
         function SerializationHelper() {
         function SerializationHelper() {
         }
         }
@@ -74,6 +78,9 @@ var BABYLON;
                         case 6:
                         case 6:
                             serializationObject[targetPropertyName] = sourceProperty.id;
                             serializationObject[targetPropertyName] = sourceProperty.id;
                             break;
                             break;
+                        case 7:
+                            serializationObject[targetPropertyName] = sourceProperty.serialize();
+                            break;
                     }
                     }
                 }
                 }
             }
             }
@@ -111,6 +118,9 @@ var BABYLON;
                         case 6:
                         case 6:
                             destination[property] = scene.getLastMeshByID(sourceProperty);
                             destination[property] = scene.getLastMeshByID(sourceProperty);
                             break;
                             break;
+                        case 7:
+                            destination[property] = BABYLON.ColorCurves.Parse(sourceProperty);
+                            break;
                     }
                     }
                 }
                 }
             }
             }
@@ -135,7 +145,8 @@ var BABYLON;
                         case 2: // Color3
                         case 2: // Color3
                         case 3: // FresnelParameters
                         case 3: // FresnelParameters
                         case 4: // Vector2
                         case 4: // Vector2
-                        case 5:
+                        case 5: // Vector3
+                        case 7:
                             destination[property] = sourceProperty.clone();
                             destination[property] = sourceProperty.clone();
                             break;
                             break;
                     }
                     }

+ 5 - 9
src/Tools/babylon.tools.js

@@ -212,15 +212,11 @@ var BABYLON;
                 window.setTimeout(func, 16);
                 window.setTimeout(func, 16);
             }
             }
         };
         };
-        Tools.RequestFullscreen = function (element) {
-            if (element.requestFullscreen)
-                element.requestFullscreen();
-            else if (element.msRequestFullscreen)
-                element.msRequestFullscreen();
-            else if (element.webkitRequestFullscreen)
-                element.webkitRequestFullscreen();
-            else if (element.mozRequestFullScreen)
-                element.mozRequestFullScreen();
+        Tools.RequestFullscreen = function (element, options) {
+            var requestFunction = element.requestFullscreen || element.msRequestFullscreen || element.webkitRequestFullscreen || element.mozRequestFullScreen;
+            if (!requestFunction)
+                return;
+            requestFunction.call(element, options);
         };
         };
         Tools.ExitFullscreen = function () {
         Tools.ExitFullscreen = function () {
             if (document.exitFullscreen) {
             if (document.exitFullscreen) {

+ 3 - 2
src/babylon.engine.js

@@ -563,14 +563,15 @@ var BABYLON;
         /**
         /**
          * Toggle full screen mode.
          * Toggle full screen mode.
          * @param {boolean} requestPointerLock - should a pointer lock be requested from the user
          * @param {boolean} requestPointerLock - should a pointer lock be requested from the user
+         * @param {any} options - an options object to be sent to the requestFullscreen function
          */
          */
-        Engine.prototype.switchFullscreen = function (requestPointerLock) {
+        Engine.prototype.switchFullscreen = function (requestPointerLock, options) {
             if (this.isFullscreen) {
             if (this.isFullscreen) {
                 BABYLON.Tools.ExitFullscreen();
                 BABYLON.Tools.ExitFullscreen();
             }
             }
             else {
             else {
                 this._pointerLockRequested = requestPointerLock;
                 this._pointerLockRequested = requestPointerLock;
-                BABYLON.Tools.RequestFullscreen(this._renderingCanvas);
+                BABYLON.Tools.RequestFullscreen(this._renderingCanvas, options);
             }
             }
         };
         };
         Engine.prototype.clear = function (color, backBuffer, depthStencil) {
         Engine.prototype.clear = function (color, backBuffer, depthStencil) {

+ 21 - 0
src/babylon.scene.js

@@ -395,6 +395,27 @@ var BABYLON;
             enumerable: true,
             enumerable: true,
             configurable: true
             configurable: true
         });
         });
+        Object.defineProperty(Scene.prototype, "actionManager", {
+            /**
+             * This scene's action manager
+             * @type {BABYLON.ActionManager}
+            */
+            get: function () {
+                if (!this._sceneActionManager) {
+                    this.actionManager = new BABYLON.ActionManager(this);
+                }
+                return this._sceneActionManager;
+            },
+            /**
+             * This scene's action manager
+             * @type {BABYLON.ActionManager}
+            */
+            set: function (value) {
+                this._sceneActionManager = value;
+            },
+            enumerable: true,
+            configurable: true
+        });
         Object.defineProperty(Scene.prototype, "debugLayer", {
         Object.defineProperty(Scene.prototype, "debugLayer", {
             // Properties
             // Properties
             get: function () {
             get: function () {

+ 18 - 2
src/babylon.scene.ts

@@ -388,11 +388,27 @@
         public database; //ANY
         public database; //ANY
 
 
         // Actions
         // Actions
+
+        private _sceneActionManager: ActionManager;
         /**
         /**
          * This scene's action manager
          * This scene's action manager
          * @type {BABYLON.ActionManager}
          * @type {BABYLON.ActionManager}
-         */
-        public actionManager: ActionManager;
+        */
+        public get actionManager(): ActionManager {
+            if (!this._sceneActionManager) {
+                this.actionManager = new ActionManager(this);
+            }
+
+            return this._sceneActionManager;
+        }
+        /**
+         * This scene's action manager
+         * @type {BABYLON.ActionManager}
+        */
+        public set actionManager(value: ActionManager) {
+            this._sceneActionManager = value;
+        }
+
         public _actionManagers = new Array<ActionManager>();
         public _actionManagers = new Array<ActionManager>();
         private _meshesForIntersections = new SmartArray<AbstractMesh>(256);
         private _meshesForIntersections = new SmartArray<AbstractMesh>(256);