@dcl/hammurabi-server 1.0.0-17268386187.commit-b609629
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/CLAUDE.md +90 -0
- package/LICENSE +201 -0
- package/README.md +125 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +79 -0
- package/dist/cli.js.map +1 -0
- package/dist/lib/babylon/avatar-rendering-system.d.ts +16 -0
- package/dist/lib/babylon/avatar-rendering-system.d.ts.map +1 -0
- package/dist/lib/babylon/avatar-rendering-system.js +96 -0
- package/dist/lib/babylon/avatar-rendering-system.js.map +1 -0
- package/dist/lib/babylon/avatars/AvatarRenderer.d.ts +40 -0
- package/dist/lib/babylon/avatars/AvatarRenderer.d.ts.map +1 -0
- package/dist/lib/babylon/avatars/AvatarRenderer.js +260 -0
- package/dist/lib/babylon/avatars/AvatarRenderer.js.map +1 -0
- package/dist/lib/babylon/avatars/CharacterController.d.ts +88 -0
- package/dist/lib/babylon/avatars/CharacterController.d.ts.map +1 -0
- package/dist/lib/babylon/avatars/CharacterController.js +463 -0
- package/dist/lib/babylon/avatars/CharacterController.js.map +1 -0
- package/dist/lib/babylon/avatars/adr-65/body.d.ts +4 -0
- package/dist/lib/babylon/avatars/adr-65/body.d.ts.map +1 -0
- package/dist/lib/babylon/avatars/adr-65/body.js +47 -0
- package/dist/lib/babylon/avatars/adr-65/body.js.map +1 -0
- package/dist/lib/babylon/avatars/adr-65/customizations.d.ts +11 -0
- package/dist/lib/babylon/avatars/adr-65/customizations.d.ts.map +1 -0
- package/dist/lib/babylon/avatars/adr-65/customizations.js +111 -0
- package/dist/lib/babylon/avatars/adr-65/customizations.js.map +1 -0
- package/dist/lib/babylon/avatars/adr-65/emote.d.ts +9 -0
- package/dist/lib/babylon/avatars/adr-65/emote.d.ts.map +1 -0
- package/dist/lib/babylon/avatars/adr-65/emote.js +46 -0
- package/dist/lib/babylon/avatars/adr-65/emote.js.map +1 -0
- package/dist/lib/babylon/avatars/adr-65/loader.d.ts +8 -0
- package/dist/lib/babylon/avatars/adr-65/loader.d.ts.map +1 -0
- package/dist/lib/babylon/avatars/adr-65/loader.js +54 -0
- package/dist/lib/babylon/avatars/adr-65/loader.js.map +1 -0
- package/dist/lib/babylon/avatars/adr-65/representation.d.ts +12 -0
- package/dist/lib/babylon/avatars/adr-65/representation.d.ts.map +1 -0
- package/dist/lib/babylon/avatars/adr-65/representation.js +77 -0
- package/dist/lib/babylon/avatars/adr-65/representation.js.map +1 -0
- package/dist/lib/babylon/avatars/adr-65/slots.d.ts +5 -0
- package/dist/lib/babylon/avatars/adr-65/slots.d.ts.map +1 -0
- package/dist/lib/babylon/avatars/adr-65/slots.js +62 -0
- package/dist/lib/babylon/avatars/adr-65/slots.js.map +1 -0
- package/dist/lib/babylon/avatars/adr-65/types.d.ts +17 -0
- package/dist/lib/babylon/avatars/adr-65/types.d.ts.map +1 -0
- package/dist/lib/babylon/avatars/adr-65/types.js +3 -0
- package/dist/lib/babylon/avatars/adr-65/types.js.map +1 -0
- package/dist/lib/babylon/avatars/adr-65/utils.d.ts +8 -0
- package/dist/lib/babylon/avatars/adr-65/utils.d.ts.map +1 -0
- package/dist/lib/babylon/avatars/adr-65/utils.js +29 -0
- package/dist/lib/babylon/avatars/adr-65/utils.js.map +1 -0
- package/dist/lib/babylon/avatars/adr-65/wearable.d.ts +7 -0
- package/dist/lib/babylon/avatars/adr-65/wearable.d.ts.map +1 -0
- package/dist/lib/babylon/avatars/adr-65/wearable.js +64 -0
- package/dist/lib/babylon/avatars/adr-65/wearable.js.map +1 -0
- package/dist/lib/babylon/avatars/avatar-asset-manager.d.ts +12 -0
- package/dist/lib/babylon/avatars/avatar-asset-manager.d.ts.map +1 -0
- package/dist/lib/babylon/avatars/avatar-asset-manager.js +31 -0
- package/dist/lib/babylon/avatars/avatar-asset-manager.js.map +1 -0
- package/dist/lib/babylon/avatars/loader.d.ts +6 -0
- package/dist/lib/babylon/avatars/loader.d.ts.map +1 -0
- package/dist/lib/babylon/avatars/loader.js +108 -0
- package/dist/lib/babylon/avatars/loader.js.map +1 -0
- package/dist/lib/babylon/avatars/urn.d.ts +2 -0
- package/dist/lib/babylon/avatars/urn.d.ts.map +1 -0
- package/dist/lib/babylon/avatars/urn.js +9 -0
- package/dist/lib/babylon/avatars/urn.js.map +1 -0
- package/dist/lib/babylon/index.d.ts +6 -0
- package/dist/lib/babylon/index.d.ts.map +1 -0
- package/dist/lib/babylon/index.js +85 -0
- package/dist/lib/babylon/index.js.map +1 -0
- package/dist/lib/babylon/input.d.ts +35 -0
- package/dist/lib/babylon/input.d.ts.map +1 -0
- package/dist/lib/babylon/input.js +137 -0
- package/dist/lib/babylon/input.js.map +1 -0
- package/dist/lib/babylon/scene/AssetManager.d.ts +19 -0
- package/dist/lib/babylon/scene/AssetManager.d.ts.map +1 -0
- package/dist/lib/babylon/scene/AssetManager.js +271 -0
- package/dist/lib/babylon/scene/AssetManager.js.map +1 -0
- package/dist/lib/babylon/scene/BabylonEntity.d.ts +84 -0
- package/dist/lib/babylon/scene/BabylonEntity.d.ts.map +1 -0
- package/dist/lib/babylon/scene/BabylonEntity.js +174 -0
- package/dist/lib/babylon/scene/BabylonEntity.js.map +1 -0
- package/dist/lib/babylon/scene/connect-context-rpc.d.ts +8 -0
- package/dist/lib/babylon/scene/connect-context-rpc.d.ts.map +1 -0
- package/dist/lib/babylon/scene/connect-context-rpc.js +210 -0
- package/dist/lib/babylon/scene/connect-context-rpc.js.map +1 -0
- package/dist/lib/babylon/scene/coordinates.d.ts +5 -0
- package/dist/lib/babylon/scene/coordinates.d.ts.map +1 -0
- package/dist/lib/babylon/scene/coordinates.js +17 -0
- package/dist/lib/babylon/scene/coordinates.js.map +1 -0
- package/dist/lib/babylon/scene/hot-reload.d.ts +9 -0
- package/dist/lib/babylon/scene/hot-reload.d.ts.map +1 -0
- package/dist/lib/babylon/scene/hot-reload.js +65 -0
- package/dist/lib/babylon/scene/hot-reload.js.map +1 -0
- package/dist/lib/babylon/scene/load.d.ts +54 -0
- package/dist/lib/babylon/scene/load.d.ts.map +1 -0
- package/dist/lib/babylon/scene/load.js +154 -0
- package/dist/lib/babylon/scene/load.js.map +1 -0
- package/dist/lib/babylon/scene/logic/apply-animations.d.ts +3 -0
- package/dist/lib/babylon/scene/logic/apply-animations.d.ts.map +1 -0
- package/dist/lib/babylon/scene/logic/apply-animations.js +50 -0
- package/dist/lib/babylon/scene/logic/apply-animations.js.map +1 -0
- package/dist/lib/babylon/scene/logic/billboards.d.ts +3 -0
- package/dist/lib/babylon/scene/logic/billboards.d.ts.map +1 -0
- package/dist/lib/babylon/scene/logic/billboards.js +12 -0
- package/dist/lib/babylon/scene/logic/billboards.js.map +1 -0
- package/dist/lib/babylon/scene/logic/camera-follows-player.d.ts +7 -0
- package/dist/lib/babylon/scene/logic/camera-follows-player.d.ts.map +1 -0
- package/dist/lib/babylon/scene/logic/camera-follows-player.js +35 -0
- package/dist/lib/babylon/scene/logic/camera-follows-player.js.map +1 -0
- package/dist/lib/babylon/scene/logic/colliders.d.ts +9 -0
- package/dist/lib/babylon/scene/logic/colliders.d.ts.map +1 -0
- package/dist/lib/babylon/scene/logic/colliders.js +79 -0
- package/dist/lib/babylon/scene/logic/colliders.js.map +1 -0
- package/dist/lib/babylon/scene/logic/cyclic-transform.d.ts +12 -0
- package/dist/lib/babylon/scene/logic/cyclic-transform.d.ts.map +1 -0
- package/dist/lib/babylon/scene/logic/cyclic-transform.js +67 -0
- package/dist/lib/babylon/scene/logic/cyclic-transform.js.map +1 -0
- package/dist/lib/babylon/scene/logic/delayed-interpolation.d.ts +27 -0
- package/dist/lib/babylon/scene/logic/delayed-interpolation.d.ts.map +1 -0
- package/dist/lib/babylon/scene/logic/delayed-interpolation.js +49 -0
- package/dist/lib/babylon/scene/logic/delayed-interpolation.js.map +1 -0
- package/dist/lib/babylon/scene/logic/easings.d.ts +7 -0
- package/dist/lib/babylon/scene/logic/easings.d.ts.map +1 -0
- package/dist/lib/babylon/scene/logic/easings.js +100 -0
- package/dist/lib/babylon/scene/logic/easings.js.map +1 -0
- package/dist/lib/babylon/scene/logic/hide-camera-obstuction-system.d.ts +5 -0
- package/dist/lib/babylon/scene/logic/hide-camera-obstuction-system.d.ts.map +1 -0
- package/dist/lib/babylon/scene/logic/hide-camera-obstuction-system.js +145 -0
- package/dist/lib/babylon/scene/logic/hide-camera-obstuction-system.js.map +1 -0
- package/dist/lib/babylon/scene/logic/local-avatar-scene.d.ts +10 -0
- package/dist/lib/babylon/scene/logic/local-avatar-scene.d.ts.map +1 -0
- package/dist/lib/babylon/scene/logic/local-avatar-scene.js +50 -0
- package/dist/lib/babylon/scene/logic/local-avatar-scene.js.map +1 -0
- package/dist/lib/babylon/scene/logic/pointer-events.d.ts +12 -0
- package/dist/lib/babylon/scene/logic/pointer-events.d.ts.map +1 -0
- package/dist/lib/babylon/scene/logic/pointer-events.js +199 -0
- package/dist/lib/babylon/scene/logic/pointer-events.js.map +1 -0
- package/dist/lib/babylon/scene/logic/raycasts.d.ts +21 -0
- package/dist/lib/babylon/scene/logic/raycasts.d.ts.map +1 -0
- package/dist/lib/babylon/scene/logic/raycasts.js +142 -0
- package/dist/lib/babylon/scene/logic/raycasts.js.map +1 -0
- package/dist/lib/babylon/scene/logic/static-entities.d.ts +18 -0
- package/dist/lib/babylon/scene/logic/static-entities.d.ts.map +1 -0
- package/dist/lib/babylon/scene/logic/static-entities.js +64 -0
- package/dist/lib/babylon/scene/logic/static-entities.js.map +1 -0
- package/dist/lib/babylon/scene/nodejs-runtime.d.ts +4 -0
- package/dist/lib/babylon/scene/nodejs-runtime.d.ts.map +1 -0
- package/dist/lib/babylon/scene/nodejs-runtime.js +100 -0
- package/dist/lib/babylon/scene/nodejs-runtime.js.map +1 -0
- package/dist/lib/babylon/scene/scene-context.d.ts +116 -0
- package/dist/lib/babylon/scene/scene-context.d.ts.map +1 -0
- package/dist/lib/babylon/scene/scene-context.js +492 -0
- package/dist/lib/babylon/scene/scene-context.js.map +1 -0
- package/dist/lib/babylon/scene/scene-culling.d.ts +6 -0
- package/dist/lib/babylon/scene/scene-culling.d.ts.map +1 -0
- package/dist/lib/babylon/scene/scene-culling.js +23 -0
- package/dist/lib/babylon/scene/scene-culling.js.map +1 -0
- package/dist/lib/babylon/scene/update-scheduler.d.ts +7 -0
- package/dist/lib/babylon/scene/update-scheduler.d.ts.map +1 -0
- package/dist/lib/babylon/scene/update-scheduler.js +40 -0
- package/dist/lib/babylon/scene/update-scheduler.js.map +1 -0
- package/dist/lib/babylon/time-based-animation.d.ts +13 -0
- package/dist/lib/babylon/time-based-animation.d.ts.map +1 -0
- package/dist/lib/babylon/time-based-animation.js +35 -0
- package/dist/lib/babylon/time-based-animation.js.map +1 -0
- package/dist/lib/babylon/visual/ambientLights.d.ts +6 -0
- package/dist/lib/babylon/visual/ambientLights.d.ts.map +1 -0
- package/dist/lib/babylon/visual/ambientLights.js +65 -0
- package/dist/lib/babylon/visual/ambientLights.js.map +1 -0
- package/dist/lib/babylon/visual/glowLayer.d.ts +6 -0
- package/dist/lib/babylon/visual/glowLayer.d.ts.map +1 -0
- package/dist/lib/babylon/visual/glowLayer.js +59 -0
- package/dist/lib/babylon/visual/glowLayer.js.map +1 -0
- package/dist/lib/babylon/visual/parcelOutline.d.ts +7 -0
- package/dist/lib/babylon/visual/parcelOutline.d.ts.map +1 -0
- package/dist/lib/babylon/visual/parcelOutline.js +88 -0
- package/dist/lib/babylon/visual/parcelOutline.js.map +1 -0
- package/dist/lib/babylon/visual/reticle.d.ts +3 -0
- package/dist/lib/babylon/visual/reticle.d.ts.map +1 -0
- package/dist/lib/babylon/visual/reticle.js +60 -0
- package/dist/lib/babylon/visual/reticle.js.map +1 -0
- package/dist/lib/babylon/visual/ui.d.ts +8 -0
- package/dist/lib/babylon/visual/ui.d.ts.map +1 -0
- package/dist/lib/babylon/visual/ui.js +54 -0
- package/dist/lib/babylon/visual/ui.js.map +1 -0
- package/dist/lib/common-runtime/game-loop.d.ts +4 -0
- package/dist/lib/common-runtime/game-loop.d.ts.map +1 -0
- package/dist/lib/common-runtime/game-loop.js +31 -0
- package/dist/lib/common-runtime/game-loop.js.map +1 -0
- package/dist/lib/common-runtime/modules.d.ts +244 -0
- package/dist/lib/common-runtime/modules.d.ts.map +1 -0
- package/dist/lib/common-runtime/modules.js +74 -0
- package/dist/lib/common-runtime/modules.js.map +1 -0
- package/dist/lib/common-runtime/startup.d.ts +8 -0
- package/dist/lib/common-runtime/startup.d.ts.map +1 -0
- package/dist/lib/common-runtime/startup.js +45 -0
- package/dist/lib/common-runtime/startup.js.map +1 -0
- package/dist/lib/common-runtime/types.d.ts +15 -0
- package/dist/lib/common-runtime/types.d.ts.map +1 -0
- package/dist/lib/common-runtime/types.js +7 -0
- package/dist/lib/common-runtime/types.js.map +1 -0
- package/dist/lib/decentraland/ByteBuffer/index.d.ts +75 -0
- package/dist/lib/decentraland/ByteBuffer/index.d.ts.map +1 -0
- package/dist/lib/decentraland/ByteBuffer/index.js +279 -0
- package/dist/lib/decentraland/ByteBuffer/index.js.map +1 -0
- package/dist/lib/decentraland/ByteBuffer/types.d.ts +109 -0
- package/dist/lib/decentraland/ByteBuffer/types.d.ts.map +1 -0
- package/dist/lib/decentraland/ByteBuffer/types.js +3 -0
- package/dist/lib/decentraland/ByteBuffer/types.js.map +1 -0
- package/dist/lib/decentraland/communications/CommsTransportWrapper.d.ts +45 -0
- package/dist/lib/decentraland/communications/CommsTransportWrapper.d.ts.map +1 -0
- package/dist/lib/decentraland/communications/CommsTransportWrapper.js +174 -0
- package/dist/lib/decentraland/communications/CommsTransportWrapper.js.map +1 -0
- package/dist/lib/decentraland/communications/avatar-communication-system.d.ts +18 -0
- package/dist/lib/decentraland/communications/avatar-communication-system.d.ts.map +1 -0
- package/dist/lib/decentraland/communications/avatar-communication-system.js +203 -0
- package/dist/lib/decentraland/communications/avatar-communication-system.js.map +1 -0
- package/dist/lib/decentraland/communications/connect-adapter.d.ts +5 -0
- package/dist/lib/decentraland/communications/connect-adapter.d.ts.map +1 -0
- package/dist/lib/decentraland/communications/connect-adapter.js +110 -0
- package/dist/lib/decentraland/communications/connect-adapter.js.map +1 -0
- package/dist/lib/decentraland/communications/connect-transport.d.ts +5 -0
- package/dist/lib/decentraland/communications/connect-transport.d.ts.map +1 -0
- package/dist/lib/decentraland/communications/connect-transport.js +32 -0
- package/dist/lib/decentraland/communications/connect-transport.js.map +1 -0
- package/dist/lib/decentraland/communications/networked-profile-system.d.ts +10 -0
- package/dist/lib/decentraland/communications/networked-profile-system.d.ts.map +1 -0
- package/dist/lib/decentraland/communications/networked-profile-system.js +73 -0
- package/dist/lib/decentraland/communications/networked-profile-system.js.map +1 -0
- package/dist/lib/decentraland/communications/player-entity-manager.d.ts +55 -0
- package/dist/lib/decentraland/communications/player-entity-manager.d.ts.map +1 -0
- package/dist/lib/decentraland/communications/player-entity-manager.js +167 -0
- package/dist/lib/decentraland/communications/player-entity-manager.js.map +1 -0
- package/dist/lib/decentraland/communications/position-report-system.d.ts +8 -0
- package/dist/lib/decentraland/communications/position-report-system.d.ts.map +1 -0
- package/dist/lib/decentraland/communications/position-report-system.js +51 -0
- package/dist/lib/decentraland/communications/position-report-system.js.map +1 -0
- package/dist/lib/decentraland/communications/realm-communications-system.d.ts +17 -0
- package/dist/lib/decentraland/communications/realm-communications-system.d.ts.map +1 -0
- package/dist/lib/decentraland/communications/realm-communications-system.js +111 -0
- package/dist/lib/decentraland/communications/realm-communications-system.js.map +1 -0
- package/dist/lib/decentraland/communications/scene-comms.d.ts +9 -0
- package/dist/lib/decentraland/communications/scene-comms.d.ts.map +1 -0
- package/dist/lib/decentraland/communications/scene-comms.js +20 -0
- package/dist/lib/decentraland/communications/scene-comms.js.map +1 -0
- package/dist/lib/decentraland/communications/transports/livekit.d.ts +27 -0
- package/dist/lib/decentraland/communications/transports/livekit.d.ts.map +1 -0
- package/dist/lib/decentraland/communications/transports/livekit.js +135 -0
- package/dist/lib/decentraland/communications/transports/livekit.js.map +1 -0
- package/dist/lib/decentraland/communications/transports/ws-room.d.ts +26 -0
- package/dist/lib/decentraland/communications/transports/ws-room.d.ts.map +1 -0
- package/dist/lib/decentraland/communications/transports/ws-room.js +235 -0
- package/dist/lib/decentraland/communications/transports/ws-room.js.map +1 -0
- package/dist/lib/decentraland/communications/types.d.ts +76 -0
- package/dist/lib/decentraland/communications/types.d.ts.map +1 -0
- package/dist/lib/decentraland/communications/types.js +6 -0
- package/dist/lib/decentraland/communications/types.js.map +1 -0
- package/dist/lib/decentraland/communications/ws-async-channel.d.ts +6 -0
- package/dist/lib/decentraland/communications/ws-async-channel.d.ts.map +1 -0
- package/dist/lib/decentraland/communications/ws-async-channel.js +52 -0
- package/dist/lib/decentraland/communications/ws-async-channel.js.map +1 -0
- package/dist/lib/decentraland/crdt-internal/components.d.ts +156 -0
- package/dist/lib/decentraland/crdt-internal/components.d.ts.map +1 -0
- package/dist/lib/decentraland/crdt-internal/components.js +8 -0
- package/dist/lib/decentraland/crdt-internal/components.js.map +1 -0
- package/dist/lib/decentraland/crdt-internal/conflict-resolution.d.ts +45 -0
- package/dist/lib/decentraland/crdt-internal/conflict-resolution.d.ts.map +1 -0
- package/dist/lib/decentraland/crdt-internal/conflict-resolution.js +49 -0
- package/dist/lib/decentraland/crdt-internal/conflict-resolution.js.map +1 -0
- package/dist/lib/decentraland/crdt-internal/dataCompare.d.ts +6 -0
- package/dist/lib/decentraland/crdt-internal/dataCompare.d.ts.map +1 -0
- package/dist/lib/decentraland/crdt-internal/dataCompare.js +34 -0
- package/dist/lib/decentraland/crdt-internal/dataCompare.js.map +1 -0
- package/dist/lib/decentraland/crdt-internal/generational-index-pool.d.ts +22 -0
- package/dist/lib/decentraland/crdt-internal/generational-index-pool.d.ts.map +1 -0
- package/dist/lib/decentraland/crdt-internal/generational-index-pool.js +91 -0
- package/dist/lib/decentraland/crdt-internal/generational-index-pool.js.map +1 -0
- package/dist/lib/decentraland/crdt-internal/grow-only-set.d.ts +10 -0
- package/dist/lib/decentraland/crdt-internal/grow-only-set.d.ts.map +1 -0
- package/dist/lib/decentraland/crdt-internal/grow-only-set.js +129 -0
- package/dist/lib/decentraland/crdt-internal/grow-only-set.js.map +1 -0
- package/dist/lib/decentraland/crdt-internal/last-write-win-element-set.d.ts +11 -0
- package/dist/lib/decentraland/crdt-internal/last-write-win-element-set.d.ts.map +1 -0
- package/dist/lib/decentraland/crdt-internal/last-write-win-element-set.js +224 -0
- package/dist/lib/decentraland/crdt-internal/last-write-win-element-set.js.map +1 -0
- package/dist/lib/decentraland/crdt-wire-protocol/appendValue.d.ts +15 -0
- package/dist/lib/decentraland/crdt-wire-protocol/appendValue.d.ts.map +1 -0
- package/dist/lib/decentraland/crdt-wire-protocol/appendValue.js +50 -0
- package/dist/lib/decentraland/crdt-wire-protocol/appendValue.js.map +1 -0
- package/dist/lib/decentraland/crdt-wire-protocol/crdtMessageProtocol.d.ts +31 -0
- package/dist/lib/decentraland/crdt-wire-protocol/crdtMessageProtocol.d.ts.map +1 -0
- package/dist/lib/decentraland/crdt-wire-protocol/crdtMessageProtocol.js +72 -0
- package/dist/lib/decentraland/crdt-wire-protocol/crdtMessageProtocol.js.map +1 -0
- package/dist/lib/decentraland/crdt-wire-protocol/deleteComponent.d.ts +14 -0
- package/dist/lib/decentraland/crdt-wire-protocol/deleteComponent.d.ts.map +1 -0
- package/dist/lib/decentraland/crdt-wire-protocol/deleteComponent.js +44 -0
- package/dist/lib/decentraland/crdt-wire-protocol/deleteComponent.js.map +1 -0
- package/dist/lib/decentraland/crdt-wire-protocol/deleteEntity.d.ts +11 -0
- package/dist/lib/decentraland/crdt-wire-protocol/deleteEntity.d.ts.map +1 -0
- package/dist/lib/decentraland/crdt-wire-protocol/deleteEntity.js +35 -0
- package/dist/lib/decentraland/crdt-wire-protocol/deleteEntity.js.map +1 -0
- package/dist/lib/decentraland/crdt-wire-protocol/index.d.ts +8 -0
- package/dist/lib/decentraland/crdt-wire-protocol/index.d.ts.map +1 -0
- package/dist/lib/decentraland/crdt-wire-protocol/index.js +24 -0
- package/dist/lib/decentraland/crdt-wire-protocol/index.js.map +1 -0
- package/dist/lib/decentraland/crdt-wire-protocol/message.d.ts +17 -0
- package/dist/lib/decentraland/crdt-wire-protocol/message.d.ts.map +1 -0
- package/dist/lib/decentraland/crdt-wire-protocol/message.js +49 -0
- package/dist/lib/decentraland/crdt-wire-protocol/message.js.map +1 -0
- package/dist/lib/decentraland/crdt-wire-protocol/prettyPrint.d.ts +4 -0
- package/dist/lib/decentraland/crdt-wire-protocol/prettyPrint.d.ts.map +1 -0
- package/dist/lib/decentraland/crdt-wire-protocol/prettyPrint.js +26 -0
- package/dist/lib/decentraland/crdt-wire-protocol/prettyPrint.js.map +1 -0
- package/dist/lib/decentraland/crdt-wire-protocol/putComponent.d.ts +15 -0
- package/dist/lib/decentraland/crdt-wire-protocol/putComponent.d.ts.map +1 -0
- package/dist/lib/decentraland/crdt-wire-protocol/putComponent.js +48 -0
- package/dist/lib/decentraland/crdt-wire-protocol/putComponent.js.map +1 -0
- package/dist/lib/decentraland/crdt-wire-protocol/types.d.ts +80 -0
- package/dist/lib/decentraland/crdt-wire-protocol/types.d.ts.map +1 -0
- package/dist/lib/decentraland/crdt-wire-protocol/types.js +15 -0
- package/dist/lib/decentraland/crdt-wire-protocol/types.js.map +1 -0
- package/dist/lib/decentraland/identifiers.d.ts +6 -0
- package/dist/lib/decentraland/identifiers.d.ts.map +1 -0
- package/dist/lib/decentraland/identifiers.js +22 -0
- package/dist/lib/decentraland/identifiers.js.map +1 -0
- package/dist/lib/decentraland/identity/avatar.d.ts +4 -0
- package/dist/lib/decentraland/identity/avatar.d.ts.map +1 -0
- package/dist/lib/decentraland/identity/avatar.js +57 -0
- package/dist/lib/decentraland/identity/avatar.js.map +1 -0
- package/dist/lib/decentraland/identity/login.d.ts +8 -0
- package/dist/lib/decentraland/identity/login.d.ts.map +1 -0
- package/dist/lib/decentraland/identity/login.js +121 -0
- package/dist/lib/decentraland/identity/login.js.map +1 -0
- package/dist/lib/decentraland/identity/signed-fetch.d.ts +17 -0
- package/dist/lib/decentraland/identity/signed-fetch.d.ts.map +1 -0
- package/dist/lib/decentraland/identity/signed-fetch.js +47 -0
- package/dist/lib/decentraland/identity/signed-fetch.js.map +1 -0
- package/dist/lib/decentraland/identity/types.d.ts +11 -0
- package/dist/lib/decentraland/identity/types.d.ts.map +1 -0
- package/dist/lib/decentraland/identity/types.js +3 -0
- package/dist/lib/decentraland/identity/types.js.map +1 -0
- package/dist/lib/decentraland/positions.d.ts +15 -0
- package/dist/lib/decentraland/positions.d.ts.map +1 -0
- package/dist/lib/decentraland/positions.js +40 -0
- package/dist/lib/decentraland/positions.js.map +1 -0
- package/dist/lib/decentraland/realm/resolution.d.ts +2 -0
- package/dist/lib/decentraland/realm/resolution.d.ts.map +1 -0
- package/dist/lib/decentraland/realm/resolution.js +39 -0
- package/dist/lib/decentraland/realm/resolution.js.map +1 -0
- package/dist/lib/decentraland/scene/content-server-entity.d.ts +34 -0
- package/dist/lib/decentraland/scene/content-server-entity.d.ts.map +1 -0
- package/dist/lib/decentraland/scene/content-server-entity.js +22 -0
- package/dist/lib/decentraland/scene/content-server-entity.js.map +1 -0
- package/dist/lib/decentraland/scene/spawn-points.d.ts +16 -0
- package/dist/lib/decentraland/scene/spawn-points.d.ts.map +1 -0
- package/dist/lib/decentraland/scene/spawn-points.js +78 -0
- package/dist/lib/decentraland/scene/spawn-points.js.map +1 -0
- package/dist/lib/decentraland/scene/types.d.ts +38 -0
- package/dist/lib/decentraland/scene/types.d.ts.map +1 -0
- package/dist/lib/decentraland/scene/types.js +3 -0
- package/dist/lib/decentraland/scene/types.js.map +1 -0
- package/dist/lib/decentraland/sdk-components/animator-component.d.ts +3 -0
- package/dist/lib/decentraland/sdk-components/animator-component.d.ts.map +1 -0
- package/dist/lib/decentraland/sdk-components/animator-component.js +12 -0
- package/dist/lib/decentraland/sdk-components/animator-component.js.map +1 -0
- package/dist/lib/decentraland/sdk-components/avatar-base.d.ts +5 -0
- package/dist/lib/decentraland/sdk-components/avatar-base.d.ts.map +1 -0
- package/dist/lib/decentraland/sdk-components/avatar-base.js +40 -0
- package/dist/lib/decentraland/sdk-components/avatar-base.js.map +1 -0
- package/dist/lib/decentraland/sdk-components/avatar-customizations.d.ts +5 -0
- package/dist/lib/decentraland/sdk-components/avatar-customizations.d.ts.map +1 -0
- package/dist/lib/decentraland/sdk-components/avatar-customizations.js +9 -0
- package/dist/lib/decentraland/sdk-components/avatar-customizations.js.map +1 -0
- package/dist/lib/decentraland/sdk-components/avatar-shape.d.ts +5 -0
- package/dist/lib/decentraland/sdk-components/avatar-shape.d.ts.map +1 -0
- package/dist/lib/decentraland/sdk-components/avatar-shape.js +33 -0
- package/dist/lib/decentraland/sdk-components/avatar-shape.js.map +1 -0
- package/dist/lib/decentraland/sdk-components/billboard-component.d.ts +3 -0
- package/dist/lib/decentraland/sdk-components/billboard-component.d.ts.map +1 -0
- package/dist/lib/decentraland/sdk-components/billboard-component.js +15 -0
- package/dist/lib/decentraland/sdk-components/billboard-component.js.map +1 -0
- package/dist/lib/decentraland/sdk-components/delayed-interpolation.d.ts +3 -0
- package/dist/lib/decentraland/sdk-components/delayed-interpolation.d.ts.map +1 -0
- package/dist/lib/decentraland/sdk-components/delayed-interpolation.js +15 -0
- package/dist/lib/decentraland/sdk-components/delayed-interpolation.js.map +1 -0
- package/dist/lib/decentraland/sdk-components/engine-info.d.ts +3 -0
- package/dist/lib/decentraland/sdk-components/engine-info.d.ts.map +1 -0
- package/dist/lib/decentraland/sdk-components/engine-info.js +7 -0
- package/dist/lib/decentraland/sdk-components/engine-info.js.map +1 -0
- package/dist/lib/decentraland/sdk-components/gltf-component.d.ts +3 -0
- package/dist/lib/decentraland/sdk-components/gltf-component.d.ts.map +1 -0
- package/dist/lib/decentraland/sdk-components/gltf-component.js +114 -0
- package/dist/lib/decentraland/sdk-components/gltf-component.js.map +1 -0
- package/dist/lib/decentraland/sdk-components/gltf-loading-state.d.ts +3 -0
- package/dist/lib/decentraland/sdk-components/gltf-loading-state.d.ts.map +1 -0
- package/dist/lib/decentraland/sdk-components/gltf-loading-state.js +7 -0
- package/dist/lib/decentraland/sdk-components/gltf-loading-state.js.map +1 -0
- package/dist/lib/decentraland/sdk-components/material-component.d.ts +5 -0
- package/dist/lib/decentraland/sdk-components/material-component.d.ts.map +1 -0
- package/dist/lib/decentraland/sdk-components/material-component.js +92 -0
- package/dist/lib/decentraland/sdk-components/material-component.js.map +1 -0
- package/dist/lib/decentraland/sdk-components/mesh-collider-component.d.ts +3 -0
- package/dist/lib/decentraland/sdk-components/mesh-collider-component.d.ts.map +1 -0
- package/dist/lib/decentraland/sdk-components/mesh-collider-component.js +37 -0
- package/dist/lib/decentraland/sdk-components/mesh-collider-component.js.map +1 -0
- package/dist/lib/decentraland/sdk-components/mesh-renderer-component.d.ts +5 -0
- package/dist/lib/decentraland/sdk-components/mesh-renderer-component.d.ts.map +1 -0
- package/dist/lib/decentraland/sdk-components/mesh-renderer-component.js +111 -0
- package/dist/lib/decentraland/sdk-components/mesh-renderer-component.js.map +1 -0
- package/dist/lib/decentraland/sdk-components/pb-based-component-helper.d.ts +10 -0
- package/dist/lib/decentraland/sdk-components/pb-based-component-helper.d.ts.map +1 -0
- package/dist/lib/decentraland/sdk-components/pb-based-component-helper.js +23 -0
- package/dist/lib/decentraland/sdk-components/pb-based-component-helper.js.map +1 -0
- package/dist/lib/decentraland/sdk-components/player-identity-data.d.ts +3 -0
- package/dist/lib/decentraland/sdk-components/player-identity-data.d.ts.map +1 -0
- package/dist/lib/decentraland/sdk-components/player-identity-data.js +7 -0
- package/dist/lib/decentraland/sdk-components/player-identity-data.js.map +1 -0
- package/dist/lib/decentraland/sdk-components/pointer-events-result.d.ts +3 -0
- package/dist/lib/decentraland/sdk-components/pointer-events-result.d.ts.map +1 -0
- package/dist/lib/decentraland/sdk-components/pointer-events-result.js +7 -0
- package/dist/lib/decentraland/sdk-components/pointer-events-result.js.map +1 -0
- package/dist/lib/decentraland/sdk-components/pointer-events.d.ts +3 -0
- package/dist/lib/decentraland/sdk-components/pointer-events.d.ts.map +1 -0
- package/dist/lib/decentraland/sdk-components/pointer-events.js +15 -0
- package/dist/lib/decentraland/sdk-components/pointer-events.js.map +1 -0
- package/dist/lib/decentraland/sdk-components/raycast-component.d.ts +5 -0
- package/dist/lib/decentraland/sdk-components/raycast-component.d.ts.map +1 -0
- package/dist/lib/decentraland/sdk-components/raycast-component.js +66 -0
- package/dist/lib/decentraland/sdk-components/raycast-component.js.map +1 -0
- package/dist/lib/decentraland/sdk-components/transform-component.d.ts +13 -0
- package/dist/lib/decentraland/sdk-components/transform-component.d.ts.map +1 -0
- package/dist/lib/decentraland/sdk-components/transform-component.js +84 -0
- package/dist/lib/decentraland/sdk-components/transform-component.js.map +1 -0
- package/dist/lib/decentraland/sdk-components/tween.d.ts +3 -0
- package/dist/lib/decentraland/sdk-components/tween.d.ts.map +1 -0
- package/dist/lib/decentraland/sdk-components/tween.js +15 -0
- package/dist/lib/decentraland/sdk-components/tween.js.map +1 -0
- package/dist/lib/decentraland/state.d.ts +24 -0
- package/dist/lib/decentraland/state.d.ts.map +1 -0
- package/dist/lib/decentraland/state.js +16 -0
- package/dist/lib/decentraland/state.js.map +1 -0
- package/dist/lib/decentraland/system.d.ts +7 -0
- package/dist/lib/decentraland/system.d.ts.map +1 -0
- package/dist/lib/decentraland/system.js +13 -0
- package/dist/lib/decentraland/system.js.map +1 -0
- package/dist/lib/decentraland/types.d.ts +9 -0
- package/dist/lib/decentraland/types.d.ts.map +1 -0
- package/dist/lib/decentraland/types.js +3 -0
- package/dist/lib/decentraland/types.js.map +1 -0
- package/dist/lib/decentraland/virtual-scene.d.ts +12 -0
- package/dist/lib/decentraland/virtual-scene.d.ts.map +1 -0
- package/dist/lib/decentraland/virtual-scene.js +3 -0
- package/dist/lib/decentraland/virtual-scene.js.map +1 -0
- package/dist/lib/engine-main.d.ts +8 -0
- package/dist/lib/engine-main.d.ts.map +1 -0
- package/dist/lib/engine-main.js +103 -0
- package/dist/lib/engine-main.js.map +1 -0
- package/dist/lib/misc/atom.d.ts +13 -0
- package/dist/lib/misc/atom.d.ts.map +1 -0
- package/dist/lib/misc/atom.js +66 -0
- package/dist/lib/misc/atom.js.map +1 -0
- package/dist/lib/misc/bit-operations.d.ts +3 -0
- package/dist/lib/misc/bit-operations.d.ts.map +1 -0
- package/dist/lib/misc/bit-operations.js +14 -0
- package/dist/lib/misc/bit-operations.js.map +1 -0
- package/dist/lib/misc/flat-fetch.d.ts +16 -0
- package/dist/lib/misc/flat-fetch.d.ts.map +1 -0
- package/dist/lib/misc/flat-fetch.js +26 -0
- package/dist/lib/misc/flat-fetch.js.map +1 -0
- package/dist/lib/misc/json.d.ts +3 -0
- package/dist/lib/misc/json.d.ts.map +1 -0
- package/dist/lib/misc/json.js +24 -0
- package/dist/lib/misc/json.js.map +1 -0
- package/dist/lib/misc/logger.d.ts +6 -0
- package/dist/lib/misc/logger.d.ts.map +1 -0
- package/dist/lib/misc/logger.js +24 -0
- package/dist/lib/misc/logger.js.map +1 -0
- package/dist/lib/misc/memoize.d.ts +2 -0
- package/dist/lib/misc/memoize.d.ts.map +1 -0
- package/dist/lib/misc/memoize.js +16 -0
- package/dist/lib/misc/memoize.js.map +1 -0
- package/dist/lib/misc/promises.d.ts +3 -0
- package/dist/lib/misc/promises.d.ts.map +1 -0
- package/dist/lib/misc/promises.js +14 -0
- package/dist/lib/misc/promises.js.map +1 -0
- package/dist/lib/polyfills/xmlhttprequest.d.ts +6 -0
- package/dist/lib/polyfills/xmlhttprequest.d.ts.map +1 -0
- package/dist/lib/polyfills/xmlhttprequest.js +127 -0
- package/dist/lib/polyfills/xmlhttprequest.js.map +1 -0
- package/dist/lib/quick-js/convert-handles.d.ts +14 -0
- package/dist/lib/quick-js/convert-handles.d.ts.map +1 -0
- package/dist/lib/quick-js/convert-handles.js +83 -0
- package/dist/lib/quick-js/convert-handles.js.map +1 -0
- package/dist/lib/quick-js/index.d.ts +12 -0
- package/dist/lib/quick-js/index.d.ts.map +1 -0
- package/dist/lib/quick-js/index.js +159 -0
- package/dist/lib/quick-js/index.js.map +1 -0
- package/dist/lib/quick-js/rpc-scene-runtime.d.ts +13 -0
- package/dist/lib/quick-js/rpc-scene-runtime.d.ts.map +1 -0
- package/dist/lib/quick-js/rpc-scene-runtime.js +32 -0
- package/dist/lib/quick-js/rpc-scene-runtime.js.map +1 -0
- package/dist/lib/quick-js/types.d.ts +35 -0
- package/dist/lib/quick-js/types.d.ts.map +1 -0
- package/dist/lib/quick-js/types.js +3 -0
- package/dist/lib/quick-js/types.js.map +1 -0
- package/dist/lib/web-worker-runtime/context.d.ts +12 -0
- package/dist/lib/web-worker-runtime/context.d.ts.map +1 -0
- package/dist/lib/web-worker-runtime/context.js +97 -0
- package/dist/lib/web-worker-runtime/context.js.map +1 -0
- package/dist/lib/web-worker-runtime/sandbox.d.ts +9 -0
- package/dist/lib/web-worker-runtime/sandbox.d.ts.map +1 -0
- package/dist/lib/web-worker-runtime/sandbox.js +98 -0
- package/dist/lib/web-worker-runtime/sandbox.js.map +1 -0
- package/dist/lib/web-worker-runtime/web-worker-scene-runtime.d.ts +13 -0
- package/dist/lib/web-worker-runtime/web-worker-scene-runtime.d.ts.map +1 -0
- package/dist/lib/web-worker-runtime/web-worker-scene-runtime.js +32 -0
- package/dist/lib/web-worker-runtime/web-worker-scene-runtime.js.map +1 -0
- package/package.json +73 -0
|
@@ -0,0 +1,492 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
26
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
27
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
28
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
29
|
+
};
|
|
30
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
31
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
32
|
+
};
|
|
33
|
+
var _SceneContext_ref;
|
|
34
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
35
|
+
exports.encodeMessage = exports.MsgType = exports.SceneContext = void 0;
|
|
36
|
+
const BABYLON = __importStar(require("@babylonjs/core"));
|
|
37
|
+
const fp_future_1 = __importDefault(require("fp-future"));
|
|
38
|
+
const crdt_wire_protocol_1 = require("../../decentraland/crdt-wire-protocol");
|
|
39
|
+
const ByteBuffer_1 = require("../../decentraland/ByteBuffer");
|
|
40
|
+
const content_server_entity_1 = require("../../decentraland/scene/content-server-entity");
|
|
41
|
+
const BabylonEntity_1 = require("./BabylonEntity");
|
|
42
|
+
const transform_component_1 = require("../../decentraland/sdk-components/transform-component");
|
|
43
|
+
const last_write_win_element_set_1 = require("../../decentraland/crdt-internal/last-write-win-element-set");
|
|
44
|
+
const cyclic_transform_1 = require("./logic/cyclic-transform");
|
|
45
|
+
const core_1 = require("@babylonjs/core");
|
|
46
|
+
const billboard_component_1 = require("../../decentraland/sdk-components/billboard-component");
|
|
47
|
+
const raycast_component_1 = require("../../decentraland/sdk-components/raycast-component");
|
|
48
|
+
const mesh_renderer_component_1 = require("../../decentraland/sdk-components/mesh-renderer-component");
|
|
49
|
+
const raycasts_1 = require("./logic/raycasts");
|
|
50
|
+
const mesh_collider_component_1 = require("../../decentraland/sdk-components/mesh-collider-component");
|
|
51
|
+
const positions_1 = require("../../decentraland/positions");
|
|
52
|
+
const parcelOutline_1 = require("../visual/parcelOutline");
|
|
53
|
+
const gltf_component_1 = require("../../decentraland/sdk-components/gltf-component");
|
|
54
|
+
const AssetManager_1 = require("./AssetManager");
|
|
55
|
+
const pointer_events_1 = require("../../decentraland/sdk-components/pointer-events");
|
|
56
|
+
const static_entities_1 = require("./logic/static-entities");
|
|
57
|
+
const animator_component_1 = require("../../decentraland/sdk-components/animator-component");
|
|
58
|
+
const engine_info_1 = require("../../decentraland/sdk-components/engine-info");
|
|
59
|
+
const gltf_loading_state_1 = require("../../decentraland/sdk-components/gltf-loading-state");
|
|
60
|
+
const loading_state_gen_1 = require("@dcl/protocol/out-js/decentraland/sdk/components/common/loading_state.gen");
|
|
61
|
+
const pointer_events_result_1 = require("../../decentraland/sdk-components/pointer-events-result");
|
|
62
|
+
const grow_only_set_1 = require("../../decentraland/crdt-internal/grow-only-set");
|
|
63
|
+
const generational_index_pool_1 = require("../../decentraland/crdt-internal/generational-index-pool");
|
|
64
|
+
const avatar_shape_1 = require("../../decentraland/sdk-components/avatar-shape");
|
|
65
|
+
const avatar_base_1 = require("../../decentraland/sdk-components/avatar-base");
|
|
66
|
+
const delayed_interpolation_1 = require("../../decentraland/sdk-components/delayed-interpolation");
|
|
67
|
+
const tween_1 = require("../../decentraland/sdk-components/tween");
|
|
68
|
+
const material_component_1 = require("../../decentraland/sdk-components/material-component");
|
|
69
|
+
const avatar_communication_system_1 = require("../../decentraland/communications/avatar-communication-system");
|
|
70
|
+
const SCENE_ENTITY_RANGE = [1, generational_index_pool_1.MAX_ENTITY_NUMBER];
|
|
71
|
+
let incrementalId = 0;
|
|
72
|
+
class SceneContext {
|
|
73
|
+
constructor(babylonScene, loadableScene, isGlobalScene, entityId) {
|
|
74
|
+
this.babylonScene = babylonScene;
|
|
75
|
+
this.loadableScene = loadableScene;
|
|
76
|
+
this.isGlobalScene = isGlobalScene;
|
|
77
|
+
this.entities = new Map();
|
|
78
|
+
_SceneContext_ref.set(this, new WeakRef(this));
|
|
79
|
+
// this future is resolved when the scene is disposed
|
|
80
|
+
this.stopped = (0, fp_future_1.default)();
|
|
81
|
+
// after the "tick" is completed, resolving the futures will send back the CRDT
|
|
82
|
+
// updates to the scripting scene
|
|
83
|
+
this.nextFrameFutures = [];
|
|
84
|
+
// stash of incoming CRDT messages from the scripting scene, processed using a
|
|
85
|
+
// quota each renderer frame. ByteBuffer reading is continuable using iterators.
|
|
86
|
+
// the incoming messages also include the range of allowe entities that the origin
|
|
87
|
+
// transports had access to
|
|
88
|
+
this.incomingMessages = [];
|
|
89
|
+
// stash of outgoing messages ready to be sent to back to the scripting scene
|
|
90
|
+
this.outgoingMessagesBuffer = new ByteBuffer_1.ReadWriteByteBuffer();
|
|
91
|
+
// when we finish to process all the income messages of a tick,
|
|
92
|
+
// set finishedProcessingFrame to true to send the outgoing messages, then to false.
|
|
93
|
+
this.finishedProcessingIncomingMessagesOfTick = false;
|
|
94
|
+
// the follwing set contains a list of pending raycast queries. if a query is continous,
|
|
95
|
+
// it won't be removed from the set
|
|
96
|
+
this.pendingRaycastOperations = new Set();
|
|
97
|
+
// log function for tests
|
|
98
|
+
this.log = (...args) => console.log(this.rootNode.name, ...args);
|
|
99
|
+
// tick counter for EngineInfo
|
|
100
|
+
this.currentTick = 0;
|
|
101
|
+
// start time for EngineInfo
|
|
102
|
+
this.startTime = performance.now();
|
|
103
|
+
// start frame for EngineInfo
|
|
104
|
+
this.startFrame = this.babylonScene.getEngine().frameId;
|
|
105
|
+
// contents of the main.crdt file
|
|
106
|
+
this.mainCrdt = Uint8Array.of();
|
|
107
|
+
this.components = {
|
|
108
|
+
[transform_component_1.transformComponent.componentId]: (0, last_write_win_element_set_1.createLwwStore)(transform_component_1.transformComponent),
|
|
109
|
+
[billboard_component_1.billboardComponent.componentId]: (0, last_write_win_element_set_1.createLwwStore)(billboard_component_1.billboardComponent),
|
|
110
|
+
[raycast_component_1.raycastComponent.componentId]: (0, last_write_win_element_set_1.createLwwStore)(raycast_component_1.raycastComponent),
|
|
111
|
+
[raycast_component_1.raycastResultComponent.componentId]: (0, last_write_win_element_set_1.createLwwStore)(raycast_component_1.raycastResultComponent),
|
|
112
|
+
[mesh_renderer_component_1.meshRendererComponent.componentId]: (0, last_write_win_element_set_1.createLwwStore)(mesh_renderer_component_1.meshRendererComponent),
|
|
113
|
+
[mesh_collider_component_1.meshColliderComponent.componentId]: (0, last_write_win_element_set_1.createLwwStore)(mesh_collider_component_1.meshColliderComponent),
|
|
114
|
+
[gltf_component_1.gltfContainerComponent.componentId]: (0, last_write_win_element_set_1.createLwwStore)(gltf_component_1.gltfContainerComponent),
|
|
115
|
+
[pointer_events_1.pointerEventsComponent.componentId]: (0, last_write_win_element_set_1.createLwwStore)(pointer_events_1.pointerEventsComponent),
|
|
116
|
+
[pointer_events_result_1.pointerEventsResultComponent.componentId]: (0, grow_only_set_1.createValueSetComponentStore)(pointer_events_result_1.pointerEventsResultComponent, {
|
|
117
|
+
maxElements: 10,
|
|
118
|
+
timestampFunction(value) {
|
|
119
|
+
return value.tickNumber;
|
|
120
|
+
},
|
|
121
|
+
}),
|
|
122
|
+
[animator_component_1.animatorComponent.componentId]: (0, last_write_win_element_set_1.createLwwStore)(animator_component_1.animatorComponent),
|
|
123
|
+
[gltf_loading_state_1.gltfContainerLoadingStateComponent.componentId]: (0, last_write_win_element_set_1.createLwwStore)(gltf_loading_state_1.gltfContainerLoadingStateComponent),
|
|
124
|
+
[engine_info_1.engineInfoComponent.componentId]: (0, last_write_win_element_set_1.createLwwStore)(engine_info_1.engineInfoComponent),
|
|
125
|
+
[avatar_shape_1.avatarShapeComponent.componentId]: (0, last_write_win_element_set_1.createLwwStore)(avatar_shape_1.avatarShapeComponent),
|
|
126
|
+
[avatar_base_1.avatarBaseComponent.componentId]: (0, last_write_win_element_set_1.createLwwStore)(avatar_base_1.avatarBaseComponent),
|
|
127
|
+
[tween_1.tweenComponent.componentId]: (0, last_write_win_element_set_1.createLwwStore)(tween_1.tweenComponent),
|
|
128
|
+
[delayed_interpolation_1.delayedInterpolationComponent.componentId]: (0, last_write_win_element_set_1.createLwwStore)(delayed_interpolation_1.delayedInterpolationComponent),
|
|
129
|
+
[material_component_1.materialComponent.componentId]: (0, last_write_win_element_set_1.createLwwStore)(material_component_1.materialComponent),
|
|
130
|
+
};
|
|
131
|
+
// this flag is changed every time an entity changed its parent. the change
|
|
132
|
+
// in the hierarchy is not immediately applied, instead, it should be queued
|
|
133
|
+
// in the unparentedEntities set. Once there, at the end of the "tick", the
|
|
134
|
+
// scene will perform all possible acyclic updates of entities to prevent
|
|
135
|
+
// breaking the Babylon's hierarcy and generating stack overflows while calculating
|
|
136
|
+
// the world matrix of the entitiesg
|
|
137
|
+
this.hierarchyChanged = false;
|
|
138
|
+
this.unparentedEntities = new Set;
|
|
139
|
+
// the assetmanager is used to centralize all the loading/unloading of assets
|
|
140
|
+
// of this scene.
|
|
141
|
+
this.assetManager = new AssetManager_1.AssetManager(this.loadableScene, this.babylonScene);
|
|
142
|
+
// subscriptions to other scene's CRDT updates
|
|
143
|
+
this.subscriptions = [];
|
|
144
|
+
this.subscriptionsBuffer = new ByteBuffer_1.ReadWriteByteBuffer();
|
|
145
|
+
// TODO: this should be the optimized data structure to keep track of deleted entities
|
|
146
|
+
// instead of a set
|
|
147
|
+
this.deletedEntities = new Set();
|
|
148
|
+
this.id = incrementalId++;
|
|
149
|
+
this.incomingNetworkMessages = [];
|
|
150
|
+
this.entityId = entityId;
|
|
151
|
+
this.rootNode = this.getOrCreateEntity(static_entities_1.StaticEntities.RootEntity);
|
|
152
|
+
// the rootNode must be positioned according to the value of the "scenes.base" of the scene metadata (scene.json)
|
|
153
|
+
this.metadata = loadableScene.entity.metadata;
|
|
154
|
+
if (this.metadata.scene?.base) {
|
|
155
|
+
const base = (0, positions_1.parseParcelPosition)(this.metadata.scene.base);
|
|
156
|
+
this.rootNode.name = this.metadata.scene.base;
|
|
157
|
+
(0, positions_1.gridToWorld)(base.x, base.y, this.rootNode.position);
|
|
158
|
+
const r = (0, parcelOutline_1.createParcelOutline)(babylonScene, this.metadata.scene.base, this.metadata.scene.parcels);
|
|
159
|
+
r.result.parent = this.rootNode;
|
|
160
|
+
// position the GlobalCenterOfCoordinates entity
|
|
161
|
+
const GlobalCenterOfCoordinates = this.getOrCreateEntity(static_entities_1.StaticEntities.GlobalCenterOfCoordinates);
|
|
162
|
+
GlobalCenterOfCoordinates.position.set(-this.rootNode.position.x, 0, -this.rootNode.position.z);
|
|
163
|
+
GlobalCenterOfCoordinates.parent = this.rootNode;
|
|
164
|
+
}
|
|
165
|
+
// calculate a naive bounding box for the scene to calculate the distance to the outer bounds
|
|
166
|
+
// and use that distance to prioritize the message quota for ADR-148
|
|
167
|
+
if (this.metadata.scene?.parcels) {
|
|
168
|
+
let minX = null;
|
|
169
|
+
let minZ = null;
|
|
170
|
+
let maxX = null;
|
|
171
|
+
let maxZ = null;
|
|
172
|
+
for (const position of this.metadata.scene.parcels) {
|
|
173
|
+
const vec = (0, positions_1.parseParcelPosition)(position);
|
|
174
|
+
if (minX == null || vec.x < minX)
|
|
175
|
+
minX = vec.x;
|
|
176
|
+
if (minZ == null || vec.y < minZ)
|
|
177
|
+
minZ = vec.y;
|
|
178
|
+
if (maxX == null || vec.x > maxX)
|
|
179
|
+
maxX = vec.x;
|
|
180
|
+
if (maxZ == null || vec.y > maxZ)
|
|
181
|
+
maxZ = vec.y;
|
|
182
|
+
}
|
|
183
|
+
// as per https://docs.decentraland.org/creator/development-guide/scene-limitations/
|
|
184
|
+
const height = Math.log2(this.metadata.scene.parcels.length + 1) * 20;
|
|
185
|
+
if (minX) {
|
|
186
|
+
this.boundingBox = new BABYLON.BoundingBox(new core_1.Vector3(minX * positions_1.PARCEL_SIZE_METERS, -1, minZ * positions_1.PARCEL_SIZE_METERS), new core_1.Vector3((maxX + 1) * positions_1.PARCEL_SIZE_METERS, height, (maxZ + 1) * positions_1.PARCEL_SIZE_METERS));
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
async initAsyncJobs() {
|
|
191
|
+
// load the main.crdt as specified by ADR-133 and ADR-148. the tick number zero
|
|
192
|
+
// is always completed by either the contents of main.crdt or by an empty array
|
|
193
|
+
try {
|
|
194
|
+
const file = 'main.crdt';
|
|
195
|
+
if ((0, content_server_entity_1.resolveFileAbsolute)(this.loadableScene, file)) {
|
|
196
|
+
const { content } = await this.readFile(file);
|
|
197
|
+
this.mainCrdt = content;
|
|
198
|
+
this.incomingMessages.push({ buffer: new ByteBuffer_1.ReadWriteByteBuffer(content), allowedEntityRange: SCENE_ENTITY_RANGE });
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
catch (err) {
|
|
202
|
+
this.log(err);
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
// this function returns the total elapsed time in seconds since the SceneContext was created
|
|
206
|
+
getElapsedTime() {
|
|
207
|
+
return (performance.now() - this.startTime) / 1000;
|
|
208
|
+
}
|
|
209
|
+
// naivest implementation of the distance to the outer bounds of the scene
|
|
210
|
+
distanceToPoint(point) {
|
|
211
|
+
if (!this.boundingBox)
|
|
212
|
+
return 0;
|
|
213
|
+
if (this.boundingBox?.intersectsPoint(point))
|
|
214
|
+
return 0;
|
|
215
|
+
return this.boundingBox?.centerWorld.subtract(point).length();
|
|
216
|
+
}
|
|
217
|
+
removeEntity(entityId) {
|
|
218
|
+
this.deletedEntities.add(entityId);
|
|
219
|
+
const entity = this.getEntityOrNull(entityId);
|
|
220
|
+
if (entity) {
|
|
221
|
+
entity.dispose();
|
|
222
|
+
this.entities.delete(entityId);
|
|
223
|
+
this.unparentedEntities.delete(entityId);
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
getOrCreateEntity(entityId) {
|
|
227
|
+
let entity = this.entities.get(entityId);
|
|
228
|
+
if (!entity) {
|
|
229
|
+
entity = new BabylonEntity_1.BabylonEntity(entityId, __classPrivateFieldGet(this, _SceneContext_ref, "f"));
|
|
230
|
+
// every new entity is parented to the scene's rootEntity by default
|
|
231
|
+
entity.parent = this.rootNode;
|
|
232
|
+
this.entities.set(entityId, entity);
|
|
233
|
+
}
|
|
234
|
+
return entity;
|
|
235
|
+
}
|
|
236
|
+
getEntityOrNull(entityId) {
|
|
237
|
+
return this.entities.get(entityId) || null;
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* The "update" function handles all the incoming messages from the scene and
|
|
241
|
+
* applies the changes to the renderer entities.
|
|
242
|
+
*
|
|
243
|
+
* This function is declared as a property to be added and removed to the
|
|
244
|
+
* rendering engine without binding the SceneContext object.
|
|
245
|
+
*
|
|
246
|
+
* Returns false if the quota was exceeded. True if there is still time to continue
|
|
247
|
+
* processing more messages, similar to cooperative scheduling.
|
|
248
|
+
*/
|
|
249
|
+
update(hasQuota) {
|
|
250
|
+
let rollingOperationCounter = 0;
|
|
251
|
+
// process all the incoming messages
|
|
252
|
+
while (this.incomingMessages.length) {
|
|
253
|
+
const message = this.incomingMessages[0];
|
|
254
|
+
for (const crdtMessage of (0, crdt_wire_protocol_1.readAllMessages)(message.buffer)) {
|
|
255
|
+
if (this.deletedEntities.has(crdtMessage.entityId))
|
|
256
|
+
continue;
|
|
257
|
+
// STUB create or delete entities based on putComponent and deleteEntity
|
|
258
|
+
switch (crdtMessage.type) {
|
|
259
|
+
case crdt_wire_protocol_1.CrdtMessageType.APPEND_VALUE:
|
|
260
|
+
case crdt_wire_protocol_1.CrdtMessageType.DELETE_COMPONENT:
|
|
261
|
+
case crdt_wire_protocol_1.CrdtMessageType.PUT_COMPONENT: {
|
|
262
|
+
// ignore updates of entities outside range
|
|
263
|
+
// if (!entityIsInRange(crdtMessage.entityId, message.allowedEntityRange)) continue
|
|
264
|
+
const entity = this.getOrCreateEntity(crdtMessage.entityId);
|
|
265
|
+
const component = this.components[crdtMessage.componentId];
|
|
266
|
+
// if the change is accepted, then we instruct the entity to update its internal state
|
|
267
|
+
// via putComponent or deleteComponent calls
|
|
268
|
+
if (component && component.updateFromCrdt(crdtMessage, this.outgoingMessagesBuffer)) {
|
|
269
|
+
if (crdtMessage.type === crdt_wire_protocol_1.CrdtMessageType.PUT_COMPONENT ||
|
|
270
|
+
crdtMessage.type === crdt_wire_protocol_1.CrdtMessageType.APPEND_VALUE) {
|
|
271
|
+
entity.putComponent(component);
|
|
272
|
+
}
|
|
273
|
+
else {
|
|
274
|
+
entity.deleteComponent(component);
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
break;
|
|
278
|
+
}
|
|
279
|
+
case crdt_wire_protocol_1.CrdtMessageType.DELETE_ENTITY: {
|
|
280
|
+
// ignore updates of entities outside range
|
|
281
|
+
if (!(0, static_entities_1.entityIsInRange)(crdtMessage.entityId, message.allowedEntityRange))
|
|
282
|
+
continue;
|
|
283
|
+
this.removeEntity(crdtMessage.entityId);
|
|
284
|
+
break;
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
// if we exceeded the quota, finish the processing of this "message" and yield
|
|
288
|
+
// the execution control back to the event loop
|
|
289
|
+
if ((++rollingOperationCounter % 10) == 0 && !hasQuota()) {
|
|
290
|
+
return false;
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
// at this point, the whole "message" was consumed, we proceed to its removal
|
|
294
|
+
this.incomingMessages.shift();
|
|
295
|
+
// this process resolves the re parenting of all entities preventing cycles
|
|
296
|
+
(0, cyclic_transform_1.resolveCyclicParening)(this);
|
|
297
|
+
}
|
|
298
|
+
// Update avatar system if it exists
|
|
299
|
+
if (this._avatarSystem) {
|
|
300
|
+
this._avatarSystem.update();
|
|
301
|
+
}
|
|
302
|
+
// mark the frame as processed. this signals the lateUpdate to respond to the scene with updates
|
|
303
|
+
this.finishedProcessingIncomingMessagesOfTick = true;
|
|
304
|
+
return true;
|
|
305
|
+
}
|
|
306
|
+
/**
|
|
307
|
+
* lateUpdate should run in each frame AFTER the physics are processed. This is described
|
|
308
|
+
* in ADR-148.
|
|
309
|
+
*
|
|
310
|
+
* The lateUpdate function is declared as a property to be added and removed to the
|
|
311
|
+
* rendering engine without binding the SceneContext object.
|
|
312
|
+
*/
|
|
313
|
+
lateUpdate() {
|
|
314
|
+
// only emit messages if there are receiver promises
|
|
315
|
+
if (!this.nextFrameFutures.length)
|
|
316
|
+
return;
|
|
317
|
+
// only finalize the frame once the incoming messages were cleared
|
|
318
|
+
if (!this.finishedProcessingIncomingMessagesOfTick)
|
|
319
|
+
return;
|
|
320
|
+
// on the first frame, as per ADR-148, the crdtSendToRenderer should only respond
|
|
321
|
+
// if and only if all assets finished loading to properly process the raycasts
|
|
322
|
+
//
|
|
323
|
+
// to compy with that statement, we early-finalize this procedure if a component is in
|
|
324
|
+
// LOADING state. the engine will catch up and finish the crdtSendToRenderer on the
|
|
325
|
+
// next renderer frame
|
|
326
|
+
if (this.currentTick === 0) {
|
|
327
|
+
const loadingComponents = this.components[gltf_loading_state_1.gltfContainerLoadingStateComponent.componentId];
|
|
328
|
+
let has = false;
|
|
329
|
+
for (const [_entity, component] of loadingComponents.iterator()) {
|
|
330
|
+
has = true;
|
|
331
|
+
if (component.currentState === loading_state_gen_1.LoadingState.LOADING) {
|
|
332
|
+
return;
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
this.log('\n\n\n\n======================= Starting Scene Logs: ======================= \n\n');
|
|
336
|
+
}
|
|
337
|
+
const outMessages = [];
|
|
338
|
+
(0, raycasts_1.processRaycasts)(this);
|
|
339
|
+
// TODO: Execute queries into this.outgoingMessages
|
|
340
|
+
// TODO: Collect events into this.outgoingMessages
|
|
341
|
+
// update the components of the static entities to be sent to the scene
|
|
342
|
+
this.updateStaticEntities();
|
|
343
|
+
// write all the CRDT updates in the outgoingMessagesBuffer
|
|
344
|
+
for (const component of Object.values(this.components)) {
|
|
345
|
+
component.dumpCrdtUpdates(this.outgoingMessagesBuffer);
|
|
346
|
+
}
|
|
347
|
+
// forward all messages from all subscriptions
|
|
348
|
+
for (const subscription of this.subscriptions) {
|
|
349
|
+
subscription.getUpdates(this.subscriptionsBuffer);
|
|
350
|
+
if (this.subscriptionsBuffer.currentWriteOffset()) {
|
|
351
|
+
const binary = this.subscriptionsBuffer.toBinary();
|
|
352
|
+
// send the messages from the subscriptions to the scenes
|
|
353
|
+
outMessages.push(binary);
|
|
354
|
+
// auto process the messages from the subscriptions
|
|
355
|
+
this.incomingMessages.push({ buffer: new ByteBuffer_1.ReadWriteByteBuffer(binary), allowedEntityRange: subscription.range });
|
|
356
|
+
// reset the buffer
|
|
357
|
+
this.subscriptionsBuffer.incrementWriteOffset(-this.subscriptionsBuffer.currentWriteOffset());
|
|
358
|
+
this.subscriptionsBuffer.incrementReadOffset(-this.subscriptionsBuffer.currentReadOffset());
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
if (this.outgoingMessagesBuffer.currentWriteOffset()) {
|
|
362
|
+
outMessages.push(this.outgoingMessagesBuffer.toBinary());
|
|
363
|
+
this.outgoingMessagesBuffer.incrementWriteOffset(-this.outgoingMessagesBuffer.currentWriteOffset());
|
|
364
|
+
this.outgoingMessagesBuffer.incrementReadOffset(-this.outgoingMessagesBuffer.currentReadOffset());
|
|
365
|
+
}
|
|
366
|
+
// finally resolve the future so the function "receiveBatch" is unblocked
|
|
367
|
+
// and the next scripting frame is allowed to happen
|
|
368
|
+
this.nextFrameFutures.forEach((fut) => fut.resolve({ data: outMessages }));
|
|
369
|
+
// finally clean the futures
|
|
370
|
+
this.nextFrameFutures.length = 0;
|
|
371
|
+
// increment the tick number, as per ADR-148
|
|
372
|
+
this.currentTick++;
|
|
373
|
+
this.finishedProcessingIncomingMessagesOfTick = false;
|
|
374
|
+
}
|
|
375
|
+
dispose() {
|
|
376
|
+
for (const [entityId] of this.entities) {
|
|
377
|
+
this.removeEntity(entityId);
|
|
378
|
+
}
|
|
379
|
+
for (const s of this.subscriptions) {
|
|
380
|
+
s.dispose();
|
|
381
|
+
}
|
|
382
|
+
this.subscriptions.length = 0;
|
|
383
|
+
// Dispose avatar system if it exists
|
|
384
|
+
if (this._avatarSystem) {
|
|
385
|
+
this._avatarSystem.dispose();
|
|
386
|
+
this._avatarSystem = undefined;
|
|
387
|
+
}
|
|
388
|
+
// Disconnect transport if it exists
|
|
389
|
+
if (this._transport) {
|
|
390
|
+
this._transport.disconnect().catch(() => {
|
|
391
|
+
// Ignore disconnection errors during dispose
|
|
392
|
+
});
|
|
393
|
+
this._transport = undefined;
|
|
394
|
+
}
|
|
395
|
+
this.stopped.resolve();
|
|
396
|
+
this.assetManager.dispose();
|
|
397
|
+
this.rootNode.parent = null;
|
|
398
|
+
this.rootNode.dispose(false);
|
|
399
|
+
}
|
|
400
|
+
// this method exists to be a wrapper of the function. so it can be mocked for tests without wizzardy
|
|
401
|
+
updateStaticEntities() {
|
|
402
|
+
(0, static_entities_1.updateStaticEntities)(this);
|
|
403
|
+
}
|
|
404
|
+
// impl RuntimeApi {
|
|
405
|
+
async readFile(file) {
|
|
406
|
+
return this.assetManager.readFile(file);
|
|
407
|
+
}
|
|
408
|
+
// }
|
|
409
|
+
// returns a future that will be resolved when the next frame is processed
|
|
410
|
+
async nextTick() {
|
|
411
|
+
const fut = (0, fp_future_1.default)();
|
|
412
|
+
this.nextFrameFutures.push(fut);
|
|
413
|
+
return fut;
|
|
414
|
+
}
|
|
415
|
+
async _crdtSendToRenderer(data) {
|
|
416
|
+
if (data.byteLength) {
|
|
417
|
+
this.incomingMessages.push({ buffer: new ByteBuffer_1.ReadWriteByteBuffer(data), allowedEntityRange: SCENE_ENTITY_RANGE });
|
|
418
|
+
}
|
|
419
|
+
// create a future to wait until all the messages are processed. even if there
|
|
420
|
+
// are no updates, we must return the future for CRDT updates like the camera
|
|
421
|
+
// position
|
|
422
|
+
return this.nextTick();
|
|
423
|
+
}
|
|
424
|
+
// impl EngineApiInterface {
|
|
425
|
+
async crdtGetState() {
|
|
426
|
+
const result = await this._crdtSendToRenderer(new Uint8Array(0));
|
|
427
|
+
const hasEntities = this.mainCrdt.byteLength > 0;
|
|
428
|
+
if (hasEntities) {
|
|
429
|
+
// prepend the main.crdt to the response (if not empty). crdt messages are
|
|
430
|
+
// processed sequentially, so the main.crdt will be processed first.
|
|
431
|
+
// if the renderer has any modifications to the main.crdt, they will be
|
|
432
|
+
// applied because they will be processed after
|
|
433
|
+
result.data.unshift(this.mainCrdt);
|
|
434
|
+
}
|
|
435
|
+
return { hasEntities, data: result.data };
|
|
436
|
+
}
|
|
437
|
+
async crdtSendToRenderer(payload) {
|
|
438
|
+
return this._crdtSendToRenderer(payload.data);
|
|
439
|
+
}
|
|
440
|
+
get transport() {
|
|
441
|
+
return this._transport;
|
|
442
|
+
}
|
|
443
|
+
getNetworkMessages() {
|
|
444
|
+
const messages = [...this.incomingNetworkMessages];
|
|
445
|
+
this.incomingNetworkMessages.length = 0;
|
|
446
|
+
return messages;
|
|
447
|
+
}
|
|
448
|
+
attachLivekitTransport(transport) {
|
|
449
|
+
this._transport = transport;
|
|
450
|
+
// Create avatar communication system for this scene
|
|
451
|
+
this._avatarSystem = (0, avatar_communication_system_1.createAvatarCommunicationSystem)(transport);
|
|
452
|
+
// Add the avatar system subscription to this scene's subscriptions
|
|
453
|
+
this.subscriptions.push(this._avatarSystem.createSubscription());
|
|
454
|
+
transport.events.on('sceneMessageBus', (event) => {
|
|
455
|
+
if (event.data.sceneId === this.entityId) {
|
|
456
|
+
if (event.data.data.byteLength) {
|
|
457
|
+
const [_, data] = decodeMessage(event.data.data);
|
|
458
|
+
const senderBytes = new TextEncoder().encode(event.address);
|
|
459
|
+
const messageLength = senderBytes.byteLength + data.byteLength + 1;
|
|
460
|
+
const serializedMessage = new Uint8Array(messageLength);
|
|
461
|
+
serializedMessage.set(new Uint8Array([senderBytes.byteLength]), 0);
|
|
462
|
+
serializedMessage.set(senderBytes, 1);
|
|
463
|
+
serializedMessage.set(data, senderBytes.byteLength + 1);
|
|
464
|
+
this.incomingNetworkMessages.push(serializedMessage);
|
|
465
|
+
}
|
|
466
|
+
}
|
|
467
|
+
});
|
|
468
|
+
}
|
|
469
|
+
}
|
|
470
|
+
exports.SceneContext = SceneContext;
|
|
471
|
+
_SceneContext_ref = new WeakMap();
|
|
472
|
+
/**
|
|
473
|
+
* MsgType utils to diff between old string messages, and new uint8Array messages.
|
|
474
|
+
*/
|
|
475
|
+
var MsgType;
|
|
476
|
+
(function (MsgType) {
|
|
477
|
+
MsgType[MsgType["String"] = 1] = "String";
|
|
478
|
+
MsgType[MsgType["Uint8Array"] = 2] = "Uint8Array";
|
|
479
|
+
})(MsgType = exports.MsgType || (exports.MsgType = {}));
|
|
480
|
+
function decodeMessage(value) {
|
|
481
|
+
const msgType = value.at(0);
|
|
482
|
+
const data = value.subarray(1);
|
|
483
|
+
return [msgType, data];
|
|
484
|
+
}
|
|
485
|
+
function encodeMessage(data, type) {
|
|
486
|
+
const message = new Uint8Array(data.byteLength + 1);
|
|
487
|
+
message.set([type]);
|
|
488
|
+
message.set(data, 1);
|
|
489
|
+
return message;
|
|
490
|
+
}
|
|
491
|
+
exports.encodeMessage = encodeMessage;
|
|
492
|
+
//# sourceMappingURL=scene-context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scene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AAiB,CAAC,GAAG,CAAC,IAAI,EAAE,WAAW,CAAC,UAAU,GAAG,CAAC,CAAC,CAAA;oBACvD,IAAI,CAAC,uBAAuB,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAA;iBACrD;aACF;QACH,CAAC,CAAC,CAAA;IACJ,CAAC;CACF;AAzdD,oCAydC;;AAED;;GAEG;AACH,IAAY,OAGX;AAHD,WAAY,OAAO;IACjB,yCAAU,CAAA;IACV,iDAAc,CAAA;AAChB,CAAC,EAHW,OAAO,GAAP,eAAO,KAAP,eAAO,QAGlB;AAED,SAAS,aAAa,CAAC,KAAiB;IACtC,MAAM,OAAO,GAAG,KAAK,CAAC,EAAE,CAAC,CAAC,CAAY,CAAA;IACtC,MAAM,IAAI,GAAG,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAA;IAC9B,OAAO,CAAC,OAAO,EAAE,IAAI,CAAC,CAAA;AACxB,CAAC;AAED,SAAgB,aAAa,CAAC,IAAgB,EAAE,IAAa;IAC3D,MAAM,OAAO,GAAG,IAAI,UAAU,CAAC,IAAI,CAAC,UAAU,GAAG,CAAC,CAAC,CAAA;IACnD,OAAO,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,CAAA;IACnB,OAAO,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC,CAAA;IACpB,OAAO,OAAO,CAAA;AAChB,CAAC;AALD,sCAKC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Scene } from "@babylonjs/core";
|
|
2
|
+
import { SceneContext } from "./scene-context";
|
|
3
|
+
export declare function createSceneCullingSystem(babylonScene: Scene, getScenes: () => Iterable<SceneContext>): {
|
|
4
|
+
update(): void;
|
|
5
|
+
};
|
|
6
|
+
//# sourceMappingURL=scene-culling.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scene-culling.d.ts","sourceRoot":"","sources":["../../../../src/lib/babylon/scene/scene-culling.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAA;AACvC,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAI9C,wBAAgB,wBAAwB,CAAC,YAAY,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC,YAAY,CAAC;;EAepG"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createSceneCullingSystem = void 0;
|
|
4
|
+
// the sceneCullingSystem rapidly checks whether the bounding box of the scene are
|
|
5
|
+
// colliding with the frustum of the camera to enable/disable their root entity
|
|
6
|
+
function createSceneCullingSystem(babylonScene, getScenes) {
|
|
7
|
+
return {
|
|
8
|
+
update() {
|
|
9
|
+
const planes = babylonScene.frustumPlanes;
|
|
10
|
+
if (planes) {
|
|
11
|
+
for (const scene of getScenes()) {
|
|
12
|
+
// we know the static bounding box of the scene in advance. we can disable the
|
|
13
|
+
// whole tree for rendering if it is not in the frustum.
|
|
14
|
+
if (scene.boundingBox) {
|
|
15
|
+
scene.rootNode.setEnabled(scene.boundingBox.isInFrustum(planes));
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
exports.createSceneCullingSystem = createSceneCullingSystem;
|
|
23
|
+
//# sourceMappingURL=scene-culling.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scene-culling.js","sourceRoot":"","sources":["../../../../src/lib/babylon/scene/scene-culling.ts"],"names":[],"mappings":";;;AAGA,kFAAkF;AAClF,+EAA+E;AAC/E,SAAgB,wBAAwB,CAAC,YAAmB,EAAE,SAAuC;IACnG,OAAO;QACL,MAAM;YACJ,MAAM,MAAM,GAAG,YAAY,CAAC,aAAa,CAAA;YACzC,IAAI,MAAM,EAAE;gBACV,KAAK,MAAM,KAAK,IAAI,SAAS,EAAE,EAAE;oBAC/B,8EAA8E;oBAC9E,wDAAwD;oBACxD,IAAI,KAAK,CAAC,WAAW,EAAE;wBACrB,KAAK,CAAC,QAAQ,CAAC,UAAU,CAAC,KAAK,CAAC,WAAW,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,CAAA;qBACjE;iBACF;aACF;QACH,CAAC;KACF,CAAA;AACH,CAAC;AAfD,4DAeC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Scene } from "@babylonjs/core";
|
|
2
|
+
import { SceneContext } from "./scene-context";
|
|
3
|
+
export declare function createSceneTickSystem(scene: Scene, getScenes: () => Iterable<SceneContext>, quotaMs: number): {
|
|
4
|
+
update(): void;
|
|
5
|
+
lateUpdate(): void;
|
|
6
|
+
};
|
|
7
|
+
//# sourceMappingURL=update-scheduler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update-scheduler.d.ts","sourceRoot":"","sources":["../../../../src/lib/babylon/scene/update-scheduler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,KAAK,EAAW,MAAM,iBAAiB,CAAC;AAChE,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAG/C,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC,YAAY,CAAC,EAAE,OAAO,EAAE,MAAM;;;EAqC3G"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createSceneTickSystem = void 0;
|
|
4
|
+
const core_1 = require("@babylonjs/core");
|
|
5
|
+
// SceneTickSystem adds hooks to the babylon engine to start processing the updates from the workers
|
|
6
|
+
function createSceneTickSystem(scene, getScenes, quotaMs) {
|
|
7
|
+
function getSortedScenes() {
|
|
8
|
+
const scenes = getScenes();
|
|
9
|
+
const cameraPosition = scene.activeCamera?.position || core_1.Vector3.Zero();
|
|
10
|
+
const scenesWithDistance = Array.from(scenes).map(scene => ({
|
|
11
|
+
scene,
|
|
12
|
+
distance: (scene.currentTick == 0 || scene.isGlobalScene) ? 0
|
|
13
|
+
: scene.distanceToPoint(cameraPosition)
|
|
14
|
+
}));
|
|
15
|
+
return scenesWithDistance.sort((a, b) => a.distance - b.distance);
|
|
16
|
+
}
|
|
17
|
+
return {
|
|
18
|
+
// this function runs the initial part of the tick defined in ADR-148,
|
|
19
|
+
// before sending GPU commands
|
|
20
|
+
update() {
|
|
21
|
+
const sortedScenes = getSortedScenes();
|
|
22
|
+
const start = core_1.PrecisionDate.Now;
|
|
23
|
+
const hasQuota = () => (core_1.PrecisionDate.Now - start) < quotaMs;
|
|
24
|
+
for (const { scene } of sortedScenes) {
|
|
25
|
+
// if the processing quota has been exceeded for this frame we will skip it for now.
|
|
26
|
+
if (!scene.update(hasQuota))
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
// this function runs the final part of the tick defined in ADR-148.
|
|
31
|
+
// ideally in parallel with GPU commands or while we wait for their completion
|
|
32
|
+
lateUpdate() {
|
|
33
|
+
for (const scene of getScenes()) {
|
|
34
|
+
scene.lateUpdate();
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
exports.createSceneTickSystem = createSceneTickSystem;
|
|
40
|
+
//# sourceMappingURL=update-scheduler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update-scheduler.js","sourceRoot":"","sources":["../../../../src/lib/babylon/scene/update-scheduler.ts"],"names":[],"mappings":";;;AAAA,0CAAgE;AAGhE,oGAAoG;AACpG,SAAgB,qBAAqB,CAAC,KAAY,EAAE,SAAuC,EAAE,OAAe;IAC1G,SAAS,eAAe;QACtB,MAAM,MAAM,GAAG,SAAS,EAAE,CAAA;QAC1B,MAAM,cAAc,GAAG,KAAK,CAAC,YAAY,EAAE,QAAQ,IAAI,cAAO,CAAC,IAAI,EAAE,CAAA;QACrE,MAAM,kBAAkB,GAAG,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,GAAG,CAC/C,KAAK,CAAC,EAAE,CAAC,CAAC;YACR,KAAK;YACL,QAAQ,EACN,CAAC,KAAK,CAAC,WAAW,IAAI,CAAC,IAAI,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC;gBACjD,CAAC,CAAC,KAAK,CAAC,eAAe,CAAC,cAAc,CAAC;SAC5C,CAAC,CACH,CAAA;QAED,OAAO,kBAAkB,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,GAAG,CAAC,CAAC,QAAQ,CAAC,CAAA;IACnE,CAAC;IAED,OAAO;QACL,sEAAsE;QACtE,8BAA8B;QAC9B,MAAM;YACJ,MAAM,YAAY,GAAG,eAAe,EAAE,CAAA;YACtC,MAAM,KAAK,GAAG,oBAAa,CAAC,GAAG,CAAA;YAC/B,MAAM,QAAQ,GAAG,GAAG,EAAE,CAAC,CAAC,oBAAa,CAAC,GAAG,GAAG,KAAK,CAAC,GAAG,OAAO,CAAA;YAE5D,KAAK,MAAM,EAAE,KAAK,EAAE,IAAI,YAAY,EAAE;gBACpC,oFAAoF;gBACpF,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC;oBAAE,OAAM;aACpC;QACH,CAAC;QACD,qEAAqE;QACrE,8EAA8E;QAC9E,UAAU;YACR,KAAK,MAAM,KAAK,IAAI,SAAS,EAAE,EAAE;gBAC/B,KAAK,CAAC,UAAU,EAAE,CAAA;aACnB;QACH,CAAC;KACF,CAAA;AACH,CAAC;AArCD,sDAqCC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare class LinearlyAnimatedScalar {
|
|
2
|
+
animationStart: number;
|
|
3
|
+
animationEnd: number;
|
|
4
|
+
finalValue: number;
|
|
5
|
+
initialValue: number;
|
|
6
|
+
animateTo(now: number, targetValue: number, linearSpeed: number): number;
|
|
7
|
+
getCurrentWeight(now: number): {
|
|
8
|
+
value: number;
|
|
9
|
+
µ: number;
|
|
10
|
+
};
|
|
11
|
+
getValue(now: number): number;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=time-based-animation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"time-based-animation.d.ts","sourceRoot":"","sources":["../../../src/lib/babylon/time-based-animation.ts"],"names":[],"mappings":"AAGA,qBAAa,sBAAsB;IACjC,cAAc,EAAE,MAAM,CAAI;IAC1B,YAAY,EAAE,MAAM,CAAI;IACxB,UAAU,EAAE,MAAM,CAAI;IACtB,YAAY,EAAE,MAAM,CAAI;IAExB,SAAS,CAAC,GAAG,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM;IAgB/D,gBAAgB,CAAC,GAAG,EAAE,MAAM;;;;IAM5B,QAAQ,CAAC,GAAG,EAAE,MAAM;CAGrB"}
|