import { Scene } from '../refs.node'; import { TableGenerateGltfOptions } from '../vpt/table/table'; /** * This is a modified version of Three's GLTF exporter that runs better * on Node.js. * * Changes: * * - Port to Typescript (and make it a module) * - Don't use Canvas but ~20x faster sharp.js for image manipulation * - Don't resolve all pending promises at once but use a pool * - Be intelligent about re-using images * - Adds Draco compression support * * @see https://github.com/mrdoob/three.js/blob/master/examples/js/exporters/GLTFExporter.js * @author fernandojsg / http://fernandojsg.com * @author Don McCurdy / https://www.donmccurdy.com * @author Takahiro / https://github.com/takahirox */ export declare class GLTFExporter { private started; private options; private byteOffset; private buffers; private pending; private nodeMap; private skins; private extensionsUsed; private readonly images; private readonly cachedData; private readonly outputJSON; constructor(options?: TableGenerateGltfOptions); /** * Parse scenes and generate GLTF output * @param input Scene or array of Scenes */ parse(input: Scene | Scene[]): Promise; /** * Compares two arrays * @param {Array} array1 Array 1 to compare * @param {Array} array2 Array 2 to compare * @return {Boolean} Returns true if both arrays are equal */ private equalArray; /** * Converts a string to an ArrayBuffer. * @param {string} text * @return {ArrayBuffer} */ private stringToBuffer; /** * Get the min and max vectors from the given attribute * @param {BufferAttribute} attribute Attribute to find the min/max in range from start to start + count * @param {Integer} start * @param {Integer} count * @return {Object} Object containing the `min` and `max` values (As an array of attribute.itemSize components) */ private getMinMax; /** * Checks if image size is POT. * * @param {Image} image The image to be checked. * @returns {Boolean} Returns true if image size is POT. * */ private isPowerOfTwo; /** * Checks if normal attribute values are normalized. * * @param {BufferAttribute} normal * @returns {Boolean} * */ private isNormalizedNormalAttribute; /** * Creates normalized normal buffer attribute. * * @param {BufferAttribute} normal * @returns {BufferAttribute} * */ private createNormalizedNormalAttribute; /** * Get the required size + padding for a buffer, rounded to the next 4-byte boundary. * https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#data-alignment * * @param {Integer} bufferSize The size the original buffer. * @returns {Integer} new buffer size with required padding. * */ private getPaddedBufferSize; /** * Returns a buffer aligned to 4-byte boundary. * * @param {ArrayBuffer} arrayBuffer Buffer to pad * @param {Integer} paddingByte (Optional) * @returns {ArrayBuffer} The same buffer if it's already aligned to 4-byte boundary or a new buffer */ private getPaddedArrayBuffer; /** * Serializes a userData. * * @param {Object3D|Material} object * @returns {Object} */ private serializeUserData; /** * Applies a texture transform, if present, to the map definition. Requires * the KHR_texture_transform extension. */ private applyTextureTransform; /** * Process a buffer to append to the default one. * @param buffer * @return 0 */ private processBuffer; /** * Process and generate a BufferView * @param {BufferAttribute} attribute * @param {number} componentType * @param {number} start * @param {number} count * @param {number} target (Optional) Target usage of the BufferView * @return {Object} */ private processBufferView; /** * Process and generate a BufferView from an image Blob. * @param blob Image data * @param uri Identifier * @returns buffer view index */ private processBufferViewImage; /** * Process attribute to generate an accessor * @param attribute Attribute to process * @param geometry (Optional) Geometry used for truncated draw range * @param start (Optional) * @param count (Optional) * @return Index of the processed accessor on the "accessors" array */ private processAccessor; /** * Process image * @param image image to process * @param format of the image (e.g. RGBFormat, RGBAFormat etc) * @param flipY before writing out the image * @return Index of the processed texture in the "images" array */ private processImage; /** * Process sampler * @param {Texture} map Texture to process * @return {Integer} Index of the processed texture in the "samplers" array */ private processSampler; /** * Process texture * @param {Texture} map Map to process * @return {Integer} Index of the processed texture in the "textures" array */ private processTexture; /** * Process material * @param {Material} material Material to process * @return {Integer} Index of the processed material in the "materials" array */ private processMaterial; /** * Process mesh * @param {Mesh} mesh Mesh to process * @return {Integer} Index of the processed mesh in the "meshes" array */ private processMesh; /** * Process camera * @param {Camera} camera Camera to process * @return {Integer} Index of the processed mesh in the "camera" array */ private processCamera; /** * Creates glTF animation entry from AnimationClip object. * * Status: * - Only properties listed in PATH_PROPERTIES may be animated. * * @param {AnimationClip} clip * @param {Object3D} root * @return {number} */ private processAnimation; private processSkin; private processLight; /** * Process Object3D node * @param {Object3D} object Object3D to processNode * @return {Integer} Index of the node in the nodes list */ private processNode; /** * Process Scene * @param {Scene} scene Scene to process */ private processScene; /** * Creates a Scene to hold a list of objects and parse it * @param {Array} objects List of objects to process */ private processObjects; private processInput; }