KhronosUnlitMaterial


public final class KhronosUnlitMaterial implements 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 methods

void

Closes the KhronosUnlitMaterial and releases its underlying graphics resources.

static final @NonNull KhronosUnlitMaterial
@MainThread
create(@NonNull Session session, int alphaMode)

Asynchronously creates a KhronosUnlitMaterial.

final void
@MainThread
setAlphaCutoff(@FloatRange(from = 0.0, to = 1.0) float alphaCutoff)

Sets the alpha cutoff threshold.

final void

Sets a linear multiplier for the base color.

final void

Sets the material's base color using a texture.

Public methods

close

@MainThread
public void close()

Closes the KhronosUnlitMaterial and releases its underlying graphics resources.

After being closed, the KhronosUnlitMaterial should not be used further.

create

@MainThread
public static final @NonNull KhronosUnlitMaterial create(@NonNull Session session, int alphaMode)

Asynchronously creates a KhronosUnlitMaterial.

Parameters
@NonNull Session session

The active Session in which to create the material.

int alphaMode

The AlphaMode to use for the material.

Returns
@NonNull KhronosUnlitMaterial

The newly created KhronosUnlitMaterial.

setAlphaCutoff

Added in 1.0.0-alpha08
@MainThread
public final void setAlphaCutoff(@FloatRange(from = 0.0, to = 1.0) float alphaCutoff)

Sets the alpha cutoff threshold.

This value is only used when the material's alphaMode is AlphaMode.ALPHA_MODE_MASK.

Parameters
@FloatRange(from = 0.0, to = 1.0) float alphaCutoff

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
kotlin.IllegalArgumentException

if the material's alphaMode is not ALPHA_MODE_MASK.

setBaseColorFactor

Added in 1.0.0-alpha08
@MainThread
public final void setBaseColorFactor(@NonNull Vector4 factor)

Sets a linear multiplier for the base color.

By default this is 1, 1, 1, 1.

Parameters
@NonNull Vector4 factor

The Vector4 (RGBA) factor multiplied component-wise with the base color texture.

setBaseColorTexture

Added in 1.0.0-alpha08
@MainThread
public final void setBaseColorTexture(
    @NonNull Texture texture,
    @NonNull TextureSampler sampler
)

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
@NonNull Texture texture

The Texture to be used as the base color texture, in sRGB color space.

@NonNull TextureSampler sampler

The TextureSampler to be used when sampling the base color texture.