David Catuhe il y a 9 ans
Parent
commit
30e38b75af
100 fichiers modifiés avec 5945 ajouts et 4047 suppressions
  1. 25 26
      dist/preview release/babylon.core.js
  2. 2268 1929
      dist/preview release/babylon.d.ts
  3. 37 36
      dist/preview release/babylon.js
  4. 2592 1781
      dist/preview release/babylon.max.js
  5. 37 36
      dist/preview release/babylon.noworker.js
  6. 1 1
      src/Actions/babylon.action.js
  7. 2 2
      src/Actions/babylon.actionManager.js
  8. 4 4
      src/Actions/babylon.condition.js
  9. 12 12
      src/Actions/babylon.directActions.js
  10. 1 1
      src/Actions/babylon.interpolateValueAction.js
  11. 1 1
      src/Animations/babylon.animatable.js
  12. 13 13
      src/Animations/babylon.easing.js
  13. 1 1
      src/Audio/babylon.analyser.js
  14. 1 1
      src/Audio/babylon.audioEngine.js
  15. 1 1
      src/Audio/babylon.sound.js
  16. 1 1
      src/Audio/babylon.soundtrack.js
  17. 1 1
      src/Bones/babylon.bone.js
  18. 1 1
      src/Bones/babylon.skeleton.js
  19. 1 1
      src/Cameras/Inputs/babylon.arcrotatecamera.input.gamepad.js
  20. 1 1
      src/Cameras/Inputs/babylon.arcrotatecamera.input.keyboard.js
  21. 1 1
      src/Cameras/Inputs/babylon.arcrotatecamera.input.mousewheel.js
  22. 1 1
      src/Cameras/Inputs/babylon.arcrotatecamera.input.pointers.js
  23. 1 1
      src/Cameras/Inputs/babylon.arcrotatecamera.input.vrdeviceorientation.js
  24. 1 1
      src/Cameras/Inputs/babylon.freecamera.input.deviceorientation.js
  25. 1 1
      src/Cameras/Inputs/babylon.freecamera.input.gamepad.js
  26. 1 1
      src/Cameras/Inputs/babylon.freecamera.input.keyboard.js
  27. 1 1
      src/Cameras/Inputs/babylon.freecamera.input.mouse.js
  28. 1 1
      src/Cameras/Inputs/babylon.freecamera.input.touch.js
  29. 1 1
      src/Cameras/Inputs/babylon.freecamera.input.virtualjoystick.js
  30. 1 1
      src/Cameras/Inputs/babylon.freecamera.input.vrdeviceorientation.js
  31. 1 1
      src/Cameras/VR/babylon.vrCameraMetrics.js
  32. 2 2
      src/Cameras/VR/babylon.vrDeviceOrientationCamera.js
  33. 1 1
      src/Cameras/VR/babylon.webVRCamera.js
  34. 1 1
      src/Cameras/babylon.arcRotateCamera.js
  35. 1 1
      src/Cameras/babylon.arcRotateCameraInputsManager.js
  36. 1 1
      src/Cameras/babylon.camera.js
  37. 1 1
      src/Cameras/babylon.cameraInputsManager.js
  38. 1 1
      src/Cameras/babylon.deviceOrientationCamera.js
  39. 2 2
      src/Cameras/babylon.followCamera.js
  40. 1 1
      src/Cameras/babylon.freeCamera.js
  41. 1 1
      src/Cameras/babylon.freeCameraInputsManager.js
  42. 1 1
      src/Cameras/babylon.gamepadCamera.js
  43. 8 8
      src/Cameras/babylon.stereoscopicCameras.js
  44. 1 1
      src/Cameras/babylon.targetCamera.js
  45. 1 1
      src/Cameras/babylon.touchCamera.js
  46. 1 1
      src/Cameras/babylon.universalCamera.js
  47. 1 1
      src/Cameras/babylon.virtualJoysticksCamera.js
  48. 43 28
      src/Canvas2d/babylon.bounding2d.js
  49. 5 5
      src/Canvas2d/babylon.brushes2d.js
  50. 322 14
      src/Canvas2d/babylon.canvas2d.js
  51. 13 5
      src/Canvas2d/babylon.group2d.js
  52. 2 2
      src/Canvas2d/babylon.modelRenderCache.js
  53. 401 17
      src/Canvas2d/babylon.prim2dBase.js
  54. 20 4
      src/Canvas2d/babylon.rectangle2d.js
  55. 18 11
      src/Canvas2d/babylon.renderablePrim2d.js
  56. 2 2
      src/Canvas2d/babylon.shape2d.js
  57. 8 8
      src/Canvas2d/babylon.smartPropertyPrim.js
  58. 11 4
      src/Canvas2d/babylon.sprite2d.js
  59. 13 11
      src/Canvas2d/babylon.text2d.js
  60. 1 1
      src/Canvas2d/babylon.worldSpaceCanvas2d.js
  61. 1 1
      src/Collisions/babylon.collider.js
  62. 2 2
      src/Collisions/babylon.collisionCoordinator.js
  63. 3 3
      src/Collisions/babylon.collisionWorker.js
  64. 2 2
      src/Collisions/babylon.pickingInfo.js
  65. 1 1
      src/Culling/Octrees/babylon.octree.js
  66. 1 1
      src/Culling/Octrees/babylon.octreeBlock.js
  67. 1 1
      src/Culling/babylon.boundingBox.js
  68. 1 1
      src/Culling/babylon.boundingInfo.js
  69. 1 1
      src/Culling/babylon.boundingSphere.js
  70. 1 1
      src/Culling/babylon.ray.js
  71. 1 1
      src/Debug/babylon.debugLayer.js
  72. 1 1
      src/Debug/babylon.skeletonViewer.js
  73. 1 1
      src/Layer/babylon.layer.js
  74. 1 1
      src/LensFlare/babylon.lensFlare.js
  75. 1 1
      src/LensFlare/babylon.lensFlareSystem.js
  76. 1 1
      src/Lights/Shadows/babylon.shadowGenerator.js
  77. 1 1
      src/Lights/babylon.directionalLight.js
  78. 1 1
      src/Lights/babylon.hemisphericLight.js
  79. 1 1
      src/Lights/babylon.light.js
  80. 2 2
      src/Lights/babylon.pointLight.js
  81. 1 1
      src/Lights/babylon.pointLight.ts
  82. 1 1
      src/Lights/babylon.spotLight.js
  83. 1 1
      src/Loading/babylon.sceneLoader.js
  84. 1 1
      src/Materials/Textures/Procedurals/babylon.customProceduralTexture.js
  85. 1 1
      src/Materials/Textures/Procedurals/babylon.proceduralTexture.js
  86. 1 1
      src/Materials/Textures/babylon.baseTexture.js
  87. 1 1
      src/Materials/Textures/babylon.colorGradingTexture.js
  88. 1 1
      src/Materials/Textures/babylon.cubeTexture.js
  89. 1 1
      src/Materials/Textures/babylon.dynamicTexture.js
  90. 5 5
      src/Materials/Textures/babylon.fontTexture.js
  91. 1 1
      src/Materials/Textures/babylon.hdrCubeTexture.js
  92. 1 1
      src/Materials/Textures/babylon.mapTexture.js
  93. 1 1
      src/Materials/Textures/babylon.mirrorTexture.js
  94. 1 1
      src/Materials/Textures/babylon.rawTexture.js
  95. 1 1
      src/Materials/Textures/babylon.refractionTexture.js
  96. 1 1
      src/Materials/Textures/babylon.renderTargetTexture.js
  97. 1 1
      src/Materials/Textures/babylon.texture.js
  98. 1 1
      src/Materials/Textures/babylon.videoTexture.js
  99. 2 2
      src/Materials/babylon.effect.js
  100. 0 0
      src/Materials/babylon.fresnelParameters.js

Fichier diff supprimé car celui-ci est trop grand
+ 25 - 26
dist/preview release/babylon.core.js


Fichier diff supprimé car celui-ci est trop grand
+ 2268 - 1929
dist/preview release/babylon.d.ts


Fichier diff supprimé car celui-ci est trop grand
+ 37 - 36
dist/preview release/babylon.js


Fichier diff supprimé car celui-ci est trop grand
+ 2592 - 1781
dist/preview release/babylon.max.js


Fichier diff supprimé car celui-ci est trop grand
+ 37 - 36
dist/preview release/babylon.noworker.js


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

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

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

@@ -29,7 +29,7 @@ var BABYLON;
             };
             };
         };
         };
         return Condition;
         return Condition;
-    }());
+    })();
     BABYLON.Condition = Condition;
     BABYLON.Condition = Condition;
     var ValueCondition = (function (_super) {
     var ValueCondition = (function (_super) {
         __extends(ValueCondition, _super);
         __extends(ValueCondition, _super);
@@ -117,7 +117,7 @@ var BABYLON;
         ValueCondition._IsGreater = 2;
         ValueCondition._IsGreater = 2;
         ValueCondition._IsLesser = 3;
         ValueCondition._IsLesser = 3;
         return ValueCondition;
         return ValueCondition;
-    }(Condition));
+    })(Condition);
     BABYLON.ValueCondition = ValueCondition;
     BABYLON.ValueCondition = ValueCondition;
     var PredicateCondition = (function (_super) {
     var PredicateCondition = (function (_super) {
         __extends(PredicateCondition, _super);
         __extends(PredicateCondition, _super);
@@ -129,7 +129,7 @@ var BABYLON;
             return this.predicate();
             return this.predicate();
         };
         };
         return PredicateCondition;
         return PredicateCondition;
-    }(Condition));
+    })(Condition);
     BABYLON.PredicateCondition = PredicateCondition;
     BABYLON.PredicateCondition = PredicateCondition;
     var StateCondition = (function (_super) {
     var StateCondition = (function (_super) {
         __extends(StateCondition, _super);
         __extends(StateCondition, _super);
@@ -152,6 +152,6 @@ var BABYLON;
             });
             });
         };
         };
         return StateCondition;
         return StateCondition;
-    }(Condition));
+    })(Condition);
     BABYLON.StateCondition = StateCondition;
     BABYLON.StateCondition = StateCondition;
 })(BABYLON || (BABYLON = {}));
 })(BABYLON || (BABYLON = {}));

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

@@ -29,7 +29,7 @@ var BABYLON;
             }, parent);
             }, parent);
         };
         };
         return SwitchBooleanAction;
         return SwitchBooleanAction;
-    }(BABYLON.Action));
+    })(BABYLON.Action);
     BABYLON.SwitchBooleanAction = SwitchBooleanAction;
     BABYLON.SwitchBooleanAction = SwitchBooleanAction;
     var SetStateAction = (function (_super) {
     var SetStateAction = (function (_super) {
         __extends(SetStateAction, _super);
         __extends(SetStateAction, _super);
@@ -51,7 +51,7 @@ var BABYLON;
             }, parent);
             }, parent);
         };
         };
         return SetStateAction;
         return SetStateAction;
-    }(BABYLON.Action));
+    })(BABYLON.Action);
     BABYLON.SetStateAction = SetStateAction;
     BABYLON.SetStateAction = SetStateAction;
     var SetValueAction = (function (_super) {
     var SetValueAction = (function (_super) {
         __extends(SetValueAction, _super);
         __extends(SetValueAction, _super);
@@ -79,7 +79,7 @@ var BABYLON;
             }, parent);
             }, parent);
         };
         };
         return SetValueAction;
         return SetValueAction;
-    }(BABYLON.Action));
+    })(BABYLON.Action);
     BABYLON.SetValueAction = SetValueAction;
     BABYLON.SetValueAction = SetValueAction;
     var IncrementValueAction = (function (_super) {
     var IncrementValueAction = (function (_super) {
         __extends(IncrementValueAction, _super);
         __extends(IncrementValueAction, _super);
@@ -110,7 +110,7 @@ var BABYLON;
             }, parent);
             }, parent);
         };
         };
         return IncrementValueAction;
         return IncrementValueAction;
-    }(BABYLON.Action));
+    })(BABYLON.Action);
     BABYLON.IncrementValueAction = IncrementValueAction;
     BABYLON.IncrementValueAction = IncrementValueAction;
     var PlayAnimationAction = (function (_super) {
     var PlayAnimationAction = (function (_super) {
         __extends(PlayAnimationAction, _super);
         __extends(PlayAnimationAction, _super);
@@ -139,7 +139,7 @@ var BABYLON;
             }, parent);
             }, parent);
         };
         };
         return PlayAnimationAction;
         return PlayAnimationAction;
-    }(BABYLON.Action));
+    })(BABYLON.Action);
     BABYLON.PlayAnimationAction = PlayAnimationAction;
     BABYLON.PlayAnimationAction = PlayAnimationAction;
     var StopAnimationAction = (function (_super) {
     var StopAnimationAction = (function (_super) {
         __extends(StopAnimationAction, _super);
         __extends(StopAnimationAction, _super);
@@ -160,7 +160,7 @@ var BABYLON;
             }, parent);
             }, parent);
         };
         };
         return StopAnimationAction;
         return StopAnimationAction;
-    }(BABYLON.Action));
+    })(BABYLON.Action);
     BABYLON.StopAnimationAction = StopAnimationAction;
     BABYLON.StopAnimationAction = StopAnimationAction;
     var DoNothingAction = (function (_super) {
     var DoNothingAction = (function (_super) {
         __extends(DoNothingAction, _super);
         __extends(DoNothingAction, _super);
@@ -177,7 +177,7 @@ var BABYLON;
             }, parent);
             }, parent);
         };
         };
         return DoNothingAction;
         return DoNothingAction;
-    }(BABYLON.Action));
+    })(BABYLON.Action);
     BABYLON.DoNothingAction = DoNothingAction;
     BABYLON.DoNothingAction = DoNothingAction;
     var CombineAction = (function (_super) {
     var CombineAction = (function (_super) {
         __extends(CombineAction, _super);
         __extends(CombineAction, _super);
@@ -208,7 +208,7 @@ var BABYLON;
             return serializationObject;
             return serializationObject;
         };
         };
         return CombineAction;
         return CombineAction;
-    }(BABYLON.Action));
+    })(BABYLON.Action);
     BABYLON.CombineAction = CombineAction;
     BABYLON.CombineAction = CombineAction;
     var ExecuteCodeAction = (function (_super) {
     var ExecuteCodeAction = (function (_super) {
         __extends(ExecuteCodeAction, _super);
         __extends(ExecuteCodeAction, _super);
@@ -220,7 +220,7 @@ var BABYLON;
             this.func(evt);
             this.func(evt);
         };
         };
         return ExecuteCodeAction;
         return ExecuteCodeAction;
-    }(BABYLON.Action));
+    })(BABYLON.Action);
     BABYLON.ExecuteCodeAction = ExecuteCodeAction;
     BABYLON.ExecuteCodeAction = ExecuteCodeAction;
     var SetParentAction = (function (_super) {
     var SetParentAction = (function (_super) {
         __extends(SetParentAction, _super);
         __extends(SetParentAction, _super);
@@ -250,7 +250,7 @@ var BABYLON;
             }, parent);
             }, parent);
         };
         };
         return SetParentAction;
         return SetParentAction;
-    }(BABYLON.Action));
+    })(BABYLON.Action);
     BABYLON.SetParentAction = SetParentAction;
     BABYLON.SetParentAction = SetParentAction;
     var PlaySoundAction = (function (_super) {
     var PlaySoundAction = (function (_super) {
         __extends(PlaySoundAction, _super);
         __extends(PlaySoundAction, _super);
@@ -271,7 +271,7 @@ var BABYLON;
             }, parent);
             }, parent);
         };
         };
         return PlaySoundAction;
         return PlaySoundAction;
-    }(BABYLON.Action));
+    })(BABYLON.Action);
     BABYLON.PlaySoundAction = PlaySoundAction;
     BABYLON.PlaySoundAction = PlaySoundAction;
     var StopSoundAction = (function (_super) {
     var StopSoundAction = (function (_super) {
         __extends(StopSoundAction, _super);
         __extends(StopSoundAction, _super);
@@ -292,6 +292,6 @@ var BABYLON;
             }, parent);
             }, parent);
         };
         };
         return StopSoundAction;
         return StopSoundAction;
-    }(BABYLON.Action));
+    })(BABYLON.Action);
     BABYLON.StopSoundAction = StopSoundAction;
     BABYLON.StopSoundAction = StopSoundAction;
 })(BABYLON || (BABYLON = {}));
 })(BABYLON || (BABYLON = {}));

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

@@ -72,6 +72,6 @@ var BABYLON;
             }, parent);
             }, parent);
         };
         };
         return InterpolateValueAction;
         return InterpolateValueAction;
-    }(BABYLON.Action));
+    })(BABYLON.Action);
     BABYLON.InterpolateValueAction = InterpolateValueAction;
     BABYLON.InterpolateValueAction = InterpolateValueAction;
 })(BABYLON || (BABYLON = {}));
 })(BABYLON || (BABYLON = {}));

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

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

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

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

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

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

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

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

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

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

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

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

+ 1 - 1
src/Bones/babylon.bone.js

@@ -124,6 +124,6 @@ var BABYLON;
             return true;
             return true;
         };
         };
         return Bone;
         return Bone;
-    }(BABYLON.Node));
+    })(BABYLON.Node);
     BABYLON.Bone = Bone;
     BABYLON.Bone = Bone;
 })(BABYLON || (BABYLON = {}));
 })(BABYLON || (BABYLON = {}));

+ 1 - 1
src/Bones/babylon.skeleton.js

@@ -329,6 +329,6 @@ var BABYLON;
             return skeleton;
             return skeleton;
         };
         };
         return Skeleton;
         return Skeleton;
-    }());
+    })();
     BABYLON.Skeleton = Skeleton;
     BABYLON.Skeleton = Skeleton;
 })(BABYLON || (BABYLON = {}));
 })(BABYLON || (BABYLON = {}));

+ 1 - 1
src/Cameras/Inputs/babylon.arcrotatecamera.input.gamepad.js

@@ -65,7 +65,7 @@ var BABYLON;
             BABYLON.serialize()
             BABYLON.serialize()
         ], ArcRotateCameraGamepadInput.prototype, "gamepadMoveSensibility", void 0);
         ], ArcRotateCameraGamepadInput.prototype, "gamepadMoveSensibility", void 0);
         return ArcRotateCameraGamepadInput;
         return ArcRotateCameraGamepadInput;
-    }());
+    })();
     BABYLON.ArcRotateCameraGamepadInput = ArcRotateCameraGamepadInput;
     BABYLON.ArcRotateCameraGamepadInput = ArcRotateCameraGamepadInput;
     BABYLON.CameraInputTypes["ArcRotateCameraGamepadInput"] = ArcRotateCameraGamepadInput;
     BABYLON.CameraInputTypes["ArcRotateCameraGamepadInput"] = ArcRotateCameraGamepadInput;
 })(BABYLON || (BABYLON = {}));
 })(BABYLON || (BABYLON = {}));

+ 1 - 1
src/Cameras/Inputs/babylon.arcrotatecamera.input.keyboard.js

@@ -107,7 +107,7 @@ var BABYLON;
             BABYLON.serialize()
             BABYLON.serialize()
         ], ArcRotateCameraKeyboardMoveInput.prototype, "keysRight", void 0);
         ], ArcRotateCameraKeyboardMoveInput.prototype, "keysRight", void 0);
         return ArcRotateCameraKeyboardMoveInput;
         return ArcRotateCameraKeyboardMoveInput;
-    }());
+    })();
     BABYLON.ArcRotateCameraKeyboardMoveInput = ArcRotateCameraKeyboardMoveInput;
     BABYLON.ArcRotateCameraKeyboardMoveInput = ArcRotateCameraKeyboardMoveInput;
     BABYLON.CameraInputTypes["ArcRotateCameraKeyboardMoveInput"] = ArcRotateCameraKeyboardMoveInput;
     BABYLON.CameraInputTypes["ArcRotateCameraKeyboardMoveInput"] = ArcRotateCameraKeyboardMoveInput;
 })(BABYLON || (BABYLON = {}));
 })(BABYLON || (BABYLON = {}));

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

@@ -51,7 +51,7 @@ var BABYLON;
             BABYLON.serialize()
             BABYLON.serialize()
         ], ArcRotateCameraMouseWheelInput.prototype, "wheelPrecision", void 0);
         ], ArcRotateCameraMouseWheelInput.prototype, "wheelPrecision", void 0);
         return ArcRotateCameraMouseWheelInput;
         return ArcRotateCameraMouseWheelInput;
-    }());
+    })();
     BABYLON.ArcRotateCameraMouseWheelInput = ArcRotateCameraMouseWheelInput;
     BABYLON.ArcRotateCameraMouseWheelInput = ArcRotateCameraMouseWheelInput;
     BABYLON.CameraInputTypes["ArcRotateCameraMouseWheelInput"] = ArcRotateCameraMouseWheelInput;
     BABYLON.CameraInputTypes["ArcRotateCameraMouseWheelInput"] = ArcRotateCameraMouseWheelInput;
 })(BABYLON || (BABYLON = {}));
 })(BABYLON || (BABYLON = {}));

+ 1 - 1
src/Cameras/Inputs/babylon.arcrotatecamera.input.pointers.js

@@ -213,7 +213,7 @@ var BABYLON;
             BABYLON.serialize()
             BABYLON.serialize()
         ], ArcRotateCameraPointersInput.prototype, "panningSensibility", void 0);
         ], ArcRotateCameraPointersInput.prototype, "panningSensibility", void 0);
         return ArcRotateCameraPointersInput;
         return ArcRotateCameraPointersInput;
-    }());
+    })();
     BABYLON.ArcRotateCameraPointersInput = ArcRotateCameraPointersInput;
     BABYLON.ArcRotateCameraPointersInput = ArcRotateCameraPointersInput;
     BABYLON.CameraInputTypes["ArcRotateCameraPointersInput"] = ArcRotateCameraPointersInput;
     BABYLON.CameraInputTypes["ArcRotateCameraPointersInput"] = ArcRotateCameraPointersInput;
 })(BABYLON || (BABYLON = {}));
 })(BABYLON || (BABYLON = {}));

+ 1 - 1
src/Cameras/Inputs/babylon.arcrotatecamera.input.vrdeviceorientation.js

@@ -42,7 +42,7 @@ var BABYLON;
             return "VRDeviceOrientation";
             return "VRDeviceOrientation";
         };
         };
         return ArcRotateCameraVRDeviceOrientationInput;
         return ArcRotateCameraVRDeviceOrientationInput;
