public class Texture

Known direct subclasses
CubeMapTexture

CubeMapTexture represents a cube map texture that can be used with materials.


Texture represents a texture that can be used with materials.

Summary

Public methods

static final @NonNull ListenableFuture<@NonNull Texture>
@MainThread
create(
    @NonNull Session session,
    @NonNull String name,
    @NonNull TextureSampler sampler
)

Public factory function for a Texture, where the texture is asynchronously loaded.

void

Disposes the given texture resource.

Public methods

create

Added in 1.0.0-alpha04
@MainThread
public static final @NonNull ListenableFuture<@NonNull Texturecreate(
    @NonNull Session session,
    @NonNull String name,
    @NonNull TextureSampler sampler
)

Public factory function for a Texture, where the texture is asynchronously loaded.

This method must be called from the main thread. https://developer.android.com/guide/components/processes-and-threads

Currently, only URLs and relative paths from the android_assets/ directory are supported.

Parameters
@NonNull Session session

The Session to use for loading the model.

@NonNull String name

The URL or asset-relative path of a texture to be loaded

@NonNull TextureSampler sampler

The TextureSampler for the texture being created.

Returns
@NonNull ListenableFuture<@NonNull Texture>

a ListenableFuture. Listeners will be called on the main thread if Runnable::run is supplied.

dispose

Added in 1.0.0-alpha04
@MainThread
public void dispose()

Disposes the given texture resource.

This method must be called from the main thread. https://developer.android.com/guide/components/processes-and-threads

Currently, a glTF model (which this texture will be used with) can't be disposed. This means that calling dispose on the texture will lead to a crash if the call is made out of order, that is, if the texture is disposed before the glTF model that uses it.