-
-
Notifications
You must be signed in to change notification settings - Fork 162
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
WebGLRenderer: Support "Linear Display P3" working color space and "D…
…isplay P3" unlit rendering (#608)
- Loading branch information
1 parent
0a221be
commit 1572c35
Showing
6 changed files
with
48 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,46 @@ | ||
import { ColorSpace, DisplayP3ColorSpace, LinearSRGBColorSpace, SRGBColorSpace } from '../constants.js'; | ||
import { | ||
ColorSpace, | ||
ColorSpacePrimaries, | ||
ColorSpaceTransfer, | ||
DisplayP3ColorSpace, | ||
LinearDisplayP3ColorSpace, | ||
LinearSRGBColorSpace, | ||
SRGBColorSpace, | ||
} from '../constants.js'; | ||
import { Color } from './Color.js'; | ||
|
||
export function SRGBToLinear(c: number): number; | ||
|
||
export function LinearToSRGB(c: number): number; | ||
export type WorkingColorSpace = typeof LinearSRGBColorSpace | typeof LinearDisplayP3ColorSpace; | ||
export type DefinedColorSpace = | ||
| typeof LinearSRGBColorSpace | ||
| typeof SRGBColorSpace | ||
| typeof LinearDisplayP3ColorSpace | ||
| typeof DisplayP3ColorSpace; | ||
|
||
export namespace ColorManagement { | ||
export interface ColorManagement { | ||
/** | ||
* @default false | ||
*/ | ||
let enabled: boolean; | ||
enabled: boolean; | ||
|
||
/** | ||
* @default LinearSRGBColorSpace | ||
*/ | ||
let workingColorSpace: ColorSpace; | ||
|
||
function convert( | ||
color: Color, | ||
sourceColorSpace: typeof SRGBColorSpace | typeof LinearSRGBColorSpace | typeof DisplayP3ColorSpace, | ||
targetColorSpace: typeof SRGBColorSpace | typeof LinearSRGBColorSpace | typeof DisplayP3ColorSpace, | ||
): Color; | ||
|
||
function fromWorkingColorSpace( | ||
color: Color, | ||
targetColorSpace: typeof SRGBColorSpace | typeof LinearSRGBColorSpace | typeof DisplayP3ColorSpace, | ||
): Color; | ||
|
||
function toWorkingColorSpace( | ||
color: Color, | ||
sourceColorSpace: typeof SRGBColorSpace | typeof LinearSRGBColorSpace | typeof DisplayP3ColorSpace, | ||
): Color; | ||
get workingColorSpace(): WorkingColorSpace; | ||
set workingSpaceColor(colorSpace: WorkingColorSpace); | ||
|
||
convert: (color: Color, sourceColorSpace: DefinedColorSpace, targetColorSpace: DefinedColorSpace) => Color; | ||
|
||
fromWorkingColorSpace: (color: Color, targetColorSpace: DefinedColorSpace) => Color; | ||
|
||
toWorkingColorSpace: (color: Color, sourceColorSpace: DefinedColorSpace) => Color; | ||
|
||
getPrimaries: (colorSpace: DefinedColorSpace) => ColorSpacePrimaries; | ||
|
||
getTransfer: (colorSpace: ColorSpace) => ColorSpaceTransfer; | ||
} | ||
|
||
export const ColorManagement: ColorManagement; | ||
|
||
export function SRGBToLinear(c: number): number; | ||
|
||
export function LinearToSRGB(c: number): number; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters