Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update nodes materials #757

Merged
merged 1 commit into from
Jan 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ import NodeMaterial from './NodeMaterial.js';
import { ShaderMaterialParameters } from '../../../../src/Three.js';

export default class LineBasicNodeMaterial extends NodeMaterial {
isLineBasicNodeMaterial: true;
readonly isLineBasicNodeMaterial: true;

constructor(parameters?: ShaderMaterialParameters);
copy(source: LineBasicNodeMaterial): this;
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@ import NodeMaterial from './NodeMaterial.js';
import { ShaderMaterialParameters } from '../../../../src/Three.js';

export default class MeshBasicNodeMaterial extends NodeMaterial {
isMeshBasicNodeMaterial: true;
lights: true;
readonly isMeshBasicNodeMaterial: true;

constructor(paramters?: ShaderMaterialParameters);
copy(source: MeshBasicNodeMaterial): this;
constructor(parameters?: ShaderMaterialParameters);
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ import { ShaderMaterialParameters } from '../../../../src/Three.js';

import MeshStandardNodeMaterial from './MeshStandardNodeMaterial.js';
import Node from '../core/Node.js';
import CheckerNode from '../procedural/CheckerNode.js';
import { ShaderNodeObject } from '../shadernode/ShaderNode.js';

export default class MeshPhysicalNodeMaterial extends MeshStandardNodeMaterial {
readonly isMeshPhysicalNodeMaterial: true;
Expand All @@ -15,9 +13,9 @@ export default class MeshPhysicalNodeMaterial extends MeshStandardNodeMaterial {
sheenNode: Node | null;
sheenRoughnessNode: Node | null;

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

iorNode?: Node | null;

Expand All @@ -30,6 +28,4 @@ export default class MeshPhysicalNodeMaterial extends MeshStandardNodeMaterial {
attenuationColorNode: Node | null;

constructor(parameters?: ShaderMaterialParameters);

copy(source: MeshPhysicalNodeMaterial): this;
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,12 @@ import Node from '../core/Node.js';
import NodeMaterial from './NodeMaterial.js';

export default class MeshStandardNodeMaterial extends NodeMaterial {
isMeshStandardNodeMaterial: true;
readonly isMeshStandardNodeMaterial: true;

emissiveNode: Node | null;

metalnessNode: Node | null;
roughnessNode: Node | null;

constructor(paramters?: ShaderMaterialParameters);
copy(source: MeshStandardNodeMaterial): this;
}
36 changes: 23 additions & 13 deletions types/three/examples/jsm/nodes/materials/NodeMaterial.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import {
} from '../../../../src/Three.js';
import NodeBuilder from '../core/NodeBuilder.js';
import Node from '../core/Node.js';
import { LightingModelNode } from '../lighting/LightingContextNode.js';
import LineBasicNodeMaterial from './LineBasicNodeMaterial.js';
import MeshBasicNodeMaterial from './MeshBasicNodeMaterial.js';
import MeshPhysicalNodeMaterial from './MeshPhysicalNodeMaterial.js';
Expand All @@ -19,12 +18,11 @@ import PointsNodeMaterial from './PointsNodeMaterial.js';
import SpriteNodeMaterial from './SpriteNodeMaterial.js';

export default class NodeMaterial extends ShaderMaterial {
isNodeMaterial: true;
readonly isNodeMaterial: true;

type: string;
normals: boolean;

lights: true;
normals: true;
colorSpaced: boolean;

lightsNode: Node | null;
envNode: Node | null;
Expand All @@ -38,17 +36,29 @@ export default class NodeMaterial extends ShaderMaterial {

positionNode: Node | null;

depthNode: Node | null;

outputNode: Node | null;

fragmentNode: Node | null;
vertexNode: Node | null;

constructor();

build(builder: NodeBuilder): void;
customProgramCacheKey(): string;
generatePosition(builder: NodeBuilder): void;
generateDiffuseColor(builder: NodeBuilder): void;
generateLight(
builder: NodeBuilder,
lights: { diffuseColorNode: Node; lightingModelNode: LightingModelNode; lightsNode?: Node },
): void;
generateOutput(builder: NodeBuilder, lights: { diffuseColorNode: Node; outgoingLightNode: Node }): void;
setup(builder: NodeBuilder): void;
setupDepth(builder: NodeBuilder): void;
setupPosition(builder: NodeBuilder): void;
setupDiffuseColor(builder: NodeBuilder): void;
setupVariants(builder: NodeBuilder): void;
setupNormal(): void;
getEnvNode(builder: NodeBuilder): void;
setupLights(builder: NodeBuilder): void;
setupLightingModel(builder: NodeBuilder): void;
setupLighting(builder: NodeBuilder): void;
setupOutput(builder: NodeBuilder, outputNode: Node): void;

setDefaultValues(material: Material): void;

static fromMaterial(material: LineBasicMaterial): LineBasicNodeMaterial;
static fromMaterial(material: MeshBasicMaterial): MeshBasicNodeMaterial;
Expand Down
10 changes: 2 additions & 8 deletions types/three/examples/jsm/nodes/materials/PointsNodeMaterial.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,7 @@ import { ShaderMaterialParameters } from '../../../../src/Three.js';
import { Node } from '../Nodes.js';

export default class PointsNodeMaterial extends NodeMaterial {
isPointsNodeMateria: true;
colorNode: Node | null;
opacityNode: Node | null;
alphaTestNode: Node | null;
lightNode: Node | null;
sizeNode: Node | null;
positionNode: Node | null;
readonly isPointsNodeMaterial: true;

constructor(parameters?: ShaderMaterialParameters);
copy(source: PointsNodeMaterial): this;
}
10 changes: 0 additions & 10 deletions types/three/examples/jsm/nodes/materials/SpriteNodeMaterial.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,8 @@ import Node from '../core/Node.js';
export default class SpriteNodeMaterial extends NodeMaterial {
isSpriteNodeMaterial: true;

colorNode: Node | null;
opacityNode: Node | null;

alphaTestNode: Node | null;

lightNode: Node | null;

positionNode: Node | null;
rotationNode: Node | null;
scaleNode: Node | null;

constructor(parameters?: ShaderMaterialParameters);
generatePosition(builder: NodeBuilder): void;
copy(source: SpriteNodeMaterial): this;
}