@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,3077 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var THREE26 = require('three');
|
|
4
|
+
var RectAreaLightHelper_js = require('three/examples/jsm/helpers/RectAreaLightHelper.js');
|
|
5
|
+
var DRACOLoader_js = require('three/examples/jsm/loaders/DRACOLoader.js');
|
|
6
|
+
var GLTFLoader_js = require('three/examples/jsm/loaders/GLTFLoader.js');
|
|
7
|
+
|
|
8
|
+
var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
|
|
9
|
+
function _interopNamespace(e) {
|
|
10
|
+
if (e && e.__esModule) return e;
|
|
11
|
+
var n = Object.create(null);
|
|
12
|
+
if (e) {
|
|
13
|
+
Object.keys(e).forEach(function (k) {
|
|
14
|
+
if (k !== 'default') {
|
|
15
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
16
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
17
|
+
enumerable: true,
|
|
18
|
+
get: function () { return e[k]; }
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
n.default = e;
|
|
24
|
+
return Object.freeze(n);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
var THREE26__namespace = /*#__PURE__*/_interopNamespace(THREE26);
|
|
28
|
+
|
|
29
|
+
var __defProp = Object.defineProperty;
|
|
30
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
31
|
+
|
|
32
|
+
// core/Component.ts
|
|
33
|
+
var _Component = class _Component {
|
|
34
|
+
};
|
|
35
|
+
__name(_Component, "Component");
|
|
36
|
+
var Component = _Component;
|
|
37
|
+
|
|
38
|
+
// core/AnimationStateMachine.ts
|
|
39
|
+
var _AnimationStateMachine = class _AnimationStateMachine {
|
|
40
|
+
constructor(name, clip, callbacks = {}, loop = false, clipId = null) {
|
|
41
|
+
this.isPlaying = false;
|
|
42
|
+
this.isPaused = false;
|
|
43
|
+
this.name = name;
|
|
44
|
+
this.clip = clip;
|
|
45
|
+
this.clipId = clipId;
|
|
46
|
+
this.loop = loop;
|
|
47
|
+
this.callbacks = {
|
|
48
|
+
onStart: callbacks.onStart ?? (() => {
|
|
49
|
+
}),
|
|
50
|
+
onPlaying: callbacks.onPlaying ?? (() => {
|
|
51
|
+
}),
|
|
52
|
+
onEnd: callbacks.onEnd ?? (() => {
|
|
53
|
+
})
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
setCallbacks(callbacks) {
|
|
57
|
+
this.callbacks = {
|
|
58
|
+
onStart: callbacks.onStart ?? this.callbacks.onStart,
|
|
59
|
+
onPlaying: callbacks.onPlaying ?? this.callbacks.onPlaying,
|
|
60
|
+
onEnd: callbacks.onEnd ?? this.callbacks.onEnd
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
setLoop(loop) {
|
|
64
|
+
this.loop = loop;
|
|
65
|
+
}
|
|
66
|
+
onStart() {
|
|
67
|
+
this.callbacks.onStart();
|
|
68
|
+
}
|
|
69
|
+
onPlaying() {
|
|
70
|
+
this.callbacks.onPlaying();
|
|
71
|
+
}
|
|
72
|
+
onEnd() {
|
|
73
|
+
this.callbacks.onEnd();
|
|
74
|
+
}
|
|
75
|
+
play() {
|
|
76
|
+
const wasPlaying = this.isPlaying;
|
|
77
|
+
this.isPlaying = true;
|
|
78
|
+
this.isPaused = false;
|
|
79
|
+
if (!wasPlaying) {
|
|
80
|
+
this.onStart();
|
|
81
|
+
}
|
|
82
|
+
this.onPlaying();
|
|
83
|
+
}
|
|
84
|
+
pause() {
|
|
85
|
+
if (!this.isPlaying) {
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
this.isPlaying = false;
|
|
89
|
+
this.isPaused = true;
|
|
90
|
+
}
|
|
91
|
+
stop() {
|
|
92
|
+
const shouldNotifyEnd = this.isPlaying || this.isPaused;
|
|
93
|
+
this.isPlaying = false;
|
|
94
|
+
this.isPaused = false;
|
|
95
|
+
if (shouldNotifyEnd) {
|
|
96
|
+
this.onEnd();
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
__name(_AnimationStateMachine, "AnimationStateMachine");
|
|
101
|
+
var AnimationStateMachine = _AnimationStateMachine;
|
|
102
|
+
var _AnimationStateManager = class _AnimationStateManager {
|
|
103
|
+
constructor() {
|
|
104
|
+
this.states = /* @__PURE__ */ new Map();
|
|
105
|
+
this.activeState = null;
|
|
106
|
+
}
|
|
107
|
+
addState(state) {
|
|
108
|
+
this.states.set(state.name, state);
|
|
109
|
+
return state;
|
|
110
|
+
}
|
|
111
|
+
createState(name, clip, callbacks = {}, loop = false, clipId = null) {
|
|
112
|
+
const state = new AnimationStateMachine(name, clip, callbacks, loop, clipId);
|
|
113
|
+
this.states.set(name, state);
|
|
114
|
+
return state;
|
|
115
|
+
}
|
|
116
|
+
removeState(name) {
|
|
117
|
+
const state = this.states.get(name);
|
|
118
|
+
if (!state) {
|
|
119
|
+
return false;
|
|
120
|
+
}
|
|
121
|
+
if (this.activeState?.name === name) {
|
|
122
|
+
this.activeState.stop();
|
|
123
|
+
this.activeState = null;
|
|
124
|
+
}
|
|
125
|
+
return this.states.delete(name);
|
|
126
|
+
}
|
|
127
|
+
getState(name) {
|
|
128
|
+
return this.states.get(name) ?? null;
|
|
129
|
+
}
|
|
130
|
+
hasState(name) {
|
|
131
|
+
return this.states.has(name);
|
|
132
|
+
}
|
|
133
|
+
listStates() {
|
|
134
|
+
return [...this.states.values()];
|
|
135
|
+
}
|
|
136
|
+
getActiveState() {
|
|
137
|
+
return this.activeState;
|
|
138
|
+
}
|
|
139
|
+
switchState(name, autoPlay = true) {
|
|
140
|
+
const next = this.states.get(name) ?? null;
|
|
141
|
+
if (!next) {
|
|
142
|
+
return null;
|
|
143
|
+
}
|
|
144
|
+
if (this.activeState && this.activeState !== next) {
|
|
145
|
+
this.activeState.stop();
|
|
146
|
+
}
|
|
147
|
+
this.activeState = next;
|
|
148
|
+
if (autoPlay) {
|
|
149
|
+
next.play();
|
|
150
|
+
}
|
|
151
|
+
return next;
|
|
152
|
+
}
|
|
153
|
+
playState(name) {
|
|
154
|
+
const state = name ? this.switchState(name, false) : this.activeState;
|
|
155
|
+
if (!state) {
|
|
156
|
+
return false;
|
|
157
|
+
}
|
|
158
|
+
this.activeState = state;
|
|
159
|
+
state.play();
|
|
160
|
+
return true;
|
|
161
|
+
}
|
|
162
|
+
pauseState(name) {
|
|
163
|
+
const state = name ? this.states.get(name) : this.activeState;
|
|
164
|
+
if (!state) {
|
|
165
|
+
return false;
|
|
166
|
+
}
|
|
167
|
+
state.pause();
|
|
168
|
+
return true;
|
|
169
|
+
}
|
|
170
|
+
stopState(name) {
|
|
171
|
+
const state = name ? this.states.get(name) : this.activeState;
|
|
172
|
+
if (!state) {
|
|
173
|
+
return false;
|
|
174
|
+
}
|
|
175
|
+
state.stop();
|
|
176
|
+
if (!name || this.activeState?.name === name) {
|
|
177
|
+
this.activeState = null;
|
|
178
|
+
}
|
|
179
|
+
return true;
|
|
180
|
+
}
|
|
181
|
+
clear() {
|
|
182
|
+
this.stopState();
|
|
183
|
+
this.states.clear();
|
|
184
|
+
this.activeState = null;
|
|
185
|
+
}
|
|
186
|
+
};
|
|
187
|
+
__name(_AnimationStateManager, "AnimationStateManager");
|
|
188
|
+
var AnimationStateManager = _AnimationStateManager;
|
|
189
|
+
|
|
190
|
+
// core/components/Animation.ts
|
|
191
|
+
var _AnimationComponent = class _AnimationComponent extends Component {
|
|
192
|
+
constructor(options = {}) {
|
|
193
|
+
super();
|
|
194
|
+
this.modelClips = Array.isArray(options.clips) ? [...options.clips] : [];
|
|
195
|
+
this.importedClips = [];
|
|
196
|
+
this.clipById = /* @__PURE__ */ new Map();
|
|
197
|
+
this.clipEntriesById = /* @__PURE__ */ new Map();
|
|
198
|
+
this.clips = [];
|
|
199
|
+
this.clipCatalog = [];
|
|
200
|
+
this.availableClips = [];
|
|
201
|
+
this.externalClipSources = [];
|
|
202
|
+
this.setExternalClipSources(options.externalClipSources ?? []);
|
|
203
|
+
this.refreshClipCatalog();
|
|
204
|
+
this.paused = options.paused ?? false;
|
|
205
|
+
this.reverse = options.reverse ?? false;
|
|
206
|
+
this.timeScale = options.timeScale ?? 1;
|
|
207
|
+
this.crossFadeDuration = options.crossFadeDuration ?? 0;
|
|
208
|
+
this.stateManager = new AnimationStateManager();
|
|
209
|
+
this.states = this.stateManager.listStates();
|
|
210
|
+
this.active = this.stateManager.getActiveState();
|
|
211
|
+
this.activeStateName = this.active?.name ?? null;
|
|
212
|
+
if (Array.isArray(options.states) && options.states.length > 0) {
|
|
213
|
+
for (const entry of options.states) {
|
|
214
|
+
this.addState(entry.name, entry.clip, entry.loop ?? false);
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
if (typeof options.activeState === "string" && options.activeState.length > 0) {
|
|
218
|
+
this.switchState(options.activeState, !this.paused);
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
refreshClipCatalog() {
|
|
222
|
+
const catalog = [];
|
|
223
|
+
const nameCounts = /* @__PURE__ */ new Map();
|
|
224
|
+
const nextById = /* @__PURE__ */ new Map();
|
|
225
|
+
const nextEntriesById = /* @__PURE__ */ new Map();
|
|
226
|
+
for (const [index, clip] of this.modelClips.entries()) {
|
|
227
|
+
const name = typeof clip?.name === "string" && clip.name.length > 0 ? clip.name : `Clip ${index + 1}`;
|
|
228
|
+
const id = `model:${index}:${name}`;
|
|
229
|
+
const count = (nameCounts.get(name) ?? 0) + 1;
|
|
230
|
+
nameCounts.set(name, count);
|
|
231
|
+
const entry = {
|
|
232
|
+
id,
|
|
233
|
+
name,
|
|
234
|
+
label: count > 1 ? `${name} (${count})` : name,
|
|
235
|
+
clip,
|
|
236
|
+
source: "model",
|
|
237
|
+
sourceUrl: null
|
|
238
|
+
};
|
|
239
|
+
catalog.push(entry);
|
|
240
|
+
nextById.set(id, clip);
|
|
241
|
+
nextEntriesById.set(id, entry);
|
|
242
|
+
}
|
|
243
|
+
for (const [index, imported] of this.importedClips.entries()) {
|
|
244
|
+
const clip = imported.clip;
|
|
245
|
+
const name = typeof clip?.name === "string" && clip.name.length > 0 ? clip.name : `Clip ${index + 1}`;
|
|
246
|
+
const sourceUrl = imported.sourceUrl;
|
|
247
|
+
const id = `external:${index}:${name}`;
|
|
248
|
+
const count = (nameCounts.get(name) ?? 0) + 1;
|
|
249
|
+
nameCounts.set(name, count);
|
|
250
|
+
const sourceSuffix = sourceUrl ? sourceUrl.split("/").pop() ?? sourceUrl : "external";
|
|
251
|
+
const entry = {
|
|
252
|
+
id,
|
|
253
|
+
name,
|
|
254
|
+
label: count > 1 ? `${name} (${count}) \u2022 ${sourceSuffix}` : `${name} \u2022 ${sourceSuffix}`,
|
|
255
|
+
clip,
|
|
256
|
+
source: "external",
|
|
257
|
+
sourceUrl
|
|
258
|
+
};
|
|
259
|
+
catalog.push(entry);
|
|
260
|
+
nextById.set(id, clip);
|
|
261
|
+
nextEntriesById.set(id, entry);
|
|
262
|
+
}
|
|
263
|
+
this.clipById = nextById;
|
|
264
|
+
this.clipEntriesById = nextEntriesById;
|
|
265
|
+
this.clipCatalog = catalog;
|
|
266
|
+
this.clips = catalog.map((entry) => entry.clip);
|
|
267
|
+
this.availableClips = catalog.map((entry) => entry.name);
|
|
268
|
+
}
|
|
269
|
+
refreshStateRefs() {
|
|
270
|
+
this.states = this.stateManager.listStates();
|
|
271
|
+
this.active = this.stateManager.getActiveState();
|
|
272
|
+
this.activeStateName = this.active?.name ?? null;
|
|
273
|
+
}
|
|
274
|
+
resolveClipRef(clipRef) {
|
|
275
|
+
const trimmed = clipRef.trim();
|
|
276
|
+
if (!trimmed) {
|
|
277
|
+
return null;
|
|
278
|
+
}
|
|
279
|
+
const byId = this.clipById.get(trimmed);
|
|
280
|
+
if (byId) {
|
|
281
|
+
return { id: trimmed, clip: byId };
|
|
282
|
+
}
|
|
283
|
+
const byName = this.clipCatalog.find((entry) => entry.name === trimmed);
|
|
284
|
+
if (!byName) {
|
|
285
|
+
return null;
|
|
286
|
+
}
|
|
287
|
+
return { id: byName.id, clip: byName.clip };
|
|
288
|
+
}
|
|
289
|
+
setModelClips(clips) {
|
|
290
|
+
this.modelClips = Array.isArray(clips) ? [...clips] : [];
|
|
291
|
+
this.refreshClipCatalog();
|
|
292
|
+
}
|
|
293
|
+
setImportedClips(clips) {
|
|
294
|
+
if (!Array.isArray(clips)) {
|
|
295
|
+
this.importedClips = [];
|
|
296
|
+
this.refreshClipCatalog();
|
|
297
|
+
return;
|
|
298
|
+
}
|
|
299
|
+
this.importedClips = clips.map((entry) => {
|
|
300
|
+
if (entry instanceof THREE26__namespace.AnimationClip) {
|
|
301
|
+
return { clip: entry, sourceUrl: null };
|
|
302
|
+
}
|
|
303
|
+
if (!entry || typeof entry !== "object") {
|
|
304
|
+
return null;
|
|
305
|
+
}
|
|
306
|
+
const candidate = entry;
|
|
307
|
+
if (!(candidate.clip instanceof THREE26__namespace.AnimationClip)) {
|
|
308
|
+
return null;
|
|
309
|
+
}
|
|
310
|
+
return {
|
|
311
|
+
clip: candidate.clip,
|
|
312
|
+
sourceUrl: typeof candidate.sourceUrl === "string" && candidate.sourceUrl.length > 0 ? candidate.sourceUrl : null
|
|
313
|
+
};
|
|
314
|
+
}).filter((entry) => entry !== null);
|
|
315
|
+
this.refreshClipCatalog();
|
|
316
|
+
}
|
|
317
|
+
setExternalClipSources(sources) {
|
|
318
|
+
if (!Array.isArray(sources)) {
|
|
319
|
+
this.externalClipSources = [];
|
|
320
|
+
return;
|
|
321
|
+
}
|
|
322
|
+
const seen = /* @__PURE__ */ new Set();
|
|
323
|
+
const normalized = [];
|
|
324
|
+
for (const source of sources) {
|
|
325
|
+
if (typeof source !== "string") {
|
|
326
|
+
continue;
|
|
327
|
+
}
|
|
328
|
+
const trimmed = source.trim();
|
|
329
|
+
if (!trimmed || seen.has(trimmed)) {
|
|
330
|
+
continue;
|
|
331
|
+
}
|
|
332
|
+
seen.add(trimmed);
|
|
333
|
+
normalized.push(trimmed);
|
|
334
|
+
}
|
|
335
|
+
this.externalClipSources = normalized;
|
|
336
|
+
}
|
|
337
|
+
addState(name, clipRef, loop = false) {
|
|
338
|
+
if (!name.trim()) {
|
|
339
|
+
return null;
|
|
340
|
+
}
|
|
341
|
+
const resolved = this.resolveClipRef(clipRef);
|
|
342
|
+
if (!resolved) {
|
|
343
|
+
return null;
|
|
344
|
+
}
|
|
345
|
+
const state = this.stateManager.createState(name, resolved.clip, {}, loop, resolved.id);
|
|
346
|
+
this.refreshStateRefs();
|
|
347
|
+
return state;
|
|
348
|
+
}
|
|
349
|
+
setStates(states) {
|
|
350
|
+
const previousActive = this.activeStateName;
|
|
351
|
+
this.stateManager.clear();
|
|
352
|
+
for (const state of states) {
|
|
353
|
+
if (!state.name.trim()) {
|
|
354
|
+
continue;
|
|
355
|
+
}
|
|
356
|
+
let createdState = null;
|
|
357
|
+
if (typeof state.clipId === "string" && state.clipId.trim().length > 0) {
|
|
358
|
+
createdState = this.addState(state.name, state.clipId, Boolean(state.loop));
|
|
359
|
+
}
|
|
360
|
+
if (!createdState) {
|
|
361
|
+
this.addState(state.name, state.clip, Boolean(state.loop));
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
if (previousActive) {
|
|
365
|
+
this.stateManager.switchState(previousActive, !this.paused);
|
|
366
|
+
}
|
|
367
|
+
this.refreshStateRefs();
|
|
368
|
+
}
|
|
369
|
+
getStateConfigs() {
|
|
370
|
+
return this.states.map((state) => ({
|
|
371
|
+
name: state.name,
|
|
372
|
+
clip: state.clip.name,
|
|
373
|
+
clipId: state.clipId,
|
|
374
|
+
loop: state.loop
|
|
375
|
+
}));
|
|
376
|
+
}
|
|
377
|
+
setActiveState(name, autoPlay = true) {
|
|
378
|
+
if (!name) {
|
|
379
|
+
const stopped = this.stateManager.stopState();
|
|
380
|
+
this.paused = true;
|
|
381
|
+
this.refreshStateRefs();
|
|
382
|
+
return stopped;
|
|
383
|
+
}
|
|
384
|
+
return this.switchState(name, autoPlay);
|
|
385
|
+
}
|
|
386
|
+
removeState(name) {
|
|
387
|
+
const removed = this.stateManager.removeState(name);
|
|
388
|
+
if (removed) {
|
|
389
|
+
this.refreshStateRefs();
|
|
390
|
+
}
|
|
391
|
+
return removed;
|
|
392
|
+
}
|
|
393
|
+
switchState(name, autoPlay = true) {
|
|
394
|
+
const state = this.stateManager.switchState(name, autoPlay);
|
|
395
|
+
if (!state) {
|
|
396
|
+
return false;
|
|
397
|
+
}
|
|
398
|
+
this.paused = !state.isPlaying;
|
|
399
|
+
this.refreshStateRefs();
|
|
400
|
+
return true;
|
|
401
|
+
}
|
|
402
|
+
playState(name) {
|
|
403
|
+
const played = this.stateManager.playState(name);
|
|
404
|
+
if (!played) {
|
|
405
|
+
return false;
|
|
406
|
+
}
|
|
407
|
+
this.paused = false;
|
|
408
|
+
this.refreshStateRefs();
|
|
409
|
+
return true;
|
|
410
|
+
}
|
|
411
|
+
pauseState(name) {
|
|
412
|
+
const paused = this.stateManager.pauseState(name);
|
|
413
|
+
if (!paused) {
|
|
414
|
+
return false;
|
|
415
|
+
}
|
|
416
|
+
this.paused = true;
|
|
417
|
+
this.refreshStateRefs();
|
|
418
|
+
return true;
|
|
419
|
+
}
|
|
420
|
+
stopState(name) {
|
|
421
|
+
const stopped = this.stateManager.stopState(name);
|
|
422
|
+
if (!stopped) {
|
|
423
|
+
return false;
|
|
424
|
+
}
|
|
425
|
+
this.paused = true;
|
|
426
|
+
this.refreshStateRefs();
|
|
427
|
+
return true;
|
|
428
|
+
}
|
|
429
|
+
};
|
|
430
|
+
__name(_AnimationComponent, "AnimationComponent");
|
|
431
|
+
var AnimationComponent = _AnimationComponent;
|
|
432
|
+
|
|
433
|
+
// core/factories/components/AnimationFactory.ts
|
|
434
|
+
function createAnimationComponent(world, entityId, ...args) {
|
|
435
|
+
const component = new AnimationComponent(...args);
|
|
436
|
+
world.addComponent(entityId, component);
|
|
437
|
+
return component;
|
|
438
|
+
}
|
|
439
|
+
__name(createAnimationComponent, "createAnimationComponent");
|
|
440
|
+
|
|
441
|
+
// core/components/Audio.ts
|
|
442
|
+
var DEFAULT_AUDIO_OPTIONS = {
|
|
443
|
+
autoplay: false,
|
|
444
|
+
loop: false,
|
|
445
|
+
pitch: 1,
|
|
446
|
+
volume: 1,
|
|
447
|
+
positional: false,
|
|
448
|
+
refDistance: 1,
|
|
449
|
+
distanceModel: "inverse",
|
|
450
|
+
rolloffFactor: 1
|
|
451
|
+
};
|
|
452
|
+
var _AudioComponent = class _AudioComponent extends Component {
|
|
453
|
+
constructor(path, options = {}) {
|
|
454
|
+
super();
|
|
455
|
+
this.path = path;
|
|
456
|
+
this.options = {
|
|
457
|
+
...DEFAULT_AUDIO_OPTIONS,
|
|
458
|
+
...options
|
|
459
|
+
};
|
|
460
|
+
this.object = null;
|
|
461
|
+
this.audio = null;
|
|
462
|
+
Object.defineProperty(this, "isPlaying", {
|
|
463
|
+
value: false,
|
|
464
|
+
writable: true,
|
|
465
|
+
configurable: true,
|
|
466
|
+
enumerable: false
|
|
467
|
+
});
|
|
468
|
+
Object.defineProperty(this, "isPaused", {
|
|
469
|
+
value: false,
|
|
470
|
+
writable: true,
|
|
471
|
+
configurable: true,
|
|
472
|
+
enumerable: false
|
|
473
|
+
});
|
|
474
|
+
}
|
|
475
|
+
/**
|
|
476
|
+
* Signals `AudioSystem` to start (or resume) playback.
|
|
477
|
+
* Has no direct effect in the editor — `AudioSystem` drives the actual
|
|
478
|
+
* THREE.js call in preview.
|
|
479
|
+
*/
|
|
480
|
+
play() {
|
|
481
|
+
this.isPlaying = true;
|
|
482
|
+
this.isPaused = false;
|
|
483
|
+
}
|
|
484
|
+
/**
|
|
485
|
+
* Signals `AudioSystem` to pause playback, preserving the current position.
|
|
486
|
+
* Calling {@link play} afterwards resumes from where it paused.
|
|
487
|
+
* No-op if not currently playing.
|
|
488
|
+
*/
|
|
489
|
+
pause() {
|
|
490
|
+
if (!this.isPlaying) return;
|
|
491
|
+
this.isPlaying = false;
|
|
492
|
+
this.isPaused = true;
|
|
493
|
+
}
|
|
494
|
+
/**
|
|
495
|
+
* Signals `AudioSystem` to stop playback and reset the playback position.
|
|
496
|
+
*/
|
|
497
|
+
stop() {
|
|
498
|
+
this.isPlaying = false;
|
|
499
|
+
this.isPaused = false;
|
|
500
|
+
}
|
|
501
|
+
};
|
|
502
|
+
__name(_AudioComponent, "AudioComponent");
|
|
503
|
+
var AudioComponent = _AudioComponent;
|
|
504
|
+
|
|
505
|
+
// core/factories/components/AudioComponentFactory.ts
|
|
506
|
+
function normalizeDistanceModel(distanceModel) {
|
|
507
|
+
const normalized = distanceModel.trim().toLowerCase();
|
|
508
|
+
if (normalized === "linear" || normalized === "exponential") {
|
|
509
|
+
return normalized;
|
|
510
|
+
}
|
|
511
|
+
return "inverse";
|
|
512
|
+
}
|
|
513
|
+
__name(normalizeDistanceModel, "normalizeDistanceModel");
|
|
514
|
+
function createConfiguredAudio(listener, options) {
|
|
515
|
+
const sound = options.positional ? new THREE26__namespace.PositionalAudio(listener) : new THREE26__namespace.Audio(listener);
|
|
516
|
+
sound.setLoop(options.loop);
|
|
517
|
+
sound.setVolume(options.volume);
|
|
518
|
+
sound.setPlaybackRate(options.pitch);
|
|
519
|
+
if (sound instanceof THREE26__namespace.PositionalAudio) {
|
|
520
|
+
sound.setRefDistance(options.refDistance);
|
|
521
|
+
sound.setDistanceModel(normalizeDistanceModel(options.distanceModel));
|
|
522
|
+
sound.setRolloffFactor(options.rolloffFactor);
|
|
523
|
+
}
|
|
524
|
+
return sound;
|
|
525
|
+
}
|
|
526
|
+
__name(createConfiguredAudio, "createConfiguredAudio");
|
|
527
|
+
function createAudioEditorHelper() {
|
|
528
|
+
if (typeof document === "undefined") {
|
|
529
|
+
const geometry = new THREE26__namespace.EdgesGeometry(
|
|
530
|
+
new THREE26__namespace.OctahedronGeometry(0.22, 0)
|
|
531
|
+
);
|
|
532
|
+
const material2 = new THREE26__namespace.LineBasicMaterial({
|
|
533
|
+
color: "#8bc8ff",
|
|
534
|
+
transparent: true,
|
|
535
|
+
opacity: 0.95,
|
|
536
|
+
depthTest: false
|
|
537
|
+
});
|
|
538
|
+
const fallback = new THREE26__namespace.LineSegments(geometry, material2);
|
|
539
|
+
fallback.renderOrder = 10;
|
|
540
|
+
fallback.userData.ecsHelper = true;
|
|
541
|
+
fallback.visible = false;
|
|
542
|
+
return fallback;
|
|
543
|
+
}
|
|
544
|
+
const size = 96;
|
|
545
|
+
const canvas = document.createElement("canvas");
|
|
546
|
+
canvas.width = size;
|
|
547
|
+
canvas.height = size;
|
|
548
|
+
const ctx = canvas.getContext("2d");
|
|
549
|
+
if (!ctx) {
|
|
550
|
+
return new THREE26__namespace.Object3D();
|
|
551
|
+
}
|
|
552
|
+
ctx.clearRect(0, 0, size, size);
|
|
553
|
+
ctx.fillStyle = "rgba(27, 35, 52, 0.9)";
|
|
554
|
+
ctx.beginPath();
|
|
555
|
+
ctx.arc(size / 2, size / 2, 36, 0, Math.PI * 2);
|
|
556
|
+
ctx.fill();
|
|
557
|
+
ctx.strokeStyle = "rgba(137, 202, 255, 0.9)";
|
|
558
|
+
ctx.lineWidth = 4;
|
|
559
|
+
ctx.beginPath();
|
|
560
|
+
ctx.arc(size / 2, size / 2, 36, 0, Math.PI * 2);
|
|
561
|
+
ctx.stroke();
|
|
562
|
+
ctx.fillStyle = "#d9ecff";
|
|
563
|
+
ctx.beginPath();
|
|
564
|
+
ctx.moveTo(33, 56);
|
|
565
|
+
ctx.lineTo(43, 56);
|
|
566
|
+
ctx.lineTo(54, 66);
|
|
567
|
+
ctx.lineTo(54, 30);
|
|
568
|
+
ctx.lineTo(43, 40);
|
|
569
|
+
ctx.lineTo(33, 40);
|
|
570
|
+
ctx.closePath();
|
|
571
|
+
ctx.fill();
|
|
572
|
+
ctx.strokeStyle = "#7fd2ff";
|
|
573
|
+
ctx.lineWidth = 4;
|
|
574
|
+
ctx.lineCap = "round";
|
|
575
|
+
ctx.beginPath();
|
|
576
|
+
ctx.arc(56, 48, 10, -0.8, 0.8);
|
|
577
|
+
ctx.stroke();
|
|
578
|
+
ctx.beginPath();
|
|
579
|
+
ctx.arc(56, 48, 16, -0.8, 0.8);
|
|
580
|
+
ctx.stroke();
|
|
581
|
+
const texture = new THREE26__namespace.CanvasTexture(canvas);
|
|
582
|
+
texture.needsUpdate = true;
|
|
583
|
+
const material = new THREE26__namespace.SpriteMaterial({
|
|
584
|
+
map: texture,
|
|
585
|
+
transparent: true,
|
|
586
|
+
depthTest: false
|
|
587
|
+
});
|
|
588
|
+
const helper = new THREE26__namespace.Sprite(material);
|
|
589
|
+
helper.scale.set(0.68, 0.68, 0.68);
|
|
590
|
+
helper.renderOrder = 10;
|
|
591
|
+
helper.userData.ecsHelper = true;
|
|
592
|
+
helper.visible = false;
|
|
593
|
+
return helper;
|
|
594
|
+
}
|
|
595
|
+
__name(createAudioEditorHelper, "createAudioEditorHelper");
|
|
596
|
+
function createAudioComponent(world, entityId, path = "", options = {}, context) {
|
|
597
|
+
const component = new AudioComponent(path, options);
|
|
598
|
+
const anchor = context?.object ?? null;
|
|
599
|
+
const listener = context?.listener ?? null;
|
|
600
|
+
if (anchor && listener) {
|
|
601
|
+
component.object = anchor;
|
|
602
|
+
const sound = createConfiguredAudio(listener, component.options);
|
|
603
|
+
if (context?.isEditor) {
|
|
604
|
+
anchor.add(createAudioEditorHelper());
|
|
605
|
+
}
|
|
606
|
+
anchor.add(sound);
|
|
607
|
+
component.audio = sound;
|
|
608
|
+
}
|
|
609
|
+
world.addComponent(entityId, component);
|
|
610
|
+
return component;
|
|
611
|
+
}
|
|
612
|
+
__name(createAudioComponent, "createAudioComponent");
|
|
613
|
+
var DEFAULT_FOV = 50;
|
|
614
|
+
var DEFAULT_NEAR = 0.1;
|
|
615
|
+
var DEFAULT_FAR = 2e3;
|
|
616
|
+
var DEFAULT_ORTHO_LEFT = -5;
|
|
617
|
+
var DEFAULT_ORTHO_RIGHT = 5;
|
|
618
|
+
var DEFAULT_ORTHO_TOP = 5;
|
|
619
|
+
var DEFAULT_ORTHO_BOTTOM = -5;
|
|
620
|
+
var DEFAULT_ZOOM = 1;
|
|
621
|
+
function inferProjection(camera) {
|
|
622
|
+
if (camera instanceof THREE26__namespace.OrthographicCamera) {
|
|
623
|
+
return "orthographic";
|
|
624
|
+
}
|
|
625
|
+
return "perspective";
|
|
626
|
+
}
|
|
627
|
+
__name(inferProjection, "inferProjection");
|
|
628
|
+
function readCameraNear(camera) {
|
|
629
|
+
if (camera && "near" in camera && typeof camera.near === "number" && Number.isFinite(camera.near)) {
|
|
630
|
+
return camera.near;
|
|
631
|
+
}
|
|
632
|
+
return null;
|
|
633
|
+
}
|
|
634
|
+
__name(readCameraNear, "readCameraNear");
|
|
635
|
+
function readCameraFar(camera) {
|
|
636
|
+
if (camera && "far" in camera && typeof camera.far === "number" && Number.isFinite(camera.far)) {
|
|
637
|
+
return camera.far;
|
|
638
|
+
}
|
|
639
|
+
return null;
|
|
640
|
+
}
|
|
641
|
+
__name(readCameraFar, "readCameraFar");
|
|
642
|
+
function inferFov(camera) {
|
|
643
|
+
if (camera instanceof THREE26__namespace.PerspectiveCamera && Number.isFinite(camera.fov)) {
|
|
644
|
+
return camera.fov;
|
|
645
|
+
}
|
|
646
|
+
return DEFAULT_FOV;
|
|
647
|
+
}
|
|
648
|
+
__name(inferFov, "inferFov");
|
|
649
|
+
function inferNear(camera) {
|
|
650
|
+
const near = readCameraNear(camera);
|
|
651
|
+
if (near !== null) {
|
|
652
|
+
return near;
|
|
653
|
+
}
|
|
654
|
+
return DEFAULT_NEAR;
|
|
655
|
+
}
|
|
656
|
+
__name(inferNear, "inferNear");
|
|
657
|
+
function inferFar(camera) {
|
|
658
|
+
const far = readCameraFar(camera);
|
|
659
|
+
if (far !== null) {
|
|
660
|
+
return far;
|
|
661
|
+
}
|
|
662
|
+
return DEFAULT_FAR;
|
|
663
|
+
}
|
|
664
|
+
__name(inferFar, "inferFar");
|
|
665
|
+
function inferOrthoLeft(camera) {
|
|
666
|
+
if (camera instanceof THREE26__namespace.OrthographicCamera && Number.isFinite(camera.left)) {
|
|
667
|
+
return camera.left;
|
|
668
|
+
}
|
|
669
|
+
return DEFAULT_ORTHO_LEFT;
|
|
670
|
+
}
|
|
671
|
+
__name(inferOrthoLeft, "inferOrthoLeft");
|
|
672
|
+
function inferOrthoRight(camera) {
|
|
673
|
+
if (camera instanceof THREE26__namespace.OrthographicCamera && Number.isFinite(camera.right)) {
|
|
674
|
+
return camera.right;
|
|
675
|
+
}
|
|
676
|
+
return DEFAULT_ORTHO_RIGHT;
|
|
677
|
+
}
|
|
678
|
+
__name(inferOrthoRight, "inferOrthoRight");
|
|
679
|
+
function inferOrthoTop(camera) {
|
|
680
|
+
if (camera instanceof THREE26__namespace.OrthographicCamera && Number.isFinite(camera.top)) {
|
|
681
|
+
return camera.top;
|
|
682
|
+
}
|
|
683
|
+
return DEFAULT_ORTHO_TOP;
|
|
684
|
+
}
|
|
685
|
+
__name(inferOrthoTop, "inferOrthoTop");
|
|
686
|
+
function inferOrthoBottom(camera) {
|
|
687
|
+
if (camera instanceof THREE26__namespace.OrthographicCamera && Number.isFinite(camera.bottom)) {
|
|
688
|
+
return camera.bottom;
|
|
689
|
+
}
|
|
690
|
+
return DEFAULT_ORTHO_BOTTOM;
|
|
691
|
+
}
|
|
692
|
+
__name(inferOrthoBottom, "inferOrthoBottom");
|
|
693
|
+
function inferZoom(camera) {
|
|
694
|
+
if (camera && "zoom" in camera && typeof camera.zoom === "number" && Number.isFinite(camera.zoom)) {
|
|
695
|
+
return camera.zoom;
|
|
696
|
+
}
|
|
697
|
+
return DEFAULT_ZOOM;
|
|
698
|
+
}
|
|
699
|
+
__name(inferZoom, "inferZoom");
|
|
700
|
+
var _CameraComponent = class _CameraComponent extends Component {
|
|
701
|
+
constructor(payload = {}) {
|
|
702
|
+
super();
|
|
703
|
+
this.camera = payload.camera ?? new THREE26__namespace.PerspectiveCamera();
|
|
704
|
+
this.type = payload.type ?? "3d";
|
|
705
|
+
this.isDefault = typeof payload.isDefault === "boolean" ? payload.isDefault : false;
|
|
706
|
+
this.projection = payload.projection ?? inferProjection(payload.camera);
|
|
707
|
+
this.fov = typeof payload.fov === "number" && Number.isFinite(payload.fov) ? payload.fov : inferFov(payload.camera);
|
|
708
|
+
this.near = typeof payload.near === "number" && Number.isFinite(payload.near) ? payload.near : inferNear(payload.camera);
|
|
709
|
+
this.far = typeof payload.far === "number" && Number.isFinite(payload.far) ? payload.far : inferFar(payload.camera);
|
|
710
|
+
this.left = typeof payload.left === "number" && Number.isFinite(payload.left) ? payload.left : inferOrthoLeft(payload.camera);
|
|
711
|
+
this.right = typeof payload.right === "number" && Number.isFinite(payload.right) ? payload.right : inferOrthoRight(payload.camera);
|
|
712
|
+
this.top = typeof payload.top === "number" && Number.isFinite(payload.top) ? payload.top : inferOrthoTop(payload.camera);
|
|
713
|
+
this.bottom = typeof payload.bottom === "number" && Number.isFinite(payload.bottom) ? payload.bottom : inferOrthoBottom(payload.camera);
|
|
714
|
+
this.zoom = typeof payload.zoom === "number" && Number.isFinite(payload.zoom) ? payload.zoom : inferZoom(payload.camera);
|
|
715
|
+
}
|
|
716
|
+
};
|
|
717
|
+
__name(_CameraComponent, "CameraComponent");
|
|
718
|
+
var CameraComponent = _CameraComponent;
|
|
719
|
+
|
|
720
|
+
// core/components/Object3DRef.ts
|
|
721
|
+
var _Object3DRef = class _Object3DRef extends Component {
|
|
722
|
+
constructor(object, visibility) {
|
|
723
|
+
super();
|
|
724
|
+
this.object = object;
|
|
725
|
+
this.visibility = typeof visibility === "boolean" ? visibility : Boolean(object.visible);
|
|
726
|
+
}
|
|
727
|
+
};
|
|
728
|
+
__name(_Object3DRef, "Object3DRef");
|
|
729
|
+
var Object3DRef = _Object3DRef;
|
|
730
|
+
|
|
731
|
+
// core/factories/components/CameraFactory.ts
|
|
732
|
+
function createCameraComponent(world, entityId, payload = {}) {
|
|
733
|
+
const object = world.getComponent(entityId, Object3DRef)?.object;
|
|
734
|
+
const objectCamera = object instanceof THREE26__namespace.Camera ? object : void 0;
|
|
735
|
+
const component = new CameraComponent({
|
|
736
|
+
...payload,
|
|
737
|
+
camera: payload.camera ?? objectCamera
|
|
738
|
+
});
|
|
739
|
+
world.addComponent(entityId, component);
|
|
740
|
+
return component;
|
|
741
|
+
}
|
|
742
|
+
__name(createCameraComponent, "createCameraComponent");
|
|
743
|
+
|
|
744
|
+
// core/components/Physics.ts
|
|
745
|
+
var DEFAULT_RIGIDBODY_STATE = {
|
|
746
|
+
enabled: true,
|
|
747
|
+
type: "dynamic",
|
|
748
|
+
mass: 1,
|
|
749
|
+
linearDamping: 0,
|
|
750
|
+
angularDamping: 0,
|
|
751
|
+
gravityScale: 1,
|
|
752
|
+
canSleep: true,
|
|
753
|
+
ccdEnabled: false,
|
|
754
|
+
lockTranslations: false,
|
|
755
|
+
lockRotations: false};
|
|
756
|
+
var DEFAULT_COLLIDER_STATE = {
|
|
757
|
+
enabled: true,
|
|
758
|
+
shape: "cuboid",
|
|
759
|
+
offsetPosition: {
|
|
760
|
+
x: 0,
|
|
761
|
+
y: 0,
|
|
762
|
+
z: 0
|
|
763
|
+
},
|
|
764
|
+
offsetRotation: {
|
|
765
|
+
x: 0,
|
|
766
|
+
y: 0,
|
|
767
|
+
z: 0
|
|
768
|
+
},
|
|
769
|
+
size: {
|
|
770
|
+
x: 1,
|
|
771
|
+
y: 1,
|
|
772
|
+
z: 1
|
|
773
|
+
},
|
|
774
|
+
radius: 0.5,
|
|
775
|
+
height: 1,
|
|
776
|
+
restitution: 0,
|
|
777
|
+
friction: 0.5,
|
|
778
|
+
isSensor: false
|
|
779
|
+
};
|
|
780
|
+
function asRecord(value) {
|
|
781
|
+
if (!value || typeof value !== "object") {
|
|
782
|
+
return null;
|
|
783
|
+
}
|
|
784
|
+
return value;
|
|
785
|
+
}
|
|
786
|
+
__name(asRecord, "asRecord");
|
|
787
|
+
function toFiniteNumber(value, fallback) {
|
|
788
|
+
if (typeof value !== "number" || !Number.isFinite(value)) {
|
|
789
|
+
return fallback;
|
|
790
|
+
}
|
|
791
|
+
return value;
|
|
792
|
+
}
|
|
793
|
+
__name(toFiniteNumber, "toFiniteNumber");
|
|
794
|
+
function toBoolean(value, fallback) {
|
|
795
|
+
if (typeof value !== "boolean") {
|
|
796
|
+
return fallback;
|
|
797
|
+
}
|
|
798
|
+
return value;
|
|
799
|
+
}
|
|
800
|
+
__name(toBoolean, "toBoolean");
|
|
801
|
+
function toRigidbodyType(value, fallback) {
|
|
802
|
+
if (value === "dynamic" || value === "fixed" || value === "kinematicPosition" || value === "kinematicVelocity") {
|
|
803
|
+
return value;
|
|
804
|
+
}
|
|
805
|
+
return fallback;
|
|
806
|
+
}
|
|
807
|
+
__name(toRigidbodyType, "toRigidbodyType");
|
|
808
|
+
function toColliderShape(value, fallback) {
|
|
809
|
+
if (value === "cuboid" || value === "ball" || value === "capsule" || value === "cylinder" || value === "trimesh") {
|
|
810
|
+
return value;
|
|
811
|
+
}
|
|
812
|
+
return fallback;
|
|
813
|
+
}
|
|
814
|
+
__name(toColliderShape, "toColliderShape");
|
|
815
|
+
function normalizeRigidbodyState(value) {
|
|
816
|
+
const source = asRecord(value);
|
|
817
|
+
const defaults = DEFAULT_RIGIDBODY_STATE;
|
|
818
|
+
const legacyLockTranslations = toBoolean(
|
|
819
|
+
source?.lockTranslations,
|
|
820
|
+
defaults.lockTranslations
|
|
821
|
+
);
|
|
822
|
+
const legacyLockRotations = toBoolean(
|
|
823
|
+
source?.lockRotations,
|
|
824
|
+
defaults.lockRotations
|
|
825
|
+
);
|
|
826
|
+
const lockTranslationX = toBoolean(
|
|
827
|
+
source?.lockTranslationX,
|
|
828
|
+
legacyLockTranslations
|
|
829
|
+
);
|
|
830
|
+
const lockTranslationY = toBoolean(
|
|
831
|
+
source?.lockTranslationY,
|
|
832
|
+
legacyLockTranslations
|
|
833
|
+
);
|
|
834
|
+
const lockTranslationZ = toBoolean(
|
|
835
|
+
source?.lockTranslationZ,
|
|
836
|
+
legacyLockTranslations
|
|
837
|
+
);
|
|
838
|
+
const lockRotationX = toBoolean(source?.lockRotationX, legacyLockRotations);
|
|
839
|
+
const lockRotationY = toBoolean(source?.lockRotationY, legacyLockRotations);
|
|
840
|
+
const lockRotationZ = toBoolean(source?.lockRotationZ, legacyLockRotations);
|
|
841
|
+
return {
|
|
842
|
+
enabled: toBoolean(source?.enabled, defaults.enabled),
|
|
843
|
+
type: toRigidbodyType(source?.type, defaults.type),
|
|
844
|
+
mass: Math.max(1e-4, toFiniteNumber(source?.mass, defaults.mass)),
|
|
845
|
+
linearDamping: Math.max(
|
|
846
|
+
0,
|
|
847
|
+
toFiniteNumber(source?.linearDamping, defaults.linearDamping)
|
|
848
|
+
),
|
|
849
|
+
angularDamping: Math.max(
|
|
850
|
+
0,
|
|
851
|
+
toFiniteNumber(source?.angularDamping, defaults.angularDamping)
|
|
852
|
+
),
|
|
853
|
+
gravityScale: toFiniteNumber(source?.gravityScale, defaults.gravityScale),
|
|
854
|
+
canSleep: toBoolean(source?.canSleep, defaults.canSleep),
|
|
855
|
+
ccdEnabled: toBoolean(source?.ccdEnabled, defaults.ccdEnabled),
|
|
856
|
+
lockTranslations: legacyLockTranslations,
|
|
857
|
+
lockTranslationX,
|
|
858
|
+
lockTranslationY,
|
|
859
|
+
lockTranslationZ,
|
|
860
|
+
lockRotations: legacyLockRotations,
|
|
861
|
+
lockRotationX,
|
|
862
|
+
lockRotationY,
|
|
863
|
+
lockRotationZ
|
|
864
|
+
};
|
|
865
|
+
}
|
|
866
|
+
__name(normalizeRigidbodyState, "normalizeRigidbodyState");
|
|
867
|
+
function normalizeColliderState(value) {
|
|
868
|
+
const source = asRecord(value);
|
|
869
|
+
const defaults = DEFAULT_COLLIDER_STATE;
|
|
870
|
+
const offsetPosition = asRecord(source?.offsetPosition);
|
|
871
|
+
const offsetRotation = asRecord(source?.offsetRotation);
|
|
872
|
+
const size = asRecord(source?.size);
|
|
873
|
+
return {
|
|
874
|
+
enabled: toBoolean(source?.enabled, defaults.enabled),
|
|
875
|
+
shape: toColliderShape(source?.shape, defaults.shape),
|
|
876
|
+
offsetPosition: {
|
|
877
|
+
x: toFiniteNumber(offsetPosition?.x, defaults.offsetPosition.x),
|
|
878
|
+
y: toFiniteNumber(offsetPosition?.y, defaults.offsetPosition.y),
|
|
879
|
+
z: toFiniteNumber(offsetPosition?.z, defaults.offsetPosition.z)
|
|
880
|
+
},
|
|
881
|
+
offsetRotation: {
|
|
882
|
+
x: toFiniteNumber(offsetRotation?.x, defaults.offsetRotation.x),
|
|
883
|
+
y: toFiniteNumber(offsetRotation?.y, defaults.offsetRotation.y),
|
|
884
|
+
z: toFiniteNumber(offsetRotation?.z, defaults.offsetRotation.z)
|
|
885
|
+
},
|
|
886
|
+
size: {
|
|
887
|
+
x: Math.max(1e-4, toFiniteNumber(size?.x, defaults.size.x)),
|
|
888
|
+
y: Math.max(1e-4, toFiniteNumber(size?.y, defaults.size.y)),
|
|
889
|
+
z: Math.max(1e-4, toFiniteNumber(size?.z, defaults.size.z))
|
|
890
|
+
},
|
|
891
|
+
radius: Math.max(1e-4, toFiniteNumber(source?.radius, defaults.radius)),
|
|
892
|
+
height: Math.max(1e-4, toFiniteNumber(source?.height, defaults.height)),
|
|
893
|
+
restitution: Math.max(0, toFiniteNumber(source?.restitution, defaults.restitution)),
|
|
894
|
+
friction: Math.max(0, toFiniteNumber(source?.friction, defaults.friction)),
|
|
895
|
+
isSensor: toBoolean(source?.isSensor, defaults.isSensor)
|
|
896
|
+
};
|
|
897
|
+
}
|
|
898
|
+
__name(normalizeColliderState, "normalizeColliderState");
|
|
899
|
+
function normalizePhysicsState(value) {
|
|
900
|
+
const source = asRecord(value);
|
|
901
|
+
return {
|
|
902
|
+
rigidbody: normalizeRigidbodyState(
|
|
903
|
+
source?.rigidbody ?? void 0
|
|
904
|
+
),
|
|
905
|
+
collider: normalizeColliderState(
|
|
906
|
+
source?.collider ?? void 0
|
|
907
|
+
)
|
|
908
|
+
};
|
|
909
|
+
}
|
|
910
|
+
__name(normalizePhysicsState, "normalizePhysicsState");
|
|
911
|
+
var _PhysicsComponent = class _PhysicsComponent extends Component {
|
|
912
|
+
constructor(values) {
|
|
913
|
+
super();
|
|
914
|
+
this.values = normalizePhysicsState(values);
|
|
915
|
+
this.rigidBody = null;
|
|
916
|
+
this.collider = null;
|
|
917
|
+
}
|
|
918
|
+
/**
|
|
919
|
+
* Patch rigidbody and/or collider state. Each sub-object is deep-merged
|
|
920
|
+
* with the current values via the respective normalizer.
|
|
921
|
+
*/
|
|
922
|
+
setValues(patch) {
|
|
923
|
+
this.values = normalizePhysicsState({
|
|
924
|
+
rigidbody: { ...this.values.rigidbody, ...patch.rigidbody ?? {} },
|
|
925
|
+
collider: { ...this.values.collider, ...patch.collider ?? {} }
|
|
926
|
+
});
|
|
927
|
+
}
|
|
928
|
+
};
|
|
929
|
+
__name(_PhysicsComponent, "PhysicsComponent");
|
|
930
|
+
var PhysicsComponent = _PhysicsComponent;
|
|
931
|
+
|
|
932
|
+
// core/factories/components/PhysicsFactory.ts
|
|
933
|
+
function createPhysicsComponent(world, entityId, values) {
|
|
934
|
+
const component = new PhysicsComponent(values);
|
|
935
|
+
world.addComponent(entityId, component);
|
|
936
|
+
return component;
|
|
937
|
+
}
|
|
938
|
+
__name(createPhysicsComponent, "createPhysicsComponent");
|
|
939
|
+
|
|
940
|
+
// core/components/Environment.ts
|
|
941
|
+
var DEFAULT_ENVIRONMENT_STATE = {
|
|
942
|
+
skybox: {
|
|
943
|
+
type: "none",
|
|
944
|
+
color: "#1e1e1e",
|
|
945
|
+
imageUrl: "",
|
|
946
|
+
gradient: {
|
|
947
|
+
colors: ["#464766", "#657ea6", "#0f0e1a"],
|
|
948
|
+
effect: "linear"
|
|
949
|
+
}
|
|
950
|
+
},
|
|
951
|
+
fog: {
|
|
952
|
+
type: "none",
|
|
953
|
+
color: "#1e1e1e",
|
|
954
|
+
linear: {
|
|
955
|
+
near: 1,
|
|
956
|
+
far: 100
|
|
957
|
+
},
|
|
958
|
+
exponential: {
|
|
959
|
+
density: 2e-3
|
|
960
|
+
}
|
|
961
|
+
},
|
|
962
|
+
gravity: {
|
|
963
|
+
x: 0,
|
|
964
|
+
y: -9.81,
|
|
965
|
+
z: 0
|
|
966
|
+
},
|
|
967
|
+
fixedTimeStep: 0.02
|
|
968
|
+
};
|
|
969
|
+
function normalizeColors(colors) {
|
|
970
|
+
if (!Array.isArray(colors)) {
|
|
971
|
+
return [...DEFAULT_ENVIRONMENT_STATE.skybox.gradient.colors];
|
|
972
|
+
}
|
|
973
|
+
const normalized = colors.filter(
|
|
974
|
+
(entry) => typeof entry === "string" && entry.length > 0
|
|
975
|
+
);
|
|
976
|
+
if (normalized.length === 0) {
|
|
977
|
+
return [...DEFAULT_ENVIRONMENT_STATE.skybox.gradient.colors];
|
|
978
|
+
}
|
|
979
|
+
return normalized;
|
|
980
|
+
}
|
|
981
|
+
__name(normalizeColors, "normalizeColors");
|
|
982
|
+
function normalizeGradientEffect(value) {
|
|
983
|
+
if (value === "radial" || value === "linear" || value === "angular") {
|
|
984
|
+
return value;
|
|
985
|
+
}
|
|
986
|
+
return DEFAULT_ENVIRONMENT_STATE.skybox.gradient.effect;
|
|
987
|
+
}
|
|
988
|
+
__name(normalizeGradientEffect, "normalizeGradientEffect");
|
|
989
|
+
function normalizeSkyboxType(value) {
|
|
990
|
+
if (value === "gradient" || value === "color" || value === "none") {
|
|
991
|
+
return value;
|
|
992
|
+
}
|
|
993
|
+
if (value === "image" || value === "Image") {
|
|
994
|
+
return "image";
|
|
995
|
+
}
|
|
996
|
+
return DEFAULT_ENVIRONMENT_STATE.skybox.type;
|
|
997
|
+
}
|
|
998
|
+
__name(normalizeSkyboxType, "normalizeSkyboxType");
|
|
999
|
+
function normalizeFogType(value) {
|
|
1000
|
+
if (value === "linear" || value === "exponential" || value === "none") {
|
|
1001
|
+
return value;
|
|
1002
|
+
}
|
|
1003
|
+
return DEFAULT_ENVIRONMENT_STATE.fog.type;
|
|
1004
|
+
}
|
|
1005
|
+
__name(normalizeFogType, "normalizeFogType");
|
|
1006
|
+
function toFiniteNumber2(value, fallback) {
|
|
1007
|
+
if (typeof value !== "number" || !Number.isFinite(value)) {
|
|
1008
|
+
return fallback;
|
|
1009
|
+
}
|
|
1010
|
+
return value;
|
|
1011
|
+
}
|
|
1012
|
+
__name(toFiniteNumber2, "toFiniteNumber");
|
|
1013
|
+
var _Environment = class _Environment extends Component {
|
|
1014
|
+
constructor(values) {
|
|
1015
|
+
super();
|
|
1016
|
+
const skybox = values?.skybox;
|
|
1017
|
+
const fog = values?.fog;
|
|
1018
|
+
const gravity = values?.gravity;
|
|
1019
|
+
this.values = {
|
|
1020
|
+
skybox: {
|
|
1021
|
+
type: normalizeSkyboxType(skybox?.type),
|
|
1022
|
+
color: typeof skybox?.color === "string" ? skybox.color : DEFAULT_ENVIRONMENT_STATE.skybox.color,
|
|
1023
|
+
imageUrl: typeof skybox?.imageUrl === "string" ? skybox.imageUrl : DEFAULT_ENVIRONMENT_STATE.skybox.imageUrl,
|
|
1024
|
+
gradient: {
|
|
1025
|
+
colors: normalizeColors(skybox?.gradient?.colors),
|
|
1026
|
+
effect: normalizeGradientEffect(skybox?.gradient?.effect)
|
|
1027
|
+
}
|
|
1028
|
+
},
|
|
1029
|
+
fog: {
|
|
1030
|
+
type: normalizeFogType(fog?.type),
|
|
1031
|
+
color: typeof fog?.color === "string" ? fog.color : DEFAULT_ENVIRONMENT_STATE.fog.color,
|
|
1032
|
+
linear: {
|
|
1033
|
+
near: toFiniteNumber2(
|
|
1034
|
+
fog?.linear?.near,
|
|
1035
|
+
DEFAULT_ENVIRONMENT_STATE.fog.linear.near
|
|
1036
|
+
),
|
|
1037
|
+
far: toFiniteNumber2(
|
|
1038
|
+
fog?.linear?.far,
|
|
1039
|
+
DEFAULT_ENVIRONMENT_STATE.fog.linear.far
|
|
1040
|
+
)
|
|
1041
|
+
},
|
|
1042
|
+
exponential: {
|
|
1043
|
+
density: toFiniteNumber2(
|
|
1044
|
+
fog?.exponential?.density,
|
|
1045
|
+
DEFAULT_ENVIRONMENT_STATE.fog.exponential.density
|
|
1046
|
+
)
|
|
1047
|
+
}
|
|
1048
|
+
},
|
|
1049
|
+
gravity: {
|
|
1050
|
+
x: toFiniteNumber2(gravity?.x, DEFAULT_ENVIRONMENT_STATE.gravity.x),
|
|
1051
|
+
y: toFiniteNumber2(gravity?.y, DEFAULT_ENVIRONMENT_STATE.gravity.y),
|
|
1052
|
+
z: toFiniteNumber2(gravity?.z, DEFAULT_ENVIRONMENT_STATE.gravity.z)
|
|
1053
|
+
},
|
|
1054
|
+
fixedTimeStep: toFiniteNumber2(
|
|
1055
|
+
values?.fixedTimeStep,
|
|
1056
|
+
DEFAULT_ENVIRONMENT_STATE.fixedTimeStep
|
|
1057
|
+
)
|
|
1058
|
+
};
|
|
1059
|
+
}
|
|
1060
|
+
};
|
|
1061
|
+
__name(_Environment, "Environment");
|
|
1062
|
+
var Environment = _Environment;
|
|
1063
|
+
|
|
1064
|
+
// core/factories/components/EnvironmentFactory.ts
|
|
1065
|
+
function createEnvironmentComponent(world, entityId, values) {
|
|
1066
|
+
const component = new Environment(values);
|
|
1067
|
+
world.addComponent(entityId, component);
|
|
1068
|
+
return component;
|
|
1069
|
+
}
|
|
1070
|
+
__name(createEnvironmentComponent, "createEnvironmentComponent");
|
|
1071
|
+
|
|
1072
|
+
// core/components/EntityType.ts
|
|
1073
|
+
var _EntityType = class _EntityType extends Component {
|
|
1074
|
+
constructor(value) {
|
|
1075
|
+
super();
|
|
1076
|
+
this.value = value;
|
|
1077
|
+
}
|
|
1078
|
+
};
|
|
1079
|
+
__name(_EntityType, "EntityType");
|
|
1080
|
+
var EntityType = _EntityType;
|
|
1081
|
+
|
|
1082
|
+
// core/factories/components/EntityTypeFactory.ts
|
|
1083
|
+
function createEntityTypeComponent(world, entityId, ...args) {
|
|
1084
|
+
const component = new EntityType(...args);
|
|
1085
|
+
world.addComponent(entityId, component);
|
|
1086
|
+
return component;
|
|
1087
|
+
}
|
|
1088
|
+
__name(createEntityTypeComponent, "createEntityTypeComponent");
|
|
1089
|
+
|
|
1090
|
+
// core/components/Image.ts
|
|
1091
|
+
var _ImageComponent = class _ImageComponent extends Component {
|
|
1092
|
+
constructor(path, width = 1, height = 1) {
|
|
1093
|
+
super();
|
|
1094
|
+
this.path = path;
|
|
1095
|
+
this.width = width;
|
|
1096
|
+
this.height = height;
|
|
1097
|
+
this.texture = null;
|
|
1098
|
+
this.object = null;
|
|
1099
|
+
}
|
|
1100
|
+
};
|
|
1101
|
+
__name(_ImageComponent, "ImageComponent");
|
|
1102
|
+
var ImageComponent = _ImageComponent;
|
|
1103
|
+
|
|
1104
|
+
// core/factories/components/ImageComponentFactory.ts
|
|
1105
|
+
function createImageComponent(world, entityId, ...args) {
|
|
1106
|
+
const component = new ImageComponent(...args);
|
|
1107
|
+
world.addComponent(entityId, component);
|
|
1108
|
+
return component;
|
|
1109
|
+
}
|
|
1110
|
+
__name(createImageComponent, "createImageComponent");
|
|
1111
|
+
|
|
1112
|
+
// core/components/ImageTargetAnchor.ts
|
|
1113
|
+
var _ImageTargetAnchor = class _ImageTargetAnchor extends Component {
|
|
1114
|
+
constructor(options) {
|
|
1115
|
+
super();
|
|
1116
|
+
this.targetId = options?.targetId ?? null;
|
|
1117
|
+
this.targetUrl = options?.targetUrl;
|
|
1118
|
+
}
|
|
1119
|
+
};
|
|
1120
|
+
__name(_ImageTargetAnchor, "ImageTargetAnchor");
|
|
1121
|
+
var ImageTargetAnchor = _ImageTargetAnchor;
|
|
1122
|
+
|
|
1123
|
+
// core/factories/components/ImageTargetAnchorFactory.ts
|
|
1124
|
+
function createImageTargetAnchorComponent(world, entityId, ...args) {
|
|
1125
|
+
const component = new ImageTargetAnchor(...args);
|
|
1126
|
+
world.addComponent(entityId, component);
|
|
1127
|
+
return component;
|
|
1128
|
+
}
|
|
1129
|
+
__name(createImageTargetAnchorComponent, "createImageTargetAnchorComponent");
|
|
1130
|
+
|
|
1131
|
+
// core/components/ImageTarget.ts
|
|
1132
|
+
var _ImageTarget = class _ImageTarget extends Component {
|
|
1133
|
+
constructor(options, texture, object) {
|
|
1134
|
+
super();
|
|
1135
|
+
this.targets = options?.targets ?? [];
|
|
1136
|
+
this.compiledTargetUrl = options?.compiledTargetUrl;
|
|
1137
|
+
this.compiledTargetDir = options?.compiledTargetDir;
|
|
1138
|
+
this.texture = texture ?? null;
|
|
1139
|
+
this.object = object ?? null;
|
|
1140
|
+
}
|
|
1141
|
+
};
|
|
1142
|
+
__name(_ImageTarget, "ImageTarget");
|
|
1143
|
+
var ImageTarget = _ImageTarget;
|
|
1144
|
+
|
|
1145
|
+
// core/factories/components/ImageTargetFactory.ts
|
|
1146
|
+
function createImageTargetComponent(world, entityId, ...args) {
|
|
1147
|
+
const component = new ImageTarget(...args);
|
|
1148
|
+
world.addComponent(entityId, component);
|
|
1149
|
+
return component;
|
|
1150
|
+
}
|
|
1151
|
+
__name(createImageTargetComponent, "createImageTargetComponent");
|
|
1152
|
+
function toHexColor(value) {
|
|
1153
|
+
return `#${value.getHexString()}`;
|
|
1154
|
+
}
|
|
1155
|
+
__name(toHexColor, "toHexColor");
|
|
1156
|
+
function createValueState(light) {
|
|
1157
|
+
const base = {
|
|
1158
|
+
color: toHexColor(light.color),
|
|
1159
|
+
intensity: light.intensity,
|
|
1160
|
+
castShadow: light.castShadow ?? false,
|
|
1161
|
+
frustumCulling: light.frustumCulled
|
|
1162
|
+
};
|
|
1163
|
+
if (light instanceof THREE26__namespace.PointLight) {
|
|
1164
|
+
base.distance = light.distance;
|
|
1165
|
+
base.decay = light.decay;
|
|
1166
|
+
} else if (light instanceof THREE26__namespace.SpotLight) {
|
|
1167
|
+
base.distance = light.distance;
|
|
1168
|
+
base.decay = light.decay;
|
|
1169
|
+
base.angle = light.angle;
|
|
1170
|
+
base.penumbra = light.penumbra;
|
|
1171
|
+
} else if (light instanceof THREE26__namespace.RectAreaLight) {
|
|
1172
|
+
base.width = light.width;
|
|
1173
|
+
base.height = light.height;
|
|
1174
|
+
}
|
|
1175
|
+
return base;
|
|
1176
|
+
}
|
|
1177
|
+
__name(createValueState, "createValueState");
|
|
1178
|
+
var _LightComponent = class _LightComponent extends Component {
|
|
1179
|
+
constructor(light) {
|
|
1180
|
+
super();
|
|
1181
|
+
this.light = light;
|
|
1182
|
+
this.type = light.type;
|
|
1183
|
+
this.values = createValueState(light);
|
|
1184
|
+
}
|
|
1185
|
+
setValues(patch) {
|
|
1186
|
+
this.values = {
|
|
1187
|
+
...this.values,
|
|
1188
|
+
...patch
|
|
1189
|
+
};
|
|
1190
|
+
}
|
|
1191
|
+
};
|
|
1192
|
+
__name(_LightComponent, "LightComponent");
|
|
1193
|
+
var LightComponent = _LightComponent;
|
|
1194
|
+
|
|
1195
|
+
// core/factories/components/LightFactory.ts
|
|
1196
|
+
function createLightComponent(world, entityId, ...args) {
|
|
1197
|
+
const component = new LightComponent(...args);
|
|
1198
|
+
world.addComponent(entityId, component);
|
|
1199
|
+
return component;
|
|
1200
|
+
}
|
|
1201
|
+
__name(createLightComponent, "createLightComponent");
|
|
1202
|
+
function toHexColor2(value, fallback) {
|
|
1203
|
+
if (value && typeof value === "object" && typeof value.getHexString === "function") {
|
|
1204
|
+
try {
|
|
1205
|
+
return `#${value.getHexString()}`;
|
|
1206
|
+
} catch {
|
|
1207
|
+
return fallback;
|
|
1208
|
+
}
|
|
1209
|
+
}
|
|
1210
|
+
return fallback;
|
|
1211
|
+
}
|
|
1212
|
+
__name(toHexColor2, "toHexColor");
|
|
1213
|
+
function getMaterialType(material) {
|
|
1214
|
+
if (material instanceof THREE26__namespace.MeshPhysicalMaterial) {
|
|
1215
|
+
return "physical";
|
|
1216
|
+
}
|
|
1217
|
+
if (material instanceof THREE26__namespace.MeshPhongMaterial) {
|
|
1218
|
+
return "phong";
|
|
1219
|
+
}
|
|
1220
|
+
if (material instanceof THREE26__namespace.MeshBasicMaterial) {
|
|
1221
|
+
return "basic";
|
|
1222
|
+
}
|
|
1223
|
+
return "standard";
|
|
1224
|
+
}
|
|
1225
|
+
__name(getMaterialType, "getMaterialType");
|
|
1226
|
+
function createMaterialValue(material) {
|
|
1227
|
+
const materialRecord = material;
|
|
1228
|
+
const normalScale = materialRecord.normalScale;
|
|
1229
|
+
const map = materialRecord.map;
|
|
1230
|
+
return {
|
|
1231
|
+
type: getMaterialType(material),
|
|
1232
|
+
color: toHexColor2(materialRecord.color, "#ffffff"),
|
|
1233
|
+
roughness: typeof materialRecord.roughness === "number" ? materialRecord.roughness : 0.5,
|
|
1234
|
+
metalness: typeof materialRecord.metalness === "number" ? materialRecord.metalness : 0.5,
|
|
1235
|
+
normalScale: typeof normalScale?.x === "number" ? normalScale.x : 1,
|
|
1236
|
+
opacity: typeof materialRecord.opacity === "number" ? materialRecord.opacity : 1,
|
|
1237
|
+
emissive: toHexColor2(materialRecord.emissive, "#000000"),
|
|
1238
|
+
emissiveIntensity: typeof materialRecord.emissiveIntensity === "number" ? materialRecord.emissiveIntensity : 0,
|
|
1239
|
+
side: typeof materialRecord.side === "number" ? materialRecord.side : THREE26__namespace.FrontSide,
|
|
1240
|
+
blending: typeof materialRecord.blending === "number" ? materialRecord.blending : THREE26__namespace.NormalBlending,
|
|
1241
|
+
depthTest: materialRecord.depthTest !== false,
|
|
1242
|
+
depthWrite: materialRecord.depthWrite !== false,
|
|
1243
|
+
wireframe: Boolean(materialRecord.wireframe),
|
|
1244
|
+
transparent: Boolean(materialRecord.transparent),
|
|
1245
|
+
textureMap: map?.image ? map.source?.data?.currentSrc || map.image?.src : void 0,
|
|
1246
|
+
alphaTextureMap: materialRecord.alphaMap?.image?.src,
|
|
1247
|
+
normalMap: materialRecord.normalMap?.image?.src,
|
|
1248
|
+
roughnessMap: materialRecord.roughnessMap?.image?.src,
|
|
1249
|
+
metalnessMap: materialRecord.metalnessMap?.image?.src,
|
|
1250
|
+
aoMap: materialRecord.aoMap?.image?.src,
|
|
1251
|
+
emissiveMap: materialRecord.emissiveMap?.image?.src,
|
|
1252
|
+
bumpMap: materialRecord.bumpMap?.image?.src,
|
|
1253
|
+
displacementMap: materialRecord.displacementMap?.image?.src,
|
|
1254
|
+
lightMap: materialRecord.lightMap?.image?.src,
|
|
1255
|
+
envMap: materialRecord.envMap?.image?.src,
|
|
1256
|
+
textureFiltering: map?.magFilter === THREE26__namespace.NearestFilter ? "sharp" : "smooth",
|
|
1257
|
+
useMipmaps: map?.generateMipmaps !== false
|
|
1258
|
+
};
|
|
1259
|
+
}
|
|
1260
|
+
__name(createMaterialValue, "createMaterialValue");
|
|
1261
|
+
function defaultMaterialValue() {
|
|
1262
|
+
return {
|
|
1263
|
+
type: "standard",
|
|
1264
|
+
color: "#ffffff",
|
|
1265
|
+
roughness: 0.5,
|
|
1266
|
+
metalness: 0.5,
|
|
1267
|
+
normalScale: 1,
|
|
1268
|
+
opacity: 1,
|
|
1269
|
+
emissive: "#000000",
|
|
1270
|
+
emissiveIntensity: 0,
|
|
1271
|
+
side: THREE26__namespace.FrontSide,
|
|
1272
|
+
blending: THREE26__namespace.NormalBlending,
|
|
1273
|
+
depthTest: true,
|
|
1274
|
+
depthWrite: true,
|
|
1275
|
+
wireframe: false,
|
|
1276
|
+
transparent: false,
|
|
1277
|
+
textureFiltering: "smooth",
|
|
1278
|
+
useMipmaps: true
|
|
1279
|
+
};
|
|
1280
|
+
}
|
|
1281
|
+
__name(defaultMaterialValue, "defaultMaterialValue");
|
|
1282
|
+
var _MaterialComponent = class _MaterialComponent extends Component {
|
|
1283
|
+
constructor(materialOrMaterials = []) {
|
|
1284
|
+
super();
|
|
1285
|
+
this.materials = [];
|
|
1286
|
+
this.material = null;
|
|
1287
|
+
this.values = [];
|
|
1288
|
+
this.setMaterials(materialOrMaterials);
|
|
1289
|
+
}
|
|
1290
|
+
setMaterials(materialOrMaterials = []) {
|
|
1291
|
+
this.materials = Array.isArray(materialOrMaterials) ? materialOrMaterials.filter(Boolean) : materialOrMaterials ? [materialOrMaterials] : [];
|
|
1292
|
+
this.material = this.materials[0] ?? null;
|
|
1293
|
+
this.values = this.materials.length > 0 ? this.materials.map((material) => createMaterialValue(material)) : [defaultMaterialValue()];
|
|
1294
|
+
}
|
|
1295
|
+
updateValue(index, patch) {
|
|
1296
|
+
if (index < 0) {
|
|
1297
|
+
return;
|
|
1298
|
+
}
|
|
1299
|
+
while (this.values.length <= index) {
|
|
1300
|
+
this.values.push(defaultMaterialValue());
|
|
1301
|
+
}
|
|
1302
|
+
this.values[index] = {
|
|
1303
|
+
...this.values[index],
|
|
1304
|
+
...patch
|
|
1305
|
+
};
|
|
1306
|
+
}
|
|
1307
|
+
resetValue(index) {
|
|
1308
|
+
if (index < 0) {
|
|
1309
|
+
return;
|
|
1310
|
+
}
|
|
1311
|
+
while (this.values.length <= index) {
|
|
1312
|
+
this.values.push(defaultMaterialValue());
|
|
1313
|
+
}
|
|
1314
|
+
const type = this.values[index]?.type ?? "standard";
|
|
1315
|
+
this.values[index] = {
|
|
1316
|
+
...defaultMaterialValue(),
|
|
1317
|
+
type
|
|
1318
|
+
};
|
|
1319
|
+
}
|
|
1320
|
+
setMaterialType(index, type) {
|
|
1321
|
+
this.updateValue(index, { type });
|
|
1322
|
+
}
|
|
1323
|
+
setTextureFiltering(index, filtering) {
|
|
1324
|
+
this.updateValue(index, { textureFiltering: filtering });
|
|
1325
|
+
}
|
|
1326
|
+
setUseMipmaps(index, enabled) {
|
|
1327
|
+
this.updateValue(index, { useMipmaps: enabled });
|
|
1328
|
+
}
|
|
1329
|
+
};
|
|
1330
|
+
__name(_MaterialComponent, "MaterialComponent");
|
|
1331
|
+
var MaterialComponent = _MaterialComponent;
|
|
1332
|
+
|
|
1333
|
+
// core/factories/components/MaterialFactory.ts
|
|
1334
|
+
function createMaterialComponent(world, entityId, ...args) {
|
|
1335
|
+
const component = new MaterialComponent(...args);
|
|
1336
|
+
world.addComponent(entityId, component);
|
|
1337
|
+
return component;
|
|
1338
|
+
}
|
|
1339
|
+
__name(createMaterialComponent, "createMaterialComponent");
|
|
1340
|
+
|
|
1341
|
+
// core/components/Mesh.ts
|
|
1342
|
+
var _MeshComponent = class _MeshComponent extends Component {
|
|
1343
|
+
constructor(mesh) {
|
|
1344
|
+
super();
|
|
1345
|
+
this.mesh = mesh;
|
|
1346
|
+
}
|
|
1347
|
+
};
|
|
1348
|
+
__name(_MeshComponent, "MeshComponent");
|
|
1349
|
+
var MeshComponent = _MeshComponent;
|
|
1350
|
+
|
|
1351
|
+
// core/factories/components/MeshFactory.ts
|
|
1352
|
+
function createMeshComponent(world, entityId, ...args) {
|
|
1353
|
+
const component = new MeshComponent(...args);
|
|
1354
|
+
world.addComponent(entityId, component);
|
|
1355
|
+
return component;
|
|
1356
|
+
}
|
|
1357
|
+
__name(createMeshComponent, "createMeshComponent");
|
|
1358
|
+
var DEFAULT_MESH_GEOMETRY_PARAMETERS = {
|
|
1359
|
+
capsule: { radius: 0.5, height: 1 },
|
|
1360
|
+
cube: { width: 1, height: 1, depth: 1 },
|
|
1361
|
+
cylinder: { radius: 0.5, height: 1 },
|
|
1362
|
+
plane: { width: 100, height: 100 },
|
|
1363
|
+
sphere: { radius: 0.5 }
|
|
1364
|
+
};
|
|
1365
|
+
var GEOMETRY_TYPE_BY_KIND = {
|
|
1366
|
+
capsule: "CapsuleGeometry",
|
|
1367
|
+
cube: "BoxGeometry",
|
|
1368
|
+
cylinder: "CylinderGeometry",
|
|
1369
|
+
model: "Model",
|
|
1370
|
+
plane: "PlaneGeometry",
|
|
1371
|
+
sphere: "SphereGeometry"
|
|
1372
|
+
};
|
|
1373
|
+
var _MeshGeometryComponent = class _MeshGeometryComponent extends Component {
|
|
1374
|
+
constructor(kind, object, parameters, options) {
|
|
1375
|
+
super();
|
|
1376
|
+
this.kind = kind;
|
|
1377
|
+
this.geometryType = GEOMETRY_TYPE_BY_KIND[kind];
|
|
1378
|
+
this.object = object;
|
|
1379
|
+
this.modelName = options?.modelName ?? "";
|
|
1380
|
+
this.castShadow = options?.castShadow ?? false;
|
|
1381
|
+
this.receiveShadow = options?.receiveShadow ?? false;
|
|
1382
|
+
switch (kind) {
|
|
1383
|
+
case "cube":
|
|
1384
|
+
this.parameters = {
|
|
1385
|
+
...DEFAULT_MESH_GEOMETRY_PARAMETERS.cube,
|
|
1386
|
+
...parameters
|
|
1387
|
+
};
|
|
1388
|
+
break;
|
|
1389
|
+
case "plane":
|
|
1390
|
+
this.parameters = {
|
|
1391
|
+
...DEFAULT_MESH_GEOMETRY_PARAMETERS.plane,
|
|
1392
|
+
...parameters
|
|
1393
|
+
};
|
|
1394
|
+
break;
|
|
1395
|
+
case "sphere":
|
|
1396
|
+
this.parameters = {
|
|
1397
|
+
...DEFAULT_MESH_GEOMETRY_PARAMETERS.sphere,
|
|
1398
|
+
...parameters
|
|
1399
|
+
};
|
|
1400
|
+
break;
|
|
1401
|
+
case "cylinder":
|
|
1402
|
+
this.parameters = {
|
|
1403
|
+
...DEFAULT_MESH_GEOMETRY_PARAMETERS.cylinder,
|
|
1404
|
+
...parameters
|
|
1405
|
+
};
|
|
1406
|
+
break;
|
|
1407
|
+
case "capsule":
|
|
1408
|
+
this.parameters = {
|
|
1409
|
+
...DEFAULT_MESH_GEOMETRY_PARAMETERS.capsule,
|
|
1410
|
+
...parameters
|
|
1411
|
+
};
|
|
1412
|
+
break;
|
|
1413
|
+
case "model":
|
|
1414
|
+
this.parameters = {};
|
|
1415
|
+
break;
|
|
1416
|
+
}
|
|
1417
|
+
}
|
|
1418
|
+
};
|
|
1419
|
+
__name(_MeshGeometryComponent, "MeshGeometryComponent");
|
|
1420
|
+
var MeshGeometryComponent = _MeshGeometryComponent;
|
|
1421
|
+
|
|
1422
|
+
// core/factories/components/MeshGeometryFactory.ts
|
|
1423
|
+
function createMeshGeometryComponent(world, entityId, ...args) {
|
|
1424
|
+
const component = new MeshGeometryComponent(...args);
|
|
1425
|
+
world.addComponent(entityId, component);
|
|
1426
|
+
return component;
|
|
1427
|
+
}
|
|
1428
|
+
__name(createMeshGeometryComponent, "createMeshGeometryComponent");
|
|
1429
|
+
|
|
1430
|
+
// core/components/Model.ts
|
|
1431
|
+
var _ModelComponent = class _ModelComponent extends Component {
|
|
1432
|
+
constructor(path) {
|
|
1433
|
+
super();
|
|
1434
|
+
this.path = path;
|
|
1435
|
+
this.object = null;
|
|
1436
|
+
}
|
|
1437
|
+
};
|
|
1438
|
+
__name(_ModelComponent, "ModelComponent");
|
|
1439
|
+
var ModelComponent = _ModelComponent;
|
|
1440
|
+
|
|
1441
|
+
// core/factories/components/ModelFactory.ts
|
|
1442
|
+
function createModelComponent(world, entityId, ...args) {
|
|
1443
|
+
const component = new ModelComponent(...args);
|
|
1444
|
+
world.addComponent(entityId, component);
|
|
1445
|
+
return component;
|
|
1446
|
+
}
|
|
1447
|
+
__name(createModelComponent, "createModelComponent");
|
|
1448
|
+
|
|
1449
|
+
// core/components/Name.ts
|
|
1450
|
+
var _Name = class _Name extends Component {
|
|
1451
|
+
constructor(value) {
|
|
1452
|
+
super();
|
|
1453
|
+
this.value = value;
|
|
1454
|
+
}
|
|
1455
|
+
};
|
|
1456
|
+
__name(_Name, "Name");
|
|
1457
|
+
var Name = _Name;
|
|
1458
|
+
|
|
1459
|
+
// core/factories/components/NameFactory.ts
|
|
1460
|
+
function createNameComponent(world, entityId, ...args) {
|
|
1461
|
+
const component = new Name(...args);
|
|
1462
|
+
world.addComponent(entityId, component);
|
|
1463
|
+
return component;
|
|
1464
|
+
}
|
|
1465
|
+
__name(createNameComponent, "createNameComponent");
|
|
1466
|
+
|
|
1467
|
+
// core/factories/components/Object3DRefFactory.ts
|
|
1468
|
+
function createObject3DRefComponent(world, entityId, ...args) {
|
|
1469
|
+
const component = new Object3DRef(...args);
|
|
1470
|
+
world.addComponent(entityId, component);
|
|
1471
|
+
return component;
|
|
1472
|
+
}
|
|
1473
|
+
__name(createObject3DRefComponent, "createObject3DRefComponent");
|
|
1474
|
+
|
|
1475
|
+
// core/components/ParentId.ts
|
|
1476
|
+
var _ParentId = class _ParentId extends Component {
|
|
1477
|
+
constructor(value = null) {
|
|
1478
|
+
super();
|
|
1479
|
+
this.value = value;
|
|
1480
|
+
}
|
|
1481
|
+
};
|
|
1482
|
+
__name(_ParentId, "ParentId");
|
|
1483
|
+
var ParentId = _ParentId;
|
|
1484
|
+
|
|
1485
|
+
// core/factories/components/ParentIdFactory.ts
|
|
1486
|
+
function createParentIdComponent(world, entityId, ...args) {
|
|
1487
|
+
const component = new ParentId(...args);
|
|
1488
|
+
world.addComponent(entityId, component);
|
|
1489
|
+
return component;
|
|
1490
|
+
}
|
|
1491
|
+
__name(createParentIdComponent, "createParentIdComponent");
|
|
1492
|
+
|
|
1493
|
+
// core/components/Postprocessing.ts
|
|
1494
|
+
var DEFAULT_POSTPROCESSING_STATE = {
|
|
1495
|
+
postEnabled: false,
|
|
1496
|
+
dof: {
|
|
1497
|
+
enabled: false,
|
|
1498
|
+
focusDistance: 0.015,
|
|
1499
|
+
focalLength: 0.018,
|
|
1500
|
+
bokehScale: 3
|
|
1501
|
+
},
|
|
1502
|
+
bloom: {
|
|
1503
|
+
enabled: false,
|
|
1504
|
+
intensity: 1.2,
|
|
1505
|
+
threshold: 0.2,
|
|
1506
|
+
radius: 0.7
|
|
1507
|
+
},
|
|
1508
|
+
vignette: {
|
|
1509
|
+
enabled: false,
|
|
1510
|
+
offset: 0.05,
|
|
1511
|
+
darkness: 1.2
|
|
1512
|
+
},
|
|
1513
|
+
chromAberration: {
|
|
1514
|
+
enabled: false,
|
|
1515
|
+
offsetX: 3e-3,
|
|
1516
|
+
offsetY: 3e-3
|
|
1517
|
+
},
|
|
1518
|
+
noise: {
|
|
1519
|
+
enabled: false,
|
|
1520
|
+
opacity: 0.12
|
|
1521
|
+
},
|
|
1522
|
+
pixelation: {
|
|
1523
|
+
enabled: false,
|
|
1524
|
+
granularity: 6
|
|
1525
|
+
},
|
|
1526
|
+
toneMapping: {
|
|
1527
|
+
enabled: false,
|
|
1528
|
+
exposure: 1.3
|
|
1529
|
+
},
|
|
1530
|
+
hueSaturation: {
|
|
1531
|
+
enabled: false,
|
|
1532
|
+
hue: 0.05,
|
|
1533
|
+
saturation: 0.2
|
|
1534
|
+
},
|
|
1535
|
+
sepia: {
|
|
1536
|
+
enabled: false,
|
|
1537
|
+
intensity: 0.5
|
|
1538
|
+
},
|
|
1539
|
+
smaa: {
|
|
1540
|
+
enabled: false
|
|
1541
|
+
},
|
|
1542
|
+
ssao: {
|
|
1543
|
+
enabled: false,
|
|
1544
|
+
intensity: 1.5,
|
|
1545
|
+
radius: 0.25
|
|
1546
|
+
},
|
|
1547
|
+
dotScreen: {
|
|
1548
|
+
enabled: false,
|
|
1549
|
+
dotScreenScale: 1.2,
|
|
1550
|
+
dotScreenAngle: 1.57,
|
|
1551
|
+
blendFunction: void 0,
|
|
1552
|
+
opacity: void 0
|
|
1553
|
+
},
|
|
1554
|
+
glitch: {
|
|
1555
|
+
enabled: false,
|
|
1556
|
+
blendFunction: void 0,
|
|
1557
|
+
delay: void 0,
|
|
1558
|
+
duration: void 0,
|
|
1559
|
+
dtSize: void 0,
|
|
1560
|
+
columns: void 0,
|
|
1561
|
+
ratio: void 0,
|
|
1562
|
+
mode: void 0}
|
|
1563
|
+
};
|
|
1564
|
+
function asRecord2(value) {
|
|
1565
|
+
if (!value || typeof value !== "object") {
|
|
1566
|
+
return null;
|
|
1567
|
+
}
|
|
1568
|
+
return value;
|
|
1569
|
+
}
|
|
1570
|
+
__name(asRecord2, "asRecord");
|
|
1571
|
+
function toFiniteNumber3(value, fallback) {
|
|
1572
|
+
if (typeof value !== "number" || !Number.isFinite(value)) {
|
|
1573
|
+
return fallback;
|
|
1574
|
+
}
|
|
1575
|
+
return value;
|
|
1576
|
+
}
|
|
1577
|
+
__name(toFiniteNumber3, "toFiniteNumber");
|
|
1578
|
+
function toBoolean2(value, fallback) {
|
|
1579
|
+
if (typeof value !== "boolean") {
|
|
1580
|
+
return fallback;
|
|
1581
|
+
}
|
|
1582
|
+
return value;
|
|
1583
|
+
}
|
|
1584
|
+
__name(toBoolean2, "toBoolean");
|
|
1585
|
+
function normalizeNumberTuple(value) {
|
|
1586
|
+
if (!Array.isArray(value) || value.length !== 2) {
|
|
1587
|
+
return void 0;
|
|
1588
|
+
}
|
|
1589
|
+
if (typeof value[0] !== "number" || !Number.isFinite(value[0]) || typeof value[1] !== "number" || !Number.isFinite(value[1])) {
|
|
1590
|
+
return void 0;
|
|
1591
|
+
}
|
|
1592
|
+
return [value[0], value[1]];
|
|
1593
|
+
}
|
|
1594
|
+
__name(normalizeNumberTuple, "normalizeNumberTuple");
|
|
1595
|
+
function normalizePostprocessing(value) {
|
|
1596
|
+
const postprocessing = asRecord2(value);
|
|
1597
|
+
const defaults = DEFAULT_POSTPROCESSING_STATE;
|
|
1598
|
+
const dof = asRecord2(postprocessing?.dof);
|
|
1599
|
+
const bloom = asRecord2(postprocessing?.bloom);
|
|
1600
|
+
const vignette = asRecord2(postprocessing?.vignette);
|
|
1601
|
+
const chromAberration = asRecord2(postprocessing?.chromAberration);
|
|
1602
|
+
const noise = asRecord2(postprocessing?.noise);
|
|
1603
|
+
const pixelation = asRecord2(postprocessing?.pixelation);
|
|
1604
|
+
const toneMapping = asRecord2(postprocessing?.toneMapping);
|
|
1605
|
+
const hueSaturation = asRecord2(postprocessing?.hueSaturation);
|
|
1606
|
+
const sepia = asRecord2(postprocessing?.sepia);
|
|
1607
|
+
const smaa = asRecord2(postprocessing?.smaa);
|
|
1608
|
+
const ssao = asRecord2(postprocessing?.ssao);
|
|
1609
|
+
const dotScreen = asRecord2(postprocessing?.dotScreen);
|
|
1610
|
+
const glitch = asRecord2(postprocessing?.glitch);
|
|
1611
|
+
const glitchChromaticAberrationOffset = asRecord2(
|
|
1612
|
+
glitch?.chromaticAberrationOffset
|
|
1613
|
+
);
|
|
1614
|
+
const glitchStrength = asRecord2(glitch?.strength);
|
|
1615
|
+
const dotScreenScale = toFiniteNumber3(
|
|
1616
|
+
dotScreen?.dotScreenScale,
|
|
1617
|
+
defaults.dotScreen.dotScreenScale
|
|
1618
|
+
);
|
|
1619
|
+
const dotScreenAngle = toFiniteNumber3(
|
|
1620
|
+
dotScreen?.dotScreenAngle,
|
|
1621
|
+
defaults.dotScreen.dotScreenAngle
|
|
1622
|
+
);
|
|
1623
|
+
const normalizedGlitchStrength = typeof glitch?.strength === "number" && Number.isFinite(glitch.strength) ? glitch.strength : glitchStrength && typeof glitchStrength.x === "number" && Number.isFinite(glitchStrength.x) && typeof glitchStrength.y === "number" && Number.isFinite(glitchStrength.y) ? { x: glitchStrength.x, y: glitchStrength.y } : void 0;
|
|
1624
|
+
const normalizedGlitchChromaticAberrationOffset = normalizeNumberTuple(glitch?.chromaticAberrationOffset) ?? (glitchChromaticAberrationOffset && typeof glitchChromaticAberrationOffset.x === "number" && Number.isFinite(glitchChromaticAberrationOffset.x) && typeof glitchChromaticAberrationOffset.y === "number" && Number.isFinite(glitchChromaticAberrationOffset.y) ? {
|
|
1625
|
+
x: glitchChromaticAberrationOffset.x,
|
|
1626
|
+
y: glitchChromaticAberrationOffset.y
|
|
1627
|
+
} : void 0);
|
|
1628
|
+
return {
|
|
1629
|
+
postEnabled: toBoolean2(postprocessing?.postEnabled, defaults.postEnabled),
|
|
1630
|
+
dof: {
|
|
1631
|
+
enabled: toBoolean2(dof?.enabled, defaults.dof.enabled),
|
|
1632
|
+
focusDistance: toFiniteNumber3(dof?.focusDistance, defaults.dof.focusDistance),
|
|
1633
|
+
focalLength: toFiniteNumber3(dof?.focalLength, defaults.dof.focalLength),
|
|
1634
|
+
bokehScale: toFiniteNumber3(dof?.bokehScale, defaults.dof.bokehScale)
|
|
1635
|
+
},
|
|
1636
|
+
bloom: {
|
|
1637
|
+
enabled: toBoolean2(bloom?.enabled, defaults.bloom.enabled),
|
|
1638
|
+
intensity: toFiniteNumber3(bloom?.intensity, defaults.bloom.intensity),
|
|
1639
|
+
threshold: toFiniteNumber3(bloom?.threshold, defaults.bloom.threshold),
|
|
1640
|
+
radius: toFiniteNumber3(bloom?.radius, defaults.bloom.radius)
|
|
1641
|
+
},
|
|
1642
|
+
vignette: {
|
|
1643
|
+
enabled: toBoolean2(vignette?.enabled, defaults.vignette.enabled),
|
|
1644
|
+
offset: toFiniteNumber3(vignette?.offset, defaults.vignette.offset),
|
|
1645
|
+
darkness: toFiniteNumber3(vignette?.darkness, defaults.vignette.darkness)
|
|
1646
|
+
},
|
|
1647
|
+
chromAberration: {
|
|
1648
|
+
enabled: toBoolean2(chromAberration?.enabled, defaults.chromAberration.enabled),
|
|
1649
|
+
offsetX: toFiniteNumber3(chromAberration?.offsetX, defaults.chromAberration.offsetX),
|
|
1650
|
+
offsetY: toFiniteNumber3(chromAberration?.offsetY, defaults.chromAberration.offsetY)
|
|
1651
|
+
},
|
|
1652
|
+
noise: {
|
|
1653
|
+
enabled: toBoolean2(noise?.enabled, defaults.noise.enabled),
|
|
1654
|
+
opacity: toFiniteNumber3(noise?.opacity, defaults.noise.opacity)
|
|
1655
|
+
},
|
|
1656
|
+
pixelation: {
|
|
1657
|
+
enabled: toBoolean2(pixelation?.enabled, defaults.pixelation.enabled),
|
|
1658
|
+
granularity: toFiniteNumber3(pixelation?.granularity, defaults.pixelation.granularity)
|
|
1659
|
+
},
|
|
1660
|
+
toneMapping: {
|
|
1661
|
+
enabled: toBoolean2(toneMapping?.enabled, defaults.toneMapping.enabled),
|
|
1662
|
+
exposure: toFiniteNumber3(toneMapping?.exposure, defaults.toneMapping.exposure)
|
|
1663
|
+
},
|
|
1664
|
+
hueSaturation: {
|
|
1665
|
+
enabled: toBoolean2(hueSaturation?.enabled, defaults.hueSaturation.enabled),
|
|
1666
|
+
hue: toFiniteNumber3(hueSaturation?.hue, defaults.hueSaturation.hue),
|
|
1667
|
+
saturation: toFiniteNumber3(
|
|
1668
|
+
hueSaturation?.saturation,
|
|
1669
|
+
defaults.hueSaturation.saturation
|
|
1670
|
+
)
|
|
1671
|
+
},
|
|
1672
|
+
sepia: {
|
|
1673
|
+
enabled: toBoolean2(sepia?.enabled, defaults.sepia.enabled),
|
|
1674
|
+
intensity: toFiniteNumber3(sepia?.intensity, defaults.sepia.intensity)
|
|
1675
|
+
},
|
|
1676
|
+
smaa: {
|
|
1677
|
+
enabled: toBoolean2(smaa?.enabled, defaults.smaa.enabled)
|
|
1678
|
+
},
|
|
1679
|
+
ssao: {
|
|
1680
|
+
enabled: toBoolean2(ssao?.enabled, defaults.ssao.enabled),
|
|
1681
|
+
intensity: toFiniteNumber3(ssao?.intensity, defaults.ssao.intensity),
|
|
1682
|
+
radius: toFiniteNumber3(ssao?.radius, defaults.ssao.radius)
|
|
1683
|
+
},
|
|
1684
|
+
dotScreen: {
|
|
1685
|
+
enabled: toBoolean2(dotScreen?.enabled, defaults.dotScreen.enabled),
|
|
1686
|
+
dotScreenScale,
|
|
1687
|
+
dotScreenAngle,
|
|
1688
|
+
scale: toFiniteNumber3(dotScreen?.scale, dotScreenScale),
|
|
1689
|
+
angle: toFiniteNumber3(dotScreen?.angle, dotScreenAngle),
|
|
1690
|
+
blendFunction: typeof dotScreen?.blendFunction === "number" && Number.isFinite(dotScreen.blendFunction) ? dotScreen.blendFunction : defaults.dotScreen.blendFunction,
|
|
1691
|
+
opacity: typeof dotScreen?.opacity === "number" && Number.isFinite(dotScreen.opacity) ? dotScreen.opacity : defaults.dotScreen.opacity
|
|
1692
|
+
},
|
|
1693
|
+
glitch: {
|
|
1694
|
+
enabled: toBoolean2(glitch?.enabled, defaults.glitch.enabled),
|
|
1695
|
+
blendFunction: typeof glitch?.blendFunction === "number" && Number.isFinite(glitch.blendFunction) ? glitch.blendFunction : defaults.glitch.blendFunction,
|
|
1696
|
+
chromaticAberrationOffset: normalizedGlitchChromaticAberrationOffset,
|
|
1697
|
+
delay: normalizeNumberTuple(glitch?.delay) ?? defaults.glitch.delay,
|
|
1698
|
+
duration: normalizeNumberTuple(glitch?.duration) ?? defaults.glitch.duration,
|
|
1699
|
+
strength: normalizedGlitchStrength,
|
|
1700
|
+
dtSize: typeof glitch?.dtSize === "number" && Number.isFinite(glitch.dtSize) ? glitch.dtSize : defaults.glitch.dtSize,
|
|
1701
|
+
columns: typeof glitch?.columns === "number" && Number.isFinite(glitch.columns) ? glitch.columns : defaults.glitch.columns,
|
|
1702
|
+
ratio: typeof glitch?.ratio === "number" && Number.isFinite(glitch.ratio) ? glitch.ratio : defaults.glitch.ratio,
|
|
1703
|
+
mode: typeof glitch?.mode === "string" ? glitch.mode : defaults.glitch.mode,
|
|
1704
|
+
active: toBoolean2(glitch?.active, false)
|
|
1705
|
+
}
|
|
1706
|
+
};
|
|
1707
|
+
}
|
|
1708
|
+
__name(normalizePostprocessing, "normalizePostprocessing");
|
|
1709
|
+
var _Postprocessing = class _Postprocessing extends Component {
|
|
1710
|
+
constructor(values) {
|
|
1711
|
+
super();
|
|
1712
|
+
this.values = normalizePostprocessing(values);
|
|
1713
|
+
}
|
|
1714
|
+
};
|
|
1715
|
+
__name(_Postprocessing, "Postprocessing");
|
|
1716
|
+
var Postprocessing = _Postprocessing;
|
|
1717
|
+
|
|
1718
|
+
// core/factories/components/PostprocessingFactory.ts
|
|
1719
|
+
function createPostprocessingComponent(world, entityId, values) {
|
|
1720
|
+
const component = new Postprocessing(values);
|
|
1721
|
+
world.addComponent(entityId, component);
|
|
1722
|
+
return component;
|
|
1723
|
+
}
|
|
1724
|
+
__name(createPostprocessingComponent, "createPostprocessingComponent");
|
|
1725
|
+
|
|
1726
|
+
// core/components/ScriptComponent.ts
|
|
1727
|
+
var _ScriptComponent = class _ScriptComponent extends Component {
|
|
1728
|
+
constructor(entries = []) {
|
|
1729
|
+
super();
|
|
1730
|
+
this.entries = entries.map((entry) => ({
|
|
1731
|
+
entityId: typeof entry.entityId === "number" ? entry.entityId : 0,
|
|
1732
|
+
className: typeof entry.className === "string" ? entry.className : "",
|
|
1733
|
+
scriptUrl: typeof entry.scriptUrl === "string" ? entry.scriptUrl : "",
|
|
1734
|
+
enabled: typeof entry.enabled === "boolean" ? entry.enabled : true,
|
|
1735
|
+
executeInEditor: typeof entry.executeInEditor === "boolean" ? entry.executeInEditor : false,
|
|
1736
|
+
data: entry.data && typeof entry.data === "object" && !Array.isArray(entry.data) ? entry.data : {},
|
|
1737
|
+
runtimeState: entry.runtimeState,
|
|
1738
|
+
runtimeMessage: typeof entry.runtimeMessage === "string" ? entry.runtimeMessage : void 0
|
|
1739
|
+
}));
|
|
1740
|
+
Object.defineProperty(this, "scriptInstance", {
|
|
1741
|
+
value: null,
|
|
1742
|
+
writable: true,
|
|
1743
|
+
configurable: true,
|
|
1744
|
+
enumerable: false
|
|
1745
|
+
});
|
|
1746
|
+
Object.defineProperty(this, "scriptInstances", {
|
|
1747
|
+
value: /* @__PURE__ */ new Map(),
|
|
1748
|
+
writable: true,
|
|
1749
|
+
configurable: true,
|
|
1750
|
+
enumerable: false
|
|
1751
|
+
});
|
|
1752
|
+
}
|
|
1753
|
+
};
|
|
1754
|
+
__name(_ScriptComponent, "ScriptComponent");
|
|
1755
|
+
var ScriptComponent = _ScriptComponent;
|
|
1756
|
+
|
|
1757
|
+
// core/factories/components/ScriptComponentFactory.ts
|
|
1758
|
+
function createScriptComponent(world, entityId, payload = {}) {
|
|
1759
|
+
const entries = Array.isArray(payload.entries) ? payload.entries.map((entry) => ({
|
|
1760
|
+
entityId,
|
|
1761
|
+
className: typeof entry.className === "string" ? entry.className : "",
|
|
1762
|
+
scriptUrl: typeof entry.scriptUrl === "string" ? entry.scriptUrl : "",
|
|
1763
|
+
enabled: typeof entry.enabled === "boolean" ? entry.enabled : true,
|
|
1764
|
+
data: entry.data && typeof entry.data === "object" && !Array.isArray(entry.data) ? entry.data : {},
|
|
1765
|
+
runtimeState: entry.runtimeState,
|
|
1766
|
+
runtimeMessage: typeof entry.runtimeMessage === "string" ? entry.runtimeMessage : void 0
|
|
1767
|
+
})) : [];
|
|
1768
|
+
const component = new ScriptComponent(entries);
|
|
1769
|
+
world.addComponent(entityId, component);
|
|
1770
|
+
return component;
|
|
1771
|
+
}
|
|
1772
|
+
__name(createScriptComponent, "createScriptComponent");
|
|
1773
|
+
|
|
1774
|
+
// core/components/Selectable.ts
|
|
1775
|
+
var _Selectable = class _Selectable extends Component {
|
|
1776
|
+
constructor(enabled = true) {
|
|
1777
|
+
super();
|
|
1778
|
+
this.enabled = enabled;
|
|
1779
|
+
}
|
|
1780
|
+
};
|
|
1781
|
+
__name(_Selectable, "Selectable");
|
|
1782
|
+
var Selectable = _Selectable;
|
|
1783
|
+
|
|
1784
|
+
// core/factories/components/SelectableFactory.ts
|
|
1785
|
+
function createSelectableComponent(world, entityId, ...args) {
|
|
1786
|
+
const component = new Selectable(...args);
|
|
1787
|
+
world.addComponent(entityId, component);
|
|
1788
|
+
return component;
|
|
1789
|
+
}
|
|
1790
|
+
__name(createSelectableComponent, "createSelectableComponent");
|
|
1791
|
+
|
|
1792
|
+
// core/components/SelectionTransformState.ts
|
|
1793
|
+
var _SelectionTransformState = class _SelectionTransformState extends Component {
|
|
1794
|
+
constructor(transform = "translate", space = "world", selectedEntityId = null) {
|
|
1795
|
+
super();
|
|
1796
|
+
this.transform = transform;
|
|
1797
|
+
this.space = space;
|
|
1798
|
+
this.selectedEntityId = selectedEntityId;
|
|
1799
|
+
}
|
|
1800
|
+
};
|
|
1801
|
+
__name(_SelectionTransformState, "SelectionTransformState");
|
|
1802
|
+
var SelectionTransformState = _SelectionTransformState;
|
|
1803
|
+
|
|
1804
|
+
// core/factories/components/SelectionTransformStateFactory.ts
|
|
1805
|
+
function createSelectionTransformStateComponent(world, entityId, ...args) {
|
|
1806
|
+
const component = new SelectionTransformState(...args);
|
|
1807
|
+
world.addComponent(entityId, component);
|
|
1808
|
+
return component;
|
|
1809
|
+
}
|
|
1810
|
+
__name(createSelectionTransformStateComponent, "createSelectionTransformStateComponent");
|
|
1811
|
+
|
|
1812
|
+
// core/components/Sprite.ts
|
|
1813
|
+
var _SpriteComponent = class _SpriteComponent extends Component {
|
|
1814
|
+
constructor(path, width = 1, height = 1) {
|
|
1815
|
+
super();
|
|
1816
|
+
this.path = path;
|
|
1817
|
+
this.width = width;
|
|
1818
|
+
this.height = height;
|
|
1819
|
+
this.texture = null;
|
|
1820
|
+
this.object = null;
|
|
1821
|
+
}
|
|
1822
|
+
};
|
|
1823
|
+
__name(_SpriteComponent, "SpriteComponent");
|
|
1824
|
+
var SpriteComponent = _SpriteComponent;
|
|
1825
|
+
|
|
1826
|
+
// core/factories/components/SpriteFactory.ts
|
|
1827
|
+
function createSpriteComponent(world, entityId, ...args) {
|
|
1828
|
+
const component = new SpriteComponent(...args);
|
|
1829
|
+
world.addComponent(entityId, component);
|
|
1830
|
+
return component;
|
|
1831
|
+
}
|
|
1832
|
+
__name(createSpriteComponent, "createSpriteComponent");
|
|
1833
|
+
function readXYZ(input) {
|
|
1834
|
+
return {
|
|
1835
|
+
x: input.x,
|
|
1836
|
+
y: input.y,
|
|
1837
|
+
z: input.z
|
|
1838
|
+
};
|
|
1839
|
+
}
|
|
1840
|
+
__name(readXYZ, "readXYZ");
|
|
1841
|
+
var _TransformComponent = class _TransformComponent extends Component {
|
|
1842
|
+
constructor(data = {}) {
|
|
1843
|
+
super();
|
|
1844
|
+
const position = data.position ?? {};
|
|
1845
|
+
const rotation = data.rotation ?? {};
|
|
1846
|
+
const scale = data.scale ?? {};
|
|
1847
|
+
this.position = {
|
|
1848
|
+
x: position.x ?? 0,
|
|
1849
|
+
y: position.y ?? 0,
|
|
1850
|
+
z: position.z ?? 0
|
|
1851
|
+
};
|
|
1852
|
+
this.rotation = {
|
|
1853
|
+
x: rotation.x ?? 0,
|
|
1854
|
+
y: rotation.y ?? 0,
|
|
1855
|
+
z: rotation.z ?? 0
|
|
1856
|
+
};
|
|
1857
|
+
this.scale = {
|
|
1858
|
+
x: scale.x ?? 1,
|
|
1859
|
+
y: scale.y ?? 1,
|
|
1860
|
+
z: scale.z ?? 1
|
|
1861
|
+
};
|
|
1862
|
+
}
|
|
1863
|
+
toPositionVector3(target = new THREE26.Vector3()) {
|
|
1864
|
+
return target.set(this.position.x, this.position.y, this.position.z);
|
|
1865
|
+
}
|
|
1866
|
+
toRotationEuler(target = new THREE26.Euler(), order = "XYZ") {
|
|
1867
|
+
return target.set(this.rotation.x, this.rotation.y, this.rotation.z, order);
|
|
1868
|
+
}
|
|
1869
|
+
toRotationQuaternion(target = new THREE26.Quaternion(), order = "XYZ") {
|
|
1870
|
+
const euler = new THREE26.Euler(
|
|
1871
|
+
this.rotation.x,
|
|
1872
|
+
this.rotation.y,
|
|
1873
|
+
this.rotation.z,
|
|
1874
|
+
order
|
|
1875
|
+
);
|
|
1876
|
+
return target.setFromEuler(euler);
|
|
1877
|
+
}
|
|
1878
|
+
toScaleVector3(target = new THREE26.Vector3()) {
|
|
1879
|
+
return target.set(this.scale.x, this.scale.y, this.scale.z);
|
|
1880
|
+
}
|
|
1881
|
+
setPosition(input) {
|
|
1882
|
+
const next = readXYZ(input);
|
|
1883
|
+
this.position.x = next.x;
|
|
1884
|
+
this.position.y = next.y;
|
|
1885
|
+
this.position.z = next.z;
|
|
1886
|
+
return this;
|
|
1887
|
+
}
|
|
1888
|
+
setScale(input) {
|
|
1889
|
+
const next = readXYZ(input);
|
|
1890
|
+
this.scale.x = next.x;
|
|
1891
|
+
this.scale.y = next.y;
|
|
1892
|
+
this.scale.z = next.z;
|
|
1893
|
+
return this;
|
|
1894
|
+
}
|
|
1895
|
+
setRotation(input, order = "XYZ") {
|
|
1896
|
+
if (input instanceof THREE26.Quaternion) {
|
|
1897
|
+
const euler = new THREE26.Euler().setFromQuaternion(input, order);
|
|
1898
|
+
this.rotation.x = euler.x;
|
|
1899
|
+
this.rotation.y = euler.y;
|
|
1900
|
+
this.rotation.z = euler.z;
|
|
1901
|
+
return this;
|
|
1902
|
+
}
|
|
1903
|
+
const next = readXYZ(input);
|
|
1904
|
+
this.rotation.x = next.x;
|
|
1905
|
+
this.rotation.y = next.y;
|
|
1906
|
+
this.rotation.z = next.z;
|
|
1907
|
+
return this;
|
|
1908
|
+
}
|
|
1909
|
+
};
|
|
1910
|
+
__name(_TransformComponent, "TransformComponent");
|
|
1911
|
+
var TransformComponent = _TransformComponent;
|
|
1912
|
+
|
|
1913
|
+
// core/factories/components/TransformFactory.ts
|
|
1914
|
+
function createTransformComponent(world, entityId, ...args) {
|
|
1915
|
+
const component = new TransformComponent(...args);
|
|
1916
|
+
world.addComponent(entityId, component);
|
|
1917
|
+
return component;
|
|
1918
|
+
}
|
|
1919
|
+
__name(createTransformComponent, "createTransformComponent");
|
|
1920
|
+
|
|
1921
|
+
// core/components/Video.ts
|
|
1922
|
+
var DEFAULT_VIDEO_OPTIONS = {
|
|
1923
|
+
autoplay: false,
|
|
1924
|
+
loop: true,
|
|
1925
|
+
volume: 1,
|
|
1926
|
+
width: 1,
|
|
1927
|
+
height: 1,
|
|
1928
|
+
isGreenScreen: false,
|
|
1929
|
+
backgroundColor: "#00ff00",
|
|
1930
|
+
similarity: 0.4,
|
|
1931
|
+
smoothness: 0.08,
|
|
1932
|
+
spill: 0.12,
|
|
1933
|
+
/** When `true`, the video's audio stream is spatialized using the entity's transform. */
|
|
1934
|
+
positional: false,
|
|
1935
|
+
/** Distance at which volume is unattenuated (positional only). */
|
|
1936
|
+
refDistance: 1,
|
|
1937
|
+
/** WebAudio distance model (`linear`, `inverse`, `exponential`). Positional only. */
|
|
1938
|
+
distanceModel: "inverse",
|
|
1939
|
+
/** How quickly volume falls off past `refDistance`. Positional only. */
|
|
1940
|
+
rolloffFactor: 1
|
|
1941
|
+
};
|
|
1942
|
+
var _VideoComponent = class _VideoComponent extends Component {
|
|
1943
|
+
constructor(path, options = {}) {
|
|
1944
|
+
super();
|
|
1945
|
+
this.path = path;
|
|
1946
|
+
this.options = {
|
|
1947
|
+
...DEFAULT_VIDEO_OPTIONS,
|
|
1948
|
+
...options
|
|
1949
|
+
};
|
|
1950
|
+
this.object = null;
|
|
1951
|
+
this.videoElement = null;
|
|
1952
|
+
this.texture = null;
|
|
1953
|
+
this.material = null;
|
|
1954
|
+
this.audioNode = null;
|
|
1955
|
+
Object.defineProperty(this, "isPlaying", {
|
|
1956
|
+
value: false,
|
|
1957
|
+
writable: true,
|
|
1958
|
+
configurable: true,
|
|
1959
|
+
enumerable: false
|
|
1960
|
+
});
|
|
1961
|
+
Object.defineProperty(this, "isPaused", {
|
|
1962
|
+
value: false,
|
|
1963
|
+
writable: true,
|
|
1964
|
+
configurable: true,
|
|
1965
|
+
enumerable: false
|
|
1966
|
+
});
|
|
1967
|
+
}
|
|
1968
|
+
/**
|
|
1969
|
+
* Signals `VideoSystem` to start (or resume) playback.
|
|
1970
|
+
* Has no direct effect in the editor — `VideoSystem` drives the actual
|
|
1971
|
+
* HTML video element call in preview.
|
|
1972
|
+
*/
|
|
1973
|
+
play() {
|
|
1974
|
+
this.isPlaying = true;
|
|
1975
|
+
this.isPaused = false;
|
|
1976
|
+
}
|
|
1977
|
+
/**
|
|
1978
|
+
* Signals `VideoSystem` to pause playback, preserving the current position.
|
|
1979
|
+
* Calling {@link play} afterwards resumes from where it paused.
|
|
1980
|
+
* No-op if not currently playing.
|
|
1981
|
+
*/
|
|
1982
|
+
pause() {
|
|
1983
|
+
if (!this.isPlaying) return;
|
|
1984
|
+
this.isPlaying = false;
|
|
1985
|
+
this.isPaused = true;
|
|
1986
|
+
}
|
|
1987
|
+
/**
|
|
1988
|
+
* Signals `VideoSystem` to stop playback and reset the playback position.
|
|
1989
|
+
*/
|
|
1990
|
+
stop() {
|
|
1991
|
+
this.isPlaying = false;
|
|
1992
|
+
this.isPaused = false;
|
|
1993
|
+
}
|
|
1994
|
+
};
|
|
1995
|
+
__name(_VideoComponent, "VideoComponent");
|
|
1996
|
+
var VideoComponent = _VideoComponent;
|
|
1997
|
+
|
|
1998
|
+
// core/factories/components/VideoFactory.ts
|
|
1999
|
+
function createVideoComponent(world, entityId, ...args) {
|
|
2000
|
+
const component = new VideoComponent(...args);
|
|
2001
|
+
world.addComponent(entityId, component);
|
|
2002
|
+
return component;
|
|
2003
|
+
}
|
|
2004
|
+
__name(createVideoComponent, "createVideoComponent");
|
|
2005
|
+
|
|
2006
|
+
// core/factories/registerDefaultComponentFactories.ts
|
|
2007
|
+
function registerDefaultComponentFactories(objectManagementSystem) {
|
|
2008
|
+
objectManagementSystem.registerComponentFactory("animation", createAnimationComponent);
|
|
2009
|
+
objectManagementSystem.registerComponentFactory("audio", createAudioComponent);
|
|
2010
|
+
objectManagementSystem.registerComponentFactory("camera", createCameraComponent);
|
|
2011
|
+
objectManagementSystem.registerComponentFactory("physics", createPhysicsComponent);
|
|
2012
|
+
objectManagementSystem.registerComponentFactory("environment", createEnvironmentComponent);
|
|
2013
|
+
objectManagementSystem.registerComponentFactory("entityType", createEntityTypeComponent);
|
|
2014
|
+
objectManagementSystem.registerComponentFactory("image", createImageComponent);
|
|
2015
|
+
objectManagementSystem.registerComponentFactory(
|
|
2016
|
+
"imageTargetAnchor",
|
|
2017
|
+
createImageTargetAnchorComponent
|
|
2018
|
+
);
|
|
2019
|
+
objectManagementSystem.registerComponentFactory("imageTarget", createImageTargetComponent);
|
|
2020
|
+
objectManagementSystem.registerComponentFactory("light", createLightComponent);
|
|
2021
|
+
objectManagementSystem.registerComponentFactory("material", createMaterialComponent);
|
|
2022
|
+
objectManagementSystem.registerComponentFactory("mesh", createMeshComponent);
|
|
2023
|
+
objectManagementSystem.registerComponentFactory(
|
|
2024
|
+
"meshGeometry",
|
|
2025
|
+
createMeshGeometryComponent
|
|
2026
|
+
);
|
|
2027
|
+
objectManagementSystem.registerComponentFactory("model", createModelComponent);
|
|
2028
|
+
objectManagementSystem.registerComponentFactory("name", createNameComponent);
|
|
2029
|
+
objectManagementSystem.registerComponentFactory(
|
|
2030
|
+
"object3DRef",
|
|
2031
|
+
createObject3DRefComponent
|
|
2032
|
+
);
|
|
2033
|
+
objectManagementSystem.registerComponentFactory("parentId", createParentIdComponent);
|
|
2034
|
+
objectManagementSystem.registerComponentFactory(
|
|
2035
|
+
"postprocessing",
|
|
2036
|
+
createPostprocessingComponent
|
|
2037
|
+
);
|
|
2038
|
+
objectManagementSystem.registerComponentFactory("script", createScriptComponent);
|
|
2039
|
+
objectManagementSystem.registerComponentFactory("selectable", createSelectableComponent);
|
|
2040
|
+
objectManagementSystem.registerComponentFactory(
|
|
2041
|
+
"selectionTransformState",
|
|
2042
|
+
createSelectionTransformStateComponent
|
|
2043
|
+
);
|
|
2044
|
+
objectManagementSystem.registerComponentFactory("sprite", createSpriteComponent);
|
|
2045
|
+
objectManagementSystem.registerComponentFactory("transform", createTransformComponent);
|
|
2046
|
+
objectManagementSystem.registerComponentFactory("video", createVideoComponent);
|
|
2047
|
+
}
|
|
2048
|
+
__name(registerDefaultComponentFactories, "registerDefaultComponentFactories");
|
|
2049
|
+
function createTransform(input) {
|
|
2050
|
+
return new TransformComponent(input);
|
|
2051
|
+
}
|
|
2052
|
+
__name(createTransform, "createTransform");
|
|
2053
|
+
function applyTransform(object, transform) {
|
|
2054
|
+
object.position.set(
|
|
2055
|
+
transform.position.x,
|
|
2056
|
+
transform.position.y,
|
|
2057
|
+
transform.position.z
|
|
2058
|
+
);
|
|
2059
|
+
object.rotation.set(
|
|
2060
|
+
transform.rotation.x,
|
|
2061
|
+
transform.rotation.y,
|
|
2062
|
+
transform.rotation.z
|
|
2063
|
+
);
|
|
2064
|
+
object.scale.set(transform.scale.x, transform.scale.y, transform.scale.z);
|
|
2065
|
+
}
|
|
2066
|
+
__name(applyTransform, "applyTransform");
|
|
2067
|
+
|
|
2068
|
+
// core/factories/objects/shared.ts
|
|
2069
|
+
function createBaseEntity(world, object, options) {
|
|
2070
|
+
const entityId = world.createEntity();
|
|
2071
|
+
object.userData.entityId = entityId;
|
|
2072
|
+
const transform = createTransform(options.transformInput);
|
|
2073
|
+
applyTransform(object, transform);
|
|
2074
|
+
world.addComponent(entityId, transform);
|
|
2075
|
+
createObject3DRefComponent(world, entityId, object);
|
|
2076
|
+
createNameComponent(world, entityId, options.label);
|
|
2077
|
+
createEntityTypeComponent(world, entityId, options.entityType);
|
|
2078
|
+
createParentIdComponent(world, entityId, options.parentId ?? null);
|
|
2079
|
+
createSelectableComponent(world, entityId, true);
|
|
2080
|
+
return entityId;
|
|
2081
|
+
}
|
|
2082
|
+
__name(createBaseEntity, "createBaseEntity");
|
|
2083
|
+
|
|
2084
|
+
// core/factories/objects/AudioFactory.ts
|
|
2085
|
+
function getOrCreateListener(camera) {
|
|
2086
|
+
const existing = camera.userData.ecsAudioListener;
|
|
2087
|
+
if (existing instanceof THREE26__namespace.AudioListener) {
|
|
2088
|
+
return existing;
|
|
2089
|
+
}
|
|
2090
|
+
const listener = new THREE26__namespace.AudioListener();
|
|
2091
|
+
camera.add(listener);
|
|
2092
|
+
camera.userData.ecsAudioListener = listener;
|
|
2093
|
+
return listener;
|
|
2094
|
+
}
|
|
2095
|
+
__name(getOrCreateListener, "getOrCreateListener");
|
|
2096
|
+
function createAudio({
|
|
2097
|
+
world,
|
|
2098
|
+
scene,
|
|
2099
|
+
camera,
|
|
2100
|
+
payload,
|
|
2101
|
+
isEditor
|
|
2102
|
+
}) {
|
|
2103
|
+
const anchor = new THREE26__namespace.Object3D();
|
|
2104
|
+
const entityId = createBaseEntity(world, anchor, {
|
|
2105
|
+
label: payload.name ?? "Audio",
|
|
2106
|
+
entityType: "audio",
|
|
2107
|
+
transformInput: payload.transform
|
|
2108
|
+
});
|
|
2109
|
+
const audio = createAudioComponent(
|
|
2110
|
+
world,
|
|
2111
|
+
entityId,
|
|
2112
|
+
payload.path ?? "",
|
|
2113
|
+
payload.options ?? {},
|
|
2114
|
+
{
|
|
2115
|
+
object: anchor,
|
|
2116
|
+
listener: getOrCreateListener(camera),
|
|
2117
|
+
isEditor
|
|
2118
|
+
}
|
|
2119
|
+
);
|
|
2120
|
+
scene.add(anchor);
|
|
2121
|
+
if (!audio.path) {
|
|
2122
|
+
return entityId;
|
|
2123
|
+
}
|
|
2124
|
+
if (!isEditor) {
|
|
2125
|
+
const loader = new THREE26__namespace.AudioLoader();
|
|
2126
|
+
loader.load(
|
|
2127
|
+
audio.path,
|
|
2128
|
+
(buffer) => {
|
|
2129
|
+
if (!world.hasEntity(entityId)) {
|
|
2130
|
+
return;
|
|
2131
|
+
}
|
|
2132
|
+
const sound = audio.audio;
|
|
2133
|
+
if (!sound) {
|
|
2134
|
+
return;
|
|
2135
|
+
}
|
|
2136
|
+
sound.setBuffer(buffer);
|
|
2137
|
+
if (audio.options.autoplay) {
|
|
2138
|
+
audio.play();
|
|
2139
|
+
}
|
|
2140
|
+
},
|
|
2141
|
+
void 0,
|
|
2142
|
+
(error) => {
|
|
2143
|
+
console.error(`Failed to load audio: ${audio.path}`, error);
|
|
2144
|
+
}
|
|
2145
|
+
);
|
|
2146
|
+
}
|
|
2147
|
+
return entityId;
|
|
2148
|
+
}
|
|
2149
|
+
__name(createAudio, "createAudio");
|
|
2150
|
+
var DEFAULT_NEAR2 = 0.1;
|
|
2151
|
+
var DEFAULT_FAR2 = 2e3;
|
|
2152
|
+
var DEFAULT_FOV2 = 50;
|
|
2153
|
+
var DEFAULT_ORTHOGRAPHIC_HALF_HEIGHT = 5;
|
|
2154
|
+
function readViewportAspect() {
|
|
2155
|
+
if (typeof window === "undefined") {
|
|
2156
|
+
return 1;
|
|
2157
|
+
}
|
|
2158
|
+
const width = window.innerWidth;
|
|
2159
|
+
const height = window.innerHeight;
|
|
2160
|
+
if (Number.isFinite(width) && Number.isFinite(height) && width > 0 && height > 0) {
|
|
2161
|
+
return width / height;
|
|
2162
|
+
}
|
|
2163
|
+
return 1;
|
|
2164
|
+
}
|
|
2165
|
+
__name(readViewportAspect, "readViewportAspect");
|
|
2166
|
+
function toCameraCreateOptions(input) {
|
|
2167
|
+
if (!input || typeof input !== "object") {
|
|
2168
|
+
return {};
|
|
2169
|
+
}
|
|
2170
|
+
const value = input;
|
|
2171
|
+
const type = value.type === "3d" || value.type === "ar" ? value.type : void 0;
|
|
2172
|
+
const projection = value.projection === "orthographic" || value.projection === "perspective" ? value.projection : void 0;
|
|
2173
|
+
return {
|
|
2174
|
+
type,
|
|
2175
|
+
isDefault: typeof value.isDefault === "boolean" ? value.isDefault : void 0,
|
|
2176
|
+
projection,
|
|
2177
|
+
fov: typeof value.fov === "number" && Number.isFinite(value.fov) ? value.fov : void 0,
|
|
2178
|
+
near: typeof value.near === "number" && Number.isFinite(value.near) ? value.near : void 0,
|
|
2179
|
+
far: typeof value.far === "number" && Number.isFinite(value.far) ? value.far : void 0,
|
|
2180
|
+
left: typeof value.left === "number" && Number.isFinite(value.left) ? value.left : void 0,
|
|
2181
|
+
right: typeof value.right === "number" && Number.isFinite(value.right) ? value.right : void 0,
|
|
2182
|
+
top: typeof value.top === "number" && Number.isFinite(value.top) ? value.top : void 0,
|
|
2183
|
+
bottom: typeof value.bottom === "number" && Number.isFinite(value.bottom) ? value.bottom : void 0,
|
|
2184
|
+
zoom: typeof value.zoom === "number" && Number.isFinite(value.zoom) ? value.zoom : void 0
|
|
2185
|
+
};
|
|
2186
|
+
}
|
|
2187
|
+
__name(toCameraCreateOptions, "toCameraCreateOptions");
|
|
2188
|
+
function resolveCameraCreateOptions(payload) {
|
|
2189
|
+
const next = toCameraCreateOptions(payload.options);
|
|
2190
|
+
if (payload.options && typeof payload.options === "object") {
|
|
2191
|
+
return next;
|
|
2192
|
+
}
|
|
2193
|
+
return toCameraCreateOptions(payload.camera);
|
|
2194
|
+
}
|
|
2195
|
+
__name(resolveCameraCreateOptions, "resolveCameraCreateOptions");
|
|
2196
|
+
function applyCameraSettings(camera, options) {
|
|
2197
|
+
const near = typeof options.near === "number" ? options.near : DEFAULT_NEAR2;
|
|
2198
|
+
const far = typeof options.far === "number" ? options.far : DEFAULT_FAR2;
|
|
2199
|
+
const projection = options.projection;
|
|
2200
|
+
if (camera instanceof THREE26__namespace.PerspectiveCamera) {
|
|
2201
|
+
if (!projection || projection === "perspective") {
|
|
2202
|
+
camera.fov = typeof options.fov === "number" ? options.fov : DEFAULT_FOV2;
|
|
2203
|
+
}
|
|
2204
|
+
camera.aspect = readViewportAspect();
|
|
2205
|
+
camera.near = near;
|
|
2206
|
+
camera.far = far;
|
|
2207
|
+
camera.updateProjectionMatrix();
|
|
2208
|
+
return;
|
|
2209
|
+
}
|
|
2210
|
+
if (camera instanceof THREE26__namespace.OrthographicCamera) {
|
|
2211
|
+
camera.left = typeof options.left === "number" ? options.left : -DEFAULT_ORTHOGRAPHIC_HALF_HEIGHT;
|
|
2212
|
+
camera.right = typeof options.right === "number" ? options.right : DEFAULT_ORTHOGRAPHIC_HALF_HEIGHT;
|
|
2213
|
+
camera.top = typeof options.top === "number" ? options.top : DEFAULT_ORTHOGRAPHIC_HALF_HEIGHT;
|
|
2214
|
+
camera.bottom = typeof options.bottom === "number" ? options.bottom : -DEFAULT_ORTHOGRAPHIC_HALF_HEIGHT;
|
|
2215
|
+
camera.zoom = typeof options.zoom === "number" ? options.zoom : 1;
|
|
2216
|
+
camera.near = near;
|
|
2217
|
+
camera.far = far;
|
|
2218
|
+
camera.updateProjectionMatrix();
|
|
2219
|
+
}
|
|
2220
|
+
}
|
|
2221
|
+
__name(applyCameraSettings, "applyCameraSettings");
|
|
2222
|
+
function createCameraObject(options) {
|
|
2223
|
+
const projection = options.projection ?? "perspective";
|
|
2224
|
+
const near = options.near ?? DEFAULT_NEAR2;
|
|
2225
|
+
const far = options.far ?? DEFAULT_FAR2;
|
|
2226
|
+
if (projection === "orthographic") {
|
|
2227
|
+
const top = options.top ?? DEFAULT_ORTHOGRAPHIC_HALF_HEIGHT;
|
|
2228
|
+
const bottom = options.bottom ?? -DEFAULT_ORTHOGRAPHIC_HALF_HEIGHT;
|
|
2229
|
+
const left = options.left ?? -DEFAULT_ORTHOGRAPHIC_HALF_HEIGHT;
|
|
2230
|
+
const right = options.right ?? DEFAULT_ORTHOGRAPHIC_HALF_HEIGHT;
|
|
2231
|
+
const camera = new THREE26__namespace.OrthographicCamera(
|
|
2232
|
+
left,
|
|
2233
|
+
right,
|
|
2234
|
+
top,
|
|
2235
|
+
bottom,
|
|
2236
|
+
near,
|
|
2237
|
+
far
|
|
2238
|
+
);
|
|
2239
|
+
camera.zoom = options.zoom ?? 1;
|
|
2240
|
+
camera.updateProjectionMatrix();
|
|
2241
|
+
return camera;
|
|
2242
|
+
}
|
|
2243
|
+
return new THREE26__namespace.PerspectiveCamera(
|
|
2244
|
+
options.fov ?? DEFAULT_FOV2,
|
|
2245
|
+
readViewportAspect(),
|
|
2246
|
+
near,
|
|
2247
|
+
far
|
|
2248
|
+
);
|
|
2249
|
+
}
|
|
2250
|
+
__name(createCameraObject, "createCameraObject");
|
|
2251
|
+
function createCamera({ world, scene, camera, payload, isEditor }) {
|
|
2252
|
+
const options = resolveCameraCreateOptions(payload);
|
|
2253
|
+
const useWorldCamera = !isEditor && (payload.useWorldCamera === true || Boolean(options.isDefault));
|
|
2254
|
+
const object = useWorldCamera ? camera : createCameraObject(options);
|
|
2255
|
+
const entityId = createBaseEntity(world, object, {
|
|
2256
|
+
label: payload.name ?? "Camera",
|
|
2257
|
+
entityType: "camera",
|
|
2258
|
+
transformInput: payload.transform
|
|
2259
|
+
});
|
|
2260
|
+
const objectRef = world.getComponent(entityId, Object3DRef);
|
|
2261
|
+
if (objectRef?.object instanceof THREE26__namespace.Camera) {
|
|
2262
|
+
objectRef.object.userData.entityId = entityId;
|
|
2263
|
+
}
|
|
2264
|
+
const componentOptions = {
|
|
2265
|
+
camera: object,
|
|
2266
|
+
type: options.type,
|
|
2267
|
+
isDefault: options.isDefault,
|
|
2268
|
+
projection: options.projection,
|
|
2269
|
+
fov: options.fov,
|
|
2270
|
+
near: options.near,
|
|
2271
|
+
far: options.far,
|
|
2272
|
+
left: options.left,
|
|
2273
|
+
right: options.right,
|
|
2274
|
+
top: options.top,
|
|
2275
|
+
bottom: options.bottom,
|
|
2276
|
+
zoom: options.zoom
|
|
2277
|
+
};
|
|
2278
|
+
const component = createCameraComponent(world, entityId, componentOptions);
|
|
2279
|
+
if (useWorldCamera) {
|
|
2280
|
+
applyCameraSettings(object, options);
|
|
2281
|
+
} else {
|
|
2282
|
+
applyCameraSettings(object, options);
|
|
2283
|
+
if (isEditor && component.isDefault) {
|
|
2284
|
+
const helper = new THREE26__namespace.CameraHelper(object);
|
|
2285
|
+
helper.onBeforeRender = () => {
|
|
2286
|
+
helper.update();
|
|
2287
|
+
};
|
|
2288
|
+
helper.userData.ecsHelper = true;
|
|
2289
|
+
helper.visible = false;
|
|
2290
|
+
object.add(helper);
|
|
2291
|
+
}
|
|
2292
|
+
scene.add(object);
|
|
2293
|
+
}
|
|
2294
|
+
return entityId;
|
|
2295
|
+
}
|
|
2296
|
+
__name(createCamera, "createCamera");
|
|
2297
|
+
function createCapsule({
|
|
2298
|
+
world,
|
|
2299
|
+
scene,
|
|
2300
|
+
payload
|
|
2301
|
+
}) {
|
|
2302
|
+
const geometry = new THREE26__namespace.CapsuleGeometry(0.5, 1, 4, 8);
|
|
2303
|
+
const material = new THREE26__namespace.MeshStandardMaterial({ color: "#ffffff" });
|
|
2304
|
+
const mesh = new THREE26__namespace.Mesh(geometry, material);
|
|
2305
|
+
const entityId = createBaseEntity(world, mesh, {
|
|
2306
|
+
label: payload.name ?? "Capsule",
|
|
2307
|
+
entityType: "capsule",
|
|
2308
|
+
transformInput: payload.transform
|
|
2309
|
+
});
|
|
2310
|
+
createMeshComponent(world, entityId, mesh);
|
|
2311
|
+
createMaterialComponent(world, entityId, material);
|
|
2312
|
+
createMeshGeometryComponent(world, entityId, "capsule", mesh, {
|
|
2313
|
+
radius: 0.5,
|
|
2314
|
+
height: 1
|
|
2315
|
+
}, {
|
|
2316
|
+
castShadow: false,
|
|
2317
|
+
receiveShadow: false
|
|
2318
|
+
});
|
|
2319
|
+
scene.add(mesh);
|
|
2320
|
+
return entityId;
|
|
2321
|
+
}
|
|
2322
|
+
__name(createCapsule, "createCapsule");
|
|
2323
|
+
function createCube({ world, scene, payload }) {
|
|
2324
|
+
const geometry = new THREE26__namespace.BoxGeometry(1, 1, 1);
|
|
2325
|
+
const material = new THREE26__namespace.MeshStandardMaterial({ color: "#ffffff" });
|
|
2326
|
+
const mesh = new THREE26__namespace.Mesh(geometry, material);
|
|
2327
|
+
const entityId = createBaseEntity(world, mesh, {
|
|
2328
|
+
label: payload.name ?? "Cube",
|
|
2329
|
+
entityType: "cube",
|
|
2330
|
+
transformInput: payload.transform
|
|
2331
|
+
});
|
|
2332
|
+
createMeshComponent(world, entityId, mesh);
|
|
2333
|
+
createMaterialComponent(world, entityId, material);
|
|
2334
|
+
createMeshGeometryComponent(world, entityId, "cube", mesh, {
|
|
2335
|
+
width: 1,
|
|
2336
|
+
height: 1,
|
|
2337
|
+
depth: 1
|
|
2338
|
+
}, {
|
|
2339
|
+
castShadow: false,
|
|
2340
|
+
receiveShadow: false
|
|
2341
|
+
});
|
|
2342
|
+
scene.add(mesh);
|
|
2343
|
+
return entityId;
|
|
2344
|
+
}
|
|
2345
|
+
__name(createCube, "createCube");
|
|
2346
|
+
function createCylinder({
|
|
2347
|
+
world,
|
|
2348
|
+
scene,
|
|
2349
|
+
payload
|
|
2350
|
+
}) {
|
|
2351
|
+
const geometry = new THREE26__namespace.CylinderGeometry(0.5, 0.5, 1, 20);
|
|
2352
|
+
const material = new THREE26__namespace.MeshStandardMaterial({ color: "#ffffff" });
|
|
2353
|
+
const mesh = new THREE26__namespace.Mesh(geometry, material);
|
|
2354
|
+
const entityId = createBaseEntity(world, mesh, {
|
|
2355
|
+
label: payload.name ?? "Cylinder",
|
|
2356
|
+
entityType: "cylinder",
|
|
2357
|
+
transformInput: payload.transform
|
|
2358
|
+
});
|
|
2359
|
+
createMeshComponent(world, entityId, mesh);
|
|
2360
|
+
createMaterialComponent(world, entityId, material);
|
|
2361
|
+
createMeshGeometryComponent(world, entityId, "cylinder", mesh, {
|
|
2362
|
+
radius: 0.5,
|
|
2363
|
+
height: 1
|
|
2364
|
+
}, {
|
|
2365
|
+
castShadow: false,
|
|
2366
|
+
receiveShadow: false
|
|
2367
|
+
});
|
|
2368
|
+
scene.add(mesh);
|
|
2369
|
+
return entityId;
|
|
2370
|
+
}
|
|
2371
|
+
__name(createCylinder, "createCylinder");
|
|
2372
|
+
function createEmpty({ world, scene, payload, isEditor }) {
|
|
2373
|
+
const object = new THREE26__namespace.Group();
|
|
2374
|
+
const entityId = createBaseEntity(world, object, {
|
|
2375
|
+
label: payload.name ?? "Empty",
|
|
2376
|
+
entityType: "empty",
|
|
2377
|
+
transformInput: payload.transform
|
|
2378
|
+
});
|
|
2379
|
+
scene.add(object);
|
|
2380
|
+
return entityId;
|
|
2381
|
+
}
|
|
2382
|
+
__name(createEmpty, "createEmpty");
|
|
2383
|
+
function createImage({ world, scene, payload }) {
|
|
2384
|
+
const anchor = new THREE26__namespace.Object3D();
|
|
2385
|
+
const imagePath = payload.path ?? "";
|
|
2386
|
+
const entityId = createBaseEntity(world, anchor, {
|
|
2387
|
+
label: payload.name ?? "Image",
|
|
2388
|
+
entityType: "image",
|
|
2389
|
+
transformInput: payload.transform
|
|
2390
|
+
});
|
|
2391
|
+
const image = createImageComponent(world, entityId, imagePath);
|
|
2392
|
+
image.object = anchor;
|
|
2393
|
+
scene.add(anchor);
|
|
2394
|
+
if (!imagePath) {
|
|
2395
|
+
return entityId;
|
|
2396
|
+
}
|
|
2397
|
+
const loader = new THREE26__namespace.TextureLoader();
|
|
2398
|
+
loader.load(
|
|
2399
|
+
imagePath,
|
|
2400
|
+
(texture) => {
|
|
2401
|
+
if (!world.hasEntity(entityId)) {
|
|
2402
|
+
texture.dispose();
|
|
2403
|
+
return;
|
|
2404
|
+
}
|
|
2405
|
+
const material = new THREE26__namespace.MeshBasicMaterial({
|
|
2406
|
+
map: texture,
|
|
2407
|
+
transparent: true,
|
|
2408
|
+
side: THREE26__namespace.DoubleSide
|
|
2409
|
+
});
|
|
2410
|
+
const geometry = new THREE26__namespace.PlaneGeometry(1, 1);
|
|
2411
|
+
const plane = new THREE26__namespace.Mesh(geometry, material);
|
|
2412
|
+
plane.userData.entityId = entityId;
|
|
2413
|
+
const textureImage = texture.image;
|
|
2414
|
+
const width = textureImage?.width ?? 1;
|
|
2415
|
+
const height = textureImage?.height ?? 1;
|
|
2416
|
+
const aspect = height > 0 ? width / height : 1;
|
|
2417
|
+
image.width = width;
|
|
2418
|
+
image.height = height;
|
|
2419
|
+
plane.scale.set(aspect, 1, 1);
|
|
2420
|
+
anchor.add(plane);
|
|
2421
|
+
image.texture = texture;
|
|
2422
|
+
image.object = plane;
|
|
2423
|
+
},
|
|
2424
|
+
void 0,
|
|
2425
|
+
(error) => {
|
|
2426
|
+
console.error(`Failed to load image: ${imagePath}`, error);
|
|
2427
|
+
}
|
|
2428
|
+
);
|
|
2429
|
+
return entityId;
|
|
2430
|
+
}
|
|
2431
|
+
__name(createImage, "createImage");
|
|
2432
|
+
function toImageTargetOptions(input) {
|
|
2433
|
+
if (!input || typeof input !== "object") {
|
|
2434
|
+
return {};
|
|
2435
|
+
}
|
|
2436
|
+
const value = input;
|
|
2437
|
+
const targets = Array.isArray(value.targets) ? value.targets.filter((target) => {
|
|
2438
|
+
if (!target || typeof target !== "object") {
|
|
2439
|
+
return false;
|
|
2440
|
+
}
|
|
2441
|
+
const candidate = target;
|
|
2442
|
+
return typeof candidate.id === "number" && Number.isFinite(candidate.id) && typeof candidate.url === "string" && candidate.url.length > 0 && typeof candidate.width === "number" && Number.isFinite(candidate.width) && typeof candidate.height === "number" && Number.isFinite(candidate.height);
|
|
2443
|
+
}) : void 0;
|
|
2444
|
+
return {
|
|
2445
|
+
targets,
|
|
2446
|
+
compiledTargetUrl: typeof value.compiledTargetUrl === "string" ? value.compiledTargetUrl : void 0,
|
|
2447
|
+
compiledTargetDir: typeof value.compiledTargetDir === "string" ? value.compiledTargetDir : void 0
|
|
2448
|
+
};
|
|
2449
|
+
}
|
|
2450
|
+
__name(toImageTargetOptions, "toImageTargetOptions");
|
|
2451
|
+
function createImageTarget({
|
|
2452
|
+
world,
|
|
2453
|
+
scene,
|
|
2454
|
+
payload,
|
|
2455
|
+
isEditor
|
|
2456
|
+
}) {
|
|
2457
|
+
const anchor = new THREE26__namespace.Object3D();
|
|
2458
|
+
const imagePath = payload.path ?? "";
|
|
2459
|
+
const entityId = createBaseEntity(world, anchor, {
|
|
2460
|
+
label: payload.name ?? "Image Target",
|
|
2461
|
+
entityType: "imageTarget",
|
|
2462
|
+
transformInput: payload.transform
|
|
2463
|
+
});
|
|
2464
|
+
const targetOptions = toImageTargetOptions(payload.options);
|
|
2465
|
+
const imageTarget = createImageTargetComponent(
|
|
2466
|
+
world,
|
|
2467
|
+
entityId,
|
|
2468
|
+
targetOptions
|
|
2469
|
+
);
|
|
2470
|
+
scene.add(anchor);
|
|
2471
|
+
if (!isEditor || !imagePath) {
|
|
2472
|
+
return entityId;
|
|
2473
|
+
}
|
|
2474
|
+
const loader = new THREE26__namespace.TextureLoader();
|
|
2475
|
+
loader.load(
|
|
2476
|
+
imagePath,
|
|
2477
|
+
(texture) => {
|
|
2478
|
+
if (!world.hasEntity(entityId)) {
|
|
2479
|
+
texture.dispose();
|
|
2480
|
+
return;
|
|
2481
|
+
}
|
|
2482
|
+
const material = new THREE26__namespace.MeshBasicMaterial({
|
|
2483
|
+
map: texture,
|
|
2484
|
+
transparent: true,
|
|
2485
|
+
side: THREE26__namespace.DoubleSide
|
|
2486
|
+
});
|
|
2487
|
+
const geometry = new THREE26__namespace.PlaneGeometry(1, 1);
|
|
2488
|
+
const plane = new THREE26__namespace.Mesh(geometry, material);
|
|
2489
|
+
plane.userData.entityId = entityId;
|
|
2490
|
+
const textureImage = texture.image;
|
|
2491
|
+
const width = textureImage?.width ?? 1;
|
|
2492
|
+
const height = textureImage?.height ?? 1;
|
|
2493
|
+
const aspect = height > 0 ? width / height : 1;
|
|
2494
|
+
plane.scale.set(aspect, 1, 1);
|
|
2495
|
+
anchor.add(plane);
|
|
2496
|
+
imageTarget.texture = texture;
|
|
2497
|
+
imageTarget.object = plane;
|
|
2498
|
+
},
|
|
2499
|
+
void 0,
|
|
2500
|
+
(error) => {
|
|
2501
|
+
console.error(`Failed to load image target: ${imagePath}`, error);
|
|
2502
|
+
}
|
|
2503
|
+
);
|
|
2504
|
+
return entityId;
|
|
2505
|
+
}
|
|
2506
|
+
__name(createImageTarget, "createImageTarget");
|
|
2507
|
+
function createAmbientLight({
|
|
2508
|
+
world,
|
|
2509
|
+
scene,
|
|
2510
|
+
payload
|
|
2511
|
+
}) {
|
|
2512
|
+
const light = new THREE26__namespace.AmbientLight("#ffffff", 0.6);
|
|
2513
|
+
const entityId = createBaseEntity(world, light, {
|
|
2514
|
+
label: payload.name ?? "Ambient Light",
|
|
2515
|
+
entityType: "ambientLight",
|
|
2516
|
+
transformInput: payload.transform
|
|
2517
|
+
});
|
|
2518
|
+
createLightComponent(world, entityId, light);
|
|
2519
|
+
scene.add(light);
|
|
2520
|
+
return entityId;
|
|
2521
|
+
}
|
|
2522
|
+
__name(createAmbientLight, "createAmbientLight");
|
|
2523
|
+
function createAreaLight({
|
|
2524
|
+
world,
|
|
2525
|
+
scene,
|
|
2526
|
+
payload,
|
|
2527
|
+
isEditor
|
|
2528
|
+
}) {
|
|
2529
|
+
const light = new THREE26__namespace.RectAreaLight("#ffffff", 5, 4, 4);
|
|
2530
|
+
light.lookAt(0, 0, 0);
|
|
2531
|
+
const entityId = createBaseEntity(world, light, {
|
|
2532
|
+
label: payload.name ?? "Area Light",
|
|
2533
|
+
entityType: "areaLight",
|
|
2534
|
+
transformInput: payload.transform ?? {
|
|
2535
|
+
position: { x: 0, y: 4, z: 0 }
|
|
2536
|
+
}
|
|
2537
|
+
});
|
|
2538
|
+
createLightComponent(world, entityId, light);
|
|
2539
|
+
if (isEditor) {
|
|
2540
|
+
const helper = new RectAreaLightHelper_js.RectAreaLightHelper(light, "#fb7185");
|
|
2541
|
+
helper.onBeforeRender = () => {
|
|
2542
|
+
helper.updateMatrixWorld(true);
|
|
2543
|
+
};
|
|
2544
|
+
helper.userData.ecsHelper = true;
|
|
2545
|
+
helper.visible = false;
|
|
2546
|
+
light.add(helper);
|
|
2547
|
+
}
|
|
2548
|
+
scene.add(light);
|
|
2549
|
+
return entityId;
|
|
2550
|
+
}
|
|
2551
|
+
__name(createAreaLight, "createAreaLight");
|
|
2552
|
+
function createDirectionalLight({
|
|
2553
|
+
world,
|
|
2554
|
+
scene,
|
|
2555
|
+
payload,
|
|
2556
|
+
isEditor
|
|
2557
|
+
}) {
|
|
2558
|
+
const light = new THREE26__namespace.DirectionalLight("#ffffff", 1.5);
|
|
2559
|
+
light.castShadow = true;
|
|
2560
|
+
const entityId = createBaseEntity(world, light, {
|
|
2561
|
+
label: payload.name ?? "Directional Light",
|
|
2562
|
+
entityType: "directionalLight",
|
|
2563
|
+
transformInput: payload.transform ?? {
|
|
2564
|
+
position: { x: 3, y: 6, z: 4 }
|
|
2565
|
+
}
|
|
2566
|
+
});
|
|
2567
|
+
createLightComponent(world, entityId, light);
|
|
2568
|
+
if (isEditor) {
|
|
2569
|
+
const helper = new THREE26__namespace.DirectionalLightHelper(light, 1.8, "#38bdf8");
|
|
2570
|
+
helper.onBeforeRender = () => {
|
|
2571
|
+
helper.update();
|
|
2572
|
+
};
|
|
2573
|
+
helper.userData.ecsHelper = true;
|
|
2574
|
+
helper.visible = false;
|
|
2575
|
+
light.add(helper);
|
|
2576
|
+
}
|
|
2577
|
+
scene.add(light);
|
|
2578
|
+
return entityId;
|
|
2579
|
+
}
|
|
2580
|
+
__name(createDirectionalLight, "createDirectionalLight");
|
|
2581
|
+
function createPointLight({
|
|
2582
|
+
world,
|
|
2583
|
+
scene,
|
|
2584
|
+
payload,
|
|
2585
|
+
isEditor
|
|
2586
|
+
}) {
|
|
2587
|
+
const light = new THREE26__namespace.PointLight("#ffffff", 1, 10);
|
|
2588
|
+
const entityId = createBaseEntity(world, light, {
|
|
2589
|
+
label: payload.name ?? "Point Light",
|
|
2590
|
+
entityType: "pointLight",
|
|
2591
|
+
transformInput: payload.transform ?? {
|
|
2592
|
+
position: { x: 2, y: 3, z: 2 }
|
|
2593
|
+
}
|
|
2594
|
+
});
|
|
2595
|
+
createLightComponent(world, entityId, light);
|
|
2596
|
+
if (isEditor) {
|
|
2597
|
+
const helper = new THREE26__namespace.PointLightHelper(light, 0.35, "#fbbf24");
|
|
2598
|
+
helper.onBeforeRender = () => {
|
|
2599
|
+
helper.update();
|
|
2600
|
+
};
|
|
2601
|
+
helper.userData.ecsHelper = true;
|
|
2602
|
+
helper.visible = false;
|
|
2603
|
+
light.add(helper);
|
|
2604
|
+
}
|
|
2605
|
+
scene.add(light);
|
|
2606
|
+
return entityId;
|
|
2607
|
+
}
|
|
2608
|
+
__name(createPointLight, "createPointLight");
|
|
2609
|
+
function createSpotLight({
|
|
2610
|
+
world,
|
|
2611
|
+
scene,
|
|
2612
|
+
payload,
|
|
2613
|
+
isEditor
|
|
2614
|
+
}) {
|
|
2615
|
+
const light = new THREE26__namespace.SpotLight("#ffffff", 1, 20, Math.PI / 6, 0.1, 1);
|
|
2616
|
+
const entityId = createBaseEntity(world, light, {
|
|
2617
|
+
label: payload.name ?? "Spot Light",
|
|
2618
|
+
entityType: "spotLight",
|
|
2619
|
+
transformInput: payload.transform ?? {
|
|
2620
|
+
position: { x: 2, y: 5, z: 2 }
|
|
2621
|
+
}
|
|
2622
|
+
});
|
|
2623
|
+
createLightComponent(world, entityId, light);
|
|
2624
|
+
if (isEditor) {
|
|
2625
|
+
const helper = new THREE26__namespace.SpotLightHelper(light, "#f59e0b");
|
|
2626
|
+
helper.onBeforeRender = () => {
|
|
2627
|
+
helper.update();
|
|
2628
|
+
};
|
|
2629
|
+
helper.userData.ecsHelper = true;
|
|
2630
|
+
helper.visible = false;
|
|
2631
|
+
light.add(helper);
|
|
2632
|
+
}
|
|
2633
|
+
scene.add(light);
|
|
2634
|
+
return entityId;
|
|
2635
|
+
}
|
|
2636
|
+
__name(createSpotLight, "createSpotLight");
|
|
2637
|
+
|
|
2638
|
+
// core/utils/dracoDecoderPath.ts
|
|
2639
|
+
var LOCAL_DRACO_DECODER_RELATIVE_PATH = "./assets/draco/";
|
|
2640
|
+
var DRACO_DECODER_CDN_PATH = "https://www.gstatic.com/draco/versioned/decoders/1.5.7/";
|
|
2641
|
+
function isBlockedBrowserFileUrl(url) {
|
|
2642
|
+
return url.startsWith("file://");
|
|
2643
|
+
}
|
|
2644
|
+
__name(isBlockedBrowserFileUrl, "isBlockedBrowserFileUrl");
|
|
2645
|
+
function resolveDracoDecoderPath() {
|
|
2646
|
+
try {
|
|
2647
|
+
const resolvedPath = new URL(
|
|
2648
|
+
LOCAL_DRACO_DECODER_RELATIVE_PATH,
|
|
2649
|
+
(typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.cjs', document.baseURI).href))
|
|
2650
|
+
).toString();
|
|
2651
|
+
if (isBlockedBrowserFileUrl(resolvedPath)) {
|
|
2652
|
+
return DRACO_DECODER_CDN_PATH;
|
|
2653
|
+
}
|
|
2654
|
+
return resolvedPath;
|
|
2655
|
+
} catch {
|
|
2656
|
+
return DRACO_DECODER_CDN_PATH;
|
|
2657
|
+
}
|
|
2658
|
+
}
|
|
2659
|
+
__name(resolveDracoDecoderPath, "resolveDracoDecoderPath");
|
|
2660
|
+
|
|
2661
|
+
// core/factories/objects/ModelFactory.ts
|
|
2662
|
+
var DEFAULT_DRACO_DECODER_PATH = resolveDracoDecoderPath();
|
|
2663
|
+
function getModelFileName(path) {
|
|
2664
|
+
const segments = path.split(/[\\/]/).filter(Boolean);
|
|
2665
|
+
return segments[segments.length - 1] ?? "";
|
|
2666
|
+
}
|
|
2667
|
+
__name(getModelFileName, "getModelFileName");
|
|
2668
|
+
function createModelLoader() {
|
|
2669
|
+
const loader = new GLTFLoader_js.GLTFLoader();
|
|
2670
|
+
try {
|
|
2671
|
+
const dracoLoader = new DRACOLoader_js.DRACOLoader();
|
|
2672
|
+
dracoLoader.setDecoderPath(DEFAULT_DRACO_DECODER_PATH);
|
|
2673
|
+
loader.setDRACOLoader(dracoLoader);
|
|
2674
|
+
} catch (error) {
|
|
2675
|
+
console.warn("DRACOLoader could not be configured. Loading non-Draco models only.", error);
|
|
2676
|
+
}
|
|
2677
|
+
return loader;
|
|
2678
|
+
}
|
|
2679
|
+
__name(createModelLoader, "createModelLoader");
|
|
2680
|
+
function createModel({ world, scene, payload }) {
|
|
2681
|
+
const anchor = new THREE26__namespace.Object3D();
|
|
2682
|
+
const modelPath = payload.path ?? "";
|
|
2683
|
+
const entityId = createBaseEntity(world, anchor, {
|
|
2684
|
+
label: payload.name ?? "Model",
|
|
2685
|
+
entityType: "model",
|
|
2686
|
+
transformInput: payload.transform
|
|
2687
|
+
});
|
|
2688
|
+
const model = createModelComponent(world, entityId, modelPath);
|
|
2689
|
+
const meshGeometry = createMeshGeometryComponent(world, entityId, "model", anchor, {}, {
|
|
2690
|
+
modelName: getModelFileName(modelPath),
|
|
2691
|
+
castShadow: false,
|
|
2692
|
+
receiveShadow: false
|
|
2693
|
+
});
|
|
2694
|
+
model.object = anchor;
|
|
2695
|
+
scene.add(anchor);
|
|
2696
|
+
if (!modelPath) {
|
|
2697
|
+
return entityId;
|
|
2698
|
+
}
|
|
2699
|
+
const loader = createModelLoader();
|
|
2700
|
+
loader.load(
|
|
2701
|
+
modelPath,
|
|
2702
|
+
(gltf) => {
|
|
2703
|
+
if (!world.hasEntity(entityId)) {
|
|
2704
|
+
return;
|
|
2705
|
+
}
|
|
2706
|
+
const object = gltf.scene;
|
|
2707
|
+
object.userData.entityId = entityId;
|
|
2708
|
+
object.traverse((child) => {
|
|
2709
|
+
child.userData.entityId = entityId;
|
|
2710
|
+
});
|
|
2711
|
+
anchor.add(object);
|
|
2712
|
+
model.object = object;
|
|
2713
|
+
meshGeometry.object = object;
|
|
2714
|
+
if (gltf.animations.length > 0) {
|
|
2715
|
+
let animation = world.getComponent(entityId, AnimationComponent);
|
|
2716
|
+
if (!animation) {
|
|
2717
|
+
animation = createAnimationComponent(world, entityId, {
|
|
2718
|
+
clips: gltf.animations,
|
|
2719
|
+
externalClipSources: [],
|
|
2720
|
+
paused: false,
|
|
2721
|
+
reverse: false,
|
|
2722
|
+
timeScale: 1,
|
|
2723
|
+
crossFadeDuration: 0
|
|
2724
|
+
});
|
|
2725
|
+
}
|
|
2726
|
+
animation.setModelClips(gltf.animations);
|
|
2727
|
+
}
|
|
2728
|
+
},
|
|
2729
|
+
void 0,
|
|
2730
|
+
(error) => {
|
|
2731
|
+
console.error(`Failed to load model: ${modelPath}`, error);
|
|
2732
|
+
}
|
|
2733
|
+
);
|
|
2734
|
+
return entityId;
|
|
2735
|
+
}
|
|
2736
|
+
__name(createModel, "createModel");
|
|
2737
|
+
function createPlane({ world, scene, payload }) {
|
|
2738
|
+
const geometry = new THREE26__namespace.PlaneGeometry(100, 100);
|
|
2739
|
+
const material = new THREE26__namespace.MeshStandardMaterial({
|
|
2740
|
+
color: "#ffffff",
|
|
2741
|
+
side: THREE26__namespace.DoubleSide
|
|
2742
|
+
});
|
|
2743
|
+
const mesh = new THREE26__namespace.Mesh(geometry, material);
|
|
2744
|
+
const entityId = createBaseEntity(
|
|
2745
|
+
world,
|
|
2746
|
+
mesh,
|
|
2747
|
+
{
|
|
2748
|
+
label: payload.name ?? "Plane",
|
|
2749
|
+
entityType: "plane",
|
|
2750
|
+
transformInput: {
|
|
2751
|
+
position: payload.transform?.position,
|
|
2752
|
+
rotation: payload.transform?.rotation ?? {
|
|
2753
|
+
x: -Math.PI / 2,
|
|
2754
|
+
y: 0,
|
|
2755
|
+
z: 0
|
|
2756
|
+
},
|
|
2757
|
+
scale: payload.transform?.scale
|
|
2758
|
+
}
|
|
2759
|
+
}
|
|
2760
|
+
);
|
|
2761
|
+
createMeshComponent(world, entityId, mesh);
|
|
2762
|
+
createMaterialComponent(world, entityId, material);
|
|
2763
|
+
createMeshGeometryComponent(world, entityId, "plane", mesh, {
|
|
2764
|
+
width: 10,
|
|
2765
|
+
height: 10
|
|
2766
|
+
}, {
|
|
2767
|
+
castShadow: false,
|
|
2768
|
+
receiveShadow: false
|
|
2769
|
+
});
|
|
2770
|
+
scene.add(mesh);
|
|
2771
|
+
return entityId;
|
|
2772
|
+
}
|
|
2773
|
+
__name(createPlane, "createPlane");
|
|
2774
|
+
function createSprite({ world, scene, payload }) {
|
|
2775
|
+
const anchor = new THREE26__namespace.Object3D();
|
|
2776
|
+
const imagePath = payload.path ?? "";
|
|
2777
|
+
const entityId = createBaseEntity(world, anchor, {
|
|
2778
|
+
label: payload.name ?? "Sprite",
|
|
2779
|
+
entityType: "sprite",
|
|
2780
|
+
transformInput: payload.transform
|
|
2781
|
+
});
|
|
2782
|
+
const spriteComponent = createSpriteComponent(world, entityId, imagePath);
|
|
2783
|
+
scene.add(anchor);
|
|
2784
|
+
if (!imagePath) {
|
|
2785
|
+
return entityId;
|
|
2786
|
+
}
|
|
2787
|
+
const loader = new THREE26__namespace.TextureLoader();
|
|
2788
|
+
loader.load(
|
|
2789
|
+
imagePath,
|
|
2790
|
+
(texture) => {
|
|
2791
|
+
if (!world.hasEntity(entityId)) {
|
|
2792
|
+
texture.dispose();
|
|
2793
|
+
return;
|
|
2794
|
+
}
|
|
2795
|
+
const material = new THREE26__namespace.SpriteMaterial({
|
|
2796
|
+
map: texture,
|
|
2797
|
+
transparent: true
|
|
2798
|
+
});
|
|
2799
|
+
const sprite = new THREE26__namespace.Sprite(material);
|
|
2800
|
+
sprite.userData.entityId = entityId;
|
|
2801
|
+
const textureImage = texture.image;
|
|
2802
|
+
spriteComponent.width = textureImage?.width ?? 1;
|
|
2803
|
+
spriteComponent.height = textureImage?.height ?? 1;
|
|
2804
|
+
anchor.add(sprite);
|
|
2805
|
+
spriteComponent.texture = texture;
|
|
2806
|
+
spriteComponent.object = sprite;
|
|
2807
|
+
},
|
|
2808
|
+
void 0,
|
|
2809
|
+
(error) => {
|
|
2810
|
+
console.error(`Failed to load sprite: ${imagePath}`, error);
|
|
2811
|
+
}
|
|
2812
|
+
);
|
|
2813
|
+
return entityId;
|
|
2814
|
+
}
|
|
2815
|
+
__name(createSprite, "createSprite");
|
|
2816
|
+
function createSphere({ world, scene, payload }) {
|
|
2817
|
+
const geometry = new THREE26__namespace.SphereGeometry(0.5, 24, 24);
|
|
2818
|
+
const material = new THREE26__namespace.MeshStandardMaterial({ color: "#ffffff" });
|
|
2819
|
+
const mesh = new THREE26__namespace.Mesh(geometry, material);
|
|
2820
|
+
const entityId = createBaseEntity(world, mesh, {
|
|
2821
|
+
label: payload.name ?? "Sphere",
|
|
2822
|
+
entityType: "sphere",
|
|
2823
|
+
transformInput: payload.transform
|
|
2824
|
+
});
|
|
2825
|
+
createMeshComponent(world, entityId, mesh);
|
|
2826
|
+
createMaterialComponent(world, entityId, material);
|
|
2827
|
+
createMeshGeometryComponent(world, entityId, "sphere", mesh, {
|
|
2828
|
+
radius: 0.5
|
|
2829
|
+
}, {
|
|
2830
|
+
castShadow: false,
|
|
2831
|
+
receiveShadow: false
|
|
2832
|
+
});
|
|
2833
|
+
scene.add(mesh);
|
|
2834
|
+
return entityId;
|
|
2835
|
+
}
|
|
2836
|
+
__name(createSphere, "createSphere");
|
|
2837
|
+
function getOrCreateListener2(camera) {
|
|
2838
|
+
const existing = camera.userData.ecsAudioListener;
|
|
2839
|
+
if (existing instanceof THREE26__namespace.AudioListener) {
|
|
2840
|
+
return existing;
|
|
2841
|
+
}
|
|
2842
|
+
const listener = new THREE26__namespace.AudioListener();
|
|
2843
|
+
camera.add(listener);
|
|
2844
|
+
camera.userData.ecsAudioListener = listener;
|
|
2845
|
+
return listener;
|
|
2846
|
+
}
|
|
2847
|
+
__name(getOrCreateListener2, "getOrCreateListener");
|
|
2848
|
+
function normalizeDistanceModel2(value) {
|
|
2849
|
+
const v = value.trim().toLowerCase();
|
|
2850
|
+
if (v === "linear" || v === "exponential") return v;
|
|
2851
|
+
return "inverse";
|
|
2852
|
+
}
|
|
2853
|
+
__name(normalizeDistanceModel2, "normalizeDistanceModel");
|
|
2854
|
+
function toBool(value, fallback) {
|
|
2855
|
+
return typeof value === "boolean" ? value : fallback;
|
|
2856
|
+
}
|
|
2857
|
+
__name(toBool, "toBool");
|
|
2858
|
+
function toNumber(value, fallback) {
|
|
2859
|
+
if (typeof value !== "number" || !Number.isFinite(value)) {
|
|
2860
|
+
return fallback;
|
|
2861
|
+
}
|
|
2862
|
+
return value;
|
|
2863
|
+
}
|
|
2864
|
+
__name(toNumber, "toNumber");
|
|
2865
|
+
function toColor(value, fallback) {
|
|
2866
|
+
if (typeof value !== "string" || value.trim().length === 0) {
|
|
2867
|
+
return fallback;
|
|
2868
|
+
}
|
|
2869
|
+
return value;
|
|
2870
|
+
}
|
|
2871
|
+
__name(toColor, "toColor");
|
|
2872
|
+
function normalizeOptions(input) {
|
|
2873
|
+
return {
|
|
2874
|
+
autoplay: toBool(input?.autoplay, false),
|
|
2875
|
+
loop: toBool(input?.loop, true),
|
|
2876
|
+
volume: Math.max(0, Math.min(1, toNumber(input?.volume, 1))),
|
|
2877
|
+
width: Math.max(0.01, toNumber(input?.width, 1)),
|
|
2878
|
+
height: Math.max(0.01, toNumber(input?.height, 1)),
|
|
2879
|
+
isGreenScreen: toBool(input?.isGreenScreen, false),
|
|
2880
|
+
backgroundColor: toColor(input?.backgroundColor, "#00ff00"),
|
|
2881
|
+
similarity: Math.max(0.01, Math.min(1, toNumber(input?.similarity, 0.4))),
|
|
2882
|
+
smoothness: Math.max(1e-3, Math.min(1, toNumber(input?.smoothness, 0.08))),
|
|
2883
|
+
spill: Math.max(0, Math.min(1, toNumber(input?.spill, 0.12))),
|
|
2884
|
+
positional: toBool(input?.positional, false),
|
|
2885
|
+
refDistance: Math.max(0, toNumber(input?.refDistance, 1)),
|
|
2886
|
+
distanceModel: toColor(input?.distanceModel, "inverse"),
|
|
2887
|
+
rolloffFactor: Math.max(0, toNumber(input?.rolloffFactor, 1))
|
|
2888
|
+
};
|
|
2889
|
+
}
|
|
2890
|
+
__name(normalizeOptions, "normalizeOptions");
|
|
2891
|
+
function createChromaMaterial(texture, options) {
|
|
2892
|
+
return new THREE26__namespace.ShaderMaterial({
|
|
2893
|
+
uniforms: {
|
|
2894
|
+
tex: { value: texture },
|
|
2895
|
+
keyColor: { value: new THREE26__namespace.Color(options.backgroundColor) },
|
|
2896
|
+
similarity: { value: options.similarity },
|
|
2897
|
+
smoothness: { value: options.smoothness },
|
|
2898
|
+
spill: { value: options.spill }
|
|
2899
|
+
},
|
|
2900
|
+
vertexShader: `
|
|
2901
|
+
varying vec2 vUv;
|
|
2902
|
+
void main() {
|
|
2903
|
+
vUv = uv;
|
|
2904
|
+
gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
|
|
2905
|
+
}
|
|
2906
|
+
`,
|
|
2907
|
+
fragmentShader: `
|
|
2908
|
+
uniform sampler2D tex;
|
|
2909
|
+
uniform vec3 keyColor;
|
|
2910
|
+
uniform float similarity;
|
|
2911
|
+
uniform float smoothness;
|
|
2912
|
+
uniform float spill;
|
|
2913
|
+
varying vec2 vUv;
|
|
2914
|
+
|
|
2915
|
+
void main() {
|
|
2916
|
+
vec4 texel = texture2D(tex, vUv);
|
|
2917
|
+
float chromaDist = distance(texel.rgb, keyColor);
|
|
2918
|
+
float alpha = smoothstep(similarity, similarity + smoothness, chromaDist);
|
|
2919
|
+
|
|
2920
|
+
float spillFactor = smoothstep(similarity, similarity + spill + smoothness, chromaDist);
|
|
2921
|
+
vec3 despilled = mix(vec3(dot(texel.rgb, vec3(0.299, 0.587, 0.114))), texel.rgb, spillFactor);
|
|
2922
|
+
|
|
2923
|
+
gl_FragColor = vec4(despilled, texel.a * alpha);
|
|
2924
|
+
}
|
|
2925
|
+
`,
|
|
2926
|
+
transparent: true,
|
|
2927
|
+
side: THREE26__namespace.DoubleSide
|
|
2928
|
+
});
|
|
2929
|
+
}
|
|
2930
|
+
__name(createChromaMaterial, "createChromaMaterial");
|
|
2931
|
+
function createStandardMaterial(texture) {
|
|
2932
|
+
return new THREE26__namespace.MeshBasicMaterial({
|
|
2933
|
+
map: texture,
|
|
2934
|
+
transparent: true,
|
|
2935
|
+
side: THREE26__namespace.DoubleSide
|
|
2936
|
+
});
|
|
2937
|
+
}
|
|
2938
|
+
__name(createStandardMaterial, "createStandardMaterial");
|
|
2939
|
+
function createVideoMesh(entityId, texture, options) {
|
|
2940
|
+
const geometry = new THREE26__namespace.PlaneGeometry(1, 1);
|
|
2941
|
+
const material = options.isGreenScreen ? createChromaMaterial(texture, options) : createStandardMaterial(texture);
|
|
2942
|
+
const mesh = new THREE26__namespace.Mesh(geometry, material);
|
|
2943
|
+
mesh.userData.entityId = entityId;
|
|
2944
|
+
mesh.scale.set(options.width, options.height, 1);
|
|
2945
|
+
return { mesh, material };
|
|
2946
|
+
}
|
|
2947
|
+
__name(createVideoMesh, "createVideoMesh");
|
|
2948
|
+
function applyMetadataSizing(video, mesh, options) {
|
|
2949
|
+
const width = video.videoWidth;
|
|
2950
|
+
const height = video.videoHeight;
|
|
2951
|
+
if (width <= 0 || height <= 0) {
|
|
2952
|
+
return;
|
|
2953
|
+
}
|
|
2954
|
+
const nextWidth = options.width > 0 ? options.width : width / height;
|
|
2955
|
+
const nextHeight = options.height > 0 ? options.height : 1;
|
|
2956
|
+
mesh.scale.set(nextWidth, nextHeight, 1);
|
|
2957
|
+
}
|
|
2958
|
+
__name(applyMetadataSizing, "applyMetadataSizing");
|
|
2959
|
+
function createVideoElement(path, options) {
|
|
2960
|
+
const video = document.createElement("video");
|
|
2961
|
+
video.src = path;
|
|
2962
|
+
video.crossOrigin = "anonymous";
|
|
2963
|
+
video.loop = options.loop;
|
|
2964
|
+
video.playsInline = true;
|
|
2965
|
+
video.preload = "auto";
|
|
2966
|
+
video.volume = options.volume;
|
|
2967
|
+
return video;
|
|
2968
|
+
}
|
|
2969
|
+
__name(createVideoElement, "createVideoElement");
|
|
2970
|
+
function createVideo({
|
|
2971
|
+
world,
|
|
2972
|
+
scene,
|
|
2973
|
+
camera,
|
|
2974
|
+
payload,
|
|
2975
|
+
isEditor
|
|
2976
|
+
}) {
|
|
2977
|
+
const anchor = new THREE26__namespace.Object3D();
|
|
2978
|
+
const path = payload.path ?? "";
|
|
2979
|
+
const options = normalizeOptions(payload.options);
|
|
2980
|
+
const entityId = createBaseEntity(world, anchor, {
|
|
2981
|
+
label: payload.name ?? "Video",
|
|
2982
|
+
entityType: "video",
|
|
2983
|
+
transformInput: payload.transform
|
|
2984
|
+
});
|
|
2985
|
+
const videoComponent = createVideoComponent(world, entityId, path, options);
|
|
2986
|
+
videoComponent.object = anchor;
|
|
2987
|
+
scene.add(anchor);
|
|
2988
|
+
if (!path || typeof document === "undefined") {
|
|
2989
|
+
return entityId;
|
|
2990
|
+
}
|
|
2991
|
+
const video = createVideoElement(path, options);
|
|
2992
|
+
const texture = new THREE26__namespace.VideoTexture(video);
|
|
2993
|
+
texture.colorSpace = THREE26__namespace.SRGBColorSpace;
|
|
2994
|
+
texture.needsUpdate = true;
|
|
2995
|
+
const { mesh, material } = createVideoMesh(entityId, texture, options);
|
|
2996
|
+
anchor.add(mesh);
|
|
2997
|
+
videoComponent.videoElement = video;
|
|
2998
|
+
videoComponent.texture = texture;
|
|
2999
|
+
videoComponent.material = material;
|
|
3000
|
+
videoComponent.object = mesh;
|
|
3001
|
+
video.addEventListener("loadedmetadata", () => {
|
|
3002
|
+
if (!world.hasEntity(entityId)) {
|
|
3003
|
+
return;
|
|
3004
|
+
}
|
|
3005
|
+
applyMetadataSizing(video, mesh, options);
|
|
3006
|
+
});
|
|
3007
|
+
if (!isEditor && options.positional) {
|
|
3008
|
+
const listener = getOrCreateListener2(camera);
|
|
3009
|
+
const audioNode = new THREE26__namespace.PositionalAudio(listener);
|
|
3010
|
+
audioNode.setVolume(options.volume);
|
|
3011
|
+
audioNode.setRefDistance(options.refDistance);
|
|
3012
|
+
audioNode.setDistanceModel(normalizeDistanceModel2(options.distanceModel));
|
|
3013
|
+
audioNode.setRolloffFactor(options.rolloffFactor);
|
|
3014
|
+
audioNode.setMediaElementSource(video);
|
|
3015
|
+
video.volume = 1;
|
|
3016
|
+
anchor.add(audioNode);
|
|
3017
|
+
videoComponent.audioNode = audioNode;
|
|
3018
|
+
}
|
|
3019
|
+
if (options.autoplay) {
|
|
3020
|
+
videoComponent.play();
|
|
3021
|
+
}
|
|
3022
|
+
return entityId;
|
|
3023
|
+
}
|
|
3024
|
+
__name(createVideo, "createVideo");
|
|
3025
|
+
|
|
3026
|
+
// core/factories/registerDefaultFactories.ts
|
|
3027
|
+
function registerDefaultFactories(objectManagementSystem) {
|
|
3028
|
+
objectManagementSystem.register("cube", createCube);
|
|
3029
|
+
objectManagementSystem.register("sphere", createSphere);
|
|
3030
|
+
objectManagementSystem.register("plane", createPlane);
|
|
3031
|
+
objectManagementSystem.register("capsule", createCapsule);
|
|
3032
|
+
objectManagementSystem.register("cylinder", createCylinder);
|
|
3033
|
+
objectManagementSystem.register("empty", createEmpty);
|
|
3034
|
+
objectManagementSystem.register("model", createModel);
|
|
3035
|
+
objectManagementSystem.register("image", createImage);
|
|
3036
|
+
objectManagementSystem.register("imageTarget", createImageTarget);
|
|
3037
|
+
objectManagementSystem.register("sprite", createSprite);
|
|
3038
|
+
objectManagementSystem.register("audio", createAudio);
|
|
3039
|
+
objectManagementSystem.register("camera", createCamera);
|
|
3040
|
+
objectManagementSystem.register("video", createVideo);
|
|
3041
|
+
objectManagementSystem.register("ambientLight", createAmbientLight);
|
|
3042
|
+
objectManagementSystem.register("directionalLight", createDirectionalLight);
|
|
3043
|
+
objectManagementSystem.register("pointLight", createPointLight);
|
|
3044
|
+
objectManagementSystem.register("spotLight", createSpotLight);
|
|
3045
|
+
objectManagementSystem.register("areaLight", createAreaLight);
|
|
3046
|
+
registerDefaultComponentFactories(objectManagementSystem);
|
|
3047
|
+
}
|
|
3048
|
+
__name(registerDefaultFactories, "registerDefaultFactories");
|
|
3049
|
+
|
|
3050
|
+
exports.createAnimationComponent = createAnimationComponent;
|
|
3051
|
+
exports.createAudioComponent = createAudioComponent;
|
|
3052
|
+
exports.createCameraComponent = createCameraComponent;
|
|
3053
|
+
exports.createEntityTypeComponent = createEntityTypeComponent;
|
|
3054
|
+
exports.createEnvironmentComponent = createEnvironmentComponent;
|
|
3055
|
+
exports.createImageComponent = createImageComponent;
|
|
3056
|
+
exports.createImageTargetAnchorComponent = createImageTargetAnchorComponent;
|
|
3057
|
+
exports.createImageTargetComponent = createImageTargetComponent;
|
|
3058
|
+
exports.createLightComponent = createLightComponent;
|
|
3059
|
+
exports.createMaterialComponent = createMaterialComponent;
|
|
3060
|
+
exports.createMeshComponent = createMeshComponent;
|
|
3061
|
+
exports.createMeshGeometryComponent = createMeshGeometryComponent;
|
|
3062
|
+
exports.createModelComponent = createModelComponent;
|
|
3063
|
+
exports.createNameComponent = createNameComponent;
|
|
3064
|
+
exports.createObject3DRefComponent = createObject3DRefComponent;
|
|
3065
|
+
exports.createParentIdComponent = createParentIdComponent;
|
|
3066
|
+
exports.createPhysicsComponent = createPhysicsComponent;
|
|
3067
|
+
exports.createPostprocessingComponent = createPostprocessingComponent;
|
|
3068
|
+
exports.createScriptComponent = createScriptComponent;
|
|
3069
|
+
exports.createSelectableComponent = createSelectableComponent;
|
|
3070
|
+
exports.createSelectionTransformStateComponent = createSelectionTransformStateComponent;
|
|
3071
|
+
exports.createSpriteComponent = createSpriteComponent;
|
|
3072
|
+
exports.createTransformComponent = createTransformComponent;
|
|
3073
|
+
exports.createVideoComponent = createVideoComponent;
|
|
3074
|
+
exports.registerDefaultComponentFactories = registerDefaultComponentFactories;
|
|
3075
|
+
exports.registerDefaultFactories = registerDefaultFactories;
|
|
3076
|
+
//# sourceMappingURL=index.cjs.map
|
|
3077
|
+
//# sourceMappingURL=index.cjs.map
|