-    }());
+    })();
     BABYLON.ArcRotateCameraVRDeviceOrientationInput = ArcRotateCameraVRDeviceOrientationInput;
     BABYLON.ArcRotateCameraVRDeviceOrientationInput = ArcRotateCameraVRDeviceOrientationInput;
     BABYLON.CameraInputTypes["ArcRotateCameraVRDeviceOrientationInput"] = ArcRotateCameraVRDeviceOrientationInput;
     BABYLON.CameraInputTypes["ArcRotateCameraVRDeviceOrientationInput"] = ArcRotateCameraVRDeviceOrientationInput;
 })(BABYLON || (BABYLON = {}));
 })(BABYLON || (BABYLON = {}));

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

@@ -70,7 +70,7 @@ var BABYLON;
             BABYLON.serialize()
             BABYLON.serialize()
         ], FreeCameraDeviceOrientationInput.prototype, "moveSensibility", void 0);
         ], FreeCameraDeviceOrientationInput.prototype, "moveSensibility", void 0);
         return FreeCameraDeviceOrientationInput;
         return FreeCameraDeviceOrientationInput;
-    }());
+    })();
     BABYLON.FreeCameraDeviceOrientationInput = FreeCameraDeviceOrientationInput;
     BABYLON.FreeCameraDeviceOrientationInput = FreeCameraDeviceOrientationInput;
     BABYLON.CameraInputTypes["FreeCameraDeviceOrientationInput"] = FreeCameraDeviceOrientationInput;
     BABYLON.CameraInputTypes["FreeCameraDeviceOrientationInput"] = FreeCameraDeviceOrientationInput;
 })(BABYLON || (BABYLON = {}));
 })(BABYLON || (BABYLON = {}));

+ 1 - 1
src/Cameras/Inputs/babylon.freecamera.input.gamepad.js

@@ -60,7 +60,7 @@ var BABYLON;
             BABYLON.serialize()
             BABYLON.serialize()
         ], FreeCameraGamepadInput.prototype, "gamepadMoveSensibility", void 0);
         ], FreeCameraGamepadInput.prototype, "gamepadMoveSensibility", void 0);
         return FreeCameraGamepadInput;
         return FreeCameraGamepadInput;
-    }());
+    })();
     BABYLON.FreeCameraGamepadInput = FreeCameraGamepadInput;
     BABYLON.FreeCameraGamepadInput = FreeCameraGamepadInput;
     BABYLON.CameraInputTypes["FreeCameraGamepadInput"] = FreeCameraGamepadInput;
     BABYLON.CameraInputTypes["FreeCameraGamepadInput"] = FreeCameraGamepadInput;
 })(BABYLON || (BABYLON = {}));
 })(BABYLON || (BABYLON = {}));

+ 1 - 1
src/Cameras/Inputs/babylon.freecamera.input.keyboard.js

@@ -111,7 +111,7 @@ var BABYLON;
             BABYLON.serialize()
             BABYLON.serialize()
         ], FreeCameraKeyboardMoveInput.prototype, "keysRight", void 0);
         ], FreeCameraKeyboardMoveInput.prototype, "keysRight", void 0);
         return FreeCameraKeyboardMoveInput;
         return FreeCameraKeyboardMoveInput;
-    }());
+    })();
     BABYLON.FreeCameraKeyboardMoveInput = FreeCameraKeyboardMoveInput;
     BABYLON.FreeCameraKeyboardMoveInput = FreeCameraKeyboardMoveInput;
     BABYLON.CameraInputTypes["FreeCameraKeyboardMoveInput"] = FreeCameraKeyboardMoveInput;
     BABYLON.CameraInputTypes["FreeCameraKeyboardMoveInput"] = FreeCameraKeyboardMoveInput;
 })(BABYLON || (BABYLON = {}));
 })(BABYLON || (BABYLON = {}));

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

@@ -92,7 +92,7 @@ var BABYLON;
             BABYLON.serialize()
             BABYLON.serialize()
         ], FreeCameraMouseInput.prototype, "angularSensibility", void 0);
         ], FreeCameraMouseInput.prototype, "angularSensibility", void 0);
         return FreeCameraMouseInput;
         return FreeCameraMouseInput;
-    }());
+    })();
     BABYLON.FreeCameraMouseInput = FreeCameraMouseInput;
     BABYLON.FreeCameraMouseInput = FreeCameraMouseInput;
     BABYLON.CameraInputTypes["FreeCameraMouseInput"] = FreeCameraMouseInput;
     BABYLON.CameraInputTypes["FreeCameraMouseInput"] = FreeCameraMouseInput;
 })(BABYLON || (BABYLON = {}));
 })(BABYLON || (BABYLON = {}));

+ 1 - 1
src/Cameras/Inputs/babylon.freecamera.input.touch.js

@@ -116,7 +116,7 @@ var BABYLON;
             BABYLON.serialize()
             BABYLON.serialize()
         ], FreeCameraTouchInput.prototype, "touchMoveSensibility", void 0);
         ], FreeCameraTouchInput.prototype, "touchMoveSensibility", void 0);
         return FreeCameraTouchInput;
         return FreeCameraTouchInput;
-    }());
+    })();
     BABYLON.FreeCameraTouchInput = FreeCameraTouchInput;
     BABYLON.FreeCameraTouchInput = FreeCameraTouchInput;
     BABYLON.CameraInputTypes["FreeCameraTouchInput"] = FreeCameraTouchInput;
     BABYLON.CameraInputTypes["FreeCameraTouchInput"] = FreeCameraTouchInput;
 })(BABYLON || (BABYLON = {}));
 })(BABYLON || (BABYLON = {}));

+ 1 - 1
src/Cameras/Inputs/babylon.freecamera.input.virtualjoystick.js

@@ -48,7 +48,7 @@ var BABYLON;
             return "virtualJoystick";
             return "virtualJoystick";
         };
         };
         return FreeCameraVirtualJoystickInput;
         return FreeCameraVirtualJoystickInput;
-    }());
+    })();
     BABYLON.FreeCameraVirtualJoystickInput = FreeCameraVirtualJoystickInput;
     BABYLON.FreeCameraVirtualJoystickInput = FreeCameraVirtualJoystickInput;
     BABYLON.CameraInputTypes["FreeCameraVirtualJoystickInput"] = FreeCameraVirtualJoystickInput;
     BABYLON.CameraInputTypes["FreeCameraVirtualJoystickInput"] = FreeCameraVirtualJoystickInput;
 })(BABYLON || (BABYLON = {}));
 })(BABYLON || (BABYLON = {}));

+ 1 - 1
src/Cameras/Inputs/babylon.freecamera.input.vrdeviceorientation.js

@@ -47,7 +47,7 @@ var BABYLON;
             return "VRDeviceOrientation";
             return "VRDeviceOrientation";
         };
         };
         return FreeCameraVRDeviceOrientationInput;
         return FreeCameraVRDeviceOrientationInput;
-    }());
+    })();
     BABYLON.FreeCameraVRDeviceOrientationInput = FreeCameraVRDeviceOrientationInput;
     BABYLON.FreeCameraVRDeviceOrientationInput = FreeCameraVRDeviceOrientationInput;
     BABYLON.CameraInputTypes["FreeCameraVRDeviceOrientationInput"] = FreeCameraVRDeviceOrientationInput;
     BABYLON.CameraInputTypes["FreeCameraVRDeviceOrientationInput"] = FreeCameraVRDeviceOrientationInput;
 })(BABYLON || (BABYLON = {}));
 })(BABYLON || (BABYLON = {}));

+ 1 - 1
src/Cameras/VR/babylon.vrCameraMetrics.js

@@ -67,6 +67,6 @@ var BABYLON;
             return result;
             return result;
         };
         };
         return VRCameraMetrics;
         return VRCameraMetrics;
-    }());
+    })();
     BABYLON.VRCameraMetrics = VRCameraMetrics;
     BABYLON.VRCameraMetrics = VRCameraMetrics;
 })(BABYLON || (BABYLON = {}));
 })(BABYLON || (BABYLON = {}));

+ 2 - 2
src/Cameras/VR/babylon.vrDeviceOrientationCamera.js

@@ -19,7 +19,7 @@ var BABYLON;
             return "VRDeviceOrientationFreeCamera";
             return "VRDeviceOrientationFreeCamera";
         };
         };
         return VRDeviceOrientationFreeCamera;
         return VRDeviceOrientationFreeCamera;
-    }(BABYLON.FreeCamera));
+    })(BABYLON.FreeCamera);
     BABYLON.VRDeviceOrientationFreeCamera = VRDeviceOrientationFreeCamera;
     BABYLON.VRDeviceOrientationFreeCamera = VRDeviceOrientationFreeCamera;
     var VRDeviceOrientationArcRotateCamera = (function (_super) {
     var VRDeviceOrientationArcRotateCamera = (function (_super) {
         __extends(VRDeviceOrientationArcRotateCamera, _super);
         __extends(VRDeviceOrientationArcRotateCamera, _super);
@@ -35,6 +35,6 @@ var BABYLON;
             return "VRDeviceOrientationArcRotateCamera";
             return "VRDeviceOrientationArcRotateCamera";
         };
         };
         return VRDeviceOrientationArcRotateCamera;
         return VRDeviceOrientationArcRotateCamera;
-    }(BABYLON.ArcRotateCamera));
+    })(BABYLON.ArcRotateCamera);
     BABYLON.VRDeviceOrientationArcRotateCamera = VRDeviceOrientationArcRotateCamera;
     BABYLON.VRDeviceOrientationArcRotateCamera = VRDeviceOrientationArcRotateCamera;
 })(BABYLON || (BABYLON = {}));
 })(BABYLON || (BABYLON = {}));

+ 1 - 1
src/Cameras/VR/babylon.webVRCamera.js

@@ -72,6 +72,6 @@ var BABYLON;
             return "WebVRFreeCamera";
             return "WebVRFreeCamera";
         };
         };
         return WebVRFreeCamera;
         return WebVRFreeCamera;
-    }(BABYLON.FreeCamera));
+    })(BABYLON.FreeCamera);
     BABYLON.WebVRFreeCamera = WebVRFreeCamera;
     BABYLON.WebVRFreeCamera = WebVRFreeCamera;
 })(BABYLON || (BABYLON = {}));
 })(BABYLON || (BABYLON = {}));

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

@@ -541,6 +541,6 @@ var BABYLON;
             BABYLON.serialize()
             BABYLON.serialize()
         ], ArcRotateCamera.prototype, "allowUpsideDown", void 0);
         ], ArcRotateCamera.prototype, "allowUpsideDown", void 0);
         return ArcRotateCamera;
         return ArcRotateCamera;
-    }(BABYLON.TargetCamera));
+    })(BABYLON.TargetCamera);
     BABYLON.ArcRotateCamera = ArcRotateCamera;
     BABYLON.ArcRotateCamera = ArcRotateCamera;
 })(BABYLON || (BABYLON = {}));
 })(BABYLON || (BABYLON = {}));

+ 1 - 1
src/Cameras/babylon.arcRotateCameraInputsManager.js

@@ -31,6 +31,6 @@ var BABYLON;
             return this;
             return this;
         };
         };
         return ArcRotateCameraInputsManager;
         return ArcRotateCameraInputsManager;
-    }(BABYLON.CameraInputsManager));
+    })(BABYLON.CameraInputsManager);
     BABYLON.ArcRotateCameraInputsManager = ArcRotateCameraInputsManager;
     BABYLON.ArcRotateCameraInputsManager = ArcRotateCameraInputsManager;
 })(BABYLON || (BABYLON = {}));
 })(BABYLON || (BABYLON = {}));

+ 1 - 1
src/Cameras/babylon.camera.js

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

+ 1 - 1
src/Cameras/babylon.cameraInputsManager.js

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

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

@@ -46,6 +46,6 @@ var BABYLON;
             return "DeviceOrientationCamera";
             return "DeviceOrientationCamera";
         };
         };
         return DeviceOrientationCamera;
         return DeviceOrientationCamera;
-    }(BABYLON.FreeCamera));
+    })(BABYLON.FreeCamera);
     BABYLON.DeviceOrientationCamera = DeviceOrientationCamera;
     BABYLON.DeviceOrientationCamera = DeviceOrientationCamera;
 })(BABYLON || (BABYLON = {}));
 })(BABYLON || (BABYLON = {}));

+ 2 - 2
src/Cameras/babylon.followCamera.js

@@ -84,7 +84,7 @@ var BABYLON;
             BABYLON.serializeAsMeshReference("lockedTargetId")
             BABYLON.serializeAsMeshReference("lockedTargetId")
         ], FollowCamera.prototype, "target", void 0);
         ], FollowCamera.prototype, "target", void 0);
         return FollowCamera;
         return FollowCamera;
-    }(BABYLON.TargetCamera));
+    })(BABYLON.TargetCamera);
     BABYLON.FollowCamera = FollowCamera;
     BABYLON.FollowCamera = FollowCamera;
     var ArcFollowCamera = (function (_super) {
     var ArcFollowCamera = (function (_super) {
         __extends(ArcFollowCamera, _super);
         __extends(ArcFollowCamera, _super);
@@ -112,6 +112,6 @@ var BABYLON;
             return "ArcFollowCamera";
             return "ArcFollowCamera";
         };
         };
         return ArcFollowCamera;
         return ArcFollowCamera;
-    }(BABYLON.TargetCamera));
+    })(BABYLON.TargetCamera);
     BABYLON.ArcFollowCamera = ArcFollowCamera;
     BABYLON.ArcFollowCamera = ArcFollowCamera;
 })(BABYLON || (BABYLON = {}));
 })(BABYLON || (BABYLON = {}));

+ 1 - 1
src/Cameras/babylon.freeCamera.js

@@ -180,6 +180,6 @@ var BABYLON;
             BABYLON.serialize()
             BABYLON.serialize()
         ], FreeCamera.prototype, "applyGravity", void 0);
         ], FreeCamera.prototype, "applyGravity", void 0);
         return FreeCamera;
         return FreeCamera;
-    }(BABYLON.TargetCamera));
+    })(BABYLON.TargetCamera);
     BABYLON.FreeCamera = FreeCamera;
     BABYLON.FreeCamera = FreeCamera;
 })(BABYLON || (BABYLON = {}));
 })(BABYLON || (BABYLON = {}));

+ 1 - 1
src/Cameras/babylon.freeCameraInputsManager.js

@@ -40,6 +40,6 @@ var BABYLON;
             return this;
             return this;
         };
         };
         return FreeCameraInputsManager;
         return FreeCameraInputsManager;
-    }(BABYLON.CameraInputsManager));
+    })(BABYLON.CameraInputsManager);
     BABYLON.FreeCameraInputsManager = FreeCameraInputsManager;
     BABYLON.FreeCameraInputsManager = FreeCameraInputsManager;
 })(BABYLON || (BABYLON = {}));
 })(BABYLON || (BABYLON = {}));

+ 1 - 1
src/Cameras/babylon.gamepadCamera.js

@@ -46,6 +46,6 @@ var BABYLON;
             return "GamepadCamera";
             return "GamepadCamera";
         };
         };
         return GamepadCamera;
         return GamepadCamera;
-    }(BABYLON.UniversalCamera));
+    })(BABYLON.UniversalCamera);
     BABYLON.GamepadCamera = GamepadCamera;
     BABYLON.GamepadCamera = GamepadCamera;
 })(BABYLON || (BABYLON = {}));
 })(BABYLON || (BABYLON = {}));

+ 8 - 8
src/Cameras/babylon.stereoscopicCameras.js

@@ -16,7 +16,7 @@ var BABYLON;
             return "AnaglyphFreeCamera";
             return "AnaglyphFreeCamera";
         };
         };
         return AnaglyphFreeCamera;
         return AnaglyphFreeCamera;
-    }(BABYLON.FreeCamera));
+    })(BABYLON.FreeCamera);
     BABYLON.AnaglyphFreeCamera = AnaglyphFreeCamera;
     BABYLON.AnaglyphFreeCamera = AnaglyphFreeCamera;
     var AnaglyphArcRotateCamera = (function (_super) {
     var AnaglyphArcRotateCamera = (function (_super) {
         __extends(AnaglyphArcRotateCamera, _super);
         __extends(AnaglyphArcRotateCamera, _super);
@@ -29,7 +29,7 @@ var BABYLON;
             return "AnaglyphArcRotateCamera";
             return "AnaglyphArcRotateCamera";
         };
         };
         return AnaglyphArcRotateCamera;
         return AnaglyphArcRotateCamera;
-    }(BABYLON.ArcRotateCamera));
+    })(BABYLON.ArcRotateCamera);
     BABYLON.AnaglyphArcRotateCamera = AnaglyphArcRotateCamera;
     BABYLON.AnaglyphArcRotateCamera = AnaglyphArcRotateCamera;
     var AnaglyphGamepadCamera = (function (_super) {
     var AnaglyphGamepadCamera = (function (_super) {
         __extends(AnaglyphGamepadCamera, _super);
         __extends(AnaglyphGamepadCamera, _super);
@@ -42,7 +42,7 @@ var BABYLON;
             return "AnaglyphGamepadCamera";
             return "AnaglyphGamepadCamera";
         };
         };
         return AnaglyphGamepadCamera;
         return AnaglyphGamepadCamera;
-    }(BABYLON.GamepadCamera));
+    })(BABYLON.GamepadCamera);
     BABYLON.AnaglyphGamepadCamera = AnaglyphGamepadCamera;
     BABYLON.AnaglyphGamepadCamera = AnaglyphGamepadCamera;
     var AnaglyphUniversalCamera = (function (_super) {
     var AnaglyphUniversalCamera = (function (_super) {
         __extends(AnaglyphUniversalCamera, _super);
         __extends(AnaglyphUniversalCamera, _super);
@@ -55,7 +55,7 @@ var BABYLON;
             return "AnaglyphUniversalCamera";
             return "AnaglyphUniversalCamera";
         };
         };
         return AnaglyphUniversalCamera;
         return AnaglyphUniversalCamera;
-    }(BABYLON.UniversalCamera));
+    })(BABYLON.UniversalCamera);
     BABYLON.AnaglyphUniversalCamera = AnaglyphUniversalCamera;
     BABYLON.AnaglyphUniversalCamera = AnaglyphUniversalCamera;
     var StereoscopicFreeCamera = (function (_super) {
     var StereoscopicFreeCamera = (function (_super) {
         __extends(StereoscopicFreeCamera, _super);
         __extends(StereoscopicFreeCamera, _super);
@@ -69,7 +69,7 @@ var BABYLON;
             return "StereoscopicFreeCamera";
             return "StereoscopicFreeCamera";
         };
         };
         return StereoscopicFreeCamera;
         return StereoscopicFreeCamera;
-    }(BABYLON.FreeCamera));
+    })(BABYLON.FreeCamera);
     BABYLON.StereoscopicFreeCamera = StereoscopicFreeCamera;
     BABYLON.StereoscopicFreeCamera = StereoscopicFreeCamera;
     var StereoscopicArcRotateCamera = (function (_super) {
     var StereoscopicArcRotateCamera = (function (_super) {
         __extends(StereoscopicArcRotateCamera, _super);
         __extends(StereoscopicArcRotateCamera, _super);
@@ -83,7 +83,7 @@ var BABYLON;
             return "StereoscopicArcRotateCamera";
             return "StereoscopicArcRotateCamera";
         };
         };
         return StereoscopicArcRotateCamera;
         return StereoscopicArcRotateCamera;
-    }(BABYLON.ArcRotateCamera));
+    })(BABYLON.ArcRotateCamera);
     BABYLON.StereoscopicArcRotateCamera = StereoscopicArcRotateCamera;
     BABYLON.StereoscopicArcRotateCamera = StereoscopicArcRotateCamera;
     var StereoscopicGamepadCamera = (function (_super) {
     var StereoscopicGamepadCamera = (function (_super) {
         __extends(StereoscopicGamepadCamera, _super);
         __extends(StereoscopicGamepadCamera, _super);
@@ -97,7 +97,7 @@ var BABYLON;
             return "StereoscopicGamepadCamera";
             return "StereoscopicGamepadCamera";
         };
         };
         return StereoscopicGamepadCamera;
         return StereoscopicGamepadCamera;
-    }(BABYLON.GamepadCamera));
+    })(BABYLON.GamepadCamera);
     BABYLON.StereoscopicGamepadCamera = StereoscopicGamepadCamera;
     BABYLON.StereoscopicGamepadCamera = StereoscopicGamepadCamera;
     var StereoscopicUniversalCamera = (function (_super) {
     var StereoscopicUniversalCamera = (function (_super) {
         __extends(StereoscopicUniversalCamera, _super);
         __extends(StereoscopicUniversalCamera, _super);
@@ -111,6 +111,6 @@ var BABYLON;
             return "StereoscopicUniversalCamera";
             return "StereoscopicUniversalCamera";
         };
         };
         return StereoscopicUniversalCamera;
         return StereoscopicUniversalCamera;
-    }(BABYLON.UniversalCamera));
+    })(BABYLON.UniversalCamera);
     BABYLON.StereoscopicUniversalCamera = StereoscopicUniversalCamera;
     BABYLON.StereoscopicUniversalCamera = StereoscopicUniversalCamera;
 })(BABYLON || (BABYLON = {}));
 })(BABYLON || (BABYLON = {}));

+ 1 - 1
src/Cameras/babylon.targetCamera.js

@@ -258,6 +258,6 @@ var BABYLON;
             BABYLON.serializeAsMeshReference("lockedTargetId")
             BABYLON.serializeAsMeshReference("lockedTargetId")
         ], TargetCamera.prototype, "lockedTarget", void 0);
         ], TargetCamera.prototype, "lockedTarget", void 0);
         return TargetCamera;
         return TargetCamera;
-    }(BABYLON.Camera));
+    })(BABYLON.Camera);
     BABYLON.TargetCamera = TargetCamera;
     BABYLON.TargetCamera = TargetCamera;
 })(BABYLON || (BABYLON = {}));
 })(BABYLON || (BABYLON = {}));

+ 1 - 1
src/Cameras/babylon.touchCamera.js

@@ -53,6 +53,6 @@ var BABYLON;
             }
             }
         };
         };
         return TouchCamera;
         return TouchCamera;
-    }(BABYLON.FreeCamera));
+    })(BABYLON.FreeCamera);
     BABYLON.TouchCamera = TouchCamera;
     BABYLON.TouchCamera = TouchCamera;
 })(BABYLON || (BABYLON = {}));
 })(BABYLON || (BABYLON = {}));

