new DistanceDisplayConditionGeometryInstanceAttribute(nearopt, faropt)
Value and type information for per-instance geometry attribute that determines if the geometry instance has a distance display condition.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
near |
Number |
<optional> |
0.0 | The near distance. |
far |
Number |
<optional> |
Number.MAX_VALUE | The far distance. |
- Source:
- See:
Throws:
-
far must be greater than near.
- Type
- DeveloperError
Example
var 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 : {
show : new Cesium.DistanceDisplayConditionGeometryInstanceAttribute(100.0, 10000.0)
}
});
Members
(readonly) componentDatatype :ComponentDatatype
The datatype of each component in the attribute, e.g., individual elements in
DistanceDisplayConditionGeometryInstanceAttribute#value
.
Type:
- Default Value:
ComponentDatatype.FLOAT
- Source:
(readonly) componentsPerAttribute :Number
The number of components in the attributes, i.e.,
DistanceDisplayConditionGeometryInstanceAttribute#value
.
Type:
- Number
- Default Value:
- 3
- Source:
(readonly) normalize :Boolean
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.
Type:
- Boolean
- Default Value:
- false
- Source:
value :Float32Array
The values for the attributes stored in a typed array.
Type:
- Float32Array
- Default Value:
- [0.0, 0.0, Number.MAX_VALUE]
- Source:
Methods
(static) fromDistanceDisplayCondition(distanceDisplayCondition) → {DistanceDisplayConditionGeometryInstanceAttribute}
Creates a new
DistanceDisplayConditionGeometryInstanceAttribute
instance given the provided an enabled flag and DistanceDisplayCondition
.
Parameters:
Name | Type | Description |
---|---|---|
distanceDisplayCondition |
DistanceDisplayCondition | The distance display condition. |
Throws:
-
distanceDisplayCondition.far must be greater than distanceDisplayCondition.near
- Type
- DeveloperError
Returns:
The new
DistanceDisplayConditionGeometryInstanceAttribute
instance.
Example
var instance = new Cesium.GeometryInstance({
geometry : geometry,
attributes : {
color : Cesium.DistanceDisplayConditionGeometryInstanceAttribute.fromDistanceDisplayCondition(distanceDisplayCondition),
}
});
(static) toValue(distanceDisplayCondition, resultopt) → {Float32Array}
Converts a distance display condition to a typed array that can be used to assign a distance display condition attribute.
Parameters:
Name | Type | Attributes | 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.
- Type
- Float32Array
Example
var attributes = primitive.getGeometryInstanceAttributes('an id');
attributes.distanceDisplayCondition = Cesium.DistanceDisplayConditionGeometryInstanceAttribute.toValue(distanceDisplayCondition, attributes.distanceDisplayCondition);