writeElements

external fun writeElements(cartesian: Cartesian3, cartesianArray: ReadonlyArray<JsDouble>, index: Int)(source)

Encodes the provided cartesian, and writes it to an array with high components followed by low components, i.e. [high.x, high.y, high.z, low.x, low.y, low.z].

This is used to create interleaved high-precision position vertex attributes.

const positions = [
new Cartesian3(),
// ...
];
const encodedPositions = new Float32Array(2 * 3 * positions.length);
let j = 0;
for (let i = 0; i < positions.length; ++i) {
EncodedCartesian3.writeElement(positions[i], encodedPositions, j);
j += 6;
}

Parameters

cartesian

The cartesian to encode.

cartesianArray

The array to write to.

index

The index into the array to start writing. Six elements will be written.

See also