@needle-tools/engine 4.5.8 → 4.6.0-next.3088402

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.
Files changed (58) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/dist/{gltf-progressive-Bx_ZJgfQ.min.js → gltf-progressive-Bm9eEfgu.min.js} +1 -1
  3. package/dist/{gltf-progressive-Ccf3INjK.umd.cjs → gltf-progressive-Dn6o99rH.umd.cjs} +1 -1
  4. package/dist/{gltf-progressive-D8GP6sjZ.js → gltf-progressive-GjIqwSG3.js} +2 -2
  5. package/dist/{needle-engine.bundle-A-KGqR38.js → needle-engine.bundle-B1JFnMRs.js} +4046 -4029
  6. package/dist/{needle-engine.bundle-DsPSVnUc.min.js → needle-engine.bundle-CLbeONlI.min.js} +123 -123
  7. package/dist/{needle-engine.bundle-2--i65ba.umd.cjs → needle-engine.bundle-CpQAQ_2N.umd.cjs} +126 -126
  8. package/dist/needle-engine.js +4 -4
  9. package/dist/needle-engine.min.js +1 -1
  10. package/dist/needle-engine.umd.cjs +1 -1
  11. package/dist/{postprocessing-CLwnKusi.umd.cjs → postprocessing-CRQa6Qxn.umd.cjs} +177 -97
  12. package/dist/{postprocessing-DS5I4Iim.js → postprocessing-D6W1EyZ-.js} +1095 -1001
  13. package/dist/{postprocessing-CdIScgB8.min.js → postprocessing-DF8AlRgW.min.js} +178 -98
  14. package/dist/{three-CFtLGNtV.min.js → three-Boa-jOq-.min.js} +18 -18
  15. package/dist/{three-1JG7vpNC.js → three-Bz6X1mrw.js} +0 -1
  16. package/dist/{three-f-JuZtOs.umd.cjs → three-DMrv-4ar.umd.cjs} +20 -20
  17. package/dist/{three-examples-BeoqFh8m.umd.cjs → three-examples-C7ryg8vN.umd.cjs} +1 -1
  18. package/dist/{three-examples-CPlN41GO.min.js → three-examples-DuVhxqft.min.js} +1 -1
  19. package/dist/{three-examples-CyWe9wwo.js → three-examples-GggCDHv0.js} +1 -1
  20. package/dist/{three-mesh-ui-B18kdQmk.js → three-mesh-ui-CLNOfsWn.js} +1 -1
  21. package/dist/{three-mesh-ui-BMeLuYD5.min.js → three-mesh-ui-CY6Izc7C.min.js} +1 -1
  22. package/dist/{three-mesh-ui-DMdtSVhY.umd.cjs → three-mesh-ui-CwlN0FUC.umd.cjs} +1 -1
  23. package/dist/{vendor-BbM-oI6p.js → vendor-BSD1RQIh.js} +1 -1
  24. package/dist/{vendor-CJFfVMoq.umd.cjs → vendor-DHr4aqIZ.umd.cjs} +1 -1
  25. package/dist/{vendor-CTtGKiDe.min.js → vendor-zxXa3Dmr.min.js} +1 -1
  26. package/lib/engine/engine_assetdatabase.js +3 -1
  27. package/lib/engine/engine_assetdatabase.js.map +1 -1
  28. package/lib/engine/engine_context.d.ts +2 -2
  29. package/lib/engine/engine_context.js +11 -10
  30. package/lib/engine/engine_context.js.map +1 -1
  31. package/lib/engine/engine_utils.js +1 -1
  32. package/lib/engine/engine_utils.js.map +1 -1
  33. package/lib/engine-components/AudioSource.d.ts +1 -1
  34. package/lib/engine-components/AudioSource.js +5 -4
  35. package/lib/engine-components/AudioSource.js.map +1 -1
  36. package/lib/engine-components/ReflectionProbe.d.ts +2 -1
  37. package/lib/engine-components/ReflectionProbe.js +4 -1
  38. package/lib/engine-components/ReflectionProbe.js.map +1 -1
  39. package/lib/engine-components/Renderer.js +9 -5
  40. package/lib/engine-components/Renderer.js.map +1 -1
  41. package/lib/engine-components/Skybox.d.ts +7 -1
  42. package/lib/engine-components/Skybox.js +30 -9
  43. package/lib/engine-components/Skybox.js.map +1 -1
  44. package/lib/engine-components/postprocessing/Effects/Tonemapping.js +10 -6
  45. package/lib/engine-components/postprocessing/Effects/Tonemapping.js.map +1 -1
  46. package/package.json +2 -2
  47. package/plugins/types/userconfig.d.ts +1 -1
  48. package/plugins/vite/asap.js +26 -20
  49. package/plugins/vite/dependency-watcher.js +8 -2
  50. package/plugins/vite/local-files.js +268 -59
  51. package/src/engine/engine_assetdatabase.ts +3 -1
  52. package/src/engine/engine_context.ts +14 -11
  53. package/src/engine/engine_utils.ts +1 -1
  54. package/src/engine-components/AudioSource.ts +5 -5
  55. package/src/engine-components/ReflectionProbe.ts +5 -1
  56. package/src/engine-components/Renderer.ts +10 -7
  57. package/src/engine-components/Skybox.ts +30 -10
  58. package/src/engine-components/postprocessing/Effects/Tonemapping.ts +9 -7
@@ -124,11 +124,17 @@ function registerLoadedTexture(src: string, texture: Promise<Texture>) {
124
124
  * evt.detail.apply(url);
125
125
  * });
126
126
  * ```
127
+ *
128
+ * @example update skybox url
129
+ * ```ts
130
+ * skybox.setSkybox("https://example.com/skybox.hdr");
131
+ * ```
127
132
  */
128
133
  export class RemoteSkybox extends Behaviour {
129
134
 
130
135
  /**
131
- * URL to a remote skybox. This value can also use a magic skybox name. Options are "quicklook", "quicklook-ar", "studio", "blurred-skybox".
136
+ * URL to a remote skybox. This value can also use a magic skybox name. Options are "quicklook", "quicklook-ar", "studio", "blurred-skybox".
137
+ * To update the skybox/environment map use `setSkybox(url)`
132
138
  * @example
133
139
  * ```ts
134
140
  * skybox.url = "https://example.com/skybox.hdr";
@@ -197,6 +203,9 @@ export class RemoteSkybox extends Behaviour {
197
203
  if (this.isRemoteTexture(this.url)) {
198
204
  this.setSkybox(this.url);
199
205
  }
206
+ else if (debug) {
207
+ console.warn(`RemoteSkybox: Not setting skybox: ${this.url} is not a remote texture. If you want to set a local texture, set allowNetworking to false.`);
208
+ }
200
209
  }
201
210
  }
202
211
 