+ 1 - 1
src/Cameras/babylon.universalCamera.js

@@ -46,6 +46,6 @@ var BABYLON;
             return "UniversalCamera";
             return "UniversalCamera";
         };
         };
         return UniversalCamera;
         return UniversalCamera;
-    }(BABYLON.TouchCamera));
+    })(BABYLON.TouchCamera);
     BABYLON.UniversalCamera = UniversalCamera;
     BABYLON.UniversalCamera = UniversalCamera;
 })(BABYLON || (BABYLON = {}));
 })(BABYLON || (BABYLON = {}));

+ 1 - 1
src/Cameras/babylon.virtualJoysticksCamera.js

@@ -13,6 +13,6 @@ var BABYLON;
             this.inputs.addVirtualJoystick();
             this.inputs.addVirtualJoystick();
         }
         }
         return VirtualJoysticksCamera;
         return VirtualJoysticksCamera;
-    }(BABYLON.FreeCamera));
+    })(BABYLON.FreeCamera);
     BABYLON.VirtualJoysticksCamera = VirtualJoysticksCamera;
     BABYLON.VirtualJoysticksCamera = VirtualJoysticksCamera;
 })(BABYLON || (BABYLON = {}));
 })(BABYLON || (BABYLON = {}));

+ 43 - 28
src/Canvas2d/babylon.bounding2d.js

@@ -10,44 +10,58 @@ var BABYLON;
             this.center = BABYLON.Vector2.Zero();
             this.center = BABYLON.Vector2.Zero();
             this.extent = BABYLON.Vector2.Zero();
             this.extent = BABYLON.Vector2.Zero();
         }
         }
-        BoundingInfo2D.CreateFromSize = function (size) {
+        BoundingInfo2D.CreateFromSize = function (size, origin) {
             var r = new BoundingInfo2D();
             var r = new BoundingInfo2D();
-            BoundingInfo2D.CreateFromSizeToRef(size, r);
+            BoundingInfo2D.CreateFromSizeToRef(size, r, origin);
             return r;
             return r;
         };
         };
-        BoundingInfo2D.CreateFromRadius = function (radius) {
+        BoundingInfo2D.CreateFromRadius = function (radius, origin) {
             var r = new BoundingInfo2D();
             var r = new BoundingInfo2D();
-            BoundingInfo2D.CreateFromRadiusToRef(radius, r);
+            BoundingInfo2D.CreateFromRadiusToRef(radius, r, origin);
             return r;
             return r;
         };
         };
-        BoundingInfo2D.CreateFromPoints = function (points) {
+        BoundingInfo2D.CreateFromPoints = function (points, origin) {
             var r = new BoundingInfo2D();
             var r = new BoundingInfo2D();
-            BoundingInfo2D.CreateFromPointsToRef(points, r);
+            BoundingInfo2D.CreateFromPointsToRef(points, r, origin);
             return r;
             return r;
         };
         };
-        BoundingInfo2D.CreateFromSizeToRef = function (size, b) {
+        BoundingInfo2D.CreateFromSizeToRef = function (size, b, origin) {
             b.center = new BABYLON.Vector2(size.width / 2, size.height / 2);
             b.center = new BABYLON.Vector2(size.width / 2, size.height / 2);
             b.extent = b.center.clone();
             b.extent = b.center.clone();
+            if (origin) {
+                b.center.x -= size.width * origin.x;
+                b.center.y -= size.height * origin.y;
+            }
             b.radius = b.extent.length();
             b.radius = b.extent.length();
         };
         };
-        BoundingInfo2D.CreateFromRadiusToRef = function (radius, b) {
+        BoundingInfo2D.CreateFromRadiusToRef = function (radius, b, origin) {
             b.center = BABYLON.Vector2.Zero();
             b.center = BABYLON.Vector2.Zero();
+            if (origin) {
+                b.center.x -= radius * origin.x;
+                b.center.y -= radius * origin.y;
+            }
             b.extent = new BABYLON.Vector2(radius, radius);
             b.extent = new BABYLON.Vector2(radius, radius);
             b.radius = radius;
             b.radius = radius;
         };
         };
-        BoundingInfo2D.CreateFromPointsToRef = function (points, b) {
+        BoundingInfo2D.CreateFromPointsToRef = function (points, b, origin) {
             var xmin = Number.MAX_VALUE, ymin = Number.MAX_VALUE, xmax = Number.MIN_VALUE, ymax = Number.MIN_VALUE;
             var xmin = Number.MAX_VALUE, ymin = Number.MAX_VALUE, xmax = Number.MIN_VALUE, ymax = Number.MIN_VALUE;
-            for (var _i = 0, points_1 = points; _i < points_1.length; _i++) {
-                var p = points_1[_i];
+            for (var _i = 0; _i < points.length; _i++) {
+                var p = points[_i];
                 xmin = Math.min(p.x, xmin);
                 xmin = Math.min(p.x, xmin);
                 xmax = Math.max(p.x, xmax);
                 xmax = Math.max(p.x, xmax);
                 ymin = Math.min(p.y, ymin);
                 ymin = Math.min(p.y, ymin);
                 ymax = Math.max(p.y, ymax);
                 ymax = Math.max(p.y, ymax);
             }
             }
-            BoundingInfo2D.CreateFromMinMaxToRef(xmin, xmax, ymin, ymax, b);
+            BoundingInfo2D.CreateFromMinMaxToRef(xmin, xmax, ymin, ymax, b, origin);
         };
         };
-        BoundingInfo2D.CreateFromMinMaxToRef = function (xmin, xmax, ymin, ymax, b) {
-            b.center = new BABYLON.Vector2(xmin + (xmax - xmin) / 2, ymin + (ymax - ymin) / 2);
+        BoundingInfo2D.CreateFromMinMaxToRef = function (xmin, xmax, ymin, ymax, b, origin) {
+            var w = xmax - xmin;
+            var h = ymax - ymin;
+            b.center = new BABYLON.Vector2(xmin + w / 2, ymin + h / 2);
+            if (origin) {
+                b.center.x -= w * origin.x;
+                b.center.y -= h * origin.y;
+            }
             b.extent = new BABYLON.Vector2(xmax - b.center.x, ymax - b.center.y);
             b.extent = new BABYLON.Vector2(xmax - b.center.x, ymax - b.center.y);
             b.radius = b.extent.length();
             b.radius = b.extent.length();
         };
         };
@@ -76,10 +90,9 @@ var BABYLON;
          * @param matrix the transformation matrix to apply
          * @param matrix the transformation matrix to apply
          * @return the new instance containing the result of the transformation applied on this BoundingInfo2D
          * @return the new instance containing the result of the transformation applied on this BoundingInfo2D
          */
          */
-        BoundingInfo2D.prototype.transform = function (matrix, origin) {
-            if (origin === void 0) { origin = null; }
+        BoundingInfo2D.prototype.transform = function (matrix) {
             var r = new BoundingInfo2D();
             var r = new BoundingInfo2D();
-            this.transformToRef(matrix, origin, r);
+            this.transformToRef(matrix, r);
             return r;
             return r;
         };
         };
         /**
         /**
@@ -94,24 +107,17 @@ var BABYLON;
         };
         };
         /**
         /**
          * Transform this BoundingInfo2D with a given matrix and store the result in an existing BoundingInfo2D instance.
          * Transform this BoundingInfo2D with a given matrix and store the result in an existing BoundingInfo2D instance.
-         * This is a GC friendly version, try to use it as much as possible, specially if your transformation is inside a loop, allocate the result object once for good outside of the loop and use it everytime.
-         * @param origin An optional normalized origin to apply before the transformation. 0;0 is top/left, 0.5;0.5 is center, etc.
+         * This is a GC friendly version, try to use it as much as possible, specially if your transformation is inside a loop, allocate the result object once for good outside of the loop and use it every time.
          * @param matrix The matrix to use to compute the transformation
          * @param matrix The matrix to use to compute the transformation
          * @param result A VALID (i.e. allocated) BoundingInfo2D object where the result will be stored
          * @param result A VALID (i.e. allocated) BoundingInfo2D object where the result will be stored
          */
          */
-        BoundingInfo2D.prototype.transformToRef = function (matrix, origin, result) {
+        BoundingInfo2D.prototype.transformToRef = function (matrix, result) {
             // Construct a bounding box based on the extent values
             // Construct a bounding box based on the extent values
             var p = new Array(4);
             var p = new Array(4);
             p[0] = new BABYLON.Vector2(this.center.x + this.extent.x, this.center.y + this.extent.y);
             p[0] = new BABYLON.Vector2(this.center.x + this.extent.x, this.center.y + this.extent.y);
             p[1] = new BABYLON.Vector2(this.center.x + this.extent.x, this.center.y - this.extent.y);
             p[1] = new BABYLON.Vector2(this.center.x + this.extent.x, this.center.y - this.extent.y);
             p[2] = new BABYLON.Vector2(this.center.x - this.extent.x, this.center.y - this.extent.y);
             p[2] = new BABYLON.Vector2(this.center.x - this.extent.x, this.center.y - this.extent.y);
             p[3] = new BABYLON.Vector2(this.center.x - this.extent.x, this.center.y + this.extent.y);
             p[3] = new BABYLON.Vector2(this.center.x - this.extent.x, this.center.y + this.extent.y);
-            //if (origin) {
-            //    let off = new Vector2((p[0].x - p[2].x) * origin.x, (p[0].y - p[2].y) * origin.y);
-            //    for (let j = 0; j < 4; j++) {
-            //        p[j].subtractInPlace(off);
-            //    }
-            //}
             // Transform the four points of the bounding box with the matrix
             // Transform the four points of the bounding box with the matrix
             for (var i = 0; i < 4; i++) {
             for (var i = 0; i < 4; i++) {
                 BABYLON.Vector2.TransformToRef(p[i], matrix, p[i]);
                 BABYLON.Vector2.TransformToRef(p[i], matrix, p[i]);
@@ -120,7 +126,7 @@ var BABYLON;
         };
         };
         /**
         /**
          * Compute the union of this BoundingInfo2D with another one and store the result in a third valid BoundingInfo2D object
          * Compute the union of this BoundingInfo2D with another one and store the result in a third valid BoundingInfo2D object
-         * This is a GC friendly version, try to use it as much as possible, specially if your transformation is inside a loop, allocate the result object once for good outside of the loop and use it everytime.
+         * This is a GC friendly version, try to use it as much as possible, specially if your transformation is inside a loop, allocate the result object once for good outside of the loop and use it every time.
          * @param other the second object used to compute the union
          * @param other the second object used to compute the union
          * @param result a VALID BoundingInfo2D instance (i.e. allocated) where the result will be stored
          * @param result a VALID BoundingInfo2D instance (i.e. allocated) where the result will be stored
          */
          */
@@ -131,7 +137,16 @@ var BABYLON;
             var ymin = Math.min(this.center.y - this.extent.y, other.center.y - other.extent.y);
             var ymin = Math.min(this.center.y - this.extent.y, other.center.y - other.extent.y);
             BoundingInfo2D.CreateFromMinMaxToRef(xmin, xmax, ymin, ymax, result);
             BoundingInfo2D.CreateFromMinMaxToRef(xmin, xmax, ymin, ymax, result);
         };
         };
+        BoundingInfo2D.prototype.doesIntersect = function (pickPosition) {
+            // is it inside the radius?
+            var pickLocal = pickPosition.subtract(this.center);
+            if (pickLocal.lengthSquared() <= (this.radius * this.radius)) {
+                // is it inside the rectangle?
+                return ((Math.abs(pickLocal.x) <= this.extent.x) && (Math.abs(pickLocal.y) <= this.extent.y));
+            }
+            return false;
+        };
         return BoundingInfo2D;
         return BoundingInfo2D;
-    }());
+    })();
     BABYLON.BoundingInfo2D = BoundingInfo2D;
     BABYLON.BoundingInfo2D = BoundingInfo2D;
 })(BABYLON || (BABYLON = {}));
 })(BABYLON || (BABYLON = {}));

+ 5 - 5
src/Canvas2d/babylon.brushes2d.js

@@ -12,7 +12,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
 var BABYLON;
 var BABYLON;
 (function (BABYLON) {
 (function (BABYLON) {
     /**
     /**
-     * Base class implemting the ILocable interface.
+     * Base class implementing the ILocable interface.
      * The particularity of this class is to call the protected onLock() method when the instance is about to be locked for good.
      * The particularity of this class is to call the protected onLock() method when the instance is about to be locked for good.
      */
      */
     var LockableBase = (function () {
     var LockableBase = (function () {
@@ -35,10 +35,10 @@ var BABYLON;
         LockableBase.prototype.onLock = function () {
         LockableBase.prototype.onLock = function () {
         };
         };
         return LockableBase;
         return LockableBase;
-    }());
+    })();
     BABYLON.LockableBase = LockableBase;
     BABYLON.LockableBase = LockableBase;
     /**
     /**
-     * This classs implements a Brush that will be drawn with a uniform solid color (i.e. the same color everywhere in the content where the brush is assigned to).
+     * This class implements a Brush that will be drawn with a uniform solid color (i.e. the same color everywhere in the content where the brush is assigned to).
      */
      */
     var SolidColorBrush2D = (function (_super) {
     var SolidColorBrush2D = (function (_super) {
         __extends(SolidColorBrush2D, _super);
         __extends(SolidColorBrush2D, _super);
@@ -82,7 +82,7 @@ var BABYLON;
             BABYLON.className("SolidColorBrush2D")
             BABYLON.className("SolidColorBrush2D")
         ], SolidColorBrush2D);
         ], SolidColorBrush2D);
         return SolidColorBrush2D;
         return SolidColorBrush2D;
-    }(LockableBase));
+    })(LockableBase);
     BABYLON.SolidColorBrush2D = SolidColorBrush2D;
     BABYLON.SolidColorBrush2D = SolidColorBrush2D;
     var GradientColorBrush2D = (function (_super) {
     var GradientColorBrush2D = (function (_super) {
         __extends(GradientColorBrush2D, _super);
         __extends(GradientColorBrush2D, _super);
@@ -179,6 +179,6 @@ var BABYLON;
             BABYLON.className("GradientColorBrush2D")
             BABYLON.className("GradientColorBrush2D")
         ], GradientColorBrush2D);
         ], GradientColorBrush2D);
         return GradientColorBrush2D;
         return GradientColorBrush2D;
-    }(LockableBase));
+    })(LockableBase);
     BABYLON.GradientColorBrush2D = GradientColorBrush2D;
     BABYLON.GradientColorBrush2D = GradientColorBrush2D;
 })(BABYLON || (BABYLON = {}));
 })(BABYLON || (BABYLON = {}));

+ 322 - 14
src/Canvas2d/babylon.canvas2d.js

@@ -26,29 +26,33 @@ var BABYLON;
             return true;
             return true;
         };
         };
         return Canvas2DEngineBoundData;
         return Canvas2DEngineBoundData;
-    }());
+    })();
     BABYLON.Canvas2DEngineBoundData = Canvas2DEngineBoundData;
     BABYLON.Canvas2DEngineBoundData = Canvas2DEngineBoundData;
     var Canvas2D = (function (_super) {
     var Canvas2D = (function (_super) {
         __extends(Canvas2D, _super);
         __extends(Canvas2D, _super);
         function Canvas2D() {
         function Canvas2D() {
             _super.apply(this, arguments);
             _super.apply(this, arguments);
+            this._notifDebugMode = false;
             this._mapCounter = 0;
             this._mapCounter = 0;
         }
         }
         /**
         /**
          * Create a new 2D ScreenSpace Rendering Canvas, it is a 2D rectangle that has a size (width/height) and a position relative to the top/left corner of the screen.
          * Create a new 2D ScreenSpace Rendering Canvas, it is a 2D rectangle that has a size (width/height) and a position relative to the top/left corner of the screen.
          * ScreenSpace Canvas will be drawn in the Viewport as a 2D Layer lying to the top of the 3D Scene. Typically used for traditional UI.
          * ScreenSpace Canvas will be drawn in the Viewport as a 2D Layer lying to the top of the 3D Scene. Typically used for traditional UI.
          * All caching strategies will be available.
          * All caching strategies will be available.
+         * PLEASE NOTE: the origin of a Screen Space Canvas is set to [0;0] (bottom/left) which is different than the default origin of a Primitive which is centered [0.5;0.5]
          * @param scene the Scene that owns the Canvas
          * @param scene the Scene that owns the Canvas
          * @param name the name of the Canvas, for information purpose only
          * @param name the name of the Canvas, for information purpose only
          * @param pos the position of the canvas, relative from the bottom/left of the scene's viewport
          * @param pos the position of the canvas, relative from the bottom/left of the scene's viewport
          * @param size the Size of the canvas. If null two behaviors depend on the cachingStrategy: if it's CACHESTRATEGY_CACHECANVAS then it will always auto-fit the rendering device, in all the other modes it will fit the content of the Canvas
          * @param size the Size of the canvas. If null two behaviors depend on the cachingStrategy: if it's CACHESTRATEGY_CACHECANVAS then it will always auto-fit the rendering device, in all the other modes it will fit the content of the Canvas
          * @param cachingStrategy either CACHESTRATEGY_TOPLEVELGROUPS, CACHESTRATEGY_ALLGROUPS, CACHESTRATEGY_CANVAS, CACHESTRATEGY_DONTCACHE. Please refer to their respective documentation for more information.
          * @param cachingStrategy either CACHESTRATEGY_TOPLEVELGROUPS, CACHESTRATEGY_ALLGROUPS, CACHESTRATEGY_CANVAS, CACHESTRATEGY_DONTCACHE. Please refer to their respective documentation for more information.
          */
          */
-        Canvas2D.CreateScreenSpace = function (scene, name, pos, size, cachingStrategy) {
+        Canvas2D.CreateScreenSpace = function (scene, name, pos, size, cachingStrategy, enableInteraction) {
             if (cachingStrategy === void 0) { cachingStrategy = Canvas2D.CACHESTRATEGY_TOPLEVELGROUPS; }
             if (cachingStrategy === void 0) { cachingStrategy = Canvas2D.CACHESTRATEGY_TOPLEVELGROUPS; }
+            if (enableInteraction === void 0) { enableInteraction = true; }
             var c = new Canvas2D();
             var c = new Canvas2D();
-            c.setupCanvas(scene, name, size, true, cachingStrategy);
+            c.setupCanvas(scene, name, size, true, cachingStrategy, enableInteraction);
             c.position = pos;
             c.position = pos;
+            c.origin = BABYLON.Vector2.Zero();
             return c;
             return c;
         };
         };
         /**
         /**
@@ -65,9 +69,10 @@ var BABYLON;
          * @param sideOrientation Unexpected behavior occur if the value is different from Mesh.DEFAULTSIDE right now, so please use this one.
          * @param sideOrientation Unexpected behavior occur if the value is different from Mesh.DEFAULTSIDE right now, so please use this one.
          * @param cachingStrategy Must be CACHESTRATEGY_CANVAS for now
          * @param cachingStrategy Must be CACHESTRATEGY_CANVAS for now
          */
          */
-        Canvas2D.CreateWorldSpace = function (scene, name, position, rotation, size, renderScaleFactor, sideOrientation, cachingStrategy) {
+        Canvas2D.CreateWorldSpace = function (scene, name, position, rotation, size, renderScaleFactor, sideOrientation, cachingStrategy, enableInteraction) {
             if (renderScaleFactor === void 0) { renderScaleFactor = 1; }
             if (renderScaleFactor === void 0) { renderScaleFactor = 1; }
             if (cachingStrategy === void 0) { cachingStrategy = Canvas2D.CACHESTRATEGY_TOPLEVELGROUPS; }
             if (cachingStrategy === void 0) { cachingStrategy = Canvas2D.CACHESTRATEGY_TOPLEVELGROUPS; }
+            if (enableInteraction === void 0) { enableInteraction = true; }
             if (cachingStrategy !== Canvas2D.CACHESTRATEGY_CANVAS) {
             if (cachingStrategy !== Canvas2D.CACHESTRATEGY_CANVAS) {
                 throw new Error("Right now only the CACHESTRATEGY_CANVAS cache Strategy is supported for WorldSpace Canvas. More will come soon!");
                 throw new Error("Right now only the CACHESTRATEGY_CANVAS cache Strategy is supported for WorldSpace Canvas. More will come soon!");
             }
             }
@@ -78,7 +83,7 @@ var BABYLON;
                 sideOrientation = BABYLON.Mesh.DEFAULTSIDE;
                 sideOrientation = BABYLON.Mesh.DEFAULTSIDE;
             }
             }
             var c = new Canvas2D();
             var c = new Canvas2D();
-            c.setupCanvas(scene, name, new BABYLON.Size(size.width * renderScaleFactor, size.height * renderScaleFactor), false, cachingStrategy);
+            c.setupCanvas(scene, name, new BABYLON.Size(size.width * renderScaleFactor, size.height * renderScaleFactor), false, cachingStrategy, enableInteraction);
             var plane = new BABYLON.WorldSpaceCanvas2d(name, scene, c);
             var plane = new BABYLON.WorldSpaceCanvas2d(name, scene, c);
             var vertexData = BABYLON.VertexData.CreatePlane({ width: size.width / 2, height: size.height / 2, sideOrientation: sideOrientation });
             var vertexData = BABYLON.VertexData.CreatePlane({ width: size.width / 2, height: size.height / 2, sideOrientation: sideOrientation });
             var mtl = new BABYLON.StandardMaterial(name + "_Material", scene);
             var mtl = new BABYLON.StandardMaterial(name + "_Material", scene);
@@ -93,10 +98,8 @@ var BABYLON;
             c._worldSpaceNode = plane;
             c._worldSpaceNode = plane;
             return c;
             return c;
         };
         };
-        Canvas2D.prototype.setupCanvas = function (scene, name, size, isScreenSpace, cachingstrategy) {
+        Canvas2D.prototype.setupCanvas = function (scene, name, size, isScreenSpace, cachingstrategy, enableInteraction) {
             var _this = this;
             var _this = this;
-            if (isScreenSpace === void 0) { isScreenSpace = true; }
-            if (cachingstrategy === void 0) { cachingstrategy = Canvas2D.CACHESTRATEGY_TOPLEVELGROUPS; }
             var engine = scene.getEngine();
             var engine = scene.getEngine();
             this._fitRenderingDevice = !size;
             this._fitRenderingDevice = !size;
             if (!size) {
             if (!size) {
@@ -109,6 +112,8 @@ var BABYLON;
             this._hierarchyLevelZFactor = 1 / this._hierarchyMaxDepth;
             this._hierarchyLevelZFactor = 1 / this._hierarchyMaxDepth;
             this._hierarchyLevelMaxSiblingCount = 1000;
             this._hierarchyLevelMaxSiblingCount = 1000;
             this._hierarchySiblingZDelta = this._hierarchyLevelZFactor / this._hierarchyLevelMaxSiblingCount;
             this._hierarchySiblingZDelta = this._hierarchyLevelZFactor / this._hierarchyLevelMaxSiblingCount;
+            this._primPointerInfo = new BABYLON.PrimitivePointerInfo();
+            this._capturedPointers = new BABYLON.StringDictionary();
             this.setupGroup2D(this, null, name, BABYLON.Vector2.Zero(), size, this._cachingStrategy === Canvas2D.CACHESTRATEGY_ALLGROUPS ? BABYLON.Group2D.GROUPCACHEBEHAVIOR_DONTCACHEOVERRIDE : BABYLON.Group2D.GROUPCACHEBEHAVIOR_FOLLOWCACHESTRATEGY);
             this.setupGroup2D(this, null, name, BABYLON.Vector2.Zero(), size, this._cachingStrategy === Canvas2D.CACHESTRATEGY_ALLGROUPS ? BABYLON.Group2D.GROUPCACHEBEHAVIOR_DONTCACHEOVERRIDE : BABYLON.Group2D.GROUPCACHEBEHAVIOR_FOLLOWCACHESTRATEGY);
             this._scene = scene;
             this._scene = scene;
             this._engine = engine;
             this._engine = engine;
@@ -119,6 +124,7 @@ var BABYLON;
             });
             });
             if (cachingstrategy !== Canvas2D.CACHESTRATEGY_TOPLEVELGROUPS) {
             if (cachingstrategy !== Canvas2D.CACHESTRATEGY_TOPLEVELGROUPS) {
                 this._background = BABYLON.Rectangle2D.Create(this, "###CANVAS BACKGROUND###", 0, 0, size.width, size.height);
                 this._background = BABYLON.Rectangle2D.Create(this, "###CANVAS BACKGROUND###", 0, 0, size.width, size.height);
+                this._background.isPickable = false;
                 this._background.origin = BABYLON.Vector2.Zero();
                 this._background.origin = BABYLON.Vector2.Zero();
                 this._background.levelVisible = false;
                 this._background.levelVisible = false;
             }
             }
@@ -136,6 +142,277 @@ var BABYLON;
             }
             }
             this._supprtInstancedArray = this._engine.getCaps().instancedArrays !== null;
             this._supprtInstancedArray = this._engine.getCaps().instancedArrays !== null;
             //            this._supprtInstancedArray = false; // TODO REMOVE!!!
             //            this._supprtInstancedArray = false; // TODO REMOVE!!!
