From 3e28fcd81ab28be6d8fedb12fc9937a2311fbdf3 Mon Sep 17 00:00:00 2001 From: Nathan Bierema Date: Sat, 24 Aug 2024 16:19:55 -0400 Subject: [PATCH] Nodes: Add LightProbeNode. (#1175) * Nodes: Add LightProbeNode. * Update three.js * Add examples * Update patch and delete examples --- examples-testing/changes.patch | 51 ++++++++++++++----- three.js | 2 +- types/three/src/nodes/Nodes.d.ts | 1 + .../src/nodes/lighting/LightProbeNode.d.ts | 11 ++++ 4 files changed, 51 insertions(+), 14 deletions(-) create mode 100644 types/three/src/nodes/lighting/LightProbeNode.d.ts diff --git a/examples-testing/changes.patch b/examples-testing/changes.patch index b106af37c..e53529385 100644 --- a/examples-testing/changes.patch +++ b/examples-testing/changes.patch @@ -13665,6 +13665,44 @@ index cfd72172..ae3271f9 100644 } renderer.render(scene, camera); +diff --git a/examples-testing/examples/webgpu_lightprobe.ts b/examples-testing/examples/webgpu_lightprobe.ts +index a34ad2de..5a90c688 100644 +--- a/examples-testing/examples/webgpu_lightprobe.ts ++++ b/examples-testing/examples/webgpu_lightprobe.ts +@@ -1,16 +1,19 @@ +-import * as THREE from 'three'; ++import * as THREE from 'three/webgpu'; + + import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; + + import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; + import { LightProbeGenerator } from 'three/addons/lights/LightProbeGenerator.js'; + +-let mesh, renderer, scene, camera; ++let mesh: THREE.Mesh, ++ renderer: THREE.WebGPURenderer, ++ scene: THREE.Scene, ++ camera: THREE.PerspectiveCamera; + +-let gui; ++let gui: GUI; + +-let lightProbe; +-let directionalLight; ++let lightProbe: THREE.LightProbe; ++let directionalLight: THREE.DirectionalLight; + + // linear color space + const API = { +@@ -55,7 +58,7 @@ function init() { + scene.add(directionalLight); + + // envmap +- const genCubeUrls = function (prefix, postfix) { ++ const genCubeUrls = function (prefix: string, postfix: string) { + return [ + prefix + 'px' + postfix, + prefix + 'nx' + postfix, diff --git a/examples-testing/examples/webgpu_lights_ies_spotlight.ts b/examples-testing/examples/webgpu_lights_ies_spotlight.ts index 41b56de8..8f7abe1f 100644 --- a/examples-testing/examples/webgpu_lights_ies_spotlight.ts @@ -15843,16 +15881,3 @@ index 2cd50ba4..b97f3eee 100644 isDepthSupplied = false; }); -diff --git a/types/three/src/nodes/display/ColorAdjustmentNode.d.ts b/types/three/src/nodes/display/ColorAdjustmentNode.d.ts -index b49345bb..517407fc 100644 ---- a/types/three/src/nodes/display/ColorAdjustmentNode.d.ts -+++ b/types/three/src/nodes/display/ColorAdjustmentNode.d.ts -@@ -33,7 +33,7 @@ export const hue: ( - adjustmentNode?: NodeRepresentation, - ) => ShaderNodeObject; - --export const luminance: (a: NodeRepresentation, b: NodeRepresentation) => ShaderNodeObject; -+export const luminance: (a: NodeRepresentation, b?: NodeRepresentation) => ShaderNodeObject; - - export const threshold: (color: NodeRepresentation, thershold: NodeRepresentation) => ShaderNodeObject; - diff --git a/three.js b/three.js index cec6ded9a..5a7ef8995 160000 --- a/three.js +++ b/three.js @@ -1 +1 @@ -Subproject commit cec6ded9aff17859c939ba15c7cb537fa3389190 +Subproject commit 5a7ef89952256ce7fb9ae3401f27c5f12ec4e276 diff --git a/types/three/src/nodes/Nodes.d.ts b/types/three/src/nodes/Nodes.d.ts index dae8682db..adbe038a7 100644 --- a/types/three/src/nodes/Nodes.d.ts +++ b/types/three/src/nodes/Nodes.d.ts @@ -388,6 +388,7 @@ export { default as HemisphereLightNode } from "./lighting/HemisphereLightNode.j export { default as IrradianceNode } from "./lighting/IrradianceNode.js"; export { default as LightingContextNode, lightingContext } from "./lighting/LightingContextNode.js"; export { default as LightingNode } from "./lighting/LightingNode.js"; +export { default as LightProbeNode } from "./lighting/LightProbeNode.js"; export { default as LightsNode, lights } from "./lighting/LightsNode.js"; export { default as PointLightNode } from "./lighting/PointLightNode.js"; export { default as RectAreaLightNode, RectAreaLightTexturesLib } from "./lighting/RectAreaLightNode.js"; diff --git a/types/three/src/nodes/lighting/LightProbeNode.d.ts b/types/three/src/nodes/lighting/LightProbeNode.d.ts new file mode 100644 index 000000000..3a5b12963 --- /dev/null +++ b/types/three/src/nodes/lighting/LightProbeNode.d.ts @@ -0,0 +1,11 @@ +import { LightProbe } from "../../lights/LightProbe.js"; +import UniformArrayNode from "../accessors/UniformArrayNode.js"; +import AnalyticLightNode from "./AnalyticLightNode.js"; + +declare class LightProbeNode extends AnalyticLightNode { + lightProbe: UniformArrayNode; + + constructor(light?: LightProbe | null); +} + +export default LightProbeNode;