@playcanvas/web-components 0.7.1 → 0.8.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/web-components",
3
- "version": "0.7.1",
3
+ "version": "0.8.0",
4
4
  "author": "PlayCanvas <support@playcanvas.com>",
5
5
  "homepage": "https://playcanvas.com",
6
6
  "description": "Web Components for the PlayCanvas Engine",
@@ -45,7 +45,7 @@
45
45
  "watch": "rollup -c -w"
46
46
  },
47
47
  "peerDependencies": {
48
- "playcanvas": "^2.19.0"
48
+ "playcanvas": "^2.20.1"
49
49
  },
50
50
  "devDependencies": {
51
51
  "@mediapipe/tasks-vision": "0.10.35",
@@ -58,13 +58,13 @@
58
58
  "@typescript-eslint/eslint-plugin": "8.62.0",
59
59
  "@typescript-eslint/parser": "8.62.0",
60
60
  "concurrently": "10.0.3",
61
- "earcut": "3.0.2",
61
+ "earcut": "3.1.0",
62
62
  "eslint": "9.39.4",
63
63
  "eslint-import-resolver-typescript": "4.4.5",
64
64
  "globals": "17.7.0",
65
65
  "mediabunny": "1.49.0",
66
66
  "opentype.js": "2.0.0",
67
- "playcanvas": "2.20.0",
67
+ "playcanvas": "2.20.1",
68
68
  "publint": "0.3.21",
69
69
  "rollup": "4.62.2",
70
70
  "serve": "14.2.6",
@@ -20,6 +20,10 @@ class GSplatComponentElement extends ComponentElement {
20
20
 
21
21
  private _lodMultiplier = 3;
22
22
 
23
+ private _lodRangeMin = 0;
24
+
25
+ private _lodRangeMax = 99;
26
+
23
27
  /** @ignore */
24
28
  constructor() {
25
29
  super('gsplat');
@@ -30,7 +34,9 @@ class GSplatComponentElement extends ComponentElement {
30
34
  asset: AssetElement.get(this._asset),
31
35
  castShadows: this._castShadows,
32
36
  lodBaseDistance: this._lodBaseDistance,
33
- lodMultiplier: this._lodMultiplier
37
+ lodMultiplier: this._lodMultiplier,
38
+ lodRangeMin: this._lodRangeMin,
39
+ lodRangeMax: this._lodRangeMax
34
40
  };
35
41
  }
36
42
 
@@ -126,13 +132,58 @@ class GSplatComponentElement extends ComponentElement {
126
132
  return this._lodMultiplier;
127
133
  }
128
134
 
135
+ /**
136
+ * Sets the minimum allowed LOD index (inclusive). The LOD selected by distance is clamped so it
137
+ * never goes finer (lower index) than this value. Raising it avoids downloading the highest
138
+ * quality (largest) LOD files. Defaults to 0. Only affects assets that contain LOD levels (e.g.
139
+ * `.lod-meta.json`).
140
+ * @param value - The minimum LOD index.
141
+ */
142
+ set lodRangeMin(value: number) {
143
+ this._lodRangeMin = value;
144
+ if (this.component) {
145
+ this.component.lodRangeMin = value;
146
+ }
147
+ }
148
+
149
+ /**
150
+ * Gets the minimum allowed LOD index.
151
+ * @returns The minimum LOD index.
152
+ */
153
+ get lodRangeMin() {
154
+ return this._lodRangeMin;
155
+ }
156
+
157
+ /**
158
+ * Sets the maximum allowed LOD index (inclusive). The LOD selected by distance is clamped so it
159
+ * never goes coarser (higher index) than this value. The default of 99 effectively means "no
160
+ * cap". Defaults to 99. Only affects assets that contain LOD levels (e.g. `.lod-meta.json`).
161
+ * @param value - The maximum LOD index.
162
+ */
163
+ set lodRangeMax(value: number) {
164
+ this._lodRangeMax = value;
165
+ if (this.component) {
166
+ this.component.lodRangeMax = value;
167
+ }
168
+ }
169
+
170
+ /**
171
+ * Gets the maximum allowed LOD index.
172
+ * @returns The maximum LOD index.
173
+ */
174
+ get lodRangeMax() {
175
+ return this._lodRangeMax;
176
+ }
177
+
129
178
  static get observedAttributes() {
130
179
  return [
131
180
  ...super.observedAttributes,
132
181
  'asset',
133
182
  'cast-shadows',
134
183
  'lod-base-distance',
135
- 'lod-multiplier'
184
+ 'lod-multiplier',
185
+ 'lod-range-min',
186
+ 'lod-range-max'
136
187
  ];
137
188
  }
138
189
 
@@ -152,6 +203,12 @@ class GSplatComponentElement extends ComponentElement {
152
203
  case 'lod-multiplier':
153
204
  this.lodMultiplier = Number(newValue);
154
205
  break;
206
+ case 'lod-range-min':
207
+ this.lodRangeMin = Number(newValue);
208
+ break;
209
+ case 'lod-range-max':
210
+ this.lodRangeMax = Number(newValue);
211
+ break;
155
212
  }
156
213
  }
157
214
  }