Menu - Top - Home - Donate to Me

H3DU.ObjData

Back to documentation index.

H3DU.ObjData()

WaveFront OBJ format.

This class is considered a supplementary class to the Public Domain HTML 3D Library and is not considered part of that library.

To use this class, you must include the script "extras/objmtl.js"; the class is not included in the "h3du_min.js" file which makes up the HTML 3D Library. Example:

<script type="text/javascript" src="extras/objmtl.js"></script>

Members

Methods

H3DU.ObjData#mtllib

Deprecated: This property is not meant to be public.

An array of meshes. Two or more meshes may have the same name (the "name" property in each mesh). The "data" property holds data for each mesh.

H3DU.ObjData#url

URL of the OBJ file.

(static) H3DU.ObjData.loadMtlFromUrl(url)

Loads a material (MTL) file asynchronously.

Parameters

Return Value

A promise that resolves when the MTL file is loaded successfully, and is rejected when an error occurs when loading the MTL file. If the promise resolves, the result is an object that implements the following methods:

(Type: Promise)

(static) H3DU.ObjData.loadObjFromUrl(url)

Loads a WaveFront OBJ file (along with its associated MTL, or material file, if available) asynchronously.

Parameters

Return Value

A promise that resolves when the OBJ file is loaded successfully, whether or not its associated MTL is also loaded successfully (the result is an H3DU.ObjData object), and is rejected when an error occurs when loading the OBJ file. (Type: Promise)

(static) H3DU.ObjData.loadObjFromUrlWithTextures(url, textureLoader)

Loads a WaveFront OBJ file (along with its associated MTL, or material file, if available), along with the textures it uses, asynchronously.

Parameters

Return Value

A promise that resolves when the OBJ file and textures are loaded successfully, whether or not the associated MTL is also loaded successfully (the result is an H3DU.ObjData object), and is rejected when an error occurs when loading the OBJ file or any of its textures. (Type: Promise)

H3DU.ObjData#toShape()

Creates one or more 3D shapes from the data in this OBJ file.

Return Value

Group of shapes. (Type: H3DU.ShapeGroup)

H3DU.ObjData#toShapeFromName(name)

Creates one or more H3DU.Shape objects from the named portion of the data in this OBJ file. If a MTL file was also loaded, the shape will have the corresponding material, if it uses one.

Parameters

Return Value

Group of shapes. The group will be empty if no shapes with the given name exist. (Type: H3DU.ShapeGroup)

Back to documentation index.