Skip to content

Commit b6f1bb2

Browse files
authored
Update dependencies (#486)
1 parent 85cc129 commit b6f1bb2

File tree

7 files changed

+129
-148
lines changed

7 files changed

+129
-148
lines changed

package-lock.json

+111-136
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
"jest": "^29.7.0",
5353
"jszip": "^3.10.1",
5454
"mp4-muxer": "^5.2.1",
55-
"playcanvas": "^2.7.1",
55+
"playcanvas": "^2.7.2",
5656
"postcss": "^8.5.3",
5757
"rollup": "^4.40.0",
5858
"rollup-plugin-scss": "^4.0.1",

src/asset-loader.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ class AssetLoader {
177177
url: loadRequest.url,
178178
filename: loadRequest.filename
179179
});
180-
asset.resource = new GSplatResource(this.app.graphicsDevice, gsplatData, []);
180+
asset.resource = new GSplatResource(this.app, gsplatData, []);
181181
resolve(new Splat(asset));
182182
})
183183
.catch((err) => {

src/camera.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -501,7 +501,7 @@ class Camera extends Element {
501501

502502
const fdist = focalRadius / this.sceneRadius;
503503

504-
this.setDistance(isNaN(fdist) ? 1 : fdist, options?.speed ?? 0);
504+
this.setDistance(isFinite(fdist) ? fdist : 1, options?.speed ?? 0);
505505
this.setFocalPoint(focalPoint, options?.speed ?? 0);
506506
}
507507

src/splat-serialize.ts

+10-3
Original file line numberDiff line numberDiff line change
@@ -792,9 +792,9 @@ const sortSplats = (splats: Splat[], indices: CompressedIndex[]) => {
792792
const y = centers[i * 3 + 1];
793793
const z = centers[i * 3 + 2];
794794

795-
const ix = Math.floor(1024 * (x - minx) / xlen);
796-
const iy = Math.floor(1024 * (y - miny) / ylen);
797-
const iz = Math.floor(1024 * (z - minz) / zlen);
795+
const ix = Math.min(1023, Math.floor(1024 * (x - minx) / xlen));
796+
const iy = Math.min(1023, Math.floor(1024 * (y - miny) / ylen));
797+
const iz = Math.min(1023, Math.floor(1024 * (z - minz) / zlen));
798798

799799
morton[idx++] = encodeMorton3(ix, iy, iz);
800800
}
@@ -918,6 +918,13 @@ const serializePlyCompressed = async (splats: Splat[], options: SerializeSetting
918918
}
919919
}
920920

921+
// pad the end of the last chunk with duplicate data
922+
if (num < 256) {
923+
for (let j = num; j < 256; ++j) {
924+
chunk.set(j, singleSplat);
925+
}
926+
}
927+
921928
const result = chunk.pack();
922929

923930
const off = chunkOffset + i * 18 * 4;

src/splat.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ class Splat extends Element {
141141

142142
// pack spherical harmonic data
143143
const createTexture = (name: string, format: number) => {
144-
return new Texture(splatResource.device, {
144+
return new Texture(splatResource.app.graphicsDevice, {
145145
name: name,
146146
width: width,
147147
height: height,
@@ -159,7 +159,7 @@ class Splat extends Element {
159159
this.transformTexture = createTexture('splatTransform', PIXELFORMAT_R16U);
160160

161161
// create the transform palette
162-
this.transformPalette = new TransformPalette(splatResource.device);
162+
this.transformPalette = new TransformPalette(splatResource.app.graphicsDevice);
163163

164164
// blend mode for splats
165165
const blendState = new BlendState(true, BLENDEQUATION_ADD, BLENDMODE_ONE, BLENDMODE_ONE_MINUS_SRC_ALPHA);

src/ui/histogram.ts

+3-4
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class HistogramData {
2424
let min, max, i;
2525
for (i = 0; i < count; i++) {
2626
const v = valueFunc(i);
27-
if (v !== undefined && !isNaN(v)) {
27+
if (v !== undefined && isFinite(v)) {
2828
min = max = v;
2929
break;
3030
}
@@ -38,17 +38,16 @@ class HistogramData {
3838
// continue min/max calc
3939
for (; i < count; i++) {
4040
const v = valueFunc(i);
41-
if (v !== undefined) {
41+
if (v !== undefined && isFinite(v)) {
4242
if (v < min) min = v; else if (v > max) max = v;
4343
}
4444
}
4545

4646
// fill bins
4747
for (let i = 0; i < count; i++) {
4848
const v = valueFunc(i);
49-
if (v !== undefined) {
49+
if (v !== undefined && isFinite(v)) {
5050
const n = min === max ? 0 : (v - min) / (max - min);
51-
if (isNaN(n)) continue;
5251
const bin = Math.min(bins.length - 1, Math.floor(n * bins.length));
5352
if (selectedFunc(i)) {
5453
bins[bin].selected++;

0 commit comments

Comments
 (0)