DistanceDisplayConditionGeometryInstanceAttribute

new Cesium.DistanceDisplayConditionGeometryInstanceAttribute(near, far)

Value and type information for per-instance geometry attribute that determines if the geometry instance has a distance display condition.
参数名称 类型 默认值 描述信息
near number 0.0 可选 The near distance.
far number Number.MAX_VALUE 可选 The far distance.
Throws:
使用示例:
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)
  }
});
参考:

成员(属性)

The datatype of each component in the attribute, e.g., individual elements in DistanceDisplayConditionGeometryInstanceAttribute#value.
默认值: ComponentDatatype.FLOAT
The number of components in the attributes, i.e., DistanceDisplayConditionGeometryInstanceAttribute#value.
默认值: 3
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.
默认值: false
The values for the attributes stored in a typed array.
默认值: [0.0, 0.0, Number.MAX_VALUE]

方法

static Cesium.DistanceDisplayConditionGeometryInstanceAttribute.fromDistanceDisplayCondition(distanceDisplayCondition)DistanceDisplayConditionGeometryInstanceAttribute

Creates a new DistanceDisplayConditionGeometryInstanceAttribute instance given the provided an enabled flag and DistanceDisplayCondition.
参数名称 类型 描述信息
distanceDisplayCondition DistanceDisplayCondition The distance display condition.
返回值:
Throws:
  • DeveloperError : distanceDisplayCondition.far must be greater than distanceDisplayCondition.near
使用示例:
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

Converts a distance display condition to a typed array that can be used to assign a distance display condition attribute.
参数名称 类型 描述信息
distanceDisplayCondition DistanceDisplayCondition The distance display condition value.
result Float32Array 可选 The array to store the result in, if undefined a new instance will be created.
返回值:
The modified result parameter or a new instance if result was undefined.
使用示例:
const attributes = primitive.getGeometryInstanceAttributes('an id');
attributes.distanceDisplayCondition = Cesium.DistanceDisplayConditionGeometryInstanceAttribute.toValue(distanceDisplayCondition, attributes.distanceDisplayCondition);