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 Model
s, Mesh
es, and most graphics primitives accept a Material as an optional first argument.
material = lovr.graphics.newMaterial()
Arguments
None
Returns
Name | Type | Description |
material | Material | The new Material.
|
material = lovr.graphics.newMaterial(texture, r, g, b, a)
Arguments
Name | Type | Default | Description |
texture | Texture | | The diffuse texture.
|
r | number | 1 | The red component of the diffuse color.
|
g | number | 1 | The green component of the diffuse color.
|
b | number | 1 | The blue component of the diffuse color.
|
a | number | 1 | The alpha component of the diffuse color.
|
Returns
Name | Type | Description |
material | Material | The new Material.
|
material = lovr.graphics.newMaterial(canvas, r, g, b, a)
Arguments
Name | Type | Default | Description |
canvas | Canvas | | A Canvas to use as the diffuse texture.
|
r | number | 1 | The red component of the diffuse color.
|
g | number | 1 | The green component of the diffuse color.
|
b | number | 1 | The blue component of the diffuse color.
|
a | number | 1 | The alpha component of the diffuse color.
|
Returns
Name | Type | Description |
material | Material | The new Material.
|
material = lovr.graphics.newMaterial(r, g, b, a)
Arguments
Name | Type | Default | Description |
r | number | 1 | The red component of the diffuse color.
|
g | number | 1 | The green component of the diffuse color.
|
b | number | 1 | The blue component of the diffuse color.
|
a | number | 1 | The alpha component of the diffuse color.
|
Returns
Name | Type | Description |
material | Material | The new Material.
|
material = lovr.graphics.newMaterial(hex)
Arguments
Name | Type | Default | Description |
hex | number | 0xffffff | A hexcode to use for the diffuse color (alpha is not supported).
|
Returns
Name | Type | Description |
material | Material | The new Material.
|
Notes
- Scalar properties will default to
1.0
.
- Color properties will default to
(1.0, 1.0, 1.0, 1.0)
, except for emissive
which will
default to (0.0, 0.0, 0.0, 0.0)
.
- Textures will default to
nil
(a single 1x1 white pixel will be used for them).
See also