Browse Source

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

nockawa 9 years ago
parent
commit
c7f30bdf21

+ 2 - 1
Exporters/Blender/readme.md

@@ -3,7 +3,8 @@ Blender to Babylon.js exporter
 
 The [Blender export plugin](http://blogs.msdn.com/b/eternalcoding/archive/2013/06/28/babylon-js-how-to-load-a-babylon-file-produced-with-blender.aspx) supports the following features:
 
-For a discussion of Tower of Babel exporter, along with the difference this exporter, [See]{https://github.com/BabylonJS/Extensions/tree/master/QueuedInterpolation/Blender}
+For a discussion of Tower of Babel exporter, along with the difference this exporter, see [ToB readme](https://github.com/BabylonJS/Extensions/tree/master/QueuedInterpolation/Blender).
+
 * **Cameras**
  * Name
  * Position

+ 4 - 0
Tools/Gulp/gulpfile.js

@@ -13,6 +13,7 @@ var runSequence = require('run-sequence');
 var replace = require("gulp-replace");
 var uncommentShader = require("./gulp-removeShaderComments");
 var expect = require('gulp-expect-file');
+var optimisejs = require('gulp-optimize-js');
 
 var config = require("./config.json");
 
@@ -131,6 +132,7 @@ gulp.task("buildCore", ["shaders"], function () {
         .pipe(replace(decorateSearchRegex, ""))
         .pipe(addModuleExports("BABYLON"))
         .pipe(uglify())
+        .pipe(optimisejs())
         .pipe(gulp.dest(config.build.outputDirectory));
 });
 
@@ -149,6 +151,7 @@ gulp.task("buildNoWorker", ["shaders"], function () {
         .pipe(replace(decorateSearchRegex, ""))
         .pipe(addModuleExports("BABYLON"))
         .pipe(uglify())
+        .pipe(optimisejs())
         .pipe(gulp.dest(config.build.outputDirectory));
 });
 
@@ -170,6 +173,7 @@ gulp.task("build", ["workers", "shaders"], function () {
         .pipe(gulp.dest(config.build.outputDirectory))
         .pipe(rename(config.build.minFilename))
         .pipe(uglify())
+        .pipe(optimisejs())
         .pipe(gulp.dest(config.build.outputDirectory));
 });
 

+ 2 - 1
Tools/Gulp/package.json

@@ -22,6 +22,7 @@
     "run-sequence": "~1.1.0",
     "gulp-replace": "~0.5.3",
     "gulp-content-to-variable": "^0.1.0",
-    "gulp-expect-file": "^0.0.7"
+    "gulp-expect-file": "^0.0.7",
+    "gulp-optimize-js": "^1.0.2"
   }
 }

File diff suppressed because it is too large
+ 23 - 23
dist/preview release/babylon.core.js


File diff suppressed because it is too large
+ 573 - 571
dist/preview release/babylon.d.ts


File diff suppressed because it is too large
+ 43 - 43
dist/preview release/babylon.js


+ 51 - 15
dist/preview release/babylon.max.js

@@ -11170,7 +11170,12 @@ var BABYLON;
         PointLight.prototype.transferToEffect = function (effect, positionUniformName) {
             if (this.parent && this.parent.getWorldMatrix) {
                 this.computeTransformedPosition();
-                effect.setFloat4(positionUniformName, this.transformedPosition.x, this.transformedPosition.y, this.transformedPosition.z, 0);
+                if (this.getScene().useRightHandedSystem) {
+                    effect.setFloat4(positionUniformName, -this.transformedPosition.x, -this.transformedPosition.y, -this.transformedPosition.z, 0);
+                }
+                else {
+                    effect.setFloat4(positionUniformName, this.transformedPosition.x, this.transformedPosition.y, this.transformedPosition.z, 0);
+                }
                 return;
             }
             if (this.getScene().useRightHandedSystem) {
@@ -13324,6 +13329,7 @@ var BABYLON;
             if (touchEnabled === void 0) { touchEnabled = true; }
             this.touchEnabled = touchEnabled;
             this.angularSensibility = 2000.0;
+            this._isPointerLock = false;
         }
         FreeCameraMouseInput.prototype.attachControl = function (element, noPreventDefault) {
             var _this = this;
@@ -13335,6 +13341,10 @@ var BABYLON;
                     if (!_this.touchEnabled && evt.pointerType === "touch") {
                         return;
                     }
+                    if (_this._isPointerLock && !engine.isPointerLock) {
+                        _this.previousPosition = null;
+                    }
+                    _this._isPointerLock = engine.isPointerLock;
                     if (p.type === BABYLON.PointerEventTypes.POINTERDOWN) {
                         try {
                             evt.srcElement.setPointerCapture(evt.pointerId);
@@ -13362,19 +13372,11 @@ var BABYLON;
                         }
                     }
                     else if (p.type === BABYLON.PointerEventTypes.POINTERMOVE) {
-                        if (!_this.previousPosition && !engine.isPointerLock) {
+                        if (!_this.previousPosition || engine.isPointerLock) {
                             return;
                         }
-                        var offsetX;
-                        var offsetY;
-                        if (!engine.isPointerLock) {
-                            offsetX = evt.clientX - _this.previousPosition.x;
-                            offsetY = evt.clientY - _this.previousPosition.y;
-                        }
-                        else {
-                            offsetX = evt.movementX || evt.mozMovementX || evt.webkitMovementX || evt.msMovementX || 0;
-                            offsetY = evt.movementY || evt.mozMovementY || evt.webkitMovementY || evt.msMovementY || 0;
-                        }
+                        var offsetX = evt.clientX - _this.previousPosition.x;
+                        var offsetY = evt.clientY - _this.previousPosition.y;
                         if (_this.camera.getScene().useRightHandedSystem) {
                             camera.cameraRotation.y -= offsetX / _this.angularSensibility;
                         }
@@ -13392,12 +13394,36 @@ var BABYLON;
                     }
                 };
             }
+            this._onMouseMove = function (evt) {
+                if (!engine.isPointerLock) {
+                    return;
+                }
+                var offsetX = evt.movementX || evt.mozMovementX || evt.webkitMovementX || evt.msMovementX || 0;
+                var offsetY = evt.movementY || evt.mozMovementY || evt.webkitMovementY || evt.msMovementY || 0;
+                if (_this.camera.getScene().useRightHandedSystem) {
+                    camera.cameraRotation.y -= offsetX / _this.angularSensibility;
+                }
+                else {
+                    camera.cameraRotation.y += offsetX / _this.angularSensibility;
+                }
+                camera.cameraRotation.x += offsetY / _this.angularSensibility;
+                _this.previousPosition = {
+                    x: evt.clientX,
+                    y: evt.clientY
+                };
+                if (!noPreventDefault) {
+                    evt.preventDefault();
+                }
+            };
             this._observer = this.camera.getScene().onPointerObservable.add(this._pointerInput, BABYLON.PointerEventTypes.POINTERDOWN | BABYLON.PointerEventTypes.POINTERUP | BABYLON.PointerEventTypes.POINTERMOVE);
+            element.addEventListener("mousemove", this._onMouseMove, false);
         };
         FreeCameraMouseInput.prototype.detachControl = function (element) {
             if (this._observer && element) {
                 this.camera.getScene().onPointerObservable.remove(this._observer);
+                element.removeEventListener("mousemove", this._onMouseMove);
                 this._observer = null;
+                this._onMouseMove = null;
                 this.previousPosition = null;
             }
         };
@@ -13698,6 +13724,10 @@ var BABYLON;
             window.removeEventListener("deviceorientation", this._deviceOrientation);
         };
         FreeCameraDeviceOrientationInput.prototype.checkInputs = function () {
+            //if no device orientation provided, don't update the rotation.
+            //Only testing against alpha under the assumption thatnorientation will never be so exact when set.
+            if (!this._alpha)
+                return;
             BABYLON.Quaternion.RotationYawPitchRollToRef(BABYLON.Tools.ToRadians(this._alpha), BABYLON.Tools.ToRadians(this._beta), -BABYLON.Tools.ToRadians(this._gamma), this.camera.rotationQuaternion);
             this._camera.rotationQuaternion.multiplyInPlace(this._screenQuaternion);
             this._camera.rotationQuaternion.multiplyInPlace(this._constantTranform);
@@ -26428,6 +26458,9 @@ var BABYLON;
             return SceneLoader._getDefaultPlugin();
         };
         SceneLoader._getPluginForFilename = function (sceneFilename) {
+            if (sceneFilename.name) {
+                sceneFilename = sceneFilename.name;
+            }
             var dotPosition = sceneFilename.lastIndexOf(".");
             var queryStringPosition = sceneFilename.indexOf("?");
             if (queryStringPosition === -1) {
@@ -55227,10 +55260,10 @@ var BABYLON;
                 return false;
             }
             var emitterPosition = this.getEmitterPosition();
-            var direction = emitterPosition.subtract(this._scene.activeCamera.position);
+            var direction = emitterPosition.subtract(this._scene.activeCamera.globalPosition);
             var distance = direction.length();
             direction.normalize();
-            var ray = new BABYLON.Ray(this._scene.activeCamera.position, direction);
+            var ray = new BABYLON.Ray(this._scene.activeCamera.globalPosition, direction);
             var pickInfo = this._scene.pickWithRay(ray, this.meshesSelectionPredicate, true);
             return !pickInfo.hit || pickInfo.distance > distance;
         };
