UNPKG

playcanvas

Version:

PlayCanvas WebGL game engine

3 lines (2 loc) 745 B
declare const _default: "\n\n#ifndef FLOAT_AS_UINT\n#define FLOAT_AS_UINT\n\n// encode float value to RGBA8\nvec4 float2uint(float value) {\n uint intBits = floatBitsToUint(value);\n return vec4(\n float((intBits >> 24u) & 0xFFu) / 255.0,\n float((intBits >> 16u) & 0xFFu) / 255.0,\n float((intBits >> 8u) & 0xFFu) / 255.0,\n float(intBits & 0xFFu) / 255.0\n );\n}\n\n// decode RGBA8 value to float\nfloat uint2float(vec4 value) {\n uint intBits = \n (uint(value.r * 255.0) << 24u) |\n (uint(value.g * 255.0) << 16u) |\n (uint(value.b * 255.0) << 8u) |\n uint(value.a * 255.0);\n\n return uintBitsToFloat(intBits);\n}\n\n#endif // FLOAT_AS_UINT\n"; export default _default;