Browse Source

Merge remote-tracking branch 'BabylonJS/master'

Raanan Weber 9 years ago
parent
commit
1124394e44
36 changed files with 1083 additions and 895 deletions
  1. 6 6
      Exporters/Blender/io_export_babylon.py
  2. 23 23
      dist/preview release/babylon.core.js
  3. 683 679
      dist/preview release/babylon.d.ts
  4. 29 29
      dist/preview release/babylon.js
  5. 107 30
      dist/preview release/babylon.max.js
  6. 28 28
      dist/preview release/babylon.noworker.js
  7. 1 0
      dist/preview release/what's new.md
  8. 2 2
      materialsLibrary/dist/babylon.fireMaterial.js
  9. 1 1
      materialsLibrary/dist/babylon.fireMaterial.min.js
  10. 2 0
      materialsLibrary/materials/fire/fire.fragment.fx
  11. 4 0
      materialsLibrary/materials/fire/fire.vertex.fx
  12. 1 1
      src/Actions/babylon.action.js
  13. 2 2
      src/Actions/babylon.actionManager.js
  14. 4 4
      src/Actions/babylon.condition.js
  15. 12 12
      src/Actions/babylon.directActions.js
  16. 1 1
      src/Actions/babylon.interpolateValueAction.js
  17. 1 1
      src/Animations/babylon.animatable.js
  18. 4 4
      src/Animations/babylon.animation.js
  19. 13 13
      src/Animations/babylon.easing.js
  20. 1 1
      src/Audio/babylon.analyser.js
  21. 1 1
      src/Audio/babylon.audioEngine.js
  22. 1 1
      src/Audio/babylon.sound.js
  23. 1 1
      src/Audio/babylon.soundtrack.js
  24. 3 1
      src/Cameras/Inputs/babylon.arcrotatecamera.input.mousewheel.ts
  25. 16 7
      src/Cameras/Inputs/babylon.arcrotatecamera.input.pointers.ts
  26. 14 6
      src/Cameras/Inputs/babylon.freecamera.input.mouse.ts
  27. 5 3
      src/Cameras/Inputs/babylon.freecamera.input.touch.ts
  28. 1 1
      src/Debug/babylon.debugLayer.js
  29. 1 1
      src/PostProcess/RenderPipeline/babylon.postProcessRenderEffect.js
  30. 1 1
      src/PostProcess/RenderPipeline/babylon.postProcessRenderPipeline.js
  31. 1 1
      src/PostProcess/RenderPipeline/babylon.postProcessRenderPipelineManager.js
  32. 9 5
      src/Tools/babylon.observable.ts
  33. 2 2
      src/babylon.engine.js
  34. 1 1
      src/babylon.node.js
  35. 61 11
      src/babylon.scene.js
  36. 40 15
      src/babylon.scene.ts

+ 6 - 6
Exporters/Blender/io_export_babylon.py

