()
| 579 | |
| 580 | // Check if source texture needs to be created/updated |
| 581 | private updateTextures() { |
| 582 | if (this.textures[0] !== ExtSplats.emptyTexture) { |
| 583 | const { width, height, depth } = this.textures[0].image; |
| 584 | if (this.maxSplats !== width * height * depth) { |
| 585 | // The existing source texture isn't the right size, so dispose it |
| 586 | this.textures[0].dispose(); |
| 587 | this.textures[0] = ExtSplats.emptyTexture; |
| 588 | this.textures[1].dispose(); |
| 589 | this.textures[1] = ExtSplats.emptyTexture; |
| 590 | } |
| 591 | } |
| 592 | if (this.textures[0] === ExtSplats.emptyTexture) { |
| 593 | // Allocate a new source texture of the right size |
| 594 | const { width, height, depth } = getTextureSize(this.maxSplats); |
| 595 | this.textures[0] = newUint32ArrayTexture( |
| 596 | this.extArrays[0], |
| 597 | width, |
| 598 | height, |
| 599 | depth, |
| 600 | THREE.RGBAIntegerFormat, |
| 601 | THREE.UnsignedIntType, |
| 602 | "RGBA32UI", |
| 603 | ); |
| 604 | this.textures[1] = newUint32ArrayTexture( |
| 605 | this.extArrays[1], |
| 606 | width, |
| 607 | height, |
| 608 | depth, |
| 609 | THREE.RGBAIntegerFormat, |
| 610 | THREE.UnsignedIntType, |
| 611 | "RGBA32UI", |
| 612 | ); |
| 613 | } else if ( |
| 614 | this.extArrays[0].buffer !== this.textures[0].image.data.buffer |
| 615 | ) { |
| 616 | this.textures[0].image.data = new Uint8Array(this.extArrays[0].buffer); |
| 617 | this.textures[1].image.data = new Uint8Array(this.extArrays[1].buffer); |
| 618 | // Indicate to Three.js that the source textures needs to be uploaded to the GPU |
| 619 | this.textures[0].needsUpdate = true; |
| 620 | this.textures[1].needsUpdate = true; |
| 621 | } |
| 622 | } |
| 623 | |
| 624 | extractSplats(indices: Uint32Array, pageColoring: boolean) { |
| 625 | const maxSplats = getTextureSize(indices.length).maxSplats; |
no test coverage detected