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 resourceTHREE.LoaderSupport.ResourceDescriptor callbackOnLoadfunction crossOriginstring <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 urlstring A string containing the path/URL of the .obj file.
onLoadcallback A function to be called after loading is successfully completed. The function receives loaded Object3D as an argument.
onProgresscallback <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.
onErrorcallback <optional>
A function to be called if an error occurs during loading. The function receives the error as an argument.
onMeshAltercallback <optional>
A function to be called after a new mesh raw data becomes available for alteration.
useAsyncboolean <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 urlstring URL to the file
namestring The name of the object
contentObject The file content as arraybuffer or text
callbackOnLoadfunction crossOriginstring <optional>
CORS value
-
<static> OBJLoader2#parse(content)
-
Parses OBJ data synchronously from arraybuffer or string.
Parameters:
Name Type Description contentarraybuffer | string OBJ data as Uint8Array or String
-
<static> OBJLoader2#parseAsync(content, onLoad)
-
Parses OBJ content asynchronously from arraybuffer.
Parameters:
Name Type Description contentarraybuffer OBJ data as Uint8Array
onLoadcallback Called after worker successfully completed loading
-
<static> OBJLoader2#run(prepData [, workerSupportExternal])
-
Run the loader according the provided instructions.
Parameters:
Name Type Argument Description prepDataTHREE.LoaderSupport.PrepData All parameters and resources required for execution
workerSupportExternalTHREE.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 materialPerSmoothingGroupboolean false