UNPKG

@woosh/meep-engine

Version:

Pure JavaScript game engine. Fully featured and production ready.

20 lines (17 loc) 738 B
import { NumericType } from "../../../core/math/NumericType.js"; import { channelCountToThreeTextureFormat } from "./channelCountToThreeTextureFormat.js"; import { channelCountToThreIntegerTextureType } from "./channelCountToThreIntegerTextureType.js"; /** * * @param {NumericType} type * @param {number} channel_count */ export function computeThreeTextureFormat(type, channel_count) { if (type === NumericType.Uint || type === NumericType.Int) { return channelCountToThreIntegerTextureType(channel_count); } else if (type === NumericType.Float) { return channelCountToThreeTextureFormat(channel_count); } else { throw new Error(`Unsupported numeric type '${type}'`); } }