|
|
@@ -1,7 +1,7 @@
|
|
|
import StorageInstancedBufferAttribute from '../../renderers/common/StorageInstancedBufferAttribute.js';
|
|
|
import StorageBufferAttribute from '../../renderers/common/StorageBufferAttribute.js';
|
|
|
import { storage } from './StorageBufferNode.js';
|
|
|
-import { getLengthFromType } from '../core/NodeUtils.js';
|
|
|
+import { getLengthFromType, getTypedArrayFromType } from '../core/NodeUtils.js';
|
|
|
|
|
|
/** @module Arrays **/
|
|
|
|
|
|
@@ -16,8 +16,9 @@ import { getLengthFromType } from '../core/NodeUtils.js';
|
|
|
export const attributeArray = ( count, type = 'float' ) => {
|
|
|
|
|
|
const itemSize = getLengthFromType( type );
|
|
|
+ const typedArray = getTypedArrayFromType( type );
|
|
|
|
|
|
- const buffer = new StorageBufferAttribute( count, itemSize );
|
|
|
+ const buffer = new StorageBufferAttribute( count, itemSize, typedArray );
|
|
|
const node = storage( buffer, type, count );
|
|
|
|
|
|
return node;
|
|
|
@@ -35,8 +36,9 @@ export const attributeArray = ( count, type = 'float' ) => {
|
|
|
export const instancedArray = ( count, type = 'float' ) => {
|
|
|
|
|
|
const itemSize = getLengthFromType( type );
|
|
|
+ const typedArray = getTypedArrayFromType( type );
|
|
|
|
|
|
- const buffer = new StorageInstancedBufferAttribute( count, itemSize );
|
|
|
+ const buffer = new StorageInstancedBufferAttribute( count, itemSize, typedArray );
|
|
|
const node = storage( buffer, type, count );
|
|
|
|
|
|
return node;
|