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

TSL: NormalNode - Improve tree shaking using TSL #968

Merged
merged 1 commit into from
May 18, 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
10 changes: 1 addition & 9 deletions types/three/examples/jsm/nodes/Nodes.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -266,15 +266,7 @@ export {
modelWorldMatrix,
} from "./accessors/ModelNode.js";
export { default as ModelViewProjectionNode, modelViewProjection } from "./accessors/ModelViewProjectionNode.js";
export {
default as NormalNode,
normalGeometry,
normalLocal,
NormalNodeScope,
normalView,
normalWorld,
transformedNormalView,
} from "./accessors/NormalNode.js";
export * from "./accessors/NormalNode.js";
export {
default as Object3DNode,
objectDirection,
Expand Down
26 changes: 9 additions & 17 deletions types/three/examples/jsm/nodes/accessors/NormalNode.d.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,12 @@
import Node from "../core/Node.js";
import AttributeNode from "../core/AttributeNode.js";
import PropertyNode from "../core/PropertyNode.js";
import VarNode from "../core/VarNode.js";
import MathNode from "../math/MathNode.js";
import { ShaderNodeObject } from "../shadernode/ShaderNode.js";

export type NormalNodeScope = typeof NormalNode.GEOMETRY | typeof NormalNode.LOCAL | typeof NormalNode.VIEW;

export default class NormalNode extends Node {
static GEOMETRY: "geometry";
static LOCAL: "local";
static VIEW: "view";
scope: NormalNodeScope;

constructor(scope?: NormalNodeScope);
}

export const normalGeometry: ShaderNodeObject<NormalNode>;
export const normalLocal: ShaderNodeObject<NormalNode>;
export const normalView: ShaderNodeObject<NormalNode>;
export const normalWorld: ShaderNodeObject<NormalNode>;
export const transformedNormalView: ShaderNodeObject<VarNode>;
export const normalGeometry: ShaderNodeObject<AttributeNode>;
export const normalLocal: ShaderNodeObject<VarNode>;
export const normalView: ShaderNodeObject<MathNode>;
export const normalWorld: ShaderNodeObject<MathNode>;
export const transformedNormalView: ShaderNodeObject<PropertyNode>;
export const transformedClearcoatNormalView: ShaderNodeObject<PropertyNode>;
8 changes: 6 additions & 2 deletions types/three/examples/jsm/nodes/core/AttributeNode.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ShaderNodeObject } from "../shadernode/ShaderNode.js";
import { NodeRepresentation, ShaderNodeObject } from "../shadernode/ShaderNode.js";
import { NodeTypeOption } from "./constants.js";
import Node from "./Node.js";
import NodeBuilder from "./NodeBuilder.js";
Expand All @@ -13,4 +13,8 @@ export default class AttributeNode extends Node {
getAttributeName(builder: NodeBuilder): string;
}

export const attribute: (name: string, nodeType: NodeTypeOption) => ShaderNodeObject<Node>;
export const attribute: (
name: string,
nodeType?: NodeTypeOption | null,
defaultNode?: NodeRepresentation,
) => ShaderNodeObject<Node>;
Loading