+            this._setupInteraction(enableInteraction);
+        };
+        Canvas2D.prototype._setupInteraction = function (enable) {
+            var _this = this;
+            // No change detection
+            if (enable === this._interactionEnabled) {
+                return;
+            }
+            // Set the new state
+            this._interactionEnabled = enable;
+            // Disable interaction
+            if (!enable) {
+                if (this._scenePrePointerObserver) {
+                    this.scene.onPrePointerObservable.remove(this._scenePrePointerObserver);
+                    this._scenePrePointerObserver = null;
+                }
+                return;
+            }
+            // Enable Interaction
+            // Register the observable
+            this.scene.onPrePointerObservable.add(function (e, s) { return _this._handlePointerEventForInteraction(e, s); });
+        };
+        /**
+         * Internal method, you should use the Prim2DBase version instead
+         */
+        Canvas2D.prototype._setPointerCapture = function (pointerId, primitive) {
+            if (this.isPointerCaptured(pointerId)) {
+                return false;
+            }
+            // Try to capture the pointer on the HTML side
+            try {
+                this.engine.getRenderingCanvas().setPointerCapture(pointerId);
+            }
+            catch (e) {
+            }
+            this._primPointerInfo.updateRelatedTarget(primitive, BABYLON.Vector2.Zero());
+            this._bubbleNotifyPrimPointerObserver(primitive, BABYLON.PrimitivePointerInfo.PointerGotCapture);
+            this._capturedPointers.add(pointerId.toString(), primitive);
+            return true;
+        };
+        /**
+         * Internal method, you should use the Prim2DBase version instead
+         */
+        Canvas2D.prototype._releasePointerCapture = function (pointerId, primitive) {
+            if (this._capturedPointers.get(pointerId.toString()) !== primitive) {
+                return false;
+            }
+            // Try to release the pointer on the HTML side
+            try {
+                this.engine.getRenderingCanvas().releasePointerCapture(pointerId);
+            }
+            catch (e) {
+            }
+            this._primPointerInfo.updateRelatedTarget(primitive, BABYLON.Vector2.Zero());
+            this._bubbleNotifyPrimPointerObserver(primitive, BABYLON.PrimitivePointerInfo.PointerLostCapture);
+            this._capturedPointers.remove(pointerId.toString());
+            return true;
+        };
+        /**
+         * Determine if the given pointer is captured or not
+         * @param pointerId the Id of the pointer
+         * @return true if it's captured, false otherwise
+         */
+        Canvas2D.prototype.isPointerCaptured = function (pointerId) {
+            return this._capturedPointers.contains(pointerId.toString());
+        };
+        Canvas2D.prototype.getCapturedPrimitive = function (pointerId) {
+            // Avoid unnecessary lookup
+            if (this._capturedPointers.count === 0) {
+                return null;
+            }
+            return this._capturedPointers.get(pointerId.toString());
+        };
+        Canvas2D.prototype._handlePointerEventForInteraction = function (eventData, eventState) {
+            // Update the this._primPointerInfo structure we'll send to observers using the PointerEvent data
+            this._updatePointerInfo(eventData);
+            var capturedPrim = this.getCapturedPrimitive(this._primPointerInfo.pointerId);
+            // Make sure the intersection list is up to date, we maintain this list either in response of a mouse event (here) or before rendering the canvas.
+            // Why before rendering the canvas? because some primitives may move and get away/under the mouse cursor (which is not moving). So we need to update at both location in order to always have an accurate list, which is needed for the hover state change.
+            this._updateIntersectionList(this._primPointerInfo.canvasPointerPos, capturedPrim !== null);
+            // Update the over status, same as above, it's could be done here or during rendering, but will be performed only once per render frame
+            this._updateOverStatus();
+            // Check if we have nothing to raise
+            if (!this._actualOverPrimitive && !capturedPrim) {
+                return;
+            }
+            // Update the relatedTarget info with the over primitive or the captured one (if any)
+            var targetPrim = capturedPrim || this._actualOverPrimitive.prim;
+            var targetPointerPos = capturedPrim ? this._primPointerInfo.canvasPointerPos.subtract(new BABYLON.Vector2(targetPrim.globalTransform.m[12], targetPrim.globalTransform.m[13])) : this._actualOverPrimitive.intersectionLocation;
+            this._primPointerInfo.updateRelatedTarget(targetPrim, targetPointerPos);
+            // Analyze the pointer event type and fire proper events on the primitive
+            if (eventData.type === BABYLON.PointerEventTypes.POINTERWHEEL) {
+                this._bubbleNotifyPrimPointerObserver(targetPrim, BABYLON.PrimitivePointerInfo.PointerMouseWheel);
+            }
+            else if (eventData.type === BABYLON.PointerEventTypes.POINTERMOVE) {
+                this._bubbleNotifyPrimPointerObserver(targetPrim, BABYLON.PrimitivePointerInfo.PointerMove);
+            }
+            else if (eventData.type === BABYLON.PointerEventTypes.POINTERDOWN) {
+                this._bubbleNotifyPrimPointerObserver(targetPrim, BABYLON.PrimitivePointerInfo.PointerDown);
+            }
+            else if (eventData.type === BABYLON.PointerEventTypes.POINTERUP) {
+                this._bubbleNotifyPrimPointerObserver(targetPrim, BABYLON.PrimitivePointerInfo.PointerUp);
+            }
+        };
+        Canvas2D.prototype._updatePointerInfo = function (eventData) {
+            var pii = this._primPointerInfo;
+            if (!pii.canvasPointerPos) {
+                pii.canvasPointerPos = BABYLON.Vector2.Zero();
+            }
+            pii.canvasPointerPos.x = eventData.localPosition.x - this.position.x;
+            pii.canvasPointerPos.y = (this.engine.getRenderHeight() - eventData.localPosition.y) - this.position.y;
+            pii.mouseWheelDelta = 0;
+            if (eventData.type === BABYLON.PointerEventTypes.POINTERWHEEL) {
+                var event = eventData.event;
+                if (event.wheelDelta) {
+                    pii.mouseWheelDelta = event.wheelDelta / (BABYLON.PrimitivePointerInfo.MouseWheelPrecision * 40);
+                }
+                else if (event.detail) {
+                    pii.mouseWheelDelta = -event.detail / BABYLON.PrimitivePointerInfo.MouseWheelPrecision;
+                }
+            }
+            else {
+                var pe = eventData.event;
+                pii.ctrlKey = pe.ctrlKey;
+                pii.altKey = pe.altKey;
+                pii.shiftKey = pe.shiftKey;
+                pii.metaKey = pe.metaKey;
+                pii.button = pe.button;
+                pii.buttons = pe.buttons;
+                pii.pointerId = pe.pointerId;
+                pii.width = pe.width;
+                pii.height = pe.height;
+                pii.presssure = pe.pressure;
+                pii.tilt.x = pe.tiltX;
+                pii.tilt.y = pe.tiltY;
+                pii.isCaptured = this.getCapturedPrimitive(pe.pointerId) !== null;
+            }
+        };
+        Canvas2D.prototype._updateIntersectionList = function (mouseLocalPos, isCapture) {
+            if (this.scene.getRenderId() === this._intersectionRenderId) {
+                return;
+            }
+            var ii = Canvas2D._interInfo;
+            ii.pickPosition.x = mouseLocalPos.x;
+            ii.pickPosition.y = mouseLocalPos.y;
+            ii.findFirstOnly = false;
+            // Fast rejection: test if the mouse pointer is outside the canvas's bounding Info
+            if (!isCapture && !this.boundingInfo.doesIntersect(ii.pickPosition)) {
+                this._previousIntersectionList = this._actualIntersectionList;
+                this._actualIntersectionList = null;
+                this._previousOverPrimitive = this._actualOverPrimitive;
+                this._actualOverPrimitive = null;
+                return;
+            }
+            this._updateCanvasState();
+            this.intersect(ii);
+            this._previousIntersectionList = this._actualIntersectionList;
+            this._actualIntersectionList = ii.intersectedPrimitives;
+            this._previousOverPrimitive = this._actualOverPrimitive;
+            this._actualOverPrimitive = ii.topMostIntersectedPrimitive;
+            this._intersectionRenderId = this.scene.getRenderId();
+        };
+        // Based on the previousIntersectionList and the actualInstersectionList we can determined which primitives are being hover state or loosing it
+        Canvas2D.prototype._updateOverStatus = function () {
+            if ((this.scene.getRenderId() === this._hoverStatusRenderId) || !this._previousIntersectionList || !this._actualIntersectionList) {
+                return;
+            }
+            // Detect a change of over
+            var prevPrim = this._previousOverPrimitive ? this._previousOverPrimitive.prim : null;
+            var actualPrim = this._actualOverPrimitive ? this._actualOverPrimitive.prim : null;
+            if (prevPrim !== actualPrim) {
+                // Detect if the current pointer is captured, only fire event if they belong to the capture primitive
+                var capturedPrim = this.getCapturedPrimitive(this._primPointerInfo.pointerId);
+                // Notify the previous "over" prim that the pointer is no longer over it
+                if ((capturedPrim && capturedPrim === prevPrim) || (!capturedPrim && prevPrim)) {
+                    this._primPointerInfo.updateRelatedTarget(prevPrim, this._previousOverPrimitive.intersectionLocation);
+                    this._bubbleNotifyPrimPointerObserver(prevPrim, BABYLON.PrimitivePointerInfo.PointerOut);
+                }
+                // Notify the new "over" prim that the pointer is over it
+                if ((capturedPrim && capturedPrim === actualPrim) || (!capturedPrim && actualPrim)) {
+                    this._primPointerInfo.updateRelatedTarget(actualPrim, this._actualOverPrimitive.intersectionLocation);
+                    this._bubbleNotifyPrimPointerObserver(actualPrim, BABYLON.PrimitivePointerInfo.PointerOver);
+                }
+            }
+            this._hoverStatusRenderId = this.scene.getRenderId();
+        };
+        Canvas2D.prototype._updatePrimPointerPos = function (prim) {
+            if (this._primPointerInfo.isCaptured) {
+                this._primPointerInfo.primitivePointerPos = this._primPointerInfo.relatedTargetPointerPos;
+            }
+            else {
+                for (var _i = 0, _a = this._actualIntersectionList; _i < _a.length; _i++) {
+                    var pii = _a[_i];
+                    if (pii.prim === prim) {
+                        this._primPointerInfo.primitivePointerPos = pii.intersectionLocation;
+                        return;
+                    }
+                }
+            }
+        };
+        Canvas2D.prototype._debugExecObserver = function (prim, mask) {
+            if (!this._notifDebugMode) {
+                return;
+            }
+            var debug = "";
+            for (var i = 0; i < prim.hierarchyDepth; i++) {
+                debug += "  ";
+            }
+            var pii = this._primPointerInfo;
+            debug += "[RID:" + this.scene.getRenderId() + "] [" + prim.hierarchyDepth + "] event:" + BABYLON.PrimitivePointerInfo.getEventTypeName(mask) + ", id: " + prim.id + " (" + BABYLON.Tools.getClassName(prim) + "), primPos: " + pii.primitivePointerPos.toString() + ", canvasPos: " + pii.canvasPointerPos.toString();
+            console.log(debug);
+        };
+        Canvas2D.prototype._bubbleNotifyPrimPointerObserver = function (prim, mask) {
+            var pii = this._primPointerInfo;
+            // In case of PointerOver/Out we will first notify the children (but the deepest to the closest) with PointerEnter/Leave
+            if ((mask & (BABYLON.PrimitivePointerInfo.PointerOver | BABYLON.PrimitivePointerInfo.PointerOut)) !== 0) {
+                this._notifChildren(prim, mask);
+            }
+            var bubbleCancelled = false;
+            var cur = prim;
+            while (cur) {
+                // Only trigger the observers if the primitive is intersected (except for out)
+                if (!bubbleCancelled) {
+                    this._updatePrimPointerPos(cur);
+                    // Exec the observers
+                    this._debugExecObserver(cur, mask);
+                    cur._pointerEventObservable.notifyObservers(pii, mask);
+                    // Bubble canceled? If we're not executing PointerOver or PointerOut, quit immediately
+                    // If it's PointerOver/Out we have to trigger PointerEnter/Leave no matter what
+                    if (pii.cancelBubble) {
+                        if ((mask & (BABYLON.PrimitivePointerInfo.PointerOver | BABYLON.PrimitivePointerInfo.PointerOut)) === 0) {
+                            return;
+                        }
+                        // We're dealing with PointerOver/Out, let's keep looping to fire PointerEnter/Leave, but not Over/Out anymore
+                        bubbleCancelled = true;
+                    }
+                }
+                // If bubble is cancel we didn't update the Primitive Pointer Pos yet, let's do it
+                if (bubbleCancelled) {
+                    this._updatePrimPointerPos(cur);
+                }
+                // Trigger a PointerEnter corresponding to the PointerOver
+                if (mask === BABYLON.PrimitivePointerInfo.PointerOver) {
+                    this._debugExecObserver(cur, BABYLON.PrimitivePointerInfo.PointerEnter);
+                    cur._pointerEventObservable.notifyObservers(pii, BABYLON.PrimitivePointerInfo.PointerEnter);
+                }
+                else if (mask === BABYLON.PrimitivePointerInfo.PointerOut) {
+                    this._debugExecObserver(cur, BABYLON.PrimitivePointerInfo.PointerLeave);
+                    cur._pointerEventObservable.notifyObservers(pii, BABYLON.PrimitivePointerInfo.PointerLeave);
+                }
+                // Loop to the parent
+                cur = cur.parent;
+            }
+        };
+        Canvas2D.prototype._notifChildren = function (prim, mask) {
+            var _this = this;
+            var pii = this._primPointerInfo;
+            prim.children.forEach(function (curChild) {
+                // Recurse first, we want the deepest to be notified first
+                _this._notifChildren(curChild, mask);
+                _this._updatePrimPointerPos(curChild);
+                // Fire the proper notification
+                if (mask === BABYLON.PrimitivePointerInfo.PointerOver) {
+                    _this._debugExecObserver(curChild, BABYLON.PrimitivePointerInfo.PointerEnter);
+                    curChild._pointerEventObservable.notifyObservers(pii, BABYLON.PrimitivePointerInfo.PointerEnter);
+                }
+                else if (mask === BABYLON.PrimitivePointerInfo.PointerOut) {
+                    _this._debugExecObserver(curChild, BABYLON.PrimitivePointerInfo.PointerLeave);
+                    curChild._pointerEventObservable.notifyObservers(pii, BABYLON.PrimitivePointerInfo.PointerLeave);
+                }
+            });
         };
         };
         /**
         /**
          * Don't forget to call the dispose method when you're done with the Canvas instance.
          * Don't forget to call the dispose method when you're done with the Canvas instance.
@@ -145,6 +422,9 @@ var BABYLON;
             if (!_super.prototype.dispose.call(this)) {
             if (!_super.prototype.dispose.call(this)) {
                 return false;
                 return false;
             }
             }
+            if (this.interactionEnabled) {
+                this._setupInteraction(false);
+            }
             if (this._beforeRenderObserver) {
             if (this._beforeRenderObserver) {
                 this._scene.onBeforeRenderObservable.remove(this._beforeRenderObserver);
                 this._scene.onBeforeRenderObservable.remove(this._beforeRenderObserver);
                 this._beforeRenderObserver = null;
                 this._beforeRenderObserver = null;
@@ -280,6 +560,20 @@ var BABYLON;
             enumerable: true,
             enumerable: true,
             configurable: true
             configurable: true
         });
         });
+        Object.defineProperty(Canvas2D.prototype, "interactionEnabled", {
+            /**
+             * Enable/Disable interaction for this Canvas
+             * When enabled the Prim2DBase.pointerEventObservable property will notified when appropriate events occur
+             */
+            get: function () {
+                return this._interactionEnabled;
+            },
+            set: function (enable) {
+                this._setupInteraction(enable);
+            },
+            enumerable: true,
+            configurable: true
+        });
         Object.defineProperty(Canvas2D.prototype, "_engineData", {
         Object.defineProperty(Canvas2D.prototype, "_engineData", {
             get: function () {
             get: function () {
                 return this.__engineData;
                 return this.__engineData;
@@ -316,10 +610,11 @@ var BABYLON;
             enumerable: true,
             enumerable: true,
             configurable: true
             configurable: true
         });
         });
-        /**
-         * Method that renders the Canvas, you should not invoke
-         */
-        Canvas2D.prototype._render = function () {
+        Canvas2D.prototype._updateCanvasState = function () {
+            // Check if the update has already been made for this render Frame
+            if (this.scene.getRenderId() === this._updateRenderId) {
+                return;
+            }
             this._renderingSize.width = this.engine.getRenderWidth();
             this._renderingSize.width = this.engine.getRenderWidth();
             this._renderingSize.height = this.engine.getRenderHeight();
             this._renderingSize.height = this.engine.getRenderHeight();
             if (this._fitRenderingDevice) {
             if (this._fitRenderingDevice) {
@@ -333,6 +628,18 @@ var BABYLON;
             ++this._globalTransformProcessStep;
             ++this._globalTransformProcessStep;
             this.updateGlobalTransVis(false);
             this.updateGlobalTransVis(false);
             this._prepareGroupRender(context);
             this._prepareGroupRender(context);
+            this._updateRenderId = this.scene.getRenderId();
+        };
+        /**
+         * Method that renders the Canvas, you should not invoke
+         */
+        Canvas2D.prototype._render = function () {
+            this._updateCanvasState();
+            if (this._primPointerInfo.canvasPointerPos) {
+                this._updateIntersectionList(this._primPointerInfo.canvasPointerPos, false);
+                this._updateOverStatus(); // TODO this._primPointerInfo may not be up to date!
+            }
+            var context = new BABYLON.Render2DContext();
             this._groupRender(context);
             this._groupRender(context);
             // If the canvas is cached at canvas level, we must manually render the sprite that will display its content
             // If the canvas is cached at canvas level, we must manually render the sprite that will display its content
             if (this._cachingStrategy === Canvas2D.CACHESTRATEGY_CANVAS && this._cachedCanvasGroup) {
             if (this._cachingStrategy === Canvas2D.CACHESTRATEGY_CANVAS && this._cachedCanvasGroup) {
@@ -393,7 +700,7 @@ var BABYLON;
                 }
                 }
                 else {
                 else {
                     var sprite = BABYLON.Sprite2D.Create(parent, "__cachedSpriteOfGroup__" + group.id, group.position.x, group.position.y, map, node.contentSize, node.pos, false);
                     var sprite = BABYLON.Sprite2D.Create(parent, "__cachedSpriteOfGroup__" + group.id, group.position.x, group.position.y, map, node.contentSize, node.pos, false);
-                    sprite.origin = BABYLON.Vector2.Zero();
+                    sprite.origin = group.origin.clone();
                     res.sprite = sprite;
                     res.sprite = sprite;
                 }
                 }
             }
             }
@@ -444,6 +751,7 @@ var BABYLON;
          * Note that you can't use this strategy for WorldSpace Canvas, they need at least a top level group caching.
          * Note that you can't use this strategy for WorldSpace Canvas, they need at least a top level group caching.
          */
          */
         Canvas2D.CACHESTRATEGY_DONTCACHE = 4;
         Canvas2D.CACHESTRATEGY_DONTCACHE = 4;
+        Canvas2D._interInfo = new BABYLON.IntersectInfo2D();
         /**
         /**
          * Define the default size used for both the width and height of a MapTexture to allocate.
          * Define the default size used for both the width and height of a MapTexture to allocate.
          * Note that some MapTexture might be bigger than this size if the first node to allocate is bigger in width or height
          * Note that some MapTexture might be bigger than this size if the first node to allocate is bigger in width or height
@@ -455,6 +763,6 @@ var BABYLON;
             BABYLON.className("Canvas2D")
             BABYLON.className("Canvas2D")
         ], Canvas2D);
         ], Canvas2D);
         return Canvas2D;
         return Canvas2D;
-    }(BABYLON.Group2D));
+    })(BABYLON.Group2D);
     BABYLON.Canvas2D = Canvas2D;
     BABYLON.Canvas2D = Canvas2D;
 })(BABYLON || (BABYLON = {}));
 })(BABYLON || (BABYLON = {}));

+ 13 - 5
src/Canvas2d/babylon.group2d.js

@@ -32,6 +32,7 @@ var BABYLON;
         Group2D._createCachedCanvasGroup = function (owner) {
         Group2D._createCachedCanvasGroup = function (owner) {
             var g = new Group2D();
             var g = new Group2D();
             g.setupGroup2D(owner, null, "__cachedCanvasGroup__", BABYLON.Vector2.Zero());
             g.setupGroup2D(owner, null, "__cachedCanvasGroup__", BABYLON.Vector2.Zero());
+            g.origin = BABYLON.Vector2.Zero();
             return g;
             return g;
         };
         };
         Group2D.prototype.applyCachedTexture = function (vertexData, material) {
         Group2D.prototype.applyCachedTexture = function (vertexData, material) {
@@ -165,6 +166,10 @@ var BABYLON;
             this._prepareGroupRender(context);
             this._prepareGroupRender(context);
             this._groupRender(context);
             this._groupRender(context);
         };
         };
+        Group2D.prototype.levelIntersect = function (intersectInfo) {
+            // If we've made it so far it means the boundingInfo intersection test succeed, the Group2D is shaped the same, so we always return true
+            return true;
+        };
         Group2D.prototype.updateLevelBoundingInfo = function () {
         Group2D.prototype.updateLevelBoundingInfo = function () {
             var size;
             var size;
             // If the size is set by the user, the boundingInfo is computed from this value
             // If the size is set by the user, the boundingInfo is computed from this value
@@ -237,7 +242,7 @@ var BABYLON;
                     sortedDirtyList.forEach(function (p) {
                     sortedDirtyList.forEach(function (p) {
                         // We need to check if prepare is needed because even if the primitive is in the dirtyList, its parent primitive may also have been modified, then prepared, then recurse on its children primitives (this one for instance) if the changes where impacting them.
                         // We need to check if prepare is needed because even if the primitive is in the dirtyList, its parent primitive may also have been modified, then prepared, then recurse on its children primitives (this one for instance) if the changes where impacting them.
                         // For instance: a Rect's position change, the position of its children primitives will also change so a prepare will be call on them. If a child was in the dirtyList we will avoid a second prepare by making this check.
                         // For instance: a Rect's position change, the position of its children primitives will also change so a prepare will be call on them. If a child was in the dirtyList we will avoid a second prepare by making this check.
-                        if (!p.isDisposed && p.needPrepare()) {
+                        if (!p.isDisposed && p._needPrepare()) {
                             p._prepareRender(context);
                             p._prepareRender(context);
                         }
                         }
                     });
                     });
@@ -268,7 +273,7 @@ var BABYLON;
                     var curVP = engine.setDirectViewport(this._viewportPosition.x, this._viewportPosition.y, this._viewportSize.width, this._viewportSize.height);
                     var curVP = engine.setDirectViewport(this._viewportPosition.x, this._viewportPosition.y, this._viewportSize.width, this._viewportSize.height);
                 }
                 }
                 // For each different model of primitive to render
                 // For each different model of primitive to render
-                var totalRenderCount_1 = 0;
+                var totalRenderCount = 0;
                 this._renderGroupInstancesInfo.forEach(function (k, v) {
                 this._renderGroupInstancesInfo.forEach(function (k, v) {
                     // This part will pack the dynamicfloatarray and update the instanced array WebGLBufffer
                     // This part will pack the dynamicfloatarray and update the instanced array WebGLBufffer
                     // Skip it if instanced arrays are not supported
                     // Skip it if instanced arrays are not supported
@@ -277,7 +282,7 @@ var BABYLON;
                             // If the instances of the model was changed, pack the data
                             // If the instances of the model was changed, pack the data
                             var array = v._instancesPartsData[i];
                             var array = v._instancesPartsData[i];
                             var instanceData_1 = array.pack();
                             var instanceData_1 = array.pack();
-                            totalRenderCount_1 += array.usedElementCount;
+                            totalRenderCount += array.usedElementCount;
                             // Compute the size the instance buffer should have
                             // Compute the size the instance buffer should have
                             var neededSize = array.usedElementCount * array.stride * 4;
                             var neededSize = array.usedElementCount * array.stride * 4;
                             // Check if we have to (re)create the instancesBuffer because there's none or the size is too small
                             // Check if we have to (re)create the instancesBuffer because there's none or the size is too small
@@ -300,7 +305,7 @@ var BABYLON;
                         }
                         }
                     }
                     }
                     // Submit render only if we have something to render (everything may be hidden and the floatarray empty)
                     // Submit render only if we have something to render (everything may be hidden and the floatarray empty)
-                    if (!_this.owner.supportInstancedArray || totalRenderCount_1 > 0) {
+                    if (!_this.owner.supportInstancedArray || totalRenderCount > 0) {
                         // render all the instances of this model, if the render method returns true then our instances are no longer dirty
                         // render all the instances of this model, if the render method returns true then our instances are no longer dirty
                         var renderFailed = !v._modelCache.render(v, context);
                         var renderFailed = !v._modelCache.render(v, context);
                         // Update dirty flag/related
                         // Update dirty flag/related
@@ -367,6 +372,9 @@ var BABYLON;
             else if (prop.id === BABYLON.Prim2DBase.scaleProperty.id) {
             else if (prop.id === BABYLON.Prim2DBase.scaleProperty.id) {
                 this._cacheRenderSprite.scale = this.scale;
                 this._cacheRenderSprite.scale = this.scale;
             }
             }
+            else if (prop.id === BABYLON.Prim2DBase.originProperty.id) {
+                this._cacheRenderSprite.origin = this.origin.clone();
+            }
             else if (prop.id === Group2D.actualSizeProperty.id) {
             else if (prop.id === Group2D.actualSizeProperty.id) {
                 this._cacheRenderSprite.spriteSize = this.actualSize.clone();
                 this._cacheRenderSprite.spriteSize = this.actualSize.clone();
             }
             }
@@ -452,6 +460,6 @@ var BABYLON;
             BABYLON.className("Group2D")
             BABYLON.className("Group2D")
         ], Group2D);
         ], Group2D);
         return Group2D;
         return Group2D;
-    }(BABYLON.Prim2DBase));
+    })(BABYLON.Prim2DBase);
     BABYLON.Group2D = Group2D;
     BABYLON.Group2D = Group2D;
 })(BABYLON || (BABYLON = {}));
 })(BABYLON || (BABYLON = {}));

+ 2 - 2
src/Canvas2d/babylon.modelRenderCache.js

@@ -31,7 +31,7 @@ var BABYLON;
             return true;
             return true;
         };
         };
         return GroupInstanceInfo;
         return GroupInstanceInfo;
-    }());
+    })();
     BABYLON.GroupInstanceInfo = GroupInstanceInfo;
     BABYLON.GroupInstanceInfo = GroupInstanceInfo;
     var ModelRenderCache = (function () {
     var ModelRenderCache = (function () {
         function ModelRenderCache(engine, modelKey, isTransparent) {
         function ModelRenderCache(engine, modelKey, isTransparent) {
@@ -178,6 +178,6 @@ var BABYLON;
         ModelRenderCache.v3 = BABYLON.Vector3.Zero();
         ModelRenderCache.v3 = BABYLON.Vector3.Zero();
         ModelRenderCache.v4 = BABYLON.Vector4.Zero();
         ModelRenderCache.v4 = BABYLON.Vector4.Zero();
         return ModelRenderCache;
         return ModelRenderCache;
-    }());
+    })();
     BABYLON.ModelRenderCache = ModelRenderCache;
     BABYLON.ModelRenderCache = ModelRenderCache;
 })(BABYLON || (BABYLON = {}));
 })(BABYLON || (BABYLON = {}));

+ 401 - 17
src/Canvas2d/babylon.prim2dBase.js

@@ -15,8 +15,207 @@ var BABYLON;
         function Render2DContext() {
         function Render2DContext() {
         }
         }
         return Render2DContext;
         return Render2DContext;
-    }());
+    })();
     BABYLON.Render2DContext = Render2DContext;
     BABYLON.Render2DContext = Render2DContext;
+    /**
+     * This class store information for the pointerEventObservable Observable.
+     * The Observable is divided into many sub events (using the Mask feature of the Observable pattern): PointerOver, PointerEnter, PointerDown, PointerMouseWheel, PointerMove, PointerUp, PointerDown, PointerLeave, PointerGotCapture and PointerLostCapture.
+     */
+    var PrimitivePointerInfo = (function () {
+        function PrimitivePointerInfo() {
+            this.primitivePointerPos = BABYLON.Vector2.Zero();
+            this.tilt = BABYLON.Vector2.Zero();
+            this.cancelBubble = false;
+        }
+        Object.defineProperty(PrimitivePointerInfo, "PointerOver", {
+            // The behavior is based on the HTML specifications of the Pointer Events (https://www.w3.org/TR/pointerevents/#list-of-pointer-events). This is not 100% compliant and not meant to be, but still, it's based on these specs for most use cases to be programmed the same way (as closest as possible) as it would have been in HTML.
+            /**
+             * This event type is raised when a pointing device is moved into the hit test boundaries of a primitive.
+             * Bubbles: yes
+             */
+            get: function () {
+                return PrimitivePointerInfo._pointerOver;
+            },
+            enumerable: true,
+            configurable: true
+        });
+        Object.defineProperty(PrimitivePointerInfo, "PointerEnter", {
+            /**
+             * This event type is raised when a pointing device is moved into the hit test boundaries of a primitive or one of its descendants.
+             * Bubbles: no
+             */
+            get: function () {
+                return PrimitivePointerInfo._pointerEnter;
+            },
+            enumerable: true,
+            configurable: true
+        });
+        Object.defineProperty(PrimitivePointerInfo, "PointerDown", {
+            /**
+             * This event type is raised when a pointer enters the active button state (non-zero value in the buttons property). For mouse it's when the device transitions from no buttons depressed to at least one button depressed. For touch/pen this is when a physical contact is made.
+             * Bubbles: yes
+             */
+            get: function () {
+                return PrimitivePointerInfo._pointerDown;
+            },
+            enumerable: true,
+            configurable: true
+        });
+        Object.defineProperty(PrimitivePointerInfo, "PointerMouseWheel", {
+            /**
+             * This event type is raised when the pointer is a mouse and it's wheel is rolling
+             * Bubbles: yes
+             */
+            get: function () {
+                return PrimitivePointerInfo._pointerMouseWheel;
+            },
+            enumerable: true,
+            configurable: true
+        });
+        Object.defineProperty(PrimitivePointerInfo, "PointerMove", {
+            /**
+             * This event type is raised when a pointer change coordinates or when a pointer changes button state, pressure, tilt, or contact geometry and the circumstances produce no other pointers events.
+             * Bubbles: yes
+             */
+            get: function () {
+                return PrimitivePointerInfo._pointerMove;
+            },
+            enumerable: true,
+            configurable: true
+        });
+        Object.defineProperty(PrimitivePointerInfo, "PointerUp", {
+            /**
+             * This event type is raised when the pointer leaves the active buttons states (zero value in the buttons property). For mouse, this is when the device transitions from at least one button depressed to no buttons depressed. For touch/pen, this is when physical contact is removed.
+             * Bubbles: yes
+             */
+            get: function () {
+                return PrimitivePointerInfo._pointerUp;
+            },
+            enumerable: true,
+            configurable: true
+        });
+        Object.defineProperty(PrimitivePointerInfo, "PointerOut", {
+            /**
+             * This event type is raised when a pointing device is moved out of the hit test the boundaries of a primitive.
+             * Bubbles: yes
+             */
+            get: function () {
+                return PrimitivePointerInfo._pointerOut;
+            },
+            enumerable: true,
+            configurable: true
+        });
+        Object.defineProperty(PrimitivePointerInfo, "PointerLeave", {
+            /**
+             * This event type is raised when a pointing device is moved out of the hit test boundaries of a primitive and all its descendants.
+             * Bubbles: no
+             */
+            get: function () {
+                return PrimitivePointerInfo._pointerLeave;
+            },
+            enumerable: true,
+            configurable: true
+        });
+        Object.defineProperty(PrimitivePointerInfo, "PointerGotCapture", {
+            /**
+             * This event type is raised when a primitive receives the pointer capture. This event is fired at the element that is receiving pointer capture. Subsequent events for that pointer will be fired at this element.
+             * Bubbles: yes
+             */
+            get: function () {
+                return PrimitivePointerInfo._pointerGotCapture;
+            },
+            enumerable: true,
+            configurable: true
+        });
+        Object.defineProperty(PrimitivePointerInfo, "PointerLostCapture", {
+            /**
+             * This event type is raised after pointer capture is released for a pointer.
+             * Bubbles: yes
+             */
+            get: function () {
+                return PrimitivePointerInfo._pointerLostCapture;
+            },
+            enumerable: true,
+            configurable: true
+        });
+        Object.defineProperty(PrimitivePointerInfo, "MouseWheelPrecision", {
+            get: function () {
+                return PrimitivePointerInfo._mouseWheelPrecision;
+            },
+            enumerable: true,
+            configurable: true
+        });
+        PrimitivePointerInfo.prototype.updateRelatedTarget = function (prim, primPointerPos) {
+            this.relatedTarget = prim;
+            this.relatedTargetPointerPos = primPointerPos;
+        };
+        PrimitivePointerInfo.getEventTypeName = function (mask) {
+            switch (mask) {
+                case PrimitivePointerInfo.PointerOver: return "PointerOver";
+                case PrimitivePointerInfo.PointerEnter: return "PointerEnter";
+                case PrimitivePointerInfo.PointerDown: return "PointerDown";
+                case PrimitivePointerInfo.PointerMouseWheel: return "PointerMouseWheel";
+                case PrimitivePointerInfo.PointerMove: return "PointerMove";
+                case PrimitivePointerInfo.PointerUp: return "PointerUp";
+                case PrimitivePointerInfo.PointerOut: return "PointerOut";
+                case PrimitivePointerInfo.PointerLeave: return "PointerLeave";
+                case PrimitivePointerInfo.PointerGotCapture: return "PointerGotCapture";
+                case PrimitivePointerInfo.PointerLostCapture: return "PointerLostCapture";
+            }
+        };
+        PrimitivePointerInfo._pointerOver = 0x0001;
+        PrimitivePointerInfo._pointerEnter = 0x0002;
+        PrimitivePointerInfo._pointerDown = 0x0004;
+        PrimitivePointerInfo._pointerMouseWheel = 0x0008;
+        PrimitivePointerInfo._pointerMove = 0x0010;
+        PrimitivePointerInfo._pointerUp = 0x0020;
+        PrimitivePointerInfo._pointerOut = 0x0040;
+        PrimitivePointerInfo._pointerLeave = 0x0080;
+        PrimitivePointerInfo._pointerGotCapture = 0x0100;
+        PrimitivePointerInfo._pointerLostCapture = 0x0200;
+        PrimitivePointerInfo._mouseWheelPrecision = 3.0;
+        return PrimitivePointerInfo;
+    })();
+    BABYLON.PrimitivePointerInfo = PrimitivePointerInfo;
+    /**
+     * Stores information about a Primitive that was intersected
+     */
+    var PrimitiveIntersectedInfo = (function () {
+        function PrimitiveIntersectedInfo(prim, intersectionLocation) {
+            this.prim = prim;
+            this.intersectionLocation = intersectionLocation;
+        }
+        return PrimitiveIntersectedInfo;
+    })();
+    BABYLON.PrimitiveIntersectedInfo = PrimitiveIntersectedInfo;
+    /**
+     * Main class used for the Primitive Intersection API
+     */
+    var IntersectInfo2D = (function () {
+        function IntersectInfo2D() {
+            this.findFirstOnly = false;
+            this.intersectHidden = false;
+            this.pickPosition = BABYLON.Vector2.Zero();
+        }
+        Object.defineProperty(IntersectInfo2D.prototype, "isIntersected", {
+            /**
+             * true if at least one primitive intersected during the test
+             */
+            get: function () {
+                return this.intersectedPrimitives && this.intersectedPrimitives.length > 0;
+            },
+            enumerable: true,
+            configurable: true
+        });
+        // Internals, don't use
+        IntersectInfo2D.prototype._exit = function (firstLevel) {
+            if (firstLevel) {
+                this._globalPickPosition = null;
+            }
+        };
+        return IntersectInfo2D;
+    })();
+    BABYLON.IntersectInfo2D = IntersectInfo2D;
     var Prim2DBase = (function (_super) {
     var Prim2DBase = (function (_super) {
         __extends(Prim2DBase, _super);
         __extends(Prim2DBase, _super);
         function Prim2DBase() {
         function Prim2DBase() {
@@ -28,6 +227,9 @@ var BABYLON;
                 throw new Error("Can't create a primitive with the canvas as direct parent when the caching strategy is TOPLEVELGROUPS. You need to create a Group below the canvas and use it as the parent for the primitive");
                 throw new Error("Can't create a primitive with the canvas as direct parent when the caching strategy is TOPLEVELGROUPS. You need to create a Group below the canvas and use it as the parent for the primitive");
             }
             }
             this.setupSmartPropertyPrim();
             this.setupSmartPropertyPrim();
+            this._pointerEventObservable = new BABYLON.Observable();
+            this._isPickable = true;
+            this._siblingDepthOffset = this._hierarchyDepthOffset = 0;
             this._boundingInfoDirty = true;
             this._boundingInfoDirty = true;
             this._boundingInfo = new BABYLON.BoundingInfo2D();
             this._boundingInfo = new BABYLON.BoundingInfo2D();
             this._owner = owner;
             this._owner = owner;
@@ -56,6 +258,11 @@ var BABYLON;
             this.levelVisible = isVisible;
             this.levelVisible = isVisible;
             this.origin = new BABYLON.Vector2(0.5, 0.5);
             this.origin = new BABYLON.Vector2(0.5, 0.5);
         };
         };
+        /**
+         * From 'this' primitive, traverse up (from parent to parent) until the given predicate is true
+         * @param predicate the predicate to test on each parent
+         * @return the first primitive where the predicate was successful
+         */
         Prim2DBase.prototype.traverseUp = function (predicate) {
         Prim2DBase.prototype.traverseUp = function (predicate) {
             var p = this;
             var p = this;
             while (p != null) {
             while (p != null) {
@@ -67,6 +274,9 @@ var BABYLON;
             return null;
             return null;
         };
         };
         Object.defineProperty(Prim2DBase.prototype, "owner", {
         Object.defineProperty(Prim2DBase.prototype, "owner", {
+            /**
+             * Retrieve the owner Canvas2D
+             */
             get: function () {
             get: function () {
                 return this._owner;
                 return this._owner;
             },
             },
@@ -74,13 +284,29 @@ var BABYLON;
             configurable: true
             configurable: true
         });
         });
         Object.defineProperty(Prim2DBase.prototype, "parent", {
         Object.defineProperty(Prim2DBase.prototype, "parent", {
+            /**
+             * Get the parent primitive (can be the Canvas, only the Canvas has no parent)
+             */
             get: function () {
             get: function () {
                 return this._parent;
                 return this._parent;
             },
             },
             enumerable: true,
             enumerable: true,
             configurable: true
             configurable: true
         });
         });
+        Object.defineProperty(Prim2DBase.prototype, "children", {
+            /**
+             * The array of direct children primitives
+             */
+            get: function () {
+                return this._children;
+            },
+            enumerable: true,
+            configurable: true
+        });
         Object.defineProperty(Prim2DBase.prototype, "id", {
         Object.defineProperty(Prim2DBase.prototype, "id", {
+            /**
+             * The identifier of this primitive, may not be unique, it's for information purpose only
+             */
             get: function () {
             get: function () {
                 return this._id;
                 return this._id;
             },
             },
@@ -117,14 +343,25 @@ var BABYLON;
             enumerable: true,
             enumerable: true,
             configurable: true
             configurable: true
         });
         });
+        Object.defineProperty(Prim2DBase.prototype, "actualSize", {
+            /**
+             * this method must be implemented by the primitive type to return its size
+             * @returns The size of the primitive
+             */
+            get: function () {
+                return undefined;
+            },
+            enumerable: true,
+            configurable: true
+        });
         Object.defineProperty(Prim2DBase.prototype, "origin", {
         Object.defineProperty(Prim2DBase.prototype, "origin", {
             /**
             /**
              * The origin defines the normalized coordinate of the center of the primitive, from the top/left corner.
              * The origin defines the normalized coordinate of the center of the primitive, from the top/left corner.
              * The origin is used only to compute transformation of the primitive, it has no meaning in the primitive local frame of reference
              * The origin is used only to compute transformation of the primitive, it has no meaning in the primitive local frame of reference
              * For instance:
              * For instance:
-             * 0,0 means the center is top/left
-             * 0.5,0.5 means the center is at the center of the primitive
-             * 0,1 means the center is bottom/left
+             * 0,0 means the center is bottom/left. Which is the default for Canvas2D instances
+             * 0.5,0.5 means the center is at the center of the primitive, which is default of all types of Primitives
+             * 0,1 means the center is top/left
              * @returns The normalized center.
              * @returns The normalized center.
              */
              */
             get: function () {
             get: function () {
@@ -166,7 +403,24 @@ var BABYLON;
             enumerable: true,
             enumerable: true,
             configurable: true
             configurable: true
         });
         });
+        Object.defineProperty(Prim2DBase.prototype, "isPickable", {
+            /**
+             * Define if the Primitive can be subject to intersection test or not (default is true)
+             */
+            get: function () {
+                return this._isPickable;
+            },
+            set: function (value) {
+                this._isPickable = value;
+            },
+            enumerable: true,
+            configurable: true
+        });
         Object.defineProperty(Prim2DBase.prototype, "hierarchyDepth", {
         Object.defineProperty(Prim2DBase.prototype, "hierarchyDepth", {
+            /**
+             * Return the depth level of the Primitive into the Canvas' Graph. A Canvas will be 0, its direct children 1, and so on.
+             * @returns {}
+             */
             get: function () {
             get: function () {
                 return this._hierarchyDepth;
                 return this._hierarchyDepth;
             },
             },
@@ -174,6 +428,10 @@ var BABYLON;
             configurable: true
             configurable: true
         });
         });
         Object.defineProperty(Prim2DBase.prototype, "renderGroup", {
         Object.defineProperty(Prim2DBase.prototype, "renderGroup", {
+            /**
+             * Retrieve the Group that is responsible to render this primitive
+             * @returns {}
+             */
             get: function () {
             get: function () {
                 return this._renderGroup;
                 return this._renderGroup;
             },
             },
@@ -181,6 +439,9 @@ var BABYLON;
             configurable: true
             configurable: true
         });
         });
         Object.defineProperty(Prim2DBase.prototype, "globalTransform", {
         Object.defineProperty(Prim2DBase.prototype, "globalTransform", {
+            /**
+             * Get the global transformation matrix of the primitive
+             */
             get: function () {
             get: function () {
                 return this._globalTransform;
                 return this._globalTransform;
             },
             },
@@ -188,13 +449,32 @@ var BABYLON;
             configurable: true
             configurable: true
         });
         });
         Object.defineProperty(Prim2DBase.prototype, "invGlobalTransform", {
         Object.defineProperty(Prim2DBase.prototype, "invGlobalTransform", {
+            /**
+             * Get invert of the global transformation matrix of the primitive
+             * @returns {}
+             */
             get: function () {
             get: function () {
                 return this._invGlobalTransform;
                 return this._invGlobalTransform;
             },
             },
             enumerable: true,
             enumerable: true,
             configurable: true
             configurable: true
         });
         });
+        Object.defineProperty(Prim2DBase.prototype, "localTransform", {
+            /**
+             * Get the local transformation of the primitive
+             */
+            get: function () {
+                this._updateLocalTransform();
+                return this._localTransform;
+            },
+            enumerable: true,
+            configurable: true
+        });
         Object.defineProperty(Prim2DBase.prototype, "boundingInfo", {
         Object.defineProperty(Prim2DBase.prototype, "boundingInfo", {
+            /**
+             * Get the boundingInfo associated to the primitive.
+             * The value is supposed to be always up to date
+             */
             get: function () {
             get: function () {
                 if (this._boundingInfoDirty) {
                 if (this._boundingInfoDirty) {
                     this._boundingInfo = this.levelBoundingInfo.clone();
                     this._boundingInfo = this.levelBoundingInfo.clone();
@@ -202,8 +482,7 @@ var BABYLON;
                     var tps = new BABYLON.BoundingInfo2D();
                     var tps = new BABYLON.BoundingInfo2D();
                     for (var _i = 0, _a = this._children; _i < _a.length; _i++) {
                     for (var _i = 0, _a = this._children; _i < _a.length; _i++) {
                         var curChild = _a[_i];
                         var curChild = _a[_i];
-                        var t = curChild.globalTransform.multiply(this.invGlobalTransform);
-                        curChild.boundingInfo.transformToRef(t, curChild.origin, tps);
+                        curChild.boundingInfo.transformToRef(curChild.localTransform, tps);
                         bi.unionToRef(tps, bi);
                         bi.unionToRef(tps, bi);
                     }
                     }
                     this._boundingInfoDirty = false;
                     this._boundingInfoDirty = false;
@@ -213,6 +492,95 @@ var BABYLON;
             enumerable: true,
             enumerable: true,
             configurable: true
             configurable: true
         });
         });
+        Object.defineProperty(Prim2DBase.prototype, "pointerEventObservable", {
+            /**
+             * Interaction with the primitive can be create using this Observable. See the PrimitivePointerInfo class for more information
+             */
+            get: function () {
+                return this._pointerEventObservable;
+            },
+            enumerable: true,
+            configurable: true
+        });
+        Prim2DBase.prototype.levelIntersect = function (intersectInfo) {
+            return false;
+        };
+        /**
+         * Capture all the Events of the given PointerId for this primitive.
+         * Don't forget to call releasePointerEventsCapture when done.
+         * @param pointerId the Id of the pointer to capture the events from.
+         */
+        Prim2DBase.prototype.setPointerEventCapture = function (pointerId) {
+            return this.owner._setPointerCapture(pointerId, this);
+        };
+        /**
+         * Release a captured pointer made with setPointerEventCapture.
+         * @param pointerId the Id of the pointer to release the capture from.
+         */
+        Prim2DBase.prototype.releasePointerEventsCapture = function (pointerId) {
+            return this.owner._releasePointerCapture(pointerId, this);
+        };
+        /**
+         * Make an intersection test with the primitive, all inputs/outputs are stored in the IntersectInfo2D class, see its documentation for more information.
+         * @param intersectInfo contains the settings of the intersection to perform, to setup before calling this method as well as the result, available after a call to this method.
+         */
+        Prim2DBase.prototype.intersect = function (intersectInfo) {
+            if (!intersectInfo) {
+                return false;
+            }
+            // If this is null it means this method is call for the first level, initialize stuffs
+            var firstLevel = !intersectInfo._globalPickPosition;
+            if (firstLevel) {
+                // Compute the pickPosition in global space and use it to find the local position for each level down, always relative from the world to get the maximum accuracy (and speed). The other way would have been to compute in local every level down relative to its parent's local, which wouldn't be as accurate (even if javascript number is 80bits accurate).
+                intersectInfo._globalPickPosition = BABYLON.Vector2.Zero();
+                BABYLON.Vector2.TransformToRef(intersectInfo.pickPosition, this.globalTransform, intersectInfo._globalPickPosition);
+                intersectInfo._localPickPosition = intersectInfo.pickPosition.clone();
+                intersectInfo.intersectedPrimitives = new Array();
+                intersectInfo.topMostIntersectedPrimitive = null;
+            }
+            if (!intersectInfo.intersectHidden && !this.isVisible) {
+                return false;
+            }
+            // Fast rejection test with boundingInfo
+            if (!this.boundingInfo.doesIntersect(intersectInfo._localPickPosition)) {
+                // Important to call this before each return to allow a good recursion next time this intersectInfo is reused
+                intersectInfo._exit(firstLevel);
+                return false;
+            }
+            // We hit the boundingInfo that bounds this primitive and its children, now we have to test on the primitive of this level
+            var levelIntersectRes = this.levelIntersect(intersectInfo);
+            if (levelIntersectRes) {
+                var pii = new PrimitiveIntersectedInfo(this, intersectInfo._localPickPosition.clone());
+                intersectInfo.intersectedPrimitives.push(pii);
+                if (!intersectInfo.topMostIntersectedPrimitive || (intersectInfo.topMostIntersectedPrimitive.prim.getActualZOffset() > pii.prim.getActualZOffset())) {
+                    intersectInfo.topMostIntersectedPrimitive = pii;
+                }
+                // If we must stop at the first intersection, we're done, quit!
+                if (intersectInfo.findFirstOnly) {
+                    intersectInfo._exit(firstLevel);
+                    return true;
+                }
+            }
+            // Recurse to children if needed
+            if (!levelIntersectRes || !intersectInfo.findFirstOnly) {
+                for (var _i = 0, _a = this._children; _i < _a.length; _i++) {
+                    var curChild = _a[_i];
+                    // Don't test primitive not pick able or if it's hidden and we don't test hidden ones
+                    if (!curChild.isPickable || (!intersectInfo.intersectHidden && !curChild.isVisible)) {
+                        continue;
+                    }
+                    // Must compute the localPickLocation for the children level
+                    BABYLON.Vector2.TransformToRef(intersectInfo._globalPickPosition, curChild.invGlobalTransform, intersectInfo._localPickPosition);
+                    // If we got an intersection with the child and we only need to find the first one, quit!
+                    if (curChild.intersect(intersectInfo) && intersectInfo.findFirstOnly) {
+                        intersectInfo._exit(firstLevel);
+                        return true;
+                    }
+                }
+            }
+            intersectInfo._exit(firstLevel);
+            return intersectInfo.isIntersected;
+        };
         Prim2DBase.prototype.moveChild = function (child, previous) {
         Prim2DBase.prototype.moveChild = function (child, previous) {
             if (child.parent !== this) {
             if (child.parent !== this) {
                 return false;
                 return false;
@@ -266,7 +634,7 @@ var BABYLON;
                 this._renderGroup._addPrimToDirtyList(this);
                 this._renderGroup._addPrimToDirtyList(this);
             }
             }
         };
         };
-        Prim2DBase.prototype.needPrepare = function () {
+        Prim2DBase.prototype._needPrepare = function () {
             return (this.isVisible || this._visibilityChanged) && (this._modelDirty || (this._instanceDirtyFlags !== 0) || (this._globalTransformProcessStep !== this._globalTransformStep));
             return (this.isVisible || this._visibilityChanged) && (this._modelDirty || (this._instanceDirtyFlags !== 0) || (this._globalTransformProcessStep !== this._globalTransformStep));
         };
         };
         Prim2DBase.prototype._prepareRender = function (context) {
         Prim2DBase.prototype._prepareRender = function (context) {
@@ -306,11 +674,29 @@ var BABYLON;
             }
             }
         };
         };
         Prim2DBase.prototype.updateGlobalTransVisOf = function (list, recurse) {
         Prim2DBase.prototype.updateGlobalTransVisOf = function (list, recurse) {
-            for (var _i = 0, list_1 = list; _i < list_1.length; _i++) {
-                var cur = list_1[_i];
+            for (var _i = 0; _i < list.length; _i++) {
+                var cur = list[_i];
                 cur.updateGlobalTransVis(recurse);
                 cur.updateGlobalTransVis(recurse);
             }
             }
         };
         };
+        Prim2DBase.prototype._updateLocalTransform = function () {
+            var tflags = Prim2DBase.positionProperty.flagId | Prim2DBase.rotationProperty.flagId | Prim2DBase.scaleProperty.flagId;
+            if (this.checkPropertiesDirty(tflags)) {
+                var rot = BABYLON.Quaternion.RotationAxis(new BABYLON.Vector3(0, 0, 1), this._rotation);
+                var local = BABYLON.Matrix.Compose(new BABYLON.Vector3(this._scale, this._scale, this._scale), rot, new BABYLON.Vector3(this._position.x, this._position.y, 0));
+                this._localTransform = local;
+                this.clearPropertiesDirty(tflags);
+                // this is important to access actualSize AFTER fetching a first version of the local transform and reset the dirty flag, because accessing actualSize on a Group2D which actualSize is built from its content will trigger a call to this very method on this very object. We won't mind about the origin offset not being computed, as long as we return a local transform based on the position/rotation/scale
+                var actualSize = this.actualSize;
+                if (!actualSize) {
+                    throw new Error("The primitive type: " + BABYLON.Tools.getClassName(this) + " must implement the actualSize get property!");
+                }
+                local.m[12] -= (actualSize.width * this.origin.x) * local.m[0] + (actualSize.height * this.origin.y) * local.m[4];
+                local.m[13] -= (actualSize.width * this.origin.x) * local.m[1] + (actualSize.height * this.origin.y) * local.m[5];
+                return true;
+            }
+            return false;
+        };
         Prim2DBase.prototype.updateGlobalTransVis = function (recurse) {
         Prim2DBase.prototype.updateGlobalTransVis = function (recurse) {
             if (this.isDisposed) {
             if (this.isDisposed) {
                 return;
                 return;
@@ -325,16 +711,14 @@ var BABYLON;
                 this.isVisible = (!this._parent || this._parent.isVisible) && this.levelVisible;
                 this.isVisible = (!this._parent || this._parent.isVisible) && this.levelVisible;
                 // Detect a change of visibility
                 // Detect a change of visibility
                 this._visibilityChanged = (curVisibleState !== undefined) && curVisibleState !== this.isVisible;
                 this._visibilityChanged = (curVisibleState !== undefined) && curVisibleState !== this.isVisible;
-                // Detect if either the parent or this node changed
-                var tflags = Prim2DBase.positionProperty.flagId | Prim2DBase.rotationProperty.flagId | Prim2DBase.scaleProperty.flagId;
-                if (this.isVisible && (this._parent && this._parent._globalTransformStep !== this._parentTransformStep) || this.checkPropertiesDirty(tflags)) {
-                    var rot = BABYLON.Quaternion.RotationAxis(new BABYLON.Vector3(0, 0, 1), this._rotation);
-                    var local = BABYLON.Matrix.Compose(new BABYLON.Vector3(this._scale, this._scale, this._scale), rot, new BABYLON.Vector3(this._position.x, this._position.y, 0));
-                    this._globalTransform = this._parent ? local.multiply(this._parent._globalTransform) : local;
+                // Get/compute the localTransform
+                var localDirty = this._updateLocalTransform();
+                // Check if we have to update the globalTransform
+                if (!this._globalTransform || localDirty || (this._parent && this._parent._globalTransformStep !== this._parentTransformStep)) {
+                    this._globalTransform = this._parent ? this._localTransform.multiply(this._parent._globalTransform) : this._localTransform;
                     this._invGlobalTransform = BABYLON.Matrix.Invert(this._globalTransform);
                     this._invGlobalTransform = BABYLON.Matrix.Invert(this._globalTransform);
                     this._globalTransformStep = this.owner._globalTransformProcessStep + 1;
                     this._globalTransformStep = this.owner._globalTransformProcessStep + 1;
                     this._parentTransformStep = this._parent ? this._parent._globalTransformStep : 0;
                     this._parentTransformStep = this._parent ? this._parent._globalTransformStep : 0;
-                    this.clearPropertiesDirty(tflags);
                 }
                 }
                 this._globalTransformProcessStep = this.owner._globalTransformProcessStep;
                 this._globalTransformProcessStep = this.owner._globalTransformProcessStep;
             }
             }
@@ -372,6 +756,6 @@ var BABYLON;
             BABYLON.className("Prim2DBase")
             BABYLON.className("Prim2DBase")
         ], Prim2DBase);
         ], Prim2DBase);
         return Prim2DBase;
         return Prim2DBase;
-    }(BABYLON.SmartPropertyPrim));
+    })(BABYLON.SmartPropertyPrim);
     BABYLON.Prim2DBase = Prim2DBase;
     BABYLON.Prim2DBase = Prim2DBase;
 })(BABYLON || (BABYLON = {}));
 })(BABYLON || (BABYLON = {}));

+ 20 - 4
src/Canvas2d/babylon.rectangle2d.js

@@ -112,7 +112,7 @@ var BABYLON;
             return true;
             return true;
         };
         };
         return Rectangle2DRenderCache;
         return Rectangle2DRenderCache;
