Skip to content

Commit

Permalink
ShadowBaseNode: Fix CSM shadowWorldPosition (#1438)
Browse files Browse the repository at this point in the history
* ShadowBaseNode: Fix CSM shadowWorldPosition

* Update
Methuselah96 authored Dec 15, 2024
1 parent a1ccd68 commit fb83610
Showing 6 changed files with 22 additions and 4 deletions.
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";
@@ -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;
1 change: 1 addition & 0 deletions types/three/src/Three.TSL.d.ts
Original file line number Diff line number Diff line change
@@ -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;
1 change: 1 addition & 0 deletions types/three/src/nodes/Nodes.d.ts
Original file line number Diff line number Diff line change
@@ -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";

1 change: 1 addition & 0 deletions types/three/src/nodes/TSL.d.ts
Original file line number Diff line number Diff line change
@@ -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
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
@@ -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,
@@ -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);
}

0 comments on commit fb83610

Please sign in to comment.