Loads a 3D model from a file. Currently, OBJ, glTF, and binary STL files are supported.
Arguments
Name | Type | Default | Description |
filename | string | |
The path to model file.
|
options | table | |
Model options.
|
.mipmaps | boolean | true |
Whether the textures created for the Model should have mipmaps generated.
|
Returns
Name | Type | Description |
model | Model |
The new Model.
|
Arguments
Name | Type | Default | Description |
blob | Blob | |
A Blob containing 3D model data.
|
options | table | |
Model options.
|
.mipmaps | boolean | true |
Whether the textures created for the Model should have mipmaps generated.
|
Returns
Name | Type | Description |
model | Model |
The new Model.
|
Arguments
Name | Type | Default | Description |
modelData | ModelData | |
An existing ModelData object to use for the Model.
|
options | table | |
Model options.
|
.mipmaps | boolean | true |
Whether the textures created for the Model should have mipmaps generated.
|
Returns
Name | Type | Description |
model | Model |
The new Model.
|
Notes
Currently, the following features are not supported by the model importer:
- glTF: Morph targets are not supported.
- glTF: Only the default scene is loaded.
- glTF: Currently, each skin in a Model can have up to 256 joints.
- glTF: Meshes can't appear multiple times in the node hierarchy with different skins, they need
to use 1 skin consistently.
- glTF:
KHR_texture_transform
is supported, but all textures in a material will use the same
transform.
- STL: ASCII STL files are not supported.
Diffuse and emissive textures will be loaded using sRGB encoding, all other textures will be loaded as linear.
See also
lovr.data.newModelData
Pass:draw
lovr.graphics