English中文

ColorGeometryInstanceAttribute

new Cesium.ColorGeometryInstanceAttribute(red, green, blue, alpha)

每个实例几何颜色的值和类型信息。 Value and type information for per-instance geometry color.
名称 Name 类型 Type 默认值 Default 说明 Description
red number 1.0 可选 optional 红色成分。 The red component.
green number 1.0 可选 optional 绿色成分。 The green component.
blue number 1.0 可选 optional 蓝色分量。 The blue component.
alpha number 1.0 可选 optional 阿尔法分量。 The alpha component.
示例: Example:
const instance = new Cesium.GeometryInstance({
  geometry : Cesium.BoxGeometry.fromDimensions({
    dimensions : new Cesium.Cartesian3(1000000.0, 1000000.0, 500000.0)
  }),
  modelMatrix : Cesium.Matrix4.multiplyByTranslation(Cesium.Transforms.eastNorthUpToFixedFrame(
    Cesium.Cartesian3.fromDegrees(0.0, 0.0)), new Cesium.Cartesian3(0.0, 0.0, 1000000.0), new Cesium.Matrix4()),
  id : 'box',
  attributes : {
    color : new Cesium.ColorGeometryInstanceAttribute(red, green, blue, alpha)
  }
});
另见: See:

成员 Members

属性中每个组件的数据类型,例如,中的各个元素 The datatype of each component in the attribute, e.g., individual elements in ColorGeometryInstanceAttribute#value.
默认值: Default Value: ComponentDatatype.UNSIGNED_BYTE

readonly componentsPerAttribute : number

属性中的组件数量,即 The number of components in the attributes, i.e., ColorGeometryInstanceAttribute#value.
默认值: Default Value: 4
When true and componentDatatype 是整数格式,指示当组件作为浮点进行渲染时应映射到范围 [0, 1](无符号)或 [-1, 1](有符号)。 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: true
存储在类型化数组中的属性值。 The values for the attributes stored in a typed array.
默认值: Default Value: [255, 255, 255, 255]

方法 Methods

static Cesium.ColorGeometryInstanceAttribute.equals(left, right)boolean

比较提供的 ColorGeometryInstanceAttributes 并返回 Compares the provided ColorGeometryInstanceAttributes and returns true 如果它们相等, if they are equal, false otherwise.
名称 Name 类型 Type 说明 Description
left ColorGeometryInstanceAttribute 可选 optional 第一个 ColorGeometryInstanceAttribute。 The first ColorGeometryInstanceAttribute.
right ColorGeometryInstanceAttribute 可选 optional 第二个 ColorGeometryInstanceAttribute。 The second ColorGeometryInstanceAttribute.
返回: Returns:
true 如果左和右相等, if left and right are equal, false otherwise.

static Cesium.ColorGeometryInstanceAttribute.fromColor(color)ColorGeometryInstanceAttribute

创建一个新的 Creates a new ColorGeometryInstanceAttribute 给定所提供的实例 instance given the provided Color.
名称 Name 类型 Type 说明 Description
color Color 颜色。 The color.
返回: Returns:
新的 The new ColorGeometryInstanceAttribute instance.
示例: Example:
const instance = new Cesium.GeometryInstance({
  geometry : geometry,
  attributes : {
    color : Cesium.ColorGeometryInstanceAttribute.fromColor(Cesium.Color.CORNFLOWERBLUE),
  }
});

static Cesium.ColorGeometryInstanceAttribute.toValue(color, result)Uint8Array

将颜色转换为可用于分配颜色属性的类型化数组。 Converts a color to a typed array that can be used to assign a color attribute.
名称 Name 类型 Type 说明 Description
color Color 颜色。 The color.
result Uint8Array 可选 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.color = Cesium.ColorGeometryInstanceAttribute.toValue(Cesium.Color.AQUA, attributes.color);
需要帮助吗?获得答案的最快方法是从社区和团队那里获得答案 Need help? The fastest way to get answers is from the community and team on the Cesium Forum.