Buckets:
| import StorageInstancedBufferAttribute from '../../renderers/common/StorageInstancedBufferAttribute.js'; | |
| import StorageBufferAttribute from '../../renderers/common/StorageBufferAttribute.js'; | |
| import { storage } from './StorageBufferNode.js'; | |
| import { getLengthFromType, getTypedArrayFromType } from '../core/NodeUtils.js'; | |
| /** | |
| * TSL function for creating a storage buffer node with a configured `StorageBufferAttribute`. | |
| * | |
| * @tsl | |
| * @function | |
| * @param {number|TypedArray} count - The data count. It is also valid to pass a typed array as an argument. | |
| * @param {string|Struct} [type='float'] - The data type. | |
| * @returns {StorageBufferNode} | |
| */ | |
| export const attributeArray = ( count, type = 'float' ) => { | |
| let itemSize, typedArray; | |
| if ( type.isStruct === true ) { | |
| itemSize = type.layout.getLength(); | |
| typedArray = getTypedArrayFromType( 'float' ); | |
| } else { | |
| itemSize = getLengthFromType( type ); | |
| typedArray = getTypedArrayFromType( type ); | |
| } | |
| const buffer = new StorageBufferAttribute( count, itemSize, typedArray ); | |
| const node = storage( buffer, type, count ); | |
| return node; | |
| }; | |
| /** | |
| * TSL function for creating a storage buffer node with a configured `StorageInstancedBufferAttribute`. | |
| * | |
| * @tsl | |
| * @function | |
| * @param {number|TypedArray} count - The data count. It is also valid to pass a typed array as an argument. | |
| * @param {string|Struct} [type='float'] - The data type. | |
| * @returns {StorageBufferNode} | |
| */ | |
| export const instancedArray = ( count, type = 'float' ) => { | |
| let itemSize, typedArray; | |
| if ( type.isStruct === true ) { | |
| itemSize = type.layout.getLength(); | |
| typedArray = getTypedArrayFromType( 'float' ); | |
| } else { | |
| itemSize = getLengthFromType( type ); | |
| typedArray = getTypedArrayFromType( type ); | |
| } | |
| const buffer = new StorageInstancedBufferAttribute( count, itemSize, typedArray ); | |
| const node = storage( buffer, type, count ); | |
| return node; | |
| }; | |
Xet Storage Details
- Size:
- 1.9 kB
- Xet hash:
- a71f66f75ae7e7f656e7e5900c8276777c0c47d4a05342542ff0235e13476abe
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.