1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428 |
- declare module "babylonjs-serializers/OBJ/objSerializer" {
- import { Mesh } from "babylonjs/Meshes/mesh";
- /**
- * Class for generating OBJ data from a Babylon scene.
- */
- export class OBJExport {
- /**
- * Exports the geometry of a Mesh array in .OBJ file format (text)
- * @param mesh defines the list of meshes to serialize
- * @param materials defines if materials should be exported
- * @param matlibname defines the name of the associated mtl file
- * @param globalposition defines if the exported positions are globals or local to the exported mesh
- * @returns the OBJ content
- */
- static OBJ(mesh: Mesh[], materials?: boolean, matlibname?: string, globalposition?: boolean): string;
- /**
- * Exports the material(s) of a mesh in .MTL file format (text)
- * @param mesh defines the mesh to extract the material from
- * @returns the mtl content
- */
- static MTL(mesh: Mesh): string;
- }
- }
- declare module "babylonjs-serializers/OBJ/index" {
- export * from "babylonjs-serializers/OBJ/objSerializer";
- }
- declare module "babylonjs-serializers/glTF/glTFFileExporter" {
- /** @hidden */
- export var __IGLTFExporterExtension: number;
- /**
- * Interface for extending the exporter
- * @hidden
- */
- export interface IGLTFExporterExtension {
- /**
- * The name of this extension
- */
- readonly name: string;
- /**
- * Defines whether this extension is enabled
- */
- enabled: boolean;
- /**
- * Defines whether this extension is required
- */
- required: boolean;
- }
- }
- declare module "babylonjs-serializers/glTF/2.0/glTFExporterExtension" {
- import { ImageMimeType, IMeshPrimitive, INode, IMaterial, ITextureInfo } from "babylonjs-gltf2interface";
- import { Node } from "babylonjs/node";
- import { Texture } from "babylonjs/Materials/Textures/texture";
- import { SubMesh } from "babylonjs/Meshes/subMesh";
- import { IDisposable } from "babylonjs/scene";
- import { _BinaryWriter } from "babylonjs-serializers/glTF/2.0/glTFExporter";
- import { IGLTFExporterExtension } from "babylonjs-serializers/glTF/glTFFileExporter";
- import { Material } from 'babylonjs/Materials/material';
- import { BaseTexture } from 'babylonjs/Materials/Textures/baseTexture';
- /** @hidden */
- export var __IGLTFExporterExtensionV2: number;
- /**
- * Interface for a glTF exporter extension
- * @hidden
- */
- export interface IGLTFExporterExtensionV2 extends IGLTFExporterExtension, IDisposable {
- /**
- * Define this method to modify the default behavior before exporting a texture
- * @param context The context when loading the asset
- * @param babylonTexture The Babylon.js texture
- * @param mimeType The mime-type of the generated image
- * @returns A promise that resolves with the exported texture
- */
- preExportTextureAsync?(context: string, babylonTexture: Texture, mimeType: ImageMimeType): Promise<Texture>;
- /**
- * Define this method to get notified when a texture info is created
- * @param context The context when loading the asset
- * @param textureInfo The glTF texture info
- * @param babylonTexture The Babylon.js texture
- */
- postExportTexture?(context: string, textureInfo: ITextureInfo, babylonTexture: BaseTexture): void;
- /**
- * Define this method to modify the default behavior when exporting texture info
- * @param context The context when loading the asset
- * @param meshPrimitive glTF mesh primitive
- * @param babylonSubMesh Babylon submesh
- * @param binaryWriter glTF serializer binary writer instance
- * @returns nullable IMeshPrimitive promise
- */
- postExportMeshPrimitiveAsync?(context: string, meshPrimitive: IMeshPrimitive, babylonSubMesh: SubMesh, binaryWriter: _BinaryWriter): Promise<IMeshPrimitive>;
- /**
- * Define this method to modify the default behavior when exporting a node
- * @param context The context when exporting the node
- * @param node glTF node
- * @param babylonNode BabylonJS node
- * @returns nullable INode promise
- */
- postExportNodeAsync?(context: string, node: INode, babylonNode: Node): Promise<INode>;
- /**
- * Define this method to modify the default behavior when exporting a material
- * @param material glTF material
- * @param babylonMaterial BabylonJS material
- * @returns nullable IMaterial promise
- */
- postExportMaterialAsync?(context: string, node: IMaterial, babylonMaterial: Material): Promise<IMaterial>;
- /**
- * Define this method to return additional textures to export from a material
- * @param material glTF material
- * @param babylonMaterial BabylonJS material
- * @returns List of textures
- */
- postExportMaterialAdditionalTextures?(context: string, node: IMaterial, babylonMaterial: Material): BaseTexture[];
- /** Gets a boolean indicating that this extension was used */
- wasUsed: boolean;
- /** Gets a boolean indicating that this extension is required for the file to work */
- required: boolean;
- /**
- * Called after the exporter state changes to EXPORTING
- */
- onExporting?(): void;
- }
- }
- declare module "babylonjs-serializers/glTF/2.0/glTFMaterialExporter" {
- import { ITextureInfo, ImageMimeType, IMaterial, IMaterialPbrMetallicRoughness } from "babylonjs-gltf2interface";
- import { Nullable } from "babylonjs/types";
- import { BaseTexture } from "babylonjs/Materials/Textures/baseTexture";
- import { Material } from "babylonjs/Materials/material";
- import { StandardMaterial } from "babylonjs/Materials/standardMaterial";
- import { PBRMaterial } from "babylonjs/Materials/PBR/pbrMaterial";
- import { PBRMetallicRoughnessMaterial } from "babylonjs/Materials/PBR/pbrMetallicRoughnessMaterial";
- import { _Exporter } from "babylonjs-serializers/glTF/2.0/glTFExporter";
- /**
- * Utility methods for working with glTF material conversion properties. This class should only be used internally
- * @hidden
- */
- export class _GLTFMaterialExporter {
- /**
- * Represents the dielectric specular values for R, G and B
- */
- private static readonly _DielectricSpecular;
- /**
- * Allows the maximum specular power to be defined for material calculations
- */
- private static readonly _MaxSpecularPower;
- /**
- * Mapping to store textures
- */
- private _textureMap;
- /**
- * Numeric tolerance value
- */
- private static readonly _Epsilon;
- /**
- * Reference to the glTF Exporter
- */
- private _exporter;
- constructor(exporter: _Exporter);
- /**
- * Specifies if two colors are approximately equal in value
- * @param color1 first color to compare to
- * @param color2 second color to compare to
- * @param epsilon threshold value
- */
- private static FuzzyEquals;
- /**
- * Gets the materials from a Babylon scene and converts them to glTF materials
- * @param scene babylonjs scene
- * @param mimeType texture mime type
- * @param images array of images
- * @param textures array of textures
- * @param materials array of materials
- * @param imageData mapping of texture names to base64 textures
- * @param hasTextureCoords specifies if texture coordinates are present on the material
- */
- _convertMaterialsToGLTFAsync(babylonMaterials: Material[], mimeType: ImageMimeType, hasTextureCoords: boolean): Promise<void>;
- /**
- * Makes a copy of the glTF material without the texture parameters
- * @param originalMaterial original glTF material
- * @returns glTF material without texture parameters
- */
- _stripTexturesFromMaterial(originalMaterial: IMaterial): IMaterial;
- /**
- * Specifies if the material has any texture parameters present
- * @param material glTF Material
- * @returns boolean specifying if texture parameters are present
- */
- _hasTexturesPresent(material: IMaterial): boolean;
- /**
- * Converts a Babylon StandardMaterial to a glTF Metallic Roughness Material
- * @param babylonStandardMaterial
- * @returns glTF Metallic Roughness Material representation
- */
- _convertToGLTFPBRMetallicRoughness(babylonStandardMaterial: StandardMaterial): IMaterialPbrMetallicRoughness;
- /**
- * Computes the metallic factor
- * @param diffuse diffused value
- * @param specular specular value
- * @param oneMinusSpecularStrength one minus the specular strength
- * @returns metallic value
- */
- static _SolveMetallic(diffuse: number, specular: number, oneMinusSpecularStrength: number): number;
- /**
- * Sets the glTF alpha mode to a glTF material from the Babylon Material
- * @param glTFMaterial glTF material
- * @param babylonMaterial Babylon material
- */
- private static _SetAlphaMode;
- /**
- * Converts a Babylon Standard Material to a glTF Material
- * @param babylonStandardMaterial BJS Standard Material
- * @param mimeType mime type to use for the textures
- * @param images array of glTF image interfaces
- * @param textures array of glTF texture interfaces
- * @param materials array of glTF material interfaces
- * @param imageData map of image file name to data
- * @param hasTextureCoords specifies if texture coordinates are present on the submesh to determine if textures should be applied
- */
- _convertStandardMaterialAsync(babylonStandardMaterial: StandardMaterial, mimeType: ImageMimeType, hasTextureCoords: boolean): Promise<IMaterial>;
- private _finishMaterial;
- /**
- * Converts a Babylon PBR Metallic Roughness Material to a glTF Material
- * @param babylonPBRMetalRoughMaterial BJS PBR Metallic Roughness Material
- * @param mimeType mime type to use for the textures
- * @param images array of glTF image interfaces
- * @param textures array of glTF texture interfaces
- * @param materials array of glTF material interfaces
- * @param imageData map of image file name to data
- * @param hasTextureCoords specifies if texture coordinates are present on the submesh to determine if textures should be applied
- */
- _convertPBRMetallicRoughnessMaterialAsync(babylonPBRMetalRoughMaterial: PBRMetallicRoughnessMaterial, mimeType: ImageMimeType, hasTextureCoords: boolean): Promise<IMaterial>;
- /**
- * Converts an image typed array buffer to a base64 image
- * @param buffer typed array buffer
- * @param width width of the image
- * @param height height of the image
- * @param mimeType mimetype of the image
- * @returns base64 image string
- */
- private _createBase64FromCanvasAsync;
- /**
- * Generates a white texture based on the specified width and height
- * @param width width of the texture in pixels
- * @param height height of the texture in pixels
- * @param scene babylonjs scene
- * @returns white texture
- */
- private _createWhiteTexture;
- /**
- * Resizes the two source textures to the same dimensions. If a texture is null, a default white texture is generated. If both textures are null, returns null
- * @param texture1 first texture to resize
- * @param texture2 second texture to resize
- * @param scene babylonjs scene
- * @returns resized textures or null
- */
- private _resizeTexturesToSameDimensions;
- /**
- * Converts an array of pixels to a Float32Array
- * Throws an error if the pixel format is not supported
- * @param pixels - array buffer containing pixel values
- * @returns Float32 of pixels
- */
- private _convertPixelArrayToFloat32;
- /**
- * Convert Specular Glossiness Textures to Metallic Roughness
- * See link below for info on the material conversions from PBR Metallic/Roughness and Specular/Glossiness
- * @link https://github.com/KhronosGroup/glTF/blob/master/extensions/2.0/Khronos/KHR_materials_pbrSpecularGlossiness/examples/convert-between-workflows-bjs/js/babylon.pbrUtilities.js
- * @param diffuseTexture texture used to store diffuse information
- * @param specularGlossinessTexture texture used to store specular and glossiness information
- * @param factors specular glossiness material factors
- * @param mimeType the mime type to use for the texture
- * @returns pbr metallic roughness interface or null
- */
- private _convertSpecularGlossinessTexturesToMetallicRoughnessAsync;
- /**
- * Converts specular glossiness material properties to metallic roughness
- * @param specularGlossiness interface with specular glossiness material properties
- * @returns interface with metallic roughness material properties
- */
- private _convertSpecularGlossinessToMetallicRoughness;
- /**
- * Calculates the surface reflectance, independent of lighting conditions
- * @param color Color source to calculate brightness from
- * @returns number representing the perceived brightness, or zero if color is undefined
- */
- private _getPerceivedBrightness;
- /**
- * Returns the maximum color component value
- * @param color
- * @returns maximum color component value, or zero if color is null or undefined
- */
- private _getMaxComponent;
- /**
- * Convert a PBRMaterial (Metallic/Roughness) to Metallic Roughness factors
- * @param babylonPBRMaterial BJS PBR Metallic Roughness Material
- * @param mimeType mime type to use for the textures
- * @param images array of glTF image interfaces
- * @param textures array of glTF texture interfaces
- * @param glTFPbrMetallicRoughness glTF PBR Metallic Roughness interface
- * @param imageData map of image file name to data
- * @param hasTextureCoords specifies if texture coordinates are present on the submesh to determine if textures should be applied
- * @returns glTF PBR Metallic Roughness factors
- */
- private _convertMetalRoughFactorsToMetallicRoughnessAsync;
- private _getGLTFTextureSampler;
- private _getGLTFTextureWrapMode;
- private _getGLTFTextureWrapModesSampler;
- /**
- * Convert a PBRMaterial (Specular/Glossiness) to Metallic Roughness factors
- * @param babylonPBRMaterial BJS PBR Metallic Roughness Material
- * @param mimeType mime type to use for the textures
- * @param images array of glTF image interfaces
- * @param textures array of glTF texture interfaces
- * @param glTFPbrMetallicRoughness glTF PBR Metallic Roughness interface
- * @param imageData map of image file name to data
- * @param hasTextureCoords specifies if texture coordinates are present on the submesh to determine if textures should be applied
- * @returns glTF PBR Metallic Roughness factors
- */
- private _convertSpecGlossFactorsToMetallicRoughnessAsync;
- /**
- * Converts a Babylon PBR Metallic Roughness Material to a glTF Material
- * @param babylonPBRMaterial BJS PBR Metallic Roughness Material
- * @param mimeType mime type to use for the textures
- * @param images array of glTF image interfaces
- * @param textures array of glTF texture interfaces
- * @param materials array of glTF material interfaces
- * @param imageData map of image file name to data
- * @param hasTextureCoords specifies if texture coordinates are present on the submesh to determine if textures should be applied
- */
- _convertPBRMaterialAsync(babylonPBRMaterial: PBRMaterial, mimeType: ImageMimeType, hasTextureCoords: boolean): Promise<IMaterial>;
- private setMetallicRoughnessPbrMaterial;
- private getPixelsFromTexture;
- /**
- * Extracts a texture from a Babylon texture into file data and glTF data
- * @param babylonTexture Babylon texture to extract
- * @param mimeType Mime Type of the babylonTexture
- * @return glTF texture info, or null if the texture format is not supported
- */
- _exportTextureAsync(babylonTexture: BaseTexture, mimeType: ImageMimeType): Promise<Nullable<ITextureInfo>>;
- _exportTextureInfoAsync(babylonTexture: BaseTexture, mimeType: ImageMimeType): Promise<Nullable<ITextureInfo>>;
- /**
- * Builds a texture from base64 string
- * @param base64Texture base64 texture string
- * @param baseTextureName Name to use for the texture
- * @param mimeType image mime type for the texture
- * @param images array of images
- * @param textures array of textures
- * @param imageData map of image data
- * @returns glTF texture info, or null if the texture format is not supported
- */
- private _getTextureInfoFromBase64;
- }
- }
- declare module "babylonjs-serializers/glTF/2.0/glTFData" {
- /**
- * Class for holding and downloading glTF file data
- */
- export class GLTFData {
- /**
- * Object which contains the file name as the key and its data as the value
- */
- glTFFiles: {
- [fileName: string]: string | Blob;
- };
- /**
- * Initializes the glTF file object
- */
- constructor();
- /**
- * Downloads the glTF data as files based on their names and data
- */
- downloadFiles(): void;
- }
- }
- declare module "babylonjs-serializers/glTF/2.0/glTFSerializer" {
- import { Node } from "babylonjs/node";
- import { Scene } from "babylonjs/scene";
- import { GLTFData } from "babylonjs-serializers/glTF/2.0/glTFData";
- /**
- * Holds a collection of exporter options and parameters
- */
- export interface IExportOptions {
- /**
- * Function which indicates whether a babylon node should be exported or not
- * @param node source Babylon node. It is used to check whether it should be exported to glTF or not
- * @returns boolean, which indicates whether the node should be exported (true) or not (false)
- */
- shouldExportNode?(node: Node): boolean;
- /**
- * Function used to extract the part of node's metadata that will be exported into glTF node extras
- * @param metadata source metadata to read from
- * @returns the data to store to glTF node extras
- */
- metadataSelector?(metadata: any): any;
- /**
- * The sample rate to bake animation curves
- */
- animationSampleRate?: number;
- /**
- * Begin serialization without waiting for the scene to be ready
- */
- exportWithoutWaitingForScene?: boolean;
- }
- /**
- * Class for generating glTF data from a Babylon scene.
- */
- export class GLTF2Export {
- /**
- * Exports the geometry of the scene to .gltf file format asynchronously
- * @param scene Babylon scene with scene hierarchy information
- * @param filePrefix File prefix to use when generating the glTF file
- * @param options Exporter options
- * @returns Returns an object with a .gltf file and associates texture names
- * as keys and their data and paths as values
- */
- static GLTFAsync(scene: Scene, filePrefix: string, options?: IExportOptions): Promise<GLTFData>;
- private static _PreExportAsync;
- private static _PostExportAsync;
- /**
- * Exports the geometry of the scene to .glb file format asychronously
- * @param scene Babylon scene with scene hierarchy information
- * @param filePrefix File prefix to use when generating glb file
- * @param options Exporter options
- * @returns Returns an object with a .glb filename as key and data as value
- */
- static GLBAsync(scene: Scene, filePrefix: string, options?: IExportOptions): Promise<GLTFData>;
- }
- }
- declare module "babylonjs-serializers/glTF/2.0/glTFUtilities" {
- import { IBufferView, AccessorType, AccessorComponentType, IAccessor } from "babylonjs-gltf2interface";
- import { FloatArray, Nullable } from "babylonjs/types";
- import { Vector3, Vector4, Quaternion } from "babylonjs/Maths/math";
- /**
- * @hidden
- */
- export class _GLTFUtilities {
- /**
- * Creates a buffer view based on the supplied arguments
- * @param bufferIndex index value of the specified buffer
- * @param byteOffset byte offset value
- * @param byteLength byte length of the bufferView
- * @param byteStride byte distance between conequential elements
- * @param name name of the buffer view
- * @returns bufferView for glTF
- */
- static _CreateBufferView(bufferIndex: number, byteOffset: number, byteLength: number, byteStride?: number, name?: string): IBufferView;
- /**
- * Creates an accessor based on the supplied arguments
- * @param bufferviewIndex The index of the bufferview referenced by this accessor
- * @param name The name of the accessor
- * @param type The type of the accessor
- * @param componentType The datatype of components in the attribute
- * @param count The number of attributes referenced by this accessor
- * @param byteOffset The offset relative to the start of the bufferView in bytes
- * @param min Minimum value of each component in this attribute
- * @param max Maximum value of each component in this attribute
- * @returns accessor for glTF
- */
- static _CreateAccessor(bufferviewIndex: number, name: string, type: AccessorType, componentType: AccessorComponentType, count: number, byteOffset: Nullable<number>, min: Nullable<number[]>, max: Nullable<number[]>): IAccessor;
- /**
- * Calculates the minimum and maximum values of an array of position floats
- * @param positions Positions array of a mesh
- * @param vertexStart Starting vertex offset to calculate min and max values
- * @param vertexCount Number of vertices to check for min and max values
- * @returns min number array and max number array
- */
- static _CalculateMinMaxPositions(positions: FloatArray, vertexStart: number, vertexCount: number, convertToRightHandedSystem: boolean): {
- min: number[];
- max: number[];
- };
- /**
- * Converts a new right-handed Vector3
- * @param vector vector3 array
- * @returns right-handed Vector3
- */
- static _GetRightHandedPositionVector3(vector: Vector3): Vector3;
- /**
- * Converts a Vector3 to right-handed
- * @param vector Vector3 to convert to right-handed
- */
- static _GetRightHandedPositionVector3FromRef(vector: Vector3): void;
- /**
- * Converts a three element number array to right-handed
- * @param vector number array to convert to right-handed
- */
- static _GetRightHandedPositionArray3FromRef(vector: number[]): void;
- /**
- * Converts a new right-handed Vector3
- * @param vector vector3 array
- * @returns right-handed Vector3
- */
- static _GetRightHandedNormalVector3(vector: Vector3): Vector3;
- /**
- * Converts a Vector3 to right-handed
- * @param vector Vector3 to convert to right-handed
- */
- static _GetRightHandedNormalVector3FromRef(vector: Vector3): void;
- /**
- * Converts a three element number array to right-handed
- * @param vector number array to convert to right-handed
- */
- static _GetRightHandedNormalArray3FromRef(vector: number[]): void;
- /**
- * Converts a Vector4 to right-handed
- * @param vector Vector4 to convert to right-handed
- */
- static _GetRightHandedVector4FromRef(vector: Vector4): void;
- /**
- * Converts a Vector4 to right-handed
- * @param vector Vector4 to convert to right-handed
- */
- static _GetRightHandedArray4FromRef(vector: number[]): void;
- /**
- * Converts a Quaternion to right-handed
- * @param quaternion Source quaternion to convert to right-handed
- */
- static _GetRightHandedQuaternionFromRef(quaternion: Quaternion): void;
- /**
- * Converts a Quaternion to right-handed
- * @param quaternion Source quaternion to convert to right-handed
- */
- static _GetRightHandedQuaternionArrayFromRef(quaternion: number[]): void;
- static _NormalizeTangentFromRef(tangent: Vector4): void;
- }
- }
- declare module "babylonjs-serializers/glTF/2.0/glTFExporter" {
- import { IBufferView, IAccessor, INode, IMaterial, ITexture, IImage, ISampler, ImageMimeType, IMeshPrimitive, IGLTF, ITextureInfo } from "babylonjs-gltf2interface";
- import { FloatArray, Nullable } from "babylonjs/types";
- import { Vector3, Vector4 } from "babylonjs/Maths/math";
- import { Node } from "babylonjs/node";
- import { SubMesh } from "babylonjs/Meshes/subMesh";
- import { BaseTexture } from "babylonjs/Materials/Textures/baseTexture";
- import { Texture } from "babylonjs/Materials/Textures/texture";
- import { Material } from "babylonjs/Materials/material";
- import { Engine } from "babylonjs/Engines/engine";
- import { Scene } from "babylonjs/scene";
- import { IGLTFExporterExtensionV2 } from "babylonjs-serializers/glTF/2.0/glTFExporterExtension";
- import { _GLTFMaterialExporter } from "babylonjs-serializers/glTF/2.0/glTFMaterialExporter";
- import { IExportOptions } from "babylonjs-serializers/glTF/2.0/glTFSerializer";
- import { GLTFData } from "babylonjs-serializers/glTF/2.0/glTFData";
- /**
- * Converts Babylon Scene into glTF 2.0.
- * @hidden
- */
- export class _Exporter {
- /**
- * Stores the glTF to export
- */
- _glTF: IGLTF;
- /**
- * Stores all generated buffer views, which represents views into the main glTF buffer data
- */
- _bufferViews: IBufferView[];
- /**
- * Stores all the generated accessors, which is used for accessing the data within the buffer views in glTF
- */
- _accessors: IAccessor[];
- /**
- * Stores all the generated nodes, which contains transform and/or mesh information per node
- */
- private _nodes;
- /**
- * Stores all the generated glTF scenes, which stores multiple node hierarchies
- */
- private _scenes;
- /**
- * Stores all the generated mesh information, each containing a set of primitives to render in glTF
- */
- private _meshes;
- /**
- * Stores all the generated material information, which represents the appearance of each primitive
- */
- _materials: IMaterial[];
- _materialMap: {
- [materialID: number]: number;
- };
- /**
- * Stores all the generated texture information, which is referenced by glTF materials
- */
- _textures: ITexture[];
- /**
- * Stores all the generated image information, which is referenced by glTF textures
- */
- _images: IImage[];
- /**
- * Stores all the texture samplers
- */
- _samplers: ISampler[];
- /**
- * Stores all the generated animation samplers, which is referenced by glTF animations
- */
- /**
- * Stores the animations for glTF models
- */
- private _animations;
- /**
- * Stores the total amount of bytes stored in the glTF buffer
- */
- private _totalByteLength;
- /**
- * Stores a reference to the Babylon scene containing the source geometry and material information
- */
- _babylonScene: Scene;
- /**
- * Stores a map of the image data, where the key is the file name and the value
- * is the image data
- */
- _imageData: {
- [fileName: string]: {
- data: Uint8Array;
- mimeType: ImageMimeType;
- };
- };
- /**
- * Stores a map of the unique id of a node to its index in the node array
- */
- private _nodeMap;
- /**
- * Specifies if a Babylon node should be converted to right-handed on export
- */
- _convertToRightHandedSystemMap: {
- [nodeId: number]: boolean;
- };
- /**
- * Baked animation sample rate
- */
- private _animationSampleRate;
- private _options;
- private _localEngine;
- _glTFMaterialExporter: _GLTFMaterialExporter;
- private _extensions;
- private static _ExtensionNames;
- private static _ExtensionFactories;
- private _applyExtension;
- private _applyExtensions;
- _extensionsPreExportTextureAsync(context: string, babylonTexture: Texture, mimeType: ImageMimeType): Promise<Nullable<BaseTexture>>;
- _extensionsPostExportMeshPrimitiveAsync(context: string, meshPrimitive: IMeshPrimitive, babylonSubMesh: SubMesh, binaryWriter: _BinaryWriter): Promise<Nullable<IMeshPrimitive>>;
- _extensionsPostExportNodeAsync(context: string, node: INode, babylonNode: Node): Promise<Nullable<INode>>;
- _extensionsPostExportMaterialAsync(context: string, material: IMaterial, babylonMaterial: Material): Promise<Nullable<IMaterial>>;
- _extensionsPostExportMaterialAdditionalTextures(context: string, material: IMaterial, babylonMaterial: Material): BaseTexture[];
- _extensionsPostExportTextures(context: string, textureInfo: ITextureInfo, babylonTexture: BaseTexture): void;
- private _forEachExtensions;
- private _extensionsOnExporting;
- /**
- * Load glTF serializer extensions
- */
- private _loadExtensions;
- /**
- * Creates a glTF Exporter instance, which can accept optional exporter options
- * @param babylonScene Babylon scene object
- * @param options Options to modify the behavior of the exporter
- */
- constructor(babylonScene: Scene, options?: IExportOptions);
- dispose(): void;
- /**
- * Registers a glTF exporter extension
- * @param name Name of the extension to export
- * @param factory The factory function that creates the exporter extension
- */
- static RegisterExtension(name: string, factory: (exporter: _Exporter) => IGLTFExporterExtensionV2): void;
- /**
- * Un-registers an exporter extension
- * @param name The name fo the exporter extension
- * @returns A boolean indicating whether the extension has been un-registered
- */
- static UnregisterExtension(name: string): boolean;
- /**
- * Lazy load a local engine
- */
- _getLocalEngine(): Engine;
- private reorderIndicesBasedOnPrimitiveMode;
- /**
- * Reorders the vertex attribute data based on the primitive mode. This is necessary when indices are not available and the winding order is
- * clock-wise during export to glTF
- * @param submesh BabylonJS submesh
- * @param primitiveMode Primitive mode of the mesh
- * @param sideOrientation the winding order of the submesh
- * @param vertexBufferKind The type of vertex attribute
- * @param meshAttributeArray The vertex attribute data
- * @param byteOffset The offset to the binary data
- * @param binaryWriter The binary data for the glTF file
- * @param convertToRightHandedSystem Converts the values to right-handed
- */
- private reorderVertexAttributeDataBasedOnPrimitiveMode;
- /**
- * Reorders the vertex attributes in the correct triangle mode order . This is necessary when indices are not available and the winding order is
- * clock-wise during export to glTF
- * @param submesh BabylonJS submesh
- * @param primitiveMode Primitive mode of the mesh
- * @param sideOrientation the winding order of the submesh
- * @param vertexBufferKind The type of vertex attribute
- * @param meshAttributeArray The vertex attribute data
- * @param byteOffset The offset to the binary data
- * @param binaryWriter The binary data for the glTF file
- * @param convertToRightHandedSystem Converts the values to right-handed
- */
- private reorderTriangleFillMode;
- /**
- * Reorders the vertex attributes in the correct triangle strip order. This is necessary when indices are not available and the winding order is
- * clock-wise during export to glTF
- * @param submesh BabylonJS submesh
- * @param primitiveMode Primitive mode of the mesh
- * @param sideOrientation the winding order of the submesh
- * @param vertexBufferKind The type of vertex attribute
- * @param meshAttributeArray The vertex attribute data
- * @param byteOffset The offset to the binary data
- * @param binaryWriter The binary data for the glTF file
- * @param convertToRightHandedSystem Converts the values to right-handed
- */
- private reorderTriangleStripDrawMode;
- /**
- * Reorders the vertex attributes in the correct triangle fan order. This is necessary when indices are not available and the winding order is
- * clock-wise during export to glTF
- * @param submesh BabylonJS submesh
- * @param primitiveMode Primitive mode of the mesh
- * @param sideOrientation the winding order of the submesh
- * @param vertexBufferKind The type of vertex attribute
- * @param meshAttributeArray The vertex attribute data
- * @param byteOffset The offset to the binary data
- * @param binaryWriter The binary data for the glTF file
- * @param convertToRightHandedSystem Converts the values to right-handed
- */
- private reorderTriangleFanMode;
- /**
- * Writes the vertex attribute data to binary
- * @param vertices The vertices to write to the binary writer
- * @param byteOffset The offset into the binary writer to overwrite binary data
- * @param vertexAttributeKind The vertex attribute type
- * @param meshAttributeArray The vertex attribute data
- * @param binaryWriter The writer containing the binary data
- * @param convertToRightHandedSystem Converts the values to right-handed
- */
- private writeVertexAttributeData;
- /**
- * Writes mesh attribute data to a data buffer
- * Returns the bytelength of the data
- * @param vertexBufferKind Indicates what kind of vertex data is being passed in
- * @param meshAttributeArray Array containing the attribute data
- * @param binaryWriter The buffer to write the binary data to
- * @param indices Used to specify the order of the vertex data
- * @param convertToRightHandedSystem Converts the values to right-handed
- */
- writeAttributeData(vertexBufferKind: string, meshAttributeArray: FloatArray, byteStride: number, binaryWriter: _BinaryWriter, convertToRightHandedSystem: boolean): void;
- /**
- * Generates glTF json data
- * @param shouldUseGlb Indicates whether the json should be written for a glb file
- * @param glTFPrefix Text to use when prefixing a glTF file
- * @param prettyPrint Indicates whether the json file should be pretty printed (true) or not (false)
- * @returns json data as string
- */
- private generateJSON;
- /**
- * Generates data for .gltf and .bin files based on the glTF prefix string
- * @param glTFPrefix Text to use when prefixing a glTF file
- * @param dispose Dispose the exporter
- * @returns GLTFData with glTF file data
- */
- _generateGLTFAsync(glTFPrefix: string, dispose?: boolean): Promise<GLTFData>;
- /**
- * Creates a binary buffer for glTF
- * @returns array buffer for binary data
- */
- private _generateBinaryAsync;
- /**
- * Pads the number to a multiple of 4
- * @param num number to pad
- * @returns padded number
- */
- private _getPadding;
- /**
- * @hidden
- */
- _generateGLBAsync(glTFPrefix: string, dispose?: boolean): Promise<GLTFData>;
- /**
- * Sets the TRS for each node
- * @param node glTF Node for storing the transformation data
- * @param babylonTransformNode Babylon mesh used as the source for the transformation data
- * @param convertToRightHandedSystem Converts the values to right-handed
- */
- private setNodeTransformation;
- private getVertexBufferFromMesh;
- /**
- * Creates a bufferview based on the vertices type for the Babylon mesh
- * @param kind Indicates the type of vertices data
- * @param babylonTransformNode The Babylon mesh to get the vertices data from
- * @param binaryWriter The buffer to write the bufferview data to
- * @param convertToRightHandedSystem Converts the values to right-handed
- */
- private createBufferViewKind;
- /**
- * The primitive mode of the Babylon mesh
- * @param babylonMesh The BabylonJS mesh
- */
- private getMeshPrimitiveMode;
- /**
- * Sets the primitive mode of the glTF mesh primitive
- * @param meshPrimitive glTF mesh primitive
- * @param primitiveMode The primitive mode
- */
- private setPrimitiveMode;
- /**
- * Sets the vertex attribute accessor based of the glTF mesh primitive
- * @param meshPrimitive glTF mesh primitive
- * @param attributeKind vertex attribute
- * @returns boolean specifying if uv coordinates are present
- */
- private setAttributeKind;
- /**
- * Sets data for the primitive attributes of each submesh
- * @param mesh glTF Mesh object to store the primitive attribute information
- * @param babylonTransformNode Babylon mesh to get the primitive attribute data from
- * @param binaryWriter Buffer to write the attribute data to
- * @param convertToRightHandedSystem Converts the values to right-handed
- */
- private setPrimitiveAttributesAsync;
- /**
- * Check if the node is used to convert its descendants from right-handed to left-handed
- * @param node The node to check
- * @returns True if the node is used to convert its descendants from right-handed to left-handed. False otherwise
- */
- private isNodeConvertingToLeftHanded;
- /**
- * Creates a glTF scene based on the array of meshes
- * Returns the the total byte offset
- * @param babylonScene Babylon scene to get the mesh data from
- * @param binaryWriter Buffer to write binary data to
- */
- private createSceneAsync;
- /**
- * Creates a mapping of Node unique id to node index and handles animations
- * @param babylonScene Babylon Scene
- * @param nodes Babylon transform nodes
- * @param binaryWriter Buffer to write binary data to
- * @returns Node mapping of unique id to index
- */
- private createNodeMapAndAnimationsAsync;
- /**
- * Creates a glTF node from a Babylon mesh
- * @param babylonMesh Source Babylon mesh
- * @param binaryWriter Buffer for storing geometry data
- * @param convertToRightHandedSystem Converts the values to right-handed
- * @returns glTF node
- */
- private createNodeAsync;
- }
- /**
- * @hidden
- *
- * Stores glTF binary data. If the array buffer byte length is exceeded, it doubles in size dynamically
- */
- export class _BinaryWriter {
- /**
- * Array buffer which stores all binary data
- */
- private _arrayBuffer;
- /**
- * View of the array buffer
- */
- private _dataView;
- /**
- * byte offset of data in array buffer
- */
- private _byteOffset;
- /**
- * Initialize binary writer with an initial byte length
- * @param byteLength Initial byte length of the array buffer
- */
- constructor(byteLength: number);
- /**
- * Resize the array buffer to the specified byte length
- * @param byteLength
- */
- private resizeBuffer;
- /**
- * Get an array buffer with the length of the byte offset
- * @returns ArrayBuffer resized to the byte offset
- */
- getArrayBuffer(): ArrayBuffer;
- /**
- * Get the byte offset of the array buffer
- * @returns byte offset
- */
- getByteOffset(): number;
- /**
- * Stores an UInt8 in the array buffer
- * @param entry
- * @param byteOffset If defined, specifies where to set the value as an offset.
- */
- setUInt8(entry: number, byteOffset?: number): void;
- /**
- * Gets an UInt32 in the array buffer
- * @param entry
- * @param byteOffset If defined, specifies where to set the value as an offset.
- */
- getUInt32(byteOffset: number): number;
- getVector3Float32FromRef(vector3: Vector3, byteOffset: number): void;
- setVector3Float32FromRef(vector3: Vector3, byteOffset: number): void;
- getVector4Float32FromRef(vector4: Vector4, byteOffset: number): void;
- setVector4Float32FromRef(vector4: Vector4, byteOffset: number): void;
- /**
- * Stores a Float32 in the array buffer
- * @param entry
- */
- setFloat32(entry: number, byteOffset?: number): void;
- /**
- * Stores an UInt32 in the array buffer
- * @param entry
- * @param byteOffset If defined, specifies where to set the value as an offset.
- */
- setUInt32(entry: number, byteOffset?: number): void;
- }
- }
- declare module "babylonjs-serializers/glTF/2.0/glTFAnimation" {
- import { AnimationSamplerInterpolation, AnimationChannelTargetPath, AccessorType, IAnimation, INode, IBufferView, IAccessor } from "babylonjs-gltf2interface";
- import { Node } from "babylonjs/node";
- import { Nullable } from "babylonjs/types";
- import { Animation } from "babylonjs/Animations/animation";
- import { TransformNode } from "babylonjs/Meshes/transformNode";
- import { Scene } from "babylonjs/scene";
- import { _BinaryWriter } from "babylonjs-serializers/glTF/2.0/glTFExporter";
- /**
- * @hidden
- * Interface to store animation data.
- */
- export interface _IAnimationData {
- /**
- * Keyframe data.
- */
- inputs: number[];
- /**
- * Value data.
- */
- outputs: number[][];
- /**
- * Animation interpolation data.
- */
- samplerInterpolation: AnimationSamplerInterpolation;
- /**
- * Minimum keyframe value.
- */
- inputsMin: number;
- /**
- * Maximum keyframe value.
- */
- inputsMax: number;
- }
- /**
- * @hidden
- */
- export interface _IAnimationInfo {
- /**
- * The target channel for the animation
- */
- animationChannelTargetPath: AnimationChannelTargetPath;
- /**
- * The glTF accessor type for the data.
- */
- dataAccessorType: AccessorType.VEC3 | AccessorType.VEC4;
- /**
- * Specifies if quaternions should be used.
- */
- useQuaternion: boolean;
- }
- /**
- * @hidden
- * Utility class for generating glTF animation data from BabylonJS.
- */
- export class _GLTFAnimation {
- /**
- * @ignore
- *
- * Creates glTF channel animation from BabylonJS animation.
- * @param babylonTransformNode - BabylonJS mesh.
- * @param animation - animation.
- * @param animationChannelTargetPath - The target animation channel.
- * @param convertToRightHandedSystem - Specifies if the values should be converted to right-handed.
- * @param useQuaternion - Specifies if quaternions are used.
- * @returns nullable IAnimationData
- */
- static _CreateNodeAnimation(babylonTransformNode: TransformNode, animation: Animation, animationChannelTargetPath: AnimationChannelTargetPath, convertToRightHandedSystem: boolean, useQuaternion: boolean, animationSampleRate: number): Nullable<_IAnimationData>;
- private static _DeduceAnimationInfo;
- /**
- * @ignore
- * Create node animations from the transform node animations
- * @param babylonNode
- * @param runtimeGLTFAnimation
- * @param idleGLTFAnimations
- * @param nodeMap
- * @param nodes
- * @param binaryWriter
- * @param bufferViews
- * @param accessors
- * @param convertToRightHandedSystem
- * @param animationSampleRate
- */
- static _CreateNodeAnimationFromNodeAnimations(babylonNode: Node, runtimeGLTFAnimation: IAnimation, idleGLTFAnimations: IAnimation[], nodeMap: {
- [key: number]: number;
- }, nodes: INode[], binaryWriter: _BinaryWriter, bufferViews: IBufferView[], accessors: IAccessor[], convertToRightHandedSystem: boolean, animationSampleRate: number): void;
- /**
- * @ignore
- * Create node animations from the animation groups
- * @param babylonScene
- * @param glTFAnimations
- * @param nodeMap
- * @param nodes
- * @param binaryWriter
- * @param bufferViews
- * @param accessors
- * @param convertToRightHandedSystemMap
- * @param animationSampleRate
- */
- static _CreateNodeAnimationFromAnimationGroups(babylonScene: Scene, glTFAnimations: IAnimation[], nodeMap: {
- [key: number]: number;
- }, nodes: INode[], binaryWriter: _BinaryWriter, bufferViews: IBufferView[], accessors: IAccessor[], convertToRightHandedSystemMap: {
- [nodeId: number]: boolean;
- }, animationSampleRate: number): void;
- private static AddAnimation;
- /**
- * Create a baked animation
- * @param babylonTransformNode BabylonJS mesh
- * @param animation BabylonJS animation corresponding to the BabylonJS mesh
- * @param animationChannelTargetPath animation target channel
- * @param minFrame minimum animation frame
- * @param maxFrame maximum animation frame
- * @param fps frames per second of the animation
- * @param inputs input key frames of the animation
- * @param outputs output key frame data of the animation
- * @param convertToRightHandedSystem converts the values to right-handed
- * @param useQuaternion specifies if quaternions should be used
- */
- private static _CreateBakedAnimation;
- private static _ConvertFactorToVector3OrQuaternion;
- private static _SetInterpolatedValue;
- /**
- * Creates linear animation from the animation key frames
- * @param babylonTransformNode BabylonJS mesh
- * @param animation BabylonJS animation
- * @param animationChannelTargetPath The target animation channel
- * @param frameDelta The difference between the last and first frame of the animation
- * @param inputs Array to store the key frame times
- * @param outputs Array to store the key frame data
- * @param convertToRightHandedSystem Specifies if the position data should be converted to right handed
- * @param useQuaternion Specifies if quaternions are used in the animation
- */
- private static _CreateLinearOrStepAnimation;
- /**
- * Creates cubic spline animation from the animation key frames
- * @param babylonTransformNode BabylonJS mesh
- * @param animation BabylonJS animation
- * @param animationChannelTargetPath The target animation channel
- * @param frameDelta The difference between the last and first frame of the animation
- * @param inputs Array to store the key frame times
- * @param outputs Array to store the key frame data
- * @param convertToRightHandedSystem Specifies if the position data should be converted to right handed
- * @param useQuaternion Specifies if quaternions are used in the animation
- */
- private static _CreateCubicSplineAnimation;
- private static _GetBasePositionRotationOrScale;
- /**
- * Adds a key frame value
- * @param keyFrame
- * @param animation
- * @param outputs
- * @param animationChannelTargetPath
- * @param basePositionRotationOrScale
- * @param convertToRightHandedSystem
- * @param useQuaternion
- */
- private static _AddKeyframeValue;
- /**
- * Determine the interpolation based on the key frames
- * @param keyFrames
- * @param animationChannelTargetPath
- * @param useQuaternion
- */
- private static _DeduceInterpolation;
- /**
- * Adds an input tangent or output tangent to the output data
- * If an input tangent or output tangent is missing, it uses the zero vector or zero quaternion
- * @param tangentType Specifies which type of tangent to handle (inTangent or outTangent)
- * @param outputs The animation data by keyframe
- * @param animationChannelTargetPath The target animation channel
- * @param interpolation The interpolation type
- * @param keyFrame The key frame with the animation data
- * @param frameDelta Time difference between two frames used to scale the tangent by the frame delta
- * @param useQuaternion Specifies if quaternions are used
- * @param convertToRightHandedSystem Specifies if the values should be converted to right-handed
- */
- private static AddSplineTangent;
- /**
- * Get the minimum and maximum key frames' frame values
- * @param keyFrames animation key frames
- * @returns the minimum and maximum key frame value
- */
- private static calculateMinMaxKeyFrames;
- }
- }
- declare module "babylonjs-serializers/glTF/2.0/shaders/textureTransform.fragment" {
- /** @hidden */
- export var textureTransformPixelShader: {
- name: string;
- shader: string;
- };
- }
- declare module "babylonjs-serializers/glTF/2.0/Extensions/KHR_texture_transform" {
- import { ImageMimeType, ITextureInfo } from "babylonjs-gltf2interface";
- import { Texture } from "babylonjs/Materials/Textures/texture";
- import { IGLTFExporterExtensionV2 } from "babylonjs-serializers/glTF/2.0/glTFExporterExtension";
- import { _Exporter } from "babylonjs-serializers/glTF/2.0/glTFExporter";
- import "babylonjs-serializers/glTF/2.0/shaders/textureTransform.fragment";
- /**
- * @hidden
- */
- export class KHR_texture_transform implements IGLTFExporterExtensionV2 {
- private _recordedTextures;
- /** Name of this extension */
- readonly name: string;
- /** Defines whether this extension is enabled */
- enabled: boolean;
- /** Defines whether this extension is required */
- required: boolean;
- /** Reference to the glTF exporter */
- private _wasUsed;
- constructor(exporter: _Exporter);
- dispose(): void;
- /** @hidden */
- get wasUsed(): boolean;
- postExportTexture?(context: string, textureInfo: ITextureInfo, babylonTexture: Texture): void;
- preExportTextureAsync(context: string, babylonTexture: Texture, mimeType: ImageMimeType): Promise<Texture>;
- /**
- * Transform the babylon texture by the offset, rotation and scale parameters using a procedural texture
- * @param babylonTexture
- * @param offset
- * @param rotation
- * @param scale
- * @param scene
- */
- private _textureTransformTextureAsync;
- }
- }
- declare module "babylonjs-serializers/glTF/2.0/Extensions/KHR_lights_punctual" {
- import { Node } from "babylonjs/node";
- import { INode } from "babylonjs-gltf2interface";
- import { IGLTFExporterExtensionV2 } from "babylonjs-serializers/glTF/2.0/glTFExporterExtension";
- import { _Exporter } from "babylonjs-serializers/glTF/2.0/glTFExporter";
- /**
- * [Specification](https://github.com/KhronosGroup/glTF/blob/master/extensions/2.0/Khronos/KHR_lights_punctual/README.md)
- */
- export class KHR_lights_punctual implements IGLTFExporterExtensionV2 {
- /** The name of this extension. */
- readonly name: string;
- /** Defines whether this extension is enabled. */
- enabled: boolean;
- /** Defines whether this extension is required */
- required: boolean;
- /** Reference to the glTF exporter */
- private _exporter;
- private _lights;
- /** @hidden */
- constructor(exporter: _Exporter);
- /** @hidden */
- dispose(): void;
- /** @hidden */
- get wasUsed(): boolean;
- /** @hidden */
- onExporting(): void;
- /**
- * Define this method to modify the default behavior when exporting a node
- * @param context The context when exporting the node
- * @param node glTF node
- * @param babylonNode BabylonJS node
- * @returns nullable INode promise
- */
- postExportNodeAsync(context: string, node: INode, babylonNode: Node): Promise<INode>;
- }
- }
- declare module "babylonjs-serializers/glTF/2.0/Extensions/KHR_materials_sheen" {
- import { ITextureInfo, IMaterial } from "babylonjs-gltf2interface";
- import { IGLTFExporterExtensionV2 } from "babylonjs-serializers/glTF/2.0/glTFExporterExtension";
- import { _Exporter } from "babylonjs-serializers/glTF/2.0/glTFExporter";
- import { Material } from 'babylonjs/Materials/material';
- import { Texture } from 'babylonjs/Materials/Textures/texture';
- import { BaseTexture } from 'babylonjs/Materials/Textures/baseTexture';
- /**
- * @hidden
- */
- export class KHR_materials_sheen implements IGLTFExporterExtensionV2 {
- /** Name of this extension */
- readonly name: string;
- /** Defines whether this extension is enabled */
- enabled: boolean;
- /** Defines whether this extension is required */
- required: boolean;
- /** Reference to the glTF exporter */
- private _textureInfos;
- private _exportedTextures;
- private _wasUsed;
- constructor(exporter: _Exporter);
- dispose(): void;
- /** @hidden */
- get wasUsed(): boolean;
- private _getTextureIndex;
- postExportTexture?(context: string, textureInfo: ITextureInfo, babylonTexture: Texture): void;
- postExportMaterialAdditionalTextures?(context: string, node: IMaterial, babylonMaterial: Material): BaseTexture[];
- postExportMaterialAsync?(context: string, node: IMaterial, babylonMaterial: Material): Promise<IMaterial>;
- }
- }
- declare module "babylonjs-serializers/glTF/2.0/Extensions/index" {
- export * from "babylonjs-serializers/glTF/2.0/Extensions/KHR_texture_transform";
- export * from "babylonjs-serializers/glTF/2.0/Extensions/KHR_lights_punctual";
- export * from "babylonjs-serializers/glTF/2.0/Extensions/KHR_materials_sheen";
- }
- declare module "babylonjs-serializers/glTF/2.0/index" {
- export * from "babylonjs-serializers/glTF/2.0/glTFAnimation";
- export * from "babylonjs-serializers/glTF/2.0/glTFData";
- export * from "babylonjs-serializers/glTF/2.0/glTFExporter";
- export * from "babylonjs-serializers/glTF/2.0/glTFExporterExtension";
- export * from "babylonjs-serializers/glTF/2.0/glTFMaterialExporter";
- export * from "babylonjs-serializers/glTF/2.0/glTFSerializer";
- export * from "babylonjs-serializers/glTF/2.0/glTFUtilities";
- export * from "babylonjs-serializers/glTF/2.0/Extensions/index";
- }
- declare module "babylonjs-serializers/glTF/index" {
- export * from "babylonjs-serializers/glTF/glTFFileExporter";
- export * from "babylonjs-serializers/glTF/2.0/index";
- }
- declare module "babylonjs-serializers/stl/stlSerializer" {
- import { Mesh } from "babylonjs/Meshes/mesh";
- /**
- * Class for generating STL data from a Babylon scene.
- */
- export class STLExport {
- /**
- * Exports the geometry of a Mesh array in .STL file format (ASCII)
- * @param meshes list defines the mesh to serialize
- * @param download triggers the automatic download of the file.
- * @param fileName changes the downloads fileName.
- * @param binary changes the STL to a binary type.
- * @param isLittleEndian toggle for binary type exporter.
- * @returns the STL as UTF8 string
- */
- static CreateSTL(meshes: Mesh[], download?: boolean, fileName?: string, binary?: boolean, isLittleEndian?: boolean): any;
- }
- }
- declare module "babylonjs-serializers/stl/index" {
- export * from "babylonjs-serializers/stl/stlSerializer";
- }
- declare module "babylonjs-serializers/index" {
- export * from "babylonjs-serializers/OBJ/index";
- export * from "babylonjs-serializers/glTF/index";
- export * from "babylonjs-serializers/stl/index";
- }
- declare module "babylonjs-serializers/legacy/legacy-glTF2Serializer" {
- export * from "babylonjs-serializers/glTF/glTFFileExporter";
- export * from "babylonjs-serializers/glTF/2.0/index";
- }
- declare module "babylonjs-serializers/legacy/legacy-objSerializer" {
- export * from "babylonjs-serializers/OBJ/index";
- }
- declare module "babylonjs-serializers/legacy/legacy-stlSerializer" {
- export * from "babylonjs-serializers/stl/index";
- }
- declare module "babylonjs-serializers/legacy/legacy" {
- import "babylonjs-serializers/index";
- export * from "babylonjs-serializers/legacy/legacy-glTF2Serializer";
- export * from "babylonjs-serializers/legacy/legacy-objSerializer";
- export * from "babylonjs-serializers/legacy/legacy-stlSerializer";
- }
- declare module "babylonjs-serializers" {
- export * from "babylonjs-serializers/legacy/legacy";
- }
- declare module BABYLON {
- /**
- * Class for generating OBJ data from a Babylon scene.
- */
- export class OBJExport {
- /**
- * Exports the geometry of a Mesh array in .OBJ file format (text)
- * @param mesh defines the list of meshes to serialize
- * @param materials defines if materials should be exported
- * @param matlibname defines the name of the associated mtl file
- * @param globalposition defines if the exported positions are globals or local to the exported mesh
- * @returns the OBJ content
- */
- static OBJ(mesh: Mesh[], materials?: boolean, matlibname?: string, globalposition?: boolean): string;
- /**
- * Exports the material(s) of a mesh in .MTL file format (text)
- * @param mesh defines the mesh to extract the material from
- * @returns the mtl content
- */
- static MTL(mesh: Mesh): string;
- }
- }
- declare module BABYLON {
- /** @hidden */
- export var __IGLTFExporterExtension: number;
- /**
- * Interface for extending the exporter
- * @hidden
- */
- export interface IGLTFExporterExtension {
- /**
- * The name of this extension
- */
- readonly name: string;
- /**
- * Defines whether this extension is enabled
- */
- enabled: boolean;
- /**
- * Defines whether this extension is required
- */
- required: boolean;
- }
- }
- declare module BABYLON.GLTF2.Exporter {
- /** @hidden */
- export var __IGLTFExporterExtensionV2: number;
- /**
- * Interface for a glTF exporter extension
- * @hidden
- */
- export interface IGLTFExporterExtensionV2 extends IGLTFExporterExtension, IDisposable {
- /**
- * Define this method to modify the default behavior before exporting a texture
- * @param context The context when loading the asset
- * @param babylonTexture The Babylon.js texture
- * @param mimeType The mime-type of the generated image
- * @returns A promise that resolves with the exported texture
- */
- preExportTextureAsync?(context: string, babylonTexture: Texture, mimeType: ImageMimeType): Promise<Texture>;
- /**
- * Define this method to get notified when a texture info is created
- * @param context The context when loading the asset
- * @param textureInfo The glTF texture info
- * @param babylonTexture The Babylon.js texture
- */
- postExportTexture?(context: string, textureInfo: ITextureInfo, babylonTexture: BaseTexture): void;
- /**
- * Define this method to modify the default behavior when exporting texture info
- * @param context The context when loading the asset
- * @param meshPrimitive glTF mesh primitive
- * @param babylonSubMesh Babylon submesh
- * @param binaryWriter glTF serializer binary writer instance
- * @returns nullable IMeshPrimitive promise
- */
- postExportMeshPrimitiveAsync?(context: string, meshPrimitive: IMeshPrimitive, babylonSubMesh: SubMesh, binaryWriter: _BinaryWriter): Promise<IMeshPrimitive>;
- /**
- * Define this method to modify the default behavior when exporting a node
- * @param context The context when exporting the node
- * @param node glTF node
- * @param babylonNode BabylonJS node
- * @returns nullable INode promise
- */
- postExportNodeAsync?(context: string, node: INode, babylonNode: Node): Promise<INode>;
- /**
- * Define this method to modify the default behavior when exporting a material
- * @param material glTF material
- * @param babylonMaterial BabylonJS material
- * @returns nullable IMaterial promise
- */
- postExportMaterialAsync?(context: string, node: IMaterial, babylonMaterial: Material): Promise<IMaterial>;
- /**
- * Define this method to return additional textures to export from a material
- * @param material glTF material
- * @param babylonMaterial BabylonJS material
- * @returns List of textures
- */
- postExportMaterialAdditionalTextures?(context: string, node: IMaterial, babylonMaterial: Material): BaseTexture[];
- /** Gets a boolean indicating that this extension was used */
- wasUsed: boolean;
- /** Gets a boolean indicating that this extension is required for the file to work */
- required: boolean;
- /**
- * Called after the exporter state changes to EXPORTING
- */
- onExporting?(): void;
- }
- }
- declare module BABYLON.GLTF2.Exporter {
- /**
- * Utility methods for working with glTF material conversion properties. This class should only be used internally
- * @hidden
- */
- export class _GLTFMaterialExporter {
- /**
- * Represents the dielectric specular values for R, G and B
- */
- private static readonly _DielectricSpecular;
- /**
- * Allows the maximum specular power to be defined for material calculations
- */
- private static readonly _MaxSpecularPower;
- /**
- * Mapping to store textures
- */
- private _textureMap;
- /**
- * Numeric tolerance value
- */
- private static readonly _Epsilon;
- /**
- * Reference to the glTF Exporter
- */
- private _exporter;
- constructor(exporter: _Exporter);
- /**
- * Specifies if two colors are approximately equal in value
- * @param color1 first color to compare to
- * @param color2 second color to compare to
- * @param epsilon threshold value
- */
- private static FuzzyEquals;
- /**
- * Gets the materials from a Babylon scene and converts them to glTF materials
- * @param scene babylonjs scene
- * @param mimeType texture mime type
- * @param images array of images
- * @param textures array of textures
- * @param materials array of materials
- * @param imageData mapping of texture names to base64 textures
- * @param hasTextureCoords specifies if texture coordinates are present on the material
- */
- _convertMaterialsToGLTFAsync(babylonMaterials: Material[], mimeType: ImageMimeType, hasTextureCoords: boolean): Promise<void>;
- /**
- * Makes a copy of the glTF material without the texture parameters
- * @param originalMaterial original glTF material
- * @returns glTF material without texture parameters
- */
- _stripTexturesFromMaterial(originalMaterial: IMaterial): IMaterial;
- /**
- * Specifies if the material has any texture parameters present
- * @param material glTF Material
- * @returns boolean specifying if texture parameters are present
- */
- _hasTexturesPresent(material: IMaterial): boolean;
- /**
- * Converts a Babylon StandardMaterial to a glTF Metallic Roughness Material
- * @param babylonStandardMaterial
- * @returns glTF Metallic Roughness Material representation
- */
- _convertToGLTFPBRMetallicRoughness(babylonStandardMaterial: StandardMaterial): IMaterialPbrMetallicRoughness;
- /**
- * Computes the metallic factor
- * @param diffuse diffused value
- * @param specular specular value
- * @param oneMinusSpecularStrength one minus the specular strength
- * @returns metallic value
- */
- static _SolveMetallic(diffuse: number, specular: number, oneMinusSpecularStrength: number): number;
- /**
- * Sets the glTF alpha mode to a glTF material from the Babylon Material
- * @param glTFMaterial glTF material
- * @param babylonMaterial Babylon material
- */
- private static _SetAlphaMode;
- /**
- * Converts a Babylon Standard Material to a glTF Material
- * @param babylonStandardMaterial BJS Standard Material
- * @param mimeType mime type to use for the textures
- * @param images array of glTF image interfaces
- * @param textures array of glTF texture interfaces
- * @param materials array of glTF material interfaces
- * @param imageData map of image file name to data
- * @param hasTextureCoords specifies if texture coordinates are present on the submesh to determine if textures should be applied
- */
- _convertStandardMaterialAsync(babylonStandardMaterial: StandardMaterial, mimeType: ImageMimeType, hasTextureCoords: boolean): Promise<IMaterial>;
- private _finishMaterial;
- /**
- * Converts a Babylon PBR Metallic Roughness Material to a glTF Material
- * @param babylonPBRMetalRoughMaterial BJS PBR Metallic Roughness Material
- * @param mimeType mime type to use for the textures
- * @param images array of glTF image interfaces
- * @param textures array of glTF texture interfaces
- * @param materials array of glTF material interfaces
- * @param imageData map of image file name to data
- * @param hasTextureCoords specifies if texture coordinates are present on the submesh to determine if textures should be applied
- */
- _convertPBRMetallicRoughnessMaterialAsync(babylonPBRMetalRoughMaterial: PBRMetallicRoughnessMaterial, mimeType: ImageMimeType, hasTextureCoords: boolean): Promise<IMaterial>;
- /**
- * Converts an image typed array buffer to a base64 image
- * @param buffer typed array buffer
- * @param width width of the image
- * @param height height of the image
- * @param mimeType mimetype of the image
- * @returns base64 image string
- */
- private _createBase64FromCanvasAsync;
- /**
- * Generates a white texture based on the specified width and height
- * @param width width of the texture in pixels
- * @param height height of the texture in pixels
- * @param scene babylonjs scene
- * @returns white texture
- */
- private _createWhiteTexture;
- /**
- * Resizes the two source textures to the same dimensions. If a texture is null, a default white texture is generated. If both textures are null, returns null
- * @param texture1 first texture to resize
- * @param texture2 second texture to resize
- * @param scene babylonjs scene
- * @returns resized textures or null
- */
- private _resizeTexturesToSameDimensions;
- /**
- * Converts an array of pixels to a Float32Array
- * Throws an error if the pixel format is not supported
- * @param pixels - array buffer containing pixel values
- * @returns Float32 of pixels
- */
- private _convertPixelArrayToFloat32;
- /**
- * Convert Specular Glossiness Textures to Metallic Roughness
- * See link below for info on the material conversions from PBR Metallic/Roughness and Specular/Glossiness
- * @link https://github.com/KhronosGroup/glTF/blob/master/extensions/2.0/Khronos/KHR_materials_pbrSpecularGlossiness/examples/convert-between-workflows-bjs/js/babylon.pbrUtilities.js
- * @param diffuseTexture texture used to store diffuse information
- * @param specularGlossinessTexture texture used to store specular and glossiness information
- * @param factors specular glossiness material factors
- * @param mimeType the mime type to use for the texture
- * @returns pbr metallic roughness interface or null
- */
- private _convertSpecularGlossinessTexturesToMetallicRoughnessAsync;
- /**
- * Converts specular glossiness material properties to metallic roughness
- * @param specularGlossiness interface with specular glossiness material properties
- * @returns interface with metallic roughness material properties
- */
- private _convertSpecularGlossinessToMetallicRoughness;
- /**
- * Calculates the surface reflectance, independent of lighting conditions
- * @param color Color source to calculate brightness from
- * @returns number representing the perceived brightness, or zero if color is undefined
- */
- private _getPerceivedBrightness;
- /**
- * Returns the maximum color component value
- * @param color
- * @returns maximum color component value, or zero if color is null or undefined
- */
- private _getMaxComponent;
- /**
- * Convert a PBRMaterial (Metallic/Roughness) to Metallic Roughness factors
- * @param babylonPBRMaterial BJS PBR Metallic Roughness Material
- * @param mimeType mime type to use for the textures
- * @param images array of glTF image interfaces
- * @param textures array of glTF texture interfaces
- * @param glTFPbrMetallicRoughness glTF PBR Metallic Roughness interface
- * @param imageData map of image file name to data
- * @param hasTextureCoords specifies if texture coordinates are present on the submesh to determine if textures should be applied
- * @returns glTF PBR Metallic Roughness factors
- */
- private _convertMetalRoughFactorsToMetallicRoughnessAsync;
- private _getGLTFTextureSampler;
- private _getGLTFTextureWrapMode;
- private _getGLTFTextureWrapModesSampler;
- /**
- * Convert a PBRMaterial (Specular/Glossiness) to Metallic Roughness factors
- * @param babylonPBRMaterial BJS PBR Metallic Roughness Material
- * @param mimeType mime type to use for the textures
- * @param images array of glTF image interfaces
- * @param textures array of glTF texture interfaces
- * @param glTFPbrMetallicRoughness glTF PBR Metallic Roughness interface
- * @param imageData map of image file name to data
- * @param hasTextureCoords specifies if texture coordinates are present on the submesh to determine if textures should be applied
- * @returns glTF PBR Metallic Roughness factors
- */
- private _convertSpecGlossFactorsToMetallicRoughnessAsync;
- /**
- * Converts a Babylon PBR Metallic Roughness Material to a glTF Material
- * @param babylonPBRMaterial BJS PBR Metallic Roughness Material
- * @param mimeType mime type to use for the textures
- * @param images array of glTF image interfaces
- * @param textures array of glTF texture interfaces
- * @param materials array of glTF material interfaces
- * @param imageData map of image file name to data
- * @param hasTextureCoords specifies if texture coordinates are present on the submesh to determine if textures should be applied
- */
- _convertPBRMaterialAsync(babylonPBRMaterial: PBRMaterial, mimeType: ImageMimeType, hasTextureCoords: boolean): Promise<IMaterial>;
- private setMetallicRoughnessPbrMaterial;
- private getPixelsFromTexture;
- /**
- * Extracts a texture from a Babylon texture into file data and glTF data
- * @param babylonTexture Babylon texture to extract
- * @param mimeType Mime Type of the babylonTexture
- * @return glTF texture info, or null if the texture format is not supported
- */
- _exportTextureAsync(babylonTexture: BaseTexture, mimeType: ImageMimeType): Promise<Nullable<ITextureInfo>>;
- _exportTextureInfoAsync(babylonTexture: BaseTexture, mimeType: ImageMimeType): Promise<Nullable<ITextureInfo>>;
- /**
- * Builds a texture from base64 string
- * @param base64Texture base64 texture string
- * @param baseTextureName Name to use for the texture
- * @param mimeType image mime type for the texture
- * @param images array of images
- * @param textures array of textures
- * @param imageData map of image data
- * @returns glTF texture info, or null if the texture format is not supported
- */
- private _getTextureInfoFromBase64;
- }
- }
- declare module BABYLON {
- /**
- * Class for holding and downloading glTF file data
- */
- export class GLTFData {
- /**
- * Object which contains the file name as the key and its data as the value
- */
- glTFFiles: {
- [fileName: string]: string | Blob;
- };
- /**
- * Initializes the glTF file object
- */
- constructor();
- /**
- * Downloads the glTF data as files based on their names and data
- */
- downloadFiles(): void;
- }
- }
- declare module BABYLON {
- /**
- * Holds a collection of exporter options and parameters
- */
- export interface IExportOptions {
- /**
- * Function which indicates whether a babylon node should be exported or not
- * @param node source Babylon node. It is used to check whether it should be exported to glTF or not
- * @returns boolean, which indicates whether the node should be exported (true) or not (false)
- */
- shouldExportNode?(node: Node): boolean;
- /**
- * Function used to extract the part of node's metadata that will be exported into glTF node extras
- * @param metadata source metadata to read from
- * @returns the data to store to glTF node extras
- */
- metadataSelector?(metadata: any): any;
- /**
- * The sample rate to bake animation curves
- */
- animationSampleRate?: number;
- /**
- * Begin serialization without waiting for the scene to be ready
- */
- exportWithoutWaitingForScene?: boolean;
- }
- /**
- * Class for generating glTF data from a Babylon scene.
- */
- export class GLTF2Export {
- /**
- * Exports the geometry of the scene to .gltf file format asynchronously
- * @param scene Babylon scene with scene hierarchy information
- * @param filePrefix File prefix to use when generating the glTF file
- * @param options Exporter options
- * @returns Returns an object with a .gltf file and associates texture names
- * as keys and their data and paths as values
- */
- static GLTFAsync(scene: Scene, filePrefix: string, options?: IExportOptions): Promise<GLTFData>;
- private static _PreExportAsync;
- private static _PostExportAsync;
- /**
- * Exports the geometry of the scene to .glb file format asychronously
- * @param scene Babylon scene with scene hierarchy information
- * @param filePrefix File prefix to use when generating glb file
- * @param options Exporter options
- * @returns Returns an object with a .glb filename as key and data as value
- */
- static GLBAsync(scene: Scene, filePrefix: string, options?: IExportOptions): Promise<GLTFData>;
- }
- }
- declare module BABYLON.GLTF2.Exporter {
- /**
- * @hidden
- */
- export class _GLTFUtilities {
- /**
- * Creates a buffer view based on the supplied arguments
- * @param bufferIndex index value of the specified buffer
- * @param byteOffset byte offset value
- * @param byteLength byte length of the bufferView
- * @param byteStride byte distance between conequential elements
- * @param name name of the buffer view
- * @returns bufferView for glTF
- */
- static _CreateBufferView(bufferIndex: number, byteOffset: number, byteLength: number, byteStride?: number, name?: string): IBufferView;
- /**
- * Creates an accessor based on the supplied arguments
- * @param bufferviewIndex The index of the bufferview referenced by this accessor
- * @param name The name of the accessor
- * @param type The type of the accessor
- * @param componentType The datatype of components in the attribute
- * @param count The number of attributes referenced by this accessor
- * @param byteOffset The offset relative to the start of the bufferView in bytes
- * @param min Minimum value of each component in this attribute
- * @param max Maximum value of each component in this attribute
- * @returns accessor for glTF
- */
- static _CreateAccessor(bufferviewIndex: number, name: string, type: AccessorType, componentType: AccessorComponentType, count: number, byteOffset: Nullable<number>, min: Nullable<number[]>, max: Nullable<number[]>): IAccessor;
- /**
- * Calculates the minimum and maximum values of an array of position floats
- * @param positions Positions array of a mesh
- * @param vertexStart Starting vertex offset to calculate min and max values
- * @param vertexCount Number of vertices to check for min and max values
- * @returns min number array and max number array
- */
- static _CalculateMinMaxPositions(positions: FloatArray, vertexStart: number, vertexCount: number, convertToRightHandedSystem: boolean): {
- min: number[];
- max: number[];
- };
- /**
- * Converts a new right-handed Vector3
- * @param vector vector3 array
- * @returns right-handed Vector3
- */
- static _GetRightHandedPositionVector3(vector: Vector3): Vector3;
- /**
- * Converts a Vector3 to right-handed
- * @param vector Vector3 to convert to right-handed
- */
- static _GetRightHandedPositionVector3FromRef(vector: Vector3): void;
- /**
- * Converts a three element number array to right-handed
- * @param vector number array to convert to right-handed
- */
- static _GetRightHandedPositionArray3FromRef(vector: number[]): void;
- /**
- * Converts a new right-handed Vector3
- * @param vector vector3 array
- * @returns right-handed Vector3
- */
- static _GetRightHandedNormalVector3(vector: Vector3): Vector3;
- /**
- * Converts a Vector3 to right-handed
- * @param vector Vector3 to convert to right-handed
- */
- static _GetRightHandedNormalVector3FromRef(vector: Vector3): void;
- /**
- * Converts a three element number array to right-handed
- * @param vector number array to convert to right-handed
- */
- static _GetRightHandedNormalArray3FromRef(vector: number[]): void;
- /**
- * Converts a Vector4 to right-handed
- * @param vector Vector4 to convert to right-handed
- */
- static _GetRightHandedVector4FromRef(vector: Vector4): void;
- /**
- * Converts a Vector4 to right-handed
- * @param vector Vector4 to convert to right-handed
- */
- static _GetRightHandedArray4FromRef(vector: number[]): void;
- /**
- * Converts a Quaternion to right-handed
- * @param quaternion Source quaternion to convert to right-handed
- */
- static _GetRightHandedQuaternionFromRef(quaternion: Quaternion): void;
- /**
- * Converts a Quaternion to right-handed
- * @param quaternion Source quaternion to convert to right-handed
- */
- static _GetRightHandedQuaternionArrayFromRef(quaternion: number[]): void;
- static _NormalizeTangentFromRef(tangent: Vector4): void;
- }
- }
- declare module BABYLON.GLTF2.Exporter {
- /**
- * Converts Babylon Scene into glTF 2.0.
- * @hidden
- */
- export class _Exporter {
- /**
- * Stores the glTF to export
- */
- _glTF: IGLTF;
- /**
- * Stores all generated buffer views, which represents views into the main glTF buffer data
- */
- _bufferViews: IBufferView[];
- /**
- * Stores all the generated accessors, which is used for accessing the data within the buffer views in glTF
- */
- _accessors: IAccessor[];
- /**
- * Stores all the generated nodes, which contains transform and/or mesh information per node
- */
- private _nodes;
- /**
- * Stores all the generated glTF scenes, which stores multiple node hierarchies
- */
- private _scenes;
- /**
- * Stores all the generated mesh information, each containing a set of primitives to render in glTF
- */
- private _meshes;
- /**
- * Stores all the generated material information, which represents the appearance of each primitive
- */
- _materials: IMaterial[];
- _materialMap: {
- [materialID: number]: number;
- };
- /**
- * Stores all the generated texture information, which is referenced by glTF materials
- */
- _textures: ITexture[];
- /**
- * Stores all the generated image information, which is referenced by glTF textures
- */
- _images: IImage[];
- /**
- * Stores all the texture samplers
- */
- _samplers: ISampler[];
- /**
- * Stores all the generated animation samplers, which is referenced by glTF animations
- */
- /**
- * Stores the animations for glTF models
- */
- private _animations;
- /**
- * Stores the total amount of bytes stored in the glTF buffer
- */
- private _totalByteLength;
- /**
- * Stores a reference to the Babylon scene containing the source geometry and material information
- */
- _babylonScene: Scene;
- /**
- * Stores a map of the image data, where the key is the file name and the value
- * is the image data
- */
- _imageData: {
- [fileName: string]: {
- data: Uint8Array;
- mimeType: ImageMimeType;
- };
- };
- /**
- * Stores a map of the unique id of a node to its index in the node array
- */
- private _nodeMap;
- /**
- * Specifies if a Babylon node should be converted to right-handed on export
- */
- _convertToRightHandedSystemMap: {
- [nodeId: number]: boolean;
- };
- /**
- * Baked animation sample rate
- */
- private _animationSampleRate;
- private _options;
- private _localEngine;
- _glTFMaterialExporter: _GLTFMaterialExporter;
- private _extensions;
- private static _ExtensionNames;
- private static _ExtensionFactories;
- private _applyExtension;
- private _applyExtensions;
- _extensionsPreExportTextureAsync(context: string, babylonTexture: Texture, mimeType: ImageMimeType): Promise<Nullable<BaseTexture>>;
- _extensionsPostExportMeshPrimitiveAsync(context: string, meshPrimitive: IMeshPrimitive, babylonSubMesh: SubMesh, binaryWriter: _BinaryWriter): Promise<Nullable<IMeshPrimitive>>;
- _extensionsPostExportNodeAsync(context: string, node: INode, babylonNode: Node): Promise<Nullable<INode>>;
- _extensionsPostExportMaterialAsync(context: string, material: IMaterial, babylonMaterial: Material): Promise<Nullable<IMaterial>>;
- _extensionsPostExportMaterialAdditionalTextures(context: string, material: IMaterial, babylonMaterial: Material): BaseTexture[];
- _extensionsPostExportTextures(context: string, textureInfo: ITextureInfo, babylonTexture: BaseTexture): void;
- private _forEachExtensions;
- private _extensionsOnExporting;
- /**
- * Load glTF serializer extensions
- */
- private _loadExtensions;
- /**
- * Creates a glTF Exporter instance, which can accept optional exporter options
- * @param babylonScene Babylon scene object
- * @param options Options to modify the behavior of the exporter
- */
- constructor(babylonScene: Scene, options?: IExportOptions);
- dispose(): void;
- /**
- * Registers a glTF exporter extension
- * @param name Name of the extension to export
- * @param factory The factory function that creates the exporter extension
- */
- static RegisterExtension(name: string, factory: (exporter: _Exporter) => IGLTFExporterExtensionV2): void;
- /**
- * Un-registers an exporter extension
- * @param name The name fo the exporter extension
- * @returns A boolean indicating whether the extension has been un-registered
- */
- static UnregisterExtension(name: string): boolean;
- /**
- * Lazy load a local engine
- */
- _getLocalEngine(): Engine;
- private reorderIndicesBasedOnPrimitiveMode;
- /**
- * Reorders the vertex attribute data based on the primitive mode. This is necessary when indices are not available and the winding order is
- * clock-wise during export to glTF
- * @param submesh BabylonJS submesh
- * @param primitiveMode Primitive mode of the mesh
- * @param sideOrientation the winding order of the submesh
- * @param vertexBufferKind The type of vertex attribute
- * @param meshAttributeArray The vertex attribute data
- * @param byteOffset The offset to the binary data
- * @param binaryWriter The binary data for the glTF file
- * @param convertToRightHandedSystem Converts the values to right-handed
- */
- private reorderVertexAttributeDataBasedOnPrimitiveMode;
- /**
- * Reorders the vertex attributes in the correct triangle mode order . This is necessary when indices are not available and the winding order is
- * clock-wise during export to glTF
- * @param submesh BabylonJS submesh
- * @param primitiveMode Primitive mode of the mesh
- * @param sideOrientation the winding order of the submesh
- * @param vertexBufferKind The type of vertex attribute
- * @param meshAttributeArray The vertex attribute data
- * @param byteOffset The offset to the binary data
- * @param binaryWriter The binary data for the glTF file
- * @param convertToRightHandedSystem Converts the values to right-handed
- */
- private reorderTriangleFillMode;
- /**
- * Reorders the vertex attributes in the correct triangle strip order. This is necessary when indices are not available and the winding order is
- * clock-wise during export to glTF
- * @param submesh BabylonJS submesh
- * @param primitiveMode Primitive mode of the mesh
- * @param sideOrientation the winding order of the submesh
- * @param vertexBufferKind The type of vertex attribute
- * @param meshAttributeArray The vertex attribute data
- * @param byteOffset The offset to the binary data
- * @param binaryWriter The binary data for the glTF file
- * @param convertToRightHandedSystem Converts the values to right-handed
- */
- private reorderTriangleStripDrawMode;
- /**
- * Reorders the vertex attributes in the correct triangle fan order. This is necessary when indices are not available and the winding order is
- * clock-wise during export to glTF
- * @param submesh BabylonJS submesh
- * @param primitiveMode Primitive mode of the mesh
- * @param sideOrientation the winding order of the submesh
- * @param vertexBufferKind The type of vertex attribute
- * @param meshAttributeArray The vertex attribute data
- * @param byteOffset The offset to the binary data
- * @param binaryWriter The binary data for the glTF file
- * @param convertToRightHandedSystem Converts the values to right-handed
- */
- private reorderTriangleFanMode;
- /**
- * Writes the vertex attribute data to binary
- * @param vertices The vertices to write to the binary writer
- * @param byteOffset The offset into the binary writer to overwrite binary data
- * @param vertexAttributeKind The vertex attribute type
- * @param meshAttributeArray The vertex attribute data
- * @param binaryWriter The writer containing the binary data
- * @param convertToRightHandedSystem Converts the values to right-handed
- */
- private writeVertexAttributeData;
- /**
- * Writes mesh attribute data to a data buffer
- * Returns the bytelength of the data
- * @param vertexBufferKind Indicates what kind of vertex data is being passed in
- * @param meshAttributeArray Array containing the attribute data
- * @param binaryWriter The buffer to write the binary data to
- * @param indices Used to specify the order of the vertex data
- * @param convertToRightHandedSystem Converts the values to right-handed
- */
- writeAttributeData(vertexBufferKind: string, meshAttributeArray: FloatArray, byteStride: number, binaryWriter: _BinaryWriter, convertToRightHandedSystem: boolean): void;
- /**
- * Generates glTF json data
- * @param shouldUseGlb Indicates whether the json should be written for a glb file
- * @param glTFPrefix Text to use when prefixing a glTF file
- * @param prettyPrint Indicates whether the json file should be pretty printed (true) or not (false)
- * @returns json data as string
- */
- private generateJSON;
- /**
- * Generates data for .gltf and .bin files based on the glTF prefix string
- * @param glTFPrefix Text to use when prefixing a glTF file
- * @param dispose Dispose the exporter
- * @returns GLTFData with glTF file data
- */
- _generateGLTFAsync(glTFPrefix: string, dispose?: boolean): Promise<GLTFData>;
- /**
- * Creates a binary buffer for glTF
- * @returns array buffer for binary data
- */
- private _generateBinaryAsync;
- /**
- * Pads the number to a multiple of 4
- * @param num number to pad
- * @returns padded number
- */
- private _getPadding;
- /**
- * @hidden
- */
- _generateGLBAsync(glTFPrefix: string, dispose?: boolean): Promise<GLTFData>;
- /**
- * Sets the TRS for each node
- * @param node glTF Node for storing the transformation data
- * @param babylonTransformNode Babylon mesh used as the source for the transformation data
- * @param convertToRightHandedSystem Converts the values to right-handed
- */
- private setNodeTransformation;
- private getVertexBufferFromMesh;
- /**
- * Creates a bufferview based on the vertices type for the Babylon mesh
- * @param kind Indicates the type of vertices data
- * @param babylonTransformNode The Babylon mesh to get the vertices data from
- * @param binaryWriter The buffer to write the bufferview data to
- * @param convertToRightHandedSystem Converts the values to right-handed
- */
- private createBufferViewKind;
- /**
- * The primitive mode of the Babylon mesh
- * @param babylonMesh The BabylonJS mesh
- */
- private getMeshPrimitiveMode;
- /**
- * Sets the primitive mode of the glTF mesh primitive
- * @param meshPrimitive glTF mesh primitive
- * @param primitiveMode The primitive mode
- */
- private setPrimitiveMode;
- /**
- * Sets the vertex attribute accessor based of the glTF mesh primitive
- * @param meshPrimitive glTF mesh primitive
- * @param attributeKind vertex attribute
- * @returns boolean specifying if uv coordinates are present
- */
- private setAttributeKind;
- /**
- * Sets data for the primitive attributes of each submesh
- * @param mesh glTF Mesh object to store the primitive attribute information
- * @param babylonTransformNode Babylon mesh to get the primitive attribute data from
- * @param binaryWriter Buffer to write the attribute data to
- * @param convertToRightHandedSystem Converts the values to right-handed
- */
- private setPrimitiveAttributesAsync;
- /**
- * Check if the node is used to convert its descendants from right-handed to left-handed
- * @param node The node to check
- * @returns True if the node is used to convert its descendants from right-handed to left-handed. False otherwise
- */
- private isNodeConvertingToLeftHanded;
- /**
- * Creates a glTF scene based on the array of meshes
- * Returns the the total byte offset
- * @param babylonScene Babylon scene to get the mesh data from
- * @param binaryWriter Buffer to write binary data to
- */
- private createSceneAsync;
- /**
- * Creates a mapping of Node unique id to node index and handles animations
- * @param babylonScene Babylon Scene
- * @param nodes Babylon transform nodes
- * @param binaryWriter Buffer to write binary data to
- * @returns Node mapping of unique id to index
- */
- private createNodeMapAndAnimationsAsync;
- /**
- * Creates a glTF node from a Babylon mesh
- * @param babylonMesh Source Babylon mesh
- * @param binaryWriter Buffer for storing geometry data
- * @param convertToRightHandedSystem Converts the values to right-handed
- * @returns glTF node
- */
- private createNodeAsync;
- }
- /**
- * @hidden
- *
- * Stores glTF binary data. If the array buffer byte length is exceeded, it doubles in size dynamically
- */
- export class _BinaryWriter {
- /**
- * Array buffer which stores all binary data
- */
- private _arrayBuffer;
- /**
- * View of the array buffer
- */
- private _dataView;
- /**
- * byte offset of data in array buffer
- */
- private _byteOffset;
- /**
- * Initialize binary writer with an initial byte length
- * @param byteLength Initial byte length of the array buffer
- */
- constructor(byteLength: number);
- /**
- * Resize the array buffer to the specified byte length
- * @param byteLength
- */
- private resizeBuffer;
- /**
- * Get an array buffer with the length of the byte offset
- * @returns ArrayBuffer resized to the byte offset
- */
- getArrayBuffer(): ArrayBuffer;
- /**
- * Get the byte offset of the array buffer
- * @returns byte offset
- */
- getByteOffset(): number;
- /**
- * Stores an UInt8 in the array buffer
- * @param entry
- * @param byteOffset If defined, specifies where to set the value as an offset.
- */
- setUInt8(entry: number, byteOffset?: number): void;
- /**
- * Gets an UInt32 in the array buffer
- * @param entry
- * @param byteOffset If defined, specifies where to set the value as an offset.
- */
- getUInt32(byteOffset: number): number;
- getVector3Float32FromRef(vector3: Vector3, byteOffset: number): void;
- setVector3Float32FromRef(vector3: Vector3, byteOffset: number): void;
- getVector4Float32FromRef(vector4: Vector4, byteOffset: number): void;
- setVector4Float32FromRef(vector4: Vector4, byteOffset: number): void;
- /**
- * Stores a Float32 in the array buffer
- * @param entry
- */
- setFloat32(entry: number, byteOffset?: number): void;
- /**
- * Stores an UInt32 in the array buffer
- * @param entry
- * @param byteOffset If defined, specifies where to set the value as an offset.
- */
- setUInt32(entry: number, byteOffset?: number): void;
- }
- }
- declare module BABYLON.GLTF2.Exporter {
- /**
- * @hidden
- * Interface to store animation data.
- */
- export interface _IAnimationData {
- /**
- * Keyframe data.
- */
- inputs: number[];
- /**
- * Value data.
- */
- outputs: number[][];
- /**
- * Animation interpolation data.
- */
- samplerInterpolation: AnimationSamplerInterpolation;
- /**
- * Minimum keyframe value.
- */
- inputsMin: number;
- /**
- * Maximum keyframe value.
- */
- inputsMax: number;
- }
- /**
- * @hidden
- */
- export interface _IAnimationInfo {
- /**
- * The target channel for the animation
- */
- animationChannelTargetPath: AnimationChannelTargetPath;
- /**
- * The glTF accessor type for the data.
- */
- dataAccessorType: AccessorType.VEC3 | AccessorType.VEC4;
- /**
- * Specifies if quaternions should be used.
- */
- useQuaternion: boolean;
- }
- /**
- * @hidden
- * Utility class for generating glTF animation data from BabylonJS.
- */
- export class _GLTFAnimation {
- /**
- * @ignore
- *
- * Creates glTF channel animation from BabylonJS animation.
- * @param babylonTransformNode - BabylonJS mesh.
- * @param animation - animation.
- * @param animationChannelTargetPath - The target animation channel.
- * @param convertToRightHandedSystem - Specifies if the values should be converted to right-handed.
- * @param useQuaternion - Specifies if quaternions are used.
- * @returns nullable IAnimationData
- */
- static _CreateNodeAnimation(babylonTransformNode: TransformNode, animation: Animation, animationChannelTargetPath: AnimationChannelTargetPath, convertToRightHandedSystem: boolean, useQuaternion: boolean, animationSampleRate: number): Nullable<_IAnimationData>;
- private static _DeduceAnimationInfo;
- /**
- * @ignore
- * Create node animations from the transform node animations
- * @param babylonNode
- * @param runtimeGLTFAnimation
- * @param idleGLTFAnimations
- * @param nodeMap
- * @param nodes
- * @param binaryWriter
- * @param bufferViews
- * @param accessors
- * @param convertToRightHandedSystem
- * @param animationSampleRate
- */
- static _CreateNodeAnimationFromNodeAnimations(babylonNode: Node, runtimeGLTFAnimation: IAnimation, idleGLTFAnimations: IAnimation[], nodeMap: {
- [key: number]: number;
- }, nodes: INode[], binaryWriter: _BinaryWriter, bufferViews: IBufferView[], accessors: IAccessor[], convertToRightHandedSystem: boolean, animationSampleRate: number): void;
- /**
- * @ignore
- * Create node animations from the animation groups
- * @param babylonScene
- * @param glTFAnimations
- * @param nodeMap
- * @param nodes
- * @param binaryWriter
- * @param bufferViews
- * @param accessors
- * @param convertToRightHandedSystemMap
- * @param animationSampleRate
- */
- static _CreateNodeAnimationFromAnimationGroups(babylonScene: Scene, glTFAnimations: IAnimation[], nodeMap: {
- [key: number]: number;
- }, nodes: INode[], binaryWriter: _BinaryWriter, bufferViews: IBufferView[], accessors: IAccessor[], convertToRightHandedSystemMap: {
- [nodeId: number]: boolean;
- }, animationSampleRate: number): void;
- private static AddAnimation;
- /**
- * Create a baked animation
- * @param babylonTransformNode BabylonJS mesh
- * @param animation BabylonJS animation corresponding to the BabylonJS mesh
- * @param animationChannelTargetPath animation target channel
- * @param minFrame minimum animation frame
- * @param maxFrame maximum animation frame
- * @param fps frames per second of the animation
- * @param inputs input key frames of the animation
- * @param outputs output key frame data of the animation
- * @param convertToRightHandedSystem converts the values to right-handed
- * @param useQuaternion specifies if quaternions should be used
- */
- private static _CreateBakedAnimation;
- private static _ConvertFactorToVector3OrQuaternion;
- private static _SetInterpolatedValue;
- /**
- * Creates linear animation from the animation key frames
- * @param babylonTransformNode BabylonJS mesh
- * @param animation BabylonJS animation
- * @param animationChannelTargetPath The target animation channel
- * @param frameDelta The difference between the last and first frame of the animation
- * @param inputs Array to store the key frame times
- * @param outputs Array to store the key frame data
- * @param convertToRightHandedSystem Specifies if the position data should be converted to right handed
- * @param useQuaternion Specifies if quaternions are used in the animation
- */
- private static _CreateLinearOrStepAnimation;
- /**
- * Creates cubic spline animation from the animation key frames
- * @param babylonTransformNode BabylonJS mesh
- * @param animation BabylonJS animation
- * @param animationChannelTargetPath The target animation channel
- * @param frameDelta The difference between the last and first frame of the animation
- * @param inputs Array to store the key frame times
- * @param outputs Array to store the key frame data
- * @param convertToRightHandedSystem Specifies if the position data should be converted to right handed
- * @param useQuaternion Specifies if quaternions are used in the animation
- */
- private static _CreateCubicSplineAnimation;
- private static _GetBasePositionRotationOrScale;
- /**
- * Adds a key frame value
- * @param keyFrame
- * @param animation
- * @param outputs
- * @param animationChannelTargetPath
- * @param basePositionRotationOrScale
- * @param convertToRightHandedSystem
- * @param useQuaternion
- */
- private static _AddKeyframeValue;
- /**
- * Determine the interpolation based on the key frames
- * @param keyFrames
- * @param animationChannelTargetPath
- * @param useQuaternion
- */
- private static _DeduceInterpolation;
- /**
- * Adds an input tangent or output tangent to the output data
- * If an input tangent or output tangent is missing, it uses the zero vector or zero quaternion
- * @param tangentType Specifies which type of tangent to handle (inTangent or outTangent)
- * @param outputs The animation data by keyframe
- * @param animationChannelTargetPath The target animation channel
- * @param interpolation The interpolation type
- * @param keyFrame The key frame with the animation data
- * @param frameDelta Time difference between two frames used to scale the tangent by the frame delta
- * @param useQuaternion Specifies if quaternions are used
- * @param convertToRightHandedSystem Specifies if the values should be converted to right-handed
- */
- private static AddSplineTangent;
- /**
- * Get the minimum and maximum key frames' frame values
- * @param keyFrames animation key frames
- * @returns the minimum and maximum key frame value
- */
- private static calculateMinMaxKeyFrames;
- }
- }
- declare module BABYLON.GLTF2.Exporter {
- /** @hidden */
- export var textureTransformPixelShader: {
- name: string;
- shader: string;
- };
- }
- declare module BABYLON.GLTF2.Exporter.Extensions {
- /**
- * @hidden
- */
- export class KHR_texture_transform implements IGLTFExporterExtensionV2 {
- private _recordedTextures;
- /** Name of this extension */
- readonly name: string;
- /** Defines whether this extension is enabled */
- enabled: boolean;
- /** Defines whether this extension is required */
- required: boolean;
- /** Reference to the glTF exporter */
- private _wasUsed;
- constructor(exporter: _Exporter);
- dispose(): void;
- /** @hidden */
- get wasUsed(): boolean;
- postExportTexture?(context: string, textureInfo: ITextureInfo, babylonTexture: Texture): void;
- preExportTextureAsync(context: string, babylonTexture: Texture, mimeType: ImageMimeType): Promise<Texture>;
- /**
- * Transform the babylon texture by the offset, rotation and scale parameters using a procedural texture
- * @param babylonTexture
- * @param offset
- * @param rotation
- * @param scale
- * @param scene
- */
- private _textureTransformTextureAsync;
- }
- }
- declare module BABYLON.GLTF2.Exporter.Extensions {
- /**
- * [Specification](https://github.com/KhronosGroup/glTF/blob/master/extensions/2.0/Khronos/KHR_lights_punctual/README.md)
- */
- export class KHR_lights_punctual implements IGLTFExporterExtensionV2 {
- /** The name of this extension. */
- readonly name: string;
- /** Defines whether this extension is enabled. */
- enabled: boolean;
- /** Defines whether this extension is required */
- required: boolean;
- /** Reference to the glTF exporter */
- private _exporter;
- private _lights;
- /** @hidden */
- constructor(exporter: _Exporter);
- /** @hidden */
- dispose(): void;
- /** @hidden */
- get wasUsed(): boolean;
- /** @hidden */
- onExporting(): void;
- /**
- * Define this method to modify the default behavior when exporting a node
- * @param context The context when exporting the node
- * @param node glTF node
- * @param babylonNode BabylonJS node
- * @returns nullable INode promise
- */
- postExportNodeAsync(context: string, node: INode, babylonNode: Node): Promise<INode>;
- }
- }
- declare module BABYLON.GLTF2.Exporter.Extensions {
- /**
- * @hidden
- */
- export class KHR_materials_sheen implements IGLTFExporterExtensionV2 {
- /** Name of this extension */
- readonly name: string;
- /** Defines whether this extension is enabled */
- enabled: boolean;
- /** Defines whether this extension is required */
- required: boolean;
- /** Reference to the glTF exporter */
- private _textureInfos;
- private _exportedTextures;
- private _wasUsed;
- constructor(exporter: _Exporter);
- dispose(): void;
- /** @hidden */
- get wasUsed(): boolean;
- private _getTextureIndex;
- postExportTexture?(context: string, textureInfo: ITextureInfo, babylonTexture: Texture): void;
- postExportMaterialAdditionalTextures?(context: string, node: IMaterial, babylonMaterial: Material): BaseTexture[];
- postExportMaterialAsync?(context: string, node: IMaterial, babylonMaterial: Material): Promise<IMaterial>;
- }
- }
- declare module BABYLON {
- /**
- * Class for generating STL data from a Babylon scene.
- */
- export class STLExport {
- /**
- * Exports the geometry of a Mesh array in .STL file format (ASCII)
- * @param meshes list defines the mesh to serialize
- * @param download triggers the automatic download of the file.
- * @param fileName changes the downloads fileName.
- * @param binary changes the STL to a binary type.
- * @param isLittleEndian toggle for binary type exporter.
- * @returns the STL as UTF8 string
- */
- static CreateSTL(meshes: Mesh[], download?: boolean, fileName?: string, binary?: boolean, isLittleEndian?: boolean): any;
- }
- }
|