Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

babylonjs-loaders

Package Overview
Dependencies
Maintainers
1
Versions
630
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babylonjs-loaders - npm Package Compare versions

Comparing version 3.2.0-beta.4 to 3.2.0-beta.5

395

babylonjs.loaders.module.d.ts

@@ -58,2 +58,3 @@ /// <reference types="babylonjs"/>

static OPTIMIZE_WITH_UV: boolean;
static INVERT_Y: boolean;
name: string;

@@ -106,2 +107,5 @@ extensions: string;

declare module BABYLON {
/**
* Coordinate system mode that will be used when loading from the gltf file
*/
enum GLTFLoaderCoordinateSystemMode {

@@ -117,2 +121,5 @@ /**

}
/**
* Animation mode that determines which animations should be started when a file is loaded
*/
enum GLTFLoaderAnimationStartMode {

@@ -132,6 +139,18 @@ /**

}
/**
* Loaded gltf data
*/
interface IGLTFLoaderData {
/**
* Loaded json string converted to an object
*/
json: Object;
/**
* Loaded ArrayBufferView
*/
bin: Nullable<ArrayBufferView>;
}
/**
* Gltf extension interface
*/
interface IGLTFLoaderExtension {

@@ -147,20 +166,74 @@ /**

}
/**
* Loading state
*/
enum GLTFLoaderState {
Loading = 0,
Ready = 1,
Complete = 2,
/**
* The asset is loading.
*/
LOADING = 0,
/**
* The asset is ready for rendering.
*/
READY = 1,
/**
* The asset is completely loaded.
*/
COMPLETE = 2,
}
/**
* GLTF loader interface
*/
interface IGLTFLoader extends IDisposable {
/**
* Coordinate system that will be used when loading from the gltf file
*/
coordinateSystemMode: GLTFLoaderCoordinateSystemMode;
/**
* Animation mode that determines which animations should be started when a file is loaded
*/
animationStartMode: GLTFLoaderAnimationStartMode;
/**
* If the materials in the file should automatically be compiled
*/
compileMaterials: boolean;
/**
* If a clip plane should be usede when loading meshes in the file
*/
useClipPlane: boolean;
/**
* If shadow generators should automatically be compiled
*/
compileShadowGenerators: boolean;
/**
* Observable that fires each time a mesh is loaded
*/
onMeshLoadedObservable: Observable<AbstractMesh>;
/**
* Observable that fires each time a texture is loaded
*/
onTextureLoadedObservable: Observable<BaseTexture>;
/**
* Observable that fires each time a material is loaded
*/
onMaterialLoadedObservable: Observable<Material>;
/**
* Observable that fires when the load has completed
*/
onCompleteObservable: Observable<IGLTFLoader>;
/**
* Observable that fires when the loader is disposed
*/
onDisposeObservable: Observable<IGLTFLoader>;
/**
* Observable that fire when an extension is loaded
*/
onExtensionLoadedObservable: Observable<IGLTFLoaderExtension>;
/**
* Loader state
*/
state: Nullable<GLTFLoaderState>;
/**
* Imports one or more meshes from a loaded gltf file and adds them to the scene
*/
importMeshAsync: (meshesNames: any, scene: Scene, data: IGLTFLoaderData, rootUrl: string, onProgress?: (event: SceneLoaderProgressEvent) => void) => Promise<{

@@ -172,6 +245,12 @@ meshes: AbstractMesh[];

}>;
/**
* Imports all objects from a loaded gltf file and adds them to the scene
*/
loadAsync: (scene: Scene, data: IGLTFLoaderData, rootUrl: string, onProgress?: (event: SceneLoaderProgressEvent) => void) => Promise<void>;
}
/** File loader to load gltf files into a babylon scene */
class GLTFFileLoader implements IDisposable, ISceneLoaderPluginAsync, ISceneLoaderPluginFactory {
/** Creates a gltf 1.0 file loader */
static CreateGLTFLoaderV1: () => IGLTFLoader;
/** Creates a gltf 2.0 file loader */
static CreateGLTFLoaderV2: () => IGLTFLoader;

@@ -185,23 +264,35 @@ /**

private _onParsedObserver;
/** Raised when the asset has been parsed. */
onParsed: (loaderData: IGLTFLoaderData) => void;
/**
* Set this property to false to disable incremental loading which delays the loader from calling the success callback until after loading the meshes and shaders. Textures always loads asynchronously. For example, the success callback can compute the bounding information of the loaded meshes when incremental loading is disabled. Defaults to true.
*/
static IncrementalLoading: boolean;
/**
* Set this property to true in order to work with homogeneous coordinates, available with some converters and exporters. Defaults to false. See https://en.wikipedia.org/wiki/Homogeneous_coordinates
*/
static HomogeneousCoordinates: boolean;
/**
* The coordinate system mode (AUTO, FORCE_RIGHT_HANDED).
* The coordinate system mode (AUTO, FORCE_RIGHT_HANDED). Defaults to AUTO.
* - AUTO - Automatically convert the glTF right-handed data to the appropriate system based on the current coordinate system mode of the scene.
* - FORCE_RIGHT_HANDED - Sets the useRightHandedSystem flag on the scene.
*/
coordinateSystemMode: GLTFLoaderCoordinateSystemMode;
/**
* The animation start mode (NONE, FIRST, ALL).
*/
* The animation start mode (NONE, FIRST, ALL). Defaults to FIRST.
* - NONE - No animation will start.
* - FIRST - The first animation will start.
* - ALL - All animations will start.
*/
animationStartMode: GLTFLoaderAnimationStartMode;
/**
* Set to true to compile materials before raising the success callback.
* Set to true to compile materials before raising the success callback. Defaults to false.
*/
compileMaterials: boolean;
/**
* Set to true to also compile materials with clip planes.
* Set to true to also compile materials with clip planes. Defaults to false.
*/
useClipPlane: boolean;
/**
* Set to true to compile shadow generators before raising the success callback.
* Set to true to compile shadow generators before raising the success callback. Defaults to false.
*/

@@ -214,2 +305,5 @@ compileShadowGenerators: boolean;

private _onMeshLoadedObserver;
/**
* Raised when the loader creates a mesh after parsing the glTF properties of the mesh. (onMeshLoadedObservable is likely desired instead.)
*/
onMeshLoaded: (mesh: AbstractMesh) => void;

@@ -221,2 +315,5 @@ /**

private _onTextureLoadedObserver;
/**
* Method called when a texture has been loaded (onTextureLoadedObservable is likely desired instead.)
*/
onTextureLoaded: (texture: BaseTexture) => void;

@@ -228,2 +325,5 @@ /**

private _onMaterialLoadedObserver;
/**
* Method when the loader creates a material after parsing the glTF properties of the material. (onMaterialLoadedObservable is likely desired instead.)
*/
onMaterialLoaded: (material: Material) => void;

@@ -233,12 +333,18 @@ /**

* For assets with LODs, raised when all of the LODs are complete.
* For assets without LODs, raised when the model is complete, immediately after onSuccess.
* For assets without LODs, raised when the model is complete, immediately after the loader resolves the returned promise.
*/
readonly onCompleteObservable: Observable<GLTFFileLoader>;
private _onCompleteObserver;
/**
* Raised when the asset is completely loaded, immediately before the loader is disposed. (onCompleteObservable is likely desired instead.)
*/
onComplete: () => void;
/**
* Raised when the loader is disposed.
* Raised after the loader is disposed.
*/
readonly onDisposeObservable: Observable<GLTFFileLoader>;
private _onDisposeObserver;
/**
* Raised after the loader is disposed. (onDisposeObservable is likely desired instead.)
*/
onDispose: () => void;

@@ -251,5 +357,8 @@ /**

private _onExtensionLoadedObserver;
/**
* Raised after a loader extension is created. (onExtensionLoadedObservable is likely desired instead.)
*/
onExtensionLoaded: (extension: IGLTFLoaderExtension) => void;
/**
* Gets a promise that resolves when the asset is completely loaded.
* Returns a promise that resolves when the asset is completely loaded.
* @returns A promise that resolves when the asset is completely loaded.

@@ -259,7 +368,13 @@ */

/**
* The loader state or null if not active.
* The loader state (LOADING, READY, COMPLETE) or null if the loader is not active.
*/
readonly loaderState: Nullable<GLTFLoaderState>;
private _loader;
/**
* Name of the loader ("gltf")
*/
name: string;
/**
* Supported file extensions of the loader (.gltf, .glb)
*/
extensions: ISceneLoaderPluginExtensions;

@@ -270,2 +385,11 @@ /**

dispose(): void;
/**
* Imports one or more meshes from a loaded gltf file and adds them to the scene
* @param meshesNames a string or array of strings of the mesh names that should be loaded from the file
* @param scene the scene the meshes should be added to
* @param data gltf data containing information of the meshes in a loaded file
* @param rootUrl root url to load from
* @param onProgress event that fires when loading progress has occured
* @returns a promise containg the loaded meshes, particles, skeletons and animations
*/
importMeshAsync(meshesNames: any, scene: Scene, data: any, rootUrl: string, onProgress?: (event: SceneLoaderProgressEvent) => void): Promise<{

@@ -277,6 +401,34 @@ meshes: AbstractMesh[];

}>;
/**
* Imports all objects from a loaded gltf file and adds them to the scene
* @param scene the scene the objects should be added to
* @param data gltf data containing information of the meshes in a loaded file
* @param rootUrl root url to load from
* @param onProgress event that fires when loading progress has occured
* @returns a promise which completes when objects have been loaded to the scene
*/
loadAsync(scene: Scene, data: string | ArrayBuffer, rootUrl: string, onProgress?: (event: SceneLoaderProgressEvent) => void): Promise<void>;
/**
* Load into an asset container.
* @param scene The scene to load into
* @param data The data to import
* @param rootUrl The root url for scene and resources
* @param onProgress The callback when the load progresses
* @returns The loaded asset container
*/
loadAssetContainerAsync(scene: Scene, data: string | ArrayBuffer, rootUrl: string, onProgress?: (event: SceneLoaderProgressEvent) => void): Promise<AssetContainer>;
/**
* If the data string can be loaded directly
* @param data string contianing the file data
* @returns if the data can be loaded directly
*/
canDirectLoad(data: string): boolean;
/**
* Rewrites a url by combining a root url and response url
*/
rewriteRootURL: (rootUrl: string, responseURL?: string) => string;
/**
* Instantiates a gltf file loader plugin
* @returns the created plugin
*/
createPlugin(): ISceneLoaderPlugin | ISceneLoaderPluginAsync;

@@ -698,5 +850,17 @@ private _parse(data);

onExtensionLoadedObservable: Observable<IGLTFLoaderExtension>;
/**
* State of the loader
*/
state: Nullable<GLTFLoaderState>;
dispose(): void;
private _importMeshAsync(meshesNames, scene, data, rootUrl, onSuccess, onProgress?, onError?);
/**
* Imports one or more meshes from a loaded gltf file and adds them to the scene
* @param meshesNames a string or array of strings of the mesh names that should be loaded from the file
* @param scene the scene the meshes should be added to
* @param data gltf data containing information of the meshes in a loaded file
* @param rootUrl root url to load from
* @param onProgress event that fires when loading progress has occured
* @returns a promise containg the loaded meshes, particles, skeletons and animations
*/
importMeshAsync(meshesNames: any, scene: Scene, data: IGLTFLoaderData, rootUrl: string, onProgress?: (event: SceneLoaderProgressEvent) => void): Promise<{

@@ -709,2 +873,10 @@ meshes: AbstractMesh[];

private _loadAsync(scene, data, rootUrl, onSuccess, onProgress?, onError?);
/**
* Imports all objects from a loaded gltf file and adds them to the scene
* @param scene the scene the objects should be added to
* @param data gltf data containing information of the meshes in a loaded file
* @param rootUrl root url to load from
* @param onProgress event that fires when loading progress has occured
* @returns a promise which completes when objects have been loaded to the scene
*/
loadAsync(scene: Scene, data: IGLTFLoaderData, rootUrl: string, onProgress?: (event: SceneLoaderProgressEvent) => void): Promise<void>;

@@ -854,15 +1026,11 @@ private _loadShadersAsync(gltfRuntime, onload);

declare module BABYLON.GLTF2 {
/** Array item which contains it's index in an array */
interface IArrayItem {
_index: number;
}
/** Array item helper methods */
class ArrayItem {
/** Sets the index of each array element to its index in the array */
static Assign(values?: IArrayItem[]): void;
}
class AnimationMultiTarget {
subTargets: any[];
position: Vector3;
rotationQuaternion: Quaternion;
scaling: Vector3;
influence: number;
}
}

@@ -872,3 +1040,9 @@

/**
* GLTF2 module for babylon
*/
declare module BABYLON.GLTF2 {
/**
* Interface to access data and vertex buffer associated with a file
*/
interface ILoaderAccessor extends IAccessor, IArrayItem {

@@ -878,4 +1052,10 @@ _data?: Promise<ArrayBufferView>;

}
/**
* Loader's animation channel
*/
interface ILoaderAnimationChannel extends IAnimationChannel, IArrayItem {
}
/**
* Container for animation keyframe data
*/
interface ILoaderAnimationSamplerData {

@@ -886,5 +1066,11 @@ input: Float32Array;

}
/**
* Keyframe data
*/
interface ILoaderAnimationSampler extends IAnimationSampler, IArrayItem {
_data: Promise<ILoaderAnimationSamplerData>;
}
/**
* Loader animation
*/
interface ILoaderAnimation extends IAnimation, IArrayItem {

@@ -895,5 +1081,11 @@ channels: ILoaderAnimationChannel[];

}
/**
* Loader buffer
*/
interface ILoaderBuffer extends IBuffer, IArrayItem {
_data?: Promise<ArrayBufferView>;
}
/**
* Loader's buffer data
*/
interface ILoaderBufferView extends IBufferView, IArrayItem {

@@ -903,7 +1095,16 @@ _data?: Promise<ArrayBufferView>;

}
/**
* Loader's loaded camera data
*/
interface ILoaderCamera extends ICamera, IArrayItem {
}
/**
* Loaded image specified by url
*/
interface ILoaderImage extends IImage, IArrayItem {
_objectURL?: Promise<string>;
}
/**
* Loaded material data
*/
interface ILoaderMaterial extends IMaterial, IArrayItem {

@@ -918,7 +1119,16 @@ _babylonData?: {

}
/**
* Loader mesh data
*/
interface ILoaderMesh extends IMesh, IArrayItem {
primitives: ILoaderMeshPrimitive[];
}
/**
* Loader mesh data
*/
interface ILoaderMeshPrimitive extends IMeshPrimitive, IArrayItem {
}
/**
* Node for traversing loader data
*/
interface ILoaderNode extends INode, IArrayItem {

@@ -931,2 +1141,5 @@ _parent: ILoaderNode;

}
/**
* Sampler data
*/
interface ILoaderSamplerData {

@@ -938,7 +1151,16 @@ noMipMaps: boolean;

}
/**
* Sampler data
*/
interface ILoaderSampler extends ISampler, IArrayItem {
_data?: ILoaderSamplerData;
}
/**
* Loader's scene
*/
interface ILoaderScene extends IScene, IArrayItem {
}
/**
* Loader's skeleton data
*/
interface ILoaderSkin extends ISkin, IArrayItem {

@@ -948,4 +1170,10 @@ _babylonSkeleton?: Skeleton;

}
/**
* Loader's texture
*/
interface ILoaderTexture extends ITexture, IArrayItem {
}
/**
* Loaded GLTF data
*/
interface ILoaderGLTF extends IGLTF {

@@ -969,10 +1197,36 @@ accessors?: ILoaderAccessor[];

/**
* Defines the GLTF2 module used to import/export GLTF 2.0 files
*/
declare module BABYLON.GLTF2 {
/**
* Interface for a meterial with a constructor
*/
interface MaterialConstructor<T extends Material> {
/**
* The material class
*/
readonly prototype: T;
/**
* Instatiates a material
* @param name name of the material
* @param scene the scene the material will be added to
*/
new (name: string, scene: Scene): T;
}
/**
* Used to load from a GLTF2 file
*/
class GLTFLoader implements IGLTFLoader {
/**
* @ignore
*/
_gltf: ILoaderGLTF;
/**
* @ignore
*/
_babylonScene: Scene;
/**
* @ignore
*/
_completePromises: Promise<void>[];

@@ -990,16 +1244,69 @@ private _disposed;

private static _Factories;
/**
* @ignore, registers the loader
* @param name name of the loader
* @param factory function that converts a loader to a loader extension
*/
static _Register(name: string, factory: (loader: GLTFLoader) => GLTFLoaderExtension): void;
/**
* Coordinate system that will be used when loading from the gltf file
*/
coordinateSystemMode: GLTFLoaderCoordinateSystemMode;
/**
* Animation mode that determines which animations should be started when a file is loaded
*/
animationStartMode: GLTFLoaderAnimationStartMode;
/**
* If the materials in the file should automatically be compiled
*/
compileMaterials: boolean;
/**
* If a clip plane should be usede when loading meshes in the file
*/
useClipPlane: boolean;
/**
* If shadow generators should automatically be compiled
*/
compileShadowGenerators: boolean;
/**
* Observable that fires when the loader is disposed
*/
readonly onDisposeObservable: Observable<IGLTFLoader>;
/**
* Observable that fires each time a mesh is loaded
*/
readonly onMeshLoadedObservable: Observable<AbstractMesh>;
/**
* Observable that fires each time a texture is loaded
*/
readonly onTextureLoadedObservable: Observable<BaseTexture>;
/**
* Observable that fires each time a material is loaded
*/
readonly onMaterialLoadedObservable: Observable<Material>;
/**
* Observable that fires each time an extension is loaded
*/
readonly onExtensionLoadedObservable: Observable<IGLTFLoaderExtension>;
/**
* Observable that fires when the load has completed
*/
readonly onCompleteObservable: Observable<IGLTFLoader>;
/**
* The current state of the loader
*/
readonly state: Nullable<GLTFLoaderState>;
/**
* Disposes of the loader
*/
dispose(): void;
/**
* Imports one or more meshes from a loaded gltf file and adds them to the scene
* @param meshesNames a string or array of strings of the mesh names that should be loaded from the file
* @param scene the scene the meshes should be added to
* @param data gltf data containing information of the meshes in a loaded file
* @param rootUrl root url to load from
* @param onProgress event that fires when loading progress has occured
* @returns a promise containg the loaded meshes, particles, skeletons and animations
*/
importMeshAsync(meshesNames: any, scene: Scene, data: IGLTFLoaderData, rootUrl: string, onProgress?: (event: SceneLoaderProgressEvent) => void): Promise<{

@@ -1011,2 +1318,10 @@ meshes: AbstractMesh[];

}>;
/**
* Imports all objects from a loaded gltf file and adds them to the scene
* @param scene the scene the objects should be added to
* @param data gltf data containing information of the meshes in a loaded file
* @param rootUrl root url to load from
* @param onProgress event that fires when loading progress has occured
* @returns a promise which completes when objects have been loaded to the scene
*/
loadAsync(scene: Scene, data: IGLTFLoaderData, rootUrl: string, onProgress?: (event: SceneLoaderProgressEvent) => void): Promise<void>;

@@ -1020,2 +1335,5 @@ private _loadAsync(nodes, scene, data, rootUrl, onProgress?);

private _loadNodesAsync(nodes);
/**
* @ignore
*/
_loadSceneAsync(context: string, scene: ILoaderScene): Promise<void>;

@@ -1027,2 +1345,5 @@ private _forEachPrimitive(node, callback);

private _startAnimations();
/**
* @ignore
*/
_loadNodeAsync(context: string, node: ILoaderNode): Promise<void>;

@@ -1047,4 +1368,10 @@ private _loadMeshAsync(context, node, mesh, babylonMesh);

private _loadBufferAsync(context, buffer);
/**
* @ignore
*/
_loadBufferViewAsync(context: string, bufferView: ILoaderBufferView): Promise<ArrayBufferView>;
private _loadAccessorAsync(context, accessor);
/**
* @ignore
*/
_loadVertexBufferViewAsync(context: string, bufferView: ILoaderBufferView, kind: string): Promise<Buffer>;

@@ -1054,11 +1381,32 @@ private _loadVertexAccessorAsync(context, accessor, kind);

private _loadMaterialMetallicRoughnessPropertiesAsync(context, material, babylonMaterial);
/**
* @ignore
*/
_loadMaterialAsync(context: string, material: ILoaderMaterial, babylonMesh: Mesh, babylonDrawMode: number, assign: (babylonMaterial: Material) => void): Promise<void>;
/**
* @ignore
*/
_createMaterial<T extends Material>(type: MaterialConstructor<T>, name: string, drawMode: number): T;
/**
* @ignore
*/
_loadMaterialBasePropertiesAsync(context: string, material: ILoaderMaterial, babylonMaterial: PBRMaterial): Promise<void>;
/**
* @ignore
*/
_loadMaterialAlphaProperties(context: string, material: ILoaderMaterial, babylonMaterial: PBRMaterial): void;
/**
* @ignore
*/
_loadTextureAsync(context: string, textureInfo: ITextureInfo, assign: (texture: Texture) => void): Promise<void>;
private _loadSampler(context, sampler);
private _loadImageAsync(context, image);
/**
* @ignore
*/
_loadUriAsync(context: string, uri: string): Promise<ArrayBufferView>;
private _onProgress();
/**
* @ignore
*/
static _GetProperty<T>(context: string, array: ArrayLike<T> | undefined, index: number | undefined): T;

@@ -1073,2 +1421,5 @@ private static _GetTextureWrapMode(context, mode);

private _clear();
/**
* @ignore
*/
_applyExtensions<T>(actionAsync: (extension: GLTFLoaderExtension) => Nullable<Promise<T>>): Nullable<Promise<T>>;

@@ -1080,2 +1431,5 @@ }

declare module BABYLON.GLTF2 {
/**
* Abstract class that can be implemented to extend existing gltf loader behavior.
*/
abstract class GLTFLoaderExtension implements IGLTFLoaderExtension, IDisposable {

@@ -1135,2 +1489,3 @@ enabled: boolean;

/** Module defining extensions to gltf */
declare module BABYLON.GLTF2.Extensions {

@@ -1137,0 +1492,0 @@ class KHR_draco_mesh_compression extends GLTFLoaderExtension {

4

package.json

@@ -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-beta.4",
"version": "3.2.0-beta.5",
"repository": {

@@ -31,3 +31,3 @@ "type": "git",

"dependencies": {
"babylonjs-gltf2interface": "3.2.0-beta.4"
"babylonjs-gltf2interface": "3.2.0-beta.5"
},

@@ -34,0 +34,0 @@ "peerDependencies": {

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc