ColorIndex Class

Describes the color(s) of the vertices of a MeshArgs or PolylineArgs. This may be a uniform color to be applied to every vertex, or a table specifying individual per-vertex colors.

Methods

Name Description
constructor(): ColorIndex Construct a default index specifying a uniform white color.  
initNonUniform(colors: Uint32Array, indices: number[], hasAlpha: boolean): void Set the per-vertex colors.  
initUniform(color: number | ColorDef): void Set the specified color to be applied to all vertices.  
reset(): void Reset this index to specify a uniform white color.  

Properties

Name Type Description
hasAlpha Accessor ReadOnly boolean Whether the color(s) in this index have transparency.  
isUniform Accessor ReadOnly boolean Whether this index specifies a single uniform color for the entire mesh or polyline.  
nonUniform Accessor ReadOnly undefined | NonUniformColor Returns the per-vertex colors, if isUniform is false; or undefined otherwise.  
numColors Accessor ReadOnly number The number of colors in this index.  
uniform Accessor ReadOnly undefined | ColorDef Returns the single color to be applied to all vertices, if isUniform is true; or undefined otherwise.  

Defined in

Last Updated: 21 November, 2024