@playcanvas/supersplat-viewer 1.4.1 → 1.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@playcanvas/supersplat-viewer",
3
- "version": "1.4.1",
3
+ "version": "1.5.0",
4
4
  "author": "PlayCanvas <support@playcanvas.com>",
5
5
  "homepage": "https://github.com/playcanvas/supersplat-viewer#readme",
6
6
  "description": "Viewer for https://superspl.at",
@@ -41,14 +41,14 @@
41
41
  "@playcanvas/web-components": "^0.2.10",
42
42
  "@rollup/plugin-node-resolve": "^16.0.1",
43
43
  "@rollup/plugin-typescript": "^12.1.4",
44
- "@typescript-eslint/eslint-plugin": "^8.43.0",
45
- "@typescript-eslint/parser": "^8.43.0",
44
+ "@typescript-eslint/eslint-plugin": "^8.44.0",
45
+ "@typescript-eslint/parser": "^8.44.0",
46
46
  "concurrently": "^9.2.1",
47
47
  "eslint": "^9.35.0",
48
- "globals": "^16.3.0",
49
- "playcanvas": "^2.11.3",
48
+ "globals": "^16.4.0",
49
+ "playcanvas": "^2.11.8",
50
50
  "publint": "^0.3.12",
51
- "rollup": "^4.50.1",
51
+ "rollup": "^4.50.2",
52
52
  "rollup-plugin-copy": "^3.5.0",
53
53
  "rollup-plugin-string": "^3.0.0",
54
54
  "serve": "^14.2.5",
package/public/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  const TRACEID_GPU_TIMINGS = 'GpuTimings';
2
2
 
3
- const version = '2.11.3';
4
- const revision = '99c96dd';
3
+ const version = '2.11.8';
4
+ const revision = 'd712e1a';
5
5
  function extend(target, ex) {
6
6
  for(const prop in ex){
7
7
  const copy = ex[prop];
@@ -3277,6 +3277,12 @@ class Quat {
3277
3277
  let m20 = d[8];
3278
3278
  let m21 = d[9];
3279
3279
  let m22 = d[10];
3280
+ const det = m00 * (m11 * m22 - m12 * m21) - m01 * (m10 * m22 - m12 * m20) + m02 * (m10 * m21 - m11 * m20);
3281
+ if (det < 0) {
3282
+ m00 = -m00;
3283
+ m01 = -m01;
3284
+ m02 = -m02;
3285
+ }
3280
3286
  let l;
3281
3287
  l = m00 * m00 + m01 * m01 + m02 * m02;
3282
3288
  if (l === 0) return this.set(0, 0, 0, 1);
@@ -34678,7 +34684,7 @@ const resolve = (scope, values)=>{
34678
34684
  class GSplatSogsIterator {
34679
34685
  constructor(data, p, r, s, c, sh){
34680
34686
  const lerp = (a, b, t)=>a * (1 - t) + b * t;
34681
- const { meta } = data;
34687
+ const { meta, shBands } = data;
34682
34688
  const { means, scales, sh0, shN } = meta;
34683
34689
  const means_l_data = p && data.means_l._levels[0];
34684
34690
  const means_u_data = p && data.means_u._levels[0];
@@ -34688,6 +34694,11 @@ class GSplatSogsIterator {
34688
34694
  const sh_labels_data = sh && data.sh_labels._levels[0];
34689
34695
  const sh_centroids_data = sh && data.sh_centroids._levels[0];
34690
34696
  const norm = 2.0 / Math.sqrt(2.0);
34697
+ const coeffs = {
34698
+ 1: 3,
34699
+ 2: 8,
34700
+ 3: 15
34701
+ }[shBands] ?? 0;
34691
34702
  this.read = (i)=>{
34692
34703
  if (p) {
34693
34704
  const nx = lerp(means.mins[0], means.maxs[0], ((means_u_data[i * 4 + 0] << 8) + means_l_data[i * 4 + 0]) / 65535);
@@ -34748,17 +34759,17 @@ class GSplatSogsIterator {
34748
34759
  }
34749
34760
  if (sh) {
34750
34761
  const n = sh_labels_data[i * 4 + 0] + (sh_labels_data[i * 4 + 1] << 8);
34751
- const u = n % 64 * 15;
34762
+ const u = n % 64 * coeffs;
34752
34763
  const v = Math.floor(n / 64);
34753
34764
  if (meta.version === 2) {
34754
34765
  for(let j = 0; j < 3; ++j){
34755
- for(let k = 0; k < 15; ++k){
34766
+ for(let k = 0; k < coeffs; ++k){
34756
34767
  sh[j * 15 + k] = shN.codebook[sh_centroids_data[(u + k) * 4 + j + v * data.sh_centroids.width * 4]];
34757
34768
  }
34758
34769
  }
34759
34770
  } else {
34760
34771
  for(let j = 0; j < 3; ++j){
34761
- for(let k = 0; k < 15; ++k){
34772
+ for(let k = 0; k < coeffs; ++k){
34762
34773
  sh[j * 15 + k] = lerp(shN.mins, shN.maxs, sh_centroids_data[(u + k) * 4 + j + v * data.sh_centroids.width * 4] / 255);
34763
34774
  }
34764
34775
  }
@@ -34819,7 +34830,9 @@ class GSplatSogsData {
34819
34830
  }
34820
34831
  }
34821
34832
  calcFocalPoint(result, pred) {
34822
- result.set(0, 0, 0);
34833
+ const { mins, maxs } = this.meta.means;
34834
+ const map = (v)=>Math.sign(v) * (Math.exp(Math.abs(v)) - 1);
34835
+ result.set((map(mins[0]) + map(maxs[0])) * 0.5, (map(mins[1]) + map(maxs[1])) * 0.5, (map(mins[2]) + map(maxs[2])) * 0.5);
34823
34836
  }
34824
34837
  get isSogs() {
34825
34838
  return true;
@@ -82171,7 +82184,7 @@ class SogBundleParser {
82171
82184
  let texture;
82172
82185
  if (file) {
82173
82186
  texture = new Asset(filename, 'texture', {
82174
- url: filename,
82187
+ url: `${url.load}/${filename}`,
82175
82188
  filename,
82176
82189
  contents: file.data
82177
82190
  }, {
@@ -95306,7 +95319,7 @@ class AppController {
95306
95319
  // desktop move
95307
95320
  const v = tmpV1.set(0, 0, 0);
95308
95321
  const keyMove = this._state.axis.clone().normalize();
95309
- v.add(keyMove.mulScalar(fly * this.moveSpeed * (this._state.shift ? 2 : this._state.ctrl ? 0.5 : 1) * dt));
95322
+ v.add(keyMove.mulScalar(fly * this.moveSpeed * (this._state.shift ? 4 : this._state.ctrl ? 0.25 : 1) * dt));
95310
95323
  const panMove = screenToWorld(this._camera, mouse[0], mouse[1], distance);
95311
95324
  v.add(panMove.mulScalar(pan));
95312
95325
  const wheelMove = new Vec3(0, 0, -wheel[0]);
@@ -95603,7 +95616,8 @@ class Viewer {
95603
95616
  // create controller
95604
95617
  // set move speed based on scene size, within reason
95605
95618
  const controller = new AppController(app.graphicsDevice.canvas, entity.camera);
95606
- controller.moveSpeed = bbox.halfExtents.length() * 0.1;
95619
+ // fixed move speed
95620
+ controller.moveSpeed = 4;
95607
95621
  // this pose stores the current camera position. it will be blended/smoothed
95608
95622
  // toward the current active camera
95609
95623
  const activePose = new Pose();