11import StorageInstancedBufferAttribute from '../../renderers/common/StorageInstancedBufferAttribute.js' ;
22import StorageBufferAttribute from '../../renderers/common/StorageBufferAttribute.js' ;
33import { storage } from './StorageBufferNode.js' ;
4- import { getLengthFromType } from '../core/NodeUtils.js' ;
4+ import { getLengthFromType , getTypedArrayFromType } from '../core/NodeUtils.js' ;
55
66/** @module Arrays **/
77
@@ -16,8 +16,9 @@ import { getLengthFromType } from '../core/NodeUtils.js';
1616export const attributeArray = ( count , type = 'float' ) => {
1717
1818 const itemSize = getLengthFromType ( type ) ;
19+ const typedArray = getTypedArrayFromType ( type ) ;
1920
20- const buffer = new StorageBufferAttribute ( count , itemSize ) ;
21+ const buffer = new StorageBufferAttribute ( count , itemSize , typedArray ) ;
2122 const node = storage ( buffer , type , count ) ;
2223
2324 return node ;
@@ -35,8 +36,9 @@ export const attributeArray = ( count, type = 'float' ) => {
3536export const instancedArray = ( count , type = 'float' ) => {
3637
3738 const itemSize = getLengthFromType ( type ) ;
39+ const typedArray = getTypedArrayFromType ( type ) ;
3840
39- const buffer = new StorageInstancedBufferAttribute ( count , itemSize ) ;
41+ const buffer = new StorageInstancedBufferAttribute ( count , itemSize , typedArray ) ;
4042 const node = storage ( buffer , type , count ) ;
4143
4244 return node ;
0 commit comments