ColorManagement
Manages the working color space and conversions between color spaces.
Ported from three.js ColorManagement (created via createColorManagement()). Modelled as a Kotlin object so that ported three.js code keeps calling ColorManagement.convert(...) etc. verbatim. Like three.js, this holds mutable global state (enabled, workingColorSpace) and is not thread-safe.
The renderer-facing helpers (getToneMappingMode, _getDrawingBufferColorSpace, _getUnpackColorSpace, define, Display-P3 spaces) are omitted from the math port because the color-space definitions here do not carry the optional outputColorSpaceConfig/workingColorSpaceConfig; they belong to the (not yet ported) renderer layer.
Properties
Implementations of supported color spaces, keyed by ColorSpace. Mirrors three.js's ColorManagement.spaces.
The working color space. Colors store their components in this space.
Functions
Converts color from sourceColorSpace to the workingColorSpace.
Converts the given color from sourceColorSpace to targetColorSpace, mutating and returning it. Returns the color unchanged when color management is disabled, the spaces match, or either space is ColorSpace.NoColorSpace.
Registers (or overrides) the given colorSpaces into spaces. Corresponds to three.js's ColorManagement.define().
Deprecated alias for workingToColorSpace (renamed in three.js r177).
Writes the luminance coefficients of the given colorSpace into target.
Copies spaces[sourceColorSpace].toXYZ into targetMatrix and multiplies it by spaces[targetColorSpace].fromXYZ, producing the source->target RGB transform.
Returns the primaries (chromaticity coordinates) of the given colorSpace.
Returns the transfer function of the given colorSpace. Returns ColorTransfer.Linear for ColorSpace.NoColorSpace.
Deprecated alias for colorSpaceToWorking (renamed in three.js r177).
Converts color from the workingColorSpace to targetColorSpace.