Class: ColorGeometryInstanceAttribute

ColorGeometryInstanceAttribute

new ColorGeometryInstanceAttribute(redopt, greenopt, blueopt, alphaopt)

Value and type information for per-instance geometry color.
Parameters:
Name Type Attributes Default Description
red Number <optional>
1.0 The red component.
green Number <optional>
1.0 The green component.
blue Number <optional>
1.0 The blue component.
alpha Number <optional>
1.0 The alpha component.
Source:
See:
Example
var 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)
  }
});

Members

(readonly) componentDatatype :ComponentDatatype

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

(readonly) componentsPerAttribute :Number

The number of components in the attributes, i.e., ColorGeometryInstanceAttribute#value.
Type:
  • Number
Default Value:
  • 4
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:
  • true
Source:

value :Uint8Array

The values for the attributes stored in a typed array.
Type:
  • Uint8Array
Default Value:
  • [255, 255, 255, 255]
Source:

Methods

(static) equals(leftopt, rightopt) → {Boolean}

Compares the provided ColorGeometryInstanceAttributes and returns true if they are equal, false otherwise.
Parameters:
Name Type Attributes Description
left ColorGeometryInstanceAttribute <optional>
The first ColorGeometryInstanceAttribute.
right ColorGeometryInstanceAttribute <optional>
The second ColorGeometryInstanceAttribute.
Source:
Returns:
true if left and right are equal, false otherwise.
Type
Boolean

(static) fromColor(color) → {ColorGeometryInstanceAttribute}

Creates a new ColorGeometryInstanceAttribute instance given the provided Color.
Parameters:
Name Type Description
color Color The color.
Source:
Returns:
The new ColorGeometryInstanceAttribute instance.
Type
ColorGeometryInstanceAttribute
Example
var instance = new Cesium.GeometryInstance({
  geometry : geometry,
  attributes : {
    color : Cesium.ColorGeometryInstanceAttribute.fromColor(Cesium.Color.CORNFLOWERBLUE),
  }
});

(static) toValue(color, resultopt) → {Uint8Array}

Converts a color to a typed array that can be used to assign a color attribute.
Parameters:
Name Type Attributes Description
color Color The color.
result Uint8Array <optional>
The array to store the result in, if undefined a new instance will be created.
Source:
Returns:
The modified result parameter or a new instance if result was undefined.
Type
Uint8Array
Example
var attributes = primitive.getGeometryInstanceAttributes('an id');
attributes.color = Cesium.ColorGeometryInstanceAttribute.toValue(Cesium.Color.AQUA, attributes.color);