@needle-tools/engine 2.67.5-pre → 2.67.7-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.
Files changed (56) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/needle-engine.js +8732 -8689
  3. package/dist/needle-engine.umd.cjs +227 -227
  4. package/lib/engine/engine_context.d.ts +170 -0
  5. package/lib/engine/engine_context.js +855 -0
  6. package/lib/engine/engine_context.js.map +1 -0
  7. package/lib/engine/engine_gizmos.js +7 -0
  8. package/lib/engine/engine_gizmos.js.map +1 -1
  9. package/lib/engine/engine_setup.d.ts +1 -166
  10. package/lib/engine/engine_setup.js +2 -841
  11. package/lib/engine/engine_setup.js.map +1 -1
  12. package/lib/engine/engine_time.d.ts +2 -0
  13. package/lib/engine/engine_time.js +4 -1
  14. package/lib/engine/engine_time.js.map +1 -1
  15. package/lib/engine-components/AnimatorController.js.map +1 -1
  16. package/lib/engine-components/postprocessing/Effects/DepthOfField.js +1 -0
  17. package/lib/engine-components/postprocessing/Effects/DepthOfField.js.map +1 -1
  18. package/lib/engine-components/postprocessing/Effects/Pixelation.js +0 -1
  19. package/lib/engine-components/postprocessing/Effects/Pixelation.js.map +1 -1
  20. package/lib/engine-components/postprocessing/Effects/ScreenspaceAmbientOcclusion.js +3 -3
  21. package/lib/engine-components/postprocessing/Effects/ScreenspaceAmbientOcclusion.js.map +1 -1
  22. package/lib/engine-components/postprocessing/PostProcessingEffect.js +3 -2
  23. package/lib/engine-components/postprocessing/PostProcessingEffect.js.map +1 -1
  24. package/lib/engine-components/postprocessing/PostProcessingHandler.d.ts +1 -0
  25. package/lib/engine-components/postprocessing/PostProcessingHandler.js +69 -22
  26. package/lib/engine-components/postprocessing/PostProcessingHandler.js.map +1 -1
  27. package/lib/engine-components/postprocessing/Volume.js +5 -5
  28. package/lib/engine-components/postprocessing/Volume.js.map +1 -1
  29. package/lib/engine-components/postprocessing/VolumeParameter.js +1 -1
  30. package/lib/engine-components/postprocessing/VolumeParameter.js.map +1 -1
  31. package/lib/engine-components/ui/Canvas.d.ts +4 -1
  32. package/lib/engine-components/ui/Canvas.js +17 -1
  33. package/lib/engine-components/ui/Canvas.js.map +1 -1
  34. package/lib/engine-components/ui/EventSystem.js +1 -2
  35. package/lib/engine-components/ui/EventSystem.js.map +1 -1
  36. package/lib/engine-components/ui/Text.js +4 -0
  37. package/lib/engine-components/ui/Text.js.map +1 -1
  38. package/lib/engine-components/ui/Utils.js +6 -4
  39. package/lib/engine-components/ui/Utils.js.map +1 -1
  40. package/package.json +1 -1
  41. package/src/engine/engine_context.ts +957 -0
  42. package/src/engine/engine_gizmos.ts +7 -0
  43. package/src/engine/engine_setup.ts +2 -944
  44. package/src/engine/engine_time.ts +4 -1
  45. package/src/engine-components/AnimatorController.ts +2 -2
  46. package/src/engine-components/postprocessing/Effects/DepthOfField.ts +1 -0
  47. package/src/engine-components/postprocessing/Effects/Pixelation.ts +0 -1
  48. package/src/engine-components/postprocessing/Effects/ScreenspaceAmbientOcclusion.ts +2 -2
  49. package/src/engine-components/postprocessing/PostProcessingEffect.ts +3 -2
  50. package/src/engine-components/postprocessing/PostProcessingHandler.ts +74 -29
  51. package/src/engine-components/postprocessing/Volume.ts +10 -10
  52. package/src/engine-components/postprocessing/VolumeParameter.ts +1 -1
  53. package/src/engine-components/ui/Canvas.ts +19 -1
  54. package/src/engine-components/ui/EventSystem.ts +1 -2
  55. package/src/engine-components/ui/Text.ts +3 -0
  56. package/src/engine-components/ui/Utils.ts +6 -4
