@needle-tools/engine 4.8.8-next.c758977 → 4.8.8-next.db5fdbd
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/README.md +50 -45
- package/dist/{needle-engine.bundle-rHPLwL4P.min.js → needle-engine.bundle-BtPGFT7e.min.js} +5 -5
- package/dist/{needle-engine.bundle-NtRy1Q8c.js → needle-engine.bundle-COsyGTEY.js} +28 -12
- package/dist/{needle-engine.bundle-CGGDUMtw.umd.cjs → needle-engine.bundle-IiODerFA.umd.cjs} +53 -53
- package/dist/needle-engine.js +2 -2
- package/dist/needle-engine.min.js +1 -1
- package/dist/needle-engine.umd.cjs +1 -1
- package/lib/engine/engine_camera.d.ts +15 -2
- package/lib/engine/engine_camera.js +9 -2
- package/lib/engine/engine_camera.js.map +1 -1
- package/lib/engine/engine_context.d.ts +8 -2
- package/lib/engine/engine_context.js +21 -3
- package/lib/engine/engine_context.js.map +1 -1
- package/lib/engine/engine_create_objects.d.ts +3 -3
- package/lib/engine/engine_create_objects.js +5 -4
- package/lib/engine/engine_create_objects.js.map +1 -1
- package/lib/engine/extensions/NEEDLE_lighting_settings.js +5 -2
- package/lib/engine/extensions/NEEDLE_lighting_settings.js.map +1 -1
- package/lib/engine-components/Camera.d.ts +1 -1
- package/lib/engine-components/Camera.js.map +1 -1
- package/lib/engine-components/OrbitControls.js +4 -6
- package/lib/engine-components/OrbitControls.js.map +1 -1
- package/lib/engine-components/api.d.ts +1 -1
- package/package.json +2 -2
- package/src/engine/engine_camera.ts +15 -3
- package/src/engine/engine_context.ts +22 -4
- package/src/engine/engine_create_objects.ts +8 -7
- package/src/engine/extensions/NEEDLE_lighting_settings.ts +5 -2
- package/src/engine-components/Camera.ts +1 -1
- package/src/engine-components/OrbitControls.ts +4 -11
- package/src/engine-components/api.ts +1 -1
|
@@ -1765,9 +1765,9 @@ fo('if(!globalThis["NEEDLE_PROJECT_BUILD_TIME"]) globalThis["NEEDLE_PROJECT_BUIL
|
|
|
1765
1765
|
fo('if(!globalThis["NEEDLE_PUBLIC_KEY"]) globalThis["NEEDLE_PUBLIC_KEY"] = "unknown";');
|
|
1766
1766
|
fo('globalThis["__NEEDLE_ENGINE_VERSION__"] = "4.8.8";');
|
|
1767
1767
|
fo('globalThis["__NEEDLE_ENGINE_GENERATOR__"] = "undefined";');
|
|
1768
|
-
fo('globalThis["__NEEDLE_PROJECT_BUILD_TIME__"] = "
|
|
1768
|
+
fo('globalThis["__NEEDLE_PROJECT_BUILD_TIME__"] = "Fri Sep 05 2025 14:22:32 GMT+0000 (Coordinated Universal Time)";');
|
|
1769
1769
|
fo('globalThis["__NEEDLE_PUBLIC_KEY__"] = "' + NEEDLE_PUBLIC_KEY + '";');
|
|
1770
|
-
const En = "4.8.8", Cm = "undefined", Gb = "
|
|
1770
|
+
const En = "4.8.8", Cm = "undefined", Gb = "Fri Sep 05 2025 14:22:32 GMT+0000 (Coordinated Universal Time)";
|
|
1771
1771
|
Hb && console.log(`Engine version: ${En} (generator: ${Cm})
|
|
1772
1772
|
Project built at ${Gb}`);
|
|
1773
1773
|
const bl = NEEDLE_PUBLIC_KEY, oo = "needle_isActiveInHierarchy", Br = "builtin_components", Mh = "needle_editor_guid";
|
|
@@ -4240,7 +4240,7 @@ class Oa {
|
|
|
4240
4240
|
return this.applyDefaultObjectOptions(n, e), n;
|
|
4241
4241
|
}
|
|
4242
4242
|
static applyDefaultObjectOptions(e, t) {
|
|
4243
|
-
e.receiveShadow = !0, e.castShadow = !0, t?.name && (e.name = t.name), t?.position && (Array.isArray(t.position) ? e.position.set(t.position[0], t.position[1], t.position[2]) : e.position.set(t.position.x, t.position.y, t.position.z)), t?.rotation && (Array.isArray(t.rotation) ? e.rotation.set(t.rotation[0], t.rotation[1], t.rotation[2]) : e.rotation.set(t.rotation.x, t.rotation.y, t.rotation.z)), t?.scale && (typeof t.scale == "number" ? e.scale.set(t.scale, t.scale, t.scale) : Array.isArray(t.scale) ? e.scale.set(t.scale[0], t.scale[1], t.scale[2]) : e.scale.set(t.scale.x, t.scale.y, t.scale.z)), t?.receiveShadow != null && (e.receiveShadow = t.receiveShadow), t?.castShadow != null && (e.castShadow = t.castShadow), t?.parent && t.parent.add(e);
|
|
4243
|
+
e.receiveShadow = !0, e.castShadow = !0, t?.name && (e.name = t.name), t?.position && (Array.isArray(t.position) ? e.position.set(t.position[0], t.position[1], t.position[2]) : e.position.set(t.position.x || 0, t.position.y || 0, t.position.z || 0)), t?.rotation && (Array.isArray(t.rotation) ? e.rotation.set(t.rotation[0], t.rotation[1], t.rotation[2]) : e.rotation.set(t.rotation.x || 0, t.rotation.y || 0, t.rotation.z || 0)), t?.scale && (typeof t.scale == "number" ? e.scale.set(t.scale, t.scale, t.scale) : Array.isArray(t.scale) ? e.scale.set(t.scale[0], t.scale[1], t.scale[2]) : e.scale.set(t.scale.x || 1, t.scale.y || 1, t.scale.z || 1)), t?.receiveShadow != null && (e.receiveShadow = t.receiveShadow), t?.castShadow != null && (e.castShadow = t.castShadow), t?.parent && t.parent.add(e);
|
|
4244
4244
|
}
|
|
4245
4245
|
}
|
|
4246
4246
|
function P1(s, e, t, i, n) {
|
|
@@ -11184,13 +11184,25 @@ Possible solutions:
|
|
|
11184
11184
|
* Set a rect or dom element. The camera center will be moved to the center of the rect.
|
|
11185
11185
|
* This is useful if you have Needle Engine embedded in a HTML layout and while you want the webgl background to fill e.g. the whole screen you want to move the camera center to free space.
|
|
11186
11186
|
* For that you can simply pass in the rect or HMTL div that you want the camera to center on.
|
|
11187
|
+
* @param rect The focus rect or null to disable
|
|
11188
|
+
* @param settings Optional settings for the focus rect. These will override the `focusRectSettings` property
|
|
11187
11189
|
*/
|
|
11188
|
-
setCameraFocusRect(e) {
|
|
11189
|
-
this._focusRect = e;
|
|
11190
|
+
setCameraFocusRect(e, t) {
|
|
11191
|
+
this._focusRect = e, t && Object.assign(this.focusRectSettings, t);
|
|
11190
11192
|
}
|
|
11191
11193
|
get focusRect() {
|
|
11192
11194
|
return this._focusRect;
|
|
11193
11195
|
}
|
|
11196
|
+
/** Settings when a focus rect is set. Use `setCameraFocusRect(...)` to do so.
|
|
11197
|
+
* This can be used to offset the renderer center e.g. to a specific DOM element.
|
|
11198
|
+
*/
|
|
11199
|
+
focusRectSettings = {
|
|
11200
|
+
/** Controls how fast the rect is centered. Smaller values mean the rect is centered faster.
|
|
11201
|
+
* A minimum value of 0 means the rect is centered instantly.
|
|
11202
|
+
* @default .05
|
|
11203
|
+
*/
|
|
11204
|
+
damping: 0.05
|
|
11205
|
+
};
|
|
11194
11206
|
_focusRect = null;
|
|
11195
11207
|
_lastTimestamp = 0;
|
|
11196
11208
|
_accumulatedTime = 0;
|
|
@@ -11264,7 +11276,11 @@ Possible solutions:
|
|
|
11264
11276
|
2
|
|
11265
11277
|
/* LateUpdate */
|
|
11266
11278
|
), this.physicsSteps === void 0 && (this.physicsSteps = 1), this.physics.engine && this.physicsSteps > 0 && this.internalUpdatePhysics(this.physicsSteps), this.isVisibleToUser || this.runInBackground) {
|
|
11267
|
-
this._focusRect && this.mainCamera instanceof me
|
|
11279
|
+
if (this._focusRect && this.mainCamera instanceof me) {
|
|
11280
|
+
const n = this.focusRectSettings, o = n.damping > 0 ? this.time.deltaTime / n.damping : 1;
|
|
11281
|
+
CC(this._focusRect, o, this.mainCamera, this.renderer);
|
|
11282
|
+
}
|
|
11283
|
+
this._currentFrameEvent = 3;
|
|
11268
11284
|
for (let n = 0; n < this.scripts_onBeforeRender.length; n++) {
|
|
11269
11285
|
const o = this.scripts_onBeforeRender[n];
|
|
11270
11286
|
o.activeAndEnabled && o.onBeforeRender !== void 0 && (U.Current = this, o.onBeforeRender(t));
|
|
@@ -16321,7 +16337,7 @@ class ye extends T {
|
|
|
16321
16337
|
return;
|
|
16322
16338
|
}
|
|
16323
16339
|
let i;
|
|
16324
|
-
if (Array.isArray(e)
|
|
16340
|
+
if (Array.isArray(e) || e && "type" in e ? i = e : e && typeof e == "object" && !(e instanceof M) && !Array.isArray(e) && (t = e, i = t.objects), i && !Array.isArray(i) && (i = [i]), (!Array.isArray(i) || i && i.length <= 0) && (i = this.context.scene.children), !Array.isArray(i) || i.length <= 0) {
|
|
16325
16341
|
console.warn("No objects to fit camera to...");
|
|
16326
16342
|
return;
|
|
16327
16343
|
}
|
|
@@ -16332,9 +16348,9 @@ class ye extends T {
|
|
|
16332
16348
|
}
|
|
16333
16349
|
t || (t = {});
|
|
16334
16350
|
const { immediate: r = !1, centerCamera: a, cameraNearFar: l = "auto", fitOffset: c = 1.1, fov: h = n?.fov } = t, d = new b(), f = new b(), p = _i(i, void 0, this._camera?.threeCamera?.layers), g = p.clone();
|
|
16335
|
-
|
|
16351
|
+
p.getCenter(f);
|
|
16336
16352
|
const _ = new b();
|
|
16337
|
-
if (p.getSize(_), p.applyMatrix4(n.matrixWorldInverse), p.getSize(d), p.setFromCenterAndSize(f, d), Number.isNaN(d.x) || Number.isNaN(d.y) || Number.isNaN(d.z)) {
|
|
16353
|
+
if (p.getSize(_), n.updateMatrixWorld(), p.applyMatrix4(n.matrixWorldInverse), p.getSize(d), p.setFromCenterAndSize(f, d), Number.isNaN(d.x) || Number.isNaN(d.y) || Number.isNaN(d.z)) {
|
|
16338
16354
|
console.warn("Camera fit size resultet in NaN", n, p, [...i]);
|
|
16339
16355
|
return;
|
|
16340
16356
|
}
|
|
@@ -16347,10 +16363,10 @@ class ye extends T {
|
|
|
16347
16363
|
const O = 0.05, k = f.clone();
|
|
16348
16364
|
if (k.y -= d.y * O, t.targetOffset && (t.targetOffset.x !== void 0 && (k.x += t.targetOffset.x), t.targetOffset.y !== void 0 && (k.y += t.targetOffset.y), t.targetOffset.z !== void 0 && (k.z += t.targetOffset.z)), t.relativeTargetOffset && (t.relativeTargetOffset.x !== void 0 && (k.x += t.relativeTargetOffset.x * d.x), t.relativeTargetOffset.y !== void 0 && (k.y += t.relativeTargetOffset.y * d.y), t.relativeTargetOffset.z !== void 0 && (k.z += t.relativeTargetOffset.z * d.z)), this.setLookTargetPosition(k, r), this.setFieldOfView(t.fov, r), l == null || l == "auto") {
|
|
16349
16365
|
const W = S.findObjectOfType(Ms), X = W ? W.radius : 0, A = Math.max(_.x, _.y, _.z, X);
|
|
16350
|
-
n.near = I / 100, n.far = A + I * 10, W && (this.maxZoom = Math.max(Math.min(this.maxZoom, X * 0.5), I));
|
|
16366
|
+
n.near = I / 100, n.far = A + I * 10, n.updateProjectionMatrix(), W && (this.maxZoom = Math.max(Math.min(this.maxZoom, X * 0.5), I));
|
|
16351
16367
|
}
|
|
16352
16368
|
const E = o.getDistance();
|
|
16353
|
-
E < this.minZoom && (this.minZoom = E * 0.9), E > this.maxZoom && (this.maxZoom = E * 1.1)
|
|
16369
|
+
E < this.minZoom && (this.minZoom = E * 0.9), E > this.maxZoom && (this.maxZoom = E * 1.1);
|
|
16354
16370
|
const B = f.clone();
|
|
16355
16371
|
t.fitDirection ? B.sub(new b().copy(t.fitDirection).multiplyScalar(1e6)) : B.sub(n.worldPosition), a === "y" && (B.y = 0), B.normalize(), B.multiplyScalar(I), a === "y" && (B.y += -O * 4 * I);
|
|
16356
16372
|
let L = f.clone().sub(B);
|
|
@@ -20590,7 +20606,7 @@ class Fp extends T {
|
|
|
20590
20606
|
}
|
|
20591
20607
|
} else
|
|
20592
20608
|
this._ambientLightObj && this._ambientLightObj.removeFromParent(), this._hemisphereLightObj && this._hemisphereLightObj.removeFromParent();
|
|
20593
|
-
this.sourceId && this.context.sceneLighting.internalEnableReflection(this.sourceId);
|
|
20609
|
+
this.sourceId && (this.context.domElement.getAttribute("environment-image") || this.context.sceneLighting.internalEnableReflection(this.sourceId));
|
|
20594
20610
|
}
|
|
20595
20611
|
onDisable() {
|
|
20596
20612
|
Nr && console.warn("💡⚫ <<< Disable lighting:", this.sourceId, this), this._ambientLightObj && this._ambientLightObj.removeFromParent(), this._hemisphereLightObj && this._hemisphereLightObj.removeFromParent(), this.sourceId && this.context.sceneLighting.internalDisableReflection(this.sourceId);
|