Skip to content

Commit 86c3071

Browse files
authored
TSL: Replace Proxy approach with prototypes (#1839)
* Test * Update * Add src * Update patch and delete src * Update declarations * Updates * Update declarations * Update * Add src * Update patch and delete src * Update declarations * Add src * Update patch and delete src * Update declarations * Add src * Update patch and delete src * Update declarations * Checkpoint * More * Add src * Update patch and delete src * Update declarations * Remove assertSwizzable * Add src * Update patch and delete src * Update declarations * Remove ShaderNodeObject from src * Remove ShaderNodeObject from examples * Remove ShaderNodeObject from test * Add examples * Update patch and delete examples * Add src * Update patch and delete src * Add jsdoc * Update patch and delete jsdoc
1 parent 31d7e12 commit 86c3071

File tree

203 files changed

+1941
-2002
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

203 files changed

+1941
-2002
lines changed

examples-testing/changes.patch

Lines changed: 279 additions & 525 deletions
Large diffs are not rendered by default.

jsdoc-testing/changes.patch

Lines changed: 28 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -6517,10 +6517,10 @@ index 1ffe1bd1..94d4efb0 100644
65176517
+
65186518
+export default MeshToonNodeMaterial;
65196519
diff --git a/jsdoc-testing/jsdoc/materials/nodes/NodeMaterial.d.ts b/jsdoc-testing/jsdoc/materials/nodes/NodeMaterial.d.ts
6520-
index 9e689cf0..d4002950 100644
6520+
index 9e689cf0..63e021e5 100644
65216521
--- a/jsdoc-testing/jsdoc/materials/nodes/NodeMaterial.d.ts
65226522
+++ b/jsdoc-testing/jsdoc/materials/nodes/NodeMaterial.d.ts
6523-
@@ -1,37 +1,23 @@
6523+
@@ -1,37 +1,22 @@
65246524
-export default NodeMaterial;
65256525
-/**
65266526
- * Base class for all node materials.
@@ -6551,7 +6551,6 @@ index 9e689cf0..d4002950 100644
65516551
+import MRTNode from "../../nodes/core/MRTNode.js";
65526552
+import NodeBuilder from "../../nodes/core/NodeBuilder.js";
65536553
+import ClippingNode from "../../nodes/accessors/ClippingNode.js";
6554-
+import { ShaderNodeObject } from "../../nodes/tsl/TSLCore.js";
65556554
+import LightingModel from "../../nodes/core/LightingModel.js";
65566555
+
65576556
+export interface NodeMaterialNodeProperties {
@@ -6569,23 +6568,23 @@ index 9e689cf0..d4002950 100644
65696568
* @default false
65706569
*/
65716570
lights: boolean;
6572-
@@ -40,7 +26,6 @@ declare class NodeMaterial extends Material {
6571+
@@ -40,7 +25,6 @@ declare class NodeMaterial extends Material {
65736572
* This property is managed by the engine and should not be
65746573
* modified by apps.
65756574
*
65766575
- * @type {boolean}
65776576
* @default false
65786577
*/
65796578
hardwareClipping: boolean;
6580-
@@ -57,7 +42,6 @@ declare class NodeMaterial extends Material {
6579+
@@ -57,7 +41,6 @@ declare class NodeMaterial extends Material {
65816580
* material.lightsNode = customLightsNode;
65826581
* ```
65836582
*
65846583
- * @type {?LightsNode}
65856584
* @default null
65866585
*/
65876586
lightsNode: LightsNode | null;
6588-
@@ -71,10 +55,9 @@ declare class NodeMaterial extends Material {
6587+
@@ -71,10 +54,9 @@ declare class NodeMaterial extends Material {
65896588
* material.envNode = pmremTexture( renderTarget.texture );
65906589
* ```
65916590
*
@@ -6597,7 +6596,7 @@ index 9e689cf0..d4002950 100644
65976596
/**
65986597
* The lighting of node materials might be influenced by ambient occlusion.
65996598
* The default AO is inferred from an ambient occlusion map assigned to `aoMap`
6600-
@@ -84,10 +67,9 @@ declare class NodeMaterial extends Material {
6599+
@@ -84,10 +66,9 @@ declare class NodeMaterial extends Material {
66016600
* If you don't want to overwrite the diffuse color but modify the existing
66026601
* values instead, use {@link materialAO}.
66036602
*
@@ -6609,7 +6608,7 @@ index 9e689cf0..d4002950 100644
66096608
/**
66106609
* The diffuse color of node materials is by default inferred from the
66116610
* `color` and `map` properties. This node property allows to overwrite the default
6612-
@@ -104,10 +86,9 @@ declare class NodeMaterial extends Material {
6611+
@@ -104,10 +85,9 @@ declare class NodeMaterial extends Material {
66136612
* material.colorNode = materialColor.mul( color( 0xff0000 ) ); // give diffuse colors a red tint
66146613
* ```
66156614
*
@@ -6621,7 +6620,7 @@ index 9e689cf0..d4002950 100644
66216620
/**
66226621
* The normals of node materials are by default inferred from the `normalMap`/`normalScale`
66236622
* or `bumpMap`/`bumpScale` properties. This node property allows to overwrite the default
6624-
@@ -116,10 +97,9 @@ declare class NodeMaterial extends Material {
6623+
@@ -116,10 +96,9 @@ declare class NodeMaterial extends Material {
66256624
* If you don't want to overwrite the normals but modify the existing values instead,
66266625
* use {@link materialNormal}.
66276626
*
@@ -6633,7 +6632,7 @@ index 9e689cf0..d4002950 100644
66336632
/**
66346633
* The opacity of node materials is by default inferred from the `opacity`
66356634
* and `alphaMap` properties. This node property allows to overwrite the default
6636-
@@ -128,10 +108,9 @@ declare class NodeMaterial extends Material {
6635+
@@ -128,10 +107,9 @@ declare class NodeMaterial extends Material {
66376636
* If you don't want to overwrite the normals but modify the existing
66386637
* value instead, use {@link materialOpacity}.
66396638
*
@@ -6645,7 +6644,7 @@ index 9e689cf0..d4002950 100644
66456644
/**
66466645
* This node can be used to implement a variety of filter-like effects. The idea is
66476646
* to store the current rendering into a texture e.g. via `viewportSharedTexture()`, use it
6648-
@@ -148,17 +127,15 @@ declare class NodeMaterial extends Material {
6647+
@@ -148,17 +126,15 @@ declare class NodeMaterial extends Material {
66496648
*
66506649
* Backdrop computations are part of the lighting so only lit materials can use this property.
66516650
*
@@ -6665,7 +6664,7 @@ index 9e689cf0..d4002950 100644
66656664
/**
66666665
* The alpha test of node materials is by default inferred from the `alphaTest`
66676666
* property. This node property allows to overwrite the default and define the
6668-
@@ -167,17 +144,15 @@ declare class NodeMaterial extends Material {
6667+
@@ -167,17 +143,15 @@ declare class NodeMaterial extends Material {
66696668
* If you don't want to overwrite the alpha test but modify the existing
66706669
* value instead, use {@link materialAlphaTest}.
66716670
*
@@ -6685,7 +6684,7 @@ index 9e689cf0..d4002950 100644
66856684
/**
66866685
* The local vertex positions are computed based on multiple factors like the
66876686
* attribute data, morphing or skinning. This node property allows to overwrite
6688-
@@ -190,10 +165,9 @@ declare class NodeMaterial extends Material {
6687+
@@ -190,10 +164,9 @@ declare class NodeMaterial extends Material {
66896688
* material.positionNode = positionLocal.add( displace );
66906689
* ```
66916690
*
@@ -6697,7 +6696,7 @@ index 9e689cf0..d4002950 100644
66976696
/**
66986697
* This node property is intended for logic which modifies geometry data once or per animation step.
66996698
* Apps usually place such logic randomly in initialization routines or in the animation loop.
6700-
@@ -205,34 +179,30 @@ declare class NodeMaterial extends Material {
6699+
@@ -205,34 +178,30 @@ declare class NodeMaterial extends Material {
67016700
* simulation would be implemented as compute shaders and managed inside a `Fn` function. This function is
67026701
* eventually assigned to `geometryNode`.
67036702
*
@@ -6736,7 +6735,7 @@ index 9e689cf0..d4002950 100644
67366735
/**
67376736
* This node can be used to influence how an object using this node material
67386737
* receive shadows.
6739-
@@ -245,10 +215,9 @@ declare class NodeMaterial extends Material {
6738+
@@ -245,10 +214,9 @@ declare class NodeMaterial extends Material {
67406739
* return shadow.mix( color( 0xff0000 ), 1 ); // modify shadow color
67416740
* } );
67426741
*
@@ -6748,7 +6747,7 @@ index 9e689cf0..d4002950 100644
67486747
/**
67496748
* This node can be used to influence how an object using this node material
67506749
* casts shadows. To apply a color to shadows, you can simply do:
6751-
@@ -268,26 +237,23 @@ declare class NodeMaterial extends Material {
6750+
@@ -268,26 +236,23 @@ declare class NodeMaterial extends Material {
67526751
* } )();
67536752
* ```
67546753
*
@@ -6777,7 +6776,7 @@ index 9e689cf0..d4002950 100644
67776776
* @default null
67786777
*/
67796778
mrtNode: MRTNode | null;
6780-
@@ -296,19 +262,34 @@ declare class NodeMaterial extends Material {
6779+
@@ -296,19 +261,34 @@ declare class NodeMaterial extends Material {
67816780
* the fragment shader. Assigning a node will replace the built-in material
67826781
* logic used in the fragment stage.
67836782
*
@@ -6816,7 +6815,7 @@ index 9e689cf0..d4002950 100644
68166815
/**
68176816
* Builds this material with the given node builder.
68186817
*
6819-
@@ -354,35 +335,35 @@ declare class NodeMaterial extends Material {
6818+
@@ -354,35 +334,35 @@ declare class NodeMaterial extends Material {
68206819
* @param {NodeBuilder} builder - The current node builder.
68216820
* @return {Node<vec3>} The position in view space.
68226821
*/
@@ -6857,7 +6856,7 @@ index 9e689cf0..d4002950 100644
68576856
/**
68586857
* Abstract interface method that can be implemented by derived materials
68596858
* to setup material-specific node variables.
6860-
@@ -390,33 +371,33 @@ declare class NodeMaterial extends Material {
6859+
@@ -390,33 +370,33 @@ declare class NodeMaterial extends Material {
68616860
* @abstract
68626861
* @param {NodeBuilder} builder - The current node builder.
68636862
*/
@@ -6876,7 +6875,7 @@ index 9e689cf0..d4002950 100644
68766875
* @return {Node<vec3>} The normal node.
68776876
*/
68786877
- setupNormal(): Node<any>;
6879-
+ setupNormal(): ShaderNodeObject<Node>;
6878+
+ setupNormal(): Node;
68806879
/**
68816880
* Setups the environment node from the material.
68826881
*
@@ -6896,7 +6895,7 @@ index 9e689cf0..d4002950 100644
68966895
/**
68976896
* Setups the lights node based on the scene, environment and material.
68986897
*
6899-
@@ -439,7 +420,7 @@ declare class NodeMaterial extends Material {
6898+
@@ -439,7 +419,7 @@ declare class NodeMaterial extends Material {
69006899
* @param {NodeBuilder} builder - The current node builder.
69016900
* @return {Node<vec3>} The outgoing light node.
69026901
*/
@@ -6905,7 +6904,7 @@ index 9e689cf0..d4002950 100644
69056904
/**
69066905
* Setup the fog.
69076906
*
6908-
@@ -447,7 +428,7 @@ declare class NodeMaterial extends Material {
6907+
@@ -447,7 +427,7 @@ declare class NodeMaterial extends Material {
69096908
* @param {Node<vec4>} outputNode - The existing output node.
69106909
* @return {Node<vec4>} The output node.
69116910
*/
@@ -6914,7 +6913,7 @@ index 9e689cf0..d4002950 100644
69146913
/**
69156914
* Setups premultiplied alpha.
69166915
*
6917-
@@ -455,7 +436,7 @@ declare class NodeMaterial extends Material {
6916+
@@ -455,7 +435,7 @@ declare class NodeMaterial extends Material {
69186917
* @param {Node<vec4>} outputNode - The existing output node.
69196918
* @return {Node<vec4>} The output node.
69206919
*/
@@ -6923,7 +6922,7 @@ index 9e689cf0..d4002950 100644
69236922
/**
69246923
* Setups the output node.
69256924
*
6926-
@@ -463,7 +444,7 @@ declare class NodeMaterial extends Material {
6925+
@@ -463,7 +443,7 @@ declare class NodeMaterial extends Material {
69276926
* @param {Node<vec4>} outputNode - The existing output node.
69286927
* @return {Node<vec4>} The output node.
69296928
*/
@@ -6932,7 +6931,7 @@ index 9e689cf0..d4002950 100644
69326931
/**
69336932
* Most classic material types have a node pendant e.g. for `MeshBasicMaterial`
69346933
* there is `MeshBasicNodeMaterial`. This utility method is intended for
6935-
@@ -478,7 +459,10 @@ declare class NodeMaterial extends Material {
6934+
@@ -478,7 +458,10 @@ declare class NodeMaterial extends Material {
69366935
* @param {NodeMaterial} source - The material to copy.
69376936
* @return {NodeMaterial} A reference to this node material.
69386937
*/
@@ -7226,10 +7225,10 @@ index 7f8da84d..48184c33 100644
72267225
+
72277226
+export default SpriteNodeMaterial;
72287227
diff --git a/jsdoc-testing/jsdoc/materials/nodes/VolumeNodeMaterial.d.ts b/jsdoc-testing/jsdoc/materials/nodes/VolumeNodeMaterial.d.ts
7229-
index 8b5885c3..490eaea6 100644
7228+
index 8b5885c3..0697bba7 100644
72307229
--- a/jsdoc-testing/jsdoc/materials/nodes/VolumeNodeMaterial.d.ts
72317230
+++ b/jsdoc-testing/jsdoc/materials/nodes/VolumeNodeMaterial.d.ts
7232-
@@ -1,28 +1,13 @@
7231+
@@ -1,28 +1,12 @@
72337232
-export default VolumeNodeMaterial;
72347233
-/**
72357234
- * Volume node material.
@@ -7255,7 +7254,6 @@ index 8b5885c3..490eaea6 100644
72557254
+import VolumetricLightingModel from '../../nodes/functions/VolumetricLightingModel.js';
72567255
+import { MapColorPropertiesToColorRepresentations, MaterialParameters, MaterialProperties } from '../Material.js';
72577256
+import Node from "../../nodes/core/Node.js";
7258-
+import { ShaderNodeObject } from "../../nodes/tsl/TSLCore.js";
72597257
+
72607258
+export interface VolumeNodeMaterialNodeProperties extends NodeMaterialNodeProperties {
72617259
/**
@@ -7265,7 +7263,7 @@ index 8b5885c3..490eaea6 100644
72657263
* @default 25
72667264
*/
72677265
steps: number;
7268-
@@ -30,19 +15,43 @@ declare class VolumeNodeMaterial extends NodeMaterial {
7266+
@@ -30,19 +14,43 @@ declare class VolumeNodeMaterial extends NodeMaterial {
72697267
* Offsets the distance a ray has been traveled through a volume.
72707268
* Can be used to implement dithering to reduce banding.
72717269
*
@@ -7282,7 +7280,7 @@ index 8b5885c3..490eaea6 100644
72827280
*/
72837281
- scatteringNode: Function | FunctionNode<vec4>;
72847282
- side: number;
7285-
+ scatteringNode: (params: { positionRay: ShaderNodeObject<Node> }) => Node | null;
7283+
+ scatteringNode: (params: { positionRay: Node }) => Node | null;
72867284
+}
72877285
+
72887286
+// eslint-disable-next-line @typescript-eslint/no-empty-interface

0 commit comments

Comments
 (0)