Back to Filament

Material

docs/android/dokka/filament-android/com.google.android.filament/-material/index.md

1.75.019.6 KB
Original Source

//filament-android/com.google.android.filament/Material

Material

open class Material

A Filament Material defines the visual appearance of an object. Materials function as a templates from which MaterialInstances can be spawned. Use Builder to construct a Material object.

See also

<a href="https://google.github.io/filament/Materials.html&quot;&gt;Filament Materials Guide</a>

Constructors

Material[main]
constructor(nativeMaterial: Long)

Types

NameSummary
BlendingMode[main]
enum BlendingMode
Supported blending modes
Builder[main]
open class Builder
CompilerPriorityQueue[main]
enum CompilerPriorityQueue
Shader compiler priority queue On platforms which support parallel shader compilation, compilation requests will be processed in order of priority, then insertion order.
CullingMode[main]
enum CullingMode
Face culling Mode
Interpolation[main]
enum Interpolation
Attribute interpolation types in the fragment shader
Parameter[main]
open class Parameter
ReflectionMode[main]
enum ReflectionMode
Supported reflection modes
RefractionMode[main]
enum RefractionMode
Supported refraction modes
RefractionType[main]
enum RefractionType
Supported refraction types
Shading[main]
enum Shading
Supported shading models
TransparencyMode[main]
enum TransparencyMode
How transparent objects are handled
UboBatchingMode[main]
enum UboBatchingMode
Defines whether a material instance should use UBO batching or not.
UserVariantFilterBit[main]
open class UserVariantFilterBit
VertexDomain[main]
enum VertexDomain
Supported types of vertex domains

Functions

