@needle-tools/engine 4.10.0-next.f0ec242 → 4.10.0
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 +7 -3
- package/README.md +2 -1
- package/components.needle.json +1 -1
- package/dist/needle-engine.bundle-BSq-d_16.min.js +1652 -0
- package/dist/{needle-engine.bundle-dgNq9Vsa.umd.cjs → needle-engine.bundle-C2kVfQq6.umd.cjs} +153 -140
- package/dist/{needle-engine.bundle-BC-0Ex9m.js → needle-engine.bundle-CIuhf7-t.js} +7388 -7113
- package/dist/needle-engine.d.ts +15 -15
- package/dist/needle-engine.js +259 -257
- package/dist/needle-engine.min.js +1 -1
- package/dist/needle-engine.umd.cjs +1 -1
- package/dist/vendor-CPuBPspY.umd.cjs +1121 -0
- package/dist/vendor-DPCU8cUF.min.js +1121 -0
- package/dist/vendor-MBoqSyFm.js +16240 -0
- package/lib/engine/codegen/register_types.js +2 -0
- package/lib/engine/codegen/register_types.js.map +1 -1
- package/lib/engine/engine_camera.d.ts +7 -1
- package/lib/engine/engine_camera.js +46 -6
- package/lib/engine/engine_camera.js.map +1 -1
- package/lib/engine/engine_context.d.ts +6 -0
- package/lib/engine/engine_context.js +48 -9
- package/lib/engine/engine_context.js.map +1 -1
- package/lib/engine/engine_gizmos.d.ts +11 -10
- package/lib/engine/engine_gizmos.js +24 -10
- package/lib/engine/engine_gizmos.js.map +1 -1
- package/lib/engine/engine_license.js +1 -1
- package/lib/engine/engine_license.js.map +1 -1
- package/lib/engine/engine_lightdata.d.ts +3 -3
- package/lib/engine/engine_lightdata.js +10 -10
- package/lib/engine/engine_lightdata.js.map +1 -1
- package/lib/engine/engine_physics_rapier.js +4 -0
- package/lib/engine/engine_physics_rapier.js.map +1 -1
- package/lib/engine/engine_scenelighting.d.ts +1 -1
- package/lib/engine/engine_scenelighting.js +4 -5
- package/lib/engine/engine_scenelighting.js.map +1 -1
- package/lib/engine/engine_utils.d.ts +3 -1
- package/lib/engine/engine_utils.js +11 -0
- package/lib/engine/engine_utils.js.map +1 -1
- package/lib/engine/extensions/NEEDLE_lightmaps.js +1 -1
- package/lib/engine/extensions/NEEDLE_lightmaps.js.map +1 -1
- package/lib/engine/extensions/extension_utils.js +1 -1
- package/lib/engine/extensions/extension_utils.js.map +1 -1
- package/lib/engine/webcomponents/logo-element.d.ts +1 -1
- package/lib/engine/webcomponents/logo-element.js +29 -5
- package/lib/engine/webcomponents/logo-element.js.map +1 -1
- package/lib/engine/webcomponents/needle menu/needle-menu.js +4 -3
- package/lib/engine/webcomponents/needle menu/needle-menu.js.map +1 -1
- package/lib/engine/webcomponents/needle-engine.js +22 -0
- package/lib/engine/webcomponents/needle-engine.js.map +1 -1
- package/lib/engine/webcomponents/needle-engine.loading.d.ts +0 -1
- package/lib/engine/webcomponents/needle-engine.loading.js +3 -36
- package/lib/engine/webcomponents/needle-engine.loading.js.map +1 -1
- package/lib/engine/xr/NeedleXRController.d.ts +3 -3
- package/lib/engine/xr/NeedleXRController.js +28 -0
- package/lib/engine/xr/NeedleXRController.js.map +1 -1
- package/lib/engine-components/CameraUtils.js +2 -1
- package/lib/engine-components/CameraUtils.js.map +1 -1
- package/lib/engine-components/Renderer.js +6 -1
- package/lib/engine-components/Renderer.js.map +1 -1
- package/lib/engine-components/Skybox.js +22 -4
- package/lib/engine-components/Skybox.js.map +1 -1
- package/lib/engine-components/codegen/components.d.ts +1 -0
- package/lib/engine-components/codegen/components.js +1 -0
- package/lib/engine-components/codegen/components.js.map +1 -1
- package/lib/engine-components/debug/LogStats.d.ts +1 -0
- package/lib/engine-components/debug/LogStats.js +1 -0
- package/lib/engine-components/debug/LogStats.js.map +1 -1
- package/lib/engine-components/timeline/PlayableDirector.d.ts +7 -0
- package/lib/engine-components/timeline/PlayableDirector.js +8 -1
- package/lib/engine-components/timeline/PlayableDirector.js.map +1 -1
- package/lib/engine-components/timeline/TimelineModels.d.ts +11 -1
- package/lib/engine-components/timeline/TimelineTracks.d.ts +2 -1
- package/lib/engine-components/timeline/TimelineTracks.js +30 -25
- package/lib/engine-components/timeline/TimelineTracks.js.map +1 -1
- package/lib/engine-components/utils/LookAt.js +5 -1
- package/lib/engine-components/utils/LookAt.js.map +1 -1
- package/lib/engine-components/web/Clickthrough.js +10 -2
- package/lib/engine-components/web/Clickthrough.js.map +1 -1
- package/lib/engine-components/web/ScrollFollow.d.ts +24 -0
- package/lib/engine-components/web/ScrollFollow.js +169 -42
- package/lib/engine-components/web/ScrollFollow.js.map +1 -1
- package/lib/engine-components/web/ViewBox.d.ts +43 -0
- package/lib/engine-components/web/ViewBox.js +258 -0
- package/lib/engine-components/web/ViewBox.js.map +1 -0
- package/lib/engine-components/web/index.d.ts +1 -0
- package/lib/engine-components/web/index.js +1 -0
- package/lib/engine-components/web/index.js.map +1 -1
- package/lib/engine-components-experimental/Presentation.d.ts +1 -0
- package/lib/engine-components-experimental/Presentation.js +1 -0
- package/lib/engine-components-experimental/Presentation.js.map +1 -1
- package/package.json +3 -2
- package/src/engine/codegen/register_types.ts +2 -0
- package/src/engine/engine_camera.ts +61 -9
- package/src/engine/engine_context.ts +50 -10
- package/src/engine/engine_gizmos.ts +37 -23
- package/src/engine/engine_license.ts +1 -1
- package/src/engine/engine_lightdata.ts +11 -11
- package/src/engine/engine_physics_rapier.ts +3 -0
- package/src/engine/engine_scenelighting.ts +5 -6
- package/src/engine/engine_utils.ts +12 -0
- package/src/engine/extensions/NEEDLE_lightmaps.ts +1 -1
- package/src/engine/extensions/extension_utils.ts +1 -1
- package/src/engine/webcomponents/logo-element.ts +29 -4
- package/src/engine/webcomponents/needle menu/needle-menu.ts +4 -3
- package/src/engine/webcomponents/needle-engine.loading.ts +32 -32
- package/src/engine/webcomponents/needle-engine.ts +33 -6
- package/src/engine/xr/NeedleXRController.ts +36 -4
- package/src/engine-components/CameraUtils.ts +1 -1
- package/src/engine-components/Renderer.ts +6 -1
- package/src/engine-components/Skybox.ts +26 -7
- package/src/engine-components/codegen/components.ts +1 -0
- package/src/engine-components/debug/LogStats.ts +1 -0
- package/src/engine-components/timeline/PlayableDirector.ts +10 -1
- package/src/engine-components/timeline/TimelineModels.ts +11 -1
- package/src/engine-components/timeline/TimelineTracks.ts +30 -25
- package/src/engine-components/utils/LookAt.ts +5 -1
- package/src/engine-components/web/Clickthrough.ts +11 -2
- package/src/engine-components/web/ScrollFollow.ts +205 -51
- package/src/engine-components/web/ViewBox.ts +278 -0
- package/src/engine-components/web/index.ts +2 -1
- package/src/engine-components-experimental/Presentation.ts +1 -0
- package/dist/needle-engine.bundle-BSh7dSEx.min.js +0 -1639
- package/dist/vendor-D0Yvltn9.umd.cjs +0 -1121
- package/dist/vendor-DU8tJyl_.js +0 -14366
- package/dist/vendor-JyrX4DVM.min.js +0 -1121
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ViewBox.js","sourceRoot":"","sources":["../../../src/engine-components/web/ViewBox.ts"],"names":[],"mappings":";;;;;;;AAAA,OAAO,EAAU,iBAAiB,EAAuC,MAAM,OAAO,CAAC;AAEvF,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,MAAM,EAAE,MAAM,+BAA+B,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,gDAAgD,CAAC;AAC9E,OAAO,EAAE,aAAa,EAAE,MAAM,oCAAoC,CAAC;AACnE,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAChE,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AACxD,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAG5C,MAAM,UAAU,GAAG,QAAQ,CAAC,cAAc,CAAC,CAAC;AAC5C,MAAM,kBAAkB,GAAG,IAAI,SAAS,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC;AAEzD;;;;;;;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,CAAC,IAAI,GAAG,EAAE,GAAG,EAAE,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,GAAG,IAAI,CAAC;YAC1F,IAAI,CAAC,oBAAoB,CAAC,KAAK,CAAC,KAAK,GAAG,CAAC,CAAC,IAAI,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,GAAG,IAAI,CAAC;YAC5F,IAAI,CAAC,oBAAoB,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,IAAI,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,GAAG,IAAI,CAAC;YAC9F,IAAI,CAAC,oBAAoB,CAAC,KAAK,CAAC,aAAa,GAAG,MAAM,CAAC;YACvD,IAAI,CAAC,oBAAoB,CAAC,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC;SACnD;QAGD,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;IAEtC,CAAC;IACO,oBAAoB,GAAuB,IAAI,CAAC;;AAlOxD;IADC,YAAY,EAAE;qDACsC;AAMrD;IADC,YAAY,EAAE;sCACQ;AAfd,OAAO;IADnB,YAAY;GACA,OAAO,CAgPnB;SAhPY,OAAO"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/engine-components/web/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/engine-components/web/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,cAAc,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Presentation.js","sourceRoot":"","sources":["../../src/engine-components-experimental/Presentation.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,mCAAmC,CAAC;AAE9D,MAAM,OAAO,gBAAiB,SAAQ,SAAS;IAE3C,SAAS,GAAY,MAAM,CAAC;IAE5B,MAAM;QACF,IAAI,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,SAAS,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE;YAC9C,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,SAAS,CAAC,MAAM,CAAC,mBAAmB,CAAC,CAAC;SACjE;IACL,CAAC;CACJ"}
|
|
1
|
+
{"version":3,"file":"Presentation.js","sourceRoot":"","sources":["../../src/engine-components-experimental/Presentation.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,mCAAmC,CAAC;AAE9D,gBAAgB;AAChB,MAAM,OAAO,gBAAiB,SAAQ,SAAS;IAE3C,SAAS,GAAY,MAAM,CAAC;IAE5B,MAAM;QACF,IAAI,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,SAAS,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE;YAC9C,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,SAAS,CAAC,MAAM,CAAC,mBAAmB,CAAC,CAAC;SACjE;IACL,CAAC;CACJ"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@needle-tools/engine",
|
|
3
|
-
"version": "4.10.0
|
|
3
|
+
"version": "4.10.0",
|
|
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": {
|
|
@@ -101,6 +101,7 @@
|
|
|
101
101
|
"n8ao": "^1.9.3",
|
|
102
102
|
"peerjs": "1.4.7",
|
|
103
103
|
"postprocessing": "^6.36.6",
|
|
104
|
+
"scroll-timeline-polyfill": "^1.1.0",
|
|
104
105
|
"simplex-noise": "^4.0.1",
|
|
105
106
|
"stats.js": "^0.17.0",
|
|
106
107
|
"three": "npm:@needle-tools/three@0.169.10",
|
|
@@ -168,4 +169,4 @@
|
|
|
168
169
|
"module": "lib/needle-engine.js",
|
|
169
170
|
"typings": "lib/needle-engine.d.ts",
|
|
170
171
|
"types": "lib/needle-engine.d.ts"
|
|
171
|
-
}
|
|
172
|
+
}
|
|
@@ -142,6 +142,7 @@ import { ClickThrough } from "../../engine-components/web/Clickthrough.js";
|
|
|
142
142
|
import { CursorFollow } from "../../engine-components/web/CursorFollow.js";
|
|
143
143
|
import { HoverAnimation } from "../../engine-components/web/HoverAnimation.js";
|
|
144
144
|
import { ScrollFollow } from "../../engine-components/web/ScrollFollow.js";
|
|
145
|
+
import { ViewBox } from "../../engine-components/web/ViewBox.js";
|
|
145
146
|
import { Avatar } from "../../engine-components/webxr/Avatar.js";
|
|
146
147
|
import { XRControllerFollow } from "../../engine-components/webxr/controllers/XRControllerFollow.js";
|
|
147
148
|
import { XRControllerModel } from "../../engine-components/webxr/controllers/XRControllerModel.js";
|
|
@@ -300,6 +301,7 @@ TypeStore.add("ClickThrough", ClickThrough);
|
|
|
300
301
|
TypeStore.add("CursorFollow", CursorFollow);
|
|
301
302
|
TypeStore.add("HoverAnimation", HoverAnimation);
|
|
302
303
|
TypeStore.add("ScrollFollow", ScrollFollow);
|
|
304
|
+
TypeStore.add("ViewBox", ViewBox);
|
|
303
305
|
TypeStore.add("Avatar", Avatar);
|
|
304
306
|
TypeStore.add("XRControllerFollow", XRControllerFollow);
|
|
305
307
|
TypeStore.add("XRControllerModel", XRControllerModel);
|
|
@@ -2,6 +2,7 @@ import { Camera, HemisphereLightHelper, Object3D, PerspectiveCamera, Vector2, We
|
|
|
2
2
|
|
|
3
3
|
import { Mathf } from "./engine_math.js";
|
|
4
4
|
import type { ICameraController } from "./engine_types.js";
|
|
5
|
+
import { getParam } from "./engine_utils.js";
|
|
5
6
|
|
|
6
7
|
|
|
7
8
|
const $cameraController = "needle:cameraController";
|
|
@@ -52,17 +53,29 @@ export type FocusRectSettings = {
|
|
|
52
53
|
/** Lower values will result in faster alignment with the rect (value ~= seconds to reach target)
|
|
53
54
|
* Minimum value is 0.
|
|
54
55
|
*/
|
|
55
|
-
damping: number
|
|
56
|
+
damping: number,
|
|
57
|
+
|
|
58
|
+
/** X offset in camera coordinates. Used by ViewBox component */
|
|
59
|
+
offsetX: number,
|
|
60
|
+
/** Y offset in camera coordinates. Used by ViewBox component */
|
|
61
|
+
offsetY: number,
|
|
62
|
+
/** Zoom factor. Used by ViewBox component */
|
|
63
|
+
zoom: number,
|
|
56
64
|
}
|
|
57
65
|
export type FocusRect = DOMRect | Element | { x: number, y: number, width: number, height: number };
|
|
58
66
|
|
|
59
67
|
let rendererRect: DOMRect | undefined = undefined;
|
|
60
68
|
const overlapRect = { x: 0, y: 0, width: 0, height: 0 };
|
|
69
|
+
const _testTime = 1;
|
|
70
|
+
const debug = getParam("debugfocusrect");
|
|
61
71
|
|
|
62
72
|
/** Used internally by the Needle Engine context via 'setFocusRect(<rect>)' */
|
|
63
|
-
export function updateCameraFocusRect(focusRect: FocusRect, dt: number, camera: PerspectiveCamera, renderer: WebGLRenderer) {
|
|
73
|
+
export function updateCameraFocusRect(focusRect: FocusRect, settings: FocusRectSettings, dt: number, camera: PerspectiveCamera, renderer: WebGLRenderer) {
|
|
64
74
|
|
|
65
75
|
if (focusRect instanceof Element) {
|
|
76
|
+
if(debug && focusRect instanceof HTMLElement) {
|
|
77
|
+
focusRect.style.outline = "2px dashed rgba(255, 150, 0, .8)";
|
|
78
|
+
}
|
|
66
79
|
focusRect = focusRect.getBoundingClientRect();
|
|
67
80
|
}
|
|
68
81
|
rendererRect = renderer.domElement.getBoundingClientRect();
|
|
@@ -76,16 +89,55 @@ export function updateCameraFocusRect(focusRect: FocusRect, dt: number, camera:
|
|
|
76
89
|
rect.x -= rendererRect.x;
|
|
77
90
|
rect.y -= rendererRect.y;
|
|
78
91
|
|
|
79
|
-
const
|
|
80
|
-
const
|
|
92
|
+
const sourceWidth = rendererRect.width;
|
|
93
|
+
const sourceHeight = rendererRect.height;
|
|
81
94
|
|
|
82
|
-
const view = camera.view;
|
|
95
|
+
const view = camera.view as PerspectiveCamera["view"];
|
|
83
96
|
|
|
97
|
+
// Apply zoom
|
|
98
|
+
const zoom = settings.zoom;
|
|
84
99
|
let offsetX = view?.offsetX || 0;
|
|
85
100
|
let offsetY = view?.offsetY || 0;
|
|
86
|
-
offsetX = Mathf.lerp(offsetX, targetX, dt);
|
|
87
|
-
offsetY = Mathf.lerp(offsetY, targetY, dt);
|
|
88
101
|
|
|
89
|
-
|
|
102
|
+
let width = rendererRect.width;
|
|
103
|
+
let height = rendererRect.height;
|
|
104
|
+
width /= zoom;
|
|
105
|
+
height /= zoom;
|
|
106
|
+
offsetX = width * (zoom - 1) * .5;
|
|
107
|
+
offsetY = height * (zoom - 1) * .5;
|
|
108
|
+
|
|
109
|
+
const focusRectCenterX = rect.x + rect.width * .5;
|
|
110
|
+
const focusRectCenterY = rect.y + rect.height * .5;
|
|
111
|
+
const rendererCenterX = rendererRect.width * .5;
|
|
112
|
+
const rendererCenterY = rendererRect.height * .5;
|
|
113
|
+
|
|
114
|
+
const diffx = focusRectCenterX - rendererCenterX;
|
|
115
|
+
const diffy = focusRectCenterY - rendererCenterY;
|
|
116
|
+
offsetX -= diffx / zoom;
|
|
117
|
+
offsetY -= diffy / zoom;
|
|
118
|
+
if (settings.offsetX !== undefined) {
|
|
119
|
+
offsetX += settings.offsetX * (rendererRect.width * .5);
|
|
120
|
+
}
|
|
121
|
+
if (settings.offsetY !== undefined) {
|
|
122
|
+
offsetY -= settings.offsetY * (rendererRect.height * .5);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
const currentOffsetX = view?.offsetX || offsetX;
|
|
127
|
+
const currentOffsetY = view?.offsetY || offsetY;
|
|
128
|
+
offsetX = Mathf.lerp(currentOffsetX, offsetX, dt);
|
|
129
|
+
offsetY = Mathf.lerp(currentOffsetY, offsetY, dt);
|
|
130
|
+
const currentWidth = view?.width || sourceWidth;
|
|
131
|
+
const currentHeight = view?.height || sourceHeight;
|
|
132
|
+
width = Mathf.lerp(currentWidth, width, dt);
|
|
133
|
+
height = Mathf.lerp(currentHeight, height, dt);
|
|
134
|
+
|
|
135
|
+
camera.setViewOffset(sourceWidth, sourceHeight, offsetX, offsetY, width, height);
|
|
90
136
|
camera.updateProjectionMatrix();
|
|
91
|
-
|
|
137
|
+
|
|
138
|
+
if (settings.damping > 0) {
|
|
139
|
+
settings.damping *= (1.0 - dt);
|
|
140
|
+
if (settings.damping < 0.01) settings.damping = 0;
|
|
141
|
+
settings.damping = Math.max(0, settings.damping);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
@@ -1382,21 +1382,61 @@ export class Context implements IContext {
|
|
|
1382
1382
|
* @param settings Optional settings for the focus rect. These will override the `focusRectSettings` property
|
|
1383
1383
|
*/
|
|
1384
1384
|
public setCameraFocusRect(rect: FocusRect | null, settings?: Partial<FocusRectSettings>) {
|
|
1385
|
+
const oldRect = this._focusRect;
|
|
1385
1386
|
this._focusRect = rect;
|
|
1386
1387
|
if (settings) {
|
|
1387
1388
|
Object.assign(this.focusRectSettings, settings);
|
|
1388
1389
|
}
|
|
1390
|
+
if (settings?.damping === undefined) {
|
|
1391
|
+
// if the new rect is on screen then set damping
|
|
1392
|
+
if (oldRect) {
|
|
1393
|
+
let domRect = oldRect as DOMRect;
|
|
1394
|
+
if (oldRect instanceof HTMLElement) {
|
|
1395
|
+
domRect = oldRect.getBoundingClientRect();
|
|
1396
|
+
}
|
|
1397
|
+
if (domRect && "top" in domRect) {
|
|
1398
|
+
const allowedDistance = 100;
|
|
1399
|
+
const isVisible = domRect.bottom >= -allowedDistance && domRect.right >= -allowedDistance && domRect.top <= window.innerHeight + allowedDistance && domRect.left <= window.innerWidth + allowedDistance;
|
|
1400
|
+
if (isVisible) this.focusRectSettings.damping = .2;
|
|
1401
|
+
}
|
|
1402
|
+
}
|
|
1403
|
+
}
|
|
1404
|
+
|
|
1389
1405
|
}
|
|
1390
1406
|
get focusRect() { return this._focusRect; }
|
|
1407
|
+
get focusRectSize(): null | { x: number, y: number, width: number, height: number } {
|
|
1408
|
+
const rect = this._focusRect;
|
|
1409
|
+
if (rect && (rect instanceof DOMRect || ("width" in rect && "height" in rect && "x" in rect && "y" in rect))) {
|
|
1410
|
+
return { x: rect.x, y: rect.y, width: rect.width, height: rect.height };
|
|
1411
|
+
}
|
|
1412
|
+
else if (rect instanceof HTMLElement) {
|
|
1413
|
+
const r = rect.getBoundingClientRect();
|
|
1414
|
+
return { x: r.x, y: r.y, width: r.width, height: r.height };
|
|
1415
|
+
}
|
|
1416
|
+
return null;
|
|
1417
|
+
}
|
|
1391
1418
|
/** Settings when a focus rect is set. Use `setCameraFocusRect(...)` to do so.
|
|
1392
1419
|
* This can be used to offset the renderer center e.g. to a specific DOM element.
|
|
1393
1420
|
*/
|
|
1394
1421
|
readonly focusRectSettings: FocusRectSettings = {
|
|
1395
1422
|
/** Controls how fast the rect is centered. Smaller values mean the rect is centered faster.
|
|
1396
1423
|
* A minimum value of 0 means the rect is centered instantly.
|
|
1397
|
-
* @default
|
|
1424
|
+
* @default 0
|
|
1398
1425
|
*/
|
|
1399
|
-
damping:
|
|
1426
|
+
damping: 0,
|
|
1427
|
+
|
|
1428
|
+
/**
|
|
1429
|
+
* Zoom factor when a focus rect is set.
|
|
1430
|
+
*/
|
|
1431
|
+
zoom: 1,
|
|
1432
|
+
/**
|
|
1433
|
+
* Additional offset in pixels from the center of the rect
|
|
1434
|
+
*/
|
|
1435
|
+
offsetX: 0,
|
|
1436
|
+
/**
|
|
1437
|
+
* Additional offset in pixels from the center of the rect
|
|
1438
|
+
*/
|
|
1439
|
+
offsetY: 0,
|
|
1400
1440
|
};
|
|
1401
1441
|
private _focusRect: FocusRect | null = null;
|
|
1402
1442
|
|
|
@@ -1528,14 +1568,6 @@ export class Context implements IContext {
|
|
|
1528
1568
|
|
|
1529
1569
|
if (this.isVisibleToUser || this.runInBackground) {
|
|
1530
1570
|
|
|
1531
|
-
if (this._focusRect) {
|
|
1532
|
-
if (this.mainCamera instanceof PerspectiveCamera) {
|
|
1533
|
-
const settings = this.focusRectSettings;
|
|
1534
|
-
const dt = settings.damping > 0 ? this.time.deltaTime / settings.damping : 1;
|
|
1535
|
-
updateCameraFocusRect(this._focusRect, dt, this.mainCamera, this.renderer);
|
|
1536
|
-
}
|
|
1537
|
-
}
|
|
1538
|
-
|
|
1539
1571
|
this._currentFrameEvent = FrameEvent.OnBeforeRender;
|
|
1540
1572
|
|
|
1541
1573
|
// should we move these callbacks in the regular three onBeforeRender events?
|
|
@@ -1552,6 +1584,14 @@ export class Context implements IContext {
|
|
|
1552
1584
|
this.executeCoroutines(FrameEvent.OnBeforeRender);
|
|
1553
1585
|
invokeLifecycleFunctions(this, FrameEvent.OnBeforeRender);
|
|
1554
1586
|
|
|
1587
|
+
if (this._focusRect) {
|
|
1588
|
+
if (this.mainCamera instanceof PerspectiveCamera) {
|
|
1589
|
+
const settings = this.focusRectSettings;
|
|
1590
|
+
const dt = settings.damping > 0 ? this.time.deltaTime / settings.damping : 1;
|
|
1591
|
+
updateCameraFocusRect(this._focusRect, this.focusRectSettings, dt, this.mainCamera, this.renderer);
|
|
1592
|
+
}
|
|
1593
|
+
}
|
|
1594
|
+
|
|
1555
1595
|
if (this._needsUpdateSize)
|
|
1556
1596
|
this.updateSize();
|
|
1557
1597
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AxesHelper, Box3, BoxGeometry, BufferAttribute, BufferGeometry, Color, type ColorRepresentation, CylinderGeometry, EdgesGeometry, Line, LineBasicMaterial, LineSegments, Matrix4, Mesh, MeshBasicMaterial, Object3D, Quaternion, SphereGeometry, Vector3 } from 'three';
|
|
1
|
+
import { AxesHelper, Box3, BoxGeometry, BufferAttribute, BufferGeometry, Color, type ColorRepresentation, CylinderGeometry, EdgesGeometry, Line, LineBasicMaterial, LineSegments, Material,Matrix4, Mesh, MeshBasicMaterial, Object3D, Quaternion, SphereGeometry, Vector3 } from 'three';
|
|
2
2
|
import ThreeMeshUI, { Inline, Text } from "three-mesh-ui"
|
|
3
3
|
import { type Options } from 'three-mesh-ui/build/types/core/elements/MeshUIBaseElement.js';
|
|
4
4
|
|
|
@@ -8,6 +8,7 @@ import { getTempVector, getWorldPosition, lookAtObject, setWorldPositionXYZ } fr
|
|
|
8
8
|
import type { Vec3, Vec4 } from './engine_types.js';
|
|
9
9
|
import { getParam } from './engine_utils.js';
|
|
10
10
|
import { NeedleXRSession } from './engine_xr.js';
|
|
11
|
+
import { RGBAColor } from './js-extensions/RGBAColor.js';
|
|
11
12
|
|
|
12
13
|
const _tmp = new Vector3();
|
|
13
14
|
const _tmp2 = new Vector3();
|
|
@@ -21,7 +22,7 @@ const circleSegments: number = 32;
|
|
|
21
22
|
export type LabelHandle = {
|
|
22
23
|
setText(str: string);
|
|
23
24
|
}
|
|
24
|
-
|
|
25
|
+
type GizmoColor = ColorRepresentation | (Color & { a: number }) | RGBAColor;
|
|
25
26
|
|
|
26
27
|
/** Gizmos are temporary objects that are drawn in the scene for debugging or visualization purposes
|
|
27
28
|
* They are automatically removed after a given duration and cached internally to reduce overhead.
|
|
@@ -62,7 +63,7 @@ export class Gizmos {
|
|
|
62
63
|
* @param parent the parent object to attach the label to. If no parent is provided the label will be attached to the scene
|
|
63
64
|
* @returns a handle to the label that can be used to update the text
|
|
64
65
|
*/
|
|
65
|
-
static DrawLabel(position: Vec3, text: string, size: number = .05, duration: number = 0, color?: ColorRepresentation, backgroundColor?: ColorRepresentation |
|
|
66
|
+
static DrawLabel(position: Vec3, text: string, size: number = .05, duration: number = 0, color?: ColorRepresentation, backgroundColor?: ColorRepresentation | GizmoColor, parent?: Object3D,) {
|
|
66
67
|
if (!Gizmos.enabled) return null;
|
|
67
68
|
if (!color) color = defaultColor;
|
|
68
69
|
const rigScale = NeedleXRSession.active?.rigScale ?? 1;
|
|
@@ -82,7 +83,7 @@ export class Gizmos {
|
|
|
82
83
|
* @param duration the duration in seconds the ray will be rendered. If 0 it will be rendered for one frame
|
|
83
84
|
* @param depthTest if true the ray will be rendered with depth test
|
|
84
85
|
*/
|
|
85
|
-
static DrawRay(origin: Vec3, dir: Vec3, color:
|
|
86
|
+
static DrawRay(origin: Vec3, dir: Vec3, color: GizmoColor = defaultColor, duration: number = 0, depthTest: boolean = true) {
|
|
86
87
|
if (!Gizmos.enabled) return;
|
|
87
88
|
const obj = Internal.getLine(duration);
|
|
88
89
|
const positions = obj.geometry.getAttribute("position");
|
|
@@ -90,9 +91,10 @@ export class Gizmos {
|
|
|
90
91
|
_tmp.set(dir.x, dir.y, dir.z).multiplyScalar(999999999);
|
|
91
92
|
positions.setXYZ(1, origin.x + _tmp.x, origin.y + _tmp.y, origin.z + _tmp.z);
|
|
92
93
|
positions.needsUpdate = true;
|
|
93
|
-
obj.material["color"].set(color);
|
|
94
94
|
obj.material["depthTest"] = depthTest;
|
|
95
95
|
obj.material["depthWrite"] = false;
|
|
96
|
+
obj.material["fog"] = false;
|
|
97
|
+
applyGizmoColor(obj.material, color);
|
|
96
98
|
}
|
|
97
99
|
|
|
98
100
|
/**
|
|
@@ -104,7 +106,7 @@ export class Gizmos {
|
|
|
104
106
|
* @param depthTest if true the line will be rendered with depth test
|
|
105
107
|
* @param lengthFactor the length of the line. Default is 1
|
|
106
108
|
*/
|
|
107
|
-
static DrawDirection(pt: Vec3, direction: Vec3 | Vec4, color:
|
|
109
|
+
static DrawDirection(pt: Vec3, direction: Vec3 | Vec4, color: GizmoColor = defaultColor, duration: number = 0, depthTest: boolean = true, lengthFactor: number = 1) {
|
|
108
110
|
if (!Gizmos.enabled) return;
|
|
109
111
|
const obj = Internal.getLine(duration);
|
|
110
112
|
const positions = obj.geometry.getAttribute("position");
|
|
@@ -120,10 +122,9 @@ export class Gizmos {
|
|
|
120
122
|
}
|
|
121
123
|
positions.setXYZ(1, pt.x + _tmp.x, pt.y + _tmp.y, pt.z + _tmp.z);
|
|
122
124
|
positions.needsUpdate = true;
|
|
123
|
-
obj.material["color"].set(color);
|
|
124
125
|
obj.material["depthTest"] = depthTest;
|
|
125
126
|
obj.material["depthWrite"] = false;
|
|
126
|
-
|
|
127
|
+
applyGizmoColor(obj.material, color);
|
|
127
128
|
}
|
|
128
129
|
|
|
129
130
|
/**
|
|
@@ -134,17 +135,17 @@ export class Gizmos {
|
|
|
134
135
|
* @param duration the duration in seconds the line will be rendered. If 0 it will be rendered for one frame
|
|
135
136
|
* @param depthTest if true the line will be rendered with depth test
|
|
136
137
|
*/
|
|
137
|
-
static DrawLine(pt0: Vec3, pt1: Vec3, color:
|
|
138
|
+
static DrawLine(pt0: Vec3, pt1: Vec3, color: GizmoColor = defaultColor, duration: number = 0, depthTest: boolean = true) {
|
|
138
139
|
if (!Gizmos.enabled) return;
|
|
139
140
|
const obj = Internal.getLine(duration);
|
|
140
141
|
const positions = obj.geometry.getAttribute("position");
|
|
141
142
|
positions.setXYZ(0, pt0.x, pt0.y, pt0.z);
|
|
142
143
|
positions.setXYZ(1, pt1.x, pt1.y, pt1.z);
|
|
143
144
|
positions.needsUpdate = true;
|
|
144
|
-
obj.material["color"].set(color);
|
|
145
145
|
obj.material["depthTest"] = depthTest;
|
|
146
146
|
obj.material["depthWrite"] = false;
|
|
147
147
|
obj.material["fog"] = false;
|
|
148
|
+
applyGizmoColor(obj.material, color);
|
|
148
149
|
}
|
|
149
150
|
|
|
150
151
|
/**
|
|
@@ -162,10 +163,10 @@ export class Gizmos {
|
|
|
162
163
|
obj.position.set(pt0.x, pt0.y, pt0.z);
|
|
163
164
|
obj.scale.set(radius, radius, radius);
|
|
164
165
|
obj.quaternion.setFromUnitVectors(this._up, _tmp.set(normal.x, normal.y, normal.z).normalize());
|
|
165
|
-
obj.material["color"].set(color);
|
|
166
166
|
obj.material["depthTest"] = depthTest;
|
|
167
167
|
obj.material["depthWrite"] = false;
|
|
168
168
|
obj.material["fog"] = false;
|
|
169
|
+
applyGizmoColor(obj.material, color);
|
|
169
170
|
}
|
|
170
171
|
|
|
171
172
|
/**
|
|
@@ -176,14 +177,14 @@ export class Gizmos {
|
|
|
176
177
|
* @param duration the duration in seconds the sphere will be rendered. If 0 it will be rendered for one frame
|
|
177
178
|
* @param depthTest if true the sphere will be rendered with depth test
|
|
178
179
|
*/
|
|
179
|
-
static DrawWireSphere(center: Vec3, radius: number, color:
|
|
180
|
+
static DrawWireSphere(center: Vec3, radius: number, color: GizmoColor = defaultColor, duration: number = 0, depthTest: boolean = true) {
|
|
180
181
|
if (!Gizmos.enabled) return;
|
|
181
182
|
const obj = Internal.getSphere(radius, duration, true);
|
|
182
183
|
setWorldPositionXYZ(obj, center.x, center.y, center.z);
|
|
183
|
-
obj.material["color"].set(color);
|
|
184
184
|
obj.material["depthTest"] = depthTest;
|
|
185
185
|
obj.material["depthWrite"] = false;
|
|
186
186
|
obj.material["fog"] = false;
|
|
187
|
+
applyGizmoColor(obj.material, color);
|
|
187
188
|
}
|
|
188
189
|
|
|
189
190
|
/**
|
|
@@ -194,13 +195,13 @@ export class Gizmos {
|
|
|
194
195
|
* @param duration the duration in seconds the sphere will be rendered. If 0 it will be rendered for one frame
|
|
195
196
|
* @param depthTest if true the sphere will be rendered with depth test
|
|
196
197
|
*/
|
|
197
|
-
static DrawSphere(center: Vec3, radius: number, color:
|
|
198
|
+
static DrawSphere(center: Vec3, radius: number, color: GizmoColor = defaultColor, duration: number = 0, depthTest: boolean = true) {
|
|
198
199
|
if (!Gizmos.enabled) return;
|
|
199
200
|
const obj = Internal.getSphere(radius, duration, false);
|
|
200
201
|
setWorldPositionXYZ(obj, center.x, center.y, center.z);
|
|
201
|
-
obj.material["color"].set(color);
|
|
202
202
|
obj.material["depthTest"] = depthTest;
|
|
203
203
|
obj.material["depthWrite"] = false;
|
|
204
|
+
applyGizmoColor(obj.material, color);
|
|
204
205
|
}
|
|
205
206
|
|
|
206
207
|
/**
|
|
@@ -212,18 +213,18 @@ export class Gizmos {
|
|
|
212
213
|
* @param duration the duration in seconds the box will be rendered. If 0 it will be rendered for one frame
|
|
213
214
|
* @param depthTest if true the box will be rendered with depth test
|
|
214
215
|
*/
|
|
215
|
-
static DrawWireBox(center: Vec3, size: Vec3, color:
|
|
216
|
+
static DrawWireBox(center: Vec3, size: Vec3, color: GizmoColor = defaultColor, duration: number = 0, depthTest: boolean = true, rotation: Quaternion | undefined = undefined) {
|
|
216
217
|
if (!Gizmos.enabled) return;
|
|
217
218
|
const obj = Internal.getBox(duration);
|
|
218
219
|
obj.position.set(center.x, center.y, center.z);
|
|
219
220
|
obj.scale.set(size.x, size.y, size.z);
|
|
220
|
-
if(rotation) obj.quaternion.copy(rotation);
|
|
221
|
+
if (rotation) obj.quaternion.copy(rotation);
|
|
221
222
|
else obj.quaternion.identity();
|
|
222
|
-
obj.material["color"].set(color);
|
|
223
223
|
obj.material["depthTest"] = depthTest;
|
|
224
224
|
obj.material["wireframe"] = true;
|
|
225
225
|
obj.material["depthWrite"] = false;
|
|
226
226
|
obj.material["fog"] = false;
|
|
227
|
+
applyGizmoColor(obj.material, color);
|
|
227
228
|
}
|
|
228
229
|
|
|
229
230
|
/**
|
|
@@ -233,16 +234,16 @@ export class Gizmos {
|
|
|
233
234
|
* @param duration the duration in seconds the box will be rendered. If 0 it will be rendered for one frame. Default: 0
|
|
234
235
|
* @param depthTest if true the box will be rendered with depth test. Default: true
|
|
235
236
|
*/
|
|
236
|
-
static DrawWireBox3(box: Box3, color:
|
|
237
|
+
static DrawWireBox3(box: Box3, color: GizmoColor = defaultColor, duration: number = 0, depthTest: boolean = true) {
|
|
237
238
|
if (!Gizmos.enabled) return;
|
|
238
239
|
const obj = Internal.getBox(duration);
|
|
239
240
|
obj.position.copy(box.getCenter(_tmp));
|
|
240
241
|
obj.scale.copy(box.getSize(_tmp));
|
|
241
|
-
obj.material["color"].set(color);
|
|
242
242
|
obj.material["depthTest"] = depthTest;
|
|
243
243
|
obj.material["wireframe"] = true;
|
|
244
244
|
obj.material["depthWrite"] = false;
|
|
245
245
|
obj.material["fog"] = false;
|
|
246
|
+
applyGizmoColor(obj.material, color);
|
|
246
247
|
}
|
|
247
248
|
|
|
248
249
|
private static _up = new Vector3(0, 1, 0);
|
|
@@ -263,9 +264,9 @@ export class Gizmos {
|
|
|
263
264
|
const dist = _tmp.set(pt1.x, pt1.y, pt1.z).sub(_tmp2.set(pt0.x, pt0.y, pt0.z)).length();
|
|
264
265
|
const scale = dist * 0.1;
|
|
265
266
|
obj.scale.set(scale, scale, scale);
|
|
266
|
-
obj.material["color"].set(color);
|
|
267
267
|
obj.material["depthTest"] = depthTest;
|
|
268
268
|
obj.material["wireframe"] = wireframe;
|
|
269
|
+
applyGizmoColor(obj.material, color);
|
|
269
270
|
this.DrawLine(pt0, pt1, color, duration, depthTest);
|
|
270
271
|
}
|
|
271
272
|
|
|
@@ -296,9 +297,9 @@ export class Gizmos {
|
|
|
296
297
|
}
|
|
297
298
|
mesh.matrixAutoUpdate = false;
|
|
298
299
|
mesh.matrixWorldAutoUpdate = false;
|
|
299
|
-
mesh.material["color"].set(options.color ?? defaultColor);
|
|
300
300
|
mesh.material["depthTest"] = options.depthTest ?? true;
|
|
301
301
|
mesh.material["wireframe"] = true;
|
|
302
|
+
applyGizmoColor(mesh.material, options.color ?? defaultColor);
|
|
302
303
|
}
|
|
303
304
|
}
|
|
304
305
|
|
|
@@ -316,6 +317,19 @@ export function CreateWireCube(col: ColorRepresentation | null = null): LineSegm
|
|
|
316
317
|
}
|
|
317
318
|
|
|
318
319
|
|
|
320
|
+
function applyGizmoColor(material: Material | Material[], color: GizmoColor) {
|
|
321
|
+
if (Array.isArray(material)) {
|
|
322
|
+
for (const mat of material) {
|
|
323
|
+
applyGizmoColor(mat, color);
|
|
324
|
+
}
|
|
325
|
+
return;
|
|
326
|
+
}
|
|
327
|
+
const alpha = (color instanceof RGBAColor) ? color.a : 1.0;
|
|
328
|
+
material["color"].set(color);
|
|
329
|
+
material["opacity"] = alpha;
|
|
330
|
+
material["transparent"] = alpha < 1.0;
|
|
331
|
+
}
|
|
332
|
+
|
|
319
333
|
|
|
320
334
|
const $cacheSymbol = Symbol("GizmoCache");
|
|
321
335
|
class Internal {
|
|
@@ -335,7 +349,7 @@ class Internal {
|
|
|
335
349
|
}
|
|
336
350
|
}
|
|
337
351
|
|
|
338
|
-
static getTextLabel(duration: number, text: string, size: number, color: ColorRepresentation, backgroundColor?: ColorRepresentation |
|
|
352
|
+
static getTextLabel(duration: number, text: string, size: number, color: ColorRepresentation, backgroundColor?: ColorRepresentation | GizmoColor): Text & LabelHandle {
|
|
339
353
|
this.ensureFont();
|
|
340
354
|
let element = this.textLabelCache.pop();
|
|
341
355
|
|
|
@@ -342,7 +342,7 @@ async function sendUsageMessageToAnalyticsBackend(context: IContext) {
|
|
|
342
342
|
if (window.crossOriginIsolated) return;
|
|
343
343
|
|
|
344
344
|
const licenseType = NEEDLE_ENGINE_LICENSE_TYPE;
|
|
345
|
-
if (licenseType === "pro") {
|
|
345
|
+
if (licenseType === "pro" || licenseType === "enterprise") {
|
|
346
346
|
const attribute = context?.domElement?.getAttribute("no-telemetry");
|
|
347
347
|
if (attribute === "" || attribute === "true" || attribute === "1") {
|
|
348
348
|
if (debug) console.debug("Telemetry is disabled");
|
|
@@ -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 { Context } from "./engine_setup.js";
|
|
4
|
+
import type { 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
|
|
31
|
-
private
|
|
30
|
+
private readonly context: Context;
|
|
31
|
+
private readonly map: Map<SourceIdentifier, Map<LightmapType, Texture[]>> = new Map();
|
|
32
32
|
|
|
33
33
|
clear() {
|
|
34
|
-
this.
|
|
34
|
+
this.map.clear();
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
constructor(context: Context) {
|
|
38
|
-
this.
|
|
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.
|
|
44
|
-
this.
|
|
45
|
-
const map = this.
|
|
43
|
+
if (!this.map.has(sourceId))
|
|
44
|
+
this.map.set(sourceId, new Map());
|
|
45
|
+
const map = this.map.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.
|
|
58
|
+
if (debugLightmap) console.log("[Get Skybox]", sourceId, this.map)
|
|
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.
|
|
63
|
+
if (debugLightmap) console.log("[Get Reflection]", sourceId, this.map)
|
|
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.
|
|
72
|
+
const entry = this.map.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,6 +67,7 @@ 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]);
|
|
70
71
|
if (!obj) return;
|
|
71
72
|
this.validate();
|
|
72
73
|
const body = obj[$bodyKey];
|
|
@@ -901,6 +902,8 @@ export class RapierPhysics implements IPhysicsEngine {
|
|
|
901
902
|
// set the collider layers
|
|
902
903
|
this.updateColliderCollisionGroups(collider);
|
|
903
904
|
|
|
905
|
+
if (debugPhysics) console.log("Created collider", collider.name, col);
|
|
906
|
+
|
|
904
907
|
return col;
|
|
905
908
|
}
|
|
906
909
|
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) {
|
|
165
|
+
internalEnableReflection(sourceId: SourceIdentifier) : Texture | null {
|
|
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;
|
|
184
|
+
return tex;
|
|
185
185
|
}
|
|
186
186
|
else if (debug) console.warn("Could not find reflection for source", sourceId);
|
|
187
187
|
break;
|
|
@@ -196,22 +196,21 @@ export class RendererData {
|
|
|
196
196
|
tex.colorSpace = SRGBColorSpace;
|
|
197
197
|
tex.mapping = EquirectangularReflectionMapping;
|
|
198
198
|
this.context.scene.environment = tex;
|
|
199
|
+
return tex;
|
|
199
200
|
}
|
|
200
201
|
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;
|
|
208
209
|
}
|
|
209
210
|
else console.error("Missing ambientlight", settings.sourceId);
|
|
210
|
-
return;
|
|
211
|
-
default:
|
|
212
|
-
return;
|
|
213
211
|
}
|
|
214
212
|
}
|
|
213
|
+
return null;
|
|
215
214
|
}
|
|
216
215
|
|
|
217
216
|
/** @internal */
|