UNPKG

threepipe

Version:

A modern 3D viewer framework built on top of three.js, written in TypeScript, designed to make creating high-quality, modular, and extensible 3D experiences on the web simple and enjoyable.

29 lines 1.14 kB
import { LinearSRGBColorSpace, NoColorSpace, RGBM16ColorSpace, SRGBColorSpace } from 'three'; // three.js WebGLProgram.js export function getTexelDecodingFunction(functionName, colorSpace) { let fn; switch (colorSpace) { case NoColorSpace: case LinearSRGBColorSpace: fn = ''; break; case SRGBColorSpace: // fn = 'sRGBToLinear' // todo required? fn = ''; break; case RGBM16ColorSpace: fn = 'RGBM16ToLinear'; break; default: console.warn('THREE.WebGLProgram: Unsupported color space:', colorSpace); fn = ''; break; } // return `vec4 ${functionName}( vec4 value ) { return ${components[ 0 ]}ToLinear${components[ 1 ]}; }`; // return `vec4 ${functionName}( vec4 value ) { return ${fn} ( value ); }` return `#define ${functionName}( value ) ${fn} ( value )`; } export function getTexelDecoding(mapName, colorSpace) { return getTexelDecodingFunction(mapName + 'TexelToLinear', colorSpace ?? LinearSRGBColorSpace) + '\n'; } //# sourceMappingURL=encoding.js.map