NameSummary
compile[main]
open fun compile(priority: Material.CompilerPriorityQueue, variants: Int, handler: Any, callback: Runnable)
Asynchronously ensures that a subset of this Material's variants are compiled.
createInstance[main]
open fun createInstance(): MaterialInstance
Creates a new instance of this material.
[main]
open fun createInstance(name: String): MaterialInstance
Creates a new instance of this material with a specified name.
getBlendingMode[main]
open fun getBlendingMode(): Material.BlendingMode
Returns the blending mode of this material.
getCullingMode[main]
open fun getCullingMode(): Material.CullingMode
Returns the default culling mode of this material.
getDefaultInstance[main]
open fun getDefaultInstance(): MaterialInstance
Returns the material's default instance.
getFeatureLevel[main]
open fun getFeatureLevel(): Engine.FeatureLevel
Returns the minimum required feature level for this material.
getInterpolation[main]
open fun getInterpolation(): Material.Interpolation
Returns the interpolation mode of this material.
getMaskThreshold[main]
open fun getMaskThreshold(): Float
Returns the alpha mask threshold used when the blending mode is set to masked.
getName[main]
open fun getName(): String
Returns the name of this material.
getNativeObject[main]
open fun getNativeObject(): Long
getParameterCount[main]
open fun getParameterCount(): Int
Returns the number of parameters declared by this material.
getParameters[main]
open fun getParameters(): List<Material.Parameter>
Returns a list of Parameter objects representing this material's parameters.
getParameterTransformName[main]
open fun getParameterTransformName(samplerName: String): String
Returns the name of the transform parameter associated with the given sampler parameter.
getReflectionMode[main]
open fun getReflectionMode(): Material.ReflectionMode
Returns the reflection mode of this material.
getRefractionMode[main]
open fun getRefractionMode(): Material.RefractionMode
Returns the refraction mode of this material.
getRefractionType[main]
open fun getRefractionType(): Material.RefractionType
Returns the refraction type of this material.
getRequiredAttributes[main]
open fun getRequiredAttributes(): Set<VertexBuffer.VertexAttribute>
Returns a set of VertexBuffer.VertexAttributes that are required by this material.
getShading[main]
open fun getShading(): Material.Shading
Returns the shading model of this material.
getSpecularAntiAliasingThreshold[main]
open fun getSpecularAntiAliasingThreshold(): Float
Returns the clamping threshold for specular-antialiasing.
getSpecularAntiAliasingVariance[main]
open fun getSpecularAntiAliasingVariance(): Float
Returns the screen-space variance for specular-antialiasing.
getTransparencyMode[main]
open fun getTransparencyMode(): Material.TransparencyMode
Returns the transparency mode of this material.
getVertexDomain[main]
open fun getVertexDomain(): Material.VertexDomain
Returns the vertex domain of this material.
hasParameter[main]
open fun hasParameter(name: String): Boolean
Indicates whether a parameter of the given name exists on this material.
isAlphaToCoverageEnabled[main]
open fun isAlphaToCoverageEnabled(): Boolean
Indicates whether instances of this material will use alpha to coverage.
isColorWriteEnabled[main]
open fun isColorWriteEnabled(): Boolean
Indicates whether instances of this material will, by default, write to the color buffer.
isDepthCullingEnabled[main]
open fun isDepthCullingEnabled(): Boolean
Indicates whether instances of this material will, by default, use depth testing.
isDepthWriteEnabled[main]
open fun isDepthWriteEnabled(): Boolean
Indicates whether instances of this material will, by default, write to the depth buffer.
isDoubleSided[main]
open fun isDoubleSided(): Boolean
Indicates whether this material is double-sided.
setDefaultParameter[main]
open fun setDefaultParameter(name: String, x: Boolean)
Sets the value of a bool parameter on this material's default instance.
[main]
open fun setDefaultParameter(name: String, x: Float)
Sets the value of a float parameter on this material's default instance.
[main]
open fun setDefaultParameter(name: String, x: Int)
Sets the value of an int parameter on this material's default instance.
[main]
open fun setDefaultParameter(name: String, x: Boolean, y: Boolean)
Sets the value of a bool2 parameter on this material's default instance.
[main]
open fun setDefaultParameter(name: String, texture: Texture, sampler: TextureSampler)
Sets a texture and sampler parameter on this material's default instance.
[main]
open fun setDefaultParameter(name: String, x: Float, y: Float)
Sets the value of a float2 parameter on this material's default instance.
[main]
open fun setDefaultParameter(name: String, x: Int, y: Int)
Sets the value of an int2 parameter on this material's default instance.
[main]
open fun setDefaultParameter(name: String, x: Boolean, y: Boolean, z: Boolean)
Sets the value of a bool3 parameter on this material's default instance.
[main]
open fun setDefaultParameter(name: String, x: Float, y: Float, z: Float)
Sets the value of a float3 parameter on this material's default instance.
[main]
open fun setDefaultParameter(name: String, x: Int, y: Int, z: Int)
Sets the value of a int3 parameter on this material's default instance.
[main]
open fun setDefaultParameter(name: String, x: Boolean, y: Boolean, z: Boolean, w: Boolean)
Sets the value of a bool4 parameter on this material's default instance.
[main]
open fun setDefaultParameter(name: String, type: Colors.RgbType, r: Float, g: Float, b: Float)
open fun setDefaultParameter(name: String, type: Colors.RgbaType, r: Float, g: Float, b: Float, a: Float)
Sets the color of the given parameter on this material's default instance.
[main]
open fun setDefaultParameter(name: String, type: MaterialInstance.BooleanElement, v: Array<Boolean>, offset: Int, count: Int)
Set a bool parameter array by name.
[main]
open fun setDefaultParameter(name: String, type: MaterialInstance.FloatElement, v: Array<Float>, offset: Int, count: Int)
Set a float parameter array by name.
[main]
open fun setDefaultParameter(name: String, type: MaterialInstance.IntElement, v: Array<Int>, offset: Int, count: Int)
Set an int parameter array by name.
[main]
open fun setDefaultParameter(name: String, x: Float, y: Float, z: Float, w: Float)
Sets the value of a float4 parameter on this material's default instance.
[main]
open fun setDefaultParameter(name: String, x: Int, y: Int, z: Int, w: Int)
Sets the value of a int4 parameter on this material's default instance.