pex-gui
Version:
GUI controls for PEX.
23 lines (20 loc) • 599 B
JavaScript
export default /* glsl */ `
#define LINEAR 1
#define GAMMA 2
#define SRGB 3
#define RGBM 4
vec4 decode(vec4 pixel, int encoding) {
if (encoding == LINEAR) return pixel;
if (encoding == GAMMA) return toLinear(pixel);
if (encoding == SRGB) return toLinear(pixel);
if (encoding == RGBM) return vec4(decodeRGBM(pixel), 1.0);
return pixel;
}
vec4 encode(vec4 pixel, int encoding) {
if (encoding == LINEAR) return pixel;
if (encoding == GAMMA) return toGamma(pixel);
if (encoding == SRGB) return toGamma(pixel);
if (encoding == RGBM) return encodeRGBM(pixel.rgb);
return pixel;
}
`;