Skip to content

Commit

Permalink
Use ShaderNodeObject for Material Node properties
Browse files Browse the repository at this point in the history
  • Loading branch information
Methuselah96 committed Jul 23, 2024
1 parent cf8707e commit 5a74d41
Show file tree
Hide file tree
Showing 6 changed files with 69 additions and 63 deletions.
5 changes: 3 additions & 2 deletions types/three/src/nodes/materials/MeshPhongNodeMaterial.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { Euler } from "../../math/Euler.js";
import { Vector2 } from "../../math/Vector2.js";
import { Texture } from "../../textures/Texture.js";
import Node from "../core/Node.js";
import { ShaderNodeObject } from "../shadernode/ShaderNode.js";
import NodeMaterial, { NodeMaterialParameters } from "./NodeMaterial.js";

export interface MeshPhongNodeMaterialParameters extends NodeMaterialParameters, MeshPhongMaterialParameters {
Expand All @@ -13,8 +14,8 @@ export interface MeshPhongNodeMaterialParameters extends NodeMaterialParameters,
export default class MeshPhongNodeMaterial extends NodeMaterial {
readonly isMeshPhongNodeMaterial: true;

shininessNode: Node | null;
specularNode: Node | null;
shininessNode: ShaderNodeObject<Node> | null;
specularNode: ShaderNodeObject<Node> | null;

// Properties from MeshPhongMaterial
readonly isMeshPhongMaterial: true;
Expand Down
35 changes: 18 additions & 17 deletions types/three/src/nodes/materials/MeshPhysicalNodeMaterial.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { Color } from "../../math/Color.js";
import { Vector2 } from "../../math/Vector2.js";
import { Texture } from "../../textures/Texture.js";
import Node from "../core/Node.js";
import { ShaderNodeObject } from "../shadernode/ShaderNode.js";
import MeshStandardNodeMaterial, { MeshStandardNodeMaterialParameters } from "./MeshStandardNodeMaterial.js";

export interface MeshPhysicalNodeMaterialParameters
Expand All @@ -13,29 +14,29 @@ export interface MeshPhysicalNodeMaterialParameters
export default class MeshPhysicalNodeMaterial extends MeshStandardNodeMaterial {
readonly isMeshPhysicalNodeMaterial: true;

clearcoatNode: Node | null;
clearcoatRoughnessNode: Node | null;
clearcoatNormalNode: Node | null;
clearcoatNode: ShaderNodeObject<Node> | null;
clearcoatRoughnessNode: ShaderNodeObject<Node> | null;
clearcoatNormalNode: ShaderNodeObject<Node> | null;

sheenNode: Node | null;
sheenRoughnessNode: Node | null;
sheenNode: ShaderNodeObject<Node> | null;
sheenRoughnessNode: ShaderNodeObject<Node> | null;

iridescenceNode: Node | null;
iridescenceIORNode: Node | null;
iridescenceThicknessNode: Node | null;
iridescenceNode: ShaderNodeObject<Node> | null;
iridescenceIORNode: ShaderNodeObject<Node> | null;
iridescenceThicknessNode: ShaderNodeObject<Node> | null;

iorNode: Node | null;
iorNode: ShaderNodeObject<Node> | null;

specularIntensityNode: Node | null;
specularColorNode: Node | null;
specularIntensityNode: ShaderNodeObject<Node> | null;
specularColorNode: ShaderNodeObject<Node> | null;

transmissionNode: Node | null;
thicknessNode: Node | null;
attenuationDistanceNode: Node | null;
attenuationColorNode: Node | null;
dispersionNode: Node | null;
transmissionNode: ShaderNodeObject<Node> | null;
thicknessNode: ShaderNodeObject<Node> | null;
attenuationDistanceNode: ShaderNodeObject<Node> | null;
attenuationColorNode: ShaderNodeObject<Node> | null;
dispersionNode: ShaderNodeObject<Node> | null;

anisotropyNode: Node | null;
anisotropyNode: ShaderNodeObject<Node> | null;

// Properties from MeshPhysicalMaterial
readonly isMeshPhysicalMaterial: true;
Expand Down
13 changes: 7 additions & 6 deletions types/three/src/nodes/materials/MeshSSSNodeMaterial.d.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import ConstNode from "../core/ConstNode.js";
import Node from "../core/Node.js";
import { ShaderNodeObject } from "../shadernode/ShaderNode.js";
import MeshPhysicalNodeMaterial, { MeshPhysicalNodeMaterialParameters } from "./MeshPhysicalNodeMaterial.js";

export default class MeshSSSNodeMaterial extends MeshPhysicalNodeMaterial {
thicknessColorNode: Node | null;
thicknessDistortionNode: ConstNode<number>;
thicknessAmbientNode: ConstNode<number>;
thicknessAttenuationNode: ConstNode<number>;
thicknessPowerNode: ConstNode<number>;
thicknessScaleNode: ConstNode<number>;
thicknessColorNode: ShaderNodeObject<Node> | null;
thicknessDistortionNode: ShaderNodeObject<ConstNode<number>>;
thicknessAmbientNode: ShaderNodeObject<ConstNode<number>>;
thicknessAttenuationNode: ShaderNodeObject<ConstNode<number>>;
thicknessPowerNode: ShaderNodeObject<ConstNode<number>>;
thicknessScaleNode: ShaderNodeObject<ConstNode<number>>;

constructor(parameters?: MeshPhysicalNodeMaterialParameters);

Expand Down
7 changes: 4 additions & 3 deletions types/three/src/nodes/materials/MeshStandardNodeMaterial.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { Euler } from "../../math/Euler.js";
import { Vector2 } from "../../math/Vector2.js";
import { Texture } from "../../textures/Texture.js";
import Node from "../core/Node.js";
import { ShaderNodeObject } from "../shadernode/ShaderNode.js";
import NodeMaterial, { NodeMaterialParameters } from "./NodeMaterial.js";

export interface MeshStandardNodeMaterialParameters extends NodeMaterialParameters, MeshStandardMaterialParameters {
Expand All @@ -13,10 +14,10 @@ export interface MeshStandardNodeMaterialParameters extends NodeMaterialParamete
export default class MeshStandardNodeMaterial extends NodeMaterial {
readonly isMeshStandardNodeMaterial: true;

emissiveNode: Node | null;
emissiveNode: ShaderNodeObject<Node> | null;

metalnessNode: Node | null;
roughnessNode: Node | null;
metalnessNode: ShaderNodeObject<Node> | null;
roughnessNode: ShaderNodeObject<Node> | null;

// Properties from MeshStandardMaterial
readonly isMeshStandardMaterial: true;
Expand Down
67 changes: 34 additions & 33 deletions types/three/src/nodes/materials/NodeMaterial.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import MRTNode from "../core/MRTNode.js";
import Node from "../core/Node.js";
import NodeBuilder from "../core/NodeBuilder.js";
import LightsNode from "../lighting/LightsNode.js";
import { ShaderNodeObject } from "../shadernode/ShaderNode.js";
import LineBasicNodeMaterial from "./LineBasicNodeMaterial.js";
import MeshBasicNodeMaterial from "./MeshBasicNodeMaterial.js";
import MeshMatcapNodeMaterial from "./MeshMatcapNodeMaterial.js";
Expand All @@ -33,26 +34,26 @@ export interface NodeMaterialParameters extends MaterialParameters {

colorSpaced?: boolean | undefined;

lightsNode?: LightsNode | null | undefined;
envNode?: Node | null | undefined;
aoNode?: Node | null | undefined;
lightsNode?: ShaderNodeObject<LightsNode> | null | undefined;
envNode?: ShaderNodeObject<Node> | null | undefined;
aoNode?: ShaderNodeObject<Node> | null | undefined;

colorNode?: Node | null | undefined;
normalNode?: Node | null | undefined;
opacityNode?: Node | null | undefined;
backdropNode?: Node | null | undefined;
backdropAlphaNode?: Node | null | undefined;
alphaTestNode?: Node | null | undefined;
colorNode?: ShaderNodeObject<Node> | null | undefined;
normalNode?: ShaderNodeObject<Node> | null | undefined;
opacityNode?: ShaderNodeObject<Node> | null | undefined;
backdropNode?: ShaderNodeObject<Node> | null | undefined;
backdropAlphaNode?: ShaderNodeObject<Node> | null | undefined;
alphaTestNode?: ShaderNodeObject<Node> | null | undefined;

positionNode?: Node | null | undefined;
positionNode?: ShaderNodeObject<Node> | null | undefined;

depthNode?: Node | null | undefined;
shadowNode?: Node | null | undefined;
depthNode?: ShaderNodeObject<Node> | null | undefined;
shadowNode?: ShaderNodeObject<Node> | null | undefined;

outputNode?: Node | null | undefined;
outputNode?: ShaderNodeObject<Node> | null | undefined;

fragmentNode?: Node | null | undefined;
vertexNode?: Node | null | undefined;
fragmentNode?: ShaderNodeObject<Node> | null | undefined;
vertexNode?: ShaderNodeObject<Node> | null | undefined;
}

export default class NodeMaterial extends Material {
Expand All @@ -62,34 +63,34 @@ export default class NodeMaterial extends Material {
lights: boolean;
normals: boolean;

lightsNode: LightsNode | null;
envNode: Node | null;
aoNode: Node | null;
lightsNode: ShaderNodeObject<LightsNode> | null;
envNode: ShaderNodeObject<Node> | null;
aoNode: ShaderNodeObject<Node> | null;

colorNode: Node | null;
normalNode: Node | null;
opacityNode: Node | null;
backdropNode: Node | null;
backdropAlphaNode: Node | null;
alphaTestNode: Node | null;
colorNode: ShaderNodeObject<Node> | null;
normalNode: ShaderNodeObject<Node> | null;
opacityNode: ShaderNodeObject<Node> | null;
backdropNode: ShaderNodeObject<Node> | null;
backdropAlphaNode: ShaderNodeObject<Node> | null;
alphaTestNode: ShaderNodeObject<Node> | null;

positionNode: Node | null;
positionNode: ShaderNodeObject<Node> | null;

depthNode: Node | null;
shadowNode: Node | null;
shadowPositionNode: Node | null;
depthNode: ShaderNodeObject<Node> | null;
shadowNode: ShaderNodeObject<Node> | null;
shadowPositionNode: ShaderNodeObject<Node> | null;

outputNode: Node | null;
mrtNode: MRTNode | null;
outputNode: ShaderNodeObject<Node> | null;
mrtNode: ShaderNodeObject<MRTNode> | null;

fragmentNode: Node | null;
vertexNode: Node | null;
fragmentNode: ShaderNodeObject<Node> | null;
vertexNode: ShaderNodeObject<Node> | null;

constructor();

build(builder: NodeBuilder): void;
setup(builder: NodeBuilder): void;
setupClipping(builder: NodeBuilder): ClippingNode | null;
setupClipping(builder: NodeBuilder): ShaderNodeObject<ClippingNode> | null;
setupDepth(builder: NodeBuilder): void;
setupPosition(builder: NodeBuilder): Node;
setupDiffuseColor(builder: NodeBuilder): void;
Expand Down
5 changes: 3 additions & 2 deletions types/three/src/nodes/materials/SpriteNodeMaterial.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { SpriteMaterialParameters } from "../../materials/SpriteMaterial.js";
import { Color } from "../../math/Color.js";
import { Texture } from "../../textures/Texture.js";
import Node from "../core/Node.js";
import { ShaderNodeObject } from "../shadernode/ShaderNode.js";
import NodeMaterial, { NodeMaterialParameters } from "./NodeMaterial.js";

export interface SpriteNodeMaterialParameters extends NodeMaterialParameters, SpriteMaterialParameters {
Expand All @@ -10,8 +11,8 @@ export interface SpriteNodeMaterialParameters extends NodeMaterialParameters, Sp
export default class SpriteNodeMaterial extends NodeMaterial {
isSpriteNodeMaterial: true;

rotationNode: Node | null;
scaleNode: Node | null;
rotationNode: ShaderNodeObject<Node> | null;
scaleNode: ShaderNodeObject<Node> | null;

// Properties from SpriteMaterial
readonly isSpriteMaterial: true;
Expand Down

0 comments on commit 5a74d41

Please sign in to comment.