lovr.graphics.newMaterial

Creates a new Material. Materials are sets of colors, textures, and other parameters that affect the appearance of objects. They can be applied to Models, Meshes, and most graphics primitives accept a Material as an optional first argument.

material = lovr.graphics.newMaterial()

Arguments

None

Returns

NameTypeDescription
materialMaterialThe new Material.

material = lovr.graphics.newMaterial(texture, r, g, b, a)

Arguments

NameTypeDefaultDescription
textureTextureThe diffuse texture.
rnumber1The red component of the diffuse color.
gnumber1The green component of the diffuse color.
bnumber1The blue component of the diffuse color.
anumber1The alpha component of the diffuse color.

Returns

NameTypeDescription
materialMaterialThe new Material.

material = lovr.graphics.newMaterial(canvas, r, g, b, a)

Arguments

NameTypeDefaultDescription
canvasCanvasA Canvas to use as the diffuse texture.
rnumber1The red component of the diffuse color.
gnumber1The green component of the diffuse color.
bnumber1The blue component of the diffuse color.
anumber1The alpha component of the diffuse color.

Returns

NameTypeDescription
materialMaterialThe new Material.

material = lovr.graphics.newMaterial(r, g, b, a)

Arguments

NameTypeDefaultDescription
rnumber1The red component of the diffuse color.
gnumber1The green component of the diffuse color.
bnumber1The blue component of the diffuse color.
anumber1The alpha component of the diffuse color.

Returns

NameTypeDescription
materialMaterialThe new Material.

See also