浏览代码

Merge pull request #3274 from BabylonJS/master

Nightly
sebavan 7 年之前
父节点
当前提交
c94d2f013e
共有 51 个文件被更改,包括 3024 次插入20759 次删除
  1. 221 209
      Playground/babylon.d.txt
  2. 19 2
      Tools/Gulp/config.json
  3. 8 4
      Tools/Gulp/gulpfile.js
  4. 14 6
      Tools/Gulp/package.json
  5. 97 0
      Viewer/assets/deepmerge.min.js
  6. 1 0
      Viewer/assets/es6-promise.min.js
  7. 29 0
      Viewer/assets/handlebars.min.js
  8. 9 9
      Viewer/package.json
  9. 1 1
      Viewer/src/configuration/loader.ts
  10. 1 2
      Viewer/src/index.ts
  11. 1 1
      Viewer/src/templateManager.ts
  12. 1 1
      Viewer/src/util/promiseObservable.ts
  13. 8 7
      Viewer/src/viewer/defaultViewer.ts
  14. 2 0
      Viewer/src/viewer/viewerManager.ts
  15. 35 0
      Viewer/tsconfig-gulp.json
  16. 51 0
      Viewer/webpack.gulp.config.js
  17. 0 18033
      dist/babylon.module.d.ts
  18. 225 210
      dist/preview release/babylon.d.ts
  19. 47 47
      dist/preview release/babylon.js
  20. 180 63
      dist/preview release/babylon.max.js
  21. 48 48
      dist/preview release/babylon.worker.js
  22. 1380 1365
      dist/preview release/customConfigurations/minimalGLTFViewer/babylon.d.ts
  23. 48 48
      dist/preview release/customConfigurations/minimalGLTFViewer/babylon.js
  24. 200 77
      dist/preview release/customConfigurations/minimalGLTFViewer/babylon.max.js
  25. 4 447
      dist/preview release/inspector/babylon.inspector.bundle.js
  26. 6 9
      dist/preview release/loaders/babylon.glTF2FileLoader.d.ts
  27. 20 14
      dist/preview release/loaders/babylon.glTF2FileLoader.js
  28. 2 2
      dist/preview release/loaders/babylon.glTF2FileLoader.min.js
  29. 6 9
      dist/preview release/loaders/babylon.glTFFileLoader.d.ts
  30. 20 14
      dist/preview release/loaders/babylon.glTFFileLoader.js
  31. 2 2
      dist/preview release/loaders/babylon.glTFFileLoader.min.js
  32. 1 1
      dist/preview release/loaders/babylon.objFileLoader.min.js
  33. 20 14
      dist/preview release/loaders/babylonjs.loaders.js
  34. 3 3
      dist/preview release/loaders/babylonjs.loaders.min.js
  35. 6 9
      dist/preview release/loaders/babylonjs.loaders.module.d.ts
  36. 73 0
      dist/preview release/viewer/babylon.viewer.js
  37. 7 3
      inspector/webpack.config.js
  38. 21 14
      loaders/src/glTF/2.0/babylon.glTFLoader.ts
  39. 2 2
      loaders/src/glTF/2.0/babylon.glTFLoaderExtension.ts
  40. 1 2
      loaders/src/glTF/2.0/babylon.glTFLoaderInterfaces.ts
  41. 69 42
      src/Cameras/VR/babylon.vrExperienceHelper.ts
  42. 8 4
      src/Engine/babylon.engine.ts
  43. 16 14
      src/Gamepad/babylon.gamepadManager.ts
  44. 4 0
      src/Helpers/babylon.environmentHelper.ts
  45. 5 0
      src/Layer/babylon.highlightlayer.ts
  46. 2 2
      src/Materials/PBR/babylon.pbrBaseMaterial.ts
  47. 2 2
      src/Materials/PBR/babylon.pbrMaterial.ts
  48. 6 6
      src/Materials/Textures/babylon.rawTexture.ts
  49. 28 1
      src/Math/babylon.math.ts
  50. 58 9
      src/Mesh/babylon.mesh.ts
  51. 6 1
      src/babylon.scene.ts

+ 221 - 209
Playground/babylon.d.txt

@@ -4570,8 +4570,8 @@ declare module BABYLON {
         createTexture(urlArg: Nullable<string>, noMipmap: boolean, invertY: boolean, scene: Nullable<Scene>, samplingMode?: number, onLoad?: Nullable<() => void>, onError?: Nullable<(message: string, exception: any) => void>, buffer?: Nullable<ArrayBuffer | HTMLImageElement>, fallBack?: Nullable<InternalTexture>, format?: Nullable<number>): InternalTexture;
         createTexture(urlArg: Nullable<string>, noMipmap: boolean, invertY: boolean, scene: Nullable<Scene>, samplingMode?: number, onLoad?: Nullable<() => void>, onError?: Nullable<(message: string, exception: any) => void>, buffer?: Nullable<ArrayBuffer | HTMLImageElement>, fallBack?: Nullable<InternalTexture>, format?: Nullable<number>): InternalTexture;
 
 
 
 
-        updateRawTexture(texture: Nullable<InternalTexture>, data: Nullable<ArrayBufferView>, format: number, invertY: boolean, compression?: Nullable<string>): void;
-        createRawTexture(data: Nullable<ArrayBufferView>, width: number, height: number, format: number, generateMipMaps: boolean, invertY: boolean, samplingMode: number, compression?: Nullable<string>): InternalTexture;
+        updateRawTexture(texture: Nullable<InternalTexture>, data: Nullable<ArrayBufferView>, format: number, invertY: boolean, compression?: Nullable<string>, type?: number): void;
+        createRawTexture(data: Nullable<ArrayBufferView>, width: number, height: number, format: number, generateMipMaps: boolean, invertY: boolean, samplingMode: number, compression?: Nullable<string>, type?: number): InternalTexture;
         createDynamicTexture(width: number, height: number, generateMipMaps: boolean, samplingMode: number): InternalTexture;
         createDynamicTexture(width: number, height: number, generateMipMaps: boolean, samplingMode: number): InternalTexture;
         updateTextureSamplingMode(samplingMode: number, texture: InternalTexture): void;
         updateTextureSamplingMode(samplingMode: number, texture: InternalTexture): void;
         updateDynamicTexture(texture: Nullable<InternalTexture>, canvas: HTMLCanvasElement, invertY: boolean, premulAlpha?: boolean, format?: number): void;
         updateDynamicTexture(texture: Nullable<InternalTexture>, canvas: HTMLCanvasElement, invertY: boolean, premulAlpha?: boolean, format?: number): void;
@@ -4808,6 +4808,69 @@ declare var WebGLVertexArrayObject: {
 };
 };
 
 
 declare module BABYLON {
 declare module BABYLON {
+    class KeyboardEventTypes {
+
+
+        static readonly KEYDOWN: number;
+        static readonly KEYUP: number;
+    }
+    class KeyboardInfo {
+        type: number;
+        event: KeyboardEvent;
+        constructor(type: number, event: KeyboardEvent);
+    }
+    /**
+     * This class is used to store keyboard related info for the onPreKeyboardObservable event.
+     * Set the skipOnKeyboardObservable property to true if you want the engine to stop any process after this event is triggered, even not calling onKeyboardObservable
+     */
+    class KeyboardInfoPre extends KeyboardInfo {
+        constructor(type: number, event: KeyboardEvent);
+        skipOnPointerObservable: boolean;
+    }
+}
+
+declare module BABYLON {
+    class PointerEventTypes {
+
+
+
+
+
+
+
+        static readonly POINTERDOWN: number;
+        static readonly POINTERUP: number;
+        static readonly POINTERMOVE: number;
+        static readonly POINTERWHEEL: number;
+        static readonly POINTERPICK: number;
+        static readonly POINTERTAP: number;
+        static readonly POINTERDOUBLETAP: number;
+    }
+    class PointerInfoBase {
+        type: number;
+        event: PointerEvent | MouseWheelEvent;
+        constructor(type: number, event: PointerEvent | MouseWheelEvent);
+    }
+    /**
+     * This class is used to store pointer related info for the onPrePointerObservable event.
+     * Set the skipOnPointerObservable property to true if you want the engine to stop any process after this event is triggered, even not calling onPointerObservable
+     */
+    class PointerInfoPre extends PointerInfoBase {
+        constructor(type: number, event: PointerEvent | MouseWheelEvent, localX: number, localY: number);
+        localPosition: Vector2;
+        skipOnPointerObservable: boolean;
+    }
+    /**
+     * This type contains all the data related to a pointer event in Babylon.js.
+     * The event member is an instance of PointerEvent for all types except PointerWheel and is of type MouseWheelEvent when type equals PointerWheel. The different event types can be found in the PointerEventTypes class.
+     */
+    class PointerInfo extends PointerInfoBase {
+        pickInfo: Nullable<PickingInfo>;
+        constructor(type: number, event: PointerEvent | MouseWheelEvent, pickInfo: Nullable<PickingInfo>);
+    }
+}
+
+declare module BABYLON {
     class StickValues {
     class StickValues {
         x: number;
         x: number;
         y: number;
         y: number;
@@ -4870,7 +4933,7 @@ declare module BABYLON {
         onGamepadDisconnectedObservable: Observable<Gamepad>;
         onGamepadDisconnectedObservable: Observable<Gamepad>;
 
 
 
 
-        constructor();
+        constructor(_scene?: Scene | undefined);
         readonly gamepads: Gamepad[];
         readonly gamepads: Gamepad[];
         getGamepadByType(type?: number): Nullable<Gamepad>;
         getGamepadByType(type?: number): Nullable<Gamepad>;
         dispose(): void;
         dispose(): void;
@@ -4878,7 +4941,6 @@ declare module BABYLON {
 
 
 
 
 
 
-
     }
     }
 }
 }
 
 
@@ -4958,69 +5020,6 @@ declare module BABYLON {
     }
     }
 }
 }
 
 