-    }(BABYLON.ModelRenderCache));
+    })(BABYLON.ModelRenderCache);
     BABYLON.Rectangle2DRenderCache = Rectangle2DRenderCache;
     BABYLON.Rectangle2DRenderCache = Rectangle2DRenderCache;
     var Rectangle2DInstanceData = (function (_super) {
     var Rectangle2DInstanceData = (function (_super) {
         __extends(Rectangle2DInstanceData, _super);
         __extends(Rectangle2DInstanceData, _super);
@@ -130,13 +130,20 @@ var BABYLON;
             BABYLON.instanceData()
             BABYLON.instanceData()
         ], Rectangle2DInstanceData.prototype, "properties", null);
         ], Rectangle2DInstanceData.prototype, "properties", null);
         return Rectangle2DInstanceData;
         return Rectangle2DInstanceData;
-    }(BABYLON.Shape2DInstanceData));
+    })(BABYLON.Shape2DInstanceData);
     BABYLON.Rectangle2DInstanceData = Rectangle2DInstanceData;
     BABYLON.Rectangle2DInstanceData = Rectangle2DInstanceData;
     var Rectangle2D = (function (_super) {
     var Rectangle2D = (function (_super) {
         __extends(Rectangle2D, _super);
         __extends(Rectangle2D, _super);
         function Rectangle2D() {
         function Rectangle2D() {
             _super.apply(this, arguments);
             _super.apply(this, arguments);
         }
         }
+        Object.defineProperty(Rectangle2D.prototype, "actualSize", {
+            get: function () {
+                return this.size;
+            },
+            enumerable: true,
+            configurable: true
+        });
         Object.defineProperty(Rectangle2D.prototype, "size", {
         Object.defineProperty(Rectangle2D.prototype, "size", {
             get: function () {
             get: function () {
                 return this._size;
                 return this._size;
@@ -168,8 +175,17 @@ var BABYLON;
             enumerable: true,
             enumerable: true,
             configurable: true
             configurable: true
         });
         });
+        Rectangle2D.prototype.levelIntersect = function (intersectInfo) {
+            // If we got there it mean the boundingInfo intersection succeed, if the rectangle has not roundRadius, it means it succeed!
+            if (this.notRounded) {
+                return true;
+            }
+            // Well, for now we neglect the area where the pickPosition could be outside due to the roundRadius...
+            // TODO make REAL intersection test here!
+            return true;
+        };
         Rectangle2D.prototype.updateLevelBoundingInfo = function () {
         Rectangle2D.prototype.updateLevelBoundingInfo = function () {
-            BABYLON.BoundingInfo2D.CreateFromSizeToRef(this.size, this._levelBoundingInfo);
+            BABYLON.BoundingInfo2D.CreateFromSizeToRef(this.size, this._levelBoundingInfo, this.origin);
         };
         };
         Rectangle2D.prototype.setupRectangle2D = function (owner, parent, id, position, size, roundRadius, fill, border, borderThickness) {
         Rectangle2D.prototype.setupRectangle2D = function (owner, parent, id, position, size, roundRadius, fill, border, borderThickness) {
             if (roundRadius === void 0) { roundRadius = 0; }
             if (roundRadius === void 0) { roundRadius = 0; }
@@ -296,6 +312,6 @@ var BABYLON;
             BABYLON.className("Rectangle2D")
             BABYLON.className("Rectangle2D")
         ], Rectangle2D);
         ], Rectangle2D);
         return Rectangle2D;
         return Rectangle2D;
-    }(BABYLON.Shape2D));
+    })(BABYLON.Shape2D);
     BABYLON.Rectangle2D = Rectangle2D;
     BABYLON.Rectangle2D = Rectangle2D;
 })(BABYLON || (BABYLON = {}));
 })(BABYLON || (BABYLON = {}));

