# DistanceDisplayConditionGeometryInstanceAttribute

#### new Cesium.DistanceDisplayConditionGeometryInstanceAttribute(near, far)
engine/Source/Core/DistanceDisplayConditionGeometryInstanceAttribute.js 35

Value and type information for per-instance geometry attribute that determines if the geometry instance has a distance display condition.

Name | Type | Default | Description
--- | --- | --- | ---
`near` | number | `0.0` | optional The near distance.
`far` | number | `Number.MAX_VALUE` | optional The far distance.

##### Throws:

- DeveloperError : far must be greater than near.

##### Example:

    const instance = new Cesium.GeometryInstance({
      geometry : new Cesium.BoxGeometry({
        vertexFormat : Cesium.VertexFormat.POSITION_AND_NORMAL,
        minimum : new Cesium.Cartesian3(-250000.0, -250000.0, -250000.0),
        maximum : new Cesium.Cartesian3(250000.0, 250000.0, 250000.0)
      }),
      modelMatrix : Cesium.Matrix4.multiplyByTranslation(Cesium.Transforms.eastNorthUpToFixedFrame(
        Cesium.Cartesian3.fromDegrees(-75.59777, 40.03883)), new Cesium.Cartesian3(0.0, 0.0, 1000000.0), new Cesium.Matrix4()),
      id : 'box',
      attributes : {
        distanceDisplayCondition : new Cesium.DistanceDisplayConditionGeometryInstanceAttribute(100.0, 10000.0)
      }
    });

##### See:

- GeometryInstance
- GeometryInstanceAttribute

### Members

#### readonly componentDatatype : ComponentDatatype
engine/Source/Core/DistanceDisplayConditionGeometryInstanceAttribute.js 71

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

Default Value: ``ComponentDatatype.FLOAT``

#### readonly componentsPerAttribute : number
engine/Source/Core/DistanceDisplayConditionGeometryInstanceAttribute.js 87

The number of components in the attributes, i.e., `DistanceDisplayConditionGeometryInstanceAttribute#value`.

Default Value: `3`

#### readonly normalize : boolean
engine/Source/Core/DistanceDisplayConditionGeometryInstanceAttribute.js 105

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.

Default Value: `false`

#### value : Float32Array
engine/Source/Core/DistanceDisplayConditionGeometryInstanceAttribute.js 54

The values for the attributes stored in a typed array.

Default Value: `[0.0, 0.0, Number.MAX_VALUE]`

### Methods

#### static Cesium.DistanceDisplayConditionGeometryInstanceAttribute.fromDistanceDisplayCondition(distanceDisplayCondition) → DistanceDisplayConditionGeometryInstanceAttribute
engine/Source/Core/DistanceDisplayConditionGeometryInstanceAttribute.js 130

Creates a new `DistanceDisplayConditionGeometryInstanceAttribute` instance given the provided an enabled flag and `DistanceDisplayCondition`.

Name | Type | Description
--- | --- | ---
`distanceDisplayCondition` | DistanceDisplayCondition | The distance display condition.

##### Returns:

The new `DistanceDisplayConditionGeometryInstanceAttribute` instance.

##### Throws:

- DeveloperError : distanceDisplayCondition.far must be greater than distanceDisplayCondition.near

##### Example:

    const distanceDisplayCondition = new Cesium.DistanceDisplayCondition(100.0, 10000.0);
    const instance = new Cesium.GeometryInstance({
      geometry : geometry,
      attributes : {
        distanceDisplayCondition : Cesium.DistanceDisplayConditionGeometryInstanceAttribute.fromDistanceDisplayCondition(distanceDisplayCondition)
      }
    });

#### static Cesium.DistanceDisplayConditionGeometryInstanceAttribute.toValue(distanceDisplayCondition, result) → Float32Array
engine/Source/Core/DistanceDisplayConditionGeometryInstanceAttribute.js 161

Converts a distance display condition to a typed array that can be used to assign a distance display condition attribute.

Name | Type | Description
--- | --- | ---
`distanceDisplayCondition` | DistanceDisplayCondition | The distance display condition value.
`result` | Float32Array | optional The array to store the result in, if undefined a new instance will be created.

##### Returns:

The modified result parameter or a new instance if result was undefined.

##### Example:

    const attributes = primitive.getGeometryInstanceAttributes('an id');
    attributes.distanceDisplayCondition = Cesium.DistanceDisplayConditionGeometryInstanceAttribute.toValue(distanceDisplayCondition, attributes.distanceDisplayCondition);

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