@types/three 0.171.0 → 0.173.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- three/README.md +1 -1
- three/examples/jsm/Addons.d.ts +0 -5
- three/examples/jsm/controls/ArcballControls.d.ts +1 -1
- three/examples/jsm/controls/OrbitControls.d.ts +5 -0
- three/examples/jsm/csm/CSMShadowNode.d.ts +2 -3
- three/examples/jsm/geometries/TextGeometry.d.ts +0 -8
- three/examples/jsm/helpers/VertexNormalsHelper.d.ts +2 -0
- three/examples/jsm/interactive/InteractiveGroup.d.ts +9 -1
- three/examples/jsm/lines/LineSegments2.d.ts +3 -1
- three/examples/jsm/materials/MeshGouraudMaterial.d.ts +3 -0
- three/examples/jsm/modifiers/CurveModifier.d.ts +1 -1
- three/examples/jsm/modifiers/CurveModifierGPU.d.ts +1 -1
- three/examples/jsm/postprocessing/OutlinePass.d.ts +1 -1
- three/examples/jsm/postprocessing/UnrealBloomPass.d.ts +1 -1
- three/examples/jsm/utils/ShadowMapViewer.d.ts +2 -2
- three/examples/jsm/webxr/XRButton.d.ts +4 -2
- three/package.json +2 -2
- three/src/Three.Core.d.ts +4 -1
- three/src/Three.TSL.d.ts +18 -5
- three/src/Three.WebGPU.Nodes.d.ts +2 -2
- three/src/Three.WebGPU.d.ts +2 -2
- three/src/animation/AnimationClip.d.ts +1 -1
- three/src/cameras/ArrayCamera.d.ts +7 -6
- three/src/cameras/Camera.d.ts +7 -7
- three/src/cameras/CubeCamera.d.ts +19 -2
- three/src/constants.d.ts +6 -0
- three/src/core/BufferAttribute.d.ts +5 -0
- three/src/core/RenderTarget.d.ts +3 -5
- three/src/core/RenderTarget3D.d.ts +9 -0
- three/src/core/RenderTargetArray.d.ts +9 -0
- three/src/materials/Material.d.ts +3 -1
- three/src/materials/MeshDepthMaterial.d.ts +0 -5
- three/src/materials/MeshDistanceMaterial.d.ts +0 -5
- three/src/materials/nodes/Line2NodeMaterial.d.ts +1 -0
- three/src/materials/nodes/MeshSSSNodeMaterial.d.ts +6 -6
- three/src/materials/nodes/NodeMaterial.d.ts +3 -0
- three/src/materials/nodes/NodeMaterials.d.ts +0 -4
- three/src/materials/nodes/PointsNodeMaterial.d.ts +7 -14
- three/src/materials/nodes/manager/NodeMaterialObserver.d.ts +57 -0
- three/src/math/Matrix4.d.ts +2 -1
- three/src/nodes/Nodes.d.ts +6 -7
- three/src/nodes/TSL.d.ts +6 -3
- three/src/nodes/accessors/Arrays.d.ts +10 -2
- three/src/nodes/accessors/BufferAttributeNode.d.ts +117 -0
- three/src/nodes/accessors/BufferNode.d.ts +4 -4
- three/src/nodes/accessors/Camera.d.ts +1 -0
- three/src/nodes/accessors/MaterialNode.d.ts +6 -6
- three/src/nodes/accessors/ModelNode.d.ts +10 -2
- three/src/nodes/accessors/ModelViewProjectionNode.d.ts +2 -6
- three/src/nodes/accessors/StorageBufferNode.d.ts +12 -4
- three/src/nodes/accessors/TextureNode.d.ts +5 -0
- three/src/nodes/accessors/UniformArrayNode.d.ts +3 -2
- three/src/nodes/core/ArrayNode.d.ts +26 -0
- three/src/nodes/core/Node.d.ts +245 -0
- three/src/nodes/core/NodeAttribute.d.ts +13 -0
- three/src/nodes/core/NodeBuilder.d.ts +1 -2
- three/src/nodes/core/NodeCache.d.ts +23 -1
- three/src/nodes/core/NodeParser.d.ts +11 -0
- three/src/nodes/core/NodeUniform.d.ts +28 -0
- three/src/nodes/core/NodeVar.d.ts +18 -2
- three/src/nodes/core/NodeVarying.d.ts +14 -0
- three/src/nodes/core/StructNode.d.ts +21 -0
- three/src/nodes/core/StructType.d.ts +8 -0
- three/src/nodes/core/StructTypeNode.d.ts +41 -4
- three/src/nodes/core/UniformNode.d.ts +44 -0
- three/src/nodes/core/VarNode.d.ts +8 -1
- three/src/nodes/core/VaryingNode.d.ts +12 -0
- three/src/nodes/core/constants.d.ts +35 -0
- three/src/nodes/display/PassNode.d.ts +1 -1
- three/src/nodes/fog/Fog.d.ts +26 -0
- three/src/nodes/geometry/RangeNode.d.ts +6 -11
- three/src/nodes/gpgpu/AtomicFunctionNode.d.ts +5 -0
- three/src/nodes/gpgpu/ComputeBuiltinNode.d.ts +1 -0
- three/src/nodes/gpgpu/ComputeNode.d.ts +6 -1
- three/src/nodes/gpgpu/WorkgroupInfoNode.d.ts +2 -0
- three/src/nodes/lighting/ShadowBaseNode.d.ts +15 -0
- three/src/nodes/lighting/ShadowNode.d.ts +2 -1
- three/src/nodes/math/MathNode.d.ts +15 -4
- three/src/nodes/math/OperatorNode.d.ts +2 -0
- three/src/nodes/shapes/Shapes.d.ts +4 -0
- three/src/nodes/tsl/TSLBase.d.ts +1 -0
- three/src/nodes/tsl/TSLCore.d.ts +62 -17
- three/src/nodes/utils/EquirectUVNode.d.ts +2 -2
- three/src/nodes/utils/LoopNode.d.ts +23 -2
- three/src/nodes/utils/MemberNode.d.ts +11 -0
- three/src/objects/BatchedMesh.d.ts +1 -0
- three/src/objects/ClippingGroup.d.ts +1 -1
- three/src/objects/InstancedMesh.d.ts +4 -3
- three/src/renderers/WebGLRenderer.d.ts +10 -10
- three/src/renderers/common/Animation.d.ts +43 -1
- three/src/renderers/common/Attributes.d.ts +31 -0
- three/src/renderers/common/Backend.d.ts +11 -0
- three/src/renderers/common/Background.d.ts +22 -0
- three/src/renderers/common/BindGroup.d.ts +15 -0
- three/src/renderers/common/Binding.d.ts +24 -0
- three/src/renderers/common/Bindings.d.ts +54 -0
- three/src/renderers/common/Buffer.d.ts +31 -0
- three/src/renderers/common/BufferUtils.d.ts +26 -0
- three/src/renderers/common/BundleGroup.d.ts +22 -0
- three/src/renderers/common/ChainMap.d.ts +33 -3
- three/src/renderers/common/ClippingContext.d.ts +45 -0
- three/src/renderers/common/Color4.d.ts +40 -0
- three/src/renderers/common/ComputePipeline.d.ts +12 -0
- three/src/renderers/common/CubeRenderTarget.d.ts +13 -0
- three/src/renderers/common/DataMap.d.ts +30 -0
- three/src/renderers/common/Geometries.d.ts +52 -0
- three/src/renderers/common/Info.d.ts +21 -5
- three/src/renderers/common/Pipeline.d.ts +11 -0
- three/src/renderers/common/Pipelines.d.ts +104 -0
- three/src/renderers/common/PostProcessing.d.ts +1 -1
- three/src/renderers/common/ProgrammableStage.d.ts +19 -1
- three/src/renderers/common/RenderBundle.d.ts +15 -4
- three/src/renderers/common/RenderBundles.d.ts +20 -2
- three/src/renderers/common/RenderContext.d.ts +27 -3
- three/src/renderers/common/RenderContexts.d.ts +37 -6
- three/src/renderers/common/RenderList.d.ts +85 -0
- three/src/renderers/common/RenderLists.d.ts +21 -0
- three/src/renderers/common/RenderObject.d.ts +163 -4
- three/src/renderers/common/RenderObjects.d.ts +53 -0
- three/src/renderers/common/RenderPipeline.d.ts +13 -0
- three/src/renderers/common/Renderer.d.ts +604 -10
- three/src/renderers/common/{PostProcessingUtils.d.ts → RendererUtils.d.ts} +16 -4
- three/src/renderers/common/StorageBufferAttribute.d.ts +1 -1
- three/src/renderers/common/Textures.d.ts +66 -0
- three/src/renderers/common/TimestampQueryPool.d.ts +31 -0
- three/src/renderers/common/Uniform.d.ts +133 -1
- three/src/renderers/common/UniformBuffer.d.ts +12 -0
- three/src/renderers/common/UniformsGroup.d.ts +103 -0
- three/src/renderers/common/XRManager.d.ts +196 -0
- three/src/renderers/common/XRRenderTarget.d.ts +23 -0
- three/src/renderers/common/nodes/NodeBuilderState.d.ts +32 -2
- three/src/renderers/common/nodes/NodeLibrary.d.ts +71 -0
- three/src/renderers/common/nodes/NodeUniform.d.ts +185 -0
- three/src/renderers/common/nodes/NodeUniformsGroup.d.ts +14 -2
- three/src/renderers/common/nodes/Nodes.d.ts +192 -17
- three/src/renderers/webgpu/WebGPUBackend.d.ts +2 -1
- three/src/renderers/webgpu/nodes/BasicNodeLibrary.d.ts +10 -0
- three/src/renderers/webgpu/nodes/StandardNodeLibrary.d.ts +11 -0
- three/src/textures/DataTexture.d.ts +2 -2
- three/src/textures/Texture.d.ts +5 -5
- three/src/textures/VideoFrameTexture.d.ts +27 -0
- three/examples/jsm/animation/MMDAnimationHelper.d.ts +0 -99
- three/examples/jsm/animation/MMDPhysics.d.ts +0 -128
- three/examples/jsm/exporters/MMDExporter.d.ts +0 -11
- three/examples/jsm/loaders/MMDLoader.d.ts +0 -60
- three/examples/jsm/shaders/MMDToonShader.d.ts +0 -15
- three/src/Three.Legacy.d.ts +0 -20
- three/src/materials/nodes/InstancedPointsNodeMaterial.d.ts +0 -33
- three/src/nodes/core/UniformGroup.d.ts +0 -7
- three/src/nodes/fog/FogExp2Node.d.ts +0 -14
- three/src/nodes/fog/FogNode.d.ts +0 -20
- three/src/nodes/fog/FogRangeNode.d.ts +0 -19
three/src/nodes/core/Node.d.ts
CHANGED
|
@@ -57,6 +57,11 @@ interface NodeJSONOutputData {
|
|
|
57
57
|
images?: unknown[];
|
|
58
58
|
nodes?: NodeJSONOutputData[];
|
|
59
59
|
}
|
|
60
|
+
/**
|
|
61
|
+
* Base class for all nodes.
|
|
62
|
+
*
|
|
63
|
+
* @augments EventDispatcher
|
|
64
|
+
*/
|
|
60
65
|
declare class Node extends EventDispatcher<{
|
|
61
66
|
dispose: {};
|
|
62
67
|
}> {
|
|
@@ -73,39 +78,279 @@ declare class Node extends EventDispatcher<{
|
|
|
73
78
|
readonly isNode: true;
|
|
74
79
|
readonly id: number;
|
|
75
80
|
self?: this;
|
|
81
|
+
/**
|
|
82
|
+
* Constructs a new node.
|
|
83
|
+
*
|
|
84
|
+
* @param {String?} nodeType - The node type.
|
|
85
|
+
*/
|
|
76
86
|
constructor(nodeType?: string | null);
|
|
87
|
+
/**
|
|
88
|
+
* Set this property to `true` when the node should be regenerated.
|
|
89
|
+
*
|
|
90
|
+
* @type {Boolean}
|
|
91
|
+
* @default false
|
|
92
|
+
* @param {boolean} value
|
|
93
|
+
*/
|
|
77
94
|
set needsUpdate(value: boolean);
|
|
95
|
+
/**
|
|
96
|
+
* The type of the class. The value is usually the constructor name.
|
|
97
|
+
*
|
|
98
|
+
* @type {String}
|
|
99
|
+
* @readonly
|
|
100
|
+
*/
|
|
78
101
|
get type(): string | undefined;
|
|
102
|
+
/**
|
|
103
|
+
* Convenient method for defining {@link Node#update}.
|
|
104
|
+
*
|
|
105
|
+
* @param {Function} callback - The update method.
|
|
106
|
+
* @param {String} updateType - The update type.
|
|
107
|
+
* @return {Node} A reference to this node.
|
|
108
|
+
*/
|
|
79
109
|
onUpdate(callback: (this: this, frame: NodeFrame) => unknown, updateType: NodeUpdateType): this;
|
|
110
|
+
/**
|
|
111
|
+
* Convenient method for defining {@link Node#update}. Similar to {@link Node#onUpdate}, but
|
|
112
|
+
* this method automatically sets the update type to `FRAME`.
|
|
113
|
+
*
|
|
114
|
+
* @param {Function} callback - The update method.
|
|
115
|
+
* @return {Node} A reference to this node.
|
|
116
|
+
*/
|
|
80
117
|
onFrameUpdate(callback: (this: this, frame: NodeFrame) => void): this;
|
|
118
|
+
/**
|
|
119
|
+
* Convenient method for defining {@link Node#update}. Similar to {@link Node#onUpdate}, but
|
|
120
|
+
* this method automatically sets the update type to `RENDER`.
|
|
121
|
+
*
|
|
122
|
+
* @param {Function} callback - The update method.
|
|
123
|
+
* @return {Node} A reference to this node.
|
|
124
|
+
*/
|
|
81
125
|
onRenderUpdate(callback: (this: this, frame: NodeFrame) => void): this;
|
|
126
|
+
/**
|
|
127
|
+
* Convenient method for defining {@link Node#update}. Similar to {@link Node#onUpdate}, but
|
|
128
|
+
* this method automatically sets the update type to `OBJECT`.
|
|
129
|
+
*
|
|
130
|
+
* @param {Function} callback - The update method.
|
|
131
|
+
* @return {Node} A reference to this node.
|
|
132
|
+
*/
|
|
82
133
|
onObjectUpdate(callback: (this: this, frame: NodeFrame) => void): this;
|
|
134
|
+
/**
|
|
135
|
+
* Convenient method for defining {@link Node#updateReference}.
|
|
136
|
+
*
|
|
137
|
+
* @param {Function} callback - The update method.
|
|
138
|
+
* @return {Node} A reference to this node.
|
|
139
|
+
*/
|
|
83
140
|
onReference(callback: (this: this, frame: NodeBuilder | NodeFrame) => unknown): this;
|
|
141
|
+
/**
|
|
142
|
+
* The `this` reference might point to a Proxy so this method can be used
|
|
143
|
+
* to get the reference to the actual node instance.
|
|
144
|
+
*
|
|
145
|
+
* @return {Node} A reference to the node.
|
|
146
|
+
*/
|
|
84
147
|
getSelf(): this;
|
|
148
|
+
/**
|
|
149
|
+
* Nodes might refer to other objects like materials. This method allows to dynamically update the reference
|
|
150
|
+
* to such objects based on a given state (e.g. the current node frame or builder).
|
|
151
|
+
*
|
|
152
|
+
* @param {Any} state - This method can be invocated in different contexts so `state` can refer to any object type.
|
|
153
|
+
* @return {Any} The updated reference.
|
|
154
|
+
*/
|
|
85
155
|
updateReference(state: NodeBuilder | NodeFrame): unknown;
|
|
156
|
+
/**
|
|
157
|
+
* By default this method returns the value of the {@link Node#global} flag. This method
|
|
158
|
+
* can be overwritten in derived classes if an analytical way is required to determine the
|
|
159
|
+
* global status.
|
|
160
|
+
*
|
|
161
|
+
* @param {NodeBuilder} builder - The current node builder.
|
|
162
|
+
* @return {Boolean} Whether this node is global or not.
|
|
163
|
+
*/
|
|
86
164
|
isGlobal(builder: NodeBuilder): boolean;
|
|
165
|
+
/**
|
|
166
|
+
* Generator function that can be used to iterate over the child nodes.
|
|
167
|
+
*
|
|
168
|
+
* @generator
|
|
169
|
+
* @yields {Node} A child node.
|
|
170
|
+
*/
|
|
87
171
|
getChildren(): Generator<Node, void, unknown>;
|
|
172
|
+
/**
|
|
173
|
+
* Calling this method dispatches the `dispose` event. This event can be used
|
|
174
|
+
* to register event listeners for clean up tasks.
|
|
175
|
+
*/
|
|
88
176
|
dispose(): void;
|
|
177
|
+
/**
|
|
178
|
+
* Callback for {@link Node#traverse}.
|
|
179
|
+
*
|
|
180
|
+
* @callback traverseCallback
|
|
181
|
+
* @param {Node} node - The current node.
|
|
182
|
+
*/
|
|
183
|
+
/**
|
|
184
|
+
* Can be used to traverse through the node's hierarchy.
|
|
185
|
+
*
|
|
186
|
+
* @param {traverseCallback} callback - A callback that is executed per node.
|
|
187
|
+
*/
|
|
89
188
|
traverse(callback: (node: Node) => void): void;
|
|
189
|
+
/**
|
|
190
|
+
* Returns the cache key for this node.
|
|
191
|
+
*
|
|
192
|
+
* @param {Boolean} [force=false] - When set to `true`, a recomputation of the cache key is forced.
|
|
193
|
+
* @return {Number} The cache key of the node.
|
|
194
|
+
*/
|
|
90
195
|
getCacheKey(force?: boolean): number;
|
|
196
|
+
/**
|
|
197
|
+
* Generate a custom cache key for this node.
|
|
198
|
+
*
|
|
199
|
+
* @return {Number} The cache key of the node.
|
|
200
|
+
*/
|
|
201
|
+
customCacheKey(): number;
|
|
202
|
+
/**
|
|
203
|
+
* Returns the references to this node which is by default `this`.
|
|
204
|
+
*
|
|
205
|
+
* @return {Node} A reference to this node.
|
|
206
|
+
*/
|
|
91
207
|
getScope(): this;
|
|
208
|
+
/**
|
|
209
|
+
* Returns the hash of the node which is used to identify the node. By default it's
|
|
210
|
+
* the {@link Node#uuid} however derived node classes might have to overwrite this method
|
|
211
|
+
* depending on their implementation.
|
|
212
|
+
*
|
|
213
|
+
* @param {NodeBuilder} builder - The current node builder.
|
|
214
|
+
* @return {String} The hash.
|
|
215
|
+
*/
|
|
92
216
|
getHash(builder: NodeBuilder): string;
|
|
217
|
+
/**
|
|
218
|
+
* Returns the update type of {@link Node#update}.
|
|
219
|
+
*
|
|
220
|
+
* @return {NodeUpdateType} The update type.
|
|
221
|
+
*/
|
|
93
222
|
getUpdateType(): NodeUpdateType;
|
|
223
|
+
/**
|
|
224
|
+
* Returns the update type of {@link Node#updateBefore}.
|
|
225
|
+
*
|
|
226
|
+
* @return {NodeUpdateType} The update type.
|
|
227
|
+
*/
|
|
94
228
|
getUpdateBeforeType(): NodeUpdateType;
|
|
229
|
+
/**
|
|
230
|
+
* Returns the update type of {@link Node#updateAfter}.
|
|
231
|
+
*
|
|
232
|
+
* @return {NodeUpdateType} The update type.
|
|
233
|
+
*/
|
|
95
234
|
getUpdateAfterType(): NodeUpdateType;
|
|
235
|
+
/**
|
|
236
|
+
* Certain types are composed of multiple elements. For example a `vec3`
|
|
237
|
+
* is composed of three `float` values. This method returns the type of
|
|
238
|
+
* these elements.
|
|
239
|
+
*
|
|
240
|
+
* @param {NodeBuilder} builder - The current node builder.
|
|
241
|
+
* @return {String} The type of the node.
|
|
242
|
+
*/
|
|
96
243
|
getElementType(builder: NodeBuilder): "bool" | "int" | "float" | "vec2" | "vec3" | "vec4" | "uint" | null;
|
|
244
|
+
/**
|
|
245
|
+
* Returns the node member type for the given name.
|
|
246
|
+
*
|
|
247
|
+
* @param {NodeBuilder} builder - The current node builder.
|
|
248
|
+
* @param {String} name - The name of the member.
|
|
249
|
+
* @return {String} The type of the node.
|
|
250
|
+
*/
|
|
251
|
+
getMemberType(builder: NodeBuilder, name: string): string;
|
|
252
|
+
/**
|
|
253
|
+
* Returns the node's type.
|
|
254
|
+
*
|
|
255
|
+
* @param {NodeBuilder} builder - The current node builder.
|
|
256
|
+
* @return {String} The type of the node.
|
|
257
|
+
*/
|
|
97
258
|
getNodeType(builder: NodeBuilder): string | null;
|
|
259
|
+
/**
|
|
260
|
+
* This method is used during the build process of a node and ensures
|
|
261
|
+
* equal nodes are not built multiple times but just once. For example if
|
|
262
|
+
* `attribute( 'uv' )` is used multiple times by the user, the build
|
|
263
|
+
* process makes sure to process just the first node.
|
|
264
|
+
*
|
|
265
|
+
* @param {NodeBuilder} builder - The current node builder.
|
|
266
|
+
* @return {Node} The shared node if possible. Otherwise `this` is returned.
|
|
267
|
+
*/
|
|
98
268
|
getShared(builder: NodeBuilder): Node;
|
|
269
|
+
/**
|
|
270
|
+
* Represents the setup stage which is the first step of the build process, see {@link Node#build} method.
|
|
271
|
+
* This method is often overwritten in derived modules to prepare the node which is used as the output/result.
|
|
272
|
+
* The output node must be returned in the `return` statement.
|
|
273
|
+
*
|
|
274
|
+
* @param {NodeBuilder} builder - The current node builder.
|
|
275
|
+
* @return {Node?} The output node.
|
|
276
|
+
*/
|
|
99
277
|
setup(builder: NodeBuilder): unknown;
|
|
278
|
+
/**
|
|
279
|
+
* Represents the analyze stage which is the second step of the build process, see {@link Node#build} method.
|
|
280
|
+
* This stage analyzes the node hierarchy and ensures descendent nodes are built.
|
|
281
|
+
*
|
|
282
|
+
* @param {NodeBuilder} builder - The current node builder.
|
|
283
|
+
*/
|
|
100
284
|
analyze(builder: NodeBuilder): void;
|
|
285
|
+
/**
|
|
286
|
+
* Represents the generate stage which is the third step of the build process, see {@link Node#build} method.
|
|
287
|
+
* This state builds the output node and returns the resulting shader string.
|
|
288
|
+
*
|
|
289
|
+
* @param {NodeBuilder} builder - The current node builder.
|
|
290
|
+
* @param {String?} output - Can be used to define the output type.
|
|
291
|
+
* @return {String?} The generated shader string.
|
|
292
|
+
*/
|
|
101
293
|
generate(builder: NodeBuilder, output?: string | null): string | null | undefined;
|
|
294
|
+
/**
|
|
295
|
+
* The method can be implemented to update the node's internal state before it is used to render an object.
|
|
296
|
+
* The {@link Node#updateBeforeType} property defines how often the update is executed.
|
|
297
|
+
*
|
|
298
|
+
* @abstract
|
|
299
|
+
* @param {NodeFrame} frame - A reference to the current node frame.
|
|
300
|
+
* @return {Boolean?} An optional bool that indicates whether the implementation actually performed an update or not (e.g. due to caching).
|
|
301
|
+
*/
|
|
102
302
|
updateBefore(frame: NodeFrame): void;
|
|
303
|
+
/**
|
|
304
|
+
* The method can be implemented to update the node's internal state after it was used to render an object.
|
|
305
|
+
* The {@link Node#updateAfterType} property defines how often the update is executed.
|
|
306
|
+
*
|
|
307
|
+
* @abstract
|
|
308
|
+
* @param {NodeFrame} frame - A reference to the current node frame.
|
|
309
|
+
* @return {Boolean?} An optional bool that indicates whether the implementation actually performed an update or not (e.g. due to caching).
|
|
310
|
+
*/
|
|
103
311
|
updateAfter(frame: NodeFrame): void;
|
|
312
|
+
/**
|
|
313
|
+
* The method can be implemented to update the node's internal state when it is used to render an object.
|
|
314
|
+
* The {@link Node#updateType} property defines how often the update is executed.
|
|
315
|
+
*
|
|
316
|
+
* @abstract
|
|
317
|
+
* @param {NodeFrame} frame - A reference to the current node frame.
|
|
318
|
+
* @return {Boolean?} An optional bool that indicates whether the implementation actually performed an update or not (e.g. due to caching).
|
|
319
|
+
*/
|
|
104
320
|
update(frame: NodeFrame): void;
|
|
321
|
+
/**
|
|
322
|
+
* This method performs the build of a node. The behavior of this method as well as its return value depend
|
|
323
|
+
* on the current build stage (setup, analyze or generate).
|
|
324
|
+
*
|
|
325
|
+
* @param {NodeBuilder} builder - The current node builder.
|
|
326
|
+
* @param {String?} output - Can be used to define the output type.
|
|
327
|
+
* @return {String?} When this method is executed in the setup or analyze stage, `null` is returned. In the generate stage, the generated shader string.
|
|
328
|
+
*/
|
|
105
329
|
build(builder: NodeBuilder, output?: string | null): string | null;
|
|
330
|
+
/**
|
|
331
|
+
* Returns the child nodes as a JSON object.
|
|
332
|
+
*
|
|
333
|
+
* @return {Array<Object>} An iterable list of serialized child objects as JSON.
|
|
334
|
+
*/
|
|
106
335
|
getSerializeChildren(): Generator<import("./NodeUtils.js").NodeChild, void, unknown>;
|
|
336
|
+
/**
|
|
337
|
+
* Serializes the node to JSON.
|
|
338
|
+
*
|
|
339
|
+
* @param {Object} json - The output JSON object.
|
|
340
|
+
*/
|
|
107
341
|
serialize(json: NodeJSONIntermediateOutputData): void;
|
|
342
|
+
/**
|
|
343
|
+
* Deserializes the node from the given JSON.
|
|
344
|
+
*
|
|
345
|
+
* @param {Object} json - The JSON object.
|
|
346
|
+
*/
|
|
108
347
|
deserialize(json: NodeJSONInputData): void;
|
|
348
|
+
/**
|
|
349
|
+
* Serializes the node into the three.js JSON Object/Scene format.
|
|
350
|
+
*
|
|
351
|
+
* @param {Object?} meta - An optional JSON object that already holds serialized data from other scene objects.
|
|
352
|
+
* @return {Object} The serialized node.
|
|
353
|
+
*/
|
|
109
354
|
toJSON(meta?: NodeJSONMeta | string): NodeJSONOutputData;
|
|
110
355
|
}
|
|
111
356
|
export default Node;
|
|
@@ -1,9 +1,22 @@
|
|
|
1
1
|
import Node from "./Node.js";
|
|
2
|
+
/**
|
|
3
|
+
* {@link NodeBuilder} is going to create instances of this class during the build process
|
|
4
|
+
* of nodes. They represent the final shader attributes that are going to be generated
|
|
5
|
+
* by the builder. Arrays of node attributes is maintained in {@link NodeBuilder#attributes}
|
|
6
|
+
* and {@link NodeBuilder#bufferAttributes} for this purpose.
|
|
7
|
+
*/
|
|
2
8
|
declare class NodeAttribute {
|
|
3
9
|
readonly isNodeAttribute: true;
|
|
4
10
|
name: string;
|
|
5
11
|
type: string | null;
|
|
6
12
|
node: Node | null;
|
|
13
|
+
/**
|
|
14
|
+
* Constructs a new node attribute.
|
|
15
|
+
*
|
|
16
|
+
* @param {String} name - The name of the attribute.
|
|
17
|
+
* @param {String} type - The type of the attribute.
|
|
18
|
+
* @param {Node?} node - An optional reference to the node.
|
|
19
|
+
*/
|
|
7
20
|
constructor(name: string, type: string | null, node?: Node | null);
|
|
8
21
|
}
|
|
9
22
|
export default NodeAttribute;
|
|
@@ -3,7 +3,6 @@ import { Object3D } from "../../core/Object3D.js";
|
|
|
3
3
|
import { Material } from "../../materials/Material.js";
|
|
4
4
|
import Renderer from "../../renderers/common/Renderer.js";
|
|
5
5
|
import { Texture } from "../../textures/Texture.js";
|
|
6
|
-
import FogNode from "../fog/FogNode.js";
|
|
7
6
|
import LightsNode from "../lighting/LightsNode.js";
|
|
8
7
|
import { NodeShaderStage } from "./constants.js";
|
|
9
8
|
import Node from "./Node.js";
|
|
@@ -41,7 +40,7 @@ export default abstract class NodeBuilder {
|
|
|
41
40
|
hashNodes: { [hash: string]: Node };
|
|
42
41
|
|
|
43
42
|
lightsNode: LightsNode;
|
|
44
|
-
fogNode:
|
|
43
|
+
fogNode: Node;
|
|
45
44
|
|
|
46
45
|
vertexShader: string;
|
|
47
46
|
fragmentShader: string;
|
|
@@ -7,6 +7,7 @@ import NodeCode from "./NodeCode.js";
|
|
|
7
7
|
import NodeUniform from "./NodeUniform.js";
|
|
8
8
|
import NodeVar from "./NodeVar.js";
|
|
9
9
|
import NodeVarying from "./NodeVarying.js";
|
|
10
|
+
import StructType from "./StructType.js";
|
|
10
11
|
export interface ShaderStageNodeData {
|
|
11
12
|
properties?:
|
|
12
13
|
| (
|
|
@@ -20,7 +21,7 @@ export interface ShaderStageNodeData {
|
|
|
20
21
|
)
|
|
21
22
|
| undefined;
|
|
22
23
|
bufferAttribute?: NodeAttribute | undefined;
|
|
23
|
-
structType?:
|
|
24
|
+
structType?: StructType | undefined;
|
|
24
25
|
uniform?: NodeUniform<unknown> | undefined;
|
|
25
26
|
variable?: NodeVar | undefined;
|
|
26
27
|
varying?: NodeVarying | undefined;
|
|
@@ -39,13 +40,34 @@ interface NodeData {
|
|
|
39
40
|
interface BufferAttributeData {
|
|
40
41
|
node: BufferAttributeNode;
|
|
41
42
|
}
|
|
43
|
+
/**
|
|
44
|
+
* This utility class is used in {@link NodeBuilder} as an internal
|
|
45
|
+
* cache data structure for node data.
|
|
46
|
+
*/
|
|
42
47
|
declare class NodeCache {
|
|
43
48
|
id: number;
|
|
44
49
|
nodesData: WeakMap<Node | TypedArray | InterleavedBuffer | BufferAttribute, NodeData | BufferAttributeData>;
|
|
45
50
|
parent: NodeCache | null;
|
|
51
|
+
/**
|
|
52
|
+
* Constructs a new node cache.
|
|
53
|
+
*
|
|
54
|
+
* @param {NodeCache?} parent - A reference to a parent cache.
|
|
55
|
+
*/
|
|
46
56
|
constructor(parent?: NodeCache | null);
|
|
57
|
+
/**
|
|
58
|
+
* Returns the data for the given node.
|
|
59
|
+
*
|
|
60
|
+
* @param {Node} node - The node.
|
|
61
|
+
* @return {Object?} The data for the node.
|
|
62
|
+
*/
|
|
47
63
|
getData(node: Node): NodeData | undefined;
|
|
48
64
|
getData(node: TypedArray | InterleavedBuffer | BufferAttribute): BufferAttributeData | undefined;
|
|
65
|
+
/**
|
|
66
|
+
* Sets the data for a given node.
|
|
67
|
+
*
|
|
68
|
+
* @param {Node} node - The node.
|
|
69
|
+
* @param {Object} data - The data that should be cached.
|
|
70
|
+
*/
|
|
49
71
|
setData(node: Node, data: NodeData): void;
|
|
50
72
|
setData(node: TypedArray | InterleavedBuffer | BufferAttribute, data: BufferAttributeData): void;
|
|
51
73
|
}
|
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
import NodeFunction from "./NodeFunction.js";
|
|
2
|
+
/**
|
|
3
|
+
* Base class for node parsers. A derived parser must be implemented
|
|
4
|
+
* for each supported native shader language.
|
|
5
|
+
*/
|
|
2
6
|
declare abstract class NodeParser {
|
|
7
|
+
/**
|
|
8
|
+
* The method parses the given native code an returns a node function.
|
|
9
|
+
*
|
|
10
|
+
* @abstract
|
|
11
|
+
* @param {String} source - The native shader code.
|
|
12
|
+
* @return {NodeFunction} A node function.
|
|
13
|
+
*/
|
|
3
14
|
abstract parseFunction(source: string): NodeFunction;
|
|
4
15
|
}
|
|
5
16
|
export default NodeParser;
|
|
@@ -1,14 +1,42 @@
|
|
|
1
1
|
import UniformNode from "./UniformNode.js";
|
|
2
|
+
/**
|
|
3
|
+
* {@link NodeBuilder} is going to create instances of this class during the build process
|
|
4
|
+
* of nodes. They represent the final shader uniforms that are going to be generated
|
|
5
|
+
* by the builder. A dictionary of node uniforms is maintained in {@link NodeBuilder#uniforms}
|
|
6
|
+
* for this purpose.
|
|
7
|
+
*/
|
|
2
8
|
declare class NodeUniform<TValue> {
|
|
3
9
|
readonly isNodeUniform: true;
|
|
4
10
|
name: string;
|
|
5
11
|
type: string | null;
|
|
6
12
|
node: UniformNode<TValue>;
|
|
7
13
|
needsUpdate: boolean | undefined;
|
|
14
|
+
/**
|
|
15
|
+
* Constructs a new node uniform.
|
|
16
|
+
*
|
|
17
|
+
* @param {String} name - The name of the uniform.
|
|
18
|
+
* @param {String} type - The type of the uniform.
|
|
19
|
+
* @param {UniformNode} node - An reference to the node.
|
|
20
|
+
*/
|
|
8
21
|
constructor(name: string, type: string | null, node: UniformNode<TValue>);
|
|
22
|
+
/**
|
|
23
|
+
* The value of the uniform node.
|
|
24
|
+
*
|
|
25
|
+
* @type {Any}
|
|
26
|
+
*/
|
|
9
27
|
get value(): TValue;
|
|
10
28
|
set value(val: TValue);
|
|
29
|
+
/**
|
|
30
|
+
* The id of the uniform node.
|
|
31
|
+
*
|
|
32
|
+
* @type {Number}
|
|
33
|
+
*/
|
|
11
34
|
get id(): number;
|
|
35
|
+
/**
|
|
36
|
+
* The uniform node's group.
|
|
37
|
+
*
|
|
38
|
+
* @type {UniformGroupNode}
|
|
39
|
+
*/
|
|
12
40
|
get groupNode(): import("./UniformGroupNode.js").default;
|
|
13
41
|
}
|
|
14
42
|
export default NodeUniform;
|
|
@@ -1,7 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* {@link NodeBuilder} is going to create instances of this class during the build process
|
|
3
|
+
* of nodes. They represent the final shader variables that are going to be generated
|
|
4
|
+
* by the builder. A dictionary of node variables is maintained in {@link NodeBuilder#vars} for
|
|
5
|
+
* this purpose.
|
|
6
|
+
*/
|
|
1
7
|
declare class NodeVar {
|
|
2
8
|
readonly isNodeVar: true;
|
|
3
9
|
name: string;
|
|
4
|
-
type: string
|
|
5
|
-
|
|
10
|
+
type: string;
|
|
11
|
+
readOnly: boolean;
|
|
12
|
+
count: number | null;
|
|
13
|
+
/**
|
|
14
|
+
* Constructs a new node variable.
|
|
15
|
+
*
|
|
16
|
+
* @param {String} name - The name of the variable.
|
|
17
|
+
* @param {String} type - The type of the variable.
|
|
18
|
+
* @param {Boolean} [readOnly=false] - The read-only flag.
|
|
19
|
+
* @param {Number?} [count=null] - The size.
|
|
20
|
+
*/
|
|
21
|
+
constructor(name: string, type: string, readOnly?: boolean, count?: number | null);
|
|
6
22
|
}
|
|
7
23
|
export default NodeVar;
|
|
@@ -1,7 +1,21 @@
|
|
|
1
1
|
import NodeVar from "./NodeVar.js";
|
|
2
|
+
/**
|
|
3
|
+
* {@link NodeBuilder} is going to create instances of this class during the build process
|
|
4
|
+
* of nodes. They represent the final shader varyings that are going to be generated
|
|
5
|
+
* by the builder. An array of node varyings is maintained in {@link NodeBuilder#varyings} for
|
|
6
|
+
* this purpose.
|
|
7
|
+
*
|
|
8
|
+
* @augments NodeVar
|
|
9
|
+
*/
|
|
2
10
|
declare class NodeVarying extends NodeVar {
|
|
3
11
|
needsInterpolation: boolean;
|
|
4
12
|
readonly isNodeVarying: true;
|
|
13
|
+
/**
|
|
14
|
+
* Constructs a new node varying.
|
|
15
|
+
*
|
|
16
|
+
* @param {String} name - The name of the varying.
|
|
17
|
+
* @param {String} type - The type of the varying.
|
|
18
|
+
*/
|
|
5
19
|
constructor(name: string, type: string | null);
|
|
6
20
|
}
|
|
7
21
|
export default NodeVarying;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { ShaderNodeObject } from "../tsl/TSLCore.js";
|
|
2
|
+
import Node from "./Node.js";
|
|
3
|
+
import StructTypeNode, { MembersLayout } from "./StructTypeNode.js";
|
|
4
|
+
|
|
5
|
+
declare class StructNode extends Node {
|
|
6
|
+
values: Node[];
|
|
7
|
+
|
|
8
|
+
constructor(structLayoutNode: StructTypeNode, values: Node[]);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export default StructNode;
|
|
12
|
+
|
|
13
|
+
export interface Struct {
|
|
14
|
+
(): ShaderNodeObject<StructNode>;
|
|
15
|
+
(values: Node[]): ShaderNodeObject<StructNode>;
|
|
16
|
+
(...values: Node[]): ShaderNodeObject<StructNode>;
|
|
17
|
+
layout: StructTypeNode;
|
|
18
|
+
isStruct: true;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export const struct: (membersLayout: MembersLayout, name?: string | null) => Struct;
|
|
@@ -1,9 +1,46 @@
|
|
|
1
1
|
import Node from "./Node.js";
|
|
2
|
+
import NodeBuilder from "./NodeBuilder.js";
|
|
3
|
+
/** @module StructTypeNode **/
|
|
4
|
+
export interface MembersLayout {
|
|
5
|
+
[name: string]: string | {
|
|
6
|
+
type: string;
|
|
7
|
+
atomic?: boolean;
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
export interface MemberLayout {
|
|
11
|
+
name: string;
|
|
12
|
+
type: string;
|
|
13
|
+
atomic: boolean;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Represents a struct type node in the node-based system.
|
|
17
|
+
* This class is used to define and manage the layout and types of struct members.
|
|
18
|
+
* It extends the base Node class and provides methods to get the length of the struct,
|
|
19
|
+
* retrieve member types, and generate the struct type for a builder.
|
|
20
|
+
*
|
|
21
|
+
* @augments Node
|
|
22
|
+
*/
|
|
2
23
|
declare class StructTypeNode extends Node {
|
|
3
24
|
static get type(): string;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
25
|
+
membersLayout: MemberLayout[];
|
|
26
|
+
name: string | null;
|
|
27
|
+
readonly isStructLayoutNode: true;
|
|
28
|
+
/**
|
|
29
|
+
* Creates an instance of StructTypeNode.
|
|
30
|
+
*
|
|
31
|
+
* @param {Object} membersLayout - The layout of the members for the struct.
|
|
32
|
+
* @param {string} [name=null] - The optional name of the struct.
|
|
33
|
+
*/
|
|
34
|
+
constructor(membersLayout: MembersLayout, name?: string | null);
|
|
35
|
+
/**
|
|
36
|
+
* Returns the length of the struct.
|
|
37
|
+
* The length is calculated by summing the lengths of the struct's members.
|
|
38
|
+
*
|
|
39
|
+
* @returns {Number} The length of the struct.
|
|
40
|
+
*/
|
|
41
|
+
getLength(): number;
|
|
42
|
+
getMemberType(builder: NodeBuilder, name: string): string;
|
|
43
|
+
getNodeType(builder: NodeBuilder): string;
|
|
44
|
+
generate(builder: NodeBuilder): string;
|
|
8
45
|
}
|
|
9
46
|
export default StructTypeNode;
|
|
@@ -4,20 +4,64 @@ import Node from "./Node.js";
|
|
|
4
4
|
import NodeBuilder from "./NodeBuilder.js";
|
|
5
5
|
import NodeFrame from "./NodeFrame.js";
|
|
6
6
|
import UniformGroupNode from "./UniformGroupNode.js";
|
|
7
|
+
/** @module UniformNode **/
|
|
8
|
+
/**
|
|
9
|
+
* Class for representing a uniform.
|
|
10
|
+
*
|
|
11
|
+
* @augments InputNode
|
|
12
|
+
*/
|
|
7
13
|
declare class UniformNode<TValue> extends InputNode<TValue> {
|
|
8
14
|
static get type(): string;
|
|
9
15
|
readonly isUniformNode: true;
|
|
10
16
|
name: string;
|
|
11
17
|
groupNode: UniformGroupNode;
|
|
18
|
+
/**
|
|
19
|
+
* Constructs a new uniform node.
|
|
20
|
+
*
|
|
21
|
+
* @param {Any} value - The value of this node. Usually a JS primitive or three.js object (vector, matrix, color, texture).
|
|
22
|
+
* @param {String?} nodeType - The node type. If no explicit type is defined, the node tries to derive the type from its value.
|
|
23
|
+
*/
|
|
12
24
|
constructor(value: TValue, nodeType?: string | null);
|
|
25
|
+
/**
|
|
26
|
+
* Sets the {@link UniformNode#name} property.
|
|
27
|
+
*
|
|
28
|
+
* @param {String} name - The name of the uniform.
|
|
29
|
+
* @return {UniformNode} A reference to this node.
|
|
30
|
+
*/
|
|
13
31
|
label(name: string): this;
|
|
32
|
+
/**
|
|
33
|
+
* Sets the {@link UniformNode#groupNode} property.
|
|
34
|
+
*
|
|
35
|
+
* @param {UniformGroupNode} group - The uniform group.
|
|
36
|
+
* @return {UniformNode} A reference to this node.
|
|
37
|
+
*/
|
|
14
38
|
setGroup(group: UniformGroupNode): this;
|
|
39
|
+
/**
|
|
40
|
+
* Returns the {@link UniformNode#groupNode}.
|
|
41
|
+
*
|
|
42
|
+
* @return {UniformGroupNode} The uniform group.
|
|
43
|
+
*/
|
|
15
44
|
getGroup(): UniformGroupNode;
|
|
45
|
+
/**
|
|
46
|
+
* By default, this method returns the result of {@link Node#getHash} but derived
|
|
47
|
+
* classes might overwrite this method with a different implementation.
|
|
48
|
+
*
|
|
49
|
+
* @param {NodeBuilder} builder - The current node builder.
|
|
50
|
+
* @return {String} The uniform hash.
|
|
51
|
+
*/
|
|
16
52
|
getUniformHash(builder: NodeBuilder): string;
|
|
17
53
|
onUpdate(callback: (frame: NodeFrame, self: this) => TValue | undefined, updateType: NodeUpdateType): this;
|
|
18
54
|
generate(builder: NodeBuilder, output: string | null): string;
|
|
19
55
|
}
|
|
20
56
|
export default UniformNode;
|
|
57
|
+
/**
|
|
58
|
+
* TSL function for creating a uniform node.
|
|
59
|
+
*
|
|
60
|
+
* @function
|
|
61
|
+
* @param {Any} arg1 - The value of this node. Usually a JS primitive or three.js object (vector, matrix, color, texture).
|
|
62
|
+
* @param {String?} arg2 - The node type. If no explicit type is defined, the node tries to derive the type from its value.
|
|
63
|
+
* @returns {UniformNode}
|
|
64
|
+
*/
|
|
21
65
|
export declare const uniform: <TValue>(
|
|
22
66
|
arg1: InputNode<TValue> | TValue,
|
|
23
67
|
arg2?: Node | string,
|
|
@@ -7,12 +7,19 @@ export default class VarNode extends Node {
|
|
|
7
7
|
|
|
8
8
|
readonly isVarNode: true;
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
readOnly: boolean;
|
|
11
|
+
|
|
12
|
+
constructor(node: Node, name?: string | null, readOnly?: boolean);
|
|
11
13
|
}
|
|
12
14
|
|
|
15
|
+
export const Var: (node: Node, name?: string | null) => ShaderNodeObject<VarNode>;
|
|
16
|
+
|
|
17
|
+
export const Const: (node: Node, name?: string | null) => ShaderNodeObject<VarNode>;
|
|
18
|
+
|
|
13
19
|
declare module "../tsl/TSLCore.js" {
|
|
14
20
|
interface NodeElements {
|
|
15
21
|
toVar: (node: NodeRepresentation, name?: string | null) => ShaderNodeObject<VarNode>;
|
|
22
|
+
toConst: (node: NodeRepresentation, name?: string | null) => ShaderNodeObject<VarNode>;
|
|
16
23
|
}
|
|
17
24
|
}
|
|
18
25
|
|
|
@@ -14,8 +14,20 @@ export default class VaryingNode extends Node {
|
|
|
14
14
|
|
|
15
15
|
export const varying: (node: NodeRepresentation, name?: string) => ShaderNodeObject<VaryingNode>;
|
|
16
16
|
|
|
17
|
+
export const vertexStage: (node: NodeRepresentation) => ShaderNodeObject<VaryingNode>;
|
|
18
|
+
|
|
17
19
|
declare module "../tsl/TSLCore.js" {
|
|
18
20
|
interface NodeElements {
|
|
21
|
+
toVarying: typeof varying;
|
|
22
|
+
toVertexStage: typeof vertexStage;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* @deprecated .varying() has been renamed to .toVarying().
|
|
26
|
+
*/
|
|
19
27
|
varying: typeof varying;
|
|
28
|
+
/**
|
|
29
|
+
* @deprecated .vertexStage() has been renamed to .toVertexStage().
|
|
30
|
+
*/
|
|
31
|
+
vertexStage: typeof vertexStage;
|
|
20
32
|
}
|
|
21
33
|
}
|