@hology/core 0.0.91 → 0.0.92
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/LICENSE.md +14 -14
- package/README.md +2 -2
- package/dist/config/project-config.d.ts +1 -0
- package/dist/config/project-config.d.ts.map +1 -0
- package/dist/config/project-config.js +1 -2
- package/dist/controllers/base-game-controller.d.ts +1 -0
- package/dist/controllers/base-game-controller.d.ts.map +1 -0
- package/dist/controllers/base-game-controller.js +1 -2
- package/dist/csm.d.ts +1 -0
- package/dist/csm.d.ts.map +1 -0
- package/dist/csm.js +1 -2
- package/dist/effects/particles/examples.d.ts +1 -0
- package/dist/effects/particles/examples.d.ts.map +1 -0
- package/dist/effects/particles/examples.js +1 -2
- package/dist/effects/particles/particle-system-config.d.ts +1 -0
- package/dist/effects/particles/particle-system-config.d.ts.map +1 -0
- package/dist/effects/particles/particle-system-config.js +1 -2
- package/dist/effects/vfx/behaviours.d.ts +3 -1
- package/dist/effects/vfx/behaviours.d.ts.map +1 -0
- package/dist/effects/vfx/behaviours.js +1 -2
- package/dist/effects/vfx/index.d.ts +1 -0
- package/dist/effects/vfx/index.d.ts.map +1 -0
- package/dist/effects/vfx/index.js +1 -2
- package/dist/effects/vfx/initializsers.d.ts +20 -39
- package/dist/effects/vfx/initializsers.d.ts.map +1 -0
- package/dist/effects/vfx/initializsers.js +1 -2
- package/dist/effects/vfx/rates.d.ts +5 -4
- package/dist/effects/vfx/rates.d.ts.map +1 -0
- package/dist/effects/vfx/rates.js +1 -2
- package/dist/effects/vfx/stretched-sprite.d.ts +1 -0
- package/dist/effects/vfx/stretched-sprite.d.ts.map +1 -0
- package/dist/effects/vfx/stretched-sprite.js +1 -2
- package/dist/effects/vfx/trail-renderer.d.ts +1 -0
- package/dist/effects/vfx/trail-renderer.d.ts.map +1 -0
- package/dist/effects/vfx/trail-renderer.js +1 -2
- package/dist/effects/vfx/vfx-actor.d.ts +2 -1
- package/dist/effects/vfx/vfx-actor.d.ts.map +1 -0
- package/dist/effects/vfx/vfx-actor.js +1 -2
- package/dist/effects/vfx/vfx-asset.d.ts +11 -0
- package/dist/effects/vfx/vfx-asset.d.ts.map +1 -0
- package/dist/effects/vfx/vfx-asset.js +1 -2
- package/dist/effects/vfx/vfx-defs.d.ts +11 -7
- package/dist/effects/vfx/vfx-defs.d.ts.map +1 -0
- package/dist/effects/vfx/vfx-defs.js +1 -2
- package/dist/effects/vfx/vfx-materializer.d.ts +9 -1
- package/dist/effects/vfx/vfx-materializer.d.ts.map +1 -0
- package/dist/effects/vfx/vfx-materializer.js +1 -2
- package/dist/effects/vfx/vfx-old-materializer.d.ts +2 -11
- package/dist/effects/vfx/vfx-old-materializer.d.ts.map +1 -0
- package/dist/effects/vfx/vfx-old-materializer.js +1 -2
- package/dist/effects/vfx/vfx-param.d.ts +1 -0
- package/dist/effects/vfx/vfx-param.d.ts.map +1 -0
- package/dist/effects/vfx/vfx-param.js +1 -2
- package/dist/effects/vfx/vfx-renderers.d.ts +2 -1
- package/dist/effects/vfx/vfx-renderers.d.ts.map +1 -0
- package/dist/effects/vfx/vfx-renderers.js +1 -2
- package/dist/effects/vfx/vfx-service.d.ts +1 -0
- package/dist/effects/vfx/vfx-service.d.ts.map +1 -0
- package/dist/effects/vfx/vfx-service.js +1 -2
- package/dist/effects/vfx/zones.d.ts +2 -1
- package/dist/effects/vfx/zones.d.ts.map +1 -0
- package/dist/effects/vfx/zones.js +1 -2
- package/dist/game-component/component-decorators.d.ts +1 -0
- package/dist/game-component/component-decorators.d.ts.map +1 -0
- package/dist/game-component/component-decorators.js +1 -2
- package/dist/game-component/game-component.d.ts +1 -0
- package/dist/game-component/game-component.d.ts.map +1 -0
- package/dist/game-component/game-component.js +1 -2
- package/dist/gameplay/actors/actor.d.ts +1 -0
- package/dist/gameplay/actors/actor.d.ts.map +1 -0
- package/dist/gameplay/actors/actor.js +1 -2
- package/dist/gameplay/actors/builtin/camera-actor.d.ts +1 -0
- package/dist/gameplay/actors/builtin/camera-actor.d.ts.map +1 -0
- package/dist/gameplay/actors/builtin/camera-actor.js +1 -2
- package/dist/gameplay/actors/builtin/components/character/character-animation.d.ts +1 -0
- package/dist/gameplay/actors/builtin/components/character/character-animation.d.ts.map +1 -0
- package/dist/gameplay/actors/builtin/components/character/character-animation.js +1 -2
- package/dist/gameplay/actors/builtin/components/character/character-movement copy.d.ts +1 -0
- package/dist/gameplay/actors/builtin/components/character/character-movement copy.d.ts.map +1 -0
- package/dist/gameplay/actors/builtin/components/character/character-movement copy.js +1 -2
- package/dist/gameplay/actors/builtin/components/character/character-movement.d.ts +1 -0
- package/dist/gameplay/actors/builtin/components/character/character-movement.d.ts.map +1 -0
- package/dist/gameplay/actors/builtin/components/character/character-movement.js +1 -2
- package/dist/gameplay/actors/builtin/components/character/modes.d.ts +1 -0
- package/dist/gameplay/actors/builtin/components/character/modes.d.ts.map +1 -0
- package/dist/gameplay/actors/builtin/components/character/modes.js +1 -2
- package/dist/gameplay/actors/builtin/components/mesh-component.d.ts +1 -0
- package/dist/gameplay/actors/builtin/components/mesh-component.d.ts.map +1 -0
- package/dist/gameplay/actors/builtin/components/mesh-component.js +1 -2
- package/dist/gameplay/actors/builtin/components/scene-component.d.ts +1 -0
- package/dist/gameplay/actors/builtin/components/scene-component.d.ts.map +1 -0
- package/dist/gameplay/actors/builtin/components/scene-component.js +1 -2
- package/dist/gameplay/actors/builtin/index.d.ts +1 -0
- package/dist/gameplay/actors/builtin/index.d.ts.map +1 -0
- package/dist/gameplay/actors/builtin/index.js +1 -2
- package/dist/gameplay/actors/builtin/navmesh-actor.d.ts +1 -0
- package/dist/gameplay/actors/builtin/navmesh-actor.d.ts.map +1 -0
- package/dist/gameplay/actors/builtin/navmesh-actor.js +1 -2
- package/dist/gameplay/actors/builtin/positional-audio-actor.d.ts +1 -0
- package/dist/gameplay/actors/builtin/positional-audio-actor.d.ts.map +1 -0
- package/dist/gameplay/actors/builtin/positional-audio-actor.js +1 -2
- package/dist/gameplay/actors/builtin/spawn-point.d.ts +1 -0
- package/dist/gameplay/actors/builtin/spawn-point.d.ts.map +1 -0
- package/dist/gameplay/actors/builtin/spawn-point.js +1 -2
- package/dist/gameplay/actors/builtin/trigger-volume.d.ts +1 -0
- package/dist/gameplay/actors/builtin/trigger-volume.d.ts.map +1 -0
- package/dist/gameplay/actors/builtin/trigger-volume.js +1 -2
- package/dist/gameplay/actors/camera/camera-component.d.ts +1 -0
- package/dist/gameplay/actors/camera/camera-component.d.ts.map +1 -0
- package/dist/gameplay/actors/camera/camera-component.js +1 -2
- package/dist/gameplay/actors/camera/third-person-camera-component.d.ts +1 -0
- package/dist/gameplay/actors/camera/third-person-camera-component.d.ts.map +1 -0
- package/dist/gameplay/actors/camera/third-person-camera-component.js +1 -2
- package/dist/gameplay/actors/component.d.ts +1 -0
- package/dist/gameplay/actors/component.d.ts.map +1 -0
- package/dist/gameplay/actors/component.js +1 -2
- package/dist/gameplay/actors/factory.d.ts +1 -0
- package/dist/gameplay/actors/factory.d.ts.map +1 -0
- package/dist/gameplay/actors/factory.js +1 -2
- package/dist/gameplay/actors/index.d.ts +1 -0
- package/dist/gameplay/actors/index.d.ts.map +1 -0
- package/dist/gameplay/actors/index.js +1 -2
- package/dist/gameplay/actors/internal/component-init.d.ts +1 -0
- package/dist/gameplay/actors/internal/component-init.d.ts.map +1 -0
- package/dist/gameplay/actors/internal/component-init.js +1 -2
- package/dist/gameplay/actors/internal/container-map.d.ts +1 -0
- package/dist/gameplay/actors/internal/container-map.d.ts.map +1 -0
- package/dist/gameplay/actors/internal/container-map.js +1 -2
- package/dist/gameplay/ai/behavior-tree/bt.d.ts +1 -0
- package/dist/gameplay/ai/behavior-tree/bt.d.ts.map +1 -0
- package/dist/gameplay/ai/behavior-tree/bt.js +1 -2
- package/dist/gameplay/ai/behavior-tree/move.d.ts +1 -0
- package/dist/gameplay/ai/behavior-tree/move.d.ts.map +1 -0
- package/dist/gameplay/ai/behavior-tree/move.js +1 -2
- package/dist/gameplay/ai/build-tile.d.ts +1 -0
- package/dist/gameplay/ai/build-tile.d.ts.map +1 -0
- package/dist/gameplay/ai/build-tile.js +1 -2
- package/dist/gameplay/ai/dynamic-tiled-navmesh.d.ts +1 -0
- package/dist/gameplay/ai/dynamic-tiled-navmesh.d.ts.map +1 -0
- package/dist/gameplay/ai/dynamic-tiled-navmesh.js +1 -2
- package/dist/gameplay/ai/dynamic-tiled-navmesh.worker.d.ts +1 -0
- package/dist/gameplay/ai/dynamic-tiled-navmesh.worker.d.ts.map +1 -0
- package/dist/gameplay/ai/dynamic-tiled-navmesh.worker.js +1 -2
- package/dist/gameplay/ai/index.d.ts +1 -0
- package/dist/gameplay/ai/index.d.ts.map +1 -0
- package/dist/gameplay/ai/index.js +1 -2
- package/dist/gameplay/ai/navigation.d.ts +1 -0
- package/dist/gameplay/ai/navigation.d.ts.map +1 -0
- package/dist/gameplay/ai/navigation.js +1 -2
- package/dist/gameplay/animation/anim-sm.d.ts +1 -0
- package/dist/gameplay/animation/anim-sm.d.ts.map +1 -0
- package/dist/gameplay/animation/anim-sm.js +1 -2
- package/dist/gameplay/animation/root-motion.d.ts +1 -0
- package/dist/gameplay/animation/root-motion.d.ts.map +1 -0
- package/dist/gameplay/animation/root-motion.js +1 -2
- package/dist/gameplay/env.d.ts +1 -0
- package/dist/gameplay/env.d.ts.map +1 -0
- package/dist/gameplay/env.js +1 -2
- package/dist/gameplay/index.d.ts +1 -0
- package/dist/gameplay/index.d.ts.map +1 -0
- package/dist/gameplay/index.js +1 -2
- package/dist/gameplay/initiate.d.ts +1 -0
- package/dist/gameplay/initiate.d.ts.map +1 -0
- package/dist/gameplay/initiate.js +1 -2
- package/dist/gameplay/inject.d.ts +1 -0
- package/dist/gameplay/inject.d.ts.map +1 -0
- package/dist/gameplay/inject.js +1 -2
- package/dist/gameplay/input/index.d.ts +1 -0
- package/dist/gameplay/input/index.d.ts.map +1 -0
- package/dist/gameplay/input/index.js +1 -2
- package/dist/gameplay/input/input-service.d.ts +1 -0
- package/dist/gameplay/input/input-service.d.ts.map +1 -0
- package/dist/gameplay/input/input-service.js +1 -2
- package/dist/gameplay/input/input.d.ts +1 -0
- package/dist/gameplay/input/input.d.ts.map +1 -0
- package/dist/gameplay/input/input.js +1 -2
- package/dist/gameplay/input/keybind.d.ts +1 -0
- package/dist/gameplay/input/keybind.d.ts.map +1 -0
- package/dist/gameplay/input/keybind.js +1 -2
- package/dist/gameplay/polyfill.d.ts +1 -0
- package/dist/gameplay/polyfill.d.ts.map +1 -0
- package/dist/gameplay/polyfill.js +1 -2
- package/dist/gameplay/services/asset-loader.d.ts +1 -0
- package/dist/gameplay/services/asset-loader.d.ts.map +1 -0
- package/dist/gameplay/services/asset-loader.js +1 -2
- package/dist/gameplay/services/physics/abstract-physics-system.d.ts +1 -0
- package/dist/gameplay/services/physics/abstract-physics-system.d.ts.map +1 -0
- package/dist/gameplay/services/physics/abstract-physics-system.js +1 -2
- package/dist/gameplay/services/physics/collision-contact.d.ts +1 -0
- package/dist/gameplay/services/physics/collision-contact.d.ts.map +1 -0
- package/dist/gameplay/services/physics/collision-contact.js +1 -2
- package/dist/gameplay/services/physics/physics-system.d.ts +1 -0
- package/dist/gameplay/services/physics/physics-system.d.ts.map +1 -0
- package/dist/gameplay/services/physics/physics-system.js +1 -2
- package/dist/gameplay/services/pointer-events.d.ts +1 -0
- package/dist/gameplay/services/pointer-events.d.ts.map +1 -0
- package/dist/gameplay/services/pointer-events.js +1 -2
- package/dist/gameplay/services/render.d.ts +1 -0
- package/dist/gameplay/services/render.d.ts.map +1 -0
- package/dist/gameplay/services/render.js +1 -2
- package/dist/gameplay/services/world.d.ts +1 -0
- package/dist/gameplay/services/world.d.ts.map +1 -0
- package/dist/gameplay/services/world.js +1 -2
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1 -2
- package/dist/rendering/shader-override.d.ts +1 -0
- package/dist/rendering/shader-override.d.ts.map +1 -0
- package/dist/rendering/shader-override.js +1 -2
- package/dist/rendering.d.ts +1 -0
- package/dist/rendering.d.ts.map +1 -0
- package/dist/rendering.js +1 -2
- package/dist/scene/asset-resource-loader.d.ts +1 -0
- package/dist/scene/asset-resource-loader.d.ts.map +1 -0
- package/dist/scene/asset-resource-loader.js +1 -2
- package/dist/scene/assets-provider.d.ts +1 -0
- package/dist/scene/assets-provider.d.ts.map +1 -0
- package/dist/scene/assets-provider.js +1 -2
- package/dist/scene/bootstrap.d.ts +1 -0
- package/dist/scene/bootstrap.d.ts.map +1 -0
- package/dist/scene/bootstrap.js +1 -2
- package/dist/scene/collision/collision-shape-import.d.ts +1 -0
- package/dist/scene/collision/collision-shape-import.d.ts.map +1 -0
- package/dist/scene/collision/collision-shape-import.js +1 -2
- package/dist/scene/collision/collision-shape.d.ts +1 -0
- package/dist/scene/collision/collision-shape.d.ts.map +1 -0
- package/dist/scene/collision/collision-shape.js +1 -2
- package/dist/scene/landscape/landscape-manager.d.ts +1 -0
- package/dist/scene/landscape/landscape-manager.d.ts.map +1 -0
- package/dist/scene/landscape/landscape-manager.js +1 -2
- package/dist/scene/landscape/landscape.d.ts +1 -0
- package/dist/scene/landscape/landscape.d.ts.map +1 -0
- package/dist/scene/landscape/landscape.js +1 -2
- package/dist/scene/landscape/utils.d.ts +1 -0
- package/dist/scene/landscape/utils.d.ts.map +1 -0
- package/dist/scene/landscape/utils.js +1 -2
- package/dist/scene/materializer.d.ts +1 -0
- package/dist/scene/materializer.d.ts.map +1 -0
- package/dist/scene/materializer.js +1 -2
- package/dist/scene/materials/grass-foliage.d.ts +1 -0
- package/dist/scene/materials/grass-foliage.d.ts.map +1 -0
- package/dist/scene/materials/grass-foliage.js +1 -2
- package/dist/scene/materials/grass.d.ts +1 -0
- package/dist/scene/materials/grass.d.ts.map +1 -0
- package/dist/scene/materials/grass.js +1 -2
- package/dist/scene/materials/utils/material-painting.d.ts +1 -0
- package/dist/scene/materials/utils/material-painting.d.ts.map +1 -0
- package/dist/scene/materials/utils/material-painting.js +1 -2
- package/dist/scene/materials/utils/noise.glsl.d.ts +1 -0
- package/dist/scene/materials/utils/noise.glsl.d.ts.map +1 -0
- package/dist/scene/materials/utils/noise.glsl.js +1 -2
- package/dist/scene/materials/water.d.ts +1 -0
- package/dist/scene/materials/water.d.ts.map +1 -0
- package/dist/scene/materials/water.js +1 -2
- package/dist/scene/model.d.ts +1 -0
- package/dist/scene/model.d.ts.map +1 -0
- package/dist/scene/model.js +1 -2
- package/dist/scene/objects/ramp-geometry.d.ts +1 -0
- package/dist/scene/objects/ramp-geometry.d.ts.map +1 -0
- package/dist/scene/objects/ramp-geometry.js +1 -2
- package/dist/scene/objects/shapes.d.ts +2 -2
- package/dist/scene/objects/shapes.d.ts.map +1 -0
- package/dist/scene/objects/shapes.js +1 -2
- package/dist/scene/objects/stairs-geometry.d.ts +1 -0
- package/dist/scene/objects/stairs-geometry.d.ts.map +1 -0
- package/dist/scene/objects/stairs-geometry.js +1 -2
- package/dist/scene/runtime-asset-service.d.ts +1 -0
- package/dist/scene/runtime-asset-service.d.ts.map +1 -0
- package/dist/scene/runtime-asset-service.js +1 -2
- package/dist/scene/runtime-backend-service.d.ts +1 -0
- package/dist/scene/runtime-backend-service.d.ts.map +1 -0
- package/dist/scene/runtime-backend-service.js +1 -2
- package/dist/scene/runtime-bundled-backend-service.d.ts +1 -0
- package/dist/scene/runtime-bundled-backend-service.d.ts.map +1 -0
- package/dist/scene/runtime-bundled-backend-service.js +1 -2
- package/dist/scene/scene-data-service.d.ts +1 -0
- package/dist/scene/scene-data-service.d.ts.map +1 -0
- package/dist/scene/scene-data-service.js +1 -2
- package/dist/scene/sky.d.ts +1 -0
- package/dist/scene/sky.d.ts.map +1 -0
- package/dist/scene/sky.js +1 -2
- package/dist/scene/storage/storage.d.ts +1 -0
- package/dist/scene/storage/storage.d.ts.map +1 -0
- package/dist/scene/storage/storage.js +1 -2
- package/dist/shader/builtin/index.d.ts +1 -0
- package/dist/shader/builtin/index.d.ts.map +1 -0
- package/dist/shader/builtin/index.js +1 -2
- package/dist/shader/builtin/lambert-shader.d.ts +1 -0
- package/dist/shader/builtin/lambert-shader.d.ts.map +1 -0
- package/dist/shader/builtin/lambert-shader.js +1 -2
- package/dist/shader/builtin/landscape-composite-shader.d.ts +1 -0
- package/dist/shader/builtin/landscape-composite-shader.d.ts.map +1 -0
- package/dist/shader/builtin/landscape-composite-shader.js +1 -2
- package/dist/shader/builtin/landscape-shader.d.ts +1 -0
- package/dist/shader/builtin/landscape-shader.d.ts.map +1 -0
- package/dist/shader/builtin/landscape-shader.js +1 -2
- package/dist/shader/builtin/standard-shader.d.ts +1 -0
- package/dist/shader/builtin/standard-shader.d.ts.map +1 -0
- package/dist/shader/builtin/standard-shader.js +1 -2
- package/dist/shader/builtin/unlit-shader.d.ts +1 -0
- package/dist/shader/builtin/unlit-shader.d.ts.map +1 -0
- package/dist/shader/builtin/unlit-shader.js +1 -2
- package/dist/shader/index.d.ts +1 -0
- package/dist/shader/index.d.ts.map +1 -0
- package/dist/shader/index.js +1 -2
- package/dist/shader/parameter.d.ts +1 -0
- package/dist/shader/parameter.d.ts.map +1 -0
- package/dist/shader/parameter.js +1 -2
- package/dist/shader/shader.d.ts +1 -0
- package/dist/shader/shader.d.ts.map +1 -0
- package/dist/shader/shader.js +1 -2
- package/dist/shader-nodes/bulge.d.ts +1 -0
- package/dist/shader-nodes/bulge.d.ts.map +1 -0
- package/dist/shader-nodes/bulge.js +1 -2
- package/dist/shader-nodes/depth.d.ts +1 -0
- package/dist/shader-nodes/depth.d.ts.map +1 -0
- package/dist/shader-nodes/depth.js +1 -2
- package/dist/shader-nodes/effects.d.ts +1 -0
- package/dist/shader-nodes/effects.d.ts.map +1 -0
- package/dist/shader-nodes/effects.js +1 -2
- package/dist/shader-nodes/glsl-node.d.ts +2 -1
- package/dist/shader-nodes/glsl-node.d.ts.map +1 -0
- package/dist/shader-nodes/glsl-node.js +1 -2
- package/dist/shader-nodes/index.d.ts +2 -0
- package/dist/shader-nodes/index.d.ts.map +1 -0
- package/dist/shader-nodes/index.js +1 -2
- package/dist/shader-nodes/landscape.d.ts +1 -0
- package/dist/shader-nodes/landscape.d.ts.map +1 -0
- package/dist/shader-nodes/landscape.js +1 -2
- package/dist/shader-nodes/layers.d.ts +1 -0
- package/dist/shader-nodes/layers.d.ts.map +1 -0
- package/dist/shader-nodes/layers.js +1 -2
- package/dist/shader-nodes/math.d.ts +1 -0
- package/dist/shader-nodes/math.d.ts.map +1 -0
- package/dist/shader-nodes/math.js +1 -2
- package/dist/shader-nodes/particle.d.ts +3 -0
- package/dist/shader-nodes/particle.d.ts.map +1 -0
- package/dist/shader-nodes/particle.js +1 -2
- package/dist/shader-nodes/shapes.d.ts +1 -0
- package/dist/shader-nodes/shapes.d.ts.map +1 -0
- package/dist/shader-nodes/shapes.js +1 -2
- package/dist/shader-nodes/texture-sequence.d.ts +2 -1
- package/dist/shader-nodes/texture-sequence.d.ts.map +1 -0
- package/dist/shader-nodes/texture-sequence.js +1 -2
- package/dist/shader-nodes/time.d.ts +1 -0
- package/dist/shader-nodes/time.d.ts.map +1 -0
- package/dist/shader-nodes/time.js +1 -2
- package/dist/shader-nodes/voronoi.d.ts +1 -0
- package/dist/shader-nodes/voronoi.d.ts.map +1 -0
- package/dist/shader-nodes/voronoi.js +1 -2
- package/dist/test/injection.test.d.ts +1 -0
- package/dist/test/injection.test.d.ts.map +1 -0
- package/dist/test/injection.test.js +1 -2
- package/dist/utils/async.d.ts +1 -0
- package/dist/utils/async.d.ts.map +1 -0
- package/dist/utils/async.js +1 -2
- package/dist/utils/buffer.d.ts +1 -0
- package/dist/utils/buffer.d.ts.map +1 -0
- package/dist/utils/buffer.js +1 -2
- package/dist/utils/collections.d.ts +1 -0
- package/dist/utils/collections.d.ts.map +1 -0
- package/dist/utils/collections.js +1 -2
- package/dist/utils/files.d.ts +1 -0
- package/dist/utils/files.d.ts.map +1 -0
- package/dist/utils/files.js +1 -2
- package/dist/utils/materials.d.ts +1 -0
- package/dist/utils/materials.d.ts.map +1 -0
- package/dist/utils/materials.js +1 -2
- package/dist/utils/math.d.ts +1 -0
- package/dist/utils/math.d.ts.map +1 -0
- package/dist/utils/math.js +1 -2
- package/dist/utils/mesh.d.ts +1 -0
- package/dist/utils/mesh.d.ts.map +1 -0
- package/dist/utils/mesh.js +1 -2
- package/dist/utils/polyfill.d.ts +1 -0
- package/dist/utils/polyfill.d.ts.map +1 -0
- package/dist/utils/polyfill.js +1 -2
- package/dist/utils/three/depth-pass.d.ts +1 -0
- package/dist/utils/three/depth-pass.d.ts.map +1 -0
- package/dist/utils/three/depth-pass.js +1 -2
- package/dist/utils/three/gpu-stats-panel.d.ts +1 -0
- package/dist/utils/three/gpu-stats-panel.d.ts.map +1 -0
- package/dist/utils/three/gpu-stats-panel.js +1 -2
- package/dist/utils/three/line-sphere.d.ts +1 -0
- package/dist/utils/three/line-sphere.d.ts.map +1 -0
- package/dist/utils/three/line-sphere.js +1 -2
- package/dist/utils/three/outline-pass.d.ts +1 -0
- package/dist/utils/three/outline-pass.d.ts.map +1 -0
- package/dist/utils/three/outline-pass.js +1 -2
- package/dist/utils/three/positional-audio-helper.d.ts +1 -0
- package/dist/utils/three/positional-audio-helper.d.ts.map +1 -0
- package/dist/utils/three/positional-audio-helper.js +1 -2
- package/dist/utils/three/stats.d.ts +1 -0
- package/dist/utils/three/stats.d.ts.map +1 -0
- package/dist/utils/three/stats.js +1 -2
- package/dist/utils/three/transform-controls.d.ts +1 -0
- package/dist/utils/three/transform-controls.d.ts.map +1 -0
- package/dist/utils/three/transform-controls.js +1 -2
- package/dist/utils/three/traverse.d.ts +1 -0
- package/dist/utils/three/traverse.d.ts.map +1 -0
- package/dist/utils/three/traverse.js +1 -2
- package/dist/utils/type.d.ts +1 -0
- package/dist/utils/type.d.ts.map +1 -0
- package/dist/utils/type.js +1 -2
- package/dist/utils/uuid.d.ts +1 -0
- package/dist/utils/uuid.d.ts.map +1 -0
- package/dist/utils/uuid.js +1 -2
- package/dist/worker/index.d.ts +1 -0
- package/dist/worker/index.d.ts.map +1 -0
- package/dist/worker/index.js +1 -2
- package/package.json +122 -122
- package/tsconfig.tsbuildinfo +1 -1
package/LICENSE.md
CHANGED
@@ -1,15 +1,15 @@
|
|
1
|
-
# Hology Interactive AB Limited License
|
2
|
-
|
3
|
-
This software package, including all associated files and documentation (the "Software"), is licensed to you (the "Licensee") by Hology Interactive AB for use exclusively with the product "Hology Engine."
|
4
|
-
|
5
|
-
By using, copying, modifying, or distributing the Software, Licensee agrees to be bound by the terms of this license.
|
6
|
-
|
7
|
-
1. License Grant: Hology Interactive AB grants Licensee a limited, non-exclusive, non-transferable license to use the Software solely for the purpose of developing and running software developed with "Hology Engine."
|
8
|
-
|
9
|
-
2. Restrictions: Licensee may not use, copy, modify, or distribute the Software for any other purpose, including but not limited to the creation of derivative works, standalone applications, or any products not directly associated with "Hology Engine."
|
10
|
-
|
11
|
-
3. Ownership: Hology Interactive AB retains all intellectual property rights to the Software. This license does not transfer ownership of the Software to Licensee.
|
12
|
-
|
13
|
-
4. Warranty Disclaimer: THE SOFTWARE IS PROVIDED "AS IS," WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT. IN NO EVENT SHALL THE CREATOR OF THIS PACKAGE BE LIABLE FOR ANY CLAIM, DAMAGES, OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT, OR OTHERWISE, ARISING FROM, OUT OF, OR IN CONNECTION WITH THE SOFTWARE.
|
14
|
-
|
1
|
+
# Hology Interactive AB Limited License
|
2
|
+
|
3
|
+
This software package, including all associated files and documentation (the "Software"), is licensed to you (the "Licensee") by Hology Interactive AB for use exclusively with the product "Hology Engine."
|
4
|
+
|
5
|
+
By using, copying, modifying, or distributing the Software, Licensee agrees to be bound by the terms of this license.
|
6
|
+
|
7
|
+
1. License Grant: Hology Interactive AB grants Licensee a limited, non-exclusive, non-transferable license to use the Software solely for the purpose of developing and running software developed with "Hology Engine."
|
8
|
+
|
9
|
+
2. Restrictions: Licensee may not use, copy, modify, or distribute the Software for any other purpose, including but not limited to the creation of derivative works, standalone applications, or any products not directly associated with "Hology Engine."
|
10
|
+
|
11
|
+
3. Ownership: Hology Interactive AB retains all intellectual property rights to the Software. This license does not transfer ownership of the Software to Licensee.
|
12
|
+
|
13
|
+
4. Warranty Disclaimer: THE SOFTWARE IS PROVIDED "AS IS," WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT. IN NO EVENT SHALL THE CREATOR OF THIS PACKAGE BE LIABLE FOR ANY CLAIM, DAMAGES, OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT, OR OTHERWISE, ARISING FROM, OUT OF, OR IN CONNECTION WITH THE SOFTWARE.
|
14
|
+
|
15
15
|
6. Contact: For any inquiries regarding this license, please email hello@hology.app
|
package/README.md
CHANGED
@@ -1,3 +1,3 @@
|
|
1
|
-
# Hology Engine Core
|
2
|
-
|
1
|
+
# Hology Engine Core
|
2
|
+
|
3
3
|
For the development with Hology Engine (https://hology.app/)
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"project-config.d.ts","sourceRoot":"","sources":["../../src/config/project-config.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,qBAAqB,uBAAuB,CAAA;AAEzD,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IAEb,QAAQ,EAAE,MAAM,CAAA;IAChB,WAAW,EAAE,MAAM,CAAA;IACnB,UAAU,EAAE,MAAM,CAAA;IAElB;;;OAGG;IACH,UAAU,EAAE,MAAM,CAAA;IAElB,IAAI,CAAC,EAAE;QAEL,OAAO,EAAE,MAAM,CAAA;QAEf,YAAY,EAAE,OAAO,CAAA;QAErB,MAAM,EAAE,SAAS,CAAA;KAClB,CAAA;CACF"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"base-game-controller.d.ts","sourceRoot":"","sources":["../../src/controllers/base-game-controller.ts"],"names":[],"mappings":"AACA,8BAAsB,kBAAkB;IACtC,MAAM,CAAC,SAAS,EAAE,MAAM;CAGzB"}
|
package/dist/csm.d.ts
CHANGED
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"csm.d.ts","sourceRoot":"","sources":["../src/csm.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAa/B,eAAO,MAAM,OAAO;;8BAEQ,QAAQ,UAAU,MAAM,kCAAkC;;CAmErF,CAAA;AAQD,eAAO,MAAM,SAAS;;;CAkSrB,CAAC"}
|
package/dist/csm.js
CHANGED
@@ -1,5 +1,4 @@
|
|
1
|
-
import*as t from"three";const e={add:t.Object3D.prototype.add,attach:t.Object3D.prototype.attach},i=new WeakMap,n=new WeakMap;export const CSMUtil=new class{constructor(){this.renderingView=null}onBeforeCompile(e,i){e.defines=e.defines||{},e.defines.USE_CSM=1,e.defines.CSM_CASCADES=this.renderingView.csm.cascades;const n=this.renderingView.camera instanceof t.PerspectiveCamera?this.renderingView.camera.far:Number.MAX_SAFE_INTEGER,a=this.renderingView.camera instanceof t.PerspectiveCamera?this.renderingView.camera.near:0,o=Math.min(n,this.renderingView.csm.maxFar),r=[];this.renderingView.csm.getExtendedBreaks(r),i.uniforms.CSM_cascades={value:r},i.uniforms.cameraNear={value:a},i.uniforms.shadowFar={value:o}}patchThreeAdd(){const a=this.renderingView;i.set(a.scene,a.csm);for(const[a,o]of Object.entries(e))t.Object3D.prototype[a]=function(...e){let a=this;for(;null!=a.parent;)a=a.parent;const r=a,d=i.get(r);if(null==d)return o.apply(this,arguments),this;n.has(r)||n.set(r,new WeakSet);const c=n.get(r);function h(t){t&&!c.has(t)&&(c.add(t),d?.setupMaterial(t))}return e.forEach((e=>e?.traverse((e=>{if(e instanceof t.Mesh||e instanceof t.SkinnedMesh)if(e.material instanceof Array)for(const t of e.material)h(t);else h(e.material)})))),o.apply(this,arguments),this}}};import{ShaderChunk as a}from"three";a.lights_pars_begin;export const CSMShader={lights_fragment_begin:"\nvec3 geometryPosition = - vViewPosition;\nvec3 geometryNormal = normal;\nvec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\n\nvec3 geometryClearcoatNormal = vec3( 0.0 );\n\n#ifdef USE_CLEARCOAT\n\n\tgeometryClearcoatNormal = clearcoatNormal;\n\n#endif\n\n#ifdef USE_IRIDESCENCE\n\tfloat dotNVi = saturate( dot( normal, geometryViewDir ) );\n\tif ( material.iridescenceThickness == 0.0 ) {\n\t\tmaterial.iridescence = 0.0;\n\t} else {\n\t\tmaterial.iridescence = saturate( material.iridescence );\n\t}\n\tif ( material.iridescence > 0.0 ) {\n\t\tmaterial.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );\n\t\t// Iridescence F0 approximation\n\t\tmaterial.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );\n\t}\n#endif\n\nIncidentLight directLight;\n\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\n\tPointLight pointLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLightShadow;\n\t#endif\n\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\n\t\tpointLight = pointLights[ i ];\n\n\t\tgetPointLightInfo( pointLight, geometryPosition, directLight );\n\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\n\t\tpointLightShadow = pointLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\n\t\t#endif\n\n\t\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\n\t}\n\t#pragma unroll_loop_end\n\n#endif\n\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\n\tSpotLight spotLight;\n \tvec4 spotColor;\n\tvec3 spotLightCoord;\n\tbool inSpotLightMap;\n\n\t#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLightShadow;\n\t#endif\n\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\n\t\tspotLight = spotLights[ i ];\n\n\t\tgetSpotLightInfo( spotLight, geometryPosition, directLight );\n\n \t\t// spot lights are ordered [shadows with maps, shadows without maps, maps without shadows, none]\n\t\t#if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n\t\t#define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX\n\t\t#elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\t#define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS\n\t\t#else\n\t\t#define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n\t\t#endif\n\t\t#if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )\n\t\t\tspotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;\n\t\t\tinSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );\n\t\t\tspotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );\n\t\t\tdirectLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;\n\t\t#endif\n\t\t#undef SPOT_LIGHT_MAP_INDEX\n\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\tspotLightShadow = spotLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n\n\t\t#endif\n\n\t\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\n\t}\n\t#pragma unroll_loop_end\n\n#endif\n\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct ) && defined( USE_CSM ) && defined( CSM_CASCADES )\n\n\tDirectionalLight directionalLight;\n\tfloat linearDepth = (vViewPosition.z) / (shadowFar - cameraNear);\n\t#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLightShadow;\n\t#endif\n\n\t#if defined( USE_SHADOWMAP ) && defined( CSM_FADE )\n\t\tvec2 cascade;\n\t\tfloat cascadeCenter;\n\t\tfloat closestEdge;\n\t\tfloat margin;\n\t\tfloat csmx;\n\t\tfloat csmy;\n\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\n\t\t\tdirectionalLight = directionalLights[ i ];\n\t\t\tgetDirectionalLightInfo( directionalLight, directLight );\n\n\t\t\t#if ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n\t\t\t\t// NOTE: Depth gets larger away from the camera.\n\t\t\t\t// cascade.x is closer, cascade.y is further\n\t\t\t\tcascade = CSM_cascades[ i ];\n\t\t\t\tcascadeCenter = ( cascade.x + cascade.y ) / 2.0;\n\t\t\t\tclosestEdge = linearDepth < cascadeCenter ? cascade.x : cascade.y;\n\t\t\t\tmargin = 0.25 * pow( closestEdge, 2.0 );\n\t\t\t\tcsmx = cascade.x - margin / 2.0;\n\t\t\t\tcsmy = cascade.y + margin / 2.0;\n\t\t\t\tif( linearDepth >= csmx && ( linearDepth < csmy || UNROLLED_LOOP_INDEX == CSM_CASCADES - 1 ) ) {\n\n\t\t\t\t\tfloat dist = min( linearDepth - csmx, csmy - linearDepth );\n\t\t\t\t\tfloat ratio = clamp( dist / margin, 0.0, 1.0 );\n\n\t\t\t\t\tvec3 prevColor = directLight.color;\n\t\t\t\t\tdirectionalLightShadow = directionalLightShadows[ i ];\n\t\t\t\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\n\t\t\t\t\tbool shouldFadeLastCascade = UNROLLED_LOOP_INDEX == CSM_CASCADES - 1 && linearDepth > cascadeCenter;\n\t\t\t\t\tdirectLight.color = mix( prevColor, directLight.color, shouldFadeLastCascade ? ratio : 1.0 );\n\n\t\t\t\t\tReflectedLight prevLight = reflectedLight;\n\t\t\t\t\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\n\t\t\t\t\tbool shouldBlend = UNROLLED_LOOP_INDEX != CSM_CASCADES - 1 || UNROLLED_LOOP_INDEX == CSM_CASCADES - 1 && linearDepth < cascadeCenter;\n\t\t\t\t\tfloat blendRatio = shouldBlend ? ratio : 1.0;\n\n\t\t\t\t\treflectedLight.directDiffuse = mix( prevLight.directDiffuse, reflectedLight.directDiffuse, blendRatio );\n\t\t\t\t\treflectedLight.directSpecular = mix( prevLight.directSpecular, reflectedLight.directSpecular, blendRatio );\n\t\t\t\t\treflectedLight.indirectDiffuse = mix( prevLight.indirectDiffuse, reflectedLight.indirectDiffuse, blendRatio );\n\t\t\t\t\treflectedLight.indirectSpecular = mix( prevLight.indirectSpecular, reflectedLight.indirectSpecular, blendRatio );\n\n\t\t\t\t}\n\t\t\t#endif\n\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#elif defined (USE_SHADOWMAP)\n\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\n\t\t\tdirectionalLight = directionalLights[ i ];\n\t\t\tgetDirectionalLightInfo( directionalLight, directLight );\n\n\t\t\t#if ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n\n\t\t\t\tdirectionalLightShadow = directionalLightShadows[ i ];\n\t\t\t\tif(linearDepth >= CSM_cascades[UNROLLED_LOOP_INDEX].x && linearDepth < CSM_cascades[UNROLLED_LOOP_INDEX].y) directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\n\t\t\t\tif(linearDepth >= CSM_cascades[UNROLLED_LOOP_INDEX].x && (linearDepth < CSM_cascades[UNROLLED_LOOP_INDEX].y || UNROLLED_LOOP_INDEX == CSM_CASCADES - 1)) RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\n\t\t\t#endif\n\n\t\t}\n\t\t#pragma unroll_loop_end\n\n\t#elif ( NUM_DIR_LIGHT_SHADOWS > 0 )\n\t\t// note: no loop here - all CSM lights are in fact one light only\n\t\tgetDirectionalLightInfo( directionalLights[0], directLight );\n\t\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\n\t#endif\n\n\t#if ( NUM_DIR_LIGHTS > NUM_DIR_LIGHT_SHADOWS)\n\t\t// compute the lights not casting shadows (if any)\n\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = NUM_DIR_LIGHT_SHADOWS; i < NUM_DIR_LIGHTS; i ++ ) {\n\n\t\t\tdirectionalLight = directionalLights[ i ];\n\n\t\t\tgetDirectionalLightInfo( directionalLight, directLight );\n\n\t\t\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\n\t\t}\n\t\t#pragma unroll_loop_end\n\n\t#endif\n\n#endif\n\n\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct ) && !defined( USE_CSM ) && !defined( CSM_CASCADES )\n\n\tDirectionalLight directionalLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLightShadow;\n\t#endif\n\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\n\t\tdirectionalLight = directionalLights[ i ];\n\n\t\tgetDirectionalLightInfo( directionalLight, directLight );\n\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n\t\tdirectionalLightShadow = directionalLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\n\t\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\n\t}\n\t#pragma unroll_loop_end\n\n#endif\n\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\n\tRectAreaLight rectAreaLight;\n\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\n\t}\n\t#pragma unroll_loop_end\n\n#endif\n\n#if defined( RE_IndirectDiffuse )\n\n\tvec3 iblIrradiance = vec3( 0.0 );\n\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\n\t#if defined( USE_LIGHT_PROBES )\n\n\t\tirradiance += getLightProbeIrradiance( lightProbe, geometryNormal );\n\n\t#endif\n\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal );\n\n\t\t}\n\t\t#pragma unroll_loop_end\n\n\t#endif\n\n#endif\n\n#if defined( RE_IndirectSpecular )\n\n\tvec3 radiance = vec3( 0.0 );\n\tvec3 clearcoatRadiance = vec3( 0.0 );\n\n#endif\n",lights_pars_begin:"\n#if defined( USE_CSM ) && defined( CSM_CASCADES )\nuniform vec2 CSM_cascades[CSM_CASCADES];\nuniform float cameraNear;\nuniform float shadowFar;\n#endif\n\t"+a.lights_pars_begin};
|
2
|
-
/*
|
1
|
+
import*as t from"three";const e={add:t.Object3D.prototype.add,attach:t.Object3D.prototype.attach},i=new WeakMap,n=new WeakMap;export const CSMUtil=new class{constructor(){this.renderingView=null}onBeforeCompile(e,i){e.defines=e.defines||{},e.defines.USE_CSM=1,e.defines.CSM_CASCADES=this.renderingView.csm.cascades;const n=this.renderingView.camera instanceof t.PerspectiveCamera?this.renderingView.camera.far:Number.MAX_SAFE_INTEGER,a=this.renderingView.camera instanceof t.PerspectiveCamera?this.renderingView.camera.near:0,o=Math.min(n,this.renderingView.csm.maxFar),r=[];this.renderingView.csm.getExtendedBreaks(r),i.uniforms.CSM_cascades={value:r},i.uniforms.cameraNear={value:a},i.uniforms.shadowFar={value:o}}patchThreeAdd(){const a=this.renderingView;i.set(a.scene,a.csm);for(const[a,o]of Object.entries(e))t.Object3D.prototype[a]=function(...e){let a=this;for(;null!=a.parent;)a=a.parent;const r=a,d=i.get(r);if(null==d)return o.apply(this,arguments),this;n.has(r)||n.set(r,new WeakSet);const c=n.get(r);function h(t){t&&!c.has(t)&&(c.add(t),d?.setupMaterial(t))}return e.forEach((e=>e?.traverse((e=>{if(e instanceof t.Mesh||e instanceof t.SkinnedMesh)if(e.material instanceof Array)for(const t of e.material)h(t);else h(e.material)})))),o.apply(this,arguments),this}}};import{ShaderChunk as a}from"three";a.lights_pars_begin;export const CSMShader={lights_fragment_begin:"\nvec3 geometryPosition = - vViewPosition;\nvec3 geometryNormal = normal;\nvec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\n\nvec3 geometryClearcoatNormal = vec3( 0.0 );\n\n#ifdef USE_CLEARCOAT\n\n\tgeometryClearcoatNormal = clearcoatNormal;\n\n#endif\n\n#ifdef USE_IRIDESCENCE\n\tfloat dotNVi = saturate( dot( normal, geometryViewDir ) );\n\tif ( material.iridescenceThickness == 0.0 ) {\n\t\tmaterial.iridescence = 0.0;\n\t} else {\n\t\tmaterial.iridescence = saturate( material.iridescence );\n\t}\n\tif ( material.iridescence > 0.0 ) {\n\t\tmaterial.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );\n\t\t// Iridescence F0 approximation\n\t\tmaterial.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );\n\t}\n#endif\n\nIncidentLight directLight;\n\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\n\tPointLight pointLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLightShadow;\n\t#endif\n\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\n\t\tpointLight = pointLights[ i ];\n\n\t\tgetPointLightInfo( pointLight, geometryPosition, directLight );\n\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\n\t\tpointLightShadow = pointLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\n\t\t#endif\n\n\t\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\n\t}\n\t#pragma unroll_loop_end\n\n#endif\n\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\n\tSpotLight spotLight;\n \tvec4 spotColor;\n\tvec3 spotLightCoord;\n\tbool inSpotLightMap;\n\n\t#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLightShadow;\n\t#endif\n\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\n\t\tspotLight = spotLights[ i ];\n\n\t\tgetSpotLightInfo( spotLight, geometryPosition, directLight );\n\n \t\t// spot lights are ordered [shadows with maps, shadows without maps, maps without shadows, none]\n\t\t#if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n\t\t#define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX\n\t\t#elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\t#define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS\n\t\t#else\n\t\t#define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n\t\t#endif\n\t\t#if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )\n\t\t\tspotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;\n\t\t\tinSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );\n\t\t\tspotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );\n\t\t\tdirectLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;\n\t\t#endif\n\t\t#undef SPOT_LIGHT_MAP_INDEX\n\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\tspotLightShadow = spotLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n\n\t\t#endif\n\n\t\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\n\t}\n\t#pragma unroll_loop_end\n\n#endif\n\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct ) && defined( USE_CSM ) && defined( CSM_CASCADES )\n\n\tDirectionalLight directionalLight;\n\tfloat linearDepth = (vViewPosition.z) / (shadowFar - cameraNear);\n\t#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLightShadow;\n\t#endif\n\n\t#if defined( USE_SHADOWMAP ) && defined( CSM_FADE )\n\t\tvec2 cascade;\n\t\tfloat cascadeCenter;\n\t\tfloat closestEdge;\n\t\tfloat margin;\n\t\tfloat csmx;\n\t\tfloat csmy;\n\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\n\t\t\tdirectionalLight = directionalLights[ i ];\n\t\t\tgetDirectionalLightInfo( directionalLight, directLight );\n\n\t\t\t#if ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n\t\t\t\t// NOTE: Depth gets larger away from the camera.\n\t\t\t\t// cascade.x is closer, cascade.y is further\n\t\t\t\tcascade = CSM_cascades[ i ];\n\t\t\t\tcascadeCenter = ( cascade.x + cascade.y ) / 2.0;\n\t\t\t\tclosestEdge = linearDepth < cascadeCenter ? cascade.x : cascade.y;\n\t\t\t\tmargin = 0.25 * pow( closestEdge, 2.0 );\n\t\t\t\tcsmx = cascade.x - margin / 2.0;\n\t\t\t\tcsmy = cascade.y + margin / 2.0;\n\t\t\t\tif( linearDepth >= csmx && ( linearDepth < csmy || UNROLLED_LOOP_INDEX == CSM_CASCADES - 1 ) ) {\n\n\t\t\t\t\tfloat dist = min( linearDepth - csmx, csmy - linearDepth );\n\t\t\t\t\tfloat ratio = clamp( dist / margin, 0.0, 1.0 );\n\n\t\t\t\t\tvec3 prevColor = directLight.color;\n\t\t\t\t\tdirectionalLightShadow = directionalLightShadows[ i ];\n\t\t\t\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\n\t\t\t\t\tbool shouldFadeLastCascade = UNROLLED_LOOP_INDEX == CSM_CASCADES - 1 && linearDepth > cascadeCenter;\n\t\t\t\t\tdirectLight.color = mix( prevColor, directLight.color, shouldFadeLastCascade ? ratio : 1.0 );\n\n\t\t\t\t\tReflectedLight prevLight = reflectedLight;\n\t\t\t\t\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\n\t\t\t\t\tbool shouldBlend = UNROLLED_LOOP_INDEX != CSM_CASCADES - 1 || UNROLLED_LOOP_INDEX == CSM_CASCADES - 1 && linearDepth < cascadeCenter;\n\t\t\t\t\tfloat blendRatio = shouldBlend ? ratio : 1.0;\n\n\t\t\t\t\treflectedLight.directDiffuse = mix( prevLight.directDiffuse, reflectedLight.directDiffuse, blendRatio );\n\t\t\t\t\treflectedLight.directSpecular = mix( prevLight.directSpecular, reflectedLight.directSpecular, blendRatio );\n\t\t\t\t\treflectedLight.indirectDiffuse = mix( prevLight.indirectDiffuse, reflectedLight.indirectDiffuse, blendRatio );\n\t\t\t\t\treflectedLight.indirectSpecular = mix( prevLight.indirectSpecular, reflectedLight.indirectSpecular, blendRatio );\n\n\t\t\t\t}\n\t\t\t#endif\n\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#elif defined (USE_SHADOWMAP)\n\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\n\t\t\tdirectionalLight = directionalLights[ i ];\n\t\t\tgetDirectionalLightInfo( directionalLight, directLight );\n\n\t\t\t#if ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n\n\t\t\t\tdirectionalLightShadow = directionalLightShadows[ i ];\n\t\t\t\tif(linearDepth >= CSM_cascades[UNROLLED_LOOP_INDEX].x && linearDepth < CSM_cascades[UNROLLED_LOOP_INDEX].y) directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\n\t\t\t\tif(linearDepth >= CSM_cascades[UNROLLED_LOOP_INDEX].x && (linearDepth < CSM_cascades[UNROLLED_LOOP_INDEX].y || UNROLLED_LOOP_INDEX == CSM_CASCADES - 1)) RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\n\t\t\t#endif\n\n\t\t}\n\t\t#pragma unroll_loop_end\n\n\t#elif ( NUM_DIR_LIGHT_SHADOWS > 0 )\n\t\t// note: no loop here - all CSM lights are in fact one light only\n\t\tgetDirectionalLightInfo( directionalLights[0], directLight );\n\t\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\n\t#endif\n\n\t#if ( NUM_DIR_LIGHTS > NUM_DIR_LIGHT_SHADOWS)\n\t\t// compute the lights not casting shadows (if any)\n\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = NUM_DIR_LIGHT_SHADOWS; i < NUM_DIR_LIGHTS; i ++ ) {\n\n\t\t\tdirectionalLight = directionalLights[ i ];\n\n\t\t\tgetDirectionalLightInfo( directionalLight, directLight );\n\n\t\t\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\n\t\t}\n\t\t#pragma unroll_loop_end\n\n\t#endif\n\n#endif\n\n\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct ) && !defined( USE_CSM ) && !defined( CSM_CASCADES )\n\n\tDirectionalLight directionalLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLightShadow;\n\t#endif\n\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\n\t\tdirectionalLight = directionalLights[ i ];\n\n\t\tgetDirectionalLightInfo( directionalLight, directLight );\n\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n\t\tdirectionalLightShadow = directionalLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\n\t\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\n\t}\n\t#pragma unroll_loop_end\n\n#endif\n\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\n\tRectAreaLight rectAreaLight;\n\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\n\t}\n\t#pragma unroll_loop_end\n\n#endif\n\n#if defined( RE_IndirectDiffuse )\n\n\tvec3 iblIrradiance = vec3( 0.0 );\n\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\n\t#if defined( USE_LIGHT_PROBES )\n\n\t\tirradiance += getLightProbeIrradiance( lightProbe, geometryNormal );\n\n\t#endif\n\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal );\n\n\t\t}\n\t\t#pragma unroll_loop_end\n\n\t#endif\n\n#endif\n\n#if defined( RE_IndirectSpecular )\n\n\tvec3 radiance = vec3( 0.0 );\n\tvec3 clearcoatRadiance = vec3( 0.0 );\n\n#endif\n",lights_pars_begin:"\n#if defined( USE_CSM ) && defined( CSM_CASCADES )\nuniform vec2 CSM_cascades[CSM_CASCADES];\nuniform float cameraNear;\nuniform float shadowFar;\n#endif\n\t"+a.lights_pars_begin};/*
|
3
2
|
* Copyright (©) 2023. All rights reserved.
|
4
3
|
* See the LICENSE.md file for details.
|
5
4
|
*/
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"examples.d.ts","sourceRoot":"","sources":["../../../src/effects/particles/examples.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwI9B,CAAA"}
|
@@ -1,5 +1,4 @@
|
|
1
|
-
export const testParticleSystem={preParticles:500,integrationType:"EULER",emitters:[{id:"51ca9450-3d8b-11e9-a1e8-4785d9606b75",totalEmitTimes:null,life:null,cache:{totalEmitTimes:null,life:null},rate:{particlesMin:1,particlesMax:4,perSecondMin:.01,perSecondMax:.02},position:{x:0,y:0,z:0},rotation:{x:0,y:0,z:0},initializers:[{id:"51ca9451-3d8b-11e9-a1e8-4785d9606b75",type:"Mass",properties:{min:30,max:10,isEnabled:!0}},{id:"51ca9452-3d8b-11e9-a1e8-4785d9606b75",type:"Life",properties:{min:2,max:4,isEnabled:!0}},{id:"51ca9453-3d8b-11e9-a1e8-4785d9606b75",type:"BodySprite",properties:{texture:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABGdBTUEAAK/INwWK6QAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAJkSURBVHjaxJeJbusgEEW94S1L//83X18M2MSuLd2pbqc4wZGqRLrKBsyZhQHny7Jk73xVL8xpVhWrcmiB5lX+6GJ5YgQ2owbAm8oIwH1VgKZUmGcRqKGGPgtEQQAzGR8hQ59fAmhJHSAagigJ4E7GPWRXOYC6owAd1JM6wDQPADyMWUqZRMqmAojHp1Vn6EQQEgUNMJLnUjMyJsM49wygBkAPw9dVFwXRkncCIIW3GRgoTQUZn6HxCMAFEFd8TwEQ78X4rHbILoAUmeT+RFG4UhQ6MiIAE4W/UsYFjuVjAIa2nIY4q1R0GFtQWG3E84lqw2GO2QOoCKBVu0BAPgDSU0eUDjjQenNkV/AW/pWChhpMTelo1a64AOKM30vk18GzTHXCNtI/Knz3DFBgsUqBGIjTInXRY1yA9xkVoqW5tVq3pDR9A0hfF5BSARmVnh7RMDCaIdcNgbPBkgzn1Bu+SfIEFSpSBmkxyrMicb0fAEuCZrWnN89veA/4XcakrPcjBWzkTuLjlbfTQPOlBhz+HwkqqPXmPQDdrQItxE1moGof1S74j/8txk8EHhTQrAE8qlwfqS5yukm1x/rAJ9Jiaa6nyATqD78aUVBhFo8b1V4DdTXdCW+IxA1zB4JhiOhZMEWO1HqnvdoHZ4FAMIhV9REF8FiUm0jsYPEJx/Fm/N8OhH90HI9YRHesWbXXZwAShU8qThe7H8YAuJmw5yOd989uRINKRTJAhoF8jbqrHKfeCYdIISZfSq26bk/K+yO3YvfKrVgiwQBHnwt8ynPB25+M8hceTt/ybPhnryJ78+tLgAEAuCFyiQgQB30AAAAASUVORK5CYII=",isEnabled:!0}},{id:"51ca9454-3d8b-11e9-a1e8-4785d9606b75",type:"Radius",properties:{width:12,height:4,isEnabled:!0}},{id:"51ca9455-3d8b-11e9-a1e8-4785d9606b75",type:"RadialVelocity",properties:{radius:10,x:0,y:5,z:0,theta:900,isEnabled:!0}}],behaviours:[{id:"51ca9456-3d8b-11e9-a1e8-4785d9606b75",type:"Alpha",properties:{alphaA:1,alphaB:0,life:null,easing:"easeLinear"}},{id:"51ca9457-3d8b-11e9-a1e8-4785d9606b75",type:"Color",properties:{colorA:"#002a4f",colorB:"#0029FF",life:null,easing:"easeOutCubic"}},{id:"51ca9458-3d8b-11e9-a1e8-4785d9606b75",type:"Scale",properties:{scaleA:1,scaleB:.5,life:null,easing:"easeLinear"}},{id:"51ca9459-3d8b-11e9-a1e8-4785d9606b75",type:"Force",properties:{fx:0,fy:5,fz:0,life:null,easing:"easeLinear"}},{id:"51ca945a-3d8b-11e9-a1e8-4785d9606b75",type:"Rotate",properties:{x:1,y:0,z:0,life:null,easing:"easeLinear"}},{id:"51ca945b-3d8b-11e9-a1e8-4785d9606b75",type:"RandomDrift",properties:{driftX:1,driftY:23,driftZ:4,delay:1,life:null,easing:"easeLinear"}},{id:"51ca945c-3d8b-11e9-a1e8-4785d9606b75",type:"Spring",properties:{x:1,y:5,z:0,spring:.01,friction:1,life:null,easing:"easeLinear"}}],emitterBehaviours:[]}]}
|
2
|
-
/*
|
1
|
+
export const testParticleSystem={preParticles:500,integrationType:"EULER",emitters:[{id:"51ca9450-3d8b-11e9-a1e8-4785d9606b75",totalEmitTimes:null,life:null,cache:{totalEmitTimes:null,life:null},rate:{particlesMin:1,particlesMax:4,perSecondMin:.01,perSecondMax:.02},position:{x:0,y:0,z:0},rotation:{x:0,y:0,z:0},initializers:[{id:"51ca9451-3d8b-11e9-a1e8-4785d9606b75",type:"Mass",properties:{min:30,max:10,isEnabled:!0}},{id:"51ca9452-3d8b-11e9-a1e8-4785d9606b75",type:"Life",properties:{min:2,max:4,isEnabled:!0}},{id:"51ca9453-3d8b-11e9-a1e8-4785d9606b75",type:"BodySprite",properties:{texture:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABGdBTUEAAK/INwWK6QAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAJkSURBVHjaxJeJbusgEEW94S1L//83X18M2MSuLd2pbqc4wZGqRLrKBsyZhQHny7Jk73xVL8xpVhWrcmiB5lX+6GJ5YgQ2owbAm8oIwH1VgKZUmGcRqKGGPgtEQQAzGR8hQ59fAmhJHSAagigJ4E7GPWRXOYC6owAd1JM6wDQPADyMWUqZRMqmAojHp1Vn6EQQEgUNMJLnUjMyJsM49wygBkAPw9dVFwXRkncCIIW3GRgoTQUZn6HxCMAFEFd8TwEQ78X4rHbILoAUmeT+RFG4UhQ6MiIAE4W/UsYFjuVjAIa2nIY4q1R0GFtQWG3E84lqw2GO2QOoCKBVu0BAPgDSU0eUDjjQenNkV/AW/pWChhpMTelo1a64AOKM30vk18GzTHXCNtI/Knz3DFBgsUqBGIjTInXRY1yA9xkVoqW5tVq3pDR9A0hfF5BSARmVnh7RMDCaIdcNgbPBkgzn1Bu+SfIEFSpSBmkxyrMicb0fAEuCZrWnN89veA/4XcakrPcjBWzkTuLjlbfTQPOlBhz+HwkqqPXmPQDdrQItxE1moGof1S74j/8txk8EHhTQrAE8qlwfqS5yukm1x/rAJ9Jiaa6nyATqD78aUVBhFo8b1V4DdTXdCW+IxA1zB4JhiOhZMEWO1HqnvdoHZ4FAMIhV9REF8FiUm0jsYPEJx/Fm/N8OhH90HI9YRHesWbXXZwAShU8qThe7H8YAuJmw5yOd989uRINKRTJAhoF8jbqrHKfeCYdIISZfSq26bk/K+yO3YvfKrVgiwQBHnwt8ynPB25+M8hceTt/ybPhnryJ78+tLgAEAuCFyiQgQB30AAAAASUVORK5CYII=",isEnabled:!0}},{id:"51ca9454-3d8b-11e9-a1e8-4785d9606b75",type:"Radius",properties:{width:12,height:4,isEnabled:!0}},{id:"51ca9455-3d8b-11e9-a1e8-4785d9606b75",type:"RadialVelocity",properties:{radius:10,x:0,y:5,z:0,theta:900,isEnabled:!0}}],behaviours:[{id:"51ca9456-3d8b-11e9-a1e8-4785d9606b75",type:"Alpha",properties:{alphaA:1,alphaB:0,life:null,easing:"easeLinear"}},{id:"51ca9457-3d8b-11e9-a1e8-4785d9606b75",type:"Color",properties:{colorA:"#002a4f",colorB:"#0029FF",life:null,easing:"easeOutCubic"}},{id:"51ca9458-3d8b-11e9-a1e8-4785d9606b75",type:"Scale",properties:{scaleA:1,scaleB:.5,life:null,easing:"easeLinear"}},{id:"51ca9459-3d8b-11e9-a1e8-4785d9606b75",type:"Force",properties:{fx:0,fy:5,fz:0,life:null,easing:"easeLinear"}},{id:"51ca945a-3d8b-11e9-a1e8-4785d9606b75",type:"Rotate",properties:{x:1,y:0,z:0,life:null,easing:"easeLinear"}},{id:"51ca945b-3d8b-11e9-a1e8-4785d9606b75",type:"RandomDrift",properties:{driftX:1,driftY:23,driftZ:4,delay:1,life:null,easing:"easeLinear"}},{id:"51ca945c-3d8b-11e9-a1e8-4785d9606b75",type:"Spring",properties:{x:1,y:5,z:0,spring:.01,friction:1,life:null,easing:"easeLinear"}}],emitterBehaviours:[]}]};/*
|
3
2
|
* Copyright (©) 2023. All rights reserved.
|
4
3
|
* See the LICENSE.md file for details.
|
5
4
|
*/
|
@@ -83,3 +83,4 @@ export interface ParticleSystemConfig {
|
|
83
83
|
export type InitializerType = 'Body' | 'BodySprite' | 'Life' | 'Mass' | 'Position' | 'Radius' | 'RadialVelocity' | 'Rate' | 'Texture';
|
84
84
|
export type BehaviourType = 'Alpha' | 'Attraction' | 'Collision' | 'Color' | 'CrossZone' | 'Force' | 'Gravity' | 'RandomDrift' | 'Repulsion' | 'Rotate' | 'Scale' | 'Spring';
|
85
85
|
export type Easing = 'easeLinear' | 'easeInQuad' | 'easeOutQuad' | 'easeInOutQuad' | 'easeInCubic' | 'easeOutCubic' | 'easeInOutCubic' | 'easeInQuart' | 'easeOutQuart' | 'easeInOutQuart' | 'easeInSine' | 'easeOutSine' | 'easeInOutSine' | 'easeInExpo' | 'easeOutExpo' | 'easeInOutExpo' | 'easeInCirc' | 'easeOutCirc' | 'easeInOutCirc' | 'easeInBack' | 'easeOutBack' | 'easeInOutBack';
|
86
|
+
//# sourceMappingURL=particle-system-config.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"particle-system-config.d.ts","sourceRoot":"","sources":["../../../src/effects/particles/particle-system-config.ts"],"names":[],"mappings":"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"}
|
@@ -1,5 +1,6 @@
|
|
1
|
-
import { Behaviour, Emitter, Particle
|
1
|
+
import { Behaviour, Emitter, Particle } from "@hology/nebula";
|
2
2
|
import * as THREE from 'three';
|
3
|
+
export type EasingFunction = (x: number) => number;
|
3
4
|
/**
|
4
5
|
* Rotate position around an axis.
|
5
6
|
*/
|
@@ -68,3 +69,4 @@ export declare class MoveOverLife extends Behaviour {
|
|
68
69
|
initialize(particle: Particle): void;
|
69
70
|
mutate(target: Particle | Emitter, time: number, index: number): void;
|
70
71
|
}
|
72
|
+
//# sourceMappingURL=behaviours.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"behaviours.d.ts","sourceRoot":"","sources":["../../../src/effects/vfx/behaviours.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAY,OAAO,EAAE,QAAQ,EAAmB,MAAM,gBAAgB,CAAA;AACxF,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAG9B,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,EAAE,MAAM,KAAK,MAAM,CAAA;AAElD;;GAEG;AACH,qBAAa,cAAe,SAAQ,SAAS;IAE/B,OAAO,CAAC,IAAI;IAAiB,OAAO,CAAC,KAAK;gBAAlC,IAAI,EAAE,KAAK,CAAC,OAAO,EAAU,KAAK,EAAE,MAAM;IAG9D,OAAO,CAAC,MAAM,CAAsD;IAEpE,MAAM,CAAC,MAAM,EAAE,QAAQ,GAAG,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI;CAMtE;AAED,oBAAY,aAAa;IACvB,CAAC,IAAA;IAAC,CAAC,IAAA;IAAC,CAAC,IAAA;IAAC,EAAE,IAAA;IAAC,EAAE,IAAA;IAAC,EAAE,IAAA;CACf;AAED,qBAAa,mBAAoB,SAAQ,SAAS;IACpC,OAAO,CAAC,aAAa;gBAAb,aAAa,EAAE,aAAa;IAGhD,UAAU,CAAC,QAAQ,EAAE,QAAQ,GAAG,IAAI;IAIpC,MAAM,CAAC,MAAM,EAAE,QAAQ,GAAG,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI;CAStE;AAED,qBAAa,YAAa,SAAQ,SAAS;IAC7B,OAAO,CAAC,KAAK;gBAAL,KAAK,EAAE,MAAM;IAGjC,UAAU,CAAC,QAAQ,EAAE,QAAQ,GAAG,IAAI;IAEpC,MAAM,CAAC,MAAM,EAAE,QAAQ,GAAG,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI;CAUtE;AAID,qBAAa,KAAM,SAAQ,SAAS;IACtB,OAAO,CAAC,MAAM;IAAU,OAAO,CAAC,MAAM;gBAA9B,MAAM,EAAE,MAAM,EAAU,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,cAAc;IACjF;;QAEI;IACJ,UAAU,CAAC,QAAQ,EAAE,QAAQ;IAO7B,MAAM,CAAC,MAAM,EAAE,QAAQ,GAAG,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI;CAevE;AAED,qBAAa,aAAc,SAAQ,SAAS;IAE9B,OAAO,CAAC,MAAM;gBAAN,MAAM,EAAE,MAAM;IAIlC,MAAM,CAAC,MAAM,EAAE,QAAQ,GAAG,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI;CAKtE;AAkBD,oBAAY,SAAS;IACnB,EAAE,IAAA;IACF,EAAE,IAAA;IACF,EAAE,IAAA;IACF,GAAG,IAAA;CAEJ;AAED,qBAAa,QAAS,SAAQ,SAAS;IAQzB,OAAO,CAAC,QAAQ;IAAU,OAAO,CAAC,KAAK;gBAA/B,QAAQ,EAAE,MAAM,EAAU,KAAK,EAAE,SAAS,EAAE,MAAM,GAAE,cAAgC;IAIxG,UAAU,CAAC,QAAQ,EAAE,QAAQ,GAAG,IAAI;IAmBpC,MAAM,CAAC,MAAM,EAAE,QAAQ,GAAG,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI;CA4BtE;AAED,qBAAa,YAAa,SAAQ,SAAS;IAI7B,OAAO,CAAC,CAAC;IAAU,OAAO,CAAC,CAAC;IAAU,OAAO,CAAC,CAAC;IAH3D,OAAO,CAAC,YAAY,CAAS;IAC7B,OAAO,CAAC,OAAO,CAAS;gBAEJ,CAAC,EAAE,MAAM,EAAU,CAAC,EAAE,MAAM,EAAU,CAAC,EAAE,MAAM,EAAE,MAAM,GAAE,cAAgC;IAM7G,UAAU,CAAC,QAAQ,EAAE,QAAQ,GAAG,IAAI;IAMpC,MAAM,CAAC,MAAM,EAAE,QAAQ,GAAG,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI;CAyBtE"}
|
@@ -1,5 +1,4 @@
|
|
1
|
-
import{Behaviour as t,Vector3D as s,ease as i}from"
|
2
|
-
/*
|
1
|
+
import{Behaviour as t,Vector3D as s,ease as i,MathUtils as e}from"@hology/nebula";import*as o from"three";export class RotatePosition extends t{constructor(t,i){super(),this.axis=t,this.angle=i,this.axis3D=new s(this.axis.x,this.axis.y,this.axis.z)}mutate(t,s,i){this.energize(t,s),t.position.sub(t.parent.position),t.position.applyAxisAngle(this.axis3D,this.angle*s),t.position.add(t.parent.position)}}export var AxisDirection;!function(t){t[t.x=0]="x",t[t.y=1]="y",t[t.z=2]="z",t[t.mx=3]="mx",t[t.my=4]="my",t[t.mz=5]="mz"}(AxisDirection||(AxisDirection={}));export class OrientAlongVelocity extends t{constructor(t){super(),this.axisDirection=t}initialize(t){t.transform.orientAlongVelocity=!0}mutate(t,s,i){t.target,o.Object3D}}export class FollowParent extends t{constructor(t){super(),this.speed=t}initialize(t){}mutate(t,s,i){const e=t.parent.parentParticle??t.parent,o=n.copy(e.position).sub(t.position),r=(o.length(),o.normalize());a.copy(r).multiplyScalar(this.speed),t.velocity.copy(a)}}export class Scale extends t{constructor(t,s,i){super(void 0,i),this.scaleA=t,this.scaleB=s}initialize(t){t.transform.scaleA=t.scale*this.scaleA,t.transform.scaleB=t.scale*this.scaleB,t.transform.oldRadius=t.radius}mutate(t,s,i){this.energize(t,s),t.scale=e.lerp(t.transform.scaleA,t.transform.scaleB,this.energy),t.scale<5e-4&&(t.scale=0),t.radius=t.transform.oldRadius*t.scale}}export class LinearDamping extends t{constructor(t){super(),this.factor=t}mutate(t,s,i){this.energize(t,s);const e=n.copy(t.velocity).multiplyScalar(-this.factor*s);t.velocity.add(e)}}const n=new s,a=new s;export var AxisPlane;!function(t){t[t.xy=0]="xy",t[t.xz=1]="xz",t[t.yz=2]="yz",t[t.xyz=3]="xyz"}(AxisPlane||(AxisPlane={}));export class Disperse extends t{constructor(t,s,e=i.easeLinear){super(void 0,e,void 0,!0),this.distance=t,this.plane=s}initialize(t){t.transform.initialPos=t.position.clone();const s=r.copy(t.transform.initialPos).sub(t.parent.position).normalize();switch(this.plane){case AxisPlane.xy:s.setComponent(2,0);break;case AxisPlane.xz:s.setComponent(1,0);break;case AxisPlane.yz:s.setComponent(0,0)}t.transform.displacement=s.clone().multiplyScalar(this.distance),t.transform.prevEnergy=1}mutate(t,s,i){this.energize(t,s);t.transform.initialPos;const e=t.transform.displacement,o=t.transform.prevEnergy-this.energy;t.transform.prevEnergy=this.energy;t.position.x+=e.x*o,t.position.y+=e.y*o,t.position.z+=e.z*o}}export class MoveOverLife extends t{constructor(t,s,e,o=i.easeLinear){super(void 0,o,void 0,!0),this.x=t,this.y=s,this.z=e}initialize(t){t.transform.initialPos=t.position.clone()}mutate(t,s,i){this.energize(t,s);const e=t.transform.initialPos,o=1-this.energy;t.position.x=e.x+this.x*o,t.position.y=e.y+this.y*o,t.position.z=e.z+this.z*o}}const r=new s;/*
|
3
2
|
* Copyright (©) 2023. All rights reserved.
|
4
3
|
* See the LICENSE.md file for details.
|
5
4
|
*/
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/effects/vfx/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAA;AAC9B,cAAc,uBAAuB,CAAA;AACrC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,kBAAkB,CAAA"}
|
@@ -1,5 +1,4 @@
|
|
1
|
-
export*from"./vfx-asset.js";export*from"./vfx-materializer.js";export*from"./vfx-actor.js";export*from"./vfx-service.js"
|
2
|
-
/*
|
1
|
+
export*from"./vfx-asset.js";export*from"./vfx-materializer.js";export*from"./vfx-actor.js";export*from"./vfx-service.js";/*
|
3
2
|
* Copyright (©) 2023. All rights reserved.
|
4
3
|
* See the LICENSE.md file for details.
|
5
4
|
*/
|
@@ -1,74 +1,55 @@
|
|
1
1
|
import { Vector3 } from "three";
|
2
|
-
import { Emitter, Particle } from "
|
3
|
-
declare
|
4
|
-
export declare class DefaultInitializer extends DefaultInitializer_base {
|
2
|
+
import { Emitter, Particle, Initializer } from "@hology/nebula";
|
3
|
+
export declare class DefaultInitializer extends Initializer {
|
5
4
|
init(emitter: Emitter, particle: Particle): void;
|
5
|
+
initialize(target: Emitter | Particle): void;
|
6
6
|
}
|
7
|
-
declare
|
8
|
-
export declare class Rotation extends Rotation_base {
|
7
|
+
export declare class Rotation extends Initializer {
|
9
8
|
private rotation;
|
10
9
|
constructor(rotation: Vector3);
|
11
|
-
|
10
|
+
initialize(target: Particle): void;
|
12
11
|
}
|
13
|
-
declare
|
14
|
-
export declare class RandomRotation extends RandomRotation_base {
|
12
|
+
export declare class RandomRotation extends Initializer {
|
15
13
|
constructor();
|
16
|
-
|
14
|
+
initialize(particle: Particle): void;
|
17
15
|
private randomAngle;
|
18
16
|
}
|
19
|
-
declare
|
20
|
-
export declare class InitialScale extends InitialScale_base {
|
17
|
+
export declare class InitialScale extends Initializer {
|
21
18
|
private scale;
|
22
19
|
constructor(scale: number);
|
23
|
-
|
20
|
+
initialize(particle: Particle): void;
|
24
21
|
}
|
25
|
-
declare
|
26
|
-
export declare class RandomScale extends RandomScale_base {
|
22
|
+
export declare class RandomScale extends Initializer {
|
27
23
|
private min;
|
28
24
|
private max;
|
29
25
|
constructor(min: number, max: number);
|
30
|
-
|
26
|
+
initialize(particle: Particle): void;
|
31
27
|
}
|
32
|
-
declare
|
33
|
-
export declare class InitialScaleComponents extends InitialScaleComponents_base {
|
28
|
+
export declare class InitialScaleComponents extends Initializer {
|
34
29
|
private scale;
|
35
30
|
constructor(scale: Vector3);
|
36
|
-
|
31
|
+
initialize(particle: Particle): void;
|
37
32
|
}
|
38
|
-
declare
|
39
|
-
export declare class AdditiveVelocity extends AdditiveVelocity_base {
|
33
|
+
export declare class AdditiveVelocity extends Initializer {
|
40
34
|
private velocity;
|
41
35
|
constructor(velocity: Vector3);
|
42
|
-
|
36
|
+
initialize(particle: Particle): void;
|
43
37
|
}
|
44
|
-
declare
|
45
|
-
export declare class RandomDirection extends RandomDirection_base {
|
38
|
+
export declare class RandomDirection extends Initializer {
|
46
39
|
private speed;
|
47
40
|
constructor(speed: number);
|
48
|
-
|
41
|
+
initialize(target: Emitter | Particle): void;
|
49
42
|
}
|
50
|
-
declare const RandomComponentsDirection_base: any;
|
51
43
|
/**
|
52
44
|
* Restrict randomness with two vectors
|
53
45
|
*/
|
54
|
-
export declare class
|
55
|
-
private speed;
|
56
|
-
private min;
|
57
|
-
private max;
|
58
|
-
private x;
|
59
|
-
private y;
|
60
|
-
private z;
|
61
|
-
constructor(speed: number, min: Vector3, max: Vector3);
|
62
|
-
init(emitter: Emitter, particle: Particle): void;
|
63
|
-
}
|
64
|
-
declare const RandomVelocity_base: any;
|
65
|
-
export declare class RandomVelocity extends RandomVelocity_base {
|
46
|
+
export declare class RandomVelocity extends Initializer {
|
66
47
|
private min;
|
67
48
|
private max;
|
68
49
|
private x;
|
69
50
|
private y;
|
70
51
|
private z;
|
71
52
|
constructor(min: Vector3, max: Vector3);
|
72
|
-
|
53
|
+
initialize(target: Particle): void;
|
73
54
|
}
|
74
|
-
|
55
|
+
//# sourceMappingURL=initializsers.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"initializsers.d.ts","sourceRoot":"","sources":["../../../src/effects/vfx/initializsers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAChC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAA6B,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE3F,qBAAa,kBAAmB,SAAQ,WAAW;IACjD,IAAI,CAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ;IAIzC,UAAU,CAAC,MAAM,EAAE,OAAO,GAAG,QAAQ,GAAG,IAAI;CAG7C;AAGD,qBAAa,QAAS,SAAQ,WAAW;IAC3B,OAAO,CAAC,QAAQ;gBAAR,QAAQ,EAAE,OAAO;IACrC,UAAU,CAAC,MAAM,EAAE,QAAQ;CAK5B;AAGD,qBAAa,cAAe,SAAQ,WAAW;;IAE7C,UAAU,CAAE,QAAQ,EAAE,QAAQ;IAI9B,OAAO,CAAC,WAAW;CAGpB;AAGD,qBAAa,YAAa,SAAQ,WAAW;IAC/B,OAAO,CAAC,KAAK;gBAAL,KAAK,EAAE,MAAM;IACjC,UAAU,CAAC,QAAQ,EAAE,QAAQ;CAG9B;AAED,qBAAa,WAAY,SAAQ,WAAW;IAC9B,OAAO,CAAC,GAAG;IAAU,OAAO,CAAC,GAAG;gBAAxB,GAAG,EAAE,MAAM,EAAU,GAAG,EAAE,MAAM;IACpD,UAAU,CAAC,QAAQ,EAAE,QAAQ;CAG9B;AAGD,qBAAa,sBAAuB,SAAQ,WAAW;IACzC,OAAO,CAAC,KAAK;gBAAL,KAAK,EAAE,OAAO;IAClC,UAAU,CAAE,QAAQ,EAAE,QAAQ;CAG/B;AAED,qBAAa,gBAAiB,SAAQ,WAAW;IACnC,OAAO,CAAC,QAAQ;gBAAR,QAAQ,EAAE,OAAO;IAErC,UAAU,CAAC,QAAQ,EAAE,QAAQ;CAK9B;AAGD,qBAAa,eAAgB,SAAQ,WAAW;IAClC,OAAO,CAAC,KAAK;gBAAL,KAAK,EAAE,MAAM;IAEjC,UAAU,CAAC,MAAM,EAAE,OAAO,GAAG,QAAQ,GAAG,IAAI;CAO7C;AAED;;GAEG;AAcH,qBAAa,cAAe,SAAQ,WAAW;IAIjC,OAAO,CAAC,GAAG;IAAW,OAAO,CAAC,GAAG;IAH7C,OAAO,CAAC,CAAC,CAAmC;IAC5C,OAAO,CAAC,CAAC,CAAmC;IAC5C,OAAO,CAAC,CAAC,CAAmC;gBACxB,GAAG,EAAE,OAAO,EAAU,GAAG,EAAE,OAAO;IACtD,UAAU,CAAC,MAAM,EAAE,QAAQ;CAM5B"}
|
@@ -1,5 +1,4 @@
|
|
1
|
-
import{Vector3 as t}from"three";import{Span as
|
2
|
-
/*
|
1
|
+
import{Vector3 as t}from"three";import{Span as i,Initializer as e}from"@hology/nebula";export class DefaultInitializer extends e{init(t,i){i.parent=t}initialize(t){}}export class Rotation extends e{constructor(t){super(),this.rotation=t}initialize(t){"number"!=typeof t.rotation&&t.rotation.copy(this.rotation)}}export class RandomRotation extends e{constructor(){super()}initialize(t){t.rotation.set(this.randomAngle(),this.randomAngle(),this.randomAngle())}randomAngle(){return 2*Math.PI*Math.random()}}export class InitialScale extends e{constructor(t){super(),this.scale=t}initialize(t){t.scale=this.scale}}export class RandomScale extends e{constructor(t,i){super(),this.min=t,this.max=i}initialize(t){var i,e;t.scale=(i=this.min,e=this.max,Math.random()*(e-i)+i)}}export class InitialScaleComponents extends e{constructor(t){super(),this.scale=t}initialize(t){t.transform.initialScale=this.scale}}export class AdditiveVelocity extends e{constructor(t){super(),this.velocity=t}initialize(t){t.velocity.x+=this.velocity.x,t.velocity.y+=this.velocity.y,t.velocity.z+=this.velocity.z}}export class RandomDirection extends e{constructor(t){super(),this.speed=t}initialize(t){s.set(2*Math.random()-1,2*Math.random()-1,2*Math.random()-1).normalize().multiplyScalar(this.speed),t.velocity.x+=s.x,t.velocity.y+=s.y,t.velocity.z+=s.z}}export class RandomVelocity extends e{constructor(t,e){super(),this.min=t,this.max=e,this.x=new i(this.min.x,this.max.x),this.y=new i(this.min.y,this.max.y),this.z=new i(this.min.z,this.max.z)}initialize(t){t.velocity.x+=this.x.getValue(),t.velocity.y+=this.y.getValue(),t.velocity.z+=this.z.getValue()}}const s=new t;/*
|
3
2
|
* Copyright (©) 2023. All rights reserved.
|
4
3
|
* See the LICENSE.md file for details.
|
5
4
|
*/
|
@@ -1,9 +1,9 @@
|
|
1
|
-
import { Rate } from "
|
2
|
-
import
|
3
|
-
export { Rate } from
|
1
|
+
import { Rate } from "@hology/nebula";
|
2
|
+
import { Span, SpanValue } from '@hology/nebula';
|
3
|
+
export { Rate } from "@hology/nebula";
|
4
4
|
export declare class DelayRate extends Rate {
|
5
5
|
readonly delay: number;
|
6
|
-
constructor(delay?: number, numPan?:
|
6
|
+
constructor(delay?: number, numPan?: number | SpanValue[] | Span, timePan?: number | SpanValue[] | Span);
|
7
7
|
restart(): void;
|
8
8
|
clone(): DelayRate;
|
9
9
|
}
|
@@ -15,3 +15,4 @@ export declare class OnceRate extends DelayRate {
|
|
15
15
|
init(): void;
|
16
16
|
getValue(time: any): number;
|
17
17
|
}
|
18
|
+
//# sourceMappingURL=rates.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"rates.d.ts","sourceRoot":"","sources":["../../../src/effects/vfx/rates.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AACtC,OAAO,EAAC,IAAI,EAAE,SAAS,EAAC,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAA;AAErC,qBAAa,SAAU,SAAQ,IAAI;aACL,KAAK,EAAE,MAAM;gBAAb,KAAK,GAAE,MAAU,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,EAAE,GAAG,IAAI,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,EAAE,GAAG,IAAI;IAK1H,OAAO,IAAI,IAAI;IAOf,KAAK;CAGN;AAED,qBAAa,QAAS,SAAQ,SAAS;IAEV,OAAO,CAAC,KAAK;IADxC,OAAO,CAAC,KAAK,CAAK;gBACN,KAAK,EAAE,MAAM,EAAU,KAAK,SAAI;IAK5C,KAAK;IAGL,IAAI;IAGJ,QAAQ,CAAC,IAAI,KAAA;CAuBd"}
|
@@ -1,5 +1,4 @@
|
|
1
|
-
import{Rate as t}from"
|
2
|
-
/*
|
1
|
+
import{Rate as t}from"@hology/nebula";export{Rate}from"@hology/nebula";export class DelayRate extends t{constructor(t=0,e,s){super(e,s),this.delay=t,this.restart()}restart(){this.nextTime=0,null!=this.delay&&this.delay>0&&(this.startTime=-this.delay)}clone(){return new DelayRate(this.delay,this.numPan,this.timePan)}}export class OnceRate extends DelayRate{constructor(t,e=1){super(t,e,1/0),this.count=e,this.calls=0,this.nextTime=0}clone(){return new OnceRate(this.delay,this.count)}init(){this.restart()}getValue(t){return this.calls++,this.startTime+=t,this.startTime>=this.nextTime?(this.nextTime=1/0,this.count):0}}/*
|
3
2
|
* Copyright (©) 2023. All rights reserved.
|
4
3
|
* See the LICENSE.md file for details.
|
5
4
|
*/
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"stretched-sprite.d.ts","sourceRoot":"","sources":["../../../src/effects/vfx/stretched-sprite.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,qBAAa,eAAgB,SAAQ,KAAK,CAAC,IAAI;IAC7C,WAAW,EAAE,MAAM,CAAI;CAIxB"}
|
@@ -1,5 +1,4 @@
|
|
1
|
-
import*as e from"three";export class StretchedSprite extends e.Mesh{constructor(){super(...arguments),this.scaleFactor=1}}
|
2
|
-
/*
|
1
|
+
import*as e from"three";export class StretchedSprite extends e.Mesh{constructor(){super(...arguments),this.scaleFactor=1}}/*
|
3
2
|
* Copyright (©) 2023. All rights reserved.
|
4
3
|
* See the LICENSE.md file for details.
|
5
4
|
*/
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"trail-renderer.d.ts","sourceRoot":"","sources":["../../../src/effects/vfx/trail-renderer.ts"],"names":[],"mappings":"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"}
|
@@ -1,5 +1,4 @@
|
|
1
|
-
import*as e from"three";export class Trail extends e.Object3D{constructor(t,r){super(),this.nodeCenters=[],this.nodeIDs=[],this.advance=function(){const t=new e.Matrix4;return function(){this.targetObject.updateMatrixWorld(),t.copy(this.targetObject.matrixWorld),this.advanceWithTransform(t),this.updateUniforms()}}(),this.advanceGeometry=function(e,t){const r=this.currentEnd+1>=this.length?0:this.currentEnd+1;if(t?this.updateNodePositionsFromTransformMatrix(r,t):this.updateNodePositionsFromOrientationTangent(r,e.position,e.tangent),this.currentLength>=1&&(this.connectNodes(this.currentEnd,r),this.currentLength>=this.length)){const e=this.currentEnd+1>=this.length?0:this.currentEnd+1;this.disconnectNodes(e)}this.currentLength<this.length&&this.currentLength++,this.currentEnd++,this.currentEnd>=this.length&&(this.currentEnd=0),this.currentLength>=1&&(this.currentLength<this.length?this.geometry.setDrawRange(0,(this.currentLength-1)*this.FaceIndicesPerNode):this.geometry.setDrawRange(0,this.currentLength*this.FaceIndicesPerNode)),this.updateNodeID(this.currentEnd,this.currentNodeID),this.currentNodeID++},this.updateHead=function(){const t=new e.Matrix4;return function(){this.currentEnd<0||(this.targetObject.updateMatrixWorld(),t.copy(this.targetObject.matrixWorld),this.updateNodePositionsFromTransformMatrix(this.currentEnd,t))}}(),this.updateNodePositionsFromOrientationTangent=function(){const t=new e.Quaternion,r=new e.Vector3,i=[];for(let t=0;t<Trail.MaxHeadVertices;t++){const t=new e.Vector3;i.push(t)}return function(e,a,n){const s=this.geometry.getAttribute("position");this.updateNodeCenter(e,a),r.copy(a),r.sub(Trail.LocalHeadOrigin),t.setFromUnitVectors(Trail.LocalOrientationTangent,n);for(let e=0;e<this.localHeadGeometry.length;e++){const a=i[e];a.copy(this.localHeadGeometry[e]),a.applyQuaternion(t),a.add(r)}for(let t=0;t<this.localHeadGeometry.length;t++){const r=(this.VerticesPerNode*e+t)*Trail.PositionComponentCount,a=i[t];s.array[r]=a.x,s.array[r+1]=a.y,s.array[r+2]=a.z}s.needsUpdate=!0}}(),this.updateNodePositionsFromTransformMatrix=function(){const t=new e.Matrix3,r=new e.Quaternion,i=new e.Vector3,a=new e.Vector3,n=new e.Vector3,s=new e.Vector3,o=[];for(let t=0;t<Trail.MaxHeadVertices;t++){const t=new e.Vector3;o.push(t)}return function(h,c){const l=this.geometry.getAttribute("position");i.set(0,0,0),i.applyMatrix4(c),this.updateNodeCenter(h,i);for(let e=0;e<this.localHeadGeometry.length;e++){o[e].copy(this.localHeadGeometry[e])}for(let e=0;e<this.localHeadGeometry.length;e++){o[e].applyMatrix4(c)}if(this.lastNodeCenter&&this.orientToMovement&&(function(e,t){const r=t.elements;e.set(r[0],r[1],r[2],r[4],r[5],r[6],r[8],r[9],r[10])}(t,c),n.set(0,0,-1),n.applyMatrix3(t),s.copy(this.currentNodeCenter),s.sub(this.lastNodeCenter),s.normalize(),s.lengthSq()<=1e-4&&this.lastOrientationDir&&s.copy(this.lastOrientationDir),s.lengthSq()>1e-4)){this.lastOrientationDir||(this.lastOrientationDir=new e.Vector3),r.setFromUnitVectors(n,s),a.copy(this.currentNodeCenter);for(let e=0;e<this.localHeadGeometry.length;e++){const t=o[e];t.sub(a),t.applyQuaternion(r),t.add(a)}}for(let e=0;e<this.localHeadGeometry.length;e++){const t=(this.VerticesPerNode*h+e)*Trail.PositionComponentCount,r=o[e];l.array[t]=r.x,l.array[t+1]=r.y,l.array[t+2]=r.z}l.needsUpdate=!0,l.addUpdateRange(h*this.VerticesPerNode*Trail.PositionComponentCount,this.VerticesPerNode*Trail.PositionComponentCount)}}(),this.connectNodes=(()=>{const e={attribute:null,offset:0,count:-1};return(t,r)=>{const i=this.geometry.getIndex();for(let e=0;e<this.localHeadGeometry.length-1;e++){const a=this.VerticesPerNode*t+e,n=this.VerticesPerNode*r+e,s=(t*this.FacesPerNode+e*Trail.FacesPerQuad)*Trail.IndicesPerFace;i.array[s]=a,i.array[s+1]=n,i.array[s+2]=a+1,i.array[s+3]=n,i.array[s+4]=n+1,i.array[s+5]=a+1}return i.needsUpdate=!0,i.clearUpdateRanges(),e.attribute=i,e.offset=t*this.FacesPerNode*Trail.IndicesPerFace,e.count=this.FacesPerNode*Trail.IndicesPerFace,e}})(),this.disconnectNodes=(()=>{const e={attribute:null,offset:0,count:-1};return t=>{const r=this.geometry.getIndex();for(let e=0;e<this.localHeadGeometry.length-1;e++){const i=(t*this.FacesPerNode+e*Trail.FacesPerQuad)*Trail.IndicesPerFace;r.array[i]=0,r.array[i+1]=0,r.array[i+2]=0,r.array[i+3]=0,r.array[i+4]=0,r.array[i+5]=0}return r.needsUpdate=!0,r.clearUpdateRanges(),e.attribute=r,e.offset=t*this.FacesPerNode*Trail.IndicesPerFace,e.count=this.FacesPerNode*Trail.IndicesPerFace,e}})(),this.active=!1,this.orientToMovement=!1,r&&(this.orientToMovement=!0),this.scene=t,this.geometry=null,this.mesh=null,this.nodeCenters=[],this.lastNodeCenter=null,this.currentNodeCenter=null,this.lastOrientationDir=null,this.nodeIDs=[],this.currentLength=0,this.currentEnd=0,this.currentNodeID=0,this.advanceFrequency=60,this.advancePeriod=1/this.advanceFrequency,this.lastAdvanceTime=0,this.paused=!1,this.pauseAdvanceUpdateTimeDiff=0}setAdvanceFrequency(e){this.advanceFrequency=e,this.advancePeriod=1/this.advanceFrequency}initialize(t,r,i,a,n,s){this.deactivate(),this.destroyMesh(),this.length=r>0?r+1:0,this.dragTexture=i?1:0,this.targetObject=s,this.initializeLocalHeadGeometry(a,n),this.nodeIDs=[],this.nodeCenters=[];for(let t=0;t<this.length;t++)this.nodeIDs[t]=-1,this.nodeCenters[t]=new e.Vector3;this.material=t,this.initializeGeometry(),this.initializeMesh(),this.material.uniforms.trailLength.value=0,this.material.uniforms.minID.value=0,this.material.uniforms.maxID.value=0,this.material.uniforms.dragTexture.value=this.dragTexture,this.material.uniforms.maxTrailLength.value=this.length,this.material.uniforms.verticesPerNode.value=this.VerticesPerNode,this.material.uniforms.textureTileFactor.value=new e.Vector2(1,1),this.material.uniforms.scale.value=1,this.reset()}initializeLocalHeadGeometry(t,r){if(this.localHeadGeometry=[],r){this.VerticesPerNode=0;for(let t=0;t<r.length&&t<Trail.MaxHeadVertices;t++){const i=r[t];if(i&&i instanceof e.Vector3){const t=new e.Vector3;t.copy(i),this.localHeadGeometry.push(t),this.VerticesPerNode++}}}else{const r=(t||1)/2;this.localHeadGeometry.push(new e.Vector3(-r,0,0)),this.localHeadGeometry.push(new e.Vector3(r,0,0)),this.VerticesPerNode=2}this.FacesPerNode=2*(this.VerticesPerNode-1),this.FaceIndicesPerNode=3*this.FacesPerNode}initializeGeometry(){this.vertexCount=this.length*this.VerticesPerNode,this.faceCount=this.length*this.FacesPerNode;const t=new e.BufferGeometry,r=new Float32Array(this.vertexCount),i=new Float32Array(this.vertexCount*this.VerticesPerNode),a=new Float32Array(this.vertexCount*Trail.PositionComponentCount),n=new Float32Array(this.vertexCount*Trail.PositionComponentCount),s=new Float32Array(this.vertexCount*Trail.UVComponentCount),o=new Uint32Array(this.faceCount*Trail.IndicesPerFace),h=new e.BufferAttribute(r,1);h.setUsage(e.DynamicDrawUsage),t.setAttribute("nodeID",h);const c=new e.BufferAttribute(i,1);c.setUsage(e.DynamicDrawUsage),t.setAttribute("nodeVertexID",c);const l=new e.BufferAttribute(n,Trail.PositionComponentCount);l.setUsage(e.DynamicDrawUsage),t.setAttribute("nodeCenter",l);const d=new e.BufferAttribute(a,Trail.PositionComponentCount);d.setUsage(e.DynamicDrawUsage),t.setAttribute("position",d);const u=new e.BufferAttribute(s,Trail.UVComponentCount);u.setUsage(e.DynamicDrawUsage),t.setAttribute("uv",u);const m=new e.BufferAttribute(o,1);m.setUsage(e.DynamicDrawUsage),t.setIndex(m),this.geometry=t}zeroVertices(){const e=this.geometry.getAttribute("position");for(let t=0;t<this.vertexCount;t++){const r=3*t;e.array[r]=0,e.array[r+1]=0,e.array[r+2]=0}e.needsUpdate=!0}zeroIndices(){if(null==this.geometry)throw"Geometry not initialized";const e=this.geometry.getIndex();for(let t=0;t<this.faceCount;t++){const r=3*t;e.array[r]=0,e.array[r+1]=0,e.array[r+2]=0}e.needsUpdate=!0,e.clearUpdateRanges()}formInitialFaces(){this.zeroIndices();const e=this.geometry.getIndex();for(let e=0;e<this.length-1;e++)this.connectNodes(e,e+1);e.needsUpdate=!0,e.clearUpdateRanges()}initializeMesh(){if(null==this.geometry)throw"Geometry not initialized";this.mesh=new e.Mesh(this.geometry,this.material),this.mesh.matrixAutoUpdate=!1}destroyMesh(){this.mesh&&(this.scene.remove(this.mesh),this.mesh=null)}reset(){this.currentLength=0,this.currentEnd=-1,this.lastNodeCenter=null,this.currentNodeCenter=null,this.lastOrientationDir=null,this.currentNodeID=0,this.formInitialFaces(),this.zeroVertices(),this.geometry.setDrawRange(0,0)}updateUniforms(){this.currentLength<this.length?this.material.uniforms.minID.value=0:this.material.uniforms.minID.value=this.currentNodeID-this.length,this.material.uniforms.maxID.value=this.currentNodeID,this.material.uniforms.trailLength.value=this.currentLength,this.material.uniforms.maxTrailLength.value=this.length,this.material.uniforms.verticesPerNode.value=this.VerticesPerNode}advanceWithPositionAndOrientation(e,t){this.advanceGeometry({position:e,tangent:t},null)}advanceWithTransform(e){this.advanceGeometry(null,e)}currentTime(){return performance.now()/1e3}pause(){this.paused||(this.paused=!0,this.pauseAdvanceUpdateTimeDiff=this.currentTime()-this.lastAdvanceTime)}resume(){this.paused&&(this.paused=!1,this.lastAdvanceTime=this.currentTime()-this.pauseAdvanceUpdateTimeDiff)}update(){if(!this.paused){const e=this.currentTime();this.lastAdvanceTime||(this.lastAdvanceTime=e),e-this.lastAdvanceTime>this.advancePeriod?(this.advance(),this.lastAdvanceTime=e):this.updateHead()}}updateNodeID(e,t){this.nodeIDs[e]=t;const r=this.geometry.getAttribute("nodeID"),i=this.geometry.getAttribute("nodeVertexID");for(let a=0;a<this.VerticesPerNode;a++){const n=e*this.VerticesPerNode+a;r.array[n]=t,i.array[n]=a}r.needsUpdate=!0,i.needsUpdate=!0,r.addUpdateRange(e*this.VerticesPerNode,this.VerticesPerNode),i.addUpdateRange(e*this.VerticesPerNode,this.VerticesPerNode)}updateNodeCenter(e,t){this.lastNodeCenter=this.currentNodeCenter,this.currentNodeCenter=this.nodeCenters[e],this.currentNodeCenter.copy(t);const r=this.geometry.getAttribute("nodeCenter");for(let i=0;i<this.VerticesPerNode;i++){const a=3*(e*this.VerticesPerNode+i);r.array[a]=t.x,r.array[a+1]=t.y,r.array[a+2]=t.z}r.needsUpdate=!0,r.updateRanges=[{start:e*this.VerticesPerNode*Trail.PositionComponentCount,count:this.VerticesPerNode*Trail.PositionComponentCount}]}deactivate(){this.active&&(this.scene.remove(this.mesh),this.active=!1)}activate(){this.active||(this.scene.add(this.mesh),this.active=!0)}static createMaterial(t,r,i){return(i=i||{}).trailLength={type:"f",value:null},i.verticesPerNode={type:"f",value:null},i.minID={type:"f",value:null},i.maxID={type:"f",value:null},i.dragTexture={type:"f",value:null},i.maxTrailLength={type:"f",value:null},i.textureTileFactor={type:"v2",value:null},i.headColor={type:"v4",value:new e.Vector4},i.tailColor={type:"v4",value:new e.Vector4},i.taper={type:"bool",value:!1},i.scale={type:"f",value:1},t=t||Trail.Shader.BaseVertexShader,r=r||Trail.Shader.BaseFragmentShader,new e.ShaderMaterial({uniforms:i,vertexShader:t,fragmentShader:r,transparent:!0,alphaTest:.5,blending:e.CustomBlending,blendSrc:e.SrcAlphaFactor,blendDst:e.OneMinusSrcAlphaFactor,blendEquation:e.AddEquation,depthTest:!0,depthWrite:!1,side:e.DoubleSide})}static createBaseMaterial(e={}){return Trail.createMaterial(Trail.Shader.BaseVertexShader,Trail.Shader.BaseFragmentShader,e)}static createTexturedMaterial(e){return(e={}).trailTexture={type:"t",value:null},Trail.createMaterial(Trail.Shader.TexturedVertexShader,Trail.Shader.TexturedFragmentShader,e)}static get MaxHeadVertices(){return 128}static{this._LocalOrientationTangent=new e.Vector3(1,0,0)}static get LocalOrientationTangent(){return Trail._LocalOrientationTangent}static{this._LocalHeadOrigin=new e.Vector3(0,0,0)}static get LocalHeadOrigin(){return Trail._LocalHeadOrigin}static get PositionComponentCount(){return 3}static get UVComponentCount(){return 2}static get IndicesPerFace(){return 3}static get FacesPerQuad(){return 2}static{this.Shader={get BaseVertexVars(){return["attribute float nodeID;","attribute float nodeVertexID;","attribute vec3 nodeCenter;","uniform float minID;","uniform float maxID;","uniform float trailLength;","uniform float maxTrailLength;","uniform float verticesPerNode;","uniform vec2 textureTileFactor;","uniform bool taper;","uniform vec4 headColor;","uniform vec4 tailColor;","varying vec4 vColor;"].join("\n")},get TexturedVertexVars(){return[this.BaseVertexVars,"varying vec2 vUV;","uniform float dragTexture;"].join("\n")},BaseFragmentVars:["varying vec4 vColor;","uniform sampler2D trailTexture;"].join("\n"),get TexturedFragmentVars(){return[this.BaseFragmentVars,"varying vec2 vUV;"].join("\n")},get VertexShaderCore(){return["float fraction = (maxID - nodeID) / (maxID - minID);","float fractionSize = taper ? fraction : 0.0;","vColor = (1.0 - fraction) * headColor + fraction * tailColor;","vec4 realPosition = vec4((1.0 - fractionSize) * position.xyz + fractionSize * nodeCenter.xyz, 1.0); "].join("\n")},get BaseVertexShader(){return[this.BaseVertexVars,"void main() { ",this.VertexShaderCore,"gl_Position = projectionMatrix * viewMatrix * realPosition;","}"].join("\n")},get BaseFragmentShader(){return[this.BaseFragmentVars,"void main() { ","gl_FragColor = vColor;","}"].join("\n")},get TexturedVertexShader(){return[this.TexturedVertexVars,"void main() { ",this.VertexShaderCore,"float s = 0.0;","float t = 0.0;","if (dragTexture == 1.0) { "," s = fraction * textureTileFactor.s; "," t = (nodeVertexID / verticesPerNode) * textureTileFactor.t;","} else { "," s = nodeID / maxTrailLength * textureTileFactor.s;"," t = (nodeVertexID / verticesPerNode) * textureTileFactor.t;","}","vUV = vec2(s, t); ","gl_Position = projectionMatrix * viewMatrix * realPosition;","}"].join("\n")},get TexturedFragmentShader(){return[this.TexturedFragmentVars,"void main() { ","vec4 textureColor = texture2D(trailTexture, vUV);","gl_FragColor = vColor * textureColor;","}"].join("\n")}}}}
|
2
|
-
/*
|
1
|
+
import*as e from"three";export class Trail extends e.Object3D{constructor(t,r){super(),this.nodeCenters=[],this.nodeIDs=[],this.advance=function(){const t=new e.Matrix4;return function(){this.targetObject.updateMatrixWorld(),t.copy(this.targetObject.matrixWorld),this.advanceWithTransform(t),this.updateUniforms()}}(),this.advanceGeometry=function(e,t){const r=this.currentEnd+1>=this.length?0:this.currentEnd+1;if(t?this.updateNodePositionsFromTransformMatrix(r,t):this.updateNodePositionsFromOrientationTangent(r,e.position,e.tangent),this.currentLength>=1&&(this.connectNodes(this.currentEnd,r),this.currentLength>=this.length)){const e=this.currentEnd+1>=this.length?0:this.currentEnd+1;this.disconnectNodes(e)}this.currentLength<this.length&&this.currentLength++,this.currentEnd++,this.currentEnd>=this.length&&(this.currentEnd=0),this.currentLength>=1&&(this.currentLength<this.length?this.geometry.setDrawRange(0,(this.currentLength-1)*this.FaceIndicesPerNode):this.geometry.setDrawRange(0,this.currentLength*this.FaceIndicesPerNode)),this.updateNodeID(this.currentEnd,this.currentNodeID),this.currentNodeID++},this.updateHead=function(){const t=new e.Matrix4;return function(){this.currentEnd<0||(this.targetObject.updateMatrixWorld(),t.copy(this.targetObject.matrixWorld),this.updateNodePositionsFromTransformMatrix(this.currentEnd,t))}}(),this.updateNodePositionsFromOrientationTangent=function(){const t=new e.Quaternion,r=new e.Vector3,i=[];for(let t=0;t<Trail.MaxHeadVertices;t++){const t=new e.Vector3;i.push(t)}return function(e,a,n){const s=this.geometry.getAttribute("position");this.updateNodeCenter(e,a),r.copy(a),r.sub(Trail.LocalHeadOrigin),t.setFromUnitVectors(Trail.LocalOrientationTangent,n);for(let e=0;e<this.localHeadGeometry.length;e++){const a=i[e];a.copy(this.localHeadGeometry[e]),a.applyQuaternion(t),a.add(r)}for(let t=0;t<this.localHeadGeometry.length;t++){const r=(this.VerticesPerNode*e+t)*Trail.PositionComponentCount,a=i[t];s.array[r]=a.x,s.array[r+1]=a.y,s.array[r+2]=a.z}s.needsUpdate=!0}}(),this.updateNodePositionsFromTransformMatrix=function(){const t=new e.Matrix3,r=new e.Quaternion,i=new e.Vector3,a=new e.Vector3,n=new e.Vector3,s=new e.Vector3,o=[];for(let t=0;t<Trail.MaxHeadVertices;t++){const t=new e.Vector3;o.push(t)}return function(h,c){const l=this.geometry.getAttribute("position");i.set(0,0,0),i.applyMatrix4(c),this.updateNodeCenter(h,i);for(let e=0;e<this.localHeadGeometry.length;e++){o[e].copy(this.localHeadGeometry[e])}for(let e=0;e<this.localHeadGeometry.length;e++){o[e].applyMatrix4(c)}if(this.lastNodeCenter&&this.orientToMovement&&(function(e,t){const r=t.elements;e.set(r[0],r[1],r[2],r[4],r[5],r[6],r[8],r[9],r[10])}(t,c),n.set(0,0,-1),n.applyMatrix3(t),s.copy(this.currentNodeCenter),s.sub(this.lastNodeCenter),s.normalize(),s.lengthSq()<=1e-4&&this.lastOrientationDir&&s.copy(this.lastOrientationDir),s.lengthSq()>1e-4)){this.lastOrientationDir||(this.lastOrientationDir=new e.Vector3),r.setFromUnitVectors(n,s),a.copy(this.currentNodeCenter);for(let e=0;e<this.localHeadGeometry.length;e++){const t=o[e];t.sub(a),t.applyQuaternion(r),t.add(a)}}for(let e=0;e<this.localHeadGeometry.length;e++){const t=(this.VerticesPerNode*h+e)*Trail.PositionComponentCount,r=o[e];l.array[t]=r.x,l.array[t+1]=r.y,l.array[t+2]=r.z}l.needsUpdate=!0,l.addUpdateRange(h*this.VerticesPerNode*Trail.PositionComponentCount,this.VerticesPerNode*Trail.PositionComponentCount)}}(),this.connectNodes=(()=>{const e={attribute:null,offset:0,count:-1};return(t,r)=>{const i=this.geometry.getIndex();for(let e=0;e<this.localHeadGeometry.length-1;e++){const a=this.VerticesPerNode*t+e,n=this.VerticesPerNode*r+e,s=(t*this.FacesPerNode+e*Trail.FacesPerQuad)*Trail.IndicesPerFace;i.array[s]=a,i.array[s+1]=n,i.array[s+2]=a+1,i.array[s+3]=n,i.array[s+4]=n+1,i.array[s+5]=a+1}return i.needsUpdate=!0,i.clearUpdateRanges(),e.attribute=i,e.offset=t*this.FacesPerNode*Trail.IndicesPerFace,e.count=this.FacesPerNode*Trail.IndicesPerFace,e}})(),this.disconnectNodes=(()=>{const e={attribute:null,offset:0,count:-1};return t=>{const r=this.geometry.getIndex();for(let e=0;e<this.localHeadGeometry.length-1;e++){const i=(t*this.FacesPerNode+e*Trail.FacesPerQuad)*Trail.IndicesPerFace;r.array[i]=0,r.array[i+1]=0,r.array[i+2]=0,r.array[i+3]=0,r.array[i+4]=0,r.array[i+5]=0}return r.needsUpdate=!0,r.clearUpdateRanges(),e.attribute=r,e.offset=t*this.FacesPerNode*Trail.IndicesPerFace,e.count=this.FacesPerNode*Trail.IndicesPerFace,e}})(),this.active=!1,this.orientToMovement=!1,r&&(this.orientToMovement=!0),this.scene=t,this.geometry=null,this.mesh=null,this.nodeCenters=[],this.lastNodeCenter=null,this.currentNodeCenter=null,this.lastOrientationDir=null,this.nodeIDs=[],this.currentLength=0,this.currentEnd=0,this.currentNodeID=0,this.advanceFrequency=60,this.advancePeriod=1/this.advanceFrequency,this.lastAdvanceTime=0,this.paused=!1,this.pauseAdvanceUpdateTimeDiff=0}setAdvanceFrequency(e){this.advanceFrequency=e,this.advancePeriod=1/this.advanceFrequency}initialize(t,r,i,a,n,s){this.deactivate(),this.destroyMesh(),this.length=r>0?r+1:0,this.dragTexture=i?1:0,this.targetObject=s,this.initializeLocalHeadGeometry(a,n),this.nodeIDs=[],this.nodeCenters=[];for(let t=0;t<this.length;t++)this.nodeIDs[t]=-1,this.nodeCenters[t]=new e.Vector3;this.material=t,this.initializeGeometry(),this.initializeMesh(),this.material.uniforms.trailLength.value=0,this.material.uniforms.minID.value=0,this.material.uniforms.maxID.value=0,this.material.uniforms.dragTexture.value=this.dragTexture,this.material.uniforms.maxTrailLength.value=this.length,this.material.uniforms.verticesPerNode.value=this.VerticesPerNode,this.material.uniforms.textureTileFactor.value=new e.Vector2(1,1),this.material.uniforms.scale.value=1,this.reset()}initializeLocalHeadGeometry(t,r){if(this.localHeadGeometry=[],r){this.VerticesPerNode=0;for(let t=0;t<r.length&&t<Trail.MaxHeadVertices;t++){const i=r[t];if(i&&i instanceof e.Vector3){const t=new e.Vector3;t.copy(i),this.localHeadGeometry.push(t),this.VerticesPerNode++}}}else{const r=(t||1)/2;this.localHeadGeometry.push(new e.Vector3(-r,0,0)),this.localHeadGeometry.push(new e.Vector3(r,0,0)),this.VerticesPerNode=2}this.FacesPerNode=2*(this.VerticesPerNode-1),this.FaceIndicesPerNode=3*this.FacesPerNode}initializeGeometry(){this.vertexCount=this.length*this.VerticesPerNode,this.faceCount=this.length*this.FacesPerNode;const t=new e.BufferGeometry,r=new Float32Array(this.vertexCount),i=new Float32Array(this.vertexCount*this.VerticesPerNode),a=new Float32Array(this.vertexCount*Trail.PositionComponentCount),n=new Float32Array(this.vertexCount*Trail.PositionComponentCount),s=new Float32Array(this.vertexCount*Trail.UVComponentCount),o=new Uint32Array(this.faceCount*Trail.IndicesPerFace),h=new e.BufferAttribute(r,1);h.setUsage(e.DynamicDrawUsage),t.setAttribute("nodeID",h);const c=new e.BufferAttribute(i,1);c.setUsage(e.DynamicDrawUsage),t.setAttribute("nodeVertexID",c);const l=new e.BufferAttribute(n,Trail.PositionComponentCount);l.setUsage(e.DynamicDrawUsage),t.setAttribute("nodeCenter",l);const d=new e.BufferAttribute(a,Trail.PositionComponentCount);d.setUsage(e.DynamicDrawUsage),t.setAttribute("position",d);const u=new e.BufferAttribute(s,Trail.UVComponentCount);u.setUsage(e.DynamicDrawUsage),t.setAttribute("uv",u);const m=new e.BufferAttribute(o,1);m.setUsage(e.DynamicDrawUsage),t.setIndex(m),this.geometry=t}zeroVertices(){const e=this.geometry.getAttribute("position");for(let t=0;t<this.vertexCount;t++){const r=3*t;e.array[r]=0,e.array[r+1]=0,e.array[r+2]=0}e.needsUpdate=!0}zeroIndices(){if(null==this.geometry)throw"Geometry not initialized";const e=this.geometry.getIndex();for(let t=0;t<this.faceCount;t++){const r=3*t;e.array[r]=0,e.array[r+1]=0,e.array[r+2]=0}e.needsUpdate=!0,e.clearUpdateRanges()}formInitialFaces(){this.zeroIndices();const e=this.geometry.getIndex();for(let e=0;e<this.length-1;e++)this.connectNodes(e,e+1);e.needsUpdate=!0,e.clearUpdateRanges()}initializeMesh(){if(null==this.geometry)throw"Geometry not initialized";this.mesh=new e.Mesh(this.geometry,this.material),this.mesh.matrixAutoUpdate=!1}destroyMesh(){this.mesh&&(this.scene.remove(this.mesh),this.mesh=null)}reset(){this.currentLength=0,this.currentEnd=-1,this.lastNodeCenter=null,this.currentNodeCenter=null,this.lastOrientationDir=null,this.currentNodeID=0,this.formInitialFaces(),this.zeroVertices(),this.geometry.setDrawRange(0,0)}updateUniforms(){this.currentLength<this.length?this.material.uniforms.minID.value=0:this.material.uniforms.minID.value=this.currentNodeID-this.length,this.material.uniforms.maxID.value=this.currentNodeID,this.material.uniforms.trailLength.value=this.currentLength,this.material.uniforms.maxTrailLength.value=this.length,this.material.uniforms.verticesPerNode.value=this.VerticesPerNode}advanceWithPositionAndOrientation(e,t){this.advanceGeometry({position:e,tangent:t},null)}advanceWithTransform(e){this.advanceGeometry(null,e)}currentTime(){return performance.now()/1e3}pause(){this.paused||(this.paused=!0,this.pauseAdvanceUpdateTimeDiff=this.currentTime()-this.lastAdvanceTime)}resume(){this.paused&&(this.paused=!1,this.lastAdvanceTime=this.currentTime()-this.pauseAdvanceUpdateTimeDiff)}update(){if(!this.paused){const e=this.currentTime();this.lastAdvanceTime||(this.lastAdvanceTime=e),e-this.lastAdvanceTime>this.advancePeriod?(this.advance(),this.lastAdvanceTime=e):this.updateHead()}}updateNodeID(e,t){this.nodeIDs[e]=t;const r=this.geometry.getAttribute("nodeID"),i=this.geometry.getAttribute("nodeVertexID");for(let a=0;a<this.VerticesPerNode;a++){const n=e*this.VerticesPerNode+a;r.array[n]=t,i.array[n]=a}r.needsUpdate=!0,i.needsUpdate=!0,r.addUpdateRange(e*this.VerticesPerNode,this.VerticesPerNode),i.addUpdateRange(e*this.VerticesPerNode,this.VerticesPerNode)}updateNodeCenter(e,t){this.lastNodeCenter=this.currentNodeCenter,this.currentNodeCenter=this.nodeCenters[e],this.currentNodeCenter.copy(t);const r=this.geometry.getAttribute("nodeCenter");for(let i=0;i<this.VerticesPerNode;i++){const a=3*(e*this.VerticesPerNode+i);r.array[a]=t.x,r.array[a+1]=t.y,r.array[a+2]=t.z}r.needsUpdate=!0,r.updateRanges=[{start:e*this.VerticesPerNode*Trail.PositionComponentCount,count:this.VerticesPerNode*Trail.PositionComponentCount}]}deactivate(){this.active&&(this.scene.remove(this.mesh),this.active=!1)}activate(){this.active||(this.scene.add(this.mesh),this.active=!0)}static createMaterial(t,r,i){return(i=i||{}).trailLength={type:"f",value:null},i.verticesPerNode={type:"f",value:null},i.minID={type:"f",value:null},i.maxID={type:"f",value:null},i.dragTexture={type:"f",value:null},i.maxTrailLength={type:"f",value:null},i.textureTileFactor={type:"v2",value:null},i.headColor={type:"v4",value:new e.Vector4},i.tailColor={type:"v4",value:new e.Vector4},i.taper={type:"bool",value:!1},i.scale={type:"f",value:1},t=t||Trail.Shader.BaseVertexShader,r=r||Trail.Shader.BaseFragmentShader,new e.ShaderMaterial({uniforms:i,vertexShader:t,fragmentShader:r,transparent:!0,alphaTest:.5,blending:e.CustomBlending,blendSrc:e.SrcAlphaFactor,blendDst:e.OneMinusSrcAlphaFactor,blendEquation:e.AddEquation,depthTest:!0,depthWrite:!1,side:e.DoubleSide})}static createBaseMaterial(e={}){return Trail.createMaterial(Trail.Shader.BaseVertexShader,Trail.Shader.BaseFragmentShader,e)}static createTexturedMaterial(e){return(e={}).trailTexture={type:"t",value:null},Trail.createMaterial(Trail.Shader.TexturedVertexShader,Trail.Shader.TexturedFragmentShader,e)}static get MaxHeadVertices(){return 128}static get LocalOrientationTangent(){return Trail._LocalOrientationTangent}static get LocalHeadOrigin(){return Trail._LocalHeadOrigin}static get PositionComponentCount(){return 3}static get UVComponentCount(){return 2}static get IndicesPerFace(){return 3}static get FacesPerQuad(){return 2}}Trail._LocalOrientationTangent=new e.Vector3(1,0,0),Trail._LocalHeadOrigin=new e.Vector3(0,0,0),Trail.Shader={get BaseVertexVars(){return["attribute float nodeID;","attribute float nodeVertexID;","attribute vec3 nodeCenter;","uniform float minID;","uniform float maxID;","uniform float trailLength;","uniform float maxTrailLength;","uniform float verticesPerNode;","uniform vec2 textureTileFactor;","uniform bool taper;","uniform vec4 headColor;","uniform vec4 tailColor;","varying vec4 vColor;"].join("\n")},get TexturedVertexVars(){return[this.BaseVertexVars,"varying vec2 vUV;","uniform float dragTexture;"].join("\n")},BaseFragmentVars:["varying vec4 vColor;","uniform sampler2D trailTexture;"].join("\n"),get TexturedFragmentVars(){return[this.BaseFragmentVars,"varying vec2 vUV;"].join("\n")},get VertexShaderCore(){return["float fraction = (maxID - nodeID) / (maxID - minID);","float fractionSize = taper ? fraction : 0.0;","vColor = (1.0 - fraction) * headColor + fraction * tailColor;","vec4 realPosition = vec4((1.0 - fractionSize) * position.xyz + fractionSize * nodeCenter.xyz, 1.0); "].join("\n")},get BaseVertexShader(){return[this.BaseVertexVars,"void main() { ",this.VertexShaderCore,"gl_Position = projectionMatrix * viewMatrix * realPosition;","}"].join("\n")},get BaseFragmentShader(){return[this.BaseFragmentVars,"void main() { ","gl_FragColor = vColor;","}"].join("\n")},get TexturedVertexShader(){return[this.TexturedVertexVars,"void main() { ",this.VertexShaderCore,"float s = 0.0;","float t = 0.0;","if (dragTexture == 1.0) { "," s = fraction * textureTileFactor.s; "," t = (nodeVertexID / verticesPerNode) * textureTileFactor.t;","} else { "," s = nodeID / maxTrailLength * textureTileFactor.s;"," t = (nodeVertexID / verticesPerNode) * textureTileFactor.t;","}","vUV = vec2(s, t); ","gl_Position = projectionMatrix * viewMatrix * realPosition;","}"].join("\n")},get TexturedFragmentShader(){return[this.TexturedFragmentVars,"void main() { ","vec4 textureColor = texture2D(trailTexture, vUV);","gl_FragColor = vColor * textureColor;","}"].join("\n")}};/*
|
3
2
|
* Copyright (©) 2023. All rights reserved.
|
4
3
|
* See the LICENSE.md file for details.
|
5
4
|
*/
|
@@ -35,6 +35,7 @@ export declare class VfxActor extends BaseActor {
|
|
35
35
|
* The container is a child of the actor so still objects move along with the actor
|
36
36
|
*
|
37
37
|
*/
|
38
|
-
getParticleCount():
|
38
|
+
getParticleCount(): number;
|
39
39
|
onEndPlay(): void;
|
40
40
|
}
|
41
|
+
//# sourceMappingURL=vfx-actor.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"vfx-actor.d.ts","sourceRoot":"","sources":["../../../src/effects/vfx/vfx-actor.ts"],"names":[],"mappings":"AAEA,OAAO,EAAS,SAAS,EAAE,MAAM,gCAAgC,CAAA;AAKjE,OAAO,EAAE,KAAK,EAAqB,MAAM,sBAAsB,CAAA;AAI/D,qBACa,QAAS,SAAQ,SAAS;IAErC;;OAEG;IACI,SAAS,SAAI;IACb,MAAM,UAAQ;IAErB,OAAO,CAAC,MAAM,CAAQ;IACtB,OAAO,CAAC,aAAa,CAAY;IACjC,OAAO,CAAC,WAAW,CAAU;IAE7B,OAAO,CAAC,WAAW,CAAsB;IACzC,OAAO,CAAC,KAAK,CAAgB;IAC7B,OAAO,CAAC,IAAI,CAAyB;IAErC,OAAO,CAAC,uBAAuB,CAAgB;IAE/C;;OAEG;IACU,SAAS,CAAC,KAAK,EAAE,KAAK;IAyDnC,IAAI;IASJ,KAAK;IAIL,IAAI;IAiBJ,OAAO;IAYP,OAAO,CAAC,SAAS,CAAsB;IAEvC,OAAO,CAAC,GAAG,CAAK;IAEhB,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI;IAuBjC;;;;;;;;;;OAUG;IAEH,gBAAgB;IAIhB,SAAS,IAAI,IAAI;CAelB"}
|
@@ -1,5 +1,4 @@
|
|
1
|
-
import{__decorate as s}from"tslib";import*as t from"three";import{Rate as e}from"
|
2
|
-
/*
|
1
|
+
import{__decorate as s}from"tslib";import*as t from"three";import{Rate as e}from"@hology/nebula";import{Actor as i,BaseActor as r}from"../../gameplay/actors/actor.js";import{inject as o}from"../../gameplay/inject.js";import{AssetLoader as a}from"../../gameplay/services/asset-loader.js";import{ViewController as m}from"../../gameplay/services/render.js";import{World as h}from"../../gameplay/services/world.js";import{DelayRate as d}from"./rates.js";import{materializeVfx as p}from"./vfx-materializer.js";let l=class extends r{constructor(){super(...arguments),this.timescale=1,this.paused=!1,this.assetLoader=o(a),this.world=o(h),this.view=o(m),this._worldPos=new t.Vector3,this.max=0}async fromAsset(s){if("vfx"!==s.type)throw"Asset must be a VFX asset but is "+s.type;null!=this.system&&(this.system.destroy(),this.system.emitters.forEach((s=>s.reset()))),this.sourceAsset=s,this.disposeSystem&&this.disposeSystem(),this.world.scene.add(this.object);const{system:t,dispose:e,container:i}=await p(this.sourceAsset,this.object,{getAsset:s=>this.assetLoader.getAsset(s),getMaterial:s=>this.assetLoader.getMaterialByAssetId(s),getTexture:s=>this.assetLoader.getTextureByAssetId(s),getMesh:s=>this.assetLoader.getModelByAssetId(s).then((s=>s.scene))},this.view);this.system=t,this.disposeSystem=e,this.particleSystemContainer=i}play(){this.paused=!1;this.system.emitters.every((s=>s.dead))&&this.restart()}pause(){this.paused=!0}stop(){this.system.emitters.forEach((s=>{const t=s.rate;t instanceof e&&(t.nextTime=1/0)}))}restart(){for(const s of this.system.emitters){const t=s.rate;t instanceof d?t.restart():t.nextTime=0,s.removeAllParticles()}}onUpdate(s){this.paused||(this.object.getWorldPosition(this._worldPos),this.system?.emitters.forEach((s=>{"world"===s._space&&s.setPosition(this._worldPos)})),this.system?.update(s*this.timescale))}getParticleCount(){return this.system?.getCount()??0}onEndPlay(){this.stop(),null!=this.disposeSystem&&this.disposeSystem()}};l=s([i()],l);export{l as VfxActor};/*
|
3
2
|
* Copyright (©) 2023. All rights reserved.
|
4
3
|
* See the LICENSE.md file for details.
|
5
4
|
*/
|
@@ -32,6 +32,15 @@ export declare const ThreeBlendingMode: {
|
|
32
32
|
subtractive: 3;
|
33
33
|
multiply: 4;
|
34
34
|
};
|
35
|
+
export declare const FlipbookModes: readonly ["clamp", "loop"];
|
36
|
+
export type FlipbookMode = (typeof FlipbookModes)[number];
|
37
|
+
export type FlipbookSettings = {
|
38
|
+
enabled: boolean;
|
39
|
+
rows: number;
|
40
|
+
columns: number;
|
41
|
+
fps: number;
|
42
|
+
mode: FlipbookMode;
|
43
|
+
};
|
35
44
|
export type CommonOutput = {
|
36
45
|
space: 'world' | 'local';
|
37
46
|
};
|
@@ -41,6 +50,7 @@ export type SpriteOutput = {
|
|
41
50
|
color: string;
|
42
51
|
blendingMode: BlendingMode;
|
43
52
|
softness: number;
|
53
|
+
flipbook?: FlipbookSettings;
|
44
54
|
} & CommonOutput;
|
45
55
|
export type StretchedSpriteOutput = {
|
46
56
|
type: 'stretchedSprite';
|
@@ -124,3 +134,4 @@ export declare function EmitterDataConstructor(): {
|
|
124
134
|
softness: number;
|
125
135
|
};
|
126
136
|
};
|
137
|
+
//# sourceMappingURL=vfx-asset.d.ts.map
|