UNPKG

@woosh/meep-engine

Version:

Pure JavaScript game engine. Fully featured and production ready.

38 lines (35 loc) 863 B
import { RedFormat, RedIntegerFormat, RGB_S3TC_DXT1_Format, RGBA_S3TC_DXT1_Format, RGBA_S3TC_DXT3_Format, RGBA_S3TC_DXT5_Format, RGBAFormat, RGFormat } from "three"; import { GL_RGBFormat } from "./GL_RGBFormat.js"; /** * * @param {number} format * @returns {number} */ export function formatToChannelCount(format) { switch (format) { case RedFormat: case RedIntegerFormat: return 1; case RGFormat: return 2; case GL_RGBFormat: case RGB_S3TC_DXT1_Format: return 3; case RGBAFormat: case RGBA_S3TC_DXT1_Format: case RGBA_S3TC_DXT3_Format: case RGBA_S3TC_DXT5_Format: return 4; default: throw new Error(`Unsupported format '${format}'`); } }