Browse Source

Merge remote-tracking branch 'upstream/master'

MackeyK24 6 years ago
parent
commit
2c790fc2c2
42 changed files with 1136 additions and 747 deletions
  1. 31 31
      Playground/babylon.d.txt
  2. 1 1
      Viewer/src/model/viewerModel.ts
  3. 31 31
      dist/preview release/babylon.d.ts
  4. 2 2
      dist/preview release/babylon.js
  5. 400 32
      dist/preview release/babylon.max.js
  6. 1 1
      dist/preview release/babylon.max.js.map
  7. 62 62
      dist/preview release/babylon.module.d.ts
  8. 1 1
      dist/preview release/inspector/babylon.inspector.bundle.js
  9. 3 1
      dist/preview release/inspector/babylon.inspector.bundle.max.js
  10. 1 1
      dist/preview release/inspector/babylon.inspector.bundle.max.js.map
  11. 6 6
      dist/preview release/loaders/babylon.glTF2FileLoader.js
  12. 1 1
      dist/preview release/loaders/babylon.glTF2FileLoader.js.map
  13. 1 1
      dist/preview release/loaders/babylon.glTF2FileLoader.min.js
  14. 6 6
      dist/preview release/loaders/babylon.glTFFileLoader.js
  15. 1 1
      dist/preview release/loaders/babylon.glTFFileLoader.js.map
  16. 1 1
      dist/preview release/loaders/babylon.glTFFileLoader.min.js
  17. 6 6
      dist/preview release/loaders/babylonjs.loaders.js
  18. 1 1
      dist/preview release/loaders/babylonjs.loaders.js.map
  19. 1 1
      dist/preview release/loaders/babylonjs.loaders.min.js
  20. 62 62
      dist/preview release/viewer/babylon.module.d.ts
  21. 310 310
      dist/preview release/viewer/babylon.viewer.js
  22. 3 3
      dist/preview release/viewer/babylon.viewer.max.js
  23. 3 1
      inspector/src/components/actionTabs/tabs/propertyGrids/animationPropertyGridComponent.tsx
  24. 2 2
      src/Animations/animatable.ts
  25. 5 5
      src/Animations/runtimeAnimation.ts
  26. 3 1
      src/Culling/boundingBox.ts
  27. 8 2
      src/Engines/engine.ts
  28. 16 16
      src/Materials/PBR/pbrBaseMaterial.ts
  29. 4 4
      src/Materials/Textures/baseTexture.ts
  30. 46 46
      src/Materials/Textures/internalTexture.ts
  31. 39 39
      src/Materials/Textures/texture.ts
  32. 11 11
      src/Materials/material.ts
  33. 1 1
      src/Materials/shaderMaterial.ts
  34. 2 2
      src/Maths/math.ts
  35. 13 13
      src/Meshes/abstractMesh.ts
  36. 16 14
      src/Meshes/mesh.ts
  37. 9 9
      src/Meshes/subMesh.ts
  38. 10 3
      src/Meshes/transformNode.ts
  39. 1 1
      src/Misc/tools.ts
  40. 6 6
      src/node.ts
  41. 2 2
      src/scene.ts
  42. 7 7
      tests/unit/babylon/src/Loading/babylon.sceneLoader.tests.ts

+ 31 - 31
Playground/babylon.d.txt

