Browse Source

Merge pull request #3661 from RaananW/fix-unit-tests

Fix unit tests
Raanan Weber 7 years ago
parent
commit
1e7559a874

+ 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" }))

+ 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
      */

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

@@ -47,7 +47,7 @@
 - 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))
-- (Gulp) extra/external declarations can be prepended to final declarations during build. ([RaananW](https://github.com/RaananW))
+- (Gulp) extra/external declarations can be prepended to final NPM declarations during build. ([RaananW](https://github.com/RaananW))
 
 ## 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))