The following methods are exported:
intBitsToFloat
floatToIntBits
intToFloatColor
colorToFloat
isPowerOfTwo
nextPowerOfTwo
var util = require('number-util');
//packs the RGBA color red into a single float
var color = util.colorToFloat(255, 0, 0, 255);
In WebGL, it's often desirable to pack RGBA data into a single float to reduce buffer upload bandwidth, at the expense of some precision loss.
Typed arrays are used to perform the casting.