OBJFileLoader

OBJ file type loader. This is a babylon scene loader plugin.

Hierarchy

  • OBJFileLoader

Implements

Index

Constructors

constructor

Find examples in Playground
  • Creates loader for .OBJ files

    Parameters

    • Optional meshLoadOptions: MeshLoadOptions

      options for loading and parsing OBJ/MTL files.

    Returns OBJFileLoader

Properties

extensions

Find examples in Playground
extensions: string

Defines the extension the plugin is able to load.

name

Find examples in Playground
name: string

Defines the name of the plugin.

Static COMPUTE_NORMALS

Find examples in Playground
COMPUTE_NORMALS: boolean

Compute the normals for the model, even if normals are present in the file.

Static IMPORT_VERTEX_COLORS

Find examples in Playground
IMPORT_VERTEX_COLORS: boolean

Include in meshes the vertex colors available in some OBJ files. This is not part of OBJ standard.

Static INVERT_TEXTURE_Y

Find examples in Playground
INVERT_TEXTURE_Y: boolean

Invert Y-Axis of referenced textures on load

Static INVERT_Y

Find examples in Playground
INVERT_Y: boolean

Invert model on y-axis (does a model scaling inversion)

Static MATERIAL_LOADING_FAILS_SILENTLY

Find examples in Playground
MATERIAL_LOADING_FAILS_SILENTLY: boolean

When a material fails to load OBJ loader will silently fail and onSuccess() callback will be triggered.

Defaults to true for backwards compatibility.

Static OPTIMIZE_WITH_UV

Find examples in Playground
OPTIMIZE_WITH_UV: boolean

Defines if UVs are optimized by default during load.

Static SKIP_MATERIALS

Find examples in Playground
SKIP_MATERIALS: boolean

Skip loading the materials even if defined in the OBJ file (materials are ignored).

Static UV_SCALING

Find examples in Playground
UV_SCALING: Vector2

Defines custom scaling of UV coordinates of loaded meshes.

Methods

canDirectLoad

Find examples in Playground
  • canDirectLoad(data: string): boolean
  • If the data string can be loaded directly.

    Parameters

    • data: string

      string containing the file data

    Returns boolean

    if the data can be loaded directly

createPlugin

Find examples in Playground

importMeshAsync

Find examples in Playground
  • importMeshAsync(meshesNames: any, scene: Scene, data: any, rootUrl: string, onProgress?: function, fileName?: string): Promise<object>
  • 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

    • Optional onProgress: function

      event that fires when loading progress has occured

    • Optional fileName: string

      Defines the name of the file to load

    Returns Promise<object>

    a promise containg the loaded meshes, particles, skeletons and animations

loadAssetContainerAsync

Find examples in Playground
  • loadAssetContainerAsync(scene: Scene, data: string, rootUrl: string, onProgress?: function, fileName?: string): Promise<AssetContainer>
  • Load into an asset container.

    Parameters

    • scene: Scene

      The scene to load into

    • data: string

      The data to import

    • rootUrl: string

      The root url for scene and resources

    • Optional onProgress: function

      The callback when the load progresses

    • Optional fileName: string

      Defines the name of the file to load

    Returns Promise<AssetContainer>

    The loaded asset container

loadAsync

Find examples in Playground
  • loadAsync(scene: Scene, data: string, rootUrl: string, onProgress?: function, fileName?: string): Promise<void>
  • 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

      the OBJ data to load

    • rootUrl: string

      root url to load from

    • Optional onProgress: function

      event that fires when loading progress has occured

    • Optional fileName: string

      Defines the name of the file to load

    Returns Promise<void>

    a promise which completes when objects have been loaded to the scene

Generated using TypeDoc