Class Material.Builder
- java.lang.Object
-
- com.google.ar.sceneform.rendering.Material.Builder
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.concurrent.CompletableFuture<Material>
build()
Creates a newMaterial
based on the parameters set previously.Material.Builder
setRegistryId(java.lang.Object registryId)
Allows aMaterial
to be reused.Material.Builder
setSource(android.content.Context context, int resource)
Allows aMaterial
to be constructed from resource.Material.Builder
setSource(android.content.Context context, android.net.Uri sourceUri)
Allows aMaterial
to be constructed fromUri
.Material.Builder
setSource(java.nio.ByteBuffer materialBuffer)
Allows aMaterial
to be created with data.Material.Builder
setSource(java.util.concurrent.Callable<java.io.InputStream> inputStreamCreator)
Allows aMaterial
to be constructed via callable function.
-
-
-
Method Detail
-
setSource
public Material.Builder setSource(java.nio.ByteBuffer materialBuffer)
Allows aMaterial
to be created with data.Construction will be immediate. Please use
setRegistryId(Object)
to register this material for reuse.- Parameters:
materialBuffer
- Sets the material data.- Returns:
Material.Builder
for chaining setup calls
-
setSource
public Material.Builder setSource(android.content.Context context, android.net.Uri sourceUri)
Allows aMaterial
to be constructed fromUri
. Construction will be asynchronous.- Parameters:
context
- Sets theContext
used for loading the resourcesourceUri
- Sets a remote Uri or android resource Uri. The material will be added to the registry using the Uri. A previously registered material with the same Uri will be re-used.- Returns:
Material.Builder
for chaining setup calls
-
setSource
public Material.Builder setSource(android.content.Context context, int resource)
Allows aMaterial
to be constructed from resource.Construction will be asynchronous.
- Parameters:
context
- Sets theContext
used for loading the resourceresource
- an android resource with raw type. A previously registered material with the same resource id will be re-used.- Returns:
Material.Builder
for chaining setup calls
-
setSource
public Material.Builder setSource(java.util.concurrent.Callable<java.io.InputStream> inputStreamCreator)
Allows aMaterial
to be constructed via callable function.- Parameters:
inputStreamCreator
- Supplies anInputStream
with theMaterial
data- Returns:
Material.Builder
for chaining setup calls
-
setRegistryId
public Material.Builder setRegistryId(java.lang.Object registryId)
Allows aMaterial
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 material to be re-used- Returns:
Material.Builder
for chaining setup calls
-
-