(indices: Uint32Array, pageColoring: boolean)
| 622 | } |
| 623 | |
| 624 | extractSplats(indices: Uint32Array, pageColoring: boolean) { |
| 625 | const maxSplats = getTextureSize(indices.length).maxSplats; |
| 626 | const newSplats = new ExtSplats({ maxSplats }); |
| 627 | for (let i = 0; i < indices.length; i++) { |
| 628 | const splat = this.getSplat(indices[i]); |
| 629 | if (pageColoring) { |
| 630 | let hue = (indices[i] >>> 16) * 0.61803398875; |
| 631 | hue = hue - Math.floor(hue); |
| 632 | const r = Math.max(0, Math.min(1, Math.abs(hue * 6.0 - 3.0) - 1.0)); |
| 633 | const g = Math.max(0, Math.min(1, Math.abs(hue * 6.0 + 1.0) - 1.0)); |
| 634 | const b = Math.max(0, Math.min(1, Math.abs(hue * 6.0 - 1.0) - 1.0)); |
| 635 | splat.color.r *= r; |
| 636 | splat.color.g *= g; |
| 637 | splat.color.b *= b; |
| 638 | } |
| 639 | newSplats.pushSplat( |
| 640 | splat.center, |
| 641 | splat.scales, |
| 642 | splat.quaternion, |
| 643 | splat.opacity, |
| 644 | splat.color, |
| 645 | ); |
| 646 | } |
| 647 | return newSplats; |
| 648 | } |
| 649 | |
| 650 | static emptyArray = (() => { |
| 651 | const { width, height, depth, maxSplats } = getTextureSize(1); |
no test coverage detected