Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ShadowBaseNode: Fix CSM shadowWorldPosition #1438

Merged
merged 2 commits into from
Dec 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions types/three/examples/jsm/csm/CSMShadowNode.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Camera, DirectionalLightShadow, Light, Node, Object3D } from "three/webgpu";
import { Camera, DirectionalLightShadow, Light, Object3D, ShadowBaseNode } from "three/webgpu";
import { CSMFrustum } from "./CSMFrustum.js";

export type CSMShadowNodeMode = "uniform" | "logarithmic" | "practical" | "custom";
Expand All @@ -20,8 +20,7 @@ declare class LwLight extends Object3D {
constructor();
}

declare class CSMShadowNode extends Node {
light: Light;
declare class CSMShadowNode extends ShadowBaseNode {
camera: Camera | null;
cascades: number;
maxFar: number;
Expand Down
1 change: 1 addition & 0 deletions types/three/src/Three.TSL.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,7 @@ export const select: typeof TSL.select;
export const setCurrentStack: typeof TSL.setCurrentStack;
export const shaderStages: typeof TSL.shaderStages;
export const shadow: typeof TSL.shadow;
export const shadowWorldPosition: typeof TSL.shadowWorldPosition;
export const sharedUniformGroup: typeof TSL.sharedUniformGroup;
export const sheen: typeof TSL.sheen;
export const sheenRoughness: typeof TSL.sheenRoughness;
Expand Down
1 change: 1 addition & 0 deletions types/three/src/nodes/Nodes.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ export { default as LightProbeNode } from "./lighting/LightProbeNode.js";
export { default as LightsNode } from "./lighting/LightsNode.js";
export { default as PointLightNode } from "./lighting/PointLightNode.js";
export { default as RectAreaLightNode, RectAreaLightTexturesLib } from "./lighting/RectAreaLightNode.js";
export { default as ShadowBaseNode } from "./lighting/ShadowBaseNode.js";
export { default as ShadowNode } from "./lighting/ShadowNode.js";
export { default as SpotLightNode } from "./lighting/SpotLightNode.js";

Expand Down
1 change: 1 addition & 0 deletions types/three/src/nodes/TSL.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ export * from "./accessors/Lights.js";
export * from "./lighting/LightingContextNode.js";
export * from "./lighting/LightsNode.js";
export * from "./lighting/PointLightNode.js";
export * from "./lighting/ShadowBaseNode.js";
export * from "./lighting/ShadowNode.js";

// pmrem
Expand Down
15 changes: 15 additions & 0 deletions types/three/src/nodes/lighting/ShadowBaseNode.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { Light } from "../../lights/Light.js";
import Node from "../core/Node.js";
import { ShaderNodeObject } from "../tsl/TSLCore.js";

declare class ShadowBaseNode extends Node {
light: Light;

readonly isShadowBasedNode: true;

constructor(light: Light);
}

export const shadowWorldPosition: ShaderNodeObject<Node>;

export default ShadowBaseNode;
3 changes: 2 additions & 1 deletion types/three/src/nodes/lighting/ShadowNode.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { Light } from "../../lights/Light.js";
import { LightShadow } from "../../lights/LightShadow.js";
import Node from "../core/Node.js";
import { NodeRepresentation, ShaderNodeObject } from "../tsl/TSLCore.js";
import ShadowBaseNode from "./ShadowBaseNode.js";

export const BasicShadowFilter: (
depthTexture: NodeRepresentation,
Expand All @@ -25,7 +26,7 @@ export const VSMShadowFilter: (
shadowCoord: NodeRepresentation,
) => ShaderNodeObject<Node>;

declare class ShadowNode extends Node {
declare class ShadowNode extends ShadowBaseNode {
constructor(light: Light, shadow: LightShadow | null);
}

Expand Down
Loading