MaterialLoader

class MaterialLoader(val engine: Engine, val context: Context, coroutineScope: CoroutineScope = CoroutineScope(Dispatchers.IO))

A Filament Material defines the visual appearance of an object.

Materials function as a templates from which MaterialInstances can be spawned.

Constructors

Link copied to clipboard
constructor(engine: Engine, context: Context, coroutineScope: CoroutineScope = CoroutineScope(Dispatchers.IO))

Types

Link copied to clipboard
data class UvCoordinate(val x: Int, val y: Int)

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val engine: Engine
Link copied to clipboard
val ubershaderProvider: UbershaderProvider

Functions

Link copied to clipboard
fun createColorInstance(color: Color, metallic: Float = kMaterialDefaultMetallic, roughness: Float = kMaterialDefaultRoughness, reflectance: Float = kMaterialDefaultReflectance): MaterialInstance
fun createColorInstance(color: Color, metallic: Float = kMaterialDefaultMetallic, roughness: Float = kMaterialDefaultRoughness, reflectance: Float = kMaterialDefaultReflectance): MaterialInstance
fun createColorInstance(color: Int, metallic: Float = kMaterialDefaultMetallic, roughness: Float = kMaterialDefaultRoughness, reflectance: Float = kMaterialDefaultReflectance): MaterialInstance

Creates an opaque or transparent Material depending on the color alpha with the Color passed in.

Link copied to clipboard
fun createImageInstance(imageTexture: Texture, sampler: TextureSampler = TextureSampler2D()): MaterialInstance
Link copied to clipboard
fun createInstance(material: Material): MaterialInstance
Link copied to clipboard
fun createMaterial(payload: Buffer): Material

Creates and returns a Material object.

fun createMaterial(assetFileLocation: String): Material

Creates and returns a Material object from Filamat asset file.

Link copied to clipboard
fun createTextureInstance(texture: Texture, isOpaque: Boolean = true, metallic: Float = kMaterialDefaultMetallic, roughness: Float = kMaterialDefaultRoughness, reflectance: Float = kMaterialDefaultReflectance): MaterialInstance

Creates an an opaque or transparent Material with the Texture passed in.

Link copied to clipboard
fun createUbershaderInstance(config: MaterialProvider.MaterialKey, uvMap: List<MaterialLoader.UvCoordinate> = listOf( // uv00 UvCoordinate(0, 0), // uv01 UvCoordinate(0, 1), // uv11 UvCoordinate(1, 1), // uv10 UvCoordinate(1, 0) ), label: String? = null, extras: String? = null): MaterialInstance?
Link copied to clipboard
fun createVideoInstance(videoTexture: Texture, chromaKeyColor: Int? = null): MaterialInstance
Link copied to clipboard
fun createViewInstance(viewTexture: Texture, unlit: Boolean = false, invertFrontFaceWinding: Boolean = false): MaterialInstance
Link copied to clipboard
fun destroy()
Link copied to clipboard
fun destroyMaterial(material: Material)
Link copied to clipboard
fun destroyMaterialInstance(materialInstance: MaterialInstance)
Link copied to clipboard
fun getUbershaderMaterial(config: MaterialProvider.MaterialKey, uvMap: List<MaterialLoader.UvCoordinate> = listOf( // uv00 UvCoordinate(0, 0), // uv01 UvCoordinate(0, 1), // uv11 UvCoordinate(1, 1), // uv10 UvCoordinate(1, 0) ), label: String? = null): Material?
Link copied to clipboard
suspend fun loadMaterial(fileLocation: String): Material?

Loads a Material from the contents of a Filamat file.

Link copied to clipboard
fun loadMaterialAsync(fileLocation: String, onResult: (Material?) -> Unit): Job

Loads a Material from the contents of a Filamat file within a created coroutine scope.