@zylem/game-lib 0.5.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/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 +106 -0
- package/dist/behaviors.js +396 -6
- package/dist/behaviors.js.map +1 -0
- package/dist/blueprints-BOCc3Wve.d.ts +26 -0
- package/dist/{src/lib/camera/zylem-camera.d.ts → camera-CpbDr4-V.d.ts} +48 -27
- package/dist/camera.d.ts +5 -0
- package/dist/camera.js +608 -4
- package/dist/camera.js.map +1 -0
- package/dist/core-CZhozNRH.d.ts +466 -0
- package/dist/core.d.ts +10 -0
- package/dist/core.js +5761 -9
- package/dist/core.js.map +1 -0
- package/dist/entities-BAxfJOkk.d.ts +307 -0
- package/dist/entities.d.ts +6 -0
- package/dist/entities.js +2284 -17
- package/dist/entities.js.map +1 -0
- package/dist/{src/lib/interfaces/entity.d.ts → entity-Bq_eNEDI.d.ts} +8 -6
- package/dist/entity-COvRtFNG.d.ts +395 -0
- package/dist/main.d.ts +211 -0
- package/dist/main.js +7600 -56
- package/dist/main.js.map +1 -0
- package/dist/moveable-B_vyA6cw.d.ts +67 -0
- package/dist/stage-types-CD21XoIU.d.ts +338 -0
- package/dist/stage.d.ts +46 -0
- package/dist/stage.js +2765 -4
- package/dist/stage.js.map +1 -0
- package/dist/transformable-CUhvyuYO.d.ts +67 -0
- package/package.json +11 -47
- 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.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,82 +0,0 @@
|
|
|
1
|
-
import { Vector3 as g, Euler as i, MathUtils as a, Quaternion as l } from "three";
|
|
2
|
-
function b(o, t) {
|
|
3
|
-
if (!o.body)
|
|
4
|
-
return;
|
|
5
|
-
const e = Math.atan2(-t.x, t.z);
|
|
6
|
-
c(o, e);
|
|
7
|
-
}
|
|
8
|
-
function c(o, t) {
|
|
9
|
-
f(o, new g(0, -t, 0));
|
|
10
|
-
}
|
|
11
|
-
function f(o, t) {
|
|
12
|
-
if (!o.group)
|
|
13
|
-
return;
|
|
14
|
-
const e = new i(t.x, t.y, t.z);
|
|
15
|
-
o.group.setRotationFromEuler(e);
|
|
16
|
-
}
|
|
17
|
-
function h(o, t) {
|
|
18
|
-
s(o, t);
|
|
19
|
-
}
|
|
20
|
-
function D(o, t) {
|
|
21
|
-
u(o, t);
|
|
22
|
-
}
|
|
23
|
-
function s(o, t) {
|
|
24
|
-
if (!o.body)
|
|
25
|
-
return;
|
|
26
|
-
const e = t / 2, r = Math.cos(e), n = Math.sin(e);
|
|
27
|
-
o.body.setRotation({ w: r, x: 0, y: n, z: 0 }, !0);
|
|
28
|
-
}
|
|
29
|
-
function w(o, t) {
|
|
30
|
-
o.body && s(o, a.degToRad(t));
|
|
31
|
-
}
|
|
32
|
-
function R(o, t) {
|
|
33
|
-
if (!o.body)
|
|
34
|
-
return;
|
|
35
|
-
const e = t / 2, r = Math.cos(e), n = Math.sin(e);
|
|
36
|
-
o.body.setRotation({ w: r, x: n, y: 0, z: 0 }, !0);
|
|
37
|
-
}
|
|
38
|
-
function x(o, t) {
|
|
39
|
-
o.body && R(o, a.degToRad(t));
|
|
40
|
-
}
|
|
41
|
-
function u(o, t) {
|
|
42
|
-
if (!o.body)
|
|
43
|
-
return;
|
|
44
|
-
const e = t / 2, r = Math.cos(e), n = Math.sin(e);
|
|
45
|
-
o.body.setRotation({ w: r, x: 0, y: 0, z: n }, !0);
|
|
46
|
-
}
|
|
47
|
-
function z(o, t) {
|
|
48
|
-
o.body && u(o, a.degToRad(t));
|
|
49
|
-
}
|
|
50
|
-
function d(o, t, e, r) {
|
|
51
|
-
if (!o.body)
|
|
52
|
-
return;
|
|
53
|
-
const n = new l().setFromEuler(new i(t, e, r));
|
|
54
|
-
o.body.setRotation({ w: n.w, x: n.x, y: n.y, z: n.z }, !0);
|
|
55
|
-
}
|
|
56
|
-
function E(o, t, e, r) {
|
|
57
|
-
o.body && d(o, a.degToRad(t), a.degToRad(e), a.degToRad(r));
|
|
58
|
-
}
|
|
59
|
-
function M(o) {
|
|
60
|
-
return o.body ? o.body.rotation() : null;
|
|
61
|
-
}
|
|
62
|
-
function m(o) {
|
|
63
|
-
const t = o;
|
|
64
|
-
return t.rotateInDirection = (e) => b(o, e), t.rotateYEuler = (e) => c(o, e), t.rotateEuler = (e) => f(o, e), t.rotateY = (e) => h(o, e), t.rotateZ = (e) => D(o, e), t.setRotationY = (e) => s(o, e), t.setRotationX = (e) => R(o, e), t.setRotationZ = (e) => u(o, e), t.setRotationDegreesY = (e) => w(o, e), t.setRotationDegreesX = (e) => x(o, e), t.setRotationDegreesZ = (e) => z(o, e), t.setRotationDegrees = (e, r, n) => E(o, e, r, n), t.setRotation = (e, r, n) => d(o, e, r, n), t.getRotation = () => M(o), t;
|
|
65
|
-
}
|
|
66
|
-
export {
|
|
67
|
-
M as getRotation,
|
|
68
|
-
m as makeRotatable,
|
|
69
|
-
f as rotateEuler,
|
|
70
|
-
b as rotateInDirection,
|
|
71
|
-
h as rotateY,
|
|
72
|
-
c as rotateYEuler,
|
|
73
|
-
D as rotateZ,
|
|
74
|
-
d as setRotation,
|
|
75
|
-
E as setRotationDegrees,
|
|
76
|
-
x as setRotationDegreesX,
|
|
77
|
-
w as setRotationDegreesY,
|
|
78
|
-
z as setRotationDegreesZ,
|
|
79
|
-
R as setRotationX,
|
|
80
|
-
s as setRotationY,
|
|
81
|
-
u as setRotationZ
|
|
82
|
-
};
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
function v(r, l) {
|
|
2
|
-
let n;
|
|
3
|
-
return (a) => {
|
|
4
|
-
const e = a.globals?.[r];
|
|
5
|
-
n !== e && (n === void 0 && e === void 0 || l(e, a), n = e);
|
|
6
|
-
};
|
|
7
|
-
}
|
|
8
|
-
function d(r, l) {
|
|
9
|
-
let n = new Array(r.length).fill(void 0);
|
|
10
|
-
return (a) => {
|
|
11
|
-
const e = r.map((t) => a.globals?.[t]);
|
|
12
|
-
if (e.some((t, o) => n[o] !== t)) {
|
|
13
|
-
const t = n.every((i) => i === void 0), o = e.every((i) => i === void 0);
|
|
14
|
-
t && o || l(e, a), n = e;
|
|
15
|
-
}
|
|
16
|
-
};
|
|
17
|
-
}
|
|
18
|
-
function f(r, l) {
|
|
19
|
-
let n;
|
|
20
|
-
return (a) => {
|
|
21
|
-
const e = a.stage?.getVariable?.(r) ?? void 0;
|
|
22
|
-
n !== e && (n === void 0 && e === void 0 || l(e, a), n = e);
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
function g(r, l) {
|
|
26
|
-
let n = new Array(r.length).fill(void 0);
|
|
27
|
-
return (a) => {
|
|
28
|
-
const e = (o) => a.stage?.getVariable?.(o), s = r.map(e);
|
|
29
|
-
if (s.some((o, i) => n[i] !== o)) {
|
|
30
|
-
const o = n.every((u) => u === void 0), i = s.every((u) => u === void 0);
|
|
31
|
-
o && i || l(s, a), n = s;
|
|
32
|
-
}
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
export {
|
|
36
|
-
v as globalChange,
|
|
37
|
-
d as globalChanges,
|
|
38
|
-
f as variableChange,
|
|
39
|
-
g as variableChanges
|
|
40
|
-
};
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { Vector2 as c, Vector3 as a } from "three";
|
|
2
|
-
import { ZylemCamera as m } from "./zylem-camera.js";
|
|
3
|
-
class o {
|
|
4
|
-
cameraRef;
|
|
5
|
-
constructor(r) {
|
|
6
|
-
this.cameraRef = r;
|
|
7
|
-
}
|
|
8
|
-
}
|
|
9
|
-
function w(e) {
|
|
10
|
-
const r = e.screenResolution || new c(window.innerWidth, window.innerHeight);
|
|
11
|
-
let n = 10;
|
|
12
|
-
e.perspective === "fixed-2d" && (n = e.zoom || 10);
|
|
13
|
-
const t = new m(e.perspective || "third-person", r, n);
|
|
14
|
-
return t.move(e.position || new a(0, 0, 0)), t.camera.lookAt(e.target || new a(0, 0, 0)), new o(t);
|
|
15
|
-
}
|
|
16
|
-
export {
|
|
17
|
-
o as CameraWrapper,
|
|
18
|
-
w as camera
|
|
19
|
-
};
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
class c {
|
|
2
|
-
screenResolution = null;
|
|
3
|
-
renderer = null;
|
|
4
|
-
scene = null;
|
|
5
|
-
cameraRef = null;
|
|
6
|
-
constructor() {
|
|
7
|
-
}
|
|
8
|
-
/**
|
|
9
|
-
* Setup the fixed 2D camera controller
|
|
10
|
-
*/
|
|
11
|
-
setup(e) {
|
|
12
|
-
const { screenResolution: s, renderer: r, scene: t, camera: n } = e;
|
|
13
|
-
this.screenResolution = s, this.renderer = r, this.scene = t, this.cameraRef = n, this.cameraRef.camera.position.set(0, 0, 10), this.cameraRef.camera.lookAt(0, 0, 0);
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* Update the fixed 2D camera
|
|
17
|
-
* Fixed cameras don't need to update position/rotation automatically
|
|
18
|
-
*/
|
|
19
|
-
update(e) {
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Handle resize events for 2D camera
|
|
23
|
-
*/
|
|
24
|
-
resize(e, s) {
|
|
25
|
-
this.screenResolution && this.screenResolution.set(e, s);
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
export {
|
|
29
|
-
c as Fixed2DCamera
|
|
30
|
-
};
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { Vector3 as a } from "three";
|
|
2
|
-
class c {
|
|
3
|
-
distance;
|
|
4
|
-
screenResolution = null;
|
|
5
|
-
renderer = null;
|
|
6
|
-
scene = null;
|
|
7
|
-
cameraRef = null;
|
|
8
|
-
constructor() {
|
|
9
|
-
this.distance = new a(0, 5, 8);
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* Setup the third person camera controller
|
|
13
|
-
*/
|
|
14
|
-
setup(e) {
|
|
15
|
-
const { screenResolution: t, renderer: s, scene: r, camera: i } = e;
|
|
16
|
-
this.screenResolution = t, this.renderer = s, this.scene = r, this.cameraRef = i;
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* Update the third person camera
|
|
20
|
-
*/
|
|
21
|
-
update(e) {
|
|
22
|
-
if (!this.cameraRef.target)
|
|
23
|
-
return;
|
|
24
|
-
const t = this.cameraRef.target.group.position.clone().add(this.distance);
|
|
25
|
-
this.cameraRef.camera.position.lerp(t, 0.1), this.cameraRef.camera.lookAt(this.cameraRef.target.group.position);
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* Handle resize events
|
|
29
|
-
*/
|
|
30
|
-
resize(e, t) {
|
|
31
|
-
this.screenResolution && this.screenResolution.set(e, t);
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Set the distance from the target
|
|
35
|
-
*/
|
|
36
|
-
setDistance(e) {
|
|
37
|
-
this.distance = e;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
export {
|
|
41
|
-
c as ThirdPersonCamera
|
|
42
|
-
};
|
|
@@ -1,208 +0,0 @@
|
|
|
1
|
-
import { Vector3 as a, WebGLRenderer as c, Object3D as u, PerspectiveCamera as o, OrthographicCamera as n } from "three";
|
|
2
|
-
import { OrbitControls as l } from "three/addons/controls/OrbitControls.js";
|
|
3
|
-
import { Perspectives as s } from "./perspective.js";
|
|
4
|
-
import { ThirdPersonCamera as h } from "./third-person.js";
|
|
5
|
-
import { Fixed2DCamera as m } from "./fixed-2d.js";
|
|
6
|
-
import { EffectComposer as b } from "three/examples/jsm/postprocessing/EffectComposer.js";
|
|
7
|
-
import d from "../graphics/render-pass.js";
|
|
8
|
-
class F {
|
|
9
|
-
cameraRig;
|
|
10
|
-
camera;
|
|
11
|
-
screenResolution;
|
|
12
|
-
renderer;
|
|
13
|
-
composer;
|
|
14
|
-
_perspective;
|
|
15
|
-
orbitControls = null;
|
|
16
|
-
target = null;
|
|
17
|
-
sceneRef = null;
|
|
18
|
-
frustumSize = 10;
|
|
19
|
-
// Perspective controller delegation
|
|
20
|
-
perspectiveController = null;
|
|
21
|
-
debugDelegate = null;
|
|
22
|
-
debugUnsubscribe = null;
|
|
23
|
-
debugStateSnapshot = { enabled: !1, selected: [] };
|
|
24
|
-
orbitTarget = null;
|
|
25
|
-
orbitTargetWorldPos = new a();
|
|
26
|
-
constructor(e, t, r = 10) {
|
|
27
|
-
this._perspective = e, this.screenResolution = t, this.frustumSize = r, this.renderer = new c({ antialias: !1, alpha: !0 }), this.renderer.setSize(t.x, t.y), this.renderer.shadowMap.enabled = !0, this.composer = new b(this.renderer);
|
|
28
|
-
const i = t.x / t.y;
|
|
29
|
-
this.camera = this.createCameraForPerspective(i), this.cameraRig = new u(), this.cameraRig.position.set(0, 3, 10), this.cameraRig.add(this.camera), this.camera.lookAt(new a(0, 2, 0)), this.initializePerspectiveController();
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* Setup the camera with a scene
|
|
33
|
-
*/
|
|
34
|
-
async setup(e) {
|
|
35
|
-
this.sceneRef = e, this.orbitControls === null && (this.orbitControls = new l(this.camera, this.renderer.domElement), this.orbitControls.enableDamping = !0, this.orbitControls.dampingFactor = 0.05, this.orbitControls.screenSpacePanning = !1, this.orbitControls.minDistance = 1, this.orbitControls.maxDistance = 500, this.orbitControls.maxPolarAngle = Math.PI / 2);
|
|
36
|
-
let t = this.screenResolution.clone().divideScalar(2);
|
|
37
|
-
t.x |= 0, t.y |= 0;
|
|
38
|
-
const r = new d(t, e, this.camera);
|
|
39
|
-
this.composer.addPass(r), this.perspectiveController && this.perspectiveController.setup({
|
|
40
|
-
screenResolution: this.screenResolution,
|
|
41
|
-
renderer: this.renderer,
|
|
42
|
-
scene: e,
|
|
43
|
-
camera: this
|
|
44
|
-
}), this.renderer.setAnimationLoop((i) => {
|
|
45
|
-
this.update(i || 0);
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* Update camera and render
|
|
50
|
-
*/
|
|
51
|
-
update(e) {
|
|
52
|
-
this.orbitControls && this.orbitTarget && (this.orbitTarget.getWorldPosition(this.orbitTargetWorldPos), this.orbitControls.target.copy(this.orbitTargetWorldPos)), this.orbitControls?.update(), this.perspectiveController && this.perspectiveController.update(e), this.composer.render(e);
|
|
53
|
-
}
|
|
54
|
-
/**
|
|
55
|
-
* Dispose renderer, composer, controls, and detach from scene
|
|
56
|
-
*/
|
|
57
|
-
destroy() {
|
|
58
|
-
try {
|
|
59
|
-
this.renderer.setAnimationLoop(null);
|
|
60
|
-
} catch {
|
|
61
|
-
}
|
|
62
|
-
try {
|
|
63
|
-
this.disableOrbitControls();
|
|
64
|
-
} catch {
|
|
65
|
-
}
|
|
66
|
-
try {
|
|
67
|
-
this.composer?.passes?.forEach((e) => e.dispose?.()), this.composer?.dispose?.();
|
|
68
|
-
} catch {
|
|
69
|
-
}
|
|
70
|
-
try {
|
|
71
|
-
this.renderer.dispose();
|
|
72
|
-
} catch {
|
|
73
|
-
}
|
|
74
|
-
this.detachDebugDelegate(), this.sceneRef = null;
|
|
75
|
-
}
|
|
76
|
-
/**
|
|
77
|
-
* Attach a delegate to react to debug state changes.
|
|
78
|
-
*/
|
|
79
|
-
setDebugDelegate(e) {
|
|
80
|
-
if (this.debugDelegate === e)
|
|
81
|
-
return;
|
|
82
|
-
if (this.detachDebugDelegate(), this.debugDelegate = e, !e) {
|
|
83
|
-
this.applyDebugState({ enabled: !1, selected: [] });
|
|
84
|
-
return;
|
|
85
|
-
}
|
|
86
|
-
const t = e.subscribe((r) => {
|
|
87
|
-
this.applyDebugState(r);
|
|
88
|
-
});
|
|
89
|
-
this.debugUnsubscribe = () => {
|
|
90
|
-
t?.();
|
|
91
|
-
};
|
|
92
|
-
}
|
|
93
|
-
/**
|
|
94
|
-
* Resize camera and renderer
|
|
95
|
-
*/
|
|
96
|
-
resize(e, t) {
|
|
97
|
-
this.screenResolution.set(e, t), this.renderer.setSize(e, t, !1), this.composer.setSize(e, t), this.camera instanceof o && (this.camera.aspect = e / t, this.camera.updateProjectionMatrix()), this.perspectiveController && this.perspectiveController.resize(e, t);
|
|
98
|
-
}
|
|
99
|
-
/**
|
|
100
|
-
* Update renderer pixel ratio (DPR)
|
|
101
|
-
*/
|
|
102
|
-
setPixelRatio(e) {
|
|
103
|
-
const t = Math.max(1, Number.isFinite(e) ? e : 1);
|
|
104
|
-
this.renderer.setPixelRatio(t);
|
|
105
|
-
}
|
|
106
|
-
/**
|
|
107
|
-
* Create camera based on perspective type
|
|
108
|
-
*/
|
|
109
|
-
createCameraForPerspective(e) {
|
|
110
|
-
switch (this._perspective) {
|
|
111
|
-
case s.ThirdPerson:
|
|
112
|
-
return this.createThirdPersonCamera(e);
|
|
113
|
-
case s.FirstPerson:
|
|
114
|
-
return this.createFirstPersonCamera(e);
|
|
115
|
-
case s.Isometric:
|
|
116
|
-
return this.createIsometricCamera(e);
|
|
117
|
-
case s.Flat2D:
|
|
118
|
-
return this.createFlat2DCamera(e);
|
|
119
|
-
case s.Fixed2D:
|
|
120
|
-
return this.createFixed2DCamera(e);
|
|
121
|
-
default:
|
|
122
|
-
return this.createThirdPersonCamera(e);
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
/**
|
|
126
|
-
* Initialize perspective-specific controller
|
|
127
|
-
*/
|
|
128
|
-
initializePerspectiveController() {
|
|
129
|
-
switch (this._perspective) {
|
|
130
|
-
case s.ThirdPerson:
|
|
131
|
-
this.perspectiveController = new h();
|
|
132
|
-
break;
|
|
133
|
-
case s.Fixed2D:
|
|
134
|
-
this.perspectiveController = new m();
|
|
135
|
-
break;
|
|
136
|
-
default:
|
|
137
|
-
this.perspectiveController = new h();
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
createThirdPersonCamera(e) {
|
|
141
|
-
return new o(75, e, 0.1, 1e3);
|
|
142
|
-
}
|
|
143
|
-
createFirstPersonCamera(e) {
|
|
144
|
-
return new o(75, e, 0.1, 1e3);
|
|
145
|
-
}
|
|
146
|
-
createIsometricCamera(e) {
|
|
147
|
-
return new n(this.frustumSize * e / -2, this.frustumSize * e / 2, this.frustumSize / 2, this.frustumSize / -2, 1, 1e3);
|
|
148
|
-
}
|
|
149
|
-
createFlat2DCamera(e) {
|
|
150
|
-
return new n(this.frustumSize * e / -2, this.frustumSize * e / 2, this.frustumSize / 2, this.frustumSize / -2, 1, 1e3);
|
|
151
|
-
}
|
|
152
|
-
createFixed2DCamera(e) {
|
|
153
|
-
return this.createFlat2DCamera(e);
|
|
154
|
-
}
|
|
155
|
-
// Movement methods
|
|
156
|
-
moveCamera(e) {
|
|
157
|
-
(this._perspective === s.Flat2D || this._perspective === s.Fixed2D) && (this.frustumSize = e.z), this.cameraRig.position.set(e.x, e.y, e.z);
|
|
158
|
-
}
|
|
159
|
-
move(e) {
|
|
160
|
-
this.moveCamera(e);
|
|
161
|
-
}
|
|
162
|
-
rotate(e, t, r) {
|
|
163
|
-
this.cameraRig.rotateX(e), this.cameraRig.rotateY(t), this.cameraRig.rotateZ(r);
|
|
164
|
-
}
|
|
165
|
-
/**
|
|
166
|
-
* Get the DOM element for the renderer
|
|
167
|
-
*/
|
|
168
|
-
getDomElement() {
|
|
169
|
-
return this.renderer.domElement;
|
|
170
|
-
}
|
|
171
|
-
applyDebugState(e) {
|
|
172
|
-
this.debugStateSnapshot = {
|
|
173
|
-
enabled: e.enabled,
|
|
174
|
-
selected: [...e.selected]
|
|
175
|
-
}, e.enabled ? (this.enableOrbitControls(), this.updateOrbitTargetFromSelection(e.selected)) : (this.orbitTarget = null, this.disableOrbitControls());
|
|
176
|
-
}
|
|
177
|
-
enableOrbitControls() {
|
|
178
|
-
this.orbitControls || (this.orbitControls = new l(this.camera, this.renderer.domElement), this.orbitControls.enableDamping = !0, this.orbitControls.dampingFactor = 0.05, this.orbitControls.screenSpacePanning = !1, this.orbitControls.minDistance = 1, this.orbitControls.maxDistance = 500, this.orbitControls.maxPolarAngle = Math.PI / 2);
|
|
179
|
-
}
|
|
180
|
-
disableOrbitControls() {
|
|
181
|
-
this.orbitControls && (this.orbitControls.dispose(), this.orbitControls = null);
|
|
182
|
-
}
|
|
183
|
-
updateOrbitTargetFromSelection(e) {
|
|
184
|
-
if (!this.debugDelegate || e.length === 0) {
|
|
185
|
-
this.orbitTarget = null;
|
|
186
|
-
return;
|
|
187
|
-
}
|
|
188
|
-
for (let t = e.length - 1; t >= 0; t -= 1) {
|
|
189
|
-
const r = e[t], i = this.debugDelegate.resolveTarget(r);
|
|
190
|
-
if (i) {
|
|
191
|
-
this.orbitTarget = i, this.orbitControls && (i.getWorldPosition(this.orbitTargetWorldPos), this.orbitControls.target.copy(this.orbitTargetWorldPos));
|
|
192
|
-
return;
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
this.orbitTarget = null;
|
|
196
|
-
}
|
|
197
|
-
detachDebugDelegate() {
|
|
198
|
-
if (this.debugUnsubscribe)
|
|
199
|
-
try {
|
|
200
|
-
this.debugUnsubscribe();
|
|
201
|
-
} catch {
|
|
202
|
-
}
|
|
203
|
-
this.debugUnsubscribe = null, this.debugDelegate = null;
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
export {
|
|
207
|
-
F as ZylemCamera
|
|
208
|
-
};
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { Vector3 as r, ActiveCollisionTypes as f, ColliderDesc as p, RigidBodyType as c, RigidBodyDesc as D } from "@dimforge/rapier3d-compat";
|
|
2
|
-
const n = /* @__PURE__ */ new Map();
|
|
3
|
-
let h = 0;
|
|
4
|
-
function d(i) {
|
|
5
|
-
let e = n.get(i);
|
|
6
|
-
return e === void 0 && (e = h++ % 16, n.set(i, e)), e;
|
|
7
|
-
}
|
|
8
|
-
function C(i) {
|
|
9
|
-
let e = 0;
|
|
10
|
-
return i.forEach((s) => {
|
|
11
|
-
const t = d(s);
|
|
12
|
-
e |= 1 << t;
|
|
13
|
-
}), e;
|
|
14
|
-
}
|
|
15
|
-
class g {
|
|
16
|
-
static = !1;
|
|
17
|
-
sensor = !1;
|
|
18
|
-
gravity = new r(0, 0, 0);
|
|
19
|
-
build(e) {
|
|
20
|
-
const s = this.bodyDesc({
|
|
21
|
-
isDynamicBody: !this.static
|
|
22
|
-
}), t = this.collider(e), o = e.collisionType;
|
|
23
|
-
if (o) {
|
|
24
|
-
let u = d(o), l = 65535;
|
|
25
|
-
e.collisionFilter && (l = C(e.collisionFilter)), t.setCollisionGroups(u << 16 | l);
|
|
26
|
-
}
|
|
27
|
-
const { KINEMATIC_FIXED: a, DEFAULT: y } = f;
|
|
28
|
-
return t.activeCollisionTypes = this.sensor ? a : y, [s, t];
|
|
29
|
-
}
|
|
30
|
-
withCollision(e) {
|
|
31
|
-
return this.sensor = e?.sensor ?? this.sensor, this.static = e?.static ?? this.static, this;
|
|
32
|
-
}
|
|
33
|
-
collider(e) {
|
|
34
|
-
const s = e.size ?? new r(1, 1, 1), t = { x: s.x / 2, y: s.y / 2, z: s.z / 2 };
|
|
35
|
-
return p.cuboid(t.x, t.y, t.z);
|
|
36
|
-
}
|
|
37
|
-
bodyDesc({ isDynamicBody: e = !0 }) {
|
|
38
|
-
const s = e ? c.Dynamic : c.Fixed;
|
|
39
|
-
return new D(s).setTranslation(0, 0, 0).setGravityScale(1).setCanSleep(!1).setCcdEnabled(!0);
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
export {
|
|
43
|
-
g as CollisionBuilder,
|
|
44
|
-
C as createCollisionFilter,
|
|
45
|
-
d as getOrCreateCollisionGroupId
|
|
46
|
-
};
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { getOrCreateCollisionGroupId as o } from "./collision-builder.js";
|
|
2
|
-
function u(i, n) {
|
|
3
|
-
if (!n)
|
|
4
|
-
return !0;
|
|
5
|
-
const r = i.name ?? "";
|
|
6
|
-
if ("name" in n) {
|
|
7
|
-
const e = n.name;
|
|
8
|
-
return e instanceof RegExp ? e.test(r) : Array.isArray(e) ? e.some((t) => t === r) : r === e;
|
|
9
|
-
} else if ("mask" in n) {
|
|
10
|
-
const e = n.mask;
|
|
11
|
-
if (e instanceof RegExp) {
|
|
12
|
-
const t = i.collisionType ?? "";
|
|
13
|
-
return e.test(t);
|
|
14
|
-
} else {
|
|
15
|
-
const t = i.collisionType ?? "", s = o(t);
|
|
16
|
-
return (e & 1 << s) !== 0;
|
|
17
|
-
}
|
|
18
|
-
} else if ("test" in n)
|
|
19
|
-
return !!n.test(i);
|
|
20
|
-
return !0;
|
|
21
|
-
}
|
|
22
|
-
export {
|
|
23
|
-
u as matchesCollisionSelector
|
|
24
|
-
};
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import d from "@dimforge/rapier3d-compat";
|
|
2
|
-
import { state as c } from "../game/game-state.js";
|
|
3
|
-
import { ZylemActor as h } from "../entities/actor.js";
|
|
4
|
-
import { isCollisionHandlerDelegate as n } from "./collision-delegate.js";
|
|
5
|
-
class v {
|
|
6
|
-
type = "World";
|
|
7
|
-
world;
|
|
8
|
-
collisionMap = /* @__PURE__ */ new Map();
|
|
9
|
-
collisionBehaviorMap = /* @__PURE__ */ new Map();
|
|
10
|
-
_removalMap = /* @__PURE__ */ new Map();
|
|
11
|
-
static async loadPhysics(o) {
|
|
12
|
-
return await d.init(), new d.World(o);
|
|
13
|
-
}
|
|
14
|
-
constructor(o) {
|
|
15
|
-
this.world = o;
|
|
16
|
-
}
|
|
17
|
-
addEntity(o) {
|
|
18
|
-
const i = this.world.createRigidBody(o.bodyDesc);
|
|
19
|
-
o.body = i, o.body.userData = { uuid: o.uuid, ref: o }, this.world.gravity.x === 0 && this.world.gravity.y === 0 && this.world.gravity.z === 0 && (o.body.lockTranslations(!0, !0), o.body.lockRotations(!0, !0));
|
|
20
|
-
const e = this.world.createCollider(o.colliderDesc, o.body);
|
|
21
|
-
o.collider = e, (o.controlledRotation || o instanceof h) && (o.body.lockRotations(!0, !0), o.characterController = this.world.createCharacterController(0.01), o.characterController.setMaxSlopeClimbAngle(45 * Math.PI / 180), o.characterController.setMinSlopeSlideAngle(30 * Math.PI / 180), o.characterController.enableSnapToGround(0.01), o.characterController.setSlideEnabled(!0), o.characterController.setApplyImpulsesToDynamicBodies(!0), o.characterController.setCharacterMass(1)), this.collisionMap.set(o.uuid, o);
|
|
22
|
-
}
|
|
23
|
-
setForRemoval(o) {
|
|
24
|
-
o.body && this._removalMap.set(o.uuid, o);
|
|
25
|
-
}
|
|
26
|
-
destroyEntity(o) {
|
|
27
|
-
o.collider && this.world.removeCollider(o.collider, !0), o.body && (this.world.removeRigidBody(o.body), this.collisionMap.delete(o.uuid), this._removalMap.delete(o.uuid));
|
|
28
|
-
}
|
|
29
|
-
setup() {
|
|
30
|
-
}
|
|
31
|
-
update(o) {
|
|
32
|
-
const { delta: i } = o;
|
|
33
|
-
this.world && (this.updateColliders(i), this.updatePostCollisionBehaviors(i), this.world.step());
|
|
34
|
-
}
|
|
35
|
-
updatePostCollisionBehaviors(o) {
|
|
36
|
-
const i = this.collisionBehaviorMap;
|
|
37
|
-
for (let [e, a] of i) {
|
|
38
|
-
const r = a;
|
|
39
|
-
if (!n(r))
|
|
40
|
-
return;
|
|
41
|
-
r.handlePostCollision({ entity: r, delta: o }) || this.collisionBehaviorMap.delete(e);
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
updateColliders(o) {
|
|
45
|
-
const i = this.collisionMap;
|
|
46
|
-
for (let [e, a] of i) {
|
|
47
|
-
const r = a;
|
|
48
|
-
if (r.body) {
|
|
49
|
-
if (this._removalMap.get(r.uuid)) {
|
|
50
|
-
this.destroyEntity(r);
|
|
51
|
-
continue;
|
|
52
|
-
}
|
|
53
|
-
this.world.contactsWith(r.body.collider(0), (t) => {
|
|
54
|
-
const s = t._parent.userData.uuid, l = i.get(s);
|
|
55
|
-
l && r._collision && r._collision(l, c.globals);
|
|
56
|
-
}), this.world.intersectionsWith(r.body.collider(0), (t) => {
|
|
57
|
-
const s = t._parent.userData.uuid, l = i.get(s);
|
|
58
|
-
l && (r._collision && r._collision(l, c.globals), n(l) && (l.handleIntersectionEvent({ entity: l, other: r, delta: o }), this.collisionBehaviorMap.set(s, l)));
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
destroy() {
|
|
64
|
-
try {
|
|
65
|
-
for (const [, o] of this.collisionMap)
|
|
66
|
-
try {
|
|
67
|
-
this.destroyEntity(o);
|
|
68
|
-
} catch {
|
|
69
|
-
}
|
|
70
|
-
this.collisionMap.clear(), this.collisionBehaviorMap.clear(), this._removalMap.clear(), this.world = void 0;
|
|
71
|
-
} catch {
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
export {
|
|
76
|
-
v as ZylemWorld
|
|
77
|
-
};
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import { nanoid as o } from "nanoid";
|
|
2
|
-
class s {
|
|
3
|
-
parent = null;
|
|
4
|
-
children = [];
|
|
5
|
-
options;
|
|
6
|
-
eid = 0;
|
|
7
|
-
uuid = "";
|
|
8
|
-
name = "";
|
|
9
|
-
markedForRemoval = !1;
|
|
10
|
-
setup = () => {
|
|
11
|
-
};
|
|
12
|
-
loaded = () => {
|
|
13
|
-
};
|
|
14
|
-
update = () => {
|
|
15
|
-
};
|
|
16
|
-
destroy = () => {
|
|
17
|
-
};
|
|
18
|
-
cleanup = () => {
|
|
19
|
-
};
|
|
20
|
-
constructor(t = []) {
|
|
21
|
-
const e = t.filter((i) => !(i instanceof s)).reduce((i, n) => ({ ...i, ...n }), {});
|
|
22
|
-
this.options = e, this.uuid = o();
|
|
23
|
-
}
|
|
24
|
-
setParent(t) {
|
|
25
|
-
this.parent = t;
|
|
26
|
-
}
|
|
27
|
-
getParent() {
|
|
28
|
-
return this.parent;
|
|
29
|
-
}
|
|
30
|
-
add(t) {
|
|
31
|
-
this.children.push(t), t.setParent(this);
|
|
32
|
-
}
|
|
33
|
-
remove(t) {
|
|
34
|
-
const e = this.children.indexOf(t);
|
|
35
|
-
e !== -1 && (this.children.splice(e, 1), t.setParent(null));
|
|
36
|
-
}
|
|
37
|
-
getChildren() {
|
|
38
|
-
return this.children;
|
|
39
|
-
}
|
|
40
|
-
isComposite() {
|
|
41
|
-
return this.children.length > 0;
|
|
42
|
-
}
|
|
43
|
-
nodeSetup(t) {
|
|
44
|
-
this.markedForRemoval = !1, typeof this._setup == "function" && this._setup(t), this.setup && this.setup(t), this.children.forEach((e) => e.nodeSetup(t));
|
|
45
|
-
}
|
|
46
|
-
nodeUpdate(t) {
|
|
47
|
-
this.markedForRemoval || (typeof this._update == "function" && this._update(t), this.update && this.update(t), this.children.forEach((e) => e.nodeUpdate(t)));
|
|
48
|
-
}
|
|
49
|
-
nodeDestroy(t) {
|
|
50
|
-
this.children.forEach((e) => e.nodeDestroy(t)), this.destroy && this.destroy(t), typeof this._destroy == "function" && this._destroy(t), this.markedForRemoval = !0;
|
|
51
|
-
}
|
|
52
|
-
getOptions() {
|
|
53
|
-
return this.options;
|
|
54
|
-
}
|
|
55
|
-
setOptions(t) {
|
|
56
|
-
this.options = { ...this.options, ...t };
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
export {
|
|
60
|
-
s as BaseNode
|
|
61
|
-
};
|