@@ -222,7 +231,7 @@ export class RemoteSkybox extends Behaviour {
222
231
  if (debug) console.log("Set remote skybox url: " + url);
223
232
 
224
233
  if (this._prevUrl === url && this._prevLoadedEnvironment) {
225
- this.applySkybox();
234
+ this.apply();
226
235
  return true;
227
236
  }
228
237
  else {
@@ -231,19 +240,30 @@ export class RemoteSkybox extends Behaviour {
231
240
  }
232
241
  this._prevUrl = url;
233
242
 
234
- const envMap = await this.loadTexture(url, name);
235
- if (!envMap) return false;
243
+ const texture = await this.loadTexture(url, name);
244
+ if (!texture) {
245
+ if (debug) console.warn("RemoteSkybox: Failed to load texture from url", url);
246
+ return false;
247
+ }
236
248
  // Check if we're still enabled
237
- if (!this.enabled) return false;
249
+ if (!this.enabled) {
250
+ if (debug) console.warn("RemoteSkybox: Component is not enabled, aborting setSkybox");
251
+ return false;
252
+ }
253
+ // Check if the url has changed while loading
254
+ if (this._prevUrl !== url) {
255
+ if (debug) console.warn("RemoteSkybox: URL changed while loading texture, aborting setSkybox");
256
+ return false; // URL changed while loading
257
+ }
238
258
  // Update the current url
239
259
  this.url = url;
240
260
  const nameIndex = url.lastIndexOf("/");
241
- envMap.name = url.substring(nameIndex >= 0 ? nameIndex + 1 : 0);
261
+ texture.name = url.substring(nameIndex >= 0 ? nameIndex + 1 : 0);
242
262
  if (this._loader instanceof TextureLoader) {
243
- envMap.colorSpace = SRGBColorSpace;
263
+ texture.colorSpace = SRGBColorSpace;
244
264
  }
245
- this._prevLoadedEnvironment = envMap;
246
- this.applySkybox();
265
+ this._prevLoadedEnvironment = texture;
266
+ this.apply();
247
267
  return true;
248
268
  }
249
269
 
@@ -284,7 +304,7 @@ export class RemoteSkybox extends Behaviour {
284
304
  return envMap;
285
305
  }
286
306
 
287
- private applySkybox() {
307
+ private apply() {
288
308
  const envMap = this._prevLoadedEnvironment;
289
309
  if (!envMap) return;
290
310
 
@@ -1,5 +1,5 @@
1
1
  import type { ToneMappingEffect as _TonemappingEffect, ToneMappingMode } from "postprocessing";
2
- import { ACESFilmicToneMapping, AgXToneMapping, LinearToneMapping, NeutralToneMapping, NoToneMapping, ReinhardToneMapping } from "three";
2
+ import { ACESFilmicToneMapping, AgXToneMapping, LinearToneMapping, NeutralToneMapping, NoToneMapping, ReinhardToneMapping, WebGLRenderer } from "three";
3
3
 
4
4
  import { MODULES } from "../../../engine/engine_modules.js";
5
5
  import { serializable } from "../../../engine/engine_serialization.js";
@@ -36,6 +36,7 @@ function toThreeToneMapping(mode: NEToneMappingMode | undefined) {
36
36
  case NEToneMappingMode.KhronosNeutral:
37
37
  return NeutralToneMapping;
38
38
  default:
39
+ if(debug) console.warn("[Postprocessing] Unknown tone mapping mode", mode);
39
40
  return NeutralToneMapping;
40
41
  }
41
42
  }
@@ -84,7 +85,7 @@ export class ToneMappingEffect extends PostProcessingEffect {
84
85
  setMode(mode: NEToneMappingModeNames) {
85
86
  const enumValue = NEToneMappingMode[mode as NEToneMappingModeNames];
86
87
  if (enumValue === undefined) {
87
- console.error("Invalid ToneMapping mode", mode);
88
+ console.error("[PostProcessing] Invalid ToneMapping mode", mode);
88
89
  return this;
89
90
  }
90
91
  this.mode.value = enumValue;
@@ -110,7 +111,7 @@ export class ToneMappingEffect extends PostProcessingEffect {
110
111
  if (other === this) break;
111
112
  // If another tonemapping effect is found, warn the user
112
113
  if (other != this && other instanceof ToneMappingEffect) {
113
- console.warn("Multiple tonemapping effects found in the same postprocessing stack: Please check your scene setup.", { activeEffect: other, ignoredEffect: this });
114
+ console.warn("[PostProcessing] Multiple tonemapping effects found in the same postprocessing stack: Please check your scene setup.", { activeEffect: other, ignoredEffect: this });
114
115
  return undefined;
115
116
  }
116
117
  }
@@ -119,8 +120,9 @@ export class ToneMappingEffect extends PostProcessingEffect {
119
120
 
120
121
  // ensure the effect tonemapping value is initialized
121
122
  if (this.mode.isInitialized == false) {
122
- const init = threeToNeToneMapping(this.context.renderer.toneMapping);
123
- this.mode.initialize(init);
123
+ const mode = threeToNeToneMapping(this.context.renderer.toneMapping);
124
+ if(debug) console.log("[PostProcessing] Initializing ToneMapping mode to renderer.toneMapping", this.context.renderer.toneMapping + " → " + mode);
125
+ this.mode.initialize(mode);
124
126
  }
125
127
 
126
128
  const threeMode = toThreeToneMapping(this.mode.value);
@@ -130,9 +132,9 @@ export class ToneMappingEffect extends PostProcessingEffect {
130
132
  this.mode.onValueChanged = (newValue) => {
131
133
  const threeMode = toThreeToneMapping(newValue);
132
134
  tonemapping.mode = threeToneMappingToEffectMode(threeMode);
133
- if (debug) console.log("ToneMapping mode changed to", NEToneMappingMode[newValue], threeMode, tonemapping.mode);
135
+ if (debug) console.log("[PostProcessing] ToneMapping mode changed to", NEToneMappingMode[newValue], threeMode, tonemapping.mode);
134
136
  };
135
- if (debug) console.log("Use ToneMapping", NEToneMappingMode[this.mode.value], threeMode, tonemapping.mode, "renderer.tonemapping: " + this.context.renderer.toneMapping);
137
+ if (debug) console.log("[PostProcessing] Use ToneMapping", NEToneMappingMode[this.mode.value], threeMode, tonemapping.mode, "renderer.tonemapping: " + this.context.renderer.toneMapping);
136
138
 
137
139
 
138
140
  this.exposure.onValueChanged = (newValue) => {