@needle-tools/engine 3.16.2-beta → 3.16.3

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.
@@ -8,6 +8,7 @@ import { getCameraController } from "../engine/engine_camera.js";
8
8
  import { Camera } from "./Camera.js";
9
9
  import { NeedleEngineHTMLElement } from "../engine/engine_element.js";
10
10
  import { getParam } from "../engine/engine_utils.js";
11
+ import { Context } from "../engine/engine_context.js";
11
12
 
12
13
  const debug = getParam("debugmissingcamera");
13
14
 
@@ -21,20 +22,23 @@ ContextRegistry.registerCallback(ContextEvent.MissingCamera, (evt) => {
21
22
 
22
23
  const camInstance = new Camera();
23
24
  camInstance.sourceId = evt.files?.[0]?.src ?? "unknown"
24
- // Set the clearFlags to a skybox
25
- camInstance.clearFlags = 1;
25
+ // Set the clearFlags to a skybox if we have one
26
+ if((evt.context as Context).lightmaps.tryGetSkybox(camInstance.sourceId))
27
+ camInstance.clearFlags = 1;
28
+ else
29
+ // TODO provide a nice default skybox
30
+ camInstance.clearFlags = 2;
26
31
  camInstance.backgroundColor = new RGBAColor(0.5, 0.5, 0.5, 1);
27
32
  camInstance.fieldOfView = 35;
28
33
  // TODO: can we store the backgroundBlurriness in the gltf file somewhere except inside the camera?
29
34
  // e.g. when we export a scene from blender without a camera in the scene
30
- camInstance.backgroundBlurriness = .125; // same as in blender 0.5
35
+ camInstance.backgroundBlurriness = .2; // same as in blender 0.5
31
36
  const cam = addNewComponent(cameraObject, camInstance, true) as ICamera;
32
37
 
33
38
  cameraObject.position.x = 0;
34
39
  cameraObject.position.y = 1;
35
40
  cameraObject.position.z = 2;
36
41
 
37
-
38
42
  createDefaultCameraControls(evt.context, cam);
39
43
 
40
44
  return cam;
@@ -94,23 +94,19 @@ export class RectTransform extends BaseUIComponent implements IRectTransform, IR
94
94
  }
95
95
 
96
96
  // private lastMatrixWorld!: Matrix4;
97
- private lastMatrix: Matrix4;
98
- private rectBlock: Object3D;
97
+ private lastMatrix!: Matrix4;
98
+ private rectBlock!: Object3D;
99
99
  private _transformNeedsUpdate: boolean = false;
100
100
  private _initialPosition!: Vector3;
101
101
 
102
- constructor() {
103
- super();
104
- this.lastMatrix = new Matrix4();
105
- this.rectBlock = new Object3D();
106
- }
107
-
108
102
  awake() {
109
103
  super.awake();
110
104
  // this is required if an animator animated the transform anchoring
111
105
  if (!this._anchoredPosition)
112
106
  this._anchoredPosition = new Vector2();
113
107
 
108
+ this.lastMatrix = new Matrix4();
109
+ this.rectBlock = new Object3D();
114
110
  this.rectBlock.name = this.name;
115
111
 
116
112
  // TODO: get rid of the initial position