+ 18 - 11
src/Canvas2d/babylon.renderablePrim2d.js

@@ -73,7 +73,7 @@ var BABYLON;
             return curOffset;
             return curOffset;
         };
         };
         return InstanceClassInfo;
         return InstanceClassInfo;
-    }());
+    })();
     BABYLON.InstanceClassInfo = InstanceClassInfo;
     BABYLON.InstanceClassInfo = InstanceClassInfo;
     var InstancePropInfo = (function () {
     var InstancePropInfo = (function () {
         //uniformLocation: WebGLUniformLocation;
         //uniformLocation: WebGLUniformLocation;
@@ -176,7 +176,7 @@ var BABYLON;
             }
             }
         };
         };
         return InstancePropInfo;
         return InstancePropInfo;
-    }());
+    })();
     BABYLON.InstancePropInfo = InstancePropInfo;
     BABYLON.InstancePropInfo = InstancePropInfo;
     function instanceData(category, shaderAttributeName) {
     function instanceData(category, shaderAttributeName) {
         return function (target, propName, descriptor) {
         return function (target, propName, descriptor) {
@@ -279,7 +279,7 @@ var BABYLON;
             instanceData()
             instanceData()
         ], InstanceDataBase.prototype, "origin", null);
         ], InstanceDataBase.prototype, "origin", null);
         return InstanceDataBase;
         return InstanceDataBase;
-    }());
+    })();
     BABYLON.InstanceDataBase = InstanceDataBase;
     BABYLON.InstanceDataBase = InstanceDataBase;
     var RenderablePrim2D = (function (_super) {
     var RenderablePrim2D = (function (_super) {
         __extends(RenderablePrim2D, _super);
         __extends(RenderablePrim2D, _super);
@@ -361,8 +361,8 @@ var BABYLON;
                     var usedCatList = new Array();
                     var usedCatList = new Array();
                     var partIdList = new Array();
                     var partIdList = new Array();
                     var joinedUsedCatList = new Array();
                     var joinedUsedCatList = new Array();
-                    for (var _i = 0, parts_1 = parts; _i < parts_1.length; _i++) {
-                        var dataPart = parts_1[_i];
+                    for (var _i = 0; _i < parts.length; _i++) {
+                        var dataPart = parts[_i];
                         var cat = this.getUsedShaderCategories(dataPart);
                         var cat = this.getUsedShaderCategories(dataPart);
                         var cti = dataPart.getClassTreeInfo();
                         var cti = dataPart.getClassTreeInfo();
                         // Make sure the instance is visible other the properties won't be set and their size/offset wont be computed
                         // Make sure the instance is visible other the properties won't be set and their size/offset wont be computed
@@ -493,23 +493,30 @@ var BABYLON;
                 return false;
                 return false;
             }
             }
             part.isVisible = this.isVisible;
             part.isVisible = this.isVisible;
-            // Which means, if there's only one data element, we're update it from this method, otherwise it is the responsability of the derived class to call updateInstanceDataPart as many times as needed, properly (look at Text2D's implementation for more information)
+            // Which means, if there's only one data element, we're update it from this method, otherwise it is the responsibility of the derived class to call updateInstanceDataPart as many times as needed, properly (look at Text2D's implementation for more information)
             if (part.dataElementCount === 1) {
             if (part.dataElementCount === 1) {
                 this.updateInstanceDataPart(part);
                 this.updateInstanceDataPart(part);
             }
             }
             return true;
             return true;
         };
         };
-        RenderablePrim2D.prototype.updateInstanceDataPart = function (part, positionOffset) {
+        /**
+         * Update the instanceDataBase level properties of a part
+         * @param part the part to update
+         * @param positionOffset to use in multi part per primitive (e.g. the Text2D has N parts for N letter to display), this give the offset to apply (e.g. the position of the letter from the bottom/left corner of the text). You MUST also set customSize.
+         * @param customSize to use in multi part per primitive, this is the size of the overall primitive to display (the bounding rect's size of the Text, for instance). This is mandatory to compute correct transformation based on the Primitive's origin property.
+         */
+        RenderablePrim2D.prototype.updateInstanceDataPart = function (part, positionOffset, customSize) {
             if (positionOffset === void 0) { positionOffset = null; }
             if (positionOffset === void 0) { positionOffset = null; }
+            if (customSize === void 0) { customSize = null; }
             var t = this._globalTransform.multiply(this.renderGroup.invGlobalTransform);
             var t = this._globalTransform.multiply(this.renderGroup.invGlobalTransform);
             var size = this.renderGroup.viewportSize;
             var size = this.renderGroup.viewportSize;
             var zBias = this.getActualZOffset();
             var zBias = this.getActualZOffset();
             var offX = 0;
             var offX = 0;
             var offY = 0;
             var offY = 0;
             // If there's an offset, apply the global transformation matrix on it to get a global offset
             // If there's an offset, apply the global transformation matrix on it to get a global offset
-            if (positionOffset) {
-                offX = positionOffset.x * t.m[0] + positionOffset.y * t.m[4];
-                offY = positionOffset.x * t.m[1] + positionOffset.y * t.m[5];
+            if (positionOffset && customSize) {
+                offX = (positionOffset.x - (customSize.width * this.origin.x)) * t.m[0] + (positionOffset.y - (customSize.height * this.origin.y)) * t.m[4];
+                offY = (positionOffset.x - (customSize.width * this.origin.x)) * t.m[1] + (positionOffset.y - (customSize.height * this.origin.y)) * t.m[5];
             }
             }
             // Have to convert the coordinates to clip space which is ranged between [-1;1] on X and Y axis, with 0,0 being the left/bottom corner
             // Have to convert the coordinates to clip space which is ranged between [-1;1] on X and Y axis, with 0,0 being the left/bottom corner
             // Current coordinates are expressed in renderGroup coordinates ([0, renderGroup.actualSize.width|height]) with 0,0 being at the left/top corner
             // Current coordinates are expressed in renderGroup coordinates ([0, renderGroup.actualSize.width|height]) with 0,0 being at the left/top corner
@@ -536,6 +543,6 @@ var BABYLON;
             BABYLON.className("RenderablePrim2D")
             BABYLON.className("RenderablePrim2D")
         ], RenderablePrim2D);
         ], RenderablePrim2D);
         return RenderablePrim2D;
         return RenderablePrim2D;
-    }(BABYLON.Prim2DBase));
+    })(BABYLON.Prim2DBase);
     BABYLON.RenderablePrim2D = RenderablePrim2D;
     BABYLON.RenderablePrim2D = RenderablePrim2D;
 })(BABYLON || (BABYLON = {}));
 })(BABYLON || (BABYLON = {}));

+ 2 - 2
src/Canvas2d/babylon.shape2d.js

@@ -144,7 +144,7 @@ var BABYLON;
             BABYLON.className("Shape2D")
             BABYLON.className("Shape2D")
         ], Shape2D);
         ], Shape2D);
         return Shape2D;
         return Shape2D;
-    }(BABYLON.RenderablePrim2D));
+    })(BABYLON.RenderablePrim2D);
     BABYLON.Shape2D = Shape2D;
     BABYLON.Shape2D = Shape2D;
     var Shape2DInstanceData = (function (_super) {
     var Shape2DInstanceData = (function (_super) {
         __extends(Shape2DInstanceData, _super);
         __extends(Shape2DInstanceData, _super);
@@ -244,6 +244,6 @@ var BABYLON;
             BABYLON.instanceData(Shape2D.SHAPE2D_CATEGORY_BORDERGRADIENT)
             BABYLON.instanceData(Shape2D.SHAPE2D_CATEGORY_BORDERGRADIENT)
         ], Shape2DInstanceData.prototype, "borderGradientTY", null);
         ], Shape2DInstanceData.prototype, "borderGradientTY", null);
         return Shape2DInstanceData;
         return Shape2DInstanceData;
-    }(BABYLON.InstanceDataBase));
+    })(BABYLON.InstanceDataBase);
     BABYLON.Shape2DInstanceData = Shape2DInstanceData;
     BABYLON.Shape2DInstanceData = Shape2DInstanceData;
 })(BABYLON || (BABYLON = {}));
 })(BABYLON || (BABYLON = {}));

+ 8 - 8
src/Canvas2d/babylon.smartPropertyPrim.js

@@ -10,7 +10,7 @@ var BABYLON;
         function Prim2DClassInfo() {
         function Prim2DClassInfo() {
         }
         }
         return Prim2DClassInfo;
         return Prim2DClassInfo;
-    }());
+    })();
     BABYLON.Prim2DClassInfo = Prim2DClassInfo;
     BABYLON.Prim2DClassInfo = Prim2DClassInfo;
     var Prim2DPropInfo = (function () {
     var Prim2DPropInfo = (function () {
         function Prim2DPropInfo() {
         function Prim2DPropInfo() {
@@ -19,13 +19,13 @@ var BABYLON;
         Prim2DPropInfo.PROPKIND_INSTANCE = 2;
         Prim2DPropInfo.PROPKIND_INSTANCE = 2;
         Prim2DPropInfo.PROPKIND_DYNAMIC = 3;
         Prim2DPropInfo.PROPKIND_DYNAMIC = 3;
         return Prim2DPropInfo;
         return Prim2DPropInfo;
-    }());
+    })();
     BABYLON.Prim2DPropInfo = Prim2DPropInfo;
     BABYLON.Prim2DPropInfo = Prim2DPropInfo;
     var PropertyChangedInfo = (function () {
     var PropertyChangedInfo = (function () {
         function PropertyChangedInfo() {
         function PropertyChangedInfo() {
         }
         }
         return PropertyChangedInfo;
         return PropertyChangedInfo;
-    }());
+    })();
     BABYLON.PropertyChangedInfo = PropertyChangedInfo;
     BABYLON.PropertyChangedInfo = PropertyChangedInfo;
     var ClassTreeInfo = (function () {
     var ClassTreeInfo = (function () {
         function ClassTreeInfo(baseClass, type, classContentFactory) {
         function ClassTreeInfo(baseClass, type, classContentFactory) {
@@ -62,13 +62,13 @@ var BABYLON;
         Object.defineProperty(ClassTreeInfo.prototype, "fullContent", {
         Object.defineProperty(ClassTreeInfo.prototype, "fullContent", {
             get: function () {
             get: function () {
                 if (!this._fullContent) {
                 if (!this._fullContent) {
-                    var dic_1 = new BABYLON.StringDictionary();
+                    var dic = new BABYLON.StringDictionary();
                     var curLevel = this;
                     var curLevel = this;
                     while (curLevel) {
                     while (curLevel) {
-                        curLevel.levelContent.forEach(function (k, v) { return dic_1.add(k, v); });
+                        curLevel.levelContent.forEach(function (k, v) { return dic.add(k, v); });
                         curLevel = curLevel._baseClass;
                         curLevel = curLevel._baseClass;
                     }
                     }
-                    this._fullContent = dic_1;
+                    this._fullContent = dic;
                 }
                 }
                 return this._fullContent;
                 return this._fullContent;
             },
             },
@@ -128,7 +128,7 @@ var BABYLON;
             return dic;
             return dic;
         };
         };
         return ClassTreeInfo;
         return ClassTreeInfo;
-    }());
+    })();
     BABYLON.ClassTreeInfo = ClassTreeInfo;
     BABYLON.ClassTreeInfo = ClassTreeInfo;
     var SmartPropertyPrim = (function () {
     var SmartPropertyPrim = (function () {
         function SmartPropertyPrim() {
         function SmartPropertyPrim() {
@@ -343,7 +343,7 @@ var BABYLON;
             BABYLON.className("SmartPropertyPrim")
             BABYLON.className("SmartPropertyPrim")
         ], SmartPropertyPrim);
         ], SmartPropertyPrim);
         return SmartPropertyPrim;
         return SmartPropertyPrim;
-    }());
+    })();
     BABYLON.SmartPropertyPrim = SmartPropertyPrim;
     BABYLON.SmartPropertyPrim = SmartPropertyPrim;
     function modelLevelProperty(propId, piStore, typeLevelCompare, dirtyBoundingInfo) {
     function modelLevelProperty(propId, piStore, typeLevelCompare, dirtyBoundingInfo) {
         if (typeLevelCompare === void 0) { typeLevelCompare = false; }
         if (typeLevelCompare === void 0) { typeLevelCompare = false; }

+ 11 - 4
src/Canvas2d/babylon.sprite2d.js

@@ -69,7 +69,7 @@ var BABYLON;
             return true;
             return true;
         };
         };
         return Sprite2DRenderCache;
         return Sprite2DRenderCache;
-    }(BABYLON.ModelRenderCache));
+    })(BABYLON.ModelRenderCache);
     BABYLON.Sprite2DRenderCache = Sprite2DRenderCache;
     BABYLON.Sprite2DRenderCache = Sprite2DRenderCache;
     var Sprite2DInstanceData = (function (_super) {
     var Sprite2DInstanceData = (function (_super) {
         __extends(Sprite2DInstanceData, _super);
         __extends(Sprite2DInstanceData, _super);
@@ -127,7 +127,7 @@ var BABYLON;
             BABYLON.instanceData()
             BABYLON.instanceData()
         ], Sprite2DInstanceData.prototype, "invertY", null);
         ], Sprite2DInstanceData.prototype, "invertY", null);
         return Sprite2DInstanceData;
         return Sprite2DInstanceData;
-    }(BABYLON.InstanceDataBase));
+    })(BABYLON.InstanceDataBase);
     BABYLON.Sprite2DInstanceData = Sprite2DInstanceData;
     BABYLON.Sprite2DInstanceData = Sprite2DInstanceData;
     var Sprite2D = (function (_super) {
     var Sprite2D = (function (_super) {
         __extends(Sprite2D, _super);
         __extends(Sprite2D, _super);
@@ -144,6 +144,13 @@ var BABYLON;
             enumerable: true,
             enumerable: true,
             configurable: true
             configurable: true
         });
         });
+        Object.defineProperty(Sprite2D.prototype, "actualSize", {
+            get: function () {
+                return this.spriteSize;
+            },
+            enumerable: true,
+            configurable: true
+        });
         Object.defineProperty(Sprite2D.prototype, "spriteSize", {
         Object.defineProperty(Sprite2D.prototype, "spriteSize", {
             get: function () {
             get: function () {
                 return this._size;
                 return this._size;
@@ -185,7 +192,7 @@ var BABYLON;
             configurable: true
             configurable: true
         });
         });
         Sprite2D.prototype.updateLevelBoundingInfo = function () {
         Sprite2D.prototype.updateLevelBoundingInfo = function () {
-            BABYLON.BoundingInfo2D.CreateFromSizeToRef(this.spriteSize, this._levelBoundingInfo);
+            BABYLON.BoundingInfo2D.CreateFromSizeToRef(this.spriteSize, this._levelBoundingInfo, this.origin);
         };
         };
         Sprite2D.prototype.setupSprite2D = function (owner, parent, id, position, texture, spriteSize, spriteLocation, invertY) {
         Sprite2D.prototype.setupSprite2D = function (owner, parent, id, position, texture, spriteSize, spriteLocation, invertY) {
             this.setupRenderablePrim2D(owner, parent, id, position, true);
             this.setupRenderablePrim2D(owner, parent, id, position, true);
@@ -278,6 +285,6 @@ var BABYLON;
             BABYLON.className("Sprite2D")
             BABYLON.className("Sprite2D")
         ], Sprite2D);
         ], Sprite2D);
         return Sprite2D;
         return Sprite2D;
-    }(BABYLON.RenderablePrim2D));
+    })(BABYLON.RenderablePrim2D);
     BABYLON.Sprite2D = Sprite2D;
     BABYLON.Sprite2D = Sprite2D;
 })(BABYLON || (BABYLON = {}));
 })(BABYLON || (BABYLON = {}));

+ 13 - 11
src/Canvas2d/babylon.text2d.js

@@ -70,7 +70,7 @@ var BABYLON;
             return true;
             return true;
         };
         };
         return Text2DRenderCache;
         return Text2DRenderCache;
-    }(BABYLON.ModelRenderCache));
+    })(BABYLON.ModelRenderCache);
     BABYLON.Text2DRenderCache = Text2DRenderCache;
     BABYLON.Text2DRenderCache = Text2DRenderCache;
     var Text2DInstanceData = (function (_super) {
     var Text2DInstanceData = (function (_super) {
         __extends(Text2DInstanceData, _super);
         __extends(Text2DInstanceData, _super);
@@ -118,7 +118,7 @@ var BABYLON;
             BABYLON.instanceData()
             BABYLON.instanceData()
         ], Text2DInstanceData.prototype, "color", null);
         ], Text2DInstanceData.prototype, "color", null);
         return Text2DInstanceData;
         return Text2DInstanceData;
-    }(BABYLON.InstanceDataBase));
+    })(BABYLON.InstanceDataBase);
     BABYLON.Text2DInstanceData = Text2DInstanceData;
     BABYLON.Text2DInstanceData = Text2DInstanceData;
     var Text2D = (function (_super) {
     var Text2D = (function (_super) {
         __extends(Text2D, _super);
         __extends(Text2D, _super);
@@ -154,7 +154,7 @@ var BABYLON;
             },
             },
             set: function (value) {
             set: function (value) {
                 this._text = value;
                 this._text = value;
-                this._actualAreaSize = null; // A change of text will reset the Actual Area Size which will be recomputed next time it's used
+                this._actualSize = null; // A change of text will reset the Actual Area Size which will be recomputed next time it's used
                 this._updateCharCount();
                 this._updateCharCount();
             },
             },
             enumerable: true,
             enumerable: true,
@@ -190,16 +190,16 @@ var BABYLON;
             enumerable: true,
             enumerable: true,
             configurable: true
             configurable: true
         });
         });
-        Object.defineProperty(Text2D.prototype, "actualAreaSize", {
+        Object.defineProperty(Text2D.prototype, "actualSize", {
             get: function () {
             get: function () {
                 if (this.areaSize) {
                 if (this.areaSize) {
                     return this.areaSize;
                     return this.areaSize;
                 }
                 }
-                if (this._actualAreaSize) {
-                    return this._actualAreaSize;
+                if (this._actualSize) {
+                    return this._actualSize;
                 }
                 }
-                this._actualAreaSize = this.fontTexture.measureText(this._text, this._tabulationSize);
-                return this._actualAreaSize;
+                this._actualSize = this.fontTexture.measureText(this._text, this._tabulationSize);
+                return this._actualSize;
             },
             },
             enumerable: true,
             enumerable: true,
             configurable: true
             configurable: true
@@ -226,7 +226,7 @@ var BABYLON;
             return true;
             return true;
         };
         };
         Text2D.prototype.updateLevelBoundingInfo = function () {
         Text2D.prototype.updateLevelBoundingInfo = function () {
-            BABYLON.BoundingInfo2D.CreateFromSizeToRef(this.actualAreaSize, this._levelBoundingInfo);
+            BABYLON.BoundingInfo2D.CreateFromSizeToRef(this.actualSize, this._levelBoundingInfo, this.origin);
         };
         };
         Text2D.prototype.setupText2D = function (owner, parent, id, position, fontName, text, areaSize, defaultFontColor, vAlign, hAlign, tabulationSize) {
         Text2D.prototype.setupText2D = function (owner, parent, id, position, fontName, text, areaSize, defaultFontColor, vAlign, hAlign, tabulationSize) {
             this.setupRenderablePrim2D(owner, parent, id, position, true);
             this.setupRenderablePrim2D(owner, parent, id, position, true);
@@ -288,9 +288,11 @@ var BABYLON;
                 var d = part;
                 var d = part;
                 var texture = this.fontTexture;
                 var texture = this.fontTexture;
                 var ts = texture.getSize();
                 var ts = texture.getSize();
+                var textSize = texture.measureText(this.text, this._tabulationSize);
                 var offset = BABYLON.Vector2.Zero();
                 var offset = BABYLON.Vector2.Zero();
                 var charxpos = 0;
                 var charxpos = 0;
                 d.curElement = 0;
                 d.curElement = 0;
+                var customOrigin = BABYLON.Vector2.Zero();
                 for (var _i = 0, _a = this.text; _i < _a.length; _i++) {
                 for (var _i = 0, _a = this.text; _i < _a.length; _i++) {
                     var char = _a[_i];
                     var char = _a[_i];
                     // Line feed
                     // Line feed
@@ -309,7 +311,7 @@ var BABYLON;
                     if (char < " ") {
                     if (char < " ") {
                         continue;
                         continue;
                     }
                     }
-                    this.updateInstanceDataPart(d, offset);
+                    this.updateInstanceDataPart(d, offset, textSize);
                     var ci = texture.getChar(char);
                     var ci = texture.getChar(char);
                     offset.x += ci.charWidth;
                     offset.x += ci.charWidth;
                     d.topLeftUV = ci.topLeftUV;
                     d.topLeftUV = ci.topLeftUV;
@@ -362,6 +364,6 @@ var BABYLON;
             BABYLON.className("Text2D")
             BABYLON.className("Text2D")
         ], Text2D);
         ], Text2D);
         return Text2D;
         return Text2D;
-    }(BABYLON.RenderablePrim2D));
+    })(BABYLON.RenderablePrim2D);
     BABYLON.Text2D = Text2D;
     BABYLON.Text2D = Text2D;
 })(BABYLON || (BABYLON = {}));
 })(BABYLON || (BABYLON = {}));

+ 1 - 1
src/Canvas2d/babylon.worldSpaceCanvas2d.js

@@ -22,6 +22,6 @@ var BABYLON;
             }
             }
         };
         };
         return WorldSpaceCanvas2d;
         return WorldSpaceCanvas2d;
-    }(BABYLON.Mesh));
+    })(BABYLON.Mesh);
     BABYLON.WorldSpaceCanvas2d = WorldSpaceCanvas2d;
     BABYLON.WorldSpaceCanvas2d = WorldSpaceCanvas2d;
 })(BABYLON || (BABYLON = {}));
 })(BABYLON || (BABYLON = {}));

+ 1 - 1
src/Collisions/babylon.collider.js

@@ -267,6 +267,6 @@ var BABYLON;
             this._destinationPoint.subtractToRef(this.intersectionPoint, vel);
             this._destinationPoint.subtractToRef(this.intersectionPoint, vel);
         };
         };
         return Collider;
         return Collider;
-    }());
+    })();
     BABYLON.Collider = Collider;
     BABYLON.Collider = Collider;
 })(BABYLON || (BABYLON = {}));
 })(BABYLON || (BABYLON = {}));

+ 2 - 2
src/Collisions/babylon.collisionCoordinator.js

@@ -205,7 +205,7 @@ var BABYLON;
             };
             };
         };
         };
         return CollisionCoordinatorWorker;
         return CollisionCoordinatorWorker;
-    }());
+    })();
     BABYLON.CollisionCoordinatorWorker = CollisionCoordinatorWorker;
     BABYLON.CollisionCoordinatorWorker = CollisionCoordinatorWorker;
     var CollisionCoordinatorLegacy = (function () {
     var CollisionCoordinatorLegacy = (function () {
         function CollisionCoordinatorLegacy() {
         function CollisionCoordinatorLegacy() {
@@ -268,6 +268,6 @@ var BABYLON;
             this._collideWithWorld(position, velocity, collider, maximumRetry, finalPosition, excludedMesh);
             this._collideWithWorld(position, velocity, collider, maximumRetry, finalPosition, excludedMesh);
         };
         };
         return CollisionCoordinatorLegacy;
         return CollisionCoordinatorLegacy;
-    }());
+    })();
     BABYLON.CollisionCoordinatorLegacy = CollisionCoordinatorLegacy;
     BABYLON.CollisionCoordinatorLegacy = CollisionCoordinatorLegacy;
 })(BABYLON || (BABYLON = {}));
 })(BABYLON || (BABYLON = {}));

+ 3 - 3
src/Collisions/babylon.collisionWorker.js

@@ -32,7 +32,7 @@ var BABYLON;
             delete this._geometries[id];
             delete this._geometries[id];
         };
         };
         return CollisionCache;
         return CollisionCache;
-    }());
+    })();
     BABYLON.CollisionCache = CollisionCache;
     BABYLON.CollisionCache = CollisionCache;
     var CollideWorker = (function () {
     var CollideWorker = (function () {
         function CollideWorker(collider, _collisionCache, finalPosition) {
         function CollideWorker(collider, _collisionCache, finalPosition) {
@@ -144,7 +144,7 @@ var BABYLON;
             return this.collider._canDoCollision(BABYLON.Vector3.FromArray(subMesh.sphereCenter), subMesh.sphereRadius, BABYLON.Vector3.FromArray(subMesh.boxMinimum), BABYLON.Vector3.FromArray(subMesh.boxMaximum));
             return this.collider._canDoCollision(BABYLON.Vector3.FromArray(subMesh.sphereCenter), subMesh.sphereRadius, BABYLON.Vector3.FromArray(subMesh.boxMinimum), BABYLON.Vector3.FromArray(subMesh.boxMaximum));
         };
         };
         return CollideWorker;
         return CollideWorker;
-    }());
+    })();
     BABYLON.CollideWorker = CollideWorker;
     BABYLON.CollideWorker = CollideWorker;
     var CollisionDetectorTransferable = (function () {
     var CollisionDetectorTransferable = (function () {
         function CollisionDetectorTransferable() {
         function CollisionDetectorTransferable() {
@@ -206,7 +206,7 @@ var BABYLON;
             postMessage(reply, undefined);
             postMessage(reply, undefined);
         };
         };
         return CollisionDetectorTransferable;
         return CollisionDetectorTransferable;
-    }());
+    })();
     BABYLON.CollisionDetectorTransferable = CollisionDetectorTransferable;
     BABYLON.CollisionDetectorTransferable = CollisionDetectorTransferable;
     //check if we are in a web worker, as this code should NOT run on the main UI thread
     //check if we are in a web worker, as this code should NOT run on the main UI thread
     try {
     try {

+ 2 - 2
src/Collisions/babylon.pickingInfo.js

@@ -9,7 +9,7 @@ var BABYLON;
             this.subMeshId = 0;
             this.subMeshId = 0;
         }
         }
         return IntersectionInfo;
         return IntersectionInfo;
