File tree Expand file tree Collapse file tree 2 files changed +18
-1
lines changed Expand file tree Collapse file tree 2 files changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -1320,9 +1320,16 @@ class NodeBuilder {
1320
1320
1321
1321
if ( length === 1 ) return componentType ;
1322
1322
1323
- const baseType = getTypeFromLength ( length ) ;
1323
+ let baseType = getTypeFromLength ( length ) ;
1324
1324
const prefix = componentType === 'float' ? '' : componentType [ 0 ] ;
1325
1325
1326
+ // fix edge case for mat2x2 being same size as vec4
1327
+ if ( / m a t 2 / . test ( componentType ) === true ) {
1328
+
1329
+ baseType = baseType . replace ( 'vec' , 'mat' ) ;
1330
+
1331
+ }
1332
+
1326
1333
return prefix + baseType ;
1327
1334
1328
1335
}
Original file line number Diff line number Diff line change 1
1
import { Color } from '../../math/Color.js' ;
2
+ import { Matrix2 } from '../../math/Matrix2.js' ;
2
3
import { Matrix3 } from '../../math/Matrix3.js' ;
3
4
import { Matrix4 } from '../../math/Matrix4.js' ;
4
5
import { Vector2 } from '../../math/Vector2.js' ;
@@ -229,6 +230,7 @@ export function getLengthFromType( type ) {
229
230
if ( / v e c 2 / . test ( type ) ) return 2 ;
230
231
if ( / v e c 3 / . test ( type ) ) return 3 ;
231
232
if ( / v e c 4 / . test ( type ) ) return 4 ;
233
+ if ( / m a t 2 / . test ( type ) ) return 4 ;
232
234
if ( / m a t 3 / . test ( type ) ) return 9 ;
233
235
if ( / m a t 4 / . test ( type ) ) return 16 ;
234
236
@@ -281,6 +283,10 @@ export function getValueType( value ) {
281
283
282
284
return 'vec4' ;
283
285
286
+ } else if ( value . isMatrix2 === true ) {
287
+
288
+ return 'mat2' ;
289
+
284
290
} else if ( value . isMatrix3 === true ) {
285
291
286
292
return 'mat3' ;
@@ -339,6 +345,10 @@ export function getValueFromType( type, ...params ) {
339
345
340
346
return new Vector4 ( ...params ) ;
341
347
348
+ } else if ( last4 === 'mat2' ) {
349
+
350
+ return new Matrix2 ( ...params ) ;
351
+
342
352
} else if ( last4 === 'mat3' ) {
343
353
344
354
return new Matrix3 ( ...params ) ;
You can’t perform that action at this time.
0 commit comments