-declare module BABYLON {
-    class KeyboardEventTypes {
-
-
-        static readonly KEYDOWN: number;
-        static readonly KEYUP: number;
-    }
-    class KeyboardInfo {
-        type: number;
-        event: KeyboardEvent;
-        constructor(type: number, event: KeyboardEvent);
-    }
-    /**
-     * This class is used to store keyboard related info for the onPreKeyboardObservable event.
-     * Set the skipOnKeyboardObservable property to true if you want the engine to stop any process after this event is triggered, even not calling onKeyboardObservable
-     */
-    class KeyboardInfoPre extends KeyboardInfo {
-        constructor(type: number, event: KeyboardEvent);
-        skipOnPointerObservable: boolean;
-    }
-}
-
-declare module BABYLON {
-    class PointerEventTypes {
-
-
-
-
-
-
-
-        static readonly POINTERDOWN: number;
-        static readonly POINTERUP: number;
-        static readonly POINTERMOVE: number;
-        static readonly POINTERWHEEL: number;
-        static readonly POINTERPICK: number;
-        static readonly POINTERTAP: number;
-        static readonly POINTERDOUBLETAP: number;
-    }
-    class PointerInfoBase {
-        type: number;
-        event: PointerEvent | MouseWheelEvent;
-        constructor(type: number, event: PointerEvent | MouseWheelEvent);
-    }
-    /**
-     * This class is used to store pointer related info for the onPrePointerObservable event.
-     * Set the skipOnPointerObservable property to true if you want the engine to stop any process after this event is triggered, even not calling onPointerObservable
-     */
-    class PointerInfoPre extends PointerInfoBase {
-        constructor(type: number, event: PointerEvent | MouseWheelEvent, localX: number, localY: number);
-        localPosition: Vector2;
-        skipOnPointerObservable: boolean;
-    }
-    /**
-     * This type contains all the data related to a pointer event in Babylon.js.
-     * The event member is an instance of PointerEvent for all types except PointerWheel and is of type MouseWheelEvent when type equals PointerWheel. The different event types can be found in the PointerEventTypes class.
-     */
-    class PointerInfo extends PointerInfoBase {
-        pickInfo: Nullable<PickingInfo>;
-        constructor(type: number, event: PointerEvent | MouseWheelEvent, pickInfo: Nullable<PickingInfo>);
-    }
-}
-
 declare namespace BABYLON {
 declare namespace BABYLON {
     /**
     /**
      * Represents the different options available during the creation of
      * Represents the different options available during the creation of
@@ -5816,112 +5815,6 @@ declare module BABYLON {
 }
 }
 
 
 declare module BABYLON {
 declare module BABYLON {
-    interface ILoadingScreen {
-        displayLoadingUI: () => void;
-        hideLoadingUI: () => void;
-        loadingUIBackgroundColor: string;
-        loadingUIText: string;
-    }
-    class DefaultLoadingScreen implements ILoadingScreen {
-
-
-
-
-
-        constructor(_renderingCanvas: HTMLCanvasElement, _loadingText?: string, _loadingDivBackgroundColor?: string);
-        displayLoadingUI(): void;
-        hideLoadingUI(): void;
-        loadingUIText: string;
-        loadingUIBackgroundColor: string;
-
-    }
-}
-
-declare module BABYLON {
-    interface ISceneLoaderPluginExtensions {
-        [extension: string]: {
-            isBinary: boolean;
-        };
-    }
-    interface ISceneLoaderPluginFactory {
-        name: string;
-        createPlugin(): ISceneLoaderPlugin | ISceneLoaderPluginAsync;
-        canDirectLoad?: (data: string) => boolean;
-    }
-    interface ISceneLoaderPlugin {
-        name: string;
-        extensions: string | ISceneLoaderPluginExtensions;
-        importMesh: (meshesNames: any, scene: Scene, data: any, rootUrl: string, meshes: AbstractMesh[], particleSystems: ParticleSystem[], skeletons: Skeleton[], onError?: (message: string, exception?: any) => void) => boolean;
-        load: (scene: Scene, data: string, rootUrl: string, onError?: (message: string, exception?: any) => void) => boolean;
-        canDirectLoad?: (data: string) => boolean;
-        rewriteRootURL?: (rootUrl: string, responseURL?: string) => string;
-    }
-    interface ISceneLoaderPluginAsync {
-        name: string;
-        extensions: string | ISceneLoaderPluginExtensions;
-        importMeshAsync: (meshesNames: any, scene: Scene, data: any, rootUrl: string, onSuccess: (meshes: AbstractMesh[], particleSystems: ParticleSystem[], skeletons: Skeleton[]) => void, onProgress: (event: ProgressEvent) => void, onError: (message: string) => void) => void;
-        loadAsync: (scene: Scene, data: string, rootUrl: string, onSuccess: () => void, onProgress: (event: ProgressEvent) => void, onError: (message: string, exception?: any) => void) => void;
-        canDirectLoad?: (data: string) => boolean;
-        rewriteRootURL?: (rootUrl: string, responseURL?: string) => string;
-    }
-    class SceneLoader {
-
-
-
-        static readonly NO_LOGGING: number;
-        static readonly MINIMAL_LOGGING: number;
-        static readonly SUMMARY_LOGGING: number;
-        static readonly DETAILED_LOGGING: number;
-
-        static ForceFullSceneLoadingForIncremental: boolean;
-        static ShowLoadingScreen: boolean;
-        static loggingLevel: number;
-        static CleanBoneMatrixWeights: boolean;
-        static OnPluginActivatedObservable: Observable<ISceneLoaderPlugin | ISceneLoaderPluginAsync>;
-
-
-
-
-
-
-
-        static GetPluginForExtension(extension: string): ISceneLoaderPlugin | ISceneLoaderPluginAsync | ISceneLoaderPluginFactory;
-        static RegisterPlugin(plugin: ISceneLoaderPlugin | ISceneLoaderPluginAsync): void;
-        /**
-        * Import meshes into a scene
-        * @param meshNames an array of mesh names, a single mesh name, or empty string for all meshes that filter what meshes are imported
-        * @param rootUrl a string that defines the root url for scene and resources
-        * @param sceneFilename a string that defines the name of the scene file. can start with "data:" following by the stringified version of the scene
-        * @param scene the instance of BABYLON.Scene to append to
-        * @param onSuccess a callback with a list of imported meshes, particleSystems, and skeletons when import succeeds
-        * @param onProgress a callback with a progress event for each file being loaded
-        * @param onError a callback with the scene, a message, and possibly an exception when import fails
-        */
-        static ImportMesh(meshNames: any, rootUrl: string, sceneFilename: string, scene: Scene, onSuccess?: Nullable<(meshes: AbstractMesh[], particleSystems: ParticleSystem[], skeletons: Skeleton[]) => void>, onProgress?: Nullable<(event: ProgressEvent) => void>, onError?: Nullable<(scene: Scene, message: string, exception?: any) => void>, pluginExtension?: string): Nullable<ISceneLoaderPlugin | ISceneLoaderPluginAsync>;
-        /**
-        * Load a scene
-        * @param rootUrl a string that defines the root url for scene and resources
-        * @param sceneFilename a string that defines the name of the scene file. can start with "data:" following by the stringified version of the scene
-        * @param engine is the instance of BABYLON.Engine to use to create the scene
-        * @param onSuccess a callback with the scene when import succeeds
-        * @param onProgress a callback with a progress event for each file being loaded
-        * @param onError a callback with the scene, a message, and possibly an exception when import fails
-        */
-        static Load(rootUrl: string, sceneFilename: any, engine: Engine, onSuccess?: (scene: Scene) => void, onProgress?: (event: ProgressEvent) => void, onError?: (scene: Scene, message: string, exception?: any) => void, pluginExtension?: string): Nullable<ISceneLoaderPlugin | ISceneLoaderPluginAsync>;
-        /**
-        * Append a scene
-        * @param rootUrl a string that defines the root url for scene and resources
-        * @param sceneFilename a string that defines the name of the scene file. can start with "data:" following by the stringified version of the scene
-        * @param scene is the instance of BABYLON.Scene to append to
-        * @param onSuccess a callback with the scene when import succeeds
-        * @param onProgress a callback with a progress event for each file being loaded
-        * @param onError a callback with the scene, a message, and possibly an exception when import fails
-        */
-        static Append(rootUrl: string, sceneFilename: any, scene: Scene, onSuccess?: (scene: Scene) => void, onProgress?: (event: ProgressEvent) => void, onError?: (scene: Scene, message: string, exception?: any) => void, pluginExtension?: string): Nullable<ISceneLoaderPlugin | ISceneLoaderPluginAsync>;
-    }
-}
-
-declare module BABYLON {
     class DirectionalLight extends ShadowLight {
     class DirectionalLight extends ShadowLight {
 
 
         /**
         /**
@@ -6455,6 +6348,112 @@ declare module BABYLON {
 }
 }
 
 
 declare module BABYLON {
 declare module BABYLON {
+    interface ILoadingScreen {
+        displayLoadingUI: () => void;
+        hideLoadingUI: () => void;
+        loadingUIBackgroundColor: string;
+        loadingUIText: string;
+    }
+    class DefaultLoadingScreen implements ILoadingScreen {
+
+
+
+
+
+        constructor(_renderingCanvas: HTMLCanvasElement, _loadingText?: string, _loadingDivBackgroundColor?: string);
+        displayLoadingUI(): void;
+        hideLoadingUI(): void;
+        loadingUIText: string;
+        loadingUIBackgroundColor: string;
+
+    }
+}
+
+declare module BABYLON {
+    interface ISceneLoaderPluginExtensions {
+        [extension: string]: {
+            isBinary: boolean;
+        };
+    }
+    interface ISceneLoaderPluginFactory {
+        name: string;
+        createPlugin(): ISceneLoaderPlugin | ISceneLoaderPluginAsync;
+        canDirectLoad?: (data: string) => boolean;
+    }
+    interface ISceneLoaderPlugin {
+        name: string;
+        extensions: string | ISceneLoaderPluginExtensions;
+        importMesh: (meshesNames: any, scene: Scene, data: any, rootUrl: string, meshes: AbstractMesh[], particleSystems: ParticleSystem[], skeletons: Skeleton[], onError?: (message: string, exception?: any) => void) => boolean;
+        load: (scene: Scene, data: string, rootUrl: string, onError?: (message: string, exception?: any) => void) => boolean;
+        canDirectLoad?: (data: string) => boolean;
+        rewriteRootURL?: (rootUrl: string, responseURL?: string) => string;
+    }
+    interface ISceneLoaderPluginAsync {
+        name: string;
+        extensions: string | ISceneLoaderPluginExtensions;
+        importMeshAsync: (meshesNames: any, scene: Scene, data: any, rootUrl: string, onSuccess: (meshes: AbstractMesh[], particleSystems: ParticleSystem[], skeletons: Skeleton[]) => void, onProgress: (event: ProgressEvent) => void, onError: (message: string) => void) => void;
+        loadAsync: (scene: Scene, data: string, rootUrl: string, onSuccess: () => void, onProgress: (event: ProgressEvent) => void, onError: (message: string, exception?: any) => void) => void;
+        canDirectLoad?: (data: string) => boolean;
+        rewriteRootURL?: (rootUrl: string, responseURL?: string) => string;
+    }
+    class SceneLoader {
+
+
+
+        static readonly NO_LOGGING: number;
+        static readonly MINIMAL_LOGGING: number;
+        static readonly SUMMARY_LOGGING: number;
+        static readonly DETAILED_LOGGING: number;
+
+        static ForceFullSceneLoadingForIncremental: boolean;
+        static ShowLoadingScreen: boolean;
+        static loggingLevel: number;
+        static CleanBoneMatrixWeights: boolean;
+        static OnPluginActivatedObservable: Observable<ISceneLoaderPlugin | ISceneLoaderPluginAsync>;
+
+
+
+
+
+
+
+        static GetPluginForExtension(extension: string): ISceneLoaderPlugin | ISceneLoaderPluginAsync | ISceneLoaderPluginFactory;
+        static RegisterPlugin(plugin: ISceneLoaderPlugin | ISceneLoaderPluginAsync): void;
+        /**
+        * Import meshes into a scene
+        * @param meshNames an array of mesh names, a single mesh name, or empty string for all meshes that filter what meshes are imported
+        * @param rootUrl a string that defines the root url for scene and resources
+        * @param sceneFilename a string that defines the name of the scene file. can start with "data:" following by the stringified version of the scene
+        * @param scene the instance of BABYLON.Scene to append to
+        * @param onSuccess a callback with a list of imported meshes, particleSystems, and skeletons when import succeeds
+        * @param onProgress a callback with a progress event for each file being loaded
+        * @param onError a callback with the scene, a message, and possibly an exception when import fails
+        */
+        static ImportMesh(meshNames: any, rootUrl: string, sceneFilename: string, scene: Scene, onSuccess?: Nullable<(meshes: AbstractMesh[], particleSystems: ParticleSystem[], skeletons: Skeleton[]) => void>, onProgress?: Nullable<(event: ProgressEvent) => void>, onError?: Nullable<(scene: Scene, message: string, exception?: any) => void>, pluginExtension?: string): Nullable<ISceneLoaderPlugin | ISceneLoaderPluginAsync>;
+        /**
+        * Load a scene
+        * @param rootUrl a string that defines the root url for scene and resources
+        * @param sceneFilename a string that defines the name of the scene file. can start with "data:" following by the stringified version of the scene
+        * @param engine is the instance of BABYLON.Engine to use to create the scene
+        * @param onSuccess a callback with the scene when import succeeds
+        * @param onProgress a callback with a progress event for each file being loaded
+        * @param onError a callback with the scene, a message, and possibly an exception when import fails
+        */
+        static Load(rootUrl: string, sceneFilename: any, engine: Engine, onSuccess?: (scene: Scene) => void, onProgress?: (event: ProgressEvent) => void, onError?: (scene: Scene, message: string, exception?: any) => void, pluginExtension?: string): Nullable<ISceneLoaderPlugin | ISceneLoaderPluginAsync>;
+        /**
+        * Append a scene
+        * @param rootUrl a string that defines the root url for scene and resources
+        * @param sceneFilename a string that defines the name of the scene file. can start with "data:" following by the stringified version of the scene
+        * @param scene is the instance of BABYLON.Scene to append to
+        * @param onSuccess a callback with the scene when import succeeds
+        * @param onProgress a callback with a progress event for each file being loaded
+        * @param onError a callback with the scene, a message, and possibly an exception when import fails
+        */
+        static Append(rootUrl: string, sceneFilename: any, scene: Scene, onSuccess?: (scene: Scene) => void, onProgress?: (event: ProgressEvent) => void, onError?: (scene: Scene, message: string, exception?: any) => void, pluginExtension?: string): Nullable<ISceneLoaderPlugin | ISceneLoaderPluginAsync>;
+    }
+}
+
+declare module BABYLON {
     /**
     /**
      * The color grading curves provide additional color adjustmnent that is applied after any color grading transform (3D LUT).
      * The color grading curves provide additional color adjustmnent that is applied after any color grading transform (3D LUT).
      * They allow basic adjustment of saturation and small exposure adjustments, along with color filter tinting to provide white balance adjustment or more stylistic effects.
      * They allow basic adjustment of saturation and small exposure adjustments, along with color filter tinting to provide white balance adjustment or more stylistic effects.
@@ -8652,9 +8651,21 @@ declare module BABYLON {
         /**
         /**
          * Normalize the current Vector3.
          * Normalize the current Vector3.
          * Returns the updated Vector3.
          * Returns the updated Vector3.
+         * /!\ In place operation.
          */
          */
         normalize(): Vector3;
         normalize(): Vector3;
         /**
         /**
+         * Normalize the current Vector3 to a new vector.
+         * @returns the new Vector3.
+         */
+        normalizeToNew(): Vector3;
+        /**
+         * Normalize the current Vector3 to the reference.
+         * @param the reference to update.
+         * @returns the updated Vector3.
+         */
+        normalizeToRef(reference: Vector3): Vector3;
+        /**
          * Returns a new Vector3 copied from the current Vector3.
          * Returns a new Vector3 copied from the current Vector3.
          */
          */
         clone(): Vector3;
         clone(): Vector3;
@@ -11427,6 +11438,7 @@ declare module BABYLON {
          */
          */
         refreshBoundingInfo(): Mesh;
         refreshBoundingInfo(): Mesh;
 
 
+
         subdivide(count: number): void;
         subdivide(count: number): void;
         /**
         /**
          * Sets the vertex data of the mesh geometry for the requested `kind`.
          * Sets the vertex data of the mesh geometry for the requested `kind`.
@@ -14817,6 +14829,36 @@ declare module BABYLON {
 }
 }
 
 
 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 {
     class AnaglyphPostProcess extends PostProcess {
 
 
         constructor(name: string, options: number | PostProcessOptions, rigCameras: Camera[], samplingMode?: number, engine?: Engine, reusable?: boolean);
         constructor(name: string, options: number | PostProcessOptions, rigCameras: Camera[], samplingMode?: number, engine?: Engine, reusable?: boolean);
@@ -15330,36 +15372,6 @@ declare module BABYLON {
 }
 }
 
 
 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 {
     class BoundingBoxRenderer {
         frontColor: Color3;
         frontColor: Color3;
         backColor: Color3;
         backColor: Color3;
@@ -17892,9 +17904,6 @@ declare module BABYLON {
     }
     }
 }
 }
 
 
-declare module BABYLON.Internals {
-}
-
 declare module BABYLON {
 declare module BABYLON {
     /**
     /**
      * Interface to implement to create a shadow generator compatible with BJS.
      * Interface to implement to create a shadow generator compatible with BJS.
@@ -18075,6 +18084,9 @@ declare module BABYLON {
     }
     }
 }
 }
 
 
+declare module BABYLON.Internals {
+}
+
 declare namespace BABYLON {
 declare namespace BABYLON {
     /**
     /**
      * Background material used to create an efficient environement around your scene.
      * Background material used to create an efficient environement around your scene.
@@ -19568,13 +19580,13 @@ declare module BABYLON {
     class RawTexture extends Texture {
     class RawTexture extends Texture {
         format: number;
         format: number;
 
 
-        constructor(data: ArrayBufferView, width: number, height: number, format: number, scene: Scene, generateMipMaps?: boolean, invertY?: boolean, samplingMode?: number);
+        constructor(data: ArrayBufferView, width: number, height: number, format: number, scene: Scene, generateMipMaps?: boolean, invertY?: boolean, samplingMode?: number, type?: number);
         update(data: ArrayBufferView): void;
         update(data: ArrayBufferView): void;
         static CreateLuminanceTexture(data: ArrayBufferView, width: number, height: number, scene: Scene, generateMipMaps?: boolean, invertY?: boolean, samplingMode?: number): RawTexture;
         static CreateLuminanceTexture(data: ArrayBufferView, width: number, height: number, scene: Scene, generateMipMaps?: boolean, invertY?: boolean, samplingMode?: number): RawTexture;
         static CreateLuminanceAlphaTexture(data: ArrayBufferView, width: number, height: number, scene: Scene, generateMipMaps?: boolean, invertY?: boolean, samplingMode?: number): RawTexture;
         static CreateLuminanceAlphaTexture(data: ArrayBufferView, width: number, height: number, scene: Scene, generateMipMaps?: boolean, invertY?: boolean, samplingMode?: number): RawTexture;
         static CreateAlphaTexture(data: ArrayBufferView, width: number, height: number, scene: Scene, generateMipMaps?: boolean, invertY?: boolean, samplingMode?: number): RawTexture;
         static CreateAlphaTexture(data: ArrayBufferView, width: number, height: number, scene: Scene, generateMipMaps?: boolean, invertY?: boolean, samplingMode?: number): RawTexture;
-        static CreateRGBTexture(data: ArrayBufferView, width: number, height: number, scene: Scene, generateMipMaps?: boolean, invertY?: boolean, samplingMode?: number): RawTexture;
-        static CreateRGBATexture(data: ArrayBufferView, width: number, height: number, scene: Scene, generateMipMaps?: boolean, invertY?: boolean, samplingMode?: number): RawTexture;
+        static CreateRGBTexture(data: ArrayBufferView, width: number, height: number, scene: Scene, generateMipMaps?: boolean, invertY?: boolean, samplingMode?: number, type?: number): RawTexture;
+        static CreateRGBATexture(data: ArrayBufferView, width: number, height: number, scene: Scene, generateMipMaps?: boolean, invertY?: boolean, samplingMode?: number, type?: number): RawTexture;
     }
     }
 }
 }
 
 

+ 19 - 2
Tools/Gulp/config.json

@@ -1178,7 +1178,8 @@
         "loaders",
         "loaders",
         "serializers",
         "serializers",
         "inspector",
         "inspector",
-        "gui"
+        "gui",
+        "viewer"
     ],
     ],
     "materialsLibrary": {
     "materialsLibrary": {
         "libraries": [
         "libraries": [
@@ -1661,5 +1662,21 @@
             "srcOutputDirectory": "../../inspector/",
             "srcOutputDirectory": "../../inspector/",
             "distOutputDirectory": "/inspector/"
             "distOutputDirectory": "/inspector/"
         }
         }
+    },
+    "viewer": {
+        "libraries": [
+            {
+                "files": [],
+                "noBundleInName": true,
+                "output": "babylon.viewer.js",
+                "webpack": "../../Viewer/webpack.gulp.config.js",
+                "bundle": "true",
+                "moduleDeclaration": "BabylonViewer"
+            }
+        ],
+        "build": {
+            "srcOutputDirectory": "../../Viewer/",
+            "distOutputDirectory": "/viewer/"
+        }
     }
     }
-}
+}

+ 8 - 4
Tools/Gulp/gulpfile.js

@@ -49,7 +49,8 @@ var tsConfig = {
     noImplicitThis: true,
     noImplicitThis: true,
     noUnusedLocals: true,
     noUnusedLocals: true,
     strictNullChecks: true,
     strictNullChecks: true,
-    strictFunctionTypes: true
+    strictFunctionTypes: true,
+    types: []
 };
 };
 var tsProject = typescript.createProject(tsConfig);
 var tsProject = typescript.createProject(tsConfig);
 
 
@@ -64,7 +65,8 @@ var externalTsConfig = {
     noImplicitReturns: true,
     noImplicitReturns: true,
     noImplicitThis: true,
     noImplicitThis: true,
     noUnusedLocals: true,
     noUnusedLocals: true,
-    strictNullChecks: true
+    strictNullChecks: true,
+    types: []
 };
 };
 
 
 var minimist = require("minimist");
 var minimist = require("minimist");
@@ -398,9 +400,11 @@ var buildExternalLibrary = function (library, settings, watch) {
 
 
         if (library.webpack) {
         if (library.webpack) {
             return waitAll.on("end", function () {
             return waitAll.on("end", function () {
-                webpack(require(library.webpack))
-                    .pipe(rename(library.output.replace(".js", ".bundle.js")))
+                return webpack(require(library.webpack))
+                    .pipe(rename(library.output.replace(".js", library.noBundleInName ? '.js' : ".bundle.js")))
                     .pipe(addModuleExports(library.moduleDeclaration, false, false, true))
                     .pipe(addModuleExports(library.moduleDeclaration, false, false, true))
+                    .pipe(uglify())
+                    .pipe(optimisejs())
                     .pipe(gulp.dest(outputDirectory))
                     .pipe(gulp.dest(outputDirectory))
             });
             });
         }
         }

+ 14 - 6
Tools/Gulp/package.json

@@ -9,9 +9,13 @@
     "readme": "https://github.com/BabylonJS/Babylon.js/edit/master/readme.md",
     "readme": "https://github.com/BabylonJS/Babylon.js/edit/master/readme.md",
     "license": "(Apache-2.0)",
     "license": "(Apache-2.0)",
     "devDependencies": {
     "devDependencies": {
+        "@types/node": "^8.0.53",
+        "base64-image-loader": "^1.2.0",
         "css-loader": "^0.25.0",
         "css-loader": "^0.25.0",
+        "deepmerge": "^2.0.1",
         "del": "2.2.2",
         "del": "2.2.2",
-        "exports-loader": "^0.6.3",
+        "es6-promise": "^4.1.1",
+        "exports-loader": "^0.6.4",
         "gulp": "^3.8.11",
         "gulp": "^3.8.11",
         "gulp-changed-in-place": "2.0.3",
         "gulp-changed-in-place": "2.0.3",
         "gulp-clean-ts-extends": "~0.1.1",
         "gulp-clean-ts-extends": "~0.1.1",
@@ -24,20 +28,24 @@
         "gulp-replace": "~0.5.3",
         "gulp-replace": "~0.5.3",
         "gulp-sass": "3.1.0",
         "gulp-sass": "3.1.0",
         "gulp-sourcemaps": "~1.9.1",
         "gulp-sourcemaps": "~1.9.1",
-        "gulp-typescript": "^3.2.2",
+        "gulp-typescript": "^3.2.3",
         "gulp-uglify": "^2.1.2",
         "gulp-uglify": "^2.1.2",
         "gulp-util": "~3.0.4",
         "gulp-util": "~3.0.4",
         "gulp-webserver": "^0.9.1",
         "gulp-webserver": "^0.9.1",
-        "imports-loader": "^0.7.0",
+        "handlebars": "^4.0.11",
+        "html-loader": "^0.5.1",
+        "imports-loader": "^0.7.1",
+        "json-loader": "^0.5.7",
         "merge2": "~0.3.5",
         "merge2": "~0.3.5",
         "minimist": "^1.2.0",
         "minimist": "^1.2.0",
         "run-sequence": "~1.1.0",
         "run-sequence": "~1.1.0",
-        "style-loader": "^0.13.1",
+        "style-loader": "^0.13.2",
         "through2": "~0.6.5",
         "through2": "~0.6.5",
+        "ts-loader": "^2.3.7",
         "typescript": "~2.6.1",
         "typescript": "~2.6.1",
-        "webpack-stream": "^3.2.0"
+        "webpack-stream": "^4.0.0"
     },
     },
     "scripts": {
     "scripts": {
         "install": "npm --prefix ../../Playground/ install ../../Playground/ && gulp typescript-compile && gulp typescript-libraries && gulp deployLocalDev"
         "install": "npm --prefix ../../Playground/ install ../../Playground/ && gulp typescript-compile && gulp typescript-libraries && gulp deployLocalDev"
     }
     }
-}
+}

+ 97 - 0
Viewer/assets/deepmerge.min.js

@@ -0,0 +1,97 @@
+(function (global, factory) {
+	typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
+	typeof define === 'function' && define.amd ? define(factory) :
+	(global.deepmerge = factory());
+}(this, (function () { 'use strict';
+
+var isMergeableObject = function isMergeableObject(value) {
+	return isNonNullObject(value)
+		&& !isSpecial(value)
+};
+
+function isNonNullObject(value) {
+	return !!value && typeof value === 'object'
+}
+
+function isSpecial(value) {
+	var stringValue = Object.prototype.toString.call(value);
+
+	return stringValue === '[object RegExp]'
+		|| stringValue === '[object Date]'
+		|| isReactElement(value)
+}
+
+// see https://github.com/facebook/react/blob/b5ac963fb791d1298e7f396236383bc955f916c1/src/isomorphic/classic/element/ReactElement.js#L21-L25
+var canUseSymbol = typeof Symbol === 'function' && Symbol.for;
+var REACT_ELEMENT_TYPE = canUseSymbol ? Symbol.for('react.element') : 0xeac7;
+
+function isReactElement(value) {
+	return value.$$typeof === REACT_ELEMENT_TYPE
+}
+
+function emptyTarget(val) {
+	return Array.isArray(val) ? [] : {}
+}
+
+function cloneUnlessOtherwiseSpecified(value, optionsArgument) {
+	var clone = !optionsArgument || optionsArgument.clone !== false;
+
+	return (clone && isMergeableObject(value))
+		? deepmerge(emptyTarget(value), value, optionsArgument)
+		: value
+}
+
+function defaultArrayMerge(target, source, optionsArgument) {
+	return target.concat(source).map(function(element) {
+		return cloneUnlessOtherwiseSpecified(element, optionsArgument)
+	})
+}
+
+function mergeObject(target, source, optionsArgument) {
+	var destination = {};
+	if (isMergeableObject(target)) {
+		Object.keys(target).forEach(function(key) {
+			destination[key] = cloneUnlessOtherwiseSpecified(target[key], optionsArgument);
+		});
+	}
+	Object.keys(source).forEach(function(key) {
+		if (!isMergeableObject(source[key]) || !target[key]) {
+			destination[key] = cloneUnlessOtherwiseSpecified(source[key], optionsArgument);
+		} else {
+			destination[key] = deepmerge(target[key], source[key], optionsArgument);
+		}
+	});
+	return destination
+}
+
+function deepmerge(target, source, optionsArgument) {
+	var sourceIsArray = Array.isArray(source);
+	var targetIsArray = Array.isArray(target);
+	var options = optionsArgument || { arrayMerge: defaultArrayMerge };
+	var sourceAndTargetTypesMatch = sourceIsArray === targetIsArray;
+
+	if (!sourceAndTargetTypesMatch) {
+		return cloneUnlessOtherwiseSpecified(source, optionsArgument)
+	} else if (sourceIsArray) {
+		var arrayMerge = options.arrayMerge || defaultArrayMerge;
+		return arrayMerge(target, source, optionsArgument)
+	} else {
+		return mergeObject(target, source, optionsArgument)
+	}
+}
+
+deepmerge.all = function deepmergeAll(array, optionsArgument) {
+	if (!Array.isArray(array)) {
+		throw new Error('first argument should be an array')
+	}
+
+	return array.reduce(function(prev, next) {
+		return deepmerge(prev, next, optionsArgument)
+	}, {})
+};
+
+var deepmerge_1 = deepmerge;
+
+return deepmerge_1;
+
+})));

文件差异内容过多而无法显示
+ 1 - 0
Viewer/assets/es6-promise.min.js


文件差异内容过多而无法显示
+ 29 - 0
Viewer/assets/handlebars.min.js


+ 9 - 9
Viewer/package.json

@@ -23,22 +23,22 @@
     },
     },
     "homepage": "https://github.com/BabylonJS/Babylon.js#readme",
     "homepage": "https://github.com/BabylonJS/Babylon.js#readme",
     "devDependencies": {
     "devDependencies": {
-        "@types/node": "^8.0.52",
+        "@types/node": "^8.0.53",
         "base64-image-loader": "^1.2.0",
         "base64-image-loader": "^1.2.0",
         "html-loader": "^0.5.1",
         "html-loader": "^0.5.1",
         "json-loader": "^0.5.7",
         "json-loader": "^0.5.7",
         "ts-loader": "^2.3.7",
         "ts-loader": "^2.3.7",
-        "typescript": "^2.6.1",
-        "uglifyjs-webpack-plugin": "^1.0.1",
+        "typescript": "^2.6.2",
+        "uglifyjs-webpack-plugin": "^1.1.1",
         "webpack": "^3.8.1",
         "webpack": "^3.8.1",
-        "webpack-dev-server": "^2.9.4"
+        "webpack-dev-server": "^2.9.5"
     },
     },
     "dependencies": {
     "dependencies": {
-        "babylonjs": "^3.1.0-beta3",
-        "babylonjs-loaders": "^3.1.0-beta3",
-        "babylonjs-materials": "^3.1.0-beta3",
-        "babylonjs-post-process": "^3.1.0-beta3",
-        "babylonjs-procedural-textures": "^3.1.0-beta3",
+        "babylonjs": "^3.1.0-beta6",
+        "babylonjs-loaders": "^3.1.0-beta6",
+        "babylonjs-materials": "^3.1.0-beta6",
+        "babylonjs-post-process": "^3.1.0-beta6",
+        "babylonjs-procedural-textures": "^3.1.0-beta6",
         "deepmerge": "^2.0.1",
         "deepmerge": "^2.0.1",
         "es6-promise": "^4.1.1",
         "es6-promise": "^4.1.1",
         "handlebars": "^4.0.11"
         "handlebars": "^4.0.11"

+ 1 - 1
Viewer/src/configuration/loader.ts

@@ -2,7 +2,7 @@ import { mapperManager } from './mappers';
 import { ViewerConfiguration } from './configuration';
 import { ViewerConfiguration } from './configuration';
 import { getConfigurationType } from './types';
 import { getConfigurationType } from './types';
 
 
-import deepmerge from 'deepmerge';
+import * as deepmerge from '../../assets/deepmerge.min.js';
 
 
 export class ConfigurationLoader {
 export class ConfigurationLoader {
 
 

+ 1 - 2
Viewer/src/index.ts

@@ -22,8 +22,7 @@ import { InitTags } from './initializer';
 global.Promise = Promise || require('es6-promise').Promise;
 global.Promise = Promise || require('es6-promise').Promise;
 
 
 export let disableInit: boolean = false;
 export let disableInit: boolean = false;
-
-setTimeout(() => {
+document.addEventListener("DOMContentLoaded", function (event) {
     if (disableInit) return;
     if (disableInit) return;
     InitTags();
     InitTags();
 });
 });

+ 1 - 1
Viewer/src/templateManager.ts

@@ -143,7 +143,7 @@ export class TemplateManager {
 }
 }
 
 
 
 
-import * as Handlebars from 'handlebars/dist/handlebars.min.js';
+import * as Handlebars from '../assets/handlebars.min.js';
 // register a new helper. modified https://stackoverflow.com/questions/9838925/is-there-any-method-to-iterate-a-map-with-handlebars-js
 // register a new helper. modified https://stackoverflow.com/questions/9838925/is-there-any-method-to-iterate-a-map-with-handlebars-js
 Handlebars.registerHelper('eachInMap', function (map, block) {
 Handlebars.registerHelper('eachInMap', function (map, block) {
     var out = '';
     var out = '';

+ 1 - 1
Viewer/src/util/promiseObservable.ts

@@ -1,4 +1,4 @@
-import { Observable, Nullable, Observer } from "babylonjs";
+import { Observable } from 'babylonjs';
 
 
 export class PromiseObservable<T> extends Observable<T> {
 export class PromiseObservable<T> extends Observable<T> {
 
 

+ 8 - 7
Viewer/src/viewer/defaultViewer.ts

@@ -1,12 +1,12 @@
+
+
 import { ViewerConfiguration } from './../configuration/configuration';
 import { ViewerConfiguration } from './../configuration/configuration';
 import { Template } from './../templateManager';
 import { Template } from './../templateManager';
 import { AbstractViewer } from './viewer';
 import { AbstractViewer } from './viewer';
-import { Observable, ShadowLight, CubeTexture, BouncingBehavior, FramingBehavior, Behavior, Light, Engine, Scene, AutoRotationBehavior, AbstractMesh, Quaternion, StandardMaterial, ShadowOnlyMaterial, ArcRotateCamera, ImageProcessingConfiguration, Color3, Vector3, SceneLoader, Mesh, HemisphericLight } from 'babylonjs';
+import { ShadowGenerator, Observable, ShadowLight, CubeTexture, BouncingBehavior, FramingBehavior, Behavior, Light, Engine, Scene, AutoRotationBehavior, AbstractMesh, Quaternion, StandardMaterial, ArcRotateCamera, ImageProcessingConfiguration, Color3, Vector3, SceneLoader, Mesh, HemisphericLight } from 'babylonjs';
 import { CameraBehavior } from '../interfaces';
 import { CameraBehavior } from '../interfaces';
 
 
-// A small hack for the inspector. to be removed!
-import * as BABYLON from 'babylonjs';
-window['BABYLON'] = BABYLON;
+import { ShadowOnlyMaterial } from 'babylonjs-materials';
 
 
 export class DefaultViewer extends AbstractViewer {
 export class DefaultViewer extends AbstractViewer {
 
 
@@ -107,7 +107,7 @@ export class DefaultViewer extends AbstractViewer {
                                     let requestFullScreen = viewerElement.requestFullscreen || viewerElement.webkitRequestFullscreen || (<any>viewerElement).msRequestFullscreen || (<any>viewerElement).mozRequestFullScreen;
                                     let requestFullScreen = viewerElement.requestFullscreen || viewerElement.webkitRequestFullscreen || (<any>viewerElement).msRequestFullscreen || (<any>viewerElement).mozRequestFullScreen;
                                     requestFullScreen.call(viewerElement);
                                     requestFullScreen.call(viewerElement);
                                 } else {
                                 } else {
-                                    let exitFullscreen = document.exitFullscreen || document.webkitExitFullscreen || (<any>document).msExitFullscreen || document.mozCancelFullScreen
+                                    let exitFullscreen = document.exitFullscreen || document.webkitExitFullscreen || (<any>document).msExitFullscreen || (<any>document).mozCancelFullScreen
                                     exitFullscreen.call(document);
                                     exitFullscreen.call(document);
                                 }
                                 }
 
 
@@ -230,7 +230,8 @@ export class DefaultViewer extends AbstractViewer {
             //default configuration
             //default configuration
             if (this.configuration.ground === true) {
             if (this.configuration.ground === true) {
                 ground.receiveShadows = true;
                 ground.receiveShadows = true;
-                ground.material.alpha = 0.4;
+                if (ground.material)
+                    ground.material.alpha = 0.4;
             }
             }
 
 
 
 
@@ -354,7 +355,7 @@ export class DefaultViewer extends AbstractViewer {
                 //position. Some lights don't support shadows
                 //position. Some lights don't support shadows
                 if (light instanceof ShadowLight) {
                 if (light instanceof ShadowLight) {
                     if (lightConfig.shadowEnabled) {
                     if (lightConfig.shadowEnabled) {
-                        var shadowGenerator = new BABYLON.ShadowGenerator(512, light);
+                        var shadowGenerator = new ShadowGenerator(512, light);
                         this.extendClassWithConfig(shadowGenerator, lightConfig.shadowConfig || {});
                         this.extendClassWithConfig(shadowGenerator, lightConfig.shadowConfig || {});
                         // add the focues meshes to the shadow list
                         // add the focues meshes to the shadow list
                         let shadownMap = shadowGenerator.getShadowMap();
                         let shadownMap = shadowGenerator.getShadowMap();

+ 2 - 0
Viewer/src/viewer/viewerManager.ts

@@ -1,3 +1,5 @@
+/// <reference path="../../../dist/preview release/babylon.d.ts"/>
+
 import { Observable } from 'babylonjs';
 import { Observable } from 'babylonjs';
 import { AbstractViewer } from './viewer';
 import { AbstractViewer } from './viewer';
 
 

+ 35 - 0
Viewer/tsconfig-gulp.json

@@ -0,0 +1,35 @@
+{
+    "compilerOptions": {
+        "target": "es5",
+        "module": "commonjs",
+        "noResolve": false,
+        "noImplicitAny": false, //mainly due to usage of external libs without typings.
+        "strictNullChecks": true,
+        "removeComments": true,
+        "preserveConstEnums": true,
+        "sourceMap": false,
+        "experimentalDecorators": true,
+        "isolatedModules": false,
+        "declaration": false,
+        "lib": [
+            "dom",
+            "es2015.promise",
+            "es5"
+        ],
+        "types": [
+            "node"
+        ],
+        "baseUrl": ".",
+        "paths": {
+            "babylonjs": [
+                "../dist/preview release/babylon.max.js"
+            ],
+            "babylonjs-materials": [
+                "../dist/preview release/materialsLibrary/babylonjs.materials.js"
+            ],
+            "babylonjs-loaders": [
+                "../dist/preview release/loaders/babylonjs.loaders.js"
+            ]
+        }
+    }
+}

+ 51 - 0
Viewer/webpack.gulp.config.js

@@ -0,0 +1,51 @@
+module.exports = {
+    //context: __dirname,
+    entry: [
+        __dirname + '/src/index.ts'
+    ]
+    ,
+    output: {
+        libraryTarget: 'var',
+        library: 'BabylonViewer',
+        umdNamedDefine: true
+    },
+    externals: {
+        cannon: true,
+        vertx: true
+    },
+    resolve: {
+        extensions: ['.ts', '.js'],
+        alias: {
+            "babylonjs": __dirname + '/../dist/preview release/babylon.max.js',
+            "babylonjs-materials": __dirname + '/../dist/preview release/materialsLibrary/babylonjs.materials.js',
+            "babylonjs-loaders": __dirname + '/../dist/preview release/loaders/babylonjs.loaders.js',
+            "es6-promise": __dirname + '/assets/es6-promise.min.js',
+            "deepmerge": __dirname + '/assets/deepmerge.min.js',
+        }
+    },
+    module: {
+        loaders: [{
+            test: /\.tsx?$/,
+            use: {
+                loader: 'ts-loader',
+                options: {
+                    configFile: 'tsconfig-gulp.json'
+                }
+            },
+            exclude: /node_modules/
+        },
+        {
+            test: /\.(html)$/,
+            use: {
+                loader: 'html-loader',
+                options: {
+                    minimize: true
+                }
+            }
+        },
+        {
+            test: /\.(jpe?g|png|ttf|eot|svg|woff(2)?)(\?[a-z0-9=&.]+)?$/,
+            use: 'base64-image-loader?limit=1000&name=[name].[ext]'
+        }]
+    }
+}

文件差异内容过多而无法显示
+ 0 - 18033
dist/babylon.module.d.ts


+ 225 - 210
dist/preview release/babylon.d.ts

@@ -4624,8 +4624,8 @@ declare module BABYLON {
         createTexture(urlArg: Nullable<string>, noMipmap: boolean, invertY: boolean, scene: Nullable<Scene>, samplingMode?: number, onLoad?: Nullable<() => void>, onError?: Nullable<(message: string, exception: any) => void>, buffer?: Nullable<ArrayBuffer | HTMLImageElement>, fallBack?: Nullable<InternalTexture>, format?: Nullable<number>): InternalTexture;
         createTexture(urlArg: Nullable<string>, noMipmap: boolean, invertY: boolean, scene: Nullable<Scene>, samplingMode?: number, onLoad?: Nullable<() => void>, onError?: Nullable<(message: string, exception: any) => void>, buffer?: Nullable<ArrayBuffer | HTMLImageElement>, fallBack?: Nullable<InternalTexture>, format?: Nullable<number>): InternalTexture;
         private _rescaleTexture(source, destination, scene, internalFormat, onComplete);
         private _rescaleTexture(source, destination, scene, internalFormat, onComplete);
         private _getInternalFormat(format);
         private _getInternalFormat(format);
-        updateRawTexture(texture: Nullable<InternalTexture>, data: Nullable<ArrayBufferView>, format: number, invertY: boolean, compression?: Nullable<string>): void;
-        createRawTexture(data: Nullable<ArrayBufferView>, width: number, height: number, format: number, generateMipMaps: boolean, invertY: boolean, samplingMode: number, compression?: Nullable<string>): InternalTexture;
+        updateRawTexture(texture: Nullable<InternalTexture>, data: Nullable<ArrayBufferView>, format: number, invertY: boolean, compression?: Nullable<string>, type?: number): void;
+        createRawTexture(data: Nullable<ArrayBufferView>, width: number, height: number, format: number, generateMipMaps: boolean, invertY: boolean, samplingMode: number, compression?: Nullable<string>, type?: number): InternalTexture;
         createDynamicTexture(width: number, height: number, generateMipMaps: boolean, samplingMode: number): InternalTexture;
         createDynamicTexture(width: number, height: number, generateMipMaps: boolean, samplingMode: number): InternalTexture;
         updateTextureSamplingMode(samplingMode: number, texture: InternalTexture): void;
         updateTextureSamplingMode(samplingMode: number, texture: InternalTexture): void;
         updateDynamicTexture(texture: Nullable<InternalTexture>, canvas: HTMLCanvasElement, invertY: boolean, premulAlpha?: boolean, format?: number): void;
         updateDynamicTexture(texture: Nullable<InternalTexture>, canvas: HTMLCanvasElement, invertY: boolean, premulAlpha?: boolean, format?: number): void;
@@ -4865,6 +4865,69 @@ declare var WebGLVertexArrayObject: {
 };
 };
 
 
 declare module BABYLON {
 declare module BABYLON {
+    class KeyboardEventTypes {
+        static _KEYDOWN: number;
+        static _KEYUP: number;
+        static readonly KEYDOWN: number;
+        static readonly KEYUP: number;
+    }
+    class KeyboardInfo {
+        type: number;
+        event: KeyboardEvent;
+        constructor(type: number, event: KeyboardEvent);
+    }
+    /**
+     * This class is used to store keyboard related info for the onPreKeyboardObservable event.
+     * Set the skipOnKeyboardObservable property to true if you want the engine to stop any process after this event is triggered, even not calling onKeyboardObservable
+     */
+    class KeyboardInfoPre extends KeyboardInfo {
+        constructor(type: number, event: KeyboardEvent);
+        skipOnPointerObservable: boolean;
+    }
+}
+
+declare module BABYLON {
+    class PointerEventTypes {
+        static _POINTERDOWN: number;
+        static _POINTERUP: number;
+        static _POINTERMOVE: number;
+        static _POINTERWHEEL: number;
+        static _POINTERPICK: number;
+        static _POINTERTAP: number;
+        static _POINTERDOUBLETAP: number;
+        static readonly POINTERDOWN: number;
+        static readonly POINTERUP: number;
+        static readonly POINTERMOVE: number;
+        static readonly POINTERWHEEL: number;
+        static readonly POINTERPICK: number;
+        static readonly POINTERTAP: number;
+        static readonly POINTERDOUBLETAP: number;
+    }
+    class PointerInfoBase {
+        type: number;
+        event: PointerEvent | MouseWheelEvent;
+        constructor(type: number, event: PointerEvent | MouseWheelEvent);
+    }
+    /**
+     * This class is used to store pointer related info for the onPrePointerObservable event.
+     * Set the skipOnPointerObservable property to true if you want the engine to stop any process after this event is triggered, even not calling onPointerObservable
+     */
+    class PointerInfoPre extends PointerInfoBase {
+        constructor(type: number, event: PointerEvent | MouseWheelEvent, localX: number, localY: number);
+        localPosition: Vector2;
+        skipOnPointerObservable: boolean;
+    }
+    /**
+     * This type contains all the data related to a pointer event in Babylon.js.
+     * The event member is an instance of PointerEvent for all types except PointerWheel and is of type MouseWheelEvent when type equals PointerWheel. The different event types can be found in the PointerEventTypes class.
+     */
+    class PointerInfo extends PointerInfoBase {
+        pickInfo: Nullable<PickingInfo>;
+        constructor(type: number, event: PointerEvent | MouseWheelEvent, pickInfo: Nullable<PickingInfo>);
+    }
+}
+
+declare module BABYLON {
     class StickValues {
     class StickValues {
         x: number;
         x: number;
         y: number;
         y: number;
@@ -4919,23 +4982,24 @@ declare module BABYLON {
 
 
 declare module BABYLON {
 declare module BABYLON {
     class GamepadManager {
     class GamepadManager {
+        private _scene;
         private _babylonGamepads;
         private _babylonGamepads;
         private _oneGamepadConnected;
         private _oneGamepadConnected;
-        private _isMonitoring;
+        _isMonitoring: boolean;
         private _gamepadEventSupported;
         private _gamepadEventSupported;
         private _gamepadSupport;
         private _gamepadSupport;
         onGamepadConnectedObservable: Observable<Gamepad>;
         onGamepadConnectedObservable: Observable<Gamepad>;
         onGamepadDisconnectedObservable: Observable<Gamepad>;
         onGamepadDisconnectedObservable: Observable<Gamepad>;
         private _onGamepadConnectedEvent;
         private _onGamepadConnectedEvent;
         private _onGamepadDisconnectedEvent;
         private _onGamepadDisconnectedEvent;
-        constructor();
+        constructor(_scene?: Scene | undefined);
         readonly gamepads: Gamepad[];
         readonly gamepads: Gamepad[];
         getGamepadByType(type?: number): Nullable<Gamepad>;
         getGamepadByType(type?: number): Nullable<Gamepad>;
         dispose(): void;
         dispose(): void;
         private _addNewGamepad(gamepad);
         private _addNewGamepad(gamepad);
         private _startMonitoringGamepads();
         private _startMonitoringGamepads();
         private _stopMonitoringGamepads();
         private _stopMonitoringGamepads();
-        private _checkGamepadsStatus();
+        _checkGamepadsStatus(): void;
         private _updateGamepadObjects();
         private _updateGamepadObjects();
     }
     }
 }
 }
@@ -5016,69 +5080,6 @@ declare module BABYLON {
     }
     }
 }
 }
 
 
-declare module BABYLON {
-    class KeyboardEventTypes {
-        static _KEYDOWN: number;
-        static _KEYUP: number;
-        static readonly KEYDOWN: number;
-        static readonly KEYUP: number;
-    }
-    class KeyboardInfo {
-        type: number;
-        event: KeyboardEvent;
-        constructor(type: number, event: KeyboardEvent);
-    }
-    /**
-     * This class is used to store keyboard related info for the onPreKeyboardObservable event.
-     * Set the skipOnKeyboardObservable property to true if you want the engine to stop any process after this event is triggered, even not calling onKeyboardObservable
-     */
-    class KeyboardInfoPre extends KeyboardInfo {
-        constructor(type: number, event: KeyboardEvent);
-        skipOnPointerObservable: boolean;
-    }
-}
-
-declare module BABYLON {
-    class PointerEventTypes {
-        static _POINTERDOWN: number;
-        static _POINTERUP: number;
-        static _POINTERMOVE: number;
-        static _POINTERWHEEL: number;
-        static _POINTERPICK: number;
-        static _POINTERTAP: number;
-        static _POINTERDOUBLETAP: number;
-        static readonly POINTERDOWN: number;
-        static readonly POINTERUP: number;
-        static readonly POINTERMOVE: number;
-        static readonly POINTERWHEEL: number;
-        static readonly POINTERPICK: number;
-        static readonly POINTERTAP: number;
-        static readonly POINTERDOUBLETAP: number;
-    }
-    class PointerInfoBase {
-        type: number;
-        event: PointerEvent | MouseWheelEvent;
-        constructor(type: number, event: PointerEvent | MouseWheelEvent);
-    }
-    /**
-     * This class is used to store pointer related info for the onPrePointerObservable event.
-     * Set the skipOnPointerObservable property to true if you want the engine to stop any process after this event is triggered, even not calling onPointerObservable
-     */
-    class PointerInfoPre extends PointerInfoBase {
-        constructor(type: number, event: PointerEvent | MouseWheelEvent, localX: number, localY: number);
-        localPosition: Vector2;
-        skipOnPointerObservable: boolean;
-    }
-    /**
-     * This type contains all the data related to a pointer event in Babylon.js.
-     * The event member is an instance of PointerEvent for all types except PointerWheel and is of type MouseWheelEvent when type equals PointerWheel. The different event types can be found in the PointerEventTypes class.
-     */
-    class PointerInfo extends PointerInfoBase {
-        pickInfo: Nullable<PickingInfo>;
-        constructor(type: number, event: PointerEvent | MouseWheelEvent, pickInfo: Nullable<PickingInfo>);
-    }
-}
-
 declare namespace BABYLON {
 declare namespace BABYLON {
     /**
     /**
      * Represents the different options available during the creation of
      * Represents the different options available during the creation of
@@ -5874,112 +5875,6 @@ declare module BABYLON {
 }
 }
 
 
 declare module BABYLON {
 declare module BABYLON {
-    interface ILoadingScreen {
-        displayLoadingUI: () => void;
-        hideLoadingUI: () => void;
-        loadingUIBackgroundColor: string;
-        loadingUIText: string;
-    }
-    class DefaultLoadingScreen implements ILoadingScreen {
-        private _renderingCanvas;
-        private _loadingText;
-        private _loadingDivBackgroundColor;
-        private _loadingDiv;
-        private _loadingTextDiv;
-        constructor(_renderingCanvas: HTMLCanvasElement, _loadingText?: string, _loadingDivBackgroundColor?: string);
-        displayLoadingUI(): void;
-        hideLoadingUI(): void;
-        loadingUIText: string;
-        loadingUIBackgroundColor: string;
-        private _resizeLoadingUI;
-    }
-}
-
-declare module BABYLON {
-    interface ISceneLoaderPluginExtensions {
-        [extension: string]: {
-            isBinary: boolean;
-        };
-    }
-    interface ISceneLoaderPluginFactory {
-        name: string;
-        createPlugin(): ISceneLoaderPlugin | ISceneLoaderPluginAsync;
-        canDirectLoad?: (data: string) => boolean;
-    }
-    interface ISceneLoaderPlugin {
-        name: string;
-        extensions: string | ISceneLoaderPluginExtensions;
-        importMesh: (meshesNames: any, scene: Scene, data: any, rootUrl: string, meshes: AbstractMesh[], particleSystems: ParticleSystem[], skeletons: Skeleton[], onError?: (message: string, exception?: any) => void) => boolean;
-        load: (scene: Scene, data: string, rootUrl: string, onError?: (message: string, exception?: any) => void) => boolean;
-        canDirectLoad?: (data: string) => boolean;
-        rewriteRootURL?: (rootUrl: string, responseURL?: string) => string;
-    }
-    interface ISceneLoaderPluginAsync {
-        name: string;
-        extensions: string | ISceneLoaderPluginExtensions;
-        importMeshAsync: (meshesNames: any, scene: Scene, data: any, rootUrl: string, onSuccess: (meshes: AbstractMesh[], particleSystems: ParticleSystem[], skeletons: Skeleton[]) => void, onProgress: (event: ProgressEvent) => void, onError: (message: string) => void) => void;
-        loadAsync: (scene: Scene, data: string, rootUrl: string, onSuccess: () => void, onProgress: (event: ProgressEvent) => void, onError: (message: string, exception?: any) => void) => void;
-        canDirectLoad?: (data: string) => boolean;
-        rewriteRootURL?: (rootUrl: string, responseURL?: string) => string;
-    }
-    class SceneLoader {
-        private static _ForceFullSceneLoadingForIncremental;
-        private static _ShowLoadingScreen;
-        private static _CleanBoneMatrixWeights;
-        static readonly NO_LOGGING: number;
-        static readonly MINIMAL_LOGGING: number;
-        static readonly SUMMARY_LOGGING: number;
-        static readonly DETAILED_LOGGING: number;
-        private static _loggingLevel;
-        static ForceFullSceneLoadingForIncremental: boolean;
-        static ShowLoadingScreen: boolean;
-        static loggingLevel: number;
-        static CleanBoneMatrixWeights: boolean;
-        static OnPluginActivatedObservable: Observable<ISceneLoaderPlugin | ISceneLoaderPluginAsync>;
-        private static _registeredPlugins;
-        private static _getDefaultPlugin();
-        private static _getPluginForExtension(extension);
-        private static _getPluginForDirectLoad(data);
-        private static _getPluginForFilename(sceneFilename);
-        private static _getDirectLoad(sceneFilename);
-        private static _loadData(rootUrl, sceneFilename, scene, onSuccess, onProgress, onError, pluginExtension?);
-        static GetPluginForExtension(extension: string): ISceneLoaderPlugin | ISceneLoaderPluginAsync | ISceneLoaderPluginFactory;
-        static RegisterPlugin(plugin: ISceneLoaderPlugin | ISceneLoaderPluginAsync): void;
-        /**
-        * Import meshes into a scene
-        * @param meshNames an array of mesh names, a single mesh name, or empty string for all meshes that filter what meshes are imported
-        * @param rootUrl a string that defines the root url for scene and resources
-        * @param sceneFilename a string that defines the name of the scene file. can start with "data:" following by the stringified version of the scene
-        * @param scene the instance of BABYLON.Scene to append to
-        * @param onSuccess a callback with a list of imported meshes, particleSystems, and skeletons when import succeeds
-        * @param onProgress a callback with a progress event for each file being loaded
-        * @param onError a callback with the scene, a message, and possibly an exception when import fails
-        */
-        static ImportMesh(meshNames: any, rootUrl: string, sceneFilename: string, scene: Scene, onSuccess?: Nullable<(meshes: AbstractMesh[], particleSystems: ParticleSystem[], skeletons: Skeleton[]) => void>, onProgress?: Nullable<(event: ProgressEvent) => void>, onError?: Nullable<(scene: Scene, message: string, exception?: any) => void>, pluginExtension?: string): Nullable<ISceneLoaderPlugin | ISceneLoaderPluginAsync>;
-        /**
-        * Load a scene
-        * @param rootUrl a string that defines the root url for scene and resources
-        * @param sceneFilename a string that defines the name of the scene file. can start with "data:" following by the stringified version of the scene
-        * @param engine is the instance of BABYLON.Engine to use to create the scene
-        * @param onSuccess a callback with the scene when import succeeds
-        * @param onProgress a callback with a progress event for each file being loaded
-        * @param onError a callback with the scene, a message, and possibly an exception when import fails
-        */
-        static Load(rootUrl: string, sceneFilename: any, engine: Engine, onSuccess?: (scene: Scene) => void, onProgress?: (event: ProgressEvent) => void, onError?: (scene: Scene, message: string, exception?: any) => void, pluginExtension?: string): Nullable<ISceneLoaderPlugin | ISceneLoaderPluginAsync>;
-        /**
-        * Append a scene
-        * @param rootUrl a string that defines the root url for scene and resources
-        * @param sceneFilename a string that defines the name of the scene file. can start with "data:" following by the stringified version of the scene
-        * @param scene is the instance of BABYLON.Scene to append to
-        * @param onSuccess a callback with the scene when import succeeds
-        * @param onProgress a callback with a progress event for each file being loaded
-        * @param onError a callback with the scene, a message, and possibly an exception when import fails
-        */
-        static Append(rootUrl: string, sceneFilename: any, scene: Scene, onSuccess?: (scene: Scene) => void, onProgress?: (event: ProgressEvent) => void, onError?: (scene: Scene, message: string, exception?: any) => void, pluginExtension?: string): Nullable<ISceneLoaderPlugin | ISceneLoaderPluginAsync>;
-    }
-}
-
-declare module BABYLON {
     class DirectionalLight extends ShadowLight {
     class DirectionalLight extends ShadowLight {
         private _shadowFrustumSize;
         private _shadowFrustumSize;
         /**
         /**
@@ -6513,6 +6408,112 @@ declare module BABYLON {
 }
 }
 
 
 declare module BABYLON {
 declare module BABYLON {
+    interface ILoadingScreen {
+        displayLoadingUI: () => void;
+        hideLoadingUI: () => void;
+        loadingUIBackgroundColor: string;
+        loadingUIText: string;
+    }
+    class DefaultLoadingScreen implements ILoadingScreen {
+        private _renderingCanvas;
+        private _loadingText;
+        private _loadingDivBackgroundColor;
+        private _loadingDiv;
+        private _loadingTextDiv;
+        constructor(_renderingCanvas: HTMLCanvasElement, _loadingText?: string, _loadingDivBackgroundColor?: string);
+        displayLoadingUI(): void;
+        hideLoadingUI(): void;
+        loadingUIText: string;
+        loadingUIBackgroundColor: string;
+        private _resizeLoadingUI;
+    }
+}
+
+declare module BABYLON {
+    interface ISceneLoaderPluginExtensions {
+        [extension: string]: {
+            isBinary: boolean;
+        };
+    }
+    interface ISceneLoaderPluginFactory {
+        name: string;
+        createPlugin(): ISceneLoaderPlugin | ISceneLoaderPluginAsync;
+        canDirectLoad?: (data: string) => boolean;
+    }
+    interface ISceneLoaderPlugin {
+        name: string;
+        extensions: string | ISceneLoaderPluginExtensions;
+        importMesh: (meshesNames: any, scene: Scene, data: any, rootUrl: string, meshes: AbstractMesh[], particleSystems: ParticleSystem[], skeletons: Skeleton[], onError?: (message: string, exception?: any) => void) => boolean;
+        load: (scene: Scene, data: string, rootUrl: string, onError?: (message: string, exception?: any) => void) => boolean;
+        canDirectLoad?: (data: string) => boolean;
+        rewriteRootURL?: (rootUrl: string, responseURL?: string) => string;
+    }
+    interface ISceneLoaderPluginAsync {
+        name: string;
+        extensions: string | ISceneLoaderPluginExtensions;
+        importMeshAsync: (meshesNames: any, scene: Scene, data: any, rootUrl: string, onSuccess: (meshes: AbstractMesh[], particleSystems: ParticleSystem[], skeletons: Skeleton[]) => void, onProgress: (event: ProgressEvent) => void, onError: (message: string) => void) => void;
+        loadAsync: (scene: Scene, data: string, rootUrl: string, onSuccess: () => void, onProgress: (event: ProgressEvent) => void, onError: (message: string, exception?: any) => void) => void;
+        canDirectLoad?: (data: string) => boolean;
+        rewriteRootURL?: (rootUrl: string, responseURL?: string) => string;
+    }
+    class SceneLoader {
+        private static _ForceFullSceneLoadingForIncremental;
+        private static _ShowLoadingScreen;
+        private static _CleanBoneMatrixWeights;
+        static readonly NO_LOGGING: number;
+        static readonly MINIMAL_LOGGING: number;
+        static readonly SUMMARY_LOGGING: number;
+        static readonly DETAILED_LOGGING: number;
+        private static _loggingLevel;
+        static ForceFullSceneLoadingForIncremental: boolean;
+        static ShowLoadingScreen: boolean;
+        static loggingLevel: number;
+        static CleanBoneMatrixWeights: boolean;
+        static OnPluginActivatedObservable: Observable<ISceneLoaderPlugin | ISceneLoaderPluginAsync>;
+        private static _registeredPlugins;
+        private static _getDefaultPlugin();
+        private static _getPluginForExtension(extension);
+        private static _getPluginForDirectLoad(data);
+        private static _getPluginForFilename(sceneFilename);
+        private static _getDirectLoad(sceneFilename);
+        private static _loadData(rootUrl, sceneFilename, scene, onSuccess, onProgress, onError, pluginExtension?);
+        static GetPluginForExtension(extension: string): ISceneLoaderPlugin | ISceneLoaderPluginAsync | ISceneLoaderPluginFactory;
+        static RegisterPlugin(plugin: ISceneLoaderPlugin | ISceneLoaderPluginAsync): void;
+        /**
+        * Import meshes into a scene
+        * @param meshNames an array of mesh names, a single mesh name, or empty string for all meshes that filter what meshes are imported
+        * @param rootUrl a string that defines the root url for scene and resources
+        * @param sceneFilename a string that defines the name of the scene file. can start with "data:" following by the stringified version of the scene
+        * @param scene the instance of BABYLON.Scene to append to
+        * @param onSuccess a callback with a list of imported meshes, particleSystems, and skeletons when import succeeds
+        * @param onProgress a callback with a progress event for each file being loaded
+        * @param onError a callback with the scene, a message, and possibly an exception when import fails
+        */
+        static ImportMesh(meshNames: any, rootUrl: string, sceneFilename: string, scene: Scene, onSuccess?: Nullable<(meshes: AbstractMesh[], particleSystems: ParticleSystem[], skeletons: Skeleton[]) => void>, onProgress?: Nullable<(event: ProgressEvent) => void>, onError?: Nullable<(scene: Scene, message: string, exception?: any) => void>, pluginExtension?: string): Nullable<ISceneLoaderPlugin | ISceneLoaderPluginAsync>;
+        /**
+        * Load a scene
+        * @param rootUrl a string that defines the root url for scene and resources
+        * @param sceneFilename a string that defines the name of the scene file. can start with "data:" following by the stringified version of the scene
+        * @param engine is the instance of BABYLON.Engine to use to create the scene
+        * @param onSuccess a callback with the scene when import succeeds
+        * @param onProgress a callback with a progress event for each file being loaded
+        * @param onError a callback with the scene, a message, and possibly an exception when import fails
+        */
+        static Load(rootUrl: string, sceneFilename: any, engine: Engine, onSuccess?: (scene: Scene) => void, onProgress?: (event: ProgressEvent) => void, onError?: (scene: Scene, message: string, exception?: any) => void, pluginExtension?: string): Nullable<ISceneLoaderPlugin | ISceneLoaderPluginAsync>;
+        /**
+        * Append a scene
+        * @param rootUrl a string that defines the root url for scene and resources
+        * @param sceneFilename a string that defines the name of the scene file. can start with "data:" following by the stringified version of the scene
+        * @param scene is the instance of BABYLON.Scene to append to
+        * @param onSuccess a callback with the scene when import succeeds
+        * @param onProgress a callback with a progress event for each file being loaded
+        * @param onError a callback with the scene, a message, and possibly an exception when import fails
+        */
+        static Append(rootUrl: string, sceneFilename: any, scene: Scene, onSuccess?: (scene: Scene) => void, onProgress?: (event: ProgressEvent) => void, onError?: (scene: Scene, message: string, exception?: any) => void, pluginExtension?: string): Nullable<ISceneLoaderPlugin | ISceneLoaderPluginAsync>;
+    }
+}
+
+declare module BABYLON {
     /**
     /**
      * The color grading curves provide additional color adjustmnent that is applied after any color grading transform (3D LUT).
      * The color grading curves provide additional color adjustmnent that is applied after any color grading transform (3D LUT).
      * They allow basic adjustment of saturation and small exposure adjustments, along with color filter tinting to provide white balance adjustment or more stylistic effects.
      * They allow basic adjustment of saturation and small exposure adjustments, along with color filter tinting to provide white balance adjustment or more stylistic effects.
@@ -8720,9 +8721,21 @@ declare module BABYLON {
         /**
         /**
          * Normalize the current Vector3.
          * Normalize the current Vector3.
          * Returns the updated Vector3.
          * Returns the updated Vector3.
+         * /!\ In place operation.
          */
          */
         normalize(): Vector3;
         normalize(): Vector3;
         /**
         /**
+         * Normalize the current Vector3 to a new vector.
+         * @returns the new Vector3.
+         */
+        normalizeToNew(): Vector3;
+        /**
+         * Normalize the current Vector3 to the reference.
+         * @param the reference to update.
+         * @returns the updated Vector3.
+         */
+        normalizeToRef(reference: Vector3): Vector3;
+        /**
          * Returns a new Vector3 copied from the current Vector3.
          * Returns a new Vector3 copied from the current Vector3.
          */
          */
         clone(): Vector3;
         clone(): Vector3;
@@ -11513,6 +11526,8 @@ declare module BABYLON {
          * Returns the Mesh.
          * Returns the Mesh.
          */
          */
         refreshBoundingInfo(): Mesh;
         refreshBoundingInfo(): Mesh;
+        _refreshBoundingInfo(applySkeleton: boolean): Mesh;
+        private _getPositionData(applySkeleton);
         _createGlobalSubMesh(force: boolean): Nullable<SubMesh>;
         _createGlobalSubMesh(force: boolean): Nullable<SubMesh>;
         subdivide(count: number): void;
         subdivide(count: number): void;
         /**
         /**
@@ -14925,6 +14940,36 @@ declare module BABYLON {
 }
 }
 
 
 declare module BABYLON {
 declare module BABYLON {
+    class ReflectionProbe {
+        name: string;
+        private _scene;
+        private _renderTargetTexture;
+        private _projectionMatrix;
+        private _viewMatrix;
+        private _target;
+        private _add;
+        private _attachedMesh;
+        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 {
     class AnaglyphPostProcess extends PostProcess {
         private _passedProcess;
         private _passedProcess;
         constructor(name: string, options: number | PostProcessOptions, rigCameras: Camera[], samplingMode?: number, engine?: Engine, reusable?: boolean);
         constructor(name: string, options: number | PostProcessOptions, rigCameras: Camera[], samplingMode?: number, engine?: Engine, reusable?: boolean);
@@ -15452,36 +15497,6 @@ declare module BABYLON {
 }
 }
 
 
 declare module BABYLON {
 declare module BABYLON {
-    class ReflectionProbe {
-        name: string;
-        private _scene;
-        private _renderTargetTexture;
-        private _projectionMatrix;
-        private _viewMatrix;
-        private _target;
-        private _add;
-        private _attachedMesh;
-        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 {
     class BoundingBoxRenderer {
         frontColor: Color3;
         frontColor: Color3;
         backColor: Color3;
         backColor: Color3;
@@ -18021,9 +18036,6 @@ declare module BABYLON {
     }
     }
 }
 }
 
 
-declare module BABYLON.Internals {
-}
-
 declare module BABYLON {
 declare module BABYLON {
     /**
     /**
      * Interface to implement to create a shadow generator compatible with BJS.
      * Interface to implement to create a shadow generator compatible with BJS.
@@ -18204,6 +18216,9 @@ declare module BABYLON {
     }
     }
 }
 }
 
 
+declare module BABYLON.Internals {
+}
+
 declare namespace BABYLON {
 declare namespace BABYLON {
     /**
     /**
      * Background material used to create an efficient environement around your scene.
      * Background material used to create an efficient environement around your scene.
@@ -19731,13 +19746,13 @@ declare module BABYLON {
     class RawTexture extends Texture {
     class RawTexture extends Texture {
         format: number;
         format: number;
         private _engine;
         private _engine;
-        constructor(data: ArrayBufferView, width: number, height: number, format: number, scene: Scene, generateMipMaps?: boolean, invertY?: boolean, samplingMode?: number);
+        constructor(data: ArrayBufferView, width: number, height: number, format: number, scene: Scene, generateMipMaps?: boolean, invertY?: boolean, samplingMode?: number, type?: number);
         update(data: ArrayBufferView): void;
         update(data: ArrayBufferView): void;
         static CreateLuminanceTexture(data: ArrayBufferView, width: number, height: number, scene: Scene, generateMipMaps?: boolean, invertY?: boolean, samplingMode?: number): RawTexture;
         static CreateLuminanceTexture(data: ArrayBufferView, width: number, height: number, scene: Scene, generateMipMaps?: boolean, invertY?: boolean, samplingMode?: number): RawTexture;
         static CreateLuminanceAlphaTexture(data: ArrayBufferView, width: number, height: number, scene: Scene, generateMipMaps?: boolean, invertY?: boolean, samplingMode?: number): RawTexture;
         static CreateLuminanceAlphaTexture(data: ArrayBufferView, width: number, height: number, scene: Scene, generateMipMaps?: boolean, invertY?: boolean, samplingMode?: number): RawTexture;
         static CreateAlphaTexture(data: ArrayBufferView, width: number, height: number, scene: Scene, generateMipMaps?: boolean, invertY?: boolean, samplingMode?: number): RawTexture;
         static CreateAlphaTexture(data: ArrayBufferView, width: number, height: number, scene: Scene, generateMipMaps?: boolean, invertY?: boolean, samplingMode?: number): RawTexture;
-        static CreateRGBTexture(data: ArrayBufferView, width: number, height: number, scene: Scene, generateMipMaps?: boolean, invertY?: boolean, samplingMode?: number): RawTexture;
-        static CreateRGBATexture(data: ArrayBufferView, width: number, height: number, scene: Scene, generateMipMaps?: boolean, invertY?: boolean, samplingMode?: number): RawTexture;
+        static CreateRGBTexture(data: ArrayBufferView, width: number, height: number, scene: Scene, generateMipMaps?: boolean, invertY?: boolean, samplingMode?: number, type?: number): RawTexture;
+        static CreateRGBATexture(data: ArrayBufferView, width: number, height: number, scene: Scene, generateMipMaps?: boolean, invertY?: boolean, samplingMode?: number, type?: number): RawTexture;
     }
     }
 }
 }
 
 

文件差异内容过多而无法显示
+ 47 - 47
dist/preview release/babylon.js


+ 180 - 63
dist/preview release/babylon.max.js

@@ -1438,10 +1438,10 @@ var BABYLON;
         Vector3.prototype.lengthSquared = function () {
         Vector3.prototype.lengthSquared = function () {
             return (this.x * this.x + this.y * this.y + this.z * this.z);
             return (this.x * this.x + this.y * this.y + this.z * this.z);
         };
         };
-        // Methods
         /**
         /**
          * Normalize the current Vector3.
          * Normalize the current Vector3.
          * Returns the updated Vector3.
          * Returns the updated Vector3.
+         * /!\ In place operation.
          */
          */
         Vector3.prototype.normalize = function () {
         Vector3.prototype.normalize = function () {
             var len = this.length();
             var len = this.length();
@@ -1454,6 +1454,30 @@ var BABYLON;
             return this;
             return this;
         };
         };
         /**
         /**
+         * Normalize the current Vector3 to a new vector.
+         * @returns the new Vector3.
+         */
+        Vector3.prototype.normalizeToNew = function () {
+            var normalized = new Vector3(0, 0, 0);
+            this.normalizeToRef(normalized);
+            return normalized;
+        };
+        /**
+         * Normalize the current Vector3 to the reference.
+         * @param the reference to update.
+         * @returns the updated Vector3.
+         */
+        Vector3.prototype.normalizeToRef = function (reference) {
+            var len = this.length();
+            if (len === 0 || len === 1.0) {
+                reference.set(this.x, this.y, this.z);
+                return reference;
+            }
+            var scale = 1.0 / len;
+            this.scaleToRef(scale, reference);
+            return reference;
+        };
+        /**
          * Returns a new Vector3 copied from the current Vector3.
          * Returns a new Vector3 copied from the current Vector3.
          */
          */
         Vector3.prototype.clone = function () {
         Vector3.prototype.clone = function () {
@@ -10478,17 +10502,21 @@ var BABYLON;
             }
             }
             return internalFormat;
             return internalFormat;
         };
         };
-        Engine.prototype.updateRawTexture = function (texture, data, format, invertY, compression) {
+        Engine.prototype.updateRawTexture = function (texture, data, format, invertY, compression, type) {
             if (compression === void 0) { compression = null; }
             if (compression === void 0) { compression = null; }
+            if (type === void 0) { type = Engine.TEXTURETYPE_UNSIGNED_INT; }
             if (!texture) {
             if (!texture) {
                 return;
                 return;
             }
             }
             var internalFormat = this._getInternalFormat(format);
             var internalFormat = this._getInternalFormat(format);
+            var internalSizedFomat = this._getRGBABufferInternalSizedFormat(type);
+            var textureType = this._getWebGLTextureType(type);
             this._bindTextureDirectly(this._gl.TEXTURE_2D, texture);
             this._bindTextureDirectly(this._gl.TEXTURE_2D, texture);
             this._gl.pixelStorei(this._gl.UNPACK_FLIP_Y_WEBGL, invertY === undefined ? 1 : (invertY ? 1 : 0));
             this._gl.pixelStorei(this._gl.UNPACK_FLIP_Y_WEBGL, invertY === undefined ? 1 : (invertY ? 1 : 0));
             if (!this._doNotHandleContextLost) {
             if (!this._doNotHandleContextLost) {
                 texture._bufferView = data;
                 texture._bufferView = data;
                 texture.format = format;
                 texture.format = format;
+                texture.type = type;
                 texture.invertY = invertY;
                 texture.invertY = invertY;
                 texture._compression = compression;
                 texture._compression = compression;
             }
             }
@@ -10499,7 +10527,7 @@ var BABYLON;
                 this._gl.compressedTexImage2D(this._gl.TEXTURE_2D, 0, this.getCaps().s3tc[compression], texture.width, texture.height, 0, data);
                 this._gl.compressedTexImage2D(this._gl.TEXTURE_2D, 0, this.getCaps().s3tc[compression], texture.width, texture.height, 0, data);
             }
             }
             else {
             else {
-                this._gl.texImage2D(this._gl.TEXTURE_2D, 0, internalFormat, texture.width, texture.height, 0, internalFormat, this._gl.UNSIGNED_BYTE, data);
+                this._gl.texImage2D(this._gl.TEXTURE_2D, 0, internalSizedFomat, texture.width, texture.height, 0, internalFormat, textureType, data);
             }
             }
             if (texture.generateMipMaps) {
             if (texture.generateMipMaps) {
                 this._gl.generateMipmap(this._gl.TEXTURE_2D);
                 this._gl.generateMipmap(this._gl.TEXTURE_2D);
@@ -10508,8 +10536,9 @@ var BABYLON;
             this.resetTextureCache();
             this.resetTextureCache();
             texture.isReady = true;
             texture.isReady = true;
         };
         };
-        Engine.prototype.createRawTexture = function (data, width, height, format, generateMipMaps, invertY, samplingMode, compression) {
+        Engine.prototype.createRawTexture = function (data, width, height, format, generateMipMaps, invertY, samplingMode, compression, type) {
             if (compression === void 0) { compression = null; }
             if (compression === void 0) { compression = null; }
+            if (type === void 0) { type = BABYLON.Engine.TEXTURETYPE_UNSIGNED_INT; }
             var texture = new BABYLON.InternalTexture(this, BABYLON.InternalTexture.DATASOURCE_RAW);
             var texture = new BABYLON.InternalTexture(this, BABYLON.InternalTexture.DATASOURCE_RAW);
             texture.baseWidth = width;
             texture.baseWidth = width;
             texture.baseHeight = height;
             texture.baseHeight = height;
@@ -10520,10 +10549,11 @@ var BABYLON;
             texture.samplingMode = samplingMode;
             texture.samplingMode = samplingMode;
             texture.invertY = invertY;
             texture.invertY = invertY;
             texture._compression = compression;
             texture._compression = compression;
+            texture.type = type;
             if (!this._doNotHandleContextLost) {
             if (!this._doNotHandleContextLost) {
                 texture._bufferView = data;
                 texture._bufferView = data;
             }
             }
-            this.updateRawTexture(texture, data, format, invertY, compression);
+            this.updateRawTexture(texture, data, format, invertY, compression, type);
             this._bindTextureDirectly(this._gl.TEXTURE_2D, texture);
             this._bindTextureDirectly(this._gl.TEXTURE_2D, texture);
             // Filters
             // Filters
             var filters = getSamplingParameters(samplingMode, generateMipMaps, this._gl);
             var filters = getSamplingParameters(samplingMode, generateMipMaps, this._gl);
@@ -18379,7 +18409,7 @@ var BABYLON;
         Object.defineProperty(Scene.prototype, "gamepadManager", {
         Object.defineProperty(Scene.prototype, "gamepadManager", {
             get: function () {
             get: function () {
                 if (!this._gamepadManager) {
                 if (!this._gamepadManager) {
-                    this._gamepadManager = new BABYLON.GamepadManager();
+                    this._gamepadManager = new BABYLON.GamepadManager(this);
                 }
                 }
                 return this._gamepadManager;
                 return this._gamepadManager;
             },
             },
@@ -20676,6 +20706,10 @@ var BABYLON;
                     this.onAfterPhysicsObservable.notifyObservers(this);
                     this.onAfterPhysicsObservable.notifyObservers(this);
                 }
                 }
             }
             }
+            // update gamepad manager
+            if (this._gamepadManager && this._gamepadManager._isMonitoring) {
+                this._gamepadManager._checkGamepadsStatus();
+            }
             // Before render
             // Before render
             this.onBeforeRenderObservable.notifyObservers(this);
             this.onBeforeRenderObservable.notifyObservers(this);
             // Customs render targets
             // Customs render targets
@@ -23669,10 +23703,13 @@ var BABYLON;
          * Returns the Mesh.
          * Returns the Mesh.
          */
          */
         Mesh.prototype.refreshBoundingInfo = function () {
         Mesh.prototype.refreshBoundingInfo = function () {
+            return this._refreshBoundingInfo(false);
+        };
+        Mesh.prototype._refreshBoundingInfo = function (applySkeleton) {
             if (this._boundingInfo && this._boundingInfo.isLocked) {
             if (this._boundingInfo && this._boundingInfo.isLocked) {
                 return this;
                 return this;
             }
             }
-            var data = this.getVerticesData(BABYLON.VertexBuffer.PositionKind);
+            var data = this._getPositionData(applySkeleton);
             if (data) {
             if (data) {
                 var extend = BABYLON.Tools.ExtractMinAndMax(data, 0, this.getTotalVertices());
                 var extend = BABYLON.Tools.ExtractMinAndMax(data, 0, this.getTotalVertices());
                 this._boundingInfo = new BABYLON.BoundingInfo(extend.minimum, extend.maximum);
                 this._boundingInfo = new BABYLON.BoundingInfo(extend.minimum, extend.maximum);
@@ -23685,6 +23722,48 @@ var BABYLON;
             this._updateBoundingInfo();
             this._updateBoundingInfo();
             return this;
             return this;
         };
         };
+        Mesh.prototype._getPositionData = function (applySkeleton) {
+            var data = this.getVerticesData(BABYLON.VertexBuffer.PositionKind);
+            if (data && applySkeleton && this.skeleton) {
+                data = data.slice();
+                var matricesIndicesData = this.getVerticesData(BABYLON.VertexBuffer.MatricesIndicesKind);
+                var matricesWeightsData = this.getVerticesData(BABYLON.VertexBuffer.MatricesWeightsKind);
+                if (matricesWeightsData && matricesIndicesData) {
+                    var needExtras = this.numBoneInfluencers > 4;
+                    var matricesIndicesExtraData = needExtras ? this.getVerticesData(BABYLON.VertexBuffer.MatricesIndicesExtraKind) : null;
+                    var matricesWeightsExtraData = needExtras ? this.getVerticesData(BABYLON.VertexBuffer.MatricesWeightsExtraKind) : null;
+                    var skeletonMatrices = this.skeleton.getTransformMatrices(this);
+                    var tempVector = BABYLON.Tmp.Vector3[0];
+                    var finalMatrix = BABYLON.Tmp.Matrix[0];
+                    var tempMatrix = BABYLON.Tmp.Matrix[1];
+                    var matWeightIdx = 0;
+                    for (var index = 0; index < data.length; index += 3, matWeightIdx += 4) {
+                        finalMatrix.reset();
+                        var inf;
+                        var weight;
+                        for (inf = 0; inf < 4; inf++) {
+                            weight = matricesWeightsData[matWeightIdx + inf];
+                            if (weight <= 0)
+                                break;
+                            BABYLON.Matrix.FromFloat32ArrayToRefScaled(skeletonMatrices, matricesIndicesData[matWeightIdx + inf] * 16, weight, tempMatrix);
+                            finalMatrix.addToSelf(tempMatrix);
+                        }
+                        if (needExtras) {
+                            for (inf = 0; inf < 4; inf++) {
+                                weight = matricesWeightsExtraData[matWeightIdx + inf];
+                                if (weight <= 0)
+                                    break;
+                                BABYLON.Matrix.FromFloat32ArrayToRefScaled(skeletonMatrices, matricesIndicesExtraData[matWeightIdx + inf] * 16, weight, tempMatrix);
+                                finalMatrix.addToSelf(tempMatrix);
+                            }
+                        }
+                        BABYLON.Vector3.TransformCoordinatesFromFloatsToRef(data[index], data[index + 1], data[index + 2], finalMatrix, tempVector);
+                        tempVector.toArray(data, index);
+                    }
+                }
+            }
+            return data;
+        };
         Mesh.prototype._createGlobalSubMesh = function (force) {
         Mesh.prototype._createGlobalSubMesh = function (force) {
             var totalVertices = this.getTotalVertices();
             var totalVertices = this.getTotalVertices();
             if (!totalVertices || !this.getIndices()) {
             if (!totalVertices || !this.getIndices()) {
@@ -25802,9 +25881,6 @@ var BABYLON;
             var needExtras = this.numBoneInfluencers > 4;
             var needExtras = this.numBoneInfluencers > 4;
             var matricesIndicesExtraData = needExtras ? this.getVerticesData(BABYLON.VertexBuffer.MatricesIndicesExtraKind) : null;
             var matricesIndicesExtraData = needExtras ? this.getVerticesData(BABYLON.VertexBuffer.MatricesIndicesExtraKind) : null;
             var matricesWeightsExtraData = needExtras ? this.getVerticesData(BABYLON.VertexBuffer.MatricesWeightsExtraKind) : null;
             var matricesWeightsExtraData = needExtras ? this.getVerticesData(BABYLON.VertexBuffer.MatricesWeightsExtraKind) : null;
-            if (!matricesWeightsExtraData || !matricesIndicesExtraData) {
-                return this;
-            }
             var skeletonMatrices = skeleton.getTransformMatrices(this);
             var skeletonMatrices = skeleton.getTransformMatrices(this);
             var tempVector3 = BABYLON.Vector3.Zero();
             var tempVector3 = BABYLON.Vector3.Zero();
             var finalMatrix = new BABYLON.Matrix();
             var finalMatrix = new BABYLON.Matrix();
@@ -35694,12 +35770,12 @@ var BABYLON;
              * This parameters will enable/disable Horizon occlusion to prevent normal maps to look shiny when the normal
              * This parameters will enable/disable Horizon occlusion to prevent normal maps to look shiny when the normal
              * makes the reflect vector face the model (under horizon).
              * makes the reflect vector face the model (under horizon).
              */
              */
-            _this._useHorizonOcclusion = false; // USEHORIZONOCCLUSION
+            _this._useHorizonOcclusion = true;
             /**
             /**
              * This parameters will enable/disable radiance occlusion by preventing the radiance to lit
              * This parameters will enable/disable radiance occlusion by preventing the radiance to lit
              * too much the area relying on ambient texture to define their ambient occlusion.
              * too much the area relying on ambient texture to define their ambient occlusion.
              */
              */
-            _this._useRadianceOcclusion = false;
+            _this._useRadianceOcclusion = true;
             /**
             /**
              * Specifies that the alpha is coming form the albedo channel alpha channel for alpha blending.
              * Specifies that the alpha is coming form the albedo channel alpha channel for alpha blending.
              */
              */
@@ -37098,12 +37174,12 @@ var BABYLON;
              * This parameters will enable/disable Horizon occlusion to prevent normal maps to look shiny when the normal
              * This parameters will enable/disable Horizon occlusion to prevent normal maps to look shiny when the normal
              * makes the reflect vector face the model (under horizon).
              * makes the reflect vector face the model (under horizon).
              */
              */
-            _this.useHorizonOcclusion = false;
+            _this.useHorizonOcclusion = true;
             /**
             /**
              * This parameters will enable/disable radiance occlusion by preventing the radiance to lit
              * This parameters will enable/disable radiance occlusion by preventing the radiance to lit
              * too much the area relying on ambient texture to define their ambient occlusion.
              * too much the area relying on ambient texture to define their ambient occlusion.
              */
              */
-            _this.useRadianceOcclusion = false;
+            _this.useRadianceOcclusion = true;
             _this._environmentBRDFTexture = BABYLON.TextureTools.GetEnvironmentBRDFTexture(scene);
             _this._environmentBRDFTexture = BABYLON.TextureTools.GetEnvironmentBRDFTexture(scene);
             return _this;
             return _this;
         }
         }
@@ -51720,14 +51796,15 @@ var BABYLON;
 (function (BABYLON) {
 (function (BABYLON) {
     var RawTexture = /** @class */ (function (_super) {
     var RawTexture = /** @class */ (function (_super) {
         __extends(RawTexture, _super);
         __extends(RawTexture, _super);
-        function RawTexture(data, width, height, format, scene, generateMipMaps, invertY, samplingMode) {
+        function RawTexture(data, width, height, format, scene, generateMipMaps, invertY, samplingMode, type) {
             if (generateMipMaps === void 0) { generateMipMaps = true; }
             if (generateMipMaps === void 0) { generateMipMaps = true; }
             if (invertY === void 0) { invertY = false; }
             if (invertY === void 0) { invertY = false; }
             if (samplingMode === void 0) { samplingMode = BABYLON.Texture.TRILINEAR_SAMPLINGMODE; }
             if (samplingMode === void 0) { samplingMode = BABYLON.Texture.TRILINEAR_SAMPLINGMODE; }
+            if (type === void 0) { type = BABYLON.Engine.TEXTURETYPE_UNSIGNED_INT; }
             var _this = _super.call(this, null, scene, !generateMipMaps, invertY) || this;
             var _this = _super.call(this, null, scene, !generateMipMaps, invertY) || this;
             _this.format = format;
             _this.format = format;
             _this._engine = scene.getEngine();
             _this._engine = scene.getEngine();
-            _this._texture = scene.getEngine().createRawTexture(data, width, height, format, generateMipMaps, invertY, samplingMode);
+            _this._texture = scene.getEngine().createRawTexture(data, width, height, format, generateMipMaps, invertY, samplingMode, null, type);
             _this.wrapU = BABYLON.Texture.CLAMP_ADDRESSMODE;
             _this.wrapU = BABYLON.Texture.CLAMP_ADDRESSMODE;
             _this.wrapV = BABYLON.Texture.CLAMP_ADDRESSMODE;
             _this.wrapV = BABYLON.Texture.CLAMP_ADDRESSMODE;
             return _this;
             return _this;
@@ -51754,17 +51831,19 @@ var BABYLON;
             if (samplingMode === void 0) { samplingMode = BABYLON.Texture.TRILINEAR_SAMPLINGMODE; }
             if (samplingMode === void 0) { samplingMode = BABYLON.Texture.TRILINEAR_SAMPLINGMODE; }
             return new RawTexture(data, width, height, BABYLON.Engine.TEXTUREFORMAT_ALPHA, scene, generateMipMaps, invertY, samplingMode);
             return new RawTexture(data, width, height, BABYLON.Engine.TEXTUREFORMAT_ALPHA, scene, generateMipMaps, invertY, samplingMode);
         };
         };
-        RawTexture.CreateRGBTexture = function (data, width, height, scene, generateMipMaps, invertY, samplingMode) {
+        RawTexture.CreateRGBTexture = function (data, width, height, scene, generateMipMaps, invertY, samplingMode, type) {
             if (generateMipMaps === void 0) { generateMipMaps = true; }
             if (generateMipMaps === void 0) { generateMipMaps = true; }
             if (invertY === void 0) { invertY = false; }
             if (invertY === void 0) { invertY = false; }
             if (samplingMode === void 0) { samplingMode = BABYLON.Texture.TRILINEAR_SAMPLINGMODE; }
             if (samplingMode === void 0) { samplingMode = BABYLON.Texture.TRILINEAR_SAMPLINGMODE; }
-            return new RawTexture(data, width, height, BABYLON.Engine.TEXTUREFORMAT_RGB, scene, generateMipMaps, invertY, samplingMode);
+            if (type === void 0) { type = BABYLON.Engine.TEXTURETYPE_UNSIGNED_INT; }
+            return new RawTexture(data, width, height, BABYLON.Engine.TEXTUREFORMAT_RGB, scene, generateMipMaps, invertY, samplingMode, type);
         };
         };
-        RawTexture.CreateRGBATexture = function (data, width, height, scene, generateMipMaps, invertY, samplingMode) {
+        RawTexture.CreateRGBATexture = function (data, width, height, scene, generateMipMaps, invertY, samplingMode, type) {
             if (generateMipMaps === void 0) { generateMipMaps = true; }
             if (generateMipMaps === void 0) { generateMipMaps = true; }
             if (invertY === void 0) { invertY = false; }
             if (invertY === void 0) { invertY = false; }
             if (samplingMode === void 0) { samplingMode = BABYLON.Texture.TRILINEAR_SAMPLINGMODE; }
             if (samplingMode === void 0) { samplingMode = BABYLON.Texture.TRILINEAR_SAMPLINGMODE; }
-            return new RawTexture(data, width, height, BABYLON.Engine.TEXTUREFORMAT_RGBA, scene, generateMipMaps, invertY, samplingMode);
+            if (type === void 0) { type = BABYLON.Engine.TEXTURETYPE_UNSIGNED_INT; }
+            return new RawTexture(data, width, height, BABYLON.Engine.TEXTUREFORMAT_RGBA, scene, generateMipMaps, invertY, samplingMode, type);
         };
         };
         return RawTexture;
         return RawTexture;
     }(BABYLON.Texture));
     }(BABYLON.Texture));
@@ -56274,8 +56353,9 @@ var BABYLON;
 var BABYLON;
 var BABYLON;
 (function (BABYLON) {
 (function (BABYLON) {
     var GamepadManager = /** @class */ (function () {
     var GamepadManager = /** @class */ (function () {
-        function GamepadManager() {
+        function GamepadManager(_scene) {
             var _this = this;
             var _this = this;
+            this._scene = _scene;
             this._babylonGamepads = [];
             this._babylonGamepads = [];
             this._oneGamepadConnected = false;
             this._oneGamepadConnected = false;
             this._isMonitoring = false;
             this._isMonitoring = false;
@@ -56402,7 +56482,10 @@ var BABYLON;
         GamepadManager.prototype._startMonitoringGamepads = function () {
         GamepadManager.prototype._startMonitoringGamepads = function () {
             if (!this._isMonitoring) {
             if (!this._isMonitoring) {
                 this._isMonitoring = true;
                 this._isMonitoring = true;
-                this._checkGamepadsStatus();
+                //back-comp
+                if (!this._scene) {
+                    this._checkGamepadsStatus();
+                }
             }
             }
         };
         };
         GamepadManager.prototype._stopMonitoringGamepads = function () {
         GamepadManager.prototype._stopMonitoringGamepads = function () {
@@ -56419,7 +56502,7 @@ var BABYLON;
                 }
                 }
                 gamepad.update();
                 gamepad.update();
             }
             }
-            if (this._isMonitoring) {
+            if (this._isMonitoring && !this._scene) {
                 BABYLON.Tools.QueueNewFrame(function () { _this._checkGamepadsStatus(); });
                 BABYLON.Tools.QueueNewFrame(function () { _this._checkGamepadsStatus(); });
             }
             }
         };
         };
@@ -72295,57 +72378,77 @@ var BABYLON;
         };
         };
         VRExperienceHelper.prototype._onNewGamepadConnected = function (gamepad) {
         VRExperienceHelper.prototype._onNewGamepadConnected = function (gamepad) {
             var _this = this;
             var _this = this;
-            if (gamepad.leftStick && gamepad.type !== BABYLON.Gamepad.POSE_ENABLED) {
-                gamepad.onleftstickchanged(function (stickValues) {
-                    // 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;
+            if (gamepad.type !== BABYLON.Gamepad.POSE_ENABLED) {
+                if (gamepad.leftStick) {
+                    gamepad.onleftstickchanged(function (stickValues) {
+                        // 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 > -_this._padSensibilityDown) {
+                                    if (_this._teleportationAllowed) {
+                                        _this._teleportCamera();
+                                    }
+                                    _this._teleportationRequestInitiated = false;
+                                }
                             }
                             }
                         }
                         }
-                        else {
-                            if (stickValues.y > -_this._padSensibilityDown) {
-                                if (_this._teleportationAllowed) {
-                                    _this._teleportCamera();
+                    });
+                }
+                if (gamepad.rightStick) {
+                    gamepad.onrightstickchanged(function (stickValues) {
+                        if (!_this._rotationLeftAsked) {
+                            if (stickValues.x < -_this._padSensibilityUp) {
+                                _this._rotationLeftAsked = true;
+                                if (_this._rotationAllowed) {
+                                    _this._rotateCamera(false);
                                 }
                                 }
-                                _this._teleportationRequestInitiated = false;
                             }
                             }
                         }
                         }
-                    }
-                });
-            }
-            if (gamepad.rightStick) {
-                gamepad.onrightstickchanged(function (stickValues) {
-                    if (!_this._rotationLeftAsked) {
-                        if (stickValues.x < -_this._padSensibilityUp) {
-                            _this._rotationLeftAsked = true;
-                            if (_this._rotationAllowed) {
-                                _this._rotateCamera(false);
+                        else {
+                            if (stickValues.x > -_this._padSensibilityDown) {
+                                _this._rotationLeftAsked = false;
                             }
                             }
                         }
                         }
-                    }
-                    else {
-                        if (stickValues.x > -_this._padSensibilityDown) {
-                            _this._rotationLeftAsked = false;
+                        if (!_this._rotationRightAsked) {
+                            if (stickValues.x > _this._padSensibilityUp) {
+                                _this._rotationRightAsked = true;
+                                if (_this._rotationAllowed) {
+                                    _this._rotateCamera(true);
+                                }
+                            }
                         }
                         }
-                    }
-                    if (!_this._rotationRightAsked) {
-                        if (stickValues.x > _this._padSensibilityUp) {
-                            _this._rotationRightAsked = true;
-                            if (_this._rotationAllowed) {
-                                _this._rotateCamera(true);
+                        else {
+                            if (stickValues.x < _this._padSensibilityDown) {
+                                _this._rotationRightAsked = false;
                             }
                             }
                         }
                         }
-                    }
-                    else {
-                        if (stickValues.x < _this._padSensibilityDown) {
-                            _this._rotationRightAsked = false;
+                    });
+                }
+                if (gamepad.type === BABYLON.Gamepad.XBOX) {
+                    gamepad.onbuttondown(function (buttonPressed) {
+                        if (buttonPressed === BABYLON.Xbox360Button.A) {
+                            _this._pointerDownOnMeshAsked = true;
+                            if (_this._currentMeshSelected && _this._currentHit) {
+                                _this._scene.simulatePointerDown(_this._currentHit);
+                            }
                         }
                         }
-                    }
-                });
+                    });
+                    gamepad.onbuttonup(function (buttonPressed) {
+                        if (buttonPressed === BABYLON.Xbox360Button.A) {
+                            if (_this._currentMeshSelected && _this._currentHit) {
+                                _this._scene.simulatePointerUp(_this._currentHit);
+                            }
+                            _this._pointerDownOnMeshAsked = false;
+                        }
+                    });
+                }
             }
             }
         };
         };
         VRExperienceHelper.prototype._enableTeleportationOnController = function (webVRController) {
         VRExperienceHelper.prototype._enableTeleportationOnController = function (webVRController) {
@@ -72700,6 +72803,7 @@ var BABYLON;
             var hit = this._scene.pickWithRay(ray, this._raySelectionPredicate);
             var hit = this._scene.pickWithRay(ray, this._raySelectionPredicate);
             // Moving the gazeTracker on the mesh face targetted
             // Moving the gazeTracker on the mesh face targetted
             if (hit && hit.pickedPoint) {
             if (hit && hit.pickedPoint) {
+                this._gazeTracker.isVisible = true;
                 var multiplier = 1;
                 var multiplier = 1;
                 if (this._isActionableMesh) {
                 if (this._isActionableMesh) {
                     multiplier = 3;
                     multiplier = 3;
@@ -72744,8 +72848,14 @@ var BABYLON;
                     this._leftLaserPointer.position.z = -hit.distance / 2;
                     this._leftLaserPointer.position.z = -hit.distance / 2;
                 }
                 }
             }
             }
+            else {
+                this._gazeTracker.isVisible = false;
+            }
             if (hit && hit.pickedMesh) {
             if (hit && hit.pickedMesh) {
                 this._currentHit = hit;
                 this._currentHit = hit;
+                if (this._pointerDownOnMeshAsked) {
+                    this._scene.simulatePointerMove(this._currentHit);
+                }
                 // The object selected is the floor, we're in a teleportation scenario
                 // The object selected is the floor, we're in a teleportation scenario
                 if (hit.pickedMesh.name.indexOf(this._floorMeshName) !== -1 && hit.pickedPoint) {
                 if (hit.pickedMesh.name.indexOf(this._floorMeshName) !== -1 && hit.pickedPoint) {
                     // Moving the teleportation area to this targetted point
                     // Moving the teleportation area to this targetted point
@@ -74844,6 +74954,10 @@ var BABYLON;
                 if (!material) {
                 if (!material) {
                     return;
                     return;
                 }
                 }
+                // Do not block in blend mode.
+                if (material.needAlphaBlendingForMesh(mesh)) {
+                    return;
+                }
                 // Culling
                 // Culling
                 engine.setState(material.backFaceCulling);
                 engine.setState(material.backFaceCulling);
                 // Managing instances
                 // Managing instances
@@ -79334,6 +79448,9 @@ var BABYLON;
             var groundSize = this._options.groundSize;
             var groundSize = this._options.groundSize;
             var skyboxSize = this._options.skyboxSize;
             var skyboxSize = this._options.skyboxSize;
             var rootPosition = this._options.rootPosition;
             var rootPosition = this._options.rootPosition;
+            if (!this._scene.meshes || this._scene.meshes.length === 1) {
+                return { groundSize: groundSize, skyboxSize: skyboxSize, rootPosition: rootPosition };
+            }
             var sceneExtends = this._scene.getWorldExtends();
             var sceneExtends = this._scene.getWorldExtends();
             var sceneDiagonal = sceneExtends.max.subtract(sceneExtends.min);
             var sceneDiagonal = sceneExtends.max.subtract(sceneExtends.min);
             var bias = 0.0001;
             var bias = 0.0001;

文件差异内容过多而无法显示
+ 48 - 48
dist/preview release/babylon.worker.js


文件差异内容过多而无法显示
+ 1380 - 1365
dist/preview release/customConfigurations/minimalGLTFViewer/babylon.d.ts


文件差异内容过多而无法显示
+ 48 - 48
dist/preview release/customConfigurations/minimalGLTFViewer/babylon.js


+ 200 - 77
dist/preview release/customConfigurations/minimalGLTFViewer/babylon.max.js

@@ -1438,10 +1438,10 @@ var BABYLON;
         Vector3.prototype.lengthSquared = function () {
         Vector3.prototype.lengthSquared = function () {
             return (this.x * this.x + this.y * this.y + this.z * this.z);
             return (this.x * this.x + this.y * this.y + this.z * this.z);
         };
         };
-        // Methods
         /**
         /**
          * Normalize the current Vector3.
          * Normalize the current Vector3.
          * Returns the updated Vector3.
          * Returns the updated Vector3.
+         * /!\ In place operation.
          */
          */
         Vector3.prototype.normalize = function () {
         Vector3.prototype.normalize = function () {
             var len = this.length();
             var len = this.length();
@@ -1454,6 +1454,30 @@ var BABYLON;
             return this;
             return this;
         };
         };
         /**
         /**
+         * Normalize the current Vector3 to a new vector.
+         * @returns the new Vector3.
+         */
+        Vector3.prototype.normalizeToNew = function () {
+            var normalized = new Vector3(0, 0, 0);
+            this.normalizeToRef(normalized);
+            return normalized;
+        };
+        /**
+         * Normalize the current Vector3 to the reference.
+         * @param the reference to update.
+         * @returns the updated Vector3.
+         */
+        Vector3.prototype.normalizeToRef = function (reference) {
+            var len = this.length();
+            if (len === 0 || len === 1.0) {
+                reference.set(this.x, this.y, this.z);
+                return reference;
+            }
+            var scale = 1.0 / len;
+            this.scaleToRef(scale, reference);
+            return reference;
+        };
+        /**
          * Returns a new Vector3 copied from the current Vector3.
          * Returns a new Vector3 copied from the current Vector3.
          */
          */
         Vector3.prototype.clone = function () {
         Vector3.prototype.clone = function () {
@@ -10478,17 +10502,21 @@ var BABYLON;
             }
             }
             return internalFormat;
             return internalFormat;
         };
         };
-        Engine.prototype.updateRawTexture = function (texture, data, format, invertY, compression) {
+        Engine.prototype.updateRawTexture = function (texture, data, format, invertY, compression, type) {
             if (compression === void 0) { compression = null; }
             if (compression === void 0) { compression = null; }
+            if (type === void 0) { type = Engine.TEXTURETYPE_UNSIGNED_INT; }
             if (!texture) {
             if (!texture) {
                 return;
                 return;
             }
             }
             var internalFormat = this._getInternalFormat(format);
             var internalFormat = this._getInternalFormat(format);
+            var internalSizedFomat = this._getRGBABufferInternalSizedFormat(type);
+            var textureType = this._getWebGLTextureType(type);
             this._bindTextureDirectly(this._gl.TEXTURE_2D, texture);
             this._bindTextureDirectly(this._gl.TEXTURE_2D, texture);
             this._gl.pixelStorei(this._gl.UNPACK_FLIP_Y_WEBGL, invertY === undefined ? 1 : (invertY ? 1 : 0));
             this._gl.pixelStorei(this._gl.UNPACK_FLIP_Y_WEBGL, invertY === undefined ? 1 : (invertY ? 1 : 0));
             if (!this._doNotHandleContextLost) {
             if (!this._doNotHandleContextLost) {
                 texture._bufferView = data;
                 texture._bufferView = data;
                 texture.format = format;
                 texture.format = format;
+                texture.type = type;
                 texture.invertY = invertY;
                 texture.invertY = invertY;
                 texture._compression = compression;
                 texture._compression = compression;
             }
             }
@@ -10499,7 +10527,7 @@ var BABYLON;
                 this._gl.compressedTexImage2D(this._gl.TEXTURE_2D, 0, this.getCaps().s3tc[compression], texture.width, texture.height, 0, data);
                 this._gl.compressedTexImage2D(this._gl.TEXTURE_2D, 0, this.getCaps().s3tc[compression], texture.width, texture.height, 0, data);
             }
             }
             else {
             else {
-                this._gl.texImage2D(this._gl.TEXTURE_2D, 0, internalFormat, texture.width, texture.height, 0, internalFormat, this._gl.UNSIGNED_BYTE, data);
+                this._gl.texImage2D(this._gl.TEXTURE_2D, 0, internalSizedFomat, texture.width, texture.height, 0, internalFormat, textureType, data);
             }
             }
             if (texture.generateMipMaps) {
             if (texture.generateMipMaps) {
                 this._gl.generateMipmap(this._gl.TEXTURE_2D);
                 this._gl.generateMipmap(this._gl.TEXTURE_2D);
@@ -10508,8 +10536,9 @@ var BABYLON;
             this.resetTextureCache();
             this.resetTextureCache();
             texture.isReady = true;
             texture.isReady = true;
         };
         };
-        Engine.prototype.createRawTexture = function (data, width, height, format, generateMipMaps, invertY, samplingMode, compression) {
+        Engine.prototype.createRawTexture = function (data, width, height, format, generateMipMaps, invertY, samplingMode, compression, type) {
             if (compression === void 0) { compression = null; }
             if (compression === void 0) { compression = null; }
+            if (type === void 0) { type = BABYLON.Engine.TEXTURETYPE_UNSIGNED_INT; }
             var texture = new BABYLON.InternalTexture(this, BABYLON.InternalTexture.DATASOURCE_RAW);
             var texture = new BABYLON.InternalTexture(this, BABYLON.InternalTexture.DATASOURCE_RAW);
             texture.baseWidth = width;
             texture.baseWidth = width;
             texture.baseHeight = height;
             texture.baseHeight = height;
@@ -10520,10 +10549,11 @@ var BABYLON;
             texture.samplingMode = samplingMode;
             texture.samplingMode = samplingMode;
             texture.invertY = invertY;
             texture.invertY = invertY;
             texture._compression = compression;
             texture._compression = compression;
+            texture.type = type;
             if (!this._doNotHandleContextLost) {
             if (!this._doNotHandleContextLost) {
                 texture._bufferView = data;
                 texture._bufferView = data;
             }
             }
-            this.updateRawTexture(texture, data, format, invertY, compression);
+            this.updateRawTexture(texture, data, format, invertY, compression, type);
             this._bindTextureDirectly(this._gl.TEXTURE_2D, texture);
             this._bindTextureDirectly(this._gl.TEXTURE_2D, texture);
             // Filters
             // Filters
             var filters = getSamplingParameters(samplingMode, generateMipMaps, this._gl);
             var filters = getSamplingParameters(samplingMode, generateMipMaps, this._gl);
@@ -18379,7 +18409,7 @@ var BABYLON;
         Object.defineProperty(Scene.prototype, "gamepadManager", {
         Object.defineProperty(Scene.prototype, "gamepadManager", {
             get: function () {
             get: function () {
                 if (!this._gamepadManager) {
                 if (!this._gamepadManager) {
-                    this._gamepadManager = new BABYLON.GamepadManager();
+                    this._gamepadManager = new BABYLON.GamepadManager(this);
                 }
                 }
                 return this._gamepadManager;
                 return this._gamepadManager;
             },
             },
@@ -20676,6 +20706,10 @@ var BABYLON;
                     this.onAfterPhysicsObservable.notifyObservers(this);
                     this.onAfterPhysicsObservable.notifyObservers(this);
                 }
                 }
             }
             }
+            // update gamepad manager
+            if (this._gamepadManager && this._gamepadManager._isMonitoring) {
+                this._gamepadManager._checkGamepadsStatus();
+            }
             // Before render
             // Before render
             this.onBeforeRenderObservable.notifyObservers(this);
             this.onBeforeRenderObservable.notifyObservers(this);
             // Customs render targets
             // Customs render targets
@@ -23669,10 +23703,13 @@ var BABYLON;
          * Returns the Mesh.
          * Returns the Mesh.
          */
          */
         Mesh.prototype.refreshBoundingInfo = function () {
         Mesh.prototype.refreshBoundingInfo = function () {
+            return this._refreshBoundingInfo(false);
+        };
+        Mesh.prototype._refreshBoundingInfo = function (applySkeleton) {
             if (this._boundingInfo && this._boundingInfo.isLocked) {
             if (this._boundingInfo && this._boundingInfo.isLocked) {
                 return this;
                 return this;
             }
             }
-            var data = this.getVerticesData(BABYLON.VertexBuffer.PositionKind);
+            var data = this._getPositionData(applySkeleton);
             if (data) {
             if (data) {
                 var extend = BABYLON.Tools.ExtractMinAndMax(data, 0, this.getTotalVertices());
                 var extend = BABYLON.Tools.ExtractMinAndMax(data, 0, this.getTotalVertices());
                 this._boundingInfo = new BABYLON.BoundingInfo(extend.minimum, extend.maximum);
                 this._boundingInfo = new BABYLON.BoundingInfo(extend.minimum, extend.maximum);
@@ -23685,6 +23722,48 @@ var BABYLON;
             this._updateBoundingInfo();
             this._updateBoundingInfo();
             return this;
             return this;
         };
         };
+        Mesh.prototype._getPositionData = function (applySkeleton) {
+            var data = this.getVerticesData(BABYLON.VertexBuffer.PositionKind);
+            if (data && applySkeleton && this.skeleton) {
+                data = data.slice();
+                var matricesIndicesData = this.getVerticesData(BABYLON.VertexBuffer.MatricesIndicesKind);
+                var matricesWeightsData = this.getVerticesData(BABYLON.VertexBuffer.MatricesWeightsKind);
+                if (matricesWeightsData && matricesIndicesData) {
+                    var needExtras = this.numBoneInfluencers > 4;
+                    var matricesIndicesExtraData = needExtras ? this.getVerticesData(BABYLON.VertexBuffer.MatricesIndicesExtraKind) : null;
+                    var matricesWeightsExtraData = needExtras ? this.getVerticesData(BABYLON.VertexBuffer.MatricesWeightsExtraKind) : null;
+                    var skeletonMatrices = this.skeleton.getTransformMatrices(this);
+                    var tempVector = BABYLON.Tmp.Vector3[0];
+                    var finalMatrix = BABYLON.Tmp.Matrix[0];
+                    var tempMatrix = BABYLON.Tmp.Matrix[1];
+                    var matWeightIdx = 0;
+                    for (var index = 0; index < data.length; index += 3, matWeightIdx += 4) {
+                        finalMatrix.reset();
+                        var inf;
+                        var weight;
+                        for (inf = 0; inf < 4; inf++) {
+                            weight = matricesWeightsData[matWeightIdx + inf];
+                            if (weight <= 0)
+                                break;
+                            BABYLON.Matrix.FromFloat32ArrayToRefScaled(skeletonMatrices, matricesIndicesData[matWeightIdx + inf] * 16, weight, tempMatrix);
+                            finalMatrix.addToSelf(tempMatrix);
+                        }
+                        if (needExtras) {
+                            for (inf = 0; inf < 4; inf++) {
+                                weight = matricesWeightsExtraData[matWeightIdx + inf];
+                                if (weight <= 0)
+                                    break;
+                                BABYLON.Matrix.FromFloat32ArrayToRefScaled(skeletonMatrices, matricesIndicesExtraData[matWeightIdx + inf] * 16, weight, tempMatrix);
+                                finalMatrix.addToSelf(tempMatrix);
+                            }
+                        }
+                        BABYLON.Vector3.TransformCoordinatesFromFloatsToRef(data[index], data[index + 1], data[index + 2], finalMatrix, tempVector);
+                        tempVector.toArray(data, index);
+                    }
+                }
+            }
+            return data;
+        };
         Mesh.prototype._createGlobalSubMesh = function (force) {
         Mesh.prototype._createGlobalSubMesh = function (force) {
             var totalVertices = this.getTotalVertices();
             var totalVertices = this.getTotalVertices();
             if (!totalVertices || !this.getIndices()) {
             if (!totalVertices || !this.getIndices()) {
@@ -25802,9 +25881,6 @@ var BABYLON;
             var needExtras = this.numBoneInfluencers > 4;
             var needExtras = this.numBoneInfluencers > 4;
             var matricesIndicesExtraData = needExtras ? this.getVerticesData(BABYLON.VertexBuffer.MatricesIndicesExtraKind) : null;
             var matricesIndicesExtraData = needExtras ? this.getVerticesData(BABYLON.VertexBuffer.MatricesIndicesExtraKind) : null;
             var matricesWeightsExtraData = needExtras ? this.getVerticesData(BABYLON.VertexBuffer.MatricesWeightsExtraKind) : null;
             var matricesWeightsExtraData = needExtras ? this.getVerticesData(BABYLON.VertexBuffer.MatricesWeightsExtraKind) : null;
-            if (!matricesWeightsExtraData || !matricesIndicesExtraData) {
-                return this;
-            }
             var skeletonMatrices = skeleton.getTransformMatrices(this);
             var skeletonMatrices = skeleton.getTransformMatrices(this);
             var tempVector3 = BABYLON.Vector3.Zero();
             var tempVector3 = BABYLON.Vector3.Zero();
             var finalMatrix = new BABYLON.Matrix();
             var finalMatrix = new BABYLON.Matrix();
@@ -35694,12 +35770,12 @@ var BABYLON;
              * This parameters will enable/disable Horizon occlusion to prevent normal maps to look shiny when the normal
              * This parameters will enable/disable Horizon occlusion to prevent normal maps to look shiny when the normal
              * makes the reflect vector face the model (under horizon).
              * makes the reflect vector face the model (under horizon).
              */
              */
-            _this._useHorizonOcclusion = false; // USEHORIZONOCCLUSION
+            _this._useHorizonOcclusion = true;
             /**
             /**
              * This parameters will enable/disable radiance occlusion by preventing the radiance to lit
              * This parameters will enable/disable radiance occlusion by preventing the radiance to lit
              * too much the area relying on ambient texture to define their ambient occlusion.
              * too much the area relying on ambient texture to define their ambient occlusion.
              */
              */
-            _this._useRadianceOcclusion = false;
+            _this._useRadianceOcclusion = true;
             /**
             /**
              * Specifies that the alpha is coming form the albedo channel alpha channel for alpha blending.
              * Specifies that the alpha is coming form the albedo channel alpha channel for alpha blending.
              */
              */
@@ -37098,12 +37174,12 @@ var BABYLON;
              * This parameters will enable/disable Horizon occlusion to prevent normal maps to look shiny when the normal
              * This parameters will enable/disable Horizon occlusion to prevent normal maps to look shiny when the normal
              * makes the reflect vector face the model (under horizon).
              * makes the reflect vector face the model (under horizon).
              */
              */
-            _this.useHorizonOcclusion = false;
+            _this.useHorizonOcclusion = true;
             /**
             /**
              * This parameters will enable/disable radiance occlusion by preventing the radiance to lit
              * This parameters will enable/disable radiance occlusion by preventing the radiance to lit
              * too much the area relying on ambient texture to define their ambient occlusion.
              * too much the area relying on ambient texture to define their ambient occlusion.
              */
              */
-            _this.useRadianceOcclusion = false;
+            _this.useRadianceOcclusion = true;
             _this._environmentBRDFTexture = BABYLON.TextureTools.GetEnvironmentBRDFTexture(scene);
             _this._environmentBRDFTexture = BABYLON.TextureTools.GetEnvironmentBRDFTexture(scene);
             return _this;
             return _this;
         }
         }
@@ -51566,14 +51642,15 @@ var BABYLON;
 (function (BABYLON) {
 (function (BABYLON) {
     var RawTexture = /** @class */ (function (_super) {
     var RawTexture = /** @class */ (function (_super) {
         __extends(RawTexture, _super);
         __extends(RawTexture, _super);
-        function RawTexture(data, width, height, format, scene, generateMipMaps, invertY, samplingMode) {
+        function RawTexture(data, width, height, format, scene, generateMipMaps, invertY, samplingMode, type) {
             if (generateMipMaps === void 0) { generateMipMaps = true; }
             if (generateMipMaps === void 0) { generateMipMaps = true; }
             if (invertY === void 0) { invertY = false; }
             if (invertY === void 0) { invertY = false; }
             if (samplingMode === void 0) { samplingMode = BABYLON.Texture.TRILINEAR_SAMPLINGMODE; }
             if (samplingMode === void 0) { samplingMode = BABYLON.Texture.TRILINEAR_SAMPLINGMODE; }
+            if (type === void 0) { type = BABYLON.Engine.TEXTURETYPE_UNSIGNED_INT; }
             var _this = _super.call(this, null, scene, !generateMipMaps, invertY) || this;
             var _this = _super.call(this, null, scene, !generateMipMaps, invertY) || this;
             _this.format = format;
             _this.format = format;
             _this._engine = scene.getEngine();
             _this._engine = scene.getEngine();
-            _this._texture = scene.getEngine().createRawTexture(data, width, height, format, generateMipMaps, invertY, samplingMode);
+            _this._texture = scene.getEngine().createRawTexture(data, width, height, format, generateMipMaps, invertY, samplingMode, null, type);
             _this.wrapU = BABYLON.Texture.CLAMP_ADDRESSMODE;
             _this.wrapU = BABYLON.Texture.CLAMP_ADDRESSMODE;
             _this.wrapV = BABYLON.Texture.CLAMP_ADDRESSMODE;
             _this.wrapV = BABYLON.Texture.CLAMP_ADDRESSMODE;
             return _this;
             return _this;
@@ -51600,17 +51677,19 @@ var BABYLON;
             if (samplingMode === void 0) { samplingMode = BABYLON.Texture.TRILINEAR_SAMPLINGMODE; }
             if (samplingMode === void 0) { samplingMode = BABYLON.Texture.TRILINEAR_SAMPLINGMODE; }
             return new RawTexture(data, width, height, BABYLON.Engine.TEXTUREFORMAT_ALPHA, scene, generateMipMaps, invertY, samplingMode);
             return new RawTexture(data, width, height, BABYLON.Engine.TEXTUREFORMAT_ALPHA, scene, generateMipMaps, invertY, samplingMode);
         };
         };
-        RawTexture.CreateRGBTexture = function (data, width, height, scene, generateMipMaps, invertY, samplingMode) {
+        RawTexture.CreateRGBTexture = function (data, width, height, scene, generateMipMaps, invertY, samplingMode, type) {
             if (generateMipMaps === void 0) { generateMipMaps = true; }
             if (generateMipMaps === void 0) { generateMipMaps = true; }
             if (invertY === void 0) { invertY = false; }
             if (invertY === void 0) { invertY = false; }
             if (samplingMode === void 0) { samplingMode = BABYLON.Texture.TRILINEAR_SAMPLINGMODE; }
             if (samplingMode === void 0) { samplingMode = BABYLON.Texture.TRILINEAR_SAMPLINGMODE; }
-            return new RawTexture(data, width, height, BABYLON.Engine.TEXTUREFORMAT_RGB, scene, generateMipMaps, invertY, samplingMode);
+            if (type === void 0) { type = BABYLON.Engine.TEXTURETYPE_UNSIGNED_INT; }
+            return new RawTexture(data, width, height, BABYLON.Engine.TEXTUREFORMAT_RGB, scene, generateMipMaps, invertY, samplingMode, type);
         };
         };
-        RawTexture.CreateRGBATexture = function (data, width, height, scene, generateMipMaps, invertY, samplingMode) {
+        RawTexture.CreateRGBATexture = function (data, width, height, scene, generateMipMaps, invertY, samplingMode, type) {
             if (generateMipMaps === void 0) { generateMipMaps = true; }
             if (generateMipMaps === void 0) { generateMipMaps = true; }
             if (invertY === void 0) { invertY = false; }
             if (invertY === void 0) { invertY = false; }
             if (samplingMode === void 0) { samplingMode = BABYLON.Texture.TRILINEAR_SAMPLINGMODE; }
             if (samplingMode === void 0) { samplingMode = BABYLON.Texture.TRILINEAR_SAMPLINGMODE; }
-            return new RawTexture(data, width, height, BABYLON.Engine.TEXTUREFORMAT_RGBA, scene, generateMipMaps, invertY, samplingMode);
+            if (type === void 0) { type = BABYLON.Engine.TEXTURETYPE_UNSIGNED_INT; }
+            return new RawTexture(data, width, height, BABYLON.Engine.TEXTUREFORMAT_RGBA, scene, generateMipMaps, invertY, samplingMode, type);
         };
         };
         return RawTexture;
         return RawTexture;
     }(BABYLON.Texture));
     }(BABYLON.Texture));
@@ -56120,8 +56199,9 @@ var BABYLON;
 var BABYLON;
 var BABYLON;
 (function (BABYLON) {
 (function (BABYLON) {
     var GamepadManager = /** @class */ (function () {
     var GamepadManager = /** @class */ (function () {
-        function GamepadManager() {
+        function GamepadManager(_scene) {
             var _this = this;
             var _this = this;
+            this._scene = _scene;
             this._babylonGamepads = [];
             this._babylonGamepads = [];
             this._oneGamepadConnected = false;
             this._oneGamepadConnected = false;
             this._isMonitoring = false;
             this._isMonitoring = false;
@@ -56248,7 +56328,10 @@ var BABYLON;
         GamepadManager.prototype._startMonitoringGamepads = function () {
         GamepadManager.prototype._startMonitoringGamepads = function () {
             if (!this._isMonitoring) {
             if (!this._isMonitoring) {
                 this._isMonitoring = true;
                 this._isMonitoring = true;
-                this._checkGamepadsStatus();
+                //back-comp
+                if (!this._scene) {
+                    this._checkGamepadsStatus();
+                }
             }
             }
         };
         };
         GamepadManager.prototype._stopMonitoringGamepads = function () {
         GamepadManager.prototype._stopMonitoringGamepads = function () {
@@ -56265,7 +56348,7 @@ var BABYLON;
                 }
                 }
                 gamepad.update();
                 gamepad.update();
             }
             }
-            if (this._isMonitoring) {
+            if (this._isMonitoring && !this._scene) {
                 BABYLON.Tools.QueueNewFrame(function () { _this._checkGamepadsStatus(); });
                 BABYLON.Tools.QueueNewFrame(function () { _this._checkGamepadsStatus(); });
             }
             }
         };
         };
@@ -72141,57 +72224,77 @@ var BABYLON;
         };
         };
         VRExperienceHelper.prototype._onNewGamepadConnected = function (gamepad) {
         VRExperienceHelper.prototype._onNewGamepadConnected = function (gamepad) {
             var _this = this;
             var _this = this;
-            if (gamepad.leftStick && gamepad.type !== BABYLON.Gamepad.POSE_ENABLED) {
-                gamepad.onleftstickchanged(function (stickValues) {
-                    // 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;
+            if (gamepad.type !== BABYLON.Gamepad.POSE_ENABLED) {
+                if (gamepad.leftStick) {
+                    gamepad.onleftstickchanged(function (stickValues) {
+                        // 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 > -_this._padSensibilityDown) {
+                                    if (_this._teleportationAllowed) {
+                                        _this._teleportCamera();
+                                    }
+                                    _this._teleportationRequestInitiated = false;
+                                }
                             }
                             }
                         }
                         }
-                        else {
-                            if (stickValues.y > -_this._padSensibilityDown) {
-                                if (_this._teleportationAllowed) {
-                                    _this._teleportCamera();
+                    });
+                }
+                if (gamepad.rightStick) {
+                    gamepad.onrightstickchanged(function (stickValues) {
+                        if (!_this._rotationLeftAsked) {
+                            if (stickValues.x < -_this._padSensibilityUp) {
+                                _this._rotationLeftAsked = true;
+                                if (_this._rotationAllowed) {
+                                    _this._rotateCamera(false);
                                 }
                                 }
-                                _this._teleportationRequestInitiated = false;
                             }
                             }
                         }
                         }
-                    }
-                });
-            }
-            if (gamepad.rightStick) {
-                gamepad.onrightstickchanged(function (stickValues) {
-                    if (!_this._rotationLeftAsked) {
-                        if (stickValues.x < -_this._padSensibilityUp) {
-                            _this._rotationLeftAsked = true;
-                            if (_this._rotationAllowed) {
-                                _this._rotateCamera(false);
+                        else {
+                            if (stickValues.x > -_this._padSensibilityDown) {
+                                _this._rotationLeftAsked = false;
                             }
                             }
                         }
                         }
-                    }
-                    else {
-                        if (stickValues.x > -_this._padSensibilityDown) {
-                            _this._rotationLeftAsked = false;
+                        if (!_this._rotationRightAsked) {
+                            if (stickValues.x > _this._padSensibilityUp) {
+                                _this._rotationRightAsked = true;
+                                if (_this._rotationAllowed) {
+                                    _this._rotateCamera(true);
+                                }
+                            }
                         }
                         }
-                    }
-                    if (!_this._rotationRightAsked) {
-                        if (stickValues.x > _this._padSensibilityUp) {
-                            _this._rotationRightAsked = true;
-                            if (_this._rotationAllowed) {
-                                _this._rotateCamera(true);
+                        else {
+                            if (stickValues.x < _this._padSensibilityDown) {
+                                _this._rotationRightAsked = false;
                             }
                             }
                         }
                         }
-                    }
-                    else {
-                        if (stickValues.x < _this._padSensibilityDown) {
-                            _this._rotationRightAsked = false;
+                    });
+                }
+                if (gamepad.type === BABYLON.Gamepad.XBOX) {
+                    gamepad.onbuttondown(function (buttonPressed) {
+                        if (buttonPressed === BABYLON.Xbox360Button.A) {
+                            _this._pointerDownOnMeshAsked = true;
+                            if (_this._currentMeshSelected && _this._currentHit) {
+                                _this._scene.simulatePointerDown(_this._currentHit);
+                            }
                         }
                         }
-                    }
-                });
+                    });
+                    gamepad.onbuttonup(function (buttonPressed) {
+                        if (buttonPressed === BABYLON.Xbox360Button.A) {
+                            if (_this._currentMeshSelected && _this._currentHit) {
+                                _this._scene.simulatePointerUp(_this._currentHit);
+                            }
+                            _this._pointerDownOnMeshAsked = false;
+                        }
+                    });
+                }
             }
             }
         };
         };
         VRExperienceHelper.prototype._enableTeleportationOnController = function (webVRController) {
         VRExperienceHelper.prototype._enableTeleportationOnController = function (webVRController) {
@@ -72546,6 +72649,7 @@ var BABYLON;
             var hit = this._scene.pickWithRay(ray, this._raySelectionPredicate);
             var hit = this._scene.pickWithRay(ray, this._raySelectionPredicate);
             // Moving the gazeTracker on the mesh face targetted
             // Moving the gazeTracker on the mesh face targetted
             if (hit && hit.pickedPoint) {
             if (hit && hit.pickedPoint) {
+                this._gazeTracker.isVisible = true;
                 var multiplier = 1;
                 var multiplier = 1;
                 if (this._isActionableMesh) {
                 if (this._isActionableMesh) {
                     multiplier = 3;
                     multiplier = 3;
@@ -72590,8 +72694,14 @@ var BABYLON;
                     this._leftLaserPointer.position.z = -hit.distance / 2;
                     this._leftLaserPointer.position.z = -hit.distance / 2;
                 }
                 }
             }
             }
+            else {
+                this._gazeTracker.isVisible = false;
+            }
             if (hit && hit.pickedMesh) {
             if (hit && hit.pickedMesh) {
                 this._currentHit = hit;
                 this._currentHit = hit;
+                if (this._pointerDownOnMeshAsked) {
+                    this._scene.simulatePointerMove(this._currentHit);
+                }
                 // The object selected is the floor, we're in a teleportation scenario
                 // The object selected is the floor, we're in a teleportation scenario
                 if (hit.pickedMesh.name.indexOf(this._floorMeshName) !== -1 && hit.pickedPoint) {
                 if (hit.pickedMesh.name.indexOf(this._floorMeshName) !== -1 && hit.pickedPoint) {
                     // Moving the teleportation area to this targetted point
                     // Moving the teleportation area to this targetted point
@@ -74690,6 +74800,10 @@ var BABYLON;
                 if (!material) {
                 if (!material) {
                     return;
                     return;
                 }
                 }
+                // Do not block in blend mode.
+                if (material.needAlphaBlendingForMesh(mesh)) {
+                    return;
+                }
                 // Culling
                 // Culling
                 engine.setState(material.backFaceCulling);
                 engine.setState(material.backFaceCulling);
                 // Managing instances
                 // Managing instances
@@ -78848,6 +78962,9 @@ var BABYLON;
             var groundSize = this._options.groundSize;
             var groundSize = this._options.groundSize;
             var skyboxSize = this._options.skyboxSize;
             var skyboxSize = this._options.skyboxSize;
             var rootPosition = this._options.rootPosition;
             var rootPosition = this._options.rootPosition;
+            if (!this._scene.meshes || this._scene.meshes.length === 1) {
+                return { groundSize: groundSize, skyboxSize: skyboxSize, rootPosition: rootPosition };
+            }
             var sceneExtends = this._scene.getWorldExtends();
             var sceneExtends = this._scene.getWorldExtends();
             var sceneDiagonal = sceneExtends.max.subtract(sceneExtends.min);
             var sceneDiagonal = sceneExtends.max.subtract(sceneExtends.min);
             var bias = 0.0001;
             var bias = 0.0001;
@@ -81910,8 +82027,9 @@ var BABYLON;
                 switch (this._parent.coordinateSystemMode) {
                 switch (this._parent.coordinateSystemMode) {
                     case BABYLON.GLTFLoaderCoordinateSystemMode.AUTO: {
                     case BABYLON.GLTFLoaderCoordinateSystemMode.AUTO: {
                         if (!this._babylonScene.useRightHandedSystem) {
                         if (!this._babylonScene.useRightHandedSystem) {
-                            this._rootNode.babylonMesh.rotation = new BABYLON.Vector3(0, Math.PI, 0);
-                            this._rootNode.babylonMesh.scaling = new BABYLON.Vector3(1, 1, -1);
+                            this._rootNode.rotation = [0, 1, 0, 0];
+                            this._rootNode.scale = [1, 1, -1];
+                            this._loadTransform(this._rootNode);
                         }
                         }
                         break;
                         break;
                     }
                     }
@@ -81975,15 +82093,22 @@ var BABYLON;
                     }
                     }
                     this._loadMesh("#/meshes/" + node.mesh, node, mesh);
                     this._loadMesh("#/meshes/" + node.mesh, node, mesh);
                 }
                 }
-                node.babylonMesh.parent = node.parent ? node.parent.babylonMesh : null;
+                node.babylonMesh.parent = node.parent.babylonMesh;
                 node.babylonAnimationTargets = node.babylonAnimationTargets || [];
                 node.babylonAnimationTargets = node.babylonAnimationTargets || [];
                 node.babylonAnimationTargets.push(node.babylonMesh);
                 node.babylonAnimationTargets.push(node.babylonMesh);
                 if (node.skin != null) {
                 if (node.skin != null) {
-                    var skin = GLTFLoader._GetProperty(this._gltf.skins, node.skin);
-                    if (!skin) {
+                    var skin_1 = GLTFLoader._GetProperty(this._gltf.skins, node.skin);
+                    if (!skin_1) {
                         throw new Error(context + ": Failed to find skin " + node.skin);
                         throw new Error(context + ": Failed to find skin " + node.skin);
                     }
                     }
-                    node.babylonMesh.skeleton = this._loadSkin("#/skins/" + node.skin, skin);
+                    this._loadSkinAsync("#/skins/" + node.skin, skin_1, function () {
+                        node.babylonMesh.skeleton = skin_1.babylonSkeleton;
+                        node.babylonMesh._refreshBoundingInfo(true);
+                    });
+                    node.babylonMesh.parent = this._rootNode.babylonMesh;
+                    node.babylonMesh.position = BABYLON.Vector3.Zero();
+                    node.babylonMesh.rotationQuaternion = BABYLON.Quaternion.Identity();
+                    node.babylonMesh.scaling = BABYLON.Vector3.One();
                 }
                 }
                 if (node.camera != null) {
                 if (node.camera != null) {
                     // TODO: handle cameras
                     // TODO: handle cameras
@@ -82377,15 +82502,17 @@ var BABYLON;
                 node.babylonMesh.rotationQuaternion = rotation;
                 node.babylonMesh.rotationQuaternion = rotation;
                 node.babylonMesh.scaling = scaling;
                 node.babylonMesh.scaling = scaling;
             };
             };
-            GLTFLoader.prototype._loadSkin = function (context, skin) {
+            GLTFLoader.prototype._loadSkinAsync = function (context, skin, onSuccess) {
                 var _this = this;
                 var _this = this;
                 if (skin.babylonSkeleton) {
                 if (skin.babylonSkeleton) {
-                    return skin.babylonSkeleton;
+                    onSuccess();
+                    return;
                 }
                 }
                 var skeletonId = "skeleton" + skin.index;
                 var skeletonId = "skeleton" + skin.index;
                 skin.babylonSkeleton = new BABYLON.Skeleton(skin.name || skeletonId, skeletonId, this._babylonScene);
                 skin.babylonSkeleton = new BABYLON.Skeleton(skin.name || skeletonId, skeletonId, this._babylonScene);
                 if (skin.inverseBindMatrices == null) {
                 if (skin.inverseBindMatrices == null) {
                     this._loadBones(context, skin, null);
                     this._loadBones(context, skin, null);
+                    onSuccess();
                 }
                 }
                 else {
                 else {
                     var accessor = GLTFLoader._GetProperty(this._gltf.accessors, skin.inverseBindMatrices);
                     var accessor = GLTFLoader._GetProperty(this._gltf.accessors, skin.inverseBindMatrices);
@@ -82394,14 +82521,12 @@ var BABYLON;
                     }
                     }
                     this._loadAccessorAsync("#/accessors/" + accessor.index, accessor, function (data) {
                     this._loadAccessorAsync("#/accessors/" + accessor.index, accessor, function (data) {
                         _this._loadBones(context, skin, data);
                         _this._loadBones(context, skin, data);
+                        onSuccess();
                     });
                     });
                 }
                 }
-                return skin.babylonSkeleton;
             };
             };
             GLTFLoader.prototype._createBone = function (node, skin, parent, localMatrix, baseMatrix, index) {
             GLTFLoader.prototype._createBone = function (node, skin, parent, localMatrix, baseMatrix, index) {
                 var babylonBone = new BABYLON.Bone(node.name || "bone" + node.index, skin.babylonSkeleton, parent, localMatrix, null, baseMatrix, index);
                 var babylonBone = new BABYLON.Bone(node.name || "bone" + node.index, skin.babylonSkeleton, parent, localMatrix, null, baseMatrix, index);
-                node.babylonBones = node.babylonBones || {};
-                node.babylonBones[skin.index] = babylonBone;
                 node.babylonAnimationTargets = node.babylonAnimationTargets || [];
                 node.babylonAnimationTargets = node.babylonAnimationTargets || [];
                 node.babylonAnimationTargets.push(babylonBone);
                 node.babylonAnimationTargets.push(babylonBone);
                 return babylonBone;
                 return babylonBone;
@@ -82429,7 +82554,7 @@ var BABYLON;
                     baseMatrix.invertToRef(baseMatrix);
                     baseMatrix.invertToRef(baseMatrix);
                 }
                 }
                 var babylonParentBone = null;
                 var babylonParentBone = null;
-                if (node.index !== skin.skeleton && node.parent && node.parent !== this._rootNode) {
+                if (node.parent !== this._rootNode) {
                     babylonParentBone = this._loadBone(node.parent, skin, inverseBindMatrixData, babylonBones);
                     babylonParentBone = this._loadBone(node.parent, skin, inverseBindMatrixData, babylonBones);
                     baseMatrix.multiplyToRef(babylonParentBone.getInvertedAbsoluteTransform(), baseMatrix);
                     baseMatrix.multiplyToRef(babylonParentBone.getInvertedAbsoluteTransform(), baseMatrix);
                 }
                 }
@@ -82443,7 +82568,6 @@ var BABYLON;
                     BABYLON.Matrix.Compose(node.scale ? BABYLON.Vector3.FromArray(node.scale) : BABYLON.Vector3.One(), node.rotation ? BABYLON.Quaternion.FromArray(node.rotation) : BABYLON.Quaternion.Identity(), node.translation ? BABYLON.Vector3.FromArray(node.translation) : BABYLON.Vector3.Zero());
                     BABYLON.Matrix.Compose(node.scale ? BABYLON.Vector3.FromArray(node.scale) : BABYLON.Vector3.One(), node.rotation ? BABYLON.Quaternion.FromArray(node.rotation) : BABYLON.Quaternion.Identity(), node.translation ? BABYLON.Vector3.FromArray(node.translation) : BABYLON.Vector3.Zero());
             };
             };
             GLTFLoader.prototype._traverseNodes = function (context, indices, action, parentNode) {
             GLTFLoader.prototype._traverseNodes = function (context, indices, action, parentNode) {
-                if (parentNode === void 0) { parentNode = null; }
                 for (var _i = 0, indices_1 = indices; _i < indices_1.length; _i++) {
                 for (var _i = 0, indices_1 = indices; _i < indices_1.length; _i++) {
                     var index = indices_1[_i];
                     var index = indices_1[_i];
                     var node = GLTFLoader._GetProperty(this._gltf.nodes, index);
                     var node = GLTFLoader._GetProperty(this._gltf.nodes, index);
@@ -82454,7 +82578,6 @@ var BABYLON;
                 }
                 }
             };
             };
             GLTFLoader.prototype._traverseNode = function (context, node, action, parentNode) {
             GLTFLoader.prototype._traverseNode = function (context, node, action, parentNode) {
-                if (parentNode === void 0) { parentNode = null; }
                 if (GLTF2.GLTFLoaderExtension.TraverseNode(this, context, node, action, parentNode)) {
                 if (GLTF2.GLTFLoaderExtension.TraverseNode(this, context, node, action, parentNode)) {
                     return;
                     return;
                 }
                 }

文件差异内容过多而无法显示
+ 4 - 447
dist/preview release/inspector/babylon.inspector.bundle.js


+ 6 - 9
dist/preview release/loaders/babylon.glTF2FileLoader.d.ts

@@ -245,11 +245,8 @@ declare module BABYLON.GLTF2 {
         translation?: number[];
         translation?: number[];
         weights?: number[];
         weights?: number[];
         index: number;
         index: number;
-        parent?: IGLTFNode;
+        parent: IGLTFNode;
         babylonMesh: Mesh;
         babylonMesh: Mesh;
-        babylonBones?: {
-            [skin: number]: Bone;
-        };
         babylonAnimationTargets?: Node[];
         babylonAnimationTargets?: Node[];
     }
     }
     interface IGLTFSampler extends IGLTFChildRootProperty {
     interface IGLTFSampler extends IGLTFChildRootProperty {
@@ -364,13 +361,13 @@ declare module BABYLON.GLTF2 {
         private _loadAllMorphTargetVertexDataAsync(context, node, mesh, onSuccess);
         private _loadAllMorphTargetVertexDataAsync(context, node, mesh, onSuccess);
         private _loadMorphTargetVertexDataAsync(context, vertexData, attributes, onSuccess);
         private _loadMorphTargetVertexDataAsync(context, vertexData, attributes, onSuccess);
         private _loadTransform(node);
         private _loadTransform(node);
-        private _loadSkin(context, skin);
+        private _loadSkinAsync(context, skin, onSuccess);
         private _createBone(node, skin, parent, localMatrix, baseMatrix, index);
         private _createBone(node, skin, parent, localMatrix, baseMatrix, index);
         private _loadBones(context, skin, inverseBindMatrixData);
         private _loadBones(context, skin, inverseBindMatrixData);
         private _loadBone(node, skin, inverseBindMatrixData, babylonBones);
         private _loadBone(node, skin, inverseBindMatrixData, babylonBones);
         private _getNodeMatrix(node);
         private _getNodeMatrix(node);
-        private _traverseNodes(context, indices, action, parentNode?);
-        _traverseNode(context: string, node: IGLTFNode, action: (node: IGLTFNode, parentNode: Nullable<IGLTFNode>) => boolean, parentNode?: Nullable<IGLTFNode>): void;
+        private _traverseNodes(context, indices, action, parentNode);
+        _traverseNode(context: string, node: IGLTFNode, action: (node: IGLTFNode, parentNode: IGLTFNode) => boolean, parentNode: IGLTFNode): void;
         private _loadAnimations();
         private _loadAnimations();
         private _loadAnimation(context, animation);
         private _loadAnimation(context, animation);
         private _loadAnimationChannel(animation, channelContext, channel, samplerContext, sampler);
         private _loadAnimationChannel(animation, channelContext, channel, samplerContext, sampler);
@@ -429,12 +426,12 @@ declare module BABYLON.GLTF2 {
     abstract class GLTFLoaderExtension {
     abstract class GLTFLoaderExtension {
         enabled: boolean;
         enabled: boolean;
         readonly abstract name: string;
         readonly abstract name: string;
-        protected _traverseNode(loader: GLTFLoader, context: string, node: IGLTFNode, action: (node: IGLTFNode, parentNode: IGLTFNode) => boolean, parentNode: Nullable<IGLTFNode>): boolean;
+        protected _traverseNode(loader: GLTFLoader, context: string, node: IGLTFNode, action: (node: IGLTFNode, parentNode: IGLTFNode) => boolean, parentNode: IGLTFNode): boolean;
         protected _loadNode(loader: GLTFLoader, context: string, node: IGLTFNode): boolean;
         protected _loadNode(loader: GLTFLoader, context: string, node: IGLTFNode): boolean;
         protected _loadMaterial(loader: GLTFLoader, context: string, material: IGLTFMaterial, assign: (babylonMaterial: Material, isNew: boolean) => void): boolean;
         protected _loadMaterial(loader: GLTFLoader, context: string, material: IGLTFMaterial, assign: (babylonMaterial: Material, isNew: boolean) => void): boolean;
         protected _loadExtension<T>(context: string, property: IGLTFProperty, action: (context: string, extension: T, onComplete: () => void) => void): boolean;
         protected _loadExtension<T>(context: string, property: IGLTFProperty, action: (context: string, extension: T, onComplete: () => void) => void): boolean;
         static _Extensions: GLTFLoaderExtension[];
         static _Extensions: GLTFLoaderExtension[];
-        static TraverseNode(loader: GLTFLoader, context: string, node: IGLTFNode, action: (node: IGLTFNode, parentNode: IGLTFNode) => boolean, parentNode: Nullable<IGLTFNode>): boolean;
+        static TraverseNode(loader: GLTFLoader, context: string, node: IGLTFNode, action: (node: IGLTFNode, parentNode: IGLTFNode) => boolean, parentNode: IGLTFNode): boolean;
         static LoadNode(loader: GLTFLoader, context: string, node: IGLTFNode): boolean;
         static LoadNode(loader: GLTFLoader, context: string, node: IGLTFNode): boolean;
         static LoadMaterial(loader: GLTFLoader, context: string, material: IGLTFMaterial, assign: (babylonMaterial: Material, isNew: boolean) => void): boolean;
         static LoadMaterial(loader: GLTFLoader, context: string, material: IGLTFMaterial, assign: (babylonMaterial: Material, isNew: boolean) => void): boolean;
         private static _ApplyExtensions(action);
         private static _ApplyExtensions(action);

+ 20 - 14
dist/preview release/loaders/babylon.glTF2FileLoader.js

@@ -536,8 +536,9 @@ var BABYLON;
                 switch (this._parent.coordinateSystemMode) {
                 switch (this._parent.coordinateSystemMode) {
                     case BABYLON.GLTFLoaderCoordinateSystemMode.AUTO: {
                     case BABYLON.GLTFLoaderCoordinateSystemMode.AUTO: {
                         if (!this._babylonScene.useRightHandedSystem) {
                         if (!this._babylonScene.useRightHandedSystem) {
-                            this._rootNode.babylonMesh.rotation = new BABYLON.Vector3(0, Math.PI, 0);
-                            this._rootNode.babylonMesh.scaling = new BABYLON.Vector3(1, 1, -1);
+                            this._rootNode.rotation = [0, 1, 0, 0];
+                            this._rootNode.scale = [1, 1, -1];
+                            this._loadTransform(this._rootNode);
                         }
                         }
                         break;
                         break;
                     }
                     }
@@ -601,15 +602,22 @@ var BABYLON;
                     }
                     }
                     this._loadMesh("#/meshes/" + node.mesh, node, mesh);
                     this._loadMesh("#/meshes/" + node.mesh, node, mesh);
                 }
                 }
-                node.babylonMesh.parent = node.parent ? node.parent.babylonMesh : null;
+                node.babylonMesh.parent = node.parent.babylonMesh;
                 node.babylonAnimationTargets = node.babylonAnimationTargets || [];
                 node.babylonAnimationTargets = node.babylonAnimationTargets || [];
                 node.babylonAnimationTargets.push(node.babylonMesh);
                 node.babylonAnimationTargets.push(node.babylonMesh);
                 if (node.skin != null) {
                 if (node.skin != null) {
-                    var skin = GLTFLoader._GetProperty(this._gltf.skins, node.skin);
-                    if (!skin) {
+                    var skin_1 = GLTFLoader._GetProperty(this._gltf.skins, node.skin);
+                    if (!skin_1) {
                         throw new Error(context + ": Failed to find skin " + node.skin);
                         throw new Error(context + ": Failed to find skin " + node.skin);
                     }
                     }
-                    node.babylonMesh.skeleton = this._loadSkin("#/skins/" + node.skin, skin);
+                    this._loadSkinAsync("#/skins/" + node.skin, skin_1, function () {
+                        node.babylonMesh.skeleton = skin_1.babylonSkeleton;
+                        node.babylonMesh._refreshBoundingInfo(true);
+                    });
+                    node.babylonMesh.parent = this._rootNode.babylonMesh;
+                    node.babylonMesh.position = BABYLON.Vector3.Zero();
+                    node.babylonMesh.rotationQuaternion = BABYLON.Quaternion.Identity();
+                    node.babylonMesh.scaling = BABYLON.Vector3.One();
                 }
                 }
                 if (node.camera != null) {
                 if (node.camera != null) {
                     // TODO: handle cameras
                     // TODO: handle cameras
@@ -1003,15 +1011,17 @@ var BABYLON;
                 node.babylonMesh.rotationQuaternion = rotation;
                 node.babylonMesh.rotationQuaternion = rotation;
                 node.babylonMesh.scaling = scaling;
                 node.babylonMesh.scaling = scaling;
             };
             };
-            GLTFLoader.prototype._loadSkin = function (context, skin) {
+            GLTFLoader.prototype._loadSkinAsync = function (context, skin, onSuccess) {
                 var _this = this;
                 var _this = this;
                 if (skin.babylonSkeleton) {
                 if (skin.babylonSkeleton) {
-                    return skin.babylonSkeleton;
+                    onSuccess();
+                    return;
                 }
                 }
                 var skeletonId = "skeleton" + skin.index;
                 var skeletonId = "skeleton" + skin.index;
                 skin.babylonSkeleton = new BABYLON.Skeleton(skin.name || skeletonId, skeletonId, this._babylonScene);
                 skin.babylonSkeleton = new BABYLON.Skeleton(skin.name || skeletonId, skeletonId, this._babylonScene);
                 if (skin.inverseBindMatrices == null) {
                 if (skin.inverseBindMatrices == null) {
                     this._loadBones(context, skin, null);
                     this._loadBones(context, skin, null);
+                    onSuccess();
                 }
                 }
                 else {
                 else {
                     var accessor = GLTFLoader._GetProperty(this._gltf.accessors, skin.inverseBindMatrices);
                     var accessor = GLTFLoader._GetProperty(this._gltf.accessors, skin.inverseBindMatrices);
@@ -1020,14 +1030,12 @@ var BABYLON;
                     }
                     }
                     this._loadAccessorAsync("#/accessors/" + accessor.index, accessor, function (data) {
                     this._loadAccessorAsync("#/accessors/" + accessor.index, accessor, function (data) {
                         _this._loadBones(context, skin, data);
                         _this._loadBones(context, skin, data);
+                        onSuccess();
                     });
                     });
                 }
                 }
-                return skin.babylonSkeleton;
             };
             };
             GLTFLoader.prototype._createBone = function (node, skin, parent, localMatrix, baseMatrix, index) {
             GLTFLoader.prototype._createBone = function (node, skin, parent, localMatrix, baseMatrix, index) {
                 var babylonBone = new BABYLON.Bone(node.name || "bone" + node.index, skin.babylonSkeleton, parent, localMatrix, null, baseMatrix, index);
                 var babylonBone = new BABYLON.Bone(node.name || "bone" + node.index, skin.babylonSkeleton, parent, localMatrix, null, baseMatrix, index);
-                node.babylonBones = node.babylonBones || {};
-                node.babylonBones[skin.index] = babylonBone;
                 node.babylonAnimationTargets = node.babylonAnimationTargets || [];
                 node.babylonAnimationTargets = node.babylonAnimationTargets || [];
                 node.babylonAnimationTargets.push(babylonBone);
                 node.babylonAnimationTargets.push(babylonBone);
                 return babylonBone;
                 return babylonBone;
@@ -1055,7 +1063,7 @@ var BABYLON;
                     baseMatrix.invertToRef(baseMatrix);
                     baseMatrix.invertToRef(baseMatrix);
                 }
                 }
                 var babylonParentBone = null;
                 var babylonParentBone = null;
-                if (node.index !== skin.skeleton && node.parent && node.parent !== this._rootNode) {
+                if (node.parent !== this._rootNode) {
                     babylonParentBone = this._loadBone(node.parent, skin, inverseBindMatrixData, babylonBones);
                     babylonParentBone = this._loadBone(node.parent, skin, inverseBindMatrixData, babylonBones);
                     baseMatrix.multiplyToRef(babylonParentBone.getInvertedAbsoluteTransform(), baseMatrix);
                     baseMatrix.multiplyToRef(babylonParentBone.getInvertedAbsoluteTransform(), baseMatrix);
                 }
                 }
@@ -1069,7 +1077,6 @@ var BABYLON;
                     BABYLON.Matrix.Compose(node.scale ? BABYLON.Vector3.FromArray(node.scale) : BABYLON.Vector3.One(), node.rotation ? BABYLON.Quaternion.FromArray(node.rotation) : BABYLON.Quaternion.Identity(), node.translation ? BABYLON.Vector3.FromArray(node.translation) : BABYLON.Vector3.Zero());
                     BABYLON.Matrix.Compose(node.scale ? BABYLON.Vector3.FromArray(node.scale) : BABYLON.Vector3.One(), node.rotation ? BABYLON.Quaternion.FromArray(node.rotation) : BABYLON.Quaternion.Identity(), node.translation ? BABYLON.Vector3.FromArray(node.translation) : BABYLON.Vector3.Zero());
             };
             };
             GLTFLoader.prototype._traverseNodes = function (context, indices, action, parentNode) {
             GLTFLoader.prototype._traverseNodes = function (context, indices, action, parentNode) {
-                if (parentNode === void 0) { parentNode = null; }
                 for (var _i = 0, indices_1 = indices; _i < indices_1.length; _i++) {
                 for (var _i = 0, indices_1 = indices; _i < indices_1.length; _i++) {
                     var index = indices_1[_i];
                     var index = indices_1[_i];
                     var node = GLTFLoader._GetProperty(this._gltf.nodes, index);
                     var node = GLTFLoader._GetProperty(this._gltf.nodes, index);
@@ -1080,7 +1087,6 @@ var BABYLON;
                 }
                 }
             };
             };
             GLTFLoader.prototype._traverseNode = function (context, node, action, parentNode) {
             GLTFLoader.prototype._traverseNode = function (context, node, action, parentNode) {
-                if (parentNode === void 0) { parentNode = null; }
                 if (GLTF2.GLTFLoaderExtension.TraverseNode(this, context, node, action, parentNode)) {
                 if (GLTF2.GLTFLoaderExtension.TraverseNode(this, context, node, action, parentNode)) {
                     return;
                     return;
                 }
                 }

文件差异内容过多而无法显示
+ 2 - 2
dist/preview release/loaders/babylon.glTF2FileLoader.min.js


+ 6 - 9
dist/preview release/loaders/babylon.glTFFileLoader.d.ts

@@ -792,11 +792,8 @@ declare module BABYLON.GLTF2 {
         translation?: number[];
         translation?: number[];
         weights?: number[];
         weights?: number[];
         index: number;
         index: number;
-        parent?: IGLTFNode;
+        parent: IGLTFNode;
         babylonMesh: Mesh;
         babylonMesh: Mesh;
-        babylonBones?: {
-            [skin: number]: Bone;
-        };
         babylonAnimationTargets?: Node[];
         babylonAnimationTargets?: Node[];
     }
     }
     interface IGLTFSampler extends IGLTFChildRootProperty {
     interface IGLTFSampler extends IGLTFChildRootProperty {
@@ -911,13 +908,13 @@ declare module BABYLON.GLTF2 {
         private _loadAllMorphTargetVertexDataAsync(context, node, mesh, onSuccess);
         private _loadAllMorphTargetVertexDataAsync(context, node, mesh, onSuccess);
         private _loadMorphTargetVertexDataAsync(context, vertexData, attributes, onSuccess);
         private _loadMorphTargetVertexDataAsync(context, vertexData, attributes, onSuccess);
         private _loadTransform(node);
         private _loadTransform(node);
-        private _loadSkin(context, skin);
+        private _loadSkinAsync(context, skin, onSuccess);
         private _createBone(node, skin, parent, localMatrix, baseMatrix, index);
         private _createBone(node, skin, parent, localMatrix, baseMatrix, index);
         private _loadBones(context, skin, inverseBindMatrixData);
         private _loadBones(context, skin, inverseBindMatrixData);
         private _loadBone(node, skin, inverseBindMatrixData, babylonBones);
         private _loadBone(node, skin, inverseBindMatrixData, babylonBones);
         private _getNodeMatrix(node);
         private _getNodeMatrix(node);
-        private _traverseNodes(context, indices, action, parentNode?);
-        _traverseNode(context: string, node: IGLTFNode, action: (node: IGLTFNode, parentNode: Nullable<IGLTFNode>) => boolean, parentNode?: Nullable<IGLTFNode>): void;
+        private _traverseNodes(context, indices, action, parentNode);
+        _traverseNode(context: string, node: IGLTFNode, action: (node: IGLTFNode, parentNode: IGLTFNode) => boolean, parentNode: IGLTFNode): void;
         private _loadAnimations();
         private _loadAnimations();
         private _loadAnimation(context, animation);
         private _loadAnimation(context, animation);
         private _loadAnimationChannel(animation, channelContext, channel, samplerContext, sampler);
         private _loadAnimationChannel(animation, channelContext, channel, samplerContext, sampler);
@@ -976,12 +973,12 @@ declare module BABYLON.GLTF2 {
     abstract class GLTFLoaderExtension {
     abstract class GLTFLoaderExtension {
         enabled: boolean;
         enabled: boolean;
         readonly abstract name: string;
         readonly abstract name: string;
-        protected _traverseNode(loader: GLTFLoader, context: string, node: IGLTFNode, action: (node: IGLTFNode, parentNode: IGLTFNode) => boolean, parentNode: Nullable<IGLTFNode>): boolean;
+        protected _traverseNode(loader: GLTFLoader, context: string, node: IGLTFNode, action: (node: IGLTFNode, parentNode: IGLTFNode) => boolean, parentNode: IGLTFNode): boolean;
         protected _loadNode(loader: GLTFLoader, context: string, node: IGLTFNode): boolean;
         protected _loadNode(loader: GLTFLoader, context: string, node: IGLTFNode): boolean;
         protected _loadMaterial(loader: GLTFLoader, context: string, material: IGLTFMaterial, assign: (babylonMaterial: Material, isNew: boolean) => void): boolean;
         protected _loadMaterial(loader: GLTFLoader, context: string, material: IGLTFMaterial, assign: (babylonMaterial: Material, isNew: boolean) => void): boolean;
         protected _loadExtension<T>(context: string, property: IGLTFProperty, action: (context: string, extension: T, onComplete: () => void) => void): boolean;
         protected _loadExtension<T>(context: string, property: IGLTFProperty, action: (context: string, extension: T, onComplete: () => void) => void): boolean;
         static _Extensions: GLTFLoaderExtension[];
         static _Extensions: GLTFLoaderExtension[];
-        static TraverseNode(loader: GLTFLoader, context: string, node: IGLTFNode, action: (node: IGLTFNode, parentNode: IGLTFNode) => boolean, parentNode: Nullable<IGLTFNode>): boolean;
+        static TraverseNode(loader: GLTFLoader, context: string, node: IGLTFNode, action: (node: IGLTFNode, parentNode: IGLTFNode) => boolean, parentNode: IGLTFNode): boolean;
         static LoadNode(loader: GLTFLoader, context: string, node: IGLTFNode): boolean;
         static LoadNode(loader: GLTFLoader, context: string, node: IGLTFNode): boolean;
         static LoadMaterial(loader: GLTFLoader, context: string, material: IGLTFMaterial, assign: (babylonMaterial: Material, isNew: boolean) => void): boolean;
         static LoadMaterial(loader: GLTFLoader, context: string, material: IGLTFMaterial, assign: (babylonMaterial: Material, isNew: boolean) => void): boolean;
         private static _ApplyExtensions(action);
         private static _ApplyExtensions(action);

+ 20 - 14
dist/preview release/loaders/babylon.glTFFileLoader.js

@@ -2681,8 +2681,9 @@ var BABYLON;
                 switch (this._parent.coordinateSystemMode) {
                 switch (this._parent.coordinateSystemMode) {
                     case BABYLON.GLTFLoaderCoordinateSystemMode.AUTO: {
                     case BABYLON.GLTFLoaderCoordinateSystemMode.AUTO: {
                         if (!this._babylonScene.useRightHandedSystem) {
                         if (!this._babylonScene.useRightHandedSystem) {
-                            this._rootNode.babylonMesh.rotation = new BABYLON.Vector3(0, Math.PI, 0);
-                            this._rootNode.babylonMesh.scaling = new BABYLON.Vector3(1, 1, -1);
+                            this._rootNode.rotation = [0, 1, 0, 0];
+                            this._rootNode.scale = [1, 1, -1];
+                            this._loadTransform(this._rootNode);
                         }
                         }
                         break;
                         break;
                     }
                     }
@@ -2746,15 +2747,22 @@ var BABYLON;
                     }
                     }
                     this._loadMesh("#/meshes/" + node.mesh, node, mesh);
                     this._loadMesh("#/meshes/" + node.mesh, node, mesh);
                 }
                 }
-                node.babylonMesh.parent = node.parent ? node.parent.babylonMesh : null;
+                node.babylonMesh.parent = node.parent.babylonMesh;
                 node.babylonAnimationTargets = node.babylonAnimationTargets || [];
                 node.babylonAnimationTargets = node.babylonAnimationTargets || [];
                 node.babylonAnimationTargets.push(node.babylonMesh);
                 node.babylonAnimationTargets.push(node.babylonMesh);
                 if (node.skin != null) {
                 if (node.skin != null) {
-                    var skin = GLTFLoader._GetProperty(this._gltf.skins, node.skin);
-                    if (!skin) {
+                    var skin_1 = GLTFLoader._GetProperty(this._gltf.skins, node.skin);
+                    if (!skin_1) {
                         throw new Error(context + ": Failed to find skin " + node.skin);
                         throw new Error(context + ": Failed to find skin " + node.skin);
                     }
                     }
-                    node.babylonMesh.skeleton = this._loadSkin("#/skins/" + node.skin, skin);
+                    this._loadSkinAsync("#/skins/" + node.skin, skin_1, function () {
+                        node.babylonMesh.skeleton = skin_1.babylonSkeleton;
+                        node.babylonMesh._refreshBoundingInfo(true);
+                    });
+                    node.babylonMesh.parent = this._rootNode.babylonMesh;
+                    node.babylonMesh.position = BABYLON.Vector3.Zero();
+                    node.babylonMesh.rotationQuaternion = BABYLON.Quaternion.Identity();
+                    node.babylonMesh.scaling = BABYLON.Vector3.One();
                 }
                 }
                 if (node.camera != null) {
                 if (node.camera != null) {
                     // TODO: handle cameras
                     // TODO: handle cameras
@@ -3148,15 +3156,17 @@ var BABYLON;
                 node.babylonMesh.rotationQuaternion = rotation;
                 node.babylonMesh.rotationQuaternion = rotation;
                 node.babylonMesh.scaling = scaling;
                 node.babylonMesh.scaling = scaling;
             };
             };
-            GLTFLoader.prototype._loadSkin = function (context, skin) {
+            GLTFLoader.prototype._loadSkinAsync = function (context, skin, onSuccess) {
                 var _this = this;
                 var _this = this;
                 if (skin.babylonSkeleton) {
                 if (skin.babylonSkeleton) {
-                    return skin.babylonSkeleton;
+                    onSuccess();
+                    return;
                 }
                 }
                 var skeletonId = "skeleton" + skin.index;
                 var skeletonId = "skeleton" + skin.index;
                 skin.babylonSkeleton = new BABYLON.Skeleton(skin.name || skeletonId, skeletonId, this._babylonScene);
                 skin.babylonSkeleton = new BABYLON.Skeleton(skin.name || skeletonId, skeletonId, this._babylonScene);
                 if (skin.inverseBindMatrices == null) {
                 if (skin.inverseBindMatrices == null) {
                     this._loadBones(context, skin, null);
                     this._loadBones(context, skin, null);
+                    onSuccess();
                 }
                 }
                 else {
                 else {
                     var accessor = GLTFLoader._GetProperty(this._gltf.accessors, skin.inverseBindMatrices);
                     var accessor = GLTFLoader._GetProperty(this._gltf.accessors, skin.inverseBindMatrices);
@@ -3165,14 +3175,12 @@ var BABYLON;
                     }
                     }
                     this._loadAccessorAsync("#/accessors/" + accessor.index, accessor, function (data) {
                     this._loadAccessorAsync("#/accessors/" + accessor.index, accessor, function (data) {
                         _this._loadBones(context, skin, data);
                         _this._loadBones(context, skin, data);
+                        onSuccess();
                     });
                     });
                 }
                 }
-                return skin.babylonSkeleton;
             };
             };
             GLTFLoader.prototype._createBone = function (node, skin, parent, localMatrix, baseMatrix, index) {
             GLTFLoader.prototype._createBone = function (node, skin, parent, localMatrix, baseMatrix, index) {
                 var babylonBone = new BABYLON.Bone(node.name || "bone" + node.index, skin.babylonSkeleton, parent, localMatrix, null, baseMatrix, index);
                 var babylonBone = new BABYLON.Bone(node.name || "bone" + node.index, skin.babylonSkeleton, parent, localMatrix, null, baseMatrix, index);
-                node.babylonBones = node.babylonBones || {};
-                node.babylonBones[skin.index] = babylonBone;
                 node.babylonAnimationTargets = node.babylonAnimationTargets || [];
                 node.babylonAnimationTargets = node.babylonAnimationTargets || [];
                 node.babylonAnimationTargets.push(babylonBone);
                 node.babylonAnimationTargets.push(babylonBone);
                 return babylonBone;
                 return babylonBone;
@@ -3200,7 +3208,7 @@ var BABYLON;
                     baseMatrix.invertToRef(baseMatrix);
                     baseMatrix.invertToRef(baseMatrix);
                 }
                 }
                 var babylonParentBone = null;
                 var babylonParentBone = null;
-                if (node.index !== skin.skeleton && node.parent && node.parent !== this._rootNode) {
+                if (node.parent !== this._rootNode) {
                     babylonParentBone = this._loadBone(node.parent, skin, inverseBindMatrixData, babylonBones);
                     babylonParentBone = this._loadBone(node.parent, skin, inverseBindMatrixData, babylonBones);
                     baseMatrix.multiplyToRef(babylonParentBone.getInvertedAbsoluteTransform(), baseMatrix);
                     baseMatrix.multiplyToRef(babylonParentBone.getInvertedAbsoluteTransform(), baseMatrix);
                 }
                 }
@@ -3214,7 +3222,6 @@ var BABYLON;
                     BABYLON.Matrix.Compose(node.scale ? BABYLON.Vector3.FromArray(node.scale) : BABYLON.Vector3.One(), node.rotation ? BABYLON.Quaternion.FromArray(node.rotation) : BABYLON.Quaternion.Identity(), node.translation ? BABYLON.Vector3.FromArray(node.translation) : BABYLON.Vector3.Zero());
                     BABYLON.Matrix.Compose(node.scale ? BABYLON.Vector3.FromArray(node.scale) : BABYLON.Vector3.One(), node.rotation ? BABYLON.Quaternion.FromArray(node.rotation) : BABYLON.Quaternion.Identity(), node.translation ? BABYLON.Vector3.FromArray(node.translation) : BABYLON.Vector3.Zero());
             };
             };
             GLTFLoader.prototype._traverseNodes = function (context, indices, action, parentNode) {
             GLTFLoader.prototype._traverseNodes = function (context, indices, action, parentNode) {
-                if (parentNode === void 0) { parentNode = null; }
                 for (var _i = 0, indices_1 = indices; _i < indices_1.length; _i++) {
                 for (var _i = 0, indices_1 = indices; _i < indices_1.length; _i++) {
                     var index = indices_1[_i];
                     var index = indices_1[_i];
                     var node = GLTFLoader._GetProperty(this._gltf.nodes, index);
                     var node = GLTFLoader._GetProperty(this._gltf.nodes, index);
@@ -3225,7 +3232,6 @@ var BABYLON;
                 }
                 }
             };
             };
             GLTFLoader.prototype._traverseNode = function (context, node, action, parentNode) {
             GLTFLoader.prototype._traverseNode = function (context, node, action, parentNode) {
-                if (parentNode === void 0) { parentNode = null; }
                 if (GLTF2.GLTFLoaderExtension.TraverseNode(this, context, node, action, parentNode)) {
                 if (GLTF2.GLTFLoaderExtension.TraverseNode(this, context, node, action, parentNode)) {
                     return;
                     return;
                 }
                 }

文件差异内容过多而无法显示
+ 2 - 2
dist/preview release/loaders/babylon.glTFFileLoader.min.js


文件差异内容过多而无法显示
+ 1 - 1
dist/preview release/loaders/babylon.objFileLoader.min.js


+ 20 - 14
dist/preview release/loaders/babylonjs.loaders.js

@@ -3637,8 +3637,9 @@ var BABYLON;
                 switch (this._parent.coordinateSystemMode) {
                 switch (this._parent.coordinateSystemMode) {
                     case BABYLON.GLTFLoaderCoordinateSystemMode.AUTO: {
                     case BABYLON.GLTFLoaderCoordinateSystemMode.AUTO: {
                         if (!this._babylonScene.useRightHandedSystem) {
                         if (!this._babylonScene.useRightHandedSystem) {
-                            this._rootNode.babylonMesh.rotation = new BABYLON.Vector3(0, Math.PI, 0);
-                            this._rootNode.babylonMesh.scaling = new BABYLON.Vector3(1, 1, -1);
+                            this._rootNode.rotation = [0, 1, 0, 0];
+                            this._rootNode.scale = [1, 1, -1];
+                            this._loadTransform(this._rootNode);
                         }
                         }
                         break;
                         break;
                     }
                     }
@@ -3702,15 +3703,22 @@ var BABYLON;
                     }
                     }
                     this._loadMesh("#/meshes/" + node.mesh, node, mesh);
                     this._loadMesh("#/meshes/" + node.mesh, node, mesh);
                 }
                 }
-                node.babylonMesh.parent = node.parent ? node.parent.babylonMesh : null;
+                node.babylonMesh.parent = node.parent.babylonMesh;
                 node.babylonAnimationTargets = node.babylonAnimationTargets || [];
                 node.babylonAnimationTargets = node.babylonAnimationTargets || [];
                 node.babylonAnimationTargets.push(node.babylonMesh);
                 node.babylonAnimationTargets.push(node.babylonMesh);
                 if (node.skin != null) {
                 if (node.skin != null) {
-                    var skin = GLTFLoader._GetProperty(this._gltf.skins, node.skin);
-                    if (!skin) {
+                    var skin_1 = GLTFLoader._GetProperty(this._gltf.skins, node.skin);
+                    if (!skin_1) {
                         throw new Error(context + ": Failed to find skin " + node.skin);
                         throw new Error(context + ": Failed to find skin " + node.skin);
                     }
                     }
-                    node.babylonMesh.skeleton = this._loadSkin("#/skins/" + node.skin, skin);
+                    this._loadSkinAsync("#/skins/" + node.skin, skin_1, function () {
+                        node.babylonMesh.skeleton = skin_1.babylonSkeleton;
+                        node.babylonMesh._refreshBoundingInfo(true);
+                    });
+                    node.babylonMesh.parent = this._rootNode.babylonMesh;
+                    node.babylonMesh.position = BABYLON.Vector3.Zero();
+                    node.babylonMesh.rotationQuaternion = BABYLON.Quaternion.Identity();
+                    node.babylonMesh.scaling = BABYLON.Vector3.One();
                 }
                 }
                 if (node.camera != null) {
                 if (node.camera != null) {
                     // TODO: handle cameras
                     // TODO: handle cameras
@@ -4104,15 +4112,17 @@ var BABYLON;
                 node.babylonMesh.rotationQuaternion = rotation;
                 node.babylonMesh.rotationQuaternion = rotation;
                 node.babylonMesh.scaling = scaling;
                 node.babylonMesh.scaling = scaling;
             };
             };
-            GLTFLoader.prototype._loadSkin = function (context, skin) {
+            GLTFLoader.prototype._loadSkinAsync = function (context, skin, onSuccess) {
                 var _this = this;
                 var _this = this;
                 if (skin.babylonSkeleton) {
                 if (skin.babylonSkeleton) {
-                    return skin.babylonSkeleton;
+                    onSuccess();
+                    return;
                 }
                 }
                 var skeletonId = "skeleton" + skin.index;
                 var skeletonId = "skeleton" + skin.index;
                 skin.babylonSkeleton = new BABYLON.Skeleton(skin.name || skeletonId, skeletonId, this._babylonScene);
                 skin.babylonSkeleton = new BABYLON.Skeleton(skin.name || skeletonId, skeletonId, this._babylonScene);
                 if (skin.inverseBindMatrices == null) {
                 if (skin.inverseBindMatrices == null) {
                     this._loadBones(context, skin, null);
                     this._loadBones(context, skin, null);
+                    onSuccess();
                 }
                 }
                 else {
                 else {
                     var accessor = GLTFLoader._GetProperty(this._gltf.accessors, skin.inverseBindMatrices);
                     var accessor = GLTFLoader._GetProperty(this._gltf.accessors, skin.inverseBindMatrices);
@@ -4121,14 +4131,12 @@ var BABYLON;
                     }
                     }
                     this._loadAccessorAsync("#/accessors/" + accessor.index, accessor, function (data) {
                     this._loadAccessorAsync("#/accessors/" + accessor.index, accessor, function (data) {
                         _this._loadBones(context, skin, data);
                         _this._loadBones(context, skin, data);
+                        onSuccess();
                     });
                     });
                 }
                 }
-                return skin.babylonSkeleton;
             };
             };
             GLTFLoader.prototype._createBone = function (node, skin, parent, localMatrix, baseMatrix, index) {
             GLTFLoader.prototype._createBone = function (node, skin, parent, localMatrix, baseMatrix, index) {
                 var babylonBone = new BABYLON.Bone(node.name || "bone" + node.index, skin.babylonSkeleton, parent, localMatrix, null, baseMatrix, index);
                 var babylonBone = new BABYLON.Bone(node.name || "bone" + node.index, skin.babylonSkeleton, parent, localMatrix, null, baseMatrix, index);
-                node.babylonBones = node.babylonBones || {};
-                node.babylonBones[skin.index] = babylonBone;
                 node.babylonAnimationTargets = node.babylonAnimationTargets || [];
                 node.babylonAnimationTargets = node.babylonAnimationTargets || [];
                 node.babylonAnimationTargets.push(babylonBone);
                 node.babylonAnimationTargets.push(babylonBone);
                 return babylonBone;
                 return babylonBone;
@@ -4156,7 +4164,7 @@ var BABYLON;
                     baseMatrix.invertToRef(baseMatrix);
                     baseMatrix.invertToRef(baseMatrix);
                 }
                 }
                 var babylonParentBone = null;
                 var babylonParentBone = null;
-                if (node.index !== skin.skeleton && node.parent && node.parent !== this._rootNode) {
+                if (node.parent !== this._rootNode) {
                     babylonParentBone = this._loadBone(node.parent, skin, inverseBindMatrixData, babylonBones);
                     babylonParentBone = this._loadBone(node.parent, skin, inverseBindMatrixData, babylonBones);
                     baseMatrix.multiplyToRef(babylonParentBone.getInvertedAbsoluteTransform(), baseMatrix);
                     baseMatrix.multiplyToRef(babylonParentBone.getInvertedAbsoluteTransform(), baseMatrix);
                 }
                 }
@@ -4170,7 +4178,6 @@ var BABYLON;
                     BABYLON.Matrix.Compose(node.scale ? BABYLON.Vector3.FromArray(node.scale) : BABYLON.Vector3.One(), node.rotation ? BABYLON.Quaternion.FromArray(node.rotation) : BABYLON.Quaternion.Identity(), node.translation ? BABYLON.Vector3.FromArray(node.translation) : BABYLON.Vector3.Zero());
                     BABYLON.Matrix.Compose(node.scale ? BABYLON.Vector3.FromArray(node.scale) : BABYLON.Vector3.One(), node.rotation ? BABYLON.Quaternion.FromArray(node.rotation) : BABYLON.Quaternion.Identity(), node.translation ? BABYLON.Vector3.FromArray(node.translation) : BABYLON.Vector3.Zero());
             };
             };
             GLTFLoader.prototype._traverseNodes = function (context, indices, action, parentNode) {
             GLTFLoader.prototype._traverseNodes = function (context, indices, action, parentNode) {
-                if (parentNode === void 0) { parentNode = null; }
                 for (var _i = 0, indices_1 = indices; _i < indices_1.length; _i++) {
                 for (var _i = 0, indices_1 = indices; _i < indices_1.length; _i++) {
                     var index = indices_1[_i];
                     var index = indices_1[_i];
                     var node = GLTFLoader._GetProperty(this._gltf.nodes, index);
                     var node = GLTFLoader._GetProperty(this._gltf.nodes, index);
@@ -4181,7 +4188,6 @@ var BABYLON;
                 }
                 }
             };
             };
             GLTFLoader.prototype._traverseNode = function (context, node, action, parentNode) {
             GLTFLoader.prototype._traverseNode = function (context, node, action, parentNode) {
-                if (parentNode === void 0) { parentNode = null; }
                 if (GLTF2.GLTFLoaderExtension.TraverseNode(this, context, node, action, parentNode)) {
                 if (GLTF2.GLTFLoaderExtension.TraverseNode(this, context, node, action, parentNode)) {
                     return;
                     return;
                 }
                 }

文件差异内容过多而无法显示
+ 3 - 3
dist/preview release/loaders/babylonjs.loaders.min.js


+ 6 - 9
dist/preview release/loaders/babylonjs.loaders.module.d.ts

@@ -890,11 +890,8 @@ declare module BABYLON.GLTF2 {
         translation?: number[];
         translation?: number[];
         weights?: number[];
         weights?: number[];
         index: number;
         index: number;
-        parent?: IGLTFNode;
+        parent: IGLTFNode;
         babylonMesh: Mesh;
         babylonMesh: Mesh;
-        babylonBones?: {
-            [skin: number]: Bone;
-        };
         babylonAnimationTargets?: Node[];
         babylonAnimationTargets?: Node[];
     }
     }
     interface IGLTFSampler extends IGLTFChildRootProperty {
     interface IGLTFSampler extends IGLTFChildRootProperty {
@@ -1009,13 +1006,13 @@ declare module BABYLON.GLTF2 {
         private _loadAllMorphTargetVertexDataAsync(context, node, mesh, onSuccess);
         private _loadAllMorphTargetVertexDataAsync(context, node, mesh, onSuccess);
         private _loadMorphTargetVertexDataAsync(context, vertexData, attributes, onSuccess);
         private _loadMorphTargetVertexDataAsync(context, vertexData, attributes, onSuccess);
         private _loadTransform(node);
         private _loadTransform(node);
-        private _loadSkin(context, skin);
+        private _loadSkinAsync(context, skin, onSuccess);
         private _createBone(node, skin, parent, localMatrix, baseMatrix, index);
         private _createBone(node, skin, parent, localMatrix, baseMatrix, index);
         private _loadBones(context, skin, inverseBindMatrixData);
         private _loadBones(context, skin, inverseBindMatrixData);
         private _loadBone(node, skin, inverseBindMatrixData, babylonBones);
         private _loadBone(node, skin, inverseBindMatrixData, babylonBones);
         private _getNodeMatrix(node);
         private _getNodeMatrix(node);
-        private _traverseNodes(context, indices, action, parentNode?);
-        _traverseNode(context: string, node: IGLTFNode, action: (node: IGLTFNode, parentNode: Nullable<IGLTFNode>) => boolean, parentNode?: Nullable<IGLTFNode>): void;
+        private _traverseNodes(context, indices, action, parentNode);
+        _traverseNode(context: string, node: IGLTFNode, action: (node: IGLTFNode, parentNode: IGLTFNode) => boolean, parentNode: IGLTFNode): void;
         private _loadAnimations();
         private _loadAnimations();
         private _loadAnimation(context, animation);
         private _loadAnimation(context, animation);
         private _loadAnimationChannel(animation, channelContext, channel, samplerContext, sampler);
         private _loadAnimationChannel(animation, channelContext, channel, samplerContext, sampler);
@@ -1074,12 +1071,12 @@ declare module BABYLON.GLTF2 {
     abstract class GLTFLoaderExtension {
     abstract class GLTFLoaderExtension {
         enabled: boolean;
         enabled: boolean;
         readonly abstract name: string;
         readonly abstract name: string;
-        protected _traverseNode(loader: GLTFLoader, context: string, node: IGLTFNode, action: (node: IGLTFNode, parentNode: IGLTFNode) => boolean, parentNode: Nullable<IGLTFNode>): boolean;
+        protected _traverseNode(loader: GLTFLoader, context: string, node: IGLTFNode, action: (node: IGLTFNode, parentNode: IGLTFNode) => boolean, parentNode: IGLTFNode): boolean;
         protected _loadNode(loader: GLTFLoader, context: string, node: IGLTFNode): boolean;
         protected _loadNode(loader: GLTFLoader, context: string, node: IGLTFNode): boolean;
         protected _loadMaterial(loader: GLTFLoader, context: string, material: IGLTFMaterial, assign: (babylonMaterial: Material, isNew: boolean) => void): boolean;
         protected _loadMaterial(loader: GLTFLoader, context: string, material: IGLTFMaterial, assign: (babylonMaterial: Material, isNew: boolean) => void): boolean;
         protected _loadExtension<T>(context: string, property: IGLTFProperty, action: (context: string, extension: T, onComplete: () => void) => void): boolean;
         protected _loadExtension<T>(context: string, property: IGLTFProperty, action: (context: string, extension: T, onComplete: () => void) => void): boolean;
         static _Extensions: GLTFLoaderExtension[];
         static _Extensions: GLTFLoaderExtension[];
-        static TraverseNode(loader: GLTFLoader, context: string, node: IGLTFNode, action: (node: IGLTFNode, parentNode: IGLTFNode) => boolean, parentNode: Nullable<IGLTFNode>): boolean;
+        static TraverseNode(loader: GLTFLoader, context: string, node: IGLTFNode, action: (node: IGLTFNode, parentNode: IGLTFNode) => boolean, parentNode: IGLTFNode): boolean;
         static LoadNode(loader: GLTFLoader, context: string, node: IGLTFNode): boolean;
         static LoadNode(loader: GLTFLoader, context: string, node: IGLTFNode): boolean;
         static LoadMaterial(loader: GLTFLoader, context: string, material: IGLTFMaterial, assign: (babylonMaterial: Material, isNew: boolean) => void): boolean;
         static LoadMaterial(loader: GLTFLoader, context: string, material: IGLTFMaterial, assign: (babylonMaterial: Material, isNew: boolean) => void): boolean;
         private static _ApplyExtensions(action);
         private static _ApplyExtensions(action);

文件差异内容过多而无法显示
+ 73 - 0
dist/preview release/viewer/babylon.viewer.js


+ 7 - 3
inspector/webpack.config.js

@@ -1,7 +1,7 @@
 module.exports = {
 module.exports = {
     entry: [
     entry: [
         "../../dist/preview release/inspector/babylon.inspector.css",
         "../../dist/preview release/inspector/babylon.inspector.css",
-        "../../dist/preview release/inspector/babylon.inspector.min.js"
+        "../../dist/preview release/inspector/babylon.inspector.js"
     ],
     ],
     output: {
     output: {
         libraryTarget: "var",
         libraryTarget: "var",
@@ -15,8 +15,12 @@ module.exports = {
     },
     },
     module: {
     module: {
         loaders: [
         loaders: [
-            { test: /\.css$/, loader: "style!css" },
-            { test: /babylon.inspector.min.js$/, loader: "imports?Split=split!exports?INSPECTOR" }
+            { test: /\.css$/, use: ['style-loader', 'css-loader'] },
+            {
+                test: /babylon.inspector.js/, use: [
+                    "imports-loader?Split=split", "exports-loader?INSPECTOR"]
+
+            }
         ]
         ]
     }
     }
 }
 }

+ 21 - 14
loaders/src/glTF/2.0/babylon.glTFLoader.ts

@@ -306,8 +306,9 @@ module BABYLON.GLTF2 {
             switch (this._parent.coordinateSystemMode) {
             switch (this._parent.coordinateSystemMode) {
                 case GLTFLoaderCoordinateSystemMode.AUTO: {
                 case GLTFLoaderCoordinateSystemMode.AUTO: {
                     if (!this._babylonScene.useRightHandedSystem) {
                     if (!this._babylonScene.useRightHandedSystem) {
-                        this._rootNode.babylonMesh.rotation = new Vector3(0, Math.PI, 0);
-                        this._rootNode.babylonMesh.scaling = new Vector3(1, 1, -1);
+                        this._rootNode.rotation = [ 0, 1, 0, 0 ];
+                        this._rootNode.scale = [ 1, 1, -1 ];
+                        this._loadTransform(this._rootNode);
                     }
                     }
                     break;
                     break;
                 }
                 }
@@ -386,7 +387,7 @@ module BABYLON.GLTF2 {
                 this._loadMesh("#/meshes/" + node.mesh, node, mesh);
                 this._loadMesh("#/meshes/" + node.mesh, node, mesh);
             }
             }
 
 
-            node.babylonMesh.parent = node.parent ? node.parent.babylonMesh : null;
+            node.babylonMesh.parent = node.parent.babylonMesh;
 
 
             node.babylonAnimationTargets = node.babylonAnimationTargets || [];
             node.babylonAnimationTargets = node.babylonAnimationTargets || [];
             node.babylonAnimationTargets.push(node.babylonMesh);
             node.babylonAnimationTargets.push(node.babylonMesh);
@@ -397,7 +398,15 @@ module BABYLON.GLTF2 {
                     throw new Error(context + ": Failed to find skin " + node.skin);
                     throw new Error(context + ": Failed to find skin " + node.skin);
                 }
                 }
 
 
-                node.babylonMesh.skeleton = this._loadSkin("#/skins/" + node.skin, skin);
+                this._loadSkinAsync("#/skins/" + node.skin, skin, () => {
+                    node.babylonMesh.skeleton = skin.babylonSkeleton;
+                    node.babylonMesh._refreshBoundingInfo(true);
+                });
+
+                node.babylonMesh.parent = this._rootNode.babylonMesh;
+                node.babylonMesh.position = Vector3.Zero();
+                node.babylonMesh.rotationQuaternion = Quaternion.Identity();
+                node.babylonMesh.scaling = Vector3.One();
             }
             }
 
 
             if (node.camera != null) {
             if (node.camera != null) {
@@ -807,9 +816,10 @@ module BABYLON.GLTF2 {
             node.babylonMesh.scaling = scaling;
             node.babylonMesh.scaling = scaling;
         }
         }
 
 
-        private _loadSkin(context: string, skin: IGLTFSkin): Skeleton {
+        private _loadSkinAsync(context: string, skin: IGLTFSkin, onSuccess: () => void): void {
             if (skin.babylonSkeleton) {
             if (skin.babylonSkeleton) {
-                return skin.babylonSkeleton;
+                onSuccess();
+                return;
             }
             }
 
 
             const skeletonId = "skeleton" + skin.index;
             const skeletonId = "skeleton" + skin.index;
@@ -817,6 +827,7 @@ module BABYLON.GLTF2 {
 
 
             if (skin.inverseBindMatrices == null) {
             if (skin.inverseBindMatrices == null) {
                 this._loadBones(context, skin, null);
                 this._loadBones(context, skin, null);
+                onSuccess();
             }
             }
             else {
             else {
                 const accessor = GLTFLoader._GetProperty(this._gltf.accessors, skin.inverseBindMatrices);
                 const accessor = GLTFLoader._GetProperty(this._gltf.accessors, skin.inverseBindMatrices);
@@ -826,18 +837,14 @@ module BABYLON.GLTF2 {
 
 
                 this._loadAccessorAsync("#/accessors/" + accessor.index, accessor, data => {
                 this._loadAccessorAsync("#/accessors/" + accessor.index, accessor, data => {
                     this._loadBones(context, skin, <Float32Array>data);
                     this._loadBones(context, skin, <Float32Array>data);
+                    onSuccess();
                 });
                 });
             }
             }
-
-            return skin.babylonSkeleton;
         }
         }
 
 
         private _createBone(node: IGLTFNode, skin: IGLTFSkin, parent: Nullable<Bone>, localMatrix: Matrix, baseMatrix: Matrix, index: number): Bone {
         private _createBone(node: IGLTFNode, skin: IGLTFSkin, parent: Nullable<Bone>, localMatrix: Matrix, baseMatrix: Matrix, index: number): Bone {
             const babylonBone = new Bone(node.name || "bone" + node.index, skin.babylonSkeleton, parent, localMatrix, null, baseMatrix, index);
             const babylonBone = new Bone(node.name || "bone" + node.index, skin.babylonSkeleton, parent, localMatrix, null, baseMatrix, index);
 
 
-            node.babylonBones = node.babylonBones || {};
-            node.babylonBones[skin.index] = babylonBone;
-
             node.babylonAnimationTargets = node.babylonAnimationTargets || [];
             node.babylonAnimationTargets = node.babylonAnimationTargets || [];
             node.babylonAnimationTargets.push(babylonBone);
             node.babylonAnimationTargets.push(babylonBone);
 
 
@@ -871,7 +878,7 @@ module BABYLON.GLTF2 {
             }
             }
 
 
             let babylonParentBone: Nullable<Bone> = null;
             let babylonParentBone: Nullable<Bone> = null;
-            if (node.index !== skin.skeleton && node.parent && node.parent !== this._rootNode) {
+            if (node.parent !== this._rootNode) {
                 babylonParentBone = this._loadBone(node.parent, skin, inverseBindMatrixData, babylonBones);
                 babylonParentBone = this._loadBone(node.parent, skin, inverseBindMatrixData, babylonBones);
                 baseMatrix.multiplyToRef(babylonParentBone.getInvertedAbsoluteTransform(), baseMatrix);
                 baseMatrix.multiplyToRef(babylonParentBone.getInvertedAbsoluteTransform(), baseMatrix);
             }
             }
@@ -890,7 +897,7 @@ module BABYLON.GLTF2 {
                     node.translation ? Vector3.FromArray(node.translation) : Vector3.Zero());
                     node.translation ? Vector3.FromArray(node.translation) : Vector3.Zero());
         }
         }
 
 
-        private _traverseNodes(context: string, indices: number[], action: (node: IGLTFNode, parentNode: IGLTFNode) => boolean, parentNode: Nullable<IGLTFNode> = null): void {
+        private _traverseNodes(context: string, indices: number[], action: (node: IGLTFNode, parentNode: IGLTFNode) => boolean, parentNode: IGLTFNode): void {
             for (const index of indices) {
             for (const index of indices) {
                 const node = GLTFLoader._GetProperty(this._gltf.nodes, index);
                 const node = GLTFLoader._GetProperty(this._gltf.nodes, index);
                 if (!node) {
                 if (!node) {
@@ -901,7 +908,7 @@ module BABYLON.GLTF2 {
             }
             }
         }
         }
 
 
-        public _traverseNode(context: string, node: IGLTFNode, action: (node: IGLTFNode, parentNode: Nullable<IGLTFNode>) => boolean, parentNode: Nullable<IGLTFNode> = null): void {
+        public _traverseNode(context: string, node: IGLTFNode, action: (node: IGLTFNode, parentNode: IGLTFNode) => boolean, parentNode: IGLTFNode): void {
             if (GLTFLoaderExtension.TraverseNode(this, context, node, action, parentNode)) {
             if (GLTFLoaderExtension.TraverseNode(this, context, node, action, parentNode)) {
                 return;
                 return;
             }
             }

+ 2 - 2
loaders/src/glTF/2.0/babylon.glTFLoaderExtension.ts

@@ -6,7 +6,7 @@ module BABYLON.GLTF2 {
 
 
         public abstract get name(): string;
         public abstract get name(): string;
 
 
-        protected _traverseNode(loader: GLTFLoader, context: string, node: IGLTFNode, action: (node: IGLTFNode, parentNode: IGLTFNode) => boolean, parentNode: Nullable<IGLTFNode>): boolean { return false; }
+        protected _traverseNode(loader: GLTFLoader, context: string, node: IGLTFNode, action: (node: IGLTFNode, parentNode: IGLTFNode) => boolean, parentNode: IGLTFNode): boolean { return false; }
 
 
         protected _loadNode(loader: GLTFLoader, context: string, node: IGLTFNode): boolean { return false; }
         protected _loadNode(loader: GLTFLoader, context: string, node: IGLTFNode): boolean { return false; }
 
 
@@ -39,7 +39,7 @@ module BABYLON.GLTF2 {
 
 
         public static _Extensions: GLTFLoaderExtension[] = [];
         public static _Extensions: GLTFLoaderExtension[] = [];
 
 
-        public static TraverseNode(loader: GLTFLoader, context: string, node: IGLTFNode, action: (node: IGLTFNode, parentNode: IGLTFNode) => boolean, parentNode: Nullable<IGLTFNode>): boolean {
+        public static TraverseNode(loader: GLTFLoader, context: string, node: IGLTFNode, action: (node: IGLTFNode, parentNode: IGLTFNode) => boolean, parentNode: IGLTFNode): boolean {
             return this._ApplyExtensions(extension => extension._traverseNode(loader, context, node, action, parentNode));
             return this._ApplyExtensions(extension => extension._traverseNode(loader, context, node, action, parentNode));
         }
         }
 
 

+ 1 - 2
loaders/src/glTF/2.0/babylon.glTFLoaderInterfaces.ts

@@ -232,9 +232,8 @@ module BABYLON.GLTF2 {
 
 
         // Runtime values
         // Runtime values
         index: number;
         index: number;
-        parent?: IGLTFNode;
+        parent: IGLTFNode;
         babylonMesh: Mesh;
         babylonMesh: Mesh;
-        babylonBones?: { [skin: number]: Bone };
         babylonAnimationTargets?: Node[];
         babylonAnimationTargets?: Node[];
     }
     }
 
 

+ 69 - 42
src/Cameras/VR/babylon.vrExperienceHelper.ts

@@ -458,58 +458,78 @@ module BABYLON {
         }
         }
 
 
         private _onNewGamepadConnected(gamepad: Gamepad) {
         private _onNewGamepadConnected(gamepad: Gamepad) {
-            if (gamepad.leftStick && gamepad.type !== BABYLON.Gamepad.POSE_ENABLED) {
-                gamepad.onleftstickchanged((stickValues) => {
-                    // 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;
+            if (gamepad.type !== BABYLON.Gamepad.POSE_ENABLED) {
+                if (gamepad.leftStick) {
+                    gamepad.onleftstickchanged((stickValues) => {
+                        // 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 > -this._padSensibilityDown) {
+                                    if (this._teleportationAllowed) {
+                                        this._teleportCamera();
+                                    }
+                                    this._teleportationRequestInitiated = false;
+                                }
                             }
                             }
                         }
                         }
-                        else {
-                            if (stickValues.y > -this._padSensibilityDown) {
-                                if (this._teleportationAllowed) {
-                                    this._teleportCamera();
+                    });
+                }
+                if (gamepad.rightStick) {
+                    gamepad.onrightstickchanged((stickValues) => {
+                        if (!this._rotationLeftAsked) {
+                            if (stickValues.x < -this._padSensibilityUp) {
+                                this._rotationLeftAsked = true;
+                                if (this._rotationAllowed) {
+                                    this._rotateCamera(false);
                                 }
                                 }
-                                this._teleportationRequestInitiated = false;
                             }
                             }
                         }
                         }
-                    }
-                });
-            }
-            if (gamepad.rightStick) {
-                gamepad.onrightstickchanged((stickValues) => {
-                    if (!this._rotationLeftAsked) {
-                        if (stickValues.x < -this._padSensibilityUp) {
-                            this._rotationLeftAsked = true;
-                            if (this._rotationAllowed) {
-                                this._rotateCamera(false);
+                        else {
+                            if (stickValues.x > -this._padSensibilityDown) {
+                                this._rotationLeftAsked = false;
                             }
                             }
                         }
                         }
-                    }
-                    else {
-                        if (stickValues.x > -this._padSensibilityDown) {
-                            this._rotationLeftAsked = false;
+            
+                        if (!this._rotationRightAsked) {
+                            if (stickValues.x > this._padSensibilityUp) {
+                                this._rotationRightAsked = true;
+                                if (this._rotationAllowed) {
+                                    this._rotateCamera(true);
+                                }
+                            }
                         }
                         }
-                    }
-        
-                    if (!this._rotationRightAsked) {
-                        if (stickValues.x > this._padSensibilityUp) {
-                            this._rotationRightAsked = true;
-                            if (this._rotationAllowed) {
-                                this._rotateCamera(true);
+                        else {
+                            if (stickValues.x < this._padSensibilityDown) {
+                                this._rotationRightAsked = false;
                             }
                             }
                         }
                         }
-                    }
-                    else {
-                        if (stickValues.x < this._padSensibilityDown) {
-                            this._rotationRightAsked = false;
+                    });
+                }
+                if (gamepad.type === BABYLON.Gamepad.XBOX) {
+                    (<Xbox360Pad>gamepad).onbuttondown((buttonPressed: Xbox360Button) => {
+                        if (buttonPressed === Xbox360Button.A) {
+                            this._pointerDownOnMeshAsked = true;
+                            if (this._currentMeshSelected && this._currentHit) {
+                                this._scene.simulatePointerDown(this._currentHit);
+                            }
                         }
                         }
-                    }
-                });
+                    });
+                    (<Xbox360Pad>gamepad).onbuttonup((buttonPressed: Xbox360Button) => {
+                        if (buttonPressed === Xbox360Button.A) {
+                            if (this._currentMeshSelected && this._currentHit) {
+                                this._scene.simulatePointerUp(this._currentHit);
+                            }
+                            this._pointerDownOnMeshAsked = false;
+                        }
+                    });
+                }
             }
             }
         }
         }
 
 
@@ -919,6 +939,7 @@ module BABYLON {
 
 
             // Moving the gazeTracker on the mesh face targetted
             // Moving the gazeTracker on the mesh face targetted
             if (hit && hit.pickedPoint) {
             if (hit && hit.pickedPoint) {
+                this._gazeTracker.isVisible = true;
                 var multiplier = 1;
                 var multiplier = 1;
                 if (this._isActionableMesh) {
                 if (this._isActionableMesh) {
                     multiplier = 3;
                     multiplier = 3;
@@ -967,13 +988,19 @@ module BABYLON {
                     this._leftLaserPointer.position.z = -hit.distance / 2;
                     this._leftLaserPointer.position.z = -hit.distance / 2;
                 }
                 }
             }
             }
+            else {
+                this._gazeTracker.isVisible = false;
+            }
         
         
             if (hit && hit.pickedMesh) {
             if (hit && hit.pickedMesh) {
                 this._currentHit = hit;
                 this._currentHit = hit;
+                if (this._pointerDownOnMeshAsked) {
+                    this._scene.simulatePointerMove(this._currentHit);
+                }
                 // The object selected is the floor, we're in a teleportation scenario
                 // The object selected is the floor, we're in a teleportation scenario
                 if (hit.pickedMesh.name.indexOf(this._floorMeshName) !== -1 && hit.pickedPoint) {
                 if (hit.pickedMesh.name.indexOf(this._floorMeshName) !== -1 && hit.pickedPoint) {
                     // Moving the teleportation area to this targetted point
                     // Moving the teleportation area to this targetted point
-                    this._moveTeleportationSelectorTo(hit)
+                    this._moveTeleportationSelectorTo(hit);
                     return;
                     return;
                 }
                 }
                 // If not, we're in a selection scenario
                 // If not, we're in a selection scenario

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

@@ -3218,18 +3218,21 @@
             return internalFormat;
             return internalFormat;
         }
         }
 
 
-        public updateRawTexture(texture: Nullable<InternalTexture>, data: Nullable<ArrayBufferView>, format: number, invertY: boolean, compression: Nullable<string> = null): void {
+        public updateRawTexture(texture: Nullable<InternalTexture>, data: Nullable<ArrayBufferView>, format: number, invertY: boolean, compression: Nullable<string> = null, type = Engine.TEXTURETYPE_UNSIGNED_INT): void {
             if (!texture) {
             if (!texture) {
                 return;
                 return;
             }
             }
 
 
             var internalFormat = this._getInternalFormat(format);
             var internalFormat = this._getInternalFormat(format);
+            var internalSizedFomat = this._getRGBABufferInternalSizedFormat(type);
+            var textureType = this._getWebGLTextureType(type);
             this._bindTextureDirectly(this._gl.TEXTURE_2D, texture);
             this._bindTextureDirectly(this._gl.TEXTURE_2D, texture);
             this._gl.pixelStorei(this._gl.UNPACK_FLIP_Y_WEBGL, invertY === undefined ? 1 : (invertY ? 1 : 0));
             this._gl.pixelStorei(this._gl.UNPACK_FLIP_Y_WEBGL, invertY === undefined ? 1 : (invertY ? 1 : 0));
 
 
             if (!this._doNotHandleContextLost) {
             if (!this._doNotHandleContextLost) {
                 texture._bufferView = data;
                 texture._bufferView = data;
                 texture.format = format;
                 texture.format = format;
+                texture.type = type;
                 texture.invertY = invertY;
                 texture.invertY = invertY;
                 texture._compression = compression;
                 texture._compression = compression;
             }
             }
@@ -3241,7 +3244,7 @@
             if (compression && data) {
             if (compression && data) {
                 this._gl.compressedTexImage2D(this._gl.TEXTURE_2D, 0, (<any>this.getCaps().s3tc)[compression], texture.width, texture.height, 0, data);
                 this._gl.compressedTexImage2D(this._gl.TEXTURE_2D, 0, (<any>this.getCaps().s3tc)[compression], texture.width, texture.height, 0, data);
             } else {
             } else {
-                this._gl.texImage2D(this._gl.TEXTURE_2D, 0, internalFormat, texture.width, texture.height, 0, internalFormat, this._gl.UNSIGNED_BYTE, data);
+                this._gl.texImage2D(this._gl.TEXTURE_2D, 0, internalSizedFomat, texture.width, texture.height, 0, internalFormat, textureType, data);
             }
             }
 
 
             if (texture.generateMipMaps) {
             if (texture.generateMipMaps) {
@@ -3252,7 +3255,7 @@
             texture.isReady = true;
             texture.isReady = true;
         }
         }
 
 
-        public createRawTexture(data: Nullable<ArrayBufferView>, width: number, height: number, format: number, generateMipMaps: boolean, invertY: boolean, samplingMode: number, compression: Nullable<string> = null): InternalTexture {
+        public createRawTexture(data: Nullable<ArrayBufferView>, width: number, height: number, format: number, generateMipMaps: boolean, invertY: boolean, samplingMode: number, compression: Nullable<string> = null, type: number = BABYLON.Engine.TEXTURETYPE_UNSIGNED_INT): InternalTexture {
             var texture = new InternalTexture(this, InternalTexture.DATASOURCE_RAW);
             var texture = new InternalTexture(this, InternalTexture.DATASOURCE_RAW);
             texture.baseWidth = width;
             texture.baseWidth = width;
             texture.baseHeight = height;
             texture.baseHeight = height;
@@ -3263,12 +3266,13 @@
             texture.samplingMode = samplingMode;
             texture.samplingMode = samplingMode;
             texture.invertY = invertY;
             texture.invertY = invertY;
             texture._compression = compression;
             texture._compression = compression;
+            texture.type = type;
 
 
             if (!this._doNotHandleContextLost) {
             if (!this._doNotHandleContextLost) {
                 texture._bufferView = data;
                 texture._bufferView = data;
             }
             }
 
 
-            this.updateRawTexture(texture, data, format, invertY, compression);
+            this.updateRawTexture(texture, data, format, invertY, compression, type);
             this._bindTextureDirectly(this._gl.TEXTURE_2D, texture);
             this._bindTextureDirectly(this._gl.TEXTURE_2D, texture);
 
 
             // Filters
             // Filters

+ 16 - 14
src/Gamepad/babylon.gamepadManager.ts

@@ -3,7 +3,7 @@
         private _babylonGamepads: Array<Gamepad> = [];
         private _babylonGamepads: Array<Gamepad> = [];
         private _oneGamepadConnected: boolean = false;
         private _oneGamepadConnected: boolean = false;
 
 
-        private _isMonitoring: boolean = false;
+        public _isMonitoring: boolean = false;
         private _gamepadEventSupported: boolean;
         private _gamepadEventSupported: boolean;
         private _gamepadSupport: () => Array<any>;
         private _gamepadSupport: () => Array<any>;
 
 
@@ -13,24 +13,23 @@
         private _onGamepadConnectedEvent: Nullable<(evt: any) => void>;
         private _onGamepadConnectedEvent: Nullable<(evt: any) => void>;
         private _onGamepadDisconnectedEvent: Nullable<(evt: any) => void>;
         private _onGamepadDisconnectedEvent: Nullable<(evt: any) => void>;
 
 
-        constructor() {
+        constructor(private _scene?: Scene) {
             if (!Tools.IsWindowObjectExist()) {
             if (!Tools.IsWindowObjectExist()) {
                 this._gamepadEventSupported = false;
                 this._gamepadEventSupported = false;
-            } else  {
+            } else {
                 this._gamepadEventSupported = 'GamepadEvent' in window;
                 this._gamepadEventSupported = 'GamepadEvent' in window;
                 this._gamepadSupport = (navigator.getGamepads ||
                 this._gamepadSupport = (navigator.getGamepads ||
                     navigator.webkitGetGamepads || navigator.msGetGamepads || navigator.webkitGamepads);
                     navigator.webkitGetGamepads || navigator.msGetGamepads || navigator.webkitGamepads);
             }
             }
 
 
-
             this.onGamepadConnectedObservable = new Observable<Gamepad>((observer) => {
             this.onGamepadConnectedObservable = new Observable<Gamepad>((observer) => {
                 // This will be used to raise the onGamepadConnected for all gamepads ALREADY connected
                 // This will be used to raise the onGamepadConnected for all gamepads ALREADY connected
                 for (var i in this._babylonGamepads) {
                 for (var i in this._babylonGamepads) {
                     let gamepad = this._babylonGamepads[i];
                     let gamepad = this._babylonGamepads[i];
-                    if (gamepad && gamepad._isConnected) {                      
+                    if (gamepad && gamepad._isConnected) {
                         this.onGamepadConnectedObservable.notifyObserver(observer, gamepad);
                         this.onGamepadConnectedObservable.notifyObserver(observer, gamepad);
                     }
                     }
-                }   
+                }
             });
             });
 
 
             this._onGamepadConnectedEvent = (evt) => {
             this._onGamepadConnectedEvent = (evt) => {
@@ -52,10 +51,10 @@
                     newGamepad = this._addNewGamepad(gamepad);
                     newGamepad = this._addNewGamepad(gamepad);
                 }
                 }
                 this.onGamepadConnectedObservable.notifyObservers(newGamepad);
                 this.onGamepadConnectedObservable.notifyObservers(newGamepad);
-                this._startMonitoringGamepads();                
+                this._startMonitoringGamepads();
             };
             };
 
 
-            this._onGamepadDisconnectedEvent  = (evt) => {
+            this._onGamepadDisconnectedEvent = (evt) => {
                 let gamepad = evt.gamepad;
                 let gamepad = evt.gamepad;
 
 
                 // Remove the gamepad from the list of gamepads to monitor.
                 // Remove the gamepad from the list of gamepads to monitor.
@@ -63,11 +62,11 @@
                     if (this._babylonGamepads[i].index === gamepad.index) {
                     if (this._babylonGamepads[i].index === gamepad.index) {
                         let disconnectedGamepad = this._babylonGamepads[i];
                         let disconnectedGamepad = this._babylonGamepads[i];
                         disconnectedGamepad._isConnected = false;
                         disconnectedGamepad._isConnected = false;
-                        
+
                         this.onGamepadDisconnectedObservable.notifyObservers(disconnectedGamepad);
                         this.onGamepadDisconnectedObservable.notifyObservers(disconnectedGamepad);
                         break;
                         break;
                     }
                     }
-                }            
+                }
             };
             };
 
 
             if (this._gamepadSupport) {
             if (this._gamepadSupport) {
@@ -150,7 +149,10 @@
         private _startMonitoringGamepads() {
         private _startMonitoringGamepads() {
             if (!this._isMonitoring) {
             if (!this._isMonitoring) {
                 this._isMonitoring = true;
                 this._isMonitoring = true;
-                this._checkGamepadsStatus();
+                //back-comp
+                if (!this._scene) {
+                    this._checkGamepadsStatus();
+                }
             }
             }
         }
         }
 
 
@@ -158,7 +160,7 @@
             this._isMonitoring = false;
             this._isMonitoring = false;
         }
         }
 
 
-        private _checkGamepadsStatus() {
+        public _checkGamepadsStatus() {
             // Hack to be compatible Chrome
             // Hack to be compatible Chrome
             this._updateGamepadObjects();
             this._updateGamepadObjects();
 
 
@@ -170,7 +172,7 @@
                 gamepad.update();
                 gamepad.update();
             }
             }
 
 
-            if (this._isMonitoring) {
+            if (this._isMonitoring && !this._scene) {
                 Tools.QueueNewFrame(() => { this._checkGamepadsStatus(); });
                 Tools.QueueNewFrame(() => { this._checkGamepadsStatus(); });
             }
             }
         }
         }
@@ -190,7 +192,7 @@
                         this._babylonGamepads[i].browserGamepad = gamepads[i];
                         this._babylonGamepads[i].browserGamepad = gamepads[i];
 
 
                         if (!this._babylonGamepads[i].isConnected) {
                         if (!this._babylonGamepads[i].isConnected) {
-                            this._babylonGamepads[i]._isConnected = true;                            
+                            this._babylonGamepads[i]._isConnected = true;
                             this.onGamepadConnectedObservable.notifyObservers(this._babylonGamepads[i]);
                             this.onGamepadConnectedObservable.notifyObservers(this._babylonGamepads[i]);
                         }
                         }
                     }
                     }

+ 4 - 0
src/Helpers/babylon.environmentHelper.ts

@@ -459,6 +459,10 @@ namespace BABYLON {
             let groundSize = this._options.groundSize;
             let groundSize = this._options.groundSize;
             let skyboxSize = this._options.skyboxSize;
             let skyboxSize = this._options.skyboxSize;
             let rootPosition = this._options.rootPosition;
             let rootPosition = this._options.rootPosition;
+            if (!this._scene.meshes || this._scene.meshes.length === 1) { // 1 only means the root of the helper.
+                return { groundSize, skyboxSize, rootPosition };
+            }
+            
             const sceneExtends = this._scene.getWorldExtends();
             const sceneExtends = this._scene.getWorldExtends();
             const sceneDiagonal = sceneExtends.max.subtract(sceneExtends.min);
             const sceneDiagonal = sceneExtends.max.subtract(sceneExtends.min);
             let bias = 0.0001;
             let bias = 0.0001;

+ 5 - 0
src/Layer/babylon.highlightlayer.ts

@@ -429,6 +429,11 @@
                     return;
                     return;
                 }
                 }
 
 
+                // Do not block in blend mode.
+                if (material.needAlphaBlendingForMesh(mesh)) {
+                    return;
+                }
+
                 // Culling
                 // Culling
                 engine.setState(material.backFaceCulling);
                 engine.setState(material.backFaceCulling);
 
 

+ 2 - 2
src/Materials/PBR/babylon.pbrBaseMaterial.ts

@@ -275,13 +275,13 @@
          * This parameters will enable/disable Horizon occlusion to prevent normal maps to look shiny when the normal
          * This parameters will enable/disable Horizon occlusion to prevent normal maps to look shiny when the normal
          * makes the reflect vector face the model (under horizon).
          * makes the reflect vector face the model (under horizon).
          */
          */
-        protected _useHorizonOcclusion = false; // USEHORIZONOCCLUSION
+        protected _useHorizonOcclusion = true;
 
 
         /**
         /**
          * This parameters will enable/disable radiance occlusion by preventing the radiance to lit
          * This parameters will enable/disable radiance occlusion by preventing the radiance to lit
          * too much the area relying on ambient texture to define their ambient occlusion.
          * too much the area relying on ambient texture to define their ambient occlusion.
          */
          */
-        protected _useRadianceOcclusion = false;
+        protected _useRadianceOcclusion = true;
         
         
         /**
         /**
          * Specifies that the alpha is coming form the albedo channel alpha channel for alpha blending.
          * Specifies that the alpha is coming form the albedo channel alpha channel for alpha blending.

+ 2 - 2
src/Materials/PBR/babylon.pbrMaterial.ts

@@ -418,7 +418,7 @@
          */
          */
         @serialize()
         @serialize()
         @expandToProperty("_markAllSubMeshesAsTexturesDirty")
         @expandToProperty("_markAllSubMeshesAsTexturesDirty")
-        public useHorizonOcclusion = false;
+        public useHorizonOcclusion = true;
         
         
         /**
         /**
          * This parameters will enable/disable radiance occlusion by preventing the radiance to lit
          * This parameters will enable/disable radiance occlusion by preventing the radiance to lit
@@ -426,7 +426,7 @@
          */
          */
         @serialize()
         @serialize()
         @expandToProperty("_markAllSubMeshesAsTexturesDirty")
         @expandToProperty("_markAllSubMeshesAsTexturesDirty")
-        public useRadianceOcclusion = false;
+        public useRadianceOcclusion = true;
 
 
         /**
         /**
          * Gets the image processing configuration used either in this material.
          * Gets the image processing configuration used either in this material.

+ 6 - 6
src/Materials/Textures/babylon.rawTexture.ts

@@ -1,10 +1,10 @@
 module BABYLON {
 module BABYLON {
     export class RawTexture extends Texture {
     export class RawTexture extends Texture {
         private _engine: Engine;
         private _engine: Engine;
-        constructor(data: ArrayBufferView, width: number, height: number, public format: number, scene: Scene, generateMipMaps: boolean = true, invertY: boolean = false, samplingMode: number = Texture.TRILINEAR_SAMPLINGMODE) {
+        constructor(data: ArrayBufferView, width: number, height: number, public format: number, scene: Scene, generateMipMaps: boolean = true, invertY: boolean = false, samplingMode: number = Texture.TRILINEAR_SAMPLINGMODE, type: number = Engine.TEXTURETYPE_UNSIGNED_INT) {
             super(null, scene, !generateMipMaps, invertY);
             super(null, scene, !generateMipMaps, invertY);
             this._engine = scene.getEngine();
             this._engine = scene.getEngine();
-            this._texture = scene.getEngine().createRawTexture(data, width, height, format, generateMipMaps, invertY, samplingMode);
+            this._texture = scene.getEngine().createRawTexture(data, width, height, format, generateMipMaps, invertY, samplingMode, null, type);
 
 
             this.wrapU = Texture.CLAMP_ADDRESSMODE;
             this.wrapU = Texture.CLAMP_ADDRESSMODE;
             this.wrapV = Texture.CLAMP_ADDRESSMODE;
             this.wrapV = Texture.CLAMP_ADDRESSMODE;
@@ -27,12 +27,12 @@
             return new RawTexture(data, width, height, Engine.TEXTUREFORMAT_ALPHA, scene, generateMipMaps, invertY, samplingMode);
             return new RawTexture(data, width, height, Engine.TEXTUREFORMAT_ALPHA, scene, generateMipMaps, invertY, samplingMode);
         }
         }
 
 
-        public static CreateRGBTexture(data: ArrayBufferView, width: number, height: number, scene: Scene, generateMipMaps: boolean = true, invertY: boolean = false, samplingMode: number = Texture.TRILINEAR_SAMPLINGMODE): RawTexture {
-            return new RawTexture(data, width, height, Engine.TEXTUREFORMAT_RGB, scene, generateMipMaps, invertY, samplingMode);
+        public static CreateRGBTexture(data: ArrayBufferView, width: number, height: number, scene: Scene, generateMipMaps: boolean = true, invertY: boolean = false, samplingMode: number = Texture.TRILINEAR_SAMPLINGMODE, type: number = Engine.TEXTURETYPE_UNSIGNED_INT): RawTexture {
+            return new RawTexture(data, width, height, Engine.TEXTUREFORMAT_RGB, scene, generateMipMaps, invertY, samplingMode, type);
         }
         }
 
 
-        public static CreateRGBATexture(data: ArrayBufferView, width: number, height: number, scene: Scene, generateMipMaps: boolean = true, invertY: boolean = false, samplingMode: number = Texture.TRILINEAR_SAMPLINGMODE): RawTexture {
-            return new RawTexture(data, width, height, Engine.TEXTUREFORMAT_RGBA, scene, generateMipMaps, invertY, samplingMode);
+        public static CreateRGBATexture(data: ArrayBufferView, width: number, height: number, scene: Scene, generateMipMaps: boolean = true, invertY: boolean = false, samplingMode: number = Texture.TRILINEAR_SAMPLINGMODE, type: number = Engine.TEXTURETYPE_UNSIGNED_INT): RawTexture {
+            return new RawTexture(data, width, height, Engine.TEXTUREFORMAT_RGBA, scene, generateMipMaps, invertY, samplingMode, type);
         }
         }
     }
     }
 }
 }

+ 28 - 1
src/Math/babylon.math.ts

@@ -1348,10 +1348,10 @@
             return (this.x * this.x + this.y * this.y + this.z * this.z);
             return (this.x * this.x + this.y * this.y + this.z * this.z);
         }
         }
 
 
-        // Methods
         /**
         /**
          * Normalize the current Vector3.  
          * Normalize the current Vector3.  
          * Returns the updated Vector3.  
          * Returns the updated Vector3.  
+         * /!\ In place operation.
          */
          */
         public normalize(): Vector3 {
         public normalize(): Vector3 {
             var len = this.length();
             var len = this.length();
@@ -1366,6 +1366,33 @@
         }
         }
 
 
         /**
         /**
+         * Normalize the current Vector3 to a new vector.
+         * @returns the new Vector3.
+         */
+        public normalizeToNew(): Vector3 {
+            const normalized = new Vector3(0, 0, 0);
+            this.normalizeToRef(normalized);
+            return normalized;
+        }
+
+        /**
+         * Normalize the current Vector3 to the reference.
+         * @param the reference to update.
+         * @returns the updated Vector3.
+         */
+        public normalizeToRef(reference: Vector3): Vector3 {
+            var len = this.length();
+            if (len === 0 || len === 1.0) {
+                reference.set(this.x, this.y, this.z);
+                return reference;
+            }
+
+            const scale = 1.0 / len;
+            this.scaleToRef(scale, reference);
+            return reference;
+        }
+
+        /**
          * Returns a new Vector3 copied from the current Vector3.  
          * Returns a new Vector3 copied from the current Vector3.  
          */
          */
         public clone(): Vector3 {
         public clone(): Vector3 {

+ 58 - 9
src/Mesh/babylon.mesh.ts

@@ -665,15 +665,19 @@
 
 
         /**
         /**
          * This method recomputes and sets a new BoundingInfo to the mesh unless it is locked.
          * This method recomputes and sets a new BoundingInfo to the mesh unless it is locked.
-         * This means the mesh underlying bounding box and sphere are recomputed.   
-         * Returns the Mesh.  
+         * This means the mesh underlying bounding box and sphere are recomputed.
+         * Returns the Mesh.
          */
          */
         public refreshBoundingInfo(): Mesh {
         public refreshBoundingInfo(): Mesh {
+            return this._refreshBoundingInfo(false);
+        }
+
+        public _refreshBoundingInfo(applySkeleton: boolean): Mesh {
             if (this._boundingInfo && this._boundingInfo.isLocked) {
             if (this._boundingInfo && this._boundingInfo.isLocked) {
                 return this;
                 return this;
             }
             }
-            var data = this.getVerticesData(VertexBuffer.PositionKind);
 
 
+            var data = this._getPositionData(applySkeleton);
             if (data) {
             if (data) {
                 var extend = Tools.ExtractMinAndMax(data, 0, this.getTotalVertices());
                 var extend = Tools.ExtractMinAndMax(data, 0, this.getTotalVertices());
                 this._boundingInfo = new BoundingInfo(extend.minimum, extend.maximum);
                 this._boundingInfo = new BoundingInfo(extend.minimum, extend.maximum);
@@ -689,6 +693,55 @@
             return this;
             return this;
         }
         }
 
 
+        private _getPositionData(applySkeleton: boolean): Nullable<FloatArray> {
+            var data = this.getVerticesData(VertexBuffer.PositionKind);
+
+            if (data && applySkeleton && this.skeleton) {
+                data = data.slice();
+
+                var matricesIndicesData = this.getVerticesData(VertexBuffer.MatricesIndicesKind);
+                var matricesWeightsData = this.getVerticesData(VertexBuffer.MatricesWeightsKind);
+                if (matricesWeightsData && matricesIndicesData) {
+                    var needExtras = this.numBoneInfluencers > 4;
+                    var matricesIndicesExtraData = needExtras ? this.getVerticesData(VertexBuffer.MatricesIndicesExtraKind) : null;
+                    var matricesWeightsExtraData = needExtras ? this.getVerticesData(VertexBuffer.MatricesWeightsExtraKind) : null;
+
+                    var skeletonMatrices = this.skeleton.getTransformMatrices(this);
+
+                    var tempVector = Tmp.Vector3[0];
+                    var finalMatrix = Tmp.Matrix[0];
+                    var tempMatrix = Tmp.Matrix[1];
+
+                    var matWeightIdx = 0;
+                    for (var index = 0; index < data.length; index += 3, matWeightIdx += 4) {
+                        finalMatrix.reset();
+
+                        var inf: number;
+                        var weight: number;
+                        for (inf = 0; inf < 4; inf++) {
+                            weight = matricesWeightsData[matWeightIdx + inf];
+                            if (weight <= 0) break;
+                            Matrix.FromFloat32ArrayToRefScaled(skeletonMatrices, matricesIndicesData[matWeightIdx + inf] * 16, weight, tempMatrix);
+                            finalMatrix.addToSelf(tempMatrix);
+                        }
+                        if (needExtras) {
+                            for (inf = 0; inf < 4; inf++) {
+                                weight = matricesWeightsExtraData![matWeightIdx + inf];
+                                if (weight <= 0) break;
+                                Matrix.FromFloat32ArrayToRefScaled(skeletonMatrices, matricesIndicesExtraData![matWeightIdx + inf] * 16, weight, tempMatrix);
+                                finalMatrix.addToSelf(tempMatrix);
+                            }
+                        }
+
+                        Vector3.TransformCoordinatesFromFloatsToRef(data[index], data[index + 1], data[index + 2], finalMatrix, tempVector);
+                        tempVector.toArray(data, index);
+                    }
+                }
+            }
+
+            return data;
+        }
+
         public _createGlobalSubMesh(force: boolean): Nullable<SubMesh> {
         public _createGlobalSubMesh(force: boolean): Nullable<SubMesh> {
             var totalVertices = this.getTotalVertices();
             var totalVertices = this.getTotalVertices();
             if (!totalVertices || !this.getIndices()) {
             if (!totalVertices || !this.getIndices()) {
@@ -3115,10 +3168,6 @@
             var matricesIndicesExtraData = needExtras ? this.getVerticesData(VertexBuffer.MatricesIndicesExtraKind) : null;
             var matricesIndicesExtraData = needExtras ? this.getVerticesData(VertexBuffer.MatricesIndicesExtraKind) : null;
             var matricesWeightsExtraData = needExtras ? this.getVerticesData(VertexBuffer.MatricesWeightsExtraKind) : null;
             var matricesWeightsExtraData = needExtras ? this.getVerticesData(VertexBuffer.MatricesWeightsExtraKind) : null;
 
 
-            if (!matricesWeightsExtraData || !matricesIndicesExtraData) {
-                return this;
-            }
-
             var skeletonMatrices = skeleton.getTransformMatrices(this);
             var skeletonMatrices = skeleton.getTransformMatrices(this);
 
 
             var tempVector3 = Vector3.Zero();
             var tempVector3 = Vector3.Zero();
@@ -3139,9 +3188,9 @@
                 }
                 }
                 if (needExtras) {
                 if (needExtras) {
                     for (inf = 0; inf < 4; inf++) {
                     for (inf = 0; inf < 4; inf++) {
-                        weight = matricesWeightsExtraData[matWeightIdx + inf];
+                        weight = matricesWeightsExtraData![matWeightIdx + inf];
                         if (weight > 0) {
                         if (weight > 0) {
-                            Matrix.FromFloat32ArrayToRefScaled(skeletonMatrices, matricesIndicesExtraData[matWeightIdx + inf] * 16, weight, tempMatrix);
+                            Matrix.FromFloat32ArrayToRefScaled(skeletonMatrices, matricesIndicesExtraData![matWeightIdx + inf] * 16, weight, tempMatrix);
                             finalMatrix.addToSelf(tempMatrix);
                             finalMatrix.addToSelf(tempMatrix);
 
 
                         } else break;
                         } else break;

+ 6 - 1
src/babylon.scene.ts

@@ -484,7 +484,7 @@
 
 
         public get gamepadManager(): GamepadManager {
         public get gamepadManager(): GamepadManager {
             if (!this._gamepadManager) {
             if (!this._gamepadManager) {
-                this._gamepadManager = new GamepadManager();
+                this._gamepadManager = new GamepadManager(this);
             }
             }
 
 
             return this._gamepadManager;
             return this._gamepadManager;
@@ -3430,6 +3430,11 @@
                 }
                 }
             }
             }
 
 
+            // update gamepad manager
+            if (this._gamepadManager && this._gamepadManager._isMonitoring) {
+                this._gamepadManager._checkGamepadsStatus();
+            }
+
             // Before render
             // Before render
             this.onBeforeRenderObservable.notifyObservers(this);
             this.onBeforeRenderObservable.notifyObservers(this);