Texture.Builder

public static final class Texture.Builder

Factory class for Texture

Public Methods

CompletableFuture<Texture>
build()
Creates a new Texture based on the parameters set previously
Texture.Builder
setRegistryId(Object registryId)
Allows a Texture to be reused.
Texture.Builder
setSampler(Texture.Sampler sampler)
Sets the Texture.Samplerto control rendering parameters on the Texture.
Texture.Builder
setSource(Callable<InputStream> inputStreamCreator)
Allows a Texture to be constructed via callable function.
Texture.Builder
setSource(Context context, Uri sourceUri)
Allows a Texture to be constructed from Uri.
Texture.Builder
setSource(Bitmap bitmap)
Allows a Texture to be constructed from a Bitmap.
Texture.Builder
setSource(Context context, int resource)
Allows a Texture to be constructed from resource.
Texture.Builder
setUsage(Texture.Usage usage)
Mark the Texture as a containing color, normal or arbitrary data.

Inherited Methods

Public Methods

public CompletableFuture<Texture> build ()

Creates a new Texture based on the parameters set previously

Throws
IllegalStateException if the builder is not properly set

public Texture.Builder setRegistryId (Object registryId)

Allows a Texture to be reused. If registryId is non-null it will be saved in a registry and the registry will be checked for this id before construction.

Parameters
registryId Allows the function to be skipped and a previous texture to be re-used.
Returns

public Texture.Builder setSampler (Texture.Sampler sampler)

Sets the Texture.Samplerto control rendering parameters on the Texture.

Parameters
sampler Controls appearance of the Texture
Returns

public Texture.Builder setSource (Callable<InputStream> inputStreamCreator)

Allows a Texture to be constructed via callable function.

Parameters
inputStreamCreator Supplies an InputStream with the Texture data.
Returns

public Texture.Builder setSource (Context context, Uri sourceUri)

Allows a Texture to be constructed from Uri. Construction will be asynchronous.

Parameters
context Sets the Context used to resolve sourceUri
sourceUri Sets a remote Uri or android resource Uri. The texture will be added to the registry using the Uri A previously registered texture with the same Uri will be re-used.
Returns

public Texture.Builder setSource (Bitmap bitmap)

Allows a Texture to be constructed from a Bitmap. Construction will be immediate.

The Bitmap must meet the following conditions to be used by Sceneform:

Parameters
bitmap Bitmap source of texture data
Throws
IllegalArgumentException if the bitmap isn't valid

public Texture.Builder setSource (Context context, int resource)

Allows a Texture to be constructed from resource. Construction will be asynchronous.

Parameters
context Context used for resolution
resource an android resource with raw type. A previously registered texture with the same resource id will be re-used.
Returns

public Texture.Builder setUsage (Texture.Usage usage)

Mark the Texture as a containing color, normal or arbitrary data. Color is the default.

Parameters
usage Sets the kind of data in Texture
Returns