Interface MaterialProvider
-
- All Known Implementing Classes:
UbershaderProvider
public interface MaterialProvider
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classMaterialProvider.MaterialKeyMaterialKey specifies the requirements for a requested glTF material.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description com.google.android.filament.MaterialInstancecreateMaterialInstance(MaterialProvider.MaterialKey config, int[] uvmap, java.lang.String label, java.lang.String extras)Creates or fetches a compiled Filament material, then creates an instance from it.voiddestroy()Frees memory consumed by the nativeMaterialProvider, but does not destroy cached materials.voiddestroyMaterials()Destroys all cached materials.com.google.android.filament.MaterialgetMaterial(MaterialProvider.MaterialKey config, int[] uvmap, java.lang.String label)Creates or fetches a compiled Filament material corresponding to the given config.com.google.android.filament.Material[]getMaterials()Creates and returns an array containing all cached materials.booleanneedsDummyData(int attrib)Returns true if the presence of the given vertex attribute is required.
-
-
-
Method Detail
-
createMaterialInstance
@Nullable com.google.android.filament.MaterialInstance createMaterialInstance(MaterialProvider.MaterialKey config, @NonNull @Size(min=8L) int[] uvmap, @Nullable java.lang.String label, @Nullable java.lang.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 uv index 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 com.google.android.filament.Material getMaterial(MaterialProvider.MaterialKey config, @NonNull @Size(min=8L) int[] uvmap, @Nullable java.lang.String label)
Creates or fetches a compiled Filament material corresponding to the given config.
-
getMaterials
@NonNull com.google.android.filament.Material[] getMaterials()
Creates and returns an array containing all cached materials.
-
needsDummyData
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 values if 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
void destroyMaterials()
Destroys all cached materials. This is not called automatically when MaterialProvider is destroyed, which allows clients to take ownership of the cache if desired.
-
destroy
void destroy()
Frees memory consumed by the nativeMaterialProvider, but does not destroy cached materials.
-
-