@needle-tools/engine 2.34.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 +11 -0
- package/dist/needle-engine.d.ts +2960 -2794
- package/dist/needle-engine.js +456 -456
- package/dist/needle-engine.js.map +4 -4
- package/dist/needle-engine.min.js +67 -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_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_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 -25
- package/lib/engine/engine_physics.js +17 -61
- 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/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/Component.d.ts +16 -50
- package/lib/engine-components/Component.js +67 -466
- package/lib/engine-components/Component.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 -2
- package/lib/engine-components/Renderer.js +2 -0
- 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.js.map +1 -1
- package/lib/engine-components/SpectatorCamera.js.map +1 -1
- package/lib/engine-components/SyncedCamera.js +2 -1
- package/lib/engine-components/SyncedCamera.js.map +1 -1
- package/lib/engine-components/SyncedTransform.js.map +1 -1
- package/lib/engine-components/TestRunner.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/WebXR.js.map +1 -1
- package/lib/engine-components/WebXRController.js +28 -8
- 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 -1
- package/lib/engine-components/codegen/components.js +1 -1
- 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 +1 -1
- package/lib/engine-components/ui/EventSystem.js +11 -31
- 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 +12 -1
- package/src/engine/api.ts +3 -0
- package/src/engine/codegen/register_types.js +2 -2
- package/src/engine/engine_addressables.ts +12 -10
- package/src/engine/{engine_components.js → engine_components.ts} +37 -47
- 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_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 +20 -82
- 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/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/Component.ts +83 -536
- 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 +5 -1
- package/src/engine-components/RigidBody.ts +2 -1
- package/src/engine-components/ScreenCapture.ts +1 -1
- package/src/engine-components/SpectatorCamera.ts +7 -5
- package/src/engine-components/SyncedCamera.ts +2 -1
- package/src/engine-components/SyncedTransform.ts +1 -1
- package/src/engine-components/TestRunner.ts +1 -2
- package/src/engine-components/Voip.ts +2 -1
- package/src/engine-components/WebXR.ts +2 -2
- package/src/engine-components/WebXRController.ts +30 -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 -1
- 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 +11 -25
- 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,6 +1,5 @@
|
|
|
1
1
|
import { DepthTexture, PerspectiveCamera, WebGLRenderer, WebGLRenderTarget } from 'three'
|
|
2
2
|
import * as THREE from 'three'
|
|
3
|
-
import { Behaviour, Component, GameObject } from '../engine-components/Component';
|
|
4
3
|
import { Input } from './engine_input';
|
|
5
4
|
import { Physics } from './engine_physics';
|
|
6
5
|
import { Time } from './engine_time';
|
|
@@ -10,8 +9,6 @@ import { beginListenDestroy, beginListenInstantiate } from './engine_networking_
|
|
|
10
9
|
import * as looputils from './engine_mainloop_utils';
|
|
11
10
|
import * as utils from "./engine_utils";
|
|
12
11
|
|
|
13
|
-
import { Camera, createCameraWithOrbitControl } from '../engine-components/Camera';
|
|
14
|
-
|
|
15
12
|
import { EffectComposer } from 'three/examples/jsm/postprocessing/EffectComposer.js';
|
|
16
13
|
import { RenderPass } from 'three/examples/jsm/postprocessing/RenderPass';
|
|
17
14
|
|
|
@@ -21,23 +18,27 @@ import { AssetDatabase } from './engine_assetdatabase';
|
|
|
21
18
|
import { logHierarchy } from './engine_three_utils';
|
|
22
19
|
|
|
23
20
|
import * as Stats from 'three/examples/jsm/libs/stats.module';
|
|
24
|
-
import { Light } from '../engine-components/Light';
|
|
25
21
|
import { RendererData } from './engine_rendererdata';
|
|
26
22
|
import { Addressables } from './engine_addressables';
|
|
27
23
|
import { Application } from './engine_application';
|
|
28
24
|
import { LightDataRegistry, ILightDataRegistry } from './engine_lightdata';
|
|
29
25
|
import { PlayerViewManager } from './engine_playerview';
|
|
30
26
|
|
|
27
|
+
import { ICamera as Camera, IComponent, ILight as Light } from "./engine_types"
|
|
28
|
+
import { destroy } from './engine_gameobject';
|
|
29
|
+
|
|
31
30
|
|
|
32
31
|
const debug = utils.getParam("debugSetup");
|
|
33
32
|
const stats = utils.getParam("stats");
|
|
34
33
|
|
|
34
|
+
|
|
35
|
+
|
|
35
36
|
// this is where functions that setup unity scenes will be pushed into
|
|
36
37
|
// those will be accessed from our custom html element to load them into their context
|
|
37
38
|
export const build_scene_functions: { [name: string]: (context: Context) => Promise<void> } = {};
|
|
38
39
|
|
|
39
40
|
declare type CoroutineData = {
|
|
40
|
-
comp:
|
|
41
|
+
comp: IComponent,
|
|
41
42
|
main: Generator,
|
|
42
43
|
chained?: Array<Generator>
|
|
43
44
|
}
|
|
@@ -79,6 +80,15 @@ export enum XRSessionMode {
|
|
|
79
80
|
|
|
80
81
|
export declare type OnBeforeRenderCallback = (renderer: THREE.WebGLRenderer, scene: THREE.Scene, camera: THREE.Camera, geometry: THREE.BufferGeometry, material: THREE.Material, group: THREE.Group) => void
|
|
81
82
|
|
|
83
|
+
|
|
84
|
+
export function registerComponent(script : IComponent, context?: Context) {
|
|
85
|
+
if (!script) return;
|
|
86
|
+
const new_scripts = context?.new_scripts ?? Context.Current.new_scripts;
|
|
87
|
+
if (!new_scripts.includes(script)) {
|
|
88
|
+
new_scripts.push(script);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
82
92
|
export class Context {
|
|
83
93
|
|
|
84
94
|
private static _current: Context;
|
|
@@ -128,14 +138,14 @@ export class Context {
|
|
|
128
138
|
composer: EffectComposer | null = null;
|
|
129
139
|
|
|
130
140
|
// all scripts
|
|
131
|
-
scripts:
|
|
141
|
+
scripts: IComponent[] = [];
|
|
132
142
|
// scripts with update event
|
|
133
|
-
scripts_earlyUpdate:
|
|
134
|
-
scripts_update:
|
|
135
|
-
scripts_lateUpdate:
|
|
136
|
-
scripts_onBeforeRender:
|
|
137
|
-
scripts_onAfterRender:
|
|
138
|
-
scripts_WithCorroutines:
|
|
143
|
+
scripts_earlyUpdate: IComponent[] = [];
|
|
144
|
+
scripts_update: IComponent[] = [];
|
|
145
|
+
scripts_lateUpdate: IComponent[] = [];
|
|
146
|
+
scripts_onBeforeRender: IComponent[] = [];
|
|
147
|
+
scripts_onAfterRender: IComponent[] = [];
|
|
148
|
+
scripts_WithCorroutines: IComponent[] = [];
|
|
139
149
|
coroutines: { [FrameEvent: number]: Array<CoroutineData> } = {}
|
|
140
150
|
|
|
141
151
|
get mainCamera(): THREE.Camera | null {
|
|
@@ -154,8 +164,8 @@ export class Context {
|
|
|
154
164
|
pre_render_callbacks: Function[] = [];
|
|
155
165
|
post_render_callbacks: Function[] = [];
|
|
156
166
|
|
|
157
|
-
new_scripts:
|
|
158
|
-
new_script_start:
|
|
167
|
+
new_scripts: IComponent[] = [];
|
|
168
|
+
new_script_start: IComponent[] = [];
|
|
159
169
|
new_scripts_pre_setup_callbacks: Function[] = [];
|
|
160
170
|
new_scripts_post_setup_callbacks: Function[] = [];
|
|
161
171
|
|
|
@@ -273,7 +283,7 @@ export class Context {
|
|
|
273
283
|
onDestroy() {
|
|
274
284
|
if (!this._isCreated) return;
|
|
275
285
|
this._isCreated = false;
|
|
276
|
-
|
|
286
|
+
destroy(this.scene, true);
|
|
277
287
|
this.renderer?.setAnimationLoop(null);
|
|
278
288
|
if (!this.isManagedExternally) {
|
|
279
289
|
this.renderer?.dispose();
|
|
@@ -281,7 +291,7 @@ export class Context {
|
|
|
281
291
|
|
|
282
292
|
}
|
|
283
293
|
|
|
284
|
-
registerCoroutineUpdate(script:
|
|
294
|
+
registerCoroutineUpdate(script: IComponent, coroutine: Generator, evt: FrameEvent): Generator {
|
|
285
295
|
if (!this.coroutines[evt]) this.coroutines[evt] = [];
|
|
286
296
|
this.coroutines[evt].push({ comp: script, main: coroutine });
|
|
287
297
|
return coroutine;
|
|
@@ -293,7 +303,7 @@ export class Context {
|
|
|
293
303
|
if (idx >= 0) this.coroutines[evt].splice(idx, 1);
|
|
294
304
|
}
|
|
295
305
|
|
|
296
|
-
stopAllCoroutinesFrom(script:
|
|
306
|
+
stopAllCoroutinesFrom(script: IComponent) {
|
|
297
307
|
for (const evt in this.coroutines) {
|
|
298
308
|
const rout: CoroutineData[] = this.coroutines[evt];
|
|
299
309
|
for (let i = rout.length - 1; i >= 0; i--) {
|
|
@@ -446,30 +456,34 @@ export class Context {
|
|
|
446
456
|
}
|
|
447
457
|
|
|
448
458
|
if (!this.mainCamera) {
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
//
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
459
|
+
// console.error("MISSING camera", this);
|
|
460
|
+
// return;
|
|
461
|
+
// Context._current = this;
|
|
462
|
+
// //@ts-ignore
|
|
463
|
+
// const cams = findObjectsOfType(Camera, this);
|
|
464
|
+
// console.log(cams);
|
|
465
|
+
// // get main camera, fallback to first camera
|
|
466
|
+
// const mc: Camera = cams.find(c => c.tag == "MainCamera") ?? cams.find(_ => true) as Camera;
|
|
467
|
+
// if (mc) {
|
|
468
|
+
// if (mc.tag !== "MainCamera")
|
|
469
|
+
// console.warn("No mainCamera configured. Some components rely on a mainCamera object being present. " +
|
|
470
|
+
// "When exporting your scene, make sure to set the mainCamera tag on your camera. Using \"" + mc.name + "\" as mainCamera now.");
|
|
471
|
+
// this.setCurrentCamera(mc);
|
|
472
|
+
// }
|
|
473
|
+
// else {
|
|
474
|
+
// console.error("No camera found");
|
|
475
|
+
// const cam = createCameraWithOrbitControl(this.scene);
|
|
476
|
+
// this.setCurrentCamera(cam);
|
|
477
|
+
// }
|
|
464
478
|
}
|
|
465
479
|
|
|
466
480
|
Context._current = this;
|
|
467
481
|
looputils.processNewScripts(this);
|
|
468
482
|
|
|
469
|
-
const mainCam = this.mainCameraComponent as Camera;
|
|
470
|
-
if (mainCam) {
|
|
471
|
-
|
|
472
|
-
}
|
|
483
|
+
// const mainCam = this.mainCameraComponent as Camera;
|
|
484
|
+
// if (mainCam) {
|
|
485
|
+
// mainCam.applyClearFlagsIfIsActiveCamera();
|
|
486
|
+
// }
|
|
473
487
|
|
|
474
488
|
if (!this.isManagedExternally && this.composer && this.mainCamera) {
|
|
475
489
|
const renderPass = new RenderPass(this.scene, this.mainCamera);
|
|
@@ -544,7 +558,7 @@ export class Context {
|
|
|
544
558
|
}
|
|
545
559
|
}
|
|
546
560
|
|
|
547
|
-
this.mainLight = null;
|
|
561
|
+
// this.mainLight = null;
|
|
548
562
|
this.executeCoroutines(FrameEvent.LateUpdate);
|
|
549
563
|
|
|
550
564
|
try {
|
|
@@ -42,14 +42,6 @@ const _worldPositions = new CircularBuffer(() => new THREE.Vector3(), 100);
|
|
|
42
42
|
|
|
43
43
|
|
|
44
44
|
|
|
45
|
-
THREE.Vector3.prototype["slerp"] = function (end: Vector3, t: number) {
|
|
46
|
-
const len1 = this.length();
|
|
47
|
-
const len2 = end.length();
|
|
48
|
-
const targetLen = Mathf.lerp(len1, len2, t);
|
|
49
|
-
return this.lerp(end, t).normalize().multiplyScalar(targetLen);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
|
|
53
45
|
|
|
54
46
|
export function getWorldPosition(obj: THREE.Object3D, vec: THREE.Vector3 | null = null, updateParents: boolean = true): THREE.Vector3 {
|
|
55
47
|
const wp = vec ?? _worldPositions.get();
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
import { Camera, Color, Material, Object3D, Vector3 } from "three";
|
|
2
|
+
import { Body, ContactEquation } from "cannon-es";
|
|
3
|
+
import { RGBAColor } from "../engine-components/js-extensions/RGBAColor";
|
|
4
|
+
|
|
5
|
+
/** used to find data registered via gltf files e.g. find lightmaps for a Renderer component that were shipped inside a gltf */
|
|
6
|
+
export declare type SourceIdentifier = string;
|
|
7
|
+
|
|
8
|
+
// TODO: figure out what is best here!
|
|
9
|
+
// https://stackoverflow.com/a/67229348
|
|
10
|
+
// https://stackoverflow.com/questions/36886082/abstract-constructor-type-in-typescript
|
|
11
|
+
// type Constructor<T> = Function & { prototype: T } // << this includes abstract constructor types
|
|
12
|
+
export type Constructor<T> = abstract new (...args: any[]) => T; // abstract to support @serializable and also getComponent with abstract types
|
|
13
|
+
export type ConstructorConcrete<T> = new (...args: any[]) => T;
|
|
14
|
+
export type GuidsMap = { [key: string]: string };
|
|
15
|
+
|
|
16
|
+
export interface UIDProvider {
|
|
17
|
+
seed: number;
|
|
18
|
+
generateUUID(): string;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
export declare interface IGameObject extends Object3D {
|
|
24
|
+
guid: string | undefined;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export interface IComponent {
|
|
28
|
+
get isComponent(): boolean;
|
|
29
|
+
|
|
30
|
+
gameObject: IGameObject;
|
|
31
|
+
guid: string;
|
|
32
|
+
enabled: boolean;
|
|
33
|
+
sourceId?: SourceIdentifier;
|
|
34
|
+
|
|
35
|
+
get name(): string;
|
|
36
|
+
get layer(): number;
|
|
37
|
+
get destroyed(): boolean;
|
|
38
|
+
|
|
39
|
+
context: any;
|
|
40
|
+
|
|
41
|
+
get activeAndEnabled(): boolean;
|
|
42
|
+
|
|
43
|
+
__internalNewInstanceCreated();
|
|
44
|
+
__internalAwake();
|
|
45
|
+
__internalStart();
|
|
46
|
+
__internalEnable();
|
|
47
|
+
__internalDisable();
|
|
48
|
+
__internalDestroy();
|
|
49
|
+
resolveGuids?(guidsMap: GuidsMap): void;
|
|
50
|
+
|
|
51
|
+
awake();
|
|
52
|
+
onEnable();
|
|
53
|
+
onDisable();
|
|
54
|
+
onDestroy();
|
|
55
|
+
|
|
56
|
+
start?(): void;
|
|
57
|
+
// available update loop events:
|
|
58
|
+
// earlyUpdate, update, lateUpdate, onBeforeRender, onAfterRender
|
|
59
|
+
earlyUpdate?(): void;
|
|
60
|
+
update?(): void;
|
|
61
|
+
lateUpdate?(): void;
|
|
62
|
+
onBeforeRender?(frame: THREE.XRFrame | null): void;
|
|
63
|
+
onAfterRender?(): void;
|
|
64
|
+
|
|
65
|
+
onCollisionEnter?(col: Collision);
|
|
66
|
+
onCollisionExit?(col: Collision);
|
|
67
|
+
onCollisionExitRaw?(col: Collision);
|
|
68
|
+
onCollisionStay?(col: Collision);
|
|
69
|
+
|
|
70
|
+
onTriggerEnter?(col: Collision);
|
|
71
|
+
onTriggerStay?(col: Collision);
|
|
72
|
+
onTriggerExit?(col: Collision);
|
|
73
|
+
|
|
74
|
+
__internalHandleCollision(col: Collision, isTriggerCollision: boolean);
|
|
75
|
+
__internalHandleExitCollisionEvent(obj: Object3D, isTriggerCollision: boolean);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
export declare interface ICamera extends IComponent {
|
|
80
|
+
applyClearFlagsIfIsActiveCamera(): unknown;
|
|
81
|
+
buildCamera();
|
|
82
|
+
get cam(): Camera;
|
|
83
|
+
nearClipPlane: number;
|
|
84
|
+
farClipPlane: number;
|
|
85
|
+
backgroundColor: RGBAColor | null;
|
|
86
|
+
clearFlags: number;
|
|
87
|
+
aspect: number;
|
|
88
|
+
fieldOfView: number;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export declare interface ILight extends IComponent {
|
|
92
|
+
intensity: number;
|
|
93
|
+
color: Color;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export declare interface IRenderer extends IComponent {
|
|
97
|
+
material: Material;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
export declare interface ICollider extends IComponent {
|
|
101
|
+
get isCollider();
|
|
102
|
+
attachedRigidbody: IRigidbody;
|
|
103
|
+
isTrigger: boolean;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
export declare interface IRigidbody extends IComponent {
|
|
107
|
+
initialize(): void;
|
|
108
|
+
body;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
export const $physicsKey = Symbol("object");
|
|
118
|
+
|
|
119
|
+
export declare type CannonCollision = {
|
|
120
|
+
body: Body;
|
|
121
|
+
contact: ContactEquation;
|
|
122
|
+
target: Body;
|
|
123
|
+
type: string;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
export class Collision {
|
|
127
|
+
|
|
128
|
+
get __internalCollision(): CannonCollision {
|
|
129
|
+
return this.collision;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
get __internalInvertedSourceReceiver(): boolean {
|
|
133
|
+
return this.invert;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
private readonly invert: boolean;
|
|
137
|
+
private readonly collision: CannonCollision;
|
|
138
|
+
private readonly targetBody: Body;
|
|
139
|
+
|
|
140
|
+
readonly me: Object3D;
|
|
141
|
+
|
|
142
|
+
private _normal?: Vector3;
|
|
143
|
+
get normal(): Vector3 {
|
|
144
|
+
if (!this._normal) {
|
|
145
|
+
const vec = this.collision.contact.ni;
|
|
146
|
+
this._normal = new Vector3(vec.x, vec.y, vec.z);
|
|
147
|
+
}
|
|
148
|
+
return this._normal;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
private _collider?: ICollider;
|
|
152
|
+
get collider(): ICollider {
|
|
153
|
+
if (!this._collider) {
|
|
154
|
+
//@ts-ignore
|
|
155
|
+
this._collider = getComponentInChildren(this.gameObject, Collider) as ICollider;
|
|
156
|
+
}
|
|
157
|
+
return this._collider;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
get gameObject(): Object3D {
|
|
161
|
+
return this.targetBody[$physicsKey];
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
// private _point?: Vector3;
|
|
165
|
+
// get point(): Vector3 {
|
|
166
|
+
// if (!this._point) {
|
|
167
|
+
// const c = this.collision.contact;
|
|
168
|
+
// const point = c.bi.position.clone().vadd(c.ri);
|
|
169
|
+
// this._point = new Vector3(point.x, point.y, point.z);
|
|
170
|
+
// }
|
|
171
|
+
// return this._point;
|
|
172
|
+
// }
|
|
173
|
+
|
|
174
|
+
constructor(obj: Object3D, collision: CannonCollision, invert: boolean = false) {
|
|
175
|
+
this.invert = invert;
|
|
176
|
+
this.me = obj;
|
|
177
|
+
this.collision = collision;
|
|
178
|
+
this.targetBody = this.invert ? collision.target : collision.body;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
1
|
// use for typesafe interface method calls
|
|
4
|
-
import { SourceIdentifier } from "./
|
|
2
|
+
import { SourceIdentifier } from "./engine_types";
|
|
5
3
|
|
|
6
4
|
// https://schneidenbach.gitbooks.io/typescript-cookbook/content/nameof-operator.html
|
|
7
5
|
export const nameofFactory = <T>() => (name: keyof T) => name;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { GLTF, GLTFLoaderPlugin, GLTFParser } from "three/examples/jsm/loaders/GLTFLoader";
|
|
2
2
|
import { NodeToObjectMap, ObjectToNodeMap, SerializationContext } from "../engine_serialization_core";
|
|
3
3
|
import { GLTFExporter } from 'three/examples/jsm/exporters/GLTFExporter.js';
|
|
4
|
-
import { writeBuiltinComponentData } from "../engine_gltf_builtin_components";
|
|
5
4
|
import { debugExtension } from "../engine_default_parameters";
|
|
6
5
|
import { builtinComponentKeyName } from "../engine_constants";
|
|
7
6
|
import { resolveReferences } from "./extension_utils";
|
|
8
7
|
import { apply } from "../../engine-components/js-extensions/Object3D";
|
|
8
|
+
import { getLoader } from "../engine_gltf";
|
|
9
9
|
|
|
10
10
|
export const debug = debugExtension
|
|
11
11
|
const componentsArrayExportKey = "$___Export_Components";
|
|
@@ -128,7 +128,7 @@ export class NEEDLE_components implements GLTFLoaderPlugin {
|
|
|
128
128
|
const serializedComponentData: Array<object | null> = [];
|
|
129
129
|
for (const comp of components) {
|
|
130
130
|
this.context.target = comp;
|
|
131
|
-
const res = writeBuiltinComponentData(comp, this.context);
|
|
131
|
+
const res = getLoader().writeBuiltinComponentData(comp, this.context);
|
|
132
132
|
if (res !== null) {
|
|
133
133
|
serializedComponentData.push(res);
|
|
134
134
|
// (comp as unknown as ISerializationCallbackReceiver)?.onAfterSerialize?.call(comp);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Material, Texture, TextureLoader } from "three";
|
|
2
2
|
import { GLTF, GLTFLoader, GLTFLoaderPlugin, GLTFParser } from "three/examples/jsm/loaders/GLTFLoader";
|
|
3
|
-
import { SourceIdentifier } from "../
|
|
3
|
+
import { SourceIdentifier } from "../engine_types";
|
|
4
4
|
import { Context } from "../engine_setup";
|
|
5
5
|
import { addDracoAndKTX2Loaders } from "../engine_loaders";
|
|
6
6
|
import { getParam, getPath } from "../engine_utils";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AmbientLight, Color, HemisphereLight } from "three";
|
|
2
2
|
import { GLTF, GLTFLoaderPlugin, GLTFParser } from "three/examples/jsm/loaders/GLTFLoader";
|
|
3
|
-
import { SourceIdentifier } from "../
|
|
3
|
+
import { SourceIdentifier } from "../engine_types";
|
|
4
4
|
import { Behaviour, GameObject } from "../../engine-components/Component";
|
|
5
5
|
import { AmbientMode, DefaultReflectionMode } from "../engine_rendererdata";
|
|
6
6
|
import { LightmapType } from "./NEEDLE_lightmaps";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ILightDataRegistry } from "../engine_lightdata";
|
|
2
2
|
import { FloatType, HalfFloatType, sRGBEncoding, Texture } from "three";
|
|
3
3
|
import { GLTF, GLTFLoaderPlugin, GLTFParser } from "three/examples/jsm/loaders/GLTFLoader";
|
|
4
|
-
import { SourceIdentifier } from "../
|
|
4
|
+
import { SourceIdentifier } from "../engine_types";
|
|
5
5
|
import { resolveReferences } from "./extension_utils";
|
|
6
6
|
import { getParam } from "../engine_utils";
|
|
7
7
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
|
|
2
|
-
import { SourceIdentifier } from "../
|
|
2
|
+
import { SourceIdentifier } from "../engine_types";
|
|
3
3
|
import { GLTF, GLTFLoaderPlugin, GLTFParser } from "three/examples/jsm/loaders/GLTFLoader";
|
|
4
|
-
import {
|
|
5
|
-
|
|
4
|
+
import { IComponent as Component, IRenderer as Renderer } from "../engine_types";
|
|
5
|
+
|
|
6
6
|
import {
|
|
7
7
|
// stencil funcs
|
|
8
8
|
NeverStencilFunc,
|
|
@@ -27,7 +27,7 @@ import { getParam } from "../engine_utils";
|
|
|
27
27
|
|
|
28
28
|
const debug = getParam("debugstencil");
|
|
29
29
|
|
|
30
|
-
function matchesLayer(stencilLayer: number, comp:
|
|
30
|
+
function matchesLayer(stencilLayer: number, comp: Component): boolean {
|
|
31
31
|
return (stencilLayer & 1 << comp.layer) != 0;
|
|
32
32
|
}
|
|
33
33
|
|
|
@@ -5,8 +5,9 @@ import { IUniform, RawShaderMaterial, Vector4 } from 'three';
|
|
|
5
5
|
import { Context } from '../engine_setup';
|
|
6
6
|
import { getParam } from "../engine_utils";
|
|
7
7
|
import * as SHADERDATA from "../shaders/shaderData"
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
8
|
+
import { SourceIdentifier } from "../engine_types";
|
|
9
|
+
import { ILight } from "../engine_types";
|
|
10
|
+
import { getWorldPosition } from "../engine_three_utils";
|
|
10
11
|
|
|
11
12
|
const debug = getParam("debugshaders");
|
|
12
13
|
|
|
@@ -203,10 +204,10 @@ export class CustomShader extends RawShaderMaterial {
|
|
|
203
204
|
this.uniforms["_TimeParameters"].value = context.rendererData.timeVec4;
|
|
204
205
|
}
|
|
205
206
|
|
|
206
|
-
const mainLight:
|
|
207
|
+
const mainLight: ILight | null = context.mainLight;
|
|
207
208
|
if (mainLight) {
|
|
208
209
|
|
|
209
|
-
const lp = mainLight.
|
|
210
|
+
const lp = getWorldPosition(mainLight.gameObject, CustomShader._mainLightPosition);
|
|
210
211
|
this.uniforms["_MainLightPosition"] = { value: lp.normalize() };
|
|
211
212
|
|
|
212
213
|
CustomShader._mainLightColor.set(mainLight.color.r, mainLight.color.g, mainLight.color.b, 0);
|
|
@@ -8,7 +8,7 @@ import { NEEDLE_gameobject_data } from "./NEEDLE_gameobject_data";
|
|
|
8
8
|
import { NEEDLE_persistent_assets } from "./NEEDLE_persistent_assets";
|
|
9
9
|
// import { KHR_animation_pointer } from "./KHR_animation_pointer";
|
|
10
10
|
import { NEEDLE_lightmaps } from "../extensions/NEEDLE_lightmaps";
|
|
11
|
-
import { SourceIdentifier } from "../
|
|
11
|
+
import { SourceIdentifier } from "../engine_types";
|
|
12
12
|
import { Context } from "../engine_setup";
|
|
13
13
|
import { NEEDLE_lighting_settings } from "./NEEDLE_lighting_settings";
|
|
14
14
|
import { NEEDLE_render_objects } from "./NEEDLE_render_objects";
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { Behaviour
|
|
1
|
+
import { Behaviour } from "./Component";
|
|
2
2
|
import * as THREE from 'three'
|
|
3
|
-
import { LoopOnce,
|
|
3
|
+
import { LoopOnce, AnimationActionLoopStyles, AnimationAction } from "three";
|
|
4
4
|
import { getParam, deepClone } from "../engine/engine_utils";
|
|
5
5
|
import { AnimatorControllerModel } from "../engine/extensions/NEEDLE_animator_controller_model";
|
|
6
6
|
import { AnimatorController } from "./AnimatorController";
|
|
7
|
-
import {
|
|
7
|
+
import { serializeable } from "../engine/engine_serialization_decorator";
|
|
8
8
|
import { Mathf } from "../engine/engine_math";
|
|
9
9
|
|
|
10
10
|
const debug = getParam("debuganimator");
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { GLTF, GLTFLoader } from "three/examples/jsm/loaders/GLTFLoader";
|
|
2
2
|
import * as THREE from "three";
|
|
3
3
|
import * as utils from "../engine/engine_utils"
|
|
4
|
-
import * as object from "../engine/engine_gltf_builtin_components";
|
|
4
|
+
// import * as object from "../engine/engine_gltf_builtin_components";
|
|
5
5
|
import * as loaders from "../engine/engine_loaders"
|
|
6
6
|
import { Context } from "../engine/engine_setup";
|
|
7
|
-
import { GameObject
|
|
7
|
+
import { GameObject } from "./Component";
|
|
8
8
|
import { download_file } from "../engine/engine_web_api";
|
|
9
|
-
import {
|
|
9
|
+
import { getLoader } from "../engine/engine_gltf";
|
|
10
|
+
import { InstantiateOptions } from "../engine/engine_gameobject";
|
|
10
11
|
|
|
11
12
|
const debug = utils.getParam("debugavatar");
|
|
12
13
|
|
|
@@ -103,7 +104,7 @@ export class AvatarLoader {
|
|
|
103
104
|
if (!bin) return null;
|
|
104
105
|
}
|
|
105
106
|
|
|
106
|
-
const gltf = await parseSync(context, bin, null!, 0);
|
|
107
|
+
const gltf = await getLoader().parseSync(context, bin, null!, 0);
|
|
107
108
|
return gltf?.scene ?? null;
|
|
108
109
|
}
|
|
109
110
|
|
|
@@ -125,7 +126,7 @@ export class AvatarLoader {
|
|
|
125
126
|
const url = this.avatarRegistryUrl + "/" + avatarId;
|
|
126
127
|
loader.load(url,
|
|
127
128
|
async gltf => {
|
|
128
|
-
await
|
|
129
|
+
await getLoader().createBuiltinComponents(context, url, gltf, null, undefined);
|
|
129
130
|
resolve(gltf.scene);
|
|
130
131
|
},
|
|
131
132
|
progress => {
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { Behaviour, GameObject } from "./Component";
|
|
2
2
|
import * as THREE from "three";
|
|
3
|
-
import { OrbitControls } from "./OrbitControls";
|
|
3
|
+
// import { OrbitControls } from "./OrbitControls";
|
|
4
4
|
import { getParam } from "../engine/engine_utils";
|
|
5
5
|
import { serializeable } from "../engine/engine_serialization_decorator";
|
|
6
6
|
import { RGBAColor } from "./js-extensions/RGBAColor";
|
|
7
7
|
import { PerspectiveCamera } from "three";
|
|
8
8
|
import { XRSessionMode } from "../engine/engine_setup";
|
|
9
|
+
import { ICamera } from "../engine/engine_types"
|
|
9
10
|
|
|
10
11
|
export enum ClearFlags {
|
|
11
12
|
Skybox = 1,
|
|
@@ -15,7 +16,8 @@ export enum ClearFlags {
|
|
|
15
16
|
|
|
16
17
|
const debug = getParam("debugcam");
|
|
17
18
|
|
|
18
|
-
export class Camera extends Behaviour {
|
|
19
|
+
export class Camera extends Behaviour implements ICamera {
|
|
20
|
+
|
|
19
21
|
|
|
20
22
|
get aspect(): number {
|
|
21
23
|
if (this._cam instanceof PerspectiveCamera) return this._cam.aspect;
|
|
@@ -104,6 +106,12 @@ export class Camera extends Behaviour {
|
|
|
104
106
|
return this._cam!;
|
|
105
107
|
}
|
|
106
108
|
|
|
109
|
+
|
|
110
|
+
// constructor(){
|
|
111
|
+
// super();
|
|
112
|
+
// console.log(this);
|
|
113
|
+
// }
|
|
114
|
+
|
|
107
115
|
awake() {
|
|
108
116
|
if (!this.sourceId) {
|
|
109
117
|
console.warn("Camera has no source - the camera should be exported inside a gltf", this.name);
|
|
@@ -239,15 +247,4 @@ class CameraSkybox {
|
|
|
239
247
|
}
|
|
240
248
|
}
|
|
241
249
|
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
export function createCameraWithOrbitControl(scene: THREE.Scene): Camera {
|
|
245
|
-
const srcId = "created/implictly";
|
|
246
|
-
const go = new THREE.Object3D();
|
|
247
|
-
scene.add(go);
|
|
248
|
-
const cam = GameObject.addNewComponent(go, Camera, false);
|
|
249
|
-
cam.sourceId = srcId;
|
|
250
|
-
const orbit = GameObject.addNewComponent(go, OrbitControls, false);
|
|
251
|
-
orbit.sourceId = srcId;
|
|
252
|
-
return cam;
|
|
253
250
|
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { OrbitControls } from "./OrbitControls";
|
|
2
|
+
import { Camera } from "./Camera";
|
|
3
|
+
import { addNewComponentInstance } from "../engine/engine_components";
|
|
4
|
+
import { Object3D, Scene } from "three";
|
|
5
|
+
|
|
6
|
+
export function createCameraWithOrbitControl(scene: Scene): Camera {
|
|
7
|
+
const srcId = "created/implictly";
|
|
8
|
+
const go = new Object3D();
|
|
9
|
+
scene.add(go);
|
|
10
|
+
const cam = addNewComponentInstance(go, new Camera(), false);
|
|
11
|
+
cam.sourceId = srcId;
|
|
12
|
+
const orbit = addNewComponentInstance(go, new OrbitControls(), false);
|
|
13
|
+
orbit.sourceId = srcId;
|
|
14
|
+
return cam as Camera;
|
|
15
|
+
}
|