Skip to content

Commit

Permalink
TSL: NormalNode - Improve tree shaking using TSL (#968)
Browse files Browse the repository at this point in the history
  • Loading branch information
Methuselah96 authored May 18, 2024
1 parent 45ab48b commit 20192c2
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 28 deletions.
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>;

0 comments on commit 20192c2

Please sign in to comment.