Skip to content
Snippets Groups Projects
Commit a7d70f4b authored by Alexander Rose's avatar Alexander Rose
Browse files

ChunkedArray.addRepeat

parent c9ae4a10
No related branches found
No related tags found
No related merge requests found
......@@ -77,6 +77,15 @@ namespace ChunkedArray {
return array.elementCount++;
}
export function addRepeat<T>(array: ChunkedArray<T, 1>, n: number, x: T) {
for (let i = 0; i < n; i++) {
if (array.currentIndex >= array.currentSize) allocateNext(array);
array.currentChunk[array.currentIndex++] = x;
array.elementCount++;
}
return array.elementCount;
}
export function addMany<T>(array: ChunkedArray<T, any>, data: ArrayLike<T>) {
const { elementSize } = array;
for (let i = 0, _i = data.length; i < _i; i += elementSize) {
......
......@@ -131,5 +131,5 @@ export function addTube(builder: MeshBuilder, controlPoints: ArrayLike<number>,
}
const addedVertexCount = (linearSegments + 1) * radialSegments + (startCap ? radialSegments + 1 : 0) + (endCap ? radialSegments + 1 : 0)
for (let i = 0, il = addedVertexCount; i < il; ++i) ChunkedArray.add(groups, currentGroup)
ChunkedArray.addRepeat(groups, addedVertexCount, currentGroup)
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment