-
public interface MaterialProvider
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public classMaterialProvider.MaterialKeyMaterialKey specifies the requirements for a requested glTF material.The provider creates Filament materials that fulfill these requirements.
-
Method Summary
Modifier and Type Method Description abstract MaterialInstancecreateMaterialInstance(MaterialProvider.MaterialKey config, @NonNull() @Size(min = 8) Array<int> uvmap, @Nullable() String label, @Nullable() String extras)Creates or fetches a compiled Filament material, then creates an instance from it. abstract MaterialgetMaterial(MaterialProvider.MaterialKey config, @NonNull() @Size(min = 8) Array<int> uvmap, @Nullable() String label)Creates or fetches a compiled Filament material corresponding to the given config. abstract Array<Material>getMaterials()Creates and returns an array containing all cached materials. abstract booleanneedsDummyData(int attrib)Returns true if the presence of the given vertex attribute is required.Some types of providers (e.g. abstract voiddestroyMaterials()Destroys all cached materials.This is not called automatically when MaterialProvider is destroyed, which allowsclients to take ownership of the cache if desired. abstract voiddestroy()Frees memory consumed by the native MaterialProvider, but does not destroycached materials.-
-
Method Detail
-
createMaterialInstance
@Nullable() abstract MaterialInstance createMaterialInstance(MaterialProvider.MaterialKey config, @NonNull() @Size(min = 8) Array<int> uvmap, @Nullable() String label, @Nullable() String extras)
Creates or fetches a compiled Filament material, then creates an instance from it.
- Parameters:
config- Specifies requirements; might be mutated due to resource constraints.uvmap- Output argument that gets populated with a small table that maps from a glTF uvindex to a Filament uv index (0 = UNUSED, 1 = UV0, 2 = UV1).label- Optional tag that is not a part of the cache key.extras- Optional extras as stringified JSON (not a part of the cache key).
-
getMaterial
@Nullable() abstract Material getMaterial(MaterialProvider.MaterialKey config, @NonNull() @Size(min = 8) Array<int> uvmap, @Nullable() String label)
Creates or fetches a compiled Filament material corresponding to the given config.
-
getMaterials
@NonNull() abstract Array<Material> getMaterials()
Creates and returns an array containing all cached materials.
-
needsDummyData
abstract boolean needsDummyData(int attrib)
Returns true if the presence of the given vertex attribute is required.Some types of providers (e.g. ubershader) require dummy attribute valuesif the glTF model does not provide them.NOTE: The given attribute is the VertexAttribute enum casted to an integer.This is done to streamline the JNI work between Java and Native layers.
-
destroyMaterials
abstract void destroyMaterials()
Destroys all cached materials.This is not called automatically when MaterialProvider is destroyed, which allowsclients to take ownership of the cache if desired.
-
destroy
abstract void destroy()
Frees memory consumed by the native
MaterialProvider, but does not destroycached materials.
-
-
-
-