({
accumulator,
viewToWorld,
ordering,
activeSplats,
displayed = false,
}: {
accumulator: OldSplatAccumulator;
viewToWorld: THREE.Matrix4;
ordering: Uint32Array;
activeSplats: number;
displayed?: boolean;
})
| 667 | } |
| 668 | |
| 669 | private updateDisplay({ |
| 670 | accumulator, |
| 671 | viewToWorld, |
| 672 | ordering, |
| 673 | activeSplats, |
| 674 | displayed = false, |
| 675 | }: { |
| 676 | accumulator: OldSplatAccumulator; |
| 677 | viewToWorld: THREE.Matrix4; |
| 678 | ordering: Uint32Array; |
| 679 | activeSplats: number; |
| 680 | displayed?: boolean; |
| 681 | }) { |
| 682 | if (!this.display) { |
| 683 | // Hold a reference to the accumulator while part of display |
| 684 | accumulator.refCount += 1; |
| 685 | this.display = { |
| 686 | accumulator, |
| 687 | viewToWorld, |
| 688 | geometry: new OldSplatGeometry(ordering, activeSplats), |
| 689 | }; |
| 690 | } else { |
| 691 | if (!displayed && accumulator !== this.display.accumulator) { |
| 692 | // Hold a reference to the new accumulator being displayed |
| 693 | accumulator.refCount += 1; |
| 694 | // Release the reference to the previously displayed accumulator |
| 695 | this.spark.releaseAccumulator(this.display.accumulator); |
| 696 | this.display.accumulator = accumulator; |
| 697 | } |
| 698 | |
| 699 | this.display.viewToWorld = viewToWorld; |
| 700 | |
| 701 | const oldOrdering = this.display.geometry.ordering; |
| 702 | if (oldOrdering.length === ordering.length) { |
| 703 | this.display.geometry.update(ordering, activeSplats); |
| 704 | } else { |
| 705 | this.display.geometry.dispose(); |
| 706 | // console.log("*** alloc SplatGeometry", ordering.length); |
| 707 | this.display.geometry = new OldSplatGeometry(ordering, activeSplats); |
| 708 | } |
| 709 | this.orderingFreelist.free(oldOrdering); |
| 710 | } |
| 711 | if (this.spark.viewpoint === this) { |
| 712 | this.spark.prepareViewpoint(this); |
| 713 | } |
| 714 | } |
| 715 | |
| 716 | // If you need an empty THREE.Texture to use to initialize a uniform that is |
| 717 | // updated via onTextureUpdated(texture), this static texture can be handy. |
no test coverage detected