og/math/doubleToTwoFloats

Source: doubleToTwoFloats.ts:7

Splits 64-bit values into two 32-bit floats, high and low, for the GPU. No dependencies, so the workers import it without the math classes.


Instance Methods

doubleToTwoFloats2( value: number, highLowArr: NumberArray2 | Float32Array, ): NumberArray2 | Float32Array

Separate 64 bit value to two 32-bit float values.

Parameters

  • value (number) — Double type value.
  • highLowArr (NumberArray2 | Float32Array) — Reference output array.

Returns

  • NumberArray2 | Float32Array — Encoded array. (exactly 2 entries)

doubleToTwoFloatsV2(value: number, highLowVec: Vec2): Vec2

Separate 64 bit value to two 32-bit float values.

Parameters

  • value (number) — Double type value.
  • highLowVec (Vec2) — Reference out vector object.

Returns

  • Vec2 — Encoded array. (exactly 2 entries)

doubleToTwoFloatsV3(v: XYZ, high: XYZ, low: XYZ)

Splits a 64-bit 3d vector into two vectors with 32-bit float components.

Parameters

  • v (XYZ) — Double type value.
  • high (XYZ) — Out vector high values.
  • low (XYZ) — Out vector low values.

doubleToTwoFloat32Array( v: XYZ, high: Float32Array | NumberArray3, low: Float32Array | NumberArray3, )

Splits a 64-bit 3d vector into two arrays with 32-bit float components.

Parameters

  • v (XYZ) — Double type value.
  • high (Float32Array | NumberArray3) — Out high values.
  • low (Float32Array | NumberArray3) — Out low values.