@@ -0,0 +1,170 @@
1
+ /// <reference types="webxr" />
2
+ import { Camera } from 'three';
3
+ import * as THREE from 'three';
4
+ import { Input } from './engine_input';
5
+ import { Physics } from './engine_physics';
6
+ import { Time } from './engine_time';
7
+ import { NetworkConnection } from './engine_networking';
8
+ import { EffectComposer } from "postprocessing";
9
+ import { AssetDatabase } from './engine_assetdatabase';
10
+ import { RendererData } from './engine_rendererdata';
11
+ import { Addressables } from './engine_addressables';
12
+ import { Application } from './engine_application';
13
+ import { ILightDataRegistry } from './engine_lightdata';
14
+ import { PlayerViewManager } from './engine_playerview';
15
+ import { CoroutineData, ICamera, IComponent, IContext, ILight } from "./engine_types";
16
+ export declare const build_scene_functions: {
17
+ [name: string]: (context: Context) => Promise<void>;
18
+ };
19
+ export declare class LoadingProgressArgs {
20
+ name: string;
21
+ progress: ProgressEvent;
22
+ index: number;
23
+ count: number;
24
+ }
25
+ export declare class LoadingOptions {
26
+ progress: (args: LoadingProgressArgs) => void;
27
+ }
28
+ export declare class ContextArgs {
29
+ name?: string;
30
+ alias?: string;
31
+ domElement: HTMLElement | null;
32
+ renderer?: THREE.WebGLRenderer;
33
+ hash?: string;
34
+ constructor(domElement: HTMLElement | null);
35
+ }
36
+ export declare enum FrameEvent {
37
+ EarlyUpdate = 0,
38
+ Update = 1,
39
+ LateUpdate = 2,
40
+ OnBeforeRender = 3,
41
+ OnAfterRender = 4,
42
+ PrePhysicsStep = 9,
43
+ PostPhysicsStep = 10,
44
+ Undefined = -1
45
+ }
46
+ export declare enum XRSessionMode {
47
+ ImmersiveVR = "immersive-vr",
48
+ ImmersiveAR = "immersive-ar"
49
+ }
50
+ export declare type OnBeforeRenderCallback = (renderer: THREE.WebGLRenderer, scene: THREE.Scene, camera: THREE.Camera, geometry: THREE.BufferGeometry, material: THREE.Material, group: THREE.Group) => void;
51
+ export declare function registerComponent(script: IComponent, context?: Context): void;
52
+ export declare class Context implements IContext {
53
+ private static _current;
54
+ static get Current(): Context;
55
+ static set Current(context: Context);
56
+ name: string;
57
+ alias: string | undefined | null;
58
+ isManagedExternally: boolean;
59
+ isPaused: boolean;
60
+ runInBackground: boolean;
61
+ targetFrameRate?: number;
62
+ /** used to append to loaded assets */
63
+ hash?: string;
64
+ domElement: HTMLElement;
65
+ get resolutionScaleFactor(): number;
66
+ /** use to scale the resolution up or down of the renderer. default is 1 */
67
+ set resolutionScaleFactor(val: number);
68
+ private _resolutionScaleFactor;
69
+ private _boundingClientRectFrame;
70
+ private _boundingClientRect;
71
+ private _domX;
72
+ private _domY;
73
+ private calculateBoundingClientRect;
74
+ get domWidth(): number;
75
+ get domHeight(): number;
76
+ get domX(): number;
77
+ get domY(): number;
78
+ get isInXR(): boolean;
79
+ xrSessionMode: XRSessionMode | undefined;
80
+ get isInVR(): boolean;
81
+ get isInAR(): boolean;
82
+ get xrSession(): XRSession | null;
83
+ get arOverlayElement(): HTMLElement;
84
+ /** Current event of the update cycle */
85
+ get currentFrameEvent(): FrameEvent;
86
+ private _currentFrameEvent;
87
+ scene: THREE.Scene;
88
+ renderer: THREE.WebGLRenderer;
89
+ composer: EffectComposer | null;
90
+ scripts: IComponent[];
91
+ scripts_pausedChanged: IComponent[];
92
+ scripts_earlyUpdate: IComponent[];
93
+ scripts_update: IComponent[];
94
+ scripts_lateUpdate: IComponent[];
95
+ scripts_onBeforeRender: IComponent[];
96
+ scripts_onAfterRender: IComponent[];
97
+ scripts_WithCorroutines: IComponent[];
98
+ coroutines: {
99
+ [FrameEvent: number]: Array<CoroutineData>;
100
+ };
101
+ get mainCamera(): THREE.Camera | null;
102
+ mainCameraComponent: ICamera | undefined;
103
+ post_setup_callbacks: Function[];
104
+ pre_update_callbacks: Function[];
105
+ pre_render_callbacks: Function[];
106
+ post_render_callbacks: Function[];
107
+ new_scripts: IComponent[];
108
+ new_script_start: IComponent[];
109
+ new_scripts_pre_setup_callbacks: Function[];
110
+ new_scripts_post_setup_callbacks: Function[];
111
+ application: Application;
112
+ time: Time;
113
+ input: Input;
114
+ physics: Physics;
115
+ connection: NetworkConnection;
116
+ /**
117
+ * @deprecated AssetDataBase is deprecated
118
+ */
119
+ assets: AssetDatabase;
120
+ mainLight: ILight | null;
121
+ rendererData: RendererData;
122
+ addressables: Addressables;
123
+ lightmaps: ILightDataRegistry;
124
+ players: PlayerViewManager;
125
+ get isCreated(): boolean;
126
+ private _sizeChanged;
127
+ private _isCreated;
128
+ private _isVisible;
129
+ private _stats;
130
+ constructor(args?: ContextArgs);
131
+ private _intersectionObserver;
132
+ private internalOnUpdateVisible;
133
+ private _disposeCallbacks;
134
+ updateSize(): void;
135
+ updateAspect(camera: THREE.PerspectiveCamera, width?: number, height?: number): void;
136
+ onCreate(buildScene?: (context: Context, loadingOptions?: LoadingOptions) => Promise<void>, opts?: LoadingOptions): Promise<void> | null;
137
+ onDestroy(): void;
138
+ registerCoroutineUpdate(script: IComponent, coroutine: Generator, evt: FrameEvent): Generator;
139
+ unregisterCoroutineUpdate(coroutine: Generator, evt: FrameEvent): void;
140
+ stopAllCoroutinesFrom(script: IComponent): void;
141
+ private _cameraStack;
142
+ setCurrentCamera(cam: ICamera): void;
143
+ removeCamera(cam?: ICamera | null): void;
144
+ private _onBeforeRenderListeners;
145
+ /** use this to subscribe to onBeforeRender events on threejs objects */
146
+ addBeforeRenderListener(target: THREE.Object3D, callback: OnBeforeRenderCallback): void;
147
+ removeBeforeRenderListener(target: THREE.Object3D, callback: OnBeforeRenderCallback): void;
148
+ private _requireDepthTexture;
149
+ private _requireColorTexture;
150
+ private _renderTarget?;
151
+ private _isRendering;
152
+ get isRendering(): boolean;
153
+ setRequireDepth(val: boolean): void;
154
+ setRequireColor(val: boolean): void;
155
+ get depthTexture(): THREE.DepthTexture | null;
156
+ get opaqueColorTexture(): THREE.Texture | null;
157
+ /** returns true if the dom element is visible on screen */
158
+ get isVisibleToUser(): boolean;
159
+ private internalOnCreate;
160
+ private _accumulatedTime;
161
+ private _framerateClock;
162
+ private render;
163
+ renderNow(camera?: Camera): boolean;
164
+ /** returns true if we should return out of the frame loop */
165
+ private _wasPaused;
166
+ private onHandlePaused;
167
+ private evaluatePaused;
168
+ private renderRequiredTextures;
169
+ private executeCoroutines;
170
+ }