mirror of
https://github.com/mikolalysenko/glsl-read-float.git
synced 2025-12-08 21:26:01 +00:00
13 lines
259 B
JavaScript
13 lines
259 B
JavaScript
module.exports = decodeFloat
|
|
|
|
var UINT8_VIEW = new Uint8Array(4)
|
|
var FLOAT_VIEW = new Float32Array(UINT8_VIEW.buffer)
|
|
|
|
function decodeFloat(x, y, z, w) {
|
|
UINT8_VIEW[0] = w
|
|
UINT8_VIEW[1] = z
|
|
UINT8_VIEW[2] = y
|
|
UINT8_VIEW[3] = x
|
|
return FLOAT_VIEW[0]
|
|
}
|