Skip to content

Commit

Permalink
TSL: Add workingToColorSpace, colorSpaceToWorking (#1260)
Browse files Browse the repository at this point in the history
  • Loading branch information
Methuselah96 authored Sep 24, 2024
1 parent e6fdf2f commit d4a287e
Showing 1 changed file with 26 additions and 7 deletions.
33 changes: 26 additions & 7 deletions types/three/src/nodes/display/ColorSpaceNode.d.ts
Original file line number Diff line number Diff line change
@@ -1,35 +1,54 @@
import { ColorSpace, LinearSRGBColorSpace, SRGBColorSpace } from "../../constants.js";
import Node from "../core/Node.js";
import NodeBuilder from "../core/NodeBuilder.js";
import TempNode from "../core/TempNode.js";
import { NodeRepresentation, ShaderNodeObject } from "../tsl/TSLCore.js";

export type WorkingOrOutputColorSpace = "WorkingColorSpace" | "OutputColorSpace";

export type ColorSpaceMethod = "LinearTosRGB" | "sRGBToLinear" | "LinearToLinear" | "sRGBTosRGB";

export const getColorSpaceMethod: (
export function getColorSpaceMethod(
source: typeof LinearSRGBColorSpace | typeof SRGBColorSpace,
target: typeof LinearSRGBColorSpace | typeof SRGBColorSpace,
) => ColorSpaceMethod;
): ColorSpaceMethod;

export default class ColorSpaceNode extends TempNode {
colorNode: Node;
target: ColorSpace | null;
source: ColorSpace | null;
source: WorkingOrOutputColorSpace | ColorSpace;
target: WorkingOrOutputColorSpace | ColorSpace;

constructor(
colorNode: Node,
source: WorkingOrOutputColorSpace | ColorSpace,
target: WorkingOrOutputColorSpace | ColorSpace,
);

constructor(colorNode: Node, target?: ColorSpace | null, source?: ColorSpace | null);
getColorSpace(nodeBuilder: NodeBuilder, colorSpace: WorkingOrOutputColorSpace): ColorSpace;
}

export const toOutputColorSpace: (
node: NodeRepresentation,
colorSpace?: ColorSpace | null,
) => ShaderNodeObject<ColorSpaceNode>;
export const toWorkingColorSpace: (
node: NodeRepresentation,
colorSpace?: ColorSpace | null,
) => ShaderNodeObject<ColorSpaceNode>;

export const workingToColorSpace: (
node: NodeRepresentation,
colorSpace: ColorSpace,
) => ShaderNodeObject<ColorSpaceNode>;
export const colorSpaceToWorking: (
node: NodeRepresentation,
colorSpace: ColorSpace,
) => ShaderNodeObject<ColorSpaceNode>;

declare module "../tsl/TSLCore.js" {
interface NodeElements {
toOutputColorSpace: typeof toOutputColorSpace;
toWorkingColorSpace: typeof toWorkingColorSpace;

workingToColorSpace: typeof workingToColorSpace;
colorSpaceToWorking: typeof colorSpaceToWorking;
}
}

0 comments on commit d4a287e

Please sign in to comment.