-    }());
+    })();
     BABYLON.IntersectionInfo = IntersectionInfo;
     BABYLON.IntersectionInfo = IntersectionInfo;
     var PickingInfo = (function () {
     var PickingInfo = (function () {
         function PickingInfo() {
         function PickingInfo() {
@@ -71,6 +71,6 @@ var BABYLON;
             return new BABYLON.Vector2(uv0.x + uv1.x + uv2.x, uv0.y + uv1.y + uv2.y);
             return new BABYLON.Vector2(uv0.x + uv1.x + uv2.x, uv0.y + uv1.y + uv2.y);
         };
         };
         return PickingInfo;
         return PickingInfo;
-    }());
+    })();
     BABYLON.PickingInfo = PickingInfo;
     BABYLON.PickingInfo = PickingInfo;
 })(BABYLON || (BABYLON = {}));
 })(BABYLON || (BABYLON = {}));

+ 1 - 1
src/Culling/Octrees/babylon.octree.js

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

+ 1 - 1
src/Culling/Octrees/babylon.octreeBlock.js

@@ -117,6 +117,6 @@ var BABYLON;
             BABYLON.Octree._CreateBlocks(this._minPoint, this._maxPoint, this.entries, this._capacity, this._depth, this._maxDepth, this, this._creationFunc);
             BABYLON.Octree._CreateBlocks(this._minPoint, this._maxPoint, this.entries, this._capacity, this._depth, this._maxDepth, this, this._creationFunc);
         };
         };
         return OctreeBlock;
         return OctreeBlock;
-    }());
+    })();
     BABYLON.OctreeBlock = OctreeBlock;
     BABYLON.OctreeBlock = OctreeBlock;
 })(BABYLON || (BABYLON = {}));
 })(BABYLON || (BABYLON = {}));

+ 1 - 1
src/Culling/babylon.boundingBox.js

@@ -138,6 +138,6 @@ var BABYLON;
             return true;
             return true;
         };
         };
         return BoundingBox;
         return BoundingBox;
-    }());
+    })();
     BABYLON.BoundingBox = BoundingBox;
     BABYLON.BoundingBox = BoundingBox;
 })(BABYLON || (BABYLON = {}));
 })(BABYLON || (BABYLON = {}));

+ 1 - 1
src/Culling/babylon.boundingInfo.js

@@ -114,6 +114,6 @@ var BABYLON;
             return true;
             return true;
         };
         };
         return BoundingInfo;
         return BoundingInfo;
-    }());
+    })();
     BABYLON.BoundingInfo = BoundingInfo;
     BABYLON.BoundingInfo = BoundingInfo;
 })(BABYLON || (BABYLON = {}));
 })(BABYLON || (BABYLON = {}));

+ 1 - 1
src/Culling/babylon.boundingSphere.js

@@ -44,6 +44,6 @@ var BABYLON;
             return true;
             return true;
         };
         };
         return BoundingSphere;
         return BoundingSphere;
-    }());
+    })();
     BABYLON.BoundingSphere = BoundingSphere;
     BABYLON.BoundingSphere = BoundingSphere;
 })(BABYLON || (BABYLON = {}));
 })(BABYLON || (BABYLON = {}));

+ 1 - 1
src/Culling/babylon.ray.js

@@ -269,6 +269,6 @@ var BABYLON;
         Ray.smallnum = 0.00000001;
         Ray.smallnum = 0.00000001;
         Ray.rayl = 10e8;
         Ray.rayl = 10e8;
         return Ray;
         return Ray;
-    }());
+    })();
     BABYLON.Ray = Ray;
     BABYLON.Ray = Ray;
 })(BABYLON || (BABYLON = {}));
 })(BABYLON || (BABYLON = {}));

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

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

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

@@ -131,7 +131,7 @@ var BABYLON;
                 }
                 }
             };
             };
             return SkeletonViewer;
             return SkeletonViewer;
-        }());
+        })();
         Debug.SkeletonViewer = SkeletonViewer;
         Debug.SkeletonViewer = SkeletonViewer;
     })(Debug = BABYLON.Debug || (BABYLON.Debug = {}));
     })(Debug = BABYLON.Debug || (BABYLON.Debug = {}));
 })(BABYLON || (BABYLON = {}));
 })(BABYLON || (BABYLON = {}));

+ 1 - 1
src/Layer/babylon.layer.js

@@ -133,6 +133,6 @@ var BABYLON;
             this.onBeforeRenderObservable.clear();
             this.onBeforeRenderObservable.clear();
         };
         };
         return Layer;
         return Layer;
-    }());
+    })();
     BABYLON.Layer = Layer;
     BABYLON.Layer = Layer;
 })(BABYLON || (BABYLON = {}));
 })(BABYLON || (BABYLON = {}));

+ 1 - 1
src/LensFlare/babylon.lensFlare.js

@@ -18,6 +18,6 @@ var BABYLON;
             system.lensFlares.push(this);
             system.lensFlares.push(this);
         }
         }
         return LensFlare;
         return LensFlare;
-    }());
+    })();
     BABYLON.LensFlare = LensFlare;
     BABYLON.LensFlare = LensFlare;
 })(BABYLON || (BABYLON = {}));
 })(BABYLON || (BABYLON = {}));

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

@@ -208,6 +208,6 @@ var BABYLON;
             return serializationObject;
             return serializationObject;
         };
         };
         return LensFlareSystem;
         return LensFlareSystem;
-    }());
+    })();
     BABYLON.LensFlareSystem = LensFlareSystem;
     BABYLON.LensFlareSystem = LensFlareSystem;
 })(BABYLON || (BABYLON = {}));
 })(BABYLON || (BABYLON = {}));

+ 1 - 1
src/Lights/Shadows/babylon.shadowGenerator.js

@@ -402,6 +402,6 @@ var BABYLON;
         ShadowGenerator._FILTER_POISSONSAMPLING = 2;
         ShadowGenerator._FILTER_POISSONSAMPLING = 2;
         ShadowGenerator._FILTER_BLURVARIANCESHADOWMAP = 3;
         ShadowGenerator._FILTER_BLURVARIANCESHADOWMAP = 3;
         return ShadowGenerator;
         return ShadowGenerator;
-    }());
+    })();
     BABYLON.ShadowGenerator = ShadowGenerator;
     BABYLON.ShadowGenerator = ShadowGenerator;
 })(BABYLON || (BABYLON = {}));
 })(BABYLON || (BABYLON = {}));

+ 1 - 1
src/Lights/babylon.directionalLight.js

@@ -124,6 +124,6 @@ var BABYLON;
             BABYLON.serialize()
             BABYLON.serialize()
         ], DirectionalLight.prototype, "autoUpdateExtends", void 0);
         ], DirectionalLight.prototype, "autoUpdateExtends", void 0);
         return DirectionalLight;
         return DirectionalLight;
-    }(BABYLON.Light));
+    })(BABYLON.Light);
     BABYLON.DirectionalLight = DirectionalLight;
     BABYLON.DirectionalLight = DirectionalLight;
 })(BABYLON || (BABYLON = {}));
 })(BABYLON || (BABYLON = {}));

+ 1 - 1
src/Lights/babylon.hemisphericLight.js

@@ -46,6 +46,6 @@ var BABYLON;
             BABYLON.serializeAsVector3()
             BABYLON.serializeAsVector3()
         ], HemisphericLight.prototype, "direction", void 0);
         ], HemisphericLight.prototype, "direction", void 0);
         return HemisphericLight;
         return HemisphericLight;
-    }(BABYLON.Light));
+    })(BABYLON.Light);
     BABYLON.HemisphericLight = HemisphericLight;
     BABYLON.HemisphericLight = HemisphericLight;
 })(BABYLON || (BABYLON = {}));
 })(BABYLON || (BABYLON = {}));

+ 1 - 1
src/Lights/babylon.light.js

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

+ 2 - 2
src/Lights/babylon.pointLight.js

@@ -25,7 +25,7 @@ var BABYLON;
                 if (!this.transformedPosition) {
                 if (!this.transformedPosition) {
                     this.transformedPosition = BABYLON.Vector3.Zero();
                     this.transformedPosition = BABYLON.Vector3.Zero();
                 }
                 }
-                BABYLON.Vector3.TransformCoordinatesToRef(this.getAbsolutePosition(), this.parent.getWorldMatrix(), this.transformedPosition);
+                BABYLON.Vector3.TransformCoordinatesToRef(this.position, this.parent.getWorldMatrix(), this.transformedPosition);
                 return true;
                 return true;
             }
             }
             return false;
             return false;
@@ -82,6 +82,6 @@ var BABYLON;
             BABYLON.serializeAsVector3()
             BABYLON.serializeAsVector3()
         ], PointLight.prototype, "position", void 0);
         ], PointLight.prototype, "position", void 0);
         return PointLight;
         return PointLight;
-    }(BABYLON.Light));
+    })(BABYLON.Light);
     BABYLON.PointLight = PointLight;
     BABYLON.PointLight = PointLight;
 })(BABYLON || (BABYLON = {}));
 })(BABYLON || (BABYLON = {}));

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

@@ -22,7 +22,7 @@
                     this.transformedPosition = Vector3.Zero();
                     this.transformedPosition = Vector3.Zero();
                 }
                 }
 
 
-                Vector3.TransformCoordinatesToRef(this.getAbsolutePosition(), this.parent.getWorldMatrix(), this.transformedPosition);
+                Vector3.TransformCoordinatesToRef(this.position, this.parent.getWorldMatrix(), this.transformedPosition);
 
 
                 return true;
                 return true;
             }
             }

+ 1 - 1
src/Lights/babylon.spotLight.js

@@ -93,6 +93,6 @@ var BABYLON;
             BABYLON.serialize()
             BABYLON.serialize()
         ], SpotLight.prototype, "exponent", void 0);
         ], SpotLight.prototype, "exponent", void 0);
         return SpotLight;
         return SpotLight;
-    }(BABYLON.Light));
+    })(BABYLON.Light);
     BABYLON.SpotLight = SpotLight;
     BABYLON.SpotLight = SpotLight;
 })(BABYLON || (BABYLON = {}));
 })(BABYLON || (BABYLON = {}));

+ 1 - 1
src/Loading/babylon.sceneLoader.js

@@ -257,7 +257,7 @@ var BABYLON;
         // Members
         // Members
         SceneLoader._registeredPlugins = new Array();
         SceneLoader._registeredPlugins = new Array();
         return SceneLoader;
         return SceneLoader;
-    }());
+    })();
     BABYLON.SceneLoader = SceneLoader;
     BABYLON.SceneLoader = SceneLoader;
     ;
     ;
 })(BABYLON || (BABYLON = {}));
 })(BABYLON || (BABYLON = {}));

+ 1 - 1
src/Materials/Textures/Procedurals/babylon.customProceduralTexture.js

@@ -119,6 +119,6 @@ var BABYLON;
             configurable: true
             configurable: true
         });
         });
         return CustomProceduralTexture;
         return CustomProceduralTexture;
-    }(BABYLON.ProceduralTexture));
+    })(BABYLON.ProceduralTexture);
     BABYLON.CustomProceduralTexture = CustomProceduralTexture;
     BABYLON.CustomProceduralTexture = CustomProceduralTexture;
 })(BABYLON || (BABYLON = {}));
 })(BABYLON || (BABYLON = {}));

+ 1 - 1
src/Materials/Textures/Procedurals/babylon.proceduralTexture.js

@@ -271,6 +271,6 @@ var BABYLON;
             _super.prototype.dispose.call(this);
             _super.prototype.dispose.call(this);
         };
         };
         return ProceduralTexture;
         return ProceduralTexture;
-    }(BABYLON.Texture));
+    })(BABYLON.Texture);
     BABYLON.ProceduralTexture = ProceduralTexture;
     BABYLON.ProceduralTexture = ProceduralTexture;
 })(BABYLON || (BABYLON = {}));
 })(BABYLON || (BABYLON = {}));

+ 1 - 1
src/Materials/Textures/babylon.baseTexture.js

@@ -182,6 +182,6 @@ var BABYLON;
             BABYLON.serialize()
             BABYLON.serialize()
         ], BaseTexture.prototype, "isRenderTarget", void 0);
         ], BaseTexture.prototype, "isRenderTarget", void 0);
         return BaseTexture;
         return BaseTexture;
-    }());
+    })();
     BABYLON.BaseTexture = BaseTexture;
     BABYLON.BaseTexture = BaseTexture;
 })(BABYLON || (BABYLON = {}));
 })(BABYLON || (BABYLON = {}));

+ 1 - 1
src/Materials/Textures/babylon.colorGradingTexture.js

@@ -177,6 +177,6 @@ var BABYLON;
          */
          */
         ColorGradingTexture._noneEmptyLineRegex = /\S+/;
         ColorGradingTexture._noneEmptyLineRegex = /\S+/;
         return ColorGradingTexture;
         return ColorGradingTexture;
-    }(BABYLON.BaseTexture));
+    })(BABYLON.BaseTexture);
     BABYLON.ColorGradingTexture = ColorGradingTexture;
     BABYLON.ColorGradingTexture = ColorGradingTexture;
 })(BABYLON || (BABYLON = {}));
 })(BABYLON || (BABYLON = {}));

+ 1 - 1
src/Materials/Textures/babylon.cubeTexture.js

@@ -77,6 +77,6 @@ var BABYLON;
             }, this);
             }, this);
         };
         };
         return CubeTexture;
         return CubeTexture;
-    }(BABYLON.BaseTexture));
+    })(BABYLON.BaseTexture);
     BABYLON.CubeTexture = CubeTexture;
     BABYLON.CubeTexture = CubeTexture;
 })(BABYLON || (BABYLON = {}));
 })(BABYLON || (BABYLON = {}));

+ 1 - 1
src/Materials/Textures/babylon.dynamicTexture.js

@@ -88,6 +88,6 @@ var BABYLON;
             return newTexture;
             return newTexture;
         };
         };
         return DynamicTexture;
         return DynamicTexture;
-    }(BABYLON.Texture));
+    })(BABYLON.Texture);
     BABYLON.DynamicTexture = DynamicTexture;
     BABYLON.DynamicTexture = DynamicTexture;
 })(BABYLON || (BABYLON = {}));
 })(BABYLON || (BABYLON = {}));

+ 5 - 5
src/Materials/Textures/babylon.fontTexture.js

@@ -12,7 +12,7 @@ var BABYLON;
         function CharInfo() {
         function CharInfo() {
         }
         }
         return CharInfo;
         return CharInfo;
-    }());
+    })();
     BABYLON.CharInfo = CharInfo;
     BABYLON.CharInfo = CharInfo;
     var FontTexture = (function (_super) {
     var FontTexture = (function (_super) {
         __extends(FontTexture, _super);
         __extends(FontTexture, _super);
@@ -134,7 +134,7 @@ var BABYLON;
             var width = measure.width;
             var width = measure.width;
             if (this._currentFreePosition.x + width + xMargin > textureSize.width) {
             if (this._currentFreePosition.x + width + xMargin > textureSize.width) {
                 this._currentFreePosition.x = 0;
                 this._currentFreePosition.x = 0;
-                this._currentFreePosition.y += this._lineHeight + yMargin; // +2 for safety marging
+                this._currentFreePosition.y += this._lineHeight + yMargin; // +2 for safety margin
                 // No more room?
                 // No more room?
                 if (this._currentFreePosition.y > textureSize.height) {
                 if (this._currentFreePosition.y > textureSize.height) {
                     return this.getChar("!");
                     return this.getChar("!");
@@ -160,8 +160,8 @@ var BABYLON;
             var lineCount = 1;
             var lineCount = 1;
             var charxpos = 0;
             var charxpos = 0;
             // Parse each char of the string
             // Parse each char of the string
-            for (var _i = 0, text_1 = text; _i < text_1.length; _i++) {
-                var char = text_1[_i];
+            for (var _i = 0; _i < text.length; _i++) {
+                var char = text[_i];
                 // Next line feed?
                 // Next line feed?
                 if (char === "\n") {
                 if (char === "\n") {
                     maxWidth = Math.max(maxWidth, curWidth);
                     maxWidth = Math.max(maxWidth, curWidth);
@@ -246,6 +246,6 @@ var BABYLON;
             return null;
             return null;
         };
         };
         return FontTexture;
         return FontTexture;
-    }(BABYLON.Texture));
+    })(BABYLON.Texture);
     BABYLON.FontTexture = FontTexture;
     BABYLON.FontTexture = FontTexture;
 })(BABYLON || (BABYLON = {}));
 })(BABYLON || (BABYLON = {}));

+ 1 - 1
src/Materials/Textures/babylon.hdrCubeTexture.js

@@ -442,6 +442,6 @@ var BABYLON;
             "back"
             "back"
         ];
         ];
         return HDRCubeTexture;
         return HDRCubeTexture;
-    }(BABYLON.BaseTexture));
+    })(BABYLON.BaseTexture);
     BABYLON.HDRCubeTexture = HDRCubeTexture;
     BABYLON.HDRCubeTexture = HDRCubeTexture;
 })(BABYLON || (BABYLON = {}));
 })(BABYLON || (BABYLON = {}));

+ 1 - 1
src/Materials/Textures/babylon.mapTexture.js

@@ -121,6 +121,6 @@ var BABYLON;
             return null;
             return null;
         };
         };
         return MapTexture;
         return MapTexture;
-    }(BABYLON.Texture));
+    })(BABYLON.Texture);
     BABYLON.MapTexture = MapTexture;
     BABYLON.MapTexture = MapTexture;
 })(BABYLON || (BABYLON = {}));
 })(BABYLON || (BABYLON = {}));

+ 1 - 1
src/Materials/Textures/babylon.mirrorTexture.js

@@ -49,6 +49,6 @@ var BABYLON;
             return serializationObject;
             return serializationObject;
         };
         };
         return MirrorTexture;
         return MirrorTexture;
-    }(BABYLON.RenderTargetTexture));
+    })(BABYLON.RenderTargetTexture);
     BABYLON.MirrorTexture = MirrorTexture;
     BABYLON.MirrorTexture = MirrorTexture;
 })(BABYLON || (BABYLON = {}));
 })(BABYLON || (BABYLON = {}));

+ 1 - 1
src/Materials/Textures/babylon.rawTexture.js

@@ -52,6 +52,6 @@ var BABYLON;
             return new RawTexture(data, width, height, BABYLON.Engine.TEXTUREFORMAT_RGBA, scene, generateMipMaps, invertY, samplingMode);
             return new RawTexture(data, width, height, BABYLON.Engine.TEXTUREFORMAT_RGBA, scene, generateMipMaps, invertY, samplingMode);
         };
         };
         return RawTexture;
         return RawTexture;
-    }(BABYLON.Texture));
+    })(BABYLON.Texture);
     BABYLON.RawTexture = RawTexture;
     BABYLON.RawTexture = RawTexture;
 })(BABYLON || (BABYLON = {}));
 })(BABYLON || (BABYLON = {}));

+ 1 - 1
src/Materials/Textures/babylon.refractionTexture.js

@@ -47,6 +47,6 @@ var BABYLON;
             return serializationObject;
             return serializationObject;
         };
         };
         return RefractionTexture;
         return RefractionTexture;
-    }(BABYLON.RenderTargetTexture));
+    })(BABYLON.RenderTargetTexture);
     BABYLON.RefractionTexture = RefractionTexture;
     BABYLON.RefractionTexture = RefractionTexture;
 })(BABYLON || (BABYLON = {}));
 })(BABYLON || (BABYLON = {}));

+ 1 - 1
src/Materials/Textures/babylon.renderTargetTexture.js

@@ -307,6 +307,6 @@ var BABYLON;
         RenderTargetTexture._REFRESHRATE_RENDER_ONEVERYFRAME = 1;
         RenderTargetTexture._REFRESHRATE_RENDER_ONEVERYFRAME = 1;
         RenderTargetTexture._REFRESHRATE_RENDER_ONEVERYTWOFRAMES = 2;
         RenderTargetTexture._REFRESHRATE_RENDER_ONEVERYTWOFRAMES = 2;
         return RenderTargetTexture;
         return RenderTargetTexture;
-    }(BABYLON.Texture));
+    })(BABYLON.Texture);
     BABYLON.RenderTargetTexture = RenderTargetTexture;
     BABYLON.RenderTargetTexture = RenderTargetTexture;
 })(BABYLON || (BABYLON = {}));
 })(BABYLON || (BABYLON = {}));

+ 1 - 1
src/Materials/Textures/babylon.texture.js

@@ -270,6 +270,6 @@ var BABYLON;
             BABYLON.serialize()
             BABYLON.serialize()
         ], Texture.prototype, "wAng", void 0);
         ], Texture.prototype, "wAng", void 0);
         return Texture;
         return Texture;
-    }(BABYLON.BaseTexture));
+    })(BABYLON.BaseTexture);
     BABYLON.Texture = Texture;
     BABYLON.Texture = Texture;
 })(BABYLON || (BABYLON = {}));
 })(BABYLON || (BABYLON = {}));

+ 1 - 1
src/Materials/Textures/babylon.videoTexture.js

@@ -78,6 +78,6 @@ var BABYLON;
             return true;
             return true;
         };
         };
         return VideoTexture;
         return VideoTexture;
-    }(BABYLON.Texture));
+    })(BABYLON.Texture);
     BABYLON.VideoTexture = VideoTexture;
     BABYLON.VideoTexture = VideoTexture;
 })(BABYLON || (BABYLON = {}));
 })(BABYLON || (BABYLON = {}));

+ 2 - 2
src/Materials/babylon.effect.js

@@ -46,7 +46,7 @@ var BABYLON;
             return currentDefines;
             return currentDefines;
         };
         };
         return EffectFallbacks;
         return EffectFallbacks;
-    }());
+    })();
     BABYLON.EffectFallbacks = EffectFallbacks;
     BABYLON.EffectFallbacks = EffectFallbacks;
     var Effect = (function () {
     var Effect = (function () {
         function Effect(baseName, attributesNames, uniformsNames, samplers, engine, defines, fallbacks, onCompiled, onError, indexParameters) {
         function Effect(baseName, attributesNames, uniformsNames, samplers, engine, defines, fallbacks, onCompiled, onError, indexParameters) {
@@ -465,6 +465,6 @@ var BABYLON;
         Effect.ShadersStore = {};
         Effect.ShadersStore = {};
         Effect.IncludesShadersStore = {};
         Effect.IncludesShadersStore = {};
         return Effect;
         return Effect;
-    }());
+    })();
     BABYLON.Effect = Effect;
     BABYLON.Effect = Effect;
 })(BABYLON || (BABYLON = {}));
 })(BABYLON || (BABYLON = {}));

+ 0 - 0
src/Materials/babylon.fresnelParameters.js


Certains fichiers n'ont pas été affichés car il y a eu trop de fichiers modifiés dans ce diff