@zylem/game-lib 0.4.1 → 0.5.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 +23 -41
- package/dist/actions.d.ts +25 -0
- package/dist/actions.js +287 -8
- package/dist/actions.js.map +1 -0
- package/dist/behaviors.d.ts +108 -0
- package/dist/behaviors.js +396 -6
- package/dist/behaviors.js.map +1 -0
- package/dist/{lib/camera/zylem-camera.d.ts → camera-Dk-fOVZE.d.ts} +55 -8
- package/dist/camera.d.ts +5 -0
- package/dist/camera.js +504 -4
- package/dist/camera.js.map +1 -0
- package/dist/core-C2mjetAd.d.ts +431 -0
- package/dist/core.d.ts +9 -0
- package/dist/core.js +4780 -9
- package/dist/core.js.map +1 -0
- package/dist/entities.d.ts +269 -0
- package/dist/entities.js +2161 -17
- package/dist/entities.js.map +1 -0
- package/dist/entity-bQElAdpo.d.ts +347 -0
- package/dist/entity-spawner-DNnLYnZq.d.ts +11 -0
- package/dist/main.d.ts +135 -0
- package/dist/main.js +6599 -56
- package/dist/main.js.map +1 -0
- package/dist/moveable-B_vyA6cw.d.ts +67 -0
- package/dist/stage-CrmY7V0i.d.ts +287 -0
- package/dist/stage.d.ts +26 -0
- package/dist/stage.js +2229 -15
- package/dist/stage.js.map +1 -0
- package/dist/transformable-CUhvyuYO.d.ts +67 -0
- package/package.json +12 -42
- package/LICENSE +0 -21
- package/dist/.vite/manifest.json +0 -676
- package/dist/api/actions.d.ts +0 -5
- package/dist/api/actions.d.ts.map +0 -1
- package/dist/api/behaviors.d.ts +0 -4
- package/dist/api/behaviors.d.ts.map +0 -1
- package/dist/api/camera.d.ts +0 -4
- package/dist/api/camera.d.ts.map +0 -1
- package/dist/api/core.d.ts +0 -6
- package/dist/api/core.d.ts.map +0 -1
- package/dist/api/entities.d.ts +0 -9
- package/dist/api/entities.d.ts.map +0 -1
- package/dist/api/main.d.ts +0 -32
- package/dist/api/main.d.ts.map +0 -1
- package/dist/api/stage.d.ts +0 -6
- package/dist/api/stage.d.ts.map +0 -1
- package/dist/assets/zylem-logo.png +0 -0
- package/dist/lib/actions/behaviors/actions.d.ts +0 -11
- package/dist/lib/actions/behaviors/actions.d.ts.map +0 -1
- package/dist/lib/actions/behaviors/actions.js +0 -35
- package/dist/lib/actions/behaviors/behavior.d.ts +0 -6
- package/dist/lib/actions/behaviors/behavior.d.ts.map +0 -1
- package/dist/lib/actions/behaviors/boundaries/boundary.d.ts +0 -37
- package/dist/lib/actions/behaviors/boundaries/boundary.d.ts.map +0 -1
- package/dist/lib/actions/behaviors/boundaries/boundary.js +0 -40
- package/dist/lib/actions/behaviors/character-controller.d.ts +0 -6
- package/dist/lib/actions/behaviors/character-controller.d.ts.map +0 -1
- package/dist/lib/actions/behaviors/debug/debug-collision.d.ts +0 -6
- package/dist/lib/actions/behaviors/debug/debug-collision.d.ts.map +0 -1
- package/dist/lib/actions/behaviors/debug/debug-update.d.ts +0 -5
- package/dist/lib/actions/behaviors/debug/debug-update.d.ts.map +0 -1
- package/dist/lib/actions/behaviors/debug/debug.d.ts +0 -10
- package/dist/lib/actions/behaviors/debug/debug.d.ts.map +0 -1
- package/dist/lib/actions/behaviors/movement/movement-sequence-2d.d.ts +0 -24
- package/dist/lib/actions/behaviors/movement/movement-sequence-2d.d.ts.map +0 -1
- package/dist/lib/actions/behaviors/ricochet/ricochet-2d-collision.d.ts +0 -11
- package/dist/lib/actions/behaviors/ricochet/ricochet-2d-collision.d.ts.map +0 -1
- package/dist/lib/actions/behaviors/ricochet/ricochet-2d-collision.js +0 -100
- package/dist/lib/actions/behaviors/ricochet/ricochet-2d-in-bounds.d.ts +0 -12
- package/dist/lib/actions/behaviors/ricochet/ricochet-2d-in-bounds.d.ts.map +0 -1
- package/dist/lib/actions/behaviors/ricochet/ricochet-2d-in-bounds.js +0 -37
- package/dist/lib/actions/behaviors/ricochet/ricochet.d.ts +0 -44
- package/dist/lib/actions/behaviors/ricochet/ricochet.d.ts.map +0 -1
- package/dist/lib/actions/behaviors/ricochet/ricochet.js +0 -6
- package/dist/lib/actions/behaviors/zylem-behavior.d.ts +0 -2
- package/dist/lib/actions/behaviors/zylem-behavior.d.ts.map +0 -1
- package/dist/lib/actions/capabilities/moveable.d.ts +0 -125
- package/dist/lib/actions/capabilities/moveable.d.ts.map +0 -1
- package/dist/lib/actions/capabilities/moveable.js +0 -108
- package/dist/lib/actions/capabilities/rotatable.d.ts +0 -111
- package/dist/lib/actions/capabilities/rotatable.d.ts.map +0 -1
- package/dist/lib/actions/capabilities/rotatable.js +0 -82
- package/dist/lib/actions/capabilities/transformable.d.ts +0 -7
- package/dist/lib/actions/capabilities/transformable.d.ts.map +0 -1
- package/dist/lib/actions/capabilities/transformable.js +0 -9
- package/dist/lib/actions/global-change.d.ts +0 -23
- package/dist/lib/actions/global-change.d.ts.map +0 -1
- package/dist/lib/actions/global-change.js +0 -40
- package/dist/lib/camera/camera.d.ts +0 -16
- package/dist/lib/camera/camera.d.ts.map +0 -1
- package/dist/lib/camera/camera.js +0 -19
- package/dist/lib/camera/fixed-2d.d.ts +0 -32
- package/dist/lib/camera/fixed-2d.d.ts.map +0 -1
- package/dist/lib/camera/fixed-2d.js +0 -30
- package/dist/lib/camera/perspective.d.ts +0 -9
- package/dist/lib/camera/perspective.d.ts.map +0 -1
- package/dist/lib/camera/perspective.js +0 -10
- package/dist/lib/camera/third-person.d.ts +0 -32
- package/dist/lib/camera/third-person.d.ts.map +0 -1
- package/dist/lib/camera/third-person.js +0 -42
- package/dist/lib/camera/zylem-camera.d.ts.map +0 -1
- package/dist/lib/camera/zylem-camera.js +0 -208
- package/dist/lib/collision/collision-builder.d.ts +0 -17
- package/dist/lib/collision/collision-builder.d.ts.map +0 -1
- package/dist/lib/collision/collision-builder.js +0 -46
- package/dist/lib/collision/collision-delegate.d.ts +0 -6
- package/dist/lib/collision/collision-delegate.d.ts.map +0 -1
- package/dist/lib/collision/collision-delegate.js +0 -6
- package/dist/lib/collision/collision-group.d.ts +0 -11
- package/dist/lib/collision/collision-group.d.ts.map +0 -1
- package/dist/lib/collision/collision-mask.d.ts +0 -18
- package/dist/lib/collision/collision-mask.d.ts.map +0 -1
- package/dist/lib/collision/collision.d.ts +0 -19
- package/dist/lib/collision/collision.d.ts.map +0 -1
- package/dist/lib/collision/utils.d.ts +0 -15
- package/dist/lib/collision/utils.d.ts.map +0 -1
- package/dist/lib/collision/utils.js +0 -24
- package/dist/lib/collision/world.d.ts +0 -23
- package/dist/lib/collision/world.d.ts.map +0 -1
- package/dist/lib/collision/world.js +0 -77
- package/dist/lib/core/asset-manager.d.ts +0 -2
- package/dist/lib/core/asset-manager.d.ts.map +0 -1
- package/dist/lib/core/base-node-life-cycle.d.ts +0 -68
- package/dist/lib/core/base-node-life-cycle.d.ts.map +0 -1
- package/dist/lib/core/base-node.d.ts +0 -37
- package/dist/lib/core/base-node.d.ts.map +0 -1
- package/dist/lib/core/base-node.js +0 -62
- package/dist/lib/core/entity-asset-loader.d.ts +0 -16
- package/dist/lib/core/entity-asset-loader.d.ts.map +0 -1
- package/dist/lib/core/entity-asset-loader.js +0 -54
- package/dist/lib/core/errors.d.ts +0 -5
- package/dist/lib/core/errors.d.ts.map +0 -1
- package/dist/lib/core/flags.d.ts +0 -3
- package/dist/lib/core/flags.d.ts.map +0 -1
- package/dist/lib/core/index.d.ts +0 -5
- package/dist/lib/core/index.d.ts.map +0 -1
- package/dist/lib/core/lazy-loader.d.ts +0 -80
- package/dist/lib/core/lazy-loader.d.ts.map +0 -1
- package/dist/lib/core/lifecycle-base.d.ts +0 -17
- package/dist/lib/core/lifecycle-base.d.ts.map +0 -1
- package/dist/lib/core/lifecycle-base.js +0 -20
- package/dist/lib/core/preset-shader.d.ts +0 -8
- package/dist/lib/core/preset-shader.d.ts.map +0 -1
- package/dist/lib/core/preset-shader.js +0 -26
- package/dist/lib/core/three-addons/Timer.d.ts +0 -92
- package/dist/lib/core/three-addons/Timer.d.ts.map +0 -1
- package/dist/lib/core/three-addons/Timer.js +0 -103
- package/dist/lib/core/utility/nodes.d.ts +0 -13
- package/dist/lib/core/utility/nodes.d.ts.map +0 -1
- package/dist/lib/core/utility/nodes.js +0 -31
- package/dist/lib/core/utility/strings.d.ts +0 -3
- package/dist/lib/core/utility/strings.d.ts.map +0 -1
- package/dist/lib/core/utility/strings.js +0 -14
- package/dist/lib/core/utility/vector.d.ts +0 -8
- package/dist/lib/core/utility/vector.d.ts.map +0 -1
- package/dist/lib/core/utility/vector.js +0 -8
- package/dist/lib/core/vector.d.ts +0 -4
- package/dist/lib/core/vector.d.ts.map +0 -1
- package/dist/lib/core/vessel.d.ts +0 -13
- package/dist/lib/core/vessel.d.ts.map +0 -1
- package/dist/lib/core/vessel.js +0 -26
- package/dist/lib/debug/console/console-state.d.ts +0 -20
- package/dist/lib/debug/console/console-state.d.ts.map +0 -1
- package/dist/lib/debug/console/console-state.js +0 -11
- package/dist/lib/debug/console/console-store.d.ts +0 -6
- package/dist/lib/debug/console/console-store.d.ts.map +0 -1
- package/dist/lib/debug/debug-state.d.ts +0 -38
- package/dist/lib/debug/debug-state.d.ts.map +0 -1
- package/dist/lib/debug/debug-state.js +0 -40
- package/dist/lib/debug/debug-store.d.ts +0 -15
- package/dist/lib/debug/debug-store.d.ts.map +0 -1
- package/dist/lib/debug/state-based-debug-loader.d.ts +0 -8
- package/dist/lib/debug/state-based-debug-loader.d.ts.map +0 -1
- package/dist/lib/device/aspect-ratio.d.ts +0 -38
- package/dist/lib/device/aspect-ratio.d.ts.map +0 -1
- package/dist/lib/device/aspect-ratio.js +0 -44
- package/dist/lib/device/desktop.d.ts +0 -2
- package/dist/lib/device/desktop.d.ts.map +0 -1
- package/dist/lib/device/mobile.d.ts +0 -2
- package/dist/lib/device/mobile.d.ts.map +0 -1
- package/dist/lib/device/tablet.d.ts +0 -2
- package/dist/lib/device/tablet.d.ts.map +0 -1
- package/dist/lib/entities/actor.d.ts +0 -44
- package/dist/lib/entities/actor.d.ts.map +0 -1
- package/dist/lib/entities/actor.js +0 -122
- package/dist/lib/entities/box.d.ts +0 -27
- package/dist/lib/entities/box.d.ts.map +0 -1
- package/dist/lib/entities/box.js +0 -68
- package/dist/lib/entities/builder.d.ts +0 -28
- package/dist/lib/entities/builder.d.ts.map +0 -1
- package/dist/lib/entities/builder.js +0 -79
- package/dist/lib/entities/create.d.ts +0 -15
- package/dist/lib/entities/create.d.ts.map +0 -1
- package/dist/lib/entities/create.js +0 -31
- package/dist/lib/entities/delegates/animation.d.ts +0 -33
- package/dist/lib/entities/delegates/animation.d.ts.map +0 -1
- package/dist/lib/entities/delegates/animation.js +0 -58
- package/dist/lib/entities/delegates/debug.d.ts +0 -29
- package/dist/lib/entities/delegates/debug.d.ts.map +0 -1
- package/dist/lib/entities/delegates/debug.js +0 -71
- package/dist/lib/entities/delegates/loader.d.ts +0 -12
- package/dist/lib/entities/delegates/loader.d.ts.map +0 -1
- package/dist/lib/entities/delegates/loader.js +0 -19
- package/dist/lib/entities/destroy.d.ts +0 -4
- package/dist/lib/entities/destroy.d.ts.map +0 -1
- package/dist/lib/entities/destroy.js +0 -15
- package/dist/lib/entities/entity.d.ts +0 -96
- package/dist/lib/entities/entity.d.ts.map +0 -1
- package/dist/lib/entities/entity.js +0 -120
- package/dist/lib/entities/index.d.ts +0 -12
- package/dist/lib/entities/index.d.ts.map +0 -1
- package/dist/lib/entities/plane.d.ts +0 -36
- package/dist/lib/entities/plane.d.ts.map +0 -1
- package/dist/lib/entities/plane.js +0 -81
- package/dist/lib/entities/rect.d.ts +0 -63
- package/dist/lib/entities/rect.d.ts.map +0 -1
- package/dist/lib/entities/rect.js +0 -160
- package/dist/lib/entities/sphere.d.ts +0 -29
- package/dist/lib/entities/sphere.d.ts.map +0 -1
- package/dist/lib/entities/sphere.js +0 -68
- package/dist/lib/entities/sprite.d.ts +0 -53
- package/dist/lib/entities/sprite.d.ts.map +0 -1
- package/dist/lib/entities/sprite.js +0 -118
- package/dist/lib/entities/text.d.ts +0 -49
- package/dist/lib/entities/text.d.ts.map +0 -1
- package/dist/lib/entities/text.js +0 -140
- package/dist/lib/entities/zone.d.ts +0 -54
- package/dist/lib/entities/zone.d.ts.map +0 -1
- package/dist/lib/entities/zone.js +0 -103
- package/dist/lib/game/game-blueprint.d.ts +0 -38
- package/dist/lib/game/game-blueprint.d.ts.map +0 -1
- package/dist/lib/game/game-canvas.d.ts +0 -35
- package/dist/lib/game/game-canvas.d.ts.map +0 -1
- package/dist/lib/game/game-canvas.js +0 -57
- package/dist/lib/game/game-config.d.ts +0 -59
- package/dist/lib/game/game-config.d.ts.map +0 -1
- package/dist/lib/game/game-config.js +0 -78
- package/dist/lib/game/game-default.d.ts +0 -14
- package/dist/lib/game/game-default.d.ts.map +0 -1
- package/dist/lib/game/game-default.js +0 -23
- package/dist/lib/game/game-interfaces.d.ts +0 -29
- package/dist/lib/game/game-interfaces.d.ts.map +0 -1
- package/dist/lib/game/game-retro-resolutions.d.ts +0 -25
- package/dist/lib/game/game-retro-resolutions.d.ts.map +0 -1
- package/dist/lib/game/game-retro-resolutions.js +0 -80
- package/dist/lib/game/game-state.d.ts +0 -11
- package/dist/lib/game/game-state.d.ts.map +0 -1
- package/dist/lib/game/game-state.js +0 -17
- package/dist/lib/game/game.d.ts +0 -37
- package/dist/lib/game/game.d.ts.map +0 -1
- package/dist/lib/game/game.js +0 -109
- package/dist/lib/game/zylem-game.d.ts +0 -58
- package/dist/lib/game/zylem-game.d.ts.map +0 -1
- package/dist/lib/game/zylem-game.js +0 -140
- package/dist/lib/graphics/geometries/XZPlaneGeometry.d.ts +0 -8
- package/dist/lib/graphics/geometries/XZPlaneGeometry.d.ts.map +0 -1
- package/dist/lib/graphics/geometries/XZPlaneGeometry.js +0 -34
- package/dist/lib/graphics/material.d.ts +0 -29
- package/dist/lib/graphics/material.d.ts.map +0 -1
- package/dist/lib/graphics/material.js +0 -64
- package/dist/lib/graphics/mesh.d.ts +0 -19
- package/dist/lib/graphics/mesh.d.ts.map +0 -1
- package/dist/lib/graphics/mesh.js +0 -14
- package/dist/lib/graphics/render-pass.d.ts +0 -17
- package/dist/lib/graphics/render-pass.d.ts.map +0 -1
- package/dist/lib/graphics/render-pass.js +0 -56
- package/dist/lib/graphics/shaders/fragment/debug.glsl.js +0 -23
- package/dist/lib/graphics/shaders/fragment/fire.glsl.js +0 -52
- package/dist/lib/graphics/shaders/fragment/standard.glsl.js +0 -11
- package/dist/lib/graphics/shaders/fragment/stars.glsl.js +0 -44
- package/dist/lib/graphics/shaders/vertex/debug.glsl.js +0 -15
- package/dist/lib/graphics/shaders/vertex/object-shader.glsl.js +0 -11
- package/dist/lib/graphics/shaders/vertex/standard.glsl.js +0 -9
- package/dist/lib/graphics/zylem-scene.d.ts +0 -50
- package/dist/lib/graphics/zylem-scene.d.ts.map +0 -1
- package/dist/lib/graphics/zylem-scene.js +0 -75
- package/dist/lib/input/gamepad-provider.d.ts +0 -14
- package/dist/lib/input/gamepad-provider.d.ts.map +0 -1
- package/dist/lib/input/gamepad-provider.js +0 -58
- package/dist/lib/input/input-manager.d.ts +0 -15
- package/dist/lib/input/input-manager.d.ts.map +0 -1
- package/dist/lib/input/input-manager.js +0 -70
- package/dist/lib/input/input-provider.d.ts +0 -7
- package/dist/lib/input/input-provider.d.ts.map +0 -1
- package/dist/lib/input/input.d.ts +0 -48
- package/dist/lib/input/input.d.ts.map +0 -1
- package/dist/lib/input/keyboard-provider.d.ts +0 -21
- package/dist/lib/input/keyboard-provider.d.ts.map +0 -1
- package/dist/lib/input/keyboard-provider.js +0 -120
- package/dist/lib/interfaces/entity.d.ts +0 -26
- package/dist/lib/interfaces/entity.d.ts.map +0 -1
- package/dist/lib/sounds/index.d.ts +0 -3
- package/dist/lib/sounds/index.d.ts.map +0 -1
- package/dist/lib/sounds/ping-pong-sound.d.ts +0 -5
- package/dist/lib/sounds/ping-pong-sound.d.ts.map +0 -1
- package/dist/lib/sounds/ricochet-sound.d.ts +0 -5
- package/dist/lib/sounds/ricochet-sound.d.ts.map +0 -1
- package/dist/lib/stage/debug-entity-cursor.d.ts +0 -24
- package/dist/lib/stage/debug-entity-cursor.d.ts.map +0 -1
- package/dist/lib/stage/debug-entity-cursor.js +0 -53
- package/dist/lib/stage/entity-spawner.d.ts +0 -9
- package/dist/lib/stage/entity-spawner.d.ts.map +0 -1
- package/dist/lib/stage/entity-spawner.js +0 -27
- package/dist/lib/stage/stage-blueprint.d.ts +0 -45
- package/dist/lib/stage/stage-blueprint.d.ts.map +0 -1
- package/dist/lib/stage/stage-blueprint.js +0 -56
- package/dist/lib/stage/stage-camera-debug-delegate.d.ts +0 -14
- package/dist/lib/stage/stage-camera-debug-delegate.d.ts.map +0 -1
- package/dist/lib/stage/stage-debug-delegate.d.ts +0 -26
- package/dist/lib/stage/stage-debug-delegate.d.ts.map +0 -1
- package/dist/lib/stage/stage-debug-delegate.js +0 -100
- package/dist/lib/stage/stage-default.d.ts +0 -3
- package/dist/lib/stage/stage-default.d.ts.map +0 -1
- package/dist/lib/stage/stage-default.js +0 -32
- package/dist/lib/stage/stage-state.d.ts +0 -14
- package/dist/lib/stage/stage-state.d.ts.map +0 -1
- package/dist/lib/stage/stage-state.js +0 -36
- package/dist/lib/stage/stage.d.ts +0 -33
- package/dist/lib/stage/stage.d.ts.map +0 -1
- package/dist/lib/stage/stage.js +0 -60
- package/dist/lib/stage/zylem-stage.d.ts +0 -128
- package/dist/lib/stage/zylem-stage.d.ts.map +0 -1
- package/dist/lib/stage/zylem-stage.js +0 -268
- package/dist/lib/systems/test-system.d.ts +0 -2
- package/dist/lib/systems/test-system.d.ts.map +0 -1
- package/dist/lib/systems/transformable.system.d.ts +0 -25
- package/dist/lib/systems/transformable.system.d.ts.map +0 -1
- package/dist/lib/systems/transformable.system.js +0 -43
- package/dist/lib/types/entity-types.d.ts +0 -24
- package/dist/lib/types/entity-types.d.ts.map +0 -1
- package/dist/lib/types/index.d.ts +0 -3
- package/dist/lib/types/index.d.ts.map +0 -1
- package/dist/lib/types/stage-types.d.ts +0 -26
- package/dist/lib/types/stage-types.d.ts.map +0 -1
- package/dist/lib/ui/Debug.d.ts +0 -6
- package/dist/lib/ui/Debug.d.ts.map +0 -1
- package/dist/lib/ui/console/Console.d.ts +0 -7
- package/dist/lib/ui/console/Console.d.ts.map +0 -1
- package/dist/lib/ui/debug-panel/AccordionMenu.d.ts +0 -7
- package/dist/lib/ui/debug-panel/AccordionMenu.d.ts.map +0 -1
- package/dist/lib/ui/debug-panel/Menu.d.ts +0 -6
- package/dist/lib/ui/debug-panel/Menu.d.ts.map +0 -1
- package/dist/lib/ui/debug-panel/sections/EntitiesSection.d.ts +0 -4
- package/dist/lib/ui/debug-panel/sections/EntitiesSection.d.ts.map +0 -1
- package/dist/lib/ui/debug-panel/sections/GameSection.d.ts +0 -3
- package/dist/lib/ui/debug-panel/sections/GameSection.d.ts.map +0 -1
- package/dist/lib/ui/debug-panel/sections/StagesSection.d.ts +0 -3
- package/dist/lib/ui/debug-panel/sections/StagesSection.d.ts.map +0 -1
- package/dist/lib/ui/debug-panel/sections/all.d.ts +0 -4
- package/dist/lib/ui/debug-panel/sections/all.d.ts.map +0 -1
- package/dist/lib/ui/toolbar/Toolbar.d.ts +0 -6
- package/dist/lib/ui/toolbar/Toolbar.d.ts.map +0 -1
- package/dist/tests/integration/debug.sim.spec.d.ts +0 -2
- package/dist/tests/integration/debug.sim.spec.d.ts.map +0 -1
- package/dist/tests/unit/collision/collision.spec.d.ts +0 -2
- package/dist/tests/unit/collision/collision.spec.d.ts.map +0 -1
- package/dist/tests/unit/core/game.spec.d.ts +0 -2
- package/dist/tests/unit/core/game.spec.d.ts.map +0 -1
- package/dist/tests/unit/core/stage.spec.d.ts +0 -2
- package/dist/tests/unit/core/stage.spec.d.ts.map +0 -1
- package/dist/tests/unit/core/vessel.spec.d.ts +0 -2
- package/dist/tests/unit/core/vessel.spec.d.ts.map +0 -1
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import { Vector3 } from 'three';
|
|
2
|
-
import { Inputs } from '../input/input';
|
|
3
|
-
export interface IGame<TGlobals extends Record<string, unknown> = any> {
|
|
4
|
-
start: () => Promise<this>;
|
|
5
|
-
nextStage: () => Promise<void>;
|
|
6
|
-
previousStage: () => Promise<void>;
|
|
7
|
-
reset: () => Promise<void>;
|
|
8
|
-
pause: () => Promise<void>;
|
|
9
|
-
resume: () => Promise<void>;
|
|
10
|
-
end: () => Promise<void>;
|
|
11
|
-
goToStage: () => void;
|
|
12
|
-
getGlobal: <K extends keyof TGlobals>(key: K) => TGlobals[K];
|
|
13
|
-
setGlobal: <K extends keyof TGlobals>(key: K, value: TGlobals[K]) => void;
|
|
14
|
-
}
|
|
15
|
-
export interface IStage {
|
|
16
|
-
onUpdate: (callback: UpdateFunction<IStage>) => void;
|
|
17
|
-
onSetup: (callback: SetupFunction<IStage>) => void;
|
|
18
|
-
onDestroy: (callback: DestroyFunction<IStage>) => void;
|
|
19
|
-
}
|
|
20
|
-
export interface ICamera {
|
|
21
|
-
move: (position: Vector3) => void;
|
|
22
|
-
rotate: (pitch: number, yaw: number, roll: number) => void;
|
|
23
|
-
}
|
|
24
|
-
export interface SetupContext<T, TGlobals extends Record<string, unknown> = any> {
|
|
25
|
-
me: T;
|
|
26
|
-
globals: TGlobals;
|
|
27
|
-
inputs?: Inputs;
|
|
28
|
-
camera?: ICamera;
|
|
29
|
-
stage?: IStage;
|
|
30
|
-
game?: IGame<TGlobals>;
|
|
31
|
-
}
|
|
32
|
-
export interface SetupFunction<T, TGlobals extends Record<string, unknown> = any> {
|
|
33
|
-
(context: SetupContext<T, TGlobals>): void;
|
|
34
|
-
}
|
|
35
|
-
export interface LoadedFunction<T, TGlobals extends Record<string, unknown> = any> {
|
|
36
|
-
(context: LoadedContext<T, TGlobals>): void;
|
|
37
|
-
}
|
|
38
|
-
export interface LoadedContext<T, TGlobals extends Record<string, unknown> = any> {
|
|
39
|
-
me: T;
|
|
40
|
-
globals: TGlobals;
|
|
41
|
-
}
|
|
42
|
-
export type UpdateContext<T, TGlobals extends Record<string, unknown> = any> = {
|
|
43
|
-
me: T;
|
|
44
|
-
delta: number;
|
|
45
|
-
inputs: Inputs;
|
|
46
|
-
globals: TGlobals;
|
|
47
|
-
camera: ICamera;
|
|
48
|
-
stage?: IStage;
|
|
49
|
-
game?: IGame<TGlobals>;
|
|
50
|
-
};
|
|
51
|
-
export interface UpdateFunction<T, TGlobals extends Record<string, unknown> = any> {
|
|
52
|
-
(context: UpdateContext<T, TGlobals>): void;
|
|
53
|
-
}
|
|
54
|
-
export interface DestroyContext<T, TGlobals extends Record<string, unknown> = any> {
|
|
55
|
-
me: T;
|
|
56
|
-
globals: TGlobals;
|
|
57
|
-
}
|
|
58
|
-
export interface DestroyFunction<T, TGlobals extends Record<string, unknown> = any> {
|
|
59
|
-
(context: DestroyContext<T, TGlobals>): void;
|
|
60
|
-
}
|
|
61
|
-
export interface CleanupFunction<T, TGlobals extends Record<string, unknown> = any> {
|
|
62
|
-
(context: CleanupContext<T, TGlobals>): void;
|
|
63
|
-
}
|
|
64
|
-
export interface CleanupContext<T, TGlobals extends Record<string, unknown> = any> {
|
|
65
|
-
me: T;
|
|
66
|
-
globals: TGlobals;
|
|
67
|
-
}
|
|
68
|
-
//# sourceMappingURL=base-node-life-cycle.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"base-node-life-cycle.d.ts","sourceRoot":"","sources":["../../../src/lib/core/base-node-life-cycle.ts"],"names":[],"mappings":"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"}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { Behavior } from "~/lib/actions/behaviors/behavior";
|
|
2
|
-
import { CleanupContext, CleanupFunction, DestroyContext, DestroyFunction, LoadedContext, LoadedFunction, SetupContext, SetupFunction, UpdateContext, UpdateFunction } from "./base-node-life-cycle";
|
|
3
|
-
export type BaseNodeOptions<T = any> = BaseNode | Partial<T>;
|
|
4
|
-
export declare abstract class BaseNode<Options = any, T = any> {
|
|
5
|
-
protected parent: BaseNode | null;
|
|
6
|
-
protected children: BaseNode[];
|
|
7
|
-
behaviors: Behavior[];
|
|
8
|
-
options: Options;
|
|
9
|
-
eid: number;
|
|
10
|
-
uuid: string;
|
|
11
|
-
name: string;
|
|
12
|
-
markedForRemoval: boolean;
|
|
13
|
-
setup: SetupFunction<this>;
|
|
14
|
-
loaded: LoadedFunction<this>;
|
|
15
|
-
update: UpdateFunction<this>;
|
|
16
|
-
destroy: DestroyFunction<this>;
|
|
17
|
-
cleanup: CleanupFunction<this>;
|
|
18
|
-
constructor(args?: BaseNodeOptions[]);
|
|
19
|
-
setParent(parent: BaseNode | null): void;
|
|
20
|
-
getParent(): BaseNode | null;
|
|
21
|
-
add(baseNode: BaseNode): void;
|
|
22
|
-
remove(baseNode: BaseNode): void;
|
|
23
|
-
getChildren(): BaseNode[];
|
|
24
|
-
isComposite(): boolean;
|
|
25
|
-
abstract create(): T;
|
|
26
|
-
protected abstract _setup(params: SetupContext<this>): void;
|
|
27
|
-
protected abstract _loaded(params: LoadedContext<this>): Promise<void>;
|
|
28
|
-
protected abstract _update(params: UpdateContext<this>): void;
|
|
29
|
-
protected abstract _destroy(params: DestroyContext<this>): void;
|
|
30
|
-
protected abstract _cleanup(params: CleanupContext<this>): Promise<void>;
|
|
31
|
-
nodeSetup(params: SetupContext<this>): void;
|
|
32
|
-
nodeUpdate(params: UpdateContext<this>): void;
|
|
33
|
-
nodeDestroy(params: DestroyContext<this>): void;
|
|
34
|
-
getOptions(): Options;
|
|
35
|
-
setOptions(options: Partial<Options>): void;
|
|
36
|
-
}
|
|
37
|
-
//# sourceMappingURL=base-node.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"base-node.d.ts","sourceRoot":"","sources":["../../../src/lib/core/base-node.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kCAAkC,CAAC;AAC5D,OAAO,EACN,cAAc,EACd,eAAe,EACf,cAAc,EACd,eAAe,EACf,aAAa,EACb,cAAc,EACd,YAAY,EACZ,aAAa,EACb,aAAa,EACb,cAAc,EACd,MAAM,wBAAwB,CAAC;AAIhC,MAAM,MAAM,eAAe,CAAC,CAAC,GAAG,GAAG,IAAI,QAAQ,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;AAE7D,8BAAsB,QAAQ,CAAC,OAAO,GAAG,GAAG,EAAE,CAAC,GAAG,GAAG;IACpD,SAAS,CAAC,MAAM,EAAE,QAAQ,GAAG,IAAI,CAAQ;IACzC,SAAS,CAAC,QAAQ,EAAE,QAAQ,EAAE,CAAM;IAC7B,SAAS,EAAE,QAAQ,EAAE,CAAM;IAC3B,OAAO,EAAE,OAAO,CAAC;IACjB,GAAG,EAAE,MAAM,CAAK;IAChB,IAAI,EAAE,MAAM,CAAM;IAClB,IAAI,EAAE,MAAM,CAAM;IAClB,gBAAgB,EAAE,OAAO,CAAS;IAEzC,KAAK,EAAE,aAAa,CAAC,IAAI,CAAC,CAAa;IACvC,MAAM,EAAE,cAAc,CAAC,IAAI,CAAC,CAAa;IACzC,MAAM,EAAE,cAAc,CAAC,IAAI,CAAC,CAAa;IACzC,OAAO,EAAE,eAAe,CAAC,IAAI,CAAC,CAAa;IAC3C,OAAO,EAAE,eAAe,CAAC,IAAI,CAAC,CAAa;gBAE/B,IAAI,GAAE,eAAe,EAAO;IAQjC,SAAS,CAAC,MAAM,EAAE,QAAQ,GAAG,IAAI,GAAG,IAAI;IAIxC,SAAS,IAAI,QAAQ,GAAG,IAAI;IAI5B,GAAG,CAAC,QAAQ,EAAE,QAAQ,GAAG,IAAI;IAK7B,MAAM,CAAC,QAAQ,EAAE,QAAQ,GAAG,IAAI;IAQhC,WAAW,IAAI,QAAQ,EAAE;IAIzB,WAAW,IAAI,OAAO;aAIb,MAAM,IAAI,CAAC;IAE3B,SAAS,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,IAAI,CAAC,GAAG,IAAI;IAE3D,SAAS,CAAC,QAAQ,CAAC,OAAO,CAAC,MAAM,EAAE,aAAa,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAEtE,SAAS,CAAC,QAAQ,CAAC,OAAO,CAAC,MAAM,EAAE,aAAa,CAAC,IAAI,CAAC,GAAG,IAAI;IAE7D,SAAS,CAAC,QAAQ,CAAC,QAAQ,CAAC,MAAM,EAAE,cAAc,CAAC,IAAI,CAAC,GAAG,IAAI;IAE/D,SAAS,CAAC,QAAQ,CAAC,QAAQ,CAAC,MAAM,EAAE,cAAc,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAEjE,SAAS,CAAC,MAAM,EAAE,YAAY,CAAC,IAAI,CAAC;IAYpC,UAAU,CAAC,MAAM,EAAE,aAAa,CAAC,IAAI,CAAC,GAAG,IAAI;IAa7C,WAAW,CAAC,MAAM,EAAE,cAAc,CAAC,IAAI,CAAC,GAAG,IAAI;IAW/C,UAAU,IAAI,OAAO;IAIrB,UAAU,CAAC,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,GAAG,IAAI;CAGlD"}
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import { nanoid as o } from "nanoid";
|
|
2
|
-
class s {
|
|
3
|
-
parent = null;
|
|
4
|
-
children = [];
|
|
5
|
-
behaviors = [];
|
|
6
|
-
options;
|
|
7
|
-
eid = 0;
|
|
8
|
-
uuid = "";
|
|
9
|
-
name = "";
|
|
10
|
-
markedForRemoval = !1;
|
|
11
|
-
setup = () => {
|
|
12
|
-
};
|
|
13
|
-
loaded = () => {
|
|
14
|
-
};
|
|
15
|
-
update = () => {
|
|
16
|
-
};
|
|
17
|
-
destroy = () => {
|
|
18
|
-
};
|
|
19
|
-
cleanup = () => {
|
|
20
|
-
};
|
|
21
|
-
constructor(t = []) {
|
|
22
|
-
const e = t.filter((i) => !(i instanceof s)).reduce((i, n) => ({ ...i, ...n }), {});
|
|
23
|
-
this.options = e, this.uuid = o();
|
|
24
|
-
}
|
|
25
|
-
setParent(t) {
|
|
26
|
-
this.parent = t;
|
|
27
|
-
}
|
|
28
|
-
getParent() {
|
|
29
|
-
return this.parent;
|
|
30
|
-
}
|
|
31
|
-
add(t) {
|
|
32
|
-
this.children.push(t), t.setParent(this);
|
|
33
|
-
}
|
|
34
|
-
remove(t) {
|
|
35
|
-
const e = this.children.indexOf(t);
|
|
36
|
-
e !== -1 && (this.children.splice(e, 1), t.setParent(null));
|
|
37
|
-
}
|
|
38
|
-
getChildren() {
|
|
39
|
-
return this.children;
|
|
40
|
-
}
|
|
41
|
-
isComposite() {
|
|
42
|
-
return this.children.length > 0;
|
|
43
|
-
}
|
|
44
|
-
nodeSetup(t) {
|
|
45
|
-
this.markedForRemoval = !1, typeof this._setup == "function" && this._setup(t), this.setup && this.setup(t), this.children.forEach((e) => e.nodeSetup(t));
|
|
46
|
-
}
|
|
47
|
-
nodeUpdate(t) {
|
|
48
|
-
this.markedForRemoval || (typeof this._update == "function" && this._update(t), this.update && this.update(t), this.children.forEach((e) => e.nodeUpdate(t)));
|
|
49
|
-
}
|
|
50
|
-
nodeDestroy(t) {
|
|
51
|
-
this.children.forEach((e) => e.nodeDestroy(t)), this.destroy && this.destroy(t), typeof this._destroy == "function" && this._destroy(t), this.markedForRemoval = !0;
|
|
52
|
-
}
|
|
53
|
-
getOptions() {
|
|
54
|
-
return this.options;
|
|
55
|
-
}
|
|
56
|
-
setOptions(t) {
|
|
57
|
-
this.options = { ...this.options, ...t };
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
export {
|
|
61
|
-
s as BaseNode
|
|
62
|
-
};
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { AnimationClip, Object3D } from 'three';
|
|
2
|
-
import { GLTF } from 'three/addons/loaders/GLTFLoader.js';
|
|
3
|
-
export interface AssetLoaderResult {
|
|
4
|
-
object?: Object3D;
|
|
5
|
-
animation?: AnimationClip;
|
|
6
|
-
gltf?: GLTF;
|
|
7
|
-
}
|
|
8
|
-
export interface IAssetLoader {
|
|
9
|
-
load(file: string): Promise<AssetLoaderResult>;
|
|
10
|
-
isSupported(file: string): boolean;
|
|
11
|
-
}
|
|
12
|
-
export declare class EntityAssetLoader {
|
|
13
|
-
private loaders;
|
|
14
|
-
loadFile(file: string): Promise<AssetLoaderResult>;
|
|
15
|
-
}
|
|
16
|
-
//# sourceMappingURL=entity-asset-loader.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"entity-asset-loader.d.ts","sourceRoot":"","sources":["../../../src/lib/core/entity-asset-loader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEhD,OAAO,EAAE,IAAI,EAAc,MAAM,oCAAoC,CAAC;AAOtE,MAAM,WAAW,iBAAiB;IACjC,MAAM,CAAC,EAAE,QAAQ,CAAC;IAClB,SAAS,CAAC,EAAE,aAAa,CAAC;IAC1B,IAAI,CAAC,EAAE,IAAI,CAAC;CACZ;AAED,MAAM,WAAW,YAAY;IAC5B,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;IAC/C,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;CACnC;AAmDD,qBAAa,iBAAiB;IAC7B,OAAO,CAAC,OAAO,CAGb;IAEI,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,CAAC;CASxD"}
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import { FBXLoader as d } from "three/addons/loaders/FBXLoader.js";
|
|
2
|
-
import { GLTFLoader as i } from "three/addons/loaders/GLTFLoader.js";
|
|
3
|
-
var t;
|
|
4
|
-
(function(r) {
|
|
5
|
-
r.FBX = "fbx", r.GLTF = "gltf";
|
|
6
|
-
})(t || (t = {}));
|
|
7
|
-
class l {
|
|
8
|
-
loader = new d();
|
|
9
|
-
isSupported(e) {
|
|
10
|
-
return e.toLowerCase().endsWith(t.FBX);
|
|
11
|
-
}
|
|
12
|
-
async load(e) {
|
|
13
|
-
return new Promise((o, s) => {
|
|
14
|
-
this.loader.load(e, (a) => {
|
|
15
|
-
const n = a.animations[0];
|
|
16
|
-
o({
|
|
17
|
-
object: a,
|
|
18
|
-
animation: n
|
|
19
|
-
});
|
|
20
|
-
}, void 0, s);
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
class p {
|
|
25
|
-
loader = new i();
|
|
26
|
-
isSupported(e) {
|
|
27
|
-
return e.toLowerCase().endsWith(t.GLTF);
|
|
28
|
-
}
|
|
29
|
-
async load(e) {
|
|
30
|
-
return new Promise((o, s) => {
|
|
31
|
-
this.loader.load(e, (a) => {
|
|
32
|
-
o({
|
|
33
|
-
object: a.scene,
|
|
34
|
-
gltf: a
|
|
35
|
-
});
|
|
36
|
-
}, void 0, s);
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
class u {
|
|
41
|
-
loaders = [
|
|
42
|
-
new l(),
|
|
43
|
-
new p()
|
|
44
|
-
];
|
|
45
|
-
async loadFile(e) {
|
|
46
|
-
const o = this.loaders.find((s) => s.isSupported(e));
|
|
47
|
-
if (!o)
|
|
48
|
-
throw new Error(`Unsupported file type: ${e}`);
|
|
49
|
-
return o.load(e);
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
export {
|
|
53
|
-
u as EntityAssetLoader
|
|
54
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../src/lib/core/errors.ts"],"names":[],"mappings":"AAAA,qBAAa,YAAY;IAExB,eAAe,IAAI,MAAM;IAMzB,yBAAyB,CAAC,SAAS,GAAE,MAAkB,GAAG,MAAM;CAKhE"}
|
package/dist/lib/core/flags.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"flags.d.ts","sourceRoot":"","sources":["../../../src/lib/core/flags.ts"],"names":[],"mappings":"AAAA,uBAAuB;AACvB,eAAO,MAAM,UAAU,SAA6C,CAAC"}
|
package/dist/lib/core/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/core/index.ts"],"names":[],"mappings":"AACA,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC;AACrC,cAAc,UAAU,CAAC;AAGzB,cAAc,UAAU,CAAC"}
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Lazy loading utilities for Zylem components
|
|
3
|
-
* Use these functions to load parts of the library only when needed
|
|
4
|
-
*
|
|
5
|
-
* Loading order follows dependency hierarchy:
|
|
6
|
-
* 1. Foundation (core utilities, types)
|
|
7
|
-
* 2. State, Input, Graphics, Physics (parallel)
|
|
8
|
-
* 3. Camera (depends on graphics)
|
|
9
|
-
* 4. Entities (depends on foundation, graphics, physics)
|
|
10
|
-
* 5. Behaviors (depends on entities)
|
|
11
|
-
* 6. Core game systems (depends on most others)
|
|
12
|
-
* 7. Stage (depends on everything)
|
|
13
|
-
*/
|
|
14
|
-
export declare const loadFoundation: () => Promise<{
|
|
15
|
-
baseNode: typeof import("./base-node");
|
|
16
|
-
lifeCycle: typeof import("./base-node-life-cycle");
|
|
17
|
-
utility: typeof import("./utility/vector");
|
|
18
|
-
vector: typeof import("./vector");
|
|
19
|
-
}>;
|
|
20
|
-
export declare const loadState: () => Promise<typeof import("../game/game-state")>;
|
|
21
|
-
export declare const loadInput: () => Promise<typeof import("../input/input-manager")>;
|
|
22
|
-
export declare const loadGraphics: () => Promise<{
|
|
23
|
-
material: typeof import("../graphics/material");
|
|
24
|
-
mesh: typeof import("../graphics/mesh");
|
|
25
|
-
}>;
|
|
26
|
-
export declare const loadPhysics: () => Promise<{
|
|
27
|
-
collision: typeof import("../collision/collision");
|
|
28
|
-
collisionBuilder: typeof import("../collision/collision-builder");
|
|
29
|
-
}>;
|
|
30
|
-
export declare const loadCamera: () => Promise<{
|
|
31
|
-
camera: typeof import("../camera/camera");
|
|
32
|
-
perspectives: typeof import("../camera/perspective");
|
|
33
|
-
}>;
|
|
34
|
-
export declare const loadAllEntities: () => Promise<typeof import("../entities/entity")>;
|
|
35
|
-
export declare const loadEntity: (entityType: "box" | "sphere" | "sprite" | "plane" | "zone" | "actor") => Promise<typeof import("../entities/box") | typeof import("../entities/sphere") | typeof import("../entities/sprite") | typeof import("../entities/plane") | typeof import("../entities/zone") | typeof import("../entities/actor")>;
|
|
36
|
-
export declare const loadBehaviors: () => Promise<typeof import("../actions/behaviors/actions")>;
|
|
37
|
-
export declare const loadGameCore: () => Promise<{
|
|
38
|
-
game: typeof import("../game/game");
|
|
39
|
-
vessel: typeof import("./vessel");
|
|
40
|
-
}>;
|
|
41
|
-
export declare const loadStage: () => Promise<{
|
|
42
|
-
stage: typeof import("../stage/stage");
|
|
43
|
-
world: typeof import("../collision/world");
|
|
44
|
-
scene: typeof import("../graphics/zylem-scene");
|
|
45
|
-
}>;
|
|
46
|
-
export declare const loadDebugTools: () => Promise<typeof import("../ui/Debug")>;
|
|
47
|
-
export declare const loadFullGame: () => Promise<{
|
|
48
|
-
foundation: {
|
|
49
|
-
baseNode: typeof import("./base-node");
|
|
50
|
-
lifeCycle: typeof import("./base-node-life-cycle");
|
|
51
|
-
utility: typeof import("./utility/vector");
|
|
52
|
-
vector: typeof import("./vector");
|
|
53
|
-
};
|
|
54
|
-
state: typeof import("../game/game-state");
|
|
55
|
-
input: typeof import("../input/input-manager");
|
|
56
|
-
graphics: {
|
|
57
|
-
material: typeof import("../graphics/material");
|
|
58
|
-
mesh: typeof import("../graphics/mesh");
|
|
59
|
-
};
|
|
60
|
-
physics: {
|
|
61
|
-
collision: typeof import("../collision/collision");
|
|
62
|
-
collisionBuilder: typeof import("../collision/collision-builder");
|
|
63
|
-
};
|
|
64
|
-
camera: {
|
|
65
|
-
camera: typeof import("../camera/camera");
|
|
66
|
-
perspectives: typeof import("../camera/perspective");
|
|
67
|
-
};
|
|
68
|
-
entities: typeof import("../entities/entity");
|
|
69
|
-
behaviors: typeof import("../actions/behaviors/actions");
|
|
70
|
-
gameCore: {
|
|
71
|
-
game: typeof import("../game/game");
|
|
72
|
-
vessel: typeof import("./vessel");
|
|
73
|
-
};
|
|
74
|
-
stage: {
|
|
75
|
-
stage: typeof import("../stage/stage");
|
|
76
|
-
world: typeof import("../collision/world");
|
|
77
|
-
scene: typeof import("../graphics/zylem-scene");
|
|
78
|
-
};
|
|
79
|
-
}>;
|
|
80
|
-
//# sourceMappingURL=lazy-loader.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"lazy-loader.d.ts","sourceRoot":"","sources":["../../../src/lib/core/lazy-loader.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAGH,eAAO,MAAM,cAAc;;;;;EAQ1B,CAAC;AAGF,eAAO,MAAM,SAAS,oDAGrB,CAAC;AAEF,eAAO,MAAM,SAAS,wDAGrB,CAAC;AAEF,eAAO,MAAM,YAAY;;;EAMxB,CAAC;AAEF,eAAO,MAAM,WAAW;;;EAMvB,CAAC;AAGF,eAAO,MAAM,UAAU;;;EAMtB,CAAC;AAGF,eAAO,MAAM,eAAe,oDAG3B,CAAC;AAEF,eAAO,MAAM,UAAU,GAAU,YAAY,KAAK,GAAG,QAAQ,GAAG,QAAQ,GAAG,OAAO,GAAG,MAAM,GAAG,OAAO,wOAiBpG,CAAC;AAGF,eAAO,MAAM,aAAa,8DAGzB,CAAC;AAGF,eAAO,MAAM,YAAY;;;EAMxB,CAAC;AAGF,eAAO,MAAM,SAAS;;;;EAOrB,CAAC;AAEF,eAAO,MAAM,cAAc,6CAG1B,CAAC;AAEF,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAoBxB,CAAC"}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { DestroyContext, DestroyFunction, SetupContext, SetupFunction, UpdateContext, UpdateFunction } from './base-node-life-cycle';
|
|
2
|
-
/**
|
|
3
|
-
* Provides BaseNode-like lifecycle without ECS/children. Consumers implement
|
|
4
|
-
* the protected hooks and may assign public setup/update/destroy callbacks.
|
|
5
|
-
*/
|
|
6
|
-
export declare abstract class LifeCycleBase<TSelf> {
|
|
7
|
-
update: UpdateFunction<TSelf>;
|
|
8
|
-
setup: SetupFunction<TSelf>;
|
|
9
|
-
destroy: DestroyFunction<TSelf>;
|
|
10
|
-
protected abstract _setup(context: SetupContext<TSelf>): void;
|
|
11
|
-
protected abstract _update(context: UpdateContext<TSelf>): void;
|
|
12
|
-
protected abstract _destroy(context: DestroyContext<TSelf>): void;
|
|
13
|
-
nodeSetup(context: SetupContext<TSelf>): void;
|
|
14
|
-
nodeUpdate(context: UpdateContext<TSelf>): void;
|
|
15
|
-
nodeDestroy(context: DestroyContext<TSelf>): void;
|
|
16
|
-
}
|
|
17
|
-
//# sourceMappingURL=lifecycle-base.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"lifecycle-base.d.ts","sourceRoot":"","sources":["../../../src/lib/core/lifecycle-base.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,YAAY,EAAE,aAAa,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAErI;;;GAGG;AACH,8BAAsB,aAAa,CAAC,KAAK;IACxC,MAAM,EAAE,cAAc,CAAC,KAAK,CAAC,CAAa;IAC1C,KAAK,EAAE,aAAa,CAAC,KAAK,CAAC,CAAa;IACxC,OAAO,EAAE,eAAe,CAAC,KAAK,CAAC,CAAa;IAE5C,SAAS,CAAC,QAAQ,CAAC,MAAM,CAAC,OAAO,EAAE,YAAY,CAAC,KAAK,CAAC,GAAG,IAAI;IAC7D,SAAS,CAAC,QAAQ,CAAC,OAAO,CAAC,OAAO,EAAE,aAAa,CAAC,KAAK,CAAC,GAAG,IAAI;IAC/D,SAAS,CAAC,QAAQ,CAAC,QAAQ,CAAC,OAAO,EAAE,cAAc,CAAC,KAAK,CAAC,GAAG,IAAI;IAEjE,SAAS,CAAC,OAAO,EAAE,YAAY,CAAC,KAAK,CAAC;IAStC,UAAU,CAAC,OAAO,EAAE,aAAa,CAAC,KAAK,CAAC;IASxC,WAAW,CAAC,OAAO,EAAE,cAAc,CAAC,KAAK,CAAC;CAQ1C"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
class e {
|
|
2
|
-
update = () => {
|
|
3
|
-
};
|
|
4
|
-
setup = () => {
|
|
5
|
-
};
|
|
6
|
-
destroy = () => {
|
|
7
|
-
};
|
|
8
|
-
nodeSetup(t) {
|
|
9
|
-
typeof this._setup == "function" && this._setup(t), this.setup && this.setup(t);
|
|
10
|
-
}
|
|
11
|
-
nodeUpdate(t) {
|
|
12
|
-
typeof this._update == "function" && this._update(t), this.update && this.update(t);
|
|
13
|
-
}
|
|
14
|
-
nodeDestroy(t) {
|
|
15
|
-
this.destroy && this.destroy(t), typeof this._destroy == "function" && this._destroy(t);
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
export {
|
|
19
|
-
e as LifeCycleBase
|
|
20
|
-
};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export type ZylemShaderObject = {
|
|
2
|
-
fragment: string;
|
|
3
|
-
vertex: string;
|
|
4
|
-
};
|
|
5
|
-
export type ZylemShaderType = 'standard' | 'fire' | 'star' | 'debug';
|
|
6
|
-
declare const shaderMap: Map<ZylemShaderType, ZylemShaderObject>;
|
|
7
|
-
export default shaderMap;
|
|
8
|
-
//# sourceMappingURL=preset-shader.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"preset-shader.d.ts","sourceRoot":"","sources":["../../../src/lib/core/preset-shader.ts"],"names":[],"mappings":"AAUA,MAAM,MAAM,iBAAiB,GAAG;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAsBrE,MAAM,MAAM,eAAe,GAAG,UAAU,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;AAErE,QAAA,MAAM,SAAS,EAAE,GAAG,CAAC,eAAe,EAAE,iBAAiB,CAAa,CAAC;AAMrE,eAAe,SAAS,CAAC"}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import r from "../graphics/shaders/fragment/stars.glsl.js";
|
|
2
|
-
import a from "../graphics/shaders/fragment/fire.glsl.js";
|
|
3
|
-
import d from "../graphics/shaders/fragment/standard.glsl.js";
|
|
4
|
-
import f from "../graphics/shaders/fragment/debug.glsl.js";
|
|
5
|
-
import t from "../graphics/shaders/vertex/object-shader.glsl.js";
|
|
6
|
-
import o from "../graphics/shaders/vertex/debug.glsl.js";
|
|
7
|
-
const s = {
|
|
8
|
-
fragment: r,
|
|
9
|
-
vertex: t
|
|
10
|
-
}, m = {
|
|
11
|
-
fragment: a,
|
|
12
|
-
vertex: t
|
|
13
|
-
}, n = {
|
|
14
|
-
fragment: d,
|
|
15
|
-
vertex: t
|
|
16
|
-
}, u = {
|
|
17
|
-
fragment: f,
|
|
18
|
-
vertex: o
|
|
19
|
-
}, e = /* @__PURE__ */ new Map();
|
|
20
|
-
e.set("standard", n);
|
|
21
|
-
e.set("fire", m);
|
|
22
|
-
e.set("star", s);
|
|
23
|
-
e.set("debug", u);
|
|
24
|
-
export {
|
|
25
|
-
e as default
|
|
26
|
-
};
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This class is an alternative to {@link Clock} with a different API design and behavior.
|
|
3
|
-
* The goal is to avoid the conceptual flaws that became apparent in `Clock` over time.
|
|
4
|
-
*
|
|
5
|
-
* - `Timer` has an `update()` method that updates its internal state. That makes it possible to
|
|
6
|
-
* call `getDelta()` and `getElapsed()` multiple times per simulation step without getting different values.
|
|
7
|
-
* - The class can make use of the Page Visibility API to avoid large time delta values when the app
|
|
8
|
-
* is inactive (e.g. tab switched or browser hidden).
|
|
9
|
-
*
|
|
10
|
-
* ```js
|
|
11
|
-
* const timer = new Timer();
|
|
12
|
-
* timer.connect( document ); // use Page Visibility API
|
|
13
|
-
* ```
|
|
14
|
-
*
|
|
15
|
-
* @three_import import { Timer } from 'three/addons/misc/Timer.js';
|
|
16
|
-
*/
|
|
17
|
-
declare class Timer {
|
|
18
|
-
protected _previousTime: number;
|
|
19
|
-
protected _currentTime: number;
|
|
20
|
-
protected _startTime: number;
|
|
21
|
-
protected _delta: number;
|
|
22
|
-
protected _elapsed: number;
|
|
23
|
-
protected _timescale: number;
|
|
24
|
-
protected _document: Document | null;
|
|
25
|
-
protected _pageVisibilityHandler: (() => void) | null;
|
|
26
|
-
/**
|
|
27
|
-
* Constructs a new timer.
|
|
28
|
-
*/
|
|
29
|
-
constructor();
|
|
30
|
-
/**
|
|
31
|
-
* Connect the timer to the given document.Calling this method is not mandatory to
|
|
32
|
-
* use the timer but enables the usage of the Page Visibility API to avoid large time
|
|
33
|
-
* delta values.
|
|
34
|
-
*
|
|
35
|
-
* @param {Document} document - The document.
|
|
36
|
-
*/
|
|
37
|
-
connect(document: Document): void;
|
|
38
|
-
/**
|
|
39
|
-
* Disconnects the timer from the DOM and also disables the usage of the Page Visibility API.
|
|
40
|
-
*/
|
|
41
|
-
disconnect(): void;
|
|
42
|
-
/**
|
|
43
|
-
* Returns the time delta in seconds.
|
|
44
|
-
*
|
|
45
|
-
* @return {number} The time delta in second.
|
|
46
|
-
*/
|
|
47
|
-
getDelta(): number;
|
|
48
|
-
/**
|
|
49
|
-
* Returns the elapsed time in seconds.
|
|
50
|
-
*
|
|
51
|
-
* @return {number} The elapsed time in second.
|
|
52
|
-
*/
|
|
53
|
-
getElapsed(): number;
|
|
54
|
-
/**
|
|
55
|
-
* Returns the timescale.
|
|
56
|
-
*
|
|
57
|
-
* @return {number} The timescale.
|
|
58
|
-
*/
|
|
59
|
-
getTimescale(): number;
|
|
60
|
-
/**
|
|
61
|
-
* Sets the given timescale which scale the time delta computation
|
|
62
|
-
* in `update()`.
|
|
63
|
-
*
|
|
64
|
-
* @param {number} timescale - The timescale to set.
|
|
65
|
-
* @return {Timer} A reference to this timer.
|
|
66
|
-
*/
|
|
67
|
-
setTimescale(timescale: number): Timer;
|
|
68
|
-
/**
|
|
69
|
-
* Resets the time computation for the current simulation step.
|
|
70
|
-
*
|
|
71
|
-
* @return {Timer} A reference to this timer.
|
|
72
|
-
*/
|
|
73
|
-
reset(): Timer;
|
|
74
|
-
/**
|
|
75
|
-
* Can be used to free all internal resources. Usually called when
|
|
76
|
-
* the timer instance isn't required anymore.
|
|
77
|
-
*/
|
|
78
|
-
dispose(): void;
|
|
79
|
-
/**
|
|
80
|
-
* Updates the internal state of the timer. This method should be called
|
|
81
|
-
* once per simulation step and before you perform queries against the timer
|
|
82
|
-
* (e.g. via `getDelta()`).
|
|
83
|
-
*
|
|
84
|
-
* @param {number} timestamp - The current time in milliseconds. Can be obtained
|
|
85
|
-
* from the `requestAnimationFrame` callback argument. If not provided, the current
|
|
86
|
-
* time will be determined with `performance.now`.
|
|
87
|
-
* @return {Timer} A reference to this timer.
|
|
88
|
-
*/
|
|
89
|
-
update(timestamp?: number): Timer;
|
|
90
|
-
}
|
|
91
|
-
export { Timer, };
|
|
92
|
-
//# sourceMappingURL=Timer.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Timer.d.ts","sourceRoot":"","sources":["../../../../src/lib/core/three-addons/Timer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,cAAM,KAAK;IACV,SAAS,CAAC,aAAa,EAAE,MAAM,CAAC;IAChC,SAAS,CAAC,YAAY,EAAE,MAAM,CAAC;IAC/B,SAAS,CAAC,UAAU,EAAE,MAAM,CAAC;IAC7B,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC;IACzB,SAAS,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC3B,SAAS,CAAC,UAAU,EAAE,MAAM,CAAC;IAC7B,SAAS,CAAC,SAAS,EAAE,QAAQ,GAAG,IAAI,CAAC;IACrC,SAAS,CAAC,sBAAsB,EAAE,CAAC,MAAM,IAAI,CAAC,GAAG,IAAI,CAAC;IAEtD;;OAEG;;IAiBH;;;;;;OAMG;IACH,OAAO,CAAC,QAAQ,EAAE,QAAQ,GAAG,IAAI;IAgBjC;;OAEG;IACH,UAAU,IAAI,IAAI;IAalB;;;;OAIG;IACH,QAAQ,IAAI,MAAM;IAMlB;;;;OAIG;IACH,UAAU,IAAI,MAAM;IAMpB;;;;OAIG;IACH,YAAY,IAAI,MAAM;IAMtB;;;;;;OAMG;IACH,YAAY,CAAC,SAAS,EAAE,MAAM,GAAG,KAAK;IAQtC;;;;OAIG;IACH,KAAK,IAAI,KAAK;IAQd;;;OAGG;IACH,OAAO,IAAI,IAAI;IAMf;;;;;;;;;OASG;IACH,MAAM,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,KAAK;CAoBjC;AA4CD,OAAO,EAAE,KAAK,GAAI,CAAC"}
|
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
class n {
|
|
2
|
-
_previousTime;
|
|
3
|
-
_currentTime;
|
|
4
|
-
_startTime;
|
|
5
|
-
_delta;
|
|
6
|
-
_elapsed;
|
|
7
|
-
_timescale;
|
|
8
|
-
_document;
|
|
9
|
-
_pageVisibilityHandler;
|
|
10
|
-
/**
|
|
11
|
-
* Constructs a new timer.
|
|
12
|
-
*/
|
|
13
|
-
constructor() {
|
|
14
|
-
this._previousTime = 0, this._currentTime = 0, this._startTime = e(), this._delta = 0, this._elapsed = 0, this._timescale = 1, this._document = null, this._pageVisibilityHandler = null;
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* Connect the timer to the given document.Calling this method is not mandatory to
|
|
18
|
-
* use the timer but enables the usage of the Page Visibility API to avoid large time
|
|
19
|
-
* delta values.
|
|
20
|
-
*
|
|
21
|
-
* @param {Document} document - The document.
|
|
22
|
-
*/
|
|
23
|
-
connect(i) {
|
|
24
|
-
this._document = i, i.hidden !== void 0 && (this._pageVisibilityHandler = t.bind(this), i.addEventListener("visibilitychange", this._pageVisibilityHandler, !1));
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Disconnects the timer from the DOM and also disables the usage of the Page Visibility API.
|
|
28
|
-
*/
|
|
29
|
-
disconnect() {
|
|
30
|
-
this._pageVisibilityHandler !== null && (this._document.removeEventListener("visibilitychange", this._pageVisibilityHandler), this._pageVisibilityHandler = null), this._document = null;
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* Returns the time delta in seconds.
|
|
34
|
-
*
|
|
35
|
-
* @return {number} The time delta in second.
|
|
36
|
-
*/
|
|
37
|
-
getDelta() {
|
|
38
|
-
return this._delta / 1e3;
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* Returns the elapsed time in seconds.
|
|
42
|
-
*
|
|
43
|
-
* @return {number} The elapsed time in second.
|
|
44
|
-
*/
|
|
45
|
-
getElapsed() {
|
|
46
|
-
return this._elapsed / 1e3;
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* Returns the timescale.
|
|
50
|
-
*
|
|
51
|
-
* @return {number} The timescale.
|
|
52
|
-
*/
|
|
53
|
-
getTimescale() {
|
|
54
|
-
return this._timescale;
|
|
55
|
-
}
|
|
56
|
-
/**
|
|
57
|
-
* Sets the given timescale which scale the time delta computation
|
|
58
|
-
* in `update()`.
|
|
59
|
-
*
|
|
60
|
-
* @param {number} timescale - The timescale to set.
|
|
61
|
-
* @return {Timer} A reference to this timer.
|
|
62
|
-
*/
|
|
63
|
-
setTimescale(i) {
|
|
64
|
-
return this._timescale = i, this;
|
|
65
|
-
}
|
|
66
|
-
/**
|
|
67
|
-
* Resets the time computation for the current simulation step.
|
|
68
|
-
*
|
|
69
|
-
* @return {Timer} A reference to this timer.
|
|
70
|
-
*/
|
|
71
|
-
reset() {
|
|
72
|
-
return this._currentTime = e() - this._startTime, this;
|
|
73
|
-
}
|
|
74
|
-
/**
|
|
75
|
-
* Can be used to free all internal resources. Usually called when
|
|
76
|
-
* the timer instance isn't required anymore.
|
|
77
|
-
*/
|
|
78
|
-
dispose() {
|
|
79
|
-
this.disconnect();
|
|
80
|
-
}
|
|
81
|
-
/**
|
|
82
|
-
* Updates the internal state of the timer. This method should be called
|
|
83
|
-
* once per simulation step and before you perform queries against the timer
|
|
84
|
-
* (e.g. via `getDelta()`).
|
|
85
|
-
*
|
|
86
|
-
* @param {number} timestamp - The current time in milliseconds. Can be obtained
|
|
87
|
-
* from the `requestAnimationFrame` callback argument. If not provided, the current
|
|
88
|
-
* time will be determined with `performance.now`.
|
|
89
|
-
* @return {Timer} A reference to this timer.
|
|
90
|
-
*/
|
|
91
|
-
update(i) {
|
|
92
|
-
return this._pageVisibilityHandler !== null && this._document.hidden === !0 ? this._delta = 0 : (this._previousTime = this._currentTime, this._currentTime = (i !== void 0 ? i : e()) - this._startTime, this._delta = (this._currentTime - this._previousTime) * this._timescale, this._elapsed += this._delta), this;
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
function e() {
|
|
96
|
-
return performance.now();
|
|
97
|
-
}
|
|
98
|
-
function t() {
|
|
99
|
-
this._document.hidden === !1 && this.reset();
|
|
100
|
-
}
|
|
101
|
-
export {
|
|
102
|
-
n as Timer
|
|
103
|
-
};
|