# MeshSpecification.Attribute

Added in[API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

# Attribute

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/android/graphics/MeshSpecification.Attribute "View this page in Java")  

```
open class Attribute
```

|---|----------------------------------------------------------------------------------------------------------------------------------------------|
| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)                                                               ||
| ↳ | [android.graphics.MeshSpecification.Attribute](https://developer.android.com/reference/kotlin/android/graphics/MeshSpecification.Attribute#) |

Data class to represent a single attribute in a shader. An attribute is a variable that accompanies a vertex, this can be a color or texture coordinates. See https://developer.android.com/develop/ui/views/graphics/agsl for more information regarding Android Graphics Shader Language. Note that offset is the offset in number of bytes. For example, if we had two attributes  

```kotlin
Float3 att1
  Float att2
  
```
att1 would have an offset of 0, while att2 would have an offset of 12 bytes. This is consumed as part of[MeshSpecification.make(Attribute[], int, Varying[], String, String, ColorSpace, int)](https://developer.android.com/reference/kotlin/android/graphics/MeshSpecification#make(kotlin.Array,%20kotlin.Int,%20kotlin.Array,%20kotlin.String,%20kotlin.String,%20android.graphics.ColorSpace,%20kotlin.Int))to create a[MeshSpecification](https://developer.android.com/reference/kotlin/android/graphics/MeshSpecification)instance.

<br />

## Summary

|                                                                                                                                                                                                                 Public constructors                                                                                                                                                                                                                 ||
|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|
| [Attribute](https://developer.android.com/reference/kotlin/android/graphics/MeshSpecification.Attribute#Attribute(kotlin.Int,%20kotlin.Int,%20kotlin.String))`(`type:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`, `offset:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`, `name:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`)` <br /> |

|                                                                                                                                                                          Public methods                                                                                                                                                                          ||
|--------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| open[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | [getName](https://developer.android.com/reference/kotlin/android/graphics/MeshSpecification.Attribute#getName())`()` Return the name of this[Attribute](https://developer.android.com/reference/kotlin/android/graphics/MeshSpecification.Attribute#)                      |
| open[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)       | [getOffset](https://developer.android.com/reference/kotlin/android/graphics/MeshSpecification.Attribute#getOffset())`()` Return the offset of the attribute in bytes                                                                                                       |
| open[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)       | [getType](https://developer.android.com/reference/kotlin/android/graphics/MeshSpecification.Attribute#getType())`()` Return the corresponding data type for this[Attribute](https://developer.android.com/reference/kotlin/android/graphics/MeshSpecification.Attribute#). |
| open[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | [toString](https://developer.android.com/reference/kotlin/android/graphics/MeshSpecification.Attribute#toString())`()` <br />                                                                                                                                              |

## Public constructors

### Attribute

Added in[API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
Attribute(
    type: Int, 
    offset: Int, 
    name: String)
```

|                                                                                                                                                                                                                                                                                                                                                                                                                                             Parameters                                                                                                                                                                                                                                                                                                                                                                                                                                             ||
|--------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `type` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html):Value is[android.graphics.MeshSpecification#TYPE_FLOAT](https://developer.android.com/reference/kotlin/android/graphics/MeshSpecification#TYPE_FLOAT:kotlin.Int),[android.graphics.MeshSpecification#TYPE_FLOAT2](https://developer.android.com/reference/kotlin/android/graphics/MeshSpecification#TYPE_FLOAT2:kotlin.Int),[android.graphics.MeshSpecification#TYPE_FLOAT3](https://developer.android.com/reference/kotlin/android/graphics/MeshSpecification#TYPE_FLOAT3:kotlin.Int),[android.graphics.MeshSpecification#TYPE_FLOAT4](https://developer.android.com/reference/kotlin/android/graphics/MeshSpecification#TYPE_FLOAT4:kotlin.Int), or[android.graphics.MeshSpecification#TYPE_UBYTE4](https://developer.android.com/reference/kotlin/android/graphics/MeshSpecification#TYPE_UBYTE4:kotlin.Int) |
| `name` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html):This value cannot be`null`.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |

## Public methods

### getName

Added in[API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
open fun getName(): String
```

Return the name of this[Attribute](https://developer.android.com/reference/kotlin/android/graphics/MeshSpecification.Attribute#)

|                                                    Return                                                     ||
|----------------------------------------------------------------------------------|-----------------------------|
| [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | This value cannot be`null`. |

### getOffset

Added in[API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
open fun getOffset(): Int
```

Return the offset of the attribute in bytes  

### getType

Added in[API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
open fun getType(): Int
```

Return the corresponding data type for this[Attribute](https://developer.android.com/reference/kotlin/android/graphics/MeshSpecification.Attribute#).

|                                                                                                                                                                                                                                                                                                                                                                                                                                           Return                                                                                                                                                                                                                                                                                                                                                                                                                                            ||
|----------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | Value is[android.graphics.MeshSpecification#TYPE_FLOAT](https://developer.android.com/reference/kotlin/android/graphics/MeshSpecification#TYPE_FLOAT:kotlin.Int),[android.graphics.MeshSpecification#TYPE_FLOAT2](https://developer.android.com/reference/kotlin/android/graphics/MeshSpecification#TYPE_FLOAT2:kotlin.Int),[android.graphics.MeshSpecification#TYPE_FLOAT3](https://developer.android.com/reference/kotlin/android/graphics/MeshSpecification#TYPE_FLOAT3:kotlin.Int),[android.graphics.MeshSpecification#TYPE_FLOAT4](https://developer.android.com/reference/kotlin/android/graphics/MeshSpecification#TYPE_FLOAT4:kotlin.Int), or[android.graphics.MeshSpecification#TYPE_UBYTE4](https://developer.android.com/reference/kotlin/android/graphics/MeshSpecification#TYPE_UBYTE4:kotlin.Int) |

### toString

Added in[API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
open fun toString(): String
```

|                                                          Return                                                          ||
|----------------------------------------------------------------------------------|----------------------------------------|
| [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | a string representation of the object. |