@@ -1,7 +1,7 @@
 bl_info = {
     'name': 'Babylon.js',
     'author': 'David Catuhe, Jeff Palmer',
-    'version': (4, 4, 2),
+    'version': (4, 4, 3),
     'blender': (2, 75, 0),
     'location': 'File > Export > Babylon.js (.babylon)',
     'description': 'Export Babylon.js scenes (.babylon)',
@@ -601,7 +601,7 @@ class FCurveAnimatable:
                 scaleAnimation = VectorAnimation(object, 'scaling', 'scale')
 
             self.ranges = []
-            frameOffset = bpy.context.scene.frame_start
+            frameOffset = bpy.context.scene.frame_start - 1
 
             for action in bpy.data.actions:
                 # get the range / assigning the action to the object
@@ -1401,7 +1401,7 @@ class Skeleton:
 
         if (skeleton.animation_data):
             self.ranges = []
-            frameOffset = scene.frame_start
+            frameOffset = scene.frame_start - 1
             for action in bpy.data.actions:
                 # get the range / assigning the action to the object
                 animationRange = AnimationRange.actionPrep(skeleton, action, FRAME_BASED_ANIMATION, frameOffset)
@@ -1459,7 +1459,7 @@ class Skeleton:
         file_handler.write(']')
 
         if hasattr(self, 'ranges'):
-            file_handler.write(',"ranges":[')
+            file_handler.write('\n,"ranges":[')
             first = True
             for range in self.ranges:
                 if first != True:
@@ -2232,7 +2232,7 @@ class AnimationRange:
     def __init__(self, name, frames, frameOffset):
         self.name = name
         self.highest_frame = frames[len(frames) - 1]
-        self.frame_start = frameOffset
+        self.frame_start = frameOffset + 1
         self.frame_end   = frameOffset + self.highest_frame
         self.frames = frames
 # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@@ -2320,7 +2320,7 @@ class Animation:
             if first != True:
                 file_handler.write(',')
             first = False
-            file_handler.write('{')
+            file_handler.write('\n{')
             write_int(file_handler, 'frame', self.frames[frame_idx], True)
             value_idx = self.values[frame_idx]
             if self.dataType == ANIMATIONTYPE_MATRIX:

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


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


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


+ 107 - 30
dist/preview release/babylon.max.js

@@ -3091,8 +3091,9 @@ var BABYLON;
     }());
     BABYLON.EventState = EventState;
     var Observer = (function () {
-        function Observer(callback) {
+        function Observer(callback, mask) {
             this.callback = callback;
+            this.mask = mask;
         }
         return Observer;
     }());
@@ -3104,14 +3105,16 @@ var BABYLON;
         /**
          * Create a new Observer with the specified callback
          * @param callback the callback that will be executed for that Observer
+         * @param mash the mask used to filter observers
          * @param insertFirst if true the callback will be inserted at the first position, hence executed before the others ones. If false (default behavior) the callback will be inserted at the last position, executed after all the others already present.
          */
-        Observable.prototype.add = function (callback, insertFirst) {
+        Observable.prototype.add = function (callback, mask, insertFirst) {
+            if (mask === void 0) { mask = -1; }
             if (insertFirst === void 0) { insertFirst = false; }
             if (!callback) {
                 return null;
             }
-            var observer = new Observer(callback);
+            var observer = new Observer(callback, mask);
             if (insertFirst) {
                 this._observers.unshift(observer);
             }
@@ -3148,12 +3151,16 @@ var BABYLON;
         /**
          * Notify all Observers by calling their respective callback with the given data
          * @param eventData
+         * @param mask
          */
-        Observable.prototype.notifyObservers = function (eventData) {
+        Observable.prototype.notifyObservers = function (eventData, mask) {
+            if (mask === void 0) { mask = -1; }
             var state = new EventState();
             for (var _i = 0, _a = this._observers; _i < _a.length; _i++) {
                 var obs = _a[_i];
-                obs.callback(eventData, state);
+                if (obs.mask & mask) {
+                    obs.callback(eventData, state);
+                }
                 if (state.skipNextObervers) {
                     break;
                 }
@@ -11637,8 +11644,12 @@ var BABYLON;
                 var engine = this.camera.getEngine();
                 this._pointerInput = function (p, s) {
                     var evt = p.event;
-                    if (p.type === 1 /* PointerDown */) {
-                        //   evt.srcElement.setPointerCapture(evt.pointerId);
+                    if (p.type === BABYLON.PointerEventTypes.POINTERDOWN) {
+                        try {
+                            evt.srcElement.setPointerCapture(evt.pointerId);
+                        }
+                        catch (e) {
+                        }
                         _this.previousPosition = {
                             x: evt.clientX,
                             y: evt.clientY
@@ -11647,14 +11658,18 @@ var BABYLON;
                             evt.preventDefault();
                         }
                     }
-                    else if (p.type === 2 /* PointerUp */) {
-                        //  evt.srcElement.releasePointerCapture(evt.pointerId);
+                    else if (p.type === BABYLON.PointerEventTypes.POINTERUP) {
+                        try {
+                            evt.srcElement.releasePointerCapture(evt.pointerId);
+                        }
+                        catch (e) {
+                        }
                         _this.previousPosition = null;
                         if (!noPreventDefault) {
                             evt.preventDefault();
                         }
                     }
-                    else if (p.type === 3 /* PointerMove */) {
+                    else if (p.type === BABYLON.PointerEventTypes.POINTERMOVE) {
                         if (!_this.previousPosition && !engine.isPointerLock) {
                             return;
                         }
@@ -11680,7 +11695,7 @@ var BABYLON;
                     }
                 };
             }
-            this._observer = this.camera.getScene().onPointerObservable.add(this._pointerInput);
+            this._observer = this.camera.getScene().onPointerObservable.add(this._pointerInput, BABYLON.PointerEventTypes.POINTERDOWN | BABYLON.PointerEventTypes.POINTERUP | BABYLON.PointerEventTypes.POINTERMOVE);
         };
         FreeCameraMouseInput.prototype.detachControl = function (element) {
             if (this._observer && element) {
@@ -11839,7 +11854,7 @@ var BABYLON;
                 };
                 this._pointerInput = function (p, s) {
                     var evt = p.event;
-                    if (p.type === 1 /* PointerDown */) {
+                    if (p.type === BABYLON.PointerEventTypes.POINTERDOWN) {
                         if (evt.pointerType === "mouse") {
                             return;
                         }
@@ -11856,7 +11871,7 @@ var BABYLON;
                             y: evt.clientY
                         };
                     }
-                    else if (p.type === 2 /* PointerUp */) {
+                    else if (p.type === BABYLON.PointerEventTypes.POINTERUP) {
                         if (evt.pointerType === "mouse") {
                             return;
                         }
@@ -11876,7 +11891,7 @@ var BABYLON;
                         _this._offsetX = null;
                         _this._offsetY = null;
                     }
-                    else if (p.type === 3 /* PointerMove */) {
+                    else if (p.type === BABYLON.PointerEventTypes.POINTERMOVE) {
                         if (evt.pointerType === "mouse") {
                             return;
                         }
@@ -11895,6 +11910,7 @@ var BABYLON;
                     }
                 };
             }
+            this._observer = this.camera.getScene().onPointerObservable.add(this._pointerInput, BABYLON.PointerEventTypes.POINTERDOWN | BABYLON.PointerEventTypes.POINTERUP | BABYLON.PointerEventTypes.POINTERMOVE);
             element.addEventListener("blur", this._onLostFocus);
         };
         FreeCameraTouchInput.prototype.detachControl = function (element) {
@@ -12304,6 +12320,9 @@ var BABYLON;
         ArcRotateCameraMouseWheelInput.prototype.attachControl = function (element, noPreventDefault) {
             var _this = this;
             this._wheel = function (p, s) {
+                //sanity check - this should be a PointerWheel event.
+                if (p.type !== BABYLON.PointerEventTypes.POINTERWHEEL)
+                    return;
                 var event = p.event;
                 var delta = 0;
                 if (event.wheelDelta) {
@@ -12320,7 +12339,7 @@ var BABYLON;
                     }
                 }
             };
-            this._observer = this.camera.getScene().onPointerObservable.add(this._wheel);
+            this._observer = this.camera.getScene().onPointerObservable.add(this._wheel, BABYLON.PointerEventTypes.POINTERWHEEL);
         };
         ArcRotateCameraMouseWheelInput.prototype.detachControl = function (element) {
             if (this._observer && element) {
@@ -12366,8 +12385,12 @@ var BABYLON;
             var previousPinchDistance = 0;
             this._pointerInput = function (p, s) {
                 var evt = p.event;
-                if (p.type === 1 /* PointerDown */) {
-                    evt.srcElement.setPointerCapture(evt.pointerId);
+                if (p.type === BABYLON.PointerEventTypes.POINTERDOWN) {
+                    try {
+                        evt.srcElement.setPointerCapture(evt.pointerId);
+                    }
+                    catch (e) {
+                    }
                     // Manage panning with right click
                     _this._isRightClick = evt.button === 2;
                     // manage pointers
@@ -12377,8 +12400,12 @@ var BABYLON;
                         evt.preventDefault();
                     }
                 }
-                else if (p.type === 2 /* PointerUp */) {
-                    evt.srcElement.releasePointerCapture(evt.pointerId);
+                else if (p.type === BABYLON.PointerEventTypes.POINTERUP) {
+                    try {
+                        evt.srcElement.releasePointerCapture(evt.pointerId);
+                    }
+                    catch (e) {
+                    }
                     cacheSoloPointer = null;
                     previousPinchDistance = 0;
                     //would be better to use pointers.remove(evt.pointerId) for multitouch gestures, 
@@ -12390,7 +12417,7 @@ var BABYLON;
                         evt.preventDefault();
                     }
                 }
-                else if (p.type === 3 /* PointerMove */) {
+                else if (p.type === BABYLON.PointerEventTypes.POINTERMOVE) {
                     if (!noPreventDefault) {
                         evt.preventDefault();
                     }
@@ -12434,7 +12461,7 @@ var BABYLON;
                     }
                 }
             };
-            this._observer = this.camera.getScene().onPointerObservable.add(this._pointerInput);
+            this._observer = this.camera.getScene().onPointerObservable.add(this._pointerInput, BABYLON.PointerEventTypes.POINTERDOWN | BABYLON.PointerEventTypes.POINTERUP | BABYLON.PointerEventTypes.POINTERMOVE);
             this._onContextMenu = function (evt) {
                 evt.preventDefault();
             };
@@ -14092,9 +14119,55 @@ var BABYLON;
 
 var BABYLON;
 (function (BABYLON) {
+    var PointerEventTypes = (function () {
+        function PointerEventTypes() {
+        }
+        Object.defineProperty(PointerEventTypes, "POINTERDOWN", {
+            get: function () {
+                return PointerEventTypes._POINTERDOWN;
+            },
+            enumerable: true,
+            configurable: true
+        });
+        Object.defineProperty(PointerEventTypes, "POINTERUP", {
+            get: function () {
+                return PointerEventTypes._POINTERUP;
+            },
+            enumerable: true,
+            configurable: true
+        });
+        Object.defineProperty(PointerEventTypes, "POINTERMOVE", {
+            get: function () {
+                return PointerEventTypes._POINTERMOVE;
+            },
+            enumerable: true,
+            configurable: true
+        });
+        Object.defineProperty(PointerEventTypes, "POINTERWHEEL", {
+            get: function () {
+                return PointerEventTypes._POINTERWHEEL;
+            },
+            enumerable: true,
+            configurable: true
+        });
+        Object.defineProperty(PointerEventTypes, "POINTERPICK", {
+            get: function () {
+                return PointerEventTypes._POINTERPICK;
+            },
+            enumerable: true,
+            configurable: true
+        });
+        PointerEventTypes._POINTERDOWN = 0x01;
+        PointerEventTypes._POINTERUP = 0x02;
+        PointerEventTypes._POINTERMOVE = 0x04;
+        PointerEventTypes._POINTERWHEEL = 0x08;
+        PointerEventTypes._POINTERPICK = 0x10;
+        return PointerEventTypes;
+    }());
+    BABYLON.PointerEventTypes = PointerEventTypes;
     /**
      * This type contains all the data related to a pointer event in Babylon.js.
-     * The event member is an instnce of PointerEvent for all types except PointerWheel and is of type MouseWheelEvent when type equals PointerWheel
+     * The event member is an instance of PointerEvent for all types except PointerWheel and is of type MouseWheelEvent when type equals PointerWheel. The differents event types can be found in the PointerEventTypes class.
      */
     var PointerInfo = (function () {
         function PointerInfo(type, event, pickInfo) {
@@ -14600,8 +14673,9 @@ var BABYLON;
                     _this.onPointerMove(evt, pickResult);
                 }
                 if (_this.onPointerObservable.hasObservers()) {
-                    var pi = new PointerInfo(evt.type === "mousewheel" ? 4 /* PointerWheel */ : 3 /* PointerMove */, evt, pickResult);
-                    _this.onPointerObservable.notifyObservers(pi);
+                    var type = evt.type === "mousewheel" ? PointerEventTypes.POINTERWHEEL : PointerEventTypes.POINTERMOVE;
+                    var pi = new PointerInfo(type, evt, pickResult);
+                    _this.onPointerObservable.notifyObservers(pi, type);
                 }
             };
             this._onPointerDown = function (evt) {
@@ -14657,8 +14731,9 @@ var BABYLON;
                     _this.onPointerDown(evt, pickResult);
                 }
                 if (_this.onPointerObservable.hasObservers()) {
-                    var pi = new PointerInfo(1 /* PointerDown */, evt, pickResult);
-                    _this.onPointerObservable.notifyObservers(pi);
+                    var type = PointerEventTypes.POINTERDOWN;
+                    var pi = new PointerInfo(type, evt, pickResult);
+                    _this.onPointerObservable.notifyObservers(pi, type);
                 }
                 // Sprites
                 _this._pickedDownSprite = null;
@@ -14701,8 +14776,9 @@ var BABYLON;
                             _this.onPointerPick(evt, pickResult);
                         }
                         if (_this.onPointerObservable.hasObservers()) {
-                            var pi = new PointerInfo(5 /* PointerPick */, evt, pickResult);
-                            _this.onPointerObservable.notifyObservers(pi);
+                            var type = PointerEventTypes.POINTERPICK;
+                            var pi = new PointerInfo(type, evt, pickResult);
+                            _this.onPointerObservable.notifyObservers(pi, type);
                         }
                     }
                     if (pickResult.pickedMesh.actionManager) {
@@ -14719,8 +14795,9 @@ var BABYLON;
                     _this.onPointerUp(evt, pickResult);
                 }
                 if (_this.onPointerObservable.hasObservers()) {
-                    var pi = new PointerInfo(2 /* PointerUp */, evt, pickResult);
-                    _this.onPointerObservable.notifyObservers(pi);
+                    var type = PointerEventTypes.POINTERUP;
+                    var pi = new PointerInfo(type, evt, pickResult);
+                    _this.onPointerObservable.notifyObservers(pi, type);
                 }
                 _this._startingPointerTime = 0;
                 // Sprites

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


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

@@ -30,6 +30,7 @@
     - LinesMesh class now supports Intersection. Added the intersectionThreshold property to set a tolerance margin during intersection with wire lines. ([nockawa](https://github.com/nockawa))
     - Geometry.boundingBias property to enlarge the boundingInfo objects ([nockawa](https://github.com/nockawa))
     - Tools.ExtractMinAndMax & ExtractMinAndMaxIndexed now supports an optional Bias for Extent computation.
+	- Scene.onPointerObservable property added to enable a unique Observable event for user input (see ArcRotateCamera inputs for examples) ([nockawa](https://github.com/nockawa))
 
   - **API doc**
     - class `SolidParticleSystem` documented

File diff suppressed because it is too large
+ 2 - 2
materialsLibrary/dist/babylon.fireMaterial.js


File diff suppressed because it is too large
+ 1 - 1
materialsLibrary/dist/babylon.fireMaterial.min.js


+ 2 - 0
materialsLibrary/materials/fire/fire.fragment.fx

@@ -21,9 +21,11 @@ uniform vec2 vDiffuseInfos;
 uniform sampler2D distortionSampler;
 uniform sampler2D opacitySampler;
 
+#ifdef DIFFUSE
 varying vec2 vDistortionCoords1;
 varying vec2 vDistortionCoords2;
 varying vec2 vDistortionCoords3;
+#endif
 
 #include<clipPlaneFragmentDeclaration>
 

+ 4 - 0
materialsLibrary/materials/fire/fire.vertex.fx

@@ -44,9 +44,11 @@ varying vec4 vColor;
 uniform float time;
 uniform float speed;
 
+#ifdef DIFFUSE
 varying vec2 vDistortionCoords1;
 varying vec2 vDistortionCoords2;
 varying vec2 vDistortionCoords3;
+#endif
 
 void main(void) {
 
@@ -80,6 +82,7 @@ void main(void) {
 	gl_PointSize = pointSize;
 #endif
 
+#ifdef DIFFUSE
 	// Fire
 	vec3 layerSpeed = vec3(-0.2, -0.52, -0.1) * speed;
 	
@@ -91,4 +94,5 @@ void main(void) {
 	
 	vDistortionCoords3.x = uv.x;
 	vDistortionCoords3.y = uv.y + layerSpeed.z * time / 1000.0;
+#endif
 }

+ 1 - 1
src/Actions/babylon.action.js

@@ -67,6 +67,6 @@ var BABYLON;
             return this._actionManager._getEffectiveTarget(target, propertyPath);
         };
         return Action;
-    }());
+    })();
     BABYLON.Action = Action;
 })(BABYLON || (BABYLON = {}));

+ 2 - 2
src/Actions/babylon.actionManager.js

@@ -47,7 +47,7 @@ var BABYLON;
             return new ActionEvent(null, scene.pointerX, scene.pointerY, scene.meshUnderPointer, evt);
         };
         return ActionEvent;
-    }());
+    })();
     BABYLON.ActionEvent = ActionEvent;
     /**
      * Action Manager manages all events to be triggered on a given mesh or the global scene.
@@ -468,6 +468,6 @@ var BABYLON;
         ActionManager.DragMovementThreshold = 10; // in pixels
         ActionManager.LongPressDelay = 500; // in milliseconds
         return ActionManager;
-    }());
+    })();
     BABYLON.ActionManager = ActionManager;
 })(BABYLON || (BABYLON = {}));

+ 4 - 4
src/Actions/babylon.condition.js

@@ -19,7 +19,7 @@ var BABYLON;
             return this._actionManager._getEffectiveTarget(target, propertyPath);
         };
         return Condition;
-    }());
+    })();
     BABYLON.Condition = Condition;
     var ValueCondition = (function (_super) {
         __extends(ValueCondition, _super);
@@ -86,7 +86,7 @@ var BABYLON;
         ValueCondition._IsGreater = 2;
         ValueCondition._IsLesser = 3;
         return ValueCondition;
-    }(Condition));
+    })(Condition);
     BABYLON.ValueCondition = ValueCondition;
     var PredicateCondition = (function (_super) {
         __extends(PredicateCondition, _super);
@@ -98,7 +98,7 @@ var BABYLON;
             return this.predicate();
         };
         return PredicateCondition;
-    }(Condition));
+    })(Condition);
     BABYLON.PredicateCondition = PredicateCondition;
     var StateCondition = (function (_super) {
         __extends(StateCondition, _super);
@@ -112,6 +112,6 @@ var BABYLON;
             return this._target.state === this.value;
         };
         return StateCondition;
-    }(Condition));
+    })(Condition);
     BABYLON.StateCondition = StateCondition;
 })(BABYLON || (BABYLON = {}));

+ 12 - 12
src/Actions/babylon.directActions.js

@@ -20,7 +20,7 @@ var BABYLON;
             this._target[this._property] = !this._target[this._property];
         };
         return SwitchBooleanAction;
-    }(BABYLON.Action));
+    })(BABYLON.Action);
     BABYLON.SwitchBooleanAction = SwitchBooleanAction;
     var SetStateAction = (function (_super) {
         __extends(SetStateAction, _super);
@@ -33,7 +33,7 @@ var BABYLON;
             this._target.state = this.value;
         };
         return SetStateAction;
-    }(BABYLON.Action));
+    })(BABYLON.Action);
     BABYLON.SetStateAction = SetStateAction;
     var SetValueAction = (function (_super) {
         __extends(SetValueAction, _super);
@@ -51,7 +51,7 @@ var BABYLON;
             this._target[this._property] = this.value;
         };
         return SetValueAction;
-    }(BABYLON.Action));
+    })(BABYLON.Action);
     BABYLON.SetValueAction = SetValueAction;
     var IncrementValueAction = (function (_super) {
         __extends(IncrementValueAction, _super);
@@ -72,7 +72,7 @@ var BABYLON;
             this._target[this._property] += this.value;
         };
         return IncrementValueAction;
-    }(BABYLON.Action));
+    })(BABYLON.Action);
     BABYLON.IncrementValueAction = IncrementValueAction;
     var PlayAnimationAction = (function (_super) {
         __extends(PlayAnimationAction, _super);
@@ -90,7 +90,7 @@ var BABYLON;
             scene.beginAnimation(this._target, this.from, this.to, this.loop);
         };
         return PlayAnimationAction;
-    }(BABYLON.Action));
+    })(BABYLON.Action);
     BABYLON.PlayAnimationAction = PlayAnimationAction;
     var StopAnimationAction = (function (_super) {
         __extends(StopAnimationAction, _super);
@@ -105,7 +105,7 @@ var BABYLON;
             scene.stopAnimation(this._target);
         };
         return StopAnimationAction;
-    }(BABYLON.Action));
+    })(BABYLON.Action);
     BABYLON.StopAnimationAction = StopAnimationAction;
     var DoNothingAction = (function (_super) {
         __extends(DoNothingAction, _super);
@@ -116,7 +116,7 @@ var BABYLON;
         DoNothingAction.prototype.execute = function () {
         };
         return DoNothingAction;
-    }(BABYLON.Action));
+    })(BABYLON.Action);
     BABYLON.DoNothingAction = DoNothingAction;
     var CombineAction = (function (_super) {
         __extends(CombineAction, _super);
@@ -136,7 +136,7 @@ var BABYLON;
             }
         };
         return CombineAction;
-    }(BABYLON.Action));
+    })(BABYLON.Action);
     BABYLON.CombineAction = CombineAction;
     var ExecuteCodeAction = (function (_super) {
         __extends(ExecuteCodeAction, _super);
@@ -148,7 +148,7 @@ var BABYLON;
             this.func(evt);
         };
         return ExecuteCodeAction;
-    }(BABYLON.Action));
+    })(BABYLON.Action);
     BABYLON.ExecuteCodeAction = ExecuteCodeAction;
     var SetParentAction = (function (_super) {
         __extends(SetParentAction, _super);
@@ -169,7 +169,7 @@ var BABYLON;
             this._target.parent = this._parent;
         };
         return SetParentAction;
-    }(BABYLON.Action));
+    })(BABYLON.Action);
     BABYLON.SetParentAction = SetParentAction;
     var PlaySoundAction = (function (_super) {
         __extends(PlaySoundAction, _super);
@@ -184,7 +184,7 @@ var BABYLON;
                 this._sound.play();
         };
         return PlaySoundAction;
-    }(BABYLON.Action));
+    })(BABYLON.Action);
     BABYLON.PlaySoundAction = PlaySoundAction;
     var StopSoundAction = (function (_super) {
         __extends(StopSoundAction, _super);
@@ -199,6 +199,6 @@ var BABYLON;
                 this._sound.stop();
         };
         return StopSoundAction;
-    }(BABYLON.Action));
+    })(BABYLON.Action);
     BABYLON.StopSoundAction = StopSoundAction;
 })(BABYLON || (BABYLON = {}));

+ 1 - 1
src/Actions/babylon.interpolateValueAction.js

@@ -60,6 +60,6 @@ var BABYLON;
             scene.beginDirectAnimation(this._target, [animation], 0, 100, false, 1, this.onInterpolationDone);
         };
         return InterpolateValueAction;
-    }(BABYLON.Action));
+    })(BABYLON.Action);
     BABYLON.InterpolateValueAction = InterpolateValueAction;
 })(BABYLON || (BABYLON = {}));

+ 1 - 1
src/Animations/babylon.animatable.js

@@ -127,6 +127,6 @@ var BABYLON;
             return running;
         };
         return Animatable;
-    }());
+    })();
     BABYLON.Animatable = Animatable;
 })(BABYLON || (BABYLON = {}));

+ 4 - 4
src/Animations/babylon.animation.js

@@ -10,7 +10,7 @@ var BABYLON;
             return new AnimationRange(this.name, this.from, this.to);
         };
         return AnimationRange;
-    }());
+    })();
     BABYLON.AnimationRange = AnimationRange;
     /**
      * Composed of a frame, and an action function
@@ -23,7 +23,7 @@ var BABYLON;
             this.isDone = false;
         }
         return AnimationEvent;
-    }());
+    })();
     BABYLON.AnimationEvent = AnimationEvent;
     var PathCursor = (function () {
         function PathCursor(path) {
@@ -80,7 +80,7 @@ var BABYLON;
             return this;
         };
         return PathCursor;
-    }());
+    })();
     BABYLON.PathCursor = PathCursor;
     var Animation = (function () {
         function Animation(name, targetProperty, framePerSecond, dataType, loopMode, enableBlending) {
@@ -697,6 +697,6 @@ var BABYLON;
         Animation._ANIMATIONLOOPMODE_CYCLE = 1;
         Animation._ANIMATIONLOOPMODE_CONSTANT = 2;
         return Animation;
-    }());
+    })();
     BABYLON.Animation = Animation;
 })(BABYLON || (BABYLON = {}));

+ 13 - 13
src/Animations/babylon.easing.js

@@ -58,7 +58,7 @@ var BABYLON;
         EasingFunction._EASINGMODE_EASEOUT = 1;
         EasingFunction._EASINGMODE_EASEINOUT = 2;
         return EasingFunction;
-    }());
+    })();
     BABYLON.EasingFunction = EasingFunction;
     var CircleEase = (function (_super) {
         __extends(CircleEase, _super);
@@ -70,7 +70,7 @@ var BABYLON;
             return (1.0 - Math.sqrt(1.0 - (gradient * gradient)));
         };
         return CircleEase;
-    }(EasingFunction));
+    })(EasingFunction);
     BABYLON.CircleEase = CircleEase;
     var BackEase = (function (_super) {
         __extends(BackEase, _super);
@@ -84,7 +84,7 @@ var BABYLON;
             return (Math.pow(gradient, 3.0) - ((gradient * num) * Math.sin(3.1415926535897931 * gradient)));
         };
         return BackEase;
-    }(EasingFunction));
+    })(EasingFunction);
     BABYLON.BackEase = BackEase;
     var BounceEase = (function (_super) {
         __extends(BounceEase, _super);
@@ -116,7 +116,7 @@ var BABYLON;
             return (((-Math.pow(1.0 / bounciness, y - num3) / (num2 * num2)) * (num6 - num2)) * (num6 + num2));
         };
         return BounceEase;
-    }(EasingFunction));
+    })(EasingFunction);
     BABYLON.BounceEase = BounceEase;
     var CubicEase = (function (_super) {
         __extends(CubicEase, _super);
@@ -127,7 +127,7 @@ var BABYLON;
             return (gradient * gradient * gradient);
         };
         return CubicEase;
-    }(EasingFunction));
+    })(EasingFunction);
     BABYLON.CubicEase = CubicEase;
     var ElasticEase = (function (_super) {
         __extends(ElasticEase, _super);
@@ -151,7 +151,7 @@ var BABYLON;
             return (num2 * Math.sin(((6.2831853071795862 * num3) + 1.5707963267948966) * gradient));
         };
         return ElasticEase;
-    }(EasingFunction));
+    })(EasingFunction);
     BABYLON.ElasticEase = ElasticEase;
     var ExponentialEase = (function (_super) {
         __extends(ExponentialEase, _super);
@@ -167,7 +167,7 @@ var BABYLON;
             return ((Math.exp(this.exponent * gradient) - 1.0) / (Math.exp(this.exponent) - 1.0));
         };
         return ExponentialEase;
-    }(EasingFunction));
+    })(EasingFunction);
     BABYLON.ExponentialEase = ExponentialEase;
     var PowerEase = (function (_super) {
         __extends(PowerEase, _super);
@@ -181,7 +181,7 @@ var BABYLON;
             return Math.pow(gradient, y);
         };
         return PowerEase;
-    }(EasingFunction));
+    })(EasingFunction);
     BABYLON.PowerEase = PowerEase;
     var QuadraticEase = (function (_super) {
         __extends(QuadraticEase, _super);
@@ -192,7 +192,7 @@ var BABYLON;
             return (gradient * gradient);
         };
         return QuadraticEase;
-    }(EasingFunction));
+    })(EasingFunction);
     BABYLON.QuadraticEase = QuadraticEase;
     var QuarticEase = (function (_super) {
         __extends(QuarticEase, _super);
@@ -203,7 +203,7 @@ var BABYLON;
             return (gradient * gradient * gradient * gradient);
         };
         return QuarticEase;
-    }(EasingFunction));
+    })(EasingFunction);
     BABYLON.QuarticEase = QuarticEase;
     var QuinticEase = (function (_super) {
         __extends(QuinticEase, _super);
@@ -214,7 +214,7 @@ var BABYLON;
             return (gradient * gradient * gradient * gradient * gradient);
         };
         return QuinticEase;
-    }(EasingFunction));
+    })(EasingFunction);
     BABYLON.QuinticEase = QuinticEase;
     var SineEase = (function (_super) {
         __extends(SineEase, _super);
@@ -225,7 +225,7 @@ var BABYLON;
             return (1.0 - Math.sin(1.5707963267948966 * (1.0 - gradient)));
         };
         return SineEase;
-    }(EasingFunction));
+    })(EasingFunction);
     BABYLON.SineEase = SineEase;
     var BezierCurveEase = (function (_super) {
         __extends(BezierCurveEase, _super);
@@ -244,6 +244,6 @@ var BABYLON;
             return BABYLON.BezierCurve.interpolate(gradient, this.x1, this.y1, this.x2, this.y2);
         };
         return BezierCurveEase;
-    }(EasingFunction));
+    })(EasingFunction);
     BABYLON.BezierCurveEase = BezierCurveEase;
 })(BABYLON || (BABYLON = {}));

+ 1 - 1
src/Audio/babylon.analyser.js

@@ -106,6 +106,6 @@ var BABYLON;
             }
         };
         return Analyser;
-    }());
+    })();
     BABYLON.Analyser = Analyser;
 })(BABYLON || (BABYLON = {}));

+ 1 - 1
src/Audio/babylon.audioEngine.js

@@ -101,6 +101,6 @@ var BABYLON;
             }
         };
         return AudioEngine;
-    }());
+    })();
     BABYLON.AudioEngine = AudioEngine;
 })(BABYLON || (BABYLON = {}));

+ 1 - 1
src/Audio/babylon.sound.js

@@ -547,6 +547,6 @@ var BABYLON;
             return newSound;
         };
         return Sound;
-    }());
+    })();
     BABYLON.Sound = Sound;
 })(BABYLON || (BABYLON = {}));

+ 1 - 1
src/Audio/babylon.soundtrack.js

@@ -96,6 +96,6 @@ var BABYLON;
             }
         };
         return SoundTrack;
-    }());
+    })();
     BABYLON.SoundTrack = SoundTrack;
 })(BABYLON || (BABYLON = {}));

+ 3 - 1
src/Cameras/Inputs/babylon.arcrotatecamera.input.mousewheel.ts

@@ -10,6 +10,8 @@ module BABYLON {
 
         public attachControl(element: HTMLElement, noPreventDefault?: boolean) {
             this._wheel = (p, s) => {
+                //sanity check - this should be a PointerWheel event.
+                if (p.type !== PointerEventTypes.POINTERWHEEL) return;
                 var event = <MouseWheelEvent>p.event;
                 var delta = 0;
                 if (event.wheelDelta) {
@@ -28,7 +30,7 @@ module BABYLON {
                 }
             };
 
-            this._observer = this.camera.getScene().onPointerObservable.add(this._wheel);
+            this._observer = this.camera.getScene().onPointerObservable.add(this._wheel, PointerEventTypes.POINTERWHEEL);
         }
 
         public detachControl(element: HTMLElement) {

+ 16 - 7
src/Cameras/Inputs/babylon.arcrotatecamera.input.pointers.ts

@@ -39,8 +39,13 @@ module BABYLON {
 
             this._pointerInput = (p, s) => {
                 var evt = <PointerEvent>p.event;
-                if (p.type === PointerEventType.PointerDown) {
-                   // evt.srcElement.setPointerCapture(evt.pointerId);
+                if (p.type === PointerEventTypes.POINTERDOWN) {
+                    try {
+                        evt.srcElement.setPointerCapture(evt.pointerId);
+                    } catch (e) {
+                        //Nothing to do with the error. Execution will continue.
+                    }
+
 
                     // Manage panning with right click
                     this._isRightClick = evt.button === 2;
@@ -51,9 +56,13 @@ module BABYLON {
                     if (!noPreventDefault) {
                         evt.preventDefault();
                     }
-                } else if (p.type === PointerEventType.PointerUp) {
-                   // evt.srcElement.releasePointerCapture(evt.pointerId);
-
+                } else if (p.type === PointerEventTypes.POINTERUP) {
+                    try {
+                        evt.srcElement.releasePointerCapture(evt.pointerId);
+                    } catch (e) {
+                        //Nothing to do with the error.
+                    }
+                    
                     cacheSoloPointer = null;
                     previousPinchDistance = 0;
 
@@ -66,7 +75,7 @@ module BABYLON {
                     if (!noPreventDefault) {
                         evt.preventDefault();
                     }
-                } else if (p.type === PointerEventType.PointerMove) {
+                } else if (p.type === PointerEventTypes.POINTERMOVE) {
                     if (!noPreventDefault) {
                         evt.preventDefault();
                     }
@@ -114,7 +123,7 @@ module BABYLON {
                 }
             }
 
-            this._observer = this.camera.getScene().onPointerObservable.add(this._pointerInput);
+            this._observer = this.camera.getScene().onPointerObservable.add(this._pointerInput, PointerEventTypes.POINTERDOWN | PointerEventTypes.POINTERUP | PointerEventTypes.POINTERMOVE);
 
             this._onContextMenu = evt => {
                 evt.preventDefault();

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

@@ -17,8 +17,12 @@ module BABYLON {
                 var engine = this.camera.getEngine();
                 this._pointerInput = (p, s) => {
                     var evt = <PointerEvent>p.event;
-                    if (p.type === PointerEventType.PointerDown) {
-                     //   evt.srcElement.setPointerCapture(evt.pointerId);
+                    if (p.type === PointerEventTypes.POINTERDOWN) {
+                        try {
+                            evt.srcElement.setPointerCapture(evt.pointerId);
+                        } catch (e) {
+                            //Nothing to do with the error. Execution will continue.
+                        }
 
                         this.previousPosition = {
                             x: evt.clientX,
@@ -29,15 +33,19 @@ module BABYLON {
                             evt.preventDefault();
                         }
                     }
-                    else if (p.type === PointerEventType.PointerUp) {
-                      //  evt.srcElement.releasePointerCapture(evt.pointerId);
+                    else if (p.type === PointerEventTypes.POINTERUP) {
+                        try {
+                            evt.srcElement.releasePointerCapture(evt.pointerId);
+                        } catch (e) {
+                            //Nothing to do with the error.
+                        }
                         this.previousPosition = null;
                         if (!noPreventDefault) {
                             evt.preventDefault();
                         }
                     }
 
-                    else if (p.type === PointerEventType.PointerMove) {
+                    else if (p.type === PointerEventTypes.POINTERMOVE) {
                         if (!this.previousPosition && !engine.isPointerLock) {
                             return;
                         }
@@ -68,7 +76,7 @@ module BABYLON {
                 }
             }
 
-            this._observer = this.camera.getScene().onPointerObservable.add(this._pointerInput);
+            this._observer = this.camera.getScene().onPointerObservable.add(this._pointerInput, PointerEventTypes.POINTERDOWN | PointerEventTypes.POINTERUP | PointerEventTypes.POINTERMOVE);
         }
 
         detachControl(element: HTMLElement) {

+ 5 - 3
src/Cameras/Inputs/babylon.freecamera.input.touch.ts

@@ -27,7 +27,7 @@ module BABYLON {
 
                 this._pointerInput = (p, s) => {
                     var evt = <PointerEvent>p.event;
-                    if (p.type === PointerEventType.PointerDown) {
+                    if (p.type === PointerEventTypes.POINTERDOWN) {
                         if (evt.pointerType === "mouse") {
                             return;
                         }
@@ -49,7 +49,7 @@ module BABYLON {
                         };
                     }
 
-                    else if (p.type === PointerEventType.PointerUp) {
+                    else if (p.type === PointerEventTypes.POINTERUP) {
                         if (evt.pointerType === "mouse") {
                             return;
                         }
@@ -74,7 +74,7 @@ module BABYLON {
                         this._offsetY = null;
                     }
 
-                    else if (p.type === PointerEventType.PointerMove) {
+                    else if (p.type === PointerEventTypes.POINTERMOVE) {
                         if (evt.pointerType === "mouse") {
                             return;
                         }
@@ -99,6 +99,8 @@ module BABYLON {
                 }
             }
 
+            this._observer = this.camera.getScene().onPointerObservable.add(this._pointerInput, PointerEventTypes.POINTERDOWN | PointerEventTypes.POINTERUP | PointerEventTypes.POINTERMOVE);
+
             element.addEventListener("blur", this._onLostFocus);
         }
 

+ 1 - 1
src/Debug/babylon.debugLayer.js

@@ -674,6 +674,6 @@ var BABYLON;
             }
         };
         return DebugLayer;
-    }());
+    })();
     BABYLON.DebugLayer = DebugLayer;
 })(BABYLON || (BABYLON = {}));

+ 1 - 1
src/PostProcess/RenderPipeline/babylon.postProcessRenderEffect.js

@@ -147,6 +147,6 @@ var BABYLON;
             }
         };
         return PostProcessRenderEffect;
-    }());
+    })();
     BABYLON.PostProcessRenderEffect = PostProcessRenderEffect;
 })(BABYLON || (BABYLON = {}));

+ 1 - 1
src/PostProcess/RenderPipeline/babylon.postProcessRenderPipeline.js

@@ -124,6 +124,6 @@ var BABYLON;
         PostProcessRenderPipeline.PASS_EFFECT_NAME = "passEffect";
         PostProcessRenderPipeline.PASS_SAMPLER_NAME = "passSampler";
         return PostProcessRenderPipeline;
-    }());
+    })();
     BABYLON.PostProcessRenderPipeline = PostProcessRenderPipeline;
 })(BABYLON || (BABYLON = {}));

+ 1 - 1
src/PostProcess/RenderPipeline/babylon.postProcessRenderPipelineManager.js

@@ -62,6 +62,6 @@ var BABYLON;
             }
         };
         return PostProcessRenderPipelineManager;
-    }());
+    })();
     BABYLON.PostProcessRenderPipelineManager = PostProcessRenderPipelineManager;
 })(BABYLON || (BABYLON = {}));

+ 9 - 5
src/Tools/babylon.observable.ts

@@ -13,7 +13,7 @@
     }
 
     export class Observer<T> {
-        constructor(public callback: (eventData: T, eventState: EventState) => void) {
+        constructor(public callback: (eventData: T, eventState: EventState) => void, public mask:number) {
         }
     }
 
@@ -23,14 +23,15 @@
         /**
          * Create a new Observer with the specified callback
          * @param callback the callback that will be executed for that Observer
+         * @param mash the mask used to filter observers
          * @param insertFirst if true the callback will be inserted at the first position, hence executed before the others ones. If false (default behavior) the callback will be inserted at the last position, executed after all the others already present.
          */
-        public add(callback: (eventData: T, eventState: EventState) => void, insertFirst = false): Observer<T> {
+        public add(callback: (eventData: T, eventState: EventState) => void, mask: number = -1, insertFirst = false): Observer<T> {
             if (!callback) {
                 return null;
             }
 
-            var observer = new Observer(callback);
+            var observer = new Observer(callback, mask);
 
             if (insertFirst) {
                 this._observers.unshift(observer);
@@ -77,12 +78,15 @@
         /**
          * Notify all Observers by calling their respective callback with the given data
          * @param eventData
+         * @param mask
          */
-        public notifyObservers(eventData: T): void {
+        public notifyObservers(eventData: T, mask:number = -1): void {
             var state = new EventState();
 
             for (var obs of this._observers) {
-                obs.callback(eventData, state);
+                if (obs.mask & mask) {
+                    obs.callback(eventData, state);
+                }
                 if (state.skipNextObervers) {
                     break;
                 }

+ 2 - 2
src/babylon.engine.js

@@ -103,7 +103,7 @@ var BABYLON;
         function EngineCapabilities() {
         }
         return EngineCapabilities;
-    }());
+    })();
     BABYLON.EngineCapabilities = EngineCapabilities;
     /**
      * The engine class is responsible for interfacing with all lower-level APIs such as WebGL and Audio.
@@ -1940,6 +1940,6 @@ var BABYLON;
         Engine.CodeRepository = "src/";
         Engine.ShadersRepository = "src/Shaders/";
         return Engine;
-    }());
+    })();
     BABYLON.Engine = Engine;
 })(BABYLON || (BABYLON = {}));

+ 1 - 1
src/babylon.node.js

@@ -293,6 +293,6 @@ var BABYLON;
             BABYLON.serialize()
         ], Node.prototype, "state", void 0);
         return Node;
-    }());
+    })();
     BABYLON.Node = Node;
 })(BABYLON || (BABYLON = {}));

+ 61 - 11
src/babylon.scene.js

@@ -1,8 +1,54 @@
 var BABYLON;
 (function (BABYLON) {
+    var PointerEventTypes = (function () {
+        function PointerEventTypes() {
+        }
+        Object.defineProperty(PointerEventTypes, "POINTERDOWN", {
+            get: function () {
+                return PointerEventTypes._POINTERDOWN;
+            },
+            enumerable: true,
+            configurable: true
+        });
+        Object.defineProperty(PointerEventTypes, "POINTERUP", {
+            get: function () {
+                return PointerEventTypes._POINTERUP;
+            },
+            enumerable: true,
+            configurable: true
+        });
+        Object.defineProperty(PointerEventTypes, "POINTERMOVE", {
+            get: function () {
+                return PointerEventTypes._POINTERMOVE;
+            },
+            enumerable: true,
+            configurable: true
+        });
+        Object.defineProperty(PointerEventTypes, "POINTERWHEEL", {
+            get: function () {
+                return PointerEventTypes._POINTERWHEEL;
+            },
+            enumerable: true,
+            configurable: true
+        });
+        Object.defineProperty(PointerEventTypes, "POINTERPICK", {
+            get: function () {
+                return PointerEventTypes._POINTERPICK;
+            },
+            enumerable: true,
+            configurable: true
+        });
+        PointerEventTypes._POINTERDOWN = 0x01;
+        PointerEventTypes._POINTERUP = 0x02;
+        PointerEventTypes._POINTERMOVE = 0x04;
+        PointerEventTypes._POINTERWHEEL = 0x08;
+        PointerEventTypes._POINTERPICK = 0x10;
+        return PointerEventTypes;
+    })();
+    BABYLON.PointerEventTypes = PointerEventTypes;
     /**
      * This type contains all the data related to a pointer event in Babylon.js.
-     * The event member is an instnce of PointerEvent for all types except PointerWheel and is of type MouseWheelEvent when type equals PointerWheel
+     * The event member is an instance of PointerEvent for all types except PointerWheel and is of type MouseWheelEvent when type equals PointerWheel. The differents event types can be found in the PointerEventTypes class.
      */
     var PointerInfo = (function () {
         function PointerInfo(type, event, pickInfo) {
@@ -11,7 +57,7 @@ var BABYLON;
             this.pickInfo = pickInfo;
         }
         return PointerInfo;
-    }());
+    })();
     BABYLON.PointerInfo = PointerInfo;
     /**
      * Represents a scene to be rendered by the engine.
@@ -508,8 +554,9 @@ var BABYLON;
                     _this.onPointerMove(evt, pickResult);
                 }
                 if (_this.onPointerObservable.hasObservers()) {
-                    var pi = new PointerInfo(evt.type === "mousewheel" ? 4 /* PointerWheel */ : 3 /* PointerMove */, evt, pickResult);
-                    _this.onPointerObservable.notifyObservers(pi);
+                    var type = evt.type === "mousewheel" ? PointerEventTypes.POINTERWHEEL : PointerEventTypes.POINTERMOVE;
+                    var pi = new PointerInfo(type, evt, pickResult);
+                    _this.onPointerObservable.notifyObservers(pi, type);
                 }
             };
             this._onPointerDown = function (evt) {
@@ -565,8 +612,9 @@ var BABYLON;
                     _this.onPointerDown(evt, pickResult);
                 }
                 if (_this.onPointerObservable.hasObservers()) {
-                    var pi = new PointerInfo(1 /* PointerDown */, evt, pickResult);
-                    _this.onPointerObservable.notifyObservers(pi);
+                    var type = PointerEventTypes.POINTERDOWN;
+                    var pi = new PointerInfo(type, evt, pickResult);
+                    _this.onPointerObservable.notifyObservers(pi, type);
                 }
                 // Sprites
                 _this._pickedDownSprite = null;
@@ -609,8 +657,9 @@ var BABYLON;
                             _this.onPointerPick(evt, pickResult);
                         }
                         if (_this.onPointerObservable.hasObservers()) {
-                            var pi = new PointerInfo(5 /* PointerPick */, evt, pickResult);
-                            _this.onPointerObservable.notifyObservers(pi);
+                            var type = PointerEventTypes.POINTERPICK;
+                            var pi = new PointerInfo(type, evt, pickResult);
+                            _this.onPointerObservable.notifyObservers(pi, type);
                         }
                     }
                     if (pickResult.pickedMesh.actionManager) {
@@ -627,8 +676,9 @@ var BABYLON;
                     _this.onPointerUp(evt, pickResult);
                 }
                 if (_this.onPointerObservable.hasObservers()) {
-                    var pi = new PointerInfo(2 /* PointerUp */, evt, pickResult);
-                    _this.onPointerObservable.notifyObservers(pi);
+                    var type = PointerEventTypes.POINTERUP;
+                    var pi = new PointerInfo(type, evt, pickResult);
+                    _this.onPointerObservable.notifyObservers(pi, type);
                 }
                 _this._startingPointerTime = 0;
                 // Sprites
@@ -2244,6 +2294,6 @@ var BABYLON;
         Scene.MinDeltaTime = 1.0;
         Scene.MaxDeltaTime = 1000.0;
         return Scene;
-    }());
+    })();
     BABYLON.Scene = Scene;
 })(BABYLON || (BABYLON = {}));

