threepipe
Version:
A 3D viewer framework built on top of three.js in TypeScript with a focus on quality rendering, modularity and extensibility.
56 lines • 2.18 kB
JavaScript
import { AdditiveBlending, BasicDepthPacking, ByteType, CubeReflectionMapping, CubeUVReflectionMapping, CustomBlending, DisplayP3ColorSpace, EquirectangularReflectionMapping, FloatType, HalfFloatType, IntType, LinearSRGBColorSpace, MultiplyBlending, NoBlending, NormalBlending, RGBADepthPacking, RGBM16ColorSpace, ShortType, SRGBColorSpace, SubtractiveBlending, UnsignedByteType, UnsignedInt248Type, UnsignedIntType, UnsignedShort4444Type, UnsignedShort5551Type, UnsignedShortType, UVMapping, } from 'three';
const blending = {
None: NoBlending,
Normal: NormalBlending,
Additive: AdditiveBlending,
Subtractive: SubtractiveBlending,
Multiply: MultiplyBlending,
Custom: CustomBlending,
};
const mapping = {
UV: UVMapping,
Cube: CubeReflectionMapping,
// CubeRefraction: CubeRefractionMapping,
CubeUV: CubeUVReflectionMapping,
Equirectangular: EquirectangularReflectionMapping,
// EquirectangularRefraction: EquirectangularRefractionMapping,
};
const colorSpace = {
None: '',
SRGB: SRGBColorSpace,
LinearSRGB: LinearSRGBColorSpace,
RGBM16: RGBM16ColorSpace,
DisplayP3: DisplayP3ColorSpace,
};
const textureDataType = {
UnsignedByte: UnsignedByteType,
Byte: ByteType,
Short: ShortType,
UnsignedShort: UnsignedShortType,
Int: IntType,
UnsignedInt: UnsignedIntType,
Float: FloatType,
HalfFloat: HalfFloatType,
UnsignedShort4444: UnsignedShort4444Type,
UnsignedShort5551: UnsignedShort5551Type,
UnsignedInt248: UnsignedInt248Type,
};
const depthPackingStrategies = {
Basic: BasicDepthPacking,
RGBADepthPacking: RGBADepthPacking,
};
function makeMapping(a) {
return {
map: a,
inv: Object.fromEntries(Object.entries(a).map(([k, v]) => [v, k])),
uiConfig: Object.entries(a).map(([k, v]) => ({ label: k, value: v })),
};
}
export const threeConstMappings = {
Blending: makeMapping(blending),
AnyMapping: makeMapping(mapping),
ColorSpace: makeMapping(colorSpace),
TextureDataType: makeMapping(textureDataType),
DepthPackingStrategies: makeMapping(depthPackingStrategies),
};
//# sourceMappingURL=const-mappings.js.map