@relu-interactives/spatial-ecs 0.2.12 → 0.2.14
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/dist/{System-CHCucemW.d.cts → System-BeuJ1xt5.d.cts} +291 -2
- package/dist/{System-CHCucemW.d.ts → System-BeuJ1xt5.d.ts} +291 -2
- package/dist/{Video-B9ZKmBIT.d.ts → Video-Cym2C52L.d.ts} +2 -241
- package/dist/{Video-ACTSfWjH.d.cts → Video-D4B-z74P.d.cts} +2 -241
- package/dist/{chunk-PH43YHUT.js → chunk-27RBPOVO.js} +3 -3
- package/dist/{chunk-PH43YHUT.js.map → chunk-27RBPOVO.js.map} +1 -1
- package/dist/{chunk-ZCEMOTH4.js → chunk-7QBONTBW.js} +4 -4
- package/dist/{chunk-ZCEMOTH4.js.map → chunk-7QBONTBW.js.map} +1 -1
- package/dist/{chunk-XPCVEXMY.js → chunk-FTIQQK62.js} +2 -2
- package/dist/chunk-FTIQQK62.js.map +1 -0
- package/dist/{chunk-ON4E5E5O.js → chunk-KDZ6VBRO.js} +4 -4
- package/dist/{chunk-ON4E5E5O.js.map → chunk-KDZ6VBRO.js.map} +1 -1
- package/dist/components/index.cjs.map +1 -1
- package/dist/components/index.d.cts +2 -2
- package/dist/components/index.d.ts +2 -2
- package/dist/components/index.js +1 -1
- package/dist/docs/api/Behaviour/classes/Behaviour.md +29 -29
- package/dist/docs/api/Component/classes/Component.md +1 -1
- package/dist/docs/api/components/classes/AnimationComponent.md +26 -26
- package/dist/docs/api/components/classes/AudioComponent.md +19 -19
- package/dist/docs/api/components/classes/CameraComponent.md +14 -14
- package/dist/docs/api/components/classes/EntityType.md +3 -3
- package/dist/docs/api/components/classes/Environment.md +7 -3
- package/dist/docs/api/components/classes/ImageComponent.md +7 -7
- package/dist/docs/api/components/classes/ImageTarget.md +7 -7
- package/dist/docs/api/components/classes/ImageTargetAnchor.md +4 -4
- package/dist/docs/api/components/classes/InstanceSlotComponent.md +4 -4
- package/dist/docs/api/components/classes/InstancedMeshComponent.md +10 -10
- package/dist/docs/api/components/classes/LightComponent.md +6 -6
- package/dist/docs/api/components/classes/MaterialComponent.md +11 -11
- package/dist/docs/api/components/classes/MeshComponent.md +3 -3
- package/dist/docs/api/components/classes/MeshGeometryComponent.md +9 -9
- package/dist/docs/api/components/classes/ModelComponent.md +4 -4
- package/dist/docs/api/components/classes/Name.md +3 -3
- package/dist/docs/api/components/classes/Object3DRef.md +4 -4
- package/dist/docs/api/components/classes/ParentId.md +3 -3
- package/dist/docs/api/components/classes/PhysicsComponent.md +6 -6
- package/dist/docs/api/components/classes/Postprocessing.md +7 -3
- package/dist/docs/api/components/classes/ScriptComponent.md +5 -5
- package/dist/docs/api/components/classes/Selectable.md +3 -3
- package/dist/docs/api/components/classes/SelectionTransformState.md +5 -5
- package/dist/docs/api/components/classes/SpriteComponent.md +7 -7
- package/dist/docs/api/components/classes/TransformComponent.md +12 -12
- package/dist/docs/api/components/classes/VideoComponent.md +28 -28
- package/dist/docs/api/components/functions/normalizePhysicsState.md +1 -1
- package/dist/docs/api/components/index.md +1 -1
- package/dist/docs/api/components/type-aliases/AnimationComponentOptions.md +9 -9
- package/dist/docs/api/components/type-aliases/CameraComponentOptions.md +13 -13
- package/dist/docs/api/components/type-aliases/CameraProjection.md +1 -1
- package/dist/docs/api/components/type-aliases/CameraRuntimeType.md +1 -1
- package/dist/docs/api/components/type-aliases/ColliderShape.md +1 -1
- package/dist/docs/api/components/type-aliases/ColliderState.md +20 -20
- package/dist/docs/api/components/type-aliases/CubeMeshParameters.md +4 -4
- package/dist/docs/api/components/type-aliases/EditableMeshObjectKind.md +1 -1
- package/dist/docs/api/components/type-aliases/EnvironmentFogState.md +8 -8
- package/dist/docs/api/components/type-aliases/EnvironmentFogType.md +1 -1
- package/dist/docs/api/components/type-aliases/EnvironmentGradientEffect.md +1 -1
- package/dist/docs/api/components/type-aliases/EnvironmentSkyboxState.md +7 -7
- package/dist/docs/api/components/type-aliases/EnvironmentSkyboxType.md +1 -1
- package/dist/docs/api/components/type-aliases/EnvironmentState.md +5 -5
- package/dist/docs/api/components/type-aliases/ImageTargetAnchorOptions.md +3 -3
- package/dist/docs/api/components/type-aliases/ImageTargetReference.md +7 -7
- package/dist/docs/api/components/type-aliases/InstanceTransform.md +13 -13
- package/dist/docs/api/components/type-aliases/InstancedMeshKind.md +1 -1
- package/dist/docs/api/components/type-aliases/LightValueState.md +11 -11
- package/dist/docs/api/components/type-aliases/MaterialTypeValue.md +1 -1
- package/dist/docs/api/components/type-aliases/MaterialValueState.md +28 -28
- package/dist/docs/api/components/type-aliases/MeshGeometryParameters.md +1 -1
- package/dist/docs/api/components/type-aliases/MeshGeometryParametersByKind.md +7 -7
- package/dist/docs/api/components/type-aliases/PhysicsState.md +3 -3
- package/dist/docs/api/components/type-aliases/PlaneMeshParameters.md +3 -3
- package/dist/docs/api/components/type-aliases/PostprocessingState.md +62 -62
- package/dist/docs/api/components/type-aliases/RadiusHeightMeshParameters.md +3 -3
- package/dist/docs/api/components/type-aliases/RadiusMeshParameters.md +2 -2
- package/dist/docs/api/components/type-aliases/RigidbodyState.md +17 -17
- package/dist/docs/api/components/type-aliases/RigidbodyType.md +1 -1
- package/dist/docs/api/components/type-aliases/ScriptEntry.md +9 -9
- package/dist/docs/api/components/type-aliases/TextureFilteringValue.md +1 -1
- package/dist/docs/api/components/type-aliases/TransformData.md +4 -4
- package/dist/docs/api/components/type-aliases/TransformModeValue.md +1 -1
- package/dist/docs/api/components/type-aliases/TransformSpaceValue.md +1 -1
- package/dist/docs/api/components/type-aliases/Vec3.md +4 -4
- package/dist/docs/api/components/variables/DEFAULT_COLLIDER_STATE.md +1 -1
- package/dist/docs/api/components/variables/DEFAULT_ENVIRONMENT_STATE.md +1 -1
- package/dist/docs/api/components/variables/DEFAULT_INSTANCED_MESH_PARAMETERS.md +1 -1
- package/dist/docs/api/components/variables/DEFAULT_INSTANCE_TRANSFORM.md +1 -1
- package/dist/docs/api/components/variables/DEFAULT_MESH_GEOMETRY_PARAMETERS.md +1 -1
- package/dist/docs/api/components/variables/DEFAULT_PHYSICS_STATE.md +1 -1
- package/dist/docs/api/components/variables/DEFAULT_POSTPROCESSING_STATE.md +1 -1
- package/dist/docs/api/components/variables/DEFAULT_RIGIDBODY_STATE.md +1 -1
- package/dist/docs/api/index/classes/AnimationStateMachine.md +16 -16
- package/dist/docs/api/index/classes/AnimationStateManager.md +13 -13
- package/dist/docs/api/index/classes/AnimationSystem.md +3 -3
- package/dist/docs/api/index/classes/AudioSystem.md +4 -4
- package/dist/docs/api/index/classes/CameraSyncSystem.md +2 -2
- package/dist/docs/api/index/classes/EnvironmentSyncSystem.md +4 -4
- package/dist/docs/api/index/classes/InputSystem.md +33 -33
- package/dist/docs/api/index/classes/InstancedMeshSystem.md +2 -2
- package/dist/docs/api/index/classes/LightSyncSystem.md +2 -2
- package/dist/docs/api/index/classes/MaterialSyncSystem.md +3 -3
- package/dist/docs/api/index/classes/MeshGeometrySystem.md +2 -2
- package/dist/docs/api/index/classes/ObjectManagementSystem.md +14 -14
- package/dist/docs/api/index/classes/ObjectVisibilitySystem.md +2 -2
- package/dist/docs/api/index/classes/PhysicsSyncSystem.md +4 -4
- package/dist/docs/api/index/classes/PostprocessingSyncSystem.md +4 -4
- package/dist/docs/api/index/classes/RenderSystem.md +3 -3
- package/dist/docs/api/index/classes/ScriptBehaviourSystem.md +4 -4
- package/dist/docs/api/index/classes/TransformSyncSystem.md +2 -2
- package/dist/docs/api/index/classes/VideoSystem.md +4 -4
- package/dist/docs/api/index/classes/World.md +186 -82
- package/dist/docs/api/index/functions/createAnimationComponent.md +1 -1
- package/dist/docs/api/index/functions/createAudioComponent.md +1 -1
- package/dist/docs/api/index/functions/createCameraComponent.md +1 -1
- package/dist/docs/api/index/functions/createEntityTypeComponent.md +1 -1
- package/dist/docs/api/index/functions/createEnvironmentComponent.md +1 -1
- package/dist/docs/api/index/functions/createImageComponent.md +1 -1
- package/dist/docs/api/index/functions/createImageTargetAnchorComponent.md +1 -1
- package/dist/docs/api/index/functions/createImageTargetComponent.md +1 -1
- package/dist/docs/api/index/functions/createInstanceSlotComponent.md +1 -1
- package/dist/docs/api/index/functions/createInstancedMeshComponent.md +1 -1
- package/dist/docs/api/index/functions/createLightComponent.md +1 -1
- package/dist/docs/api/index/functions/createMaterialComponent.md +1 -1
- package/dist/docs/api/index/functions/createMeshComponent.md +1 -1
- package/dist/docs/api/index/functions/createMeshGeometryComponent.md +1 -1
- package/dist/docs/api/index/functions/createModelComponent.md +1 -1
- package/dist/docs/api/index/functions/createNameComponent.md +1 -1
- package/dist/docs/api/index/functions/createObject3DRefComponent.md +1 -1
- package/dist/docs/api/index/functions/createParentIdComponent.md +1 -1
- package/dist/docs/api/index/functions/createPhysicsComponent.md +1 -1
- package/dist/docs/api/index/functions/createPostprocessingComponent.md +1 -1
- package/dist/docs/api/index/functions/createScriptComponent.md +1 -1
- package/dist/docs/api/index/functions/createSelectableComponent.md +1 -1
- package/dist/docs/api/index/functions/createSelectionTransformStateComponent.md +1 -1
- package/dist/docs/api/index/functions/createSpriteComponent.md +1 -1
- package/dist/docs/api/index/functions/createTransformComponent.md +1 -1
- package/dist/docs/api/index/functions/createVideoComponent.md +1 -1
- package/dist/docs/api/index/functions/hydrateWorldFromSnapshot.md +1 -1
- package/dist/docs/api/index/functions/hydrateWorldFromSnapshotDetailed.md +1 -1
- package/dist/docs/api/index/functions/registerDefaultComponentFactories.md +1 -1
- package/dist/docs/api/index/functions/registerDefaultFactories.md +1 -1
- package/dist/docs/api/index/interfaces/EcsSystem.md +3 -3
- package/dist/docs/api/index/interfaces/StateMachine.md +13 -13
- package/dist/docs/api/index/type-aliases/AnimationStateCallbacks.md +4 -4
- package/dist/docs/api/index/type-aliases/ComponentFactory.md +1 -1
- package/dist/docs/api/index/type-aliases/EcsComponentFactoryKind.md +1 -1
- package/dist/docs/api/index/type-aliases/EcsWorldComponentSnapshot.md +3 -3
- package/dist/docs/api/index/type-aliases/EcsWorldStateSnapshotLike.md +4 -4
- package/dist/docs/api/index/type-aliases/HydrateWorldFromSnapshotResult.md +3 -3
- package/dist/docs/api/index/type-aliases/KeyboardKey.md +1 -1
- package/dist/docs/api/index/type-aliases/MouseButton.md +1 -1
- package/dist/docs/api/index/type-aliases/SelectionContext.md +4 -4
- package/dist/docs/api/index/variables/HYDRATABLE_ENTITY_KINDS.md +1 -1
- package/dist/docs/api/index/variables/KeyboardKeys.md +89 -89
- package/dist/docs/api/types/type-aliases/AssetInput.md +3 -3
- package/dist/docs/api/types/type-aliases/CheckboxInput.md +12 -2
- package/dist/docs/api/types/type-aliases/ColorInput.md +1 -1
- package/dist/docs/api/types/type-aliases/ComponentInput.md +4 -4
- package/dist/docs/api/types/type-aliases/ComponentKind.md +1 -1
- package/dist/docs/api/types/type-aliases/DropdownInput.md +3 -3
- package/dist/docs/api/types/type-aliases/DropdownOption.md +3 -3
- package/dist/docs/api/types/type-aliases/EcsEntityEditorKind.md +1 -1
- package/dist/docs/api/types/type-aliases/EcsEntityKind.md +1 -1
- package/dist/docs/api/types/type-aliases/EntityId.md +1 -1
- package/dist/docs/api/types/type-aliases/EntityInput.md +3 -3
- package/dist/docs/api/types/type-aliases/FloatInput.md +1 -1
- package/dist/docs/api/types/type-aliases/IntersectionResult.md +3 -3
- package/dist/docs/api/types/type-aliases/ParentLookup.md +3 -3
- package/dist/docs/api/types/type-aliases/SelectionListener.md +1 -1
- package/dist/docs/api/types/type-aliases/SliderInput.md +5 -5
- package/dist/docs/api/types/type-aliases/TextInput.md +1 -1
- package/dist/docs/api/types/type-aliases/ToggleInput.md +1 -1
- package/dist/docs/api/types/type-aliases/Vec3.md +1 -1
- package/dist/docs/api/types/type-aliases/Vector2Input.md +3 -3
- package/dist/docs/api/types/type-aliases/Vector3Input.md +4 -4
- package/dist/docs/api/types/type-aliases/WorldEntityView.md +1 -1
- package/dist/docs/guide/accessing-components.md +135 -1
- package/dist/docs/guide/authoring-a-behaviour.md +1 -1
- package/dist/docs/guide/behaviour-data-binding/asset-input.md +54 -0
- package/dist/docs/guide/behaviour-data-binding/checkbox-input.md +38 -0
- package/dist/docs/guide/behaviour-data-binding/color-input.md +38 -0
- package/dist/docs/guide/behaviour-data-binding/component-input.md +79 -0
- package/dist/docs/guide/behaviour-data-binding/dropdown-input.md +53 -0
- package/dist/docs/guide/behaviour-data-binding/entity-input.md +100 -0
- package/dist/docs/guide/behaviour-data-binding/float-input.md +35 -0
- package/dist/docs/guide/behaviour-data-binding/index.md +158 -0
- package/dist/docs/guide/behaviour-data-binding/slider-input.md +37 -0
- package/dist/docs/guide/behaviour-data-binding/text-input.md +35 -0
- package/dist/docs/guide/behaviour-data-binding/toggle-input.md +36 -0
- package/dist/docs/guide/behaviour-data-binding/vector2-input.md +36 -0
- package/dist/docs/guide/behaviour-data-binding/vector3-input.md +41 -0
- package/dist/docs/guide/components/parent-id.md +25 -0
- package/dist/docs/guide/runtime-entity-management.md +302 -0
- package/dist/docs/guide/scene/environment.md +5 -6
- package/dist/docs/guide/scene/index.md +5 -10
- package/dist/docs/guide/scene/postprocessing.md +5 -6
- package/dist/docs/guide/systems/object-management-system.md +61 -0
- package/dist/docs/guide/world-api.md +37 -1
- package/dist/factories/index.cjs.map +1 -1
- package/dist/factories/index.d.cts +2 -2
- package/dist/factories/index.d.ts +2 -2
- package/dist/factories/index.js +3 -3
- package/dist/{index-B5JcGMJ5.d.ts → index-BfoOC2CG.d.cts} +2 -2
- package/dist/{index-kx5O2mVU.d.cts → index-BoJ3_6a3.d.ts} +2 -2
- package/dist/index.cjs +65 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5 -5
- package/dist/index.d.ts +5 -5
- package/dist/index.js +73 -8
- package/dist/index.js.map +1 -1
- package/dist/systems/index.cjs.map +1 -1
- package/dist/systems/index.d.cts +2 -2
- package/dist/systems/index.d.ts +2 -2
- package/dist/systems/index.js +3 -3
- package/dist/types.d.cts +1 -1
- package/dist/types.d.ts +1 -1
- package/dist/worldSnapshotUtils.d.cts +1 -1
- package/dist/worldSnapshotUtils.d.ts +1 -1
- package/package.json +1 -1
- package/dist/chunk-XPCVEXMY.js.map +0 -1
- package/dist/docs/guide/inspector-data-binding.md +0 -367
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as THREE from 'three';
|
|
2
|
-
import { C as Component,
|
|
2
|
+
import { C as Component, o as EcsEntityKind, x as EcsEntityEditorKind, y as EntityId } from './System-BeuJ1xt5.js';
|
|
3
3
|
import * as RAPIER from '@dimforge/rapier3d-compat';
|
|
4
4
|
|
|
5
5
|
interface StateMachine {
|
|
@@ -313,245 +313,6 @@ declare class AudioComponent extends Component {
|
|
|
313
313
|
stop(): void;
|
|
314
314
|
}
|
|
315
315
|
|
|
316
|
-
/** Skybox rendering modes. `none` disables skybox rendering entirely. */
|
|
317
|
-
type EnvironmentSkyboxType = "gradient" | "color" | "image" | "none";
|
|
318
|
-
/** Gradient distribution applied when {@link EnvironmentSkyboxState.type} is `"gradient"`. */
|
|
319
|
-
type EnvironmentGradientEffect = "radial" | "linear" | "angular";
|
|
320
|
-
/** Fog distance models. `none` disables fog. */
|
|
321
|
-
type EnvironmentFogType = "linear" | "exponential" | "none";
|
|
322
|
-
/** Skybox configuration. Only the fields relevant to {@link type} are read at render time. */
|
|
323
|
-
type EnvironmentSkyboxState = {
|
|
324
|
-
/** Active skybox mode. */
|
|
325
|
-
type: EnvironmentSkyboxType;
|
|
326
|
-
/** Solid color used when {@link type} is `"color"`. `#rrggbb`. */
|
|
327
|
-
color: string;
|
|
328
|
-
/** URL or `localasset://` path of the equirectangular image used when {@link type} is `"image"`. */
|
|
329
|
-
imageUrl?: string;
|
|
330
|
-
/** Gradient parameters used when {@link type} is `"gradient"`. */
|
|
331
|
-
gradient: {
|
|
332
|
-
/** Ordered list of color stops as `#rrggbb` strings. */
|
|
333
|
-
colors: string[];
|
|
334
|
-
/** Gradient distribution. */
|
|
335
|
-
effect: EnvironmentGradientEffect;
|
|
336
|
-
};
|
|
337
|
-
};
|
|
338
|
-
/** Fog configuration. Mirrors three.js `Fog` / `FogExp2`. */
|
|
339
|
-
type EnvironmentFogState = {
|
|
340
|
-
/** Active fog model. */
|
|
341
|
-
type: EnvironmentFogType;
|
|
342
|
-
/** Fog color as `#rrggbb`. */
|
|
343
|
-
color: string;
|
|
344
|
-
/** Linear-fog parameters used when {@link type} is `"linear"`. */
|
|
345
|
-
linear: {
|
|
346
|
-
/** Distance at which fog begins to take effect. */
|
|
347
|
-
near: number;
|
|
348
|
-
/** Distance at which fog reaches full opacity. */
|
|
349
|
-
far: number;
|
|
350
|
-
};
|
|
351
|
-
/** Exponential-fog parameters used when {@link type} is `"exponential"`. */
|
|
352
|
-
exponential: {
|
|
353
|
-
/** Density coefficient. Higher values produce thicker fog. */
|
|
354
|
-
density: number;
|
|
355
|
-
};
|
|
356
|
-
};
|
|
357
|
-
/** World gravity vector applied by the physics system, in world units per second squared. */
|
|
358
|
-
type EnvironmentGravityState = {
|
|
359
|
-
/** Gravity along world X. */
|
|
360
|
-
x: number;
|
|
361
|
-
/** Gravity along world Y (negative pulls objects down). */
|
|
362
|
-
y: number;
|
|
363
|
-
/** Gravity along world Z. */
|
|
364
|
-
z: number;
|
|
365
|
-
};
|
|
366
|
-
/** Aggregated authoring state owned by {@link Environment}. */
|
|
367
|
-
type EnvironmentState = {
|
|
368
|
-
/** Skybox configuration. */
|
|
369
|
-
skybox: EnvironmentSkyboxState;
|
|
370
|
-
/** Fog configuration. */
|
|
371
|
-
fog: EnvironmentFogState;
|
|
372
|
-
/** World gravity. */
|
|
373
|
-
gravity: EnvironmentGravityState;
|
|
374
|
-
/**
|
|
375
|
-
* Fixed timestep (seconds) used by the physics accumulator loop.
|
|
376
|
-
* Physics is stepped in fixed increments of this size each frame.
|
|
377
|
-
* Default is `0.02` (50 Hz).
|
|
378
|
-
*/
|
|
379
|
-
fixedTimeStep: number;
|
|
380
|
-
};
|
|
381
|
-
declare const DEFAULT_ENVIRONMENT_STATE: EnvironmentState;
|
|
382
|
-
/**
|
|
383
|
-
* Scene environment settings: skybox (gradient/color/image), fog
|
|
384
|
-
* (linear/exponential), and gravity vector for the physics world.
|
|
385
|
-
* Singleton-style — attached to one environment entity per scene.
|
|
386
|
-
*
|
|
387
|
-
* @category Components
|
|
388
|
-
*/
|
|
389
|
-
declare class Environment extends Component {
|
|
390
|
-
/** Aggregated environment authoring state (skybox, fog, gravity). Saved with the project. */
|
|
391
|
-
values: EnvironmentState;
|
|
392
|
-
constructor(values?: Partial<EnvironmentState>);
|
|
393
|
-
}
|
|
394
|
-
|
|
395
|
-
/** Aggregated post-processing effect chain authored on the scene environment. Each sub-effect has its own `enabled` flag plus per-effect parameters. */
|
|
396
|
-
type PostprocessingState = {
|
|
397
|
-
/** Master toggle. When `false` no post-processing is applied even if individual effects are enabled. */
|
|
398
|
-
postEnabled: boolean;
|
|
399
|
-
/** Depth-of-field (bokeh) effect. */
|
|
400
|
-
dof: {
|
|
401
|
-
/** Enable the effect. */
|
|
402
|
-
enabled: boolean;
|
|
403
|
-
/** Distance to the focal plane in world units. */
|
|
404
|
-
focusDistance: number;
|
|
405
|
-
/** Lens focal length controlling depth-of-field strength. */
|
|
406
|
-
focalLength: number;
|
|
407
|
-
/** Bokeh blur kernel scale. */
|
|
408
|
-
bokehScale: number;
|
|
409
|
-
};
|
|
410
|
-
/** Bloom (HDR glow) effect. */
|
|
411
|
-
bloom: {
|
|
412
|
-
/** Enable the effect. */
|
|
413
|
-
enabled: boolean;
|
|
414
|
-
/** Strength of the bloom contribution. */
|
|
415
|
-
intensity: number;
|
|
416
|
-
/** Luminance threshold above which pixels bloom. */
|
|
417
|
-
threshold: number;
|
|
418
|
-
/** Blur radius applied to the bloom buffer. */
|
|
419
|
-
radius: number;
|
|
420
|
-
};
|
|
421
|
-
/** Vignette (corner darkening) effect. */
|
|
422
|
-
vignette: {
|
|
423
|
-
/** Enable the effect. */
|
|
424
|
-
enabled: boolean;
|
|
425
|
-
/** Distance from screen center where the vignette begins. */
|
|
426
|
-
offset: number;
|
|
427
|
-
/** Maximum darkness applied at screen edges. */
|
|
428
|
-
darkness: number;
|
|
429
|
-
};
|
|
430
|
-
/** Chromatic aberration (RGB channel offset) effect. */
|
|
431
|
-
chromAberration: {
|
|
432
|
-
/** Enable the effect. */
|
|
433
|
-
enabled: boolean;
|
|
434
|
-
/** Horizontal channel offset. */
|
|
435
|
-
offsetX: number;
|
|
436
|
-
/** Vertical channel offset. */
|
|
437
|
-
offsetY: number;
|
|
438
|
-
};
|
|
439
|
-
/** Film-noise overlay. */
|
|
440
|
-
noise: {
|
|
441
|
-
/** Enable the effect. */
|
|
442
|
-
enabled: boolean;
|
|
443
|
-
/** Opacity of the noise layer in `[0, 1]`. */
|
|
444
|
-
opacity: number;
|
|
445
|
-
};
|
|
446
|
-
/** Pixelation (mosaic) effect. */
|
|
447
|
-
pixelation: {
|
|
448
|
-
/** Enable the effect. */
|
|
449
|
-
enabled: boolean;
|
|
450
|
-
/** Pixel block size in screen pixels. */
|
|
451
|
-
granularity: number;
|
|
452
|
-
};
|
|
453
|
-
/** Tone-mapping exposure control. */
|
|
454
|
-
toneMapping: {
|
|
455
|
-
/** Enable the effect. */
|
|
456
|
-
enabled: boolean;
|
|
457
|
-
/** Exposure multiplier applied before tone-mapping. */
|
|
458
|
-
exposure: number;
|
|
459
|
-
};
|
|
460
|
-
/** Hue/saturation color grading. */
|
|
461
|
-
hueSaturation: {
|
|
462
|
-
/** Enable the effect. */
|
|
463
|
-
enabled: boolean;
|
|
464
|
-
/** Hue rotation in radians. */
|
|
465
|
-
hue: number;
|
|
466
|
-
/** Saturation offset (`0` = unchanged, `>0` = more saturated). */
|
|
467
|
-
saturation: number;
|
|
468
|
-
};
|
|
469
|
-
/** Sepia color grade. */
|
|
470
|
-
sepia: {
|
|
471
|
-
/** Enable the effect. */
|
|
472
|
-
enabled: boolean;
|
|
473
|
-
/** Blend strength between original and sepia in `[0, 1]`. */
|
|
474
|
-
intensity: number;
|
|
475
|
-
};
|
|
476
|
-
/** SMAA antialiasing pass. */
|
|
477
|
-
smaa: {
|
|
478
|
-
/** Enable the effect. */
|
|
479
|
-
enabled: boolean;
|
|
480
|
-
};
|
|
481
|
-
/** Screen-space ambient occlusion. */
|
|
482
|
-
ssao: {
|
|
483
|
-
/** Enable the effect. */
|
|
484
|
-
enabled: boolean;
|
|
485
|
-
/** Strength of the AO contribution. */
|
|
486
|
-
intensity: number;
|
|
487
|
-
/** Sampling radius in world units. */
|
|
488
|
-
radius: number;
|
|
489
|
-
};
|
|
490
|
-
/** Dot-screen (halftone) effect. */
|
|
491
|
-
dotScreen: {
|
|
492
|
-
/** Enable the effect. */
|
|
493
|
-
enabled: boolean;
|
|
494
|
-
/** Pattern scale (legacy field; use {@link scale} where available). */
|
|
495
|
-
dotScreenScale: number;
|
|
496
|
-
/** Pattern rotation in radians (legacy field; use {@link angle} where available). */
|
|
497
|
-
dotScreenAngle: number;
|
|
498
|
-
/** Pattern rotation in radians. */
|
|
499
|
-
angle?: number;
|
|
500
|
-
/** Pattern scale. */
|
|
501
|
-
scale?: number;
|
|
502
|
-
/** Three.js blend function override. */
|
|
503
|
-
blendFunction?: number;
|
|
504
|
-
/** Effect opacity in `[0, 1]`. */
|
|
505
|
-
opacity?: number;
|
|
506
|
-
};
|
|
507
|
-
/** Glitch effect (digital corruption simulation). */
|
|
508
|
-
glitch: {
|
|
509
|
-
/** Enable the effect. */
|
|
510
|
-
enabled: boolean;
|
|
511
|
-
/** Three.js blend function override. */
|
|
512
|
-
blendFunction?: number;
|
|
513
|
-
/** RGB channel offset applied during a glitch burst. */
|
|
514
|
-
chromaticAberrationOffset?: {
|
|
515
|
-
x: number;
|
|
516
|
-
y: number;
|
|
517
|
-
} | [number, number];
|
|
518
|
-
/** `[min, max]` delay (seconds) between glitch bursts. */
|
|
519
|
-
delay?: [number, number];
|
|
520
|
-
/** `[min, max]` duration (seconds) of each glitch burst. */
|
|
521
|
-
duration?: [number, number];
|
|
522
|
-
/** Glitch displacement strength (scalar or per-axis). */
|
|
523
|
-
strength?: number | {
|
|
524
|
-
x: number;
|
|
525
|
-
y: number;
|
|
526
|
-
};
|
|
527
|
-
/** Size of the displacement texture sampled by the glitch shader. */
|
|
528
|
-
dtSize?: number;
|
|
529
|
-
/** Fraction of columns affected during a glitch burst. */
|
|
530
|
-
columns?: number;
|
|
531
|
-
/** Ratio between weak and strong glitch bursts. */
|
|
532
|
-
ratio?: number;
|
|
533
|
-
/** Glitch mode label (matches the postprocessing library's mode enum). */
|
|
534
|
-
mode?: string;
|
|
535
|
-
/** Force the glitch to remain active. */
|
|
536
|
-
active?: boolean;
|
|
537
|
-
};
|
|
538
|
-
};
|
|
539
|
-
declare const DEFAULT_POSTPROCESSING_STATE: PostprocessingState;
|
|
540
|
-
/**
|
|
541
|
-
* Postprocessing stack settings (depth-of-field, bloom, vignette, chromatic
|
|
542
|
-
* aberration, noise, pixelation, tone mapping, hue/saturation, sepia, SMAA,
|
|
543
|
-
* SSAO, dot-screen, glitch). The render system applies enabled effects in a
|
|
544
|
-
* `postprocessing`-library composer when `postEnabled` is `true`. Singleton-
|
|
545
|
-
* style — attached to one entity per scene.
|
|
546
|
-
*
|
|
547
|
-
* @category Components
|
|
548
|
-
*/
|
|
549
|
-
declare class Postprocessing extends Component {
|
|
550
|
-
/** Aggregated post-processing state. Saved with the project. */
|
|
551
|
-
values: PostprocessingState;
|
|
552
|
-
constructor(values?: Partial<PostprocessingState>);
|
|
553
|
-
}
|
|
554
|
-
|
|
555
316
|
/** Editable primitive kinds the mesh-geometry system can rebuild on the fly. `model` is a passthrough placeholder for entities that own a loaded GLTF/GLB instead. */
|
|
556
317
|
type EditableMeshObjectKind = "capsule" | "cube" | "cylinder" | "model" | "plane" | "sphere";
|
|
557
318
|
/** Box geometry parameters in world units. */
|
|
@@ -1352,4 +1113,4 @@ declare class VideoComponent extends Component {
|
|
|
1352
1113
|
stop(): void;
|
|
1353
1114
|
}
|
|
1354
1115
|
|
|
1355
|
-
export { type
|
|
1116
|
+
export { type TransformSpaceValue as $, AnimationComponent as A, MeshGeometryComponent as B, CameraComponent as C, DEFAULT_COLLIDER_STATE as D, type EditableMeshObjectKind as E, type MeshGeometryParameters as F, type MeshGeometryParametersByKind as G, ModelComponent as H, ImageComponent as I, type PhysicsState as J, type PlaneMeshParameters as K, LightComponent as L, MaterialComponent as M, Name as N, Object3DRef as O, PhysicsComponent as P, type RadiusMeshParameters as Q, type RadiusHeightMeshParameters as R, type RigidbodyState as S, type RigidbodyType as T, ScriptComponent as U, type ScriptEntry as V, Selectable as W, SelectionTransformState as X, SpriteComponent as Y, type TextureFilteringValue as Z, type TransformModeValue as _, type AnimationComponentOptions as a, VideoComponent as a0, normalizePhysicsState as a1, type AnimationStateCallbacks as a2, AnimationStateMachine as a3, AnimationStateManager as a4, type StateMachine as a5, AudioComponent as b, type CameraComponentOptions as c, type CameraProjection as d, type CameraRuntimeType as e, type ColliderShape as f, type ColliderState as g, type CubeMeshParameters as h, DEFAULT_INSTANCED_MESH_PARAMETERS as i, DEFAULT_INSTANCE_TRANSFORM as j, DEFAULT_MESH_GEOMETRY_PARAMETERS as k, DEFAULT_PHYSICS_STATE as l, DEFAULT_RIGIDBODY_STATE as m, EntityType as n, ImageTarget as o, ImageTargetAnchor as p, type ImageTargetAnchorOptions as q, type ImageTargetReference as r, InstanceSlotComponent as s, type InstanceTransform as t, InstancedMeshComponent as u, type InstancedMeshKind as v, type LightValueState as w, type MaterialTypeValue as x, type MaterialValueState as y, MeshComponent as z };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as THREE from 'three';
|
|
2
|
-
import { C as Component,
|
|
2
|
+
import { C as Component, o as EcsEntityKind, x as EcsEntityEditorKind, y as EntityId } from './System-BeuJ1xt5.cjs';
|
|
3
3
|
import * as RAPIER from '@dimforge/rapier3d-compat';
|
|
4
4
|
|
|
5
5
|
interface StateMachine {
|
|
@@ -313,245 +313,6 @@ declare class AudioComponent extends Component {
|
|
|
313
313
|
stop(): void;
|
|
314
314
|
}
|
|
315
315
|
|
|
316
|
-
/** Skybox rendering modes. `none` disables skybox rendering entirely. */
|
|
317
|
-
type EnvironmentSkyboxType = "gradient" | "color" | "image" | "none";
|
|
318
|
-
/** Gradient distribution applied when {@link EnvironmentSkyboxState.type} is `"gradient"`. */
|
|
319
|
-
type EnvironmentGradientEffect = "radial" | "linear" | "angular";
|
|
320
|
-
/** Fog distance models. `none` disables fog. */
|
|
321
|
-
type EnvironmentFogType = "linear" | "exponential" | "none";
|
|
322
|
-
/** Skybox configuration. Only the fields relevant to {@link type} are read at render time. */
|
|
323
|
-
type EnvironmentSkyboxState = {
|
|
324
|
-
/** Active skybox mode. */
|
|
325
|
-
type: EnvironmentSkyboxType;
|
|
326
|
-
/** Solid color used when {@link type} is `"color"`. `#rrggbb`. */
|
|
327
|
-
color: string;
|
|
328
|
-
/** URL or `localasset://` path of the equirectangular image used when {@link type} is `"image"`. */
|
|
329
|
-
imageUrl?: string;
|
|
330
|
-
/** Gradient parameters used when {@link type} is `"gradient"`. */
|
|
331
|
-
gradient: {
|
|
332
|
-
/** Ordered list of color stops as `#rrggbb` strings. */
|
|
333
|
-
colors: string[];
|
|
334
|
-
/** Gradient distribution. */
|
|
335
|
-
effect: EnvironmentGradientEffect;
|
|
336
|
-
};
|
|
337
|
-
};
|
|
338
|
-
/** Fog configuration. Mirrors three.js `Fog` / `FogExp2`. */
|
|
339
|
-
type EnvironmentFogState = {
|
|
340
|
-
/** Active fog model. */
|
|
341
|
-
type: EnvironmentFogType;
|
|
342
|
-
/** Fog color as `#rrggbb`. */
|
|
343
|
-
color: string;
|
|
344
|
-
/** Linear-fog parameters used when {@link type} is `"linear"`. */
|
|
345
|
-
linear: {
|
|
346
|
-
/** Distance at which fog begins to take effect. */
|
|
347
|
-
near: number;
|
|
348
|
-
/** Distance at which fog reaches full opacity. */
|
|
349
|
-
far: number;
|
|
350
|
-
};
|
|
351
|
-
/** Exponential-fog parameters used when {@link type} is `"exponential"`. */
|
|
352
|
-
exponential: {
|
|
353
|
-
/** Density coefficient. Higher values produce thicker fog. */
|
|
354
|
-
density: number;
|
|
355
|
-
};
|
|
356
|
-
};
|
|
357
|
-
/** World gravity vector applied by the physics system, in world units per second squared. */
|
|
358
|
-
type EnvironmentGravityState = {
|
|
359
|
-
/** Gravity along world X. */
|
|
360
|
-
x: number;
|
|
361
|
-
/** Gravity along world Y (negative pulls objects down). */
|
|
362
|
-
y: number;
|
|
363
|
-
/** Gravity along world Z. */
|
|
364
|
-
z: number;
|
|
365
|
-
};
|
|
366
|
-
/** Aggregated authoring state owned by {@link Environment}. */
|
|
367
|
-
type EnvironmentState = {
|
|
368
|
-
/** Skybox configuration. */
|
|
369
|
-
skybox: EnvironmentSkyboxState;
|
|
370
|
-
/** Fog configuration. */
|
|
371
|
-
fog: EnvironmentFogState;
|
|
372
|
-
/** World gravity. */
|
|
373
|
-
gravity: EnvironmentGravityState;
|
|
374
|
-
/**
|
|
375
|
-
* Fixed timestep (seconds) used by the physics accumulator loop.
|
|
376
|
-
* Physics is stepped in fixed increments of this size each frame.
|
|
377
|
-
* Default is `0.02` (50 Hz).
|
|
378
|
-
*/
|
|
379
|
-
fixedTimeStep: number;
|
|
380
|
-
};
|
|
381
|
-
declare const DEFAULT_ENVIRONMENT_STATE: EnvironmentState;
|
|
382
|
-
/**
|
|
383
|
-
* Scene environment settings: skybox (gradient/color/image), fog
|
|
384
|
-
* (linear/exponential), and gravity vector for the physics world.
|
|
385
|
-
* Singleton-style — attached to one environment entity per scene.
|
|
386
|
-
*
|
|
387
|
-
* @category Components
|
|
388
|
-
*/
|
|
389
|
-
declare class Environment extends Component {
|
|
390
|
-
/** Aggregated environment authoring state (skybox, fog, gravity). Saved with the project. */
|
|
391
|
-
values: EnvironmentState;
|
|
392
|
-
constructor(values?: Partial<EnvironmentState>);
|
|
393
|
-
}
|
|
394
|
-
|
|
395
|
-
/** Aggregated post-processing effect chain authored on the scene environment. Each sub-effect has its own `enabled` flag plus per-effect parameters. */
|
|
396
|
-
type PostprocessingState = {
|
|
397
|
-
/** Master toggle. When `false` no post-processing is applied even if individual effects are enabled. */
|
|
398
|
-
postEnabled: boolean;
|
|
399
|
-
/** Depth-of-field (bokeh) effect. */
|
|
400
|
-
dof: {
|
|
401
|
-
/** Enable the effect. */
|
|
402
|
-
enabled: boolean;
|
|
403
|
-
/** Distance to the focal plane in world units. */
|
|
404
|
-
focusDistance: number;
|
|
405
|
-
/** Lens focal length controlling depth-of-field strength. */
|
|
406
|
-
focalLength: number;
|
|
407
|
-
/** Bokeh blur kernel scale. */
|
|
408
|
-
bokehScale: number;
|
|
409
|
-
};
|
|
410
|
-
/** Bloom (HDR glow) effect. */
|
|
411
|
-
bloom: {
|
|
412
|
-
/** Enable the effect. */
|
|
413
|
-
enabled: boolean;
|
|
414
|
-
/** Strength of the bloom contribution. */
|
|
415
|
-
intensity: number;
|
|
416
|
-
/** Luminance threshold above which pixels bloom. */
|
|
417
|
-
threshold: number;
|
|
418
|
-
/** Blur radius applied to the bloom buffer. */
|
|
419
|
-
radius: number;
|
|
420
|
-
};
|
|
421
|
-
/** Vignette (corner darkening) effect. */
|
|
422
|
-
vignette: {
|
|
423
|
-
/** Enable the effect. */
|
|
424
|
-
enabled: boolean;
|
|
425
|
-
/** Distance from screen center where the vignette begins. */
|
|
426
|
-
offset: number;
|
|
427
|
-
/** Maximum darkness applied at screen edges. */
|
|
428
|
-
darkness: number;
|
|
429
|
-
};
|
|
430
|
-
/** Chromatic aberration (RGB channel offset) effect. */
|
|
431
|
-
chromAberration: {
|
|
432
|
-
/** Enable the effect. */
|
|
433
|
-
enabled: boolean;
|
|
434
|
-
/** Horizontal channel offset. */
|
|
435
|
-
offsetX: number;
|
|
436
|
-
/** Vertical channel offset. */
|
|
437
|
-
offsetY: number;
|
|
438
|
-
};
|
|
439
|
-
/** Film-noise overlay. */
|
|
440
|
-
noise: {
|
|
441
|
-
/** Enable the effect. */
|
|
442
|
-
enabled: boolean;
|
|
443
|
-
/** Opacity of the noise layer in `[0, 1]`. */
|
|
444
|
-
opacity: number;
|
|
445
|
-
};
|
|
446
|
-
/** Pixelation (mosaic) effect. */
|
|
447
|
-
pixelation: {
|
|
448
|
-
/** Enable the effect. */
|
|
449
|
-
enabled: boolean;
|
|
450
|
-
/** Pixel block size in screen pixels. */
|
|
451
|
-
granularity: number;
|
|
452
|
-
};
|
|
453
|
-
/** Tone-mapping exposure control. */
|
|
454
|
-
toneMapping: {
|
|
455
|
-
/** Enable the effect. */
|
|
456
|
-
enabled: boolean;
|
|
457
|
-
/** Exposure multiplier applied before tone-mapping. */
|
|
458
|
-
exposure: number;
|
|
459
|
-
};
|
|
460
|
-
/** Hue/saturation color grading. */
|
|
461
|
-
hueSaturation: {
|
|
462
|
-
/** Enable the effect. */
|
|
463
|
-
enabled: boolean;
|
|
464
|
-
/** Hue rotation in radians. */
|
|
465
|
-
hue: number;
|
|
466
|
-
/** Saturation offset (`0` = unchanged, `>0` = more saturated). */
|
|
467
|
-
saturation: number;
|
|
468
|
-
};
|
|
469
|
-
/** Sepia color grade. */
|
|
470
|
-
sepia: {
|
|
471
|
-
/** Enable the effect. */
|
|
472
|
-
enabled: boolean;
|
|
473
|
-
/** Blend strength between original and sepia in `[0, 1]`. */
|
|
474
|
-
intensity: number;
|
|
475
|
-
};
|
|
476
|
-
/** SMAA antialiasing pass. */
|
|
477
|
-
smaa: {
|
|
478
|
-
/** Enable the effect. */
|
|
479
|
-
enabled: boolean;
|
|
480
|
-
};
|
|
481
|
-
/** Screen-space ambient occlusion. */
|
|
482
|
-
ssao: {
|
|
483
|
-
/** Enable the effect. */
|
|
484
|
-
enabled: boolean;
|
|
485
|
-
/** Strength of the AO contribution. */
|
|
486
|
-
intensity: number;
|
|
487
|
-
/** Sampling radius in world units. */
|
|
488
|
-
radius: number;
|
|
489
|
-
};
|
|
490
|
-
/** Dot-screen (halftone) effect. */
|
|
491
|
-
dotScreen: {
|
|
492
|
-
/** Enable the effect. */
|
|
493
|
-
enabled: boolean;
|
|
494
|
-
/** Pattern scale (legacy field; use {@link scale} where available). */
|
|
495
|
-
dotScreenScale: number;
|
|
496
|
-
/** Pattern rotation in radians (legacy field; use {@link angle} where available). */
|
|
497
|
-
dotScreenAngle: number;
|
|
498
|
-
/** Pattern rotation in radians. */
|
|
499
|
-
angle?: number;
|
|
500
|
-
/** Pattern scale. */
|
|
501
|
-
scale?: number;
|
|
502
|
-
/** Three.js blend function override. */
|
|
503
|
-
blendFunction?: number;
|
|
504
|
-
/** Effect opacity in `[0, 1]`. */
|
|
505
|
-
opacity?: number;
|
|
506
|
-
};
|
|
507
|
-
/** Glitch effect (digital corruption simulation). */
|
|
508
|
-
glitch: {
|
|
509
|
-
/** Enable the effect. */
|
|
510
|
-
enabled: boolean;
|
|
511
|
-
/** Three.js blend function override. */
|
|
512
|
-
blendFunction?: number;
|
|
513
|
-
/** RGB channel offset applied during a glitch burst. */
|
|
514
|
-
chromaticAberrationOffset?: {
|
|
515
|
-
x: number;
|
|
516
|
-
y: number;
|
|
517
|
-
} | [number, number];
|
|
518
|
-
/** `[min, max]` delay (seconds) between glitch bursts. */
|
|
519
|
-
delay?: [number, number];
|
|
520
|
-
/** `[min, max]` duration (seconds) of each glitch burst. */
|
|
521
|
-
duration?: [number, number];
|
|
522
|
-
/** Glitch displacement strength (scalar or per-axis). */
|
|
523
|
-
strength?: number | {
|
|
524
|
-
x: number;
|
|
525
|
-
y: number;
|
|
526
|
-
};
|
|
527
|
-
/** Size of the displacement texture sampled by the glitch shader. */
|
|
528
|
-
dtSize?: number;
|
|
529
|
-
/** Fraction of columns affected during a glitch burst. */
|
|
530
|
-
columns?: number;
|
|
531
|
-
/** Ratio between weak and strong glitch bursts. */
|
|
532
|
-
ratio?: number;
|
|
533
|
-
/** Glitch mode label (matches the postprocessing library's mode enum). */
|
|
534
|
-
mode?: string;
|
|
535
|
-
/** Force the glitch to remain active. */
|
|
536
|
-
active?: boolean;
|
|
537
|
-
};
|
|
538
|
-
};
|
|
539
|
-
declare const DEFAULT_POSTPROCESSING_STATE: PostprocessingState;
|
|
540
|
-
/**
|
|
541
|
-
* Postprocessing stack settings (depth-of-field, bloom, vignette, chromatic
|
|
542
|
-
* aberration, noise, pixelation, tone mapping, hue/saturation, sepia, SMAA,
|
|
543
|
-
* SSAO, dot-screen, glitch). The render system applies enabled effects in a
|
|
544
|
-
* `postprocessing`-library composer when `postEnabled` is `true`. Singleton-
|
|
545
|
-
* style — attached to one entity per scene.
|
|
546
|
-
*
|
|
547
|
-
* @category Components
|
|
548
|
-
*/
|
|
549
|
-
declare class Postprocessing extends Component {
|
|
550
|
-
/** Aggregated post-processing state. Saved with the project. */
|
|
551
|
-
values: PostprocessingState;
|
|
552
|
-
constructor(values?: Partial<PostprocessingState>);
|
|
553
|
-
}
|
|
554
|
-
|
|
555
316
|
/** Editable primitive kinds the mesh-geometry system can rebuild on the fly. `model` is a passthrough placeholder for entities that own a loaded GLTF/GLB instead. */
|
|
556
317
|
type EditableMeshObjectKind = "capsule" | "cube" | "cylinder" | "model" | "plane" | "sphere";
|
|
557
318
|
/** Box geometry parameters in world units. */
|
|
@@ -1352,4 +1113,4 @@ declare class VideoComponent extends Component {
|
|
|
1352
1113
|
stop(): void;
|
|
1353
1114
|
}
|
|
1354
1115
|
|
|
1355
|
-
export { type
|
|
1116
|
+
export { type TransformSpaceValue as $, AnimationComponent as A, MeshGeometryComponent as B, CameraComponent as C, DEFAULT_COLLIDER_STATE as D, type EditableMeshObjectKind as E, type MeshGeometryParameters as F, type MeshGeometryParametersByKind as G, ModelComponent as H, ImageComponent as I, type PhysicsState as J, type PlaneMeshParameters as K, LightComponent as L, MaterialComponent as M, Name as N, Object3DRef as O, PhysicsComponent as P, type RadiusMeshParameters as Q, type RadiusHeightMeshParameters as R, type RigidbodyState as S, type RigidbodyType as T, ScriptComponent as U, type ScriptEntry as V, Selectable as W, SelectionTransformState as X, SpriteComponent as Y, type TextureFilteringValue as Z, type TransformModeValue as _, type AnimationComponentOptions as a, VideoComponent as a0, normalizePhysicsState as a1, type AnimationStateCallbacks as a2, AnimationStateMachine as a3, AnimationStateManager as a4, type StateMachine as a5, AudioComponent as b, type CameraComponentOptions as c, type CameraProjection as d, type CameraRuntimeType as e, type ColliderShape as f, type ColliderState as g, type CubeMeshParameters as h, DEFAULT_INSTANCED_MESH_PARAMETERS as i, DEFAULT_INSTANCE_TRANSFORM as j, DEFAULT_MESH_GEOMETRY_PARAMETERS as k, DEFAULT_PHYSICS_STATE as l, DEFAULT_RIGIDBODY_STATE as m, EntityType as n, ImageTarget as o, ImageTargetAnchor as p, type ImageTargetAnchorOptions as q, type ImageTargetReference as r, InstanceSlotComponent as s, type InstanceTransform as t, InstancedMeshComponent as u, type InstancedMeshKind as v, type LightValueState as w, type MaterialTypeValue as x, type MaterialValueState as y, MeshComponent as z };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { TransformComponent, Object3DRef, ParentId } from './chunk-
|
|
1
|
+
import { TransformComponent, Object3DRef, ParentId } from './chunk-FTIQQK62.js';
|
|
2
2
|
import { __name } from './chunk-OY7ZODZP.js';
|
|
3
3
|
import * as THREE from 'three';
|
|
4
4
|
|
|
@@ -255,5 +255,5 @@ function resolveDracoDecoderPath() {
|
|
|
255
255
|
__name(resolveDracoDecoderPath, "resolveDracoDecoderPath");
|
|
256
256
|
|
|
257
257
|
export { ObjectManagementSystem, applyTransform, createTransform, resolveDracoDecoderPath };
|
|
258
|
-
//# sourceMappingURL=chunk-
|
|
259
|
-
//# sourceMappingURL=chunk-
|
|
258
|
+
//# sourceMappingURL=chunk-27RBPOVO.js.map
|
|
259
|
+
//# sourceMappingURL=chunk-27RBPOVO.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../core/systems/ObjectManagementSystem.ts","../core/utils/dracoDecoderPath.ts"],"names":[],"mappings":";;;;AAqEO,SAAS,gBAAgB,KAAA,EAA2C;AACzE,EAAA,OAAO,IAAI,mBAAmB,KAAK,CAAA;AACrC;AAFgB,MAA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AA,OAAA,CAAQ,YAAY,QAAQ,CAAA;AAAA,IAC9B;AAEA,IAAA,IAAA,CAAK,wBAAwB,KAAK,CAAA;AAAA,EACpC;AACF,CAAA;AAzSyD,MAAA,CAAA,uBAAA,EAAA,wBAAA,CAAA;AAAlD,IAAM,sBAAA,GAAN;;;AC1FP,IAAM,iCAAA,GAAoC,iBAAA;AACnC,IAAM,sBAAA,GACX,yDAAA;AAEF,SAAS,wBAAwB,GAAA,EAAsB;AACrD,EAAA,OAAO,GAAA,CAAI,WAAW,SAAS,CAAA;AACjC;AAFS,MAAA,CAAA,uBAAA,EAAA,yBAAA,CAAA;AAIF,SAAS,uBAAA,GAAkC;AAChD,EAAA,IAAI;AAEF,IAAA,MAAM,eAAe,IAAI,GAAA;AAAA,MACvB,iCAAA;AAAA,MACA,MAAA,CAAA,IAAA,CAAY;AAAA,MACZ,QAAA,EAAS;AAIX,IAAA,IAAI,uBAAA,CAAwB,YAAY,CAAA,EAAG;AACzC,MAAA,OAAO,sBAAA;AAAA,IACT;AAEA,IAAA,OAAO,YAAA;AAAA,EACT,CAAA,CAAA,MAAQ;AAEN,IAAA,OAAO,sBAAA;AAAA,EACT;AACF;AAnBgB,MAAA,CAAA,uBAAA,EAAA,yBAAA,CAAA","file":"chunk-PH43YHUT.js","sourcesContent":["import * as THREE from \"three\";\n\nimport { Object3DRef } from \"../components/Object3DRef\";\nimport { ParentId } from \"../components/ParentId\";\nimport type { TransformData } from \"../components/Transform\";\nimport { TransformComponent } from \"../components/Transform\";\nimport type { EcsSystem } from \"../System\";\nimport type { World } from \"../World\";\nimport type { EntityId, EcsEntityKind } from \"../types\";\n\nexport type CreatePayload = {\n name?: string;\n transform?: TransformData;\n parentId?: EntityId | null;\n path?: string;\n options?: Record<string, unknown>;\n camera?: Record<string, unknown>;\n useWorldCamera?: boolean;\n};\n\nexport type CreateContext = {\n world: World;\n scene: THREE.Scene;\n camera: THREE.PerspectiveCamera;\n payload: CreatePayload;\n isEditor?: boolean;\n};\n\nexport type EntityFactory = (context: CreateContext) => EntityId;\n\nexport type EcsComponentFactoryKind =\n | \"animation\"\n | \"audio\"\n | \"camera\"\n | \"environment\"\n | \"entityType\"\n | \"image\"\n | \"imageTargetAnchor\"\n | \"imageTarget\"\n | \"light\"\n | \"material\"\n | \"mesh\"\n | \"meshGeometry\"\n | \"model\"\n | \"name\"\n | \"object3DRef\"\n | \"parentId\"\n | \"physics\"\n | \"postprocessing\"\n | \"script\"\n | \"selectable\"\n | \"selectionTransformState\"\n | \"sprite\"\n | \"transform\"\n | \"video\"\n | \"instancedMesh\";\n\nexport type ComponentFactory = (\n world: World,\n entityId: EntityId,\n ...args: any[]\n) => unknown;\n\ntype CreateRequest = {\n kind: EcsEntityKind;\n payload: CreatePayload;\n onCreated?: (entityId: EntityId) => void;\n};\n\nexport function createTransform(input?: TransformData): TransformComponent {\n return new TransformComponent(input);\n}\n\nexport function applyTransform(\n object: THREE.Object3D,\n transform: TransformComponent,\n): void {\n object.position.set(\n transform.position.x,\n transform.position.y,\n transform.position.z,\n );\n object.rotation.set(\n transform.rotation.x,\n transform.rotation.y,\n transform.rotation.z,\n );\n object.scale.set(transform.scale.x, transform.scale.y, transform.scale.z);\n}\n\nexport class ObjectManagementSystem implements EcsSystem {\n private readonly scene: THREE.Scene;\n private readonly camera: THREE.PerspectiveCamera;\n private readonly isEditor: boolean;\n private readonly registry = new Map<EcsEntityKind, EntityFactory>();\n private readonly componentRegistry = new Map<\n EcsComponentFactoryKind,\n ComponentFactory\n >();\n private readonly createQueue: CreateRequest[] = [];\n\n constructor(\n scene: THREE.Scene,\n camera: THREE.PerspectiveCamera,\n isEditor = false,\n ) {\n this.scene = scene;\n this.camera = camera;\n this.isEditor = isEditor;\n }\n\n register(kind: EcsEntityKind, factory: EntityFactory): void {\n this.registry.set(kind, factory);\n }\n\n registerComponentFactory(\n kind: EcsComponentFactoryKind,\n factory: ComponentFactory,\n ): void {\n this.componentRegistry.set(kind, factory);\n }\n\n getOrCreateAudioListener(): THREE.AudioListener {\n const existing = this.camera.userData.ecsAudioListener;\n if (existing instanceof THREE.AudioListener) {\n return existing;\n }\n\n const listener = new THREE.AudioListener();\n this.camera.add(listener);\n this.camera.userData.ecsAudioListener = listener;\n return listener;\n }\n\n isEditorMode(): boolean {\n return this.isEditor;\n }\n\n getComponentFactory(kind: EcsComponentFactoryKind): ComponentFactory | null {\n return this.componentRegistry.get(kind) ?? null;\n }\n\n createComponentNow(\n kind: EcsComponentFactoryKind,\n world: World,\n entityId: EntityId,\n ...args: any[]\n ): unknown {\n const factory = this.componentRegistry.get(kind);\n if (!factory) {\n throw new Error(`Unknown component kind: ${kind}`);\n }\n\n return factory(world, entityId, ...args);\n }\n\n requestCreate(\n kind: EcsEntityKind,\n payload: CreatePayload = {},\n onCreated?: (entityId: EntityId) => void,\n ): void {\n this.createQueue.push({ kind, payload, onCreated });\n }\n\n createNow(\n kind: EcsEntityKind,\n world: World,\n payload: CreatePayload = {},\n ): EntityId {\n const factory = this.registry.get(kind);\n if (!factory) {\n throw new Error(`Unknown object kind: ${kind}`);\n }\n\n const entityId = factory({\n world,\n scene: this.scene,\n camera: this.camera,\n payload,\n isEditor: this.isEditor,\n });\n\n const object = world.getComponent(entityId, Object3DRef)?.object;\n if (object) {\n object.userData.ecsKind = kind;\n }\n\n if (payload.parentId !== undefined) {\n world.addComponent(entityId, new ParentId(payload.parentId));\n }\n\n return entityId;\n }\n\n /**\n * Removes an entity from the ECS world and its associated `Object3D` from the\n * THREE.js scene graph.\n *\n * @param world - The world the entity belongs to.\n * @param entityId - The entity to remove.\n * @param dispose - When `true`, traverses the entity's `Object3D` subtree and\n * calls `.dispose()` on every `BufferGeometry` and `Material` found. Pass\n * `true` when the entity will not be reused and you want to free GPU memory\n * immediately (e.g. dynamically spawned objects). Defaults to `false`.\n * @returns `true` if the entity existed and was removed; `false` if the entity\n * was not found.\n *\n * @example\n * ```ts\n * // Remove from scene, keep GPU resources (safe if geometry is shared)\n * objects.deleteEntity(world, entityId);\n *\n * // Remove from scene and free GPU memory (use for one-off spawned objects)\n * objects.deleteEntity(world, entityId, true);\n * ```\n */\n deleteEntity(world: World, entityId: EntityId, dispose = false): boolean {\n if (!world.hasEntity(entityId)) {\n return false;\n }\n\n const object3d = world.getComponent(entityId, Object3DRef)?.object;\n if (object3d?.parent) {\n object3d.parent.remove(object3d);\n }\n\n if (dispose && object3d) {\n object3d.traverse((child) => {\n if (child instanceof THREE.Mesh) {\n child.geometry?.dispose();\n if (Array.isArray(child.material)) {\n for (const mat of child.material) {\n mat.dispose();\n }\n } else {\n child.material?.dispose();\n }\n }\n });\n }\n\n world.destroyEntity(entityId);\n return true;\n }\n\n setParent(\n world: World,\n entityId: EntityId,\n parentId: EntityId | null,\n options?: {\n preserveWorldTransform?: boolean;\n },\n ): boolean {\n if (!world.hasEntity(entityId)) {\n return false;\n }\n\n if (parentId !== null && !world.hasEntity(parentId)) {\n return false;\n }\n\n if (parentId === entityId) {\n return false;\n }\n\n let ancestor = parentId;\n while (ancestor !== null) {\n if (ancestor === entityId) {\n return false;\n }\n\n ancestor = world.getComponent(ancestor, ParentId)?.value ?? null;\n }\n\n const parentComponent = world.getComponent(entityId, ParentId);\n if (parentComponent) {\n if (parentComponent.value === parentId) {\n return false;\n }\n\n parentComponent.value = parentId;\n } else {\n world.addComponent(entityId, new ParentId(parentId));\n }\n\n const preserveWorldTransform = options?.preserveWorldTransform ?? true;\n if (preserveWorldTransform) {\n const object = world.getComponent(entityId, Object3DRef)?.object;\n const parentObject =\n parentId !== null\n ? world.getComponent(parentId, Object3DRef)?.object ?? null\n : null;\n\n if (object) {\n // Refresh matrixWorld before attach so world-space preservation is accurate.\n this.scene.updateMatrixWorld(true);\n\n if (parentObject && parentObject !== object) {\n parentObject.attach(object);\n } else {\n this.scene.attach(object);\n }\n\n object.updateMatrixWorld(true);\n this.syncTransformComponentFromObject(world, entityId, object);\n }\n }\n\n this.reconcileSceneFromWorld(world);\n return true;\n }\n\n private syncTransformComponentFromObject(\n world: World,\n entityId: EntityId,\n object: THREE.Object3D,\n ): void {\n const transform = world.getComponent(entityId, TransformComponent);\n if (!transform) {\n return;\n }\n\n transform.position.x = object.position.x;\n transform.position.y = object.position.y;\n transform.position.z = object.position.z;\n\n transform.rotation.x = object.rotation.x;\n transform.rotation.y = object.rotation.y;\n transform.rotation.z = object.rotation.z;\n\n transform.scale.x = object.scale.x;\n transform.scale.y = object.scale.y;\n transform.scale.z = object.scale.z;\n }\n\n reconcileSceneFromWorld(world: World): void {\n const worldObjects = new Map<EntityId, THREE.Object3D>();\n const entityIds = world.query(Object3DRef);\n\n for (const entityId of entityIds) {\n const object = world.getComponent(entityId, Object3DRef)?.object;\n if (!object) {\n continue;\n }\n\n worldObjects.set(entityId, object);\n }\n\n for (const child of [...this.scene.children]) {\n const entityId = child.userData?.entityId;\n if (typeof entityId === \"number\" && !world.hasEntity(entityId)) {\n this.scene.remove(child);\n }\n }\n\n for (const [entityId, object] of worldObjects.entries()) {\n const parentEntityId = world.getComponent(entityId, ParentId)?.value;\n const parentObject =\n typeof parentEntityId === \"number\"\n ? worldObjects.get(parentEntityId)\n : undefined;\n\n if (parentObject && parentObject !== object) {\n if (object.parent !== parentObject) {\n // Reconcile hierarchy from ParentId while keeping Transform as local source of truth.\n parentObject.add(object);\n object.updateMatrixWorld(true);\n }\n continue;\n }\n\n if (object.parent !== this.scene) {\n // Reconcile hierarchy from ParentId while keeping Transform as local source of truth.\n this.scene.add(object);\n object.updateMatrixWorld(true);\n }\n }\n }\n\n update(world: World): void {\n for (const request of this.createQueue.splice(0)) {\n const entityId = this.createNow(request.kind, world, request.payload);\n request.onCreated?.(entityId);\n }\n\n this.reconcileSceneFromWorld(world);\n }\n}\n","const LOCAL_DRACO_DECODER_RELATIVE_PATH = \"./assets/draco/\";\nexport const DRACO_DECODER_CDN_PATH =\n \"https://www.gstatic.com/draco/versioned/decoders/1.5.7/\";\n\nfunction isBlockedBrowserFileUrl(url: string): boolean {\n return url.startsWith(\"file://\");\n}\n\nexport function resolveDracoDecoderPath(): string {\n try {\n // Prefer vendored decoder assets shipped with this package.\n const resolvedPath = new URL(\n LOCAL_DRACO_DECODER_RELATIVE_PATH,\n import.meta.url,\n ).toString();\n\n // Browser loaders cannot fetch file:// resources from package install paths.\n // Fall back to CDN decoders when bundlers emit file URLs for node_modules assets.\n if (isBlockedBrowserFileUrl(resolvedPath)) {\n return DRACO_DECODER_CDN_PATH;\n }\n\n return resolvedPath;\n } catch {\n // Fallback keeps compatibility in runtimes that cannot resolve package-relative URLs.\n return DRACO_DECODER_CDN_PATH;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../core/systems/ObjectManagementSystem.ts","../core/utils/dracoDecoderPath.ts"],"names":[],"mappings":";;;;AAqEO,SAAS,gBAAgB,KAAA,EAA2C;AACzE,EAAA,OAAO,IAAI,mBAAmB,KAAK,CAAA;AACrC;AAFgB,MAAA,CAAA,eAAA,EAAA,iBAAA,CAAA;AAIT,SAAS,cAAA,CACd,QACA,SAAA,EACM;AACN,EAAA,MAAA,CAAO,QAAA,CAAS,GAAA;AAAA,IACd,UAAU,QAAA,CAAS,CAAA;AAAA,IACnB,UAAU,QAAA,CAAS,CAAA;AAAA,IACnB,UAAU,QAAA,CAAS;AAAA,GACrB;AACA,EAAA,MAAA,CAAO,QAAA,CAAS,GAAA;AAAA,IACd,UAAU,QAAA,CAAS,CAAA;AAAA,IACnB,UAAU,QAAA,CAAS,CAAA;AAAA,IACnB,UAAU,QAAA,CAAS;AAAA,GACrB;AACA,EAAA,MAAA,CAAO,KAAA,CAAM,GAAA,CAAI,SAAA,CAAU,KAAA,CAAM,CAAA,EAAG,UAAU,KAAA,CAAM,CAAA,EAAG,SAAA,CAAU,KAAA,CAAM,CAAC,CAAA;AAC1E;AAfgB,MAAA,CAAA,cAAA,EAAA,gBAAA,CAAA;AAiBT,IAAM,uBAAA,GAAN,MAAM,uBAAA,CAA4C;AAAA,EAWvD,WAAA,CACE,KAAA,EACA,MAAA,EACA,QAAA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AAA,MAAQ;AAEN,IAAA,OAAO,sBAAA;AAAA,EACT;AACF;AAnBgB,MAAA,CAAA,uBAAA,EAAA,yBAAA,CAAA","file":"chunk-27RBPOVO.js","sourcesContent":["import * as THREE from \"three\";\n\nimport { Object3DRef } from \"../components/Object3DRef\";\nimport { ParentId } from \"../components/ParentId\";\nimport type { TransformData } from \"../components/Transform\";\nimport { TransformComponent } from \"../components/Transform\";\nimport type { EcsSystem } from \"../System\";\nimport type { World } from \"../World\";\nimport type { EntityId, EcsEntityKind } from \"../types\";\n\nexport type CreatePayload = {\n name?: string;\n transform?: TransformData;\n parentId?: EntityId | null;\n path?: string;\n options?: Record<string, unknown>;\n camera?: Record<string, unknown>;\n useWorldCamera?: boolean;\n};\n\nexport type CreateContext = {\n world: World;\n scene: THREE.Scene;\n camera: THREE.PerspectiveCamera;\n payload: CreatePayload;\n isEditor?: boolean;\n};\n\nexport type EntityFactory = (context: CreateContext) => EntityId;\n\nexport type EcsComponentFactoryKind =\n | \"animation\"\n | \"audio\"\n | \"camera\"\n | \"environment\"\n | \"entityType\"\n | \"image\"\n | \"imageTargetAnchor\"\n | \"imageTarget\"\n | \"light\"\n | \"material\"\n | \"mesh\"\n | \"meshGeometry\"\n | \"model\"\n | \"name\"\n | \"object3DRef\"\n | \"parentId\"\n | \"physics\"\n | \"postprocessing\"\n | \"script\"\n | \"selectable\"\n | \"selectionTransformState\"\n | \"sprite\"\n | \"transform\"\n | \"video\"\n | \"instancedMesh\";\n\nexport type ComponentFactory = (\n world: World,\n entityId: EntityId,\n ...args: any[]\n) => unknown;\n\ntype CreateRequest = {\n kind: EcsEntityKind;\n payload: CreatePayload;\n onCreated?: (entityId: EntityId) => void;\n};\n\nexport function createTransform(input?: TransformData): TransformComponent {\n return new TransformComponent(input);\n}\n\nexport function applyTransform(\n object: THREE.Object3D,\n transform: TransformComponent,\n): void {\n object.position.set(\n transform.position.x,\n transform.position.y,\n transform.position.z,\n );\n object.rotation.set(\n transform.rotation.x,\n transform.rotation.y,\n transform.rotation.z,\n );\n object.scale.set(transform.scale.x, transform.scale.y, transform.scale.z);\n}\n\nexport class ObjectManagementSystem implements EcsSystem {\n private readonly scene: THREE.Scene;\n private readonly camera: THREE.PerspectiveCamera;\n private readonly isEditor: boolean;\n private readonly registry = new Map<EcsEntityKind, EntityFactory>();\n private readonly componentRegistry = new Map<\n EcsComponentFactoryKind,\n ComponentFactory\n >();\n private readonly createQueue: CreateRequest[] = [];\n\n constructor(\n scene: THREE.Scene,\n camera: THREE.PerspectiveCamera,\n isEditor = false,\n ) {\n this.scene = scene;\n this.camera = camera;\n this.isEditor = isEditor;\n }\n\n register(kind: EcsEntityKind, factory: EntityFactory): void {\n this.registry.set(kind, factory);\n }\n\n registerComponentFactory(\n kind: EcsComponentFactoryKind,\n factory: ComponentFactory,\n ): void {\n this.componentRegistry.set(kind, factory);\n }\n\n getOrCreateAudioListener(): THREE.AudioListener {\n const existing = this.camera.userData.ecsAudioListener;\n if (existing instanceof THREE.AudioListener) {\n return existing;\n }\n\n const listener = new THREE.AudioListener();\n this.camera.add(listener);\n this.camera.userData.ecsAudioListener = listener;\n return listener;\n }\n\n isEditorMode(): boolean {\n return this.isEditor;\n }\n\n getComponentFactory(kind: EcsComponentFactoryKind): ComponentFactory | null {\n return this.componentRegistry.get(kind) ?? null;\n }\n\n createComponentNow(\n kind: EcsComponentFactoryKind,\n world: World,\n entityId: EntityId,\n ...args: any[]\n ): unknown {\n const factory = this.componentRegistry.get(kind);\n if (!factory) {\n throw new Error(`Unknown component kind: ${kind}`);\n }\n\n return factory(world, entityId, ...args);\n }\n\n requestCreate(\n kind: EcsEntityKind,\n payload: CreatePayload = {},\n onCreated?: (entityId: EntityId) => void,\n ): void {\n this.createQueue.push({ kind, payload, onCreated });\n }\n\n createNow(\n kind: EcsEntityKind,\n world: World,\n payload: CreatePayload = {},\n ): EntityId {\n const factory = this.registry.get(kind);\n if (!factory) {\n throw new Error(`Unknown object kind: ${kind}`);\n }\n\n const entityId = factory({\n world,\n scene: this.scene,\n camera: this.camera,\n payload,\n isEditor: this.isEditor,\n });\n\n const object = world.getComponent(entityId, Object3DRef)?.object;\n if (object) {\n object.userData.ecsKind = kind;\n }\n\n if (payload.parentId !== undefined) {\n world.addComponent(entityId, new ParentId(payload.parentId));\n }\n\n return entityId;\n }\n\n /**\n * Removes an entity from the ECS world and its associated `Object3D` from the\n * THREE.js scene graph.\n *\n * @param world - The world the entity belongs to.\n * @param entityId - The entity to remove.\n * @param dispose - When `true`, traverses the entity's `Object3D` subtree and\n * calls `.dispose()` on every `BufferGeometry` and `Material` found. Pass\n * `true` when the entity will not be reused and you want to free GPU memory\n * immediately (e.g. dynamically spawned objects). Defaults to `false`.\n * @returns `true` if the entity existed and was removed; `false` if the entity\n * was not found.\n *\n * @example\n * ```ts\n * // Remove from scene, keep GPU resources (safe if geometry is shared)\n * objects.deleteEntity(world, entityId);\n *\n * // Remove from scene and free GPU memory (use for one-off spawned objects)\n * objects.deleteEntity(world, entityId, true);\n * ```\n */\n deleteEntity(world: World, entityId: EntityId, dispose = false): boolean {\n if (!world.hasEntity(entityId)) {\n return false;\n }\n\n const object3d = world.getComponent(entityId, Object3DRef)?.object;\n if (object3d?.parent) {\n object3d.parent.remove(object3d);\n }\n\n if (dispose && object3d) {\n object3d.traverse((child) => {\n if (child instanceof THREE.Mesh) {\n child.geometry?.dispose();\n if (Array.isArray(child.material)) {\n for (const mat of child.material) {\n mat.dispose();\n }\n } else {\n child.material?.dispose();\n }\n }\n });\n }\n\n world.destroyEntity(entityId);\n return true;\n }\n\n setParent(\n world: World,\n entityId: EntityId,\n parentId: EntityId | null,\n options?: {\n preserveWorldTransform?: boolean;\n },\n ): boolean {\n if (!world.hasEntity(entityId)) {\n return false;\n }\n\n if (parentId !== null && !world.hasEntity(parentId)) {\n return false;\n }\n\n if (parentId === entityId) {\n return false;\n }\n\n let ancestor = parentId;\n while (ancestor !== null) {\n if (ancestor === entityId) {\n return false;\n }\n\n ancestor = world.getComponent(ancestor, ParentId)?.value ?? null;\n }\n\n const parentComponent = world.getComponent(entityId, ParentId);\n if (parentComponent) {\n if (parentComponent.value === parentId) {\n return false;\n }\n\n parentComponent.value = parentId;\n } else {\n world.addComponent(entityId, new ParentId(parentId));\n }\n\n const preserveWorldTransform = options?.preserveWorldTransform ?? true;\n if (preserveWorldTransform) {\n const object = world.getComponent(entityId, Object3DRef)?.object;\n const parentObject =\n parentId !== null\n ? world.getComponent(parentId, Object3DRef)?.object ?? null\n : null;\n\n if (object) {\n // Refresh matrixWorld before attach so world-space preservation is accurate.\n this.scene.updateMatrixWorld(true);\n\n if (parentObject && parentObject !== object) {\n parentObject.attach(object);\n } else {\n this.scene.attach(object);\n }\n\n object.updateMatrixWorld(true);\n this.syncTransformComponentFromObject(world, entityId, object);\n }\n }\n\n this.reconcileSceneFromWorld(world);\n return true;\n }\n\n private syncTransformComponentFromObject(\n world: World,\n entityId: EntityId,\n object: THREE.Object3D,\n ): void {\n const transform = world.getComponent(entityId, TransformComponent);\n if (!transform) {\n return;\n }\n\n transform.position.x = object.position.x;\n transform.position.y = object.position.y;\n transform.position.z = object.position.z;\n\n transform.rotation.x = object.rotation.x;\n transform.rotation.y = object.rotation.y;\n transform.rotation.z = object.rotation.z;\n\n transform.scale.x = object.scale.x;\n transform.scale.y = object.scale.y;\n transform.scale.z = object.scale.z;\n }\n\n reconcileSceneFromWorld(world: World): void {\n const worldObjects = new Map<EntityId, THREE.Object3D>();\n const entityIds = world.query(Object3DRef);\n\n for (const entityId of entityIds) {\n const object = world.getComponent(entityId, Object3DRef)?.object;\n if (!object) {\n continue;\n }\n\n worldObjects.set(entityId, object);\n }\n\n for (const child of [...this.scene.children]) {\n const entityId = child.userData?.entityId;\n if (typeof entityId === \"number\" && !world.hasEntity(entityId)) {\n this.scene.remove(child);\n }\n }\n\n for (const [entityId, object] of worldObjects.entries()) {\n const parentEntityId = world.getComponent(entityId, ParentId)?.value;\n const parentObject =\n typeof parentEntityId === \"number\"\n ? worldObjects.get(parentEntityId)\n : undefined;\n\n if (parentObject && parentObject !== object) {\n if (object.parent !== parentObject) {\n // Reconcile hierarchy from ParentId while keeping Transform as local source of truth.\n parentObject.add(object);\n object.updateMatrixWorld(true);\n }\n continue;\n }\n\n if (object.parent !== this.scene) {\n // Reconcile hierarchy from ParentId while keeping Transform as local source of truth.\n this.scene.add(object);\n object.updateMatrixWorld(true);\n }\n }\n }\n\n update(world: World): void {\n for (const request of this.createQueue.splice(0)) {\n const entityId = this.createNow(request.kind, world, request.payload);\n request.onCreated?.(entityId);\n }\n\n this.reconcileSceneFromWorld(world);\n }\n}\n","const LOCAL_DRACO_DECODER_RELATIVE_PATH = \"./assets/draco/\";\nexport const DRACO_DECODER_CDN_PATH =\n \"https://www.gstatic.com/draco/versioned/decoders/1.5.7/\";\n\nfunction isBlockedBrowserFileUrl(url: string): boolean {\n return url.startsWith(\"file://\");\n}\n\nexport function resolveDracoDecoderPath(): string {\n try {\n // Prefer vendored decoder assets shipped with this package.\n const resolvedPath = new URL(\n LOCAL_DRACO_DECODER_RELATIVE_PATH,\n import.meta.url,\n ).toString();\n\n // Browser loaders cannot fetch file:// resources from package install paths.\n // Fall back to CDN decoders when bundlers emit file URLs for node_modules assets.\n if (isBlockedBrowserFileUrl(resolvedPath)) {\n return DRACO_DECODER_CDN_PATH;\n }\n\n return resolvedPath;\n } catch {\n // Fallback keeps compatibility in runtimes that cannot resolve package-relative URLs.\n return DRACO_DECODER_CDN_PATH;\n }\n}\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { resolveDracoDecoderPath, createTransform, applyTransform } from './chunk-
|
|
2
|
-
import { AnimationComponent, AudioComponent, Object3DRef, CameraComponent, PhysicsComponent, Environment, EntityType, ImageComponent, ImageTargetAnchor, ImageTarget, LightComponent, MaterialComponent, MeshComponent, MeshGeometryComponent, ModelComponent, Name, ParentId, Postprocessing, ScriptComponent, Selectable, SelectionTransformState, SpriteComponent, TransformComponent, InstancedMeshComponent, InstanceSlotComponent, VideoComponent, DEFAULT_INSTANCE_TRANSFORM } from './chunk-
|
|
1
|
+
import { resolveDracoDecoderPath, createTransform, applyTransform } from './chunk-27RBPOVO.js';
|
|
2
|
+
import { AnimationComponent, AudioComponent, Object3DRef, CameraComponent, PhysicsComponent, Environment, EntityType, ImageComponent, ImageTargetAnchor, ImageTarget, LightComponent, MaterialComponent, MeshComponent, MeshGeometryComponent, ModelComponent, Name, ParentId, Postprocessing, ScriptComponent, Selectable, SelectionTransformState, SpriteComponent, TransformComponent, InstancedMeshComponent, InstanceSlotComponent, VideoComponent, DEFAULT_INSTANCE_TRANSFORM } from './chunk-FTIQQK62.js';
|
|
3
3
|
import { __name } from './chunk-OY7ZODZP.js';
|
|
4
4
|
import * as THREE21 from 'three';
|
|
5
5
|
import { RectAreaLightHelper } from 'three/examples/jsm/helpers/RectAreaLightHelper.js';
|
|
@@ -1428,5 +1428,5 @@ function registerDefaultFactories(objectManagementSystem) {
|
|
|
1428
1428
|
__name(registerDefaultFactories, "registerDefaultFactories");
|
|
1429
1429
|
|
|
1430
1430
|
export { createAnimationComponent, createAudioComponent, createCameraComponent, createEntityTypeComponent, createEnvironmentComponent, createImageComponent, createImageTargetAnchorComponent, createImageTargetComponent, createInstanceSlotComponent, createInstancedMeshComponent, createLightComponent, createMaterialComponent, createMeshComponent, createMeshGeometryComponent, createModelComponent, createNameComponent, createObject3DRefComponent, createParentIdComponent, createPhysicsComponent, createPostprocessingComponent, createScriptComponent, createSelectableComponent, createSelectionTransformStateComponent, createSpriteComponent, createTransformComponent, createVideoComponent, registerDefaultComponentFactories, registerDefaultFactories };
|
|
1431
|
-
//# sourceMappingURL=chunk-
|
|
1432
|
-
//# sourceMappingURL=chunk-
|
|
1431
|
+
//# sourceMappingURL=chunk-7QBONTBW.js.map
|
|
1432
|
+
//# sourceMappingURL=chunk-7QBONTBW.js.map
|