Needle Engine

Changes between version 3.43.0-beta and 3.43.0-beta.1
Files changed (4) hide show
  1. src/engine-components/export/usdz/extensions/behavior/BehaviourComponents.ts +10 -0
  2. src/engine/webcomponents/needle-button.ts +0 -1
  3. src/engine-components/Skybox.ts +22 -10
  4. src/engine-components/postprocessing/Volume.ts +5 -0
src/engine-components/export/usdz/extensions/behavior/BehaviourComponents.ts CHANGED
@@ -164,12 +164,22 @@
164
164
 
165
165
  export class ChangeMaterialOnClick extends Behaviour implements IPointerClickHandler, UsdzBehaviour {
166
166
 
167
+ /**
168
+ * The material that will be switched to the variant material
169
+ */
167
170
  @serializable(Material)
168
171
  materialToSwitch?: Material;
169
172
 
173
+ /**
174
+ * The material that will be switched to
175
+ */
170
176
  @serializable(Material)
171
177
  variantMaterial?: Material;
172
178
 
179
+ /**
180
+ * The duration of the fade effect in seconds (USDZ/Quicklook only)
181
+ * @default 0
182
+ */
173
183
  @serializable()
174
184
  fadeDuration: number = 0;
175
185
 
src/engine/webcomponents/needle-button.ts CHANGED
@@ -139,7 +139,6 @@
139
139
  if (this.style.display?.length) {
140
140
  return;
141
141
  }
142
- console.log(this.#button.style.display);
143
142
  if (this.#button.style.display === "none") {
144
143
  this.style.display = "none";
145
144
  }
src/engine-components/Skybox.ts CHANGED
@@ -206,7 +206,7 @@
206
206
  async setSkybox(url: string | undefined | null, name?: string) {
207
207
  if (!this.activeAndEnabled) return false;
208
208
 
209
- url = tryParseMagicSkyboxName(url);
209
+ url = tryParseMagicSkyboxName(url, this.environment, this.background);
210
210
 
211
211
  if (!url) return false;
212
212
 
@@ -407,20 +407,32 @@
407
407
 
408
408
 
409
409
 
410
- function tryParseMagicSkyboxName(str: string | null | undefined): string | null {
410
+ function tryParseMagicSkyboxName(str: string | null | undefined, environment: boolean, background: boolean): string | null {
411
+
412
+ const useLowRes = environment && !background;
413
+
411
414
  switch (str?.toLowerCase()) {
412
415
  case "studio":
413
- str = "https://cdn.needle.tools/static/skybox/modelviewer-Neutral.hdr";
414
- break;
416
+ if (useLowRes) {
417
+ return "https://cdn.needle.tools/static/skybox/modelviewer-Neutral-small.hdr";
418
+ }
419
+ else return "https://cdn.needle.tools/static/skybox/modelviewer-Neutral.hdr";
420
+
415
421
  case "blurred-skybox":
416
- str = "https://cdn.needle.tools/static/skybox/blurred-skybox.exr";
417
- break;
422
+ if (useLowRes) {
423
+ return "https://cdn.needle.tools/static/skybox/blurred-skybox-small.exr";
424
+ }
425
+ return "https://cdn.needle.tools/static/skybox/blurred-skybox.exr";
418
426
  case "quicklook-ar":
419
- str = "https://cdn.needle.tools/static/skybox/QuickLook-ARMode.exr";
420
- break;
427
+ if (useLowRes) {
428
+ return "https://cdn.needle.tools/static/skybox/QuickLook-ARMode-small.exr";
429
+ }
430
+ return "https://cdn.needle.tools/static/skybox/QuickLook-ARMode.exr";
421
431
  case "quicklook":
422
- str = "https://cdn.needle.tools/static/skybox/QuickLook-ObjectMode.exr";
423
- break;
432
+ if (useLowRes) {
433
+ return "https://cdn.needle.tools/static/skybox/QuickLook-ObjectMode-small.exr";
434
+ }
435
+ return "https://cdn.needle.tools/static/skybox/QuickLook-ObjectMode.exr";
424
436
  }
425
437
  if (str === undefined) return null;
426
438
  return str;
src/engine-components/postprocessing/Volume.ts CHANGED
@@ -114,9 +114,14 @@
114
114
  this.sharedProfile?.init();
115
115
  }
116
116
 
117
+ onEnable(): void {
118
+ this._isDirty = true;
119
+ }
120
+
117
121
  /** @internal */
118
122
  onDisable() {
119
123
  this._postprocessing?.unapply();
124
+ this._isDirty = false;
120
125
  }
121
126
 
122
127
  /** @internal */