@woosh/meep-engine
Version:
Pure JavaScript game engine. Fully featured and production ready.
42 lines (40 loc) • 1.13 kB
JavaScript
import { BinaryDataType } from "../../../core/binary/type/BinaryDataType.js";
import {
ByteType,
FloatType,
HalfFloatType,
IntType,
ShortType,
UnsignedByteType,
UnsignedIntType,
UnsignedShortType
} from "three";
/**
*
* @param {BinaryDataType} dt
* @returns {number}
*/
export function computeThreeTextureTypeFromDataType(dt) {
switch (dt) {
case BinaryDataType.Uint8:
return UnsignedByteType;
case BinaryDataType.Uint16:
return UnsignedShortType;
case BinaryDataType.Uint32:
return UnsignedIntType;
case BinaryDataType.Int8:
return ByteType;
case BinaryDataType.Int16:
return ShortType;
case BinaryDataType.Int32:
return IntType;
case BinaryDataType.Float16:
return HalfFloatType;
case BinaryDataType.Float32:
return FloatType;
case BinaryDataType.Float64:
return FloatType;
default:
throw new Error(`Unsupported data type '${dt}'`);
}
}