Browse Source

Merge branch 'master' into GUILine

SvenFrankson 7 years ago
parent
commit
fec9cb19f1
49 changed files with 31868 additions and 31785 deletions
  1. 13604 13366
      Playground/babylon.d.txt
  2. 3 3
      Tools/Gulp/config.json
  3. 5 8
      Tools/Gulp/gulpfile.js
  4. 54 54
      Viewer/dist/viewer.js
  5. 54 54
      Viewer/dist/viewer.min.js
  6. 5 0
      Viewer/src/configuration/configuration.ts
  7. 46 0
      Viewer/src/viewer/viewer.ts
  8. 5702 5432
      dist/preview release/babylon.d.ts
  9. 47 47
      dist/preview release/babylon.js
  10. 456 132
      dist/preview release/babylon.max.js
  11. 48 48
      dist/preview release/babylon.worker.js
  12. 7397 7127
      dist/preview release/customConfigurations/minimalGLTFViewer/babylon.d.ts
  13. 48 48
      dist/preview release/customConfigurations/minimalGLTFViewer/babylon.js
  14. 456 132
      dist/preview release/customConfigurations/minimalGLTFViewer/babylon.max.js
  15. 456 132
      dist/preview release/customConfigurations/minimalGLTFViewer/es6.js
  16. 456 132
      dist/preview release/es6.js
  17. 3 3
      dist/preview release/gui/babylon.gui.min.js
  18. 4 4
      dist/preview release/inspector/babylon.inspector.bundle.js
  19. 3 3
      dist/preview release/inspector/babylon.inspector.min.js
  20. 2 2
      dist/preview release/loaders/babylon.glTF1FileLoader.min.js
  21. 2 2
      dist/preview release/loaders/babylon.glTF2FileLoader.min.js
  22. 3 3
      dist/preview release/loaders/babylon.glTFFileLoader.min.js
  23. 1 1
      dist/preview release/loaders/babylon.objFileLoader.min.js
  24. 3 3
      dist/preview release/loaders/babylonjs.loaders.min.js
  25. 1 1
      dist/preview release/materialsLibrary/babylon.customMaterial.min.js
  26. 1 1
      dist/preview release/materialsLibrary/babylon.shadowOnlyMaterial.min.js
  27. 1 1
      dist/preview release/materialsLibrary/babylon.waterMaterial.min.js
  28. 3 3
      dist/preview release/materialsLibrary/babylonjs.materials.min.js
  29. 1 1
      dist/preview release/postProcessesLibrary/babylon.asciiArtPostProcess.min.js
  30. 1 1
      dist/preview release/postProcessesLibrary/babylon.digitalRainPostProcess.min.js
  31. 1 1
      dist/preview release/postProcessesLibrary/babylonjs.postProcess.min.js
  32. 0 249
      dist/preview release/serializers/babylon.glTF2Serializer.d.ts
  33. 1 1
      dist/preview release/serializers/babylon.glTF2Serializer.min.js
  34. 1 1
      dist/preview release/serializers/babylonjs.serializers.min.js
  35. 8 8
      dist/preview release/serializers/babylonjs.serializers.module.d.ts
  36. 2495 4602
      dist/preview release/typedocValidationBaseline.json
  37. 54 54
      dist/preview release/viewer/babylon.viewer.js
  38. 3 1
      dist/preview release/what's new.md
  39. 1 1
      src/Engine/babylon.engine.ts
  40. 7 3
      src/Loading/Plugins/babylon.babylonFileLoader.ts
  41. 26 1
      src/Materials/Textures/babylon.baseTexture.ts
  42. 373 116
      src/Math/babylon.math.ts
  43. 2 2
      src/Mesh/babylon.mesh.ts
  44. 1 1
      src/Mesh/babylon.transformNode.ts
  45. 11 0
      src/Tools/babylon.observable.ts
  46. BIN
      tests/validation/ReferenceImages/gltfMaterialAlphaBack.png
  47. BIN
      tests/validation/ReferenceImages/gltfMeshPrimitives.png
  48. BIN
      tests/validation/ReferenceImages/gltfMeshPrimitivesUV.png
  49. 18 0
      tests/validation/config.json

File diff suppressed because it is too large
+ 13604 - 13366
Playground/babylon.d.txt


+ 3 - 3
Tools/Gulp/config.json

@@ -1516,9 +1516,6 @@
                     "../../serializers/src/glTF/2.0/babylon.glTFData.ts",
                     "../../serializers/src/glTF/2.0/babylon.glTFMaterial.ts"
                 ],