@@ -55388,6 +55421,7 @@ var BABYLON;
         __extends(DeviceOrientationCamera, _super);
         function DeviceOrientationCamera(name, position, scene) {
             _super.call(this, name, position, scene);
+            this._quaternionCache = new BABYLON.Quaternion();
             this.inputs.addDeviceOrientation();
         }
         DeviceOrientationCamera.prototype.getTypeName = function () {
@@ -55395,8 +55429,8 @@ var BABYLON;
         };
         DeviceOrientationCamera.prototype._checkInputs = function () {
             _super.prototype._checkInputs.call(this);
+            this._quaternionCache.copyFrom(this.rotationQuaternion);
             if (this._initialQuaternion) {
-                this._quaternionCache.copyFrom(this.rotationQuaternion);
                 this._initialQuaternion.multiplyToRef(this.rotationQuaternion, this.rotationQuaternion);
             }
         };
@@ -55419,6 +55453,8 @@ var BABYLON;
                 }
             });
             this._initialQuaternion.normalize();
+            //force rotation update
+            this._initialQuaternion.multiplyToRef(this.rotationQuaternion, this.rotationQuaternion);
         };
         return DeviceOrientationCamera;
     })(BABYLON.FreeCamera);

File diff suppressed because it is too large
+ 43 - 43
dist/preview release/babylon.noworker.js


