@needle-tools/engine 4.10.0-beta.3 → 4.10.0-next.4f9d92a

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 (39) hide show
  1. package/dist/{needle-engine.bundle-Ddybtee9.js → needle-engine.bundle-BeZ_xmJa.js} +6422 -6480
  2. package/dist/needle-engine.bundle-C3bpSNYu.min.js +1650 -0
  3. package/dist/{needle-engine.bundle-Ckr5KE6m.umd.cjs → needle-engine.bundle-D4dO0t5I.umd.cjs} +134 -134
  4. package/dist/needle-engine.js +14 -15
  5. package/dist/needle-engine.min.js +1 -1
  6. package/dist/needle-engine.umd.cjs +1 -1
  7. package/lib/engine/engine_lightdata.d.ts +3 -3
  8. package/lib/engine/engine_lightdata.js +10 -10
  9. package/lib/engine/engine_lightdata.js.map +1 -1
  10. package/lib/engine/engine_physics_rapier.js +0 -4
  11. package/lib/engine/engine_physics_rapier.js.map +1 -1
  12. package/lib/engine/engine_scenelighting.d.ts +1 -1
  13. package/lib/engine/engine_scenelighting.js +5 -4
  14. package/lib/engine/engine_scenelighting.js.map +1 -1
  15. package/lib/engine/engine_utils.d.ts +1 -3
  16. package/lib/engine/engine_utils.js +0 -11
  17. package/lib/engine/engine_utils.js.map +1 -1
  18. package/lib/engine/webcomponents/needle-engine.js +0 -22
  19. package/lib/engine/webcomponents/needle-engine.js.map +1 -1
  20. package/lib/engine-components/CameraUtils.js +1 -2
  21. package/lib/engine-components/CameraUtils.js.map +1 -1
  22. package/lib/engine-components/Skybox.js +4 -22
  23. package/lib/engine-components/Skybox.js.map +1 -1
  24. package/lib/engine-components/web/ScrollFollow.js +70 -80
  25. package/lib/engine-components/web/ScrollFollow.js.map +1 -1
  26. package/lib/engine-components/web/ViewBox.d.ts +1 -0
  27. package/lib/engine-components/web/ViewBox.js +27 -67
  28. package/lib/engine-components/web/ViewBox.js.map +1 -1
  29. package/package.json +2 -2
  30. package/src/engine/engine_lightdata.ts +11 -11
  31. package/src/engine/engine_physics_rapier.ts +0 -3
  32. package/src/engine/engine_scenelighting.ts +6 -5
  33. package/src/engine/engine_utils.ts +0 -12
  34. package/src/engine/webcomponents/needle-engine.ts +6 -33
  35. package/src/engine-components/CameraUtils.ts +1 -1
  36. package/src/engine-components/Skybox.ts +7 -26
  37. package/src/engine-components/web/ScrollFollow.ts +70 -82
  38. package/src/engine-components/web/ViewBox.ts +29 -71
  39. package/dist/needle-engine.bundle-CLzMgxkO.min.js +0 -1650
