lovr.graphics.newModel

Creates a new Model from a file. The supported 3D file formats are OBJ and glTF.

The following features are not supported yet: animations, materials, vertex colors.

model = lovr.graphics.newModel(filename, texture)

Arguments

NameTypeDefaultDescription
filenamestringThe filename of the model to load.
texturestringnilThe filename of the texture to apply to the model.

Returns

NameTypeDescription
modelModelThe new Model.

model = lovr.graphics.newModel(filename, material)

Arguments

NameTypeDefaultDescription
filenamestringThe filename of the model to load.
materialMaterialnilThe material to apply to the model. If nil, the materials will be loaded from the model file.

Returns

NameTypeDescription
modelModelThe new Model.

model = lovr.graphics.newModel(modelData, texture)

Arguments

NameTypeDefaultDescription
modelDataModelDataThe ModelData holding the data for the Model.
texturestringnilThe filename of the texture to apply to the model.

Returns

NameTypeDescription
modelModelThe new Model.

model = lovr.graphics.newModel(modelData, material)

Arguments

NameTypeDefaultDescription
modelDataModelDataThe ModelData holding the data for the Model.
materialMaterialnilThe material to apply to the model. If nil, the materials will be loaded from the model file.

Returns

NameTypeDescription
modelModelThe new Model.

Notes

Diffuse and emissive textures will be loaded in the sRGB encoding, all other textures will be loaded as linear.

See also