playcanvas
Version:
Open-source WebGL/WebGPU 3D engine for the web
29 lines (28 loc) • 642 B
JavaScript
const decodeTable = {
"linear": "decodeLinear",
"srgb": "decodeGamma",
"rgbm": "decodeRGBM",
"rgbe": "decodeRGBE",
"rgbp": "decodeRGBP",
"xy": "unpackNormalXY",
"xyz": "unpackNormalXYZ"
};
const encodeTable = {
"linear": "encodeLinear",
"srgb": "encodeGamma",
"rgbm": "encodeRGBM",
"rgbe": "encodeRGBE",
"rgbp": "encodeRGBP"
};
class ChunkUtils {
// returns the name of the decode function for the texture encoding
static decodeFunc(encoding) {
return decodeTable[encoding] ?? "decodeGamma";
}
static encodeFunc(encoding) {
return encodeTable[encoding] ?? "encodeGamma";
}
}
export {
ChunkUtils
};