@relu-interactives/spatial-ecs 0.2.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/README.md +125 -0
- package/dist/System-rXAmagXA.d.cts +659 -0
- package/dist/System-rXAmagXA.d.ts +659 -0
- package/dist/Video-CDemv74U.d.cts +1261 -0
- package/dist/Video-ChKV1UI7.d.ts +1261 -0
- package/dist/assets/draco/draco_decoder.js +34 -0
- package/dist/assets/draco/draco_decoder.wasm +0 -0
- package/dist/assets/draco/draco_wasm_wrapper.js +117 -0
- package/dist/chunk-AYEF3X2P.js +223 -0
- package/dist/chunk-AYEF3X2P.js.map +1 -0
- package/dist/chunk-MAWBTMCG.js +1722 -0
- package/dist/chunk-MAWBTMCG.js.map +1 -0
- package/dist/chunk-NFDTIYR4.js +248 -0
- package/dist/chunk-NFDTIYR4.js.map +1 -0
- package/dist/chunk-OY7ZODZP.js +16 -0
- package/dist/chunk-OY7ZODZP.js.map +1 -0
- package/dist/chunk-P2YDX5DB.js +3304 -0
- package/dist/chunk-P2YDX5DB.js.map +1 -0
- package/dist/chunk-QHILSPT4.js +3 -0
- package/dist/chunk-QHILSPT4.js.map +1 -0
- package/dist/chunk-XWIEEJ7Z.js +1315 -0
- package/dist/chunk-XWIEEJ7Z.js.map +1 -0
- package/dist/components/index.cjs +1745 -0
- package/dist/components/index.cjs.map +1 -0
- package/dist/components/index.d.cts +4 -0
- package/dist/components/index.d.ts +4 -0
- package/dist/components/index.js +4 -0
- package/dist/components/index.js.map +1 -0
- package/dist/docs/api/Behaviour/classes/Behaviour.md +554 -0
- package/dist/docs/api/Behaviour/index.md +15 -0
- package/dist/docs/api/Component/classes/Component.md +57 -0
- package/dist/docs/api/Component/index.md +15 -0
- package/dist/docs/api/components/classes/AnimationComponent.md +318 -0
- package/dist/docs/api/components/classes/AudioComponent.md +114 -0
- package/dist/docs/api/components/classes/CameraComponent.md +59 -0
- package/dist/docs/api/components/classes/EntityType.md +48 -0
- package/dist/docs/api/components/classes/Environment.md +47 -0
- package/dist/docs/api/components/classes/ImageComponent.md +57 -0
- package/dist/docs/api/components/classes/ImageTarget.md +60 -0
- package/dist/docs/api/components/classes/ImageTargetAnchor.md +48 -0
- package/dist/docs/api/components/classes/LightComponent.md +70 -0
- package/dist/docs/api/components/classes/MaterialComponent.md +181 -0
- package/dist/docs/api/components/classes/MeshComponent.md +48 -0
- package/dist/docs/api/components/classes/MeshGeometryComponent.md +64 -0
- package/dist/docs/api/components/classes/ModelComponent.md +49 -0
- package/dist/docs/api/components/classes/Name.md +46 -0
- package/dist/docs/api/components/classes/Object3DRef.md +54 -0
- package/dist/docs/api/components/classes/ParentId.md +47 -0
- package/dist/docs/api/components/classes/PhysicsComponent.md +82 -0
- package/dist/docs/api/components/classes/Postprocessing.md +49 -0
- package/dist/docs/api/components/classes/ScriptComponent.md +54 -0
- package/dist/docs/api/components/classes/Selectable.md +46 -0
- package/dist/docs/api/components/classes/SelectionTransformState.md +54 -0
- package/dist/docs/api/components/classes/SpriteComponent.md +55 -0
- package/dist/docs/api/components/classes/TransformComponent.md +197 -0
- package/dist/docs/api/components/classes/VideoComponent.md +123 -0
- package/dist/docs/api/components/functions/normalizePhysicsState.md +23 -0
- package/dist/docs/api/components/index.md +94 -0
- package/dist/docs/api/components/type-aliases/AnimationComponentOptions.md +42 -0
- package/dist/docs/api/components/type-aliases/CameraComponentOptions.md +45 -0
- package/dist/docs/api/components/type-aliases/CameraProjection.md +15 -0
- package/dist/docs/api/components/type-aliases/CameraRuntimeType.md +15 -0
- package/dist/docs/api/components/type-aliases/ColliderShape.md +15 -0
- package/dist/docs/api/components/type-aliases/ColliderState.md +62 -0
- package/dist/docs/api/components/type-aliases/CubeMeshParameters.md +27 -0
- package/dist/docs/api/components/type-aliases/EditableMeshObjectKind.md +15 -0
- package/dist/docs/api/components/type-aliases/EnvironmentFogState.md +37 -0
- package/dist/docs/api/components/type-aliases/EnvironmentFogType.md +15 -0
- package/dist/docs/api/components/type-aliases/EnvironmentGradientEffect.md +15 -0
- package/dist/docs/api/components/type-aliases/EnvironmentSkyboxState.md +34 -0
- package/dist/docs/api/components/type-aliases/EnvironmentSkyboxType.md +15 -0
- package/dist/docs/api/components/type-aliases/EnvironmentState.md +29 -0
- package/dist/docs/api/components/type-aliases/ImageTargetAnchorOptions.md +25 -0
- package/dist/docs/api/components/type-aliases/ImageTargetReference.md +33 -0
- package/dist/docs/api/components/type-aliases/LightValueState.md +41 -0
- package/dist/docs/api/components/type-aliases/MaterialTypeValue.md +15 -0
- package/dist/docs/api/components/type-aliases/MaterialValueState.md +75 -0
- package/dist/docs/api/components/type-aliases/MeshGeometryParameters.md +13 -0
- package/dist/docs/api/components/type-aliases/MeshGeometryParametersByKind.md +33 -0
- package/dist/docs/api/components/type-aliases/PhysicsState.md +25 -0
- package/dist/docs/api/components/type-aliases/PlaneMeshParameters.md +25 -0
- package/dist/docs/api/components/type-aliases/PostprocessingState.md +164 -0
- package/dist/docs/api/components/type-aliases/RadiusHeightMeshParameters.md +25 -0
- package/dist/docs/api/components/type-aliases/RadiusMeshParameters.md +23 -0
- package/dist/docs/api/components/type-aliases/RigidbodyState.md +53 -0
- package/dist/docs/api/components/type-aliases/RigidbodyType.md +19 -0
- package/dist/docs/api/components/type-aliases/ScriptEntry.md +38 -0
- package/dist/docs/api/components/type-aliases/TextureFilteringValue.md +15 -0
- package/dist/docs/api/components/type-aliases/TransformData.md +27 -0
- package/dist/docs/api/components/type-aliases/TransformModeValue.md +15 -0
- package/dist/docs/api/components/type-aliases/TransformSpaceValue.md +15 -0
- package/dist/docs/api/components/type-aliases/Vec3.md +27 -0
- package/dist/docs/api/components/variables/DEFAULT_COLLIDER_STATE.md +13 -0
- package/dist/docs/api/components/variables/DEFAULT_ENVIRONMENT_STATE.md +13 -0
- package/dist/docs/api/components/variables/DEFAULT_MESH_GEOMETRY_PARAMETERS.md +13 -0
- package/dist/docs/api/components/variables/DEFAULT_PHYSICS_STATE.md +13 -0
- package/dist/docs/api/components/variables/DEFAULT_POSTPROCESSING_STATE.md +13 -0
- package/dist/docs/api/components/variables/DEFAULT_RIGIDBODY_STATE.md +13 -0
- package/dist/docs/api/index/classes/AnimationStateMachine.md +201 -0
- package/dist/docs/api/index/classes/AnimationStateManager.md +253 -0
- package/dist/docs/api/index/classes/AnimationSystem.md +68 -0
- package/dist/docs/api/index/classes/AudioSystem.md +98 -0
- package/dist/docs/api/index/classes/CameraSyncSystem.md +49 -0
- package/dist/docs/api/index/classes/EnvironmentSyncSystem.md +75 -0
- package/dist/docs/api/index/classes/InputSystem.md +449 -0
- package/dist/docs/api/index/classes/LightSyncSystem.md +49 -0
- package/dist/docs/api/index/classes/MaterialSyncSystem.md +67 -0
- package/dist/docs/api/index/classes/MeshGeometrySystem.md +49 -0
- package/dist/docs/api/index/classes/ObjectManagementSystem.md +298 -0
- package/dist/docs/api/index/classes/ObjectVisibilitySystem.md +49 -0
- package/dist/docs/api/index/classes/PhysicsSyncSystem.md +83 -0
- package/dist/docs/api/index/classes/PostprocessingSyncSystem.md +80 -0
- package/dist/docs/api/index/classes/RenderSystem.md +64 -0
- package/dist/docs/api/index/classes/ScriptBehaviourSystem.md +83 -0
- package/dist/docs/api/index/classes/TransformSyncSystem.md +49 -0
- package/dist/docs/api/index/classes/VideoSystem.md +97 -0
- package/dist/docs/api/index/classes/World.md +1405 -0
- package/dist/docs/api/index/functions/createAnimationComponent.md +28 -0
- package/dist/docs/api/index/functions/createAudioComponent.md +32 -0
- package/dist/docs/api/index/functions/createCameraComponent.md +28 -0
- package/dist/docs/api/index/functions/createEntityTypeComponent.md +28 -0
- package/dist/docs/api/index/functions/createEnvironmentComponent.md +28 -0
- package/dist/docs/api/index/functions/createImageComponent.md +28 -0
- package/dist/docs/api/index/functions/createImageTargetAnchorComponent.md +28 -0
- package/dist/docs/api/index/functions/createImageTargetComponent.md +28 -0
- package/dist/docs/api/index/functions/createLightComponent.md +28 -0
- package/dist/docs/api/index/functions/createMaterialComponent.md +28 -0
- package/dist/docs/api/index/functions/createMeshComponent.md +28 -0
- package/dist/docs/api/index/functions/createMeshGeometryComponent.md +28 -0
- package/dist/docs/api/index/functions/createModelComponent.md +28 -0
- package/dist/docs/api/index/functions/createNameComponent.md +28 -0
- package/dist/docs/api/index/functions/createObject3DRefComponent.md +28 -0
- package/dist/docs/api/index/functions/createParentIdComponent.md +28 -0
- package/dist/docs/api/index/functions/createPhysicsComponent.md +30 -0
- package/dist/docs/api/index/functions/createPostprocessingComponent.md +28 -0
- package/dist/docs/api/index/functions/createScriptComponent.md +28 -0
- package/dist/docs/api/index/functions/createSelectableComponent.md +28 -0
- package/dist/docs/api/index/functions/createSelectionTransformStateComponent.md +28 -0
- package/dist/docs/api/index/functions/createSpriteComponent.md +28 -0
- package/dist/docs/api/index/functions/createTransformComponent.md +28 -0
- package/dist/docs/api/index/functions/createVideoComponent.md +28 -0
- package/dist/docs/api/index/functions/hydrateWorldFromSnapshot.md +28 -0
- package/dist/docs/api/index/functions/hydrateWorldFromSnapshotDetailed.md +28 -0
- package/dist/docs/api/index/functions/registerDefaultComponentFactories.md +23 -0
- package/dist/docs/api/index/functions/registerDefaultFactories.md +23 -0
- package/dist/docs/api/index/index.md +249 -0
- package/dist/docs/api/index/interfaces/EcsSystem.md +50 -0
- package/dist/docs/api/index/interfaces/StateMachine.md +26 -0
- package/dist/docs/api/index/type-aliases/AnimationStateCallbacks.md +25 -0
- package/dist/docs/api/index/type-aliases/ComponentFactory.md +25 -0
- package/dist/docs/api/index/type-aliases/EcsComponentFactoryKind.md +37 -0
- package/dist/docs/api/index/type-aliases/EcsWorldComponentSnapshot.md +26 -0
- package/dist/docs/api/index/type-aliases/EcsWorldStateSnapshotLike.md +25 -0
- package/dist/docs/api/index/type-aliases/HydrateWorldFromSnapshotResult.md +23 -0
- package/dist/docs/api/index/type-aliases/KeyboardKey.md +13 -0
- package/dist/docs/api/index/type-aliases/MouseButton.md +13 -0
- package/dist/docs/api/index/type-aliases/SelectionContext.md +31 -0
- package/dist/docs/api/index/variables/HYDRATABLE_ENTITY_KINDS.md +13 -0
- package/dist/docs/api/index/variables/KeyboardKeys.md +195 -0
- package/dist/docs/api/index.md +15 -0
- package/dist/docs/api/typedoc-sidebar.json +1 -0
- package/dist/docs/api/types/index.md +34 -0
- package/dist/docs/api/types/type-aliases/AssetInput.md +23 -0
- package/dist/docs/api/types/type-aliases/CheckboxInput.md +13 -0
- package/dist/docs/api/types/type-aliases/ColorInput.md +13 -0
- package/dist/docs/api/types/type-aliases/ComponentInput.md +52 -0
- package/dist/docs/api/types/type-aliases/ComponentKind.md +37 -0
- package/dist/docs/api/types/type-aliases/DropdownInput.md +23 -0
- package/dist/docs/api/types/type-aliases/DropdownOption.md +23 -0
- package/dist/docs/api/types/type-aliases/EcsEntityEditorKind.md +15 -0
- package/dist/docs/api/types/type-aliases/EcsEntityKind.md +35 -0
- package/dist/docs/api/types/type-aliases/EntityId.md +16 -0
- package/dist/docs/api/types/type-aliases/EntityInput.md +23 -0
- package/dist/docs/api/types/type-aliases/FloatInput.md +13 -0
- package/dist/docs/api/types/type-aliases/IntersectionResult.md +29 -0
- package/dist/docs/api/types/type-aliases/ParentLookup.md +26 -0
- package/dist/docs/api/types/type-aliases/SelectionListener.md +25 -0
- package/dist/docs/api/types/type-aliases/SliderInput.md +27 -0
- package/dist/docs/api/types/type-aliases/TextInput.md +13 -0
- package/dist/docs/api/types/type-aliases/ToggleInput.md +13 -0
- package/dist/docs/api/types/type-aliases/Vec3.md +23 -0
- package/dist/docs/api/types/type-aliases/Vector2Input.md +23 -0
- package/dist/docs/api/types/type-aliases/Vector3Input.md +25 -0
- package/dist/docs/api/types/type-aliases/WorldEntityView.md +17 -0
- package/dist/docs/guide/accessing-components.md +399 -0
- package/dist/docs/guide/authoring-a-behaviour.md +166 -0
- package/dist/docs/guide/behaviour-lifecycle.md +43 -0
- package/dist/docs/guide/component-catalog.md +59 -0
- package/dist/docs/guide/components/_sidebar.json +78 -0
- package/dist/docs/guide/components/animation.md +171 -0
- package/dist/docs/guide/components/audio.md +181 -0
- package/dist/docs/guide/components/camera.md +179 -0
- package/dist/docs/guide/components/entity-type.md +141 -0
- package/dist/docs/guide/components/image-target-anchor.md +103 -0
- package/dist/docs/guide/components/image-target.md +122 -0
- package/dist/docs/guide/components/image.md +146 -0
- package/dist/docs/guide/components/light.md +157 -0
- package/dist/docs/guide/components/material.md +161 -0
- package/dist/docs/guide/components/mesh-geometry.md +153 -0
- package/dist/docs/guide/components/mesh.md +151 -0
- package/dist/docs/guide/components/model.md +96 -0
- package/dist/docs/guide/components/name.md +121 -0
- package/dist/docs/guide/components/object3d-ref.md +115 -0
- package/dist/docs/guide/components/parent-id.md +108 -0
- package/dist/docs/guide/components/physics.md +163 -0
- package/dist/docs/guide/components/script.md +142 -0
- package/dist/docs/guide/components/sprite.md +155 -0
- package/dist/docs/guide/components/transform.md +155 -0
- package/dist/docs/guide/components/video.md +153 -0
- package/dist/docs/guide/concepts.md +34 -0
- package/dist/docs/guide/getting-started/creating-objects.md +50 -0
- package/dist/docs/guide/getting-started/editing-objects.md +62 -0
- package/dist/docs/guide/getting-started/editor/assets-browser.md +55 -0
- package/dist/docs/guide/getting-started/editor/hierarchy.md +47 -0
- package/dist/docs/guide/getting-started/editor/index.md +16 -0
- package/dist/docs/guide/getting-started/editor/inspector.md +36 -0
- package/dist/docs/guide/getting-started/editor/modules.md +35 -0
- package/dist/docs/guide/getting-started/editor/scene-inspector.md +64 -0
- package/dist/docs/guide/getting-started/editor/toolbar.md +39 -0
- package/dist/docs/guide/getting-started/editor/viewport.md +43 -0
- package/dist/docs/guide/getting-started/first-launch.md +17 -0
- package/dist/docs/guide/getting-started/index.md +37 -0
- package/dist/docs/guide/getting-started/installation.md +59 -0
- package/dist/docs/guide/getting-started/preview-and-test.md +55 -0
- package/dist/docs/guide/getting-started/project-types/3d.md +30 -0
- package/dist/docs/guide/getting-started/project-types/ar.md +6 -0
- package/dist/docs/guide/getting-started/project-types/face-tracking.md +6 -0
- package/dist/docs/guide/getting-started/project-types/image-tracking.md +42 -0
- package/dist/docs/guide/getting-started/project-types/index.md +25 -0
- package/dist/docs/guide/getting-started/project-types/vr.md +6 -0
- package/dist/docs/guide/getting-started/projects.md +53 -0
- package/dist/docs/guide/getting-started/shortcuts.md +43 -0
- package/dist/docs/guide/inspector-data-binding.md +367 -0
- package/dist/docs/guide/reading-input.md +202 -0
- package/dist/docs/guide/scene/environment.md +101 -0
- package/dist/docs/guide/scene/index.md +36 -0
- package/dist/docs/guide/scene/postprocessing.md +108 -0
- package/dist/docs/guide/spawning/ambient-light.md +28 -0
- package/dist/docs/guide/spawning/area-light.md +32 -0
- package/dist/docs/guide/spawning/audio.md +42 -0
- package/dist/docs/guide/spawning/camera.md +50 -0
- package/dist/docs/guide/spawning/capsule.md +29 -0
- package/dist/docs/guide/spawning/cube.md +31 -0
- package/dist/docs/guide/spawning/cylinder.md +29 -0
- package/dist/docs/guide/spawning/directional-light.md +32 -0
- package/dist/docs/guide/spawning/empty.md +31 -0
- package/dist/docs/guide/spawning/image-target.md +48 -0
- package/dist/docs/guide/spawning/image.md +33 -0
- package/dist/docs/guide/spawning/index.md +79 -0
- package/dist/docs/guide/spawning/model.md +31 -0
- package/dist/docs/guide/spawning/plane.md +31 -0
- package/dist/docs/guide/spawning/point-light.md +32 -0
- package/dist/docs/guide/spawning/sphere.md +29 -0
- package/dist/docs/guide/spawning/spot-light.md +32 -0
- package/dist/docs/guide/spawning/sprite.md +31 -0
- package/dist/docs/guide/spawning/video.md +53 -0
- package/dist/docs/guide/system-overview.md +73 -0
- package/dist/docs/guide/systems/_sidebar.json +66 -0
- package/dist/docs/guide/systems/animation-system.md +32 -0
- package/dist/docs/guide/systems/audio-system.md +28 -0
- package/dist/docs/guide/systems/camera-sync-system.md +31 -0
- package/dist/docs/guide/systems/environment-sync-system.md +31 -0
- package/dist/docs/guide/systems/input-system.md +217 -0
- package/dist/docs/guide/systems/light-sync-system.md +29 -0
- package/dist/docs/guide/systems/material-sync-system.md +32 -0
- package/dist/docs/guide/systems/mesh-geometry-system.md +40 -0
- package/dist/docs/guide/systems/object-management-system.md +38 -0
- package/dist/docs/guide/systems/object-visibility-system.md +26 -0
- package/dist/docs/guide/systems/physics-sync-system.md +56 -0
- package/dist/docs/guide/systems/postprocessing-sync-system.md +43 -0
- package/dist/docs/guide/systems/render-system.md +22 -0
- package/dist/docs/guide/systems/script-behaviour-system.md +59 -0
- package/dist/docs/guide/systems/transform-sync-system.md +29 -0
- package/dist/docs/guide/systems/video-system.md +30 -0
- package/dist/docs/guide/world-api.md +405 -0
- package/dist/factories/index.cjs +3077 -0
- package/dist/factories/index.cjs.map +1 -0
- package/dist/factories/index.d.cts +69 -0
- package/dist/factories/index.d.ts +69 -0
- package/dist/factories/index.js +6 -0
- package/dist/factories/index.js.map +1 -0
- package/dist/index-B4-YyUNR.d.cts +73 -0
- package/dist/index-BZUOKeTO.d.ts +73 -0
- package/dist/index.cjs +8584 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +283 -0
- package/dist/index.d.ts +283 -0
- package/dist/index.js +1729 -0
- package/dist/index.js.map +1 -0
- package/dist/systems/index.cjs +5119 -0
- package/dist/systems/index.cjs.map +1 -0
- package/dist/systems/index.d.cts +200 -0
- package/dist/systems/index.d.ts +200 -0
- package/dist/systems/index.js +6 -0
- package/dist/systems/index.js.map +1 -0
- package/dist/types.cjs +4 -0
- package/dist/types.cjs.map +1 -0
- package/dist/types.d.cts +3 -0
- package/dist/types.d.ts +3 -0
- package/dist/types.js +3 -0
- package/dist/types.js.map +1 -0
- package/dist/worldSnapshotUtils.cjs +259 -0
- package/dist/worldSnapshotUtils.cjs.map +1 -0
- package/dist/worldSnapshotUtils.d.cts +3 -0
- package/dist/worldSnapshotUtils.d.ts +3 -0
- package/dist/worldSnapshotUtils.js +4 -0
- package/dist/worldSnapshotUtils.js.map +1 -0
- package/package.json +80 -0
|
@@ -0,0 +1,659 @@
|
|
|
1
|
+
import * as THREE from 'three';
|
|
2
|
+
import { Vector3, Euler, EulerOrder, Quaternion } from 'three';
|
|
3
|
+
import * as RAPIER from '@dimforge/rapier3d-compat';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Marker base class for every ECS component. Subclass `Component` to declare
|
|
7
|
+
* a typed data container that systems can query.
|
|
8
|
+
*
|
|
9
|
+
* @remarks
|
|
10
|
+
* Components own state only — runtime behaviour belongs in {@link Behaviour}
|
|
11
|
+
* subclasses for user scripts. Keep fields plain (numbers, strings, vectors,
|
|
12
|
+
* asset URLs).
|
|
13
|
+
*
|
|
14
|
+
* @category Components
|
|
15
|
+
*/
|
|
16
|
+
declare class Component {
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Records the parent entity id for hierarchical scene graphs. `null` means
|
|
21
|
+
* the entity is at the world root. The `ObjectManagementSystem` reconciles
|
|
22
|
+
* scene-graph parenting from this component each frame.
|
|
23
|
+
*
|
|
24
|
+
* @category Components
|
|
25
|
+
*/
|
|
26
|
+
declare class ParentId extends Component {
|
|
27
|
+
/** Parent entity id, or `null` for root-level entities. */
|
|
28
|
+
value: EntityId | null;
|
|
29
|
+
constructor(value?: EntityId | null);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/** Plain XYZ vector. All ECS transform fields use this shape rather than `THREE.Vector3` so they save cleanly with the project. */
|
|
33
|
+
type Vec3$1 = {
|
|
34
|
+
/** X component. */
|
|
35
|
+
x: number;
|
|
36
|
+
/** Y component. */
|
|
37
|
+
y: number;
|
|
38
|
+
/** Z component. */
|
|
39
|
+
z: number;
|
|
40
|
+
};
|
|
41
|
+
/** Optional initial values passed to {@link TransformComponent}. Missing axes default to `0` for position/rotation and `1` for scale. */
|
|
42
|
+
type TransformData = {
|
|
43
|
+
/** Initial position (defaults to `{ 0, 0, 0 }`). */
|
|
44
|
+
position?: Partial<Vec3$1>;
|
|
45
|
+
/** Initial rotation in **radians** (defaults to `{ 0, 0, 0 }`). */
|
|
46
|
+
rotation?: Partial<Vec3$1>;
|
|
47
|
+
/** Initial scale (defaults to `{ 1, 1, 1 }`). */
|
|
48
|
+
scale?: Partial<Vec3$1>;
|
|
49
|
+
};
|
|
50
|
+
type TransformInput = Vector3 | Euler | Quaternion;
|
|
51
|
+
/**
|
|
52
|
+
* Position, rotation, and scale of an entity in its parent's local space.
|
|
53
|
+
*
|
|
54
|
+
* @remarks
|
|
55
|
+
* Rotation is stored in **radians** (Euler XYZ). The editor inspector converts
|
|
56
|
+
* to/from degrees for display — do not store degrees in this component.
|
|
57
|
+
* Mutations should go through the `setPosition` / `setRotation` / `setScale`
|
|
58
|
+
* helpers so dependent systems pick up the change.
|
|
59
|
+
*
|
|
60
|
+
* @category Components
|
|
61
|
+
*/
|
|
62
|
+
declare class TransformComponent extends Component {
|
|
63
|
+
/** Local position relative to the parent (or world if no parent). */
|
|
64
|
+
position: Vec3$1;
|
|
65
|
+
/** Local rotation as Euler XYZ in **radians**. */
|
|
66
|
+
rotation: Vec3$1;
|
|
67
|
+
/** Local scale factors per axis (`1` = identity). */
|
|
68
|
+
scale: Vec3$1;
|
|
69
|
+
constructor(data?: TransformData);
|
|
70
|
+
toPositionVector3(target?: Vector3): Vector3;
|
|
71
|
+
toRotationEuler(target?: Euler, order?: EulerOrder): Euler;
|
|
72
|
+
toRotationQuaternion(target?: Quaternion, order?: EulerOrder): Quaternion;
|
|
73
|
+
toScaleVector3(target?: Vector3): Vector3;
|
|
74
|
+
setPosition(input: TransformInput): this;
|
|
75
|
+
setScale(input: TransformInput): this;
|
|
76
|
+
setRotation(input: TransformInput, order?: EulerOrder): this;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Numeric identifier for an entity. Entities are pure ids — all data lives in
|
|
81
|
+
* components attached to the entity.
|
|
82
|
+
*/
|
|
83
|
+
type EntityId = number;
|
|
84
|
+
/**
|
|
85
|
+
* Built-in entity kinds recognized by the ECS factory registry. Each kind
|
|
86
|
+
* maps to an object factory in `core/factories/objects/*` that creates the
|
|
87
|
+
* baseline component set.
|
|
88
|
+
*/
|
|
89
|
+
type EcsEntityKind = "cube" | "sphere" | "plane" | "capsule" | "cylinder" | "empty" | "model" | "image" | "imageTarget" | "sprite" | "audio" | "camera" | "video" | "ambientLight" | "directionalLight" | "pointLight" | "spotLight" | "areaLight";
|
|
90
|
+
/** {@link EcsEntityKind} extended with editor-only utility entities (gizmos, helpers). */
|
|
91
|
+
type EcsEntityEditorKind = EcsEntityKind | "editorUtility";
|
|
92
|
+
/** Callback invoked when the selected entity changes. `null` indicates a deselection. */
|
|
93
|
+
type SelectionListener = (entityId: EntityId | null) => void;
|
|
94
|
+
type TextInput = string;
|
|
95
|
+
type FloatInput = number;
|
|
96
|
+
type ColorInput = string;
|
|
97
|
+
type Vector2Input = {
|
|
98
|
+
x: number;
|
|
99
|
+
y: number;
|
|
100
|
+
};
|
|
101
|
+
type Vector3Input = {
|
|
102
|
+
x: number;
|
|
103
|
+
y: number;
|
|
104
|
+
z: number;
|
|
105
|
+
};
|
|
106
|
+
type SliderInput = {
|
|
107
|
+
min: number;
|
|
108
|
+
max: number;
|
|
109
|
+
step: number;
|
|
110
|
+
value: number;
|
|
111
|
+
};
|
|
112
|
+
type DropdownOption = {
|
|
113
|
+
label: string;
|
|
114
|
+
value: string | any;
|
|
115
|
+
};
|
|
116
|
+
type DropdownInput = {
|
|
117
|
+
options: DropdownOption[];
|
|
118
|
+
value: string | any;
|
|
119
|
+
};
|
|
120
|
+
type CheckboxInput = boolean;
|
|
121
|
+
type ToggleInput = boolean;
|
|
122
|
+
type AssetInput = {
|
|
123
|
+
path: string;
|
|
124
|
+
type: string;
|
|
125
|
+
};
|
|
126
|
+
type EntityInput = {
|
|
127
|
+
type: "entity";
|
|
128
|
+
value: EntityId | null;
|
|
129
|
+
};
|
|
130
|
+
type ComponentKind = "Animation" | "Audio" | "Camera" | "Environment" | "EntityType" | "Image" | "ImageTarget" | "ImageTargetAnchor" | "Light" | "Material" | "Mesh" | "MeshGeometry" | "Model" | "Name" | "Object3DRef" | "ParentId" | "Physics" | "Postprocessing" | "Script" | "Selectable" | "SelectionTransformState" | "Sprite" | "Transform" | "Video";
|
|
131
|
+
/**
|
|
132
|
+
* Inspector field that lets the user drag an entity and optionally pick a
|
|
133
|
+
* component from it.
|
|
134
|
+
*
|
|
135
|
+
* The optional `componentKind` property narrows which component the inspector
|
|
136
|
+
* should auto-resolve or pre-filter to. When set, dropping an entity will
|
|
137
|
+
* immediately commit that component kind — skipping the dropdown entirely.
|
|
138
|
+
*
|
|
139
|
+
* @example
|
|
140
|
+
* // Unconstrained — shows a component-kind dropdown after entity drop
|
|
141
|
+
* anyRef: { type: "component", value: null } as ComponentInput
|
|
142
|
+
*
|
|
143
|
+
* // Constrained — auto-resolves to "Transform", no dropdown
|
|
144
|
+
* transform: { type: "component", componentKind: "Transform", value: null } as ComponentInput<Transform>
|
|
145
|
+
*/
|
|
146
|
+
type ComponentInput<T extends Component = Component> = {
|
|
147
|
+
type: "component";
|
|
148
|
+
/** Optional component-kind constraint. When provided, the inspector skips
|
|
149
|
+
* the dropdown and resolves directly to this kind. */
|
|
150
|
+
componentKind?: ComponentKind;
|
|
151
|
+
value: {
|
|
152
|
+
entityId: EntityId;
|
|
153
|
+
componentKind: ComponentKind;
|
|
154
|
+
} | null;
|
|
155
|
+
/** @internal used only for TypeScript type inference; not persisted. */
|
|
156
|
+
readonly _phantom?: T;
|
|
157
|
+
};
|
|
158
|
+
/**
|
|
159
|
+
* Lightweight, read-only view of an entity returned by `World.getEntityById`.
|
|
160
|
+
* Contains the entity id and its current component list at the moment of the
|
|
161
|
+
* lookup. Re-query each frame rather than caching across ticks.
|
|
162
|
+
*/
|
|
163
|
+
type WorldEntityView$1 = NonNullable<ReturnType<World["getEntityById"]>>;
|
|
164
|
+
/**
|
|
165
|
+
* Result of a parent lookup. `parent` is `null` for entities at the root or
|
|
166
|
+
* for entities without a {@link ParentId} component.
|
|
167
|
+
*/
|
|
168
|
+
type ParentLookup = {
|
|
169
|
+
/** The entity's `ParentId` component, or `null` if it has none. */
|
|
170
|
+
parentIdComponent: ParentId | null;
|
|
171
|
+
/** The resolved parent entity view, or `null` if the entity is at the root. */
|
|
172
|
+
parent: WorldEntityView$1 | null;
|
|
173
|
+
};
|
|
174
|
+
/**
|
|
175
|
+
* Loose 3D vector accepted by raycast and other spatial helpers. Either a
|
|
176
|
+
* live `THREE.Vector3` or a plain `{ x, y, z }` object — both are normalized
|
|
177
|
+
* internally before use.
|
|
178
|
+
*/
|
|
179
|
+
type Vec3 = THREE.Vector3 | {
|
|
180
|
+
x: number;
|
|
181
|
+
y: number;
|
|
182
|
+
z: number;
|
|
183
|
+
};
|
|
184
|
+
/**
|
|
185
|
+
* Single hit returned by `World.raycast` / `World.raycastFrom`. Pairs the
|
|
186
|
+
* standard `THREE.Intersection` (`threeResult`) with the owning entity id
|
|
187
|
+
* (when the hit traces back to a registered ECS entity). `entityId` is
|
|
188
|
+
* `null` if the hit object is not part of any tracked entity (e.g. an
|
|
189
|
+
* editor helper).
|
|
190
|
+
*/
|
|
191
|
+
type IntersectionResult = {
|
|
192
|
+
/** The entity that owns the hit object, or `null` if untracked. */
|
|
193
|
+
entityId: EntityId | null;
|
|
194
|
+
/** The underlying three.js intersection record. */
|
|
195
|
+
threeResult: THREE.Intersection;
|
|
196
|
+
};
|
|
197
|
+
|
|
198
|
+
type ComponentClass<T extends Component> = new (...args: never[]) => T;
|
|
199
|
+
type AnyComponent = Component;
|
|
200
|
+
type WorldHistorySnapshot = {
|
|
201
|
+
selectedEntityId: EntityId | null;
|
|
202
|
+
entities: EntityId[];
|
|
203
|
+
nextEntityId: number;
|
|
204
|
+
components: Array<{
|
|
205
|
+
componentType: ComponentClass<AnyComponent>;
|
|
206
|
+
entries: Array<{
|
|
207
|
+
entityId: EntityId;
|
|
208
|
+
component: AnyComponent;
|
|
209
|
+
}>;
|
|
210
|
+
}>;
|
|
211
|
+
};
|
|
212
|
+
declare const DEBUG_CHANGE_IGNORED_SYSTEMS: Set<string>;
|
|
213
|
+
type NormalizeContext = {
|
|
214
|
+
seen: WeakSet<object>;
|
|
215
|
+
depth: number;
|
|
216
|
+
maxDepth: number;
|
|
217
|
+
};
|
|
218
|
+
declare function normalizeDebugValue(value: unknown, ctx: NormalizeContext): unknown;
|
|
219
|
+
declare function cloneHistoryValue<T>(value: T, seen?: WeakMap<object, unknown>): T;
|
|
220
|
+
|
|
221
|
+
type CreatePayload = {
|
|
222
|
+
name?: string;
|
|
223
|
+
transform?: TransformData;
|
|
224
|
+
parentId?: EntityId | null;
|
|
225
|
+
path?: string;
|
|
226
|
+
options?: Record<string, unknown>;
|
|
227
|
+
camera?: Record<string, unknown>;
|
|
228
|
+
useWorldCamera?: boolean;
|
|
229
|
+
};
|
|
230
|
+
type CreateContext = {
|
|
231
|
+
world: World;
|
|
232
|
+
scene: THREE.Scene;
|
|
233
|
+
camera: THREE.PerspectiveCamera;
|
|
234
|
+
payload: CreatePayload;
|
|
235
|
+
isEditor?: boolean;
|
|
236
|
+
};
|
|
237
|
+
type EntityFactory = (context: CreateContext) => EntityId;
|
|
238
|
+
type EcsComponentFactoryKind = "animation" | "audio" | "camera" | "environment" | "entityType" | "image" | "imageTargetAnchor" | "imageTarget" | "light" | "material" | "mesh" | "meshGeometry" | "model" | "name" | "object3DRef" | "parentId" | "physics" | "postprocessing" | "script" | "selectable" | "selectionTransformState" | "sprite" | "transform" | "video";
|
|
239
|
+
type ComponentFactory = (world: World, entityId: EntityId, ...args: any[]) => unknown;
|
|
240
|
+
declare class ObjectManagementSystem implements EcsSystem {
|
|
241
|
+
private readonly scene;
|
|
242
|
+
private readonly camera;
|
|
243
|
+
private readonly isEditor;
|
|
244
|
+
private readonly registry;
|
|
245
|
+
private readonly componentRegistry;
|
|
246
|
+
private readonly createQueue;
|
|
247
|
+
constructor(scene: THREE.Scene, camera: THREE.PerspectiveCamera, isEditor?: boolean);
|
|
248
|
+
register(kind: EcsEntityKind, factory: EntityFactory): void;
|
|
249
|
+
registerComponentFactory(kind: EcsComponentFactoryKind, factory: ComponentFactory): void;
|
|
250
|
+
getOrCreateAudioListener(): THREE.AudioListener;
|
|
251
|
+
isEditorMode(): boolean;
|
|
252
|
+
getComponentFactory(kind: EcsComponentFactoryKind): ComponentFactory | null;
|
|
253
|
+
createComponentNow(kind: EcsComponentFactoryKind, world: World, entityId: EntityId, ...args: any[]): unknown;
|
|
254
|
+
requestCreate(kind: EcsEntityKind, payload?: CreatePayload, onCreated?: (entityId: EntityId) => void): void;
|
|
255
|
+
createNow(kind: EcsEntityKind, world: World, payload?: CreatePayload): EntityId;
|
|
256
|
+
deleteEntity(world: World, entityId: EntityId): boolean;
|
|
257
|
+
setParent(world: World, entityId: EntityId, parentId: EntityId | null, options?: {
|
|
258
|
+
preserveWorldTransform?: boolean;
|
|
259
|
+
}): boolean;
|
|
260
|
+
private syncTransformComponentFromObject;
|
|
261
|
+
reconcileSceneFromWorld(world: World): void;
|
|
262
|
+
update(world: World): void;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
declare const KeyboardKeys: {
|
|
266
|
+
readonly A: "a";
|
|
267
|
+
readonly B: "b";
|
|
268
|
+
readonly C: "c";
|
|
269
|
+
readonly D: "d";
|
|
270
|
+
readonly E: "e";
|
|
271
|
+
readonly F: "f";
|
|
272
|
+
readonly G: "g";
|
|
273
|
+
readonly H: "h";
|
|
274
|
+
readonly I: "i";
|
|
275
|
+
readonly J: "j";
|
|
276
|
+
readonly K: "k";
|
|
277
|
+
readonly L: "l";
|
|
278
|
+
readonly M: "m";
|
|
279
|
+
readonly N: "n";
|
|
280
|
+
readonly O: "o";
|
|
281
|
+
readonly P: "p";
|
|
282
|
+
readonly Q: "q";
|
|
283
|
+
readonly R: "r";
|
|
284
|
+
readonly S: "s";
|
|
285
|
+
readonly T: "t";
|
|
286
|
+
readonly U: "u";
|
|
287
|
+
readonly V: "v";
|
|
288
|
+
readonly W: "w";
|
|
289
|
+
readonly X: "x";
|
|
290
|
+
readonly Y: "y";
|
|
291
|
+
readonly Z: "z";
|
|
292
|
+
readonly Digit0: "0";
|
|
293
|
+
readonly Digit1: "1";
|
|
294
|
+
readonly Digit2: "2";
|
|
295
|
+
readonly Digit3: "3";
|
|
296
|
+
readonly Digit4: "4";
|
|
297
|
+
readonly Digit5: "5";
|
|
298
|
+
readonly Digit6: "6";
|
|
299
|
+
readonly Digit7: "7";
|
|
300
|
+
readonly Digit8: "8";
|
|
301
|
+
readonly Digit9: "9";
|
|
302
|
+
readonly Space: " ";
|
|
303
|
+
readonly Enter: "enter";
|
|
304
|
+
readonly Escape: "escape";
|
|
305
|
+
readonly Tab: "tab";
|
|
306
|
+
readonly Backspace: "backspace";
|
|
307
|
+
readonly Delete: "delete";
|
|
308
|
+
readonly Insert: "insert";
|
|
309
|
+
readonly Home: "home";
|
|
310
|
+
readonly End: "end";
|
|
311
|
+
readonly PageUp: "pageup";
|
|
312
|
+
readonly PageDown: "pagedown";
|
|
313
|
+
readonly ArrowUp: "arrowup";
|
|
314
|
+
readonly ArrowDown: "arrowdown";
|
|
315
|
+
readonly ArrowLeft: "arrowleft";
|
|
316
|
+
readonly ArrowRight: "arrowright";
|
|
317
|
+
readonly Shift: "shift";
|
|
318
|
+
readonly ShiftLeft: "shiftleft";
|
|
319
|
+
readonly ShiftRight: "shiftright";
|
|
320
|
+
readonly Control: "control";
|
|
321
|
+
readonly ControlLeft: "controlleft";
|
|
322
|
+
readonly ControlRight: "controlright";
|
|
323
|
+
readonly Alt: "alt";
|
|
324
|
+
readonly Meta: "meta";
|
|
325
|
+
readonly CapsLock: "capslock";
|
|
326
|
+
readonly NumLock: "numlock";
|
|
327
|
+
readonly ScrollLock: "scrolllock";
|
|
328
|
+
readonly Pause: "pause";
|
|
329
|
+
readonly PrintScreen: "printscreen";
|
|
330
|
+
readonly ContextMenu: "contextmenu";
|
|
331
|
+
readonly Minus: "-";
|
|
332
|
+
readonly Equal: "=";
|
|
333
|
+
readonly BracketLeft: "[";
|
|
334
|
+
readonly BracketRight: "]";
|
|
335
|
+
readonly Backslash: "\\";
|
|
336
|
+
readonly Semicolon: ";";
|
|
337
|
+
readonly Quote: "'";
|
|
338
|
+
readonly Backquote: "`";
|
|
339
|
+
readonly Comma: ",";
|
|
340
|
+
readonly Period: ".";
|
|
341
|
+
readonly Slash: "/";
|
|
342
|
+
readonly F1: "f1";
|
|
343
|
+
readonly F2: "f2";
|
|
344
|
+
readonly F3: "f3";
|
|
345
|
+
readonly F4: "f4";
|
|
346
|
+
readonly F5: "f5";
|
|
347
|
+
readonly F6: "f6";
|
|
348
|
+
readonly F7: "f7";
|
|
349
|
+
readonly F8: "f8";
|
|
350
|
+
readonly F9: "f9";
|
|
351
|
+
readonly F10: "f10";
|
|
352
|
+
readonly F11: "f11";
|
|
353
|
+
readonly F12: "f12";
|
|
354
|
+
};
|
|
355
|
+
type KeyboardKey = (typeof KeyboardKeys)[keyof typeof KeyboardKeys];
|
|
356
|
+
|
|
357
|
+
type MouseButton = "left" | "middle" | "right";
|
|
358
|
+
declare class InputSystem implements EcsSystem {
|
|
359
|
+
private readonly held;
|
|
360
|
+
private readonly down;
|
|
361
|
+
private readonly up;
|
|
362
|
+
private readonly pendingDown;
|
|
363
|
+
private readonly pendingUp;
|
|
364
|
+
private readonly heldMouse;
|
|
365
|
+
private readonly downMouse;
|
|
366
|
+
private readonly upMouse;
|
|
367
|
+
private readonly pendingMouseDown;
|
|
368
|
+
private readonly pendingMouseUp;
|
|
369
|
+
private scrollDeltaX;
|
|
370
|
+
private scrollDeltaY;
|
|
371
|
+
private pendingScrollDeltaX;
|
|
372
|
+
private pendingScrollDeltaY;
|
|
373
|
+
private mouseDeltaX;
|
|
374
|
+
private mouseDeltaY;
|
|
375
|
+
private pendingMouseDeltaX;
|
|
376
|
+
private pendingMouseDeltaY;
|
|
377
|
+
private mousePosition;
|
|
378
|
+
private pointerLockElement;
|
|
379
|
+
private pendingPointerLockRequest;
|
|
380
|
+
private resolvePointerBounds;
|
|
381
|
+
private onKeyDown;
|
|
382
|
+
private onKeyUp;
|
|
383
|
+
private onWindowBlur;
|
|
384
|
+
private onMouseDown;
|
|
385
|
+
private onMouseUp;
|
|
386
|
+
private onMouseWheel;
|
|
387
|
+
private onMouseMove;
|
|
388
|
+
private onPointerLockChange;
|
|
389
|
+
private onPointerLockError;
|
|
390
|
+
constructor();
|
|
391
|
+
setPointerLockElement(element: HTMLElement | null): void;
|
|
392
|
+
lockMousePointer(): boolean;
|
|
393
|
+
unlockMousePointer(): boolean;
|
|
394
|
+
isMousePointerLocked(): boolean;
|
|
395
|
+
getKey(key: KeyboardKey | string): boolean;
|
|
396
|
+
getKeyDown(key: KeyboardKey | string): boolean;
|
|
397
|
+
getKeyUp(key: KeyboardKey | string): boolean;
|
|
398
|
+
consumePressed(key: KeyboardKey | string): boolean;
|
|
399
|
+
getMouse(button: MouseButton | number | string): boolean;
|
|
400
|
+
getMouseDown(button: MouseButton | number | string): boolean;
|
|
401
|
+
getMouseUp(button: MouseButton | number | string): boolean;
|
|
402
|
+
getScrollClick(): boolean;
|
|
403
|
+
getScrollClickDown(): boolean;
|
|
404
|
+
getScrollClickUp(): boolean;
|
|
405
|
+
getScrollDelta(): {
|
|
406
|
+
x: number;
|
|
407
|
+
y: number;
|
|
408
|
+
};
|
|
409
|
+
consumeScrollDelta(): {
|
|
410
|
+
x: number;
|
|
411
|
+
y: number;
|
|
412
|
+
};
|
|
413
|
+
getMousePosition(): {
|
|
414
|
+
x: number;
|
|
415
|
+
y: number;
|
|
416
|
+
};
|
|
417
|
+
getMouseDelta(): {
|
|
418
|
+
x: number;
|
|
419
|
+
y: number;
|
|
420
|
+
};
|
|
421
|
+
consumeMouseDelta(): {
|
|
422
|
+
x: number;
|
|
423
|
+
y: number;
|
|
424
|
+
};
|
|
425
|
+
update(_world: World, _deltaTime: number): void;
|
|
426
|
+
dispose(): void;
|
|
427
|
+
private clearAll;
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
declare class RenderSystem implements EcsSystem {
|
|
431
|
+
private readonly renderer;
|
|
432
|
+
private readonly scene;
|
|
433
|
+
private readonly camera;
|
|
434
|
+
private readonly afterRender?;
|
|
435
|
+
constructor(renderer: THREE.WebGLRenderer, scene: THREE.Scene, camera: THREE.PerspectiveCamera, afterRender?: () => void);
|
|
436
|
+
update(_world: World): void;
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
declare class TransformSyncSystem implements EcsSystem {
|
|
440
|
+
update(world: World): void;
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
type StoreListener = () => void;
|
|
444
|
+
type WorldFeatureFlags = {
|
|
445
|
+
supportSkybox?: boolean;
|
|
446
|
+
supportPostprocessing?: boolean;
|
|
447
|
+
};
|
|
448
|
+
type WorldEntityView = {
|
|
449
|
+
name: string;
|
|
450
|
+
entityId: number;
|
|
451
|
+
object: THREE.Object3D | null;
|
|
452
|
+
type: string;
|
|
453
|
+
components: Component[];
|
|
454
|
+
};
|
|
455
|
+
declare class World {
|
|
456
|
+
private nextEntityId;
|
|
457
|
+
private entities;
|
|
458
|
+
private systems;
|
|
459
|
+
private selectionListeners;
|
|
460
|
+
private storeListeners;
|
|
461
|
+
private scene;
|
|
462
|
+
private camera;
|
|
463
|
+
private renderer;
|
|
464
|
+
private readonly featureFlags;
|
|
465
|
+
private components;
|
|
466
|
+
private inputSystem;
|
|
467
|
+
private rapierModule;
|
|
468
|
+
private rapierModulePromise;
|
|
469
|
+
private physicsWorld;
|
|
470
|
+
private isEditor;
|
|
471
|
+
private paused;
|
|
472
|
+
constructor(options: {
|
|
473
|
+
scene: THREE.Scene;
|
|
474
|
+
camera: THREE.PerspectiveCamera;
|
|
475
|
+
renderer: THREE.WebGLRenderer;
|
|
476
|
+
featureFlags?: WorldFeatureFlags;
|
|
477
|
+
});
|
|
478
|
+
createEntity(): EntityId;
|
|
479
|
+
destroyEntity(entityId: EntityId): void;
|
|
480
|
+
private getSelectionState;
|
|
481
|
+
hasEntity(entityId: EntityId): boolean;
|
|
482
|
+
getEntities(): EntityId[];
|
|
483
|
+
getEntityCount(): number;
|
|
484
|
+
addComponent<T extends Component>(entityId: EntityId, component: T): void;
|
|
485
|
+
addComponents<T extends Component>(entityId: EntityId, components: T[]): void;
|
|
486
|
+
removeComponent<T extends Component>(entityId: EntityId, componentType: ComponentClass<T>): void;
|
|
487
|
+
getComponent<T extends Component>(entityId: EntityId, componentType: ComponentClass<T>): T | undefined;
|
|
488
|
+
hasComponent<T extends Component>(entityId: EntityId, componentType: ComponentClass<T>): boolean;
|
|
489
|
+
query(...componentTypes: ComponentClass<AnyComponent>[]): EntityId[];
|
|
490
|
+
/**
|
|
491
|
+
* Returns `true` if the entity is currently visible (its `Object3DRef.visibility`
|
|
492
|
+
* is `true`), or if the entity has no `Object3DRef` component (entities without a
|
|
493
|
+
* scene object are always considered active). Systems use this to skip per-entity
|
|
494
|
+
* updates for hidden objects.
|
|
495
|
+
*/
|
|
496
|
+
isEntityVisible(entityId: EntityId): boolean;
|
|
497
|
+
getInputSystem(): EcsSystem | null;
|
|
498
|
+
getKeyDown(key: KeyboardKey): boolean;
|
|
499
|
+
getKeyUp(key: KeyboardKey): boolean;
|
|
500
|
+
getKey(key: KeyboardKey): boolean;
|
|
501
|
+
getMouse(button: MouseButton | number | string): boolean;
|
|
502
|
+
getMouseDown(button: MouseButton | number | string): boolean;
|
|
503
|
+
getMouseUp(button: MouseButton | number | string): boolean;
|
|
504
|
+
getScrollClick(): boolean;
|
|
505
|
+
getScrollClickDown(): boolean;
|
|
506
|
+
getScrollClickUp(): boolean;
|
|
507
|
+
getScrollDelta(): {
|
|
508
|
+
x: number;
|
|
509
|
+
y: number;
|
|
510
|
+
};
|
|
511
|
+
consumeScrollDelta(): {
|
|
512
|
+
x: number;
|
|
513
|
+
y: number;
|
|
514
|
+
};
|
|
515
|
+
getMousePosition(): {
|
|
516
|
+
x: number;
|
|
517
|
+
y: number;
|
|
518
|
+
};
|
|
519
|
+
getMouseDelta(): {
|
|
520
|
+
x: number;
|
|
521
|
+
y: number;
|
|
522
|
+
};
|
|
523
|
+
consumeMouseDelta(): {
|
|
524
|
+
x: number;
|
|
525
|
+
y: number;
|
|
526
|
+
};
|
|
527
|
+
getRapierModule(): Promise<typeof RAPIER>;
|
|
528
|
+
getPhysicsWorld(): RAPIER.World | null;
|
|
529
|
+
setPhysicsWorld(physicsWorld: RAPIER.World | null): void;
|
|
530
|
+
createPhysicsWorld(options?: {
|
|
531
|
+
gravity?: {
|
|
532
|
+
x?: number;
|
|
533
|
+
y?: number;
|
|
534
|
+
z?: number;
|
|
535
|
+
};
|
|
536
|
+
}): Promise<RAPIER.World | null>;
|
|
537
|
+
lockMousePointer(): boolean;
|
|
538
|
+
unlockMousePointer(): boolean;
|
|
539
|
+
isMousePointerLocked(): boolean;
|
|
540
|
+
getSystem<T extends EcsSystem>(system: T): T;
|
|
541
|
+
hasSystem<T extends EcsSystem>(system: T): boolean;
|
|
542
|
+
addSystem(system: EcsSystem): void;
|
|
543
|
+
addSystems(systems: EcsSystem[]): void;
|
|
544
|
+
setup({ systems, isEditor }: {
|
|
545
|
+
systems: EcsSystem[];
|
|
546
|
+
isEditor?: boolean;
|
|
547
|
+
}): {
|
|
548
|
+
objectManagementSystem: ObjectManagementSystem;
|
|
549
|
+
transformSyncSystem: TransformSyncSystem;
|
|
550
|
+
renderSystem: RenderSystem;
|
|
551
|
+
};
|
|
552
|
+
isEditorMode(): boolean;
|
|
553
|
+
/**
|
|
554
|
+
* Pauses world simulation. While paused, `update()` skips all system ticks so
|
|
555
|
+
* physics, animation, scripts, and rendering stop advancing. The last rendered
|
|
556
|
+
* frame remains frozen on-screen.
|
|
557
|
+
*
|
|
558
|
+
* Call {@link resume} to continue.
|
|
559
|
+
*/
|
|
560
|
+
pause(): void;
|
|
561
|
+
/**
|
|
562
|
+
* Resumes world simulation after a previous {@link pause} call.
|
|
563
|
+
* Has no effect if the world is not paused.
|
|
564
|
+
*/
|
|
565
|
+
resume(): void;
|
|
566
|
+
/**
|
|
567
|
+
* Returns `true` if the world is currently paused.
|
|
568
|
+
*
|
|
569
|
+
* @example
|
|
570
|
+
* ```ts
|
|
571
|
+
* if (this.world.isPaused()) {
|
|
572
|
+
* this.world.resume();
|
|
573
|
+
* }
|
|
574
|
+
* ```
|
|
575
|
+
*/
|
|
576
|
+
isPaused(): boolean;
|
|
577
|
+
getScene(): THREE.Scene;
|
|
578
|
+
getCamera(): THREE.PerspectiveCamera;
|
|
579
|
+
getRenderer(): THREE.WebGLRenderer;
|
|
580
|
+
update(deltaTime: number): void;
|
|
581
|
+
dispose(): void;
|
|
582
|
+
setSelectedEntity(entityId: EntityId | null): void;
|
|
583
|
+
getSelectedEntity(): EntityId | null;
|
|
584
|
+
private getEntityComponents;
|
|
585
|
+
private getEntityName;
|
|
586
|
+
private getEntityType;
|
|
587
|
+
private getObject3d;
|
|
588
|
+
private toEntityView;
|
|
589
|
+
getEntitiesByComponent(component: Component): WorldEntityView[];
|
|
590
|
+
getEntitiesByName(name: string): WorldEntityView[];
|
|
591
|
+
getEntityByName(name: string): WorldEntityView | null;
|
|
592
|
+
getEntityById(entityId: number): WorldEntityView | null;
|
|
593
|
+
/**
|
|
594
|
+
* Cast a ray from `origin` along `direction` and return every intersected
|
|
595
|
+
* entity-bound mesh, sorted by distance. Each result is a standard
|
|
596
|
+
* `THREE.Intersection` augmented with the owning `entityId` (or `null` if
|
|
597
|
+
* the hit object is not part of any tracked entity).
|
|
598
|
+
*
|
|
599
|
+
* @param origin - World-space origin of the ray (`THREE.Vector3` or
|
|
600
|
+
* `{ x, y, z }`).
|
|
601
|
+
* @param direction - World-space direction of the ray. Will be normalized
|
|
602
|
+
* internally; magnitude is ignored.
|
|
603
|
+
* @param near - Minimum hit distance from the origin. Defaults to `0`.
|
|
604
|
+
* @param far - Maximum hit distance from the origin. Defaults to `Infinity`.
|
|
605
|
+
*
|
|
606
|
+
* @example
|
|
607
|
+
* ```ts
|
|
608
|
+
* const hits = world.raycast(
|
|
609
|
+
* { x: 0, y: 1, z: 0 },
|
|
610
|
+
* { x: 0, y: 0, z: -1 },
|
|
611
|
+
* );
|
|
612
|
+
* if (hits[0]?.entityId !== null) {
|
|
613
|
+
* console.log("hit entity", hits[0].entityId, "at", hits[0].point);
|
|
614
|
+
* }
|
|
615
|
+
* ```
|
|
616
|
+
*/
|
|
617
|
+
raycast(origin: Vec3, direction: Vec3, near?: number, far?: number): IntersectionResult[];
|
|
618
|
+
/**
|
|
619
|
+
* Cast a ray from an entity's world-space position along its forward
|
|
620
|
+
* direction (the +Z axis of its world matrix). Returns intersected
|
|
621
|
+
* entity-bound meshes sorted by distance, with the source entity itself
|
|
622
|
+
* filtered out so the ray does not hit the caster.
|
|
623
|
+
*
|
|
624
|
+
* @param entityId - Entity to cast the ray from. Must have an `Object3DRef`.
|
|
625
|
+
* @param near - Minimum hit distance from the origin. Defaults to `0`.
|
|
626
|
+
* @param far - Maximum hit distance from the origin. Defaults to `Infinity`.
|
|
627
|
+
*
|
|
628
|
+
* @example
|
|
629
|
+
* ```ts
|
|
630
|
+
* const hits = world.raycastFrom(this.entityId, 0, 50);
|
|
631
|
+
* const closest = hits[0];
|
|
632
|
+
* if (closest && closest.entityId !== null) {
|
|
633
|
+
* console.log("looking at", closest.entityId);
|
|
634
|
+
* }
|
|
635
|
+
* ```
|
|
636
|
+
*/
|
|
637
|
+
raycastFrom(entityId: EntityId, near?: number, far?: number): IntersectionResult[];
|
|
638
|
+
private buildObjectToEntityMap;
|
|
639
|
+
private resolveEntityForObject;
|
|
640
|
+
private toIntersectionResult;
|
|
641
|
+
getEntityScript<T = unknown>(entityId: number): T | null;
|
|
642
|
+
getScripts<T = unknown>(className: string): T[];
|
|
643
|
+
getScript<T = unknown>(className: string): T | null;
|
|
644
|
+
getAllEntities(): WorldEntityView[];
|
|
645
|
+
onSelectionChanged(listener: SelectionListener): () => void;
|
|
646
|
+
subscribe(listener: StoreListener): () => void;
|
|
647
|
+
getDebugSnapshot(maxDepth?: number): unknown;
|
|
648
|
+
getDebugSignature(maxDepth?: number): string;
|
|
649
|
+
createHistorySnapshot(): WorldHistorySnapshot;
|
|
650
|
+
applyHistorySnapshot(snapshot: WorldHistorySnapshot): void;
|
|
651
|
+
private emitStoreChanged;
|
|
652
|
+
}
|
|
653
|
+
|
|
654
|
+
interface EcsSystem {
|
|
655
|
+
update(world: World, deltaTime: number): void;
|
|
656
|
+
dispose?(world: World): void;
|
|
657
|
+
}
|
|
658
|
+
|
|
659
|
+
export { type AssetInput as A, type WorldHistorySnapshot as B, Component as C, type DropdownInput as D, type EcsSystem as E, type FloatInput as F, cloneHistoryValue as G, normalizeDebugValue as H, InputSystem as I, type KeyboardKey as K, type MouseButton as M, ObjectManagementSystem as O, ParentId as P, RenderSystem as R, type SelectionListener as S, TransformComponent as T, type Vec3$1 as V, type WorldEntityView$1 as W, type TransformData as a, World as b, type ComponentClass as c, type ParentLookup as d, type EcsEntityKind as e, type CheckboxInput as f, type ColorInput as g, type ComponentFactory as h, type ComponentInput as i, type ComponentKind as j, type DropdownOption as k, type EcsComponentFactoryKind as l, type EcsEntityEditorKind as m, type EntityId as n, type EntityInput as o, type IntersectionResult as p, KeyboardKeys as q, type SliderInput as r, type TextInput as s, type ToggleInput as t, TransformSyncSystem as u, type Vec3 as v, type Vector2Input as w, type Vector3Input as x, type AnyComponent as y, DEBUG_CHANGE_IGNORED_SYSTEMS as z };
|