@needle-tools/engine 5.1.0-alpha → 5.1.0-alpha.2
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/.needle/generated/needle-bindings.gen.d.ts +5 -0
- package/CHANGELOG.md +27 -1
- package/SKILL.md +39 -21
- package/components.needle.json +1 -1
- package/dist/{gltf-progressive-DJBMx-zB.umd.cjs → gltf-progressive-BmblPzFj.umd.cjs} +4 -4
- package/dist/{gltf-progressive-BryRjllq.min.js → gltf-progressive-CN_mbb66.min.js} +2 -2
- package/dist/{gltf-progressive-Cl167Vjx.js → gltf-progressive-DUlhxdv4.js} +5 -2
- package/dist/{needle-engine.bundle-qDahLTqW.min.js → needle-engine.bundle-B-5Q2CpC.min.js} +249 -173
- package/dist/{needle-engine.bundle-CwhCzjep.js → needle-engine.bundle-dit3f1l5.js} +13238 -12724
- package/dist/{needle-engine.bundle-wM-BWPX9.umd.cjs → needle-engine.bundle-qZfVf_v-.umd.cjs} +250 -174
- package/dist/needle-engine.d.ts +295 -31
- package/dist/needle-engine.js +569 -563
- package/dist/needle-engine.min.js +1 -1
- package/dist/needle-engine.umd.cjs +1 -1
- package/dist/{postprocessing-B_9sKVU7.min.js → postprocessing-B571qGWR.min.js} +34 -34
- package/dist/{postprocessing-WDc9WwI3.js → postprocessing-CfrLAbLX.js} +0 -1
- package/dist/{postprocessing-B2wb6pzI.umd.cjs → postprocessing-CiGkAeM9.umd.cjs} +17 -17
- package/dist/{vendor-CAcsI0eU.js → vendor-BFrMaK9q.js} +8983 -9136
- package/dist/vendor-CJmyOrCq.min.js +1116 -0
- package/dist/vendor-DkMW3WY4.umd.cjs +1116 -0
- package/lib/engine/api.d.ts +12 -0
- package/lib/engine/api.js +2 -0
- package/lib/engine/api.js.map +1 -1
- package/lib/engine/debug/debug_environment.js +1 -1
- package/lib/engine/debug/debug_environment.js.map +1 -1
- package/lib/engine/engine_application.js +8 -6
- package/lib/engine/engine_application.js.map +1 -1
- package/lib/engine/engine_components.js +5 -1
- package/lib/engine/engine_components.js.map +1 -1
- package/lib/engine/engine_constants.js +6 -0
- package/lib/engine/engine_constants.js.map +1 -1
- package/lib/engine/engine_context.d.ts +33 -7
- package/lib/engine/engine_context.js +40 -2
- package/lib/engine/engine_context.js.map +1 -1
- package/lib/engine/engine_context_registry.js +1 -1
- package/lib/engine/engine_context_registry.js.map +1 -1
- package/lib/engine/engine_init.js +7 -0
- package/lib/engine/engine_init.js.map +1 -1
- package/lib/engine/engine_input.d.ts +3 -2
- package/lib/engine/engine_input.js +3 -2
- package/lib/engine/engine_input.js.map +1 -1
- package/lib/engine/engine_license.d.ts +2 -0
- package/lib/engine/engine_license.js +25 -15
- package/lib/engine/engine_license.js.map +1 -1
- package/lib/engine/engine_lifecycle_functions_internal.js +5 -0
- package/lib/engine/engine_lifecycle_functions_internal.js.map +1 -1
- package/lib/engine/engine_networking_blob.d.ts +1 -1
- package/lib/engine/engine_networking_blob.js +5 -11
- package/lib/engine/engine_networking_blob.js.map +1 -1
- package/lib/engine/engine_physics_rapier.d.ts +3 -0
- package/lib/engine/engine_physics_rapier.js +13 -10
- package/lib/engine/engine_physics_rapier.js.map +1 -1
- package/lib/engine/engine_pmrem.js +2 -2
- package/lib/engine/engine_pmrem.js.map +1 -1
- package/lib/engine/engine_scenedata.d.ts +30 -0
- package/lib/engine/engine_scenedata.js +136 -0
- package/lib/engine/engine_scenedata.js.map +1 -0
- package/lib/engine/engine_ssr.d.ts +18 -0
- package/lib/engine/engine_ssr.js +40 -0
- package/lib/engine/engine_ssr.js.map +1 -0
- package/lib/engine/engine_three_utils.d.ts +14 -7
- package/lib/engine/engine_three_utils.js +14 -7
- package/lib/engine/engine_three_utils.js.map +1 -1
- package/lib/engine/engine_types.d.ts +2 -0
- package/lib/engine/engine_types.js.map +1 -1
- package/lib/engine/engine_utils.js +4 -2
- package/lib/engine/engine_utils.js.map +1 -1
- package/lib/engine/engine_utils_hash.d.ts +9 -0
- package/lib/engine/engine_utils_hash.js +112 -0
- package/lib/engine/engine_utils_hash.js.map +1 -0
- package/lib/engine/webcomponents/jsx.d.ts +51 -0
- package/lib/engine/webcomponents/logo-element.d.ts +2 -1
- package/lib/engine/webcomponents/logo-element.js +2 -1
- package/lib/engine/webcomponents/logo-element.js.map +1 -1
- package/lib/engine/webcomponents/needle menu/needle-menu.d.ts +4 -4
- package/lib/engine/webcomponents/needle menu/needle-menu.js +2 -1
- package/lib/engine/webcomponents/needle menu/needle-menu.js.map +1 -1
- package/lib/engine/webcomponents/needle-button.d.ts +2 -1
- package/lib/engine/webcomponents/needle-button.js +2 -1
- package/lib/engine/webcomponents/needle-button.js.map +1 -1
- package/lib/engine/webcomponents/needle-engine.d.ts +2 -1
- package/lib/engine/webcomponents/needle-engine.js +2 -1
- package/lib/engine/webcomponents/needle-engine.js.map +1 -1
- package/lib/engine/xr/NeedleXRSession.d.ts +1 -0
- package/lib/engine/xr/NeedleXRSession.js +5 -5
- package/lib/engine/xr/NeedleXRSession.js.map +1 -1
- package/lib/engine/xr/events.d.ts +30 -3
- package/lib/engine/xr/events.js +38 -0
- package/lib/engine/xr/events.js.map +1 -1
- package/lib/engine/xr/init.js +1 -7
- package/lib/engine/xr/init.js.map +1 -1
- package/lib/engine-components/AnimatorController.d.ts +135 -2
- package/lib/engine-components/AnimatorController.js +218 -2
- package/lib/engine-components/AnimatorController.js.map +1 -1
- package/lib/engine-components/GroundProjection.d.ts +1 -0
- package/lib/engine-components/GroundProjection.js +184 -48
- package/lib/engine-components/GroundProjection.js.map +1 -1
- package/lib/engine-components/Light.d.ts +6 -8
- package/lib/engine-components/Light.js +40 -27
- package/lib/engine-components/Light.js.map +1 -1
- package/lib/engine-components/RigidBody.js +3 -3
- package/lib/engine-components/RigidBody.js.map +1 -1
- package/lib/engine-components/SceneSwitcher.js +2 -0
- package/lib/engine-components/SceneSwitcher.js.map +1 -1
- package/lib/engine-components/api.d.ts +1 -0
- package/lib/engine-components/api.js +1 -0
- package/lib/engine-components/api.js.map +1 -1
- package/lib/engine-components/codegen/components.d.ts +1 -0
- package/lib/engine-components/codegen/components.js +1 -0
- package/lib/engine-components/codegen/components.js.map +1 -1
- package/lib/engine-components/postprocessing/Effects/BloomEffect.d.ts +1 -1
- package/lib/engine-components/postprocessing/Effects/Sharpening.js +1 -2
- package/lib/engine-components/postprocessing/Effects/Sharpening.js.map +1 -1
- package/lib/engine-components/postprocessing/PostProcessingHandler.js +5 -6
- package/lib/engine-components/postprocessing/PostProcessingHandler.js.map +1 -1
- package/lib/engine-components/web/ScrollFollow.d.ts +0 -1
- package/lib/engine-components/web/ScrollFollow.js +3 -2
- package/lib/engine-components/web/ScrollFollow.js.map +1 -1
- package/lib/needle-engine.d.ts +2 -0
- package/lib/needle-engine.js +2 -0
- package/lib/needle-engine.js.map +1 -1
- package/package.json +6 -4
- package/plugins/common/logger.js +42 -19
- package/plugins/dts-generator/dts.codegen.js +334 -0
- package/plugins/dts-generator/dts.scan.js +99 -0
- package/plugins/dts-generator/dts.writer.js +59 -0
- package/plugins/dts-generator/glb.discovery.js +279 -0
- package/plugins/dts-generator/glb.extractor.js +215 -0
- package/plugins/dts-generator/glb.reader.js +167 -0
- package/plugins/dts-generator/index.js +36 -0
- package/plugins/dts-generator/manifest.types.js +174 -0
- package/plugins/types/index.d.ts +2 -1
- package/plugins/types/needle-bindings.d.ts +30 -0
- package/plugins/types/userconfig.d.ts +21 -2
- package/plugins/vite/asap.js +1 -1
- package/plugins/vite/dependency-watcher.d.ts +2 -2
- package/plugins/vite/dependency-watcher.js +3 -4
- package/plugins/vite/drop.d.ts +2 -2
- package/plugins/vite/drop.js +3 -4
- package/plugins/vite/dts-generator.d.ts +7 -0
- package/plugins/vite/dts-generator.js +191 -0
- package/plugins/vite/index.d.ts +10 -3
- package/plugins/vite/index.js +27 -10
- package/plugins/vite/logger.client.js +4 -3
- package/plugins/vite/logging.js +2 -2
- package/plugins/vite/meta.js +4 -2
- package/plugins/vite/poster.d.ts +2 -2
- package/plugins/vite/poster.js +3 -5
- package/plugins/vite/reload.d.ts +2 -2
- package/plugins/vite/reload.js +23 -22
- package/src/engine/api.ts +15 -1
- package/src/engine/debug/debug_environment.ts +1 -1
- package/src/engine/engine_application.ts +8 -6
- package/src/engine/engine_components.ts +7 -4
- package/src/engine/engine_constants.ts +11 -6
- package/src/engine/engine_context.ts +50 -7
- package/src/engine/engine_context_registry.ts +1 -1
- package/src/engine/engine_init.ts +6 -0
- package/src/engine/engine_input.ts +3 -2
- package/src/engine/engine_license.ts +23 -19
- package/src/engine/engine_lifecycle_functions_internal.ts +7 -0
- package/src/engine/engine_networking_blob.ts +5 -11
- package/src/engine/engine_physics_rapier.ts +14 -12
- package/src/engine/engine_pmrem.ts +3 -3
- package/src/engine/engine_scenedata.ts +134 -0
- package/src/engine/engine_ssr.ts +48 -0
- package/src/engine/engine_three_utils.ts +15 -7
- package/src/engine/engine_types.ts +2 -0
- package/src/engine/engine_utils.ts +3 -2
- package/src/engine/engine_utils_hash.ts +65 -0
- package/src/engine/webcomponents/jsx.d.ts +51 -0
- package/src/engine/webcomponents/logo-element.ts +3 -1
- package/src/engine/webcomponents/needle menu/needle-menu.ts +4 -2
- package/src/engine/webcomponents/needle-button.ts +3 -1
- package/src/engine/webcomponents/needle-engine.ts +3 -1
- package/src/engine/xr/NeedleXRSession.ts +6 -6
- package/src/engine/xr/events.ts +44 -1
- package/src/engine/xr/init.ts +0 -7
- package/src/engine-components/AnimatorController.ts +286 -4
- package/src/engine-components/GroundProjection.ts +226 -52
- package/src/engine-components/Light.ts +40 -26
- package/src/engine-components/RigidBody.ts +3 -3
- package/src/engine-components/SceneSwitcher.ts +1 -0
- package/src/engine-components/api.ts +1 -0
- package/src/engine-components/codegen/components.ts +1 -0
- package/src/engine-components/postprocessing/Effects/BloomEffect.ts +1 -1
- package/src/engine-components/postprocessing/Effects/Sharpening.ts +1 -2
- package/src/engine-components/postprocessing/PostProcessingHandler.ts +4 -8
- package/src/engine-components/web/ScrollFollow.ts +2 -2
- package/src/needle-engine.ts +3 -0
- package/src/vite-env.d.ts +16 -0
- package/dist/vendor-CEM38hLE.umd.cjs +0 -1116
- package/dist/vendor-HRlxIBga.min.js +0 -1116
package/dist/needle-engine.d.ts
CHANGED
|
@@ -84,6 +84,7 @@ import { RawShaderMaterial } from 'three';
|
|
|
84
84
|
import { Ray } from 'three';
|
|
85
85
|
import { Raycaster } from 'three';
|
|
86
86
|
import { Scene } from 'three';
|
|
87
|
+
import { SceneData } from '../../plugins/types/needle-bindings.d.ts';
|
|
87
88
|
import { ShaderMaterial } from 'three';
|
|
88
89
|
import { ShapeJSON } from 'three.quarks';
|
|
89
90
|
import { SkinnedMesh } from 'three';
|
|
@@ -918,8 +919,9 @@ export declare enum AnimatorConditionMode {
|
|
|
918
919
|
* and parameters that affect those transitions. It is used by the {@link Animator}
|
|
919
920
|
* component to control animation behavior on 3D models.
|
|
920
921
|
*
|
|
921
|
-
* Use
|
|
922
|
-
*
|
|
922
|
+
* Use {@link AnimatorController.build} to fluently create a controller with parameters,
|
|
923
|
+
* states, transitions, and conditions. For simple sequential playback,
|
|
924
|
+
* use {@link AnimatorController.createFromClips}.
|
|
923
925
|
*
|
|
924
926
|
* @category Animation and Sequencing
|
|
925
927
|
* @group Utilities
|
|
@@ -934,6 +936,27 @@ export declare class AnimatorController {
|
|
|
934
936
|
* @returns A new AnimatorController instance
|
|
935
937
|
*/
|
|
936
938
|
static createFromClips(clips: AnimationClip[], options?: CreateAnimatorControllerOptions): AnimatorController;
|
|
939
|
+
/**
|
|
940
|
+
* Creates a new {@link AnimatorControllerBuilder} for fluently constructing a controller with
|
|
941
|
+
* parameters, states, transitions, and conditions.
|
|
942
|
+
*
|
|
943
|
+
* @param name - Optional name for the controller
|
|
944
|
+
* @returns A new builder instance
|
|
945
|
+
*
|
|
946
|
+
* @example
|
|
947
|
+
* ```ts
|
|
948
|
+
* const ctrl = AnimatorController.build("MyController")
|
|
949
|
+
* .floatParameter("Speed")
|
|
950
|
+
* .state("Idle", { clip: idleClip, loop: true })
|
|
951
|
+
* .state("Walk", { clip: walkClip, loop: true })
|
|
952
|
+
* .transition("Idle", "Walk", { duration: 0.25 })
|
|
953
|
+
* .condition("Speed", "greater", 0.1)
|
|
954
|
+
* .transition("Walk", "Idle", { duration: 0.25 })
|
|
955
|
+
* .condition("Speed", "less", 0.1)
|
|
956
|
+
* .build();
|
|
957
|
+
* ```
|
|
958
|
+
*/
|
|
959
|
+
static build(name?: string): AnimatorControllerBuilder;
|
|
937
960
|
/**
|
|
938
961
|
* Plays an animation state by name or hash.
|
|
939
962
|
*
|
|
@@ -1125,6 +1148,84 @@ export declare class AnimatorController {
|
|
|
1125
1148
|
private rootMotionHandler?;
|
|
1126
1149
|
}
|
|
1127
1150
|
|
|
1151
|
+
/**
|
|
1152
|
+
* A fluent builder for creating {@link AnimatorController} instances from code.
|
|
1153
|
+
*
|
|
1154
|
+
* Use {@link AnimatorController.build} to create a new builder.
|
|
1155
|
+
*
|
|
1156
|
+
* @example
|
|
1157
|
+
* ```ts
|
|
1158
|
+
* const controller = AnimatorController.build("CharacterController")
|
|
1159
|
+
* .floatParameter("Speed", 0)
|
|
1160
|
+
* .triggerParameter("Jump")
|
|
1161
|
+
* .state("Idle", { clip: idleClip, loop: true })
|
|
1162
|
+
* .state("Walk", { clip: walkClip, loop: true })
|
|
1163
|
+
* .state("Jump", { clip: jumpClip })
|
|
1164
|
+
* .transition("Idle", "Walk", { duration: 0.25 })
|
|
1165
|
+
* .condition("Speed", "greater", 0.1)
|
|
1166
|
+
* .transition("Walk", "Idle", { duration: 0.25 })
|
|
1167
|
+
* .condition("Speed", "less", 0.1)
|
|
1168
|
+
* .transition("*", "Jump", { duration: 0.1 })
|
|
1169
|
+
* .condition("Jump", "if")
|
|
1170
|
+
* .transition("Jump", "Idle", { hasExitTime: true, exitTime: 0.9, duration: 0.25 })
|
|
1171
|
+
* .build();
|
|
1172
|
+
* ```
|
|
1173
|
+
*
|
|
1174
|
+
* @category Animation and Sequencing
|
|
1175
|
+
* @group Utilities
|
|
1176
|
+
*/
|
|
1177
|
+
export declare class AnimatorControllerBuilder {
|
|
1178
|
+
private _name;
|
|
1179
|
+
private _parameters;
|
|
1180
|
+
private _states;
|
|
1181
|
+
private _anyStateTransitions;
|
|
1182
|
+
private _defaultStateName;
|
|
1183
|
+
private _lastTransition;
|
|
1184
|
+
constructor(name?: string);
|
|
1185
|
+
/** Adds a float parameter */
|
|
1186
|
+
floatParameter(name: string, defaultValue?: number): this;
|
|
1187
|
+
/** Adds an integer parameter */
|
|
1188
|
+
intParameter(name: string, defaultValue?: number): this;
|
|
1189
|
+
/** Adds a boolean parameter */
|
|
1190
|
+
boolParameter(name: string, defaultValue?: boolean): this;
|
|
1191
|
+
/** Adds a trigger parameter */
|
|
1192
|
+
triggerParameter(name: string): this;
|
|
1193
|
+
/**
|
|
1194
|
+
* Adds a state to the controller. The first state added becomes the default state.
|
|
1195
|
+
* @param name - Unique name for the state
|
|
1196
|
+
* @param options - State configuration including clip, loop, speed
|
|
1197
|
+
*/
|
|
1198
|
+
state(name: string, options: StateOptions): this;
|
|
1199
|
+
/**
|
|
1200
|
+
* Adds a transition between two states.
|
|
1201
|
+
* Use `"*"` as the source to create a transition from any state.
|
|
1202
|
+
* Chain `.condition()` calls after this to add conditions.
|
|
1203
|
+
* @param from - Source state name, or `"*"` for any-state transition
|
|
1204
|
+
* @param to - Destination state name
|
|
1205
|
+
* @param options - Transition configuration
|
|
1206
|
+
*/
|
|
1207
|
+
transition(from: string, to: string, options?: TransitionOptions): this;
|
|
1208
|
+
/**
|
|
1209
|
+
* Adds a condition to the most recently added transition.
|
|
1210
|
+
* Multiple conditions on the same transition are AND-ed together.
|
|
1211
|
+
* @param parameter - Name of the parameter to evaluate
|
|
1212
|
+
* @param mode - Condition mode: `"if"`, `"ifNot"`, `"greater"`, `"less"`, `"equals"`, `"notEqual"`
|
|
1213
|
+
* @param threshold - Comparison threshold for numeric conditions (default: 0)
|
|
1214
|
+
*/
|
|
1215
|
+
condition(parameter: string, mode: ConditionMode, threshold?: number): this;
|
|
1216
|
+
/**
|
|
1217
|
+
* Sets which state is the default/entry state.
|
|
1218
|
+
* If not called, the first added state is used.
|
|
1219
|
+
* @param name - Name of the state
|
|
1220
|
+
*/
|
|
1221
|
+
defaultState(name: string): this;
|
|
1222
|
+
/**
|
|
1223
|
+
* Builds and returns the {@link AnimatorController}.
|
|
1224
|
+
* Resolves all state name references to indices.
|
|
1225
|
+
*/
|
|
1226
|
+
build(): AnimatorController;
|
|
1227
|
+
}
|
|
1228
|
+
|
|
1128
1229
|
export declare type AnimatorControllerModel = {
|
|
1129
1230
|
name: string;
|
|
1130
1231
|
guid: string;
|
|
@@ -2092,7 +2193,7 @@ export declare namespace BlobStorage {
|
|
|
2092
2193
|
/**
|
|
2093
2194
|
* Generates an md5 hash from a given buffer
|
|
2094
2195
|
* @param buffer The buffer to hash
|
|
2095
|
-
* @returns The md5 hash
|
|
2196
|
+
* @returns The md5 hash as a hex string
|
|
2096
2197
|
*/
|
|
2097
2198
|
export function hashMD5(buffer: ArrayBuffer): string;
|
|
2098
2199
|
export function hashMD5_Base64(buffer: ArrayBuffer): string;
|
|
@@ -4006,6 +4107,9 @@ export declare type Condition = {
|
|
|
4006
4107
|
threshold: number;
|
|
4007
4108
|
};
|
|
4008
4109
|
|
|
4110
|
+
/** String condition modes for the builder, mapped to {@link AnimatorConditionMode} */
|
|
4111
|
+
export declare type ConditionMode = "if" | "ifNot" | "greater" | "less" | "equals" | "notEqual";
|
|
4112
|
+
|
|
4009
4113
|
/** Events regarding the websocket connection (e.g. when the connection opens) */
|
|
4010
4114
|
export declare enum ConnectionEvents {
|
|
4011
4115
|
ConnectionInfo = "connection-start-info"
|
|
@@ -4355,6 +4459,25 @@ export declare class Context implements IContext {
|
|
|
4355
4459
|
* The main camera of the scene - this camera is used for rendering
|
|
4356
4460
|
* Use `setCurrentCamera` for updating the main camera.
|
|
4357
4461
|
*/
|
|
4462
|
+
/**
|
|
4463
|
+
* Access your scene's full hierarchy, objects, and components directly by name — with full autocomplete.
|
|
4464
|
+
* Types are generated automatically from your GLB files when the dev server starts.
|
|
4465
|
+
*
|
|
4466
|
+
* You can store references to objects or components for later use.
|
|
4467
|
+
* Note that the scene hierarchy can change at runtime (e.g. when objects are added, removed, or re-parented),
|
|
4468
|
+
* in which case stored references may become stale.
|
|
4469
|
+
*
|
|
4470
|
+
* @experimental This API may change in future versions.
|
|
4471
|
+
*
|
|
4472
|
+
* @example
|
|
4473
|
+
* // Toggle auto-rotate on the orbit camera
|
|
4474
|
+
* ctx.sceneData.Camera.OrbitControls.autoRotate = true;
|
|
4475
|
+
*
|
|
4476
|
+
* @example
|
|
4477
|
+
* // Change the background color
|
|
4478
|
+
* ctx.sceneData.Camera.Camera.backgroundColor = new RGBAColor(1, 0, 0, 1);
|
|
4479
|
+
*/
|
|
4480
|
+
get sceneData(): SceneData;
|
|
4358
4481
|
get mainCamera(): Camera_2;
|
|
4359
4482
|
/** Set the main camera of the scene. If set to null the camera of the {@link mainCameraComponent} will be used - this camera is used for rendering */
|
|
4360
4483
|
set mainCamera(cam: Camera_2 | null);
|
|
@@ -4376,15 +4499,21 @@ export declare class Context implements IContext {
|
|
|
4376
4499
|
connection: NetworkConnection;
|
|
4377
4500
|
/** @deprecated AssetDatabase is deprecated */
|
|
4378
4501
|
assets: AssetDatabase;
|
|
4379
|
-
/**
|
|
4380
|
-
|
|
4502
|
+
/** All registered lights in the scene, maintained by the Light component.
|
|
4503
|
+
* @see mainLight for accessing the main directional light in the scene
|
|
4504
|
+
*/
|
|
4505
|
+
readonly lights: ILight[];
|
|
4506
|
+
/** The brightest registered directional light, or null if none are registered
|
|
4507
|
+
* @see lights
|
|
4508
|
+
*/
|
|
4509
|
+
get mainLight(): ILight | null;
|
|
4381
4510
|
/** @deprecated Use sceneLighting */
|
|
4382
|
-
get rendererData()
|
|
4511
|
+
private get rendererData();
|
|
4383
4512
|
/** Access the scene lighting manager to control lighting settings in the context */
|
|
4384
|
-
sceneLighting: RendererData;
|
|
4385
|
-
addressables: Addressables;
|
|
4386
|
-
lightmaps: ILightDataRegistry;
|
|
4387
|
-
players: PlayerViewManager;
|
|
4513
|
+
readonly sceneLighting: RendererData;
|
|
4514
|
+
readonly addressables: Addressables;
|
|
4515
|
+
readonly lightmaps: ILightDataRegistry;
|
|
4516
|
+
readonly players: PlayerViewManager;
|
|
4388
4517
|
/** Access the LODs manager to control LOD behavior in the context */
|
|
4389
4518
|
readonly lodsManager: LODsManager;
|
|
4390
4519
|
/** Access the needle menu to add or remove buttons to the menu element */
|
|
@@ -7027,6 +7156,20 @@ export declare function getPeerOptions(): PeerJSOption | undefined;
|
|
|
7027
7156
|
|
|
7028
7157
|
export declare function getResourceUserCount(object: object): number | undefined;
|
|
7029
7158
|
|
|
7159
|
+
/**
|
|
7160
|
+
* Returns a lazily-resolved proxy typed as {@link SceneData}.
|
|
7161
|
+
* The proxy is cached per context — each context gets exactly one instance.
|
|
7162
|
+
*
|
|
7163
|
+
* Shape mirrors the generated `needle-bindings.gen.d.ts`:
|
|
7164
|
+
* ctx.sceneData.MyGlb.Camera.$components.OrbitControls.autoRotate = true;
|
|
7165
|
+
* ctx.sceneData.MyGlb.Camera.$object // → THREE.Camera
|
|
7166
|
+
* ctx.sceneData.MyGlb.UI.Button.$components.Button // → Needle Button component
|
|
7167
|
+
*
|
|
7168
|
+
* GLB name is ignored at runtime (scene is already loaded).
|
|
7169
|
+
* Node lookup starts at the scene root.
|
|
7170
|
+
*/
|
|
7171
|
+
export declare function getSceneData(ctx: IContext): SceneData;
|
|
7172
|
+
|
|
7030
7173
|
export declare function getTempColor(color?: Color): Color;
|
|
7031
7174
|
|
|
7032
7175
|
/**
|
|
@@ -7357,13 +7500,20 @@ export declare class GraphicRaycaster extends ObjectRaycaster {
|
|
|
7357
7500
|
* Utility class to perform various graphics operations like copying textures to canvas
|
|
7358
7501
|
*/
|
|
7359
7502
|
export declare class Graphics {
|
|
7360
|
-
private static
|
|
7361
|
-
private static
|
|
7362
|
-
private static
|
|
7363
|
-
private static
|
|
7364
|
-
private static
|
|
7365
|
-
private static
|
|
7366
|
-
private static
|
|
7503
|
+
private static _planeGeometry;
|
|
7504
|
+
private static _renderer;
|
|
7505
|
+
private static _perspectiveCam;
|
|
7506
|
+
private static _orthographicCam;
|
|
7507
|
+
private static _scene;
|
|
7508
|
+
private static _blitMaterial;
|
|
7509
|
+
private static _mesh;
|
|
7510
|
+
private static get planeGeometry();
|
|
7511
|
+
private static get renderer();
|
|
7512
|
+
private static get perspectiveCam();
|
|
7513
|
+
private static get orthographicCam();
|
|
7514
|
+
private static get scene();
|
|
7515
|
+
private static get blitMaterial();
|
|
7516
|
+
private static get mesh();
|
|
7367
7517
|
/**
|
|
7368
7518
|
* Copy a texture to a new texture
|
|
7369
7519
|
* @param texture the texture to copy
|
|
@@ -7516,6 +7666,7 @@ export declare class GroundProjectedEnv extends Component {
|
|
|
7516
7666
|
updateProjection(): void;
|
|
7517
7667
|
private _blurrynessShader;
|
|
7518
7668
|
private _lastBlurriness;
|
|
7669
|
+
private updateProjectionMaterial;
|
|
7519
7670
|
private updateBlurriness;
|
|
7520
7671
|
}
|
|
7521
7672
|
|
|
@@ -7826,6 +7977,9 @@ export declare class HoverAnimation extends Component {
|
|
|
7826
7977
|
private playHover;
|
|
7827
7978
|
}
|
|
7828
7979
|
|
|
7980
|
+
/** SSR-safe base class for web components. */
|
|
7981
|
+
declare const HTMLElementBase: typeof HTMLElement;
|
|
7982
|
+
|
|
7829
7983
|
export declare type IAnimationComponent = Pick<IComponent, "gameObject"> & {
|
|
7830
7984
|
isAnimationComponent: boolean;
|
|
7831
7985
|
addClip?(clip: AnimationClip): any;
|
|
@@ -8085,6 +8239,8 @@ declare interface ILayoutGroup extends IComponent {
|
|
|
8085
8239
|
export declare interface ILight extends IComponent {
|
|
8086
8240
|
intensity: number;
|
|
8087
8241
|
color: Color;
|
|
8242
|
+
/** The type of light as a lowercase string: `"directional"`, `"point"`, `"spot"` */
|
|
8243
|
+
readonly type: "directional" | "point" | "spot";
|
|
8088
8244
|
}
|
|
8089
8245
|
|
|
8090
8246
|
declare interface ILightDataRegistry {
|
|
@@ -8301,6 +8457,10 @@ export declare class InheritVelocityModule {
|
|
|
8301
8457
|
applyCurrent(vel: Vector3 | Vector3_2, t01: number, lerpFactor: number): void;
|
|
8302
8458
|
}
|
|
8303
8459
|
|
|
8460
|
+
/** Register the Rapier physics backend. Called from {@link initEngine}
|
|
8461
|
+
* to ensure it runs regardless of tree-shaking. */
|
|
8462
|
+
export declare function initPhysics(): void;
|
|
8463
|
+
|
|
8304
8464
|
/**
|
|
8305
8465
|
* Handles all input events including mouse, touch, keyboard, and XR controllers.
|
|
8306
8466
|
* Access via `this.context.input` from any component.
|
|
@@ -9591,6 +9751,9 @@ declare const enum KeyboardEnumType {
|
|
|
9591
9751
|
KeyPressed = "keypress"
|
|
9592
9752
|
}
|
|
9593
9753
|
|
|
9754
|
+
/** SSR-safe base class for keyboard events. */
|
|
9755
|
+
declare const KeyboardEventBase: typeof KeyboardEvent;
|
|
9756
|
+
|
|
9594
9757
|
declare type KeyboardEventListener = (evt: NEKeyboardEvent) => void;
|
|
9595
9758
|
|
|
9596
9759
|
declare type KeyboardEventNames = EnumToPrimitiveUnion<KeyboardEnumType>;
|
|
@@ -9715,10 +9878,13 @@ declare type LifecycleMethodOptions = {
|
|
|
9715
9878
|
*/
|
|
9716
9879
|
export declare class Light extends Component implements ILight {
|
|
9717
9880
|
/**
|
|
9718
|
-
* The type of light
|
|
9719
|
-
* Can not be changed at runtime.
|
|
9881
|
+
* The type of light as a lowercase string: `"directional"`, `"point"`, `"spot"`.
|
|
9882
|
+
* Implements {@link ILight.type}. Can not be changed at runtime.
|
|
9720
9883
|
*/
|
|
9721
|
-
|
|
9884
|
+
get type(): ILight["type"];
|
|
9885
|
+
/** Numeric LightType serialized from Unity/Blender — converts to string on write */
|
|
9886
|
+
set type(value: LightType | ILight["type"]);
|
|
9887
|
+
private _type;
|
|
9722
9888
|
/**
|
|
9723
9889
|
* The maximum distance the light affects.
|
|
9724
9890
|
* Only applicable for spot and point lights.
|
|
@@ -9824,11 +9990,6 @@ export declare class Light extends Component implements ILight {
|
|
|
9824
9990
|
* and applies all settings like shadows, intensity, and color.
|
|
9825
9991
|
*/
|
|
9826
9992
|
createLight(): void;
|
|
9827
|
-
/**
|
|
9828
|
-
* Coroutine that updates the main light reference in the context
|
|
9829
|
-
* if this directional light should be the main light
|
|
9830
|
-
*/
|
|
9831
|
-
updateMainLightRoutine(): Generator<undefined, void, unknown>;
|
|
9832
9993
|
/**
|
|
9833
9994
|
* Controls whether the renderer's shadow map type can be changed when soft shadows are used
|
|
9834
9995
|
*/
|
|
@@ -9877,6 +10038,25 @@ declare enum LightShadows {
|
|
|
9877
10038
|
Soft = 2
|
|
9878
10039
|
}
|
|
9879
10040
|
|
|
10041
|
+
/**
|
|
10042
|
+
* Defines the type of light in a scene.
|
|
10043
|
+
* @see {@link Light} for configuring light properties and behavior
|
|
10044
|
+
*/
|
|
10045
|
+
declare enum LightType {
|
|
10046
|
+
/** Spot light that emits light in a cone shape */
|
|
10047
|
+
Spot = 0,
|
|
10048
|
+
/** Directional light that emits parallel light rays in a specific direction */
|
|
10049
|
+
Directional = 1,
|
|
10050
|
+
/** Point light that emits light in all directions from a single point */
|
|
10051
|
+
Point = 2,
|
|
10052
|
+
/** Area light */
|
|
10053
|
+
Area = 3,
|
|
10054
|
+
/** Rectangle shaped area light that only affects baked lightmaps and light probes */
|
|
10055
|
+
Rectangle = 3,
|
|
10056
|
+
/** Disc shaped area light that only affects baked lightmaps and light probes */
|
|
10057
|
+
Disc = 4
|
|
10058
|
+
}
|
|
10059
|
+
|
|
9880
10060
|
export declare class LimitVelocityOverLifetimeModule {
|
|
9881
10061
|
enabled: boolean;
|
|
9882
10062
|
dampen: number;
|
|
@@ -10864,6 +11044,21 @@ export declare type MouseButtonName = "left" | "right" | "middle";
|
|
|
10864
11044
|
|
|
10865
11045
|
/* Excluded from this release type: nameofFactory */
|
|
10866
11046
|
|
|
11047
|
+
/**
|
|
11048
|
+
* Quick access to the current Needle Engine context from anywhere — no need to pass `ctx` around.
|
|
11049
|
+
* Use it in React/Svelte/Vue components, button handlers, or plain JavaScript.
|
|
11050
|
+
*
|
|
11051
|
+
* Safe to import at module level, including in SSR environments.
|
|
11052
|
+
* For pages with multiple `<needle-engine>` elements, use `ctx` directly instead.
|
|
11053
|
+
*
|
|
11054
|
+
* @example
|
|
11055
|
+
* import { needle } from "@needle-tools/engine";
|
|
11056
|
+
* button.onclick = () => {
|
|
11057
|
+
* needle.sceneData.Camera.OrbitControls.autoRotate = true;
|
|
11058
|
+
* };
|
|
11059
|
+
*/
|
|
11060
|
+
export declare const needle: IContext;
|
|
11061
|
+
|
|
10867
11062
|
declare class NEEDLE_components implements GLTFLoaderPlugin {
|
|
10868
11063
|
get name(): string;
|
|
10869
11064
|
exportContext: {
|
|
@@ -10997,7 +11192,7 @@ export { NEEDLE_progressive }
|
|
|
10997
11192
|
* @see {@link NeedleEngineWebComponent} for the main <needle-engine> element
|
|
10998
11193
|
* @see {@link NeedleMenu} for the built-in menu component that can display similar buttons
|
|
10999
11194
|
*/
|
|
11000
|
-
export declare class NeedleButtonElement extends
|
|
11195
|
+
export declare class NeedleButtonElement extends HTMLElementBase {
|
|
11001
11196
|
#private;
|
|
11002
11197
|
static observedAttributes: string[];
|
|
11003
11198
|
constructor();
|
|
@@ -11137,7 +11332,7 @@ export declare namespace NeedleEngineModelLoader {
|
|
|
11137
11332
|
* @see {@link NeedleButtonElement} for adding AR/VR/Quicklook buttons via <needle-button>
|
|
11138
11333
|
* @see {@link NeedleMenu} for the built-in menu configuration component
|
|
11139
11334
|
*/
|
|
11140
|
-
export declare class NeedleEngineWebComponent extends
|
|
11335
|
+
export declare class NeedleEngineWebComponent extends HTMLElementBase implements INeedleEngineComponent {
|
|
11141
11336
|
static get observedAttributes(): string[];
|
|
11142
11337
|
get loadingProgress01(): number;
|
|
11143
11338
|
get loadingFinished(): boolean;
|
|
@@ -12110,7 +12305,7 @@ export declare class NeedleXRUtils {
|
|
|
12110
12305
|
}): void;
|
|
12111
12306
|
}
|
|
12112
12307
|
|
|
12113
|
-
export declare class NEKeyboardEvent extends
|
|
12308
|
+
export declare class NEKeyboardEvent extends KeyboardEventBase {
|
|
12114
12309
|
source?: Event;
|
|
12115
12310
|
constructor(type: InputEvents, source: Event, init: KeyboardEventInit);
|
|
12116
12311
|
stopImmediatePropagation(): void;
|
|
@@ -12134,7 +12329,7 @@ export declare class NEKeyboardEvent extends KeyboardEvent {
|
|
|
12134
12329
|
* @see {@link Input} for the input management system
|
|
12135
12330
|
* @see {@link PointerType} for available pointer types
|
|
12136
12331
|
*/
|
|
12137
|
-
export declare class NEPointerEvent extends
|
|
12332
|
+
export declare class NEPointerEvent extends PointerEventBase {
|
|
12138
12333
|
/**
|
|
12139
12334
|
* Spatial input data
|
|
12140
12335
|
*/
|
|
@@ -12900,6 +13095,12 @@ export declare class ObjectUtils {
|
|
|
12900
13095
|
private static applyDefaultObjectOptions;
|
|
12901
13096
|
}
|
|
12902
13097
|
|
|
13098
|
+
/**
|
|
13099
|
+
* Remove a listener for before an XR session is requested
|
|
13100
|
+
* @param fn The function to remove from the listeners
|
|
13101
|
+
*/
|
|
13102
|
+
export declare function offBeforeXRSession(fn: (args: XRSessionRequestEventArgs) => void): void;
|
|
13103
|
+
|
|
12903
13104
|
/* Excluded from this release type: OffscreenCanvasExt */
|
|
12904
13105
|
|
|
12905
13106
|
/**
|
|
@@ -13004,6 +13205,21 @@ export declare function onAfterRender(cb: LifecycleMethod, opts?: LifecycleMetho
|
|
|
13004
13205
|
* */
|
|
13005
13206
|
export declare function onBeforeRender(cb: LifecycleMethod, opts?: LifecycleMethodOptions): () => void;
|
|
13006
13207
|
|
|
13208
|
+
/**
|
|
13209
|
+
* Add a listener that fires before an XR session is requested.
|
|
13210
|
+
* Use this to modify the session init options, e.g. to add optional features like `camera-access`.
|
|
13211
|
+
* @param fn The function to call before the XR session is requested
|
|
13212
|
+
* @example
|
|
13213
|
+
* ```js
|
|
13214
|
+
* onBeforeXRSession((args) => {
|
|
13215
|
+
* args.init.optionalFeatures ??= [];
|
|
13216
|
+
* args.init.optionalFeatures.push("camera-access");
|
|
13217
|
+
* });
|
|
13218
|
+
* ```
|
|
13219
|
+
* @return A function to remove the listener
|
|
13220
|
+
*/
|
|
13221
|
+
export declare function onBeforeXRSession(fn: (args: XRSessionRequestEventArgs) => void): () => void;
|
|
13222
|
+
|
|
13007
13223
|
/**
|
|
13008
13224
|
* Register a callback before the engine context is cleared.
|
|
13009
13225
|
* This happens if e.g. `<needle-engine src>` changes
|
|
@@ -13225,8 +13441,9 @@ export declare function onUpdate(cb: LifecycleMethod, opts?: LifecycleMethodOpti
|
|
|
13225
13441
|
* console.log("XR session ended", evt);
|
|
13226
13442
|
* });
|
|
13227
13443
|
* ```
|
|
13444
|
+
* @returns A function to remove the listener
|
|
13228
13445
|
*/
|
|
13229
|
-
export declare function onXRSessionEnd(fn: (evt: XRSessionEventArgs) => void): void;
|
|
13446
|
+
export declare function onXRSessionEnd(fn: (evt: XRSessionEventArgs) => void): () => void;
|
|
13230
13447
|
|
|
13231
13448
|
/**
|
|
13232
13449
|
* Add a listener for when an XR session starts
|
|
@@ -13238,8 +13455,9 @@ export declare function onXRSessionEnd(fn: (evt: XRSessionEventArgs) => void): v
|
|
|
13238
13455
|
* console.log("XR session started", evt);
|
|
13239
13456
|
* });
|
|
13240
13457
|
* ```
|
|
13458
|
+
* @returns A function to remove the listener
|
|
13241
13459
|
*/
|
|
13242
|
-
export declare function onXRSessionStart(fn: (evt: XRSessionEventArgs) => void): void;
|
|
13460
|
+
export declare function onXRSessionStart(fn: (evt: XRSessionEventArgs) => void): () => void;
|
|
13243
13461
|
|
|
13244
13462
|
/**
|
|
13245
13463
|
* OpenURL behaviour opens a URL in a new tab or window when the object (or any if it's children) is clicked.
|
|
@@ -14943,6 +15161,9 @@ export declare class OrbitControls extends Component implements ICameraControlle
|
|
|
14943
15161
|
PointerMove = "pointermove"
|
|
14944
15162
|
}
|
|
14945
15163
|
|
|
15164
|
+
/** SSR-safe base class for pointer events. */
|
|
15165
|
+
declare const PointerEventBase: typeof PointerEvent;
|
|
15166
|
+
|
|
14946
15167
|
/** [PointerEventData](https://engine.needle.tools/docs/api/PointerEventData) This pointer event data object is passed to all event receivers that are currently active
|
|
14947
15168
|
* It contains hit information if an object was hovered or clicked
|
|
14948
15169
|
* If the event is received in onPointerDown or onPointerMove, you can call `setPointerCapture` to receive onPointerMove events even when the pointer has left the object until you call `releasePointerCapture` or when the pointerUp event happens
|
|
@@ -16830,6 +17051,8 @@ export declare class OrbitControls extends Component implements ICameraControlle
|
|
|
16830
17051
|
*/
|
|
16831
17052
|
declare type ScaleClipType = "linear" | "spring";
|
|
16832
17053
|
|
|
17054
|
+
export { SceneData }
|
|
17055
|
+
|
|
16833
17056
|
export declare class SceneLightSettings extends Component {
|
|
16834
17057
|
ambientMode: AmbientMode;
|
|
16835
17058
|
ambientLight?: Color;
|
|
@@ -17977,6 +18200,7 @@ export declare class OrbitControls extends Component implements ICameraControlle
|
|
|
17977
18200
|
export declare type SessionRequestedEvent = (args: {
|
|
17978
18201
|
readonly mode: XRSessionMode;
|
|
17979
18202
|
readonly init: XRSessionInit;
|
|
18203
|
+
readonly context: Context;
|
|
17980
18204
|
}) => void;
|
|
17981
18205
|
|
|
17982
18206
|
export declare function setActive(go: Object3D, active: boolean | number): boolean;
|
|
@@ -19614,6 +19838,24 @@ export declare class OrbitControls extends Component implements ICameraControlle
|
|
|
19614
19838
|
instance?: StateMachineBehaviour;
|
|
19615
19839
|
};
|
|
19616
19840
|
|
|
19841
|
+
/**
|
|
19842
|
+
* Configuration for an animation state in the builder
|
|
19843
|
+
*/
|
|
19844
|
+
export declare type StateOptions = {
|
|
19845
|
+
/** The animation clip for this state */
|
|
19846
|
+
clip: AnimationClip;
|
|
19847
|
+
/** Whether the animation should loop (default: false) */
|
|
19848
|
+
loop?: boolean;
|
|
19849
|
+
/** Base speed multiplier (default: 1) */
|
|
19850
|
+
speed?: number;
|
|
19851
|
+
/** Name of a float parameter to multiply with speed */
|
|
19852
|
+
speedParameter?: string;
|
|
19853
|
+
/** Normalized cycle offset 0-1 (default: 0) */
|
|
19854
|
+
cycleOffset?: number;
|
|
19855
|
+
/** Name of a float parameter to use as cycle offset */
|
|
19856
|
+
cycleOffsetParameter?: string;
|
|
19857
|
+
};
|
|
19858
|
+
|
|
19617
19859
|
declare type StickName = "xr-standard-thumbstick" | "xr-standard-touchpad";
|
|
19618
19860
|
|
|
19619
19861
|
export declare class StreamEndedEvent {
|
|
@@ -20712,6 +20954,22 @@ export declare class OrbitControls extends Component implements ICameraControlle
|
|
|
20712
20954
|
Animation = 3
|
|
20713
20955
|
}
|
|
20714
20956
|
|
|
20957
|
+
/**
|
|
20958
|
+
* Configuration for a transition in the builder
|
|
20959
|
+
*/
|
|
20960
|
+
export declare type TransitionOptions = {
|
|
20961
|
+
/** Duration of the crossfade in seconds (default: 0) */
|
|
20962
|
+
duration?: number;
|
|
20963
|
+
/** Normalized exit time 0-1 (default: 1). Only used when hasExitTime is true */
|
|
20964
|
+
exitTime?: number;
|
|
20965
|
+
/** Whether the transition waits for exitTime before transitioning (default: false) */
|
|
20966
|
+
hasExitTime?: boolean;
|
|
20967
|
+
/** Normalized offset into the destination state's animation (default: 0) */
|
|
20968
|
+
offset?: number;
|
|
20969
|
+
/** Whether duration is in seconds (true) or normalized (false) (default: false) */
|
|
20970
|
+
hasFixedDuration?: boolean;
|
|
20971
|
+
};
|
|
20972
|
+
|
|
20715
20973
|
export declare class TriggerBuilder {
|
|
20716
20974
|
private static __sceneStartTrigger?;
|
|
20717
20975
|
static sceneStartTrigger(): TriggerModel;
|
|
@@ -23231,6 +23489,12 @@ export declare class OrbitControls extends Component implements ICameraControlle
|
|
|
23231
23489
|
session: NeedleXRSession;
|
|
23232
23490
|
};
|
|
23233
23491
|
|
|
23492
|
+
export declare type XRSessionRequestEventArgs = {
|
|
23493
|
+
readonly mode: XRSessionMode;
|
|
23494
|
+
readonly init: XRSessionInit;
|
|
23495
|
+
readonly context: Context;
|
|
23496
|
+
};
|
|
23497
|
+
|
|
23234
23498
|
export declare class XRState {
|
|
23235
23499
|
static Global: XRState;
|
|
23236
23500
|
Mask: XRStateFlag;
|