Back to Filament

MaterialInstance

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

1.75.024.5 KB
Original Source

//filament-android/com.google.android.filament/MaterialInstance

MaterialInstance

[main]
open class MaterialInstance

Constructors

MaterialInstance[main]
constructor(engine: Engine, nativeMaterialInstance: Long)

Types

NameSummary
BooleanElement[main]
enum BooleanElement
FloatElement[main]
enum FloatElement
IntElement[main]
enum IntElement
StencilFace[main]
enum StencilFace
StencilOperation[main]
enum StencilOperation
Operations that control how the stencil buffer is updated.

Functions

NameSummary
compile[main]
open fun compile(priority: Material.CompilerPriorityQueue, variants: Int, handler: Any, callback: Runnable)
Asynchronously ensures that a subset of this MaterialInstance's variants are compiled.
duplicate[main]
open fun duplicate(other: MaterialInstance, name: String): MaterialInstance
Creates a new MaterialInstance using another MaterialInstance as a template for initialization.
getConstantBoolean[main]
open fun getConstantBoolean(name: String): Boolean
Gets the value of a specialization constant by name.
getConstantFloat[main]
open fun getConstantFloat(name: String): Float
Gets the value of a specialization constant by name.
getConstantInt[main]
open fun getConstantInt(name: String): Int
Gets the value of a specialization constant by name.
getCullingMode[main]
open fun getCullingMode(): Material.CullingMode
Returns the face culling mode.
getDepthFunc[main]
open fun getDepthFunc(): TextureSampler.CompareFunction
Returns the depth comparison function.
getMaskThreshold[main]
open fun getMaskThreshold(): Float
Gets the minimum alpha value a fragment must have to not be discarded when the blend mode is MASKED
getMaterial[main]
open fun getMaterial(): Material
getName[main]
open fun getName(): String
getNativeObject[main]
open fun getNativeObject(): Long
getShadowCullingMode[main]
open fun getShadowCullingMode(): Material.CullingMode
Returns the face culling mode for the shadow passes.
getSpecularAntiAliasingThreshold[main]
open fun getSpecularAntiAliasingThreshold(): Float
Gets the clamping threshold used to suppress estimation errors when applying specular anti-aliasing.
getSpecularAntiAliasingVariance[main]
open fun getSpecularAntiAliasingVariance(): Float
Gets the screen space variance of the filter kernel used when applying specular anti-aliasing.
getTransparencyMode[main]
open fun getTransparencyMode(): Material.TransparencyMode
Returns the transparency mode.
isColorWriteEnabled[main]
open fun isColorWriteEnabled(): Boolean
Returns whether color write is enabled.
isDepthCullingEnabled[main]
open fun isDepthCullingEnabled(): Boolean
Returns whether depth culling is enabled.
isDepthWriteEnabled[main]
open fun isDepthWriteEnabled(): Boolean
Returns whether depth write is enabled.
isDoubleSided[main]
open fun isDoubleSided(): Boolean
Returns whether double-sided lighting is enabled when the parent Material has double-sided capability.
isStencilWriteEnabled[main]
open fun isStencilWriteEnabled(): Boolean
Returns whether stencil write is enabled.
setColorWrite[main]
open fun setColorWrite(enable: Boolean)
Overrides the default color-buffer write state that was set on the material.
setConstant[main]
open fun setConstant(name: String, value: Boolean)
open fun setConstant(name: String, value: Float)
open fun setConstant(name: String, value: Int)
Overrides a specialization constant of this material instance.
setCullingMode[main]
open fun setCullingMode(mode: Material.CullingMode)
Overrides the default triangle culling state that was set on the material.
[main]
open fun setCullingMode(colorPassCullingMode: Material.CullingMode, shadowPassCullingMode: Material.CullingMode)
Overrides the default triangle culling state that was set on the material separately for the color and shadow passes
setDepthCulling[main]
open fun setDepthCulling(enable: Boolean)
Overrides the default depth testing state that was set on the material.
setDepthFunc[main]
open fun setDepthFunc(func: TextureSampler.CompareFunction)
Sets the depth comparison function (default is GE).
setDepthWrite[main]
open fun setDepthWrite(enable: Boolean)
Overrides the default depth-buffer write state that was set on the material.
setDoubleSided[main]
open fun setDoubleSided(doubleSided: Boolean)
Enables or disables double-sided lighting if the parent Material has double-sided capability, otherwise prints a warning.
setMaskThreshold[main]
open fun setMaskThreshold(threshold: Float)
Overrides the minimum alpha value a fragment must have to not be discarded when the blend mode is MASKED.
setParameter[main]
open fun setParameter(name: String, x: Boolean)
Sets the value of a bool parameter.
[main]
open fun setParameter(name: String, x: Float)
Sets the value of a float parameter.
[main]
open fun setParameter(name: String, x: Int)
Sets the value of an int parameter.
[main]
open fun setParameter(name: String, x: Boolean, y: Boolean)
Sets the value of a bool2 parameter.
[main]
open fun setParameter(name: String, texture: Texture, sampler: TextureSampler)
Sets a texture and sampler parameter on this material's default instance.
[main]
open fun setParameter(name: String, x: Float, y: Float)
Sets the value of a float2 parameter.
[main]
open fun setParameter(name: String, x: Int, y: Int)
Sets the value of an int2 parameter.
[main]
open fun setParameter(name: String, x: Boolean, y: Boolean, z: Boolean)
Sets the value of a bool3 parameter.
[main]
open fun setParameter(name: String, x: Float, y: Float, z: Float)
Sets the value of a float3 parameter.
[main]
open fun setParameter(name: String, x: Int, y: Int, z: Int)
Sets the value of a int3 parameter.
[main]
open fun setParameter(name: String, x: Boolean, y: Boolean, z: Boolean, w: Boolean)
Sets the value of a bool4 parameter.
[main]
open fun setParameter(name: String, type: Colors.RgbType, r: Float, g: Float, b: Float)
open fun setParameter(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 setParameter(name: String, type: MaterialInstance.BooleanElement, v: Array<Boolean>, offset: Int, count: Int)
Set a bool parameter array by name.
[main]
open fun setParameter(name: String, type: MaterialInstance.FloatElement, v: Array<Float>, offset: Int, count: Int)
Set a float parameter array by name.
[main]
open fun setParameter(name: String, type: MaterialInstance.IntElement, v: Array<Int>, offset: Int, count: Int)
Set an int parameter array by name.
[main]
open fun setParameter(name: String, x: Float, y: Float, z: Float, w: Float)
Sets the value of a float4 parameter.
[main]
open fun setParameter(name: String, x: Int, y: Int, z: Int, w: Int)
Sets the value of a int4 parameter.
setPolygonOffset[main]
open fun setPolygonOffset(scale: Float, constant: Float)
Sets a polygon offset that will be applied to all renderables drawn with this material instance.
setScissor[main]
open fun setScissor(left: Int, bottom: Int, width: Int, height: Int)
Set-up a custom scissor rectangle; by default it is disabled.
setSpecularAntiAliasingThreshold[main]
open fun setSpecularAntiAliasingThreshold(threshold: Float)
Sets the clamping threshold used to suppress estimation errors when applying specular anti-aliasing.
setSpecularAntiAliasingVariance[main]
open fun setSpecularAntiAliasingVariance(variance: Float)
Sets the screen space variance of the filter kernel used when applying specular anti-aliasing.
setStencilCompareFunction[main]
open fun setStencilCompareFunction(func: TextureSampler.CompareFunction)
Sets the stencil comparison function for both front and back-facing polygons.
[main]
open fun setStencilCompareFunction(func: TextureSampler.CompareFunction, face: MaterialInstance.StencilFace)
Sets the stencil comparison function (default is ALWAYS).
setStencilOpDepthFail[main]
open fun setStencilOpDepthFail(op: MaterialInstance.StencilOperation)
Sets the depth fail operation for both front and back-facing polygons.
[main]
open fun setStencilOpDepthFail(op: MaterialInstance.StencilOperation, face: MaterialInstance.StencilFace)
Sets the depth fail operation (default is KEEP).
setStencilOpDepthStencilPass[main]
open fun setStencilOpDepthStencilPass(op: MaterialInstance.StencilOperation)
Sets the depth-stencil pass operation for both front and back-facing polygons.
[main]
open fun setStencilOpDepthStencilPass(op: MaterialInstance.StencilOperation, face: MaterialInstance.StencilFace)
Sets the depth-stencil pass operation (default is KEEP).
setStencilOpStencilFail[main]
open fun setStencilOpStencilFail(op: MaterialInstance.StencilOperation)
Sets the stencil fail operation for both front and back-facing polygons.
[main]
open fun setStencilOpStencilFail(op: MaterialInstance.StencilOperation, face: MaterialInstance.StencilFace)
Sets the stencil fail operation (default is KEEP).
setStencilReadMask[main]
open fun setStencilReadMask(readMask: Int)
Sets the stencil read mask for both front and back-facing polygons.
[main]
open fun setStencilReadMask(readMask: Int, face: MaterialInstance.StencilFace)
Sets the stencil read mask (default is 0xFF).
setStencilReferenceValue[main]
open fun setStencilReferenceValue(value: Int)
Sets the stencil reference value for both front and back-facing polygons.
[main]
open fun setStencilReferenceValue(value: Int, face: MaterialInstance.StencilFace)
Sets the stencil reference value (default is 0).
setStencilWrite[main]
open fun setStencilWrite(enable: Boolean)
Enables or Disable stencil writes
setStencilWriteMask[main]
open fun setStencilWriteMask(writeMask: Int)
Sets the stencil write mask for both front and back-facing polygons.
[main]
open fun setStencilWriteMask(writeMask: Int, face: MaterialInstance.StencilFace)
Sets the stencil write mask (default is 0xFF).
setTransparencyMode[main]
open fun setTransparencyMode(mode: Material.TransparencyMode)
Sets the transparency mode for this material instance.
unsetScissor[main]
open fun unsetScissor()
Returns the scissor rectangle to its default disabled setting.