+ 40 - 15
src/babylon.scene.ts

@@ -3,19 +3,40 @@
         dispose(): void;
     }
 
-    /**
-     * Different type of pointer event, enumerations are self explanatory
-     */
-    export const enum PointerEventType {
-        None, PointerDown, PointerUp, PointerMove, PointerWheel, PointerPick
+    export class PointerEventTypes {
+        static _POINTERDOWN  = 0x01;
+        static _POINTERUP    = 0x02;
+        static _POINTERMOVE  = 0x04;
+        static _POINTERWHEEL = 0x08;
+        static _POINTERPICK  = 0x10;
+
+        public static get POINTERDOWN() : number {
+            return PointerEventTypes._POINTERDOWN;
+        }
+
+        public static get POINTERUP(): number {
+            return PointerEventTypes._POINTERUP;
+        }
+
+        public static get POINTERMOVE(): number {
+            return PointerEventTypes._POINTERMOVE;
+        }
+
+        public static get POINTERWHEEL(): number {
+            return PointerEventTypes._POINTERWHEEL;
+        }
+
+        public static get POINTERPICK(): number {
+            return PointerEventTypes._POINTERPICK;
+        }
     }
 
     /**
      * This type contains all the data related to a pointer event in Babylon.js.
-     * The event member is an instnce of PointerEvent for all types except PointerWheel and is of type MouseWheelEvent when type equals PointerWheel
+     * The event member is an instance of PointerEvent for all types except PointerWheel and is of type MouseWheelEvent when type equals PointerWheel. The differents event types can be found in the PointerEventTypes class.
      */
     export class PointerInfo {
-        constructor(public type: PointerEventType, public event: PointerEvent | MouseWheelEvent, public pickInfo: PickingInfo) {
+        constructor(public type: number, public event: PointerEvent | MouseWheelEvent, public pickInfo: PickingInfo) {
         }
     }
 
@@ -660,8 +681,9 @@
                 }
 
                 if (this.onPointerObservable.hasObservers()) {
-                    let pi = new PointerInfo(evt.type === "mousewheel" ? PointerEventType.PointerWheel : PointerEventType.PointerMove, evt, pickResult);
-                    this.onPointerObservable.notifyObservers(pi);
+                    let type = evt.type === "mousewheel" ? PointerEventTypes.POINTERWHEEL : PointerEventTypes.POINTERMOVE;
+                    let pi = new PointerInfo(type, evt, pickResult);
+                    this.onPointerObservable.notifyObservers(pi, type);
                 }
             };
 
