From f7d6c2cb36538d3bb82574f7763758bff95b7f35 Mon Sep 17 00:00:00 2001 From: Nathan Bierema Date: Sun, 21 Jul 2024 16:16:23 -0400 Subject: [PATCH] MeshBasicNodeMaterial: Refactor env map support. --- types/three/src/nodes/Nodes.d.ts | 1 + .../three/src/nodes/functions/BasicLightingModel.d.ts | 7 +++++++ .../three/src/nodes/functions/PhongLightingModel.d.ts | 4 ++-- .../three/src/nodes/lighting/BasicEnvironmentNode.d.ts | 10 ++++++++++ types/three/src/nodes/lighting/LightingNode.d.ts | 2 ++ types/three/src/nodes/materials/NodeMaterial.d.ts | 2 +- 6 files changed, 23 insertions(+), 3 deletions(-) create mode 100644 types/three/src/nodes/functions/BasicLightingModel.d.ts create mode 100644 types/three/src/nodes/lighting/BasicEnvironmentNode.d.ts diff --git a/types/three/src/nodes/Nodes.d.ts b/types/three/src/nodes/Nodes.d.ts index d2ac90fee..a89d715e8 100644 --- a/types/three/src/nodes/Nodes.d.ts +++ b/types/three/src/nodes/Nodes.d.ts @@ -366,6 +366,7 @@ export { compute, default as ComputeNode } from "./gpgpu/ComputeNode.js"; // lighting export { default as AnalyticLightNode } from "./lighting/AnalyticLightNode.js"; export { default as AONode } from "./lighting/AONode.js"; +export { default as BasicEnvironmentNode } from "./lighting/BasicEnvironmentNode.js"; export { default as EnvironmentNode } from "./lighting/EnvironmentNode.js"; export { default as HemisphereLightNode } from "./lighting/HemisphereLightNode.js"; export { default as IrradianceNode } from "./lighting/IrradianceNode.js"; diff --git a/types/three/src/nodes/functions/BasicLightingModel.d.ts b/types/three/src/nodes/functions/BasicLightingModel.d.ts new file mode 100644 index 000000000..a64fafd44 --- /dev/null +++ b/types/three/src/nodes/functions/BasicLightingModel.d.ts @@ -0,0 +1,7 @@ +import LightingModel from "../core/LightingModel.js"; + +declare class BasicLightingModel extends LightingModel { + constructor(); +} + +export default BasicLightingModel; diff --git a/types/three/src/nodes/functions/PhongLightingModel.d.ts b/types/three/src/nodes/functions/PhongLightingModel.d.ts index dc9b1f17b..5df595269 100644 --- a/types/three/src/nodes/functions/PhongLightingModel.d.ts +++ b/types/three/src/nodes/functions/PhongLightingModel.d.ts @@ -1,6 +1,6 @@ -import LightingModel from "../core/LightingModel.js"; +import BasicLightingModel from "./BasicLightingModel.js"; -export default class PhongLightingModel extends LightingModel { +export default class PhongLightingModel extends BasicLightingModel { specular: boolean; constructor(specular?: boolean); diff --git a/types/three/src/nodes/lighting/BasicEnvironmentNode.d.ts b/types/three/src/nodes/lighting/BasicEnvironmentNode.d.ts new file mode 100644 index 000000000..de244562f --- /dev/null +++ b/types/three/src/nodes/lighting/BasicEnvironmentNode.d.ts @@ -0,0 +1,10 @@ +import Node from "../core/Node.js"; +import LightingNode from "./LightingNode.js"; + +declare class BasicEnvironmentNode extends LightingNode { + envNode: Node | null; + + constructor(envNode?: Node | null); +} + +export default BasicEnvironmentNode; diff --git a/types/three/src/nodes/lighting/LightingNode.d.ts b/types/three/src/nodes/lighting/LightingNode.d.ts index b8657545a..3e8dd5424 100644 --- a/types/three/src/nodes/lighting/LightingNode.d.ts +++ b/types/three/src/nodes/lighting/LightingNode.d.ts @@ -1,5 +1,7 @@ import Node from "../core/Node.js"; export default abstract class LightingNode extends Node { + readonly isLightingNode: true; + constructor(); } diff --git a/types/three/src/nodes/materials/NodeMaterial.d.ts b/types/three/src/nodes/materials/NodeMaterial.d.ts index 366c947cf..5c1eab399 100644 --- a/types/three/src/nodes/materials/NodeMaterial.d.ts +++ b/types/three/src/nodes/materials/NodeMaterial.d.ts @@ -91,7 +91,7 @@ export default class NodeMaterial extends Material { setupDiffuseColor(builder: NodeBuilder): void; setupVariants(builder: NodeBuilder): void; setupNormal(builder: NodeBuilder): void; - getEnvNode(builder: NodeBuilder): Node | null; + setupEnvironment(builder: NodeBuilder): Node | null; setupLights(builder: NodeBuilder): LightsNode; setupLightingModel(builder: NodeBuilder): LightingModel; setupLighting(builder: NodeBuilder): Node;