@iwsdk/core 0.1.0
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/LICENSE +21 -0
- package/dist/asset/asset-manager.d.ts +72 -0
- package/dist/asset/asset-manager.d.ts.map +1 -0
- package/dist/asset/asset-manager.js +138 -0
- package/dist/asset/asset-manager.js.map +1 -0
- package/dist/asset/cache-manager.d.ts +44 -0
- package/dist/asset/cache-manager.d.ts.map +1 -0
- package/dist/asset/cache-manager.js +80 -0
- package/dist/asset/cache-manager.js.map +1 -0
- package/dist/asset/index.d.ts +9 -0
- package/dist/asset/index.d.ts.map +1 -0
- package/dist/asset/loaders/audio-loader.d.ts +21 -0
- package/dist/asset/loaders/audio-loader.d.ts.map +1 -0
- package/dist/asset/loaders/audio-loader.js +57 -0
- package/dist/asset/loaders/audio-loader.js.map +1 -0
- package/dist/asset/loaders/gltf-loader.d.ts +33 -0
- package/dist/asset/loaders/gltf-loader.d.ts.map +1 -0
- package/dist/asset/loaders/gltf-loader.js +79 -0
- package/dist/asset/loaders/gltf-loader.js.map +1 -0
- package/dist/asset/loaders/hdr-texture-loader.d.ts +18 -0
- package/dist/asset/loaders/hdr-texture-loader.d.ts.map +1 -0
- package/dist/asset/loaders/hdr-texture-loader.js +65 -0
- package/dist/asset/loaders/hdr-texture-loader.js.map +1 -0
- package/dist/asset/loaders/texture-loader.d.ts +21 -0
- package/dist/asset/loaders/texture-loader.d.ts.map +1 -0
- package/dist/asset/loaders/texture-loader.js +57 -0
- package/dist/asset/loaders/texture-loader.js.map +1 -0
- package/dist/audio/audio-pool.d.ts +59 -0
- package/dist/audio/audio-pool.d.ts.map +1 -0
- package/dist/audio/audio-pool.js +105 -0
- package/dist/audio/audio-pool.js.map +1 -0
- package/dist/audio/audio-system.d.ts +326 -0
- package/dist/audio/audio-system.d.ts.map +1 -0
- package/dist/audio/audio-system.js +478 -0
- package/dist/audio/audio-system.js.map +1 -0
- package/dist/audio/audio-utils.d.ts +71 -0
- package/dist/audio/audio-utils.d.ts.map +1 -0
- package/dist/audio/audio-utils.js +145 -0
- package/dist/audio/audio-utils.js.map +1 -0
- package/dist/audio/audio.d.ts +178 -0
- package/dist/audio/audio.d.ts.map +1 -0
- package/dist/audio/audio.js +104 -0
- package/dist/audio/audio.js.map +1 -0
- package/dist/audio/index.d.ts +11 -0
- package/dist/audio/index.d.ts.map +1 -0
- package/dist/ecs/component-registry.d.ts +54 -0
- package/dist/ecs/component-registry.d.ts.map +1 -0
- package/dist/ecs/component-registry.js +86 -0
- package/dist/ecs/component-registry.js.map +1 -0
- package/dist/ecs/component.d.ts +12 -0
- package/dist/ecs/component.d.ts.map +1 -0
- package/dist/ecs/entity.d.ts +17 -0
- package/dist/ecs/entity.d.ts.map +1 -0
- package/dist/ecs/entity.js +13 -0
- package/dist/ecs/entity.js.map +1 -0
- package/dist/ecs/index.d.ts +12 -0
- package/dist/ecs/index.d.ts.map +1 -0
- package/dist/ecs/system.d.ts +70 -0
- package/dist/ecs/system.d.ts.map +1 -0
- package/dist/ecs/system.js +79 -0
- package/dist/ecs/system.js.map +1 -0
- package/dist/ecs/world.d.ts +101 -0
- package/dist/ecs/world.d.ts.map +1 -0
- package/dist/ecs/world.js +165 -0
- package/dist/ecs/world.js.map +1 -0
- package/dist/environment/dome-gradient.d.ts +39 -0
- package/dist/environment/dome-gradient.d.ts.map +1 -0
- package/dist/environment/dome-gradient.js +30 -0
- package/dist/environment/dome-gradient.js.map +1 -0
- package/dist/environment/dome-texture.d.ts +39 -0
- package/dist/environment/dome-texture.d.ts.map +1 -0
- package/dist/environment/dome-texture.js +30 -0
- package/dist/environment/dome-texture.js.map +1 -0
- package/dist/environment/environment-system.d.ts +82 -0
- package/dist/environment/environment-system.d.ts.map +1 -0
- package/dist/environment/environment-system.js +389 -0
- package/dist/environment/environment-system.js.map +1 -0
- package/dist/environment/gradient-environment.d.ts +37 -0
- package/dist/environment/gradient-environment.d.ts.map +1 -0
- package/dist/environment/gradient-environment.js +99 -0
- package/dist/environment/gradient-environment.js.map +1 -0
- package/dist/environment/ibl-gradient.d.ts +38 -0
- package/dist/environment/ibl-gradient.d.ts.map +1 -0
- package/dist/environment/ibl-gradient.js +29 -0
- package/dist/environment/ibl-gradient.js.map +1 -0
- package/dist/environment/ibl-texture.d.ts +36 -0
- package/dist/environment/ibl-texture.d.ts.map +1 -0
- package/dist/environment/ibl-texture.js +30 -0
- package/dist/environment/ibl-texture.js.map +1 -0
- package/dist/environment/index.d.ts +12 -0
- package/dist/environment/index.d.ts.map +1 -0
- package/dist/grab/distance-grabbable.d.ts +115 -0
- package/dist/grab/distance-grabbable.d.ts.map +1 -0
- package/dist/grab/distance-grabbable.js +102 -0
- package/dist/grab/distance-grabbable.js.map +1 -0
- package/dist/grab/grab-system.d.ts +320 -0
- package/dist/grab/grab-system.d.ts.map +1 -0
- package/dist/grab/grab-system.js +239 -0
- package/dist/grab/grab-system.js.map +1 -0
- package/dist/grab/handles.d.ts +43 -0
- package/dist/grab/handles.d.ts.map +1 -0
- package/dist/grab/handles.js +132 -0
- package/dist/grab/handles.js.map +1 -0
- package/dist/grab/index.d.ts +13 -0
- package/dist/grab/index.d.ts.map +1 -0
- package/dist/grab/index.js +23 -0
- package/dist/grab/index.js.map +1 -0
- package/dist/grab/one-hand-grabbable.d.ts +80 -0
- package/dist/grab/one-hand-grabbable.d.ts.map +1 -0
- package/dist/grab/one-hand-grabbable.js +80 -0
- package/dist/grab/one-hand-grabbable.js.map +1 -0
- package/dist/grab/pointer-events-patch.d.ts +16 -0
- package/dist/grab/pointer-events-patch.d.ts.map +1 -0
- package/dist/grab/pointer-events-patch.js +223 -0
- package/dist/grab/pointer-events-patch.js.map +1 -0
- package/dist/grab/two-hands-grabbable.d.ts +103 -0
- package/dist/grab/two-hands-grabbable.d.ts.map +1 -0
- package/dist/grab/two-hands-grabbable.js +100 -0
- package/dist/grab/two-hands-grabbable.js.map +1 -0
- package/dist/index.d.ts +27 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +82 -0
- package/dist/index.js.map +1 -0
- package/dist/init/index.d.ts +9 -0
- package/dist/init/index.d.ts.map +1 -0
- package/dist/init/world-initializer.d.ts +76 -0
- package/dist/init/world-initializer.d.ts.map +1 -0
- package/dist/init/world-initializer.js +403 -0
- package/dist/init/world-initializer.js.map +1 -0
- package/dist/init/xr.d.ts +87 -0
- package/dist/init/xr.d.ts.map +1 -0
- package/dist/init/xr.js +193 -0
- package/dist/init/xr.js.map +1 -0
- package/dist/input/index.d.ts +9 -0
- package/dist/input/index.d.ts.map +1 -0
- package/dist/input/input-system.d.ts +52 -0
- package/dist/input/input-system.d.ts.map +1 -0
- package/dist/input/input-system.js +176 -0
- package/dist/input/input-system.js.map +1 -0
- package/dist/input/state-tags.d.ts +56 -0
- package/dist/input/state-tags.d.ts.map +1 -0
- package/dist/input/state-tags.js +63 -0
- package/dist/input/state-tags.js.map +1 -0
- package/dist/level/index.d.ts +12 -0
- package/dist/level/index.d.ts.map +1 -0
- package/dist/level/level-entity-creator.d.ts +27 -0
- package/dist/level/level-entity-creator.d.ts.map +1 -0
- package/dist/level/level-entity-creator.js +110 -0
- package/dist/level/level-entity-creator.js.map +1 -0
- package/dist/level/level-glxf-importer.d.ts +22 -0
- package/dist/level/level-glxf-importer.d.ts.map +1 -0
- package/dist/level/level-glxf-importer.js +40 -0
- package/dist/level/level-glxf-importer.js.map +1 -0
- package/dist/level/level-root.d.ts +18 -0
- package/dist/level/level-root.d.ts.map +1 -0
- package/dist/level/level-root.js +25 -0
- package/dist/level/level-root.js.map +1 -0
- package/dist/level/level-system.d.ts +54 -0
- package/dist/level/level-system.d.ts.map +1 -0
- package/dist/level/level-system.js +134 -0
- package/dist/level/level-system.js.map +1 -0
- package/dist/level/level-tag.d.ts +25 -0
- package/dist/level/level-tag.d.ts.map +1 -0
- package/dist/level/level-tag.js +28 -0
- package/dist/level/level-tag.js.map +1 -0
- package/dist/locomotion/geometries/beveled-cylinder.d.ts +12 -0
- package/dist/locomotion/geometries/beveled-cylinder.d.ts.map +1 -0
- package/dist/locomotion/geometries/beveled-cylinder.js +64 -0
- package/dist/locomotion/geometries/beveled-cylinder.js.map +1 -0
- package/dist/locomotion/index.d.ts +11 -0
- package/dist/locomotion/index.d.ts.map +1 -0
- package/dist/locomotion/locomotion.d.ts +239 -0
- package/dist/locomotion/locomotion.d.ts.map +1 -0
- package/dist/locomotion/locomotion.js +256 -0
- package/dist/locomotion/locomotion.js.map +1 -0
- package/dist/locomotion/materials/line.d.ts +24 -0
- package/dist/locomotion/materials/line.d.ts.map +1 -0
- package/dist/locomotion/materials/line.js +307 -0
- package/dist/locomotion/materials/line.js.map +1 -0
- package/dist/locomotion/slide.d.ts +76 -0
- package/dist/locomotion/slide.d.ts.map +1 -0
- package/dist/locomotion/slide.js +131 -0
- package/dist/locomotion/slide.js.map +1 -0
- package/dist/locomotion/teleport.d.ts +68 -0
- package/dist/locomotion/teleport.d.ts.map +1 -0
- package/dist/locomotion/teleport.js +150 -0
- package/dist/locomotion/teleport.js.map +1 -0
- package/dist/locomotion/turn.d.ts +77 -0
- package/dist/locomotion/turn.d.ts.map +1 -0
- package/dist/locomotion/turn.js +126 -0
- package/dist/locomotion/turn.js.map +1 -0
- package/dist/node_modules/.pnpm/@pmndrs_uikitml@0.0.10_@pmndrs_uikit@1.0.32_super-three@0.177.0_/node_modules/@pmndrs/uikitml/dist/index.js +13 -0
- package/dist/node_modules/.pnpm/@pmndrs_uikitml@0.0.10_@pmndrs_uikit@1.0.32_super-three@0.177.0_/node_modules/@pmndrs/uikitml/dist/index.js.map +1 -0
- package/dist/node_modules/.pnpm/@pmndrs_uikitml@0.0.10_@pmndrs_uikit@1.0.32_super-three@0.177.0_/node_modules/@pmndrs/uikitml/dist/interpreter/index.js +154 -0
- package/dist/node_modules/.pnpm/@pmndrs_uikitml@0.0.10_@pmndrs_uikit@1.0.32_super-three@0.177.0_/node_modules/@pmndrs/uikitml/dist/interpreter/index.js.map +1 -0
- package/dist/node_modules/.pnpm/parse5@7.3.0/node_modules/parse5/dist/common/error-codes.js +66 -0
- package/dist/node_modules/.pnpm/parse5@7.3.0/node_modules/parse5/dist/common/error-codes.js.map +1 -0
- package/dist/node_modules/.pnpm/parse5@7.3.0/node_modules/parse5/dist/common/foreign-content.js +162 -0
- package/dist/node_modules/.pnpm/parse5@7.3.0/node_modules/parse5/dist/common/foreign-content.js.map +1 -0
- package/dist/node_modules/.pnpm/parse5@7.3.0/node_modules/parse5/dist/common/html.js +519 -0
- package/dist/node_modules/.pnpm/parse5@7.3.0/node_modules/parse5/dist/common/html.js.map +1 -0
- package/dist/node_modules/.pnpm/parse5@7.3.0/node_modules/parse5/dist/common/token.js +15 -0
- package/dist/node_modules/.pnpm/parse5@7.3.0/node_modules/parse5/dist/common/token.js.map +1 -0
- package/dist/node_modules/.pnpm/parse5@7.3.0/node_modules/parse5/dist/common/unicode.js +32 -0
- package/dist/node_modules/.pnpm/parse5@7.3.0/node_modules/parse5/dist/common/unicode.js.map +1 -0
- package/dist/node_modules/.pnpm/parse5@7.3.0/node_modules/parse5/dist/parser/formatting-element-list.js +10 -0
- package/dist/node_modules/.pnpm/parse5@7.3.0/node_modules/parse5/dist/parser/formatting-element-list.js.map +1 -0
- package/dist/node_modules/.pnpm/parse5@7.3.0/node_modules/parse5/dist/parser/index.js +41 -0
- package/dist/node_modules/.pnpm/parse5@7.3.0/node_modules/parse5/dist/parser/index.js.map +1 -0
- package/dist/node_modules/.pnpm/parse5@7.3.0/node_modules/parse5/dist/parser/open-element-stack.js +35 -0
- package/dist/node_modules/.pnpm/parse5@7.3.0/node_modules/parse5/dist/parser/open-element-stack.js.map +1 -0
- package/dist/node_modules/.pnpm/parse5@7.3.0/node_modules/parse5/dist/serializer/index.js +24 -0
- package/dist/node_modules/.pnpm/parse5@7.3.0/node_modules/parse5/dist/serializer/index.js.map +1 -0
- package/dist/node_modules/.pnpm/parse5@7.3.0/node_modules/parse5/dist/tokenizer/index.js +92 -0
- package/dist/node_modules/.pnpm/parse5@7.3.0/node_modules/parse5/dist/tokenizer/index.js.map +1 -0
- package/dist/node_modules/.pnpm/super-three@0.177.0/node_modules/super-three/examples/jsm/libs/fflate.module.js +382 -0
- package/dist/node_modules/.pnpm/super-three@0.177.0/node_modules/super-three/examples/jsm/libs/fflate.module.js.map +1 -0
- package/dist/node_modules/.pnpm/super-three@0.177.0/node_modules/super-three/examples/jsm/loaders/EXRLoader.js +2587 -0
- package/dist/node_modules/.pnpm/super-three@0.177.0/node_modules/super-three/examples/jsm/loaders/EXRLoader.js.map +1 -0
- package/dist/node_modules/.pnpm/super-three@0.177.0/node_modules/super-three/examples/jsm/loaders/RGBELoader.js +477 -0
- package/dist/node_modules/.pnpm/super-three@0.177.0/node_modules/super-three/examples/jsm/loaders/RGBELoader.js.map +1 -0
- package/dist/node_modules/.pnpm/super-three@0.177.0/node_modules/super-three/src/math/MathUtils.js +17 -0
- package/dist/node_modules/.pnpm/super-three@0.177.0/node_modules/super-three/src/math/MathUtils.js.map +1 -0
- package/dist/physics/index.d.ts +11 -0
- package/dist/physics/index.d.ts.map +1 -0
- package/dist/physics/physics-system.d.ts +314 -0
- package/dist/physics/physics-system.d.ts.map +1 -0
- package/dist/physics/physics-system.js +419 -0
- package/dist/physics/physics-system.js.map +1 -0
- package/dist/physics/physicsBody.d.ts +83 -0
- package/dist/physics/physicsBody.d.ts.map +1 -0
- package/dist/physics/physicsBody.js +60 -0
- package/dist/physics/physicsBody.js.map +1 -0
- package/dist/physics/physicsManipulation.d.ts +51 -0
- package/dist/physics/physicsManipulation.d.ts.map +1 -0
- package/dist/physics/physicsManipulation.js +46 -0
- package/dist/physics/physicsManipulation.js.map +1 -0
- package/dist/physics/physicsShape.d.ts +133 -0
- package/dist/physics/physicsShape.d.ts.map +1 -0
- package/dist/physics/physicsShape.js +97 -0
- package/dist/physics/physicsShape.js.map +1 -0
- package/dist/physics/utils.d.ts +21 -0
- package/dist/physics/utils.d.ts.map +1 -0
- package/dist/physics/utils.js +130 -0
- package/dist/physics/utils.js.map +1 -0
- package/dist/runtime/index.d.ts +8 -0
- package/dist/runtime/index.d.ts.map +1 -0
- package/dist/runtime/three.d.ts +8 -0
- package/dist/runtime/three.d.ts.map +1 -0
- package/dist/runtime/three.js +18 -0
- package/dist/runtime/three.js.map +1 -0
- package/dist/scene-understanding/anchor.d.ts +42 -0
- package/dist/scene-understanding/anchor.d.ts.map +1 -0
- package/dist/scene-understanding/anchor.js +45 -0
- package/dist/scene-understanding/anchor.js.map +1 -0
- package/dist/scene-understanding/index.d.ts +11 -0
- package/dist/scene-understanding/index.d.ts.map +1 -0
- package/dist/scene-understanding/mesh.d.ts +67 -0
- package/dist/scene-understanding/mesh.d.ts.map +1 -0
- package/dist/scene-understanding/mesh.js +55 -0
- package/dist/scene-understanding/mesh.js.map +1 -0
- package/dist/scene-understanding/plane.d.ts +39 -0
- package/dist/scene-understanding/plane.d.ts.map +1 -0
- package/dist/scene-understanding/plane.js +42 -0
- package/dist/scene-understanding/plane.js.map +1 -0
- package/dist/scene-understanding/scene-understanding-system.d.ts +180 -0
- package/dist/scene-understanding/scene-understanding-system.d.ts.map +1 -0
- package/dist/scene-understanding/scene-understanding-system.js +342 -0
- package/dist/scene-understanding/scene-understanding-system.js.map +1 -0
- package/dist/transform/index.d.ts +10 -0
- package/dist/transform/index.d.ts.map +1 -0
- package/dist/transform/synced-quaternion.d.ts +35 -0
- package/dist/transform/synced-quaternion.d.ts.map +1 -0
- package/dist/transform/synced-quaternion.js +128 -0
- package/dist/transform/synced-quaternion.js.map +1 -0
- package/dist/transform/synced-vector3.d.ts +34 -0
- package/dist/transform/synced-vector3.d.ts.map +1 -0
- package/dist/transform/synced-vector3.js +106 -0
- package/dist/transform/synced-vector3.js.map +1 -0
- package/dist/transform/transform.d.ts +100 -0
- package/dist/transform/transform.d.ts.map +1 -0
- package/dist/transform/transform.js +194 -0
- package/dist/transform/transform.js.map +1 -0
- package/dist/types/webxr-augmentations.d.ts +23 -0
- package/dist/types/webxr-augmentations.d.ts.map +1 -0
- package/dist/ui/document.d.ts +112 -0
- package/dist/ui/document.d.ts.map +1 -0
- package/dist/ui/document.js +298 -0
- package/dist/ui/document.js.map +1 -0
- package/dist/ui/follow.d.ts +197 -0
- package/dist/ui/follow.d.ts.map +1 -0
- package/dist/ui/follow.js +143 -0
- package/dist/ui/follow.js.map +1 -0
- package/dist/ui/index.d.ts +18 -0
- package/dist/ui/index.d.ts.map +1 -0
- package/dist/ui/screenspace.d.ts +219 -0
- package/dist/ui/screenspace.d.ts.map +1 -0
- package/dist/ui/screenspace.js +215 -0
- package/dist/ui/screenspace.js.map +1 -0
- package/dist/ui/ui.d.ts +209 -0
- package/dist/ui/ui.d.ts.map +1 -0
- package/dist/ui/ui.js +185 -0
- package/dist/ui/ui.js.map +1 -0
- package/dist/vendor/basis/README.md +46 -0
- package/dist/vendor/basis/basis_transcoder.js +19 -0
- package/dist/vendor/basis/basis_transcoder.wasm +0 -0
- package/dist/vendor/draco/README.md +32 -0
- package/dist/vendor/draco/draco_decoder.js +34 -0
- package/dist/vendor/draco/draco_decoder.wasm +0 -0
- package/dist/vendor/draco/draco_encoder.js +33 -0
- package/dist/vendor/draco/draco_wasm_wrapper.js +117 -0
- package/dist/vendor/draco/gltf/draco_decoder.js +33 -0
- package/dist/vendor/draco/gltf/draco_decoder.wasm +0 -0
- package/dist/vendor/draco/gltf/draco_encoder.js +33 -0
- package/dist/vendor/draco/gltf/draco_wasm_wrapper.js +116 -0
- package/dist/version.d.ts +2 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +4 -0
- package/dist/version.js.map +1 -0
- package/dist/visibility/index.d.ts +8 -0
- package/dist/visibility/index.d.ts.map +1 -0
- package/dist/visibility/visibility.d.ts +37 -0
- package/dist/visibility/visibility.d.ts.map +1 -0
- package/dist/visibility/visibility.js +52 -0
- package/dist/visibility/visibility.js.map +1 -0
- package/package.json +46 -0
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import { AudioSource } from './audio.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
5
|
+
*
|
|
6
|
+
* This source code is licensed under the MIT license found in the
|
|
7
|
+
* LICENSE file in the root directory of this source tree.
|
|
8
|
+
*/
|
|
9
|
+
/** Utility helpers to control {@link AudioSource} without touching Three audio.
|
|
10
|
+
* @category Audio
|
|
11
|
+
*/
|
|
12
|
+
class AudioUtils {
|
|
13
|
+
/**
|
|
14
|
+
* Play audio on an entity
|
|
15
|
+
* @param entity - Entity with Audio component
|
|
16
|
+
* @param fadeIn - Fade in duration in seconds
|
|
17
|
+
*/
|
|
18
|
+
static play(entity, fadeIn = 0) {
|
|
19
|
+
const index = entity.index;
|
|
20
|
+
// Check if entity has audio by checking if data exists
|
|
21
|
+
if (AudioSource.data.src[index] === undefined) {
|
|
22
|
+
console.warn('Entity does not have Audio component');
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
AudioSource.data._playRequested[index] = 1;
|
|
26
|
+
AudioSource.data._fadeIn[index] = fadeIn;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Pause audio on an entity
|
|
30
|
+
* @param entity - Entity with Audio component
|
|
31
|
+
* @param fadeOut - Fade out duration in seconds
|
|
32
|
+
*/
|
|
33
|
+
static pause(entity, fadeOut = 0) {
|
|
34
|
+
const index = entity.index;
|
|
35
|
+
if (AudioSource.data.src[index] === undefined) {
|
|
36
|
+
console.warn('Entity does not have Audio component');
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
AudioSource.data._pauseRequested[index] = 1;
|
|
40
|
+
AudioSource.data._fadeOut[index] = fadeOut;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Stop audio on an entity
|
|
44
|
+
* @param entity - Entity with Audio component
|
|
45
|
+
*/
|
|
46
|
+
static stop(entity) {
|
|
47
|
+
const index = entity.index;
|
|
48
|
+
if (AudioSource.data.src[index] === undefined) {
|
|
49
|
+
console.warn('Entity does not have Audio component');
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
AudioSource.data._stopRequested[index] = 1;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Check if audio is playing on an entity
|
|
56
|
+
* @param entity - Entity with Audio component
|
|
57
|
+
* @returns True if audio is playing
|
|
58
|
+
*/
|
|
59
|
+
static isPlaying(entity) {
|
|
60
|
+
const index = entity.index;
|
|
61
|
+
if (AudioSource.data.src[index] === undefined) {
|
|
62
|
+
return false;
|
|
63
|
+
}
|
|
64
|
+
return AudioSource.data._isPlaying[index] === 1;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Set volume on an entity's audio
|
|
68
|
+
* @param entity - Entity with Audio component
|
|
69
|
+
* @param volume - Volume level (0.0 to 1.0)
|
|
70
|
+
*/
|
|
71
|
+
static setVolume(entity, volume) {
|
|
72
|
+
const index = entity.index;
|
|
73
|
+
if (AudioSource.data.src[index] === undefined) {
|
|
74
|
+
console.warn('Entity does not have Audio component');
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
AudioSource.data.volume[index] = Math.max(0, Math.min(1, volume));
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Get volume from an entity's audio
|
|
81
|
+
* @param entity - Entity with Audio component
|
|
82
|
+
* @returns Current volume level
|
|
83
|
+
*/
|
|
84
|
+
static getVolume(entity) {
|
|
85
|
+
const index = entity.index;
|
|
86
|
+
if (AudioSource.data.src[index] === undefined) {
|
|
87
|
+
return 0;
|
|
88
|
+
}
|
|
89
|
+
return AudioSource.data.volume[index];
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Preload audio for an entity
|
|
93
|
+
* @param entity - Entity with Audio component
|
|
94
|
+
* @returns Promise that resolves when audio is loaded
|
|
95
|
+
*/
|
|
96
|
+
static async preload(entity) {
|
|
97
|
+
const index = entity.index;
|
|
98
|
+
if (AudioSource.data.src[index] === undefined) {
|
|
99
|
+
throw new Error('Entity does not have Audio component');
|
|
100
|
+
}
|
|
101
|
+
// Wait for loading to complete
|
|
102
|
+
return new Promise((resolve) => {
|
|
103
|
+
const checkLoaded = () => {
|
|
104
|
+
if (AudioSource.data._loaded[index]) {
|
|
105
|
+
resolve();
|
|
106
|
+
}
|
|
107
|
+
else if (!AudioSource.data._loading[index] &&
|
|
108
|
+
!AudioSource.data._loaded[index]) {
|
|
109
|
+
// Not loading and not loaded, might need to wait for system update
|
|
110
|
+
setTimeout(checkLoaded, 16);
|
|
111
|
+
}
|
|
112
|
+
else {
|
|
113
|
+
// Currently loading
|
|
114
|
+
setTimeout(checkLoaded, 16);
|
|
115
|
+
}
|
|
116
|
+
};
|
|
117
|
+
checkLoaded();
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Create a one-shot audio entity that auto-removes after playing
|
|
122
|
+
* @param world - World instance
|
|
123
|
+
* @param src - Audio source path
|
|
124
|
+
* @param options - Additional audio options
|
|
125
|
+
* @returns Created entity
|
|
126
|
+
*/
|
|
127
|
+
static createOneShot(world, src, options = {}) {
|
|
128
|
+
var _a, _b;
|
|
129
|
+
const entity = world.createEntity();
|
|
130
|
+
entity.addComponent(AudioSource, {
|
|
131
|
+
src,
|
|
132
|
+
volume: (_a = options.volume) !== null && _a !== void 0 ? _a : 1.0,
|
|
133
|
+
positional: (_b = options.positional) !== null && _b !== void 0 ? _b : false,
|
|
134
|
+
autoplay: true,
|
|
135
|
+
loop: false,
|
|
136
|
+
});
|
|
137
|
+
if (options.positional && options.position) ;
|
|
138
|
+
// Auto-remove entity when sound ends
|
|
139
|
+
// This would be handled by the AudioSystem when detecting ended non-looping sounds
|
|
140
|
+
return entity;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
export { AudioUtils };
|
|
145
|
+
//# sourceMappingURL=audio-utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"audio-utils.js","sources":["../../src/audio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D;;AAGA,QAAA,OAAO,IAAI,OAAO,CAAO,CAAC,OAAO,KAAI;YACnC,MAAM,WAAW,GAAG,MAAK;gBACvB,IAAIA,WAAc,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;AACtC,oBAAA,OAAO,EAAE;gBACX;qBAAO,IACL,CAACA,WAAc,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC;oBACpC,CAACA,WAAc,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,EACnC;;AAEA,oBAAA,UAAU,CAAC,WAAW,EAAE,EAAE,CAAC;gBAC7B;qBAAO;;AAEL,oBAAA,UAAU,CAAC,WAAW,EAAE,EAAE,CAAC;gBAC7B;AACF,YAAA,CAAC;AAED,YAAA,WAAW,EAAE;AACf,QAAA,CAAC,CAAC;IACJ;AAEA;;;;;;AAMG;IACH,OAAO,aAAa,CAClB,KAAY,EACZ,GAAW,EACX,UAII,EAAE,EAAA;;AAEN,QAAA,MAAM,MAAM,GAAG,KAAK,CAAC,YAAY,EAAE;AAEnC,QAAA,MAAM,CAAC,YAAY,CAACA,WAAc,EAAE;YAClC,GAAG;AACH,YAAA,MAAM,EAAE,CAAA,EAAA,GAAA,OAAO,CAAC,MAAM,mCAAI,GAAG;AAC7B,YAAA,UAAU,EAAE,CAAA,EAAA,GAAA,OAAO,CAAC,UAAU,mCAAI,KAAK;AACvC,YAAA,QAAQ,EAAE,IAAI;AACd,YAAA,IAAI,EAAE,KAAK;AACZ,SAAA,CAAC;QAEF,IAAI,OAAO,CAAC,UAAU,IAAI,OAAO,CAAC,QAAQ,EAAE;;;AAQ5C,QAAA,OAAO,MAAM;IACf;AACD;;;;"}
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
import { Types } from '../ecs/index.js';
|
|
8
|
+
/**
|
|
9
|
+
* Playback behavior when a new play is requested.
|
|
10
|
+
*
|
|
11
|
+
* @category Audio
|
|
12
|
+
*/
|
|
13
|
+
export declare const PlaybackMode: {
|
|
14
|
+
readonly Restart: "restart";
|
|
15
|
+
readonly Overlap: "overlap";
|
|
16
|
+
readonly Ignore: "ignore";
|
|
17
|
+
readonly FadeRestart: "fade-restart";
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Policy used when the instance pool is full and a new play is requested.
|
|
21
|
+
*
|
|
22
|
+
* @category Audio
|
|
23
|
+
*/
|
|
24
|
+
export declare const InstanceStealPolicy: {
|
|
25
|
+
readonly Oldest: "oldest";
|
|
26
|
+
readonly Quietest: "quietest";
|
|
27
|
+
readonly Furthest: "furthest";
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Distance attenuation model for positional audio.
|
|
31
|
+
*
|
|
32
|
+
* @category Audio
|
|
33
|
+
*/
|
|
34
|
+
export declare const DistanceModel: {
|
|
35
|
+
readonly Linear: "linear";
|
|
36
|
+
readonly Inverse: "inverse";
|
|
37
|
+
readonly Exponential: "exponential";
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* Configurable audio playback component for positional and ambient sounds.
|
|
41
|
+
*
|
|
42
|
+
* @remarks
|
|
43
|
+
* - The {@link AudioSystem} loads sources via {@link AssetManager} and manages
|
|
44
|
+
* instance pooling, crossfades, and XR session lifecycle.
|
|
45
|
+
* - For positional audio, attach the component to an entity with a valid
|
|
46
|
+
* Object3D; non-positional audio plays from the listener.
|
|
47
|
+
* - Use `_playRequested/_pauseRequested/_stopRequested` to trigger actions
|
|
48
|
+
* without directly reaching into Three.js audio objects.
|
|
49
|
+
*
|
|
50
|
+
* @category Audio
|
|
51
|
+
*/
|
|
52
|
+
export declare const AudioSource: import("elics").Component<{
|
|
53
|
+
src: {
|
|
54
|
+
type: Types.String;
|
|
55
|
+
default: string;
|
|
56
|
+
};
|
|
57
|
+
volume: {
|
|
58
|
+
type: Types.Float32;
|
|
59
|
+
default: number;
|
|
60
|
+
};
|
|
61
|
+
loop: {
|
|
62
|
+
type: Types.Boolean;
|
|
63
|
+
default: false;
|
|
64
|
+
};
|
|
65
|
+
autoplay: {
|
|
66
|
+
type: Types.Boolean;
|
|
67
|
+
default: false;
|
|
68
|
+
};
|
|
69
|
+
positional: {
|
|
70
|
+
type: Types.Boolean;
|
|
71
|
+
default: true;
|
|
72
|
+
};
|
|
73
|
+
refDistance: {
|
|
74
|
+
type: Types.Float32;
|
|
75
|
+
default: number;
|
|
76
|
+
};
|
|
77
|
+
rolloffFactor: {
|
|
78
|
+
type: Types.Float32;
|
|
79
|
+
default: number;
|
|
80
|
+
};
|
|
81
|
+
maxDistance: {
|
|
82
|
+
type: Types.Float32;
|
|
83
|
+
default: number;
|
|
84
|
+
};
|
|
85
|
+
distanceModel: {
|
|
86
|
+
type: Types.Enum;
|
|
87
|
+
enum: {
|
|
88
|
+
readonly Linear: "linear";
|
|
89
|
+
readonly Inverse: "inverse";
|
|
90
|
+
readonly Exponential: "exponential";
|
|
91
|
+
};
|
|
92
|
+
default: "inverse";
|
|
93
|
+
};
|
|
94
|
+
coneInnerAngle: {
|
|
95
|
+
type: Types.Float32;
|
|
96
|
+
default: number;
|
|
97
|
+
};
|
|
98
|
+
coneOuterAngle: {
|
|
99
|
+
type: Types.Float32;
|
|
100
|
+
default: number;
|
|
101
|
+
};
|
|
102
|
+
coneOuterGain: {
|
|
103
|
+
type: Types.Float32;
|
|
104
|
+
default: number;
|
|
105
|
+
};
|
|
106
|
+
playbackMode: {
|
|
107
|
+
type: Types.Enum;
|
|
108
|
+
enum: {
|
|
109
|
+
readonly Restart: "restart";
|
|
110
|
+
readonly Overlap: "overlap";
|
|
111
|
+
readonly Ignore: "ignore";
|
|
112
|
+
readonly FadeRestart: "fade-restart";
|
|
113
|
+
};
|
|
114
|
+
default: "restart";
|
|
115
|
+
};
|
|
116
|
+
maxInstances: {
|
|
117
|
+
type: Types.Int8;
|
|
118
|
+
default: number;
|
|
119
|
+
};
|
|
120
|
+
crossfadeDuration: {
|
|
121
|
+
type: Types.Float32;
|
|
122
|
+
default: number;
|
|
123
|
+
};
|
|
124
|
+
instanceStealPolicy: {
|
|
125
|
+
type: Types.Enum;
|
|
126
|
+
enum: {
|
|
127
|
+
readonly Oldest: "oldest";
|
|
128
|
+
readonly Quietest: "quietest";
|
|
129
|
+
readonly Furthest: "furthest";
|
|
130
|
+
};
|
|
131
|
+
default: "oldest";
|
|
132
|
+
};
|
|
133
|
+
_playRequested: {
|
|
134
|
+
type: Types.Boolean;
|
|
135
|
+
default: false;
|
|
136
|
+
};
|
|
137
|
+
_pauseRequested: {
|
|
138
|
+
type: Types.Boolean;
|
|
139
|
+
default: false;
|
|
140
|
+
};
|
|
141
|
+
_stopRequested: {
|
|
142
|
+
type: Types.Boolean;
|
|
143
|
+
default: false;
|
|
144
|
+
};
|
|
145
|
+
_fadeIn: {
|
|
146
|
+
type: Types.Float32;
|
|
147
|
+
default: number;
|
|
148
|
+
};
|
|
149
|
+
_fadeOut: {
|
|
150
|
+
type: Types.Float32;
|
|
151
|
+
default: number;
|
|
152
|
+
};
|
|
153
|
+
_pool: {
|
|
154
|
+
type: Types.Object;
|
|
155
|
+
default: undefined;
|
|
156
|
+
};
|
|
157
|
+
_instances: {
|
|
158
|
+
type: Types.Object;
|
|
159
|
+
default: undefined;
|
|
160
|
+
};
|
|
161
|
+
_isPlaying: {
|
|
162
|
+
type: Types.Boolean;
|
|
163
|
+
default: false;
|
|
164
|
+
};
|
|
165
|
+
_buffer: {
|
|
166
|
+
type: Types.Object;
|
|
167
|
+
default: undefined;
|
|
168
|
+
};
|
|
169
|
+
_loaded: {
|
|
170
|
+
type: Types.Boolean;
|
|
171
|
+
default: false;
|
|
172
|
+
};
|
|
173
|
+
_loading: {
|
|
174
|
+
type: Types.Boolean;
|
|
175
|
+
default: false;
|
|
176
|
+
};
|
|
177
|
+
}>;
|
|
178
|
+
//# sourceMappingURL=audio.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"audio.d.ts","sourceRoot":"","sources":["../../src/audio/audio.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,KAAK,EAAmB,MAAM,iBAAiB,CAAC;AAEzD;;;;GAIG;AACH,eAAO,MAAM,YAAY;;;;;CAKf,CAAC;AAEX;;;;GAIG;AACH,eAAO,MAAM,mBAAmB;;;;CAItB,CAAC;AAEX;;;;GAIG;AACH,eAAO,MAAM,aAAa;;;;CAIhB,CAAC;AAEX;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAqDvB,CAAC"}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import '@preact/signals-core';
|
|
2
|
+
import '../ecs/world.js';
|
|
3
|
+
import { createComponent, Types } from 'elics';
|
|
4
|
+
import '../ecs/component-registry.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
8
|
+
*
|
|
9
|
+
* This source code is licensed under the MIT license found in the
|
|
10
|
+
* LICENSE file in the root directory of this source tree.
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* Playback behavior when a new play is requested.
|
|
14
|
+
*
|
|
15
|
+
* @category Audio
|
|
16
|
+
*/
|
|
17
|
+
const PlaybackMode = {
|
|
18
|
+
Restart: 'restart',
|
|
19
|
+
Overlap: 'overlap',
|
|
20
|
+
Ignore: 'ignore',
|
|
21
|
+
FadeRestart: 'fade-restart',
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* Policy used when the instance pool is full and a new play is requested.
|
|
25
|
+
*
|
|
26
|
+
* @category Audio
|
|
27
|
+
*/
|
|
28
|
+
const InstanceStealPolicy = {
|
|
29
|
+
Oldest: 'oldest',
|
|
30
|
+
Quietest: 'quietest',
|
|
31
|
+
Furthest: 'furthest',
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* Distance attenuation model for positional audio.
|
|
35
|
+
*
|
|
36
|
+
* @category Audio
|
|
37
|
+
*/
|
|
38
|
+
const DistanceModel = {
|
|
39
|
+
Linear: 'linear',
|
|
40
|
+
Inverse: 'inverse',
|
|
41
|
+
Exponential: 'exponential',
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* Configurable audio playback component for positional and ambient sounds.
|
|
45
|
+
*
|
|
46
|
+
* @remarks
|
|
47
|
+
* - The {@link AudioSystem} loads sources via {@link AssetManager} and manages
|
|
48
|
+
* instance pooling, crossfades, and XR session lifecycle.
|
|
49
|
+
* - For positional audio, attach the component to an entity with a valid
|
|
50
|
+
* Object3D; non-positional audio plays from the listener.
|
|
51
|
+
* - Use `_playRequested/_pauseRequested/_stopRequested` to trigger actions
|
|
52
|
+
* without directly reaching into Three.js audio objects.
|
|
53
|
+
*
|
|
54
|
+
* @category Audio
|
|
55
|
+
*/
|
|
56
|
+
const AudioSource = createComponent('AudioSource', {
|
|
57
|
+
// Core properties
|
|
58
|
+
src: { type: Types.String, default: '' }, // URL or cache key for an audio buffer
|
|
59
|
+
volume: { type: Types.Float32, default: 1.0 }, // Linear gain [0..1]
|
|
60
|
+
loop: { type: Types.Boolean, default: false }, // When true, newly created instances loop
|
|
61
|
+
autoplay: { type: Types.Boolean, default: false }, // Trigger a single play on first update after load
|
|
62
|
+
// Spatial properties
|
|
63
|
+
positional: { type: Types.Boolean, default: true }, // true: PositionalAudio; false: ambient Audio
|
|
64
|
+
refDistance: { type: Types.Float32, default: 1 }, // Distance at which volume is 1.0
|
|
65
|
+
rolloffFactor: { type: Types.Float32, default: 1 }, // Rolloff curve steepness
|
|
66
|
+
maxDistance: { type: Types.Float32, default: 10000 }, // Distance after which volume is 0
|
|
67
|
+
distanceModel: {
|
|
68
|
+
type: Types.Enum,
|
|
69
|
+
enum: DistanceModel,
|
|
70
|
+
default: DistanceModel.Inverse,
|
|
71
|
+
},
|
|
72
|
+
coneInnerAngle: { type: Types.Float32, default: 360 }, // Degrees of full-volume cone
|
|
73
|
+
coneOuterAngle: { type: Types.Float32, default: 360 }, // Degrees until falloff reaches outer gain
|
|
74
|
+
coneOuterGain: { type: Types.Float32, default: 0 }, // Gain at the edge/outside of the cone
|
|
75
|
+
// Playback behavior control
|
|
76
|
+
playbackMode: {
|
|
77
|
+
type: Types.Enum,
|
|
78
|
+
enum: PlaybackMode,
|
|
79
|
+
default: PlaybackMode.Restart,
|
|
80
|
+
}, // Behavior when play is triggered while another instance is active
|
|
81
|
+
maxInstances: { type: Types.Int8, default: 1 }, // Max simultaneous instances in pool
|
|
82
|
+
crossfadeDuration: { type: Types.Float32, default: 0.1 }, // Seconds used for FadeRestart
|
|
83
|
+
instanceStealPolicy: {
|
|
84
|
+
type: Types.Enum,
|
|
85
|
+
enum: InstanceStealPolicy,
|
|
86
|
+
default: InstanceStealPolicy.Oldest,
|
|
87
|
+
}, // Which instance to replace when pool is full
|
|
88
|
+
// Playback control flags (internal)
|
|
89
|
+
_playRequested: { type: Types.Boolean, default: false }, // Set true to request play on next update
|
|
90
|
+
_pauseRequested: { type: Types.Boolean, default: false }, // Set true to request pause (optional fade)
|
|
91
|
+
_stopRequested: { type: Types.Boolean, default: false }, // Set true to stop and clear instances
|
|
92
|
+
_fadeIn: { type: Types.Float32, default: 0 }, // Seconds to fade in on next play
|
|
93
|
+
_fadeOut: { type: Types.Float32, default: 0 }, // Seconds to fade out on pause
|
|
94
|
+
// Runtime state (managed by AudioSystem)
|
|
95
|
+
_pool: { type: Types.Object, default: undefined }, // Assigned AudioPool for this entity
|
|
96
|
+
_instances: { type: Types.Object, default: undefined }, // Active instance list (internal)
|
|
97
|
+
_isPlaying: { type: Types.Boolean, default: false }, // True if any instance is currently playing
|
|
98
|
+
_buffer: { type: Types.Object, default: undefined }, // Loaded AudioBuffer
|
|
99
|
+
_loaded: { type: Types.Boolean, default: false }, // True once buffer is loaded
|
|
100
|
+
_loading: { type: Types.Boolean, default: false }, // True while buffer is loading
|
|
101
|
+
}, 'AudioSource playback component for positional and non-positional sounds');
|
|
102
|
+
|
|
103
|
+
export { AudioSource, DistanceModel, InstanceStealPolicy, PlaybackMode };
|
|
104
|
+
//# sourceMappingURL=audio.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"audio.js","sources":["../../src/audio/audio.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;AAAA;;;;;AAKG;AAIH;;;;AAIG;AACI,MAAM,YAAY,GAAG;AAC1B,IAAA,OAAO,EAAE,SAAS;AAClB,IAAA,OAAO,EAAE,SAAS;AAClB,IAAA,MAAM,EAAE,QAAQ;AAChB,IAAA,WAAW,EAAE,cAAc;;AAG7B;;;;AAIG;AACI,MAAM,mBAAmB,GAAG;AACjC,IAAA,MAAM,EAAE,QAAQ;AAChB,IAAA,QAAQ,EAAE,UAAU;AACpB,IAAA,QAAQ,EAAE,UAAU;;AAGtB;;;;AAIG;AACI,MAAM,aAAa,GAAG;AAC3B,IAAA,MAAM,EAAE,QAAQ;AAChB,IAAA,OAAO,EAAE,SAAS;AAClB,IAAA,WAAW,EAAE,aAAa;;AAG5B;;;;;;;;;;;;AAYG;AACI,MAAM,WAAW,GAAG,eAAe,CACxC,aAAa,EACb;;AAEE,IAAA,GAAG,EAAE,EAAE,IAAI,EAAE,KAAK,CAAC,MAAM,EAAE,OAAO,EAAE,EAAE,EAAE;AACxC,IAAA,MAAM,EAAE,EAAE,IAAI,EAAE,KAAK,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE;AAC7C,IAAA,IAAI,EAAE,EAAE,IAAI,EAAE,KAAK,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE;AAC7C,I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
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
export { AudioSource, PlaybackMode, InstanceStealPolicy, DistanceModel, } from './audio.js';
|
|
8
|
+
export { AudioSystem } from './audio-system.js';
|
|
9
|
+
export { AudioUtils } from './audio-utils.js';
|
|
10
|
+
export { AudioPool, type AudioInstance } from './audio-pool.js';
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/audio/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EACL,WAAW,EACX,YAAY,EACZ,mBAAmB,EACnB,aAAa,GACd,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,KAAK,aAAa,EAAE,MAAM,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
import type { Component } from 'elics';
|
|
8
|
+
import type { Entity } from './entity.js';
|
|
9
|
+
import { World } from './world.js';
|
|
10
|
+
/** Field shape for GLXF component metadata. @category ECS */
|
|
11
|
+
export interface GLXFComponentData {
|
|
12
|
+
[key: string]: {
|
|
13
|
+
keyString: string;
|
|
14
|
+
type: string;
|
|
15
|
+
value: any;
|
|
16
|
+
alias?: string;
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
/** Mapping entry from GLXF name → component class and optional mapper. @category ECS */
|
|
20
|
+
export interface ComponentRegistryEntry {
|
|
21
|
+
componentClass: Component<any>;
|
|
22
|
+
description?: string;
|
|
23
|
+
mapper?: (glxfData: GLXFComponentData) => Record<string, any>;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Registry that maps GLXF component names to ECS component classes.
|
|
27
|
+
*
|
|
28
|
+
* @remarks
|
|
29
|
+
* - Separate from `elics`' built-in registry to avoid naming conflicts.
|
|
30
|
+
* - Supports custom field mappers to translate GLXF metadata to component props.
|
|
31
|
+
*
|
|
32
|
+
* @category ECS
|
|
33
|
+
*/
|
|
34
|
+
export declare class GLXFComponentRegistry {
|
|
35
|
+
private static registry;
|
|
36
|
+
private static componentToName;
|
|
37
|
+
/** Register an ECS component class under a GLXF component name. */
|
|
38
|
+
static register(glxfComponentName: string, componentClass: Component<any>, description?: string, mapper?: (glxfData: GLXFComponentData) => Record<string, any>): void;
|
|
39
|
+
/** Return the GLXF name for a given component class. */
|
|
40
|
+
static getComponentName(component: Component<any>): string | undefined;
|
|
41
|
+
/** Lookup a registered mapping entry by GLXF name. */
|
|
42
|
+
static getComponent(glxfComponentName: string): ComponentRegistryEntry | undefined;
|
|
43
|
+
/** Apply mapped components from GLXF metadata to an entity. */
|
|
44
|
+
static applyComponents(entity: Entity, world: World, glxfComponents: Record<string, GLXFComponentData>): void;
|
|
45
|
+
/** Default mapper converting GLXF `{ key: { value } }` shape to props. */
|
|
46
|
+
private static defaultMapper;
|
|
47
|
+
/** List all registered GLXF component names. */
|
|
48
|
+
static getRegisteredComponents(): string[];
|
|
49
|
+
/** Clear the registry (useful for tests). */
|
|
50
|
+
static clear(): void;
|
|
51
|
+
/** Placeholder to wire built‑in mappings from generated metadata. */
|
|
52
|
+
static setupBuiltinComponents(): void;
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=component-registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"component-registry.d.ts","sourceRoot":"","sources":["../../src/ecs/component-registry.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KA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EACd,KAAK,EAAE,KAAK,EACZ,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAAC,GAChD,IAAI;IA2BP,0EAA0E;IAC1E,OAAO,CAAC,MAAM,CAAC,aAAa;IAc5B,gDAAgD;IAChD,MAAM,CAAC,uBAAuB,IAAI,MAAM,EAAE;IAI1C,6CAA6C;IAC7C,MAAM,CAAC,KAAK,IAAI,IAAI;IAKpB,qEAAqE;IACrE,MAAM,CAAC,sBAAsB,IAAI,IAAI;CAOtC"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Registry that maps GLXF component names to ECS component classes.
|
|
9
|
+
*
|
|
10
|
+
* @remarks
|
|
11
|
+
* - Separate from `elics`' built-in registry to avoid naming conflicts.
|
|
12
|
+
* - Supports custom field mappers to translate GLXF metadata to component props.
|
|
13
|
+
*
|
|
14
|
+
* @category ECS
|
|
15
|
+
*/
|
|
16
|
+
class GLXFComponentRegistry {
|
|
17
|
+
/** Register an ECS component class under a GLXF component name. */
|
|
18
|
+
static register(glxfComponentName, componentClass, description, mapper) {
|
|
19
|
+
this.registry.set(glxfComponentName, {
|
|
20
|
+
componentClass,
|
|
21
|
+
description,
|
|
22
|
+
mapper,
|
|
23
|
+
});
|
|
24
|
+
this.componentToName.set(componentClass, glxfComponentName);
|
|
25
|
+
}
|
|
26
|
+
/** Return the GLXF name for a given component class. */
|
|
27
|
+
static getComponentName(component) {
|
|
28
|
+
return this.componentToName.get(component);
|
|
29
|
+
}
|
|
30
|
+
/** Lookup a registered mapping entry by GLXF name. */
|
|
31
|
+
static getComponent(glxfComponentName) {
|
|
32
|
+
return this.registry.get(glxfComponentName);
|
|
33
|
+
}
|
|
34
|
+
/** Apply mapped components from GLXF metadata to an entity. */
|
|
35
|
+
static applyComponents(entity, world, glxfComponents) {
|
|
36
|
+
Object.entries(glxfComponents).forEach(([componentName, componentData]) => {
|
|
37
|
+
const entry = this.getComponent(componentName);
|
|
38
|
+
if (entry) {
|
|
39
|
+
// Use custom mapper if provided, otherwise use default mapping
|
|
40
|
+
const componentProps = entry.mapper
|
|
41
|
+
? entry.mapper(componentData)
|
|
42
|
+
: this.defaultMapper(componentData);
|
|
43
|
+
console.log(`Applying component "${componentName}" to entity with props:`, componentProps);
|
|
44
|
+
if (!entry.componentClass.bitmask) {
|
|
45
|
+
world.registerComponent(entry.componentClass);
|
|
46
|
+
}
|
|
47
|
+
entity.addComponent(entry.componentClass, componentProps);
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
console.warn(`Component "${componentName}" not found in registry. Available components:`, Array.from(this.registry.keys()));
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
/** Default mapper converting GLXF `{ key: { value } }` shape to props. */
|
|
55
|
+
static defaultMapper(glxfData) {
|
|
56
|
+
const props = {};
|
|
57
|
+
Object.entries(glxfData).forEach(([key, fieldData]) => {
|
|
58
|
+
if (fieldData && typeof fieldData === 'object' && 'value' in fieldData) {
|
|
59
|
+
props[key] = fieldData.value;
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
return props;
|
|
63
|
+
}
|
|
64
|
+
/** List all registered GLXF component names. */
|
|
65
|
+
static getRegisteredComponents() {
|
|
66
|
+
return Array.from(this.registry.keys());
|
|
67
|
+
}
|
|
68
|
+
/** Clear the registry (useful for tests). */
|
|
69
|
+
static clear() {
|
|
70
|
+
this.registry.clear();
|
|
71
|
+
this.componentToName.clear();
|
|
72
|
+
}
|
|
73
|
+
/** Placeholder to wire built‑in mappings from generated metadata. */
|
|
74
|
+
static setupBuiltinComponents() {
|
|
75
|
+
// This will be populated with the actual component imports
|
|
76
|
+
// For now, we'll register the components we know about
|
|
77
|
+
// Note: This is a temporary solution. In a real implementation,
|
|
78
|
+
// we would need to import the actual component objects and register them
|
|
79
|
+
// with their correct names from the components.json
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
GLXFComponentRegistry.registry = new Map();
|
|
83
|
+
GLXFComponentRegistry.componentToName = new Map();
|
|
84
|
+
|
|
85
|
+
export { GLXFComponentRegistry };
|
|
86
|
+
//# sourceMappingURL=component-registry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"component-registry.js","sources":["../../src/ecs/component-registry.ts"],"sourcesContent":[null],"names":[],"mappings":"AAAA;;;;;AAKG;AAyBH;;;;;;;;AAQG;MACU,qBAAqB,CAAA;;IAKhC,OAAO,QAAQ,CACb,iBAAyB,EACzB,cAA8B,EAC9B,WAAoB,EACpB,MAA6D,EAAA;AAE7D,QAAA,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,iBAAiB,EAAE;YACnC,cAAc;YACd,WAAW;YACX,MAAM;AACP,SAAA,CAAC;QACF,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,cAAc,EAAE,iBAAiB,CAAC;IAC7D;;IAGA,OAAO,gBAAgB,CAAC,SAAyB,EAAA;QAC/C,OAAO,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,SAAS,CAAC;IAC5C;;IAGA,OAAO,YAAY,CACjB,iBAAyB,EAAA;QAEzB,OAAO,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,iBAAiB,CAAC;IAC7C;;AAGA,IAAA,OAAO,eAAe,CACpB,MAAc,EACd,KAAY,EACZ,cAAiD,EAAA;AAEjD,QAAA,MAAM,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,aAAa,EAAE,aAAa,CAAC,KAAI;YACxE,MAAM,KAAK,GAAG,IAAI,CAAC,YAAY,CAAC,aAAa,CAAC;YAC9C,IAAI,KAAK,EAAE;;AAET,gBAAA,MAAM,cAAc,GAAG,KAAK,CAAC;AAC3B,s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,sBAAsB,GAAA;;;;;;IAM7B;;AA/Fe,qBAAA,CAAA,QAAQ,GAAG,IAAI,GAAG,EAAkC;AACpD,qBAAA,CAAA,eAAe,GAAG,IAAI,GAAG,EAA0B;;;;"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
import { ComponentRegistry, Types, createComponent } from 'elics';
|
|
8
|
+
/** Elics query operators re-export. @category ECS */
|
|
9
|
+
export { eq, ne, lt, le, gt, ge, isin, nin } from 'elics';
|
|
10
|
+
/** ECS component helpers and Types re-export. @category ECS */
|
|
11
|
+
export { Types, createComponent, ComponentRegistry };
|
|
12
|
+
//# sourceMappingURL=component.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"component.d.ts","sourceRoot":"","sources":["../../src/ecs/component.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,iBAAiB,EAAE,KAAK,EAAE,eAAe,EAAE,MAAM,OAAO,CAAC;AAElE,qDAAqD;AACrD,OAAO,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAE1D,+DAA+D;AAC/D,OAAO,EAAE,KAAK,EAAE,eAAe,EAAE,iBAAiB,EAAE,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
import type { PointerEventsMap } from '@pmndrs/pointer-events';
|
|
8
|
+
import type { Object3D, Object3DEventMap } from '../runtime/index.js';
|
|
9
|
+
declare module 'elics' {
|
|
10
|
+
interface Entity {
|
|
11
|
+
object3D?: Object3D<Object3DEventMap & PointerEventsMap>;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
export { Entity } from 'elics';
|
|
15
|
+
/** Sentinel value used for “no parent” in Transform.parent. @category ECS */
|
|
16
|
+
export declare const NullEntity = -1;
|
|
17
|
+
//# sourceMappingURL=entity.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entity.d.ts","sourceRoot":"","sources":["../../src/ecs/entity.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,KAAK,EAAE,QAAQ,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAEtE,OAAO,QAAQ,OAAO,CAAC;IACrB,UAAU,MAAM;QACd,QAAQ,CAAC,EAAE,QAAQ,CAAC,gBAAgB,GAAG,gBAAgB,CAAC,CAAC;KAC1D;CACF;AAED,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAC/B,6EAA6E;AAC7E,eAAO,MAAM,UAAU,KAAK,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export { Entity } from 'elics';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
5
|
+
*
|
|
6
|
+
* This source code is licensed under the MIT license found in the
|
|
7
|
+
* LICENSE file in the root directory of this source tree.
|
|
8
|
+
*/
|
|
9
|
+
/** Sentinel value used for “no parent” in Transform.parent. @category ECS */
|
|
10
|
+
const NullEntity = -1;
|
|
11
|
+
|
|
12
|
+
export { NullEntity };
|
|
13
|
+
//# sourceMappingURL=entity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entity.js","sources":["../../src/ecs/entity.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAAA;;;;;AAKG;AAYH;AACO,MAAM,UAAU,GAAG;;;;"}
|