@@ -728,8 +750,9 @@
                 }
 
                 if (this.onPointerObservable.hasObservers()) {
-                    let pi = new PointerInfo(PointerEventType.PointerDown, evt, pickResult);
-                    this.onPointerObservable.notifyObservers(pi);
+                    let type = PointerEventTypes.POINTERDOWN;
+                    let pi = new PointerInfo(type, evt, pickResult);
+                    this.onPointerObservable.notifyObservers(pi, type);
                 }
 
                 // Sprites
@@ -779,8 +802,9 @@
                             this.onPointerPick(evt, pickResult);
                         }
                         if (this.onPointerObservable.hasObservers()) {
-                            let pi = new PointerInfo(PointerEventType.PointerPick, evt, pickResult);
-                            this.onPointerObservable.notifyObservers(pi);
+                            let type = PointerEventTypes.POINTERPICK;
+                            let pi = new PointerInfo(type, evt, pickResult);
+                            this.onPointerObservable.notifyObservers(pi, type);
                         }
                     }
                     if (pickResult.pickedMesh.actionManager) {
@@ -800,8 +824,9 @@
                 }
 
                 if (this.onPointerObservable.hasObservers()) {
-                    let pi = new PointerInfo(PointerEventType.PointerUp, evt, pickResult);
-                    this.onPointerObservable.notifyObservers(pi);
+                    let type = PointerEventTypes.POINTERUP;
+                    let pi = new PointerInfo(type, evt, pickResult);
+                    this.onPointerObservable.notifyObservers(pi, type);
                 }
 
                 this._startingPointerTime = 0;