Class Material.Builder

  • Enclosing class:
    Material

    public static final class Material.Builder
    extends java.lang.Object
    Builder for constructing a Material
    • Method Detail

      • setSource

        public Material.Builder setSource​(java.nio.ByteBuffer materialBuffer)
        Allows a Material 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 a Material to be constructed from Uri. Construction will be asynchronous.
        Parameters:
        context - Sets the Context used for loading the resource
        sourceUri - 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 a Material to be constructed from resource.

        Construction will be asynchronous.

        Parameters:
        context - Sets the Context used for loading the resource
        resource - 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 a Material to be constructed via callable function.
        Parameters:
        inputStreamCreator - Supplies an InputStream with the Material data
        Returns:
        Material.Builder for chaining setup calls
      • setRegistryId

        public Material.Builder setRegistryId​(java.lang.Object registryId)
        Allows a Material 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
      • build

        public java.util.concurrent.CompletableFuture<Material> build()
        Creates a new Material based on the parameters set previously. A source must be specified.