@@ -484,7 +484,7 @@ declare module BABYLON {
          */
         static FromHexString(hex: string): Color3;
         /**
-         * Creates a new Vector3 from the starting index of the given array
+         * Creates a new Color3 from the starting index of the given array
          * @param array defines the source array
          * @param offset defines an offset in the source array
          * @returns a new Color3 object
@@ -6289,8 +6289,8 @@ declare module BABYLON {
         /** @hidden */
size: number;
         /** @hidden */
extension: string;
         /** @hidden */
files: Nullable<string[]>;
-        /** @hidden */
workingCanvas: HTMLCanvasElement;
-        /** @hidden */
workingContext: CanvasRenderingContext2D;
+        /** @hidden */
workingCanvas: Nullable<HTMLCanvasElement>;
+        /** @hidden */
workingContext: Nullable<CanvasRenderingContext2D>;
         /** @hidden */
framebuffer: Nullable<WebGLFramebuffer>;
         /** @hidden */
depthStencilBuffer: Nullable<WebGLRenderbuffer>;
         /** @hidden */
MSAAFramebuffer: Nullable<WebGLFramebuffer>;
@@ -6311,9 +6311,9 @@ declare module BABYLON {
         /** @hidden */
lodGenerationOffset: number;
         /** @hidden */
colorTextureArray: Nullable<WebGLTexture>;
         /** @hidden */
depthStencilTextureArray: Nullable<WebGLTexture>;
-        /** @hidden */
lodTextureHigh: BaseTexture;
-        /** @hidden */
lodTextureMid: BaseTexture;
-        /** @hidden */
lodTextureLow: BaseTexture;
+        /** @hidden */
lodTextureHigh: Nullable<BaseTexture>;
+        /** @hidden */
lodTextureMid: Nullable<BaseTexture>;
+        /** @hidden */
lodTextureLow: Nullable<BaseTexture>;
         /** @hidden */
isRGBD: boolean;
         /** @hidden */
webGLTexture: Nullable<WebGLTexture>;
         /** @hidden */
references: number;
@@ -7442,7 +7442,7 @@ declare module BABYLON {
          * Gets or sets a boolean indicating that even if rotationQuaternion is defined, you can keep updating rotation property and Babylon.js will just mix both
          */
         reIntegrateRotationIntoRotationQuaternion: boolean;
-        /** @hidden */
poseMatrix: Matrix;
+        /** @hidden */
poseMatrix: Nullable<Matrix>;
         /** @hidden */
localMatrix: Matrix;
         private _usePivotMatrix;
         private _absolutePosition;
@@ -17736,7 +17736,7 @@ declare module BABYLON {
          * List of inspectable custom properties (used by the Inspector)
          * @see https://doc.babylonjs.com/how_to/debug_layer#extensibility
          */
-        inspectableCustomProperties: IInspectable[];
+        inspectableCustomProperties: Nullable<IInspectable[]>;
         private _noMipmap;
         /** @hidden */
invertY: boolean;
         private _rowGenerationMatrix;
@@ -18207,7 +18207,7 @@ declare module BABYLON {
         /**
          * Gets the root Animatable used to synchronize and normalize animations
          */
-        readonly syncRoot: Animatable;
+        readonly syncRoot: Nullable<Animatable>;
         /**
          * Gets the current frame of the first RuntimeAnimation
          * Used to synchronize Animatables
@@ -21337,15 +21337,15 @@ declare module BABYLON {
         /**
          * Callback triggered when the material is compiled
          */
-        onCompiled: (effect: Effect) => void;
+        onCompiled: Nullable<(effect: Effect) => void>;
         /**
          * Callback triggered when an error occurs
          */
-        onError: (effect: Effect, errors: string) => void;
+        onError: Nullable<(effect: Effect, errors: string) => void>;
         /**
          * Callback triggered to get the render target textures
          */
-        getRenderTargetTextures: () => SmartArray<RenderTargetTexture>;
+        getRenderTargetTextures: Nullable<() => SmartArray<RenderTargetTexture>>;
         /**
          * Gets a boolean indicating that current material needs to register RTT
          */
@@ -21360,7 +21360,7 @@ declare module BABYLON {
         /**
          * Stores the animations for the material
          */
-        animations: Array<Animation>;
+        animations: Nullable<Array<Animation>>;
         /**
         * An event triggered when the material is disposed
         */
@@ -21797,7 +21797,7 @@ declare module BABYLON {
         private _linesIndexBuffer;
         /** @hidden */
lastColliderWorldVertices: Nullable<Vector3[]>;
         /** @hidden */
trianglePlanes: Plane[];
-        /** @hidden */
lastColliderTransformMatrix: Matrix;
+        /** @hidden */
lastColliderTransformMatrix: Nullable<Matrix>;
         /** @hidden */
renderId: number;
         /** @hidden */
alphaIndex: number;
         /** @hidden */
distanceToCamera: number;
@@ -23560,7 +23560,7 @@ declare module BABYLON {
         /** @hidden */
occlusionQuery: Nullable<WebGLQuery>;
         private _visibility;
         /** @hidden */
isActive: boolean;
-        /** @hidden */
renderingGroup: RenderingGroup;
+        /** @hidden */
renderingGroup: Nullable<RenderingGroup>;
         /**
          * Gets or sets mesh visibility between 0 and 1 (default is 1)
          */
@@ -23703,7 +23703,7 @@ declare module BABYLON {
         /** @hidden */
unIndexed: boolean;
         /** @hidden */
lightSources: Light[];
         /** @hidden */
protected readonly _positions: Nullable<Vector3[]>;
-        /** @hidden */
waitingActions: any;
+        /** @hidden */
waitingActions: Nullable<any>;
         /** @hidden */
waitingFreezeWorldMatrix: Nullable<boolean>;
         private _skeleton;
         /** @hidden */
bonesTransformMatrices: Nullable<Float32Array>;
@@ -23962,7 +23962,7 @@ declare module BABYLON {
          * Gets Collider object used to compute collisions (not physics)
          * @see http://doc.babylonjs.com/babylon101/cameras,_mesh_collisions_and_gravity
          */
-        readonly collider: Collider;
+        readonly collider: Nullable<Collider>;
         /**
          * Move the mesh using collision engine
          * @see http://doc.babylonjs.com/babylon101/cameras,_mesh_collisions_and_gravity
@@ -24399,7 +24399,7 @@ declare module BABYLON {
         /**
          * Callback raised when the node is ready to be used
          */
-        onReady: (node: Node) => void;
+        onReady: Nullable<(node: Node) => void>;
         private _isEnabled;
         private _isParentEnabled;
         private _isReady;
@@ -27614,7 +27614,7 @@ declare module BABYLON {
          * @param indexParameters defines an object containing the index values to use to compile shaders (like the maximum number of simultaneous lights)
          * @returns the new Effect
          */
-        createEffect(baseName: any, attributesNamesOrOptions: string[] | EffectCreationOptions, uniformsNamesOrEngine: string[] | Engine, samplers?: string[], defines?: string, fallbacks?: EffectFallbacks, onCompiled?: (effect: Effect) => void, onError?: (effect: Effect, errors: string) => void, indexParameters?: any): Effect;
+        createEffect(baseName: any, attributesNamesOrOptions: string[] | EffectCreationOptions, uniformsNamesOrEngine: string[] | Engine, samplers?: string[], defines?: string, fallbacks?: EffectFallbacks, onCompiled?: Nullable<(effect: Effect) => void>, onError?: Nullable<(effect: Effect, errors: string) => void>, indexParameters?: any): Effect;
         private _compileShader;
         private _compileRawShader;
         /**
@@ -30050,7 +30050,7 @@ declare module BABYLON {
         /**
          * Array of animations
          */
-        animations: Array<Animation>;
+        animations: Nullable<Array<Animation>>;
     }
     /** Interface used by value gradients (color, factor, ...) */
     export interface IValueGradient {
@@ -44085,11 +44085,11 @@ declare module BABYLON {
         /**
          * AKA Diffuse Texture in standard nomenclature.
          */
-        protected _albedoTexture: BaseTexture;
+        protected _albedoTexture: Nullable<BaseTexture>;
         /**
          * AKA Occlusion Texture in other nomenclature.
          */
-        protected _ambientTexture: BaseTexture;
+        protected _ambientTexture: Nullable<BaseTexture>;
         /**
          * AKA Occlusion Texture Intensity in other nomenclature.
          */
@@ -44103,23 +44103,23 @@ declare module BABYLON {
         /**
          * Stores the alpha values in a texture.
          */
-        protected _opacityTexture: BaseTexture;
+        protected _opacityTexture: Nullable<BaseTexture>;
         /**
          * Stores the reflection values in a texture.
          */
-        protected _reflectionTexture: BaseTexture;
+        protected _reflectionTexture: Nullable<BaseTexture>;
         /**
          * Stores the emissive values in a texture.
          */
-        protected _emissiveTexture: BaseTexture;
+        protected _emissiveTexture: Nullable<BaseTexture>;
         /**
          * AKA Specular texture in other nomenclature.
          */
-        protected _reflectivityTexture: BaseTexture;
+        protected _reflectivityTexture: Nullable<BaseTexture>;
         /**
          * Used to switch from specular/glossiness to metallic/roughness workflow.
          */
-        protected _metallicTexture: BaseTexture;
+        protected _metallicTexture: Nullable<BaseTexture>;
         /**
          * Specifies the metallic scalar of the metallic/roughness workflow.
          * Can also be used to scale the metalness values of the metallic texture.
@@ -44134,15 +44134,15 @@ declare module BABYLON {
          * Used to enable roughness/glossiness fetch from a separate channel depending on the current mode.
          * Gray Scale represents roughness in metallic mode and glossiness in specular mode.
          */
-        protected _microSurfaceTexture: BaseTexture;
+        protected _microSurfaceTexture: Nullable<BaseTexture>;
         /**
          * Stores surface normal data used to displace a mesh in a texture.
          */
-        protected _bumpTexture: BaseTexture;
+        protected _bumpTexture: Nullable<BaseTexture>;
         /**
          * Stores the pre-calculated light information of a mesh in a texture.
          */
-        protected _lightmapTexture: BaseTexture;
+        protected _lightmapTexture: Nullable<BaseTexture>;
         /**
          * The color of a material in ambient lighting.
          */
@@ -44445,7 +44445,7 @@ declare module BABYLON {
         /**
          * Gets the texture used for the alpha test.
          */
-        getAlphaTestTexture(): BaseTexture;
+        getAlphaTestTexture(): Nullable<BaseTexture>;
         /**
          * Specifies that the submesh is ready to be used.
          * @param mesh - BJS mesh.

+ 1 - 1
Viewer/src/model/viewerModel.ts

@@ -264,7 +264,7 @@ export class ViewerModel implements IDisposable {
                 let ag = new AnimationGroup("animation-" + idx, this._configurationContainer && this._configurationContainer.scene);
                 let add = false;
                 skeleton.getAnimatables().forEach((a) => {
-                    if (a.animations[0]) {
+                    if (a.animations && a.animations[0]) {
                         ag.addTargetedAnimation(a.animations[0], a);
                         add = true;
                     }

+ 31 - 31
dist/preview release/babylon.d.ts

@@ -484,7 +484,7 @@ declare module BABYLON {
          */
         static FromHexString(hex: string): Color3;
         /**
-         * Creates a new Vector3 from the starting index of the given array
+         * Creates a new Color3 from the starting index of the given array
          * @param array defines the source array
          * @param offset defines an offset in the source array
          * @returns a new Color3 object
@@ -6325,9 +6325,9 @@ declare module BABYLON {
         /** @hidden */
         _files: Nullable<string[]>;
         /** @hidden */
-        _workingCanvas: HTMLCanvasElement;
+        _workingCanvas: Nullable<HTMLCanvasElement>;
         /** @hidden */
-        _workingContext: CanvasRenderingContext2D;
+        _workingContext: Nullable<CanvasRenderingContext2D>;
         /** @hidden */
         _framebuffer: Nullable<WebGLFramebuffer>;
         /** @hidden */
@@ -6369,11 +6369,11 @@ declare module BABYLON {
         /** @hidden */
         _depthStencilTextureArray: Nullable<WebGLTexture>;
         /** @hidden */
-        _lodTextureHigh: BaseTexture;
+        _lodTextureHigh: Nullable<BaseTexture>;
         /** @hidden */
-        _lodTextureMid: BaseTexture;
+        _lodTextureMid: Nullable<BaseTexture>;
         /** @hidden */
-        _lodTextureLow: BaseTexture;
+        _lodTextureLow: Nullable<BaseTexture>;
         /** @hidden */
         _isRGBD: boolean;
         /** @hidden */
@@ -7525,7 +7525,7 @@ declare module BABYLON {
          */
         reIntegrateRotationIntoRotationQuaternion: boolean;
         /** @hidden */
-        _poseMatrix: Matrix;
+        _poseMatrix: Nullable<Matrix>;
         /** @hidden */
         _localMatrix: Matrix;
         private _usePivotMatrix;
@@ -18009,7 +18009,7 @@ declare module BABYLON {
          * List of inspectable custom properties (used by the Inspector)
          * @see https://doc.babylonjs.com/how_to/debug_layer#extensibility
          */
-        inspectableCustomProperties: IInspectable[];
+        inspectableCustomProperties: Nullable<IInspectable[]>;
         private _noMipmap;
         /** @hidden */
         _invertY: boolean;
@@ -18485,7 +18485,7 @@ declare module BABYLON {
         /**
          * Gets the root Animatable used to synchronize and normalize animations
          */
-        readonly syncRoot: Animatable;
+        readonly syncRoot: Nullable<Animatable>;
         /**
          * Gets the current frame of the first RuntimeAnimation
          * Used to synchronize Animatables
@@ -21669,15 +21669,15 @@ declare module BABYLON {
         /**
          * Callback triggered when the material is compiled
          */
-        onCompiled: (effect: Effect) => void;
+        onCompiled: Nullable<(effect: Effect) => void>;
         /**
          * Callback triggered when an error occurs
          */
-        onError: (effect: Effect, errors: string) => void;
+        onError: Nullable<(effect: Effect, errors: string) => void>;
         /**
          * Callback triggered to get the render target textures
          */
-        getRenderTargetTextures: () => SmartArray<RenderTargetTexture>;
+        getRenderTargetTextures: Nullable<() => SmartArray<RenderTargetTexture>>;
         /**
          * Gets a boolean indicating that current material needs to register RTT
          */
@@ -21693,7 +21693,7 @@ declare module BABYLON {
         /**
          * Stores the animations for the material
          */
-        animations: Array<Animation>;
+        animations: Nullable<Array<Animation>>;
         /**
         * An event triggered when the material is disposed
         */
@@ -22140,7 +22140,7 @@ declare module BABYLON {
         /** @hidden */
         _trianglePlanes: Plane[];
         /** @hidden */
-        _lastColliderTransformMatrix: Matrix;
+        _lastColliderTransformMatrix: Nullable<Matrix>;
         /** @hidden */
         _renderId: number;
         /** @hidden */
@@ -23944,7 +23944,7 @@ declare module BABYLON {
         /** @hidden */
         _isActive: boolean;
         /** @hidden */
-        _renderingGroup: RenderingGroup;
+        _renderingGroup: Nullable<RenderingGroup>;
         /**
          * Gets or sets mesh visibility between 0 and 1 (default is 1)
          */
@@ -24096,7 +24096,7 @@ declare module BABYLON {
         /** @hidden */
         readonly _positions: Nullable<Vector3[]>;
         /** @hidden */
-        _waitingActions: any;
+        _waitingActions: Nullable<any>;
         /** @hidden */
         _waitingFreezeWorldMatrix: Nullable<boolean>;
         private _skeleton;
@@ -24377,7 +24377,7 @@ declare module BABYLON {
          * Gets Collider object used to compute collisions (not physics)
          * @see http://doc.babylonjs.com/babylon101/cameras,_mesh_collisions_and_gravity
          */
-        readonly collider: Collider;
+        readonly collider: Nullable<Collider>;
         /**
          * Move the mesh using collision engine
          * @see http://doc.babylonjs.com/babylon101/cameras,_mesh_collisions_and_gravity
@@ -24821,7 +24821,7 @@ declare module BABYLON {
         /**
          * Callback raised when the node is ready to be used
          */
-        onReady: (node: Node) => void;
+        onReady: Nullable<(node: Node) => void>;
         private _isEnabled;
         private _isParentEnabled;
         private _isReady;
@@ -28081,7 +28081,7 @@ declare module BABYLON {
          * @param indexParameters defines an object containing the index values to use to compile shaders (like the maximum number of simultaneous lights)
          * @returns the new Effect
          */
-        createEffect(baseName: any, attributesNamesOrOptions: string[] | EffectCreationOptions, uniformsNamesOrEngine: string[] | Engine, samplers?: string[], defines?: string, fallbacks?: EffectFallbacks, onCompiled?: (effect: Effect) => void, onError?: (effect: Effect, errors: string) => void, indexParameters?: any): Effect;
+        createEffect(baseName: any, attributesNamesOrOptions: string[] | EffectCreationOptions, uniformsNamesOrEngine: string[] | Engine, samplers?: string[], defines?: string, fallbacks?: EffectFallbacks, onCompiled?: Nullable<(effect: Effect) => void>, onError?: Nullable<(effect: Effect, errors: string) => void>, indexParameters?: any): Effect;
         private _compileShader;
         private _compileRawShader;
         /**
@@ -30587,7 +30587,7 @@ declare module BABYLON {
         /**
          * Array of animations
          */
-        animations: Array<Animation>;
+        animations: Nullable<Array<Animation>>;
     }
     /** Interface used by value gradients (color, factor, ...) */
     export interface IValueGradient {
@@ -44767,11 +44767,11 @@ declare module BABYLON {
         /**
          * AKA Diffuse Texture in standard nomenclature.
          */
-        protected _albedoTexture: BaseTexture;
+        protected _albedoTexture: Nullable<BaseTexture>;
         /**
          * AKA Occlusion Texture in other nomenclature.
          */
-        protected _ambientTexture: BaseTexture;
+        protected _ambientTexture: Nullable<BaseTexture>;
         /**
          * AKA Occlusion Texture Intensity in other nomenclature.
          */
@@ -44785,23 +44785,23 @@ declare module BABYLON {
         /**
          * Stores the alpha values in a texture.
          */
-        protected _opacityTexture: BaseTexture;
+        protected _opacityTexture: Nullable<BaseTexture>;
         /**
          * Stores the reflection values in a texture.
          */
-        protected _reflectionTexture: BaseTexture;
+        protected _reflectionTexture: Nullable<BaseTexture>;
         /**
          * Stores the emissive values in a texture.
          */
-        protected _emissiveTexture: BaseTexture;
+        protected _emissiveTexture: Nullable<BaseTexture>;
         /**
          * AKA Specular texture in other nomenclature.
          */
-        protected _reflectivityTexture: BaseTexture;
+        protected _reflectivityTexture: Nullable<BaseTexture>;
         /**
          * Used to switch from specular/glossiness to metallic/roughness workflow.
          */
-        protected _metallicTexture: BaseTexture;
+        protected _metallicTexture: Nullable<BaseTexture>;
         /**
          * Specifies the metallic scalar of the metallic/roughness workflow.
          * Can also be used to scale the metalness values of the metallic texture.
@@ -44816,15 +44816,15 @@ declare module BABYLON {
          * Used to enable roughness/glossiness fetch from a separate channel depending on the current mode.
          * Gray Scale represents roughness in metallic mode and glossiness in specular mode.
          */
-        protected _microSurfaceTexture: BaseTexture;
+        protected _microSurfaceTexture: Nullable<BaseTexture>;
         /**
          * Stores surface normal data used to displace a mesh in a texture.
          */
-        protected _bumpTexture: BaseTexture;
+        protected _bumpTexture: Nullable<BaseTexture>;
         /**
          * Stores the pre-calculated light information of a mesh in a texture.
          */
-        protected _lightmapTexture: BaseTexture;
+        protected _lightmapTexture: Nullable<BaseTexture>;
         /**
          * The color of a material in ambient lighting.
          */
@@ -45127,7 +45127,7 @@ declare module BABYLON {
         /**
          * Gets the texture used for the alpha test.
          */
-        getAlphaTestTexture(): BaseTexture;
+        getAlphaTestTexture(): Nullable<BaseTexture>;
         /**
          * Specifies that the submesh is ready to be used.
          * @param mesh - BJS mesh.

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


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


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


+ 62 - 62
dist/preview release/babylon.module.d.ts

@@ -486,7 +486,7 @@ declare module "babylonjs/Maths/math" {
          */
         static FromHexString(hex: string): Color3;
         /**
-         * Creates a new Vector3 from the starting index of the given array
+         * Creates a new Color3 from the starting index of the given array
          * @param array defines the source array
          * @param offset defines an offset in the source array
          * @returns a new Color3 object
@@ -6350,9 +6350,9 @@ declare module "babylonjs/Materials/Textures/internalTexture" {
         /** @hidden */
         _files: Nullable<string[]>;
         /** @hidden */
-        _workingCanvas: HTMLCanvasElement;
+        _workingCanvas: Nullable<HTMLCanvasElement>;
         /** @hidden */
-        _workingContext: CanvasRenderingContext2D;
+        _workingContext: Nullable<CanvasRenderingContext2D>;
         /** @hidden */
         _framebuffer: Nullable<WebGLFramebuffer>;
         /** @hidden */
@@ -6394,11 +6394,11 @@ declare module "babylonjs/Materials/Textures/internalTexture" {
         /** @hidden */
         _depthStencilTextureArray: Nullable<WebGLTexture>;
         /** @hidden */
-        _lodTextureHigh: BaseTexture;
+        _lodTextureHigh: Nullable<BaseTexture>;
         /** @hidden */
-        _lodTextureMid: BaseTexture;
+        _lodTextureMid: Nullable<BaseTexture>;
         /** @hidden */
-        _lodTextureLow: BaseTexture;
+        _lodTextureLow: Nullable<BaseTexture>;
         /** @hidden */
         _isRGBD: boolean;
         /** @hidden */
@@ -7580,7 +7580,7 @@ declare module "babylonjs/Meshes/transformNode" {
          */
         reIntegrateRotationIntoRotationQuaternion: boolean;
         /** @hidden */
-        _poseMatrix: Matrix;
+        _poseMatrix: Nullable<Matrix>;
         /** @hidden */
         _localMatrix: Matrix;
         private _usePivotMatrix;
@@ -18488,7 +18488,7 @@ declare module "babylonjs/Materials/Textures/texture" {
          * List of inspectable custom properties (used by the Inspector)
          * @see https://doc.babylonjs.com/how_to/debug_layer#extensibility
          */
-        inspectableCustomProperties: IInspectable[];
+        inspectableCustomProperties: Nullable<IInspectable[]>;
         private _noMipmap;
         /** @hidden */
         _invertY: boolean;
@@ -18976,7 +18976,7 @@ declare module "babylonjs/Animations/animatable" {
         /**
          * Gets the root Animatable used to synchronize and normalize animations
          */
-        readonly syncRoot: Animatable;
+        readonly syncRoot: Nullable<Animatable>;
         /**
          * Gets the current frame of the first RuntimeAnimation
          * Used to synchronize Animatables
@@ -22246,15 +22246,15 @@ declare module "babylonjs/Materials/material" {
         /**
          * Callback triggered when the material is compiled
          */
-        onCompiled: (effect: Effect) => void;
+        onCompiled: Nullable<(effect: Effect) => void>;
         /**
          * Callback triggered when an error occurs
          */
-        onError: (effect: Effect, errors: string) => void;
+        onError: Nullable<(effect: Effect, errors: string) => void>;
         /**
          * Callback triggered to get the render target textures
          */
-        getRenderTargetTextures: () => SmartArray<RenderTargetTexture>;
+        getRenderTargetTextures: Nullable<() => SmartArray<RenderTargetTexture>>;
         /**
          * Gets a boolean indicating that current material needs to register RTT
          */
@@ -22270,7 +22270,7 @@ declare module "babylonjs/Materials/material" {
         /**
          * Stores the animations for the material
          */
-        animations: Array<Animation>;
+        animations: Nullable<Array<Animation>>;
         /**
         * An event triggered when the material is disposed
         */
@@ -22730,7 +22730,7 @@ declare module "babylonjs/Meshes/subMesh" {
         /** @hidden */
         _trianglePlanes: Plane[];
         /** @hidden */
-        _lastColliderTransformMatrix: Matrix;
+        _lastColliderTransformMatrix: Nullable<Matrix>;
         /** @hidden */
         _renderId: number;
         /** @hidden */
@@ -24582,7 +24582,7 @@ declare module "babylonjs/Meshes/abstractMesh" {
         /** @hidden */
         _isActive: boolean;
         /** @hidden */
-        _renderingGroup: RenderingGroup;
+        _renderingGroup: Nullable<RenderingGroup>;
         /**
          * Gets or sets mesh visibility between 0 and 1 (default is 1)
          */
@@ -24734,7 +24734,7 @@ declare module "babylonjs/Meshes/abstractMesh" {
         /** @hidden */
         readonly _positions: Nullable<Vector3[]>;
         /** @hidden */
-        _waitingActions: any;
+        _waitingActions: Nullable<any>;
         /** @hidden */
         _waitingFreezeWorldMatrix: Nullable<boolean>;
         private _skeleton;
@@ -25015,7 +25015,7 @@ declare module "babylonjs/Meshes/abstractMesh" {
          * Gets Collider object used to compute collisions (not physics)
          * @see http://doc.babylonjs.com/babylon101/cameras,_mesh_collisions_and_gravity
          */
-        readonly collider: Collider;
+        readonly collider: Nullable<Collider>;
         /**
          * Move the mesh using collision engine
          * @see http://doc.babylonjs.com/babylon101/cameras,_mesh_collisions_and_gravity
@@ -25481,7 +25481,7 @@ declare module "babylonjs/node" {
         /**
          * Callback raised when the node is ready to be used
          */
-        onReady: (node: Node) => void;
+        onReady: Nullable<(node: Node) => void>;
         private _isEnabled;
         private _isParentEnabled;
         private _isReady;
@@ -28803,7 +28803,7 @@ declare module "babylonjs/Engines/engine" {
          * @param indexParameters defines an object containing the index values to use to compile shaders (like the maximum number of simultaneous lights)
          * @returns the new Effect
          */
-        createEffect(baseName: any, attributesNamesOrOptions: string[] | EffectCreationOptions, uniformsNamesOrEngine: string[] | Engine, samplers?: string[], defines?: string, fallbacks?: EffectFallbacks, onCompiled?: (effect: Effect) => void, onError?: (effect: Effect, errors: string) => void, indexParameters?: any): Effect;
+        createEffect(baseName: any, attributesNamesOrOptions: string[] | EffectCreationOptions, uniformsNamesOrEngine: string[] | Engine, samplers?: string[], defines?: string, fallbacks?: EffectFallbacks, onCompiled?: Nullable<(effect: Effect) => void>, onError?: Nullable<(effect: Effect, errors: string) => void>, indexParameters?: any): Effect;
         private _compileShader;
         private _compileRawShader;
         /**
@@ -31354,7 +31354,7 @@ declare module "babylonjs/Misc/tools" {
         /**
          * Array of animations
          */
-        animations: Array<Animation>;
+        animations: Nullable<Array<Animation>>;
     }
     /** Interface used by value gradients (color, factor, ...) */
     export interface IValueGradient {
@@ -46579,11 +46579,11 @@ declare module "babylonjs/Materials/PBR/pbrBaseMaterial" {
         /**
          * AKA Diffuse Texture in standard nomenclature.
          */
-        protected _albedoTexture: BaseTexture;
+        protected _albedoTexture: Nullable<BaseTexture>;
         /**
          * AKA Occlusion Texture in other nomenclature.
          */
-        protected _ambientTexture: BaseTexture;
+        protected _ambientTexture: Nullable<BaseTexture>;
         /**
          * AKA Occlusion Texture Intensity in other nomenclature.
          */
@@ -46597,23 +46597,23 @@ declare module "babylonjs/Materials/PBR/pbrBaseMaterial" {
         /**
          * Stores the alpha values in a texture.
          */
-        protected _opacityTexture: BaseTexture;
+        protected _opacityTexture: Nullable<BaseTexture>;
         /**
          * Stores the reflection values in a texture.
          */
-        protected _reflectionTexture: BaseTexture;
+        protected _reflectionTexture: Nullable<BaseTexture>;
         /**
          * Stores the emissive values in a texture.
          */
-        protected _emissiveTexture: BaseTexture;
+        protected _emissiveTexture: Nullable<BaseTexture>;
         /**
          * AKA Specular texture in other nomenclature.
          */
-        protected _reflectivityTexture: BaseTexture;
+        protected _reflectivityTexture: Nullable<BaseTexture>;
         /**
          * Used to switch from specular/glossiness to metallic/roughness workflow.
          */
-        protected _metallicTexture: BaseTexture;
+        protected _metallicTexture: Nullable<BaseTexture>;
         /**
          * Specifies the metallic scalar of the metallic/roughness workflow.
          * Can also be used to scale the metalness values of the metallic texture.
@@ -46628,15 +46628,15 @@ declare module "babylonjs/Materials/PBR/pbrBaseMaterial" {
          * Used to enable roughness/glossiness fetch from a separate channel depending on the current mode.
          * Gray Scale represents roughness in metallic mode and glossiness in specular mode.
          */
-        protected _microSurfaceTexture: BaseTexture;
+        protected _microSurfaceTexture: Nullable<BaseTexture>;
         /**
          * Stores surface normal data used to displace a mesh in a texture.
          */
-        protected _bumpTexture: BaseTexture;
+        protected _bumpTexture: Nullable<BaseTexture>;
         /**
          * Stores the pre-calculated light information of a mesh in a texture.
          */
-        protected _lightmapTexture: BaseTexture;
+        protected _lightmapTexture: Nullable<BaseTexture>;
         /**
          * The color of a material in ambient lighting.
          */
@@ -46939,7 +46939,7 @@ declare module "babylonjs/Materials/PBR/pbrBaseMaterial" {
         /**
          * Gets the texture used for the alpha test.
          */
-        getAlphaTestTexture(): BaseTexture;
+        getAlphaTestTexture(): Nullable<BaseTexture>;
         /**
          * Specifies that the submesh is ready to be used.
          * @param mesh - BJS mesh.
@@ -59976,7 +59976,7 @@ declare module BABYLON {
          */
         static FromHexString(hex: string): Color3;
         /**
-         * Creates a new Vector3 from the starting index of the given array
+         * Creates a new Color3 from the starting index of the given array
          * @param array defines the source array
          * @param offset defines an offset in the source array
          * @returns a new Color3 object
@@ -65817,9 +65817,9 @@ declare module BABYLON {
         /** @hidden */
         _files: Nullable<string[]>;
         /** @hidden */
-        _workingCanvas: HTMLCanvasElement;
+        _workingCanvas: Nullable<HTMLCanvasElement>;
         /** @hidden */
-        _workingContext: CanvasRenderingContext2D;
+        _workingContext: Nullable<CanvasRenderingContext2D>;
         /** @hidden */
         _framebuffer: Nullable<WebGLFramebuffer>;
         /** @hidden */
@@ -65861,11 +65861,11 @@ declare module BABYLON {
         /** @hidden */
         _depthStencilTextureArray: Nullable<WebGLTexture>;
         /** @hidden */
-        _lodTextureHigh: BaseTexture;
+        _lodTextureHigh: Nullable<BaseTexture>;
         /** @hidden */
-        _lodTextureMid: BaseTexture;
+        _lodTextureMid: Nullable<BaseTexture>;
         /** @hidden */
-        _lodTextureLow: BaseTexture;
+        _lodTextureLow: Nullable<BaseTexture>;
         /** @hidden */
         _isRGBD: boolean;
         /** @hidden */
@@ -67017,7 +67017,7 @@ declare module BABYLON {
          */
         reIntegrateRotationIntoRotationQuaternion: boolean;
         /** @hidden */
-        _poseMatrix: Matrix;
+        _poseMatrix: Nullable<Matrix>;
         /** @hidden */
         _localMatrix: Matrix;
         private _usePivotMatrix;
@@ -77501,7 +77501,7 @@ declare module BABYLON {
          * List of inspectable custom properties (used by the Inspector)
          * @see https://doc.babylonjs.com/how_to/debug_layer#extensibility
          */
-        inspectableCustomProperties: IInspectable[];
+        inspectableCustomProperties: Nullable<IInspectable[]>;
         private _noMipmap;
         /** @hidden */
         _invertY: boolean;
@@ -77977,7 +77977,7 @@ declare module BABYLON {
         /**
          * Gets the root Animatable used to synchronize and normalize animations
          */
-        readonly syncRoot: Animatable;
+        readonly syncRoot: Nullable<Animatable>;
         /**
          * Gets the current frame of the first RuntimeAnimation
          * Used to synchronize Animatables
@@ -81161,15 +81161,15 @@ declare module BABYLON {
         /**
          * Callback triggered when the material is compiled
          */
-        onCompiled: (effect: Effect) => void;
+        onCompiled: Nullable<(effect: Effect) => void>;
         /**
          * Callback triggered when an error occurs
          */
-        onError: (effect: Effect, errors: string) => void;
+        onError: Nullable<(effect: Effect, errors: string) => void>;
         /**
          * Callback triggered to get the render target textures
          */
-        getRenderTargetTextures: () => SmartArray<RenderTargetTexture>;
+        getRenderTargetTextures: Nullable<() => SmartArray<RenderTargetTexture>>;
         /**
          * Gets a boolean indicating that current material needs to register RTT
          */
@@ -81185,7 +81185,7 @@ declare module BABYLON {
         /**
          * Stores the animations for the material
          */
-        animations: Array<Animation>;
+        animations: Nullable<Array<Animation>>;
         /**
         * An event triggered when the material is disposed
         */
@@ -81632,7 +81632,7 @@ declare module BABYLON {
         /** @hidden */
         _trianglePlanes: Plane[];
         /** @hidden */
-        _lastColliderTransformMatrix: Matrix;
+        _lastColliderTransformMatrix: Nullable<Matrix>;
         /** @hidden */
         _renderId: number;
         /** @hidden */
@@ -83436,7 +83436,7 @@ declare module BABYLON {
         /** @hidden */
         _isActive: boolean;
         /** @hidden */
-        _renderingGroup: RenderingGroup;
+        _renderingGroup: Nullable<RenderingGroup>;
         /**
          * Gets or sets mesh visibility between 0 and 1 (default is 1)
          */
@@ -83588,7 +83588,7 @@ declare module BABYLON {
         /** @hidden */
         readonly _positions: Nullable<Vector3[]>;
         /** @hidden */
-        _waitingActions: any;
+        _waitingActions: Nullable<any>;
         /** @hidden */
         _waitingFreezeWorldMatrix: Nullable<boolean>;
         private _skeleton;
@@ -83869,7 +83869,7 @@ declare module BABYLON {
          * Gets Collider object used to compute collisions (not physics)
          * @see http://doc.babylonjs.com/babylon101/cameras,_mesh_collisions_and_gravity
          */
-        readonly collider: Collider;
+        readonly collider: Nullable<Collider>;
         /**
          * Move the mesh using collision engine
          * @see http://doc.babylonjs.com/babylon101/cameras,_mesh_collisions_and_gravity
@@ -84313,7 +84313,7 @@ declare module BABYLON {
         /**
          * Callback raised when the node is ready to be used
          */
-        onReady: (node: Node) => void;
+        onReady: Nullable<(node: Node) => void>;
         private _isEnabled;
         private _isParentEnabled;
         private _isReady;
@@ -87573,7 +87573,7 @@ declare module BABYLON {
          * @param indexParameters defines an object containing the index values to use to compile shaders (like the maximum number of simultaneous lights)
          * @returns the new Effect
          */
-        createEffect(baseName: any, attributesNamesOrOptions: string[] | EffectCreationOptions, uniformsNamesOrEngine: string[] | Engine, samplers?: string[], defines?: string, fallbacks?: EffectFallbacks, onCompiled?: (effect: Effect) => void, onError?: (effect: Effect, errors: string) => void, indexParameters?: any): Effect;
+        createEffect(baseName: any, attributesNamesOrOptions: string[] | EffectCreationOptions, uniformsNamesOrEngine: string[] | Engine, samplers?: string[], defines?: string, fallbacks?: EffectFallbacks, onCompiled?: Nullable<(effect: Effect) => void>, onError?: Nullable<(effect: Effect, errors: string) => void>, indexParameters?: any): Effect;
         private _compileShader;
         private _compileRawShader;
         /**
@@ -90079,7 +90079,7 @@ declare module BABYLON {
         /**
          * Array of animations
          */
-        animations: Array<Animation>;
+        animations: Nullable<Array<Animation>>;
     }
     /** Interface used by value gradients (color, factor, ...) */
     export interface IValueGradient {
@@ -104259,11 +104259,11 @@ declare module BABYLON {
         /**
          * AKA Diffuse Texture in standard nomenclature.
          */
-        protected _albedoTexture: BaseTexture;
+        protected _albedoTexture: Nullable<BaseTexture>;
         /**
          * AKA Occlusion Texture in other nomenclature.
          */
-        protected _ambientTexture: BaseTexture;
+        protected _ambientTexture: Nullable<BaseTexture>;
         /**
          * AKA Occlusion Texture Intensity in other nomenclature.
          */
@@ -104277,23 +104277,23 @@ declare module BABYLON {
         /**
          * Stores the alpha values in a texture.
          */
-        protected _opacityTexture: BaseTexture;
+        protected _opacityTexture: Nullable<BaseTexture>;
         /**
          * Stores the reflection values in a texture.
          */
-        protected _reflectionTexture: BaseTexture;
+        protected _reflectionTexture: Nullable<BaseTexture>;
         /**
          * Stores the emissive values in a texture.
          */
-        protected _emissiveTexture: BaseTexture;
+        protected _emissiveTexture: Nullable<BaseTexture>;
         /**
          * AKA Specular texture in other nomenclature.
          */
-        protected _reflectivityTexture: BaseTexture;
+        protected _reflectivityTexture: Nullable<BaseTexture>;
         /**
          * Used to switch from specular/glossiness to metallic/roughness workflow.
          */
-        protected _metallicTexture: BaseTexture;
+        protected _metallicTexture: Nullable<BaseTexture>;
         /**
          * Specifies the metallic scalar of the metallic/roughness workflow.
          * Can also be used to scale the metalness values of the metallic texture.
@@ -104308,15 +104308,15 @@ declare module BABYLON {
          * Used to enable roughness/glossiness fetch from a separate channel depending on the current mode.
          * Gray Scale represents roughness in metallic mode and glossiness in specular mode.
          */
-        protected _microSurfaceTexture: BaseTexture;
+        protected _microSurfaceTexture: Nullable<BaseTexture>;
         /**
          * Stores surface normal data used to displace a mesh in a texture.
          */
-        protected _bumpTexture: BaseTexture;
+        protected _bumpTexture: Nullable<BaseTexture>;
         /**
          * Stores the pre-calculated light information of a mesh in a texture.
          */
-        protected _lightmapTexture: BaseTexture;
+        protected _lightmapTexture: Nullable<BaseTexture>;
         /**
          * The color of a material in ambient lighting.
          */
@@ -104619,7 +104619,7 @@ declare module BABYLON {
         /**
          * Gets the texture used for the alpha test.
          */
-        getAlphaTestTexture(): BaseTexture;
+        getAlphaTestTexture(): Nullable<BaseTexture>;
         /**
          * Specifies that the submesh is ready to be used.
          * @param mesh - BJS mesh.

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


+ 3 - 1
dist/preview release/inspector/babylon.inspector.bundle.max.js

@@ -35485,7 +35485,9 @@ var AnimationGridComponent = /** @class */ (function (_super) {
             _this._animations = new Array();
             animatables.forEach(function (animatable) {
                 var _a;
-                (_a = _this._animations).push.apply(_a, animatable.animations);
+                if (animatable.animations) {
+                    (_a = _this._animations).push.apply(_a, animatable.animations);
+                }
             });
             // Extract from and to
             if (_this._animations && _this._animations.length) {

File diff suppressed because it is too large
+ 1 - 1
dist/preview release/inspector/babylon.inspector.bundle.max.js.map


+ 6 - 6
dist/preview release/loaders/babylon.glTF2FileLoader.js

@@ -2333,17 +2333,17 @@ var GLTFLoader = /** @class */ (function () {
             var animationType;
             switch (channel.target.path) {
                 case "translation" /* TRANSLATION */: {
-                    targetPath = "_position";
+                    targetPath = "position";
                     animationType = babylonjs_Misc_deferred__WEBPACK_IMPORTED_MODULE_0__["Animation"].ANIMATIONTYPE_VECTOR3;
                     break;
                 }
                 case "rotation" /* ROTATION */: {
-                    targetPath = "_rotationQuaternion";
+                    targetPath = "rotationQuaternion";
                     animationType = babylonjs_Misc_deferred__WEBPACK_IMPORTED_MODULE_0__["Animation"].ANIMATIONTYPE_QUATERNION;
                     break;
                 }
                 case "scale" /* SCALE */: {
-                    targetPath = "_scaling";
+                    targetPath = "scaling";
                     animationType = babylonjs_Misc_deferred__WEBPACK_IMPORTED_MODULE_0__["Animation"].ANIMATIONTYPE_VECTOR3;
                     break;
                 }
@@ -2359,7 +2359,7 @@ var GLTFLoader = /** @class */ (function () {
             var outputBufferOffset = 0;
             var getNextOutputValue;
             switch (targetPath) {
-                case "_position": {
+                case "position": {
                     getNextOutputValue = function () {
                         var value = babylonjs_Misc_deferred__WEBPACK_IMPORTED_MODULE_0__["Vector3"].FromArray(data.output, outputBufferOffset);
                         outputBufferOffset += 3;
@@ -2367,7 +2367,7 @@ var GLTFLoader = /** @class */ (function () {
                     };
                     break;
                 }
-                case "_rotationQuaternion": {
+                case "rotationQuaternion": {
                     getNextOutputValue = function () {
                         var value = babylonjs_Misc_deferred__WEBPACK_IMPORTED_MODULE_0__["Quaternion"].FromArray(data.output, outputBufferOffset);
                         outputBufferOffset += 4;
@@ -2375,7 +2375,7 @@ var GLTFLoader = /** @class */ (function () {
                     };
                     break;
                 }
-                case "_scaling": {
+                case "scaling": {
                     getNextOutputValue = function () {
                         var value = babylonjs_Misc_deferred__WEBPACK_IMPORTED_MODULE_0__["Vector3"].FromArray(data.output, outputBufferOffset);
                         outputBufferOffset += 3;

File diff suppressed because it is too large
+ 1 - 1
dist/preview release/loaders/babylon.glTF2FileLoader.js.map


File diff suppressed because it is too large
+ 1 - 1
dist/preview release/loaders/babylon.glTF2FileLoader.min.js


+ 6 - 6
dist/preview release/loaders/babylon.glTFFileLoader.js

@@ -4882,17 +4882,17 @@ var GLTFLoader = /** @class */ (function () {
             var animationType;
             switch (channel.target.path) {
                 case "translation" /* TRANSLATION */: {
-                    targetPath = "_position";
+                    targetPath = "position";
                     animationType = babylonjs_Misc_deferred__WEBPACK_IMPORTED_MODULE_0__["Animation"].ANIMATIONTYPE_VECTOR3;
                     break;
                 }
                 case "rotation" /* ROTATION */: {
-                    targetPath = "_rotationQuaternion";
+                    targetPath = "rotationQuaternion";
                     animationType = babylonjs_Misc_deferred__WEBPACK_IMPORTED_MODULE_0__["Animation"].ANIMATIONTYPE_QUATERNION;
                     break;
                 }
                 case "scale" /* SCALE */: {
-                    targetPath = "_scaling";
+                    targetPath = "scaling";
                     animationType = babylonjs_Misc_deferred__WEBPACK_IMPORTED_MODULE_0__["Animation"].ANIMATIONTYPE_VECTOR3;
                     break;
                 }
@@ -4908,7 +4908,7 @@ var GLTFLoader = /** @class */ (function () {
             var outputBufferOffset = 0;
             var getNextOutputValue;
             switch (targetPath) {
-                case "_position": {
+                case "position": {
                     getNextOutputValue = function () {
                         var value = babylonjs_Misc_deferred__WEBPACK_IMPORTED_MODULE_0__["Vector3"].FromArray(data.output, outputBufferOffset);
                         outputBufferOffset += 3;
@@ -4916,7 +4916,7 @@ var GLTFLoader = /** @class */ (function () {
                     };
                     break;
                 }
-                case "_rotationQuaternion": {
+                case "rotationQuaternion": {
                     getNextOutputValue = function () {
                         var value = babylonjs_Misc_deferred__WEBPACK_IMPORTED_MODULE_0__["Quaternion"].FromArray(data.output, outputBufferOffset);
                         outputBufferOffset += 4;
@@ -4924,7 +4924,7 @@ var GLTFLoader = /** @class */ (function () {
                     };
                     break;
                 }
-                case "_scaling": {
+                case "scaling": {
                     getNextOutputValue = function () {
                         var value = babylonjs_Misc_deferred__WEBPACK_IMPORTED_MODULE_0__["Vector3"].FromArray(data.output, outputBufferOffset);
                         outputBufferOffset += 3;

File diff suppressed because it is too large
+ 1 - 1
dist/preview release/loaders/babylon.glTFFileLoader.js.map


File diff suppressed because it is too large
+ 1 - 1
dist/preview release/loaders/babylon.glTFFileLoader.min.js


+ 6 - 6
dist/preview release/loaders/babylonjs.loaders.js

@@ -6214,17 +6214,17 @@ var GLTFLoader = /** @class */ (function () {
             var animationType;
             switch (channel.target.path) {
                 case "translation" /* TRANSLATION */: {
-                    targetPath = "_position";
+                    targetPath = "position";
                     animationType = babylonjs_Misc_deferred__WEBPACK_IMPORTED_MODULE_0__["Animation"].ANIMATIONTYPE_VECTOR3;
                     break;
                 }
                 case "rotation" /* ROTATION */: {
-                    targetPath = "_rotationQuaternion";
+                    targetPath = "rotationQuaternion";
                     animationType = babylonjs_Misc_deferred__WEBPACK_IMPORTED_MODULE_0__["Animation"].ANIMATIONTYPE_QUATERNION;
                     break;
                 }
                 case "scale" /* SCALE */: {
-                    targetPath = "_scaling";
+                    targetPath = "scaling";
                     animationType = babylonjs_Misc_deferred__WEBPACK_IMPORTED_MODULE_0__["Animation"].ANIMATIONTYPE_VECTOR3;
                     break;
                 }
@@ -6240,7 +6240,7 @@ var GLTFLoader = /** @class */ (function () {
             var outputBufferOffset = 0;
             var getNextOutputValue;
             switch (targetPath) {
-                case "_position": {
+                case "position": {
                     getNextOutputValue = function () {
                         var value = babylonjs_Misc_deferred__WEBPACK_IMPORTED_MODULE_0__["Vector3"].FromArray(data.output, outputBufferOffset);
                         outputBufferOffset += 3;
@@ -6248,7 +6248,7 @@ var GLTFLoader = /** @class */ (function () {
                     };
                     break;
                 }
-                case "_rotationQuaternion": {
+                case "rotationQuaternion": {
                     getNextOutputValue = function () {
                         var value = babylonjs_Misc_deferred__WEBPACK_IMPORTED_MODULE_0__["Quaternion"].FromArray(data.output, outputBufferOffset);
                         outputBufferOffset += 4;
@@ -6256,7 +6256,7 @@ var GLTFLoader = /** @class */ (function () {
                     };
                     break;
                 }
-                case "_scaling": {
+                case "scaling": {
                     getNextOutputValue = function () {
                         var value = babylonjs_Misc_deferred__WEBPACK_IMPORTED_MODULE_0__["Vector3"].FromArray(data.output, outputBufferOffset);
                         outputBufferOffset += 3;

File diff suppressed because it is too large
+ 1 - 1
dist/preview release/loaders/babylonjs.loaders.js.map


File diff suppressed because it is too large
+ 1 - 1
dist/preview release/loaders/babylonjs.loaders.min.js


+ 62 - 62
dist/preview release/viewer/babylon.module.d.ts

@@ -486,7 +486,7 @@ declare module "babylonjs/Maths/math" {
          */
         static FromHexString(hex: string): Color3;
         /**
-         * Creates a new Vector3 from the starting index of the given array
+         * Creates a new Color3 from the starting index of the given array
          * @param array defines the source array
          * @param offset defines an offset in the source array
          * @returns a new Color3 object
@@ -6350,9 +6350,9 @@ declare module "babylonjs/Materials/Textures/internalTexture" {
         /** @hidden */
         _files: Nullable<string[]>;
         /** @hidden */
-        _workingCanvas: HTMLCanvasElement;
+        _workingCanvas: Nullable<HTMLCanvasElement>;
         /** @hidden */
-        _workingContext: CanvasRenderingContext2D;
+        _workingContext: Nullable<CanvasRenderingContext2D>;
         /** @hidden */
         _framebuffer: Nullable<WebGLFramebuffer>;
         /** @hidden */
@@ -6394,11 +6394,11 @@ declare module "babylonjs/Materials/Textures/internalTexture" {
         /** @hidden */
         _depthStencilTextureArray: Nullable<WebGLTexture>;
         /** @hidden */
-        _lodTextureHigh: BaseTexture;
+        _lodTextureHigh: Nullable<BaseTexture>;
         /** @hidden */
-        _lodTextureMid: BaseTexture;
+        _lodTextureMid: Nullable<BaseTexture>;
         /** @hidden */
-        _lodTextureLow: BaseTexture;
+        _lodTextureLow: Nullable<BaseTexture>;
         /** @hidden */
         _isRGBD: boolean;
         /** @hidden */
@@ -7580,7 +7580,7 @@ declare module "babylonjs/Meshes/transformNode" {
          */
         reIntegrateRotationIntoRotationQuaternion: boolean;
         /** @hidden */
-        _poseMatrix: Matrix;
+        _poseMatrix: Nullable<Matrix>;
         /** @hidden */
         _localMatrix: Matrix;
         private _usePivotMatrix;
@@ -18488,7 +18488,7 @@ declare module "babylonjs/Materials/Textures/texture" {
          * List of inspectable custom properties (used by the Inspector)
          * @see https://doc.babylonjs.com/how_to/debug_layer#extensibility
          */
-        inspectableCustomProperties: IInspectable[];
+        inspectableCustomProperties: Nullable<IInspectable[]>;
         private _noMipmap;
         /** @hidden */
         _invertY: boolean;
@@ -18976,7 +18976,7 @@ declare module "babylonjs/Animations/animatable" {
         /**
          * Gets the root Animatable used to synchronize and normalize animations
          */
-        readonly syncRoot: Animatable;
+        readonly syncRoot: Nullable<Animatable>;
         /**
          * Gets the current frame of the first RuntimeAnimation
          * Used to synchronize Animatables
@@ -22246,15 +22246,15 @@ declare module "babylonjs/Materials/material" {
         /**
          * Callback triggered when the material is compiled
          */
-        onCompiled: (effect: Effect) => void;
+        onCompiled: Nullable<(effect: Effect) => void>;
         /**
          * Callback triggered when an error occurs
          */
-        onError: (effect: Effect, errors: string) => void;
+        onError: Nullable<(effect: Effect, errors: string) => void>;
         /**
          * Callback triggered to get the render target textures
          */
-        getRenderTargetTextures: () => SmartArray<RenderTargetTexture>;
+        getRenderTargetTextures: Nullable<() => SmartArray<RenderTargetTexture>>;
         /**
          * Gets a boolean indicating that current material needs to register RTT
          */
@@ -22270,7 +22270,7 @@ declare module "babylonjs/Materials/material" {
         /**
          * Stores the animations for the material
          */
-        animations: Array<Animation>;
+        animations: Nullable<Array<Animation>>;
         /**
         * An event triggered when the material is disposed
         */
@@ -22730,7 +22730,7 @@ declare module "babylonjs/Meshes/subMesh" {
         /** @hidden */
         _trianglePlanes: Plane[];
         /** @hidden */
-        _lastColliderTransformMatrix: Matrix;
+        _lastColliderTransformMatrix: Nullable<Matrix>;
         /** @hidden */
         _renderId: number;
         /** @hidden */
@@ -24582,7 +24582,7 @@ declare module "babylonjs/Meshes/abstractMesh" {
         /** @hidden */
         _isActive: boolean;
         /** @hidden */
-        _renderingGroup: RenderingGroup;
+        _renderingGroup: Nullable<RenderingGroup>;
         /**
          * Gets or sets mesh visibility between 0 and 1 (default is 1)
          */
@@ -24734,7 +24734,7 @@ declare module "babylonjs/Meshes/abstractMesh" {
         /** @hidden */
         readonly _positions: Nullable<Vector3[]>;
         /** @hidden */
-        _waitingActions: any;
+        _waitingActions: Nullable<any>;
         /** @hidden */
         _waitingFreezeWorldMatrix: Nullable<boolean>;
         private _skeleton;
@@ -25015,7 +25015,7 @@ declare module "babylonjs/Meshes/abstractMesh" {
          * Gets Collider object used to compute collisions (not physics)
          * @see http://doc.babylonjs.com/babylon101/cameras,_mesh_collisions_and_gravity
          */
-        readonly collider: Collider;
+        readonly collider: Nullable<Collider>;
         /**
          * Move the mesh using collision engine
          * @see http://doc.babylonjs.com/babylon101/cameras,_mesh_collisions_and_gravity
@@ -25481,7 +25481,7 @@ declare module "babylonjs/node" {
         /**
          * Callback raised when the node is ready to be used
          */
-        onReady: (node: Node) => void;
+        onReady: Nullable<(node: Node) => void>;
         private _isEnabled;
         private _isParentEnabled;
         private _isReady;
@@ -28803,7 +28803,7 @@ declare module "babylonjs/Engines/engine" {
          * @param indexParameters defines an object containing the index values to use to compile shaders (like the maximum number of simultaneous lights)
          * @returns the new Effect
          */
-        createEffect(baseName: any, attributesNamesOrOptions: string[] | EffectCreationOptions, uniformsNamesOrEngine: string[] | Engine, samplers?: string[], defines?: string, fallbacks?: EffectFallbacks, onCompiled?: (effect: Effect) => void, onError?: (effect: Effect, errors: string) => void, indexParameters?: any): Effect;
+        createEffect(baseName: any, attributesNamesOrOptions: string[] | EffectCreationOptions, uniformsNamesOrEngine: string[] | Engine, samplers?: string[], defines?: string, fallbacks?: EffectFallbacks, onCompiled?: Nullable<(effect: Effect) => void>, onError?: Nullable<(effect: Effect, errors: string) => void>, indexParameters?: any): Effect;
         private _compileShader;
         private _compileRawShader;
         /**
@@ -31354,7 +31354,7 @@ declare module "babylonjs/Misc/tools" {
         /**
          * Array of animations
          */
-        animations: Array<Animation>;
+        animations: Nullable<Array<Animation>>;
     }
     /** Interface used by value gradients (color, factor, ...) */
     export interface IValueGradient {
@@ -46579,11 +46579,11 @@ declare module "babylonjs/Materials/PBR/pbrBaseMaterial" {
         /**
          * AKA Diffuse Texture in standard nomenclature.
          */
-        protected _albedoTexture: BaseTexture;
+        protected _albedoTexture: Nullable<BaseTexture>;
         /**
          * AKA Occlusion Texture in other nomenclature.
          */
-        protected _ambientTexture: BaseTexture;
+        protected _ambientTexture: Nullable<BaseTexture>;
         /**
          * AKA Occlusion Texture Intensity in other nomenclature.
          */
@@ -46597,23 +46597,23 @@ declare module "babylonjs/Materials/PBR/pbrBaseMaterial" {
         /**
          * Stores the alpha values in a texture.
          */
-        protected _opacityTexture: BaseTexture;
+        protected _opacityTexture: Nullable<BaseTexture>;
         /**
          * Stores the reflection values in a texture.
          */
-        protected _reflectionTexture: BaseTexture;
+        protected _reflectionTexture: Nullable<BaseTexture>;
         /**
          * Stores the emissive values in a texture.
          */
-        protected _emissiveTexture: BaseTexture;
+        protected _emissiveTexture: Nullable<BaseTexture>;
         /**
          * AKA Specular texture in other nomenclature.
          */
-        protected _reflectivityTexture: BaseTexture;
+        protected _reflectivityTexture: Nullable<BaseTexture>;
         /**
          * Used to switch from specular/glossiness to metallic/roughness workflow.
          */
-        protected _metallicTexture: BaseTexture;
+        protected _metallicTexture: Nullable<BaseTexture>;
         /**
          * Specifies the metallic scalar of the metallic/roughness workflow.
          * Can also be used to scale the metalness values of the metallic texture.
@@ -46628,15 +46628,15 @@ declare module "babylonjs/Materials/PBR/pbrBaseMaterial" {
          * Used to enable roughness/glossiness fetch from a separate channel depending on the current mode.
          * Gray Scale represents roughness in metallic mode and glossiness in specular mode.
          */
-        protected _microSurfaceTexture: BaseTexture;
+        protected _microSurfaceTexture: Nullable<BaseTexture>;
         /**
          * Stores surface normal data used to displace a mesh in a texture.
          */
-        protected _bumpTexture: BaseTexture;
+        protected _bumpTexture: Nullable<BaseTexture>;
         /**
          * Stores the pre-calculated light information of a mesh in a texture.
          */
-        protected _lightmapTexture: BaseTexture;
+        protected _lightmapTexture: Nullable<BaseTexture>;
         /**
          * The color of a material in ambient lighting.
          */
@@ -46939,7 +46939,7 @@ declare module "babylonjs/Materials/PBR/pbrBaseMaterial" {
         /**
          * Gets the texture used for the alpha test.
          */
-        getAlphaTestTexture(): BaseTexture;
+        getAlphaTestTexture(): Nullable<BaseTexture>;
         /**
          * Specifies that the submesh is ready to be used.
          * @param mesh - BJS mesh.
@@ -59976,7 +59976,7 @@ declare module BABYLON {
          */
         static FromHexString(hex: string): Color3;
         /**
-         * Creates a new Vector3 from the starting index of the given array
+         * Creates a new Color3 from the starting index of the given array
          * @param array defines the source array
          * @param offset defines an offset in the source array
          * @returns a new Color3 object
@@ -65817,9 +65817,9 @@ declare module BABYLON {
         /** @hidden */
         _files: Nullable<string[]>;
         /** @hidden */
-        _workingCanvas: HTMLCanvasElement;
+        _workingCanvas: Nullable<HTMLCanvasElement>;
         /** @hidden */
-        _workingContext: CanvasRenderingContext2D;
+        _workingContext: Nullable<CanvasRenderingContext2D>;
         /** @hidden */
         _framebuffer: Nullable<WebGLFramebuffer>;
         /** @hidden */
@@ -65861,11 +65861,11 @@ declare module BABYLON {
         /** @hidden */
         _depthStencilTextureArray: Nullable<WebGLTexture>;
         /** @hidden */
-        _lodTextureHigh: BaseTexture;
+        _lodTextureHigh: Nullable<BaseTexture>;
         /** @hidden */
-        _lodTextureMid: BaseTexture;
+        _lodTextureMid: Nullable<BaseTexture>;
         /** @hidden */
-        _lodTextureLow: BaseTexture;
+        _lodTextureLow: Nullable<BaseTexture>;
         /** @hidden */
         _isRGBD: boolean;
         /** @hidden */
@@ -67017,7 +67017,7 @@ declare module BABYLON {
          */
         reIntegrateRotationIntoRotationQuaternion: boolean;
         /** @hidden */
-        _poseMatrix: Matrix;
+        _poseMatrix: Nullable<Matrix>;
         /** @hidden */
         _localMatrix: Matrix;
         private _usePivotMatrix;
@@ -77501,7 +77501,7 @@ declare module BABYLON {
          * List of inspectable custom properties (used by the Inspector)
          * @see https://doc.babylonjs.com/how_to/debug_layer#extensibility
          */
-        inspectableCustomProperties: IInspectable[];
+        inspectableCustomProperties: Nullable<IInspectable[]>;
         private _noMipmap;
         /** @hidden */
         _invertY: boolean;
@@ -77977,7 +77977,7 @@ declare module BABYLON {
         /**
          * Gets the root Animatable used to synchronize and normalize animations
          */
-        readonly syncRoot: Animatable;
+        readonly syncRoot: Nullable<Animatable>;
         /**
          * Gets the current frame of the first RuntimeAnimation
          * Used to synchronize Animatables
@@ -81161,15 +81161,15 @@ declare module BABYLON {
         /**
          * Callback triggered when the material is compiled
          */
-        onCompiled: (effect: Effect) => void;
+        onCompiled: Nullable<(effect: Effect) => void>;
         /**
          * Callback triggered when an error occurs
          */
-        onError: (effect: Effect, errors: string) => void;
+        onError: Nullable<(effect: Effect, errors: string) => void>;
         /**
          * Callback triggered to get the render target textures
          */
-        getRenderTargetTextures: () => SmartArray<RenderTargetTexture>;
+        getRenderTargetTextures: Nullable<() => SmartArray<RenderTargetTexture>>;
         /**
          * Gets a boolean indicating that current material needs to register RTT
          */
@@ -81185,7 +81185,7 @@ declare module BABYLON {
         /**
          * Stores the animations for the material
          */
-        animations: Array<Animation>;
+        animations: Nullable<Array<Animation>>;
         /**
         * An event triggered when the material is disposed
         */
@@ -81632,7 +81632,7 @@ declare module BABYLON {
         /** @hidden */
         _trianglePlanes: Plane[];
         /** @hidden */
-        _lastColliderTransformMatrix: Matrix;
+        _lastColliderTransformMatrix: Nullable<Matrix>;
         /** @hidden */
         _renderId: number;
         /** @hidden */
@@ -83436,7 +83436,7 @@ declare module BABYLON {
         /** @hidden */
         _isActive: boolean;
         /** @hidden */
-        _renderingGroup: RenderingGroup;
+        _renderingGroup: Nullable<RenderingGroup>;
         /**
          * Gets or sets mesh visibility between 0 and 1 (default is 1)
          */
@@ -83588,7 +83588,7 @@ declare module BABYLON {
         /** @hidden */
         readonly _positions: Nullable<Vector3[]>;
         /** @hidden */
-        _waitingActions: any;
+        _waitingActions: Nullable<any>;
         /** @hidden */
         _waitingFreezeWorldMatrix: Nullable<boolean>;
         private _skeleton;
@@ -83869,7 +83869,7 @@ declare module BABYLON {
          * Gets Collider object used to compute collisions (not physics)
          * @see http://doc.babylonjs.com/babylon101/cameras,_mesh_collisions_and_gravity
          */
-        readonly collider: Collider;
+        readonly collider: Nullable<Collider>;
         /**
          * Move the mesh using collision engine
          * @see http://doc.babylonjs.com/babylon101/cameras,_mesh_collisions_and_gravity
@@ -84313,7 +84313,7 @@ declare module BABYLON {
         /**
          * Callback raised when the node is ready to be used
          */
-        onReady: (node: Node) => void;
+        onReady: Nullable<(node: Node) => void>;
         private _isEnabled;
         private _isParentEnabled;
         private _isReady;
@@ -87573,7 +87573,7 @@ declare module BABYLON {
          * @param indexParameters defines an object containing the index values to use to compile shaders (like the maximum number of simultaneous lights)
          * @returns the new Effect
          */
-        createEffect(baseName: any, attributesNamesOrOptions: string[] | EffectCreationOptions, uniformsNamesOrEngine: string[] | Engine, samplers?: string[], defines?: string, fallbacks?: EffectFallbacks, onCompiled?: (effect: Effect) => void, onError?: (effect: Effect, errors: string) => void, indexParameters?: any): Effect;
+        createEffect(baseName: any, attributesNamesOrOptions: string[] | EffectCreationOptions, uniformsNamesOrEngine: string[] | Engine, samplers?: string[], defines?: string, fallbacks?: EffectFallbacks, onCompiled?: Nullable<(effect: Effect) => void>, onError?: Nullable<(effect: Effect, errors: string) => void>, indexParameters?: any): Effect;
         private _compileShader;
         private _compileRawShader;
         /**
@@ -90079,7 +90079,7 @@ declare module BABYLON {
         /**
          * Array of animations
          */
-        animations: Array<Animation>;
+        animations: Nullable<Array<Animation>>;
     }
     /** Interface used by value gradients (color, factor, ...) */
     export interface IValueGradient {
@@ -104259,11 +104259,11 @@ declare module BABYLON {
         /**
          * AKA Diffuse Texture in standard nomenclature.
          */
-        protected _albedoTexture: BaseTexture;
+        protected _albedoTexture: Nullable<BaseTexture>;
         /**
          * AKA Occlusion Texture in other nomenclature.
          */
-        protected _ambientTexture: BaseTexture;
+        protected _ambientTexture: Nullable<BaseTexture>;
         /**
          * AKA Occlusion Texture Intensity in other nomenclature.
          */
@@ -104277,23 +104277,23 @@ declare module BABYLON {
         /**
          * Stores the alpha values in a texture.
          */
-        protected _opacityTexture: BaseTexture;
+        protected _opacityTexture: Nullable<BaseTexture>;
         /**
          * Stores the reflection values in a texture.
          */
-        protected _reflectionTexture: BaseTexture;
+        protected _reflectionTexture: Nullable<BaseTexture>;
         /**
          * Stores the emissive values in a texture.
          */
-        protected _emissiveTexture: BaseTexture;
+        protected _emissiveTexture: Nullable<BaseTexture>;
         /**
          * AKA Specular texture in other nomenclature.
          */
-        protected _reflectivityTexture: BaseTexture;
+        protected _reflectivityTexture: Nullable<BaseTexture>;
         /**
          * Used to switch from specular/glossiness to metallic/roughness workflow.
          */
-        protected _metallicTexture: BaseTexture;
+        protected _metallicTexture: Nullable<BaseTexture>;
         /**
          * Specifies the metallic scalar of the metallic/roughness workflow.
          * Can also be used to scale the metalness values of the metallic texture.
@@ -104308,15 +104308,15 @@ declare module BABYLON {
          * Used to enable roughness/glossiness fetch from a separate channel depending on the current mode.
          * Gray Scale represents roughness in metallic mode and glossiness in specular mode.
          */
-        protected _microSurfaceTexture: BaseTexture;
+        protected _microSurfaceTexture: Nullable<BaseTexture>;
         /**
          * Stores surface normal data used to displace a mesh in a texture.
          */
-        protected _bumpTexture: BaseTexture;
+        protected _bumpTexture: Nullable<BaseTexture>;
         /**
          * Stores the pre-calculated light information of a mesh in a texture.
          */
-        protected _lightmapTexture: BaseTexture;
+        protected _lightmapTexture: Nullable<BaseTexture>;
         /**
          * The color of a material in ambient lighting.
          */
@@ -104619,7 +104619,7 @@ declare module BABYLON {
         /**
          * Gets the texture used for the alpha test.
          */
-        getAlphaTestTexture(): BaseTexture;
+        getAlphaTestTexture(): Nullable<BaseTexture>;
         /**
          * Specifies that the submesh is ready to be used.
          * @param mesh - BJS mesh.

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


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


+ 3 - 1
inspector/src/components/actionTabs/tabs/propertyGrids/animationPropertyGridComponent.tsx

@@ -52,7 +52,9 @@ export class AnimationGridComponent extends React.Component<IAnimationGridCompon
             this._animations = new Array<Animation>();
 
             animatables.forEach((animatable: IAnimatable) => {
-                this._animations!.push(...animatable.animations);
+                if (animatable.animations) {
+                    this._animations!.push(...animatable.animations);
+                }
             });
 
             // Extract from and to

+ 2 - 2
src/Animations/animatable.ts

@@ -20,7 +20,7 @@ export class Animatable {
     private _scene: Scene;
     private _speedRatio = 1;
     private _weight = -1.0;
-    private _syncRoot: Animatable;
+    private _syncRoot: Nullable<Animatable> = null;
 
     /**
      * Gets or sets a boolean indicating if the animatable must be disposed and removed at the end of the animation.
@@ -46,7 +46,7 @@ export class Animatable {
     /**
      * Gets the root Animatable used to synchronize and normalize animations
      */
-    public get syncRoot(): Animatable {
+    public get syncRoot(): Nullable<Animatable> {
         return this._syncRoot;
     }
 

+ 5 - 5
src/Animations/runtimeAnimation.ts

@@ -1,4 +1,4 @@
-import { DeepImmutable } from "../types";
+import { DeepImmutable, Nullable } from "../types";
 import { Quaternion, Vector3, Vector2, Size, Color3, Matrix } from "../Maths/math";
 import { Animation, _IAnimationState } from "./animation";
 import { AnimationEvent } from "./animationEvent";
@@ -59,7 +59,7 @@ export class RuntimeAnimation {
     /**
      * The original blend value of the runtime animation
      */
-    private _originalBlendValue: any;
+    private _originalBlendValue: Nullable<any> = null;
 
     /**
      * The offsets cache of the runtime animation
@@ -89,7 +89,7 @@ export class RuntimeAnimation {
     /**
      * The current value of the runtime animation
      */
-    private _currentValue: any;
+    private _currentValue: Nullable<any> = null;
 
     /** @hidden */
     public _animationState: _IAnimationState;
@@ -98,8 +98,8 @@ export class RuntimeAnimation {
      * The active target of the runtime animation
      */
     private _activeTargets: any[];
-    private _currentActiveTarget: any;
-    private _directTarget: any;
+    private _currentActiveTarget: Nullable<any> = null;
+    private _directTarget: Nullable<any> = null;
 
     /**
      * The target path of the runtime animation

+ 3 - 1
src/Culling/boundingBox.ts

@@ -99,7 +99,9 @@ export class BoundingBox implements ICullable {
         max.addToRef(min, this.center).scaleInPlace(0.5);
         max.subtractToRef(min, this.extendSize).scaleInPlace(0.5);
 
-        this._update(worldMatrix || Matrix.IdentityReadOnly);
+        this._worldMatrix = worldMatrix || Matrix.IdentityReadOnly;
+
+        this._update(this._worldMatrix);
     }
 
     /**

+ 8 - 2
src/Engines/engine.ts

@@ -3365,7 +3365,7 @@ export class Engine {
      * @returns the new Effect
      */
     public createEffect(baseName: any, attributesNamesOrOptions: string[] | EffectCreationOptions, uniformsNamesOrEngine: string[] | Engine, samplers?: string[], defines?: string, fallbacks?: EffectFallbacks,
-        onCompiled?: (effect: Effect) => void, onError?: (effect: Effect, errors: string) => void, indexParameters?: any): Effect {
+        onCompiled?: Nullable<(effect: Effect) => void>, onError?: Nullable<(effect: Effect, errors: string) => void>, indexParameters?: any): Effect {
         var vertex = baseName.vertexElement || baseName.vertex || baseName;
         var fragment = baseName.fragmentElement || baseName.fragment || baseName;
 
@@ -4841,7 +4841,7 @@ export class Engine {
                     texture._workingCanvas.height = texture.height;
                 }
 
-                texture._workingContext.drawImage(video, 0, 0, video.videoWidth, video.videoHeight, 0, 0, texture.width, texture.height);
+                texture._workingContext!.drawImage(video, 0, 0, video.videoWidth, video.videoHeight, 0, 0, texture.width, texture.height);
 
                 this._gl.texImage2D(this._gl.TEXTURE_2D, 0, this._gl.RGBA, this._gl.RGBA, this._gl.UNSIGNED_BYTE, texture._workingCanvas);
             } else {
@@ -7335,6 +7335,12 @@ export class Engine {
                         return this._gl.RGB8UI;
                     case Engine.TEXTUREFORMAT_RGBA_INTEGER:
                         return this._gl.RGBA8UI;
+                    case Engine.TEXTUREFORMAT_ALPHA:
+                        return this._gl.ALPHA;
+                    case Engine.TEXTUREFORMAT_LUMINANCE:
+                        return this._gl.LUMINANCE;
+                    case Engine.TEXTUREFORMAT_LUMINANCE_ALPHA:
+                        return this._gl.LUMINANCE_ALPHA;
                     default:
                         return this._gl.RGBA8;
                 }

+ 16 - 16
src/Materials/PBR/pbrBaseMaterial.ts

@@ -333,12 +333,12 @@ export abstract class PBRBaseMaterial extends PushMaterial {
     /**
      * AKA Diffuse Texture in standard nomenclature.
      */
-    protected _albedoTexture: BaseTexture;
+    protected _albedoTexture: Nullable<BaseTexture> = null;
 
     /**
      * AKA Occlusion Texture in other nomenclature.
      */
-    protected _ambientTexture: BaseTexture;
+    protected _ambientTexture: Nullable<BaseTexture> = null;
 
     /**
      * AKA Occlusion Texture Intensity in other nomenclature.
@@ -355,55 +355,55 @@ export abstract class PBRBaseMaterial extends PushMaterial {
     /**
      * Stores the alpha values in a texture.
      */
-    protected _opacityTexture: BaseTexture;
+    protected _opacityTexture: Nullable<BaseTexture> = null;
 
     /**
      * Stores the reflection values in a texture.
      */
-    protected _reflectionTexture: BaseTexture;
+    protected _reflectionTexture: Nullable<BaseTexture> = null;
 
     /**
      * Stores the emissive values in a texture.
      */
-    protected _emissiveTexture: BaseTexture;
+    protected _emissiveTexture: Nullable<BaseTexture> = null;
 
     /**
      * AKA Specular texture in other nomenclature.
      */
-    protected _reflectivityTexture: BaseTexture;
+    protected _reflectivityTexture: Nullable<BaseTexture> = null;
 
     /**
      * Used to switch from specular/glossiness to metallic/roughness workflow.
      */
-    protected _metallicTexture: BaseTexture;
+    protected _metallicTexture: Nullable<BaseTexture> = null;
 
     /**
      * Specifies the metallic scalar of the metallic/roughness workflow.
      * Can also be used to scale the metalness values of the metallic texture.
      */
-    protected _metallic: Nullable<number>;
+    protected _metallic: Nullable<number> = null;
 
     /**
      * Specifies the roughness scalar of the metallic/roughness workflow.
      * Can also be used to scale the roughness values of the metallic texture.
      */
-    protected _roughness: Nullable<number>;
+    protected _roughness: Nullable<number> = null;
 
     /**
      * Used to enable roughness/glossiness fetch from a separate channel depending on the current mode.
      * Gray Scale represents roughness in metallic mode and glossiness in specular mode.
      */
-    protected _microSurfaceTexture: BaseTexture;
+    protected _microSurfaceTexture: Nullable<BaseTexture> = null;
 
     /**
      * Stores surface normal data used to displace a mesh in a texture.
      */
-    protected _bumpTexture: BaseTexture;
+    protected _bumpTexture: Nullable<BaseTexture> = null;
 
     /**
      * Stores the pre-calculated light information of a mesh in a texture.
      */
-    protected _lightmapTexture: BaseTexture;
+    protected _lightmapTexture: Nullable<BaseTexture> = null;
 
     /**
      * The color of a material in ambient lighting.
@@ -616,7 +616,7 @@ export abstract class PBRBaseMaterial extends PushMaterial {
     /**
      * Keep track of the image processing observer to allow dispose and replace.
      */
-    private _imageProcessingObserver: Nullable<Observer<ImageProcessingConfiguration>>;
+    private _imageProcessingObserver: Nullable<Observer<ImageProcessingConfiguration>> = null;
 
     /**
      * Attaches a new image processing configuration to the PBR Material.
@@ -661,7 +661,7 @@ export abstract class PBRBaseMaterial extends PushMaterial {
     /**
      * Enables the use of logarithmic depth buffers, which is good for wide depth buffers.
      */
-    private _useLogarithmicDepth: boolean;
+    private _useLogarithmicDepth: boolean = false;
 
     /**
      * If set to true, no lighting calculations will be applied.
@@ -874,7 +874,7 @@ export abstract class PBRBaseMaterial extends PushMaterial {
     /**
      * Gets the texture used for the alpha test.
      */
-    public getAlphaTestTexture(): BaseTexture {
+    public getAlphaTestTexture(): Nullable<BaseTexture> {
         return this._albedoTexture;
     }
 
@@ -1857,7 +1857,7 @@ export abstract class PBRBaseMaterial extends PushMaterial {
             }
 
             // image processing
-            this._imageProcessingConfiguration.bind(this._activeEffect);
+            this._imageProcessingConfiguration!.bind(this._activeEffect);
 
             // Log. depth
             MaterialHelper.BindLogDepth(defines, this._activeEffect, scene);

+ 4 - 4
src/Materials/Textures/baseTexture.ts

@@ -300,7 +300,7 @@ export class BaseTexture implements IAnimatable {
     */
     public onDisposeObservable = new Observable<BaseTexture>();
 
-    private _onDisposeObserver: Nullable<Observer<BaseTexture>>;
+    private _onDisposeObserver: Nullable<Observer<BaseTexture>> = null;
     /**
      * Callback triggered when the texture has been disposed.
      * Kept for back compatibility, you can use the onDisposeObservable instead.
@@ -317,11 +317,11 @@ export class BaseTexture implements IAnimatable {
      */
     public delayLoadState = Constants.DELAYLOADSTATE_NONE;
 
-    private _scene: Nullable<Scene>;
+    private _scene: Nullable<Scene> = null;
 
     /** @hidden */
-    public _texture: Nullable<InternalTexture>;
-    private _uid: Nullable<string>;
+    public _texture: Nullable<InternalTexture> = null;
+    private _uid: Nullable<string> = null;
 
     /**
      * Define if the texture is preventinga material to render or not.

+ 46 - 46
src/Materials/Textures/internalTexture.ts

@@ -77,43 +77,43 @@ export class InternalTexture {
     /**
      * Defines if the texture is ready
      */
-    public isReady: boolean;
+    public isReady: boolean = false;
     /**
      * Defines if the texture is a cube texture
      */
-    public isCube: boolean;
+    public isCube: boolean = false;
     /**
      * Defines if the texture contains 3D data
      */
-    public is3D: boolean;
+    public is3D: boolean = false;
     /**
      * Defines if the texture contains multiview data
      */
-    public isMultiview: boolean;
+    public isMultiview: boolean = false;
     /**
      * Gets the URL used to load this texture
      */
-    public url: string;
+    public url: string = "";
     /**
      * Gets the sampling mode of the texture
      */
-    public samplingMode: number;
+    public samplingMode: number = -1;
     /**
      * Gets a boolean indicating if the texture needs mipmaps generation
      */
-    public generateMipMaps: boolean;
+    public generateMipMaps: boolean = false;
     /**
      * Gets the number of samples used by the texture (WebGL2+ only)
      */
-    public samples: number;
+    public samples: number = 0;
     /**
      * Gets the type of the texture (int, float...)
      */
-    public type: number;
+    public type: number = -1;
     /**
      * Gets the format of the texture (RGB, RGBA...)
      */
-    public format: number;
+    public format: number = -1;
     /**
      * Observable called when the texture is loaded
      */
@@ -121,31 +121,31 @@ export class InternalTexture {
     /**
      * Gets the width of the texture
      */
-    public width: number;
+    public width: number = 0;
     /**
      * Gets the height of the texture
      */
-    public height: number;
+    public height: number = 0;
     /**
      * Gets the depth of the texture
      */
-    public depth: number;
+    public depth: number = 0;
     /**
      * Gets the initial width of the texture (It could be rescaled if the current system does not support non power of two textures)
      */
-    public baseWidth: number;
+    public baseWidth: number = 0;
     /**
      * Gets the initial height of the texture (It could be rescaled if the current system does not support non power of two textures)
      */
-    public baseHeight: number;
+    public baseHeight: number = 0;
     /**
      * Gets the initial depth of the texture (It could be rescaled if the current system does not support non power of two textures)
      */
-    public baseDepth: number;
+    public baseDepth: number = 0;
     /**
      * Gets a boolean indicating if the texture is inverted on Y axis
      */
-    public invertY: boolean;
+    public invertY: boolean = false;
 
     // Private
     /** @hidden */
@@ -155,51 +155,51 @@ export class InternalTexture {
     /** @hidden */
     public _dataSource = InternalTexture.DATASOURCE_UNKNOWN;
     /** @hidden */
-    public _buffer: Nullable<string | ArrayBuffer | HTMLImageElement | Blob>;
+    public _buffer: Nullable<string | ArrayBuffer | HTMLImageElement | Blob> = null;
     /** @hidden */
-    public _bufferView: Nullable<ArrayBufferView>;
+    public _bufferView: Nullable<ArrayBufferView> = null;
     /** @hidden */
-    public _bufferViewArray: Nullable<ArrayBufferView[]>;
+    public _bufferViewArray: Nullable<ArrayBufferView[]> = null;
     /** @hidden */
-    public _bufferViewArrayArray: Nullable<ArrayBufferView[][]>;
+    public _bufferViewArrayArray: Nullable<ArrayBufferView[][]> = null;
     /** @hidden */
-    public _size: number;
+    public _size: number = 0;
     /** @hidden */
-    public _extension: string;
+    public _extension: string = "";
     /** @hidden */
-    public _files: Nullable<string[]>;
+    public _files: Nullable<string[]> = null;
     /** @hidden */
-    public _workingCanvas: HTMLCanvasElement;
+    public _workingCanvas: Nullable<HTMLCanvasElement> = null;
     /** @hidden */
-    public _workingContext: CanvasRenderingContext2D;
+    public _workingContext: Nullable<CanvasRenderingContext2D> = null;
     /** @hidden */
-    public _framebuffer: Nullable<WebGLFramebuffer>;
+    public _framebuffer: Nullable<WebGLFramebuffer> = null;
     /** @hidden */
-    public _depthStencilBuffer: Nullable<WebGLRenderbuffer>;
+    public _depthStencilBuffer: Nullable<WebGLRenderbuffer> = null;
     /** @hidden */
-    public _MSAAFramebuffer: Nullable<WebGLFramebuffer>;
+    public _MSAAFramebuffer: Nullable<WebGLFramebuffer> = null;
     /** @hidden */
-    public _MSAARenderBuffer: Nullable<WebGLRenderbuffer>;
+    public _MSAARenderBuffer: Nullable<WebGLRenderbuffer> = null;
     /** @hidden */
-    public _attachments: Nullable<number[]>;
+    public _attachments: Nullable<number[]> = null;
     /** @hidden */
-    public _cachedCoordinatesMode: Nullable<number>;
+    public _cachedCoordinatesMode: Nullable<number> = null;
     /** @hidden */
-    public _cachedWrapU: Nullable<number>;
+    public _cachedWrapU: Nullable<number> = null;
     /** @hidden */
-    public _cachedWrapV: Nullable<number>;
+    public _cachedWrapV: Nullable<number> = null;
     /** @hidden */
-    public _cachedWrapR: Nullable<number>;
+    public _cachedWrapR: Nullable<number> = null;
     /** @hidden */
-    public _cachedAnisotropicFilteringLevel: Nullable<number>;
+    public _cachedAnisotropicFilteringLevel: Nullable<number> = null;
     /** @hidden */
-    public _isDisabled: boolean;
+    public _isDisabled: boolean = false;
     /** @hidden */
-    public _compression: Nullable<string>;
+    public _compression: Nullable<string> = null;
     /** @hidden */
-    public _generateStencilBuffer: boolean;
+    public _generateStencilBuffer: boolean = false;
     /** @hidden */
-    public _generateDepthBuffer: boolean;
+    public _generateDepthBuffer: boolean = false;
     /** @hidden */
     public _comparisonFunction: number = 0;
     /** @hidden */
@@ -211,24 +211,24 @@ export class InternalTexture {
 
     // Multiview
     /** @hidden */
-    public _colorTextureArray: Nullable<WebGLTexture>;
+    public _colorTextureArray: Nullable<WebGLTexture> = null;
     /** @hidden */
-    public _depthStencilTextureArray: Nullable<WebGLTexture>;
+    public _depthStencilTextureArray: Nullable<WebGLTexture> = null;
 
     // The following three fields helps sharing generated fixed LODs for texture filtering
     // In environment not supporting the textureLOD extension like EDGE. They are for internal use only.
     // They are at the level of the gl texture to benefit from the cache.
     /** @hidden */
-    public _lodTextureHigh: BaseTexture;
+    public _lodTextureHigh: Nullable<BaseTexture> = null;
     /** @hidden */
-    public _lodTextureMid: BaseTexture;
+    public _lodTextureMid: Nullable<BaseTexture> = null;
     /** @hidden */
-    public _lodTextureLow: BaseTexture;
+    public _lodTextureLow: Nullable<BaseTexture> = null;
     /** @hidden */
     public _isRGBD: boolean = false;
 
     /** @hidden */
-    public _webGLTexture: Nullable<WebGLTexture>;
+    public _webGLTexture: Nullable<WebGLTexture> = null;
     /** @hidden */
     public _references: number = 1;
 

+ 39 - 39
src/Materials/Textures/texture.ts

@@ -104,7 +104,7 @@ export class Texture extends BaseTexture {
      * Define the url of the texture.
      */
     @serialize()
-    public url: Nullable<string>;
+    public url: Nullable<string> = null;
 
     /**
      * Define an offset on the texture to offset the u coordinates of the UVs
@@ -184,37 +184,37 @@ export class Texture extends BaseTexture {
      * List of inspectable custom properties (used by the Inspector)
      * @see https://doc.babylonjs.com/how_to/debug_layer#extensibility
      */
-    public inspectableCustomProperties: IInspectable[];
+    public inspectableCustomProperties: Nullable<IInspectable[]> = null;
 
-    private _noMipmap: boolean;
+    private _noMipmap: boolean = false;
     /** @hidden */
-    public _invertY: boolean;
-    private _rowGenerationMatrix: Matrix;
-    private _cachedTextureMatrix: Matrix;
-    private _projectionModeMatrix: Matrix;
-    private _t0: Vector3;
-    private _t1: Vector3;
-    private _t2: Vector3;
-
-    private _cachedUOffset: number;
-    private _cachedVOffset: number;
-    private _cachedUScale: number;
-    private _cachedVScale: number;
-    private _cachedUAng: number;
-    private _cachedVAng: number;
-    private _cachedWAng: number;
-    private _cachedProjectionMatrixId: number;
-    private _cachedCoordinatesMode: number;
+    public _invertY: boolean = false;
+    private _rowGenerationMatrix: Nullable<Matrix> = null;
+    private _cachedTextureMatrix: Nullable<Matrix> = null;
+    private _projectionModeMatrix: Nullable<Matrix> = null;
+    private _t0: Nullable<Vector3> = null;
+    private _t1: Nullable<Vector3> = null;
+    private _t2: Nullable<Vector3> = null;
+
+    private _cachedUOffset: number = -1;
+    private _cachedVOffset: number = -1;
+    private _cachedUScale: number = 0;
+    private _cachedVScale: number = 0;
+    private _cachedUAng: number = -1;
+    private _cachedVAng: number = -1;
+    private _cachedWAng: number = -1;
+    private _cachedProjectionMatrixId: number = -1;
+    private _cachedCoordinatesMode: number = -1;
 
     /** @hidden */
     protected _initialSamplingMode = Texture.BILINEAR_SAMPLINGMODE;
 
     /** @hidden */
-    public _buffer: Nullable<string | ArrayBuffer | HTMLImageElement | Blob>;
-    private _deleteBuffer: boolean;
-    protected _format: Nullable<number>;
-    private _delayedOnLoad: Nullable<() => void>;
-    private _delayedOnError: Nullable<() => void>;
+    public _buffer: Nullable<string | ArrayBuffer | HTMLImageElement | Blob> = null;
+    private _deleteBuffer: boolean = false;
+    protected _format: Nullable<number> = null;
+    private _delayedOnLoad: Nullable<() => void> = null;
+    private _delayedOnError: Nullable<() => void> = null;
 
     /**
      * Observable triggered once the texture has been loaded.
@@ -400,7 +400,7 @@ export class Texture extends BaseTexture {
         y -= this.vRotationCenter * this.vScale;
         z -= this.wRotationCenter;
 
-        Vector3.TransformCoordinatesFromFloatsToRef(x, y, z, this._rowGenerationMatrix, t);
+        Vector3.TransformCoordinatesFromFloatsToRef(x, y, z, this._rowGenerationMatrix!, t);
 
         t.x += this.uRotationCenter * this.uScale + this.uOffset;
         t.y += this.vRotationCenter * this.vScale + this.vOffset;
@@ -420,7 +420,7 @@ export class Texture extends BaseTexture {
             this.uAng === this._cachedUAng &&
             this.vAng === this._cachedVAng &&
             this.wAng === this._cachedWAng) {
-            return this._cachedTextureMatrix;
+            return this._cachedTextureMatrix!;
         }
 
         this._cachedUOffset = this.uOffset;
@@ -439,19 +439,19 @@ export class Texture extends BaseTexture {
             this._t2 = Vector3.Zero();
         }
 
-        Matrix.RotationYawPitchRollToRef(this.vAng, this.uAng, this.wAng, this._rowGenerationMatrix);
+        Matrix.RotationYawPitchRollToRef(this.vAng, this.uAng, this.wAng, this._rowGenerationMatrix!);
 
-        this._prepareRowForTextureGeneration(0, 0, 0, this._t0);
-        this._prepareRowForTextureGeneration(1.0, 0, 0, this._t1);
-        this._prepareRowForTextureGeneration(0, 1.0, 0, this._t2);
+        this._prepareRowForTextureGeneration(0, 0, 0, this._t0!);
+        this._prepareRowForTextureGeneration(1.0, 0, 0, this._t1!);
+        this._prepareRowForTextureGeneration(0, 1.0, 0, this._t2!);
 
-        this._t1.subtractInPlace(this._t0);
-        this._t2.subtractInPlace(this._t0);
+        this._t1!.subtractInPlace(this._t0!);
+        this._t2!.subtractInPlace(this._t0!);
 
         Matrix.FromValuesToRef(
-            this._t1.x, this._t1.y, this._t1.z, 0.0,
-            this._t2.x, this._t2.y, this._t2.z, 0.0,
-            this._t0.x, this._t0.y, this._t0.z, 0.0,
+            this._t1!.x, this._t1!.y, this._t1!.z, 0.0,
+            this._t2!.x, this._t2!.y, this._t2!.z, 0.0,
+            this._t0!.x, this._t0!.y, this._t0!.z, 0.0,
             0.0, 0.0, 0.0, 1.0,
             this._cachedTextureMatrix
         );
@@ -477,7 +477,7 @@ export class Texture extends BaseTexture {
         let scene = this.getScene();
 
         if (!scene) {
-            return this._cachedTextureMatrix;
+            return this._cachedTextureMatrix!;
         }
 
         if (
@@ -488,10 +488,10 @@ export class Texture extends BaseTexture {
             this.coordinatesMode === this._cachedCoordinatesMode) {
             if (this.coordinatesMode === Texture.PROJECTION_MODE) {
                 if (this._cachedProjectionMatrixId === scene.getProjectionMatrix().updateFlag) {
-                    return this._cachedTextureMatrix;
+                    return this._cachedTextureMatrix!;
                 }
             } else {
-                return this._cachedTextureMatrix;
+                return this._cachedTextureMatrix!;
             }
         }
 

+ 11 - 11
src/Materials/material.ts

@@ -213,17 +213,17 @@ export class Material implements IAnimatable {
     /**
      * Callback triggered when the material is compiled
      */
-    public onCompiled: (effect: Effect) => void;
+    public onCompiled: Nullable<(effect: Effect) => void> = null;
 
     /**
      * Callback triggered when an error occurs
      */
-    public onError: (effect: Effect, errors: string) => void;
+    public onError: Nullable<(effect: Effect, errors: string) => void> = null;
 
     /**
      * Callback triggered to get the render target textures
      */
-    public getRenderTargetTextures: () => SmartArray<RenderTargetTexture>;
+    public getRenderTargetTextures: Nullable<() => SmartArray<RenderTargetTexture>> = null;
 
     /**
      * Gets a boolean indicating that current material needs to register RTT
@@ -245,7 +245,7 @@ export class Material implements IAnimatable {
     /**
      * Stores the animations for the material
      */
-    public animations: Array<Animation>;
+    public animations: Nullable<Array<Animation>> = null;
 
     /**
     * An event triggered when the material is disposed
@@ -255,8 +255,8 @@ export class Material implements IAnimatable {
     /**
      * An observer which watches for dispose events
      */
-    private _onDisposeObserver: Nullable<Observer<Material>>;
-    private _onUnBindObservable: Nullable<Observable<Material>>;
+    private _onDisposeObserver: Nullable<Observer<Material>> = null;
+    private _onUnBindObservable: Nullable<Observable<Material>> = null;
 
     /**
      * Called during a dispose event
@@ -284,7 +284,7 @@ export class Material implements IAnimatable {
     /**
      * An observer which watches for bind events
      */
-    private _onBindObserver: Nullable<Observer<AbstractMesh>>;
+    private _onBindObserver: Nullable<Observer<AbstractMesh>> = null;
 
     /**
      * Called during a bind event
@@ -494,7 +494,7 @@ export class Material implements IAnimatable {
      * @hidden
      * Stores the effects for the material
      */
-    public _effect: Nullable<Effect>;
+    public _effect: Nullable<Effect> = null;
 
     /**
      * @hidden
@@ -505,7 +505,7 @@ export class Material implements IAnimatable {
     /**
      * Specifies if uniform buffers should be used
      */
-    private _useUBO: boolean;
+    private _useUBO: boolean = false;
 
     /**
      * Stores a reference to the scene
@@ -520,7 +520,7 @@ export class Material implements IAnimatable {
     /**
      * Specifies if the depth write state should be cached
      */
-    private _cachedDepthWriteState: boolean;
+    private _cachedDepthWriteState: boolean = false;
 
     /**
      * Stores the uniform buffer
@@ -531,7 +531,7 @@ export class Material implements IAnimatable {
     public _indexInSceneMaterialArray = -1;
 
     /** @hidden */
-    public meshMap: Nullable<{ [id: string]: AbstractMesh | undefined }>;
+    public meshMap: Nullable<{ [id: string]: AbstractMesh | undefined }> = null;
 
     /**
      * Creates a material instance

+ 1 - 1
src/Materials/shaderMaterial.ts

@@ -733,7 +733,7 @@ export class ShaderMaterial extends Material {
      */
     public serialize(): any {
         var serializationObject = SerializationHelper.Serialize(this);
-        serializationObject.customType = "ShaderMaterial";
+        serializationObject.customType = "BABYLON.ShaderMaterial";
 
         serializationObject.options = this._options;
         serializationObject.shaderPath = this._shaderPath;

+ 2 - 2
src/Maths/math.ts

@@ -371,7 +371,7 @@ export class Color3 {
     }
 
     /**
-     * Creates a new Vector3 from the starting index of the given array
+     * Creates a new Color3 from the starting index of the given array
      * @param array defines the source array
      * @param offset defines an offset in the source array
      * @returns a new Color3 object
@@ -4386,7 +4386,7 @@ export class Matrix {
      * It will be incremented every time the matrix data change.
      * You can use it to speed the comparison between two versions of the same matrix.
      */
-    public updateFlag: number;
+    public updateFlag: number = -1;
 
     private readonly _m: Float32Array = new Float32Array(16);
 

+ 13 - 13
src/Meshes/abstractMesh.ts

@@ -264,14 +264,14 @@ export class AbstractMesh extends TransformNode implements IDisposable, ICullabl
     public definedFacingForward = true;
 
     /** @hidden */
-    public _occlusionQuery: Nullable<WebGLQuery>;
+    public _occlusionQuery: Nullable<WebGLQuery> = null;
 
     private _visibility = 1.0;
 
     /** @hidden */
     public _isActive = false;
     /** @hidden */
-    public _renderingGroup: RenderingGroup;
+    public _renderingGroup: Nullable<RenderingGroup> = null;
 
     /**
      * Gets or sets mesh visibility between 0 and 1 (default is 1)
@@ -325,7 +325,7 @@ export class AbstractMesh extends TransformNode implements IDisposable, ICullabl
      * @see http://doc.babylonjs.com/resources/transparency_and_how_meshes_are_rendered#rendering-groups
      */
     public renderingGroupId = 0;
-    private _material: Nullable<Material>;
+    private _material: Nullable<Material> = null;
 
     /** Gets or sets current material */
     public get material(): Nullable<Material> {
@@ -518,7 +518,7 @@ export class AbstractMesh extends TransformNode implements IDisposable, ICullabl
      * @see http://doc.babylonjs.com/babylon101/cameras,_mesh_collisions_and_gravity
      */
     public ellipsoidOffset = new Vector3(0, 0, 0);
-    private _collider: Collider;
+    private _collider: Nullable<Collider> = null;
     private _oldPositionForCollisions = new Vector3(0, 0, 0);
     private _diffPositionForCollisions = new Vector3(0, 0, 0);
 
@@ -558,12 +558,12 @@ export class AbstractMesh extends TransformNode implements IDisposable, ICullabl
      */
     public edgesColor = new Color4(1, 0, 0, 1);
     /** @hidden */
-    public _edgesRenderer: Nullable<IEdgesRenderer>;
+    public _edgesRenderer: Nullable<IEdgesRenderer> = null;
 
     /** @hidden */
-    public _masterMesh: Nullable<AbstractMesh>;
+    public _masterMesh: Nullable<AbstractMesh> = null;
     /** @hidden */
-    public _boundingInfo: Nullable<BoundingInfo>;
+    public _boundingInfo: Nullable<BoundingInfo> = null;
     /** @hidden */
     public _renderId = 0;
 
@@ -589,14 +589,14 @@ export class AbstractMesh extends TransformNode implements IDisposable, ICullabl
 
     // Loading properties
     /** @hidden */
-    public _waitingActions: any;
+    public _waitingActions: Nullable<any> = null;
     /** @hidden */
-    public _waitingFreezeWorldMatrix: Nullable<boolean>;
+    public _waitingFreezeWorldMatrix: Nullable<boolean> = null;
 
     // Skeleton
-    private _skeleton: Nullable<Skeleton>;
+    private _skeleton: Nullable<Skeleton> = null;
     /** @hidden */
-    public _bonesTransformMatrices: Nullable<Float32Array>;
+    public _bonesTransformMatrices: Nullable<Float32Array> = null;
 
     /**
      * Gets or sets a skeleton to apply skining transformations
@@ -1338,7 +1338,7 @@ export class AbstractMesh extends TransformNode implements IDisposable, ICullabl
      * Gets Collider object used to compute collisions (not physics)
      * @see http://doc.babylonjs.com/babylon101/cameras,_mesh_collisions_and_gravity
      */
-    public get collider(): Collider {
+    public get collider(): Nullable<Collider> {
         return this._collider;
     }
 
@@ -1388,7 +1388,7 @@ export class AbstractMesh extends TransformNode implements IDisposable, ICullabl
         }
 
         // Transformation
-        if (!subMesh._lastColliderWorldVertices || !subMesh._lastColliderTransformMatrix.equals(transformMatrix)) {
+        if (!subMesh._lastColliderWorldVertices || !subMesh._lastColliderTransformMatrix!.equals(transformMatrix)) {
             subMesh._lastColliderTransformMatrix = transformMatrix.clone();
             subMesh._lastColliderWorldVertices = [];
             subMesh._trianglePlanes = [];

+ 16 - 14
src/Meshes/mesh.ts

@@ -27,6 +27,7 @@ import { SerializationHelper } from "../Misc/decorators";
 import { Logger } from "../Misc/logger";
 import { _TypeStore } from '../Misc/typeStore';
 import { _DevTools } from '../Misc/devTools';
+import { SceneComponentConstants } from "../sceneComponent";
 
 declare type LinesMesh = import("./linesMesh").LinesMesh;
 declare type InstancedMesh = import("./instancedMesh").InstancedMesh;
@@ -241,7 +242,7 @@ export class Mesh extends AbstractMesh implements IGetSetVerticesData {
     public onLODLevelSelection: (distance: number, mesh: Mesh, selectedLevel: Nullable<Mesh>) => void;
 
     // Morph
-    private _morphTargetManager: Nullable<MorphTargetManager>;
+    private _morphTargetManager: Nullable<MorphTargetManager> = null;
 
     /**
      * Gets or sets the morph target manager
@@ -261,10 +262,10 @@ export class Mesh extends AbstractMesh implements IGetSetVerticesData {
 
     // Private
     /** @hidden */
-    public _creationDataStorage: Nullable<_CreationDataStorage>;
+    public _creationDataStorage: Nullable<_CreationDataStorage> = null;
 
     /** @hidden */
-    public _geometry: Nullable<Geometry>;
+    public _geometry: Nullable<Geometry> = null;
     /** @hidden */
     public _delayInfo: Array<string>;
     /** @hidden */
@@ -273,11 +274,11 @@ export class Mesh extends AbstractMesh implements IGetSetVerticesData {
     /** @hidden */
     public _instanceDataStorage = new _InstanceDataStorage();
 
-    private _effectiveMaterial: Material;
+    private _effectiveMaterial: Nullable<Material> = null;
 
     /** @hidden */
-    public _shouldGenerateFlatShading: boolean;
-    private _preActivateId: number;
+    public _shouldGenerateFlatShading: boolean = false;
+    private _preActivateId: number = -1;
 
     // Use by builder only to know what orientation were the mesh build in.
     /** @hidden */
@@ -296,7 +297,7 @@ export class Mesh extends AbstractMesh implements IGetSetVerticesData {
     // Will be used to save a source mesh reference, If any
     private _source: Nullable<Mesh> = null;
     // Will be used to for fast cloned mesh lookup
-    private meshMap: Nullable<{ [id: string]: Mesh | undefined }>;
+    private meshMap: Nullable<{ [id: string]: Mesh | undefined }> = null;
 
     /**
      * Gets the source mesh (the one used to clone this one from)
@@ -2775,13 +2776,14 @@ export class Mesh extends AbstractMesh implements IGetSetVerticesData {
 
         // Physics
         //TODO implement correct serialization for physics impostors.
-
-        let impostor = this.getPhysicsImpostor();
-        if (impostor) {
-            serializationObject.physicsMass = impostor.getParam("mass");
-            serializationObject.physicsFriction = impostor.getParam("friction");
-            serializationObject.physicsRestitution = impostor.getParam("mass");
-            serializationObject.physicsImpostor = impostor.type;
+        if (this.getScene()._getComponent(SceneComponentConstants.NAME_PHYSICSENGINE)) {
+            let impostor = this.getPhysicsImpostor();
+            if (impostor) {
+                serializationObject.physicsMass = impostor.getParam("mass");
+                serializationObject.physicsFriction = impostor.getParam("friction");
+                serializationObject.physicsRestitution = impostor.getParam("mass");
+                serializationObject.physicsImpostor = impostor.type;
+            }
         }
 
         // Metadata

+ 9 - 9
src/Meshes/subMesh.ts

@@ -22,9 +22,9 @@ declare type TrianglePickingPredicate = import("../Culling/ray").TrianglePicking
  */
 export class BaseSubMesh {
     /** @hidden */
-    public _materialDefines: Nullable<MaterialDefines>;
+    public _materialDefines: Nullable<MaterialDefines> = null;
     /** @hidden */
-    public _materialEffect: Nullable<Effect>;
+    public _materialEffect: Nullable<Effect> = null;
 
     /**
      * Gets associated effect
@@ -55,28 +55,28 @@ export class BaseSubMesh {
  */
 export class SubMesh extends BaseSubMesh implements ICullable {
     /** @hidden */
-    public _linesIndexCount: number;
+    public _linesIndexCount: number = 0;
     private _mesh: AbstractMesh;
     private _renderingMesh: Mesh;
     private _boundingInfo: BoundingInfo;
-    private _linesIndexBuffer: Nullable<WebGLBuffer>;
+    private _linesIndexBuffer: Nullable<WebGLBuffer> = null;
     /** @hidden */
-    public _lastColliderWorldVertices: Nullable<Vector3[]>;
+    public _lastColliderWorldVertices: Nullable<Vector3[]> = null;
     /** @hidden */
     public _trianglePlanes: Plane[];
     /** @hidden */
-    public _lastColliderTransformMatrix: Matrix;
+    public _lastColliderTransformMatrix: Nullable<Matrix> = null;
 
     /** @hidden */
     public _renderId = 0;
     /** @hidden */
-    public _alphaIndex: number;
+    public _alphaIndex: number = 0;
     /** @hidden */
-    public _distanceToCamera: number;
+    public _distanceToCamera: number = 0;
     /** @hidden */
     public _id: number;
 
-    private _currentMaterial: Nullable<Material>;
+    private _currentMaterial: Nullable<Material> = null;
 
     /**
      * Add a new submesh to a mesh

+ 10 - 3
src/Meshes/transformNode.ts

@@ -49,12 +49,12 @@ export class TransformNode extends Node {
     private _rotation = Vector3.Zero();
 
     @serializeAsQuaternion("rotationQuaternion")
-    private _rotationQuaternion: Nullable<Quaternion>;
+    private _rotationQuaternion: Nullable<Quaternion> = null;
 
     @serializeAsVector3("scaling")
     protected _scaling = Vector3.One();
     protected _isDirty = false;
-    private _transformToBoneReferal: Nullable<TransformNode>;
+    private _transformToBoneReferal: Nullable<TransformNode> = null;
 
     @serialize("billboardMode")
     private _billboardMode = TransformNode.BILLBOARDMODE_NONE;
@@ -137,7 +137,7 @@ export class TransformNode extends Node {
 
     // Cache
     /** @hidden */
-    public _poseMatrix: Matrix;
+    public _poseMatrix: Nullable<Matrix> = null;
     /** @hidden */
     public _localMatrix = Matrix.Zero();
 
@@ -264,6 +264,10 @@ export class TransformNode extends Node {
      * @returns this TransformNode.
      */
     public updatePoseMatrix(matrix: Matrix): TransformNode {
+        if (!this._poseMatrix) {
+            this._poseMatrix = matrix.clone();
+            return this;
+        }
         this._poseMatrix.copyFrom(matrix);
         return this;
     }
@@ -273,6 +277,9 @@ export class TransformNode extends Node {
      * @returns the pose matrix
      */
     public getPoseMatrix(): Matrix {
+        if (!this._poseMatrix) {
+            this._poseMatrix = Matrix.Identity();
+        }
         return this._poseMatrix;
     }
 

+ 1 - 1
src/Misc/tools.ts

@@ -44,7 +44,7 @@ export interface IAnimatable {
     /**
      * Array of animations
      */
-    animations: Array<Animation>;
+    animations: Nullable<Array<Animation>>;
 }
 
 /** Interface used by value gradients (color, factor, ...) */

+ 6 - 6
src/node.ts

@@ -118,7 +118,7 @@ export class Node implements IBehaviorAware<Node> {
     /**
      * Callback raised when the node is ready to be used
      */
-    public onReady: (node: Node) => void;
+    public onReady: Nullable<(node: Node) => void> = null;
 
     private _isEnabled = true;
     private _isParentEnabled = true;
@@ -130,14 +130,14 @@ export class Node implements IBehaviorAware<Node> {
     public _childUpdateId = -1;
 
     /** @hidden */
-    public _waitingParentId: Nullable<string>;
+    public _waitingParentId: Nullable<string> = null;
     /** @hidden */
     public _scene: Scene;
     /** @hidden */
-    public _cache: any;
+    public _cache: any = {};
 
-    private _parentNode: Nullable<Node>;
-    private _children: Node[];
+    private _parentNode: Nullable<Node> = null;
+    private _children: Nullable<Node[]> = null;
 
     /** @hidden */
     public _worldMatrix = Matrix.Identity();
@@ -253,7 +253,7 @@ export class Node implements IBehaviorAware<Node> {
     */
     public onDisposeObservable = new Observable<Node>();
 
-    private _onDisposeObserver: Nullable<Observer<Node>>;
+    private _onDisposeObserver: Nullable<Observer<Node>> = null;
     /**
      * Sets a callback that will be raised when the node will be disposed
      */

+ 2 - 2
src/scene.ts

@@ -3736,7 +3736,7 @@ export class Scene extends AbstractScene implements IAnimatable {
                     if (this._processedMaterials.indexOf(material) === -1) {
                         this._processedMaterials.push(material);
 
-                        this._renderTargets.concatWithNoDuplicate(material.getRenderTargetTextures());
+                        this._renderTargets.concatWithNoDuplicate(material.getRenderTargetTextures!());
                     }
                 }
 
@@ -3926,7 +3926,7 @@ export class Scene extends AbstractScene implements IAnimatable {
 
             this._totalVertices.addCount(mesh.getTotalVertices(), false);
 
-            if (!mesh.isReady() || !mesh.isEnabled()) {
+            if (!mesh.isReady() || !mesh.isEnabled() || mesh.scaling.lengthSquared() === 0) {
                 continue;
             }
 

+ 7 - 7
tests/unit/babylon/src/Loading/babylon.sceneLoader.tests.ts

@@ -269,9 +269,9 @@ describe('Babylon Scene Loader', function() {
                 expect(animationGroup.targetedAnimations, "animationGroup.targetedAnimations").to.have.lengthOf(7);
                 const influenceAnimations = animationGroup.targetedAnimations.filter((_) => _.animation.targetProperty === "influence");
                 expect(influenceAnimations, "influenceAnimations").to.have.lengthOf(2);
-                const rotationAnimations = animationGroup.targetedAnimations.filter((_) => _.animation.targetProperty === "_rotationQuaternion");
+                const rotationAnimations = animationGroup.targetedAnimations.filter((_) => _.animation.targetProperty === "rotationQuaternion");
                 expect(rotationAnimations, "rotationAnimations").to.have.lengthOf(4);
-                const positionAnimations = animationGroup.targetedAnimations.filter((_) => _.animation.targetProperty === "_position");
+                const positionAnimations = animationGroup.targetedAnimations.filter((_) => _.animation.targetProperty === "position");
                 expect(positionAnimations, "positionAnimations").to.have.lengthOf(1);
             });
         });
@@ -539,12 +539,12 @@ describe('Babylon Scene Loader', function() {
             `;
 
             var scene = new BABYLON.Scene(subject);
-            return BABYLON.SceneLoader.LoadAssetContainerAsync('', 'data:' + fileContents, scene, ()=> {}, ".obj").then(container => {
+            return BABYLON.SceneLoader.LoadAssetContainerAsync('', 'data:' + fileContents, scene, () => { }, ".obj").then(container => {
                 expect(container.meshes.length).to.eq(1);
                 let tetrahedron = container.meshes[0];
 
-                var positions : BABYLON.FloatArray = tetrahedron.getVerticesData(BABYLON.VertexBuffer.PositionKind);
-                var colors : BABYLON.FloatArray = tetrahedron.getVerticesData(BABYLON.VertexBuffer.ColorKind);
+                var positions: BABYLON.FloatArray = tetrahedron.getVerticesData(BABYLON.VertexBuffer.PositionKind);
+                var colors: BABYLON.FloatArray = tetrahedron.getVerticesData(BABYLON.VertexBuffer.ColorKind);
 
                 expect(positions).to.deep.equal([1, 1, 1, 1, 2, 1, 2, 1, 1, 1, 1, 2]);
                 assert.isNull(colors, 'expecting colors vertex buffer to be null')
@@ -569,11 +569,11 @@ describe('Babylon Scene Loader', function() {
             `;
 
             var scene = new BABYLON.Scene(subject);
-            return BABYLON.SceneLoader.LoadAssetContainerAsync('', 'data:' + fileContents, scene, ()=> {}, ".obj").then(container => {
+            return BABYLON.SceneLoader.LoadAssetContainerAsync('', 'data:' + fileContents, scene, () => { }, ".obj").then(container => {
                 expect(container.meshes.length).to.eq(1);
                 let tetrahedron = container.meshes[0];
 
-                var positions : BABYLON.FloatArray = tetrahedron.getVerticesData(BABYLON.VertexBuffer.PositionKind);
+                var positions: BABYLON.FloatArray = tetrahedron.getVerticesData(BABYLON.VertexBuffer.PositionKind);
 
                 expect(positions).to.deep.equal([1, 1, 1, 1, 2, 1, 2, 1, 1, 1, 1, 2]);
             })