Skip to content

Commit

Permalink
Nodes: Add LightProbeNode. (#1175)
Browse files Browse the repository at this point in the history
* Nodes: Add LightProbeNode.

* Update three.js

* Add examples

* Update patch and delete examples
  • Loading branch information
Methuselah96 committed Aug 24, 2024
1 parent bb0f759 commit 3e28fcd
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 14 deletions.
51 changes: 38 additions & 13 deletions examples-testing/changes.patch
Original file line number Diff line number Diff line change
Expand Up @@ -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<THREE.SphereGeometry, THREE.MeshStandardMaterial>,
+ 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
Expand Down Expand Up @@ -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<ColorAdjustmentNode>;

-export const luminance: (a: NodeRepresentation, b: NodeRepresentation) => ShaderNodeObject<MathNode>;
+export const luminance: (a: NodeRepresentation, b?: NodeRepresentation) => ShaderNodeObject<MathNode>;

export const threshold: (color: NodeRepresentation, thershold: NodeRepresentation) => ShaderNodeObject<MathNode>;

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 @@ -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";
Expand Down
11 changes: 11 additions & 0 deletions types/three/src/nodes/lighting/LightProbeNode.d.ts
Original file line number Diff line number Diff line change
@@ -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> {
lightProbe: UniformArrayNode;

constructor(light?: LightProbe | null);
}

export default LightProbeNode;

0 comments on commit 3e28fcd

Please sign in to comment.