David Catuhe 7 лет назад
Родитель
Сommit
71fc19ae99

Разница между файлами не показана из-за своего большого размера
+ 3046 - 3045
Playground/babylon.d.txt


Разница между файлами не показана из-за своего большого размера
+ 2844 - 2843
dist/preview release/babylon.d.ts


+ 1 - 0
dist/preview release/babylon.max.js

@@ -41843,6 +41843,7 @@ var BABYLON;
          * @param {BABYLON.EasingFunction} easingFunction defines the easing function to use (linear by default)
          * @param {BABYLON.EasingFunction} easingFunction defines the easing function to use (linear by default)
          * @param onAnimationEnd defines the callback to call when an animation ends (will be called once per node)
          * @param onAnimationEnd defines the callback to call when an animation ends (will be called once per node)
          * @returns the list of animatables created for all nodes
          * @returns the list of animatables created for all nodes
+         * @example https://www.babylonjs-playground.com/#MH0VLI
          */
          */
         Animation.CreateAndStartHierarchyAnimation = function (name, node, directDescendantsOnly, targetProperty, framePerSecond, totalFrame, from, to, loopMode, easingFunction, onAnimationEnd) {
         Animation.CreateAndStartHierarchyAnimation = function (name, node, directDescendantsOnly, targetProperty, framePerSecond, totalFrame, from, to, loopMode, easingFunction, onAnimationEnd) {
             var animation = Animation._PrepareAnimation(name, targetProperty, framePerSecond, totalFrame, from, to, loopMode, easingFunction);
             var animation = Animation._PrepareAnimation(name, targetProperty, framePerSecond, totalFrame, from, to, loopMode, easingFunction);

Разница между файлами не показана из-за своего большого размера
+ 3711 - 3711
dist/preview release/customConfigurations/minimalGLTFViewer/babylon.d.ts


+ 150 - 3
dist/preview release/serializers/babylon.glTF2Serializer.d.ts

@@ -1,15 +1,162 @@
 
 
 declare module BABYLON {
 declare module BABYLON {
-    class GLTFExport {
+    class GLTF2Export {
         /**
         /**
          * Exports the geometry of a Mesh array in .gltf file format.
          * Exports the geometry of a Mesh array in .gltf file format.
          * If glb is set to true, exports as .glb.
          * If glb is set to true, exports as .glb.
          * @param meshes
          * @param meshes
          * @param materials
          * @param materials
-         * @param glb
+         *
+         * @returns {[fileName: string]: string | Blob} Returns an object with a .gltf, .glb and associates textures
+         * as keys and their data and paths as values.
+         */
+        static GLTF(scene: BABYLON.Scene, filename: string): {
+            [fileName: string]: string | Blob;
+        };
+        /**
+         *
+         * @param meshes
+         * @param filename
+         *
+         * @returns {[fileName: string]: string | Blob} Returns an object with a .glb filename as key and data as value
+         */
+        static GLB(scene: BABYLON.Scene, filename: string): {
+            [fileName: string]: string | Blob;
+        };
+        /**
+         * Downloads data from glTF object.
+         *
+         * @param gltfData glTF object with keys being file names and values being data
          */
          */
-        static GLTF(meshes: Mesh[], filename: string, glb?: boolean): {
+        static downloadFiles(gltfData: {
             [fileName: string]: string | Blob;
             [fileName: string]: string | Blob;
+        }): void;
+    }
+}
+
+declare module BABYLON {
+    class _GLTF2Exporter {
+        private bufferViews;
+        private accessors;
+        private nodes;
+        private asset;
+        private scenes;
+        private meshes;
+        private totalByteLength;
+        private babylonScene;
+        constructor(babylonScene: BABYLON.Scene);
+        /**
+         * Creates a buffer view based on teh supplied arguments
+         * @param bufferIndex
+         * @param byteOffset
+         * @param byteLength
+         *
+         * @returns {_IGLTFBufferView}
+         */
+        private createBufferView(bufferIndex, byteOffset, byteLength);
+        /**
+         * Creates an accessor based on the supplied arguments
+         * @param bufferviewIndex
+         * @param name
+         * @param type
+         * @param componentType
+         * @param count
+         * @param min
+         * @param max
+         *
+         * @returns {_IGLTFAccessor}
+         */
+        private createAccessor(bufferviewIndex, name, type, componentType, count, min?, max?);
+        /**
+         * Calculates the minimum and maximum values of an array of floats, based on stride
+         * @param buff
+         * @param vertexStart
+         * @param vertexCount
+         * @param arrayOffset
+         * @param stride
+         *
+         * @returns {min: number[], max: number[]} min number array and max number array
+         */
+        private calculateMinMax(buff, vertexStart, vertexCount, arrayOffset, stride);
+        /**
+         * Write mesh attribute data to buffer.
+         * Returns the bytelength of the data.
+         * @param vertexBufferType
+         * @param submesh
+         * @param meshAttributeArray
+         * @param strideSize
+         * @param byteOffset
+         * @param dataBuffer
+         * @param useRightHandedSystem
+         *
+         * @returns {number} byte length
+         */
+        private writeAttributeData(vertexBufferType, submesh, meshAttributeArray, strideSize, byteOffset, dataBuffer, useRightHandedSystem);
+        /**
+         * Generates glTF json data
+         * @param glb
+         * @param glTFPrefix
+         * @param prettyPrint
+         *
+         * @returns {string} json data as string
+         */
+        private generateJSON(glb, glTFPrefix?, prettyPrint?);
+        /**
+         * Generates data for .gltf and .bin files based on the glTF prefix string
+         * @param glTFPrefix
+         *
+         * @returns {[x: string]: string | Blob} object with glTF json tex filename
+         * and binary file name as keys and their data as values
+         */
+        _generateGLTF(glTFPrefix: string): {
+            [x: string]: string | Blob;
         };
         };
+        /**
+         * Creates a binary buffer for glTF
+         *
+         * @returns {ArrayBuffer}
+         */
+        private generateBinary();
+        /**
+         * Generates a glb file from the json and binary data.
+         * Returns an object with the glb file name as the key and data as the value.
+         * @param jsonText
+         * @param binaryBuffer
+         * @param glTFPrefix
+         *
+         * @returns {[glbFileName: string]: Blob} object with glb filename as key and data as value
+         */
+        _generateGLB(glTFPrefix: string): {
+            [glbFileName: string]: Blob;
+        };
+        /**
+         * Sets the TRS for each node
+         * @param node
+         * @param babylonMesh
+         * @param useRightHandedSystem
+         */
+        private setNodeTransformation(node, babylonMesh, useRightHandedSystem);
+        /**
+         * Sets data for the primitive attributes of each submesh
+         * @param mesh
+         * @param babylonMesh
+         * @param byteOffset
+         * @param useRightHandedSystem
+         * @param dataBuffer
+         *
+         * @returns {number} bytelength of the primitive attributes plus the passed in byteOffset
+         */
+        private setPrimitiveAttributes(mesh, babylonMesh, byteOffset, useRightHandedSystem, dataBuffer?);
+        /**
+         * Creates a glTF scene based on the array of meshes.
+         * Returns the the total byte offset.
+         * @param gltf
+         * @param byteOffset
+         * @param buffer
+         * @param dataBuffer
+         *
+         * @returns {number} bytelength + byteoffset
+         */
+        private createScene(babylonScene, byteOffset, dataBuffer?);
     }
     }
 }
 }

Разница между файлами не показана из-за своего большого размера
+ 589 - 481
dist/preview release/serializers/babylon.glTF2Serializer.js


Разница между файлами не показана из-за своего большого размера
+ 1 - 1
dist/preview release/serializers/babylon.glTF2Serializer.min.js


Разница между файлами не показана из-за своего большого размера
+ 592 - 484
dist/preview release/serializers/babylonjs.serializers.js


Разница между файлами не показана из-за своего большого размера
+ 1 - 1
dist/preview release/serializers/babylonjs.serializers.min.js


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

@@ -13,16 +13,163 @@ declare module BABYLON {
 
 
 
 
 declare module BABYLON {
 declare module BABYLON {
-    class GLTFExport {
+    class GLTF2Export {
         /**
         /**
          * Exports the geometry of a Mesh array in .gltf file format.
          * Exports the geometry of a Mesh array in .gltf file format.
          * If glb is set to true, exports as .glb.
          * If glb is set to true, exports as .glb.
          * @param meshes
          * @param meshes
          * @param materials
          * @param materials
-         * @param glb
+         *
+         * @returns {[fileName: string]: string | Blob} Returns an object with a .gltf, .glb and associates textures
+         * as keys and their data and paths as values.
+         */
+        static GLTF(scene: BABYLON.Scene, filename: string): {
+            [fileName: string]: string | Blob;
+        };
+        /**
+         *
+         * @param meshes
+         * @param filename
+         *
+         * @returns {[fileName: string]: string | Blob} Returns an object with a .glb filename as key and data as value
+         */
+        static GLB(scene: BABYLON.Scene, filename: string): {
+            [fileName: string]: string | Blob;
+        };
+        /**
+         * Downloads data from glTF object.
+         *
+         * @param gltfData glTF object with keys being file names and values being data
          */
          */
-        static GLTF(meshes: Mesh[], filename: string, glb?: boolean): {
+        static downloadFiles(gltfData: {
             [fileName: string]: string | Blob;
             [fileName: string]: string | Blob;
+        }): void;
+    }
+}
+
+declare module BABYLON {
+    class _GLTF2Exporter {
+        private bufferViews;
+        private accessors;
+        private nodes;
+        private asset;
+        private scenes;
+        private meshes;
+        private totalByteLength;
+        private babylonScene;
+        constructor(babylonScene: BABYLON.Scene);
+        /**
+         * Creates a buffer view based on teh supplied arguments
+         * @param bufferIndex
+         * @param byteOffset
+         * @param byteLength
+         *
+         * @returns {_IGLTFBufferView}
+         */
+        private createBufferView(bufferIndex, byteOffset, byteLength);
+        /**
+         * Creates an accessor based on the supplied arguments
+         * @param bufferviewIndex
+         * @param name
+         * @param type
+         * @param componentType
+         * @param count
+         * @param min
+         * @param max
+         *
+         * @returns {_IGLTFAccessor}
+         */
+        private createAccessor(bufferviewIndex, name, type, componentType, count, min?, max?);
+        /**
+         * Calculates the minimum and maximum values of an array of floats, based on stride
+         * @param buff
+         * @param vertexStart
+         * @param vertexCount
+         * @param arrayOffset
+         * @param stride
+         *
+         * @returns {min: number[], max: number[]} min number array and max number array
+         */
+        private calculateMinMax(buff, vertexStart, vertexCount, arrayOffset, stride);
+        /**
+         * Write mesh attribute data to buffer.
+         * Returns the bytelength of the data.
+         * @param vertexBufferType
+         * @param submesh
+         * @param meshAttributeArray
+         * @param strideSize
+         * @param byteOffset
+         * @param dataBuffer
+         * @param useRightHandedSystem
+         *
+         * @returns {number} byte length
+         */
+        private writeAttributeData(vertexBufferType, submesh, meshAttributeArray, strideSize, byteOffset, dataBuffer, useRightHandedSystem);
+        /**
+         * Generates glTF json data
+         * @param glb
+         * @param glTFPrefix
+         * @param prettyPrint
+         *
+         * @returns {string} json data as string
+         */
+        private generateJSON(glb, glTFPrefix?, prettyPrint?);
+        /**
+         * Generates data for .gltf and .bin files based on the glTF prefix string
+         * @param glTFPrefix
+         *
+         * @returns {[x: string]: string | Blob} object with glTF json tex filename
+         * and binary file name as keys and their data as values
+         */
+        _generateGLTF(glTFPrefix: string): {
+            [x: string]: string | Blob;
         };
         };
+        /**
+         * Creates a binary buffer for glTF
+         *
+         * @returns {ArrayBuffer}
+         */
+        private generateBinary();
+        /**
+         * Generates a glb file from the json and binary data.
+         * Returns an object with the glb file name as the key and data as the value.
+         * @param jsonText
+         * @param binaryBuffer
+         * @param glTFPrefix
+         *
+         * @returns {[glbFileName: string]: Blob} object with glb filename as key and data as value
+         */
+        _generateGLB(glTFPrefix: string): {
+            [glbFileName: string]: Blob;
+        };
+        /**
+         * Sets the TRS for each node
+         * @param node
+         * @param babylonMesh
+         * @param useRightHandedSystem
+         */
+        private setNodeTransformation(node, babylonMesh, useRightHandedSystem);
+        /**
+         * Sets data for the primitive attributes of each submesh
+         * @param mesh
+         * @param babylonMesh
+         * @param byteOffset
+         * @param useRightHandedSystem
+         * @param dataBuffer
+         *
+         * @returns {number} bytelength of the primitive attributes plus the passed in byteOffset
+         */
+        private setPrimitiveAttributes(mesh, babylonMesh, byteOffset, useRightHandedSystem, dataBuffer?);
+        /**
+         * Creates a glTF scene based on the array of meshes.
+         * Returns the the total byte offset.
+         * @param gltf
+         * @param byteOffset
+         * @param buffer
+         * @param dataBuffer
+         *
+         * @returns {number} bytelength + byteoffset
+         */
+        private createScene(babylonScene, byteOffset, dataBuffer?);
     }
     }
 }
 }