Browse Source

Merge upstream

Borut 7 năm trước cách đây
mục cha
commit
9a1f795913

+ 173 - 166
Playground/babylon.d.txt

@@ -3842,135 +3842,6 @@ declare module BABYLON {
     }
 }
 
-declare module BABYLON.Debug {
-    class AxesViewer {
-
-
-
-
-
-
-        scene: Nullable<Scene>;
-        scaleLines: number;
-        constructor(scene: Scene, scaleLines?: number);
-        update(position: Vector3, xaxis: Vector3, yaxis: Vector3, zaxis: Vector3): void;
-        dispose(): void;
-    }
-}
-
-declare module BABYLON.Debug {
-    class BoneAxesViewer extends Debug.AxesViewer {
-        mesh: Nullable<Mesh>;
-        bone: Nullable<Bone>;
-        pos: Vector3;
-        xaxis: Vector3;
-        yaxis: Vector3;
-        zaxis: Vector3;
-        constructor(scene: Scene, bone: Bone, mesh: Mesh, scaleLines?: number);
-        update(): void;
-        dispose(): void;
-    }
-}
-
-declare module BABYLON {
-    class DebugLayer {
-
-        static InspectorURL: string;
-
-
-        constructor(scene: Scene);
-        /** Creates the inspector window. */
-
-        isVisible(): boolean;
-        hide(): void;
-        show(config?: {
-            popup?: boolean;
-            initialTab?: number;
-            parentElement?: HTMLElement;
-            newColors?: {
-                backgroundColor?: string;
-                backgroundColorLighter?: string;
-                backgroundColorLighter2?: string;
-                backgroundColorLighter3?: string;
-                color?: string;
-                colorTop?: string;
-                colorBot?: string;
-            };
-        }): void;
-    }
-}
-
-declare module BABYLON.Debug {
-    class PhysicsViewer {
-
-
-
-
-
-
-
-
-
-        constructor(scene: Scene);
-
-        showImpostor(impostor: PhysicsImpostor): void;
-        hideImpostor(impostor: Nullable<PhysicsImpostor>): void;
-
-
-
-
-        dispose(): void;
-    }
-}
-
-declare module BABYLON {
-    class RayHelper {
-        ray: Nullable<Ray>;
-
-
-
-
-
-
-
-
-        static CreateAndShow(ray: Ray, scene: Scene, color: Color3): RayHelper;
-        constructor(ray: Ray);
-        show(scene: Scene, color: Color3): void;
-        hide(): void;
-
-        attachToMesh(mesh: AbstractMesh, meshSpaceDirection?: Vector3, meshSpaceOrigin?: Vector3, length?: number): void;
-        detachFromMesh(): void;
-
-        dispose(): void;
-    }
-}
-
-declare module BABYLON.Debug {
-    /**
-    * Demo available here: http://www.babylonjs-playground.com/#1BZJVJ#8
-    */
-    class SkeletonViewer {
-        skeleton: Skeleton;
-        mesh: AbstractMesh;
-        autoUpdateBonesMatrices: boolean;
-        renderingGroupId: number;
-        color: Color3;
-
-
-
-
-
-        constructor(skeleton: Skeleton, mesh: AbstractMesh, scene: Scene, autoUpdateBonesMatrices?: boolean, renderingGroupId?: number);
-        isEnabled: boolean;
-
-
-
-        update(): void;
-        dispose(): void;
-    }
-}
-
 declare module BABYLON {
     class InstancingAttributeInfo {
         /**
@@ -4273,7 +4144,7 @@ declare module BABYLON {
 
 
 
-            [key: string]: Nullable<WebGLTexture>;
+            [key: string]: Nullable<InternalTexture>;
         };
 
 
@@ -4807,6 +4678,135 @@ declare var WebGLVertexArrayObject: {
     new (): WebGLVertexArrayObject;
 };
 
+declare module BABYLON.Debug {
+    class AxesViewer {
+
+
+
+
+
+
+        scene: Nullable<Scene>;
+        scaleLines: number;
+        constructor(scene: Scene, scaleLines?: number);
+        update(position: Vector3, xaxis: Vector3, yaxis: Vector3, zaxis: Vector3): void;
+        dispose(): void;
+    }
+}
+
+declare module BABYLON.Debug {
+    class BoneAxesViewer extends Debug.AxesViewer {
+        mesh: Nullable<Mesh>;
+        bone: Nullable<Bone>;
+        pos: Vector3;
+        xaxis: Vector3;
+        yaxis: Vector3;
+        zaxis: Vector3;
+        constructor(scene: Scene, bone: Bone, mesh: Mesh, scaleLines?: number);
+        update(): void;
+        dispose(): void;
+    }
+}
+
+declare module BABYLON {
+    class DebugLayer {
+
+        static InspectorURL: string;
+
+
+        constructor(scene: Scene);
+        /** Creates the inspector window. */
+
+        isVisible(): boolean;
+        hide(): void;
+        show(config?: {
+            popup?: boolean;
+            initialTab?: number;
+            parentElement?: HTMLElement;
+            newColors?: {
+                backgroundColor?: string;
+                backgroundColorLighter?: string;
+                backgroundColorLighter2?: string;
+                backgroundColorLighter3?: string;
+                color?: string;
+                colorTop?: string;
+                colorBot?: string;
+            };
+        }): void;
+    }
+}
+
+declare module BABYLON.Debug {
+    class PhysicsViewer {
+
+
+
+
+
+
+
+
+
+        constructor(scene: Scene);
+
+        showImpostor(impostor: PhysicsImpostor): void;
+        hideImpostor(impostor: Nullable<PhysicsImpostor>): void;
+
+
+
+
+        dispose(): void;
+    }
+}
+
+declare module BABYLON {
+    class RayHelper {
+        ray: Nullable<Ray>;
+
+
+
+
+
+
+
+
+        static CreateAndShow(ray: Ray, scene: Scene, color: Color3): RayHelper;
+        constructor(ray: Ray);
+        show(scene: Scene, color: Color3): void;
+        hide(): void;
+
+        attachToMesh(mesh: AbstractMesh, meshSpaceDirection?: Vector3, meshSpaceOrigin?: Vector3, length?: number): void;
+        detachFromMesh(): void;
+
+        dispose(): void;
+    }
+}
+
+declare module BABYLON.Debug {
+    /**
+    * Demo available here: http://www.babylonjs-playground.com/#1BZJVJ#8
+    */
+    class SkeletonViewer {
+        skeleton: Skeleton;
+        mesh: AbstractMesh;
+        autoUpdateBonesMatrices: boolean;
+        renderingGroupId: number;
+        color: Color3;
+
+
+
+
+
+        constructor(skeleton: Skeleton, mesh: AbstractMesh, scene: Scene, autoUpdateBonesMatrices?: boolean, renderingGroupId?: number);
+        isEnabled: boolean;
+
+
+
+        update(): void;
+        dispose(): void;
+    }
+}
+
 declare module BABYLON {
     class KeyboardEventTypes {
 
@@ -10627,6 +10627,11 @@ declare module BABYLON {
          * @param updatable.
          */
         createNormals(updatable: boolean): void;
+        /**
+         * Align the mesh with a normal.
+         * Returns the mesh.
+         */
+        alignWithNormal(normal: BABYLON.Vector3, upDirection?: BABYLON.Vector3): AbstractMesh;
 
     }
 }
@@ -12608,7 +12613,7 @@ declare module BABYLON {
          * The parameter `lines` is an array of lines, each line being an array of successive Vector3.
          * The optional parameter `instance` is an instance of an existing LineSystem object to be updated with the passed `lines` parameter. The way to update it is the same than for
          * The optional parameter `colors` is an array of line colors, each line colors being an array of successive Color4, one per line point.
-         * The optional parameter `useVertexAlpha' is to be set to `true` (default `false`) when the alpha value from the former `Color4` array must be used.
+         * The optional parameter `useVertexAlpha' is to be set to `false` (default `true`) when you don't need the alpha blending (faster).
          * updating a simple Line mesh, you just need to update every line in the `lines` array : http://doc.babylonjs.com/tutorials/How_to_dynamically_morph_a_mesh#lines-and-dashedlines
          * When updating an instance, remember that only line point positions can change, not the number of points, neither the number of lines.
          * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
@@ -12628,7 +12633,7 @@ declare module BABYLON {
          * The parameter `points` is an array successive Vector3.
          * The optional parameter `instance` is an instance of an existing LineMesh object to be updated with the passed `points` parameter : http://doc.babylonjs.com/tutorials/How_to_dynamically_morph_a_mesh#lines-and-dashedlines
          * The optional parameter `colors` is an array of successive Color4, one per line point.
-         * The optional parameter `useVertexAlpha' is to be set to `true` (default `false`) when the alpha value from the former `Color4` array must be used.
+         * The optional parameter `useVertexAlpha' is to be set to `false` (default `true`) when you don't need alpha blending (faster).
          * When updating an instance, remember that only point positions can change, not the number of points.
          * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
          */
@@ -14378,7 +14383,7 @@ declare module BABYLON {
          * Disposes the radialSphere.
          * @param {bolean} force
          */
-        cleanup(force?: boolean): void;
+        dispose(force?: boolean): void;
         /*** Helpers ***/
 
 
@@ -14420,7 +14425,7 @@ declare module BABYLON {
          * Disposes the radialSphere.
          * @param {bolean} force
          */
-        cleanup(force?: boolean): void;
+        dispose(force?: boolean): void;
 
     }
     interface PhysicsGravitationalFieldEventData {
@@ -14744,36 +14749,6 @@ declare module BABYLON {
 }
 
 declare module BABYLON {
-    class ReflectionProbe {
-        name: string;
-
-
-
-
-
-
-
-        invertYAxis: boolean;
-        position: Vector3;
-        constructor(name: string, size: number, scene: Scene, generateMipMaps?: boolean);
-        samples: number;
-        refreshRate: number;
-        getScene(): Scene;
-        readonly cubeTexture: RenderTargetTexture;
-        readonly renderList: Nullable<AbstractMesh[]>;
-        attachToMesh(mesh: AbstractMesh): void;
-        /**
-         * Specifies whether or not the stencil and depth buffer are cleared between two rendering groups.
-         *
-         * @param renderingGroupId The rendering group id corresponding to its index
-         * @param autoClearDepthStencil Automatically clears depth and stencil between groups if true.
-         */
-        setRenderingAutoClearDepthStencil(renderingGroupId: number, autoClearDepthStencil: boolean): void;
-        dispose(): void;
-    }
-}
-
-declare module BABYLON {
     class AnaglyphPostProcess extends PostProcess {
 
         constructor(name: string, options: number | PostProcessOptions, rigCameras: Camera[], samplingMode?: number, engine?: Engine, reusable?: boolean);
@@ -15025,7 +15000,7 @@ declare module BABYLON {
          * Defines cache preventing GC.
          */
 
-        constructor(name: string, options: number | PostProcessOptions, camera?: Nullable<Camera>, samplingMode?: number, engine?: Engine, reusable?: boolean, textureType?: number);
+        constructor(name: string, options: number | PostProcessOptions, camera?: Nullable<Camera>, samplingMode?: number, engine?: Engine, reusable?: boolean, textureType?: number, imageProcessingConfiguration?: ImageProcessingConfiguration);
         getClassName(): string;
 
         dispose(camera?: Camera): void;
@@ -15287,6 +15262,36 @@ declare module BABYLON {
 }
 
 declare module BABYLON {
+    class ReflectionProbe {
+        name: string;
+
+
+
+
+
+
+
+        invertYAxis: boolean;
+        position: Vector3;
+        constructor(name: string, size: number, scene: Scene, generateMipMaps?: boolean);
+        samples: number;
+        refreshRate: number;
+        getScene(): Scene;
+        readonly cubeTexture: RenderTargetTexture;
+        readonly renderList: Nullable<AbstractMesh[]>;
+        attachToMesh(mesh: AbstractMesh): void;
+        /**
+         * Specifies whether or not the stencil and depth buffer are cleared between two rendering groups.
+         *
+         * @param renderingGroupId The rendering group id corresponding to its index
+         * @param autoClearDepthStencil Automatically clears depth and stencil between groups if true.
+         */
+        setRenderingAutoClearDepthStencil(renderingGroupId: number, autoClearDepthStencil: boolean): void;
+        dispose(): void;
+    }
+}
+
+declare module BABYLON {
     class BoundingBoxRenderer {
         frontColor: Color3;
         backColor: Color3;
@@ -20631,6 +20636,8 @@ declare module BABYLON.GUI {
 
 
 
+
+        renderScale: number;
         background: string;
         idealWidth: number;
         idealHeight: number;
@@ -20655,7 +20662,7 @@ declare module BABYLON.GUI {
 
 
         static CreateForMesh(mesh: AbstractMesh, width?: number, height?: number, supportPointerMove?: boolean): AdvancedDynamicTexture;
-        static CreateFullscreenUI(name: string, foreground?: boolean, scene?: Nullable<Scene>): AdvancedDynamicTexture;
+        static CreateFullscreenUI(name: string, foreground?: boolean, scene?: Nullable<Scene>, sampling?: number): AdvancedDynamicTexture;
     }
 }
 

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 4576 - 4570
dist/preview release/babylon.d.ts


Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 43 - 43
dist/preview release/babylon.js


+ 105 - 56
dist/preview release/babylon.max.js

@@ -8014,7 +8014,7 @@ var BABYLON;
             this._alphaMode = Engine.ALPHA_DISABLE;
             // Cache
             this._internalTexturesCache = new Array();
-            this._activeTexturesCache = {};
+            this._boundTexturesCache = {};
             this._compiledEffects = {};
             this._vertexAttribArraysEnabled = [];
             this._uintIndicesCurrentlySet = false;
@@ -8872,8 +8872,8 @@ var BABYLON;
             }
         };
         Engine.prototype.resetTextureCache = function () {
-            for (var key in this._activeTexturesCache) {
-                this._activeTexturesCache[key] = null;
+            for (var key in this._boundTexturesCache) {
+                this._boundTexturesCache[key] = null;
             }
         };
         Engine.prototype.isDeterministicLockStep = function () {
@@ -10447,7 +10447,7 @@ var BABYLON;
                 if (!hostingScene) {
                     hostingScene = _this.scenes[_this.scenes.length - 1];
                 }
-                hostingScene.postProcessManager.directRender([_this._rescalePostProcess], rtt);
+                hostingScene.postProcessManager.directRender([_this._rescalePostProcess], rtt, true);
                 _this._bindTextureDirectly(_this._gl.TEXTURE_2D, destination);
                 _this._gl.copyTexImage2D(_this._gl.TEXTURE_2D, 0, internalFormat, 0, 0, destination.width, destination.height, 0);
                 _this.unBindFramebuffer(rtt);
@@ -11518,9 +11518,9 @@ var BABYLON;
             }
         };
         Engine.prototype._bindTextureDirectly = function (target, texture) {
-            if (this._activeTexturesCache[this._activeTextureChannel] !== texture) {
+            if (this._boundTexturesCache[this._activeTextureChannel] !== texture) {
                 this._gl.bindTexture(target, texture ? texture._webGLTexture : null);
-                this._activeTexturesCache[this._activeTextureChannel] = texture;
+                this._boundTexturesCache[this._activeTextureChannel] = texture;
             }
         };
         Engine.prototype._bindTexture = function (channel, texture) {
@@ -11554,7 +11554,7 @@ var BABYLON;
         Engine.prototype._setTexture = function (channel, texture) {
             // Not ready?
             if (!texture) {
-                if (this._activeTexturesCache[channel] != null) {
+                if (this._boundTexturesCache[channel] != null) {
                     this.activateTextureChannel(this._gl.TEXTURE0 + channel);
                     this._bindTextureDirectly(this._gl.TEXTURE_2D, null);
                     this._bindTextureDirectly(this._gl.TEXTURE_CUBE_MAP, null);
@@ -11591,7 +11591,7 @@ var BABYLON;
             if (!alreadyActivated) {
                 this.activateTextureChannel(this._gl.TEXTURE0 + channel);
             }
-            if (this._activeTexturesCache[this._activeTextureChannel] === internalTexture) {
+            if (this._boundTexturesCache[this._activeTextureChannel] === internalTexture) {
                 return false;
             }
             if (internalTexture && internalTexture.is3D) {
@@ -15600,6 +15600,26 @@ var BABYLON;
             BABYLON.VertexData.ComputeNormals(positions, indices, normals, { useRightHandedSystem: this.getScene().useRightHandedSystem });
             this.setVerticesData(BABYLON.VertexBuffer.NormalKind, normals, updatable);
         };
+        /**
+         * Align the mesh with a normal.
+         * Returns the mesh.
+         */
+        AbstractMesh.prototype.alignWithNormal = function (normal, upDirection) {
+            if (!upDirection) {
+                upDirection = BABYLON.Axis.Y;
+            }
+            var axisX = BABYLON.Tmp.Vector3[0];
+            var axisZ = BABYLON.Tmp.Vector3[1];
+            BABYLON.Vector3.CrossToRef(upDirection, normal, axisZ);
+            BABYLON.Vector3.CrossToRef(normal, axisZ, axisX);
+            if (this.rotationQuaternion) {
+                BABYLON.Quaternion.RotationQuaternionFromAxisToRef(axisX, normal, axisZ, this.rotationQuaternion);
+            }
+            else {
+                BABYLON.Vector3.RotationFromAxisToRef(axisX, normal, axisZ, this.rotation);
+            }
+            return this;
+        };
         AbstractMesh.prototype.checkOcclusionQuery = function () {
             var engine = this.getEngine();
             if (engine.webGLVersion < 2 || this.occlusionType === AbstractMesh.OCCLUSION_TYPE_NONE) {
@@ -47413,14 +47433,16 @@ var BABYLON;
             var options = {
                 attributes: [BABYLON.VertexBuffer.PositionKind],
                 uniforms: ["world", "viewProjection"],
-                needAlphaBlending: false,
+                needAlphaBlending: true,
                 defines: defines
             };
+            if (useVertexAlpha === false) {
+                options.needAlphaBlending = false;
+            }
             if (!useVertexColor) {
                 options.uniforms.push("color");
             }
             else {
-                options.needAlphaBlending = (useVertexAlpha) ? true : false;
                 options.defines.push("#define VERTEXCOLOR");
                 options.attributes.push(BABYLON.VertexBuffer.ColorKind);
             }
@@ -48376,7 +48398,7 @@ var BABYLON;
          * The parameter `lines` is an array of lines, each line being an array of successive Vector3.
          * The optional parameter `instance` is an instance of an existing LineSystem object to be updated with the passed `lines` parameter. The way to update it is the same than for
          * The optional parameter `colors` is an array of line colors, each line colors being an array of successive Color4, one per line point.
-         * The optional parameter `useVertexAlpha' is to be set to `true` (default `false`) when the alpha value from the former `Color4` array must be used.
+         * The optional parameter `useVertexAlpha' is to be set to `false` (default `true`) when you don't need the alpha blending (faster).
          * updating a simple Line mesh, you just need to update every line in the `lines` array : http://doc.babylonjs.com/tutorials/How_to_dynamically_morph_a_mesh#lines-and-dashedlines
          * When updating an instance, remember that only line point positions can change, not the number of points, neither the number of lines.
          * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
@@ -48432,7 +48454,7 @@ var BABYLON;
          * The parameter `points` is an array successive Vector3.
          * The optional parameter `instance` is an instance of an existing LineMesh object to be updated with the passed `points` parameter : http://doc.babylonjs.com/tutorials/How_to_dynamically_morph_a_mesh#lines-and-dashedlines
          * The optional parameter `colors` is an array of successive Color4, one per line point.
-         * The optional parameter `useVertexAlpha' is to be set to `true` (default `false`) when the alpha value from the former `Color4` array must be used.
+         * The optional parameter `useVertexAlpha' is to be set to `false` (default `true`) when you don't need alpha blending (faster).
          * When updating an instance, remember that only point positions can change, not the number of points.
          * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
          */
@@ -60323,6 +60345,9 @@ var BABYLON;
                 this.addEffect(new BABYLON.PostProcessRenderEffect(engine, this.FxaaPostProcessId, function () { return _this.fxaa; }, true));
                 this.fxaa.autoClear = !this.bloomEnabled && (!this._hdr || !this.imageProcessing);
             }
+            else if (this._hdr && this.imageProcessing) {
+                this.finalMerge = this.imageProcessing;
+            }
             else {
                 this.finalMerge = new BABYLON.PassPostProcess("finalMerge", 1.0, null, BABYLON.Texture.BILINEAR_SAMPLINGMODE, engine, false, this._defaultPipelineTextureType);
                 this.addEffect(new BABYLON.PostProcessRenderEffect(engine, this.FinalMergePostProcessId, function () { return _this.finalMerge; }, true));
@@ -61233,7 +61258,7 @@ var BABYLON;
 (function (BABYLON) {
     var ImageProcessingPostProcess = /** @class */ (function (_super) {
         __extends(ImageProcessingPostProcess, _super);
-        function ImageProcessingPostProcess(name, options, camera, samplingMode, engine, reusable, textureType) {
+        function ImageProcessingPostProcess(name, options, camera, samplingMode, engine, reusable, textureType, imageProcessingConfiguration) {
             if (camera === void 0) { camera = null; }
             if (textureType === void 0) { textureType = BABYLON.Engine.TEXTURETYPE_UNSIGNED_INT; }
             var _this = _super.call(this, name, "imageProcessing", [], [], options, camera, samplingMode, engine, reusable, null, textureType, "postprocess", null, true) || this;
@@ -61257,9 +61282,17 @@ var BABYLON;
                 IMAGEPROCESSINGPOSTPROCESS: false,
                 EXPOSURE: false,
             };
-            // Setup the default processing configuration to the scene.
-            _this._attachImageProcessingConfiguration(null, true);
-            _this.imageProcessingConfiguration.applyByPostProcess = true;
+            // Setup the configuration as forced by the constructor. This would then not force the 
+            // scene materials output in linear space and let untouched the default forward pass.
+            if (imageProcessingConfiguration) {
+                _this._attachImageProcessingConfiguration(imageProcessingConfiguration, true);
+                _this.imageProcessingConfiguration.applyByPostProcess = false;
+                _this.fromLinearSpace = false;
+            }
+            else {
+                _this._attachImageProcessingConfiguration(null, true);
+                _this.imageProcessingConfiguration.applyByPostProcess = true;
+            }
             _this.onApply = function (effect) {
                 _this.imageProcessingConfiguration.bind(effect, _this.aspectRatio);
             };
@@ -67410,7 +67443,7 @@ var BABYLON;
                 }
                 impostor.applyImpulse(impostorForceAndContactPoint.force, impostorForceAndContactPoint.contactPoint);
             });
-            event.cleanup(false);
+            event.dispose(false);
             return event;
         };
         /**
@@ -67437,7 +67470,7 @@ var BABYLON;
                 }
                 impostor.applyForce(impostorForceAndContactPoint.force, impostorForceAndContactPoint.contactPoint);
             });
-            event.cleanup(false);
+            event.dispose(false);
             return event;
         };
         /**
@@ -67457,7 +67490,7 @@ var BABYLON;
                 return null;
             }
             var event = new PhysicsGravitationalFieldEvent(this, this._scene, origin, radius, strength, falloff);
-            event.cleanup(false);
+            event.dispose(false);
             return event;
         };
         return PhysicsHelper;
@@ -67521,7 +67554,7 @@ var BABYLON;
          * Disposes the radialSphere.
          * @param {bolean} force
          */
-        PhysicsRadialExplosionEvent.prototype.cleanup = function (force) {
+        PhysicsRadialExplosionEvent.prototype.dispose = function (force) {
             var _this = this;
             if (force === void 0) { force = true; }
             if (force) {
@@ -67594,7 +67627,7 @@ var BABYLON;
          * Disposes the radialSphere.
          * @param {bolean} force
          */
-        PhysicsGravitationalFieldEvent.prototype.cleanup = function (force) {
+        PhysicsGravitationalFieldEvent.prototype.dispose = function (force) {
             var _this = this;
             if (force === void 0) { force = true; }
             if (force) {
@@ -71717,13 +71750,14 @@ var BABYLON;
             this._teleportationAllowed = false;
             this._rotationAllowed = true;
             this._teleportationRequestInitiated = false;
-            //private _classicGamepadTeleportationRequestInitiated = false;
             this._rotationRightAsked = false;
             this._rotationLeftAsked = false;
             this._teleportationFillColor = "#444444";
             this._teleportationBorderColor = "#FFFFFF";
             this._rotationAngle = 0;
             this._haloCenter = new BABYLON.Vector3(0, 0, 0);
+            this._padSensibilityUp = 0.7;
+            this._padSensibilityDown = 0.3;
             this._scene = scene;
             if (!this._scene.activeCamera || isNaN(this._scene.activeCamera.position.x)) {
                 this._position = new BABYLON.Vector3(0, 2, 0);
@@ -71958,7 +71992,6 @@ var BABYLON;
                 if (!this._webVRpresenting) {
                     this._webVRCamera.position = this._position;
                     this._scene.activeCamera = this._webVRCamera;
-                    this._scene.imageProcessingConfiguration.isEnabled = true;
                 }
             }
             else {
@@ -71986,7 +72019,6 @@ var BABYLON;
             }
             this._deviceOrientationCamera.position = this._position;
             this._scene.activeCamera = this._deviceOrientationCamera;
-            this._scene.imageProcessingConfiguration.isEnabled = false;
             if (this._canvas) {
                 this._scene.activeCamera.attachControl(this._canvas);
             }
@@ -72021,17 +72053,25 @@ var BABYLON;
                 this._enableTeleportationOnController(this._webVRCamera.rightController);
             }
             this._scene.gamepadManager.onGamepadConnectedObservable.add(function (pad) { return _this._onNewGamepadConnected(pad); });
-            this._postProcessMove = new BABYLON.ImageProcessingPostProcess("postProcessMove", 1.0, this._webVRCamera);
+            // Creates an image processing post process for the vignette not relying
+            // on the main scene configuration for image processing to reduce setup and spaces 
+            // (gamma/linear) conflicts.
+            var imageProcessingConfiguration = new BABYLON.ImageProcessingConfiguration();
+            imageProcessingConfiguration.vignetteColor = new BABYLON.Color4(0, 0, 0, 0);
+            this._postProcessMove = new BABYLON.ImageProcessingPostProcess("postProcessMove", 1.0, this._webVRCamera, undefined, undefined, undefined, undefined, imageProcessingConfiguration);
+            // Force recompilation of the postprocess to be ready before hand and not block the animation.
+            // Simply touching the property forces recompilation of the effect.
+            this._postProcessMove.imageProcessingConfiguration.vignetteEnabled = true;
+            // Go back to default (both variants would be compiled).
+            this._postProcessMove.imageProcessingConfiguration.vignetteEnabled = false;
             this._passProcessMove = new BABYLON.PassPostProcess("pass", 1.0, this._webVRCamera);
-            this._scene.imageProcessingConfiguration.vignetteColor = new BABYLON.Color4(0, 0, 0, 0);
-            this._scene.imageProcessingConfiguration.vignetteEnabled = true;
-            this._scene.imageProcessingConfiguration.isEnabled = false;
             this._createGazeTracker();
             this._createTeleportationCircles();
             this.meshSelectionPredicate = function (mesh) {
                 if (mesh.isVisible && mesh.name.indexOf("gazeTracker") === -1
                     && mesh.name.indexOf("teleportationCircle") === -1
-                    && mesh.name.indexOf("torusTeleportation") === -1) {
+                    && mesh.name.indexOf("torusTeleportation") === -1
+                    && mesh.name.indexOf("ray") === -1) {
                     return true;
                 }
                 return false;
@@ -72045,12 +72085,12 @@ var BABYLON;
             if (gamepad.leftStick) {
                 gamepad.onleftstickchanged(function (stickValues) {
                     if (!_this._teleportationRequestInitiated) {
-                        if (stickValues.y < -0.6) {
+                        if (stickValues.y < -_this._padSensibilityUp) {
                             _this._teleportationRequestInitiated = true;
                         }
                     }
                     else {
-                        if (stickValues.y > -0.4) {
+                        if (stickValues.y > -_this._padSensibilityDown) {
                             if (_this._teleportationAllowed) {
                                 _this._teleportCamera();
                             }
@@ -72062,7 +72102,7 @@ var BABYLON;
             if (gamepad.rightStick) {
                 gamepad.onrightstickchanged(function (stickValues) {
                     if (!_this._rotationLeftAsked) {
-                        if (stickValues.x < -0.6) {
+                        if (stickValues.x < -_this._padSensibilityUp) {
                             _this._rotationLeftAsked = true;
                             if (_this._rotationAllowed) {
                                 _this._rotateCamera(false);
@@ -72070,12 +72110,12 @@ var BABYLON;
                         }
                     }
                     else {
-                        if (stickValues.x > -0.4) {
+                        if (stickValues.x > -_this._padSensibilityDown) {
                             _this._rotationLeftAsked = false;
                         }
                     }
                     if (!_this._rotationRightAsked) {
-                        if (stickValues.x > 0.6) {
+                        if (stickValues.x > _this._padSensibilityUp) {
                             _this._rotationRightAsked = true;
                             if (_this._rotationAllowed) {
                                 _this._rotateCamera(true);
@@ -72083,7 +72123,7 @@ var BABYLON;
                         }
                     }
                     else {
-                        if (stickValues.x < 0.4) {
+                        if (stickValues.x < _this._padSensibilityDown) {
                             _this._rotationRightAsked = false;
                         }
                     }
@@ -72101,14 +72141,14 @@ var BABYLON;
                         break;
                     }
                 }
-                var laserPointer = BABYLON.Mesh.CreateCylinder("laserPointer", 3, 0.004, 0.0001, 20, 1, this._scene, false);
+                var laserPointer = BABYLON.Mesh.CreateCylinder("laserPointer", 1, 0.004, 0.0001, 20, 1, this._scene, false);
                 var laserPointerMaterial = new BABYLON.StandardMaterial("laserPointerMat", this._scene);
                 laserPointerMaterial.emissiveColor = new BABYLON.Color3(0.7, 0.7, 0.7);
                 laserPointerMaterial.alpha = 0.6;
                 laserPointer.material = laserPointerMaterial;
                 laserPointer.rotation.x = Math.PI / 2;
                 laserPointer.parent = controllerMesh;
-                laserPointer.position.z = -1.5;
+                laserPointer.position.z = -0.5;
                 laserPointer.position.y = 0;
                 laserPointer.isVisible = false;
                 webVRController.onMainButtonStateChangedObservable.add(function (stateObject) {
@@ -72120,22 +72160,23 @@ var BABYLON;
                 webVRController.onPadValuesChangedObservable.add(function (stateObject) {
                     // on pressed
                     if (!_this._teleportationRequestInitiated) {
-                        if (stateObject.y < -0.6) {
-                            laserPointer.isVisible = true;
+                        if (stateObject.y < -_this._padSensibilityUp) {
+                            //laserPointer.isVisible = true;
                             _this._teleportationRequestInitiated = true;
                         }
                     }
                     else {
-                        if (stateObject.y > -0.4) {
+                        if (stateObject.y > -_this._padSensibilityDown) {
                             if (_this._teleportationAllowed) {
+                                _this._teleportationAllowed = false;
                                 _this._teleportCamera();
                             }
                             _this._teleportationRequestInitiated = false;
-                            laserPointer.isVisible = false;
+                            //laserPointer.isVisible = false;
                         }
                     }
                     if (!_this._rotationLeftAsked) {
-                        if (stateObject.x < -0.6) {
+                        if (stateObject.x < -_this._padSensibilityUp) {
                             _this._rotationLeftAsked = true;
                             if (_this._rotationAllowed) {
                                 _this._rotateCamera(false);
@@ -72143,12 +72184,12 @@ var BABYLON;
                         }
                     }
                     else {
-                        if (stateObject.x > -0.4) {
+                        if (stateObject.x > -_this._padSensibilityDown) {
                             _this._rotationLeftAsked = false;
                         }
                     }
                     if (!_this._rotationRightAsked) {
-                        if (stateObject.x > 0.6) {
+                        if (stateObject.x > _this._padSensibilityUp) {
                             _this._rotationRightAsked = true;
                             if (_this._rotationAllowed) {
                                 _this._rotateCamera(true);
@@ -72156,7 +72197,7 @@ var BABYLON;
                         }
                     }
                     else {
-                        if (stateObject.x < 0.4) {
+                        if (stateObject.x < _this._padSensibilityDown) {
                             _this._rotationRightAsked = false;
                         }
                     }
@@ -72176,6 +72217,7 @@ var BABYLON;
         };
         VRExperienceHelper.prototype._createTeleportationCircles = function () {
             this._teleportationCircle = BABYLON.Mesh.CreateGround("teleportationCircle", 2, 2, 2, this._scene);
+            this._teleportationCircle.isPickable = false;
             var length = 512;
             var dynamicTexture = new BABYLON.DynamicTexture("DynamicTexture", length, this._scene, true);
             dynamicTexture.hasAlpha = true;
@@ -72196,6 +72238,7 @@ var BABYLON;
             teleportationCircleMaterial.diffuseTexture = dynamicTexture;
             this._teleportationCircle.material = teleportationCircleMaterial;
             var torus = BABYLON.Mesh.CreateTorus("torusTeleportation", 0.75, 0.1, 25, this._scene, false);
+            torus.isPickable = false;
             torus.parent = this._teleportationCircle;
             var animationInnerCircle = new BABYLON.Animation("animationInnerCircle", "position.y", 30, BABYLON.Animation.ANIMATIONTYPE_FLOAT, BABYLON.Animation.ANIMATIONLOOPMODE_CYCLE);
             var keys = [];
@@ -72288,11 +72331,11 @@ var BABYLON;
             animationPP2.setKeys(vignetteStretchKeys);
             animationPP2.setEasingFunction(easingFunction);
             this._postProcessMove.animations.push(animationPP2);
-            this._scene.imageProcessingConfiguration.vignetteWeight = 0;
-            this._scene.imageProcessingConfiguration.vignetteStretch = 0;
-            this._scene.imageProcessingConfiguration.vignetteEnabled = true;
+            this._postProcessMove.imageProcessingConfiguration.vignetteWeight = 0;
+            this._postProcessMove.imageProcessingConfiguration.vignetteStretch = 0;
+            this._postProcessMove.imageProcessingConfiguration.vignetteEnabled = true;
             this._scene.beginAnimation(this._postProcessMove, 0, 6, false, 1, function () {
-                _this._scene.imageProcessingConfiguration.vignetteEnabled = false;
+                _this._postProcessMove.imageProcessingConfiguration.vignetteEnabled = false;
             });
             this._scene.beginAnimation(this.currentVRCamera, 0, 6, false, 1);
         };
@@ -72372,11 +72415,11 @@ var BABYLON;
             });
             animationPP2.setKeys(vignetteStretchKeys);
             this._postProcessMove.animations.push(animationPP2);
-            this._scene.imageProcessingConfiguration.vignetteWeight = 8;
-            this._scene.imageProcessingConfiguration.vignetteStretch = 10;
-            this._scene.imageProcessingConfiguration.vignetteEnabled = true;
+            this._postProcessMove.imageProcessingConfiguration.vignetteWeight = 8;
+            this._postProcessMove.imageProcessingConfiguration.vignetteStretch = 10;
+            this._postProcessMove.imageProcessingConfiguration.vignetteEnabled = true;
             this._scene.beginAnimation(this._postProcessMove, 0, 11, false, 1, function () {
-                _this._scene.imageProcessingConfiguration.vignetteEnabled = false;
+                _this._postProcessMove.imageProcessingConfiguration.vignetteEnabled = false;
             });
             this._scene.beginAnimation(this.currentVRCamera, 0, 11, false, 1);
         };
@@ -72419,6 +72462,7 @@ var BABYLON;
                 else {
                     this._gazeTracker.position.z -= deltaFighting;
                 }
+                ray.length = hit.distance;
             }
             if (this._rayHelper) {
                 this._rayHelper.dispose();
@@ -72432,6 +72476,7 @@ var BABYLON;
                     this._moveTeleportationSelectorTo(hit.pickedPoint);
                     return;
                 }
+                console.log(hit.pickedMesh.name);
                 // If not, we're in a selection scenario
                 this._hideTeleportationCircle();
                 this._teleportationAllowed = false;
@@ -77090,8 +77135,8 @@ var BABYLON;
         NullEngine.prototype.updateDynamicVertexBuffer = function (vertexBuffer, vertices, offset, count) {
         };
         NullEngine.prototype._bindTextureDirectly = function (target, texture) {
-            if (this._activeTexturesCache[this._activeTextureChannel] !== texture) {
-                this._activeTexturesCache[this._activeTextureChannel] = texture;
+            if (this._boundTexturesCache[this._activeTextureChannel] !== texture) {
+                this._boundTexturesCache[this._activeTextureChannel] = texture;
             }
         };
         NullEngine.prototype._bindTexture = function (channel, texture) {
@@ -79004,10 +79049,12 @@ var BABYLON;
          * Setup the ground according to the specified options.
          */
         EnvironmentHelper.prototype._setupGround = function (sceneSize) {
+            var _this = this;
             if (!this._ground) {
                 this._ground = BABYLON.Mesh.CreatePlane("BackgroundPlane", sceneSize.groundSize, this._scene);
                 this._ground.rotation.x = Math.PI / 2; // Face up by default.
                 this._ground.parent = this._rootMesh;
+                this._ground.onDisposeObservable.add(function () { _this._ground = null; });
             }
             this._ground.receiveShadows = this._options.enableGroundShadow;
         };
@@ -79092,8 +79139,10 @@ var BABYLON;
          * Setup the skybox according to the specified options.
          */
         EnvironmentHelper.prototype._setupSkybox = function (sceneSize) {
+            var _this = this;
             if (!this._skybox) {
                 this._skybox = BABYLON.Mesh.CreateBox("BackgroundSkybox", sceneSize.skyboxSize, this._scene, undefined, BABYLON.Mesh.BACKSIDE);
+                this._skybox.onDisposeObservable.add(function () { _this._skybox = null; });
             }
             this._skybox.parent = this._rootMesh;
         };
@@ -79144,7 +79193,7 @@ var BABYLON;
             if (this._skyboxMaterial) {
                 this._skyboxMaterial.dispose(true, true);
             }
-            this._rootMesh.dispose(true);
+            this._rootMesh.dispose(false);
         };
         /**
          * Default ground texture URL.

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 43 - 43
dist/preview release/babylon.worker.js


Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 6199 - 6199
dist/preview release/customConfigurations/minimalGLTFViewer/babylon.d.ts


Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 11 - 11
dist/preview release/customConfigurations/minimalGLTFViewer/babylon.js


+ 39 - 31
dist/preview release/customConfigurations/minimalGLTFViewer/babylon.max.js

@@ -8014,7 +8014,7 @@ var BABYLON;
             this._alphaMode = Engine.ALPHA_DISABLE;
             // Cache
             this._internalTexturesCache = new Array();
-            this._activeTexturesCache = {};
+            this._boundTexturesCache = {};
             this._compiledEffects = {};
             this._vertexAttribArraysEnabled = [];
             this._uintIndicesCurrentlySet = false;
@@ -8872,8 +8872,8 @@ var BABYLON;
             }
         };
         Engine.prototype.resetTextureCache = function () {
-            for (var key in this._activeTexturesCache) {
-                this._activeTexturesCache[key] = null;
+            for (var key in this._boundTexturesCache) {
+                this._boundTexturesCache[key] = null;
             }
         };
         Engine.prototype.isDeterministicLockStep = function () {
@@ -10447,7 +10447,7 @@ var BABYLON;
                 if (!hostingScene) {
                     hostingScene = _this.scenes[_this.scenes.length - 1];
                 }
-                hostingScene.postProcessManager.directRender([_this._rescalePostProcess], rtt);
+                hostingScene.postProcessManager.directRender([_this._rescalePostProcess], rtt, true);
                 _this._bindTextureDirectly(_this._gl.TEXTURE_2D, destination);
                 _this._gl.copyTexImage2D(_this._gl.TEXTURE_2D, 0, internalFormat, 0, 0, destination.width, destination.height, 0);
                 _this.unBindFramebuffer(rtt);
@@ -11518,9 +11518,9 @@ var BABYLON;
             }
         };
         Engine.prototype._bindTextureDirectly = function (target, texture) {
-            if (this._activeTexturesCache[this._activeTextureChannel] !== texture) {
+            if (this._boundTexturesCache[this._activeTextureChannel] !== texture) {
                 this._gl.bindTexture(target, texture ? texture._webGLTexture : null);
-                this._activeTexturesCache[this._activeTextureChannel] = texture;
+                this._boundTexturesCache[this._activeTextureChannel] = texture;
             }
         };
         Engine.prototype._bindTexture = function (channel, texture) {
@@ -11554,7 +11554,7 @@ var BABYLON;
         Engine.prototype._setTexture = function (channel, texture) {
             // Not ready?
             if (!texture) {
-                if (this._activeTexturesCache[channel] != null) {
+                if (this._boundTexturesCache[channel] != null) {
                     this.activateTextureChannel(this._gl.TEXTURE0 + channel);
                     this._bindTextureDirectly(this._gl.TEXTURE_2D, null);
                     this._bindTextureDirectly(this._gl.TEXTURE_CUBE_MAP, null);
@@ -11591,7 +11591,7 @@ var BABYLON;
             if (!alreadyActivated) {
                 this.activateTextureChannel(this._gl.TEXTURE0 + channel);
             }
-            if (this._activeTexturesCache[this._activeTextureChannel] === internalTexture) {
+            if (this._boundTexturesCache[this._activeTextureChannel] === internalTexture) {
                 return false;
             }
             if (internalTexture && internalTexture.is3D) {
@@ -47279,14 +47279,16 @@ var BABYLON;
             var options = {
                 attributes: [BABYLON.VertexBuffer.PositionKind],
                 uniforms: ["world", "viewProjection"],
-                needAlphaBlending: false,
+                needAlphaBlending: true,
                 defines: defines
             };
+            if (useVertexAlpha === false) {
+                options.needAlphaBlending = false;
+            }
             if (!useVertexColor) {
                 options.uniforms.push("color");
             }
             else {
-                options.needAlphaBlending = (useVertexAlpha) ? true : false;
                 options.defines.push("#define VERTEXCOLOR");
                 options.attributes.push(BABYLON.VertexBuffer.ColorKind);
             }
@@ -48242,7 +48244,7 @@ var BABYLON;
          * The parameter `lines` is an array of lines, each line being an array of successive Vector3.
          * The optional parameter `instance` is an instance of an existing LineSystem object to be updated with the passed `lines` parameter. The way to update it is the same than for
          * The optional parameter `colors` is an array of line colors, each line colors being an array of successive Color4, one per line point.
-         * The optional parameter `useVertexAlpha' is to be set to `true` (default `false`) when the alpha value from the former `Color4` array must be used.
+         * The optional parameter `useVertexAlpha' is to be set to `false` (default `true`) when you don't need the alpha blending (faster).
          * updating a simple Line mesh, you just need to update every line in the `lines` array : http://doc.babylonjs.com/tutorials/How_to_dynamically_morph_a_mesh#lines-and-dashedlines
          * When updating an instance, remember that only line point positions can change, not the number of points, neither the number of lines.
          * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
@@ -48298,7 +48300,7 @@ var BABYLON;
          * The parameter `points` is an array successive Vector3.
          * The optional parameter `instance` is an instance of an existing LineMesh object to be updated with the passed `points` parameter : http://doc.babylonjs.com/tutorials/How_to_dynamically_morph_a_mesh#lines-and-dashedlines
          * The optional parameter `colors` is an array of successive Color4, one per line point.
-         * The optional parameter `useVertexAlpha' is to be set to `true` (default `false`) when the alpha value from the former `Color4` array must be used.
+         * The optional parameter `useVertexAlpha' is to be set to `false` (default `true`) when you don't need alpha blending (faster).
          * When updating an instance, remember that only point positions can change, not the number of points.
          * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
          */
@@ -67287,7 +67289,7 @@ var BABYLON;
                 }
                 impostor.applyImpulse(impostorForceAndContactPoint.force, impostorForceAndContactPoint.contactPoint);
             });
-            event.cleanup(false);
+            event.dispose(false);
             return event;
         };
         /**
@@ -67314,7 +67316,7 @@ var BABYLON;
                 }
                 impostor.applyForce(impostorForceAndContactPoint.force, impostorForceAndContactPoint.contactPoint);
             });
-            event.cleanup(false);
+            event.dispose(false);
             return event;
         };
         /**
@@ -67334,7 +67336,7 @@ var BABYLON;
                 return null;
             }
             var event = new PhysicsGravitationalFieldEvent(this, this._scene, origin, radius, strength, falloff);
-            event.cleanup(false);
+            event.dispose(false);
             return event;
         };
         return PhysicsHelper;
@@ -67398,7 +67400,7 @@ var BABYLON;
          * Disposes the radialSphere.
          * @param {bolean} force
          */
-        PhysicsRadialExplosionEvent.prototype.cleanup = function (force) {
+        PhysicsRadialExplosionEvent.prototype.dispose = function (force) {
             var _this = this;
             if (force === void 0) { force = true; }
             if (force) {
@@ -67471,7 +67473,7 @@ var BABYLON;
          * Disposes the radialSphere.
          * @param {bolean} force
          */
-        PhysicsGravitationalFieldEvent.prototype.cleanup = function (force) {
+        PhysicsGravitationalFieldEvent.prototype.dispose = function (force) {
             var _this = this;
             if (force === void 0) { force = true; }
             if (force) {
@@ -71594,13 +71596,14 @@ var BABYLON;
             this._teleportationAllowed = false;
             this._rotationAllowed = true;
             this._teleportationRequestInitiated = false;
-            //private _classicGamepadTeleportationRequestInitiated = false;
             this._rotationRightAsked = false;
             this._rotationLeftAsked = false;
             this._teleportationFillColor = "#444444";
             this._teleportationBorderColor = "#FFFFFF";
             this._rotationAngle = 0;
             this._haloCenter = new BABYLON.Vector3(0, 0, 0);
+            this._padSensibilityUp = 0.7;
+            this._padSensibilityDown = 0.3;
             this._scene = scene;
             if (!this._scene.activeCamera || isNaN(this._scene.activeCamera.position.x)) {
                 this._position = new BABYLON.Vector3(0, 2, 0);
@@ -71913,7 +71916,8 @@ var BABYLON;
             this.meshSelectionPredicate = function (mesh) {
                 if (mesh.isVisible && mesh.name.indexOf("gazeTracker") === -1
                     && mesh.name.indexOf("teleportationCircle") === -1
-                    && mesh.name.indexOf("torusTeleportation") === -1) {
+                    && mesh.name.indexOf("torusTeleportation") === -1
+                    && mesh.name.indexOf("ray") === -1) {
                     return true;
                 }
                 return false;
@@ -71927,12 +71931,12 @@ var BABYLON;
             if (gamepad.leftStick) {
                 gamepad.onleftstickchanged(function (stickValues) {
                     if (!_this._teleportationRequestInitiated) {
-                        if (stickValues.y < -0.6) {
+                        if (stickValues.y < -_this._padSensibilityUp) {
                             _this._teleportationRequestInitiated = true;
                         }
                     }
                     else {
-                        if (stickValues.y > -0.4) {
+                        if (stickValues.y > -_this._padSensibilityDown) {
                             if (_this._teleportationAllowed) {
                                 _this._teleportCamera();
                             }
@@ -71944,7 +71948,7 @@ var BABYLON;
             if (gamepad.rightStick) {
                 gamepad.onrightstickchanged(function (stickValues) {
                     if (!_this._rotationLeftAsked) {
-                        if (stickValues.x < -0.6) {
+                        if (stickValues.x < -_this._padSensibilityUp) {
                             _this._rotationLeftAsked = true;
                             if (_this._rotationAllowed) {
                                 _this._rotateCamera(false);
@@ -71952,12 +71956,12 @@ var BABYLON;
                         }
                     }
                     else {
-                        if (stickValues.x > -0.4) {
+                        if (stickValues.x > -_this._padSensibilityDown) {
                             _this._rotationLeftAsked = false;
                         }
                     }
                     if (!_this._rotationRightAsked) {
-                        if (stickValues.x > 0.6) {
+                        if (stickValues.x > _this._padSensibilityUp) {
                             _this._rotationRightAsked = true;
                             if (_this._rotationAllowed) {
                                 _this._rotateCamera(true);
@@ -71965,7 +71969,7 @@ var BABYLON;
                         }
                     }
                     else {
-                        if (stickValues.x < 0.4) {
+                        if (stickValues.x < _this._padSensibilityDown) {
                             _this._rotationRightAsked = false;
                         }
                     }
@@ -72002,14 +72006,15 @@ var BABYLON;
                 webVRController.onPadValuesChangedObservable.add(function (stateObject) {
                     // on pressed
                     if (!_this._teleportationRequestInitiated) {
-                        if (stateObject.y < -0.6) {
+                        if (stateObject.y < -_this._padSensibilityUp) {
                             laserPointer.isVisible = true;
                             _this._teleportationRequestInitiated = true;
                         }
                     }
                     else {
-                        if (stateObject.y > -0.4) {
+                        if (stateObject.y > -_this._padSensibilityDown) {
                             if (_this._teleportationAllowed) {
+                                _this._teleportationAllowed = false;
                                 _this._teleportCamera();
                             }
                             _this._teleportationRequestInitiated = false;
@@ -72017,7 +72022,7 @@ var BABYLON;
                         }
                     }
                     if (!_this._rotationLeftAsked) {
-                        if (stateObject.x < -0.6) {
+                        if (stateObject.x < -_this._padSensibilityUp) {
                             _this._rotationLeftAsked = true;
                             if (_this._rotationAllowed) {
                                 _this._rotateCamera(false);
@@ -72025,12 +72030,12 @@ var BABYLON;
                         }
                     }
                     else {
-                        if (stateObject.x > -0.4) {
+                        if (stateObject.x > -_this._padSensibilityDown) {
                             _this._rotationLeftAsked = false;
                         }
                     }
                     if (!_this._rotationRightAsked) {
-                        if (stateObject.x > 0.6) {
+                        if (stateObject.x > _this._padSensibilityUp) {
                             _this._rotationRightAsked = true;
                             if (_this._rotationAllowed) {
                                 _this._rotateCamera(true);
@@ -72038,7 +72043,7 @@ var BABYLON;
                         }
                     }
                     else {
-                        if (stateObject.x < 0.4) {
+                        if (stateObject.x < _this._padSensibilityDown) {
                             _this._rotationRightAsked = false;
                         }
                     }
@@ -72058,6 +72063,7 @@ var BABYLON;
         };
         VRExperienceHelper.prototype._createTeleportationCircles = function () {
             this._teleportationCircle = BABYLON.Mesh.CreateGround("teleportationCircle", 2, 2, 2, this._scene);
+            this._teleportationCircle.isPickable = false;
             var length = 512;
             var dynamicTexture = new BABYLON.DynamicTexture("DynamicTexture", length, this._scene, true);
             dynamicTexture.hasAlpha = true;
@@ -72078,6 +72084,7 @@ var BABYLON;
             teleportationCircleMaterial.diffuseTexture = dynamicTexture;
             this._teleportationCircle.material = teleportationCircleMaterial;
             var torus = BABYLON.Mesh.CreateTorus("torusTeleportation", 0.75, 0.1, 25, this._scene, false);
+            torus.isPickable = false;
             torus.parent = this._teleportationCircle;
             var animationInnerCircle = new BABYLON.Animation("animationInnerCircle", "position.y", 30, BABYLON.Animation.ANIMATIONTYPE_FLOAT, BABYLON.Animation.ANIMATIONLOOPMODE_CYCLE);
             var keys = [];
@@ -72314,6 +72321,7 @@ var BABYLON;
                     this._moveTeleportationSelectorTo(hit.pickedPoint);
                     return;
                 }
+                console.log(hit.pickedMesh.name);
                 // If not, we're in a selection scenario
                 this._hideTeleportationCircle();
                 this._teleportationAllowed = false;

+ 3 - 1
dist/preview release/gui/babylon.gui.d.ts

@@ -29,6 +29,8 @@ declare module BABYLON.GUI {
         private _renderAtIdealSize;
         private _focusedControl;
         private _blockNextFocusCheck;
+        private _renderScale;
+        renderScale: number;
         background: string;
         idealWidth: number;
         idealHeight: number;
@@ -54,7 +56,7 @@ declare module BABYLON.GUI {
         private _manageFocus();
         private _attachToOnPointerOut(scene);
         static CreateForMesh(mesh: AbstractMesh, width?: number, height?: number, supportPointerMove?: boolean): AdvancedDynamicTexture;
-        static CreateFullscreenUI(name: string, foreground?: boolean, scene?: Nullable<Scene>): AdvancedDynamicTexture;
+        static CreateFullscreenUI(name: string, foreground?: boolean, scene?: Nullable<Scene>, sampling?: number): AdvancedDynamicTexture;
     }
 }
 

+ 22 - 6
dist/preview release/gui/babylon.gui.js

@@ -40,6 +40,7 @@ var BABYLON;
                 _this._idealHeight = 0;
                 _this._renderAtIdealSize = false;
                 _this._blockNextFocusCheck = false;
+                _this._renderScale = 1;
                 scene = _this.getScene();
                 if (!scene || !_this._texture) {
                     return _this;
@@ -63,6 +64,20 @@ var BABYLON;
                 _this._texture.isReady = true;
                 return _this;
             }
+            Object.defineProperty(AdvancedDynamicTexture.prototype, "renderScale", {
+                get: function () {
+                    return this._renderScale;
+                },
+                set: function (value) {
+                    if (value === this._renderScale) {
+                        return;
+                    }
+                    this._renderScale = value;
+                    this._onResize();
+                },
+                enumerable: true,
+                configurable: true
+            });
             Object.defineProperty(AdvancedDynamicTexture.prototype, "background", {
                 get: function () {
                     return this._background;
@@ -234,8 +249,8 @@ var BABYLON;
                 // Check size
                 var engine = scene.getEngine();
                 var textureSize = this.getSize();
-                var renderWidth = engine.getRenderWidth();
-                var renderHeight = engine.getRenderHeight();
+                var renderWidth = engine.getRenderWidth() * this._renderScale;
+                var renderHeight = engine.getRenderHeight() * this._renderScale;
                 if (this._renderAtIdealSize) {
                     if (this._idealWidth) {
                         renderHeight = (renderHeight * this._idealWidth) / renderWidth;
@@ -326,8 +341,8 @@ var BABYLON;
                 var engine = scene.getEngine();
                 var textureSize = this.getSize();
                 if (this._isFullscreen) {
-                    x = x * (textureSize.width / engine.getRenderWidth());
-                    y = y * (textureSize.height / engine.getRenderHeight());
+                    x = x * ((textureSize.width / this._renderScale) / engine.getRenderWidth());
+                    y = y * ((textureSize.height / this._renderScale) / engine.getRenderHeight());
                 }
                 if (this._capturingControl) {
                     this._capturingControl._processObservables(type, x, y, buttonIndex);
@@ -459,10 +474,11 @@ var BABYLON;
                 result.attachToMesh(mesh, supportPointerMove);
                 return result;
             };
-            AdvancedDynamicTexture.CreateFullscreenUI = function (name, foreground, scene) {
+            AdvancedDynamicTexture.CreateFullscreenUI = function (name, foreground, scene, sampling) {
                 if (foreground === void 0) { foreground = true; }
                 if (scene === void 0) { scene = null; }
-                var result = new AdvancedDynamicTexture(name, 0, 0, scene, false, BABYLON.Texture.BILINEAR_SAMPLINGMODE);
+                if (sampling === void 0) { sampling = BABYLON.Texture.BILINEAR_SAMPLINGMODE; }
+                var result = new AdvancedDynamicTexture(name, 0, 0, scene, false, sampling);
                 // Display
                 var layer = new BABYLON.Layer(name + "_layer", null, scene, !foreground);
                 layer.texture = result;

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 3 - 3
dist/preview release/gui/babylon.gui.min.js


+ 3 - 1
dist/preview release/gui/babylon.gui.module.d.ts

@@ -34,6 +34,8 @@ declare module BABYLON.GUI {
         private _renderAtIdealSize;
         private _focusedControl;
         private _blockNextFocusCheck;
+        private _renderScale;
+        renderScale: number;
         background: string;
         idealWidth: number;
         idealHeight: number;
@@ -59,7 +61,7 @@ declare module BABYLON.GUI {
         private _manageFocus();
         private _attachToOnPointerOut(scene);
         static CreateForMesh(mesh: AbstractMesh, width?: number, height?: number, supportPointerMove?: boolean): AdvancedDynamicTexture;
-        static CreateFullscreenUI(name: string, foreground?: boolean, scene?: Nullable<Scene>): AdvancedDynamicTexture;
+        static CreateFullscreenUI(name: string, foreground?: boolean, scene?: Nullable<Scene>, sampling?: number): AdvancedDynamicTexture;
     }
 }
 

+ 2 - 2
dist/preview release/inspector/babylon.inspector.bundle.js

@@ -68,8 +68,8 @@ var INSPECTOR =
 	if(false) {
 		// When the styles change, update the <style> tags
 		if(!content.locals) {
-			module.hot.accept("!!../../../Tools/Gulp/node_modules/css-loader/index.js!./babylon.inspector.css", function() {
-				var newContent = require("!!../../../Tools/Gulp/node_modules/css-loader/index.js!./babylon.inspector.css");
+			module.hot.accept("!!../../../tools/gulp/node_modules/css-loader/index.js!./babylon.inspector.css", function() {
+				var newContent = require("!!../../../tools/gulp/node_modules/css-loader/index.js!./babylon.inspector.css");
 				if(typeof newContent === 'string') newContent = [[module.id, newContent, '']];
 				update(newContent);
 			});

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 1 - 1
dist/preview release/loaders/babylon.objFileLoader.min.js


Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 1 - 1
dist/preview release/loaders/babylonjs.loaders.min.js


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

@@ -51,6 +51,7 @@
 - Added `pivot` property to the SPS solid particles ([jerome](https://github.com/jbousquie)) 
 - Added the mesh facet depth sort to FacetData  ([jerome](https://github.com/jbousquie)) 
 - Added `LineSystem` and `LineMesh` per point colors ([jerome](https://github.com/jbousquie))  
+- Added `AdvancedDynamicTexture.renderScale` to allow users to render at higher DPI ([deltakosh](https://github.com/deltakosh))
 
 ## Bug fixes
 - Fixed a bug with PBR on iOS ([sebavan](https://github.com/sebavan))

+ 49 - 34
gui/src/advancedDynamicTexture.ts

@@ -31,6 +31,21 @@ module BABYLON.GUI {
         private _renderAtIdealSize = false;
         private _focusedControl: Nullable<IFocusableControl>;
         private _blockNextFocusCheck = false;
+        private _renderScale = 1;
+
+        public get renderScale(): number {
+            return this._renderScale;
+        }
+
+        public set renderScale(value: number) {
+            if (value === this._renderScale) {
+                return;
+            }
+
+            this._renderScale = value;
+
+            this._onResize();
+        }
 
         public get background(): string {
             return this._background;
@@ -71,7 +86,7 @@ module BABYLON.GUI {
             this._idealHeight = value;
             this.markAsDirty();
             this._rootContainer._markAllAsDirty();
-        }     
+        }
 
         public get renderAtIdealSize(): boolean {
             return this._renderAtIdealSize;
@@ -84,11 +99,11 @@ module BABYLON.GUI {
 
             this._renderAtIdealSize = value;
             this._onResize();
-        }    
+        }
 
         public get layer(): Nullable<Layer> {
             return this._layerToDispose;
-        }   
+        }
 
         public get rootContainer(): Container {
             return this._rootContainer;
@@ -113,7 +128,7 @@ module BABYLON.GUI {
 
             this._focusedControl = control;
         }
-        
+
         public get isForeground(): boolean {
             if (!this.layer) {
                 return true;
@@ -124,15 +139,15 @@ module BABYLON.GUI {
         public set isForeground(value: boolean) {
             if (!this.layer) {
                 return;
-            }            
+            }
             if (this.layer.isBackground === !value) {
                 return;
             }
             this.layer.isBackground = !value;
-        }   
-       
+        }
+
         constructor(name: string, width = 0, height = 0, scene: Nullable<Scene>, generateMipMaps = false, samplingMode = Texture.NEAREST_SAMPLINGMODE) {
-            super(name, {width: width, height: height}, scene, generateMipMaps, samplingMode, Engine.TEXTUREFORMAT_RGBA);
+            super(name, { width: width, height: height }, scene, generateMipMaps, samplingMode, Engine.TEXTUREFORMAT_RGBA);
 
             scene = this.getScene();
 
@@ -170,7 +185,7 @@ module BABYLON.GUI {
                 container = this._rootContainer;
             }
 
-            for (var child of container.children) {               
+            for (var child of container.children) {
                 if ((<any>child).children) {
                     this.executeOnAllControls(func, (<Container>child));
                     continue;
@@ -236,16 +251,16 @@ module BABYLON.GUI {
 
         private _onResize(): void {
             let scene = this.getScene();
-            
+
             if (!scene) {
                 return;
-            }            
+            }
 
             // Check size
             var engine = scene.getEngine();
             var textureSize = this.getSize();
-            var renderWidth = engine.getRenderWidth();
-            var renderHeight = engine.getRenderHeight();
+            var renderWidth = engine.getRenderWidth() * this._renderScale;
+            var renderHeight = engine.getRenderHeight() * this._renderScale;
 
             if (this._renderAtIdealSize) {
                 if (this._idealWidth) {
@@ -253,7 +268,7 @@ module BABYLON.GUI {
                     renderWidth = this._idealWidth;
                 } else if (this._idealHeight) {
                     renderWidth = (renderWidth * this._idealHeight) / renderHeight;
-                    renderHeight = this._idealHeight;                    
+                    renderHeight = this._idealHeight;
                 }
             }
 
@@ -264,7 +279,7 @@ module BABYLON.GUI {
 
                 if (this._idealWidth || this._idealHeight) {
                     this._rootContainer._markAllAsDirty();
-                }                
+                }
             }
         }
 
@@ -297,13 +312,13 @@ module BABYLON.GUI {
                     var mesh = control._linkedMesh;
 
                     if (!mesh || mesh.isDisposed()) {
-                        Tools.SetImmediate(()=>{
+                        Tools.SetImmediate(() => {
                             control.linkWithMesh(null);
                         });
-                        
+
                         continue;
                     }
-                    
+
                     var position = mesh.getBoundingInfo().boundingSphere.center;
                     var projectedPosition = Vector3.Project(position, mesh.getWorldMatrix(), scene.getTransformMatrix(), globalViewport);
 
@@ -358,10 +373,10 @@ module BABYLON.GUI {
             var textureSize = this.getSize();
 
             if (this._isFullscreen) {
-                x = x * (textureSize.width / engine.getRenderWidth());
-                y = y * (textureSize.height / engine.getRenderHeight());
+                x = x * ((textureSize.width / this._renderScale) / engine.getRenderWidth());
+                y = y * ((textureSize.height / this._renderScale) / engine.getRenderHeight());
             }
-            
+
             if (this._capturingControl) {
                 this._capturingControl._processObservables(type, x, y, buttonIndex);
                 return;
@@ -373,7 +388,7 @@ module BABYLON.GUI {
                     if (this._lastControlOver) {
                         this._lastControlOver._onPointerOut(this._lastControlOver);
                     }
-                    
+
                     this._lastControlOver = null;
                 }
             }
@@ -388,7 +403,7 @@ module BABYLON.GUI {
             }
 
             this._pointerMoveObserver = scene.onPrePointerObservable.add((pi, state) => {
-                if (pi.type !== BABYLON.PointerEventTypes.POINTERMOVE 
+                if (pi.type !== BABYLON.PointerEventTypes.POINTERMOVE
                     && pi.type !== BABYLON.PointerEventTypes.POINTERUP
                     && pi.type !== BABYLON.PointerEventTypes.POINTERDOWN) {
                     return;
@@ -421,9 +436,9 @@ module BABYLON.GUI {
             var scene = this.getScene();
             if (!scene) {
                 return;
-            }            
+            }
             this._pointerObserver = scene.onPointerObservable.add((pi, state) => {
-                if (pi.type !== BABYLON.PointerEventTypes.POINTERMOVE 
+                if (pi.type !== BABYLON.PointerEventTypes.POINTERMOVE
                     && pi.type !== BABYLON.PointerEventTypes.POINTERUP
                     && pi.type !== BABYLON.PointerEventTypes.POINTERDOWN) {
                     return;
@@ -440,13 +455,13 @@ module BABYLON.GUI {
                     if (this._lastControlDown) {
                         this._lastControlDown.forcePointerUp();
                     }
-                    this._lastControlDown = null;  
+                    this._lastControlDown = null;
 
                     this.focusedControl = null;
                 } else if (pi.type === BABYLON.PointerEventTypes.POINTERMOVE) {
                     if (this._lastControlOver) {
                         this._lastControlOver._onPointerOut(this._lastControlOver);
-                    }              
+                    }
                     this._lastControlOver = null;
                 }
             });
@@ -454,13 +469,13 @@ module BABYLON.GUI {
             mesh.enablePointerMoveEvents = supportPointerMove;
             this._attachToOnPointerOut(scene);
         }
-        
+
         public moveFocusToControl(control: IFocusableControl): void {
             this.focusedControl = control;
             this._lastPickedControl = <any>control;
             this._blockNextFocusCheck = true;
         }
-        
+
         private _manageFocus(): void {
             if (this._blockNextFocusCheck) {
                 this._blockNextFocusCheck = false;
@@ -484,13 +499,13 @@ module BABYLON.GUI {
             this._canvasPointerOutObserver = scene.getEngine().onCanvasPointerOutObservable.add(() => {
                 if (this._lastControlOver) {
                     this._lastControlOver._onPointerOut(this._lastControlOver);
-                }            
+                }
                 this._lastControlOver = null;
 
                 if (this._lastControlDown) {
                     this._lastControlDown.forcePointerUp();
                 }
-                this._lastControlDown = null;                
+                this._lastControlDown = null;
             });
         }
 
@@ -512,8 +527,8 @@ module BABYLON.GUI {
             return result;
         }
 
-        public static CreateFullscreenUI(name: string, foreground: boolean = true, scene: Nullable<Scene> = null): AdvancedDynamicTexture {
-            var result = new AdvancedDynamicTexture(name, 0, 0, scene, false, Texture.BILINEAR_SAMPLINGMODE);
+        public static CreateFullscreenUI(name: string, foreground: boolean = true, scene: Nullable<Scene> = null, sampling = Texture.BILINEAR_SAMPLINGMODE): AdvancedDynamicTexture {
+            var result = new AdvancedDynamicTexture(name, 0, 0, scene, false, sampling);
 
             // Display
             var layer = new BABYLON.Layer(name + "_layer", null, scene, !foreground);
@@ -527,5 +542,5 @@ module BABYLON.GUI {
 
             return result;
         }
-    }    
+    }
 }

+ 106 - 45
src/Cameras/VR/babylon.vrExperienceHelper.ts

@@ -45,7 +45,6 @@ module BABYLON {
         private _teleportationAllowed: boolean = false;
         private _rotationAllowed: boolean = true;
         private _teleportationRequestInitiated = false;
-        //private _classicGamepadTeleportationRequestInitiated = false;
         private _rotationRightAsked = false;
         private _rotationLeftAsked = false;
         private _teleportationCircle: Mesh;
@@ -55,9 +54,15 @@ module BABYLON {
         private _teleportationBorderColor: string = "#FFFFFF";
         private _rotationAngle: number = 0;
         private _haloCenter = new Vector3(0, 0, 0);
-        private _rayHelper: RayHelper;
         private _gazeTracker: BABYLON.Mesh;
-
+        private _padSensibilityUp = 0.7;
+        private _padSensibilityDown = 0.3;
+        private _leftLaserPointer: Mesh;
+        private _rightLaserPointer: Mesh;
+        private _currentMeshSelected: Nullable<AbstractMesh>;
+        public onNewMeshSelected = new Observable<AbstractMesh>();
+
+        private _meshSelectionPredicate: (mesh: AbstractMesh) => boolean;
         public meshSelectionPredicate: (mesh: AbstractMesh) => boolean;
 
         public get deviceOrientationCamera(): DeviceOrientationCamera {
@@ -395,10 +400,16 @@ module BABYLON {
             this._createGazeTracker();
             this._createTeleportationCircles();
 
+            // To be optionnaly changed by user to define his custom selection logic
             this.meshSelectionPredicate = (mesh) => {
-                if (mesh.isVisible && mesh.name.indexOf("gazeTracker") === -1 
+                return true;
+            }
+
+            this._meshSelectionPredicate = (mesh) => {
+                if (mesh.name.indexOf(this._floorMeshName) !== -1 || (mesh.isVisible && mesh.name.indexOf("gazeTracker") === -1 
                         && mesh.name.indexOf("teleportationCircle") === -1
-                        && mesh.name.indexOf("torusTeleportation") === -1) {
+                        && mesh.name.indexOf("torusTeleportation") === -1
+                        && mesh.name.indexOf("laserPointer") === -1)) {
                     return true;
                 }
                 return false;
@@ -410,19 +421,24 @@ module BABYLON {
         }
 
         private _onNewGamepadConnected(gamepad: Gamepad) {
-            if (gamepad.leftStick) {
+            if (gamepad.leftStick && gamepad.type !== BABYLON.Gamepad.POSE_ENABLED) {
                 gamepad.onleftstickchanged((stickValues) => {
-                    if (!this._teleportationRequestInitiated) {
-                        if (stickValues.y < -0.6) {
-                            this._teleportationRequestInitiated = true;
+                    // Listening to classic/xbox gamepad only if no VR controller is active
+                    if ((!this._leftLaserPointer && !this._rightLaserPointer) || 
+                        ((this._leftLaserPointer && !this._leftLaserPointer.isVisible) && 
+                        (this._rightLaserPointer && !this._rightLaserPointer.isVisible))) {
+                        if (!this._teleportationRequestInitiated) {
+                            if (stickValues.y < -this._padSensibilityUp) {
+                                this._teleportationRequestInitiated = true;
+                            }
                         }
-                    }
-                    else {
-                        if (stickValues.y > -0.4) {
-                            if (this._teleportationAllowed) {
-                                this._teleportCamera();
+                        else {
+                            if (stickValues.y > -this._padSensibilityDown) {
+                                if (this._teleportationAllowed) {
+                                    this._teleportCamera();
+                                }
+                                this._teleportationRequestInitiated = false;
                             }
-                            this._teleportationRequestInitiated = false;
                         }
                     }
                 });
@@ -430,7 +446,7 @@ module BABYLON {
             if (gamepad.rightStick) {
                 gamepad.onrightstickchanged((stickValues) => {
                     if (!this._rotationLeftAsked) {
-                        if (stickValues.x < -0.6) {
+                        if (stickValues.x < -this._padSensibilityUp) {
                             this._rotationLeftAsked = true;
                             if (this._rotationAllowed) {
                                 this._rotateCamera(false);
@@ -438,13 +454,13 @@ module BABYLON {
                         }
                     }
                     else {
-                        if (stickValues.x > -0.4) {
+                        if (stickValues.x > -this._padSensibilityDown) {
                             this._rotationLeftAsked = false;
                         }
                     }
         
                     if (!this._rotationRightAsked) {
-                        if (stickValues.x > 0.6) {
+                        if (stickValues.x > this._padSensibilityUp) {
                             this._rotationRightAsked = true;
                             if (this._rotationAllowed) {
                                 this._rotateCamera(true);
@@ -452,7 +468,7 @@ module BABYLON {
                         }
                     }
                     else {
-                        if (stickValues.x < 0.4) {
+                        if (stickValues.x < this._padSensibilityDown) {
                             this._rotationRightAsked = false;
                         }
                     }
@@ -471,41 +487,65 @@ module BABYLON {
                         break;
                     }
                 }
-                var laserPointer = BABYLON.Mesh.CreateCylinder("laserPointer", 3, 0.004, 0.0001, 20, 1, this._scene, false);
+                var laserPointer = BABYLON.Mesh.CreateCylinder("laserPointer", 1, 0.004, 0.0002, 20, 1, this._scene, false);
                 var laserPointerMaterial = new BABYLON.StandardMaterial("laserPointerMat", this._scene);
                 laserPointerMaterial.emissiveColor = new BABYLON.Color3(0.7, 0.7, 0.7);
                 laserPointerMaterial.alpha = 0.6;
                 laserPointer.material = laserPointerMaterial;
                 laserPointer.rotation.x = Math.PI / 2;
                 laserPointer.parent = controllerMesh;
-                laserPointer.position.z = -1.5;
+                laserPointer.position.z = -0.5;
                 laserPointer.position.y = 0;
                 laserPointer.isVisible = false;
+                if (webVRController.hand === "left") {
+                    this._leftLaserPointer = laserPointer;
+                }
+                else {
+                    this._rightLaserPointer = laserPointer;
+                }
                 webVRController.onMainButtonStateChangedObservable.add((stateObject) => {
                     // Enabling / disabling laserPointer 
                     if (stateObject.value === 1) {
                         laserPointer.isVisible = !laserPointer.isVisible;
+                        // Laser pointer can only be active on left or right, not both at the same time
+                        if (webVRController.hand === "left") {
+                            this._rightLaserPointer.isVisible = false;
+                        }
+                        else {
+                            this._leftLaserPointer.isVisible = false;
+                        }
                     }
                 });
                 webVRController.onPadValuesChangedObservable.add((stateObject) => {
-                    // on pressed
                     if (!this._teleportationRequestInitiated) {
-                        if (stateObject.y < -0.6) {
-                            laserPointer.isVisible = true;
+                        if (stateObject.y < -this._padSensibilityUp) {
+                            // If laser pointer wasn't enabled yet
+                            if (webVRController.hand === "left") {
+                                this._leftLaserPointer.isVisible = true;
+                                this._rightLaserPointer.isVisible = false;
+                            }
+                            else {
+                                this._leftLaserPointer.isVisible = false;
+                                this._rightLaserPointer.isVisible = true;
+                            }
                             this._teleportationRequestInitiated = true;
                         }
                     }
                     else {
-                        if (stateObject.y > -0.4) {
-                            if (this._teleportationAllowed) {
-                                this._teleportCamera();
+                        // Listening to the proper controller values changes to confirm teleportation
+                        if ((webVRController.hand === "left" && this._leftLaserPointer.isVisible) 
+                            || (webVRController.hand === "right" && this._rightLaserPointer.isVisible)) {
+                            if (stateObject.y > -this._padSensibilityDown) {
+                                if (this._teleportationAllowed) {
+                                    this._teleportationAllowed = false;
+                                    this._teleportCamera();
+                                }
+                                this._teleportationRequestInitiated = false;
                             }
-                            this._teleportationRequestInitiated = false;
-                            laserPointer.isVisible = false;
                         }
                     }
                     if (!this._rotationLeftAsked) {
-                        if (stateObject.x < -0.6) {
+                        if (stateObject.x < -this._padSensibilityUp) {
                             this._rotationLeftAsked = true;
                             if (this._rotationAllowed) {
                                 this._rotateCamera(false);
@@ -513,13 +553,13 @@ module BABYLON {
                         }
                     }
                     else {
-                        if (stateObject.x > -0.4) {
+                        if (stateObject.x > -this._padSensibilityDown) {
                             this._rotationLeftAsked = false;
                         }
                     }
         
                     if (!this._rotationRightAsked) {
-                        if (stateObject.x > 0.6) {
+                        if (stateObject.x > this._padSensibilityUp) {
                             this._rotationRightAsked = true;
                             if (this._rotationAllowed) {
                                 this._rotateCamera(true);
@@ -527,7 +567,7 @@ module BABYLON {
                         }
                     }
                     else {
-                        if (stateObject.x < 0.4) {
+                        if (stateObject.x < this._padSensibilityDown) {
                             this._rotationRightAsked = false;
                         }
                     }
@@ -550,6 +590,7 @@ module BABYLON {
 
         private _createTeleportationCircles() {
             this._teleportationCircle = BABYLON.Mesh.CreateGround("teleportationCircle", 2, 2, 2, this._scene);
+            this._teleportationCircle.isPickable = false;
             
             var length = 512;
             var dynamicTexture = new BABYLON.DynamicTexture("DynamicTexture", length, this._scene, true);
@@ -575,6 +616,7 @@ module BABYLON {
             this._teleportationCircle.material = teleportationCircleMaterial;
             
             var torus = BABYLON.Mesh.CreateTorus("torusTeleportation", 0.75, 0.1, 25, this._scene, false);
+            torus.isPickable = false;
             torus.parent = this._teleportationCircle;
             
             var animationInnerCircle = new BABYLON.Animation("animationInnerCircle", "position.y", 30, BABYLON.Animation.ANIMATIONTYPE_FLOAT, BABYLON.Animation.ANIMATIONLOOPMODE_CYCLE);
@@ -814,20 +856,29 @@ module BABYLON {
 
         private _castRayAndSelectObject () {
             var ray;
-            if (!(<WebVRFreeCamera>this.currentVRCamera).rightController) {
+            if (!(<WebVRFreeCamera>this.currentVRCamera).rightController || !(<WebVRFreeCamera>this.currentVRCamera).leftController || 
+                ((this._leftLaserPointer && !this._leftLaserPointer.isVisible) && (this._rightLaserPointer && !this._rightLaserPointer.isVisible))) {
                 ray = this.currentVRCamera.getForwardRay();
+                
             } else {
-                ray = (<any>this.currentVRCamera).rightController.getForwardRay();
+                if (this._leftLaserPointer && this._leftLaserPointer.isVisible) {
+                    ray = (<any>this.currentVRCamera).leftController.getForwardRay();
+                }
+                else {
+                    ray = (<any>this.currentVRCamera).rightController.getForwardRay();
+                }
             }
         
-            var hit = this._scene.pickWithRay(ray, this.meshSelectionPredicate);
+            var hit = this._scene.pickWithRay(ray, this._meshSelectionPredicate);
 
+            // Moving the gazeTracker on the mesh face targetted
             if (hit && hit.pickedPoint) {
                 this._gazeTracker.scaling.x = hit.distance;
                 this._gazeTracker.scaling.y = hit.distance;
                 this._gazeTracker.scaling.z = hit.distance;
         
                 var pickNormal = hit.getNormal();
+                // To avoid z-fighting
                 var deltaFighting = 0.002;
                 
                 if (pickNormal) {
@@ -855,28 +906,38 @@ module BABYLON {
                 else {
                     this._gazeTracker.position.z -= deltaFighting;
                 }
-            }
-        
-            if (this._rayHelper) {
-                this._rayHelper.dispose();
-            }
-        
-            if ((<WebVRFreeCamera>this.currentVRCamera).rightController) {
-                this._rayHelper = BABYLON.RayHelper.CreateAndShow(ray, this._scene, new BABYLON.Color3(0.7, 0.7, 0.7));
+                ray.length = hit.distance;
+                // Changing the size of the laser pointer based on the distance from the targetted point
+                if (this._rightLaserPointer && this._rightLaserPointer.isVisible) {
+                    this._rightLaserPointer.scaling.y = hit.distance;
+                    this._rightLaserPointer.position.z = -hit.distance / 2;
+                }
+                if (this._leftLaserPointer && this._leftLaserPointer.isVisible) {
+                    this._leftLaserPointer.scaling.y = hit.distance;
+                    this._leftLaserPointer.position.z = -hit.distance / 2;
+                }
             }
         
             if (hit && hit.pickedMesh) {
                 // The object selected is the floor, we're in a teleportation scenario
                 if (hit.pickedMesh.name.indexOf(this._floorMeshName) !== -1 && hit.pickedPoint) {
+                    // Moving the teleportation area to this targetted point
                     this._moveTeleportationSelectorTo(hit.pickedPoint)
                     return;
                 }
                 // If not, we're in a selection scenario
                 this._hideTeleportationCircle();
                 this._teleportationAllowed = false;
-                //currentMeshSelected = hit.pickedMesh;
+                if (hit.pickedMesh !== this._currentMeshSelected && this.meshSelectionPredicate(hit.pickedMesh)) {
+                    this._currentMeshSelected = hit.pickedMesh;
+                    this.onNewMeshSelected.notifyObservers(this._currentMeshSelected);
+                }
+                else {
+                    this._currentMeshSelected = null;
+                }
             }
             else {
+                this._currentMeshSelected = null;
                 this._teleportationAllowed = false;
                 this._hideTeleportationCircle();
             }

+ 8 - 8
src/Engine/babylon.engine.ts

@@ -749,7 +749,7 @@
         // Cache
         private _internalTexturesCache = new Array<InternalTexture>();
         protected _activeTextureChannel: number;
-        protected _activeTexturesCache: { [key: string]: Nullable<WebGLTexture> } = {};
+        protected _boundTexturesCache: { [key: string]: Nullable<InternalTexture> } = {};
         protected _currentEffect: Nullable<Effect>;
         protected _currentProgram: Nullable<WebGLProgram>;
         private _compiledEffects: { [key: string]: Effect } = {}
@@ -1302,8 +1302,8 @@
         }
 
         public resetTextureCache() {
-            for (var key in this._activeTexturesCache) {
-                this._activeTexturesCache[key] = null;
+            for (var key in this._boundTexturesCache) {
+                this._boundTexturesCache[key] = null;
             }
         }
 
@@ -3181,7 +3181,7 @@
                 if (!hostingScene) {
                     hostingScene = this.scenes[this.scenes.length - 1];
                 }
-                hostingScene.postProcessManager.directRender([this._rescalePostProcess], rtt);
+                hostingScene.postProcessManager.directRender([this._rescalePostProcess], rtt, true);
 
                 this._bindTextureDirectly(this._gl.TEXTURE_2D, destination);
                 this._gl.copyTexImage2D(this._gl.TEXTURE_2D, 0, internalFormat, 0, 0, destination.width, destination.height, 0);
@@ -4530,9 +4530,9 @@
         }
 
         public _bindTextureDirectly(target: number, texture: Nullable<InternalTexture>): void {
-            if (this._activeTexturesCache[this._activeTextureChannel] !== texture) {
+            if (this._boundTexturesCache[this._activeTextureChannel] !== texture) {
                 this._gl.bindTexture(target, texture ? texture._webGLTexture : null);
-                this._activeTexturesCache[this._activeTextureChannel] = texture;
+                this._boundTexturesCache[this._activeTextureChannel] = texture;
             }
         }
 
@@ -4573,7 +4573,7 @@
         private _setTexture(channel: number, texture: Nullable<BaseTexture>): boolean {
             // Not ready?
             if (!texture) {
-                if (this._activeTexturesCache[channel] != null) {
+                if (this._boundTexturesCache[channel] != null) {
                     this.activateTextureChannel(this._gl.TEXTURE0 + channel);
                     this._bindTextureDirectly(this._gl.TEXTURE_2D, null);
                     this._bindTextureDirectly(this._gl.TEXTURE_CUBE_MAP, null);
@@ -4613,7 +4613,7 @@
                 this.activateTextureChannel(this._gl.TEXTURE0 + channel);
             }
 
-            if (this._activeTexturesCache[this._activeTextureChannel] === internalTexture) {
+            if (this._boundTexturesCache[this._activeTextureChannel] === internalTexture) {
                 return false;
             }
 

+ 2 - 2
src/Engine/babylon.nullEngine.ts

@@ -368,8 +368,8 @@
         }
 
         public _bindTextureDirectly(target: number, texture: InternalTexture): void {
-            if (this._activeTexturesCache[this._activeTextureChannel] !== texture) {
-                this._activeTexturesCache[this._activeTextureChannel] = texture;
+            if (this._boundTexturesCache[this._activeTextureChannel] !== texture) {
+                this._boundTexturesCache[this._activeTextureChannel] = texture;
             }
         }