Class OBJFileLoader
Implements
Constructors
constructor
-
Creates loader for .OBJ files
Parameters
OptionalloadingOptions: Partial<Readonly<OBJLoadingOptions>>options for loading and parsing OBJ/MTL files.
Returns OBJFileLoader
Properties
Readonlyextensions
Defines the extension the plugin is able to load.
Readonlyname
Defines the name of the plugin.
StaticCOMPUTE_ NORMALS
Compute the normals for the model, even if normals are present in the file.
StaticENCODING
Defines the character encoding used to decode OBJ and MTL files.
StaticIMPORT_ VERTEX_ COLORS
Include in meshes the vertex colors available in some OBJ files. This is not part of OBJ standard.
StaticINVERT_ Y
Invert model on y-axis (does a model scaling inversion)
StaticMATERIAL_ LOADING_ FAILS_ SILENTLY
When a material fails to load OBJ loader will silently fail and onSuccess() callback will be triggered.
Defaults to true for backwards compatibility.
StaticOPTIMIZE_ NORMALS
Optimize the normals for the model. Lighting can be uneven if you use OptimizeWithUV = true because new vertices can be created for the same location if they pertain to different faces. Using OptimizehNormals = true will help smoothing the lighting by averaging the normals of those vertices.
StaticOPTIMIZE_ WITH_ UV
Defines if UVs are optimized by default during load.
StaticSKIP_ MATERIALS
Skip loading the materials even if defined in the OBJ file (materials are ignored).
StaticUSE_ LEGACY_ BEHAVIOR
Loads assets without handedness conversions. This flag is for compatibility. Use it only if absolutely required. Defaults to false.
StaticUV_ SCALING
Defines custom scaling of UV coordinates of loaded meshes.
StaticWAIT_ FOR_ TEXTURES
Wait for referenced textures to finish loading before completing the OBJ load. Defaults to false for backwards compatibility.
Accessors
StaticINVERT_ TEXTURE_ Y
-
get INVERT_TEXTURE_Y(): boolean
Invert Y-Axis of referenced textures on load
Returns boolean
-
set INVERT_TEXTURE_Y(value: boolean): void
Parameters
- value: boolean
Returns void
Methods
can Direct Load
-
If the data string can be loaded directly.
Returns boolean
if the data can be loaded directly
import Mesh Async
-
importMeshAsync(
meshesNames: any,
scene: Scene,
data: any,
rootUrl: string,
): Promise<ISceneLoaderAsyncResult>Imports one or more meshes from the loaded OBJ data and adds them to the scene
Parameters
- meshesNames: any
a string or array of strings of the mesh names that should be loaded from the file
- scene: Scene
the scene the meshes should be added to
- data: any
the OBJ data to load
- rootUrl: string
root url to load from
Returns Promise<ISceneLoaderAsyncResult>
a promise containing the loaded meshes, particles, skeletons and animations
- meshesNames: any
load Asset Container Async
-
loadAssetContainerAsync(
scene: Scene,
data: string | ArrayBuffer,
rootUrl: string,
): Promise<AssetContainer>Load into an asset container.
Parameters
- scene: Scene
The scene to load into
- data: string | ArrayBuffer
The data to import
- rootUrl: string
The root url for scene and resources
Returns Promise<AssetContainer>
The loaded asset container
- scene: Scene
load Async
-
Imports all objects from the loaded OBJ data and adds them to the scene
Parameters
- scene: Scene
the scene the objects should be added to
- data: string | ArrayBuffer
the OBJ data to load
- rootUrl: string
root url to load from
Returns Promise<void>
a promise which completes when objects have been loaded to the scene
- scene: Scene
OBJ file type loader. This is a babylon scene loader plugin.