@zylem/game-lib 0.5.0 → 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/{src/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 -4
- package/dist/stage.js.map +1 -0
- package/dist/transformable-CUhvyuYO.d.ts +67 -0
- package/package.json +9 -45
- package/LICENSE +0 -21
- package/dist/.vite/manifest.json +0 -716
- package/dist/assets/zylem-logo.png +0 -0
- package/dist/examples/00-readme-example.d.ts +0 -2
- package/dist/examples/00-readme-example.d.ts.map +0 -1
- package/dist/examples/01-basic.d.ts +0 -2
- package/dist/examples/01-basic.d.ts.map +0 -1
- package/dist/examples/01.1-basic-ball.d.ts +0 -9
- package/dist/examples/01.1-basic-ball.d.ts.map +0 -1
- package/dist/examples/01.2-ricochet-test.d.ts +0 -2
- package/dist/examples/01.2-ricochet-test.d.ts.map +0 -1
- package/dist/examples/01.3-rect.d.ts +0 -2
- package/dist/examples/01.3-rect.d.ts.map +0 -1
- package/dist/examples/02-input.d.ts +0 -2
- package/dist/examples/02-input.d.ts.map +0 -1
- package/dist/examples/03-stage-test/03-stage-test.d.ts +0 -2
- package/dist/examples/03-stage-test/03-stage-test.d.ts.map +0 -1
- package/dist/examples/03-stage-test/stage0.d.ts +0 -2
- package/dist/examples/03-stage-test/stage0.d.ts.map +0 -1
- package/dist/examples/03-stage-test/stage1.d.ts +0 -2
- package/dist/examples/03-stage-test/stage1.d.ts.map +0 -1
- package/dist/examples/03-stage-test/stage2.d.ts +0 -2
- package/dist/examples/03-stage-test/stage2.d.ts.map +0 -1
- package/dist/examples/03-stage-test/stage3.d.ts +0 -2
- package/dist/examples/03-stage-test/stage3.d.ts.map +0 -1
- package/dist/examples/03.1-stage-variable.d.ts +0 -2
- package/dist/examples/03.1-stage-variable.d.ts.map +0 -1
- package/dist/examples/04-vessel-test.d.ts +0 -18
- package/dist/examples/04-vessel-test.d.ts.map +0 -1
- package/dist/examples/05-camera-test.d.ts +0 -2
- package/dist/examples/05-camera-test.d.ts.map +0 -1
- package/dist/examples/06-entity-test.d.ts +0 -2
- package/dist/examples/06-entity-test.d.ts.map +0 -1
- package/dist/examples/07-behaviors.d.ts +0 -2
- package/dist/examples/07-behaviors.d.ts.map +0 -1
- package/dist/examples/07.01-behavior-context.d.ts +0 -2
- package/dist/examples/07.01-behavior-context.d.ts.map +0 -1
- package/dist/examples/08-pong.d.ts +0 -2
- package/dist/examples/08-pong.d.ts.map +0 -1
- package/dist/examples/08.01-breakout.d.ts +0 -2
- package/dist/examples/08.01-breakout.d.ts.map +0 -1
- package/dist/examples/09-space-invaders.d.ts +0 -2
- package/dist/examples/09-space-invaders.d.ts.map +0 -1
- package/dist/examples/10-asteroids.d.ts +0 -2
- package/dist/examples/10-asteroids.d.ts.map +0 -1
- package/dist/examples/11-2d-platformer.d.ts +0 -2
- package/dist/examples/11-2d-platformer.d.ts.map +0 -1
- package/dist/examples/12-3d-platformer.d.ts +0 -2
- package/dist/examples/12-3d-platformer.d.ts.map +0 -1
- package/dist/examples/13-fps.d.ts +0 -2
- package/dist/examples/13-fps.d.ts.map +0 -1
- package/dist/examples/14-strategy.d.ts +0 -2
- package/dist/examples/14-strategy.d.ts.map +0 -1
- package/dist/examples/15-zylem-planet-demo.d.ts +0 -2
- package/dist/examples/15-zylem-planet-demo.d.ts.map +0 -1
- package/dist/examples/16-timbotron.d.ts +0 -2
- package/dist/examples/16-timbotron.d.ts.map +0 -1
- package/dist/examples/17-stress-test.d.ts +0 -2
- package/dist/examples/17-stress-test.d.ts.map +0 -1
- package/dist/examples/architecture-test.d.ts +0 -2
- package/dist/examples/architecture-test.d.ts.map +0 -1
- package/dist/examples/utils.d.ts +0 -10
- package/dist/examples/utils.d.ts.map +0 -1
- package/dist/lib/actions/behaviors/actions.js +0 -35
- package/dist/lib/actions/behaviors/boundaries/boundary.js +0 -40
- package/dist/lib/actions/behaviors/ricochet/ricochet-2d-collision.js +0 -100
- package/dist/lib/actions/behaviors/ricochet/ricochet-2d-in-bounds.js +0 -37
- package/dist/lib/actions/behaviors/ricochet/ricochet.js +0 -6
- package/dist/lib/actions/capabilities/moveable.js +0 -108
- package/dist/lib/actions/capabilities/rotatable.js +0 -82
- package/dist/lib/actions/capabilities/transformable.js +0 -9
- package/dist/lib/actions/global-change.js +0 -40
- package/dist/lib/camera/camera.js +0 -19
- package/dist/lib/camera/fixed-2d.js +0 -30
- package/dist/lib/camera/perspective.js +0 -10
- package/dist/lib/camera/third-person.js +0 -42
- package/dist/lib/camera/zylem-camera.js +0 -208
- package/dist/lib/collision/collision-builder.js +0 -46
- package/dist/lib/collision/collision-delegate.js +0 -6
- package/dist/lib/collision/utils.js +0 -24
- package/dist/lib/collision/world.js +0 -77
- package/dist/lib/core/base-node.js +0 -61
- package/dist/lib/core/entity-asset-loader.js +0 -54
- package/dist/lib/core/lifecycle-base.js +0 -20
- package/dist/lib/core/preset-shader.js +0 -26
- package/dist/lib/core/three-addons/Timer.js +0 -103
- package/dist/lib/core/utility/nodes.js +0 -31
- package/dist/lib/core/utility/strings.js +0 -14
- package/dist/lib/core/utility/vector.js +0 -8
- package/dist/lib/core/vessel.js +0 -26
- package/dist/lib/debug/console/console-state.js +0 -11
- package/dist/lib/debug/debug-state.js +0 -40
- package/dist/lib/device/aspect-ratio.js +0 -44
- package/dist/lib/entities/actor.js +0 -122
- package/dist/lib/entities/box.js +0 -68
- package/dist/lib/entities/builder.js +0 -79
- package/dist/lib/entities/create.js +0 -31
- package/dist/lib/entities/delegates/animation.js +0 -58
- package/dist/lib/entities/delegates/debug.js +0 -71
- package/dist/lib/entities/delegates/loader.js +0 -19
- package/dist/lib/entities/destroy.js +0 -15
- package/dist/lib/entities/entity-factory.js +0 -24
- package/dist/lib/entities/entity.js +0 -121
- package/dist/lib/entities/plane.js +0 -81
- package/dist/lib/entities/rect.js +0 -160
- package/dist/lib/entities/sphere.js +0 -68
- package/dist/lib/entities/sprite.js +0 -125
- package/dist/lib/entities/text.js +0 -140
- package/dist/lib/entities/zone.js +0 -103
- package/dist/lib/game/game-canvas.js +0 -57
- package/dist/lib/game/game-config.js +0 -78
- package/dist/lib/game/game-default.js +0 -23
- package/dist/lib/game/game-retro-resolutions.js +0 -80
- package/dist/lib/game/game-state.js +0 -17
- package/dist/lib/game/game.js +0 -131
- package/dist/lib/game/zylem-game.js +0 -140
- package/dist/lib/graphics/geometries/XZPlaneGeometry.js +0 -34
- package/dist/lib/graphics/material.js +0 -64
- package/dist/lib/graphics/mesh.js +0 -14
- 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.js +0 -75
- package/dist/lib/input/gamepad-provider.js +0 -58
- package/dist/lib/input/input-manager.js +0 -70
- package/dist/lib/input/keyboard-provider.js +0 -120
- package/dist/lib/stage/debug-entity-cursor.js +0 -53
- package/dist/lib/stage/entity-spawner.js +0 -27
- package/dist/lib/stage/stage-debug-delegate.js +0 -100
- package/dist/lib/stage/stage-default.js +0 -32
- package/dist/lib/stage/stage-factory.js +0 -22
- package/dist/lib/stage/stage-manager.js +0 -49
- package/dist/lib/stage/stage-state.js +0 -36
- package/dist/lib/stage/stage.js +0 -67
- package/dist/lib/stage/zylem-stage.js +0 -268
- package/dist/lib/systems/transformable.system.js +0 -43
- package/dist/node_modules/.pnpm/idb-keyval@6.2.2/node_modules/idb-keyval/dist/index.js +0 -34
- package/dist/node_modules/.pnpm/msgpackr@1.11.5/node_modules/msgpackr/pack.js +0 -520
- package/dist/node_modules/.pnpm/msgpackr@1.11.5/node_modules/msgpackr/unpack.js +0 -672
- package/dist/src/api/actions.d.ts +0 -5
- package/dist/src/api/actions.d.ts.map +0 -1
- package/dist/src/api/behaviors.d.ts +0 -4
- package/dist/src/api/behaviors.d.ts.map +0 -1
- package/dist/src/api/camera.d.ts +0 -4
- package/dist/src/api/camera.d.ts.map +0 -1
- package/dist/src/api/core.d.ts +0 -6
- package/dist/src/api/core.d.ts.map +0 -1
- package/dist/src/api/entities.d.ts +0 -9
- package/dist/src/api/entities.d.ts.map +0 -1
- package/dist/src/api/main.d.ts +0 -32
- package/dist/src/api/main.d.ts.map +0 -1
- package/dist/src/api/stage.d.ts +0 -5
- package/dist/src/api/stage.d.ts.map +0 -1
- package/dist/src/lib/actions/behaviors/actions.d.ts +0 -11
- package/dist/src/lib/actions/behaviors/actions.d.ts.map +0 -1
- package/dist/src/lib/actions/behaviors/behavior.d.ts +0 -6
- package/dist/src/lib/actions/behaviors/behavior.d.ts.map +0 -1
- package/dist/src/lib/actions/behaviors/boundaries/boundary.d.ts +0 -37
- package/dist/src/lib/actions/behaviors/boundaries/boundary.d.ts.map +0 -1
- package/dist/src/lib/actions/behaviors/character-controller.d.ts +0 -6
- package/dist/src/lib/actions/behaviors/character-controller.d.ts.map +0 -1
- package/dist/src/lib/actions/behaviors/debug/debug-collision.d.ts +0 -6
- package/dist/src/lib/actions/behaviors/debug/debug-collision.d.ts.map +0 -1
- package/dist/src/lib/actions/behaviors/debug/debug-update.d.ts +0 -5
- package/dist/src/lib/actions/behaviors/debug/debug-update.d.ts.map +0 -1
- package/dist/src/lib/actions/behaviors/debug/debug.d.ts +0 -10
- package/dist/src/lib/actions/behaviors/debug/debug.d.ts.map +0 -1
- package/dist/src/lib/actions/behaviors/movement/movement-sequence-2d.d.ts +0 -24
- package/dist/src/lib/actions/behaviors/movement/movement-sequence-2d.d.ts.map +0 -1
- package/dist/src/lib/actions/behaviors/ricochet/ricochet-2d-collision.d.ts +0 -11
- package/dist/src/lib/actions/behaviors/ricochet/ricochet-2d-collision.d.ts.map +0 -1
- package/dist/src/lib/actions/behaviors/ricochet/ricochet-2d-in-bounds.d.ts +0 -12
- package/dist/src/lib/actions/behaviors/ricochet/ricochet-2d-in-bounds.d.ts.map +0 -1
- package/dist/src/lib/actions/behaviors/ricochet/ricochet.d.ts +0 -44
- package/dist/src/lib/actions/behaviors/ricochet/ricochet.d.ts.map +0 -1
- package/dist/src/lib/actions/behaviors/zylem-behavior.d.ts +0 -2
- package/dist/src/lib/actions/behaviors/zylem-behavior.d.ts.map +0 -1
- package/dist/src/lib/actions/capabilities/moveable.d.ts +0 -125
- package/dist/src/lib/actions/capabilities/moveable.d.ts.map +0 -1
- package/dist/src/lib/actions/capabilities/rotatable.d.ts +0 -111
- package/dist/src/lib/actions/capabilities/rotatable.d.ts.map +0 -1
- package/dist/src/lib/actions/capabilities/transformable.d.ts +0 -7
- package/dist/src/lib/actions/capabilities/transformable.d.ts.map +0 -1
- package/dist/src/lib/actions/global-change.d.ts +0 -23
- package/dist/src/lib/actions/global-change.d.ts.map +0 -1
- package/dist/src/lib/camera/camera.d.ts +0 -16
- package/dist/src/lib/camera/camera.d.ts.map +0 -1
- package/dist/src/lib/camera/fixed-2d.d.ts +0 -32
- package/dist/src/lib/camera/fixed-2d.d.ts.map +0 -1
- package/dist/src/lib/camera/perspective.d.ts +0 -9
- package/dist/src/lib/camera/perspective.d.ts.map +0 -1
- package/dist/src/lib/camera/third-person.d.ts +0 -32
- package/dist/src/lib/camera/third-person.d.ts.map +0 -1
- package/dist/src/lib/camera/zylem-camera.d.ts.map +0 -1
- package/dist/src/lib/collision/collision-builder.d.ts +0 -17
- package/dist/src/lib/collision/collision-builder.d.ts.map +0 -1
- package/dist/src/lib/collision/collision-delegate.d.ts +0 -6
- package/dist/src/lib/collision/collision-delegate.d.ts.map +0 -1
- package/dist/src/lib/collision/collision-group.d.ts +0 -11
- package/dist/src/lib/collision/collision-group.d.ts.map +0 -1
- package/dist/src/lib/collision/collision-mask.d.ts +0 -18
- package/dist/src/lib/collision/collision-mask.d.ts.map +0 -1
- package/dist/src/lib/collision/collision.d.ts +0 -19
- package/dist/src/lib/collision/collision.d.ts.map +0 -1
- package/dist/src/lib/collision/utils.d.ts +0 -15
- package/dist/src/lib/collision/utils.d.ts.map +0 -1
- package/dist/src/lib/collision/world.d.ts +0 -23
- package/dist/src/lib/collision/world.d.ts.map +0 -1
- package/dist/src/lib/core/asset-manager.d.ts +0 -2
- package/dist/src/lib/core/asset-manager.d.ts.map +0 -1
- package/dist/src/lib/core/base-node-life-cycle.d.ts +0 -54
- package/dist/src/lib/core/base-node-life-cycle.d.ts.map +0 -1
- package/dist/src/lib/core/base-node.d.ts +0 -36
- package/dist/src/lib/core/base-node.d.ts.map +0 -1
- package/dist/src/lib/core/blueprints.d.ts +0 -22
- package/dist/src/lib/core/blueprints.d.ts.map +0 -1
- package/dist/src/lib/core/entity-asset-loader.d.ts +0 -16
- package/dist/src/lib/core/entity-asset-loader.d.ts.map +0 -1
- package/dist/src/lib/core/errors.d.ts +0 -5
- package/dist/src/lib/core/errors.d.ts.map +0 -1
- package/dist/src/lib/core/flags.d.ts +0 -3
- package/dist/src/lib/core/flags.d.ts.map +0 -1
- package/dist/src/lib/core/index.d.ts +0 -5
- package/dist/src/lib/core/index.d.ts.map +0 -1
- package/dist/src/lib/core/interfaces.d.ts +0 -25
- package/dist/src/lib/core/interfaces.d.ts.map +0 -1
- package/dist/src/lib/core/lazy-loader.d.ts +0 -80
- package/dist/src/lib/core/lazy-loader.d.ts.map +0 -1
- package/dist/src/lib/core/lifecycle-base.d.ts +0 -17
- package/dist/src/lib/core/lifecycle-base.d.ts.map +0 -1
- package/dist/src/lib/core/node-interface.d.ts +0 -12
- package/dist/src/lib/core/node-interface.d.ts.map +0 -1
- package/dist/src/lib/core/preset-shader.d.ts +0 -8
- package/dist/src/lib/core/preset-shader.d.ts.map +0 -1
- package/dist/src/lib/core/three-addons/Timer.d.ts +0 -92
- package/dist/src/lib/core/three-addons/Timer.d.ts.map +0 -1
- package/dist/src/lib/core/utility/nodes.d.ts +0 -13
- package/dist/src/lib/core/utility/nodes.d.ts.map +0 -1
- package/dist/src/lib/core/utility/strings.d.ts +0 -3
- package/dist/src/lib/core/utility/strings.d.ts.map +0 -1
- package/dist/src/lib/core/utility/vector.d.ts +0 -8
- package/dist/src/lib/core/utility/vector.d.ts.map +0 -1
- package/dist/src/lib/core/vector.d.ts +0 -4
- package/dist/src/lib/core/vector.d.ts.map +0 -1
- package/dist/src/lib/core/vessel.d.ts +0 -13
- package/dist/src/lib/core/vessel.d.ts.map +0 -1
- package/dist/src/lib/debug/console/console-state.d.ts +0 -20
- package/dist/src/lib/debug/console/console-state.d.ts.map +0 -1
- package/dist/src/lib/debug/console/console-store.d.ts +0 -6
- package/dist/src/lib/debug/console/console-store.d.ts.map +0 -1
- package/dist/src/lib/debug/debug-state.d.ts +0 -38
- package/dist/src/lib/debug/debug-state.d.ts.map +0 -1
- package/dist/src/lib/debug/debug-store.d.ts +0 -15
- package/dist/src/lib/debug/debug-store.d.ts.map +0 -1
- package/dist/src/lib/debug/state-based-debug-loader.d.ts +0 -8
- package/dist/src/lib/debug/state-based-debug-loader.d.ts.map +0 -1
- package/dist/src/lib/device/aspect-ratio.d.ts +0 -38
- package/dist/src/lib/device/aspect-ratio.d.ts.map +0 -1
- package/dist/src/lib/device/desktop.d.ts +0 -2
- package/dist/src/lib/device/desktop.d.ts.map +0 -1
- package/dist/src/lib/device/mobile.d.ts +0 -2
- package/dist/src/lib/device/mobile.d.ts.map +0 -1
- package/dist/src/lib/device/tablet.d.ts +0 -2
- package/dist/src/lib/device/tablet.d.ts.map +0 -1
- package/dist/src/lib/entities/actor.d.ts +0 -44
- package/dist/src/lib/entities/actor.d.ts.map +0 -1
- package/dist/src/lib/entities/box.d.ts +0 -27
- package/dist/src/lib/entities/box.d.ts.map +0 -1
- package/dist/src/lib/entities/builder.d.ts +0 -28
- package/dist/src/lib/entities/builder.d.ts.map +0 -1
- package/dist/src/lib/entities/create.d.ts +0 -15
- package/dist/src/lib/entities/create.d.ts.map +0 -1
- package/dist/src/lib/entities/delegates/animation.d.ts +0 -33
- package/dist/src/lib/entities/delegates/animation.d.ts.map +0 -1
- package/dist/src/lib/entities/delegates/debug.d.ts +0 -29
- package/dist/src/lib/entities/delegates/debug.d.ts.map +0 -1
- package/dist/src/lib/entities/delegates/loader.d.ts +0 -12
- package/dist/src/lib/entities/delegates/loader.d.ts.map +0 -1
- package/dist/src/lib/entities/destroy.d.ts +0 -4
- package/dist/src/lib/entities/destroy.d.ts.map +0 -1
- package/dist/src/lib/entities/entity-factory.d.ts +0 -10
- package/dist/src/lib/entities/entity-factory.d.ts.map +0 -1
- package/dist/src/lib/entities/entity.d.ts +0 -98
- package/dist/src/lib/entities/entity.d.ts.map +0 -1
- package/dist/src/lib/entities/index.d.ts +0 -12
- package/dist/src/lib/entities/index.d.ts.map +0 -1
- package/dist/src/lib/entities/plane.d.ts +0 -36
- package/dist/src/lib/entities/plane.d.ts.map +0 -1
- package/dist/src/lib/entities/rect.d.ts +0 -63
- package/dist/src/lib/entities/rect.d.ts.map +0 -1
- package/dist/src/lib/entities/sphere.d.ts +0 -29
- package/dist/src/lib/entities/sphere.d.ts.map +0 -1
- package/dist/src/lib/entities/sprite.d.ts +0 -54
- package/dist/src/lib/entities/sprite.d.ts.map +0 -1
- package/dist/src/lib/entities/text.d.ts +0 -49
- package/dist/src/lib/entities/text.d.ts.map +0 -1
- package/dist/src/lib/entities/zone.d.ts +0 -54
- package/dist/src/lib/entities/zone.d.ts.map +0 -1
- package/dist/src/lib/game/game-blueprint.d.ts +0 -38
- package/dist/src/lib/game/game-blueprint.d.ts.map +0 -1
- package/dist/src/lib/game/game-canvas.d.ts +0 -35
- package/dist/src/lib/game/game-canvas.d.ts.map +0 -1
- package/dist/src/lib/game/game-config.d.ts +0 -59
- package/dist/src/lib/game/game-config.d.ts.map +0 -1
- package/dist/src/lib/game/game-default.d.ts +0 -14
- package/dist/src/lib/game/game-default.d.ts.map +0 -1
- package/dist/src/lib/game/game-interfaces.d.ts +0 -29
- package/dist/src/lib/game/game-interfaces.d.ts.map +0 -1
- package/dist/src/lib/game/game-retro-resolutions.d.ts +0 -25
- package/dist/src/lib/game/game-retro-resolutions.d.ts.map +0 -1
- package/dist/src/lib/game/game-state.d.ts +0 -11
- package/dist/src/lib/game/game-state.d.ts.map +0 -1
- package/dist/src/lib/game/game.d.ts +0 -39
- package/dist/src/lib/game/game.d.ts.map +0 -1
- package/dist/src/lib/game/zylem-game.d.ts +0 -58
- package/dist/src/lib/game/zylem-game.d.ts.map +0 -1
- package/dist/src/lib/graphics/geometries/XZPlaneGeometry.d.ts +0 -8
- package/dist/src/lib/graphics/geometries/XZPlaneGeometry.d.ts.map +0 -1
- package/dist/src/lib/graphics/material.d.ts +0 -29
- package/dist/src/lib/graphics/material.d.ts.map +0 -1
- package/dist/src/lib/graphics/mesh.d.ts +0 -19
- package/dist/src/lib/graphics/mesh.d.ts.map +0 -1
- package/dist/src/lib/graphics/render-pass.d.ts +0 -17
- package/dist/src/lib/graphics/render-pass.d.ts.map +0 -1
- package/dist/src/lib/graphics/zylem-scene.d.ts +0 -50
- package/dist/src/lib/graphics/zylem-scene.d.ts.map +0 -1
- package/dist/src/lib/input/gamepad-provider.d.ts +0 -14
- package/dist/src/lib/input/gamepad-provider.d.ts.map +0 -1
- package/dist/src/lib/input/input-manager.d.ts +0 -15
- package/dist/src/lib/input/input-manager.d.ts.map +0 -1
- package/dist/src/lib/input/input-provider.d.ts +0 -7
- package/dist/src/lib/input/input-provider.d.ts.map +0 -1
- package/dist/src/lib/input/input.d.ts +0 -48
- package/dist/src/lib/input/input.d.ts.map +0 -1
- package/dist/src/lib/input/keyboard-provider.d.ts +0 -21
- package/dist/src/lib/input/keyboard-provider.d.ts.map +0 -1
- package/dist/src/lib/interfaces/entity.d.ts +0 -26
- package/dist/src/lib/interfaces/entity.d.ts.map +0 -1
- package/dist/src/lib/sounds/index.d.ts +0 -3
- package/dist/src/lib/sounds/index.d.ts.map +0 -1
- package/dist/src/lib/sounds/ping-pong-sound.d.ts +0 -5
- package/dist/src/lib/sounds/ping-pong-sound.d.ts.map +0 -1
- package/dist/src/lib/sounds/ricochet-sound.d.ts +0 -5
- package/dist/src/lib/sounds/ricochet-sound.d.ts.map +0 -1
- package/dist/src/lib/stage/debug-entity-cursor.d.ts +0 -24
- package/dist/src/lib/stage/debug-entity-cursor.d.ts.map +0 -1
- package/dist/src/lib/stage/entity-spawner.d.ts +0 -9
- package/dist/src/lib/stage/entity-spawner.d.ts.map +0 -1
- package/dist/src/lib/stage/stage-camera-debug-delegate.d.ts +0 -14
- package/dist/src/lib/stage/stage-camera-debug-delegate.d.ts.map +0 -1
- package/dist/src/lib/stage/stage-debug-delegate.d.ts +0 -26
- package/dist/src/lib/stage/stage-debug-delegate.d.ts.map +0 -1
- package/dist/src/lib/stage/stage-default.d.ts +0 -3
- package/dist/src/lib/stage/stage-default.d.ts.map +0 -1
- package/dist/src/lib/stage/stage-factory.d.ts +0 -6
- package/dist/src/lib/stage/stage-factory.d.ts.map +0 -1
- package/dist/src/lib/stage/stage-manager.d.ts +0 -30
- package/dist/src/lib/stage/stage-manager.d.ts.map +0 -1
- package/dist/src/lib/stage/stage-state.d.ts +0 -14
- package/dist/src/lib/stage/stage-state.d.ts.map +0 -1
- package/dist/src/lib/stage/stage.d.ts +0 -35
- package/dist/src/lib/stage/stage.d.ts.map +0 -1
- package/dist/src/lib/stage/zylem-stage.d.ts +0 -128
- package/dist/src/lib/stage/zylem-stage.d.ts.map +0 -1
- package/dist/src/lib/systems/test-system.d.ts +0 -2
- package/dist/src/lib/systems/test-system.d.ts.map +0 -1
- package/dist/src/lib/systems/transformable.system.d.ts +0 -25
- package/dist/src/lib/systems/transformable.system.d.ts.map +0 -1
- package/dist/src/lib/types/entity-types.d.ts +0 -24
- package/dist/src/lib/types/entity-types.d.ts.map +0 -1
- package/dist/src/lib/types/index.d.ts +0 -3
- package/dist/src/lib/types/index.d.ts.map +0 -1
- package/dist/src/lib/types/stage-types.d.ts +0 -26
- package/dist/src/lib/types/stage-types.d.ts.map +0 -1
- package/dist/src/lib/ui/Debug.d.ts +0 -6
- package/dist/src/lib/ui/Debug.d.ts.map +0 -1
- package/dist/src/lib/ui/console/Console.d.ts +0 -7
- package/dist/src/lib/ui/console/Console.d.ts.map +0 -1
- package/dist/src/lib/ui/debug-panel/AccordionMenu.d.ts +0 -7
- package/dist/src/lib/ui/debug-panel/AccordionMenu.d.ts.map +0 -1
- package/dist/src/lib/ui/debug-panel/Menu.d.ts +0 -6
- package/dist/src/lib/ui/debug-panel/Menu.d.ts.map +0 -1
- package/dist/src/lib/ui/debug-panel/sections/EntitiesSection.d.ts +0 -4
- package/dist/src/lib/ui/debug-panel/sections/EntitiesSection.d.ts.map +0 -1
- package/dist/src/lib/ui/debug-panel/sections/GameSection.d.ts +0 -3
- package/dist/src/lib/ui/debug-panel/sections/GameSection.d.ts.map +0 -1
- package/dist/src/lib/ui/debug-panel/sections/StagesSection.d.ts +0 -3
- package/dist/src/lib/ui/debug-panel/sections/StagesSection.d.ts.map +0 -1
- package/dist/src/lib/ui/debug-panel/sections/all.d.ts +0 -4
- package/dist/src/lib/ui/debug-panel/sections/all.d.ts.map +0 -1
- package/dist/src/lib/ui/toolbar/Toolbar.d.ts +0 -6
- package/dist/src/lib/ui/toolbar/Toolbar.d.ts.map +0 -1
- package/dist/tests/e2e/basic-game.spec.d.ts +0 -2
- package/dist/tests/e2e/basic-game.spec.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/base-node.spec.d.ts +0 -2
- package/dist/tests/unit/core/base-node.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,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,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,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,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
|
-
};
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { BaseNode as r } from "../base-node.js";
|
|
2
|
-
import { Stage as c } from "../../stage/stage.js";
|
|
3
|
-
import { GameEntity as g } from "../../entities/entity.js";
|
|
4
|
-
async function h(i) {
|
|
5
|
-
const { getGameDefaultConfig: n } = await import("../../game/game-default.js");
|
|
6
|
-
let s = { ...n() };
|
|
7
|
-
const o = [], e = [], a = [];
|
|
8
|
-
return Object.values(i).forEach((t) => {
|
|
9
|
-
if (t instanceof c)
|
|
10
|
-
e.push(t);
|
|
11
|
-
else if (t instanceof g)
|
|
12
|
-
a.push(t);
|
|
13
|
-
else if (t instanceof r)
|
|
14
|
-
a.push(t);
|
|
15
|
-
else if (t?.constructor?.name === "Object" && typeof t == "object") {
|
|
16
|
-
const f = Object.assign({ ...n() }, { ...t });
|
|
17
|
-
o.push(f);
|
|
18
|
-
}
|
|
19
|
-
}), o.forEach((t) => {
|
|
20
|
-
s = Object.assign(s, { ...t });
|
|
21
|
-
}), e.forEach((t) => {
|
|
22
|
-
t.addEntities(a);
|
|
23
|
-
}), e.length ? s.stages = e : s.stages[0].addEntities(a), s;
|
|
24
|
-
}
|
|
25
|
-
function l(i) {
|
|
26
|
-
return !!i.find((s) => s instanceof c);
|
|
27
|
-
}
|
|
28
|
-
export {
|
|
29
|
-
h as convertNodes,
|
|
30
|
-
l as hasStages
|
|
31
|
-
};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
function o(r) {
|
|
2
|
-
const e = Object.keys(r).sort().reduce((t, n) => (t[n] = r[n], t), {});
|
|
3
|
-
return JSON.stringify(e);
|
|
4
|
-
}
|
|
5
|
-
function s(r) {
|
|
6
|
-
let e = 0;
|
|
7
|
-
for (let t = 0; t < r.length; t++)
|
|
8
|
-
e = Math.imul(31, e) + r.charCodeAt(t) | 0;
|
|
9
|
-
return e.toString(36);
|
|
10
|
-
}
|
|
11
|
-
export {
|
|
12
|
-
s as shortHash,
|
|
13
|
-
o as sortedStringify
|
|
14
|
-
};
|
package/dist/lib/core/vessel.js
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { BaseNode as t } from "./base-node.js";
|
|
2
|
-
const r = Symbol("vessel");
|
|
3
|
-
class n extends t {
|
|
4
|
-
static type = r;
|
|
5
|
-
_setup(s) {
|
|
6
|
-
}
|
|
7
|
-
async _loaded(s) {
|
|
8
|
-
}
|
|
9
|
-
_update(s) {
|
|
10
|
-
}
|
|
11
|
-
_destroy(s) {
|
|
12
|
-
}
|
|
13
|
-
async _cleanup(s) {
|
|
14
|
-
}
|
|
15
|
-
create() {
|
|
16
|
-
return this;
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
function o(...e) {
|
|
20
|
-
const s = new n();
|
|
21
|
-
return e.forEach((a) => s.add(a)), s;
|
|
22
|
-
}
|
|
23
|
-
export {
|
|
24
|
-
n as Vessel,
|
|
25
|
-
o as vessel
|
|
26
|
-
};
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { proxy as s } from "valtio/vanilla";
|
|
2
|
-
import { printToConsole as t } from "./console/console-state.js";
|
|
3
|
-
const n = {
|
|
4
|
-
NONE: "NONE",
|
|
5
|
-
SELECT: "SELECT",
|
|
6
|
-
DELETE: "DELETE"
|
|
7
|
-
}, o = s({
|
|
8
|
-
on: !1,
|
|
9
|
-
paused: !1,
|
|
10
|
-
configuration: {
|
|
11
|
-
showCollisionBounds: !1,
|
|
12
|
-
showModelBounds: !1,
|
|
13
|
-
showSpriteBounds: !1
|
|
14
|
-
},
|
|
15
|
-
hovered: null,
|
|
16
|
-
selected: [],
|
|
17
|
-
tool: n.NONE
|
|
18
|
-
}), r = (e = !1) => {
|
|
19
|
-
o.on = e;
|
|
20
|
-
}, u = (e) => {
|
|
21
|
-
o.selected.push(e);
|
|
22
|
-
}, E = () => o.tool, a = (e) => {
|
|
23
|
-
o.hovered = e;
|
|
24
|
-
}, c = () => {
|
|
25
|
-
o.hovered = null;
|
|
26
|
-
}, i = () => o.hovered, f = (e) => {
|
|
27
|
-
o.paused = e, t(e ? "Paused" : "Resumed");
|
|
28
|
-
}, p = () => o.paused;
|
|
29
|
-
export {
|
|
30
|
-
n as DebugTools,
|
|
31
|
-
o as debugState,
|
|
32
|
-
E as getDebugTool,
|
|
33
|
-
i as getHoveredEntity,
|
|
34
|
-
p as isPaused,
|
|
35
|
-
c as resetHoveredEntity,
|
|
36
|
-
r as setDebugFlag,
|
|
37
|
-
a as setHoveredEntity,
|
|
38
|
-
f as setPaused,
|
|
39
|
-
u as setSelectedEntity
|
|
40
|
-
};
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
const h = {
|
|
2
|
-
FourByThree: 1.3333333333333333,
|
|
3
|
-
SixteenByNine: 1.7777777777777777,
|
|
4
|
-
TwentyOneByNine: 2.3333333333333335,
|
|
5
|
-
OneByOne: 1
|
|
6
|
-
};
|
|
7
|
-
class a {
|
|
8
|
-
container;
|
|
9
|
-
canvas;
|
|
10
|
-
aspectRatio;
|
|
11
|
-
onResize;
|
|
12
|
-
handleResizeBound;
|
|
13
|
-
constructor(t) {
|
|
14
|
-
this.container = t.container, this.canvas = t.canvas, this.aspectRatio = (typeof t.aspectRatio == "number", t.aspectRatio), this.onResize = t.onResize, this.handleResizeBound = this.apply.bind(this);
|
|
15
|
-
}
|
|
16
|
-
/** Attach window resize listener and apply once. */
|
|
17
|
-
attach() {
|
|
18
|
-
window.addEventListener("resize", this.handleResizeBound), this.apply();
|
|
19
|
-
}
|
|
20
|
-
/** Detach window resize listener. */
|
|
21
|
-
detach() {
|
|
22
|
-
window.removeEventListener("resize", this.handleResizeBound);
|
|
23
|
-
}
|
|
24
|
-
/** Compute the largest size that fits container while preserving aspect. */
|
|
25
|
-
measure() {
|
|
26
|
-
const t = this.container.clientWidth || window.innerWidth, e = this.container.clientHeight || window.innerHeight;
|
|
27
|
-
if (t / e > this.aspectRatio) {
|
|
28
|
-
const i = e;
|
|
29
|
-
return { width: Math.round(i * this.aspectRatio), height: i };
|
|
30
|
-
} else {
|
|
31
|
-
const i = t, n = Math.round(i / this.aspectRatio);
|
|
32
|
-
return { width: i, height: n };
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
/** Apply measured size to canvas and notify. */
|
|
36
|
-
apply() {
|
|
37
|
-
const { width: t, height: e } = this.measure();
|
|
38
|
-
this.canvas.style.width = `${t}px`, this.canvas.style.height = `${e}px`, this.onResize?.(t, e);
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
export {
|
|
42
|
-
h as AspectRatio,
|
|
43
|
-
a as AspectRatioDelegate
|
|
44
|
-
};
|
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
import { ColliderDesc as l, ActiveCollisionTypes as m } from "@dimforge/rapier3d-compat";
|
|
2
|
-
import { Vector3 as r, Group as d, SkinnedMesh as u } from "three";
|
|
3
|
-
import { GameEntity as p } from "./entity.js";
|
|
4
|
-
import { createEntity as g } from "./create.js";
|
|
5
|
-
import { EntityAssetLoader as y } from "../core/entity-asset-loader.js";
|
|
6
|
-
import { AnimationDelegate as f } from "./delegates/animation.js";
|
|
7
|
-
import { EntityCollisionBuilder as b, EntityBuilder as _ } from "./builder.js";
|
|
8
|
-
const c = {
|
|
9
|
-
position: { x: 0, y: 0, z: 0 },
|
|
10
|
-
collision: {
|
|
11
|
-
static: !1,
|
|
12
|
-
size: new r(0.5, 0.5, 0.5),
|
|
13
|
-
position: new r(0, 0, 0)
|
|
14
|
-
},
|
|
15
|
-
material: {
|
|
16
|
-
shader: "standard"
|
|
17
|
-
},
|
|
18
|
-
animations: [],
|
|
19
|
-
models: []
|
|
20
|
-
};
|
|
21
|
-
class j extends b {
|
|
22
|
-
height = 1;
|
|
23
|
-
objectModel = null;
|
|
24
|
-
constructor(t) {
|
|
25
|
-
super(), this.objectModel = t.objectModel;
|
|
26
|
-
}
|
|
27
|
-
createColliderFromObjectModel(t) {
|
|
28
|
-
if (!t)
|
|
29
|
-
return l.capsule(1, 1);
|
|
30
|
-
const e = t.children.find((s) => s instanceof u).geometry;
|
|
31
|
-
if (e && (e.computeBoundingBox(), e.boundingBox)) {
|
|
32
|
-
const s = e.boundingBox.max.y, h = e.boundingBox.min.y;
|
|
33
|
-
this.height = s - h;
|
|
34
|
-
}
|
|
35
|
-
this.height = 1;
|
|
36
|
-
let o = l.capsule(this.height / 2, 1);
|
|
37
|
-
return o.setSensor(!1), o.setTranslation(0, this.height + 0.5, 0), o.activeCollisionTypes = m.DEFAULT, o;
|
|
38
|
-
}
|
|
39
|
-
collider(t) {
|
|
40
|
-
return this.createColliderFromObjectModel(this.objectModel);
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
class C extends _ {
|
|
44
|
-
createEntity(t) {
|
|
45
|
-
return new a(t);
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
const D = Symbol("Actor");
|
|
49
|
-
class a extends p {
|
|
50
|
-
static type = D;
|
|
51
|
-
_object = null;
|
|
52
|
-
_animationDelegate = null;
|
|
53
|
-
_modelFileNames = [];
|
|
54
|
-
_assetLoader = new y();
|
|
55
|
-
controlledRotation = !1;
|
|
56
|
-
constructor(t) {
|
|
57
|
-
super(), this.options = { ...c, ...t }, this.lifeCycleDelegate = {
|
|
58
|
-
update: [this.actorUpdate.bind(this)]
|
|
59
|
-
}, this.controlledRotation = !0;
|
|
60
|
-
}
|
|
61
|
-
async load() {
|
|
62
|
-
this._modelFileNames = this.options.models || [], await this.loadModels(), this._object && (this._animationDelegate = new f(this._object), await this._animationDelegate.loadAnimations(this.options.animations || []));
|
|
63
|
-
}
|
|
64
|
-
async data() {
|
|
65
|
-
return {
|
|
66
|
-
animations: this._animationDelegate?.animations,
|
|
67
|
-
objectModel: this._object
|
|
68
|
-
};
|
|
69
|
-
}
|
|
70
|
-
async actorUpdate(t) {
|
|
71
|
-
this._animationDelegate?.update(t.delta);
|
|
72
|
-
}
|
|
73
|
-
async loadModels() {
|
|
74
|
-
if (this._modelFileNames.length === 0)
|
|
75
|
-
return;
|
|
76
|
-
const t = this._modelFileNames.map((e) => this._assetLoader.loadFile(e)), i = await Promise.all(t);
|
|
77
|
-
i[0]?.object && (this._object = i[0].object), this._object && (this.group = new d(), this.group.attach(this._object), this.group.scale.set(this.options.scale?.x || 1, this.options.scale?.y || 1, this.options.scale?.z || 1));
|
|
78
|
-
}
|
|
79
|
-
playAnimation(t) {
|
|
80
|
-
this._animationDelegate?.playAnimation(t);
|
|
81
|
-
}
|
|
82
|
-
get object() {
|
|
83
|
-
return this._object;
|
|
84
|
-
}
|
|
85
|
-
/**
|
|
86
|
-
* Provide custom debug information for the actor
|
|
87
|
-
* This will be merged with the default debug information
|
|
88
|
-
*/
|
|
89
|
-
getDebugInfo() {
|
|
90
|
-
const t = {
|
|
91
|
-
type: "Actor",
|
|
92
|
-
models: this._modelFileNames.length > 0 ? this._modelFileNames : "none",
|
|
93
|
-
modelLoaded: !!this._object,
|
|
94
|
-
scale: this.options.scale ? `${this.options.scale.x}, ${this.options.scale.y}, ${this.options.scale.z}` : "1, 1, 1"
|
|
95
|
-
};
|
|
96
|
-
if (this._animationDelegate && (t.currentAnimation = this._animationDelegate.currentAnimationKey || "none", t.animationsCount = this.options.animations?.length || 0), this._object) {
|
|
97
|
-
let i = 0, e = 0;
|
|
98
|
-
this._object.traverse((o) => {
|
|
99
|
-
if (o.isMesh) {
|
|
100
|
-
i++;
|
|
101
|
-
const s = o.geometry;
|
|
102
|
-
s && s.attributes.position && (e += s.attributes.position.count);
|
|
103
|
-
}
|
|
104
|
-
}), t.meshCount = i, t.vertexCount = e;
|
|
105
|
-
}
|
|
106
|
-
return t;
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
async function T(...n) {
|
|
110
|
-
return await g({
|
|
111
|
-
args: n,
|
|
112
|
-
defaultConfig: c,
|
|
113
|
-
EntityClass: a,
|
|
114
|
-
BuilderClass: C,
|
|
115
|
-
CollisionBuilderClass: j,
|
|
116
|
-
entityType: a.type
|
|
117
|
-
});
|
|
118
|
-
}
|
|
119
|
-
export {
|
|
120
|
-
a as ZylemActor,
|
|
121
|
-
T as actor
|
|
122
|
-
};
|
package/dist/lib/entities/box.js
DELETED
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import { ColliderDesc as a } from "@dimforge/rapier3d-compat";
|
|
2
|
-
import { Color as d, Vector3 as n, BoxGeometry as u } from "three";
|
|
3
|
-
import { GameEntity as y } from "./entity.js";
|
|
4
|
-
import { EntityCollisionBuilder as f, EntityBuilder as x, EntityMeshBuilder as m } from "./builder.js";
|
|
5
|
-
import { DebugDelegate as p } from "./delegates/debug.js";
|
|
6
|
-
import { createEntity as z } from "./create.js";
|
|
7
|
-
const l = {
|
|
8
|
-
size: new n(1, 1, 1),
|
|
9
|
-
position: new n(0, 0, 0),
|
|
10
|
-
collision: {
|
|
11
|
-
static: !1
|
|
12
|
-
},
|
|
13
|
-
material: {
|
|
14
|
-
color: new d("#ffffff"),
|
|
15
|
-
shader: "standard"
|
|
16
|
-
}
|
|
17
|
-
};
|
|
18
|
-
class B extends f {
|
|
19
|
-
collider(t) {
|
|
20
|
-
const e = t.size || new n(1, 1, 1), s = { x: e.x / 2, y: e.y / 2, z: e.z / 2 };
|
|
21
|
-
return a.cuboid(s.x, s.y, s.z);
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
class b extends m {
|
|
25
|
-
build(t) {
|
|
26
|
-
const e = t.size ?? new n(1, 1, 1);
|
|
27
|
-
return new u(e.x, e.y, e.z);
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
class C extends x {
|
|
31
|
-
createEntity(t) {
|
|
32
|
-
return new i(t);
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
const h = Symbol("Box");
|
|
36
|
-
class i extends y {
|
|
37
|
-
static type = h;
|
|
38
|
-
constructor(t) {
|
|
39
|
-
super(), this.options = { ...l, ...t };
|
|
40
|
-
}
|
|
41
|
-
buildInfo() {
|
|
42
|
-
const e = new p(this).buildDebugInfo(), { x: s, y: r, z: c } = this.options.size ?? { x: 1, y: 1, z: 1 };
|
|
43
|
-
return {
|
|
44
|
-
...e,
|
|
45
|
-
type: String(i.type),
|
|
46
|
-
size: `${s}, ${r}, ${c}`
|
|
47
|
-
};
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
async function $(...o) {
|
|
51
|
-
return z({
|
|
52
|
-
args: o,
|
|
53
|
-
defaultConfig: l,
|
|
54
|
-
EntityClass: i,
|
|
55
|
-
BuilderClass: C,
|
|
56
|
-
MeshBuilderClass: b,
|
|
57
|
-
CollisionBuilderClass: B,
|
|
58
|
-
entityType: i.type
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
export {
|
|
62
|
-
h as BOX_TYPE,
|
|
63
|
-
C as BoxBuilder,
|
|
64
|
-
B as BoxCollisionBuilder,
|
|
65
|
-
b as BoxMeshBuilder,
|
|
66
|
-
i as ZylemBox,
|
|
67
|
-
$ as box
|
|
68
|
-
};
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
import { Mesh as l, Color as n, BufferGeometry as u } from "three";
|
|
2
|
-
import { CollisionBuilder as h } from "../collision/collision-builder.js";
|
|
3
|
-
import { MeshBuilder as m } from "../graphics/mesh.js";
|
|
4
|
-
import { MaterialBuilder as d } from "../graphics/material.js";
|
|
5
|
-
class y extends h {
|
|
6
|
-
}
|
|
7
|
-
class b extends m {
|
|
8
|
-
build(i) {
|
|
9
|
-
return new u();
|
|
10
|
-
}
|
|
11
|
-
postBuild() {
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
class M {
|
|
15
|
-
meshBuilder;
|
|
16
|
-
collisionBuilder;
|
|
17
|
-
materialBuilder;
|
|
18
|
-
options;
|
|
19
|
-
entity;
|
|
20
|
-
constructor(i, s, t, e) {
|
|
21
|
-
this.options = i, this.entity = s, this.meshBuilder = t, this.collisionBuilder = e, this.materialBuilder = new d();
|
|
22
|
-
const o = {
|
|
23
|
-
meshBuilder: this.meshBuilder,
|
|
24
|
-
collisionBuilder: this.collisionBuilder,
|
|
25
|
-
materialBuilder: this.materialBuilder
|
|
26
|
-
};
|
|
27
|
-
this.options._builders = o;
|
|
28
|
-
}
|
|
29
|
-
withPosition(i) {
|
|
30
|
-
return this.options.position = i, this;
|
|
31
|
-
}
|
|
32
|
-
async withMaterial(i, s) {
|
|
33
|
-
return this.materialBuilder && await this.materialBuilder.build(i, s), this;
|
|
34
|
-
}
|
|
35
|
-
applyMaterialToGroup(i, s) {
|
|
36
|
-
i.traverse((t) => {
|
|
37
|
-
t instanceof l && t.type === "SkinnedMesh" && s[0] && !t.material.map && (t.material = s[0]), t.castShadow = !0, t.receiveShadow = !0;
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
async build() {
|
|
41
|
-
const i = this.entity;
|
|
42
|
-
if (this.materialBuilder && (i.materials = this.materialBuilder.materials), this.meshBuilder && i.materials) {
|
|
43
|
-
const s = this.meshBuilder.build(this.options);
|
|
44
|
-
i.mesh = this.meshBuilder._build(this.options, s, i.materials), this.meshBuilder.postBuild();
|
|
45
|
-
}
|
|
46
|
-
if (i.group && i.materials && this.applyMaterialToGroup(i.group, i.materials), this.collisionBuilder) {
|
|
47
|
-
this.collisionBuilder.withCollision(this.options?.collision || {});
|
|
48
|
-
const [s, t] = this.collisionBuilder.build(this.options);
|
|
49
|
-
i.bodyDesc = s, i.colliderDesc = t;
|
|
50
|
-
const { x: e, y: o, z: a } = this.options.position || { x: 0, y: 0, z: 0 };
|
|
51
|
-
i.bodyDesc.setTranslation(e, o, a);
|
|
52
|
-
}
|
|
53
|
-
if (this.options.collisionType && (i.collisionType = this.options.collisionType), this.options.color instanceof n) {
|
|
54
|
-
const s = (t) => {
|
|
55
|
-
const e = t;
|
|
56
|
-
e && e.color && e.color.set && e.color.set(this.options.color);
|
|
57
|
-
};
|
|
58
|
-
if (i.materials?.length)
|
|
59
|
-
for (const t of i.materials)
|
|
60
|
-
s(t);
|
|
61
|
-
if (i.mesh && i.mesh.material) {
|
|
62
|
-
const t = i.mesh.material;
|
|
63
|
-
Array.isArray(t) ? t.forEach(s) : s(t);
|
|
64
|
-
}
|
|
65
|
-
i.group && i.group.traverse((t) => {
|
|
66
|
-
if (t instanceof l && t.material) {
|
|
67
|
-
const e = t.material;
|
|
68
|
-
Array.isArray(e) ? e.forEach(s) : s(e);
|
|
69
|
-
}
|
|
70
|
-
});
|
|
71
|
-
}
|
|
72
|
-
return i;
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
export {
|
|
76
|
-
M as EntityBuilder,
|
|
77
|
-
y as EntityCollisionBuilder,
|
|
78
|
-
b as EntityMeshBuilder
|
|
79
|
-
};
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { BaseNode as s } from "../core/base-node.js";
|
|
2
|
-
import { isLoadable as p, EntityLoader as C } from "./delegates/loader.js";
|
|
3
|
-
async function E(w) {
|
|
4
|
-
const { args: n, defaultConfig: l, EntityClass: g, BuilderClass: y, entityType: c, MeshBuilderClass: f, CollisionBuilderClass: d } = w;
|
|
5
|
-
let e = null, r;
|
|
6
|
-
const u = n.findIndex((i) => !(i instanceof s));
|
|
7
|
-
u !== -1 && (r = n.splice(u, 1).find((t) => !(t instanceof s)));
|
|
8
|
-
const m = r ? { ...l, ...r } : l;
|
|
9
|
-
n.push(m);
|
|
10
|
-
for (const i of n) {
|
|
11
|
-
if (i instanceof s)
|
|
12
|
-
continue;
|
|
13
|
-
let t = null;
|
|
14
|
-
const a = new g(i);
|
|
15
|
-
try {
|
|
16
|
-
if (p(a)) {
|
|
17
|
-
const o = new C(a);
|
|
18
|
-
await o.load(), t = await o.data();
|
|
19
|
-
}
|
|
20
|
-
} catch (o) {
|
|
21
|
-
console.error("Error creating entity with loader:", o);
|
|
22
|
-
}
|
|
23
|
-
e = new y(i, a, f ? new f(t) : null, d ? new d(t) : null), i.material && await e.withMaterial(i.material, c);
|
|
24
|
-
}
|
|
25
|
-
if (!e)
|
|
26
|
-
throw new Error(`missing options for ${String(c)}, builder is not initialized.`);
|
|
27
|
-
return await e.build();
|
|
28
|
-
}
|
|
29
|
-
export {
|
|
30
|
-
E as createEntity
|
|
31
|
-
};
|