babylonjs-loaders
Advanced tools
Comparing version 3.2.0-alpha7 to 3.2.0-alpha8
@@ -18,3 +18,3 @@ /// <reference types="babylonjs"/> | ||
load(scene: Scene, data: any, rootUrl: string): boolean; | ||
loadAssets(scene: Scene, data: string, rootUrl: string, onError?: (message: string, exception?: any) => void): Nullable<AssetContainer>; | ||
loadAssetContainer(scene: Scene, data: string, rootUrl: string, onError?: (message: string, exception?: any) => void): AssetContainer; | ||
private isBinary(data); | ||
@@ -86,3 +86,3 @@ private parseBinary(mesh, data); | ||
load(scene: Scene, data: string, rootUrl: string): boolean; | ||
loadAssets(scene: Scene, data: string, rootUrl: string, onError?: (message: string, exception?: any) => void): Nullable<AssetContainer>; | ||
loadAssetContainer(scene: Scene, data: string, rootUrl: string, onError?: (message: string, exception?: any) => void): AssetContainer; | ||
/** | ||
@@ -134,2 +134,17 @@ * Read the OBJ file and create an Array of meshes. | ||
} | ||
interface IGLTFLoaderExtension { | ||
/** | ||
* The name of this extension. | ||
*/ | ||
readonly name: string; | ||
/** | ||
* Whether this extension is enabled. | ||
*/ | ||
enabled: boolean; | ||
} | ||
enum GLTFLoaderState { | ||
Loading = 0, | ||
Ready = 1, | ||
Complete = 2, | ||
} | ||
interface IGLTFLoader extends IDisposable { | ||
@@ -141,3 +156,2 @@ coordinateSystemMode: GLTFLoaderCoordinateSystemMode; | ||
compileShadowGenerators: boolean; | ||
onDisposeObservable: Observable<IGLTFLoader>; | ||
onMeshLoadedObservable: Observable<AbstractMesh>; | ||
@@ -147,4 +161,11 @@ onTextureLoadedObservable: Observable<BaseTexture>; | ||
onCompleteObservable: Observable<IGLTFLoader>; | ||
importMeshAsync: (meshesNames: any, scene: Scene, data: IGLTFLoaderData, rootUrl: string, onSuccess?: (meshes: AbstractMesh[], particleSystems: ParticleSystem[], skeletons: Skeleton[]) => void, onProgress?: (event: SceneLoaderProgressEvent) => void, onError?: (message: string, exception?: any) => void) => void; | ||
loadAsync: (scene: Scene, data: IGLTFLoaderData, rootUrl: string, onSuccess?: () => void, onProgress?: (event: SceneLoaderProgressEvent) => void, onError?: (message: string, exception?: any) => void) => void; | ||
onDisposeObservable: Observable<IGLTFLoader>; | ||
onExtensionLoadedObservable: Observable<IGLTFLoaderExtension>; | ||
state: Nullable<GLTFLoaderState>; | ||
importMeshAsync: (meshesNames: any, scene: Scene, data: IGLTFLoaderData, rootUrl: string, onProgress?: (event: SceneLoaderProgressEvent) => void) => Promise<{ | ||
meshes: AbstractMesh[]; | ||
particleSystems: ParticleSystem[]; | ||
skeletons: Skeleton[]; | ||
}>; | ||
loadAsync: (scene: Scene, data: IGLTFLoaderData, rootUrl: string, onProgress?: (event: SceneLoaderProgressEvent) => void) => Promise<void>; | ||
} | ||
@@ -187,3 +208,3 @@ class GLTFFileLoader implements IDisposable, ISceneLoaderPluginAsync, ISceneLoaderPluginFactory { | ||
*/ | ||
onMeshLoadedObservable: Observable<AbstractMesh>; | ||
readonly onMeshLoadedObservable: Observable<AbstractMesh>; | ||
private _onMeshLoadedObserver; | ||
@@ -194,3 +215,3 @@ onMeshLoaded: (mesh: AbstractMesh) => void; | ||
*/ | ||
onTextureLoadedObservable: Observable<BaseTexture>; | ||
readonly onTextureLoadedObservable: Observable<BaseTexture>; | ||
private _onTextureLoadedObserver; | ||
@@ -201,3 +222,3 @@ onTextureLoaded: (Texture: BaseTexture) => void; | ||
*/ | ||
onMaterialLoadedObservable: Observable<Material>; | ||
readonly onMaterialLoadedObservable: Observable<Material>; | ||
private _onMaterialLoadedObserver; | ||
@@ -210,3 +231,3 @@ onMaterialLoaded: (Material: Material) => void; | ||
*/ | ||
onCompleteObservable: Observable<GLTFFileLoader>; | ||
readonly onCompleteObservable: Observable<GLTFFileLoader>; | ||
private _onCompleteObserver; | ||
@@ -217,5 +238,16 @@ onComplete: () => void; | ||
*/ | ||
onDisposeObservable: Observable<GLTFFileLoader>; | ||
readonly onDisposeObservable: Observable<GLTFFileLoader>; | ||
private _onDisposeObserver; | ||
onDispose: () => void; | ||
/** | ||
* Raised after a loader extension is created. | ||
* Set additional options for a loader extension in this event. | ||
*/ | ||
readonly onExtensionLoadedObservable: Observable<IGLTFLoaderExtension>; | ||
private _onExtensionLoadedObserver; | ||
onExtensionLoaded: (extension: IGLTFLoaderExtension) => void; | ||
/** | ||
* The loader state or null if not active. | ||
*/ | ||
readonly loaderState: Nullable<GLTFLoaderState>; | ||
private _loader; | ||
@@ -228,5 +260,9 @@ name: string; | ||
dispose(): void; | ||
importMeshAsync(meshesNames: any, scene: Scene, data: any, rootUrl: string, onSuccess?: (meshes: AbstractMesh[], particleSystems: ParticleSystem[], skeletons: Skeleton[]) => void, onProgress?: (event: SceneLoaderProgressEvent) => void, onError?: (message: string, exception?: any) => void): void; | ||
loadAsync(scene: Scene, data: string | ArrayBuffer, rootUrl: string, onSuccess?: () => void, onProgress?: (event: SceneLoaderProgressEvent) => void, onError?: (message: string, exception?: any) => void): void; | ||
loadAssetsAsync(scene: Scene, data: string | ArrayBuffer, rootUrl: string, onSuccess: (assets: AssetContainer) => void, onProgress?: (event: SceneLoaderProgressEvent) => void, onError?: (message: string, exception?: any) => void): void; | ||
importMeshAsync(meshesNames: any, scene: Scene, data: any, rootUrl: string, onProgress?: (event: SceneLoaderProgressEvent) => void): Promise<{ | ||
meshes: AbstractMesh[]; | ||
particleSystems: ParticleSystem[]; | ||
skeletons: Skeleton[]; | ||
}>; | ||
loadAsync(scene: Scene, data: string | ArrayBuffer, rootUrl: string, onProgress?: (event: SceneLoaderProgressEvent) => void): Promise<void>; | ||
loadAssetContainerAsync(scene: Scene, data: string | ArrayBuffer, rootUrl: string, onProgress?: (event: SceneLoaderProgressEvent) => void): Promise<AssetContainer>; | ||
canDirectLoad(data: string): boolean; | ||
@@ -649,5 +685,13 @@ rewriteRootURL: (rootUrl: string, responseURL?: string) => string; | ||
onCompleteObservable: Observable<IGLTFLoader>; | ||
onExtensionLoadedObservable: Observable<IGLTFLoaderExtension>; | ||
state: Nullable<GLTFLoaderState>; | ||
dispose(): void; | ||
importMeshAsync(meshesNames: any, scene: Scene, data: IGLTFLoaderData, rootUrl: string, onSuccess: (meshes: AbstractMesh[], particleSystems: ParticleSystem[], skeletons: Skeleton[]) => void, onProgress: (event: SceneLoaderProgressEvent) => void, onError: (message: string) => void): boolean; | ||
loadAsync(scene: Scene, data: IGLTFLoaderData, rootUrl: string, onSuccess: () => void, onProgress: (event: SceneLoaderProgressEvent) => void, onError: (message: string) => void): void; | ||
private _importMeshAsync(meshesNames, scene, data, rootUrl, onSuccess, onProgress, onError); | ||
importMeshAsync(meshesNames: any, scene: Scene, data: IGLTFLoaderData, rootUrl: string, onProgress: (event: SceneLoaderProgressEvent) => void): Promise<{ | ||
meshes: AbstractMesh[]; | ||
particleSystems: ParticleSystem[]; | ||
skeletons: Skeleton[]; | ||
}>; | ||
private _loadAsync(scene, data, rootUrl, onSuccess, onProgress, onError); | ||
loadAsync(scene: Scene, data: IGLTFLoaderData, rootUrl: string, onProgress: (event: SceneLoaderProgressEvent) => void): Promise<void>; | ||
private _loadShadersAsync(gltfRuntime, onload); | ||
@@ -683,12 +727,2 @@ private _loadBuffersAsync(gltfRuntime, onLoad, onProgress?); | ||
/** | ||
* If the uri is a base64 string | ||
* @param uri: the uri to test | ||
*/ | ||
static IsBase64(uri: string): boolean; | ||
/** | ||
* Decode the base64 uri | ||
* @param uri: the uri to decode | ||
*/ | ||
static DecodeBase64(uri: string): ArrayBuffer; | ||
/** | ||
* Returns the wrap mode of the texture | ||
@@ -807,204 +841,64 @@ * @param mode: the mode value | ||
declare module BABYLON.GLTF2 { | ||
/** | ||
* Enums | ||
*/ | ||
enum EComponentType { | ||
BYTE = 5120, | ||
UNSIGNED_BYTE = 5121, | ||
SHORT = 5122, | ||
UNSIGNED_SHORT = 5123, | ||
UNSIGNED_INT = 5125, | ||
FLOAT = 5126, | ||
interface TypedArray extends ArrayBufferView { | ||
[index: number]: number; | ||
} | ||
enum EMeshPrimitiveMode { | ||
POINTS = 0, | ||
LINES = 1, | ||
LINE_LOOP = 2, | ||
LINE_STRIP = 3, | ||
TRIANGLES = 4, | ||
TRIANGLE_STRIP = 5, | ||
TRIANGLE_FAN = 6, | ||
interface IArrayItem { | ||
_index: number; | ||
} | ||
enum ETextureMagFilter { | ||
NEAREST = 9728, | ||
LINEAR = 9729, | ||
class ArrayItem { | ||
static Assign(values?: IArrayItem[]): void; | ||
} | ||
enum ETextureMinFilter { | ||
NEAREST = 9728, | ||
LINEAR = 9729, | ||
NEAREST_MIPMAP_NEAREST = 9984, | ||
LINEAR_MIPMAP_NEAREST = 9985, | ||
NEAREST_MIPMAP_LINEAR = 9986, | ||
LINEAR_MIPMAP_LINEAR = 9987, | ||
} | ||
declare module BABYLON.GLTF2 { | ||
interface ILoaderAccessor extends IAccessor, IArrayItem { | ||
_data?: Promise<TypedArray>; | ||
} | ||
enum ETextureWrapMode { | ||
CLAMP_TO_EDGE = 33071, | ||
MIRRORED_REPEAT = 33648, | ||
REPEAT = 10497, | ||
interface ILoaderAnimationChannel extends IAnimationChannel, IArrayItem { | ||
_babylonAnimationGroup: AnimationGroup; | ||
} | ||
/** | ||
* Interfaces | ||
*/ | ||
interface IGLTFProperty { | ||
extensions?: { | ||
[key: string]: any; | ||
}; | ||
extras?: any; | ||
interface ILoaderAnimationSamplerData { | ||
input: Float32Array; | ||
interpolation: AnimationSamplerInterpolation; | ||
output: Float32Array; | ||
} | ||
interface IGLTFChildRootProperty extends IGLTFProperty { | ||
name?: string; | ||
interface ILoaderAnimationSampler extends IAnimationSampler, IArrayItem { | ||
_data: Promise<ILoaderAnimationSamplerData>; | ||
} | ||
interface IGLTFAccessorSparseIndices extends IGLTFProperty { | ||
bufferView: number; | ||
byteOffset?: number; | ||
componentType: EComponentType; | ||
interface ILoaderAnimation extends IAnimation, IArrayItem { | ||
channels: ILoaderAnimationChannel[]; | ||
samplers: ILoaderAnimationSampler[]; | ||
_babylonAnimationGroup: Nullable<AnimationGroup>; | ||
} | ||
interface IGLTFAccessorSparseValues extends IGLTFProperty { | ||
bufferView: number; | ||
byteOffset?: number; | ||
interface ILoaderBuffer extends IBuffer, IArrayItem { | ||
_data?: Promise<ArrayBufferView>; | ||
} | ||
interface IGLTFAccessorSparse extends IGLTFProperty { | ||
count: number; | ||
indices: IGLTFAccessorSparseIndices; | ||
values: IGLTFAccessorSparseValues; | ||
interface ILoaderBufferView extends IBufferView, IArrayItem { | ||
_data?: Promise<ArrayBufferView>; | ||
} | ||
interface IGLTFAccessor extends IGLTFChildRootProperty { | ||
bufferView?: number; | ||
byteOffset?: number; | ||
componentType: EComponentType; | ||
normalized?: boolean; | ||
count: number; | ||
type: string; | ||
max: number[]; | ||
min: number[]; | ||
sparse?: IGLTFAccessorSparse; | ||
index: number; | ||
interface ILoaderCamera extends ICamera, IArrayItem { | ||
} | ||
interface IGLTFAnimationChannel extends IGLTFProperty { | ||
sampler: number; | ||
target: IGLTFAnimationChannelTarget; | ||
interface ILoaderImage extends IImage, IArrayItem { | ||
_objectURL?: Promise<string>; | ||
} | ||
interface IGLTFAnimationChannelTarget extends IGLTFProperty { | ||
node: number; | ||
path: string; | ||
interface ILoaderMaterial extends IMaterial, IArrayItem { | ||
_babylonMaterial?: Material; | ||
_babylonMeshes?: AbstractMesh[]; | ||
_loaded?: Promise<void>; | ||
} | ||
interface IGLTFAnimationSampler extends IGLTFProperty { | ||
input: number; | ||
interpolation?: string; | ||
output: number; | ||
interface ILoaderMesh extends IMesh, IArrayItem { | ||
primitives: ILoaderMeshPrimitive[]; | ||
} | ||
interface IGLTFAnimation extends IGLTFChildRootProperty { | ||
channels: IGLTFAnimationChannel[]; | ||
samplers: IGLTFAnimationSampler[]; | ||
index: number; | ||
babylonAnimationGroup: AnimationGroup; | ||
interface ILoaderMeshPrimitive extends IMeshPrimitive, IArrayItem { | ||
} | ||
interface IGLTFAsset extends IGLTFChildRootProperty { | ||
copyright?: string; | ||
generator?: string; | ||
version: string; | ||
minVersion?: string; | ||
interface ILoaderNode extends INode, IArrayItem { | ||
_parent: ILoaderNode; | ||
_babylonMesh?: Mesh; | ||
_primitiveBabylonMeshes?: Mesh[]; | ||
_babylonAnimationTargets?: Node[]; | ||
_numMorphTargets?: number; | ||
} | ||
interface IGLTFBuffer extends IGLTFChildRootProperty { | ||
uri?: string; | ||
byteLength: number; | ||
index: number; | ||
loadedData?: ArrayBufferView; | ||
loadedObservable?: Observable<IGLTFBuffer>; | ||
} | ||
interface IGLTFBufferView extends IGLTFChildRootProperty { | ||
buffer: number; | ||
byteOffset?: number; | ||
byteLength: number; | ||
byteStride?: number; | ||
index: number; | ||
} | ||
interface IGLTFCameraOrthographic extends IGLTFProperty { | ||
xmag: number; | ||
ymag: number; | ||
zfar: number; | ||
znear: number; | ||
} | ||
interface IGLTFCameraPerspective extends IGLTFProperty { | ||
aspectRatio: number; | ||
yfov: number; | ||
zfar: number; | ||
znear: number; | ||
} | ||
interface IGLTFCamera extends IGLTFChildRootProperty { | ||
orthographic?: IGLTFCameraOrthographic; | ||
perspective?: IGLTFCameraPerspective; | ||
type: string; | ||
} | ||
interface IGLTFImage extends IGLTFChildRootProperty { | ||
uri?: string; | ||
mimeType?: string; | ||
bufferView?: number; | ||
index: number; | ||
} | ||
interface IGLTFMaterialNormalTextureInfo extends IGLTFTextureInfo { | ||
scale: number; | ||
} | ||
interface IGLTFMaterialOcclusionTextureInfo extends IGLTFTextureInfo { | ||
strength: number; | ||
} | ||
interface IGLTFMaterialPbrMetallicRoughness { | ||
baseColorFactor: number[]; | ||
baseColorTexture: IGLTFTextureInfo; | ||
metallicFactor: number; | ||
roughnessFactor: number; | ||
metallicRoughnessTexture: IGLTFTextureInfo; | ||
} | ||
interface IGLTFMaterial extends IGLTFChildRootProperty { | ||
pbrMetallicRoughness?: IGLTFMaterialPbrMetallicRoughness; | ||
normalTexture?: IGLTFMaterialNormalTextureInfo; | ||
occlusionTexture?: IGLTFMaterialOcclusionTextureInfo; | ||
emissiveTexture?: IGLTFTextureInfo; | ||
emissiveFactor?: number[]; | ||
alphaMode?: string; | ||
alphaCutoff: number; | ||
doubleSided?: boolean; | ||
index: number; | ||
babylonMaterial: Material; | ||
} | ||
interface IGLTFMeshPrimitive extends IGLTFProperty { | ||
attributes: { | ||
[name: string]: number; | ||
}; | ||
indices?: number; | ||
material?: number; | ||
mode?: EMeshPrimitiveMode; | ||
targets?: { | ||
[name: string]: number; | ||
}[]; | ||
vertexData: VertexData; | ||
targetsVertexData: VertexData[]; | ||
} | ||
interface IGLTFMesh extends IGLTFChildRootProperty { | ||
primitives: IGLTFMeshPrimitive[]; | ||
weights?: number[]; | ||
index: number; | ||
hasVertexAlpha: boolean; | ||
} | ||
interface IGLTFNode extends IGLTFChildRootProperty { | ||
camera?: number; | ||
children?: number[]; | ||
skin?: number; | ||
matrix?: number[]; | ||
mesh?: number; | ||
rotation?: number[]; | ||
scale?: number[]; | ||
translation?: number[]; | ||
weights?: number[]; | ||
index: number; | ||
parent: IGLTFNode; | ||
babylonMesh: Mesh; | ||
babylonAnimationTargets?: Node[]; | ||
} | ||
interface IGLTFSampler extends IGLTFChildRootProperty { | ||
magFilter?: ETextureMagFilter; | ||
minFilter?: ETextureMinFilter; | ||
wrapS?: ETextureWrapMode; | ||
wrapT?: ETextureWrapMode; | ||
index: number; | ||
interface ILoaderSamplerData { | ||
noMipMaps: boolean; | ||
@@ -1015,42 +909,27 @@ samplingMode: number; | ||
} | ||
interface IGLTFScene extends IGLTFChildRootProperty { | ||
nodes: number[]; | ||
index: number; | ||
interface ILoaderSampler extends ISampler, IArrayItem { | ||
_data?: ILoaderSamplerData; | ||
} | ||
interface IGLTFSkin extends IGLTFChildRootProperty { | ||
inverseBindMatrices?: number; | ||
skeleton?: number; | ||
joints: number[]; | ||
index: number; | ||
babylonSkeleton: Skeleton; | ||
interface ILoaderScene extends IScene, IArrayItem { | ||
} | ||
interface IGLTFTexture extends IGLTFChildRootProperty { | ||
sampler?: number; | ||
source: number; | ||
index: number; | ||
url?: string; | ||
dataReadyObservable?: Observable<IGLTFTexture>; | ||
interface ILoaderSkin extends ISkin, IArrayItem { | ||
_babylonSkeleton: Nullable<Skeleton>; | ||
_loaded?: Promise<void>; | ||
} | ||
interface IGLTFTextureInfo { | ||
index: number; | ||
texCoord?: number; | ||
interface ILoaderTexture extends ITexture, IArrayItem { | ||
} | ||
interface _IGLTF extends IGLTFProperty { | ||
accessors?: IGLTFAccessor[]; | ||
animations?: IGLTFAnimation[]; | ||
asset: IGLTFAsset; | ||
buffers?: IGLTFBuffer[]; | ||
bufferViews?: IGLTFBufferView[]; | ||
cameras?: IGLTFCamera[]; | ||
extensionsUsed?: string[]; | ||
extensionsRequired?: string[]; | ||
images?: IGLTFImage[]; | ||
materials?: IGLTFMaterial[]; | ||
meshes?: IGLTFMesh[]; | ||
nodes?: IGLTFNode[]; | ||
samplers?: IGLTFSampler[]; | ||
scene?: number; | ||
scenes?: IGLTFScene[]; | ||
skins?: IGLTFSkin[]; | ||
textures?: IGLTFTexture[]; | ||
interface ILoaderGLTF extends IGLTF { | ||
accessors?: ILoaderAccessor[]; | ||
animations?: ILoaderAnimation[]; | ||
buffers?: ILoaderBuffer[]; | ||
bufferViews?: ILoaderBufferView[]; | ||
cameras?: ILoaderCamera[]; | ||
images?: ILoaderImage[]; | ||
materials?: ILoaderMaterial[]; | ||
meshes?: ILoaderMesh[]; | ||
nodes?: ILoaderNode[]; | ||
samplers?: ILoaderSampler[]; | ||
scenes?: ILoaderScene[]; | ||
skins?: ILoaderSkin[]; | ||
textures?: ILoaderTexture[]; | ||
} | ||
@@ -1062,22 +941,16 @@ } | ||
class GLTFLoader implements IGLTFLoader { | ||
_gltf: _IGLTF; | ||
_gltf: ILoaderGLTF; | ||
_babylonScene: Scene; | ||
_completePromises: Promise<void>[]; | ||
private _disposed; | ||
private _state; | ||
private _extensions; | ||
private _rootUrl; | ||
private _defaultMaterial; | ||
private _rootBabylonMesh; | ||
private _defaultSampler; | ||
private _rootNode; | ||
private _successCallback?; | ||
private _progressCallback?; | ||
private _errorCallback?; | ||
private _renderReady; | ||
private _requests; | ||
private _renderReadyObservable; | ||
private _renderPendingCount; | ||
private _loaderPendingCount; | ||
private _loaderTrackers; | ||
static Extensions: { | ||
[name: string]: GLTFLoaderExtension; | ||
}; | ||
static RegisterExtension(extension: GLTFLoaderExtension): void; | ||
private static _Names; | ||
private static _Factories; | ||
static _Register(name: string, factory: (loader: GLTFLoader) => GLTFLoaderExtension): void; | ||
coordinateSystemMode: GLTFLoaderCoordinateSystemMode; | ||
@@ -1088,82 +961,71 @@ animationStartMode: GLTFLoaderAnimationStartMode; | ||
compileShadowGenerators: boolean; | ||
onDisposeObservable: Observable<IGLTFLoader>; | ||
onMeshLoadedObservable: Observable<AbstractMesh>; | ||
onTextureLoadedObservable: Observable<BaseTexture>; | ||
onMaterialLoadedObservable: Observable<Material>; | ||
onCompleteObservable: Observable<IGLTFLoader>; | ||
readonly onDisposeObservable: Observable<IGLTFLoader>; | ||
readonly onMeshLoadedObservable: Observable<AbstractMesh>; | ||
readonly onTextureLoadedObservable: Observable<BaseTexture>; | ||
readonly onMaterialLoadedObservable: Observable<Material>; | ||
readonly onExtensionLoadedObservable: Observable<IGLTFLoaderExtension>; | ||
readonly onCompleteObservable: Observable<IGLTFLoader>; | ||
readonly state: Nullable<GLTFLoaderState>; | ||
dispose(): void; | ||
importMeshAsync(meshesNames: any, scene: Scene, data: IGLTFLoaderData, rootUrl: string, onSuccess?: (meshes: AbstractMesh[], particleSystems: ParticleSystem[], skeletons: Skeleton[]) => void, onProgress?: (event: SceneLoaderProgressEvent) => void, onError?: (message: string, exception?: any) => void): void; | ||
loadAsync(scene: Scene, data: IGLTFLoaderData, rootUrl: string, onSuccess?: () => void, onProgress?: (event: SceneLoaderProgressEvent) => void, onError?: (message: string, exception?: any) => void): void; | ||
private _loadAsync(nodeNames, scene, data, rootUrl, onSuccess?, onProgress?, onError?); | ||
private _onProgress(); | ||
_executeWhenRenderReady(func: () => void): void; | ||
private _onRenderReady(); | ||
private _onComplete(); | ||
importMeshAsync(meshesNames: any, scene: Scene, data: IGLTFLoaderData, rootUrl: string, onProgress?: (event: SceneLoaderProgressEvent) => void): Promise<{ | ||
meshes: AbstractMesh[]; | ||
particleSystems: ParticleSystem[]; | ||
skeletons: Skeleton[]; | ||
}>; | ||
loadAsync(scene: Scene, data: IGLTFLoaderData, rootUrl: string, onProgress?: (event: SceneLoaderProgressEvent) => void): Promise<void>; | ||
private _loadAsync(nodes, scene, data, rootUrl, onProgress?); | ||
private _loadExtensions(); | ||
private _loadData(data); | ||
private _setupData(); | ||
private _checkExtensions(); | ||
private _createRootNode(); | ||
private _loadNodesAsync(nodes); | ||
_loadSceneAsync(context: string, scene: ILoaderScene): Promise<void>; | ||
private _getMeshes(); | ||
private _getSkeletons(); | ||
private _startAnimations(); | ||
private _loadDefaultScene(nodeNames); | ||
private _loadScene(context, scene, nodeNames); | ||
_loadNode(context: string, node: IGLTFNode): void; | ||
private _loadMesh(context, node, mesh); | ||
private _loadAllVertexDataAsync(context, mesh, onSuccess); | ||
/** | ||
* Converts a data bufferview into a Float4 Texture Coordinate Array, based on the accessor component type | ||
* @param {ArrayBufferView} data | ||
* @param {IGLTFAccessor} accessor | ||
*/ | ||
private _convertToFloat4TextureCoordArray(context, data, accessor); | ||
/** | ||
* Converts a data bufferview into a Float4 Color Array, based on the accessor component type | ||
* @param {ArrayBufferView} data | ||
* @param {IGLTFAccessor} accessor | ||
*/ | ||
private _convertToFloat4ColorArray(context, data, accessor); | ||
private _loadVertexDataAsync(context, mesh, primitive, onSuccess); | ||
private _createMorphTargets(context, node, mesh); | ||
private _loadMorphTargets(context, node, mesh); | ||
private _loadAllMorphTargetVertexDataAsync(context, node, mesh, onSuccess); | ||
private _loadMorphTargetVertexDataAsync(context, vertexData, attributes, onSuccess); | ||
private _loadTransform(node); | ||
private _loadSkinAsync(context, skin, onSuccess); | ||
_loadNodeAsync(context: string, node: ILoaderNode): Promise<void>; | ||
private _loadMeshAsync(context, node, mesh); | ||
private _loadPrimitiveAsync(context, node, mesh, primitive); | ||
private _loadVertexDataAsync(context, primitive, babylonMesh); | ||
private _createMorphTargets(context, node, mesh, primitive, babylonMesh); | ||
private _loadMorphTargetsAsync(context, primitive, babylonMesh, babylonVertexData); | ||
private _loadMorphTargetVertexDataAsync(context, babylonVertexData, attributes, babylonMorphTarget); | ||
private static _ConvertToFloat32Array(context, accessor, data); | ||
private static _ConvertVec3ToVec4(context, data); | ||
private static _LoadTransform(node, babylonNode); | ||
private _loadSkinAsync(context, node, mesh, skin); | ||
private _loadSkinInverseBindMatricesDataAsync(context, skin); | ||
private _createBone(node, skin, parent, localMatrix, baseMatrix, index); | ||
private _loadBones(context, skin, inverseBindMatrixData); | ||
private _loadBone(node, skin, inverseBindMatrixData, babylonBones); | ||
private _loadBones(context, skin, inverseBindMatricesData); | ||
private _loadBone(node, skin, inverseBindMatricesData, babylonBones); | ||
private _getNodeMatrix(node); | ||
private _traverseNodes(context, indices, action, parentNode); | ||
_traverseNode(context: string, node: IGLTFNode, action: (node: IGLTFNode, parentNode: IGLTFNode) => boolean, parentNode: IGLTFNode): void; | ||
private _loadAnimations(); | ||
private _loadAnimation(context, animation); | ||
private _loadAnimationChannel(animation, channelContext, channel, samplerContext, sampler); | ||
private _loadBufferAsync(context, buffer, onSuccess); | ||
private _loadBufferViewAsync(context, bufferView, onSuccess); | ||
private _loadAccessorAsync(context, accessor, onSuccess); | ||
private _loadAnimationsAsync(); | ||
private _loadAnimationAsync(context, animation); | ||
private _loadAnimationChannelAsync(context, animationContext, animation, channel, babylonAnimationGroup); | ||
private _loadAnimationSamplerAsync(context, sampler); | ||
private _loadBufferAsync(context, buffer); | ||
_loadBufferViewAsync(context: string, bufferView: ILoaderBufferView): Promise<ArrayBufferView>; | ||
private _loadAccessorAsync(context, accessor); | ||
private _buildArrayBuffer<T>(typedArray, data, byteOffset, count, numComponents, byteStride?); | ||
_addPendingData(data: any): void; | ||
_removePendingData(data: any): void; | ||
_addLoaderPendingData(data: any): void; | ||
_removeLoaderPendingData(data: any): void; | ||
_whenAction(action: () => void, onComplete: () => void): void; | ||
private _getDefaultMaterial(); | ||
private _loadMaterialMetallicRoughnessProperties(context, material); | ||
_loadMaterial(context: string, material: IGLTFMaterial, assign: (babylonMaterial: Material, isNew: boolean) => void): void; | ||
_createPbrMaterial(material: IGLTFMaterial): void; | ||
_loadMaterialBaseProperties(context: string, material: IGLTFMaterial): void; | ||
_loadMaterialAlphaProperties(context: string, material: IGLTFMaterial, colorFactor: number[]): void; | ||
_loadTexture(context: string, texture: IGLTFTexture, coordinatesIndex?: number): Texture; | ||
private _loadMaterialMetallicRoughnessPropertiesAsync(context, material); | ||
_loadMaterialAsync(context: string, material: ILoaderMaterial, babylonMesh: Mesh): Promise<void>; | ||
_createMaterial(material: ILoaderMaterial): PBRMaterial; | ||
_loadMaterialBasePropertiesAsync(context: string, material: ILoaderMaterial): Promise<void>; | ||
_loadMaterialAlphaProperties(context: string, material: ILoaderMaterial): void; | ||
_loadTextureAsync(context: string, textureInfo: ITextureInfo, assign: (texture: Texture) => void): Promise<void>; | ||
private _loadSampler(context, sampler); | ||
private _loadImageAsync(context, image, onSuccess); | ||
_loadUriAsync(context: string, uri: string, onSuccess: (data: ArrayBufferView) => void): void; | ||
_tryCatchOnError(handler: () => void): void; | ||
private static _AssignIndices(array?); | ||
static _GetProperty<T extends IGLTFProperty>(array?: ArrayLike<T>, index?: number): Nullable<T>; | ||
private static _GetTextureWrapMode(context, mode?); | ||
private _loadImageAsync(context, image); | ||
_loadUriAsync(context: string, uri: string): Promise<ArrayBufferView>; | ||
private _onProgress(); | ||
static _GetProperty<T>(context: string, array: ArrayLike<T> | undefined, index: number | undefined): T; | ||
private static _GetTextureWrapMode(context, mode); | ||
private static _GetTextureSamplingMode(context, magFilter?, minFilter?); | ||
private static _GetNumComponents(context, type); | ||
private _compileMaterialAsync(babylonMaterial, babylonMesh, onSuccess); | ||
private _compileMaterialsAsync(onSuccess); | ||
private _compileShadowGeneratorsAsync(onSuccess); | ||
private _abortRequests(); | ||
private _releaseResources(); | ||
private static _ValidateUri(uri); | ||
private _compileMaterialsAsync(); | ||
private _compileShadowGeneratorsAsync(); | ||
private _clear(); | ||
_applyExtensions<T>(actionAsync: (extension: GLTFLoaderExtension) => Nullable<Promise<T>>): Nullable<Promise<T>>; | ||
} | ||
@@ -1174,17 +1036,29 @@ } | ||
declare module BABYLON.GLTF2 { | ||
/** | ||
* Utils functions for GLTF | ||
*/ | ||
class GLTFUtils { | ||
/** | ||
* If the uri is a base64 string | ||
* @param uri: the uri to test | ||
*/ | ||
static IsBase64(uri: string): boolean; | ||
/** | ||
* Decode the base64 uri | ||
* @param uri: the uri to decode | ||
*/ | ||
static DecodeBase64(uri: string): ArrayBuffer; | ||
static ValidateUri(uri: string): boolean; | ||
abstract class GLTFLoaderExtension implements IGLTFLoaderExtension { | ||
enabled: boolean; | ||
readonly abstract name: string; | ||
protected _loader: GLTFLoader; | ||
constructor(loader: GLTFLoader); | ||
/** Override this method to modify the default behavior for loading scenes. */ | ||
protected _loadSceneAsync(context: string, node: ILoaderScene): Nullable<Promise<void>>; | ||
/** Override this method to modify the default behavior for loading nodes. */ | ||
protected _loadNodeAsync(context: string, node: ILoaderNode): Nullable<Promise<void>>; | ||
/** Override this method to modify the default behavior for loading mesh primitive vertex data. */ | ||
protected _loadVertexDataAsync(context: string, primitive: ILoaderMeshPrimitive, babylonMesh: Mesh): Nullable<Promise<VertexData>>; | ||
/** Override this method to modify the default behavior for loading materials. */ | ||
protected _loadMaterialAsync(context: string, material: ILoaderMaterial, babylonMesh: Mesh): Nullable<Promise<void>>; | ||
/** Override this method to modify the default behavior for loading uris. */ | ||
protected _loadUriAsync(context: string, uri: string): Nullable<Promise<ArrayBufferView>>; | ||
/** Helper method called by a loader extension to load an glTF extension. */ | ||
protected _loadExtensionAsync<TProperty, TResult = void>(context: string, property: IProperty, actionAsync: (context: string, extension: TProperty) => Promise<TResult>): Nullable<Promise<TResult>>; | ||
/** Helper method called by the loader to allow extensions to override loading scenes. */ | ||
static _LoadSceneAsync(loader: GLTFLoader, context: string, scene: ILoaderScene): Nullable<Promise<void>>; | ||
/** Helper method called by the loader to allow extensions to override loading nodes. */ | ||
static _LoadNodeAsync(loader: GLTFLoader, context: string, node: ILoaderNode): Nullable<Promise<void>>; | ||
/** Helper method called by the loader to allow extensions to override loading mesh primitive vertex data. */ | ||
static _LoadVertexDataAsync(loader: GLTFLoader, context: string, primitive: ILoaderMeshPrimitive, babylonMesh: Mesh): Nullable<Promise<VertexData>>; | ||
/** Helper method called by the loader to allow extensions to override loading materials. */ | ||
static _LoadMaterialAsync(loader: GLTFLoader, context: string, material: ILoaderMaterial, babylonMesh: Mesh): Nullable<Promise<void>>; | ||
/** Helper method called by the loader to allow extensions to override loading uris. */ | ||
static _LoadUriAsync(loader: GLTFLoader, context: string, uri: string): Nullable<Promise<ArrayBufferView>>; | ||
} | ||
@@ -1194,19 +1068,20 @@ } | ||
declare module BABYLON.GLTF2 { | ||
abstract class GLTFLoaderExtension { | ||
enabled: boolean; | ||
readonly abstract name: string; | ||
protected _traverseNode(loader: GLTFLoader, context: string, node: IGLTFNode, action: (node: IGLTFNode, parentNode: IGLTFNode) => boolean, parentNode: IGLTFNode): boolean; | ||
protected _loadNode(loader: GLTFLoader, context: string, node: IGLTFNode): boolean; | ||
protected _loadRoot(loader: GLTFLoader, context: string, root: BABYLON.GLTF2._IGLTF): boolean; | ||
protected _loadScene(loader: GLTFLoader, context: string, scene: IGLTFScene): boolean; | ||
protected _loadMaterial(loader: GLTFLoader, context: string, material: IGLTFMaterial, assign: (babylonMaterial: Material, isNew: boolean) => void): boolean; | ||
protected _loadExtension<T>(context: string, property: IGLTFProperty, action: (context: string, extension: T, onComplete: () => void) => void): boolean; | ||
static _Extensions: GLTFLoaderExtension[]; | ||
static TraverseNode(loader: GLTFLoader, context: string, node: IGLTFNode, action: (node: IGLTFNode, parentNode: IGLTFNode) => boolean, parentNode: IGLTFNode): boolean; | ||
static LoadRoot(loader: GLTFLoader, context: string, root: BABYLON.GLTF2._IGLTF): boolean; | ||
static LoadScene(loader: GLTFLoader, context: string, scene: IGLTFScene): boolean; | ||
static LoadNode(loader: GLTFLoader, context: string, node: IGLTFNode): boolean; | ||
static LoadMaterial(loader: GLTFLoader, context: string, material: IGLTFMaterial, assign: (babylonMaterial: Material, isNew: boolean) => void): boolean; | ||
private static _ApplyExtensions(action); | ||
declare module BABYLON.GLTF2.Extensions { | ||
class MSFT_lod extends GLTFLoaderExtension { | ||
readonly name: string; | ||
/** | ||
* Maximum number of LODs to load, starting from the lowest LOD. | ||
*/ | ||
maxLODsToLoad: number; | ||
private _loadingNodeLOD; | ||
private _loadNodeSignals; | ||
private _loadingMaterialLOD; | ||
private _loadMaterialSignals; | ||
protected _loadNodeAsync(context: string, node: ILoaderNode): Nullable<Promise<void>>; | ||
protected _loadMaterialAsync(context: string, material: ILoaderMaterial, babylonMesh: Mesh): Nullable<Promise<void>>; | ||
protected _loadUriAsync(context: string, uri: string): Nullable<Promise<ArrayBufferView>>; | ||
/** | ||
* Gets an array of LOD properties from lowest to highest. | ||
*/ | ||
private _getLODs<T>(context, property, array, ids); | ||
} | ||
@@ -1217,13 +1092,5 @@ } | ||
declare module BABYLON.GLTF2.Extensions { | ||
class MSFTLOD extends GLTFLoaderExtension { | ||
/** | ||
* Specify the minimal delay between LODs in ms (default = 250) | ||
*/ | ||
Delay: number; | ||
class KHR_draco_mesh_compression extends GLTFLoaderExtension { | ||
readonly name: string; | ||
protected _traverseNode(loader: GLTFLoader, context: string, node: IGLTFNode, action: (node: IGLTFNode, parentNode: IGLTFNode) => boolean, parentNode: IGLTFNode): boolean; | ||
protected _loadNode(loader: GLTFLoader, context: string, node: IGLTFNode): boolean; | ||
private _loadNodeLOD(loader, context, nodes, index, onComplete); | ||
protected _loadMaterial(loader: GLTFLoader, context: string, material: IGLTFMaterial, assign: (babylonMaterial: Material, isNew: boolean) => void): boolean; | ||
private _loadMaterialLOD(loader, context, materials, index, assign, onComplete); | ||
protected _loadVertexDataAsync(context: string, primitive: ILoaderMeshPrimitive, babylonMesh: Mesh): Nullable<Promise<VertexData>>; | ||
} | ||
@@ -1234,6 +1101,6 @@ } | ||
declare module BABYLON.GLTF2.Extensions { | ||
class KHRMaterialsPbrSpecularGlossiness extends GLTFLoaderExtension { | ||
class KHR_materials_pbrSpecularGlossiness extends GLTFLoaderExtension { | ||
readonly name: string; | ||
protected _loadMaterial(loader: GLTFLoader, context: string, material: IGLTFMaterial, assign: (babylonMaterial: Material, isNew: boolean) => void): boolean; | ||
private _loadSpecularGlossinessProperties(loader, context, material, properties); | ||
protected _loadMaterialAsync(context: string, material: ILoaderMaterial, babylonMesh: Mesh): Nullable<Promise<void>>; | ||
private _loadSpecularGlossinessPropertiesAsync(loader, context, material, properties); | ||
} | ||
@@ -1244,9 +1111,8 @@ } | ||
declare module BABYLON.GLTF2.Extensions { | ||
class KHRLights extends GLTFLoaderExtension { | ||
class KHR_lights extends GLTFLoaderExtension { | ||
readonly name: string; | ||
private applyCommonProperties(light, lightInfo); | ||
protected _loadScene(loader: GLTFLoader, context: string, scene: IGLTFScene): boolean; | ||
protected _loadNode(loader: GLTFLoader, context: string, node: IGLTFNode): boolean; | ||
protected _loadRoot(loader: GLTFLoader, context: string, root: BABYLON.GLTF2._IGLTF): boolean; | ||
protected _loadSceneAsync(context: string, scene: ILoaderScene): Nullable<Promise<void>>; | ||
protected _loadNodeAsync(context: string, node: ILoaderNode): Nullable<Promise<void>>; | ||
private readonly _lights; | ||
} | ||
} |
@@ -7,3 +7,3 @@ { | ||
"description": "The Babylon.js file loaders library is an extension you can use to load different 3D file types into a Babylon scene.", | ||
"version": "3.2.0-alpha7", | ||
"version": "3.2.0-alpha8", | ||
"repository": { | ||
@@ -10,0 +10,0 @@ "type": "git", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
420209
6709