File tree 3 files changed +31
-6
lines changed
3 files changed +31
-6
lines changed Original file line number Diff line number Diff line change @@ -2614,13 +2614,13 @@ class NodeBuilder {
2614
2614
2615
2615
if ( fromTypeLength === 16 && toTypeLength === 9 ) {
2616
2616
2617
- return `${ this . getType ( toType ) } (${ snippet } [0 ].xyz, ${ snippet } [1 ].xyz, ${ snippet } [2 ].xyz)` ;
2617
+ return `${ this . getType ( toType ) } ( ${ snippet } [ 0 ].xyz, ${ snippet } [ 1 ].xyz, ${ snippet } [ 2 ].xyz )` ;
2618
2618
2619
2619
}
2620
2620
2621
2621
if ( fromTypeLength === 9 && toTypeLength === 4 ) {
2622
2622
2623
- return `${ this . getType ( toType ) } (${ snippet } [0 ].xy, ${ snippet } [1 ].xy)` ;
2623
+ return `${ this . getType ( toType ) } ( ${ snippet } [ 0 ].xy, ${ snippet } [ 1 ].xy )` ;
2624
2624
2625
2625
}
2626
2626
Original file line number Diff line number Diff line change @@ -17,12 +17,12 @@ export function addMethodChaining( name, nodeElement ) {
17
17
18
18
if ( NodeElements . has ( name ) ) {
19
19
20
- console . warn ( `Redefinition of method chaining ${ name } ` ) ;
20
+ console . warn ( `THREE.TSL: Redefinition of method chaining ' ${ name } '. ` ) ;
21
21
return ;
22
22
23
23
}
24
24
25
- if ( typeof nodeElement !== 'function' ) throw new Error ( `Node element ${ name } is not a function` ) ;
25
+ if ( typeof nodeElement !== 'function' ) throw new Error ( `THREE.TSL: Node element ${ name } is not a function` ) ;
26
26
27
27
NodeElements . set ( name , nodeElement ) ;
28
28
Original file line number Diff line number Diff line change @@ -56,17 +56,42 @@ class JoinNode extends TempNode {
56
56
generate ( builder , output ) {
57
57
58
58
const type = this . getNodeType ( builder ) ;
59
+ const maxLength = builder . getTypeLength ( type ) ;
60
+
59
61
const nodes = this . nodes ;
60
62
61
63
const primitiveType = builder . getComponentType ( type ) ;
62
64
63
65
const snippetValues = [ ] ;
64
66
67
+ let length = 0 ;
68
+
65
69
for ( const input of nodes ) {
66
70
67
- let inputSnippet = input . build ( builder ) ;
71
+ if ( length >= maxLength ) {
72
+
73
+ console . error ( 'THREE.TSL: Length of parameters exceeds maximum length of function type.' ) ;
74
+ break ;
75
+
76
+ }
77
+
78
+ let inputType = input . getNodeType ( builder ) ;
79
+ let inputTypeLength = builder . getTypeLength ( inputType ) ;
80
+ let inputSnippet ;
81
+
82
+ if ( length + inputTypeLength > maxLength ) {
83
+
84
+ console . error ( 'THREE.TSL: Length of joined data exceeds maximum length of output type.' ) ;
85
+
86
+ inputTypeLength = maxLength - length ;
87
+ inputType = builder . getTypeFromLength ( inputTypeLength ) ;
88
+
89
+ }
90
+
91
+ length += inputTypeLength ;
92
+ inputSnippet = input . build ( builder , inputType ) ;
68
93
69
- const inputPrimitiveType = builder . getComponentType ( input . getNodeType ( builder ) ) ;
94
+ const inputPrimitiveType = builder . getComponentType ( inputType ) ;
70
95
71
96
if ( inputPrimitiveType !== primitiveType ) {
72
97
You can’t perform that action at this time.
0 commit comments