UNPKG

4.38 kBTypeScriptView Raw
1import { Camera } from "../../../cameras/Camera.js";
2import { Object3D } from "../../../core/Object3D.js";
3import { Material } from "../../../materials/Material.js";
4import { Color } from "../../../math/Color.js";
5import Node from "../../../nodes/core/Node.js";
6import NodeBuilder from "../../../nodes/core/NodeBuilder.js";
7import UniformGroupNode from "../../../nodes/core/UniformGroupNode.js";
8import ComputeNode from "../../../nodes/gpgpu/ComputeNode.js";
9import LightsNode from "../../../nodes/lighting/LightsNode.js";
10import { NodeFrame } from "../../../nodes/Nodes.js";
11import { ShaderNodeObject } from "../../../nodes/TSL.js";
12import { Fog } from "../../../scenes/Fog.js";
13import { FogExp2 } from "../../../scenes/FogExp2.js";
14import { Scene } from "../../../scenes/Scene.js";
15import { CubeTexture } from "../../../textures/CubeTexture.js";
16import { Texture } from "../../../textures/Texture.js";
17import Backend from "../Backend.js";
18import ChainMap from "../ChainMap.js";
19import DataMap from "../DataMap.js";
20import Renderer from "../Renderer.js";
21import RenderObject from "../RenderObject.js";
22import NodeBuilderState from "./NodeBuilderState.js";
23import NodeUniformsGroup from "./NodeUniformsGroup.js";
24interface NodeUniformsGroupData {
25 renderId?: number | undefined;
26 frameId?: number | undefined;
27}
28interface RenderObjectData {
29 nodeBuilderState?: NodeBuilderState | undefined;
30}
31interface ComputeNodeData {
32 nodeBuilderState?: NodeBuilderState | undefined;
33}
34interface SceneData {
35 background?: Color | Texture | CubeTexture | undefined;
36 backgroundNode?: Node | undefined;
37 fog?: Fog | FogExp2 | undefined;
38 fogNode?: Node | undefined;
39 environment?: Texture | undefined;
40 environmentNode?: Node | undefined;
41}
42declare module "../../../scenes/Scene.js" {
43 interface Scene {
44 environmentNode?: Node | null | undefined;
45 backgroundNode?: Node | null | undefined;
46 fogNode?: Node | null | undefined;
47 }
48}
49declare class Nodes extends DataMap<{
50 nodeUniformsGroup: {
51 key: NodeUniformsGroup;
52 value: NodeUniformsGroupData;
53 };
54 renderObject: {
55 key: RenderObject;
56 value: RenderObjectData;
57 };
58 computeNode: {
59 key: ComputeNode;
60 value: ComputeNodeData;
61 };
62 scene: {
63 key: Scene;
64 value: SceneData;
65 };
66}> {
67 renderer: Renderer;
68 backend: Backend;
69 nodeFrame: NodeFrame;
70 nodeBuilderCache: Map<string, NodeBuilderState>;
71 callHashCache: ChainMap<readonly [Scene, LightsNode], {
72 callId: number;
73 cacheKey: string;
74 }>;
75 groupsData: ChainMap<readonly [UniformGroupNode, NodeUniformsGroup], {
76 version?: number;
77 }>;
78 constructor(renderer: Renderer, backend: Backend);
79 updateGroup(nodeUniformsGroup: NodeUniformsGroup): boolean;
80 getForRenderCacheKey(renderObject: RenderObject): string;
81 getForRender(renderObject: RenderObject): NodeBuilderState;
82 delete(
83 object: NodeUniformsGroup | RenderObject | ComputeNode | Scene,
84 ): SceneData | RenderObjectData | NodeUniformsGroupData | ComputeNodeData;
85 getForCompute(computeNode: ComputeNode): NodeBuilderState;
86 _createNodeBuilderState(nodeBuilder: NodeBuilder): NodeBuilderState;
87 getEnvironmentNode(scene: Scene): Node | null;
88 getBackgroundNode(scene: Scene): Node | null;
89 getFogNode(scene: Scene): Node | null;
90 getCacheKey(scene: Scene, lightsNode: LightsNode): string;
91 updateScene(scene: Scene): void;
92 get isToneMappingState(): boolean;
93 updateBackground(scene: Scene): void;
94 updateFog(scene: Scene): void;
95 updateEnvironment(scene: Scene): void;
96 getNodeFrame(
97 renderer?: Renderer,
98 scene?: Scene | null,
99 object?: Object3D | null,
100 camera?: Camera | null,
101 material?: Material | null,
102 ): NodeFrame;
103 getNodeFrameForRender(renderObject: RenderObject): NodeFrame;
104 getOutputCacheKey(): string;
105 hasOutputChange(outputTarget: Texture): boolean;
106 getOutputNode(outputTexture: Texture): ShaderNodeObject<Node>;
107 updateBefore(renderObject: RenderObject): void;
108 updateAfter(renderObject: RenderObject): void;
109 updateForCompute(computeNode: ComputeNode): void;
110 updateForRender(renderObject: RenderObject): void;
111 needsRefresh(renderObject: RenderObject): boolean;
112 dispose(): void;
113}
114export default Nodes;