-                "extraDeclarations": [
-                    "../../dist/babylon.glTF2Interface.d.ts"
-                ],
                 "output": "babylon.glTF2Serializer.js"
             }
         ],
@@ -1527,6 +1524,9 @@
             "distOutputDirectory": "/serializers/",
             "buildAsModule": true,
             "moduleName": "babylonjs-serializers",
+            "extraDeclarations": [
+                "../../dist/babylon.glTF2Interface.d.ts"
+            ],
             "outputFilename": "babylonjs.serializers",
             "moduleDeclaration": "BJSSerializers",
             "extendsRoot": true

+ 5 - 8
Tools/Gulp/gulpfile.js

@@ -325,7 +325,9 @@ var buildExternalLibraries = function (settings) {
             let dtsFiles = files.map(function (filename) {
                 return filename.replace(".js", ".d.ts");
             });
-
+            if (settings.build.extraDeclarations) {
+                settings.build.extraDeclarations.forEach(file => { dtsFiles.unshift(file) })
+            }
             let dtsTask = gulp.src(dtsFiles)
                 .pipe(concat(settings.build.outputFilename + ".module.d.ts"))
                 .pipe(replace(referenceSearchRegex, ""))
@@ -405,14 +407,9 @@ var buildExternalLibrary = function (library, settings, watch) {
             .pipe(gulp.dest(outputDirectory));
         /*}*/
 
-        let preDts;
-        if (library.extraDeclarations) {
-            preDts = merge2([tsProcess.dts, gulp.src(library.extraDeclarations)])
-        } else {
-            preDts = tsProcess.dts;
-        }
 
-        var dts = preDts
+
+        var dts = tsProcess.dts
             .pipe(concat(library.output))
             .pipe(replace(referenceSearchRegex, ""))
             .pipe(rename({ extname: ".d.ts" }))

File diff suppressed because it is too large
+ 54 - 54
Viewer/dist/viewer.js


File diff suppressed because it is too large
+ 54 - 54
Viewer/dist/viewer.min.js


+ 5 - 0
Viewer/src/configuration/configuration.ts

@@ -75,6 +75,11 @@ export interface IModelConfiguration {
     parentObjectIndex?: number; // the index of the parent object of the model in the loaded meshes array.
 
     castShadow?: boolean;
+    normalize?: boolean | {
+        center?: boolean;
+        unitSize?: boolean;
+        parentIndex?: number;
+    }; // shoud the model be scaled to unit-size
 
     title: string;
     subtitle?: string;

+ 46 - 0
Viewer/src/viewer/viewer.ts

@@ -529,6 +529,52 @@ export abstract class AbstractViewer {
                 Tags.AddTagsTo(mesh, 'castShadow');
             });
         }
+
+        if (modelConfiguration.normalize) {
+            let center = false;
+            let unitSize = false;
+            let parentIndex;
+            if (modelConfiguration.normalize === true) {
+                center = true;
+                unitSize = true;
+                parentIndex = 0;
+            } else {
+                center = !!modelConfiguration.normalize.center;
+                unitSize = !!modelConfiguration.normalize.unitSize;
+                parentIndex = modelConfiguration.normalize.parentIndex;
+            }
+
+            let meshesToNormalize: Array<AbstractMesh> = [];
+            if (parentIndex !== undefined) {
+                meshesToNormalize.push(focusMeshes[parentIndex]);
+            } else {
+                meshesToNormalize = meshesWithNoParent;
+            }
+
+            if (unitSize) {
+                meshesToNormalize.forEach(mesh => {
+                    console.log(mesh.scaling.x)
+                    mesh.normalizeToUnitCube(true);
+                    mesh.computeWorldMatrix(true);
+                    console.log(mesh.scaling.x)
+                });
+            }
+            if (center) {
+                meshesToNormalize.forEach(mesh => {
+                    const boundingInfo = mesh.getHierarchyBoundingVectors(true);
+                    const sizeVec = boundingInfo.max.subtract(boundingInfo.min);
+                    const halfSizeVec = sizeVec.scale(0.5);
+                    const center = boundingInfo.min.add(halfSizeVec);
+                    mesh.position = center.scale(-1);
+
+                    // Set on ground.
+                    mesh.position.y += halfSizeVec.y;
+
+                    // Recompute Info.
+                    mesh.computeWorldMatrix(true);
+                });
+            }
+        }
     }
 
     public dispose() {

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


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


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


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


File diff suppressed because it is too large
+ 7397 - 7127
dist/preview release/customConfigurations/minimalGLTFViewer/babylon.d.ts


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


File diff suppressed because it is too large
+ 456 - 132
dist/preview release/customConfigurations/minimalGLTFViewer/babylon.max.js


File diff suppressed because it is too large
+ 456 - 132
dist/preview release/customConfigurations/minimalGLTFViewer/es6.js


File diff suppressed because it is too large
+ 456 - 132
dist/preview release/es6.js


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


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


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


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


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


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


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


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


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


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


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


File diff suppressed because it is too large
+ 3 - 3
dist/preview release/materialsLibrary/babylonjs.materials.min.js


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


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


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


+ 0 - 249
dist/preview release/serializers/babylon.glTF2Serializer.d.ts

@@ -1,252 +1,3 @@
-declare module BABYLON.GLTF2 {
-    const enum AccessorComponentType {
-        BYTE = 5120,
-        UNSIGNED_BYTE = 5121,
-        SHORT = 5122,
-        UNSIGNED_SHORT = 5123,
-        UNSIGNED_INT = 5125,
-        FLOAT = 5126,
-    }
-    const enum AccessorType {
-        SCALAR = "SCALAR",
-        VEC2 = "VEC2",
-        VEC3 = "VEC3",
-        VEC4 = "VEC4",
-        MAT2 = "MAT2",
-        MAT3 = "MAT3",
-        MAT4 = "MAT4",
-    }
-    const enum AnimationChannelTargetPath {
-        TRANSLATION = "translation",
-        ROTATION = "rotation",
-        SCALE = "scale",
-        WEIGHTS = "weights",
-    }
-    const enum AnimationInterpolation {
-        LINEAR = "LINEAR",
-        STEP = "STEP",
-        CUBICSPLINE = "CUBICSPLINE",
-    }
-    const enum CameraType {
-        PERSPECTIVE = "perspective",
-        ORTHOGRAPHIC = "orthographic",
-    }
-    const enum ImageMimeType {
-        JPEG = "image/jpeg",
-        PNG = "image/png",
-    }
-    const enum MaterialAlphaMode {
-        OPAQUE = "OPAQUE",
-        MASK = "MASK",
-        BLEND = "BLEND",
-    }
-    const enum MeshPrimitiveMode {
-        POINTS = 0,
-        LINES = 1,
-        LINE_LOOP = 2,
-        LINE_STRIP = 3,
-        TRIANGLES = 4,
-        TRIANGLE_STRIP = 5,
-        TRIANGLE_FAN = 6,
-    }
-    const enum TextureMagFilter {
-        NEAREST = 9728,
-        LINEAR = 9729,
-    }
-    const enum TextureMinFilter {
-        NEAREST = 9728,
-        LINEAR = 9729,
-        NEAREST_MIPMAP_NEAREST = 9984,
-        LINEAR_MIPMAP_NEAREST = 9985,
-        NEAREST_MIPMAP_LINEAR = 9986,
-        LINEAR_MIPMAP_LINEAR = 9987,
-    }
-    const enum TextureWrapMode {
-        CLAMP_TO_EDGE = 33071,
-        MIRRORED_REPEAT = 33648,
-        REPEAT = 10497,
-    }
-    interface IProperty {
-        extensions?: {
-            [key: string]: any;
-        };
-        extras?: any;
-    }
-    interface IChildRootProperty extends IProperty {
-        name?: string;
-    }
-    interface IAccessorSparseIndices extends IProperty {
-        bufferView: number;
-        byteOffset?: number;
-        componentType: AccessorComponentType;
-    }
-    interface IAccessorSparseValues extends IProperty {
-        bufferView: number;
-        byteOffset?: number;
-    }
-    interface IAccessorSparse extends IProperty {
-        count: number;
-        indices: IAccessorSparseIndices;
-        values: IAccessorSparseValues;
-    }
-    interface IAccessor extends IChildRootProperty {
-        bufferView?: number;
-        byteOffset?: number;
-        componentType: AccessorComponentType;
-        normalized?: boolean;
-        count: number;
-        type: AccessorType;
-        max?: number[];
-        min?: number[];
-        sparse?: IAccessorSparse;
-    }
-    interface IAnimationChannel extends IProperty {
-        sampler: number;
-        target: IAnimationChannelTarget;
-    }
-    interface IAnimationChannelTarget extends IProperty {
-        node: number;
-        path: AnimationChannelTargetPath;
-    }
-    interface IAnimationSampler extends IProperty {
-        input: number;
-        interpolation?: AnimationInterpolation;
-        output: number;
-    }
-    interface IAnimation extends IChildRootProperty {
-        channels: IAnimationChannel[];
-        samplers: IAnimationSampler[];
-    }
-    interface IAsset extends IChildRootProperty {
-        copyright?: string;
-        generator?: string;
-        version: string;
-        minVersion?: string;
-    }
-    interface IBuffer extends IChildRootProperty {
-        uri?: string;
-        byteLength: number;
-    }
-    interface IBufferView extends IChildRootProperty {
-        buffer: number;
-        byteOffset?: number;
-        byteLength: number;
-        byteStride?: number;
-    }
-    interface ICameraOrthographic extends IProperty {
-        xmag: number;
-        ymag: number;
-        zfar: number;
-        znear: number;
-    }
-    interface ICameraPerspective extends IProperty {
-        aspectRatio: number;
-        yfov: number;
-        zfar: number;
-        znear: number;
-    }
-    interface ICamera extends IChildRootProperty {
-        orthographic?: ICameraOrthographic;
-        perspective?: ICameraPerspective;
-        type: CameraType;
-    }
-    interface IImage extends IChildRootProperty {
-        uri?: string;
-        mimeType?: ImageMimeType;
-        bufferView?: number;
-    }
-    interface IMaterialNormalTextureInfo extends ITextureInfo {
-        scale?: number;
-    }
-    interface IMaterialOcclusionTextureInfo extends ITextureInfo {
-        strength?: number;
-    }
-    interface IMaterialPbrMetallicRoughness {
-        baseColorFactor?: number[];
-        baseColorTexture?: ITextureInfo;
-        metallicFactor?: number;
-        roughnessFactor?: number;
-        metallicRoughnessTexture?: ITextureInfo;
-    }
-    interface IMaterial extends IChildRootProperty {
-        pbrMetallicRoughness?: IMaterialPbrMetallicRoughness;
-        normalTexture?: IMaterialNormalTextureInfo;
-        occlusionTexture?: IMaterialOcclusionTextureInfo;
-        emissiveTexture?: ITextureInfo;
-        emissiveFactor?: number[];
-        alphaMode?: MaterialAlphaMode;
-        alphaCutoff?: number;
-        doubleSided?: boolean;
-    }
-    interface IMeshPrimitive extends IProperty {
-        attributes: {
-            [name: string]: number;
-        };
-        indices?: number;
-        material?: number;
-        mode?: MeshPrimitiveMode;
-        targets?: {
-            [name: string]: number;
-        }[];
-    }
-    interface IMesh extends IChildRootProperty {
-        primitives: IMeshPrimitive[];
-        weights?: number[];
-    }
-    interface INode extends IChildRootProperty {
-        camera?: number;
-        children?: number[];
-        skin?: number;
-        matrix?: number[];
-        mesh?: number;
-        rotation?: number[];
-        scale?: number[];
-        translation?: number[];
-        weights?: number[];
-    }
-    interface ISampler extends IChildRootProperty {
-        magFilter?: TextureMagFilter;
-        minFilter?: TextureMinFilter;
-        wrapS?: TextureWrapMode;
-        wrapT?: TextureWrapMode;
-    }
-    interface IScene extends IChildRootProperty {
-        nodes: number[];
-    }
-    interface ISkin extends IChildRootProperty {
-        inverseBindMatrices?: number;
-        skeleton?: number;
-        joints: number[];
-    }
-    interface ITexture extends IChildRootProperty {
-        sampler?: number;
-        source: number;
-    }
-    interface ITextureInfo {
-        index: number;
-        texCoord?: number;
-    }
-    interface IGLTF extends IProperty {
-        accessors?: IAccessor[];
-        animations?: IAnimation[];
-        asset: IAsset;
-        buffers?: IBuffer[];
-        bufferViews?: IBufferView[];
-        cameras?: ICamera[];
-        extensionsUsed?: string[];
-        extensionsRequired?: string[];
-        images?: IImage[];
-        materials?: IMaterial[];
-        meshes?: IMesh[];
-        nodes?: INode[];
-        samplers?: ISampler[];
-        scene?: number;
-        scenes?: IScene[];
-        skins?: ISkin[];
-        textures?: ITexture[];
-    }
-}
-
 
 declare module BABYLON {
     /**

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


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


+ 8 - 8
dist/preview release/serializers/babylonjs.serializers.module.d.ts

@@ -4,14 +4,6 @@
 declare module 'babylonjs-serializers' { 
     export = BABYLON; 
 }
-
-declare module BABYLON {
-    class OBJExport {
-        static OBJ(mesh: Mesh[], materials?: boolean, matlibname?: string, globalposition?: boolean): string;
-        static MTL(mesh: Mesh): string;
-    }
-}
-
 declare module BABYLON.GLTF2 {
     const enum AccessorComponentType {
         BYTE = 5120,
@@ -263,6 +255,14 @@ declare module BABYLON.GLTF2 {
 
 
 declare module BABYLON {
+    class OBJExport {
+        static OBJ(mesh: Mesh[], materials?: boolean, matlibname?: string, globalposition?: boolean): string;
+        static MTL(mesh: Mesh): string;
+    }
+}
+
+
+declare module BABYLON {
     /**
      * Holds a collection of exporter options and parameters
      */

File diff suppressed because it is too large
+ 2495 - 4602
dist/preview release/typedocValidationBaseline.json


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


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

@@ -47,8 +47,10 @@
 - AssetContainer Class and loading methods. ([trevordev](https://github.com/trevordev))
 - KeepAssets class and AssetContainer.moveAllFromScene ([HoloLite](http://www.html5gamedevs.com/profile/28694-hololite/), [trevordev](https://github.com/trevordev))
 - (Viewer) It is now possible to update parts of the configuration without rcreating the objects. ([RaananW](https://github.com/RaananW))
-- GUI.Line can have its world position set from one end or the other ([SvenFrankson](https://github.com/SvenFrankson))
 - (Gulp) extra/external declarations can be prepended to final declarations during build. ([RaananW](https://github.com/RaananW))
+- (Viewer) Model can be normalized using configuration. ([RaananW](https://github.com/RaananW))
+- (Gulp) extra/external declarations can be prepended to final NPM declarations during build. ([RaananW](https://github.com/RaananW))
+- GUI.Line can have its world position set from one end or the other ([SvenFrankson](https://github.com/SvenFrankson))
 
 ## Bug fixes
 - `setPivotMatrix` ws not setting pivot correctly. This is now fixed. We also introduced a new `setPreTransformMatrix` to reproduce the sometimes needed behavior of the previous `setPivotMatrix` function ([deltakosh](https://github.com/deltakosh))

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

@@ -540,7 +540,7 @@
         }
 
         public static get Version(): string {
-            return "3.2.0-alpha6";
+            return "3.2.0-alpha7";
         }
 
         // Updatable statics so stick with vars here

+ 7 - 3
src/Loading/Plugins/babylon.babylonFileLoader.ts

@@ -481,12 +481,16 @@
                                                 var subMatId = parsedMultiMaterial.materials[matIndex];
                                                 loadedMaterialsIds.push(subMatId);
                                                 var mat = parseMaterialById(subMatId, parsedData, scene, rootUrl);
-                                                log += "\n\tMaterial " + mat.toString(fullDetails);
+                                                if (mat) {
+                                                    log += "\n\tMaterial " + mat.toString(fullDetails);
+                                                }
                                             }
                                             loadedMaterialsIds.push(parsedMultiMaterial.id);
                                             var mmat = Material.ParseMultiMaterial(parsedMultiMaterial, scene);
-                                            materialFound = true;
-                                            log += "\n\tMulti-Material " + mmat.toString(fullDetails);
+                                            if (mmat) {
+                                                materialFound = true;
+                                                log += "\n\tMulti-Material " + mmat.toString(fullDetails);
+                                            }
                                             break;
                                         }
                                     }

+ 26 - 1
src/Materials/Textures/babylon.baseTexture.ts

@@ -43,9 +43,34 @@
         public get coordinatesMode(): number {
             return this._coordinatesMode;
         }
+        
+        /*
+        * How a texture is mapped.
+        *
+        * | Value | Type                                | Description |
+        * | ----- | ----------------------------------- | ----------- |
+        * | 0     | EXPLICIT_MODE                       |             |
+        * | 1     | SPHERICAL_MODE                      |             |
+        * | 2     | PLANAR_MODE                         |             |
+        * | 3     | CUBIC_MODE                          |             |
+        * | 4     | PROJECTION_MODE                     |             |
+        * | 5     | SKYBOX_MODE                         |             |
+        * | 6     | INVCUBIC_MODE                       |             |
+        * | 7     | EQUIRECTANGULAR_MODE                |             |
+        * | 8     | FIXED_EQUIRECTANGULAR_MODE          |             |
+        * | 9     | FIXED_EQUIRECTANGULAR_MIRRORED_MODE |             |
+        */
 
         @serialize()
         public wrapU = Texture.WRAP_ADDRESSMODE;
+        
+        /* 
+        * | Value | Type               | Description |
+        * | ----- | ------------------ | ----------- |
+        * | 0     | CLAMP_ADDRESSMODE  |             |
+        * | 1     | WRAP_ADDRESSMODE   |             |
+        * | 2     | MIRROR_ADDRESSMODE |             |
+        */
 
         @serialize()
         public wrapV = Texture.WRAP_ADDRESSMODE;
@@ -378,4 +403,4 @@
             }
         }
     }
-} 
+} 

File diff suppressed because it is too large
+ 373 - 116
src/Math/babylon.math.ts


+ 2 - 2
src/Mesh/babylon.mesh.ts

@@ -3310,8 +3310,8 @@
                     minVector = boundingBox.minimumWorld;
                     maxVector = boundingBox.maximumWorld;
                 } else {
-                    minVector.MinimizeInPlace(boundingBox.minimumWorld);
-                    maxVector.MaximizeInPlace(boundingBox.maximumWorld);
+                    minVector.minimizeInPlace(boundingBox.minimumWorld);
+                    maxVector.maximizeInPlace(boundingBox.maximumWorld);
                 }
             });
 

+ 1 - 1
src/Mesh/babylon.transformNode.ts

@@ -425,7 +425,7 @@ module BABYLON {
                 point = Vector3.TransformCoordinates(point, tmat);
             }
 
-            return this.setPivotMatrix(Matrix.Translation(point.x, point.y, point.z), true);
+            return this.setPivotMatrix(Matrix.Translation(-point.x, -point.y, -point.z), true);
         }
 
         /**

+ 11 - 0
src/Tools/babylon.observable.ts

@@ -63,6 +63,8 @@
      * Represent an Observer registered to a given Observable object.
      */
     export class Observer<T> {
+        /** @ignore */
+        public _willBeUnregistered = false;
         /**
          * Gets or sets a property defining that the observer as to be unregistered after the next notification
          */
@@ -233,6 +235,8 @@
         }
 
         private _deferUnregister(observer: Observer<T>): void {
+            observer.unregisterOnNextCall = false;
+            observer._willBeUnregistered = true;
             Tools.SetImmediate(() => {
                 this.remove(observer);
             })
@@ -260,6 +264,10 @@
             state.lastReturnValue = eventData;
 
             for (var obs of this._observers) {
+                if (obs._willBeUnregistered) {
+                    continue;
+                }
+
                 if (obs.mask & mask) {
                     if (obs.scope) {
                         state.lastReturnValue = obs.callback.apply(obs.scope, [eventData, state])
@@ -312,6 +320,9 @@
                 if (state.skipNextObservers) {
                     return;
                 }
+                if (obs._willBeUnregistered) {
+                    return;
+                }                
                 if (obs.mask & mask) {
                     if (obs.scope) {
                         p = p.then((lastReturnedValue) => {

BIN
tests/validation/ReferenceImages/gltfMaterialAlphaBack.png


BIN
tests/validation/ReferenceImages/gltfMeshPrimitives.png


BIN
tests/validation/ReferenceImages/gltfMeshPrimitivesUV.png


+ 18 - 0
tests/validation/config.json

@@ -200,6 +200,24 @@
       "referenceImage": "gltfMaterialAlpha.png"
     },
     {
+      "title": "GLTF Material Alpha (Back)",
+      "scriptToRun": "/Demos/GLTFTests/index.js",
+      "functionToCall": "createMaterialAlphaFlippedScene",
+      "referenceImage": "gltfMaterialAlphaBack.png"
+    },
+    {
+      "title": "GLTF Mesh Primitives",
+      "scriptToRun": "/Demos/GLTFTests/index.js",
+      "functionToCall": "createMeshPrimitivesScene",
+      "referenceImage": "gltfMeshPrimitives.png"
+    },
+    {
+      "title": "GLTF Mesh Primitives UV",
+      "scriptToRun": "/Demos/GLTFTests/index.js",
+      "functionToCall": "createMeshPrimitivesUVScene",
+      "referenceImage": "gltfMeshPrimitivesUV.png"
+    },
+    {
       "title": "GLTF Primitive Attribute",
       "scriptToRun": "/Demos/GLTFTests/index.js",
       "functionToCall": "createPrimitiveAttributeScene",