docs/android/dokka/filament-android/com.google.android.filament/-material-instance/set-parameter.md
//filament-android/com.google.android.filament/MaterialInstance/setParameter
[main]
open fun setParameter(name: String, x: Boolean)
Sets the value of a bool parameter.
main
| name | the name of the material parameter |
| x | the value of the material parameter |
| RuntimeException | if name doesn't exist or no-op if exceptions are disabled. |
[main]
open fun setParameter(name: String, x: Float)
Sets the value of a float parameter.
main
| name | the name of the material parameter |
| x | the value of the material parameter |
| RuntimeException | if name doesn't exist or no-op if exceptions are disabled. |
[main]
open fun setParameter(name: String, x: Int)
Sets the value of an int parameter.
main
| name | the name of the material parameter |
| x | the value of the material parameter |
| RuntimeException | if name doesn't exist or no-op if exceptions are disabled. |
[main]
open fun setParameter(name: String, x: Boolean, y: Boolean)
Sets the value of a bool2 parameter.
main
| name | the name of the material parameter |
| x | the value of the first component |
| y | the value of the second component |
| RuntimeException | if name doesn't exist or no-op if exceptions are disabled. |
[main]
open fun setParameter(name: String, x: Float, y: Float)
Sets the value of a float2 parameter.
main
| name | the name of the material parameter |
| x | the value of the first component |
| y | the value of the second component |
| RuntimeException | if name doesn't exist or no-op if exceptions are disabled. |
[main]
open fun setParameter(name: String, x: Int, y: Int)
Sets the value of an int2 parameter.
main
| name | the name of the material parameter |
| x | the value of the first component |
| y | the value of the second component |
| RuntimeException | if name doesn't exist or no-op if exceptions are disabled. |
[main]
open fun setParameter(name: String, x: Boolean, y: Boolean, z: Boolean)
Sets the value of a bool3 parameter.
main
| name | the name of the material parameter |
| x | the value of the first component |
| y | the value of the second component |
| z | the value of the third component |
| RuntimeException | if name doesn't exist or no-op if exceptions are disabled. |
[main]
open fun setParameter(name: String, x: Float, y: Float, z: Float)
Sets the value of a float3 parameter.
main
| name | the name of the material parameter |
| x | the value of the first component |
| y | the value of the second component |
| z | the value of the third component |
| RuntimeException | if name doesn't exist or no-op if exceptions are disabled. |
[main]
open fun setParameter(name: String, x: Int, y: Int, z: Int)
Sets the value of a int3 parameter.
main
| name | the name of the material parameter |
| x | the value of the first component |
| y | the value of the second component |
| z | the value of the third component |
| RuntimeException | if name doesn't exist or no-op if exceptions are disabled. |
[main]
open fun setParameter(name: String, x: Boolean, y: Boolean, z: Boolean, w: Boolean)
Sets the value of a bool4 parameter.
main
| name | the name of the material parameter |
| x | the value of the first component |
| y | the value of the second component |
| z | the value of the third component |
| w | the value of the fourth component |
| RuntimeException | if name doesn't exist or no-op if exceptions are disabled. |
[main]
open fun setParameter(name: String, x: Float, y: Float, z: Float, w: Float)
Sets the value of a float4 parameter.
main
| name | the name of the material parameter |
| x | the value of the first component |
| y | the value of the second component |
| z | the value of the third component |
| w | the value of the fourth component |
| RuntimeException | if name doesn't exist or no-op if exceptions are disabled. |
[main]
open fun setParameter(name: String, x: Int, y: Int, z: Int, w: Int)
Sets the value of a int4 parameter.
main
| name | the name of the material parameter |
| x | the value of the first component |
| y | the value of the second component |
| z | the value of the third component |
| w | the value of the fourth component |
| RuntimeException | if name doesn't exist or no-op if exceptions are disabled. |
[main]
open fun setParameter(name: String, texture: Texture, sampler: TextureSampler)
Sets a texture and sampler parameter on this material's default instance.
Note: Depth textures can't be sampled with a linear filter unless the comparison mode is set to COMPARE_TO_TEXTURE.
main
| name | The name of the material texture parameter |
| texture | The texture to set as parameter |
| sampler | The sampler to be used with this texture |
| RuntimeException | if name doesn't exist or no-op if exceptions are disabled. |
[main]
open fun setParameter(name: String, type: MaterialInstance.BooleanElement, v: Array<Boolean>, offset: Int, count: Int)
Set a bool parameter array by name.
main
| name | name of the parameter array as defined by this Material |
| type | the number of components for each individual parameter |
| v | array of values to set to the named parameter array |
| offset | the number of elements in v to skip |
| count | the number of elements in the parameter array to set |
| For example, to set a parameter array of 4 bool4s: |
boolean[] a = new boolean[4 * 4]; instance.setParameter("param", MaterialInstance.BooleanElement.BOOL4, a, 0, 4);
``` |
#### Throws
| | |
|---|---|
| [RuntimeException](https://developer.android.com/reference/kotlin/java/lang/RuntimeException.html) | if name doesn't exist or no-op if exceptions are disabled. |
[main]\
open fun [setParameter](set-parameter.md)(name: [String](https://developer.android.com/reference/kotlin/java/lang/String.html), type: [MaterialInstance.IntElement](-int-element/index.md), v: [Array](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin-stdlib/kotlin/-array/index.html)<[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin-stdlib/kotlin/-int/index.html)>, offset: [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin-stdlib/kotlin/-int/index.html), count: [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin-stdlib/kotlin/-int/index.html))
Set an int parameter array by name.
#### Parameters
main
| | |
|---|---|
| name | name of the parameter array as defined by this Material |
| type | the number of components for each individual parameter |
| v | array of values to set to the named parameter array |
| offset | the number of elements in `v` to skip |
| count | the number of elements in the parameter array to set
For example, to set a parameter array of 4 int4s:
```kotlin
int[] a = new int[4 * 4]; instance.setParameter("param", MaterialInstance.IntElement.INT4, a, 0, 4);
``` |
#### Throws
| | |
|---|---|
| [RuntimeException](https://developer.android.com/reference/kotlin/java/lang/RuntimeException.html) | if name doesn't exist or no-op if exceptions are disabled. |
[main]\
open fun [setParameter](set-parameter.md)(name: [String](https://developer.android.com/reference/kotlin/java/lang/String.html), type: [MaterialInstance.FloatElement](-float-element/index.md), v: [Array](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin-stdlib/kotlin/-array/index.html)<[Float](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin-stdlib/kotlin/-float/index.html)>, offset: [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin-stdlib/kotlin/-int/index.html), count: [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin-stdlib/kotlin/-int/index.html))
Set a float parameter array by name.
#### Parameters
main
| | |
|---|---|
| name | name of the parameter array as defined by this Material |
| type | the number of components for each individual parameter |
| v | array of values to set to the named parameter array |
| offset | the number of elements in `v` to skip |
| count | the number of elements in the parameter array to set
For example, to set a parameter array of 4 float4s:
```kotlin
float[] a = new float[4 * 4]; material.setDefaultParameter("param", MaterialInstance.FloatElement.FLOAT4, a, 0, 4);
``` |
#### Throws
| | |
|---|---|
| [RuntimeException](https://developer.android.com/reference/kotlin/java/lang/RuntimeException.html) | if name doesn't exist or no-op if exceptions are disabled. |
[main]\
open fun [setParameter](set-parameter.md)(name: [String](https://developer.android.com/reference/kotlin/java/lang/String.html), type: [Colors.RgbType](../-colors/-rgb-type/index.md), r: [Float](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin-stdlib/kotlin/-float/index.html), g: [Float](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin-stdlib/kotlin/-float/index.html), b: [Float](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin-stdlib/kotlin/-float/index.html))
Sets the color of the given parameter on this material's default instance.
#### Parameters
main
| | |
|---|---|
| name | the name of the material color parameter |
| type | whether the color is specified in the linear or sRGB space |
| r | red component |
| g | green component |
| b | blue component |
#### Throws
| | |
|---|---|
| [RuntimeException](https://developer.android.com/reference/kotlin/java/lang/RuntimeException.html) | if name doesn't exist or no-op if exceptions are disabled. |
[main]\
open fun [setParameter](set-parameter.md)(name: [String](https://developer.android.com/reference/kotlin/java/lang/String.html), type: [Colors.RgbaType](../-colors/-rgba-type/index.md), r: [Float](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin-stdlib/kotlin/-float/index.html), g: [Float](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin-stdlib/kotlin/-float/index.html), b: [Float](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin-stdlib/kotlin/-float/index.html), a: [Float](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin-stdlib/kotlin/-float/index.html))
Sets the color of the given parameter on this material's default instance.
#### Parameters
main
| | |
|---|---|
| name | the name of the material color parameter |
| type | whether the color is specified in the linear or sRGB space |
| r | red component |
| g | green component |
| b | blue component |
| a | alpha component |
#### Throws
| | |
|---|---|
| [RuntimeException](https://developer.android.com/reference/kotlin/java/lang/RuntimeException.html) | if name doesn't exist or no-op if exceptions are disabled. |