+ 4 - 1
dist/preview release/what's new.md

@@ -1,7 +1,9 @@
 # 2.5.0:
 
 ### Major updates
-- Babylon.js now supports right handed system with ```scene.useRightHandedSystem = true``` ([deltakosh](https://github.com/deltakosh))    
+- Babylon.js now supports right handed system with ```scene.useRightHandedSystem = true``` ([deltakosh](https://github.com/deltakosh))
+- Babylon.js is now compiled with [optimize-js](https://github.com/nolanlawson/optimize-js) to get faster initial load ([deltakosh](https://github.com/deltakosh))
+
 ### Updates
 - New ```Tools.CreateScreenshot``` function will capture all canvas data. Previous implementation is now called `CreateScreenshotUsingRenderTarget` ([deltakosh](https://github.com/deltakosh)) 
 - Cube textures are now cached by texture cache ([deltakosh](https://github.com/deltakosh)) 
@@ -29,6 +31,7 @@
 ### API doc
 
 ### Bug fixes
+- Fixed issue with FreeCamera not working in fullscreen or when pointer locked ([abow](https://github.com/abow))
 - MapTexture: Font Characters are now correctly aligned on Chrome ([nockawa](https://github.com/nockawa))
 - Fixed some missing parameter default values in `MeshBuilder.CreateGroundFromHeightMap()` and `MeshBuilder.CreateTiledGround()` ([jerome](https://github.com/jbousquie))
 - Fixed cross vector calculation in `_computeHeightQuads()` that affected  all the `GroundMesh.getHeightAtCoordinates()` and `GroundMesh.getNormalAtCoordinates()` methods ([jerome](https://github.com/jbousquie))

+ 4 - 0
src/Cameras/Inputs/babylon.freecamera.input.deviceorientation.js

@@ -45,6 +45,10 @@ var BABYLON;
             window.removeEventListener("deviceorientation", this._deviceOrientation);
         };
         FreeCameraDeviceOrientationInput.prototype.checkInputs = function () {
+            //if no device orientation provided, don't update the rotation.
+            //Only testing against alpha under the assumption thatnorientation will never be so exact when set.
+            if (!this._alpha)
+                return;
             BABYLON.Quaternion.RotationYawPitchRollToRef(BABYLON.Tools.ToRadians(this._alpha), BABYLON.Tools.ToRadians(this._beta), -BABYLON.Tools.ToRadians(this._gamma), this.camera.rotationQuaternion);
             this._camera.rotationQuaternion.multiplyInPlace(this._screenQuaternion);
             this._camera.rotationQuaternion.multiplyInPlace(this._constantTranform);

+ 3 - 0
src/Cameras/Inputs/babylon.freecamera.input.deviceorientation.ts

@@ -51,6 +51,9 @@ module BABYLON {
         }
 
         public checkInputs() {
+            //if no device orientation provided, don't update the rotation.
+            //Only testing against alpha under the assumption thatnorientation will never be so exact when set.
+            if(!this._alpha) return;
             Quaternion.RotationYawPitchRollToRef(BABYLON.Tools.ToRadians(this._alpha), BABYLON.Tools.ToRadians(this._beta), -BABYLON.Tools.ToRadians(this._gamma), this.camera.rotationQuaternion)
             this._camera.rotationQuaternion.multiplyInPlace(this._screenQuaternion);
             this._camera.rotationQuaternion.multiplyInPlace(this._constantTranform);

+ 32 - 11
src/Cameras/Inputs/babylon.freecamera.input.mouse.js

@@ -11,6 +11,7 @@ var BABYLON;
             if (touchEnabled === void 0) { touchEnabled = true; }
             this.touchEnabled = touchEnabled;
             this.angularSensibility = 2000.0;
+            this._isPointerLock = false;
         }
         FreeCameraMouseInput.prototype.attachControl = function (element, noPreventDefault) {
             var _this = this;
@@ -22,6 +23,10 @@ var BABYLON;
                     if (!_this.touchEnabled && evt.pointerType === "touch") {
                         return;
                     }
+                    if (_this._isPointerLock && !engine.isPointerLock) {
+                        _this.previousPosition = null;
+                    }
+                    _this._isPointerLock = engine.isPointerLock;
                     if (p.type === BABYLON.PointerEventTypes.POINTERDOWN) {
                         try {
                             evt.srcElement.setPointerCapture(evt.pointerId);
@@ -49,19 +54,11 @@ var BABYLON;
                         }
                     }
                     else if (p.type === BABYLON.PointerEventTypes.POINTERMOVE) {
-                        if (!_this.previousPosition && !engine.isPointerLock) {
+                        if (!_this.previousPosition || engine.isPointerLock) {
                             return;
                         }
-                        var offsetX;
-                        var offsetY;
-                        if (!engine.isPointerLock) {
-                            offsetX = evt.clientX - _this.previousPosition.x;
-                            offsetY = evt.clientY - _this.previousPosition.y;
-                        }
-                        else {
-                            offsetX = evt.movementX || evt.mozMovementX || evt.webkitMovementX || evt.msMovementX || 0;
-                            offsetY = evt.movementY || evt.mozMovementY || evt.webkitMovementY || evt.msMovementY || 0;
-                        }
+                        var offsetX = evt.clientX - _this.previousPosition.x;
+                        var offsetY = evt.clientY - _this.previousPosition.y;
                         if (_this.camera.getScene().useRightHandedSystem) {
                             camera.cameraRotation.y -= offsetX / _this.angularSensibility;
                         }
@@ -79,12 +76,36 @@ var BABYLON;
                     }
                 };
             }
+            this._onMouseMove = function (evt) {
+                if (!engine.isPointerLock) {
+                    return;
+                }
+                var offsetX = evt.movementX || evt.mozMovementX || evt.webkitMovementX || evt.msMovementX || 0;
+                var offsetY = evt.movementY || evt.mozMovementY || evt.webkitMovementY || evt.msMovementY || 0;
+                if (_this.camera.getScene().useRightHandedSystem) {
+                    camera.cameraRotation.y -= offsetX / _this.angularSensibility;
+                }
+                else {
+                    camera.cameraRotation.y += offsetX / _this.angularSensibility;
+                }
+                camera.cameraRotation.x += offsetY / _this.angularSensibility;
+                _this.previousPosition = {
+                    x: evt.clientX,
+                    y: evt.clientY
+                };
+                if (!noPreventDefault) {
+                    evt.preventDefault();
+                }
+            };
             this._observer = this.camera.getScene().onPointerObservable.add(this._pointerInput, BABYLON.PointerEventTypes.POINTERDOWN | BABYLON.PointerEventTypes.POINTERUP | BABYLON.PointerEventTypes.POINTERMOVE);
+            element.addEventListener("mousemove", this._onMouseMove, false);
         };
         FreeCameraMouseInput.prototype.detachControl = function (element) {
             if (this._observer && element) {
                 this.camera.getScene().onPointerObservable.remove(this._observer);
+                element.removeEventListener("mousemove", this._onMouseMove);
                 this._observer = null;
+                this._onMouseMove = null;
                 this.previousPosition = null;
             }
         };

+ 35 - 14
src/Cameras/Inputs/babylon.freecamera.input.mouse.ts

@@ -6,10 +6,11 @@ module BABYLON {
         public angularSensibility = 2000.0;
 
         private _pointerInput: (p: PointerInfo, s: EventState) => void;
+        private _onMouseMove: (e: MouseEvent) => any;
         private _observer: Observer<PointerInfo>;
 
         private previousPosition: { x: number, y: number };
-
+        
         constructor(public touchEnabled = true) {
         }
 
@@ -55,26 +56,19 @@ module BABYLON {
                     }
 
                     else if (p.type === PointerEventTypes.POINTERMOVE) {
-                        if (!this.previousPosition && !engine.isPointerLock) {
+                        if (!this.previousPosition || engine.isPointerLock) {
                             return;
                         }
 
-                        var offsetX;
-                        var offsetY;
-
-                        if (!engine.isPointerLock) {
-                            offsetX = evt.clientX - this.previousPosition.x;
-                            offsetY = evt.clientY - this.previousPosition.y;
-                        } else {
-                            offsetX = evt.movementX || evt.mozMovementX || evt.webkitMovementX || evt.msMovementX || 0;
-                            offsetY = evt.movementY || evt.mozMovementY || evt.webkitMovementY || evt.msMovementY || 0;
-                        }
-
+                        var offsetX = evt.clientX - this.previousPosition.x;
+                        var offsetY = evt.clientY - this.previousPosition.y;
+                        
                         if (this.camera.getScene().useRightHandedSystem) {
                             camera.cameraRotation.y -= offsetX / this.angularSensibility;
                         } else {
                             camera.cameraRotation.y += offsetX / this.angularSensibility;                            
                         }
+
                         camera.cameraRotation.x += offsetY / this.angularSensibility;
 
                         this.previousPosition = {
@@ -89,14 +83,41 @@ module BABYLON {
                 }
             }
 
+            this._onMouseMove = evt => {
+                if (!engine.isPointerLock) {
+                    return;
+                }
+
+                var offsetX = evt.movementX || evt.mozMovementX || evt.webkitMovementX || evt.msMovementX || 0;
+                var offsetY = evt.movementY || evt.mozMovementY || evt.webkitMovementY || evt.msMovementY || 0;
+
+                if (this.camera.getScene().useRightHandedSystem) {
+                    camera.cameraRotation.y -= offsetX / this.angularSensibility;
+                } else {
+                    camera.cameraRotation.y += offsetX / this.angularSensibility;                            
+                }
+                
+                camera.cameraRotation.x += offsetY / this.angularSensibility;
+
+                this.previousPosition = null;
+                
+                if (!noPreventDefault) {
+                    evt.preventDefault();
+                }
+            };
+
             this._observer = this.camera.getScene().onPointerObservable.add(this._pointerInput, PointerEventTypes.POINTERDOWN | PointerEventTypes.POINTERUP | PointerEventTypes.POINTERMOVE);
+            element.addEventListener("mousemove", this._onMouseMove, false);
+
         }
 
         detachControl(element: HTMLElement) {
             if (this._observer && element) {
                 this.camera.getScene().onPointerObservable.remove(this._observer);
-                this._observer = null;
+                element.removeEventListener("mousemove", this._onMouseMove);
 
+                this._observer = null;
+                this._onMouseMove = null;
                 this.previousPosition = null;
             }
         }

+ 4 - 1
src/Cameras/babylon.deviceOrientationCamera.js

@@ -10,6 +10,7 @@ var BABYLON;
         __extends(DeviceOrientationCamera, _super);
         function DeviceOrientationCamera(name, position, scene) {
             _super.call(this, name, position, scene);
+            this._quaternionCache = new BABYLON.Quaternion();
             this.inputs.addDeviceOrientation();
         }
         DeviceOrientationCamera.prototype.getTypeName = function () {
@@ -17,8 +18,8 @@ var BABYLON;
         };
         DeviceOrientationCamera.prototype._checkInputs = function () {
             _super.prototype._checkInputs.call(this);
+            this._quaternionCache.copyFrom(this.rotationQuaternion);
             if (this._initialQuaternion) {
-                this._quaternionCache.copyFrom(this.rotationQuaternion);
                 this._initialQuaternion.multiplyToRef(this.rotationQuaternion, this.rotationQuaternion);
             }
         };
@@ -41,6 +42,8 @@ var BABYLON;
                 }
             });
             this._initialQuaternion.normalize();
+            //force rotation update
+            this._initialQuaternion.multiplyToRef(this.rotationQuaternion, this.rotationQuaternion);
         };
         return DeviceOrientationCamera;
     })(BABYLON.FreeCamera);

+ 6 - 3
src/Cameras/babylon.deviceOrientationCamera.ts

@@ -7,6 +7,7 @@ module BABYLON {
 
         constructor(name: string, position: Vector3, scene: Scene) {
             super(name, position, scene);
+            this._quaternionCache = new Quaternion();
             this.inputs.addDeviceOrientation();
         }
 
@@ -16,18 +17,18 @@ module BABYLON {
 
         public _checkInputs(): void {
             super._checkInputs();
+            this._quaternionCache.copyFrom(this.rotationQuaternion);
             if (this._initialQuaternion) {
-                this._quaternionCache.copyFrom(this.rotationQuaternion);
                 this._initialQuaternion.multiplyToRef(this.rotationQuaternion, this.rotationQuaternion);
             }
         }
 
-        public resetToCurrentRotation(axis: BABYLON.Axis = BABYLON.Axis.Y) {
+        public resetToCurrentRotation(axis: Axis = Axis.Y) {
             //can only work if this camera has a rotation quaternion already.
             if (!this.rotationQuaternion) return;
 
             if (!this._initialQuaternion) {
-                this._initialQuaternion = new BABYLON.Quaternion();
+                this._initialQuaternion = new Quaternion();
             }
 
             this._initialQuaternion.copyFrom(this._quaternionCache || this.rotationQuaternion);
@@ -40,6 +41,8 @@ module BABYLON {
                 }
             });
             this._initialQuaternion.normalize();
+            //force rotation update
+            this._initialQuaternion.multiplyToRef(this.rotationQuaternion, this.rotationQuaternion);
         }
     }
 }

+ 10 - 2
src/Canvas2d/babylon.canvas2d.ts

@@ -412,7 +412,9 @@
             }
 
             // Update the this._primPointerInfo structure we'll send to observers using the PointerEvent data
-            this._updatePointerInfo(eventData, localPosition);
+            if (!this._updatePointerInfo(eventData, localPosition)) {
+                return;
+            }
 
             let capturedPrim = this.getCapturedPrimitive(this._primPointerInfo.pointerId);
 
@@ -451,13 +453,17 @@
             eventState.skipNextObservers = skip;
         }
 
-        private _updatePointerInfo(eventData: PointerInfoBase, localPosition: Vector2) {
+        private _updatePointerInfo(eventData: PointerInfoBase, localPosition: Vector2): boolean {
             let s = this.scale;
             let pii = this._primPointerInfo;
             if (!pii.canvasPointerPos) {
                 pii.canvasPointerPos = Vector2.Zero();
             }
             var camera = this._scene.cameraToUseForPointers || this._scene.activeCamera;
+            if (!camera || !camera.viewport) {
+                return false;
+            }
+
             var engine = this._scene.getEngine();
 
             if (this._isScreenSpace) {
@@ -500,6 +506,8 @@
                 pii.tilt.y = pe.tiltY;
                 pii.isCaptured = this.getCapturedPrimitive(pe.pointerId) !== null;
             }
+
+            return true;
         }
 
         private _updateIntersectionList(mouseLocalPos: Vector2, isCapture: boolean) {

+ 2 - 2
src/LensFlare/babylon.lensFlareSystem.js

@@ -86,10 +86,10 @@ var BABYLON;
                 return false;
             }
             var emitterPosition = this.getEmitterPosition();
-            var direction = emitterPosition.subtract(this._scene.activeCamera.position);
+            var direction = emitterPosition.subtract(this._scene.activeCamera.globalPosition);
             var distance = direction.length();
             direction.normalize();
-            var ray = new BABYLON.Ray(this._scene.activeCamera.position, direction);
+            var ray = new BABYLON.Ray(this._scene.activeCamera.globalPosition, direction);
             var pickInfo = this._scene.pickWithRay(ray, this.meshesSelectionPredicate, true);
             return !pickInfo.hit || pickInfo.distance > distance;
         };

+ 2 - 2
src/LensFlare/babylon.lensFlareSystem.ts

@@ -117,11 +117,11 @@
             }
 
             var emitterPosition = this.getEmitterPosition();
-            var direction = emitterPosition.subtract(this._scene.activeCamera.position);
+            var direction = emitterPosition.subtract(this._scene.activeCamera.globalPosition);
             var distance = direction.length();
             direction.normalize();
 
-            var ray = new Ray(this._scene.activeCamera.position, direction);
+            var ray = new Ray(this._scene.activeCamera.globalPosition, direction);
             var pickInfo = this._scene.pickWithRay(ray, this.meshesSelectionPredicate, true);
 
             return !pickInfo.hit || pickInfo.distance > distance;

+ 6 - 1
src/Lights/babylon.pointLight.js

@@ -33,7 +33,12 @@ var BABYLON;
         PointLight.prototype.transferToEffect = function (effect, positionUniformName) {
             if (this.parent && this.parent.getWorldMatrix) {
                 this.computeTransformedPosition();
-                effect.setFloat4(positionUniformName, this.transformedPosition.x, this.transformedPosition.y, this.transformedPosition.z, 0);
+                if (this.getScene().useRightHandedSystem) {
+                    effect.setFloat4(positionUniformName, -this.transformedPosition.x, -this.transformedPosition.y, -this.transformedPosition.z, 0);
+                }
+                else {
+                    effect.setFloat4(positionUniformName, this.transformedPosition.x, this.transformedPosition.y, this.transformedPosition.z, 0);
+                }
                 return;
             }
             if (this.getScene().useRightHandedSystem) {

+ 13 - 1
src/Lights/babylon.pointLight.ts

@@ -34,7 +34,19 @@
             if (this.parent && this.parent.getWorldMatrix) {
                 this.computeTransformedPosition();
 
-                effect.setFloat4(positionUniformName, this.transformedPosition.x, this.transformedPosition.y, this.transformedPosition.z, 0);
+                if (this.getScene().useRightHandedSystem) {
+                    effect.setFloat4(positionUniformName,
+                        -this.transformedPosition.x,
+                        -this.transformedPosition.y,
+                        -this.transformedPosition.z,
+                        0);
+                } else {
+                    effect.setFloat4(positionUniformName,
+                        this.transformedPosition.x,
+                        this.transformedPosition.y,
+                        this.transformedPosition.z,
+                        0); 
+                }
 
                 return;
             }

+ 3 - 0
src/Loading/babylon.sceneLoader.js

@@ -72,6 +72,9 @@ var BABYLON;
             return SceneLoader._getDefaultPlugin();
         };
         SceneLoader._getPluginForFilename = function (sceneFilename) {
+            if (sceneFilename.name) {
+                sceneFilename = sceneFilename.name;
+            }
             var dotPosition = sceneFilename.lastIndexOf(".");
             var queryStringPosition = sceneFilename.indexOf("?");
             if (queryStringPosition === -1) {

+ 5 - 1
src/Loading/babylon.sceneLoader.ts

@@ -85,7 +85,11 @@
             return SceneLoader._getDefaultPlugin();
         }
 
-        private static _getPluginForFilename(sceneFilename: string): IRegisteredPlugin {
+        private static _getPluginForFilename(sceneFilename: any): IRegisteredPlugin {
+            if (sceneFilename.name) {
+                sceneFilename = sceneFilename.name;
+            }
+
             var dotPosition = sceneFilename.lastIndexOf(".");
 
             var queryStringPosition = sceneFilename.indexOf("?");