KhronosUnlitMaterial
class KhronosUnlitMaterial : Material
Represents an unlit material, which is not affected by scene lighting.
This material type is defined by a base color and supports a limited set of parameters. It is a direct implementation of the following glTF features:
Summary
Public companion functions |
|
|---|---|
suspend KhronosUnlitMaterial |
@MainThreadAsynchronously creates a |
Public functions |
|
|---|---|
open Unit |
Closes the |
Unit |
@MainThreadSets the alpha cutoff threshold. |
Unit |
@MainThreadSets a linear multiplier for the base color. |
Unit |
@MainThreadSets the material's base color using a texture. |
Public companion functions
create
@MainThread
suspend fun create(session: Session, alphaMode: AlphaMode): KhronosUnlitMaterial
Asynchronously creates a KhronosUnlitMaterial.
| Parameters | |
|---|---|
session: Session |
The active |
alphaMode: AlphaMode |
The |
| Returns | |
|---|---|
KhronosUnlitMaterial |
The newly created |
Public functions
close
@MainThread
open fun close(): Unit
Closes the KhronosUnlitMaterial and releases its underlying graphics resources.
After being closed, the KhronosUnlitMaterial should not be used further.
setAlphaCutoff
@MainThread
fun setAlphaCutoff(alphaCutoff: @FloatRange(from = 0.0, to = 1.0) Float): Unit
Sets the alpha cutoff threshold.
This value is only used when the material's alphaMode is AlphaMode.MASK.
| Parameters | |
|---|---|
alphaCutoff: @FloatRange(from = 0.0, to = 1.0) Float |
The alpha cutoff. Fragments with alpha below this value are discarded. Default is 0.5. Valid values are between 0.0 and 1.0, inclusive. |
| Throws | |
|---|---|
IllegalArgumentException |
if the material's alphaMode is not ALPHA_MODE_MASK. |
setBaseColorFactor
@MainThread
fun setBaseColorFactor(factor: Vector4): Unit
Sets a linear multiplier for the base color.
By default this is 1, 1, 1, 1.
setBaseColorTexture
@MainThread
fun setBaseColorTexture(
texture: Texture,
sampler: TextureSampler = TextureSampler()
): Unit
Sets the material's base color using a texture.
By default this is a white texture, where all pixels are 1, 1, 1, 1. In other words, if this is left as default, the base color will always be the base color factor.
| Parameters | |
|---|---|
texture: Texture |
The |
sampler: TextureSampler = TextureSampler() |
The |