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 newTexturebased on the parameters set previouslyTexture.BuildersetData(TextureInternalData textureInternalData)Sets internal data of the texture directly.Texture.BuildersetRegistryId(java.lang.Object registryId)Allows aTextureto be reused.Texture.BuildersetSampler(Texture.Sampler sampler)Sets theTexture.Samplerto control rendering parameters on theTexture.Texture.BuildersetSource(android.content.Context context, int resource)Allows aTextureto be constructed from resource.Texture.BuildersetSource(android.content.Context context, android.net.Uri sourceUri)Allows aTextureto be constructed fromUri.Texture.BuildersetSource(android.graphics.Bitmap bitmap)Allows aTextureto be constructed from aBitmap.Texture.BuildersetSource(java.util.concurrent.Callable<java.io.InputStream> inputStreamCreator)Allows aTextureto be constructed via callable function.Texture.BuildersetUsage(Texture.Usage usage)Mark theTextureas a containing color, normal or arbitrary data.
-
-
-
Method Detail
-
setSource
public Texture.Builder setSource(android.content.Context context, android.net.Uri sourceUri)
Allows aTextureto 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 theContextused to resolve sourceUri- Returns:
Texture.Builderfor chaining setup calls.
-
setSource
public Texture.Builder setSource(java.util.concurrent.Callable<java.io.InputStream> inputStreamCreator)
Allows aTextureto be constructed via callable function.- Parameters:
inputStreamCreator- Supplies anInputStreamwith theTexturedata.- Returns:
Texture.Builderfor chaining setup calls.
-
setSource
public Texture.Builder setSource(android.content.Context context, int resource)
Allows aTextureto 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-Contextused for resolution- Returns:
Texture.Builderfor chaining setup calls.
-
setSource
public Texture.Builder setSource(android.graphics.Bitmap bitmap)
Allows aTextureto 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-Bitmapsource 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 aTextureto 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.Builderfor chaining setup calls.
-
setUsage
public Texture.Builder setUsage(Texture.Usage usage)
Mark theTextureas a containing color, normal or arbitrary data. Color is the default.- Parameters:
usage- Sets the kind of data inTexture- Returns:
Texture.Builderfor chaining setup calls.
-
setSampler
public Texture.Builder setSampler(Texture.Sampler sampler)
Sets theTexture.Samplerto control rendering parameters on theTexture.- Parameters:
sampler- Controls appearance of theTexture- Returns:
Texture.Builderfor chaining setup calls.
-
-