@needle-tools/engine 4.14.0-beta → 4.14.0-next.52fdb13
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 +1 -1
- package/components.needle.json +1 -1
- package/dist/{needle-engine.bundle-BW2VusZV.min.js → needle-engine.bundle-BwfaInTa.min.js} +131 -123
- package/dist/{needle-engine.bundle-Cb5bKEqa.umd.cjs → needle-engine.bundle-DJE-Bjpa.umd.cjs} +124 -116
- package/dist/{needle-engine.bundle-D9VPvp5o.js → needle-engine.bundle-TmE5-_na.js} +3457 -3227
- package/dist/needle-engine.d.ts +430 -94
- package/dist/needle-engine.js +570 -569
- package/dist/needle-engine.min.js +1 -1
- package/dist/needle-engine.umd.cjs +1 -1
- package/dist/{postprocessing-CctM1XIO.min.js → postprocessing-06AXuvdv.min.js} +2 -2
- package/dist/{postprocessing-DGm6qJ-I.js → postprocessing-CI2x8Cln.js} +2 -2
- package/dist/{postprocessing-Dbl2PJpd.umd.cjs → postprocessing-CPDcA21P.umd.cjs} +2 -2
- package/lib/engine/api.d.ts +203 -18
- package/lib/engine/api.js +271 -18
- package/lib/engine/api.js.map +1 -1
- package/lib/engine/engine_accessibility.d.ts +58 -0
- package/lib/engine/engine_accessibility.js +143 -0
- package/lib/engine/engine_accessibility.js.map +1 -0
- package/lib/engine/engine_context.d.ts +2 -0
- package/lib/engine/engine_context.js +7 -0
- package/lib/engine/engine_context.js.map +1 -1
- package/lib/engine/engine_materialpropertyblock.d.ts +91 -5
- package/lib/engine/engine_materialpropertyblock.js +97 -7
- package/lib/engine/engine_materialpropertyblock.js.map +1 -1
- package/lib/engine/engine_math.d.ts +34 -1
- package/lib/engine/engine_math.js +34 -1
- package/lib/engine/engine_math.js.map +1 -1
- package/lib/engine/engine_networking.js +1 -1
- package/lib/engine/engine_networking.js.map +1 -1
- package/lib/engine/engine_types.d.ts +2 -0
- package/lib/engine/engine_types.js +2 -0
- package/lib/engine/engine_types.js.map +1 -1
- package/lib/engine/webcomponents/icons.js +3 -0
- package/lib/engine/webcomponents/icons.js.map +1 -1
- package/lib/engine/webcomponents/logo-element.d.ts +1 -0
- package/lib/engine/webcomponents/logo-element.js +3 -1
- package/lib/engine/webcomponents/logo-element.js.map +1 -1
- package/lib/engine/webcomponents/needle-button.d.ts +37 -11
- package/lib/engine/webcomponents/needle-button.js +42 -11
- package/lib/engine/webcomponents/needle-button.js.map +1 -1
- package/lib/engine/webcomponents/needle-engine.d.ts +10 -2
- package/lib/engine/webcomponents/needle-engine.js +13 -3
- package/lib/engine/webcomponents/needle-engine.js.map +1 -1
- package/lib/engine-components/Component.d.ts +1 -2
- package/lib/engine-components/Component.js +1 -2
- package/lib/engine-components/Component.js.map +1 -1
- package/lib/engine-components/DragControls.d.ts +1 -0
- package/lib/engine-components/DragControls.js +21 -0
- package/lib/engine-components/DragControls.js.map +1 -1
- package/lib/engine-components/GroundProjection.js.map +1 -1
- package/lib/engine-components/NeedleMenu.d.ts +2 -0
- package/lib/engine-components/NeedleMenu.js +2 -0
- package/lib/engine-components/NeedleMenu.js.map +1 -1
- package/lib/engine-components/Networking.d.ts +28 -3
- package/lib/engine-components/Networking.js +28 -3
- package/lib/engine-components/Networking.js.map +1 -1
- package/lib/engine-components/ReflectionProbe.d.ts +1 -0
- package/lib/engine-components/ReflectionProbe.js +21 -3
- package/lib/engine-components/ReflectionProbe.js.map +1 -1
- package/lib/engine-components/RendererLightmap.js +1 -1
- package/lib/engine-components/RendererLightmap.js.map +1 -1
- package/lib/engine-components/SeeThrough.js +1 -1
- package/lib/engine-components/SeeThrough.js.map +1 -1
- package/lib/engine-components/export/usdz/extensions/behavior/BehaviourComponents.d.ts +107 -13
- package/lib/engine-components/export/usdz/extensions/behavior/BehaviourComponents.js +167 -30
- package/lib/engine-components/export/usdz/extensions/behavior/BehaviourComponents.js.map +1 -1
- package/lib/engine-components/ui/Button.d.ts +1 -0
- package/lib/engine-components/ui/Button.js +11 -0
- package/lib/engine-components/ui/Button.js.map +1 -1
- package/lib/engine-components/ui/Text.d.ts +1 -0
- package/lib/engine-components/ui/Text.js +11 -0
- package/lib/engine-components/ui/Text.js.map +1 -1
- package/lib/engine-components/web/ViewBox.js.map +1 -1
- package/package.json +2 -2
- package/src/engine/api.ts +371 -19
- package/src/engine/engine_accessibility.ts +178 -0
- package/src/engine/engine_context.ts +9 -0
- package/src/engine/engine_materialpropertyblock.ts +103 -12
- package/src/engine/engine_math.ts +34 -1
- package/src/engine/engine_networking.ts +1 -1
- package/src/engine/engine_types.ts +5 -0
- package/src/engine/webcomponents/icons.ts +3 -0
- package/src/engine/webcomponents/logo-element.ts +4 -1
- package/src/engine/webcomponents/needle-button.ts +44 -13
- package/src/engine/webcomponents/needle-engine.ts +18 -7
- package/src/engine-components/Component.ts +1 -3
- package/src/engine-components/DragControls.ts +29 -4
- package/src/engine-components/GroundProjection.ts +1 -1
- package/src/engine-components/NeedleMenu.ts +5 -3
- package/src/engine-components/Networking.ts +29 -4
- package/src/engine-components/ReflectionProbe.ts +22 -3
- package/src/engine-components/RendererLightmap.ts +1 -1
- package/src/engine-components/SeeThrough.ts +1 -1
- package/src/engine-components/export/usdz/extensions/behavior/BehaviourComponents.ts +198 -65
- package/src/engine-components/ui/Button.ts +12 -0
- package/src/engine-components/ui/Text.ts +13 -0
- package/src/engine-components/web/ViewBox.ts +3 -3
package/lib/engine/api.d.ts
CHANGED
|
@@ -1,86 +1,271 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
2
|
+
* The Engine Core API is the main entry point for Needle Engine functionality.
|
|
3
|
+
* It provides a unified interface for building interactive 3D web experiences
|
|
4
|
+
* with features spanning rendering, physics, networking, XR, and more.
|
|
5
|
+
*
|
|
6
|
+
* ## Quick Start
|
|
7
|
+
* ```typescript
|
|
8
|
+
* import { Context, Behaviour, serializable } from "@needle-tools/engine";
|
|
9
|
+
*
|
|
10
|
+
* class MyComponent extends Behaviour {
|
|
11
|
+
* @serializable()
|
|
12
|
+
* speed: number = 1;
|
|
13
|
+
*
|
|
14
|
+
* update() {
|
|
15
|
+
* this.gameObject.rotateY(this.context.time.deltaTime * this.speed);
|
|
16
|
+
* }
|
|
17
|
+
* }
|
|
18
|
+
* ```
|
|
19
|
+
*
|
|
20
|
+
* ## Module Categories
|
|
21
|
+
*
|
|
22
|
+
* ### Context & Application
|
|
23
|
+
* The {@link Context} class is the central hub that manages the scene, renderer, camera,
|
|
24
|
+
* and all engine systems. Access it via `this.context` in any component.
|
|
25
|
+
* - {@link Context} - Main engine context managing scene, renderer, and systems
|
|
26
|
+
* - {@link ContextRegistry} - Registry for multiple engine contexts
|
|
27
|
+
* - {@link Application} - Application-level utilities and state
|
|
28
|
+
*
|
|
29
|
+
* ### Components & GameObjects
|
|
30
|
+
* Needle Engine uses a component-based architecture similar to Unity.
|
|
31
|
+
* Components are attached to three.js Object3D instances (GameObjects).
|
|
32
|
+
* - {@link addComponent}, {@link getComponent}, {@link removeComponent} - Component management
|
|
33
|
+
* - {@link findObjectOfType}, {@link findObjectsOfType} - Scene queries
|
|
34
|
+
* - {@link instantiate}, {@link destroy} - Object lifecycle
|
|
35
|
+
* @see {@link https://engine.needle.tools/docs/scripting.html | Scripting Documentation}
|
|
36
|
+
*
|
|
37
|
+
* ### Asset Loading
|
|
38
|
+
* Load glTF/GLB files, textures, and other assets at runtime.
|
|
39
|
+
* - {@link loadSync}, {@link parseSync} - Load glTF/GLB assets
|
|
40
|
+
* - {@link AssetDatabase} - Asset reference management
|
|
41
|
+
* - {@link Addressables} - Addressable asset system
|
|
42
|
+
* @see {@link https://engine.needle.tools/docs/addressables.html | Addressables Documentation}
|
|
43
|
+
*
|
|
44
|
+
* ### Input System
|
|
45
|
+
* Unified input handling for mouse, touch, keyboard, and XR controllers.
|
|
46
|
+
* Access via `this.context.input` in components.
|
|
47
|
+
* - {@link Input} - Unified input manager
|
|
48
|
+
* - {@link NEPointerEvent} - Cross-platform pointer events
|
|
49
|
+
* - {@link InputEvents} - Event types for input listeners
|
|
50
|
+
* @see {@link https://engine.needle.tools/docs/input.html | Input Documentation}
|
|
51
|
+
*
|
|
52
|
+
* ### Physics & Raycasting
|
|
53
|
+
* Rapier-based physics engine with collision detection and raycasting.
|
|
54
|
+
* - {@link Physics} - Physics world access and raycasting
|
|
55
|
+
* - {@link RaycastOptions} - Configure raycast behavior
|
|
56
|
+
* - {@link Collision}, {@link ContactPoint} - Collision data types
|
|
57
|
+
* @see {@link https://engine.needle.tools/docs/physics.html | Physics Documentation}
|
|
58
|
+
*
|
|
59
|
+
* ### Networking
|
|
60
|
+
* Real-time multiplayer networking with automatic state synchronization.
|
|
61
|
+
* - {@link NetworkConnection} - WebSocket connection management
|
|
62
|
+
* - {@link RoomEvents} - Room join/leave events
|
|
63
|
+
* - {@link syncField} - Decorator for automatic field synchronization
|
|
64
|
+
* - {@link PeerNetworking} - WebRTC peer-to-peer connections
|
|
65
|
+
* @see {@link https://engine.needle.tools/docs/networking.html | Networking Documentation}
|
|
66
|
+
*
|
|
67
|
+
* ### XR (AR/VR)
|
|
68
|
+
* WebXR support for augmented and virtual reality experiences.
|
|
69
|
+
* - {@link NeedleXRSession} - XR session management
|
|
70
|
+
* - {@link NeedleXRController} - XR controller input and tracking
|
|
71
|
+
* - {@link XRRig} - XR camera rig configuration
|
|
72
|
+
* @see {@link https://engine.needle.tools/docs/xr.html | XR Documentation}
|
|
73
|
+
*
|
|
74
|
+
* ### Time & Animation
|
|
75
|
+
* Frame timing and animation utilities.
|
|
76
|
+
* - {@link Time} - Delta time, frame count, time scale
|
|
77
|
+
* - {@link AnimationUtils} - Animation playback helpers
|
|
78
|
+
* - Coroutines via {@link startCoroutine} for async sequences
|
|
79
|
+
*
|
|
80
|
+
* ### Debugging & Gizmos
|
|
81
|
+
* Visual debugging tools for development.
|
|
82
|
+
* - {@link Gizmos} - Draw debug shapes (lines, spheres, boxes)
|
|
83
|
+
* - {@link showBalloonMessage}, {@link showBalloonWarning} - On-screen messages
|
|
84
|
+
* - {@link isDevEnvironment} - Check if running in development mode
|
|
85
|
+
*
|
|
86
|
+
* ### Utilities
|
|
87
|
+
* Helper functions for common operations.
|
|
88
|
+
* - {@link getParam} - URL parameter parsing
|
|
89
|
+
* - {@link delay} - Promise-based delay
|
|
90
|
+
* - {@link generateQRCode} - QR code generation
|
|
91
|
+
* - Math utilities: {@link Mathf}, vector operations
|
|
18
92
|
*
|
|
19
93
|
* @module Engine Core
|
|
94
|
+
* @see {@link https://engine.needle.tools/docs/ | Needle Engine Documentation}
|
|
20
95
|
*/
|
|
21
96
|
export * from "./debug/index.js";
|
|
97
|
+
/** Addressable asset system for loading assets by address/label */
|
|
22
98
|
export * from "./engine_addressables.js";
|
|
99
|
+
/** Animation playback and control utilities */
|
|
23
100
|
export { AnimationUtils } from "./engine_animation.js";
|
|
101
|
+
/** Application-level state and utilities */
|
|
24
102
|
export { Application } from "./engine_application.js";
|
|
103
|
+
/** Asset database for managing asset references */
|
|
25
104
|
export * from "./engine_assetdatabase.js";
|
|
105
|
+
/** Camera fitting utilities for framing objects */
|
|
26
106
|
export * from "./engine_camera.fit.js";
|
|
107
|
+
/** Camera controller management and auto-fit configuration */
|
|
27
108
|
export { getCameraController, setAutoFitEnabled, setCameraController, useForAutoFit } from "./engine_camera.js";
|
|
109
|
+
/**
|
|
110
|
+
* Component management functions: addComponent, getComponent, removeComponent, etc.
|
|
111
|
+
* @see {@link https://engine.needle.tools/docs/scripting.html | Scripting Documentation}
|
|
112
|
+
*/
|
|
28
113
|
export * from "./engine_components.js";
|
|
114
|
+
/** Internal component lifecycle events and management */
|
|
29
115
|
export * from "./engine_components_internal.js";
|
|
30
|
-
|
|
116
|
+
/** Engine constants and configuration values */
|
|
31
117
|
export * from "./engine_constants.js";
|
|
118
|
+
/**
|
|
119
|
+
* Main engine context class - the central hub for all engine systems.
|
|
120
|
+
* Provides access to scene, renderer, camera, input, physics, networking, and more.
|
|
121
|
+
* @see {@link https://engine.needle.tools/docs/scripting.html#context | Context Documentation}
|
|
122
|
+
*/
|
|
32
123
|
export * from "./engine_context.js";
|
|
124
|
+
/** Registry for managing multiple engine contexts */
|
|
33
125
|
export * from "./engine_context_registry.js";
|
|
126
|
+
/**
|
|
127
|
+
* Coroutine system for async sequences in components.
|
|
128
|
+
* Use startCoroutine() for frame-based async operations.
|
|
129
|
+
*/
|
|
34
130
|
export * from "./engine_coroutine.js";
|
|
131
|
+
/** Factory functions for creating primitives and objects */
|
|
35
132
|
export * from "./engine_create_objects.js";
|
|
133
|
+
/** Feature flags for enabling/disabling engine features */
|
|
36
134
|
export * from "./engine_feature_flags.js";
|
|
135
|
+
/**
|
|
136
|
+
* GameObject utilities: instantiate, destroy, find, traverse.
|
|
137
|
+
* @see {@link https://engine.needle.tools/docs/scripting.html#finding-objects | Finding Objects}
|
|
138
|
+
*/
|
|
37
139
|
export * from "./engine_gameobject.js";
|
|
140
|
+
/**
|
|
141
|
+
* Visual debugging with Gizmos - draw lines, spheres, boxes for debugging.
|
|
142
|
+
* @see {@link https://engine.needle.tools/docs/debugging.html | Debugging Documentation}
|
|
143
|
+
*/
|
|
38
144
|
export { Gizmos } from "./engine_gizmos.js";
|
|
145
|
+
/** glTF/GLB loader registration and management */
|
|
39
146
|
export * from "./engine_gltf.js";
|
|
147
|
+
/** Hot reload support for development */
|
|
40
148
|
export * from "./engine_hot_reload.js";
|
|
149
|
+
/**
|
|
150
|
+
* Unified input system supporting mouse, touch, keyboard, and XR controllers.
|
|
151
|
+
* Access via this.context.input in components.
|
|
152
|
+
* @see {@link https://engine.needle.tools/docs/input.html | Input Documentation}
|
|
153
|
+
*/
|
|
41
154
|
export * from "./engine_input.js";
|
|
155
|
+
/** GPU instancing utilities for rendering many similar objects efficiently */
|
|
42
156
|
export { InstancingUtil } from "./engine_instancing.js";
|
|
157
|
+
/** License checking utilities */
|
|
43
158
|
export { hasCommercialLicense, hasIndieLicense, hasProLicense } from "./engine_license.js";
|
|
159
|
+
/** Lifecycle API for registering global callbacks */
|
|
44
160
|
export * from "./engine_lifecycle_api.js";
|
|
161
|
+
/** Model loader callbacks for customizing load behavior */
|
|
45
162
|
export { NeedleEngineModelLoader } from "./engine_loaders.callbacks.js";
|
|
163
|
+
/**
|
|
164
|
+
* Asset loading functions: loadSync, parseSync for glTF/GLB files.
|
|
165
|
+
* @see {@link https://engine.needle.tools/docs/addressables.html | Loading Assets}
|
|
166
|
+
*/
|
|
46
167
|
export { loadAsset, loadSync, parseSync } from "./engine_loaders.js";
|
|
168
|
+
/** MaterialPropertyBlock for efficient material property overrides per-instance */
|
|
169
|
+
export { MaterialPropertyBlock } from "./engine_materialpropertyblock.js";
|
|
170
|
+
/** Math utilities: Mathf, interpolation, easing functions */
|
|
47
171
|
export * from "./engine_math.js";
|
|
172
|
+
/** Engine modules registry */
|
|
48
173
|
export { MODULES as NEEDLE_ENGINE_MODULES } from "./engine_modules.js";
|
|
174
|
+
/**
|
|
175
|
+
* Core networking: NetworkConnection, RoomEvents, OwnershipEvent.
|
|
176
|
+
* @see {@link https://engine.needle.tools/docs/networking.html | Networking Documentation}
|
|
177
|
+
*/
|
|
49
178
|
export * from "./engine_networking.js";
|
|
179
|
+
/**
|
|
180
|
+
* @syncField decorator for automatic field synchronization across clients.
|
|
181
|
+
* @see {@link https://engine.needle.tools/docs/networking.html#synced-variables | Synced Variables}
|
|
182
|
+
*/
|
|
50
183
|
export { syncField } from "./engine_networking_auto.js";
|
|
184
|
+
/** Blob/binary data transfer over network */
|
|
51
185
|
export * from "./engine_networking_blob.js";
|
|
186
|
+
/** File transfer utilities for networking */
|
|
52
187
|
export * from "./engine_networking_files.js";
|
|
188
|
+
/**
|
|
189
|
+
* Network instantiation for spawning synced objects.
|
|
190
|
+
* @see {@link https://engine.needle.tools/docs/networking.html#spawning-objects | Spawning Objects}
|
|
191
|
+
*/
|
|
53
192
|
export * from "./engine_networking_instantiate.js";
|
|
193
|
+
/** WebRTC peer-to-peer networking for direct client connections */
|
|
54
194
|
export * from "./engine_networking_peer.js";
|
|
195
|
+
/** Media streaming utilities (audio/video) */
|
|
55
196
|
export * from "./engine_networking_streams.js";
|
|
197
|
+
/** Networking type definitions and interfaces */
|
|
56
198
|
export * from "./engine_networking_types.js";
|
|
199
|
+
/** Networking utility functions */
|
|
57
200
|
export * from "./engine_networking_utils.js";
|
|
58
|
-
|
|
201
|
+
/** Object patching utilities */
|
|
59
202
|
export * from "./engine_patcher.js";
|
|
203
|
+
/**
|
|
204
|
+
* Physics system: raycasting, collision queries, physics world access.
|
|
205
|
+
* @see {@link https://engine.needle.tools/docs/physics.html | Physics Documentation}
|
|
206
|
+
*/
|
|
60
207
|
export * from "./engine_physics.js";
|
|
208
|
+
/** Physics type definitions: RaycastOptions, Collision, ContactPoint */
|
|
61
209
|
export * from "./engine_physics.types.js";
|
|
210
|
+
/** Rapier physics engine integration */
|
|
62
211
|
export * from "./engine_physics_rapier.js";
|
|
212
|
+
/** Player view management for multi-user scenarios */
|
|
63
213
|
export * from "./engine_playerview.js";
|
|
214
|
+
/** PMREM (Prefiltered Mipmapped Radiance Environment Map) loading */
|
|
64
215
|
export { loadPMREM } from "./engine_pmrem.js";
|
|
216
|
+
/** Scene lighting data and environment configuration */
|
|
65
217
|
export * from "./engine_scenelighting.js";
|
|
218
|
+
/**
|
|
219
|
+
* Serialization utilities for components and objects.
|
|
220
|
+
* @see {@link https://engine.needle.tools/docs/scripting.html#serialization | Serialization Documentation}
|
|
221
|
+
*/
|
|
66
222
|
export * from "./engine_serialization.js";
|
|
223
|
+
/** Serialization core interfaces */
|
|
67
224
|
export { type ISerializable } from "./engine_serialization_core.js";
|
|
225
|
+
/** Testing utilities for automated tests */
|
|
68
226
|
export * from "./engine_test_utils.js";
|
|
227
|
+
/** Texture utilities and processing */
|
|
69
228
|
export * from "./engine_texture.js";
|
|
229
|
+
/** Three.js helper utilities: getWorldPosition, getTempVector, etc. */
|
|
70
230
|
export * from "./engine_three_utils.js";
|
|
231
|
+
/**
|
|
232
|
+
* Time class: deltaTime, time, frameCount, timeScale.
|
|
233
|
+
* Access via this.context.time in components.
|
|
234
|
+
*/
|
|
71
235
|
export * from "./engine_time.js";
|
|
236
|
+
/** Time-related utility functions */
|
|
72
237
|
export * from "./engine_time_utils.js";
|
|
238
|
+
/** Core type definitions and interfaces */
|
|
73
239
|
export * from "./engine_types.js";
|
|
240
|
+
/** Type registration for component discovery */
|
|
74
241
|
export { registerType, TypeStore } from "./engine_typestore.js";
|
|
242
|
+
/** Decorator utilities: @prefix, @validate */
|
|
75
243
|
export { prefix, validate } from "./engine_util_decorator.js";
|
|
244
|
+
/** General utilities: getParam, delay, DeviceUtilities, etc. */
|
|
76
245
|
export * from "./engine_utils.js";
|
|
246
|
+
/** Formatting utilities for strings and numbers */
|
|
77
247
|
export * from "./engine_utils_format.js";
|
|
248
|
+
/** QR code generation utility */
|
|
78
249
|
export { generateQRCode } from "./engine_utils_qrcode.js";
|
|
250
|
+
/** Screenshot capture utilities */
|
|
79
251
|
export * from "./engine_utils_screenshot.js";
|
|
252
|
+
/** Export utilities and formats */
|
|
80
253
|
export * from "./export/index.js";
|
|
254
|
+
/** glTF extension implementations (NEEDLE_components, etc.) */
|
|
81
255
|
export * from "./extensions/index.js";
|
|
256
|
+
/** JavaScript object extensions for three.js objects */
|
|
82
257
|
export * from "./js-extensions/index.js";
|
|
258
|
+
/** Web component API utilities */
|
|
83
259
|
export * from "./webcomponents/api.js";
|
|
260
|
+
/**
|
|
261
|
+
* <needle-engine> web component for embedding 3D scenes.
|
|
262
|
+
* @see {@link https://engine.needle.tools/docs/html.html | HTML Integration}
|
|
263
|
+
*/
|
|
84
264
|
export * from "./webcomponents/needle-engine.js";
|
|
265
|
+
/** Loading screen and progress indicators */
|
|
85
266
|
export * from "./webcomponents/needle-engine.loading.js";
|
|
267
|
+
/**
|
|
268
|
+
* XR API: NeedleXRSession, NeedleXRController, XRRig.
|
|
269
|
+
* @see {@link https://engine.needle.tools/docs/xr.html | XR Documentation}
|
|
270
|
+
*/
|
|
86
271
|
export * from "./xr/api.js";
|
package/lib/engine/api.js
CHANGED
|
@@ -1,86 +1,339 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
2
|
+
* The Engine Core API is the main entry point for Needle Engine functionality.
|
|
3
|
+
* It provides a unified interface for building interactive 3D web experiences
|
|
4
|
+
* with features spanning rendering, physics, networking, XR, and more.
|
|
5
|
+
*
|
|
6
|
+
* ## Quick Start
|
|
7
|
+
* ```typescript
|
|
8
|
+
* import { Context, Behaviour, serializable } from "@needle-tools/engine";
|
|
9
|
+
*
|
|
10
|
+
* class MyComponent extends Behaviour {
|
|
11
|
+
* @serializable()
|
|
12
|
+
* speed: number = 1;
|
|
13
|
+
*
|
|
14
|
+
* update() {
|
|
15
|
+
* this.gameObject.rotateY(this.context.time.deltaTime * this.speed);
|
|
16
|
+
* }
|
|
17
|
+
* }
|
|
18
|
+
* ```
|
|
19
|
+
*
|
|
20
|
+
* ## Module Categories
|
|
21
|
+
*
|
|
22
|
+
* ### Context & Application
|
|
23
|
+
* The {@link Context} class is the central hub that manages the scene, renderer, camera,
|
|
24
|
+
* and all engine systems. Access it via `this.context` in any component.
|
|
25
|
+
* - {@link Context} - Main engine context managing scene, renderer, and systems
|
|
26
|
+
* - {@link ContextRegistry} - Registry for multiple engine contexts
|
|
27
|
+
* - {@link Application} - Application-level utilities and state
|
|
28
|
+
*
|
|
29
|
+
* ### Components & GameObjects
|
|
30
|
+
* Needle Engine uses a component-based architecture similar to Unity.
|
|
31
|
+
* Components are attached to three.js Object3D instances (GameObjects).
|
|
32
|
+
* - {@link addComponent}, {@link getComponent}, {@link removeComponent} - Component management
|
|
33
|
+
* - {@link findObjectOfType}, {@link findObjectsOfType} - Scene queries
|
|
34
|
+
* - {@link instantiate}, {@link destroy} - Object lifecycle
|
|
35
|
+
* @see {@link https://engine.needle.tools/docs/scripting.html | Scripting Documentation}
|
|
36
|
+
*
|
|
37
|
+
* ### Asset Loading
|
|
38
|
+
* Load glTF/GLB files, textures, and other assets at runtime.
|
|
39
|
+
* - {@link loadSync}, {@link parseSync} - Load glTF/GLB assets
|
|
40
|
+
* - {@link AssetDatabase} - Asset reference management
|
|
41
|
+
* - {@link Addressables} - Addressable asset system
|
|
42
|
+
* @see {@link https://engine.needle.tools/docs/addressables.html | Addressables Documentation}
|
|
43
|
+
*
|
|
44
|
+
* ### Input System
|
|
45
|
+
* Unified input handling for mouse, touch, keyboard, and XR controllers.
|
|
46
|
+
* Access via `this.context.input` in components.
|
|
47
|
+
* - {@link Input} - Unified input manager
|
|
48
|
+
* - {@link NEPointerEvent} - Cross-platform pointer events
|
|
49
|
+
* - {@link InputEvents} - Event types for input listeners
|
|
50
|
+
* @see {@link https://engine.needle.tools/docs/input.html | Input Documentation}
|
|
51
|
+
*
|
|
52
|
+
* ### Physics & Raycasting
|
|
53
|
+
* Rapier-based physics engine with collision detection and raycasting.
|
|
54
|
+
* - {@link Physics} - Physics world access and raycasting
|
|
55
|
+
* - {@link RaycastOptions} - Configure raycast behavior
|
|
56
|
+
* - {@link Collision}, {@link ContactPoint} - Collision data types
|
|
57
|
+
* @see {@link https://engine.needle.tools/docs/physics.html | Physics Documentation}
|
|
58
|
+
*
|
|
59
|
+
* ### Networking
|
|
60
|
+
* Real-time multiplayer networking with automatic state synchronization.
|
|
61
|
+
* - {@link NetworkConnection} - WebSocket connection management
|
|
62
|
+
* - {@link RoomEvents} - Room join/leave events
|
|
63
|
+
* - {@link syncField} - Decorator for automatic field synchronization
|
|
64
|
+
* - {@link PeerNetworking} - WebRTC peer-to-peer connections
|
|
65
|
+
* @see {@link https://engine.needle.tools/docs/networking.html | Networking Documentation}
|
|
66
|
+
*
|
|
67
|
+
* ### XR (AR/VR)
|
|
68
|
+
* WebXR support for augmented and virtual reality experiences.
|
|
69
|
+
* - {@link NeedleXRSession} - XR session management
|
|
70
|
+
* - {@link NeedleXRController} - XR controller input and tracking
|
|
71
|
+
* - {@link XRRig} - XR camera rig configuration
|
|
72
|
+
* @see {@link https://engine.needle.tools/docs/xr.html | XR Documentation}
|
|
73
|
+
*
|
|
74
|
+
* ### Time & Animation
|
|
75
|
+
* Frame timing and animation utilities.
|
|
76
|
+
* - {@link Time} - Delta time, frame count, time scale
|
|
77
|
+
* - {@link AnimationUtils} - Animation playback helpers
|
|
78
|
+
* - Coroutines via {@link startCoroutine} for async sequences
|
|
79
|
+
*
|
|
80
|
+
* ### Debugging & Gizmos
|
|
81
|
+
* Visual debugging tools for development.
|
|
82
|
+
* - {@link Gizmos} - Draw debug shapes (lines, spheres, boxes)
|
|
83
|
+
* - {@link showBalloonMessage}, {@link showBalloonWarning} - On-screen messages
|
|
84
|
+
* - {@link isDevEnvironment} - Check if running in development mode
|
|
85
|
+
*
|
|
86
|
+
* ### Utilities
|
|
87
|
+
* Helper functions for common operations.
|
|
88
|
+
* - {@link getParam} - URL parameter parsing
|
|
89
|
+
* - {@link delay} - Promise-based delay
|
|
90
|
+
* - {@link generateQRCode} - QR code generation
|
|
91
|
+
* - Math utilities: {@link Mathf}, vector operations
|
|
18
92
|
*
|
|
19
93
|
* @module Engine Core
|
|
94
|
+
* @see {@link https://engine.needle.tools/docs/ | Needle Engine Documentation}
|
|
20
95
|
*/
|
|
96
|
+
// ============================================================================
|
|
97
|
+
// DEBUGGING & DEVELOPMENT
|
|
98
|
+
// Debugging utilities, gizmos, and development tools.
|
|
99
|
+
// ============================================================================
|
|
21
100
|
export * from "./debug/index.js";
|
|
101
|
+
// ============================================================================
|
|
102
|
+
// ASSET LOADING & MANAGEMENT
|
|
103
|
+
// Systems for loading, managing, and referencing assets at runtime.
|
|
104
|
+
// ============================================================================
|
|
105
|
+
/** Addressable asset system for loading assets by address/label */
|
|
22
106
|
export * from "./engine_addressables.js";
|
|
107
|
+
/** Animation playback and control utilities */
|
|
23
108
|
export { AnimationUtils } from "./engine_animation.js";
|
|
109
|
+
/** Application-level state and utilities */
|
|
24
110
|
export { Application } from "./engine_application.js";
|
|
111
|
+
/** Asset database for managing asset references */
|
|
25
112
|
export * from "./engine_assetdatabase.js";
|
|
113
|
+
// ============================================================================
|
|
114
|
+
// CAMERA & RENDERING
|
|
115
|
+
// Camera control, rendering utilities, and visual effects.
|
|
116
|
+
// ============================================================================
|
|
117
|
+
/** Camera fitting utilities for framing objects */
|
|
26
118
|
export * from "./engine_camera.fit.js";
|
|
119
|
+
/** Camera controller management and auto-fit configuration */
|
|
27
120
|
export { getCameraController, setAutoFitEnabled, setCameraController, useForAutoFit } from "./engine_camera.js";
|
|
121
|
+
// ============================================================================
|
|
122
|
+
// COMPONENTS & GAMEOBJECTS
|
|
123
|
+
// Component-based architecture for building interactive 3D content.
|
|
124
|
+
// Functions for adding, removing, and querying components on objects.
|
|
125
|
+
// ============================================================================
|
|
126
|
+
/**
|
|
127
|
+
* Component management functions: addComponent, getComponent, removeComponent, etc.
|
|
128
|
+
* @see {@link https://engine.needle.tools/docs/scripting.html | Scripting Documentation}
|
|
129
|
+
*/
|
|
28
130
|
export * from "./engine_components.js";
|
|
131
|
+
/** Internal component lifecycle events and management */
|
|
29
132
|
export * from "./engine_components_internal.js";
|
|
30
|
-
|
|
133
|
+
/** Engine constants and configuration values */
|
|
31
134
|
export * from "./engine_constants.js";
|
|
135
|
+
// ============================================================================
|
|
136
|
+
// CONTEXT & LIFECYCLE
|
|
137
|
+
// Core engine context and application lifecycle management.
|
|
138
|
+
// ============================================================================
|
|
139
|
+
/**
|
|
140
|
+
* Main engine context class - the central hub for all engine systems.
|
|
141
|
+
* Provides access to scene, renderer, camera, input, physics, networking, and more.
|
|
142
|
+
* @see {@link https://engine.needle.tools/docs/scripting.html#context | Context Documentation}
|
|
143
|
+
*/
|
|
32
144
|
export * from "./engine_context.js";
|
|
145
|
+
/** Registry for managing multiple engine contexts */
|
|
33
146
|
export * from "./engine_context_registry.js";
|
|
147
|
+
/**
|
|
148
|
+
* Coroutine system for async sequences in components.
|
|
149
|
+
* Use startCoroutine() for frame-based async operations.
|
|
150
|
+
*/
|
|
34
151
|
export * from "./engine_coroutine.js";
|
|
152
|
+
/** Factory functions for creating primitives and objects */
|
|
35
153
|
export * from "./engine_create_objects.js";
|
|
154
|
+
/** Feature flags for enabling/disabling engine features */
|
|
36
155
|
export * from "./engine_feature_flags.js";
|
|
156
|
+
/**
|
|
157
|
+
* GameObject utilities: instantiate, destroy, find, traverse.
|
|
158
|
+
* @see {@link https://engine.needle.tools/docs/scripting.html#finding-objects | Finding Objects}
|
|
159
|
+
*/
|
|
37
160
|
export * from "./engine_gameobject.js";
|
|
161
|
+
/**
|
|
162
|
+
* Visual debugging with Gizmos - draw lines, spheres, boxes for debugging.
|
|
163
|
+
* @see {@link https://engine.needle.tools/docs/debugging.html | Debugging Documentation}
|
|
164
|
+
*/
|
|
38
165
|
export { Gizmos } from "./engine_gizmos.js";
|
|
166
|
+
/** glTF/GLB loader registration and management */
|
|
39
167
|
export * from "./engine_gltf.js";
|
|
168
|
+
/** Hot reload support for development */
|
|
40
169
|
export * from "./engine_hot_reload.js";
|
|
170
|
+
// ============================================================================
|
|
171
|
+
// INPUT SYSTEM
|
|
172
|
+
// Unified input handling for mouse, touch, keyboard, and XR controllers.
|
|
173
|
+
// ============================================================================
|
|
174
|
+
/**
|
|
175
|
+
* Unified input system supporting mouse, touch, keyboard, and XR controllers.
|
|
176
|
+
* Access via this.context.input in components.
|
|
177
|
+
* @see {@link https://engine.needle.tools/docs/input.html | Input Documentation}
|
|
178
|
+
*/
|
|
41
179
|
export * from "./engine_input.js";
|
|
180
|
+
// ============================================================================
|
|
181
|
+
// INSTANCING & PERFORMANCE
|
|
182
|
+
// GPU instancing and performance optimization utilities.
|
|
183
|
+
// ============================================================================
|
|
184
|
+
/** GPU instancing utilities for rendering many similar objects efficiently */
|
|
42
185
|
export { InstancingUtil } from "./engine_instancing.js";
|
|
186
|
+
/** License checking utilities */
|
|
43
187
|
export { hasCommercialLicense, hasIndieLicense, hasProLicense } from "./engine_license.js";
|
|
188
|
+
// ============================================================================
|
|
189
|
+
// LIFECYCLE & LOADING
|
|
190
|
+
// Component lifecycle hooks and asset loading systems.
|
|
191
|
+
// ============================================================================
|
|
192
|
+
/** Lifecycle API for registering global callbacks */
|
|
44
193
|
export * from "./engine_lifecycle_api.js";
|
|
194
|
+
/** Model loader callbacks for customizing load behavior */
|
|
45
195
|
export { NeedleEngineModelLoader } from "./engine_loaders.callbacks.js";
|
|
196
|
+
/**
|
|
197
|
+
* Asset loading functions: loadSync, parseSync for glTF/GLB files.
|
|
198
|
+
* @see {@link https://engine.needle.tools/docs/addressables.html | Loading Assets}
|
|
199
|
+
*/
|
|
46
200
|
export { loadAsset, loadSync, parseSync } from "./engine_loaders.js";
|
|
201
|
+
// ============================================================================
|
|
202
|
+
// MATERIALS & RENDERING
|
|
203
|
+
// Material utilities and rendering helpers.
|
|
204
|
+
// ============================================================================
|
|
205
|
+
/** MaterialPropertyBlock for efficient material property overrides per-instance */
|
|
206
|
+
export { MaterialPropertyBlock } from "./engine_materialpropertyblock.js";
|
|
207
|
+
/** Math utilities: Mathf, interpolation, easing functions */
|
|
47
208
|
export * from "./engine_math.js";
|
|
209
|
+
/** Engine modules registry */
|
|
48
210
|
export { MODULES as NEEDLE_ENGINE_MODULES } from "./engine_modules.js";
|
|
211
|
+
// ============================================================================
|
|
212
|
+
// NETWORKING
|
|
213
|
+
// Real-time multiplayer networking with WebSocket and WebRTC support.
|
|
214
|
+
// ============================================================================
|
|
215
|
+
/**
|
|
216
|
+
* Core networking: NetworkConnection, RoomEvents, OwnershipEvent.
|
|
217
|
+
* @see {@link https://engine.needle.tools/docs/networking.html | Networking Documentation}
|
|
218
|
+
*/
|
|
49
219
|
export * from "./engine_networking.js";
|
|
220
|
+
/**
|
|
221
|
+
* @syncField decorator for automatic field synchronization across clients.
|
|
222
|
+
* @see {@link https://engine.needle.tools/docs/networking.html#synced-variables | Synced Variables}
|
|
223
|
+
*/
|
|
50
224
|
export { syncField } from "./engine_networking_auto.js";
|
|
225
|
+
/** Blob/binary data transfer over network */
|
|
51
226
|
export * from "./engine_networking_blob.js";
|
|
227
|
+
/** File transfer utilities for networking */
|
|
52
228
|
export * from "./engine_networking_files.js";
|
|
229
|
+
/**
|
|
230
|
+
* Network instantiation for spawning synced objects.
|
|
231
|
+
* @see {@link https://engine.needle.tools/docs/networking.html#spawning-objects | Spawning Objects}
|
|
232
|
+
*/
|
|
53
233
|
export * from "./engine_networking_instantiate.js";
|
|
234
|
+
/** WebRTC peer-to-peer networking for direct client connections */
|
|
54
235
|
export * from "./engine_networking_peer.js";
|
|
236
|
+
/** Media streaming utilities (audio/video) */
|
|
55
237
|
export * from "./engine_networking_streams.js";
|
|
238
|
+
/** Networking type definitions and interfaces */
|
|
56
239
|
export * from "./engine_networking_types.js";
|
|
240
|
+
/** Networking utility functions */
|
|
57
241
|
export * from "./engine_networking_utils.js";
|
|
58
|
-
|
|
242
|
+
// ============================================================================
|
|
243
|
+
// PHYSICS & RAYCASTING
|
|
244
|
+
// Rapier-based physics simulation and raycasting.
|
|
245
|
+
// ============================================================================
|
|
246
|
+
/** Object patching utilities */
|
|
59
247
|
export * from "./engine_patcher.js";
|
|
248
|
+
/**
|
|
249
|
+
* Physics system: raycasting, collision queries, physics world access.
|
|
250
|
+
* @see {@link https://engine.needle.tools/docs/physics.html | Physics Documentation}
|
|
251
|
+
*/
|
|
60
252
|
export * from "./engine_physics.js";
|
|
253
|
+
/** Physics type definitions: RaycastOptions, Collision, ContactPoint */
|
|
61
254
|
export * from "./engine_physics.types.js";
|
|
255
|
+
/** Rapier physics engine integration */
|
|
62
256
|
export * from "./engine_physics_rapier.js";
|
|
257
|
+
// ============================================================================
|
|
258
|
+
// PLAYER & VIEW MANAGEMENT
|
|
259
|
+
// Multi-player view management and scene lighting.
|
|
260
|
+
// ============================================================================
|
|
261
|
+
/** Player view management for multi-user scenarios */
|
|
63
262
|
export * from "./engine_playerview.js";
|
|
263
|
+
/** PMREM (Prefiltered Mipmapped Radiance Environment Map) loading */
|
|
64
264
|
export { loadPMREM } from "./engine_pmrem.js";
|
|
265
|
+
/** Scene lighting data and environment configuration */
|
|
65
266
|
export * from "./engine_scenelighting.js";
|
|
267
|
+
// ============================================================================
|
|
268
|
+
// SERIALIZATION
|
|
269
|
+
// Component serialization for saving/loading and networking.
|
|
270
|
+
// ============================================================================
|
|
271
|
+
/**
|
|
272
|
+
* Serialization utilities for components and objects.
|
|
273
|
+
* @see {@link https://engine.needle.tools/docs/scripting.html#serialization | Serialization Documentation}
|
|
274
|
+
*/
|
|
66
275
|
export * from "./engine_serialization.js";
|
|
276
|
+
// ============================================================================
|
|
277
|
+
// UTILITIES & HELPERS
|
|
278
|
+
// General-purpose utility functions and helpers.
|
|
279
|
+
// ============================================================================
|
|
280
|
+
/** Testing utilities for automated tests */
|
|
67
281
|
export * from "./engine_test_utils.js";
|
|
282
|
+
/** Texture utilities and processing */
|
|
68
283
|
export * from "./engine_texture.js";
|
|
284
|
+
/** Three.js helper utilities: getWorldPosition, getTempVector, etc. */
|
|
69
285
|
export * from "./engine_three_utils.js";
|
|
286
|
+
/**
|
|
287
|
+
* Time class: deltaTime, time, frameCount, timeScale.
|
|
288
|
+
* Access via this.context.time in components.
|
|
289
|
+
*/
|
|
70
290
|
export * from "./engine_time.js";
|
|
291
|
+
/** Time-related utility functions */
|
|
71
292
|
export * from "./engine_time_utils.js";
|
|
293
|
+
/** Core type definitions and interfaces */
|
|
72
294
|
export * from "./engine_types.js";
|
|
295
|
+
/** Type registration for component discovery */
|
|
73
296
|
export { registerType, TypeStore } from "./engine_typestore.js";
|
|
297
|
+
/** Decorator utilities: @prefix, @validate */
|
|
74
298
|
export { prefix, validate } from "./engine_util_decorator.js";
|
|
299
|
+
/** General utilities: getParam, delay, DeviceUtilities, etc. */
|
|
75
300
|
export * from "./engine_utils.js";
|
|
301
|
+
/** Formatting utilities for strings and numbers */
|
|
76
302
|
export * from "./engine_utils_format.js";
|
|
303
|
+
/** QR code generation utility */
|
|
77
304
|
export { generateQRCode } from "./engine_utils_qrcode.js";
|
|
305
|
+
/** Screenshot capture utilities */
|
|
78
306
|
export * from "./engine_utils_screenshot.js";
|
|
307
|
+
// ============================================================================
|
|
308
|
+
// EXTENSIONS & INTEGRATIONS
|
|
309
|
+
// glTF extensions and JavaScript object extensions.
|
|
310
|
+
// ============================================================================
|
|
311
|
+
/** Export utilities and formats */
|
|
79
312
|
export * from "./export/index.js";
|
|
313
|
+
/** glTF extension implementations (NEEDLE_components, etc.) */
|
|
80
314
|
export * from "./extensions/index.js";
|
|
315
|
+
/** JavaScript object extensions for three.js objects */
|
|
81
316
|
export * from "./js-extensions/index.js";
|
|
317
|
+
// ============================================================================
|
|
318
|
+
// WEB COMPONENTS
|
|
319
|
+
// Custom HTML elements for embedding Needle Engine.
|
|
320
|
+
// ============================================================================
|
|
321
|
+
/** Web component API utilities */
|
|
82
322
|
export * from "./webcomponents/api.js";
|
|
323
|
+
/**
|
|
324
|
+
* <needle-engine> web component for embedding 3D scenes.
|
|
325
|
+
* @see {@link https://engine.needle.tools/docs/html.html | HTML Integration}
|
|
326
|
+
*/
|
|
83
327
|
export * from "./webcomponents/needle-engine.js";
|
|
328
|
+
/** Loading screen and progress indicators */
|
|
84
329
|
export * from "./webcomponents/needle-engine.loading.js";
|
|
330
|
+
// ============================================================================
|
|
331
|
+
// XR (AR/VR)
|
|
332
|
+
// WebXR support for augmented and virtual reality experiences.
|
|
333
|
+
// ============================================================================
|
|
334
|
+
/**
|
|
335
|
+
* XR API: NeedleXRSession, NeedleXRController, XRRig.
|
|
336
|
+
* @see {@link https://engine.needle.tools/docs/xr.html | XR Documentation}
|
|
337
|
+
*/
|
|
85
338
|
export * from "./xr/api.js";
|
|
86
339
|
//# sourceMappingURL=api.js.map
|