Class: OBJLoader2

OBJLoader2


new OBJLoader2( [manager], logger)

Use this class to load OBJ data from files or to parse OBJ data from an arraybuffer

Parameters:
Name Type Argument Description
manager THREE.DefaultLoadingManager <optional>

The loadingManager for the loader to use. Default is THREE.DefaultLoadingManager

logger THREE.LoaderSupport.ConsoleLogger

logger to be used

Methods


<static> OBJLoader2#_loadMtl(resource, callbackOnLoad [, crossOrigin])

Utility method for loading an mtl file according resource description.

Parameters:
Name Type Argument Description
resource THREE.LoaderSupport.ResourceDescriptor
callbackOnLoad function
crossOrigin string <optional>

CORS value


<static> OBJLoader2#load(url, onLoad [, onProgress] [, onError] [, onMeshAlter] [, useAsync])

Use this convenient method to load an OBJ file at the given URL. By default the fileLoader uses an arraybuffer.

Parameters:
Name Type Argument Description
url string

A string containing the path/URL of the .obj file.

onLoad callback

A function to be called after loading is successfully completed. The function receives loaded Object3D as an argument.

onProgress callback <optional>

A function to be called while the loading is in progress. The argument will be the XMLHttpRequest instance, which contains total and Integer bytes.

onError callback <optional>

A function to be called if an error occurs during loading. The function receives the error as an argument.

onMeshAlter callback <optional>

A function to be called after a new mesh raw data becomes available for alteration.

useAsync boolean <optional>

If true, uses async loading with worker, if false loads data synchronously.


<static> OBJLoader2#loadMtl(url, name, content, callbackOnLoad [, crossOrigin])

Utility method for loading an mtl file according resource description.

Parameters:
Name Type Argument Description
url string

URL to the file

name string

The name of the object

content Object

The file content as arraybuffer or text

callbackOnLoad function
crossOrigin string <optional>

CORS value


<static> OBJLoader2#parse(content)

Parses OBJ data synchronously from arraybuffer or string.

Parameters:
Name Type Description
content arraybuffer | string

OBJ data as Uint8Array or String


<static> OBJLoader2#parseAsync(content, onLoad)

Parses OBJ content asynchronously from arraybuffer.

Parameters:
Name Type Description
content arraybuffer

OBJ data as Uint8Array

onLoad callback

Called after worker successfully completed loading


<static> OBJLoader2#run(prepData [, workerSupportExternal])

Run the loader according the provided instructions.

Parameters:
Name Type Argument Description
prepData THREE.LoaderSupport.PrepData

All parameters and resources required for execution

workerSupportExternal THREE.LoaderSupport.WorkerSupport <optional>

Use pre-existing WorkerSupport


<static> OBJLoader2#setMaterialPerSmoothingGroup(materialPerSmoothingGroup)

Tells whether a material shall be created per smoothing group.

Parameters:
Name Type Default Description
materialPerSmoothingGroup boolean false