()
| 570 | } |
| 571 | |
| 572 | getIndices(): ArrayLike<number> { |
| 573 | let newIndices; |
| 574 | |
| 575 | const indices = this._indices; |
| 576 | if (indices) { |
| 577 | const Ctor = indices.constructor as DataArrayLikeConstructor; |
| 578 | const thisCount = this._count; |
| 579 | // `new Array(a, b, c)` is different from `new Uint32Array(a, b, c)`. |
| 580 | if (Ctor === Array) { |
| 581 | newIndices = new Ctor(thisCount); |
| 582 | for (let i = 0; i < thisCount; i++) { |
| 583 | newIndices[i] = indices[i]; |
| 584 | } |
| 585 | } |
| 586 | else { |
| 587 | newIndices = new (Ctor as DataTypedArrayConstructor)( |
| 588 | (indices as DataTypedArray).buffer, 0, thisCount |
| 589 | ); |
| 590 | } |
| 591 | } |
| 592 | else { |
| 593 | const Ctor = getIndicesCtor(this._rawCount); |
| 594 | newIndices = new Ctor(this.count()); |
| 595 | for (let i = 0; i < newIndices.length; i++) { |
| 596 | newIndices[i] = i; |
| 597 | } |
| 598 | } |
| 599 | |
| 600 | return newIndices; |
| 601 | } |
| 602 | |
| 603 | /** |
| 604 | * [NOTICE]: Performance-sensitive for large data. |
no test coverage detected