@needle-tools/engine 2.33.0-pre → 2.35.0-pre
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 +20 -0
- package/dist/needle-engine.d.ts +3045 -2855
- package/dist/needle-engine.js +457 -407
- package/dist/needle-engine.js.map +4 -4
- package/dist/needle-engine.min.js +117 -67
- package/dist/needle-engine.min.js.map +4 -4
- package/lib/engine/api.d.ts +3 -0
- package/lib/engine/api.js +4 -0
- package/lib/engine/api.js.map +1 -0
- package/lib/engine/engine.d.ts +4 -3
- package/lib/engine/engine_addressables.d.ts +5 -4
- package/lib/engine/engine_addressables.js +8 -7
- package/lib/engine/engine_addressables.js.map +1 -1
- package/lib/engine/engine_components.d.ts +16 -0
- package/lib/engine/engine_components.js +223 -0
- package/lib/engine/engine_components.js.map +1 -0
- package/lib/engine/engine_create_objects.d.ts +11 -0
- package/lib/engine/engine_create_objects.js +20 -0
- package/lib/engine/engine_create_objects.js.map +1 -0
- package/lib/engine/engine_element.js +2 -2
- package/lib/engine/engine_element.js.map +1 -1
- package/lib/engine/engine_gameobject.d.ts +33 -0
- package/lib/engine/engine_gameobject.js +449 -0
- package/lib/engine/engine_gameobject.js.map +1 -0
- package/lib/engine/engine_gltf.d.ts +13 -2
- package/lib/engine/engine_gltf.js +7 -1
- package/lib/engine/engine_gltf.js.map +1 -1
- package/lib/engine/engine_gltf_builtin_components.d.ts +3 -3
- package/lib/engine/engine_gltf_builtin_components.js +2 -3
- package/lib/engine/engine_gltf_builtin_components.js.map +1 -1
- package/lib/engine/engine_instancing.d.ts +5 -0
- package/lib/engine/engine_instancing.js +22 -0
- package/lib/engine/engine_instancing.js.map +1 -0
- package/lib/engine/engine_lightdata.d.ts +1 -1
- package/lib/engine/engine_lightdata.js.map +1 -1
- package/lib/engine/engine_mainloop_utils.d.ts +2 -2
- package/lib/engine/engine_mainloop_utils.js +7 -6
- package/lib/engine/engine_mainloop_utils.js.map +1 -1
- package/lib/engine/engine_networking.d.ts +2 -11
- package/lib/engine/engine_networking.js +1 -7
- package/lib/engine/engine_networking.js.map +1 -1
- package/lib/engine/engine_networking_files.d.ts +1 -1
- package/lib/engine/engine_networking_files.js +8 -7
- package/lib/engine/engine_networking_files.js.map +1 -1
- package/lib/engine/engine_networking_files_default_components.d.ts +2 -2
- package/lib/engine/engine_networking_files_default_components.js +38 -43
- package/lib/engine/engine_networking_files_default_components.js.map +1 -1
- package/lib/engine/engine_networking_instantiate.d.ts +8 -6
- package/lib/engine/engine_networking_instantiate.js +12 -9
- package/lib/engine/engine_networking_instantiate.js.map +1 -1
- package/lib/engine/engine_networking_types.d.ts +14 -0
- package/lib/engine/engine_networking_types.js +8 -0
- package/lib/engine/engine_networking_types.js.map +1 -0
- package/lib/engine/engine_physics.d.ts +1 -23
- package/lib/engine/engine_physics.js +18 -56
- package/lib/engine/engine_physics.js.map +1 -1
- package/lib/engine/engine_rendererdata.d.ts +1 -1
- package/lib/engine/engine_rendererdata.js.map +1 -1
- package/lib/engine/engine_scenetools.d.ts +2 -2
- package/lib/engine/engine_scenetools.js +22 -5
- package/lib/engine/engine_scenetools.js.map +1 -1
- package/lib/engine/engine_serialization_builtin_serializer.d.ts +1 -1
- package/lib/engine/engine_serialization_core.d.ts +1 -1
- package/lib/engine/engine_serialization_decorator.d.ts +1 -1
- package/lib/engine/engine_setup.d.ts +14 -15
- package/lib/engine/engine_setup.js +34 -23
- package/lib/engine/engine_setup.js.map +1 -1
- package/lib/engine/engine_three_utils.js +0 -6
- package/lib/engine/engine_three_utils.js.map +1 -1
- package/lib/engine/engine_types.d.ts +103 -0
- package/lib/engine/engine_types.js +49 -0
- package/lib/engine/engine_types.js.map +1 -0
- package/lib/engine/engine_utils.d.ts +1 -1
- package/lib/engine/engine_utils.js.map +1 -1
- package/lib/engine/extensions/NEEDLE_components.js +2 -2
- package/lib/engine/extensions/NEEDLE_components.js.map +1 -1
- package/lib/engine/extensions/NEEDLE_deferred_texture.d.ts +1 -1
- package/lib/engine/extensions/NEEDLE_lighting_settings.d.ts +1 -1
- package/lib/engine/extensions/NEEDLE_lightmaps.d.ts +1 -1
- package/lib/engine/extensions/NEEDLE_render_objects.d.ts +2 -2
- package/lib/engine/extensions/NEEDLE_techniques_webgl.d.ts +1 -1
- package/lib/engine/extensions/NEEDLE_techniques_webgl.js +3 -2
- package/lib/engine/extensions/NEEDLE_techniques_webgl.js.map +1 -1
- package/lib/engine/extensions/extensions.d.ts +1 -1
- package/lib/engine-components/Animation.js +1 -1
- package/lib/engine-components/Animation.js.map +1 -1
- package/lib/engine-components/Animator.js.map +1 -1
- package/lib/engine-components/AvatarLoader.js +6 -5
- package/lib/engine-components/AvatarLoader.js.map +1 -1
- package/lib/engine-components/Camera.d.ts +2 -2
- package/lib/engine-components/Camera.js +6 -12
- package/lib/engine-components/Camera.js.map +1 -1
- package/lib/engine-components/CameraUtils.d.ts +3 -0
- package/lib/engine-components/CameraUtils.js +15 -0
- package/lib/engine-components/CameraUtils.js.map +1 -0
- package/lib/engine-components/Collider.d.ts +1 -0
- package/lib/engine-components/Collider.js +4 -0
- package/lib/engine-components/Collider.js.map +1 -1
- package/lib/engine-components/Component.d.ts +16 -50
- package/lib/engine-components/Component.js +67 -465
- package/lib/engine-components/Component.js.map +1 -1
- package/lib/engine-components/DragControls.js +1 -1
- package/lib/engine-components/DragControls.js.map +1 -1
- package/lib/engine-components/Duplicatable.js +2 -1
- package/lib/engine-components/Duplicatable.js.map +1 -1
- package/lib/engine-components/LODGroup.js.map +1 -1
- package/lib/engine-components/Light.d.ts +2 -1
- package/lib/engine-components/Light.js +2 -2
- package/lib/engine-components/Light.js.map +1 -1
- package/lib/engine-components/NestedGltf.js +2 -1
- package/lib/engine-components/NestedGltf.js.map +1 -1
- package/lib/engine-components/OrbitControls.js +4 -2
- package/lib/engine-components/OrbitControls.js.map +1 -1
- package/lib/engine-components/Renderer.d.ts +3 -5
- package/lib/engine-components/Renderer.js +3 -20
- package/lib/engine-components/Renderer.js.map +1 -1
- package/lib/engine-components/{Rigidbody.d.ts → RigidBody.d.ts} +2 -1
- package/lib/engine-components/{Rigidbody.js → RigidBody.js} +1 -1
- package/lib/engine-components/{Rigidbody.js.map → RigidBody.js.map} +1 -1
- package/lib/engine-components/ScreenCapture.d.ts +0 -10
- package/lib/engine-components/ScreenCapture.js +8 -75
- package/lib/engine-components/ScreenCapture.js.map +1 -1
- package/lib/engine-components/SpectatorCamera.js.map +1 -1
- package/lib/engine-components/SyncedCamera.js +3 -2
- package/lib/engine-components/SyncedCamera.js.map +1 -1
- package/lib/engine-components/SyncedTransform.js +1 -1
- package/lib/engine-components/SyncedTransform.js.map +1 -1
- package/lib/engine-components/TestRunner.js.map +1 -1
- package/lib/engine-components/VideoPlayer.d.ts +14 -3
- package/lib/engine-components/VideoPlayer.js +390 -47
- package/lib/engine-components/VideoPlayer.js.map +1 -1
- package/lib/engine-components/Voip.js +2 -1
- package/lib/engine-components/Voip.js.map +1 -1
- package/lib/engine-components/WebARSessionRoot.js +1 -1
- package/lib/engine-components/WebARSessionRoot.js.map +1 -1
- package/lib/engine-components/WebXR.js.map +1 -1
- package/lib/engine-components/WebXRAvatar.js +1 -1
- package/lib/engine-components/WebXRAvatar.js.map +1 -1
- package/lib/engine-components/WebXRController.d.ts +1 -0
- package/lib/engine-components/WebXRController.js +40 -9
- package/lib/engine-components/WebXRController.js.map +1 -1
- package/lib/engine-components/WebXRGrabRendering.d.ts +1 -1
- package/lib/engine-components/WebXRGrabRendering.js +1 -1
- package/lib/engine-components/WebXRGrabRendering.js.map +1 -1
- package/lib/engine-components/WebXRSync.js +1 -1
- package/lib/engine-components/WebXRSync.js.map +1 -1
- package/lib/engine-components/avatar/Avatar_Brain_LookAt.js.map +1 -1
- package/lib/engine-components/codegen/components.d.ts +1 -2
- package/lib/engine-components/codegen/components.js +1 -2
- package/lib/engine-components/codegen/components.js.map +1 -1
- package/lib/engine-components/js-extensions/ExtensionUtils.d.ts +4 -0
- package/lib/engine-components/js-extensions/ExtensionUtils.js +56 -0
- package/lib/engine-components/js-extensions/ExtensionUtils.js.map +1 -0
- package/lib/engine-components/js-extensions/Object3D.js +16 -41
- package/lib/engine-components/js-extensions/Object3D.js.map +1 -1
- package/lib/engine-components/js-extensions/Vector.d.ts +2 -0
- package/lib/engine-components/js-extensions/Vector.js +16 -0
- package/lib/engine-components/js-extensions/Vector.js.map +1 -0
- package/lib/engine-components/timeline/PlayableDirector.d.ts +2 -1
- package/lib/engine-components/timeline/PlayableDirector.js.map +1 -1
- package/lib/engine-components/ui/BaseUIComponent.d.ts +1 -0
- package/lib/engine-components/ui/BaseUIComponent.js +11 -5
- package/lib/engine-components/ui/BaseUIComponent.js.map +1 -1
- package/lib/engine-components/ui/Canvas.d.ts +3 -0
- package/lib/engine-components/ui/Canvas.js +12 -1
- package/lib/engine-components/ui/Canvas.js.map +1 -1
- package/lib/engine-components/ui/CanvasScaler.d.ts +0 -0
- package/lib/engine-components/ui/CanvasScaler.js +17 -0
- package/lib/engine-components/ui/CanvasScaler.js.map +1 -0
- package/lib/engine-components/ui/EventSystem.d.ts +4 -1
- package/lib/engine-components/ui/EventSystem.js +28 -39
- package/lib/engine-components/ui/EventSystem.js.map +1 -1
- package/lib/engine-components/ui/Graphic.js +2 -1
- package/lib/engine-components/ui/Graphic.js.map +1 -1
- package/lib/engine-components/ui/Keyboard.js +2 -1
- package/lib/engine-components/ui/Keyboard.js.map +1 -1
- package/lib/engine-components/ui/RaycastUtils.d.ts +11 -0
- package/lib/engine-components/ui/RaycastUtils.js +62 -0
- package/lib/engine-components/ui/RaycastUtils.js.map +1 -0
- package/lib/engine-components/ui/Raycaster.js.map +1 -1
- package/lib/engine-components/ui/Text.js +8 -3
- package/lib/engine-components/ui/Text.js.map +1 -1
- package/lib/engine-components/ui/Utils.js +3 -2
- package/lib/engine-components/ui/Utils.js.map +1 -1
- package/lib/needle-engine.d.ts +3 -1
- package/lib/needle-engine.js +4 -2
- package/lib/needle-engine.js.map +1 -1
- package/package.json +13 -2
- package/src/engine/api.ts +3 -0
- package/src/engine/codegen/register_types.js +4 -6
- package/src/engine/engine_addressables.ts +12 -10
- package/src/engine/{engine_components.js → engine_components.ts} +37 -47
- package/src/engine/engine_create_objects.ts +27 -0
- package/src/engine/engine_element.ts +2 -2
- package/src/engine/engine_gameobject.ts +506 -0
- package/src/engine/engine_gltf.ts +21 -2
- package/src/engine/engine_gltf_builtin_components.ts +8 -7
- package/src/engine/engine_instancing.ts +25 -0
- package/src/engine/engine_lightdata.ts +1 -1
- package/src/engine/engine_mainloop_utils.ts +13 -11
- package/src/engine/engine_networking.ts +3 -14
- package/src/engine/engine_networking_files.ts +14 -11
- package/src/engine/engine_networking_files_default_components.ts +53 -52
- package/src/engine/engine_networking_instantiate.ts +24 -14
- package/src/engine/engine_networking_types.ts +19 -0
- package/src/engine/engine_physics.ts +21 -75
- package/src/engine/engine_rendererdata.ts +1 -1
- package/src/engine/engine_scenetools.ts +30 -6
- package/src/engine/engine_serialization_core.ts +1 -1
- package/src/engine/engine_serialization_decorator.ts +1 -1
- package/src/engine/engine_setup.ts +51 -37
- package/src/engine/engine_three_utils.ts +0 -8
- package/src/engine/engine_types.ts +180 -0
- package/src/engine/engine_utils.ts +1 -3
- package/src/engine/extensions/NEEDLE_components.ts +2 -2
- package/src/engine/extensions/NEEDLE_deferred_texture.ts +1 -1
- package/src/engine/extensions/NEEDLE_lighting_settings.ts +1 -1
- package/src/engine/extensions/NEEDLE_lightmaps.ts +1 -1
- package/src/engine/extensions/NEEDLE_render_objects.ts +4 -4
- package/src/engine/extensions/NEEDLE_techniques_webgl.ts +5 -4
- package/src/engine/extensions/extensions.ts +1 -1
- package/src/engine-components/Animation.ts +1 -1
- package/src/engine-components/Animator.ts +3 -3
- package/src/engine-components/AvatarLoader.ts +6 -5
- package/src/engine-components/Camera.ts +10 -13
- package/src/engine-components/CameraUtils.ts +15 -0
- package/src/engine-components/Collider.ts +5 -0
- package/src/engine-components/Component.ts +83 -535
- package/src/engine-components/DragControls.ts +1 -1
- package/src/engine-components/Duplicatable.ts +4 -3
- package/src/engine-components/LODGroup.ts +1 -1
- package/src/engine-components/Light.ts +3 -2
- package/src/engine-components/NestedGltf.ts +2 -1
- package/src/engine-components/OrbitControls.ts +5 -5
- package/src/engine-components/Renderer.ts +7 -21
- package/src/engine-components/RigidBody.ts +2 -1
- package/src/engine-components/ScreenCapture.ts +11 -77
- package/src/engine-components/SpectatorCamera.ts +7 -5
- package/src/engine-components/SyncedCamera.ts +3 -2
- package/src/engine-components/SyncedTransform.ts +2 -2
- package/src/engine-components/TestRunner.ts +1 -2
- package/src/engine-components/VideoPlayer.ts +401 -48
- package/src/engine-components/Voip.ts +2 -1
- package/src/engine-components/WebARSessionRoot.ts +1 -1
- package/src/engine-components/WebXR.ts +2 -2
- package/src/engine-components/WebXRAvatar.ts +1 -1
- package/src/engine-components/WebXRController.ts +40 -10
- package/src/engine-components/WebXRGrabRendering.ts +1 -1
- package/src/engine-components/WebXRSync.ts +1 -1
- package/src/engine-components/avatar/Avatar_Brain_LookAt.ts +2 -1
- package/src/engine-components/codegen/components.ts +1 -2
- package/src/engine-components/js-extensions/ExtensionUtils.ts +66 -0
- package/src/engine-components/js-extensions/Object3D.ts +22 -48
- package/src/engine-components/js-extensions/Vector.ts +17 -0
- package/src/engine-components/timeline/PlayableDirector.ts +2 -1
- package/src/engine-components/ui/BaseUIComponent.ts +17 -6
- package/src/engine-components/ui/Canvas.ts +14 -2
- package/src/engine-components/ui/CanvasScaler.ts +21 -0
- package/src/engine-components/ui/EventSystem.ts +30 -35
- package/src/engine-components/ui/Graphic.ts +2 -1
- package/src/engine-components/ui/Keyboard.ts +2 -1
- package/src/engine-components/ui/RaycastUtils.ts +64 -0
- package/src/engine-components/ui/Raycaster.ts +2 -0
- package/src/engine-components/ui/Text.ts +8 -4
- package/src/engine-components/ui/Utils.ts +3 -2
- package/src/needle-engine.ts +7 -2
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { Context } from './engine_setup';
|
|
2
2
|
import * as utils from "./engine_generic_utils";
|
|
3
3
|
import * as constants from "./engine_constants";
|
|
4
|
-
import { Behaviour, Component, GameObject } from '../engine-components/Component';
|
|
5
4
|
import { getParam } from './engine_utils';
|
|
6
5
|
import { Object3D } from 'three';
|
|
6
|
+
import { IComponent } from './engine_types';
|
|
7
|
+
import { isActiveSelf } from './engine_gameobject';
|
|
7
8
|
|
|
8
9
|
const debug = getParam("debugnewscripts");
|
|
9
10
|
|
|
@@ -38,7 +39,7 @@ export function processNewScripts(context: Context) {
|
|
|
38
39
|
// Check valid scripts and add all valid to the scripts array
|
|
39
40
|
for (let i = 0; i < new_scripts_buffer.length; i++) {
|
|
40
41
|
try {
|
|
41
|
-
const script:
|
|
42
|
+
const script: IComponent = new_scripts_buffer[i];
|
|
42
43
|
if (script.destroyed) continue;
|
|
43
44
|
if (!script.gameObject) {
|
|
44
45
|
console.error("MISSING GAMEOBJECT - will ignore", script);
|
|
@@ -61,7 +62,7 @@ export function processNewScripts(context: Context) {
|
|
|
61
62
|
// Awake
|
|
62
63
|
for (let i = 0; i < new_scripts_buffer.length; i++) {
|
|
63
64
|
try {
|
|
64
|
-
const script:
|
|
65
|
+
const script: IComponent = new_scripts_buffer[i];
|
|
65
66
|
if (script.destroyed) {
|
|
66
67
|
removeScriptFromContext(new_scripts_buffer[i], context);
|
|
67
68
|
new_scripts_buffer.splice(i, 1);
|
|
@@ -89,7 +90,7 @@ export function processNewScripts(context: Context) {
|
|
|
89
90
|
// OnEnable
|
|
90
91
|
for (let i = 0; i < new_scripts_buffer.length; i++) {
|
|
91
92
|
try {
|
|
92
|
-
const script:
|
|
93
|
+
const script: IComponent = new_scripts_buffer[i];
|
|
93
94
|
if (script.destroyed) continue;
|
|
94
95
|
// console.log(script, script.enabled, script.activeAndEnabled);
|
|
95
96
|
if (script.enabled === false) continue;
|
|
@@ -138,7 +139,7 @@ export function processNewScripts(context: Context) {
|
|
|
138
139
|
context.new_scripts_post_setup_callbacks.length = 0;
|
|
139
140
|
}
|
|
140
141
|
|
|
141
|
-
export function processRemoveFromScene(script:
|
|
142
|
+
export function processRemoveFromScene(script: IComponent) {
|
|
142
143
|
if (!script) return;
|
|
143
144
|
script.__internalDisable();
|
|
144
145
|
removeScriptFromContext(script, script.context);
|
|
@@ -217,7 +218,7 @@ export function updateIsActive() {
|
|
|
217
218
|
function updateIsActiveInHierarchyRecursiveRuntime(go: THREE.Object3D, activeInHierarchy: boolean, allowEventCall: boolean) {
|
|
218
219
|
let activeStateChanged: boolean = false;
|
|
219
220
|
|
|
220
|
-
const active =
|
|
221
|
+
const active = isActiveSelf(go);
|
|
221
222
|
// if (activeInHierarchy) {
|
|
222
223
|
// const prevActive = previousActiveMap[go.uuid];
|
|
223
224
|
// if (prevActive !== undefined) {
|
|
@@ -238,7 +239,7 @@ function updateIsActiveInHierarchyRecursiveRuntime(go: THREE.Object3D, activeInH
|
|
|
238
239
|
previousActiveMap[go.uuid] = active;
|
|
239
240
|
|
|
240
241
|
|
|
241
|
-
if (activeInHierarchy) activeInHierarchy =
|
|
242
|
+
if (activeInHierarchy) activeInHierarchy = isActiveSelf(go);
|
|
242
243
|
go[constants.activeInHierarchyFieldName] = activeInHierarchy;
|
|
243
244
|
|
|
244
245
|
// only raise events here if we didnt call enable etc already
|
|
@@ -250,9 +251,10 @@ function updateIsActiveInHierarchyRecursiveRuntime(go: THREE.Object3D, activeInH
|
|
|
250
251
|
perComponent(go, comp => {
|
|
251
252
|
if (activeInHierarchy) {
|
|
252
253
|
utils.safeInvoke(comp.__internalAwake.bind(comp));
|
|
253
|
-
comp.
|
|
254
|
+
comp.enabled = true;
|
|
255
|
+
// comp.onEnable();
|
|
254
256
|
}
|
|
255
|
-
else comp.
|
|
257
|
+
else comp.enabled = false;
|
|
256
258
|
});
|
|
257
259
|
}
|
|
258
260
|
}
|
|
@@ -274,7 +276,7 @@ export function updateActiveInHierarchyWithoutEventCall(go: THREE.Object3D) {
|
|
|
274
276
|
while (current) {
|
|
275
277
|
if (!current) break;
|
|
276
278
|
if (current.type === "Scene") foundScene = true;
|
|
277
|
-
if (!
|
|
279
|
+
if (!isActiveSelf(current)) {
|
|
278
280
|
activeInHierarchy = false;
|
|
279
281
|
break;
|
|
280
282
|
}
|
|
@@ -287,7 +289,7 @@ export function updateActiveInHierarchyWithoutEventCall(go: THREE.Object3D) {
|
|
|
287
289
|
go[constants.activeInHierarchyFieldName] = activeInHierarchy && foundScene;
|
|
288
290
|
}
|
|
289
291
|
|
|
290
|
-
function perComponent(go: THREE.Object3D, evt: (comp:
|
|
292
|
+
function perComponent(go: THREE.Object3D, evt: (comp: IComponent) => void) {
|
|
291
293
|
if (go.userData?.components) {
|
|
292
294
|
for (const comp of go.userData.components) {
|
|
293
295
|
evt(comp);
|
|
@@ -6,21 +6,17 @@ let serverUrl = 'wss://needle-tiny-starter.glitch.me/socket';
|
|
|
6
6
|
import { Websocket, WebsocketBuilder } from 'websocket-ts';
|
|
7
7
|
import { Behaviour, GameObject } from '../engine-components/Component';
|
|
8
8
|
import { Networking } from '../engine-components/Networking';
|
|
9
|
-
import { Context
|
|
9
|
+
import { Context } from './engine_setup';
|
|
10
10
|
import * as utils from "./engine_utils";
|
|
11
11
|
import * as flatbuffers from 'flatbuffers';
|
|
12
12
|
import * as schemes from "../engine-schemes/schemes";
|
|
13
13
|
import { PeerNetworking } from './engine_networking_peer';
|
|
14
|
+
import { IModel, INetworkConnection, SendQueue } from './engine_networking_types';
|
|
14
15
|
|
|
15
16
|
export const debugNet = utils.getParam("debugnet") ? true : false;
|
|
16
17
|
export const debugOwner = debugNet || utils.getParam("debugowner") ? true : false;
|
|
17
18
|
|
|
18
19
|
|
|
19
|
-
export declare interface IModel {
|
|
20
|
-
guid: string;
|
|
21
|
-
dontSave?: boolean; // if set to true the model will not be saved in the server room state
|
|
22
|
-
}
|
|
23
|
-
|
|
24
20
|
export declare interface IConnectionData {
|
|
25
21
|
id: string;
|
|
26
22
|
}
|
|
@@ -225,18 +221,11 @@ export class OwnershipModel {
|
|
|
225
221
|
}
|
|
226
222
|
|
|
227
223
|
|
|
228
|
-
export enum SendQueue {
|
|
229
|
-
OnConnection,
|
|
230
|
-
OnRoomJoin,
|
|
231
|
-
Queued,
|
|
232
|
-
Immediate,
|
|
233
|
-
}
|
|
234
|
-
|
|
235
224
|
export declare type BinaryCallback = {
|
|
236
225
|
(data: any | flatbuffers.ByteBuffer): void;
|
|
237
226
|
}
|
|
238
227
|
|
|
239
|
-
export class NetworkConnection {
|
|
228
|
+
export class NetworkConnection implements INetworkConnection {
|
|
240
229
|
|
|
241
230
|
private context: Context;
|
|
242
231
|
private _peer: PeerNetworking | null = null;
|
|
@@ -1,12 +1,15 @@
|
|
|
1
|
-
import { GameObject } from "../engine-components/Component";
|
|
2
1
|
import { Context } from "../engine/engine_setup";
|
|
3
|
-
import { loadSync, parseSync } from "../engine/engine_scenetools";
|
|
2
|
+
// import { loadSync, parseSync } from "../engine/engine_scenetools";
|
|
4
3
|
import * as THREE from "three";
|
|
5
4
|
import * as web from "../engine/engine_web_api";
|
|
6
|
-
import {
|
|
5
|
+
import { NetworkConnection } from "../engine/engine_networking";
|
|
7
6
|
import { generateSeed, InstantiateIdProvider } from "../engine/engine_networking_instantiate";
|
|
8
7
|
import * as def from "./engine_networking_files_default_components"
|
|
9
8
|
import { GLTF } from 'three/examples/jsm/loaders/GLTFLoader.js'
|
|
9
|
+
import { getLoader } from "../engine/engine_gltf";
|
|
10
|
+
import { IModel } from "./engine_networking_types";
|
|
11
|
+
import { IGameObject } from "./engine_types";
|
|
12
|
+
import { findByGuid } from "./engine_gameobject";
|
|
10
13
|
|
|
11
14
|
export enum File_Event {
|
|
12
15
|
File_Spawned = "file-spawned",
|
|
@@ -50,9 +53,9 @@ export async function addFile(file: File, context: Context, backendUrl?: string)
|
|
|
50
53
|
// first load it locally
|
|
51
54
|
const seed = generateSeed();
|
|
52
55
|
const prov = new InstantiateIdProvider(seed);
|
|
53
|
-
const gltf: GLTF = await loadSync(context, content, prov, true) as GLTF;
|
|
56
|
+
const gltf: GLTF = await getLoader().loadSync(context, content, prov, true) as GLTF;
|
|
54
57
|
if (gltf && gltf.scene) {
|
|
55
|
-
const obj = gltf.scene as unknown as
|
|
58
|
+
const obj = gltf.scene as unknown as IGameObject;
|
|
56
59
|
// if we dont have a guid yet (because components guids are actually created in a callback a bit later)
|
|
57
60
|
// we just use the same seed and generate a guid for the root only
|
|
58
61
|
// this should be the exact same guid the instantiate call will produce
|
|
@@ -81,9 +84,9 @@ export async function addFileFromUrl(url: URL, context: Context): Promise<GLTF |
|
|
|
81
84
|
return new Promise(async (resolve, _reject) => {
|
|
82
85
|
const seed = generateSeed();
|
|
83
86
|
const prov = new InstantiateIdProvider(seed);
|
|
84
|
-
const gltf: GLTF = await loadSync(context, url.toString(), prov, true) as GLTF;
|
|
87
|
+
const gltf: GLTF = await getLoader().loadSync(context, url.toString(), prov, true) as GLTF;
|
|
85
88
|
if (gltf && gltf.scene) {
|
|
86
|
-
const obj = gltf.scene as unknown as
|
|
89
|
+
const obj = gltf.scene as unknown as IGameObject;
|
|
87
90
|
// handleUpload(context.connection, file, seed, obj); // TODO needs to upload the URL only and store that
|
|
88
91
|
def.onDynamicObjectAdded(obj, prov, gltf);
|
|
89
92
|
resolve(gltf);
|
|
@@ -108,7 +111,7 @@ export function beginListenFileSpawn(context: Context) {
|
|
|
108
111
|
}
|
|
109
112
|
if (bin) {
|
|
110
113
|
const prov = new InstantiateIdProvider(evt.seed);
|
|
111
|
-
const gltf = await parseSync(context, bin, null!, prov);
|
|
114
|
+
const gltf = await getLoader().parseSync(context, bin, null!, prov);
|
|
112
115
|
if (gltf && gltf.scene) {
|
|
113
116
|
const obj = gltf.scene;
|
|
114
117
|
def.onDynamicObjectAdded(obj, prov, gltf);
|
|
@@ -118,7 +121,7 @@ export function beginListenFileSpawn(context: Context) {
|
|
|
118
121
|
|
|
119
122
|
// add object to proper parent
|
|
120
123
|
if (evt.parentGuid) {
|
|
121
|
-
const parent =
|
|
124
|
+
const parent = findByGuid(evt.parentGuid, context.scene) as THREE.Object3D;
|
|
122
125
|
if ("add" in parent) parent.add(obj);
|
|
123
126
|
}
|
|
124
127
|
if (!obj.parent)
|
|
@@ -136,7 +139,7 @@ export function beginListenFileSpawn(context: Context) {
|
|
|
136
139
|
|
|
137
140
|
|
|
138
141
|
|
|
139
|
-
async function handleUpload(connection: NetworkConnection, file: File, seed: number, obj:
|
|
142
|
+
async function handleUpload(connection: NetworkConnection, file: File, seed: number, obj: IGameObject, backendUrl: string) {
|
|
140
143
|
if (!connection.connectionId) {
|
|
141
144
|
console.error("Can not upload file - no connection id");
|
|
142
145
|
return;
|
|
@@ -180,7 +183,7 @@ function addPreview(evt: FileSpawnModel, context: Context) {
|
|
|
180
183
|
previews[evt.guid] = box;
|
|
181
184
|
context.scene.add(box);
|
|
182
185
|
if (evt.parentGuid) {
|
|
183
|
-
const parent =
|
|
186
|
+
const parent = findByGuid(evt.parentGuid, context.scene) as THREE.Object3D;
|
|
184
187
|
if (parent)
|
|
185
188
|
parent.add(box);
|
|
186
189
|
}
|
|
@@ -1,54 +1,55 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
// import { SyncedTransform } from "../engine-components/SyncedTransform";
|
|
2
|
+
// import { DragControls } from "../engine-components/DragControls"
|
|
3
|
+
// import { ObjectRaycaster } from "../engine-components/ui/Raycaster";
|
|
4
|
+
import { UIDProvider } from "./engine_types";
|
|
5
5
|
import { GLTF } from "three/examples/jsm/loaders/GLTFLoader";
|
|
6
|
-
import { Animation } from "../engine-components/Animation";
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
if
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
if
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
6
|
+
// import { Animation } from "../engine-components/Animation";
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
export function onDynamicObjectAdded(_obj: THREE.Object3D, _idProv: UIDProvider, _gltf?: GLTF) {
|
|
10
|
+
|
|
11
|
+
console.warn("Adding components on object has been temporarily disabled");
|
|
12
|
+
|
|
13
|
+
// // this ensures we have a drag component
|
|
14
|
+
// let drag = getComponentInChildren(obj as GameObject, DragControls);
|
|
15
|
+
// if (!drag) {
|
|
16
|
+
// drag = GameObject.addNewComponent(obj as GameObject, DragControls, false);
|
|
17
|
+
// drag.guid = idProv.generateUUID();
|
|
18
|
+
// }
|
|
19
|
+
|
|
20
|
+
// // if a drag component is found we add a syncedTransform if none exists
|
|
21
|
+
// if (drag && !GameObject.getComponent(drag.gameObject, SyncedTransform)) {
|
|
22
|
+
// const st = GameObject.addNewComponent(drag.gameObject, SyncedTransform, false);
|
|
23
|
+
// st.guid = idProv.generateUUID();
|
|
24
|
+
// // st.autoOwnership = true;
|
|
25
|
+
|
|
26
|
+
// //drag.transformGroup = true;
|
|
27
|
+
// //drag.targets = [obj];
|
|
28
|
+
// }
|
|
29
|
+
|
|
30
|
+
// // if a drag component is found we add a syncedTransform if none exists
|
|
31
|
+
// if (drag && !GameObject.getComponentInParent(drag.gameObject, ObjectRaycaster)) {
|
|
32
|
+
// const st = GameObject.addNewComponent(drag.gameObject, ObjectRaycaster, false);
|
|
33
|
+
// st.guid = idProv.generateUUID();
|
|
34
|
+
// }
|
|
35
|
+
|
|
36
|
+
// if (gltf) {
|
|
37
|
+
// if (gltf.animations?.length > 0) {
|
|
38
|
+
// const firstAnimation = gltf.animations[0];
|
|
39
|
+
// const anim = GameObject.addNewComponent(obj, Animation, false);
|
|
40
|
+
// anim.animations = [firstAnimation];
|
|
41
|
+
// }
|
|
42
|
+
// }
|
|
43
|
+
|
|
44
|
+
// let didDisablFrustumCulling = false;
|
|
45
|
+
// obj.traverse(o => {
|
|
46
|
+
// if (!o) return;
|
|
47
|
+
|
|
48
|
+
// if (o["isSkinnedMesh"] === true) {
|
|
49
|
+
// if (!didDisablFrustumCulling) console.log("Disabling frustum culling for skinned meshes", gltf);
|
|
50
|
+
// didDisablFrustumCulling = true;
|
|
51
|
+
// o.frustumCulled = false;
|
|
52
|
+
// }
|
|
53
|
+
|
|
54
|
+
// });
|
|
54
55
|
}
|
|
@@ -1,17 +1,27 @@
|
|
|
1
|
-
import { IModel, NetworkConnection } from "./engine_networking"
|
|
1
|
+
// import { IModel, NetworkConnection } from "./engine_networking"
|
|
2
2
|
import * as THREE from "three";
|
|
3
3
|
import { Context } from "./engine_setup"
|
|
4
|
-
import { Behaviour, Component, GameObject, InstantiateOptions, UIDProvider } from "../engine-components/Component";
|
|
5
4
|
import * as utils from "./engine_utils"
|
|
6
|
-
|
|
5
|
+
import { INetworkConnection } from "./engine_networking_types";
|
|
6
|
+
import { IGameObject as GameObject, IComponent as Component } from "./engine_types"
|
|
7
7
|
|
|
8
8
|
// https://github.com/uuidjs/uuid
|
|
9
9
|
// v5 takes string and namespace
|
|
10
10
|
import { v5, v1 } from 'uuid';
|
|
11
|
+
import { UIDProvider } from "./engine_types";
|
|
12
|
+
import { IModel } from "./engine_networking_types";
|
|
13
|
+
import { SendQueue } from "./engine_networking_types";
|
|
14
|
+
import { destroy, findByGuid, instantiate } from "./engine_gameobject";
|
|
11
15
|
import { Object3D } from "three";
|
|
12
|
-
|
|
16
|
+
import { InstantiateOptions } from "./engine_gameobject";
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
const debug = utils.getParam("debugcomponents");
|
|
20
|
+
|
|
13
21
|
|
|
14
22
|
|
|
23
|
+
const ID_NAMESPACE = 'eff8ba80-635d-11ec-90d6-0242ac120003';
|
|
24
|
+
|
|
15
25
|
export class InstantiateIdProvider implements UIDProvider {
|
|
16
26
|
|
|
17
27
|
get seed() {
|
|
@@ -63,10 +73,10 @@ export interface IBeforeNetworkedDestroy {
|
|
|
63
73
|
onBeforeNetworkedDestroy(networkIds: string[]): void;
|
|
64
74
|
}
|
|
65
75
|
|
|
66
|
-
export function syncDestroy(obj: GameObject | Component, con:
|
|
76
|
+
export function syncDestroy(obj: GameObject | Component, con: INetworkConnection, recursive: boolean = true) {
|
|
67
77
|
if (!obj) return;
|
|
68
78
|
const go = obj as GameObject;
|
|
69
|
-
|
|
79
|
+
destroy(obj, recursive);
|
|
70
80
|
|
|
71
81
|
if (!con) {
|
|
72
82
|
console.warn("Can not send destroy: No networking connection provided", obj.guid);
|
|
@@ -88,12 +98,12 @@ export function syncDestroy(obj: GameObject | Component, con: NetworkConnection,
|
|
|
88
98
|
}
|
|
89
99
|
|
|
90
100
|
const model = new DestroyInstanceModel(guid);
|
|
91
|
-
con.send(InstantiateEvent.InstanceDestroyed, model);
|
|
101
|
+
con.send(InstantiateEvent.InstanceDestroyed, model, SendQueue.Queued);
|
|
92
102
|
}
|
|
93
103
|
|
|
94
|
-
export function sendDestroyed(guid: string, con:
|
|
104
|
+
export function sendDestroyed(guid: string, con: INetworkConnection) {
|
|
95
105
|
const model = new DestroyInstanceModel(guid);
|
|
96
|
-
con.send(InstantiateEvent.InstanceDestroyed, model);
|
|
106
|
+
con.send(InstantiateEvent.InstanceDestroyed, model, SendQueue.Queued);
|
|
97
107
|
}
|
|
98
108
|
|
|
99
109
|
export function beginListenDestroy(context: Context) {
|
|
@@ -101,8 +111,8 @@ export function beginListenDestroy(context: Context) {
|
|
|
101
111
|
if (debug)
|
|
102
112
|
console.log("[Remote] Destroyed", context.scene, data);
|
|
103
113
|
// TODO: create global lookup table for guids
|
|
104
|
-
const obj =
|
|
105
|
-
if (obj)
|
|
114
|
+
const obj = findByGuid(data.guid, context.scene);
|
|
115
|
+
if (obj) destroy(obj);
|
|
106
116
|
});
|
|
107
117
|
}
|
|
108
118
|
|
|
@@ -140,7 +150,7 @@ class NewInstanceModel implements IModel {
|
|
|
140
150
|
}
|
|
141
151
|
}
|
|
142
152
|
|
|
143
|
-
export function syncInstantiate(object: GameObject |
|
|
153
|
+
export function syncInstantiate(object: GameObject | Object3D, opts: InstantiateOptions, hostData?: HostData, save?: boolean): GameObject | null {
|
|
144
154
|
|
|
145
155
|
const obj: GameObject = object as GameObject;
|
|
146
156
|
|
|
@@ -226,7 +236,7 @@ export function beginListenInstantiate(context: Context) {
|
|
|
226
236
|
options.context = context;
|
|
227
237
|
if (debug && context.alias)
|
|
228
238
|
console.log("[Remote] instantiate in: " + context.alias);
|
|
229
|
-
const inst =
|
|
239
|
+
const inst = instantiate(obj as GameObject, options);
|
|
230
240
|
|
|
231
241
|
if (inst) {
|
|
232
242
|
if (model.parent === "scene")
|
|
@@ -247,7 +257,7 @@ function instantiateSeeded(obj: GameObject, opts: InstantiateOptions | null): {
|
|
|
247
257
|
const seed = generateSeed();
|
|
248
258
|
const options = opts ?? new InstantiateOptions();
|
|
249
259
|
options.idProvider = new InstantiateIdProvider(seed);
|
|
250
|
-
const instance =
|
|
260
|
+
const instance = instantiate(obj, options);
|
|
251
261
|
return { seed: seed, instance: instance };
|
|
252
262
|
}
|
|
253
263
|
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export declare interface IModel {
|
|
2
|
+
guid: string;
|
|
3
|
+
dontSave?: boolean; // if set to true the model will not be saved in the server room state
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
export enum SendQueue {
|
|
8
|
+
OnConnection,
|
|
9
|
+
OnRoomJoin,
|
|
10
|
+
Queued,
|
|
11
|
+
Immediate,
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export declare interface INetworkConnection {
|
|
15
|
+
get isConnected(): boolean;
|
|
16
|
+
|
|
17
|
+
send(key: string, data: IModel | object | boolean | null | string | number, queue: SendQueue): unknown;
|
|
18
|
+
|
|
19
|
+
}
|
|
@@ -2,14 +2,12 @@ import * as CANNON from 'cannon-es'
|
|
|
2
2
|
import * as THREE from 'three'
|
|
3
3
|
import { Context } from './engine_setup';
|
|
4
4
|
import cannonDebugger from 'cannon-es-debugger'
|
|
5
|
-
import { Rigidbody } from '../engine-components/Rigidbody';
|
|
6
5
|
import * as utils from "./engine_utils"
|
|
7
6
|
import * as threeutils from "./engine_three_utils"
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import { Collider } from '../engine-components/Collider';
|
|
7
|
+
import { IComponent as Component, IGameObject as GameObject, ICollider as Collider, IRigidbody as Rigidbody, ICollider, $physicsKey, Collision, CannonCollision } from './engine_types';
|
|
8
|
+
import { Shape } from 'cannon-es';
|
|
9
|
+
import { InstancingUtil } from './engine_instancing';
|
|
10
|
+
import { foreachComponent } from './engine_gameobject';
|
|
13
11
|
|
|
14
12
|
const debugPhysics = utils.getParam("debugphysics");
|
|
15
13
|
const debugCollisions = utils.getParam("debugcollisions");
|
|
@@ -23,7 +21,6 @@ export class BodyOptions {
|
|
|
23
21
|
sleepThreshold: number = .01;
|
|
24
22
|
}
|
|
25
23
|
|
|
26
|
-
const bodyObjectKey = Symbol("object");
|
|
27
24
|
|
|
28
25
|
// TODO: refactor to return some kind of handle for adding/removing
|
|
29
26
|
class PhysicsObject {
|
|
@@ -41,17 +38,10 @@ class PhysicsObject {
|
|
|
41
38
|
this.parent = obj.parent;
|
|
42
39
|
this.body = body;
|
|
43
40
|
if (this.body)
|
|
44
|
-
this.body[
|
|
41
|
+
this.body[$physicsKey] = obj;
|
|
45
42
|
}
|
|
46
43
|
}
|
|
47
44
|
|
|
48
|
-
declare type CannonCollision = {
|
|
49
|
-
body: CANNON.Body;
|
|
50
|
-
contact: CANNON.ContactEquation;
|
|
51
|
-
target: CANNON.Body;
|
|
52
|
-
type: string;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
45
|
export class RaycastOptions {
|
|
56
46
|
ray: THREE.Ray | undefined = undefined;
|
|
57
47
|
cam: THREE.Camera | undefined | null = undefined;
|
|
@@ -649,14 +639,14 @@ export class Physics {
|
|
|
649
639
|
const collision = new Collision(obj, event);
|
|
650
640
|
if (debugCollisions)
|
|
651
641
|
console.log("collision between", event.contact.bi, event.contact.bj, obj, event);
|
|
652
|
-
|
|
642
|
+
foreachComponent(obj, (c: Component) => {
|
|
653
643
|
c.__internalHandleCollision(collision, false);
|
|
654
644
|
});
|
|
655
645
|
|
|
656
646
|
// handle triggers
|
|
657
647
|
if (collision.collider && !collision.collider.attachedRigidbody && collision.collider.isTrigger) {
|
|
658
648
|
const collision2 = new Collision(collision.gameObject, event, true);
|
|
659
|
-
|
|
649
|
+
foreachComponent(collision.gameObject, (c: Component) => {
|
|
660
650
|
c.__internalHandleCollision(collision2, true);
|
|
661
651
|
});
|
|
662
652
|
}
|
|
@@ -665,68 +655,24 @@ export class Physics {
|
|
|
665
655
|
private onEndContact(args: { bodyA: CANNON.Body, bodyB: CANNON.Body }) {
|
|
666
656
|
// if(args.bodyB.sleepState !== CANNON.Body.AWAKE) return;
|
|
667
657
|
// console.log("END", CANNON.BODY_SLEEP_STATES, args.bodyB.sleepState);
|
|
668
|
-
const obj1 = args.bodyA[
|
|
669
|
-
const obj2 = args.bodyB[
|
|
658
|
+
const obj1 = args.bodyA[$physicsKey];
|
|
659
|
+
const obj2 = args.bodyB[$physicsKey];
|
|
670
660
|
// console.log(obj2);
|
|
671
|
-
|
|
661
|
+
|
|
662
|
+
|
|
663
|
+
foreachComponent(obj2, (c: Component) => {
|
|
672
664
|
c.__internalHandleExitCollisionEvent(obj1, false);
|
|
673
665
|
});
|
|
674
666
|
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
667
|
+
// TODO: stop iterating when we found the collider
|
|
668
|
+
foreachComponent(obj1, c => {
|
|
669
|
+
const collider = c as ICollider;
|
|
670
|
+
if (collider.isCollider && !collider.attachedRigidbody && collider.isTrigger) {
|
|
671
|
+
foreachComponent(collider.gameObject, (c: Component) => {
|
|
672
|
+
c.__internalHandleExitCollisionEvent(obj2, true);
|
|
673
|
+
});
|
|
674
|
+
}
|
|
675
|
+
});
|
|
682
676
|
}
|
|
683
677
|
|
|
684
678
|
}
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
export class Collision {
|
|
688
|
-
|
|
689
|
-
private readonly invert: boolean;
|
|
690
|
-
private readonly collision: CannonCollision;
|
|
691
|
-
private readonly targetBody: CANNON.Body;
|
|
692
|
-
|
|
693
|
-
readonly me: Object3D;
|
|
694
|
-
|
|
695
|
-
private _normal?: Vector3;
|
|
696
|
-
get normal(): Vector3 {
|
|
697
|
-
if (!this._normal) {
|
|
698
|
-
const vec = this.collision.contact.ni;
|
|
699
|
-
this._normal = new Vector3(vec.x, vec.y, vec.z);
|
|
700
|
-
}
|
|
701
|
-
return this._normal;
|
|
702
|
-
}
|
|
703
|
-
|
|
704
|
-
private _collider?: Collider;
|
|
705
|
-
get collider(): Collider {
|
|
706
|
-
if (this._collider === undefined) {
|
|
707
|
-
this._collider = GameObject.getComponentInChildren(this.gameObject, Collider)!;
|
|
708
|
-
}
|
|
709
|
-
return this._collider;
|
|
710
|
-
}
|
|
711
|
-
|
|
712
|
-
get gameObject(): Object3D {
|
|
713
|
-
return this.targetBody[bodyObjectKey];
|
|
714
|
-
}
|
|
715
|
-
|
|
716
|
-
// private _point?: Vector3;
|
|
717
|
-
// get point(): Vector3 {
|
|
718
|
-
// if (!this._point) {
|
|
719
|
-
// const c = this.collision.contact;
|
|
720
|
-
// const point = c.bi.position.clone().vadd(c.ri);
|
|
721
|
-
// this._point = new Vector3(point.x, point.y, point.z);
|
|
722
|
-
// }
|
|
723
|
-
// return this._point;
|
|
724
|
-
// }
|
|
725
|
-
|
|
726
|
-
constructor(obj: Object3D, collision: CannonCollision, invert: boolean = false) {
|
|
727
|
-
this.invert = invert;
|
|
728
|
-
this.me = obj;
|
|
729
|
-
this.collision = collision;
|
|
730
|
-
this.targetBody = this.invert ? collision.target : collision.body;
|
|
731
|
-
}
|
|
732
|
-
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { SourceIdentifier } from "./engine_gltf";
|
|
2
1
|
import { Vector4, EquirectangularReflectionMapping, sRGBEncoding, WebGLCubeRenderTarget, Texture, LightProbe, Color } from "three";
|
|
3
2
|
import { LightProbeGenerator } from "three/examples/jsm/lights/LightProbeGenerator.js"
|
|
4
3
|
import { Context } from "./engine_setup";
|
|
5
4
|
import { SceneLightSettings } from "./extensions/NEEDLE_lighting_settings";
|
|
6
5
|
import { createFlatTexture, createTrilightTexture } from "./engine_shaders";
|
|
7
6
|
import { getParam } from "./engine_utils";
|
|
7
|
+
import { SourceIdentifier } from "./engine_types";
|
|
8
8
|
|
|
9
9
|
const debug = getParam("debugenvlight");
|
|
10
10
|
|