@iwsdk/core 0.5.3 → 1.0.0-rc.1
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 +22 -1
- package/dist/asset/asset-manager.d.ts.map +1 -1
- package/dist/asset/asset-manager.js +3 -2
- package/dist/asset/asset-manager.js.map +1 -1
- package/dist/asset/cache-manager.js.map +1 -1
- package/dist/asset/loaders/audio-loader.js.map +1 -1
- package/dist/asset/loaders/cached-asset-load.js.map +1 -1
- package/dist/asset/loaders/gltf-loader.js.map +1 -1
- package/dist/asset/loaders/hdr-texture-loader.js.map +1 -1
- package/dist/asset/loaders/texture-loader.js.map +1 -1
- package/dist/asset/loaders/uikitml-loader.js.map +1 -1
- package/dist/audio/audio-pool.js.map +1 -1
- package/dist/audio/audio-system.js.map +1 -1
- package/dist/audio/audio-utils.js.map +1 -1
- package/dist/audio/audio.js.map +1 -1
- package/dist/camera/camera-source.js.map +1 -1
- package/dist/camera/camera-system.d.ts +7 -3
- package/dist/camera/camera-system.d.ts.map +1 -1
- package/dist/camera/camera-system.js +81 -50
- package/dist/camera/camera-system.js.map +1 -1
- package/dist/camera/camera-utils.d.ts +5 -0
- package/dist/camera/camera-utils.d.ts.map +1 -1
- package/dist/camera/camera-utils.js +8 -1
- package/dist/camera/camera-utils.js.map +1 -1
- package/dist/camera/types.js.map +1 -1
- package/dist/depth/depth-occludable.js.map +1 -1
- package/dist/depth/depth-sensing-system.d.ts +3 -0
- package/dist/depth/depth-sensing-system.d.ts.map +1 -1
- package/dist/depth/depth-sensing-system.js +55 -1
- package/dist/depth/depth-sensing-system.js.map +1 -1
- package/dist/depth/depth-textures.js.map +1 -1
- package/dist/depth/occlusion/preprocessing-pass.js.map +1 -1
- package/dist/depth/occlusion/preprocessing-shader.glsl.js.map +1 -1
- package/dist/ecs/builtin-components.js.map +1 -1
- package/dist/ecs/component-editor-metadata.js.map +1 -1
- package/dist/ecs/component-manifest.js.map +1 -1
- package/dist/ecs/entity.js.map +1 -1
- package/dist/ecs/system.js.map +1 -1
- package/dist/ecs/world.d.ts +2 -0
- package/dist/ecs/world.d.ts.map +1 -1
- package/dist/ecs/world.js +4 -0
- package/dist/ecs/world.js.map +1 -1
- package/dist/environment/dome-gradient.js.map +1 -1
- package/dist/environment/dome-texture.js.map +1 -1
- package/dist/environment/environment-system.js.map +1 -1
- package/dist/environment/gradient-environment.js.map +1 -1
- package/dist/environment/ibl-gradient.js.map +1 -1
- package/dist/environment/ibl-texture.js.map +1 -1
- package/dist/environment/scene-ar-environment.js.map +1 -1
- package/dist/environment-raycast/environment-raycast.js.map +1 -1
- package/dist/environment-raycast/raycast-target.js.map +1 -1
- package/dist/grab/distance-grabbable.d.ts +5 -0
- package/dist/grab/distance-grabbable.d.ts.map +1 -1
- package/dist/grab/distance-grabbable.js +5 -0
- package/dist/grab/distance-grabbable.js.map +1 -1
- package/dist/grab/grab-helpers.js.map +1 -1
- package/dist/grab/grab-system.js.map +1 -1
- package/dist/grab/grab-warnings.js.map +1 -1
- package/dist/grab/grabbed.js.map +1 -1
- package/dist/grab/handles.d.ts +6 -0
- package/dist/grab/handles.d.ts.map +1 -1
- package/dist/grab/handles.js +46 -12
- package/dist/grab/handles.js.map +1 -1
- package/dist/grab/index.js.map +1 -1
- package/dist/grab/one-hand-grabbable.d.ts +5 -0
- package/dist/grab/one-hand-grabbable.d.ts.map +1 -1
- package/dist/grab/one-hand-grabbable.js +5 -0
- package/dist/grab/one-hand-grabbable.js.map +1 -1
- package/dist/grab/pointer-events-patch.js.map +1 -1
- package/dist/grab/two-hands-grabbable.d.ts +5 -0
- package/dist/grab/two-hands-grabbable.d.ts.map +1 -1
- package/dist/grab/two-hands-grabbable.js +5 -0
- package/dist/grab/two-hands-grabbable.js.map +1 -1
- package/dist/index.js +4 -3
- package/dist/index.js.map +1 -1
- package/dist/init/browser-camera.js.map +1 -1
- package/dist/init/index.d.ts +2 -2
- package/dist/init/index.d.ts.map +1 -1
- package/dist/init/player-camera.js.map +1 -1
- package/dist/init/session-grant.d.ts +34 -0
- package/dist/init/session-grant.d.ts.map +1 -0
- package/dist/init/session-grant.js +89 -0
- package/dist/init/session-grant.js.map +1 -0
- package/dist/init/world-initializer.d.ts +87 -4
- package/dist/init/world-initializer.d.ts.map +1 -1
- package/dist/init/world-initializer.js +45 -41
- package/dist/init/world-initializer.js.map +1 -1
- package/dist/init/xr.d.ts +19 -0
- package/dist/init/xr.d.ts.map +1 -1
- package/dist/init/xr.js +136 -41
- package/dist/init/xr.js.map +1 -1
- package/dist/input/canvas-pointer-system.d.ts +2 -0
- package/dist/input/canvas-pointer-system.d.ts.map +1 -1
- package/dist/input/canvas-pointer-system.js +33 -13
- package/dist/input/canvas-pointer-system.js.map +1 -1
- package/dist/input/input-actions.js.map +1 -1
- package/dist/input/input-manager.js.map +1 -1
- package/dist/input/input-system.d.ts.map +1 -1
- package/dist/input/input-system.js +5 -2
- package/dist/input/input-system.js.map +1 -1
- package/dist/input/state-tags.js.map +1 -1
- package/dist/input/stateful-browser-gamepad.js.map +1 -1
- package/dist/input/stateful-keyboard.js.map +1 -1
- package/dist/layers/xr-cylinder-layer.d.ts +2 -1
- package/dist/layers/xr-cylinder-layer.d.ts.map +1 -1
- package/dist/layers/xr-cylinder-layer.js +2 -1
- package/dist/layers/xr-cylinder-layer.js.map +1 -1
- package/dist/layers/xr-layer-init.d.ts +19 -0
- package/dist/layers/xr-layer-init.d.ts.map +1 -0
- package/dist/layers/xr-layer-init.js +20 -0
- package/dist/layers/xr-layer-init.js.map +1 -0
- package/dist/layers/xr-layer-state.js.map +1 -1
- package/dist/layers/xr-layer-system.d.ts +41 -1
- package/dist/layers/xr-layer-system.d.ts.map +1 -1
- package/dist/layers/xr-layer-system.js +506 -132
- package/dist/layers/xr-layer-system.js.map +1 -1
- package/dist/layers/xr-layer-transform.d.ts +18 -0
- package/dist/layers/xr-layer-transform.d.ts.map +1 -0
- package/dist/layers/xr-layer-transform.js +115 -0
- package/dist/layers/xr-layer-transform.js.map +1 -0
- package/dist/layers/xr-quad-layer.d.ts +2 -1
- package/dist/layers/xr-quad-layer.d.ts.map +1 -1
- package/dist/layers/xr-quad-layer.js +2 -1
- package/dist/layers/xr-quad-layer.js.map +1 -1
- package/dist/level/level-component-applier.d.ts +2 -0
- package/dist/level/level-component-applier.d.ts.map +1 -1
- package/dist/level/level-component-applier.js +24 -5
- package/dist/level/level-component-applier.js.map +1 -1
- package/dist/level/level-player-rig.js.map +1 -1
- package/dist/level/level-root.js.map +1 -1
- package/dist/level/level-scene-environment.js.map +1 -1
- package/dist/level/level-scene-json-importer.js.map +1 -1
- package/dist/level/level-scene-material.js.map +1 -1
- package/dist/level/level-scene-object.js.map +1 -1
- package/dist/level/level-scene-primitive.js.map +1 -1
- package/dist/level/level-system.js.map +1 -1
- package/dist/level/level-tag.js.map +1 -1
- package/dist/lighting/light-binding.js.map +1 -1
- package/dist/lighting/light-components.js.map +1 -1
- package/dist/lighting/light-system.js.map +1 -1
- package/dist/locomotion/geometries/beveled-cylinder.js.map +1 -1
- package/dist/locomotion/locomotion-environment.js.map +1 -1
- package/dist/locomotion/locomotion-input-provider.js.map +1 -1
- package/dist/locomotion/locomotion.js.map +1 -1
- package/dist/locomotion/materials/line.js.map +1 -1
- package/dist/locomotion/slide.js.map +1 -1
- package/dist/locomotion/teleport.js.map +1 -1
- package/dist/locomotion/turn.js.map +1 -1
- package/dist/mcp/ecs-debug-tools.d.ts +4 -1
- package/dist/mcp/ecs-debug-tools.d.ts.map +1 -1
- package/dist/mcp/ecs-debug-tools.js +113 -10
- package/dist/mcp/ecs-debug-tools.js.map +1 -1
- package/dist/mcp/index.d.ts +1 -0
- package/dist/mcp/index.d.ts.map +1 -1
- package/dist/mcp/mcp-runtime.d.ts +2 -0
- package/dist/mcp/mcp-runtime.d.ts.map +1 -1
- package/dist/mcp/mcp-runtime.js +41 -0
- package/dist/mcp/mcp-runtime.js.map +1 -1
- package/dist/mcp/scene-tools.js.map +1 -1
- package/dist/mcp/ui-debug-tools.d.ts +56 -0
- package/dist/mcp/ui-debug-tools.d.ts.map +1 -0
- package/dist/mcp/ui-debug-tools.js +412 -0
- package/dist/mcp/ui-debug-tools.js.map +1 -0
- package/dist/physics/index.js +1 -1
- package/dist/physics/physics-runtime.d.ts +22 -0
- package/dist/physics/physics-runtime.d.ts.map +1 -0
- package/dist/physics/physics-runtime.js +423 -0
- package/dist/physics/physics-runtime.js.map +1 -0
- package/dist/physics/physics-system.d.ts +84 -108
- package/dist/physics/physics-system.d.ts.map +1 -1
- package/dist/physics/physics-system.js +686 -555
- package/dist/physics/physics-system.js.map +1 -1
- package/dist/physics/physics-transport.d.ts +20 -0
- package/dist/physics/physics-transport.d.ts.map +1 -0
- package/dist/physics/physics-transport.js +111 -0
- package/dist/physics/physics-transport.js.map +1 -0
- package/dist/physics/physics-worker-protocol.d.ts +144 -0
- package/dist/physics/physics-worker-protocol.d.ts.map +1 -0
- package/dist/physics/physics-worker-protocol.js +41 -0
- package/dist/physics/physics-worker-protocol.js.map +1 -0
- package/dist/physics/physics-worker-utils.d.ts +8 -0
- package/dist/physics/physics-worker-utils.d.ts.map +1 -0
- package/dist/physics/physics-worker-utils.js +12 -0
- package/dist/physics/physics-worker-utils.js.map +1 -0
- package/dist/physics/physics-worker.d.ts +8 -0
- package/dist/physics/physics-worker.d.ts.map +1 -0
- package/dist/physics/physics-worker.js +66 -0
- package/dist/physics/physics-worker.js.map +1 -0
- package/dist/physics/physicsBody.js.map +1 -1
- package/dist/physics/physicsManipulation.js.map +1 -1
- package/dist/physics/physicsShape.js.map +1 -1
- package/dist/physics/utils.js.map +1 -1
- package/dist/project/normalize.js +7 -1
- package/dist/project/normalize.js.map +1 -1
- package/dist/project/paths.js.map +1 -1
- package/dist/project/types.d.ts +7 -1
- package/dist/project/types.d.ts.map +1 -1
- package/dist/project/types.js.map +1 -1
- package/dist/project/validation.js +36 -2
- package/dist/project/validation.js.map +1 -1
- package/dist/runtime/three.js.map +1 -1
- package/dist/scene-understanding/anchor.js.map +1 -1
- package/dist/scene-understanding/mesh.js.map +1 -1
- package/dist/scene-understanding/plane.js.map +1 -1
- package/dist/scene-understanding/scene-understanding-system.d.ts +42 -6
- package/dist/scene-understanding/scene-understanding-system.d.ts.map +1 -1
- package/dist/scene-understanding/scene-understanding-system.js +391 -106
- package/dist/scene-understanding/scene-understanding-system.js.map +1 -1
- package/dist/schemas/iwsdk-project.v1.schema.json +20 -1
- package/dist/transform/synced-euler.js.map +1 -1
- package/dist/transform/synced-quaternion.js.map +1 -1
- package/dist/transform/synced-vector3.js.map +1 -1
- package/dist/transform/transform-component.js.map +1 -1
- package/dist/transform/transform-utils.js.map +1 -1
- package/dist/transform/transform.js.map +1 -1
- package/dist/ui/document.js.map +1 -1
- package/dist/ui/follow-component.js.map +1 -1
- package/dist/ui/follow.d.ts.map +1 -1
- package/dist/ui/follow.js +0 -1
- package/dist/ui/follow.js.map +1 -1
- package/dist/ui/panel-components.js.map +1 -1
- package/dist/ui/screenspace-component.js.map +1 -1
- package/dist/ui/screenspace.js.map +1 -1
- package/dist/ui/ui.js.map +1 -1
- package/dist/ui/uikitml-asset.js.map +1 -1
- package/dist/ui/uikitml.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.d.ts.map +1 -1
- package/dist/version.js +1 -1
- package/dist/version.js.map +1 -1
- package/dist/visibility/visibility-component.js.map +1 -1
- package/dist/visibility/visibility.js.map +1 -1
- package/package.json +5 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"input-system.js","sources":["../../src/input/input-system.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;;AAKG;AAmBH;;;;;;;;;;;;;;;;;;;;;;AAsBG;AACG,MAAO,WAAY,SAAQ,YAAY,CAC3C;;IAEE,gBAAgB,EAAE,EAAE,QAAQ,EAAE,CAAC,eAAe,EAAE,SAAS,CAAC,EAAE;;IAE5D,iBAAiB,EAAE,EAAE,QAAQ,EAAE,CAAC,gBAA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IAAI,GAAG,KAAa;gBAC1B,IAAK,IAAY,CAAC,QAAQ,IAAI,CAAE,IAAY,CAAC,QAAQ,CAAC,UAAU,EAAE;AAChE,oBAAA,IAAI;AACD,wBAAA,IAAY,CAAC,QAAQ,CAAC,iBAAiB,EAAE;oBAC5C;oBAAE,OAAO,KAAK,EAAE;AACd,wBAAA,OAAO,CAAC,IAAI,CACV,CAAA,wCAAA,EAA2C,IAAI,CAAC,IAAI,IAAI,SAAS,CAAA,CAAA,CAAG,EACpE,KAAK,CACN;oBACH;gBACF;YACF;AACF,QAAA,CAAC,CAAC;IACJ;AAEQ,IAAA,qBAAqB,CAAC,MAAc,EAAA;AAC1C,QAAA,MAAM,QAAQ,GAAG,MAAM,CAAC,QAAe;QACvC,IAAI,CAAC,QAAQ,EAAE;YACb;QACF;QACA,MAAM,GAAG,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC;QACxC,IAAI,GAAG,EAAE;YACP,QAAQ,CAAC,mBAAmB,CAAC,cAAc,EAAE,GAAG,CAAC,KAAK,CAAC;YACvD,QAAQ,CAAC,mBAAmB,CAAC,cAAc,EAAE,GAAG,CAAC,KAAK,CAAC;YACvD,QAAQ,CAAC,mBAAmB,CAAC,aAAa,EAAE,GAAG,CAAC,IAAI,CAAC;YACrD,QAAQ,CAAC,mBAAmB,CAAC,WAAW,EAAE,GAAG,CAAC,EAAE,CAAC;AACjD,YAAA,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,QAAQ,CAAC;QACjC;;;;;AAKA,QAAA,IAAI,MAAM,CAAC,MAAM,EAAE;YACjB,MAAM,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC,eAAe,CAAC,OAAO,CAAC;QAC1D;IACF;AACD;;;;"}
|
|
1
|
+
{"version":3,"file":"input-system.js","sources":["../../src/input/input-system.ts"],"sourcesContent":["/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport type { PointerEvent, PointerEventsMap } from '@pmndrs/pointer-events';\nimport { Types } from '../ecs/component.js';\nimport { Entity } from '../ecs/entity.js';\nimport { createSystem } from '../ecs/system.js';\nimport { VisibilityState } from '../ecs/world.js';\nimport { DistanceGrabbable } from '../grab/distance-grabbable.js';\nimport { OneHandGrabbable } from '../grab/one-hand-grabbable.js';\nimport { TwoHandsGrabbable } from '../grab/two-hands-grabbable.js';\nimport { Mesh, Object3D, Object3DEventMap } from '../runtime/index.js';\nimport { Transform } from '../transform/index.js';\nimport {\n Hovered,\n PokeInteractable,\n Pressed,\n RayInteractable,\n} from './state-tags.js';\n\n/**\n * Samples XR poses (hands/controllers/head) and gamepads, curates the set of\n * interactables for pointer raycasting, and attaches minimal event listeners.\n *\n * @remarks\n * - Scheduled after player movement so pointers reflect updated transforms.\n * - Maintains type-specific descendant arrays for optimized pointer intersection.\n * - Adds transient `Hovered` / `Pressed` tags so other systems can react declaratively.\n *\n * @category Input\n * @example React to Hovered / Pressed\n * ```ts\n * export class HighlightSystem extends createSystem({\n * items: { required: [RayInteractable] }\n * }) {\n * update() {\n * this.queries.items.entities.forEach(e => {\n * e.object3D.visible = !e.hasComponent(Pressed);\n * })\n * }\n * }\n * ```\n */\nexport class InputSystem extends createSystem(\n {\n /** Entities interactable via ray pointer */\n rayInteractables: { required: [RayInteractable, Transform] },\n /** Entities interactable via touch/poke pointer */\n pokeInteractables: { required: [PokeInteractable, Transform] },\n /** One-hand grabbable entities */\n oneHandGrabbables: { required: [OneHandGrabbable, Transform] },\n /** Two-hands grabbable entities */\n twoHandsGrabbables: { required: [TwoHandsGrabbable, Transform] },\n /** Distance grabbable entities */\n distanceGrabbables: { required: [DistanceGrabbable, Transform] },\n },\n {\n /** Keep pointer target lists available outside immersive XR for browser canvas input. */\n maintainScenePointers: { type: Types.Boolean, default: false },\n },\n) {\n /** Descendants for ray pointer intersection */\n private rayDescendants: Object3D[] = [];\n /** Descendants for touch/poke pointer intersection */\n private touchDescendants: Object3D[] = [];\n /** Descendants for grab pointer intersection */\n private grabDescendants: Object3D[] = [];\n\n private shouldSetIntersectables = false;\n private listeners = new WeakMap<\n Object3D,\n {\n enter: (e: any) => void;\n leave: (e: any) => void;\n down: (e: any) => void;\n up: (e: any) => void;\n }\n >();\n private lastBVHUpdate = new WeakMap<Object3D, number>();\n\n init(): void {\n this.shouldSetIntersectables =\n this.visibilityState.value === VisibilityState.Visible ||\n this.config.maintainScenePointers.value;\n // React to XR visibility for enabling scoped intersections\n this.cleanupFuncs.push(\n this.visibilityState.subscribe((value) => {\n this.shouldSetIntersectables =\n value === VisibilityState.Visible ||\n this.config.maintainScenePointers.value;\n }),\n );\n\n // Wire pointer event listeners on qualify; tear them down on disqualify.\n // Descendant arrays are rebuilt every frame, so no dirty bookkeeping here.\n // Register the query subscriptions on cleanupFuncs so they're released on\n // system teardown (matching the visibilityState subscription above).\n this.cleanupFuncs.push(\n this.queries.rayInteractables.subscribe('qualify', (entity) => {\n this.setupEventListeners(entity);\n }),\n this.queries.rayInteractables.subscribe('disqualify', (entity) => {\n this.cleanupEventListeners(entity);\n }),\n\n this.queries.pokeInteractables.subscribe('qualify', (entity) => {\n this.setupEventListeners(entity);\n // Enable touch pointers when first poke interactable appears\n this.input.xr.multiPointers.left.toggleSubPointer('touch', true);\n this.input.xr.multiPointers.right.toggleSubPointer('touch', true);\n }),\n this.queries.pokeInteractables.subscribe('disqualify', (entity) => {\n this.cleanupEventListeners(entity);\n // Disable touch pointers when no poke interactables remain\n if (this.queries.pokeInteractables.entities.size === 0) {\n this.input.xr.multiPointers.left.toggleSubPointer('touch', false);\n this.input.xr.multiPointers.right.toggleSubPointer('touch', false);\n }\n }),\n );\n\n // Enable touch pointer if there are already poke interactables\n if (this.queries.pokeInteractables.entities.size > 0) {\n this.input.xr.multiPointers.left.toggleSubPointer('touch', true);\n this.input.xr.multiPointers.right.toggleSubPointer('touch', true);\n }\n }\n\n update(delta: number, time: number): void {\n // Update input sampling first\n this.input.update(this.xrManager, delta, time);\n\n // Rebuild interactable descendant arrays every frame so newly parented\n // entities (TransformSystem runs at priority 0, after this system at -4)\n // become hit-testable on the same frame they're created.\n this.updateDescendantArrays();\n }\n\n /**\n * Update per-type descendant arrays for optimized pointer intersection\n */\n private updateDescendantArrays(): void {\n // Clear arrays\n this.rayDescendants.length = 0;\n this.touchDescendants.length = 0;\n this.grabDescendants.length = 0;\n\n if (!this.shouldSetIntersectables) {\n // Clear all descendant arrays on scene\n (this.scene as any).interactableDescendants = undefined;\n (this.scene as any).rayDescendants = undefined;\n (this.scene as any).touchDescendants = undefined;\n (this.scene as any).grabDescendants = undefined;\n return;\n }\n\n // Collect ray interactables + distance grabbables (both use ray)\n for (const entity of this.queries.rayInteractables.entities) {\n const obj = entity.object3D;\n if (obj) {\n this.rayDescendants.push(obj);\n }\n }\n for (const entity of this.queries.distanceGrabbables.entities) {\n const obj = entity.object3D;\n if (obj && !this.rayDescendants.includes(obj)) {\n this.rayDescendants.push(obj);\n }\n }\n\n // Collect poke/touch interactables\n for (const entity of this.queries.pokeInteractables.entities) {\n const obj = entity.object3D;\n if (obj) {\n this.touchDescendants.push(obj);\n }\n }\n\n // Collect grab interactables (oneHand + twoHands)\n for (const entity of this.queries.oneHandGrabbables.entities) {\n const obj = entity.object3D;\n if (obj) {\n this.grabDescendants.push(obj);\n }\n }\n for (const entity of this.queries.twoHandsGrabbables.entities) {\n const obj = entity.object3D;\n if (obj && !this.grabDescendants.includes(obj)) {\n this.grabDescendants.push(obj);\n }\n }\n\n // Set type-specific arrays on scene\n (this.scene as any).rayDescendants = this.rayDescendants;\n (this.scene as any).touchDescendants = this.touchDescendants;\n (this.scene as any).grabDescendants = this.grabDescendants;\n\n // Also set legacy interactableDescendants as union for backwards compatibility\n const allDescendants = new Set<Object3D>([\n ...this.rayDescendants,\n ...this.touchDescendants,\n ...this.grabDescendants,\n ]);\n (this.scene as any).interactableDescendants = Array.from(allDescendants);\n }\n\n private setupEventListeners(entity: Entity): void {\n const object3D = entity.object3D as Object3D<\n Object3DEventMap & PointerEventsMap\n >;\n if (!object3D) {\n return;\n }\n\n // Skip if already has listeners\n if (this.listeners.has(object3D)) {\n return;\n }\n\n // Compute BVH for all meshes in the entity hierarchy for fast raycasting\n this.computeBoundsTreeForEntity(object3D);\n\n // Enable pointer events for raycasting\n (object3D as any).pointerEvents = 'auto';\n\n // Throttled subtree BVH refresh helper\n const maybeRefreshBVH = () => {\n const now =\n typeof performance !== 'undefined' && performance.now\n ? performance.now()\n : Date.now();\n const last = this.lastBVHUpdate.get(object3D) ?? 0;\n if (now - last > 250) {\n this.computeBoundsTreeForEntity(object3D);\n this.lastBVHUpdate.set(object3D, now);\n }\n };\n\n const enter = (event: PointerEvent) => {\n event.stopPropagation();\n maybeRefreshBVH();\n if (!entity.hasComponent(Hovered)) {\n entity.addComponent(Hovered);\n }\n };\n const leave = (event: PointerEvent) => {\n event.stopPropagation();\n entity.removeComponent(Hovered);\n // pointerleave can fire without a preceding pointerup for flat geometry\n // (poke sphere exits intersection in one frame); clear Pressed defensively.\n entity.removeComponent(Pressed);\n };\n const down = (event: PointerEvent) => {\n event.stopPropagation();\n maybeRefreshBVH();\n // pointerdown implies the pointer is over the entity; ensure Hovered is\n // present even if a pointerleave/pointerdown sequence cleared it\n // (flat-geometry poke: the sphere can exit then re-contact from behind).\n if (!entity.hasComponent(Hovered)) {\n entity.addComponent(Hovered);\n }\n if (!entity.hasComponent(Pressed)) {\n entity.addComponent(Pressed);\n }\n };\n const up = (event: PointerEvent) => {\n event.stopPropagation();\n entity.removeComponent(Pressed);\n };\n\n this.listeners.set(object3D, { enter, leave, down, up });\n (object3D as any).addEventListener('pointerenter', enter);\n (object3D as any).addEventListener('pointerleave', leave);\n (object3D as any).addEventListener('pointerdown', down);\n (object3D as any).addEventListener('pointerup', up);\n }\n\n private computeBoundsTreeForEntity(object3D: Object3D): void {\n object3D.traverse((child) => {\n if ((child as Mesh).isMesh) {\n const mesh = child as Mesh;\n const geometry = (mesh as any).geometry;\n if (\n geometry &&\n !geometry.boundsTree &&\n typeof geometry.computeBoundsTree === 'function'\n ) {\n try {\n geometry.computeBoundsTree();\n } catch (error) {\n console.warn(\n `[InputSystem] Failed to compute BVH for ${mesh.name || 'unnamed'}:`,\n error,\n );\n }\n }\n }\n });\n }\n\n private cleanupEventListeners(entity: Entity): void {\n const object3D = entity.object3D as any;\n if (!object3D) {\n return;\n }\n const fns = this.listeners.get(object3D);\n if (fns) {\n object3D.removeEventListener('pointerenter', fns.enter);\n object3D.removeEventListener('pointerleave', fns.leave);\n object3D.removeEventListener('pointerdown', fns.down);\n object3D.removeEventListener('pointerup', fns.up);\n this.listeners.delete(object3D);\n }\n // A query also disqualifies an entity when it is destroyed. At that point\n // Elics has already cleared its components and rejects further mutations.\n // The listeners still need to be detached from the retained Object3D, but\n // there are no transient input tags left to remove from an inactive entity.\n if (entity.active) {\n entity.removeComponent(Hovered).removeComponent(Pressed);\n }\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;;AAKG;AAmBH;;;;;;;;;;;;;;;;;;;;;;AAsBG;AACG,MAAO,WAAY,SAAQ,YAAY,CAC3C;;IAEE,gBAAgB,EAAE,EAAE,QAAQ,EAAE,CAAC,eAAe,EAAE,SAAS,CAAC,EAAE;;IAE5D,iBAAiB,EAAE,EAAE,QAAQ,EAAE,CAAC,gBAAgB,EAAE,SAAS,CAAC,EAAE;;IAE9D,iBAAiB,EAAE,EAAE,QAAQ,EAAE,CAAC,gBAAgB,EAAE,SAAS,CAAC,EAAE;;IAE9D,kBAAkB,EAAE,EAAE,QAAQ,EAAE,CAAC,iBAAiB,EAAE,SAAS,CAAC,EAAE;;IAEhE,kBAAkB,EAAE,EAAE,QAAQ,EAAE,CAAC,iBAAiB,EAAE,SAAS,CAAC,EAAE;CACjE,EACD;;IAEE,qBAAqB,EAAE,EAAE,IAAI,EAAE,KAAK,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE;CAC/D,CACF,C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KAAK,CACN;oBACH;gBACF;YACF;AACF,QAAA,CAAC,CAAC;IACJ;AAEQ,IAAA,qBAAqB,CAAC,MAAc,EAAA;AAC1C,QAAA,MAAM,QAAQ,GAAG,MAAM,CAAC,QAAe;QACvC,IAAI,CAAC,QAAQ,EAAE;YACb;QACF;QACA,MAAM,GAAG,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC;QACxC,IAAI,GAAG,EAAE;YACP,QAAQ,CAAC,mBAAmB,CAAC,cAAc,EAAE,GAAG,CAAC,KAAK,CAAC;YACvD,QAAQ,CAAC,mBAAmB,CAAC,cAAc,EAAE,GAAG,CAAC,KAAK,CAAC;YACvD,QAAQ,CAAC,mBAAmB,CAAC,aAAa,EAAE,GAAG,CAAC,IAAI,CAAC;YACrD,QAAQ,CAAC,mBAAmB,CAAC,WAAW,EAAE,GAAG,CAAC,EAAE,CAAC;AACjD,YAAA,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,QAAQ,CAAC;QACjC;;;;;AAKA,QAAA,IAAI,MAAM,CAAC,MAAM,EAAE;YACjB,MAAM,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC,eAAe,CAAC,OAAO,CAAC;QAC1D;IACF;AACD;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"state-tags.js","sources":["../../src/input/state-tags.ts"],"sourcesContent":[
|
|
1
|
+
{"version":3,"file":"state-tags.js","sources":["../../src/input/state-tags.ts"],"sourcesContent":["/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport { createComponent } from '../ecs/component.js';\n/**\n * Marks an entity as eligible for ray-based pointer interaction.\n *\n * @remarks\n * - The {@link InputSystem} discovers all entities with `RayInteractable` and\n * registers their Object3D roots as raycast targets.\n * - Used for UI elements, buttons, and clickable objects interacted via ray pointer.\n * - When a pointer enters/leaves or presses/releases on the entity, the system\n * adds/removes the transient tags {@link Hovered} and {@link Pressed}.\n *\n * @category Input\n * @example Highlight on hover\n * ```ts\n * export class HighlightSystem extends createSystem({ items: { required: [RayInteractable] } }) {\n * update() {\n * this.queries.items.entities.forEach(e => {\n * e.object3D.material.emissiveIntensity = e.hasComponent(Hovered) ? 1.0 : 0.0;\n * });\n * }\n * }\n * ```\n */\nexport const RayInteractable = createComponent(\n 'RayInteractable',\n {},\n 'Marks an entity as eligible for ray-based pointer interaction.',\n);\n\n/**\n * Marks an entity as eligible for poke/touch interaction.\n *\n * @remarks\n * - Used for UI elements that can be poked/touched with finger or controller.\n * - Auto-selects when finger crosses the surface (distance <= 0).\n * - Uses hysteresis (separate enter/exit thresholds) to prevent flickering.\n *\n * @category Input\n * @example Create a pokeable button\n * ```ts\n * entity.addComponent(PokeInteractable);\n * ```\n */\nexport const PokeInteractable = createComponent(\n 'PokeInteractable',\n {},\n 'Marks an entity as eligible for poke/touch interaction.',\n);\n\n/**\n * A transient tag set while a pointer is intersecting an interactable.\n *\n * @remarks\n * - Managed by {@link InputSystem}; do not add/remove this component manually.\n * - Use as a declarative condition for hover effects, tooltips, or affordances.\n * - Works with both RayInteractable and PokeInteractable entities.\n *\n * @category Input\n * @hideineditor\n */\nexport const Hovered = createComponent(\n 'Hovered',\n {},\n 'A tag added by InputSystem while a pointer is hovering over the entity.',\n);\n\n/**\n * A transient tag set while a pointer is actively pressing an interactable.\n *\n * @remarks\n * - Managed by {@link InputSystem}; do not add/remove this component manually.\n * - Often used to gate activation logic or pressed-state visuals.\n * - Works with both RayInteractable and PokeInteractable entities.\n *\n * @category Input\n * @hideineditor\n */\nexport const Pressed = createComponent(\n 'Pressed',\n {},\n 'A tag added by InputSystem while the entity is actively pressed.',\n);\n\n/**\n * @deprecated Use `RayInteractable` instead. This will be removed in a future version.\n */\nexport const Interactable = RayInteractable;\n"],"names":[],"mappings":";;AAAA;;;;;AAKG;AAGH;;;;;;;;;;;;;;;;;;;;;AAqBG;AACI,MAAM,eAAe,GAAG,eAAe,CAC5C,iBAAiB,EACjB,EAAE,EACF,gEAAgE;AAGlE;;;;;;;;;;;;;AAaG;AACI,MAAM,gBAAgB,GAAG,eAAe,CAC7C,kBAAkB,EAClB,EAAE,EACF,yDAAyD;AAG3D;;;;;;;;;;AAUG;AACI,MAAM,OAAO,GAAG,eAAe,CACpC,SAAS,EACT,EAAE,EACF,yEAAyE;AAG3E;;;;;;;;;;AAUG;AACI,MAAM,OAAO,GAAG,eAAe,CACpC,SAAS,EACT,EAAE,EACF,kEAAkE;AAGpE;;AAEG;AACI,MAAM,YAAY,GAAG;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stateful-browser-gamepad.js","sources":["../../src/input/stateful-browser-gamepad.ts"],"sourcesContent":[
|
|
1
|
+
{"version":3,"file":"stateful-browser-gamepad.js","sources":["../../src/input/stateful-browser-gamepad.ts"],"sourcesContent":["/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport { ButtonAxesLayout, StatefulButtonAxesDevice } from '@iwsdk/xr-input';\n\nexport enum BrowserGamepadButton {\n South = 'standard-south',\n East = 'standard-east',\n West = 'standard-west',\n North = 'standard-north',\n LeftBumper = 'standard-left-bumper',\n RightBumper = 'standard-right-bumper',\n LeftTrigger = 'standard-left-trigger',\n RightTrigger = 'standard-right-trigger',\n Select = 'standard-select',\n Start = 'standard-start',\n LeftStick = 'standard-left-stick',\n RightStick = 'standard-right-stick',\n DPadUp = 'standard-dpad-up',\n DPadDown = 'standard-dpad-down',\n DPadLeft = 'standard-dpad-left',\n DPadRight = 'standard-dpad-right',\n Home = 'standard-home',\n}\n\nexport enum BrowserGamepadAxis {\n LeftStick = 'standard-left-stick-axes',\n RightStick = 'standard-right-stick-axes',\n}\n\nconst STANDARD_GAMEPAD_LAYOUT: ButtonAxesLayout = {\n selectComponentId: BrowserGamepadButton.South,\n components: {\n [BrowserGamepadButton.South]: {\n type: 'button',\n gamepadIndices: { button: 0 },\n },\n [BrowserGamepadButton.East]: {\n type: 'button',\n gamepadIndices: { button: 1 },\n },\n [BrowserGamepadButton.West]: {\n type: 'button',\n gamepadIndices: { button: 2 },\n },\n [BrowserGamepadButton.North]: {\n type: 'button',\n gamepadIndices: { button: 3 },\n },\n [BrowserGamepadButton.LeftBumper]: {\n type: 'button',\n gamepadIndices: { button: 4 },\n },\n [BrowserGamepadButton.RightBumper]: {\n type: 'button',\n gamepadIndices: { button: 5 },\n },\n [BrowserGamepadButton.LeftTrigger]: {\n type: 'trigger',\n gamepadIndices: { button: 6 },\n },\n [BrowserGamepadButton.RightTrigger]: {\n type: 'trigger',\n gamepadIndices: { button: 7 },\n },\n [BrowserGamepadButton.Select]: {\n type: 'button',\n gamepadIndices: { button: 8 },\n },\n [BrowserGamepadButton.Start]: {\n type: 'button',\n gamepadIndices: { button: 9 },\n },\n [BrowserGamepadButton.LeftStick]: {\n type: 'button',\n gamepadIndices: { button: 10 },\n },\n [BrowserGamepadButton.RightStick]: {\n type: 'button',\n gamepadIndices: { button: 11 },\n },\n [BrowserGamepadButton.DPadUp]: {\n type: 'button',\n gamepadIndices: { button: 12 },\n },\n [BrowserGamepadButton.DPadDown]: {\n type: 'button',\n gamepadIndices: { button: 13 },\n },\n [BrowserGamepadButton.DPadLeft]: {\n type: 'button',\n gamepadIndices: { button: 14 },\n },\n [BrowserGamepadButton.DPadRight]: {\n type: 'button',\n gamepadIndices: { button: 15 },\n },\n [BrowserGamepadButton.Home]: {\n type: 'button',\n gamepadIndices: { button: 16 },\n },\n [BrowserGamepadAxis.LeftStick]: {\n type: 'thumbstick',\n gamepadIndices: { xAxis: 0, yAxis: 1 },\n },\n [BrowserGamepadAxis.RightStick]: {\n type: 'thumbstick',\n gamepadIndices: { xAxis: 2, yAxis: 3 },\n },\n },\n};\n\nexport class StatefulBrowserGamepad extends StatefulButtonAxesDevice {\n public gamepad: Gamepad;\n\n constructor(gamepad: Gamepad) {\n super(STANDARD_GAMEPAD_LAYOUT, gamepad.buttons.length);\n this.gamepad = gamepad;\n }\n\n get index(): number {\n return this.gamepad.index;\n }\n\n get id(): string {\n return this.gamepad.id;\n }\n\n get connected(): boolean {\n return this.gamepad.connected;\n }\n\n get mapping(): GamepadMappingType {\n return this.gamepad.mapping;\n }\n\n refresh(gamepad: Gamepad = this.gamepad): void {\n this.gamepad = gamepad;\n super.update(gamepad.buttons, gamepad.axes);\n }\n}\n"],"names":[],"mappings":";;AAAA;;;;;AAKG;IAIS;AAAZ,CAAA,UAAY,oBAAoB,EAAA;AAC9B,IAAA,oBAAA,CAAA,OAAA,CAAA,GAAA,gBAAwB;AACxB,IAAA,oBAAA,CAAA,MAAA,CAAA,GAAA,eAAsB;AACtB,IAAA,oBAAA,CAAA,MAAA,CAAA,GAAA,eAAsB;AACtB,IAAA,oBAAA,CAAA,OAAA,CAAA,GAAA,gBAAwB;AACxB,IAAA,oBAAA,CAAA,YAAA,CAAA,GAAA,sBAAmC;AACnC,IAAA,oBAAA,CAAA,aAAA,CAAA,GAAA,uBAAqC;AACrC,IAAA,oBAAA,CAAA,aAAA,CAAA,GAAA,uBAAqC;AACrC,IAAA,oBAAA,CAAA,cAAA,CAAA,GAAA,wBAAuC;AACvC,IAAA,oBAAA,CAAA,QAAA,CAAA,GAAA,iBAA0B;AAC1B,IAAA,oBAAA,CAAA,OAAA,CAAA,GAAA,gBAAwB;AACxB,IAAA,oBAAA,CAAA,WAAA,CAAA,GAAA,qBAAiC;AACjC,IAAA,oBAAA,CAAA,YAAA,CAAA,GAAA,sBAAmC;AACnC,IAAA,oBAAA,CAAA,QAAA,CAAA,GAAA,kBAA2B;AAC3B,IAAA,oBAAA,CAAA,UAAA,CAAA,GAAA,oBAA+B;AAC/B,IAAA,oBAAA,CAAA,UAAA,CAAA,GAAA,oBAA+B;AAC/B,IAAA,oBAAA,CAAA,WAAA,CAAA,GAAA,qBAAiC;AACjC,IAAA,oBAAA,CAAA,MAAA,C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,GAAmB,IAAI,CAAC,OAAO,EAAA;AACrC,QAAA,IAAI,CAAC,OAAO,GAAG,OAAO;QACtB,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,IAAI,CAAC;IAC7C;AACD;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stateful-keyboard.js","sources":["../../src/input/stateful-keyboard.ts"],"sourcesContent":[
|
|
1
|
+
{"version":3,"file":"stateful-keyboard.js","sources":["../../src/input/stateful-keyboard.ts"],"sourcesContent":["/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nexport class StatefulKeyboard {\n private readonly pressedKeys = new Set<string>();\n private readonly currentDownKeys = new Set<string>();\n private readonly currentUpKeys = new Set<string>();\n private readonly pendingDownKeys = new Set<string>();\n private readonly pendingUpKeys = new Set<string>();\n private readonly target: Window;\n\n private readonly handleKeyDown = (event: KeyboardEvent) => {\n if (!this.pressedKeys.has(event.code)) {\n this.pendingDownKeys.add(event.code);\n }\n this.pressedKeys.add(event.code);\n };\n\n private readonly handleKeyUp = (event: KeyboardEvent) => {\n if (this.pressedKeys.has(event.code)) {\n this.pendingUpKeys.add(event.code);\n }\n this.pressedKeys.delete(event.code);\n };\n\n constructor(target: Window = window) {\n this.target = target;\n this.target.addEventListener('keydown', this.handleKeyDown);\n this.target.addEventListener('keyup', this.handleKeyUp);\n }\n\n update(): void {\n this.currentDownKeys.clear();\n this.currentUpKeys.clear();\n for (const code of this.pendingDownKeys) {\n this.currentDownKeys.add(code);\n }\n for (const code of this.pendingUpKeys) {\n this.currentUpKeys.add(code);\n }\n this.pendingDownKeys.clear();\n this.pendingUpKeys.clear();\n }\n\n getKeyPressed(code: string): boolean {\n return this.pressedKeys.has(code);\n }\n\n getKeyDown(code: string): boolean {\n return this.currentDownKeys.has(code);\n }\n\n getKeyUp(code: string): boolean {\n return this.currentUpKeys.has(code);\n }\n\n destroy(): void {\n this.target.removeEventListener('keydown', this.handleKeyDown);\n this.target.removeEventListener('keyup', this.handleKeyUp);\n this.pressedKeys.clear();\n this.currentDownKeys.clear();\n this.currentUpKeys.clear();\n this.pendingDownKeys.clear();\n this.pendingUpKeys.clear();\n }\n}\n"],"names":[],"mappings":"AAAA;;;;;AAKG;MAEU,gBAAgB,CAAA;AAsB3B,IAAA,WAAA,CAAY,SAAiB,MAAM,EAAA;AArBlB,QAAA,IAAA,CAAA,WAAW,GAAG,IAAI,GAAG,EAAU;AAC/B,QAAA,IAAA,CAAA,eAAe,GAAG,IAAI,GAAG,EAAU;AACnC,QAAA,IAAA,CAAA,aAAa,GAAG,IAAI,GAAG,EAAU;AACjC,QAAA,IAAA,CAAA,eAAe,GAAG,IAAI,GAAG,EAAU;AACnC,QAAA,IAAA,CAAA,aAAa,GAAG,IAAI,GAAG,EAAU;AAGjC,QAAA,IAAA,CAAA,aAAa,GAAG,CAAC,KAAoB,KAAI;AACxD,YAAA,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE;gBACrC,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC;YACtC;YACA,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC;AAClC,QAAA,CAAC;AAEgB,QAAA,IAAA,CAAA,WAAW,GAAG,CAAC,KAAoB,KAAI;YACtD,IAAI,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE;gBACpC,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC;YACpC;YACA,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC;AACrC,QAAA,CAAC;AAGC,QAAA,IAAI,CAAC,MAAM,GAAG,MAAM;QACpB,IAAI,CAAC,MAAM,CAAC,gBAAg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,EAAE;AAC1B,QAAA,IAAI,CAAC,eAAe,CAAC,KAAK,EAAE;AAC5B,QAAA,IAAI,CAAC,aAAa,CAAC,KAAK,EAAE;IAC5B;AACD;;;;"}
|
|
@@ -45,7 +45,8 @@ export declare const XRCylinderLayer: import("elics").Component<{
|
|
|
45
45
|
default: number;
|
|
46
46
|
};
|
|
47
47
|
/**
|
|
48
|
-
* Callback invoked each frame
|
|
48
|
+
* Callback invoked each frame while the layer is visible and its render
|
|
49
|
+
* surface is active.
|
|
49
50
|
* The renderer's render target is already set; call
|
|
50
51
|
* `renderer.render(scene, camera)` to draw into the layer.
|
|
51
52
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"xr-cylinder-layer.d.ts","sourceRoot":"","sources":["../../src/layers/xr-cylinder-layer.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,KAAK,EAAmB,MAAM,qBAAqB,CAAC;AAC7D;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,eAAe;IAGxB,wCAAwC;;;;;IAExC,mDAAmD;;;;;IAEnD,2DAA2D;;;;;IAE3D,oDAAoD;;;;;IAEpD,qDAAqD;;;;;IAErD
|
|
1
|
+
{"version":3,"file":"xr-cylinder-layer.d.ts","sourceRoot":"","sources":["../../src/layers/xr-cylinder-layer.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,KAAK,EAAmB,MAAM,qBAAqB,CAAC;AAC7D;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,eAAe;IAGxB,wCAAwC;;;;;IAExC,mDAAmD;;;;;IAEnD,2DAA2D;;;;;IAE3D,oDAAoD;;;;;IAEpD,qDAAqD;;;;;IAErD;;;;;OAKG;;;;;IAEH,0DAA0D;;;;;EAI7D,CAAC"}
|
|
@@ -31,7 +31,8 @@ const XRCylinderLayer = createComponent('XRCylinderLayer', {
|
|
|
31
31
|
/** Height of the layer's render target in pixels. */
|
|
32
32
|
pixelHeight: { type: Types.Int16, default: 1024 },
|
|
33
33
|
/**
|
|
34
|
-
* Callback invoked each frame
|
|
34
|
+
* Callback invoked each frame while the layer is visible and its render
|
|
35
|
+
* surface is active.
|
|
35
36
|
* The renderer's render target is already set; call
|
|
36
37
|
* `renderer.render(scene, camera)` to draw into the layer.
|
|
37
38
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"xr-cylinder-layer.js","sources":["../../src/layers/xr-cylinder-layer.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAAA;;;;;AAKG;AAGH;;;;;;;;;;;;AAYG;AACI,MAAM,eAAe,GAAG,eAAe,CAC5C,iBAAiB,EACjB;;IAEE,MAAM,EAAE,EAAE,IAAI,EAAE,KAAK,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE;;AAE7C,IAAA,YAAY,EAAE,EAAE,IAAI,EAAE,KAAK,CAAC,OAAO,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,GAAG,CAAC,EAAE;;IAE3D,WAAW,EAAE,EAAE,IAAI,EAAE,KAAK,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE;;IAElD,UAAU,EAAE,EAAE,IAAI,EAAE,KAAK,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE;;IAEhD,WAAW,EAAE,EAAE,IAAI,EAAE,KAAK,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE;AACjD
|
|
1
|
+
{"version":3,"file":"xr-cylinder-layer.js","sources":["../../src/layers/xr-cylinder-layer.ts"],"sourcesContent":["/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport { Types, createComponent } from '../ecs/component.js';\n/**\n * XRCylinderLayer - Component for WebXR cylinder composition layers.\n *\n * A cylinder layer renders content onto a curved rectangular surface. The\n * viewer sees the inside of the cylinder. The entity's transform controls\n * the layer's world position and orientation. In XR, the content is\n * composited by the device's native compositor.\n *\n * Outside XR, the layer content is displayed on a textured cylinder mesh\n * as a fallback.\n *\n * @category Layers\n */\nexport const XRCylinderLayer = createComponent(\n 'XRCylinderLayer',\n {\n /** Radius of the cylinder in meters. */\n radius: { type: Types.Float32, default: 2.0 },\n /** Central angle of the visible arc in radians. */\n centralAngle: { type: Types.Float32, default: Math.PI / 4 },\n /** Width-to-height aspect ratio of the visible section. */\n aspectRatio: { type: Types.Float32, default: 2.0 },\n /** Width of the layer's render target in pixels. */\n pixelWidth: { type: Types.Int16, default: 1024 },\n /** Height of the layer's render target in pixels. */\n pixelHeight: { type: Types.Int16, default: 1024 },\n /**\n * Callback invoked each frame while the layer is visible and its render\n * surface is active.\n * The renderer's render target is already set; call\n * `renderer.render(scene, camera)` to draw into the layer.\n */\n renderCallback: { type: Types.Object, default: null },\n /** Enable stencil buffer on the layer's render target. */\n stencil: { type: Types.Boolean, default: false },\n },\n 'Cylinder composition layer for WebXR',\n);\n"],"names":[],"mappings":";;AAAA;;;;;AAKG;AAGH;;;;;;;;;;;;AAYG;AACI,MAAM,eAAe,GAAG,eAAe,CAC5C,iBAAiB,EACjB;;IAEE,MAAM,EAAE,EAAE,IAAI,EAAE,KAAK,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE;;AAE7C,IAAA,YAAY,EAAE,EAAE,IAAI,EAAE,KAAK,CAAC,OAAO,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,GAAG,CAAC,EAAE;;IAE3D,WAAW,EAAE,EAAE,IAAI,EAAE,KAAK,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE;;IAElD,UAAU,EAAE,EAAE,IAAI,EAAE,KAAK,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE;;IAEhD,WAAW,EAAE,EAAE,IAAI,EAAE,KAAK,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE;AACjD;;;;;AAKG;IACH,cAAc,EAAE,EAAE,IAAI,EAAE,KAAK,CAAC,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE;;IAErD,OAAO,EAAE,EAAE,IAAI,EAAE,KAAK,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE;CACjD,EACD,sCAAsC;;;;"}
|
|
@@ -0,0 +1,19 @@
|
|
|
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
|
+
interface QuadLayerInitInput {
|
|
8
|
+
transform: XRRigidTransform;
|
|
9
|
+
width: number;
|
|
10
|
+
height: number;
|
|
11
|
+
space: XRSpace;
|
|
12
|
+
pixelWidth: number;
|
|
13
|
+
pixelHeight: number;
|
|
14
|
+
}
|
|
15
|
+
export declare function createQuadLayerInit({ transform, width, height, space, pixelWidth, pixelHeight, }: QuadLayerInitInput): XRQuadLayerInit & {
|
|
16
|
+
clearOnAccess: false;
|
|
17
|
+
};
|
|
18
|
+
export {};
|
|
19
|
+
//# sourceMappingURL=xr-layer-init.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"xr-layer-init.d.ts","sourceRoot":"","sources":["../../src/layers/xr-layer-init.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,UAAU,kBAAkB;IAC1B,SAAS,EAAE,gBAAgB,CAAC;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,OAAO,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,wBAAgB,mBAAmB,CAAC,EAClC,SAAS,EACT,KAAK,EACL,MAAM,EACN,KAAK,EACL,UAAU,EACV,WAAW,GACZ,EAAE,kBAAkB,GAAG,eAAe,GAAG;IAAE,aAAa,EAAE,KAAK,CAAA;CAAE,CAUjE"}
|
|
@@ -0,0 +1,20 @@
|
|
|
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
|
+
function createQuadLayerInit({ transform, width, height, space, pixelWidth, pixelHeight, }) {
|
|
8
|
+
return {
|
|
9
|
+
transform,
|
|
10
|
+
width,
|
|
11
|
+
height,
|
|
12
|
+
space,
|
|
13
|
+
viewPixelWidth: pixelWidth,
|
|
14
|
+
viewPixelHeight: pixelHeight,
|
|
15
|
+
clearOnAccess: false,
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export { createQuadLayerInit };
|
|
20
|
+
//# sourceMappingURL=xr-layer-init.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"xr-layer-init.js","sources":["../../src/layers/xr-layer-init.ts"],"sourcesContent":["/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\ninterface QuadLayerInitInput {\n transform: XRRigidTransform;\n width: number;\n height: number;\n space: XRSpace;\n pixelWidth: number;\n pixelHeight: number;\n}\n\nexport function createQuadLayerInit({\n transform,\n width,\n height,\n space,\n pixelWidth,\n pixelHeight,\n}: QuadLayerInitInput): XRQuadLayerInit & { clearOnAccess: false } {\n return {\n transform,\n width,\n height,\n space,\n viewPixelWidth: pixelWidth,\n viewPixelHeight: pixelHeight,\n clearOnAccess: false,\n };\n}\n"],"names":[],"mappings":"AAAA;;;;;AAKG;AAWG,SAAU,mBAAmB,CAAC,EAClC,SAAS,EACT,KAAK,EACL,MAAM,EACN,KAAK,EACL,UAAU,EACV,WAAW,GACQ,EAAA;IACnB,OAAO;QACL,SAAS;QACT,KAAK;QACL,MAAM;QACN,KAAK;AACL,QAAA,cAAc,EAAE,UAAU;AAC1B,QAAA,eAAe,EAAE,WAAW;AAC5B,QAAA,aAAa,EAAE,KAAK;KACrB;AACH;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"xr-layer-state.js","sources":["../../src/layers/xr-layer-state.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAAA;;;;;AAKG;AAIH;AACO,MAAM,YAAY,GAAG,eAAe,CACzC,cAAc,EACd;IACE,MAAM,EAAE,EAAE,IAAI,EAAE,KAAK,CAAC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE;IAC9C,IAAI,EAAE,EAAE,IAAI,EAAE,KAAK,CAAC,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE;IAC3C,YAAY,EAAE,EAAE,IAAI,EAAE,KAAK,CAAC,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE;IACnD,gBAAgB,EAAE,EAAE,IAAI,EAAE,KAAK,CAAC,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE;IACvD,OAAO,EAAE,EAAE,IAAI,EAAE,KAAK,CAAC,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE;IAC9C,UAAU,EAAE,EAAE,IAAI,EAAE,KAAK,CAAC,KAAK,EAAE,OAAO,EAAE,CAAC,EAAE;IAC7C,WAAW,EAAE,EAAE,IAAI,EAAE,KAAK,CAAC,KAAK,EAAE,OAAO,EAAE,CAAC,EAAE;IAC9C,OAAO,EAAE,EAAE,IAAI,EAAE,KAAK,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE;IAChD,eAAe,EAAE,EAAE,IAAI,EAAE,KAAK,CAAC,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE;CACvD,EACD,6CAA6C;;;;"}
|
|
1
|
+
{"version":3,"file":"xr-layer-state.js","sources":["../../src/layers/xr-layer-state.ts"],"sourcesContent":["/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport { Types, createComponent } from '../ecs/component.js';\n\n/** Internal per-entity runtime state for active XR layers. */\nexport const XRLayerState = createComponent(\n 'XRLayerState',\n {\n isQuad: { type: Types.Boolean, default: true },\n mesh: { type: Types.Object, default: null },\n renderTarget: { type: Types.Object, default: null },\n fallbackMaterial: { type: Types.Object, default: null },\n xrLayer: { type: Types.Object, default: null },\n pixelWidth: { type: Types.Int16, default: 0 },\n pixelHeight: { type: Types.Int16, default: 0 },\n stencil: { type: Types.Boolean, default: false },\n cachedTransform: { type: Types.Object, default: null },\n },\n 'Internal state for active XR layer entities',\n);\n"],"names":[],"mappings":";;AAAA;;;;;AAKG;AAIH;AACO,MAAM,YAAY,GAAG,eAAe,CACzC,cAAc,EACd;IACE,MAAM,EAAE,EAAE,IAAI,EAAE,KAAK,CAAC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE;IAC9C,IAAI,EAAE,EAAE,IAAI,EAAE,KAAK,CAAC,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE;IAC3C,YAAY,EAAE,EAAE,IAAI,EAAE,KAAK,CAAC,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE;IACnD,gBAAgB,EAAE,EAAE,IAAI,EAAE,KAAK,CAAC,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE;IACvD,OAAO,EAAE,EAAE,IAAI,EAAE,KAAK,CAAC,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE;IAC9C,UAAU,EAAE,EAAE,IAAI,EAAE,KAAK,CAAC,KAAK,EAAE,OAAO,EAAE,CAAC,EAAE;IAC7C,WAAW,EAAE,EAAE,IAAI,EAAE,KAAK,CAAC,KAAK,EAAE,OAAO,EAAE,CAAC,EAAE;IAC9C,OAAO,EAAE,EAAE,IAAI,EAAE,KAAK,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE;IAChD,eAAe,EAAE,EAAE,IAAI,EAAE,KAAK,CAAC,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE;CACvD,EACD,6CAA6C;;;;"}
|
|
@@ -214,7 +214,8 @@ declare const XRLayerSystem_base: import("elics").SystemConstructor<import("elic
|
|
|
214
214
|
* For each entity with an {@link XRQuadLayer} or {@link XRCylinderLayer}
|
|
215
215
|
* component, the system:
|
|
216
216
|
* - Creates a mesh (plane or cylinder) as a child of the entity's object3D
|
|
217
|
-
* - Renders layer content
|
|
217
|
+
* - Renders layer content via the component's `renderCallback` while its
|
|
218
|
+
* render surface is visible and active
|
|
218
219
|
* - In XR sessions with layer support, creates native XR composition layers
|
|
219
220
|
* and switches the mesh to a punch-through material that makes the
|
|
220
221
|
* projection layer transparent where the content layer appears
|
|
@@ -224,14 +225,45 @@ declare const XRLayerSystem_base: import("elics").SystemConstructor<import("elic
|
|
|
224
225
|
*/
|
|
225
226
|
export declare class XRLayerSystem extends XRLayerSystem_base {
|
|
226
227
|
private sessionUsesLayers;
|
|
228
|
+
private sessionLayerInitializationPending;
|
|
229
|
+
private unsupportedLayerStates;
|
|
230
|
+
private pendingNativeLayerRemovals;
|
|
231
|
+
private retiredLayers;
|
|
232
|
+
private layerVisibility;
|
|
233
|
+
private layerConfigurations;
|
|
227
234
|
init(): void;
|
|
228
235
|
update(): void;
|
|
229
236
|
private setupLayer;
|
|
230
237
|
private teardownLayer;
|
|
231
238
|
private handleSessionStart;
|
|
232
239
|
private handleSessionEnd;
|
|
240
|
+
/**
|
|
241
|
+
* Enable composition layers once the projection layer is active.
|
|
242
|
+
*
|
|
243
|
+
* super-three queues its projection-layer render state before dispatching
|
|
244
|
+
* `sessionstart`, so `renderState.layers` can legitimately be empty during
|
|
245
|
+
* that event. Keep rendering the mesh fallback and retry on subsequent
|
|
246
|
+
* frames instead of permanently classifying the session as unsupported.
|
|
247
|
+
*/
|
|
248
|
+
private tryInitializeSessionLayers;
|
|
233
249
|
private activateNativeLayer;
|
|
234
250
|
private deactivateNativeLayer;
|
|
251
|
+
/**
|
|
252
|
+
* Switch from the internal fallback texture only after the compositor layer
|
|
253
|
+
* is active. This avoids punching a transparent hole while
|
|
254
|
+
* updateRenderState() is still pending.
|
|
255
|
+
*/
|
|
256
|
+
private useNativeSurface;
|
|
257
|
+
/** Restore a fresh internal target after an external XR texture was bound. */
|
|
258
|
+
private useFallbackSurface;
|
|
259
|
+
private disposeLayerResources;
|
|
260
|
+
private disposeRetiredLayers;
|
|
261
|
+
/**
|
|
262
|
+
* Keep removed layers alive until the queued render state no longer
|
|
263
|
+
* references them. While removal is pending, clear their native textures so
|
|
264
|
+
* the compositor cannot present stale content from the detached entity.
|
|
265
|
+
*/
|
|
266
|
+
private renderRetiredLayers;
|
|
235
267
|
/**
|
|
236
268
|
* Rebuild the session's render state layers array.
|
|
237
269
|
* Keeps the projection layer at index 0, then appends content layers.
|
|
@@ -243,6 +275,14 @@ export declare class XRLayerSystem extends XRLayerSystem_base {
|
|
|
243
275
|
* avoiding per-frame XRRigidTransform allocations for static layers.
|
|
244
276
|
*/
|
|
245
277
|
private syncLayerTransform;
|
|
278
|
+
private requestNativeLayerRemoval;
|
|
279
|
+
private restorePendingNativeLayer;
|
|
280
|
+
private readLayerConfiguration;
|
|
281
|
+
private syncLayerGeometry;
|
|
282
|
+
private createFallbackGeometry;
|
|
283
|
+
private shouldRetryNativeLayer;
|
|
284
|
+
private hasLayerShapeChanged;
|
|
285
|
+
private rememberUnsupportedLayer;
|
|
246
286
|
private createRenderTarget;
|
|
247
287
|
}
|
|
248
288
|
//# sourceMappingURL=xr-layer-system.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"xr-layer-system.d.ts","sourceRoot":"","sources":["../../src/layers/xr-layer-system.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;
|
|
1
|
+
{"version":3,"file":"xr-layer-system.d.ts","sourceRoot":"","sources":["../../src/layers/xr-layer-system.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAwCH,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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