From 72d60f1346640aff173b52479ba4673d442038c4 Mon Sep 17 00:00:00 2001 From: Nathan Bierema Date: Sun, 15 Dec 2024 16:41:59 -0500 Subject: [PATCH 1/2] ShadowBaseNode: Fix CSM shadowWorldPosition --- types/three/examples/jsm/csm/CSMShadowNode.d.ts | 5 ++--- types/three/src/Three.TSL.d.ts | 1 + types/three/src/nodes/Nodes.d.ts | 1 + types/three/src/nodes/TSL.d.ts | 1 + .../three/src/nodes/lighting/ShadowBaseNode.d.ts | 15 +++++++++++++++ types/three/src/nodes/lighting/ShadowNode.d.ts | 3 ++- 6 files changed, 22 insertions(+), 4 deletions(-) create mode 100644 types/three/src/nodes/lighting/ShadowBaseNode.d.ts diff --git a/types/three/examples/jsm/csm/CSMShadowNode.d.ts b/types/three/examples/jsm/csm/CSMShadowNode.d.ts index 7b7cd3a88..1f795e0e4 100644 --- a/types/three/examples/jsm/csm/CSMShadowNode.d.ts +++ b/types/three/examples/jsm/csm/CSMShadowNode.d.ts @@ -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; diff --git a/types/three/src/Three.TSL.d.ts b/types/three/src/Three.TSL.d.ts index a6660fac8..527d8cd48 100644 --- a/types/three/src/Three.TSL.d.ts +++ b/types/three/src/Three.TSL.d.ts @@ -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; diff --git a/types/three/src/nodes/Nodes.d.ts b/types/three/src/nodes/Nodes.d.ts index f569cb6aa..285d7e0ac 100644 --- a/types/three/src/nodes/Nodes.d.ts +++ b/types/three/src/nodes/Nodes.d.ts @@ -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"; diff --git a/types/three/src/nodes/TSL.d.ts b/types/three/src/nodes/TSL.d.ts index 92c50b62c..fe30989b8 100644 --- a/types/three/src/nodes/TSL.d.ts +++ b/types/three/src/nodes/TSL.d.ts @@ -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 diff --git a/types/three/src/nodes/lighting/ShadowBaseNode.d.ts b/types/three/src/nodes/lighting/ShadowBaseNode.d.ts new file mode 100644 index 000000000..a6a0bc639 --- /dev/null +++ b/types/three/src/nodes/lighting/ShadowBaseNode.d.ts @@ -0,0 +1,15 @@ +import { Light } from "../../lights/Light"; +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; + +export default ShadowBaseNode; diff --git a/types/three/src/nodes/lighting/ShadowNode.d.ts b/types/three/src/nodes/lighting/ShadowNode.d.ts index e9c4acf58..f54eac1f1 100644 --- a/types/three/src/nodes/lighting/ShadowNode.d.ts +++ b/types/three/src/nodes/lighting/ShadowNode.d.ts @@ -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; -declare class ShadowNode extends Node { +declare class ShadowNode extends ShadowBaseNode { constructor(light: Light, shadow: LightShadow | null); } From 1d9062004a18535b8b477e07024af33f827e4d81 Mon Sep 17 00:00:00 2001 From: Nathan Bierema Date: Sun, 15 Dec 2024 16:43:18 -0500 Subject: [PATCH 2/2] Update --- types/three/src/nodes/lighting/ShadowBaseNode.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/three/src/nodes/lighting/ShadowBaseNode.d.ts b/types/three/src/nodes/lighting/ShadowBaseNode.d.ts index a6a0bc639..b25613a07 100644 --- a/types/three/src/nodes/lighting/ShadowBaseNode.d.ts +++ b/types/three/src/nodes/lighting/ShadowBaseNode.d.ts @@ -1,4 +1,4 @@ -import { Light } from "../../lights/Light"; +import { Light } from "../../lights/Light.js"; import Node from "../core/Node.js"; import { ShaderNodeObject } from "../tsl/TSLCore.js";