({
rgbaArray,
quality,
}: { rgbaArray?: RgbaArray; quality?: boolean } = {})
| 897 | } |
| 898 | |
| 899 | async createLodSplats({ |
| 900 | rgbaArray, |
| 901 | quality, |
| 902 | }: { rgbaArray?: RgbaArray; quality?: boolean } = {}) { |
| 903 | const lodBase = |
| 904 | typeof this.lod === "number" |
| 905 | ? Math.max(1.1, Math.min(2.0, this.lod)) |
| 906 | : quality |
| 907 | ? 1.75 |
| 908 | : 1.5; |
| 909 | const packedArray = (this.packedArray as Uint32Array).slice(); |
| 910 | const rgba = rgbaArray ? (await rgbaArray.getArray()).slice() : undefined; |
| 911 | const extra = { |
| 912 | sh1: this.extra.sh1 ? (this.extra.sh1 as Uint32Array).slice() : undefined, |
| 913 | sh2: this.extra.sh2 ? (this.extra.sh2 as Uint32Array).slice() : undefined, |
| 914 | sh3: this.extra.sh3 ? (this.extra.sh3 as Uint32Array).slice() : undefined, |
| 915 | }; |
| 916 | const decoded = await workerPool.withWorker(async (worker) => { |
| 917 | return (await worker.call( |
| 918 | quality ? "qualityLodPackedSplats" : "tinyLodPackedSplats", |
| 919 | { |
| 920 | numSplats: this.numSplats, |
| 921 | packedArray, |
| 922 | extra, |
| 923 | lodBase, |
| 924 | rgba, |
| 925 | encoding: this.splatEncoding ?? DEFAULT_SPLAT_ENCODING, |
| 926 | }, |
| 927 | )) as { |
| 928 | numSplats: number; |
| 929 | packedArray: Uint32Array; |
| 930 | extra: Record<string, unknown>; |
| 931 | splatEncoding: SplatEncoding; |
| 932 | }; |
| 933 | }); |
| 934 | |
| 935 | const lodSplats = new PackedSplats(decoded); |
| 936 | if (this.lodSplats) { |
| 937 | this.lodSplats.dispose(); |
| 938 | } |
| 939 | |
| 940 | this.lodSplats = lodSplats; |
| 941 | this.nonLod = true; |
| 942 | this.lod = quality ? "quality" : true; |
| 943 | } |
| 944 | |
| 945 | extractSplats(indices: Uint32Array, pageColoring: boolean) { |
| 946 | const maxSplats = getTextureSize(indices.length).maxSplats; |
nothing calls this directly
no test coverage detected