Class Texture.Builder
- java.lang.Object
-
- com.google.ar.sceneform.rendering.Texture.Builder
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.concurrent.CompletableFuture<Texture>
build()
Creates a newTexture
based on the parameters set previouslyTexture.Builder
setData(TextureInternalData textureInternalData)
Sets internal data of the texture directly.Texture.Builder
setRegistryId(java.lang.Object registryId)
Allows aTexture
to be reused.Texture.Builder
setSampler(Texture.Sampler sampler)
Sets theTexture.Sampler
to control rendering parameters on theTexture
.Texture.Builder
setSource(android.content.Context context, int resource)
Allows aTexture
to be constructed from resource.Texture.Builder
setSource(android.content.Context context, android.net.Uri sourceUri)
Allows aTexture
to be constructed fromUri
.Texture.Builder
setSource(android.graphics.Bitmap bitmap)
Allows aTexture
to be constructed from aBitmap
.Texture.Builder
setSource(java.util.concurrent.Callable<java.io.InputStream> inputStreamCreator)
Allows aTexture
to be constructed via callable function.Texture.Builder
setUsage(Texture.Usage usage)
Mark theTexture
as a containing color, normal or arbitrary data.
-
-
-
Method Detail
-
setSource
public Texture.Builder setSource(android.content.Context context, android.net.Uri sourceUri)
Allows aTexture
to be constructed fromUri
. Construction will be asynchronous.- Parameters:
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.context
- Sets theContext
used to resolve sourceUri- Returns:
Texture.Builder
for chaining setup calls.
-
setSource
public Texture.Builder setSource(java.util.concurrent.Callable<java.io.InputStream> inputStreamCreator)
Allows aTexture
to be constructed via callable function.- Parameters:
inputStreamCreator
- Supplies anInputStream
with theTexture
data.- Returns:
Texture.Builder
for chaining setup calls.
-
setSource
public Texture.Builder setSource(android.content.Context context, int resource)
Allows aTexture
to be constructed from resource. Construction will be asynchronous.- Parameters:
resource
- an android resource with raw type. A previously registered texture with the same resource id will be re-used.context
-Context
used for resolution- Returns:
Texture.Builder
for chaining setup calls.
-
setSource
public Texture.Builder setSource(android.graphics.Bitmap bitmap)
Allows aTexture
to be constructed from aBitmap
. Construction will be immediate.The Bitmap must meet the following conditions to be used by Sceneform:
Bitmap.getConfig()
must beBitmap.Config.ARGB_8888
.Bitmap.isPremultiplied()
must be true.- The width and height must be smaller than 4096 pixels.
- Parameters:
bitmap
-Bitmap
source of texture data- Throws:
java.lang.IllegalArgumentException
- if the bitmap isn't valid
-
setData
public Texture.Builder setData(TextureInternalData textureInternalData)
Sets internal data of the texture directly.
-
setRegistryId
public Texture.Builder setRegistryId(java.lang.Object registryId)
Allows aTexture
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:
Texture.Builder
for chaining setup calls.
-
setUsage
public Texture.Builder setUsage(Texture.Usage usage)
Mark theTexture
as a containing color, normal or arbitrary data. Color is the default.- Parameters:
usage
- Sets the kind of data inTexture
- Returns:
Texture.Builder
for chaining setup calls.
-
setSampler
public Texture.Builder setSampler(Texture.Sampler sampler)
Sets theTexture.Sampler
to control rendering parameters on theTexture
.- Parameters:
sampler
- Controls appearance of theTexture
- Returns:
Texture.Builder
for chaining setup calls.
-
-