# GeometryAttribute

#### new Cesium.GeometryAttribute(options)
engine/Source/Core/GeometryAttribute.js 40

Values and type information for geometry attributes. A `Geometry` generally contains one or more attributes. All attributes together form the geometry's vertices.

Name | Type | Description
--- | --- | ---
`options` | object | optional Object with the following properties:
Name | Type | Default | Description
--- | --- | --- | ---
`componentDatatype` | ComponentDatatype |  | The datatype of each component in the attribute, e.g., individual elements in values.
`componentsPerAttribute` | number |  | A number between 1 and 4 that defines the number of components in an attributes.
`normalize` | boolean | `false` | optional When `true` and `componentDatatype` is an integer format, indicate that the components should be mapped to the range [0, 1] (unsigned) or [-1, 1] (signed) when they are accessed as floating-point for rendering.
`values` | Array.<number> | Int8Array | Uint8Array | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array |  | The values for the attributes stored in a typed array.

##### Throws:

- DeveloperError : options.componentsPerAttribute must be between 1 and 4.

##### Example:

    const geometry = new Cesium.Geometry({
      attributes : {
        position : new Cesium.GeometryAttribute({
          componentDatatype : Cesium.ComponentDatatype.FLOAT,
          componentsPerAttribute : 3,
          values : new Float32Array([
            0.0, 0.0, 0.0,
            7500000.0, 0.0, 0.0,
            0.0, 7500000.0, 0.0
          ])
        })
      },
      primitiveType : Cesium.PrimitiveType.LINE_LOOP
    });

##### See:

- Geometry

### Members

#### componentDatatype : ComponentDatatype
engine/Source/Core/GeometryAttribute.js 70

The datatype of each component in the attribute, e.g., individual elements in `GeometryAttribute#values`.

#### componentsPerAttribute : number
engine/Source/Core/GeometryAttribute.js 88

A number between 1 and 4 that defines the number of components in an attributes. For example, a position attribute with x, y, and z components would have 3 as shown in the code example.

##### Example:

    attribute.componentDatatype = Cesium.ComponentDatatype.FLOAT;
    attribute.componentsPerAttribute = 3;
    attribute.values = new Float32Array([
      0.0, 0.0, 0.0,
      7500000.0, 0.0, 0.0,
      0.0, 7500000.0, 0.0
    ]);

#### normalize : boolean
engine/Source/Core/GeometryAttribute.js 113

When `true` and `componentDatatype` is an integer format, indicate that the components should be mapped to the range [0, 1] (unsigned) or [-1, 1] (signed) when they are accessed as floating-point for rendering.

This is commonly used when storing colors using `ComponentDatatype.UNSIGNED_BYTE`.

Default Value: `false`

##### Example:

    attribute.componentDatatype = Cesium.ComponentDatatype.UNSIGNED_BYTE;
    attribute.componentsPerAttribute = 4;
    attribute.normalize = true;
    attribute.values = new Uint8Array([
      Cesium.Color.floatToByte(color.red),
      Cesium.Color.floatToByte(color.green),
      Cesium.Color.floatToByte(color.blue),
      Cesium.Color.floatToByte(color.alpha)
    ]);

#### values : Array.<number>|Int8Array|Uint8Array|Int16Array|Uint16Array|Int32Array|Uint32Array|Float32Array|Float64Array
engine/Source/Core/GeometryAttribute.js 131

The values for the attributes stored in a typed array. In the code example, every three elements in `values` defines one attributes since `componentsPerAttribute` is 3.

##### Example:

    attribute.componentDatatype = Cesium.ComponentDatatype.FLOAT;
    attribute.componentsPerAttribute = 3;
    attribute.values = new Float32Array([
      0.0, 0.0, 0.0,
      7500000.0, 0.0, 0.0,
      0.0, 7500000.0, 0.0
    ]);

Need help? The fastest way to get answers is from the community and team on the Cesium Forum.