@@ -18,25 +18,21 @@ let ViewBox = ViewBox_1 = class ViewBox extends Behaviour {
18
18
  static instances = [];
19
19
  referenceFieldOfView = 60;
20
20
  debug = false;
21
- // awake() {
22
- // // this.referenceFieldOfView = (this.context.mainCamera as PerspectiveCamera)?.fov || 60;
23
- // setInterval(()=>{
24
- // if(Math.random() > .5)
25
- // this.enabled = !this.enabled
26
- // }, 1000)
27
- // }
21
+ awake() {
22
+ // this.referenceFieldOfView = (this.context.mainCamera as PerspectiveCamera)?.fov || 60;
23
+ // setInterval(()=>{
24
+ // this.enabled = !this.enabled
25
+ // }, 1000)
26
+ }
28
27
  onEnable() {
29
28
  if (debugParam || this.debug || isDevEnvironment())
30
29
  console.debug("[ViewBox] Using camera fov:", this.referenceFieldOfView);
31
30
  ViewBox_1.instances.push(this);
32
31
  }
33
32
  onDisable() {
34
- if (debugParam || this.debug)
35
- console.debug("[ViewBox] Disabled");
36
33
  const idx = ViewBox_1.instances.indexOf(this);
37
34
  if (idx !== -1)
38
35
  ViewBox_1.instances.splice(idx, 1);
39
- this._projectedBoxElement?.remove();
40
36
  }
41
37
  onBeforeRender() {
42
38
  if (this.context.isInXR)
@@ -81,66 +77,33 @@ let ViewBox = ViewBox_1 = class ViewBox extends Behaviour {
81
77
  diffWidth = domWidth / rectWidth;
82
78
  diffHeight = domHeight / rectHeight;
83
79
  }
80
+ // const view = camera.view;
84
81
  const view = camera.view;
85
82
  const zoom = camera.zoom;
86
83
  const aspect = camera.aspect;
87
84
  const fov = camera.fov;
88
85
  camera.view = null;
89
86
  camera.zoom = 1;
87
+ // camera.aspect = rectWidth / rectHeight;
90
88
  camera.fov = this.referenceFieldOfView;
91
89
  camera.updateProjectionMatrix();
92
90
  const boxPosition = this.gameObject.worldPosition;
93
91
  const boxScale = this.gameObject.worldScale;
94
- const cameraPosition = camera.worldPosition;
95
- const distance = cameraPosition.distanceTo(boxPosition);
96
- // #region camera fixes
97
- // If the camera is inside the box, move it out
98
- const boxSizeMax = Math.max(boxScale.x, boxScale.y, boxScale.z);
99
- const direction = getTempVector(cameraPosition).sub(boxPosition);
100
- if (distance < boxSizeMax) {
101
- // move camera out of bounds
102
- if (this.debug || debugParam)
103
- console.warn("[ViewBox] Moving camera out of bounds", distance, "<", boxSizeMax);
104
- const positionDirection = getTempVector(direction);
105
- positionDirection.y *= .00000001; // stay on horizontal plane mostly
106
- positionDirection.normalize();
107
- const lengthToMove = (boxSizeMax - distance) * 10; // move a bit more than needed
108
- const newPosition = cameraPosition.add(positionDirection.multiplyScalar(lengthToMove));
109
- camera.worldPosition = newPosition.lerp(cameraPosition, 1 - this.context.time.deltaTime);
110
- }
111
- // Ensure the camera looks at the ViewBox
112
- // TOOD: smooth lookat over multiple frames if we have multiple viewboxes
113
- // const dot = direction.normalize().dot(camera.worldForward);
114
- // if (dot < .9) {
115
- // console.log(dot);
116
- // const targetRotation = direction;
117
- // const rotation = getTempQuaternion();
118
- // rotation.setFromUnitVectors(camera.worldForward.multiplyScalar(-1), targetRotation);
119
- // camera.worldQuaternion = rotation;
120
- // camera.updateMatrixWorld();
121
- // }
122
- const boxPositionInCameraSpace = getTempVector(boxPosition);
123
- camera.worldToLocal(boxPositionInCameraSpace);
124
- camera.lookAt(boxPosition);
125
- camera.updateMatrixWorld();
126
- // #region calculate fit
92
+ // const fov = this.referenceFieldOfView
93
+ const distance = camera.worldPosition.distanceTo(boxPosition);
127
94
  const vFOV = this.referenceFieldOfView * Math.PI / 180; // convert vertical fov to radians
128
95
  const height = 2 * Math.tan(vFOV / 2) * distance; // visible height
129
96
  const width = height * camera.aspect; // visible width
130
- const projectedBox = this.projectBoxIntoCamera(boxPosition, boxScale, camera, 1);
131
- // return
97
+ const projectedBox = this.projectBoxIntoCamera(boxPosition, boxScale, camera, height * .5);
132
98
  const boxWidth = (projectedBox.maxX - projectedBox.minX);
133
99
  const boxHeight = (projectedBox.maxY - projectedBox.minY);
100
+ // TODO: take the rect size different into account
134
101
  const scale = this.fit(boxWidth * camera.aspect, boxHeight, width / diffWidth, height / diffHeight);
135
- // console.log({ scale, width, height, boxWidth: boxWidth * camera.aspect, boxHeight, diffWidth, diffHeight, aspect: camera.aspect, distance })
136
- // this.context.focusRectSettings.zoom = 1.39;
137
- // if (!this.context.focusRect) this.context.setCameraFocusRect(this.context.domElement);
138
- // return
139
102
  const vec = getTempVector(boxPosition);
140
103
  vec.project(camera);
141
104
  this.context.focusRectSettings.offsetX = vec.x;
142
105
  this.context.focusRectSettings.offsetY = vec.y;
143
- this.context.focusRectSettings.zoom = scale / (height * .5);
106
+ this.context.focusRectSettings.zoom = scale;
144
107
  // if we don't have a focus rect yet, set it to the dom element
145
108
  if (!this.context.focusRect)
146
109
  this.context.setCameraFocusRect(this.context.domElement);
@@ -165,8 +128,8 @@ let ViewBox = ViewBox_1 = class ViewBox extends Behaviour {
165
128
  const scaleY = height2 / height1;
166
129
  return Math.min(scaleX, scaleY);
167
130
  }
168
- projectBoxIntoCamera(position, scale, camera, _factor) {
169
- const factor = .5 * _factor;
131
+ projectBoxIntoCamera(position, scale, camera, diff) {
132
+ const factor = .5 * diff;
170
133
  const corners = [
171
134
  getTempVector(-scale.x * factor, -scale.y * factor, -scale.z * factor),
172
135
  getTempVector(scale.x * factor, -scale.y * factor, -scale.z * factor),
@@ -194,21 +157,18 @@ let ViewBox = ViewBox_1 = class ViewBox extends Behaviour {
194
157
  if (c.y > maxY)
195
158
  maxY = c.y;
196
159
  }
197
- if (debugParam) {
198
- if (!this._projectedBoxElement) {
199
- this._projectedBoxElement = document.createElement("div");
200
- }
201
- if (this._projectedBoxElement.parentElement !== this.context.domElement)
202
- this.context.domElement.appendChild(this._projectedBoxElement);
203
- this._projectedBoxElement.style.position = "fixed";
204
- this._projectedBoxElement.style.outline = "5px dotted red";
205
- this._projectedBoxElement.style.left = ((minX * .5 + .5) * this.context.domWidth) + "px";
206
- this._projectedBoxElement.style.top = ((-maxY * .5 + .5) * this.context.domHeight) + "px";
207
- this._projectedBoxElement.style.width = ((maxX - minX) * .5 * this.context.domWidth) + "px";
208
- this._projectedBoxElement.style.height = ((maxY - minY) * .5 * this.context.domHeight) + "px";
209
- this._projectedBoxElement.style.pointerEvents = "none";
210
- this._projectedBoxElement.style.zIndex = "1000";
211
- }
160
+ // if(!this._projectedBoxElement) {
161
+ // this._projectedBoxElement = document.createElement("div");
162
+ // this.context.domElement.appendChild(this._projectedBoxElement);
163
+ // }
164
+ // this._projectedBoxElement.style.position = "fixed";
165
+ // this._projectedBoxElement.style.outline = "10px solid red";
166
+ // this._projectedBoxElement.style.left = ((minX * .5 + .5) * this.context.domWidth) + "px";
167
+ // this._projectedBoxElement.style.top = ((-maxY * .5 + .5) * this.context.domHeight) + "px";
168
+ // this._projectedBoxElement.style.width = ((maxX - minX) * .5 * this.context.domWidth) + "px";
169
+ // this._projectedBoxElement.style.height = ((maxY - minY) * .5 * this.context.domHeight) + "px";
170
+ // this._projectedBoxElement.style.pointerEvents = "none";
171
+ // this._projectedBoxElement.style.zIndex = "1000";
212
172
  return { minX, maxX, minY, maxY };
213
173
  }
214
174
  _projectedBoxElement = null;
@@ -1 +1 @@
1
- {"version":3,"file":"ViewBox.js","sourceRoot":"","sources":["../../../src/engine-components/web/ViewBox.ts"],"names":[],"mappings":";;;;;;;AAAA,OAAO,EAAU,iBAAiB,EAAoB,MAAM,OAAO,CAAC;AAEpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,MAAM,EAAE,MAAM,+BAA+B,CAAC;AACvD,OA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AC,CAAC;YAC3B,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI;gBAAE,IAAI,GAAG,CAAC,CAAC,CAAC,CAAC;YAC3B,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI;gBAAE,IAAI,GAAG,CAAC,CAAC,CAAC,CAAC;YAC3B,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI;gBAAE,IAAI,GAAG,CAAC,CAAC,CAAC,CAAC;SAC9B;QAED,mCAAmC;QACnC,iEAAiE;QACjE,kEAAkE;QAClE,IAAI;QACJ,sDAAsD;QACtD,8DAA8D;QAC9D,4FAA4F;QAC5F,6FAA6F;QAC7F,+FAA+F;QAC/F,iGAAiG;QACjG,0DAA0D;QAC1D,mDAAmD;QAGnD,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;IAEtC,CAAC;IACO,oBAAoB,GAAuB,IAAI,CAAC;;AAlLxD;IADC,YAAY,EAAE;qDACmB;AAGlC;IADC,YAAY,EAAE;sCACQ;AARd,OAAO;IADnB,YAAY;GACA,OAAO,CA4LnB;SA5LY,OAAO"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@needle-tools/engine",
3
- "version": "4.10.0-beta.3",
3
+ "version": "4.10.0-next.4f9d92a",
4
4
  "description": "Needle Engine is a web-based runtime for 3D apps. It runs on your machine for development with great integrations into editors like Unity or Blender - and can be deployed onto any device! It is flexible, extensible and networking and XR are built-in.",
5
5
  "main": "dist/needle-engine.min.js",
6
6
  "exports": {
@@ -168,4 +168,4 @@
168
168
  "module": "lib/needle-engine.js",
169
169
  "typings": "lib/needle-engine.d.ts",
170
170
  "types": "lib/needle-engine.d.ts"
171
- }
171
+ }
@@ -1,7 +1,7 @@
1
1
  import { ShaderChunk, Texture, UniformsLib, Vector4 } from "three";
2
2
 
3
3
  import { setDisposable } from "./engine_assetdatabase.js";
4
- import type { Context } from "./engine_setup.js";
4
+ import { Context } from "./engine_setup.js";
5
5
  import type { SourceIdentifier } from "./engine_types.js";
6
6
  import { getParam } from "./engine_utils.js";
7
7
  import { LightmapType } from "./extensions/NEEDLE_lightmaps.js";
@@ -27,22 +27,22 @@ export interface ILightDataRegistry {
27
27
 
28
28
  export class LightDataRegistry implements ILightDataRegistry {
29
29
 
30
- private readonly context: Context;
31
- private readonly map: Map<SourceIdentifier, Map<LightmapType, Texture[]>> = new Map();
30
+ private _context: Context;
31
+ private _lightmaps: Map<SourceIdentifier, Map<LightmapType, Texture[]>> = new Map();
32
32
 
33
33
  clear() {
34
- this.map.clear();
34
+ this._lightmaps.clear();
35
35
  }
36
36
 
37
37
  constructor(context: Context) {
38
- this.context = context;
38
+ this._context = context;
39
39
  }
40
40
 
41
41
  registerTexture(sourceId: SourceIdentifier, type: LightmapType, tex: Texture, index: number) {
42
42
  if (debugLightmap) console.log("Registering ", LightmapType[type] + " \"" + sourceId + "\"", tex);
43
- if (!this.map.has(sourceId))
44
- this.map.set(sourceId, new Map());
45
- const map = this.map.get(sourceId);
43
+ if (!this._lightmaps.has(sourceId))
44
+ this._lightmaps.set(sourceId, new Map());
45
+ const map = this._lightmaps.get(sourceId);
46
46
  const arr = map?.get(type) ?? [];
47
47
  if (arr.length < index) arr.length = index + 1;
48
48
  setDisposable(tex, false);
@@ -55,12 +55,12 @@ export class LightDataRegistry implements ILightDataRegistry {
55
55
  }
56
56
 
57
57
  tryGetSkybox(sourceId?: SourceIdentifier | null): Texture | null {
58
- if (debugLightmap) console.log("[Get Skybox]", sourceId, this.map)
58
+ if (debugLightmap) console.log("[Get Skybox]", sourceId, this._lightmaps)
59
59
  return this.tryGet(sourceId, LightmapType.Skybox, 0);
60
60
  }
61
61
 
62
62
  tryGetReflection(sourceId?: SourceIdentifier | null): Texture | null {
63
- if (debugLightmap) console.log("[Get Reflection]", sourceId, this.map)
63
+ if (debugLightmap) console.log("[Get Reflection]", sourceId, this._lightmaps)
64
64
  return this.tryGet(sourceId, LightmapType.Reflection, 0);
65
65
  }
66
66
 
@@ -69,7 +69,7 @@ export class LightDataRegistry implements ILightDataRegistry {
69
69
  if (debugLightmap) console.warn("Missing source id");
70
70
  return null;
71
71
  }
72
- const entry = this.map.get(sourceId);
72
+ const entry = this._lightmaps.get(sourceId);
73
73
  if (!entry) {
74
74
  if (debugLightmap) console.warn(`[Lighting] No ${LightmapType[type]} texture entry for`, sourceId);
75
75
  return null;
@@ -67,7 +67,6 @@ export class RapierPhysics implements IPhysicsEngine {
67
67
  debugRenderRaycasts: boolean = false;
68
68
 
69
69
  removeBody(obj: IComponent) {
70
- if(debugPhysics) console.log("REMOVE BODY", obj?.name, obj[$bodyKey]);
71
70
  if (!obj) return;
72
71
  this.validate();
73
72
  const body = obj[$bodyKey];
@@ -902,8 +901,6 @@ export class RapierPhysics implements IPhysicsEngine {
902
901
  // set the collider layers
903
902
  this.updateColliderCollisionGroups(collider);
904
903
 
905
- if (debugPhysics) console.log("Created collider", collider.name, col);
906
-
907
904
  return col;
908
905
  }
909
906
  catch (e) {
@@ -162,7 +162,7 @@ export class RendererData {
162
162
  private __currentReflectionId: SourceIdentifier | null = null;
163
163
 
164
164
  /** @internal */
165
- internalEnableReflection(sourceId: SourceIdentifier) : Texture | null {
165
+ internalEnableReflection(sourceId: SourceIdentifier) {
166
166
  this.__currentReflectionId = sourceId;
167
167
  const settings = this._sceneLightSettings?.get(sourceId);
168
168
 
@@ -181,7 +181,7 @@ export class RendererData {
181
181
  const tex = existing.Source;
182
182
  tex.mapping = EquirectangularReflectionMapping;
183
183
  scene.environment = tex;
184
- return tex;
184
+ return;
185
185
  }
186
186
  else if (debug) console.warn("Could not find reflection for source", sourceId);
187
187
  break;
@@ -196,21 +196,22 @@ export class RendererData {
196
196
  tex.colorSpace = SRGBColorSpace;
197
197
  tex.mapping = EquirectangularReflectionMapping;
198
198
  this.context.scene.environment = tex;
199
- return tex;
200
199
  }
201
200
  else console.error("Missing ambient trilight", settings.sourceId);
201
+ return;
202
202
  case AmbientMode.Flat:
203
203
  if (settings.ambientLight) {
204
204
  const tex = createFlatTexture(settings.ambientLight, 64);
205
205
  tex.colorSpace = SRGBColorSpace;
206
206
  tex.mapping = EquirectangularReflectionMapping;
207
207
  this.context.scene.environment = tex;
208
- return tex;
209
208
  }
210
209
  else console.error("Missing ambientlight", settings.sourceId);
210
+ return;
211
+ default:
212
+ return;
211
213
  }
212
214
  }
213
- return null;
214
215
  }
215
216
 
216
217
  /** @internal */
@@ -381,14 +381,6 @@ export function resolveUrl(source: SourceIdentifier | undefined, uri: string): s
381
381
  }
382
382
  return uri;
383
383
  }
384
-
385
- export function toSourceId(src: string | null): SourceIdentifier | undefined {
386
- if (!src) return undefined;
387
- src = src.trim();
388
- src = src.split("?")[0]?.split("#")[0];
389
- return src;
390
- }
391
-
392
384
  // export function getPath(glbLocation: SourceIdentifier | undefined, path: string) {
393
385
  // if (path && glbLocation && !path.includes("/")) {
394
386
  // // get directory of glb and prepend it to the audio file path
@@ -801,7 +793,6 @@ const mutationObserverMap = new WeakMap<HTMLElement, HtmlElementExtra>();
801
793
  /**
802
794
  * Register a callback when an {@link HTMLElement} attribute changes.
803
795
  * This is used, for example, by the Skybox component to watch for changes to the environment-* and skybox-* attributes.
804
- * @returns A function that can be used to unregister the callback
805
796
  */
806
797
  export function addAttributeChangeCallback(domElement: HTMLElement, name: string, callback: AttributeChangeCallback) {
807
798
  if (!mutationObserverMap.get(domElement)) {
@@ -820,9 +811,6 @@ export function addAttributeChangeCallback(domElement: HTMLElement, name: string
820
811
  listeners.set(name, []);
821
812
  }
822
813
  listeners.get(name)!.push(callback);
823
- return () => {
824
- removeAttributeChangeCallback(domElement, name, callback);
825
- }
826
814
  };
827
815
 
828
816
  /**
@@ -38,18 +38,14 @@ const observedAttributes = [
38
38
  "loadstart",
39
39
  "progress",
40
40
  "loadfinished",
41
-
42
41
  "dracoDecoderPath",
43
42
  "dracoDecoderType",
44
43
  "ktx2DecoderPath",
45
-
46
44
  "tone-mapping",
47
45
  "tone-mapping-exposure",
48
46
  "background-blurriness",
49
47
  "background-color",
50
48
  "environment-intensity",
51
-
52
- "focus-rect",
53
49
  ]
54
50
 
55
51
  // https://developers.google.com/web/fundamentals/web-components/customelements
@@ -99,7 +95,7 @@ export class NeedleEngineWebComponent extends HTMLElement implements INeedleEngi
99
95
  if (value === null) this.removeAttribute("camera-controls");
100
96
  else this.setAttribute("camera-controls", value ? "true" : "false");
101
97
  }
102
-
98
+
103
99
 
104
100
  /**
105
101
  * Get the current context for this web component instance. The context is created when the src attribute is set and the loading has finished.
@@ -335,17 +331,17 @@ export class NeedleEngineWebComponent extends HTMLElement implements INeedleEngi
335
331
  if (debug) console.log("ktx2DecoderPath", newValue);
336
332
  setKtx2TranscoderPath(newValue);
337
333
  break;
338
-
334
+
339
335
  case "tonemapping":
340
336
  case "tone-mapping":
341
337
  case "tone-mapping-exposure":
342
338
  case "background-blurriness":
343
339
  case "background-color":
344
340
  case "environment-intensity":
345
- {
346
- this.applyAttributes();
347
- break;
348
- }
341
+ {
342
+ this.applyAttributes();
343
+ break;
344
+ }
349
345
  case "public-key": {
350
346
  if (newValue != PUBLIC_KEY)
351
347
  this.setPublicKey();
@@ -356,25 +352,6 @@ export class NeedleEngineWebComponent extends HTMLElement implements INeedleEngi
356
352
  this.setVersion();
357
353
  break;
358
354
  }
359
-
360
- case "focus-rect":
361
- {
362
- const focus_rect = this.getAttribute("focus-rect") as HTMLElement | string | null;
363
- if (focus_rect && this._context) {
364
- if (focus_rect === null) {
365
- this._context.setCameraFocusRect(null);
366
- }
367
- else if (typeof focus_rect === "string" && focus_rect.length > 0) {
368
- const element = document.querySelector(focus_rect);
369
- this._context.setCameraFocusRect(element instanceof HTMLElement ? element : null);
370
- }
371
- else if (focus_rect instanceof HTMLElement) {
372
- this._context.setCameraFocusRect(focus_rect);
373
- }
374
-
375
- }
376
- }
377
- break;
378
355
  }
379
356
  }
380
357
 
@@ -593,10 +570,6 @@ export class NeedleEngineWebComponent extends HTMLElement implements INeedleEngi
593
570
  this._context.renderer.setClearColor(rgbaColor, rgbaColor.alpha);
594
571
  this.context.scene.background = null;
595
572
  }
596
- // HACK: if we set background-color to a color and then back to null we want the background-image attribute to re-apply
597
- else if (this.getAttribute("background-image")) {
598
- this.setAttribute("background-image", this.getAttribute("background-image")!);
599
- }
600
573
  }
601
574
  }
602
575
 
@@ -122,7 +122,7 @@ function createDefaultCameraControls(context: IContext, cam?: ICamera) {
122
122
  orbit.autoRotate = autoRotate != "0" && autoRotate?.toLowerCase() != "false";
123
123
  const autoRotateSpeed = Number.parseFloat(autoRotate || ".5");
124
124
  orbit.autoRotateSpeed = !isNaN(autoRotateSpeed) ? autoRotateSpeed : .5;
125
- if(debug) console.log("Auto-rotate", orbit.autoRotate, "speed:", orbit.autoRotateSpeed);
125
+ console.log("Auto-rotate", orbit.autoRotate, "speed:", orbit.autoRotateSpeed);
126
126
  const autoFit = context.domElement.getAttribute("auto-fit");
127
127
  orbit.autoFit = autoFit !== "0" && autoFit?.toLowerCase() != "false";
128
128
  orbit.autoTarget = true;
@@ -8,7 +8,7 @@ import { syncField } from "../engine/engine_networking_auto.js";
8
8
  import { loadPMREM } from "../engine/engine_pmrem.js";
9
9
  import { serializable } from "../engine/engine_serialization_decorator.js";
10
10
  import { type IContext } from "../engine/engine_types.js";
11
- import { addAttributeChangeCallback, getParam, PromiseAllWithErrors, removeAttributeChangeCallback, toSourceId } from "../engine/engine_utils.js";
11
+ import { addAttributeChangeCallback, getParam, PromiseAllWithErrors, removeAttributeChangeCallback } from "../engine/engine_utils.js";
12
12
  import { registerObservableAttribute } from "../engine/webcomponents/needle-engine.extras.js";
13
13
  import { Camera, ClearFlags } from "./Camera.js";
14
14
  import { Behaviour, GameObject } from "./Component.js";
@@ -27,34 +27,15 @@ function createRemoteSkyboxComponent(context: IContext, url: string, skybox: boo
27
27
  }
28
28
 
29
29
  const remote = new RemoteSkybox();
30
- remote.sourceId = toSourceId(url);
31
30
  remote.allowDrop = false;
32
31
  remote.allowNetworking = false;
33
32
  remote.background = skybox;
34
33
  remote.environment = environment;
35
34
  GameObject.addComponent(context.scene, remote);
36
35
  const urlChanged = newValue => {
37
- if (debug) console.log(attribute, "CHANGED TO", newValue);
38
- if (newValue) {
39
- if (typeof newValue !== "string") {
40
- console.warn("Invalid attribute value for " + attribute);
41
- return;
42
- }
43
- remote.setSkybox(newValue);
44
- }
45
- else {
46
- if (remote.sourceId) {
47
- if (environment) {
48
- if (!context.sceneLighting.internalEnableReflection(remote.sourceId)) {
49
- context.scene.environment = null;
50
- }
51
- }
52
- if (skybox) {
53
- const skybox = context.lightmaps.tryGetSkybox(remote.sourceId);
54
- context.scene.background = skybox;
55
- }
56
- }
57
- }
36
+ if (typeof newValue !== "string") return;
37
+ if (debug) console.log(attribute, "CHANGED TO", newValue)
38
+ remote.setSkybox(newValue);
58
39
  };
59
40
  addAttributeChangeCallback(context.domElement, attribute, urlChanged);
60
41
  remote.addEventListener("destroy", () => {
@@ -69,7 +50,7 @@ ContextRegistry.registerCallback(ContextEvent.ContextCreationStart, (args) => {
69
50
  const context = args.context;
70
51
  const backgroundImage = context.domElement.getAttribute("background-image");
71
52
  const environmentImage = context.domElement.getAttribute("environment-image");
72
-
53
+
73
54
  if (backgroundImage) {
74
55
  if (debug) console.log("Creating RemoteSkybox to load background " + backgroundImage);
75
56
  // if the user is loading a GLB without a camera then the CameraUtils (which creates the default camera)
@@ -265,8 +246,8 @@ export class RemoteSkybox extends Behaviour {
265
246
  envMap.needsUpdate = true;
266
247
  }
267
248
 
268
- if (this.destroyed) return;
269
- if (!this.context) {
249
+ if(this.destroyed) return;
250
+ if(!this.context) {
270
251
  console.warn("RemoteSkybox: Context is not available - can not apply skybox.");
271
252
  return;
272
253
  }