@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.
- package/CHANGELOG.md +10 -0
- package/dist/needle-engine.js +2290 -2208
- package/dist/needle-engine.light.js +3367 -3285
- package/dist/needle-engine.light.min.js +177 -159
- package/dist/needle-engine.light.umd.cjs +115 -97
- package/dist/needle-engine.min.js +164 -146
- package/dist/needle-engine.umd.cjs +116 -98
- package/lib/engine/engine_license.js +27 -6
- package/lib/engine/engine_license.js.map +1 -1
- package/lib/engine/engine_loaders.js +5 -2
- package/lib/engine/engine_loaders.js.map +1 -1
- package/lib/engine/engine_physics_rapier.js +7 -1
- package/lib/engine/engine_physics_rapier.js.map +1 -1
- package/lib/engine-components/CameraUtils.js +7 -3
- package/lib/engine-components/CameraUtils.js.map +1 -1
- package/lib/engine-components/ui/RectTransform.d.ts +0 -1
- package/lib/engine-components/ui/RectTransform.js +2 -5
- package/lib/engine-components/ui/RectTransform.js.map +1 -1
- package/package.json +1 -1
- package/src/engine/engine_license.ts +28 -6
- package/src/engine/engine_loaders.ts +8 -4
- package/src/engine/engine_physics_rapier.ts +8 -1
- package/src/engine-components/CameraUtils.ts +8 -4
- package/src/engine-components/ui/RectTransform.ts +4 -8
|
@@ -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
|
-
|
|
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 = .
|
|
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
|
|
98
|
-
private rectBlock
|
|
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
|