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

每英寸几何颜色的值和类型信息.
Name Type Default Description
red number 1.0 optional 红色组件.
green number 1.0 optional 绿色成分.
blue number 1.0 optional 蓝色成分.
alpha number 1.0 optional α组件.
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

readonly componentDatatype : ComponentDatatype

The datatype of each component in the attribute, e.g., individual elements in ColorGeometryInstanceAttribute#value.
Default Value: ComponentDatatype.UNSIGNED_BYTE

readonly componentsPerAttribute : number

属性中的组件数, i.e ., ColorGeometryInstanceAttribute#value .
Default Value: 4

readonly normalize : boolean

当 NT 0 true NT 1 和 NT 2 组件Datatype NT 3 是一个整数格式时, indicate that the components should be mapped to the range [0, 1] (unsigned) 或[-1, 1] (署名),当它们作为浮点进行渲染时.
Default Value: true

value : Uint8Array

输入数组中存储属性的值 .
Default Value: [255, 255, 255, 255]

Methods

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

比较提供的颜色图形属性和返回 -NT+0+Treal NT+1+,如果两者是相等的, NT+2+false NT+3+否则.
Name Type Description
left ColorGeometryInstanceAttribute optional 首个色彩测量InstanceAttize.
right ColorGeometryInstanceAttribute optional 第二色相几何内存属性.
Returns:
如果左右对等, 则使用 NT 0 true NT 1 , 否则使用 NT 2 false NT 3 .

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

将一个颜色转换成可以用来指定颜色属性的打字数组.
Name Type Description
color Color The color.
result Uint8Array optional 如果创建未定义的新实例, 将存储结果的数组 .
Returns:
如果结果未定义, 修改后的结果参数或新实例 .
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.