@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
@@ -1,5 +1,4 @@
|
|
1
|
-
import{__decorate as t,__metadata as e}from"tslib";import{Raycaster as i,Vector2 as o}from"three";import{Service as n}from"typedi";import{ViewController as s}from"./render";import{World as r}from"./world";import{inject as c}from"../../gameplay";import{Subject as h,tap as p,map as a,filter as d,takeUntil as l,withLatestFrom as b,mergeMap as P,merge as u,from as j}from"rxjs";let w=class{constructor(){this.view=c(s),this.world=c(r),this.enabled=!1,this.stopped=new h,this.monitoredObjects=new Map,this.useCache=!1,this.cachePointerPosition=new o,this.pointerPosition=new o,this.adjustedPosition=new o,this.raycastIntersectionResult=[],this.raycaster=new i,this.onClick=new h,this.onDoubleClick=new h,this.onPointerMove=new h,this.onPointerDown=new h,this.onPointerUp=new h,this.onPointerEnterObject3D=t=>{let e=!1;return this.onPointerMove.pipe(this.tapUsingPointerMove(),this.tapMonitorObject(t),a((()=>this.findIntersection(t))),p((t=>{null==t&&(e=!1)})),d((t=>null!=t&&!e)),p((()=>{e=!0})),a((e=>({intersection:e,object:t}))))},this.onPointerEnterActor=t=>this.onPointerEnterObject3D(t.object).pipe(l(t.disposed),a((({intersection:e})=>({intersection:e,actor:t})))),this.onPointerEnterActorType=t=>u(j(this.world.actors),this.world.actorAdded).pipe(d((e=>e instanceof t)),P((t=>this.onPointerEnterActor(t)))),this.onPointerLeaveObject3D=t=>{let e=!1;return this.onPointerMove.pipe(this.tapUsingPointerMove(),this.tapMonitorObject(t),a((()=>this.findIntersection(t))),p((t=>{null!=t&&(e=!1)})),d((t=>null==t&&!e)),p((()=>{e=!0})),a((e=>({intersection:e,object:t}))))},this.onPointerLeaveActor=t=>this.onPointerLeaveObject3D(t.object).pipe(l(t.disposed),a((({intersection:e})=>({intersection:e,actor:t})))),this.onPointerLeaveActorType=t=>u(j(this.world.actors),this.world.actorAdded).pipe(d((e=>e instanceof t)),P((t=>this.onPointerLeaveActor(t)))),this.onClickObject3D=t=>{const e=this.onPointerDown.pipe(a((()=>this.findIntersection(t))));return this.onPointerUp.pipe(a((()=>this.findIntersection(t)))).pipe(this.tapMonitorObject(t),b(e),d((([t,e])=>null!=t&&null!=e)),a((([e])=>({intersection:e,object:t}))))},this.onClickActor=t=>this.onClickObject3D(t.object).pipe(l(t.disposed),a((({intersection:e})=>({intersection:e,actor:t})))),this.onClickActorType=t=>u(j(this.world.actors),this.world.actorAdded).pipe(d((e=>e instanceof t)),P((t=>this.onClickActor(t)))),this.onPointerDownActor=t=>this.onPointerDownObject3D(t.object).pipe(l(t.disposed),a((({intersection:e})=>({intersection:e,actor:t})))),this.onPointerDownActorType=t=>u(j(this.world.actors),this.world.actorAdded).pipe(d((e=>e instanceof t)),P((t=>this.onPointerDownActor(t)))),this.onPointerDownObject3D=t=>this.onPointerDown.pipe(this.tapMonitorObject(t),a((()=>this.findIntersection(t))),d((t=>null!=t)),a((e=>({intersection:e,object:t})))),this.onPointerUpActor=t=>this.onPointerUpObject3D(t.object).pipe(l(t.disposed),a((({intersection:e})=>({intersection:e,actor:t})))),this.onPointerUpActorType=t=>u(j(this.world.actors),this.world.actorAdded).pipe(d((e=>e instanceof t)),P((t=>this.onPointerUpActor(t)))),this.onPointerUpObject3D=t=>this.onPointerUp.pipe(this.tapMonitorObject(t),a((()=>this.findIntersection(t))),d((t=>null!=t)),a((e=>({intersection:e,object:t})))),this.onPointerMoveActor=t=>this.onPointerMoveObject3D(t.object).pipe(l(t.disposed),a((({intersection:e})=>({intersection:e,actor:t})))),this.onPointerMoveActorType=t=>u(j(this.world.actors),this.world.actorAdded).pipe(d((e=>e instanceof t)),P((t=>this.onPointerMoveActor(t)))),this.onPointerMoveObject3D=t=>this.onPointerMove.pipe(this.tapUsingPointerMove(),this.tapMonitorObject(t),a((()=>this.findIntersection(t))),d((t=>null!=t)),a((e=>({intersection:e,object:t})))),this.usingPointerMoveEvents=!1,this.handlers={click:t=>{this.onClick.next(t)},dblclick:t=>{this.onDoubleClick.next(t)},pointermove:t=>{this.onPointerMove.next(t)},pointerup:t=>{this.onPointerUp.next(t)},pointerdown:t=>{this.onPointerDown.next(t)}},this.raycaster.firstHitOnly=!0}start(){this.enabled||(this.enabled=!0,Object.entries(this.handlers).forEach((([t,e])=>{this.view.htmlElement.addEventListener(t,(i=>{("pointermove"!==t||this.usingPointerMoveEvents)&&(this.updateRaycast(i),e(i))}))})),this.view.onLateUpdate().pipe(l(this.stopped)).subscribe((()=>this.useCache=!1)))}stop(){this.enabled=!1,Object.entries(this.handlers).forEach((([t,e])=>{document.removeEventListener(t,e)})),this.stopped.next(!0),this.onClick.complete(),this.onDoubleClick.complete(),this.onPointerMove.complete(),this.onPointerDown.complete(),this.onPointerUp.complete()}addMonitoredObject(t){const e=this.monitoredObjects.get(t)??0;this.monitoredObjects.set(t,e+1)}removeMonitoriedObject(t){const e=this.monitoredObjects.get(t);null!=e&&(e>1?this.monitoredObjects.set(t,e-1):this.monitoredObjects.delete(t))}updateRaycast(t){this.pointerPosition.set(t.x,t.y),this.useCache&&this.cachePointerPosition.equals(this.pointerPosition)||(this.cachePointerPosition.copy(this.pointerPosition),this.useCache=!0,this.adjustedPosition.x=t.offsetX/this.view.htmlElement.offsetWidth*2-1,this.adjustedPosition.y=-t.offsetY/this.view.htmlElement.offsetHeight*2+1,this.raycaster.setFromCamera(this.adjustedPosition,this.view.getCamera()),this.raycastIntersectionResult.length=0,this.raycaster.intersectObject(this.world.scene,!0,this.raycastIntersectionResult))}tapUsingPointerMove(){return p({subscribe:()=>{this.usingPointerMoveEvents=!0},unsubscribe:()=>{}})}tapMonitorObject(t){return p({subscribe:()=>{this.addMonitoredObject(t)},unsubscribe:()=>{this.removeMonitoriedObject(t)}})}findIntersection(t){if(this.raycastIntersectionResult.length>0){let e=this.raycastIntersectionResult[0].object;for(;null!=e;){if(e.uuid===t.uuid)return this.raycastIntersectionResult[0];e=e.parent}}return null}};w=t([n(),e("design:paramtypes",[])],w);export{w as PointerEvents}
|
2
|
-
/*
|
1
|
+
import{__decorate as t,__metadata as e}from"tslib";import{Raycaster as i,Vector2 as o}from"three";import{Service as n}from"typedi";import{ViewController as s}from"./render";import{World as r}from"./world";import{inject as c}from"../../gameplay";import{Subject as h,tap as p,map as a,filter as d,takeUntil as l,withLatestFrom as b,mergeMap as P,merge as u,from as j}from"rxjs";let w=class{constructor(){this.view=c(s),this.world=c(r),this.enabled=!1,this.stopped=new h,this.monitoredObjects=new Map,this.useCache=!1,this.cachePointerPosition=new o,this.pointerPosition=new o,this.adjustedPosition=new o,this.raycastIntersectionResult=[],this.raycaster=new i,this.onClick=new h,this.onDoubleClick=new h,this.onPointerMove=new h,this.onPointerDown=new h,this.onPointerUp=new h,this.onPointerEnterObject3D=t=>{let e=!1;return this.onPointerMove.pipe(this.tapUsingPointerMove(),this.tapMonitorObject(t),a((()=>this.findIntersection(t))),p((t=>{null==t&&(e=!1)})),d((t=>null!=t&&!e)),p((()=>{e=!0})),a((e=>({intersection:e,object:t}))))},this.onPointerEnterActor=t=>this.onPointerEnterObject3D(t.object).pipe(l(t.disposed),a((({intersection:e})=>({intersection:e,actor:t})))),this.onPointerEnterActorType=t=>u(j(this.world.actors),this.world.actorAdded).pipe(d((e=>e instanceof t)),P((t=>this.onPointerEnterActor(t)))),this.onPointerLeaveObject3D=t=>{let e=!1;return this.onPointerMove.pipe(this.tapUsingPointerMove(),this.tapMonitorObject(t),a((()=>this.findIntersection(t))),p((t=>{null!=t&&(e=!1)})),d((t=>null==t&&!e)),p((()=>{e=!0})),a((e=>({intersection:e,object:t}))))},this.onPointerLeaveActor=t=>this.onPointerLeaveObject3D(t.object).pipe(l(t.disposed),a((({intersection:e})=>({intersection:e,actor:t})))),this.onPointerLeaveActorType=t=>u(j(this.world.actors),this.world.actorAdded).pipe(d((e=>e instanceof t)),P((t=>this.onPointerLeaveActor(t)))),this.onClickObject3D=t=>{const e=this.onPointerDown.pipe(a((()=>this.findIntersection(t))));return this.onPointerUp.pipe(a((()=>this.findIntersection(t)))).pipe(this.tapMonitorObject(t),b(e),d((([t,e])=>null!=t&&null!=e)),a((([e])=>({intersection:e,object:t}))))},this.onClickActor=t=>this.onClickObject3D(t.object).pipe(l(t.disposed),a((({intersection:e})=>({intersection:e,actor:t})))),this.onClickActorType=t=>u(j(this.world.actors),this.world.actorAdded).pipe(d((e=>e instanceof t)),P((t=>this.onClickActor(t)))),this.onPointerDownActor=t=>this.onPointerDownObject3D(t.object).pipe(l(t.disposed),a((({intersection:e})=>({intersection:e,actor:t})))),this.onPointerDownActorType=t=>u(j(this.world.actors),this.world.actorAdded).pipe(d((e=>e instanceof t)),P((t=>this.onPointerDownActor(t)))),this.onPointerDownObject3D=t=>this.onPointerDown.pipe(this.tapMonitorObject(t),a((()=>this.findIntersection(t))),d((t=>null!=t)),a((e=>({intersection:e,object:t})))),this.onPointerUpActor=t=>this.onPointerUpObject3D(t.object).pipe(l(t.disposed),a((({intersection:e})=>({intersection:e,actor:t})))),this.onPointerUpActorType=t=>u(j(this.world.actors),this.world.actorAdded).pipe(d((e=>e instanceof t)),P((t=>this.onPointerUpActor(t)))),this.onPointerUpObject3D=t=>this.onPointerUp.pipe(this.tapMonitorObject(t),a((()=>this.findIntersection(t))),d((t=>null!=t)),a((e=>({intersection:e,object:t})))),this.onPointerMoveActor=t=>this.onPointerMoveObject3D(t.object).pipe(l(t.disposed),a((({intersection:e})=>({intersection:e,actor:t})))),this.onPointerMoveActorType=t=>u(j(this.world.actors),this.world.actorAdded).pipe(d((e=>e instanceof t)),P((t=>this.onPointerMoveActor(t)))),this.onPointerMoveObject3D=t=>this.onPointerMove.pipe(this.tapUsingPointerMove(),this.tapMonitorObject(t),a((()=>this.findIntersection(t))),d((t=>null!=t)),a((e=>({intersection:e,object:t})))),this.usingPointerMoveEvents=!1,this.handlers={click:t=>{this.onClick.next(t)},dblclick:t=>{this.onDoubleClick.next(t)},pointermove:t=>{this.onPointerMove.next(t)},pointerup:t=>{this.onPointerUp.next(t)},pointerdown:t=>{this.onPointerDown.next(t)}},this.raycaster.firstHitOnly=!0}start(){this.enabled||(this.enabled=!0,Object.entries(this.handlers).forEach((([t,e])=>{this.view.htmlElement.addEventListener(t,(i=>{("pointermove"!==t||this.usingPointerMoveEvents)&&(this.updateRaycast(i),e(i))}))})),this.view.onLateUpdate().pipe(l(this.stopped)).subscribe((()=>this.useCache=!1)))}stop(){this.enabled=!1,Object.entries(this.handlers).forEach((([t,e])=>{document.removeEventListener(t,e)})),this.stopped.next(!0),this.onClick.complete(),this.onDoubleClick.complete(),this.onPointerMove.complete(),this.onPointerDown.complete(),this.onPointerUp.complete()}addMonitoredObject(t){const e=this.monitoredObjects.get(t)??0;this.monitoredObjects.set(t,e+1)}removeMonitoriedObject(t){const e=this.monitoredObjects.get(t);null!=e&&(e>1?this.monitoredObjects.set(t,e-1):this.monitoredObjects.delete(t))}updateRaycast(t){this.pointerPosition.set(t.x,t.y),this.useCache&&this.cachePointerPosition.equals(this.pointerPosition)||(this.cachePointerPosition.copy(this.pointerPosition),this.useCache=!0,this.adjustedPosition.x=t.offsetX/this.view.htmlElement.offsetWidth*2-1,this.adjustedPosition.y=-t.offsetY/this.view.htmlElement.offsetHeight*2+1,this.raycaster.setFromCamera(this.adjustedPosition,this.view.getCamera()),this.raycastIntersectionResult.length=0,this.raycaster.intersectObject(this.world.scene,!0,this.raycastIntersectionResult))}tapUsingPointerMove(){return p({subscribe:()=>{this.usingPointerMoveEvents=!0},unsubscribe:()=>{}})}tapMonitorObject(t){return p({subscribe:()=>{this.addMonitoredObject(t)},unsubscribe:()=>{this.removeMonitoriedObject(t)}})}findIntersection(t){if(this.raycastIntersectionResult.length>0){let e=this.raycastIntersectionResult[0].object;for(;null!=e;){if(e.uuid===t.uuid)return this.raycastIntersectionResult[0];e=e.parent}}return null}};w=t([n(),e("design:paramtypes",[])],w);export{w as PointerEvents};/*
|
3
2
|
* Copyright (©) 2023. All rights reserved.
|
4
3
|
* See the LICENSE.md file for details.
|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 @@
|
|
1
|
-
import{__decorate as t,__metadata as e}from"tslib";import{Service as i}from"typedi";import{Camera as s}from"three";import{RenderingView as r}from"../../rendering.js";import{Subject as n,takeUntil as o}from"rxjs";import*as a from"three";let h=class{constructor(t){this.view=t,this.tick=new n,this.lateTick=new n,this.audioListener=new a.AudioListener,t.onLoop((t=>{this.tick.next(t),this.lateTick.next(t)})),t.camera.add(this.audioListener),window.hology_view=this}set fpsCap(t){this.view.fpsCap=t}get fpsCap(){return this.view.fpsCap}set showStats(t){this.view.showStats=t}get showStats(){return this.view.showStats}onUpdate(t){return null!=t&&this.tick.pipe(o(t.disposed)),this.tick}onLateUpdate(t){return null!=t&&this.lateTick.pipe(o(t.disposed)),this.lateTick}setCamera(t){const e=t instanceof s?t:t.camera.instance;this.view.setCamera(e),e.add(this.audioListener)}getCamera(){return this.view.camera}get htmlElement(){return this.view.container}pauseRendering(){this.view.paused=!0}unpauseRendering(){this.view.paused=!1}dispose(){this.view.stop(),this.audioListener.removeFromParent()}getScreenPosition(t,e=p){const i=this.getCamera();if(i instanceof a.PerspectiveCamera&&(c.setFromProjectionMatrix(i.projectionMatrix),!c.containsPoint(t)))return null;const s=this.view.container.offsetWidth/2,r=this.view.container.offsetHeight/2;return e.copy(t),e.project(this.getCamera()),e.x=e.x*s+s,e.y=-e.y*r+r,e}};h=t([i(),e("design:paramtypes",[r])],h);export{h as ViewController};const p=new a.Vector3,c=new a.Frustum
|
2
|
-
/*
|
1
|
+
import{__decorate as t,__metadata as e}from"tslib";import{Service as i}from"typedi";import{Camera as s}from"three";import{RenderingView as r}from"../../rendering.js";import{Subject as n,takeUntil as o}from"rxjs";import*as a from"three";let h=class{constructor(t){this.view=t,this.tick=new n,this.lateTick=new n,this.audioListener=new a.AudioListener,t.onLoop((t=>{this.tick.next(t),this.lateTick.next(t)})),t.camera.add(this.audioListener),window.hology_view=this}set fpsCap(t){this.view.fpsCap=t}get fpsCap(){return this.view.fpsCap}set showStats(t){this.view.showStats=t}get showStats(){return this.view.showStats}onUpdate(t){return null!=t&&this.tick.pipe(o(t.disposed)),this.tick}onLateUpdate(t){return null!=t&&this.lateTick.pipe(o(t.disposed)),this.lateTick}setCamera(t){const e=t instanceof s?t:t.camera.instance;this.view.setCamera(e),e.add(this.audioListener)}getCamera(){return this.view.camera}get htmlElement(){return this.view.container}pauseRendering(){this.view.paused=!0}unpauseRendering(){this.view.paused=!1}dispose(){this.view.stop(),this.audioListener.removeFromParent()}getScreenPosition(t,e=p){const i=this.getCamera();if(i instanceof a.PerspectiveCamera&&(c.setFromProjectionMatrix(i.projectionMatrix),!c.containsPoint(t)))return null;const s=this.view.container.offsetWidth/2,r=this.view.container.offsetHeight/2;return e.copy(t),e.project(this.getCamera()),e.x=e.x*s+s,e.y=-e.y*r+r,e}};h=t([i(),e("design:paramtypes",[r])],h);export{h as ViewController};const p=new a.Vector3,c=new a.Frustum;/*
|
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":"world.d.ts","sourceRoot":"","sources":["../../../src/gameplay/services/world.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,aAAa,EAAE,MAAM,QAAQ,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAE9C,OAAO,EAAE,UAAU,EAAW,MAAM,MAAM,CAAA;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAKnD,cAAM,0BAA0B;IAClB,OAAO,CAAC,IAAI;gBAAJ,IAAI,EAAE,aAAa;IAIvC;;;OAGG;IACH,IAAI,SAAS,IAAI,OAAO,CAEvB;IAED,IAAI,SAAS,CAAC,KAAK,EAAE,MAAM,EAG1B;IAED,IAAI,SAAS,IAAI,MAAM,CAEtB;IAED;;;;OAIG;IACH,IAAI,QAAQ,IAAI,OAAO,CAKtB;CAEF;AAED,qBACa,KAAK;IAOJ,OAAO,CAAC,YAAY;IAAgB,OAAO,CAAC,IAAI;IAN5D,SAAgB,MAAM,EAAE,SAAS,EAAE,CAAK;IACxC,SAAgB,UAAU,EAAE,UAAU,CAAC,SAAS,CAAC,CAAgB;IACjE,SAAgB,YAAY,EAAE,UAAU,CAAC,SAAS,CAAC,CAAgB;IAC5D,KAAK,EAAE,KAAK,CAAA;IACnB,SAAgB,gBAAgB,6BAA4C;gBAExD,YAAY,EAAE,YAAY,EAAU,IAAI,EAAE,aAAa;IAE9D,UAAU,CAAC,CAAC,SAAS,SAAS,EAAE,IAAI,EAAE,aAAa,CAAC,CAAC,CAAC,EAAE,QAAQ,CAAC,EAAE,OAAO,EAAE,QAAQ,CAAC,EAAE,KAAK,GAAG,OAAO,CAAC,CAAC,CAAC;IAM/G,QAAQ,CAAC,KAAK,EAAE,SAAS,EAAE,QAAQ,CAAC,EAAE,OAAO,EAAE,QAAQ,CAAC,EAAE,KAAK;IAa/D,WAAW,CAAC,KAAK,EAAE,SAAS;IAS5B,eAAe,CAAC,CAAC,SAAS,SAAS,EAAE,IAAI,EAAE,aAAa,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,CAAC;IAI9E,gBAAgB,CAAC,CAAC,SAAS,SAAS,EAAE,IAAI,EAAE,aAAa,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,CAAC,EAAE;CAGzF"}
|
@@ -1,5 +1,4 @@
|
|
1
|
-
import{__decorate as t,__metadata as i}from"tslib";import{Service as e}from"typedi";import{ActorFactory as s}from"../actors/factory.js";import{Vector3 as o}from"three";import{ActorComponent as r}from"../../gameplay/actors/component.js";import{Subject as n}from"rxjs";import{RenderingView as c}from"../../rendering.js";const a=new o;class h{constructor(t){this.view=t}get direction(){return this.view.csm.lightDirection}set intensity(t){this.view.csm.lightIntensity=t,this.view.csm.lights.forEach((t=>t.intensity=this.view.csm.lightIntensity))}get intensity(){return this.view.csm.lightIntensity}get position(){return 0==this.view.csm.lights.length?a:this.view.csm.lights[0].position}}let m=class{constructor(t,i){this.actorFactory=t,this.view=i,this.actors=[],this.actorAdded=new n,this.actorRemoved=new n,this.directionalLight=new h(this.view)}async spawnActor(t,i,e){const s=await this.actorFactory.create(t,i,e);return this.addActor(s,i,e),s}addActor(t,i,e){i&&t.object.position.copy(i),e&&t.object.rotation.copy(e),this.scene.add(t.object),this.actors.push(t),d(t,(t=>t.onBeginPlay())),this.actorAdded.next(t)}removeActor(t){d(t,(t=>t.onEndPlay()));const i=this.actors.indexOf(t);i>=0&&this.actors.splice(i,1),this.scene.remove(t.object),t.disposed.next(!0),this.actorRemoved.next(t)}findActorByType(t,i){return this.actors.find((e=>e instanceof t&&(null==i||e.object.name==i)))}findActorsByType(t,i){return this.actors.filter((e=>e instanceof t&&(null==i||e.object.name==i)))}};m=t([e(),i("design:paramtypes",[s,c])],m);export{m as World};function d(t,i){return i(t),Object.entries(t).filter((([t,i])=>i instanceof r)).forEach((([t,e])=>{d(e,i)}))}
|
2
|
-
/*
|
1
|
+
import{__decorate as t,__metadata as i}from"tslib";import{Service as e}from"typedi";import{ActorFactory as s}from"../actors/factory.js";import{Vector3 as o}from"three";import{ActorComponent as r}from"../../gameplay/actors/component.js";import{Subject as n}from"rxjs";import{RenderingView as c}from"../../rendering.js";const a=new o;class h{constructor(t){this.view=t}get direction(){return this.view.csm.lightDirection}set intensity(t){this.view.csm.lightIntensity=t,this.view.csm.lights.forEach((t=>t.intensity=this.view.csm.lightIntensity))}get intensity(){return this.view.csm.lightIntensity}get position(){return 0==this.view.csm.lights.length?a:this.view.csm.lights[0].position}}let m=class{constructor(t,i){this.actorFactory=t,this.view=i,this.actors=[],this.actorAdded=new n,this.actorRemoved=new n,this.directionalLight=new h(this.view)}async spawnActor(t,i,e){const s=await this.actorFactory.create(t,i,e);return this.addActor(s,i,e),s}addActor(t,i,e){i&&t.object.position.copy(i),e&&t.object.rotation.copy(e),this.scene.add(t.object),this.actors.push(t),d(t,(t=>t.onBeginPlay())),this.actorAdded.next(t)}removeActor(t){d(t,(t=>t.onEndPlay()));const i=this.actors.indexOf(t);i>=0&&this.actors.splice(i,1),this.scene.remove(t.object),t.disposed.next(!0),this.actorRemoved.next(t)}findActorByType(t,i){return this.actors.find((e=>e instanceof t&&(null==i||e.object.name==i)))}findActorsByType(t,i){return this.actors.filter((e=>e instanceof t&&(null==i||e.object.name==i)))}};m=t([e(),i("design:paramtypes",[s,c])],m);export{m as World};function d(t,i){return i(t),Object.entries(t).filter((([t,i])=>i instanceof r)).forEach((([t,e])=>{d(e,i)}))}/*
|
3
2
|
* Copyright (©) 2023. All rights reserved.
|
4
3
|
* See the LICENSE.md file for details.
|
5
4
|
*/
|
package/dist/index.d.ts
CHANGED
@@ -3,3 +3,4 @@ export { BaseGameController } from './controllers/base-game-controller.js';
|
|
3
3
|
export * from './scene/collision/collision-shape.js';
|
4
4
|
export { AssetMeshInstance } from './scene/asset-resource-loader.js';
|
5
5
|
export { registerWorker, initWorker } from './worker';
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAA;AAChD,OAAO,EAAE,kBAAkB,EAAE,MAAM,uCAAuC,CAAC;AAC3E,cAAc,sCAAsC,CAAA;AACpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAA;AACpE,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA"}
|
package/dist/index.js
CHANGED
@@ -1,5 +1,4 @@
|
|
1
|
-
export{loadScene}from"./scene/bootstrap.js";export{BaseGameController}from"./controllers/base-game-controller.js";export*from"./scene/collision/collision-shape.js";export{AssetMeshInstance}from"./scene/asset-resource-loader.js";export{registerWorker,initWorker}from"./worker"
|
2
|
-
/*
|
1
|
+
export{loadScene}from"./scene/bootstrap.js";export{BaseGameController}from"./controllers/base-game-controller.js";export*from"./scene/collision/collision-shape.js";export{AssetMeshInstance}from"./scene/asset-resource-loader.js";export{registerWorker,initWorker}from"./worker";/*
|
3
2
|
* Copyright (©) 2023. All rights reserved.
|
4
3
|
* See the LICENSE.md file for details.
|
5
4
|
*/
|
@@ -1,2 +1,3 @@
|
|
1
1
|
export declare const lambertVertexShaderOverride = "\nvec3 diffuse = vec3( 1.0 );\nGeometricContext geometry;\ngeometry.position = mvPosition.xyz;\ngeometry.normal = normalize( transformedNormal );\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( -mvPosition.xyz );\nGeometricContext backGeometry;\nbackGeometry.position = geometry.position;\nbackGeometry.normal = -geometry.normal;\nbackGeometry.viewDir = geometry.viewDir;\nvLightFront = vec3( 0.0 );\nvIndirectFront = vec3( 0.0 );\n#ifdef DOUBLE_SIDED\n\tvLightBack = vec3( 0.0 );\n\tvIndirectBack = vec3( 0.0 );\n#endif\nIncidentLight directLight;\nfloat dotNL;\nvec3 directLightColor_Diffuse;\nvIndirectFront += getAmbientLightIrradiance( ambientLightColor );\nvIndirectFront += getLightProbeIrradiance( lightProbe, geometry.normal );\n#ifdef DOUBLE_SIDED\n\tvIndirectBack += getAmbientLightIrradiance( ambientLightColor );\n\tvIndirectBack += getLightProbeIrradiance( lightProbe, backGeometry.normal );\n#endif\n#if NUM_POINT_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tgetPointLightInfo( pointLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( - dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tgetSpotLightInfo( spotLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( - dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if NUM_DIR_LIGHTS > 0\n float linearDepth = (-mvPosition.z) / (shadowFar - cameraNear);\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\n #if ( UNROLLED_LOOP_INDEX < CSM_CASCADES )\n if(linearDepth >= CSM_cascades[UNROLLED_LOOP_INDEX].x && (linearDepth < CSM_cascades[UNROLLED_LOOP_INDEX].y || UNROLLED_LOOP_INDEX == CSM_CASCADES - 1)) {\n #endif \n getDirectionalLightInfo( directionalLights[ i ], geometry, directLight );\n dotNL = dot( geometry.normal, directLight.direction );\n directLightColor_Diffuse = directLight.color;\n vLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n #ifdef DOUBLE_SIDED\n vLightBack += saturate( - dotNL ) * directLightColor_Diffuse;\n #endif\n #if ( UNROLLED_LOOP_INDEX < CSM_CASCADES )\n }\n #endif \n\t}\n\t#pragma unroll_loop_end\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\tvIndirectFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry.normal );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvIndirectBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry.normal );\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif\n";
|
2
2
|
export declare const shadowMaskOverride = "\nvarying vec3 vViewPosition;\nfloat getShadowMask() {\n\tfloat shadow = 1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n // TODO this does not work as this varying does not exist in this shader\n float linearDepth = (-vViewPosition.z) / (shadowFar - cameraNear);\n\tDirectionalLightShadow directionalLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n #if ( UNROLLED_LOOP_INDEX < CSM_CASCADES )\n if(linearDepth >= CSM_cascades[UNROLLED_LOOP_INDEX].x && linearDepth < CSM_cascades[UNROLLED_LOOP_INDEX].y) {\n #endif \n directionalLight = directionalLightShadows[ i ];\n shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n #if ( UNROLLED_LOOP_INDEX < CSM_CASCADES )\n }\n #endif \n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tspotLight = spotLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tpointLight = pointLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#endif\n\treturn shadow;\n}\n";
|
3
|
+
//# sourceMappingURL=shader-override.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"shader-override.d.ts","sourceRoot":"","sources":["../../src/rendering/shader-override.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,2BAA2B,8mGAkFvC,CAAA;AAED,eAAO,MAAM,kBAAkB,+zDA2C9B,CAAA"}
|
@@ -1,5 +1,4 @@
|
|
1
|
-
export const lambertVertexShaderOverride="\nvec3 diffuse = vec3( 1.0 );\nGeometricContext geometry;\ngeometry.position = mvPosition.xyz;\ngeometry.normal = normalize( transformedNormal );\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( -mvPosition.xyz );\nGeometricContext backGeometry;\nbackGeometry.position = geometry.position;\nbackGeometry.normal = -geometry.normal;\nbackGeometry.viewDir = geometry.viewDir;\nvLightFront = vec3( 0.0 );\nvIndirectFront = vec3( 0.0 );\n#ifdef DOUBLE_SIDED\n\tvLightBack = vec3( 0.0 );\n\tvIndirectBack = vec3( 0.0 );\n#endif\nIncidentLight directLight;\nfloat dotNL;\nvec3 directLightColor_Diffuse;\nvIndirectFront += getAmbientLightIrradiance( ambientLightColor );\nvIndirectFront += getLightProbeIrradiance( lightProbe, geometry.normal );\n#ifdef DOUBLE_SIDED\n\tvIndirectBack += getAmbientLightIrradiance( ambientLightColor );\n\tvIndirectBack += getLightProbeIrradiance( lightProbe, backGeometry.normal );\n#endif\n#if NUM_POINT_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tgetPointLightInfo( pointLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( - dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tgetSpotLightInfo( spotLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( - dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if NUM_DIR_LIGHTS > 0\n float linearDepth = (-mvPosition.z) / (shadowFar - cameraNear);\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\n #if ( UNROLLED_LOOP_INDEX < CSM_CASCADES )\n if(linearDepth >= CSM_cascades[UNROLLED_LOOP_INDEX].x && (linearDepth < CSM_cascades[UNROLLED_LOOP_INDEX].y || UNROLLED_LOOP_INDEX == CSM_CASCADES - 1)) {\n #endif \n getDirectionalLightInfo( directionalLights[ i ], geometry, directLight );\n dotNL = dot( geometry.normal, directLight.direction );\n directLightColor_Diffuse = directLight.color;\n vLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n #ifdef DOUBLE_SIDED\n vLightBack += saturate( - dotNL ) * directLightColor_Diffuse;\n #endif\n #if ( UNROLLED_LOOP_INDEX < CSM_CASCADES )\n }\n #endif \n\t}\n\t#pragma unroll_loop_end\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\tvIndirectFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry.normal );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvIndirectBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry.normal );\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif\n";export const shadowMaskOverride="\nvarying vec3 vViewPosition;\nfloat getShadowMask() {\n\tfloat shadow = 1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n // TODO this does not work as this varying does not exist in this shader\n float linearDepth = (-vViewPosition.z) / (shadowFar - cameraNear);\n\tDirectionalLightShadow directionalLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n #if ( UNROLLED_LOOP_INDEX < CSM_CASCADES )\n if(linearDepth >= CSM_cascades[UNROLLED_LOOP_INDEX].x && linearDepth < CSM_cascades[UNROLLED_LOOP_INDEX].y) {\n #endif \n directionalLight = directionalLightShadows[ i ];\n shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n #if ( UNROLLED_LOOP_INDEX < CSM_CASCADES )\n }\n #endif \n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tspotLight = spotLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tpointLight = pointLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#endif\n\treturn shadow;\n}\n"
|
2
|
-
/*
|
1
|
+
export const lambertVertexShaderOverride="\nvec3 diffuse = vec3( 1.0 );\nGeometricContext geometry;\ngeometry.position = mvPosition.xyz;\ngeometry.normal = normalize( transformedNormal );\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( -mvPosition.xyz );\nGeometricContext backGeometry;\nbackGeometry.position = geometry.position;\nbackGeometry.normal = -geometry.normal;\nbackGeometry.viewDir = geometry.viewDir;\nvLightFront = vec3( 0.0 );\nvIndirectFront = vec3( 0.0 );\n#ifdef DOUBLE_SIDED\n\tvLightBack = vec3( 0.0 );\n\tvIndirectBack = vec3( 0.0 );\n#endif\nIncidentLight directLight;\nfloat dotNL;\nvec3 directLightColor_Diffuse;\nvIndirectFront += getAmbientLightIrradiance( ambientLightColor );\nvIndirectFront += getLightProbeIrradiance( lightProbe, geometry.normal );\n#ifdef DOUBLE_SIDED\n\tvIndirectBack += getAmbientLightIrradiance( ambientLightColor );\n\tvIndirectBack += getLightProbeIrradiance( lightProbe, backGeometry.normal );\n#endif\n#if NUM_POINT_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tgetPointLightInfo( pointLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( - dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tgetSpotLightInfo( spotLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( - dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if NUM_DIR_LIGHTS > 0\n float linearDepth = (-mvPosition.z) / (shadowFar - cameraNear);\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\n #if ( UNROLLED_LOOP_INDEX < CSM_CASCADES )\n if(linearDepth >= CSM_cascades[UNROLLED_LOOP_INDEX].x && (linearDepth < CSM_cascades[UNROLLED_LOOP_INDEX].y || UNROLLED_LOOP_INDEX == CSM_CASCADES - 1)) {\n #endif \n getDirectionalLightInfo( directionalLights[ i ], geometry, directLight );\n dotNL = dot( geometry.normal, directLight.direction );\n directLightColor_Diffuse = directLight.color;\n vLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n #ifdef DOUBLE_SIDED\n vLightBack += saturate( - dotNL ) * directLightColor_Diffuse;\n #endif\n #if ( UNROLLED_LOOP_INDEX < CSM_CASCADES )\n }\n #endif \n\t}\n\t#pragma unroll_loop_end\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\tvIndirectFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry.normal );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvIndirectBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry.normal );\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif\n";export const shadowMaskOverride="\nvarying vec3 vViewPosition;\nfloat getShadowMask() {\n\tfloat shadow = 1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n // TODO this does not work as this varying does not exist in this shader\n float linearDepth = (-vViewPosition.z) / (shadowFar - cameraNear);\n\tDirectionalLightShadow directionalLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n #if ( UNROLLED_LOOP_INDEX < CSM_CASCADES )\n if(linearDepth >= CSM_cascades[UNROLLED_LOOP_INDEX].x && linearDepth < CSM_cascades[UNROLLED_LOOP_INDEX].y) {\n #endif \n directionalLight = directionalLightShadows[ i ];\n shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n #if ( UNROLLED_LOOP_INDEX < CSM_CASCADES )\n }\n #endif \n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tspotLight = spotLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tpointLight = pointLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#endif\n\treturn shadow;\n}\n";/*
|
3
2
|
* Copyright (©) 2023. All rights reserved.
|
4
3
|
* See the LICENSE.md file for details.
|
5
4
|
*/
|
package/dist/rendering.d.ts
CHANGED
@@ -88,3 +88,4 @@ export declare function setRenderingPaused(value: boolean): void;
|
|
88
88
|
* @returns `true` if the object is in the camera's frustum, `false` otherwise.
|
89
89
|
*/
|
90
90
|
export declare function isObjectInFrustum(object: THREE.Object3D, frustum: THREE.Frustum): boolean;
|
91
|
+
//# sourceMappingURL=rendering.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"rendering.d.ts","sourceRoot":"","sources":["../src/rendering.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EACL,MAAM,EAKN,QAAQ,EAIR,aAAa,EACb,iBAAiB,EAClB,MAAM,OAAO,CAAC;AAOf,OAAO,EAAE,GAAG,EAAE,MAAM,+BAA+B,CAAC;AAGpD,OAAO,EAAE,QAAQ,EAAE,MAAM,+CAA+C,CAAC;AA6CzE,MAAM,MAAM,oBAAoB,GAAG;IACjC,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,OAAO,CAAC,EAAE;QACR,UAAU,CAAC,EAAE,OAAO,CAAA;KACrB,CAAA;IACD,EAAE,CAAC,EAAE;QACH,OAAO,EAAE,OAAO,CAAA;KACjB,CAAA;CACF,CAAA;AAED,qBACa,aAAa;IA+Ff,SAAS,EAAE,WAAW;aACb,OAAO,EAAE,oBAAoB;IA/FxC,MAAM,EAAE,KAAK,CAAC,MAAM,CAAA;IACpB,aAAa,UAAO;IACpB,QAAQ,EAAE,aAAa,CAAA;IACvB,aAAa,EAAE,aAAa,CAAA;IACnC,OAAO,CAAC,QAAQ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O,CAU3B;IAED,OAAO,CAAC,WAAW;IAsBZ,IAAI,CAAC,OAAO,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,GAAG,EAAE,SAAS,UAAQ;IA8OlE,OAAO,CAAC,WAAW,CAAM;IACzB,OAAO,CAAC,UAAU,CAA8B;IAChD,OAAO,CAAC,YAAY,CAAM;IAC1B,OAAO,CAAC,WAAW,CAAK;IACxB,OAAO,CAAC,eAAe,CAAI;IAE3B,OAAO,CAAC,cAAc,CAAyB;IAE/C,OAAO,CAAC,aAAa;IAyBd,gBAAgB,CAAC,MAAM,EAAE,MAAM;IAI/B,mBAAmB;IAInB,mBAAmB,CAAC,MAAM,EAAE,MAAM;IAIzC,OAAO,CAAC,cAAc,CAAc;IACpC,OAAO,CAAC,QAAQ,CAAQ;IACjB,MAAM,CAAC,SAAS,CAAC,EAAE,MAAM;IA4BhC,OAAO,CAAC,oBAAoB,CAAK;IACjC,OAAO,CAAC,WAAW,CAAiB;IAEpC,OAAO,CAAC,QAAQ;IAIhB,OAAO,CAAC,gBAAgB;IAkBxB,OAAO,CAAC,eAAe;IAUvB,OAAO,CAAC,gBAAgB;CAwBzB;AAcD,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,OAAO,QAIhD;AAuGD;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,KAAK,CAAC,QAAQ,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,GAAG,OAAO,CAIzF"}
|
package/dist/rendering.js
CHANGED
@@ -1,5 +1,4 @@
|
|
1
|
-
var e;import{__decorate as t,__metadata as i}from"tslib";import*as s from"three";import{Color as r,Material as n,Matrix4 as a,Mesh as o,PerspectiveCamera as h,ShaderChunk as l,ShaderMaterial as d}from"three";import{EffectComposer as c,FXAAShader as m,GammaCorrectionShader as p,RenderPass as u,ShaderPass as f,UnrealBloomPass as g,VRButton as v}from"three-stdlib";import{CSMShader as x,CSMUtil as w}from"./csm.js";import{NodeShaderMaterial as b}from"three-shader-graph";import{Reflector as T}from"three-stdlib";import{OutputPass as y}from"three/examples/jsm/Addons.js";import{CSM as M}from"three/examples/jsm/csm/CSM.js";import C from"three/examples/jsm/libs/stats.module.js";import{GTAOPass as P}from"three/examples/jsm/postprocessing/GTAOPass.js";import{Service as R}from"typedi";import{depthUniformName as S,farUniformName as D,nearUniformName as F,resolutionUniformName as W,supportsDepthTextureExtension as A}from"./shader-nodes/depth.js";import{elapsedTimeUniformName as H}from"./shader-nodes/time.js";import{DepthPass as L}from"./utils/three/depth-pass.js";import{GPUStatsPanel as k}from"./utils/three/gpu-stats-panel.js";import{OutlinePass as O}from"./utils/three/outline-pass.js";import{findFirstVisibleObject as j}from"./utils/three/traverse.js";(new s.Layers).set(9);const E=new s.MeshBasicMaterial({color:"black"}),B=new s.MeshDepthMaterial;B.depthPacking=s.RGBADepthPacking,B.blending=s.NoBlending,B.side=s.DoubleSide;const U=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);let V=e=class{setPaused(e){this.paused=e}resizeRender(){this.previousClientWith===this.container.clientWidth&&this.previousClientHeight===this.container.clientHeight||(this.previousClientWith=this.container.clientWidth,this.previousClientHeight=this.container.clientHeight,this.camera instanceof h&&(this.camera.aspect=this.container.clientWidth/this.container.clientHeight,this.camera.updateProjectionMatrix()),this.renderer.setPixelRatio(Math.min(this.maxPixelRatio,window.devicePixelRatio)*this.resolutionScale),this.renderer.setSize(this.container.clientWidth,this.container.clientHeight),this.composer.setSize(this.container.clientWidth*this.resolutionScale,this.container.clientHeight*this.resolutionScale),this.aoMaskDepthRenderTarget.dispose(),this.aoMaskDepthRenderTarget=e.createAOMaskDepthRenderTarget(this.renderer,this.container),this.aoPass.blendMaterial.uniforms.tDepth.value=this.aoMaskDepthRenderTarget.depthTexture)}constructor(t,i={}){this.container=t,this.options=i,this.windowVisible=!0,this.running=!0,this.paused=!1,this.fpsCap=null,this.resolutionScale=U?.5:1,this.maxPixelRatio=U?1:window.devicePixelRatio,this.onResize=()=>{this.resizeRender(),this.paused||this.render()},this.onVisiblityChane=()=>{this.windowVisible=!document.hidden},this.isDepthTextureExtensionSupported=!1,this.onLoopCallbacks=[],this.stats=new C,this._showStats=!0,this.insetHeight=200,this.insetWidth=this.insetHeight*(16/9),this.insetOffsetY=250,this.insetMargin=10,this.maxInsetCameras=4,this.overlayCameras=new Set,this.prevClearColor=new r,this.hadBloom=!1,this.bloomStoredMaterials={},this.bloomHidden=[],null!=i.maxPixelRatio&&(this.maxPixelRatio=i.maxPixelRatio),window.renderer=this.renderer=new s.WebGLRenderer({antialias:!0,powerPreference:"high-performance"}),this.scene=new s.Scene,this.renderer.setPixelRatio(Math.min(this.maxPixelRatio,window.devicePixelRatio)*this.resolutionScale),this.renderer.setSize(t.clientWidth,t.clientHeight),this.renderer.xr.enabled=this.options.enableXR??!1,!0===this.options.enableXR&&document.body.appendChild(v.createButton(this.renderer)),this.composer=new c(this.renderer);var n=t.clientWidth/t.clientHeight;const a=new s.PerspectiveCamera(45,n,.5,800);a.layers.enable(19),this.setCamera(a),this.renderer.shadowMap.enabled=!0,this.renderer.shadowMap.type=s.PCFSoftShadowMap,this.renderer.shadowMap.autoUpdate=i.shadows?.autoUpdate??!1,this.renderer.outputColorSpace=s.SRGBColorSpace,this.renderer.toneMapping=s.NoToneMapping,this.renderer.toneMappingExposure=1,this.renderer.gammaFactor=1.4,w.renderingView=this,w.patchThreeAdd(),this.isDepthTextureExtensionSupported=A(this.renderer),t.replaceChildren(this.renderer.domElement),this.setupEventListeners(),this.depthRenderTarget=e.createDepthRenderTarget(this.renderer,this.container),this.aoMaskDepthRenderTarget=e.createAOMaskDepthRenderTarget(this.renderer,this.container);const o=new u(this.scene,this.camera);this.composer.addPass(o);const h=new g(new s.Vector2(t.clientWidth,t.clientHeight),1.5,.4,.85);h.threshold=0,h.strength=.9,h.radius=1;const l=new P(this.scene,this.camera,t.clientWidth,t.clientWidth);l.blendMaterial.uniforms.tDepth={value:this.aoMaskDepthRenderTarget.depthTexture},l.blendMaterial.uniforms.tAODepth={value:l.depthTexture},l.blendMaterial.fragmentShader="\n uniform float intensity;\n uniform sampler2D tDiffuse;\n uniform sampler2D tDepth;\n uniform sampler2D tAODepth;\n varying vec2 vUv;\n\n void main() {\n vec4 texel = texture2D( tDiffuse, vUv );\n float d = textureLod(tDepth, vUv.xy, 0.0).x;\n float d2 = textureLod(tAODepth, vUv.xy, 0.0).x;\n\n float depth = 2.0 * 1.0 * 500.0 / (500.0 + 1.0 - (2.0 * d - 1.0) * (500.0 - 1.0));\n gl_FragColor = vec4(mix(vec3(1.), texel.rgb, d2 > d ? 0.0 : intensity), texel.a);\n }\n ",l.output=P.OUTPUT.Default,l.enabled=!1,this.aoPass=l,!1!==this.options.ao?.enabled&&this.composer.addPass(l),this.renderer.info.autoReset=!1;const d=new c(this.renderer);d.renderToScreen=!1,d.addPass(o),d.addPass(h),this.bloomComposer=d;const x=new f(new s.ShaderMaterial({uniforms:{baseTexture:{value:null},bloomTexture:{value:d.renderTarget2.texture}},vertexShader:"\n varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n }",fragmentShader:"\n uniform sampler2D baseTexture;\n uniform sampler2D bloomTexture;\n varying vec2 vUv;\n void main() {\n gl_FragColor = ( texture2D( baseTexture, vUv ) + vec4( 1.0 ) * texture2D( bloomTexture, vUv ) );\n }",defines:{}}),"baseTexture");if(x.needsSwap=!0,this.composer.addPass(x),this.outlinePass=new O(new s.Vector2(t.clientWidth,t.clientHeight),this.scene,this.camera),!0===i.enableOutlines){this.outlinePass.edgeThickness=0,this.outlinePass.edgeGlow=0,this.outlinePass.edgeThickness=1.5,this.outlinePass.edgeStrength=5,this.outlinePass.clear=!1,this.composer.addPass(this.outlinePass);const e=new f(m);e.uniforms.resolution.value.set(1/t.clientWidth,1/t.clientHeight),this.composer.addPass(e)}new f(p).clear=!1,this.fixStatsStyle();const b=new y;this.composer.addPass(b)}fixStatsStyle(){const e=this.stats.dom;e.style.position="absolute";const t=e.getElementsByTagName("canvas");for(let e=0;e<t.length;e++)t.item(e).style.display="inline-block"}setCamera(e){this.camera=e,this.composer.passes.forEach((t=>{t instanceof u?t.camera=e:t instanceof O?t.renderCamera=e:(t instanceof L||t instanceof P)&&(t.camera=e)})),null==this.csm?(this.csm=new M({maxFar:500,lightFar:250,lightMargin:20,cascades:4,shadowMapSize:2048,lightDirection:new s.Vector3(.5,-1,-.6).normalize(),lightIntensity:.5*Math.PI,camera:this.camera,parent:this.scene}),l.lights_fragment_begin=x.lights_fragment_begin):(this.csm.camera=this.camera,this.camera instanceof h&&(this.csm.maxFar=this.camera.far)),this.csm.updateFrustums()}setSelectedObjects(e){const t=new Map;for(const i of e)t.set(i.uuid,i);for(const i of e)i.traverse((e=>{e.uuid!==i.uuid&&t.has(e.uuid)&&t.delete(e.uuid)}));this.outlinePass.selectedObjects=Array.from(t.values())}static createDepthRenderTarget(e,t){var i=!!e.extensions.get("WEBGL_depth_texture");const r=new s.WebGLRenderTarget(t.clientWidth*e.getPixelRatio(),t.clientHeight*e.getPixelRatio());return r.texture.minFilter=s.NearestFilter,r.texture.magFilter=s.NearestFilter,r.texture.generateMipmaps=!1,r.stencilBuffer=!1,!0===i&&(r.depthTexture=new s.DepthTexture(128,128),r.depthTexture.type=s.UnsignedShortType,r.depthTexture.minFilter=s.NearestFilter,r.depthTexture.magFilter=s.NearestFilter),r}static createAOMaskDepthRenderTarget(e,t){const i=new s.WebGLRenderTarget(t.clientWidth*e.getPixelRatio(),t.clientHeight*e.getPixelRatio(),{type:s.HalfFloatType});return i.texture.minFilter=s.NearestFilter,i.texture.magFilter=s.NearestFilter,i.texture.generateMipmaps=!1,i.stencilBuffer=!1,i.depthTexture=new s.DepthTexture(128,128),i.depthTexture.type=s.UnsignedInt248Type,i.depthTexture.minFilter=s.NearestFilter,i.depthTexture.magFilter=s.NearestFilter,i}setupEventListeners(){window.addEventListener("resize",this.onResize),window.addEventListener("orientationchange",this.onResize),document.addEventListener("visibilitychange",this.onVisiblityChane)}stop(){this.running=!1,window.removeEventListener("resize",this.onResize),window.removeEventListener("orientationchange",this.onResize),document.removeEventListener("visibilitychange",this.onVisiblityChane),this.onLoopCallbacks=[],this.renderer.dispose(),this.depthRenderTarget.dispose(),this.aoMaskDepthRenderTarget.dispose(),this.csm.dispose(),this.container.replaceChildren()}onLoop(e){this.onLoopCallbacks.push(e)}removeOnLoop(e){const t=this.onLoopCallbacks.find(e);t>=0&&this.onLoopCallbacks.splice(t,1)}set showStats(e){this._showStats=e,this._showStats&&!this.container.contains(this.stats.dom)?this.container.appendChild(this.stats.dom):!this._showStats&&this.container.contains(this.stats.dom)&&this.container.removeChild(this.stats.dom)}get showStats(){return this._showStats}applyEnvMap(e){null!=this.scene.environment&&e instanceof b&&(null==e.uniforms.envMap&&(e.uniforms.envMap={value:this.scene.environment}),null==e.uniforms.envMapIntensity&&(e.uniforms.envMapIntensity={value:1}),e.uniforms.envMap.value=this.scene.environment,e.uniforms.envMapIntensity.value=this.scene.environmentIntensity,e.envMap=this.scene.environment)}loop(e,t=!1){const i=this.stats,r=i.addPanel(new C.Panel("Calls","#83f","#002")),h=i.addPanel(new C.Panel("Triangles","#c32","#002"));let l;navigator.userAgent.includes("Chrome")&&navigator.userAgent.includes("HologyEngine")&&(l=new k(this.renderer.getContext()),i.addPanel(l)),this.showStats=t;let d=10,c=1e3;const m=()=>{const e=this.renderer.info.render.calls;e>d&&(d=e,setTimeout((()=>d=10),5e3)),r.update(e,d);const t=this.renderer.info.render.triangles;t>c&&(c=t,setTimeout((()=>c=1e3),5e3)),h.update(t,c)};performance.now();s.Ray.prototype.intersectTriangle;const p=[],u=[];let f=0;const g=new a,v=new a,x=t=>{const r=this.renderer.getContext();if(this.paused&&this.running&&r.drawingBufferHeight>1)return void setTimeout((()=>x(t)),500);this.renderer.autoClear=!1,this.renderer.clear(),this.renderer.setViewport(0,0,this.container.clientWidth,this.container.clientHeight),this.camera,i.begin();let a=(t*=.001)-f;if(f=t,g.copy(this.camera.matrixWorld),a>1){let t=a;for(;t>.05;)e(z),t-=z;e(t)}else e(a);this.onLoopCallbacks.forEach((e=>e(a))),this.camera?.updateMatrixWorld(),v.copy(this.camera.matrixWorld),v.equals(g)||(this.renderer.shadowMap.needsUpdate=!0),this.resizeRender(),p.length=0,u.length=0;const h=_;if(this.camera.updateMatrixWorld(),N.multiplyMatrices(this.camera.projectionMatrix,this.camera.matrixWorldInverse),h.setFromProjectionMatrix(N),this.scene.traverseVisible((e=>{if(null!=this.scene.environment&&(e instanceof o||e instanceof s.Sprite)&&function(e,t){if(Array.isArray(e.material))for(const i of e.material)t(i);else null!=e.material&&t(e.material)}(e,(e=>this.applyEnvMap(e))),(e instanceof o||e instanceof s.Sprite)&&e.visible&&(e.material?.userData?.water||e.material?.uniforms&&null!=e.material?.uniforms[S])&&isObjectInFrustum(e,h)?(e.visible=!1,p.push(e),this.initDepthUniform(e.material),e.renderOrder=100):(e instanceof T||(e instanceof o||e instanceof s.Sprite)&&function(e){if(e.material instanceof n)return e.material.transparent||e.material.alphaTest>0;if(Array.isArray(e.material))for(const t of e.material)if(t.transparent||t.alphaTest>0)return!0}(e))&&(e.visible=!1,u.push(e)),e instanceof o&&e.material?.uniforms&&null!=e.material?.uniforms[H])e.material.uniforms[H].value=t;else if(e instanceof o&&Array.isArray(e.material))for(const i of e.material)i.uniforms&&null!=i.uniforms[H]&&(i.uniforms[H].value=t)})),p.length>0){if(this.scene.overrideMaterial=B,this.renderer.setRenderTarget(this.depthRenderTarget),!this.paused&&null!=this.camera)try{this.renderer.clear(),this.renderer.render(this.scene,this.camera)}catch(e){console.warn(e)}this.renderer.setRenderTarget(null),this.scene.overrideMaterial=null}if(p.forEach((e=>e.visible=!0)),u.forEach((e=>e.visible=!0)),this.aoPass.enabled){if(this.scene.overrideMaterial=B,this.renderer.setRenderTarget(this.aoMaskDepthRenderTarget),!this.paused&&null!=this.camera)try{this.renderer.clear(),this.renderer.render(this.scene,this.camera)}catch(e){console.warn(e)}this.renderer.setRenderTarget(null),this.scene.overrideMaterial=null}try{!this.paused&&this.running&&(this.showStats&&l?.startQuery(),this.render(a),this.showStats&&l?.endQuery(),this.showStats&&m(),this.renderer.info.reset(),this.renderOverlay())}catch(e){console.warn(e)}i.end(),this.csm?.update(),this.running&&!0!==this.options.enableXR&&(this.fpsCap?setTimeout((()=>{requestAnimationFrame(x)}),1e3/this.fpsCap):requestAnimationFrame(x))};!0===this.options.enableXR?this.renderer.setAnimationLoop(x):requestAnimationFrame(x)}renderOverlay(){const e=Array.from(this.overlayCameras.values()).slice(0,this.maxInsetCameras),t=this.container.clientWidth/2,i=e.length*this.insetWidth+(e.length-1)*this.insetMargin;for(let s=0;s<e.length;s++)this.renderer.clearDepth(),this.renderer.setViewport(t-i/2+this.insetWidth*s+this.insetMargin*s,this.insetOffsetY,this.insetWidth,this.insetHeight),this.renderer.render(this.scene,e[s])}addOverlayCamera(e){this.overlayCameras.add(e)}clearOverlayCameras(){this.overlayCameras.clear()}removeOverlayCamera(e){this.overlayCameras.delete(e)}render(e){const t=this.hasBloom();if(t||this.hadBloom){const e=this.scene.fog;this.scene.fog=null;const t=this.renderer.getClearColor(this.prevClearColor);this.renderer.setClearColor(0),this.scene.traverseVisible((e=>this.darkenNonBloomed(e))),this.bloomComposer.render(),this.scene.traverse((e=>this.restoreMaterial(e))),this.bloomHidden.forEach((e=>e.visible=!0)),this.bloomHidden.length=0,this.renderer.setClearColor(t),this.scene.fog=e}this.hadBloom=t,this.composer.render(e)}hasBloom(){return null!=j(this.scene,(e=>e instanceof o&&!0===e.material?.userData?.hasBloom))}darkenNonBloomed(e){(e instanceof o||e instanceof s.Sprite||e instanceof s.Line)&&e.visible&&(null==e.material.userData||!0!==e.material.userData.hasBloom)?(this.bloomStoredMaterials[e.uuid]=e.material,!0!==e.material.transparent?e.material=E:e.visible=!1):"TransformControlsPlane"!==e.type&&"TransformControlsGizmo"!==e.type||(e.visible=!1,this.bloomHidden.push(e))}restoreMaterial(e){this.bloomStoredMaterials[e.uuid]&&(e.material=this.bloomStoredMaterials[e.uuid],delete this.bloomStoredMaterials[e.uuid],e.visible=!0)}initDepthUniform(e){e instanceof d&&(e.uniforms[S].value=this.isDepthTextureExtensionSupported?this.depthRenderTarget.depthTexture:this.depthRenderTarget.texture,null!=e.uniforms[W]&&e.uniforms[W].value.set(this.container.clientWidth*this.renderer.getPixelRatio(),this.container.clientHeight*this.renderer.getPixelRatio()),this.camera instanceof h&&(e.uniforms[F].value=this.camera.near,e.uniforms[D].value=this.camera.far))}};V=e=t([R(),i("design:paramtypes",[HTMLElement,Object])],V);export{V as RenderingView};export function setRenderingPaused(e){null!=window.editor?.viewer?.renderingView&&(window.editor.viewer.renderingView.paused=e)}const z=.05;P.prototype.overrideVisibility=function(){const e=this.scene,t=this._visibilityCache;e.traverse((function(e){if(t.set(e,e.visible),(e.isPoints||e.isLine||e.isTransformControls)&&(e.visible=!1),null!=e.material){let t=!1;if(Array.isArray(e.material)){for(const i of e.material)if(null!=i.alphaTest&&i.alphaTest>0){t=!0;break}}else null!=e.material.alphaTest&&e.material.alphaTest>0&&(t=!0);t&&(e.visible=!1)}}))};const _=new s.Frustum,I=new s.Box3,N=new s.Matrix4;export function isObjectInFrustum(e,t){const i=I.setFromObject(e);return t.intersectsBox(i)}
|
2
|
-
/*
|
1
|
+
var e;import{__decorate as t,__metadata as i}from"tslib";import*as s from"three";import{Color as r,Material as n,Matrix4 as a,Mesh as o,PerspectiveCamera as h,ShaderChunk as l,ShaderMaterial as d}from"three";import{EffectComposer as c,FXAAShader as m,GammaCorrectionShader as p,RenderPass as u,ShaderPass as f,UnrealBloomPass as g,VRButton as v}from"three-stdlib";import{CSMShader as x,CSMUtil as w}from"./csm.js";import{NodeShaderMaterial as b}from"three-shader-graph";import{Reflector as T}from"three-stdlib";import{OutputPass as y}from"three/examples/jsm/Addons.js";import{CSM as M}from"three/examples/jsm/csm/CSM.js";import C from"three/examples/jsm/libs/stats.module.js";import{GTAOPass as P}from"three/examples/jsm/postprocessing/GTAOPass.js";import{Service as R}from"typedi";import{depthUniformName as S,farUniformName as D,nearUniformName as F,resolutionUniformName as W,supportsDepthTextureExtension as A}from"./shader-nodes/depth.js";import{elapsedTimeUniformName as H}from"./shader-nodes/time.js";import{DepthPass as L}from"./utils/three/depth-pass.js";import{GPUStatsPanel as k}from"./utils/three/gpu-stats-panel.js";import{OutlinePass as O}from"./utils/three/outline-pass.js";import{findFirstVisibleObject as j}from"./utils/three/traverse.js";(new s.Layers).set(9);const E=new s.MeshBasicMaterial({color:"black"}),B=new s.MeshDepthMaterial;B.depthPacking=s.RGBADepthPacking,B.blending=s.NoBlending,B.side=s.DoubleSide;const U=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);let V=e=class{setPaused(e){this.paused=e}resizeRender(){this.previousClientWith===this.container.clientWidth&&this.previousClientHeight===this.container.clientHeight||(this.previousClientWith=this.container.clientWidth,this.previousClientHeight=this.container.clientHeight,this.camera instanceof h&&(this.camera.aspect=this.container.clientWidth/this.container.clientHeight,this.camera.updateProjectionMatrix()),this.renderer.setPixelRatio(Math.min(this.maxPixelRatio,window.devicePixelRatio)*this.resolutionScale),this.renderer.setSize(this.container.clientWidth,this.container.clientHeight),this.composer.setSize(this.container.clientWidth*this.resolutionScale,this.container.clientHeight*this.resolutionScale),this.aoMaskDepthRenderTarget.dispose(),this.aoMaskDepthRenderTarget=e.createAOMaskDepthRenderTarget(this.renderer,this.container),this.aoPass.blendMaterial.uniforms.tDepth.value=this.aoMaskDepthRenderTarget.depthTexture)}constructor(t,i={}){this.container=t,this.options=i,this.windowVisible=!0,this.running=!0,this.paused=!1,this.fpsCap=null,this.resolutionScale=U?.5:1,this.maxPixelRatio=U?1:window.devicePixelRatio,this.onResize=()=>{this.resizeRender(),this.paused||this.render()},this.onVisiblityChane=()=>{this.windowVisible=!document.hidden},this.isDepthTextureExtensionSupported=!1,this.onLoopCallbacks=[],this.stats=new C,this._showStats=!0,this.insetHeight=200,this.insetWidth=this.insetHeight*(16/9),this.insetOffsetY=250,this.insetMargin=10,this.maxInsetCameras=4,this.overlayCameras=new Set,this.prevClearColor=new r,this.hadBloom=!1,this.bloomStoredMaterials={},this.bloomHidden=[],null!=i.maxPixelRatio&&(this.maxPixelRatio=i.maxPixelRatio),window.renderer=this.renderer=new s.WebGLRenderer({antialias:!0,powerPreference:"high-performance"}),this.scene=new s.Scene,this.renderer.setPixelRatio(Math.min(this.maxPixelRatio,window.devicePixelRatio)*this.resolutionScale),this.renderer.setSize(t.clientWidth,t.clientHeight),this.renderer.xr.enabled=this.options.enableXR??!1,!0===this.options.enableXR&&document.body.appendChild(v.createButton(this.renderer)),this.composer=new c(this.renderer);var n=t.clientWidth/t.clientHeight;const a=new s.PerspectiveCamera(45,n,.5,800);a.layers.enable(19),this.setCamera(a),this.renderer.shadowMap.enabled=!0,this.renderer.shadowMap.type=s.PCFSoftShadowMap,this.renderer.shadowMap.autoUpdate=i.shadows?.autoUpdate??!1,this.renderer.outputColorSpace=s.SRGBColorSpace,this.renderer.toneMapping=s.NoToneMapping,this.renderer.toneMappingExposure=1,this.renderer.gammaFactor=1.4,w.renderingView=this,w.patchThreeAdd(),this.isDepthTextureExtensionSupported=A(this.renderer),t.replaceChildren(this.renderer.domElement),this.setupEventListeners(),this.depthRenderTarget=e.createDepthRenderTarget(this.renderer,this.container),this.aoMaskDepthRenderTarget=e.createAOMaskDepthRenderTarget(this.renderer,this.container);const o=new u(this.scene,this.camera);this.composer.addPass(o);const h=new g(new s.Vector2(t.clientWidth,t.clientHeight),1.5,.4,.85);h.threshold=0,h.strength=.9,h.radius=1;const l=new P(this.scene,this.camera,t.clientWidth,t.clientWidth);l.blendMaterial.uniforms.tDepth={value:this.aoMaskDepthRenderTarget.depthTexture},l.blendMaterial.uniforms.tAODepth={value:l.depthTexture},l.blendMaterial.fragmentShader="\n uniform float intensity;\n uniform sampler2D tDiffuse;\n uniform sampler2D tDepth;\n uniform sampler2D tAODepth;\n varying vec2 vUv;\n\n void main() {\n vec4 texel = texture2D( tDiffuse, vUv );\n float d = textureLod(tDepth, vUv.xy, 0.0).x;\n float d2 = textureLod(tAODepth, vUv.xy, 0.0).x;\n\n float depth = 2.0 * 1.0 * 500.0 / (500.0 + 1.0 - (2.0 * d - 1.0) * (500.0 - 1.0));\n gl_FragColor = vec4(mix(vec3(1.), texel.rgb, d2 > d ? 0.0 : intensity), texel.a);\n }\n ",l.output=P.OUTPUT.Default,l.enabled=!1,this.aoPass=l,!1!==this.options.ao?.enabled&&this.composer.addPass(l),this.renderer.info.autoReset=!1;const d=new c(this.renderer);d.renderToScreen=!1,d.addPass(o),d.addPass(h),this.bloomComposer=d;const x=new f(new s.ShaderMaterial({uniforms:{baseTexture:{value:null},bloomTexture:{value:d.renderTarget2.texture}},vertexShader:"\n varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n }",fragmentShader:"\n uniform sampler2D baseTexture;\n uniform sampler2D bloomTexture;\n varying vec2 vUv;\n void main() {\n gl_FragColor = ( texture2D( baseTexture, vUv ) + vec4( 1.0 ) * texture2D( bloomTexture, vUv ) );\n }",defines:{}}),"baseTexture");if(x.needsSwap=!0,this.composer.addPass(x),this.outlinePass=new O(new s.Vector2(t.clientWidth,t.clientHeight),this.scene,this.camera),!0===i.enableOutlines){this.outlinePass.edgeThickness=0,this.outlinePass.edgeGlow=0,this.outlinePass.edgeThickness=1.5,this.outlinePass.edgeStrength=5,this.outlinePass.clear=!1,this.composer.addPass(this.outlinePass);const e=new f(m);e.uniforms.resolution.value.set(1/t.clientWidth,1/t.clientHeight),this.composer.addPass(e)}new f(p).clear=!1,this.fixStatsStyle();const b=new y;this.composer.addPass(b)}fixStatsStyle(){const e=this.stats.dom;e.style.position="absolute";const t=e.getElementsByTagName("canvas");for(let e=0;e<t.length;e++)t.item(e).style.display="inline-block"}setCamera(e){this.camera=e,this.composer.passes.forEach((t=>{t instanceof u?t.camera=e:t instanceof O?t.renderCamera=e:(t instanceof L||t instanceof P)&&(t.camera=e)})),null==this.csm?(this.csm=new M({maxFar:500,lightFar:250,lightMargin:20,cascades:4,shadowMapSize:2048,lightDirection:new s.Vector3(.5,-1,-.6).normalize(),lightIntensity:.5*Math.PI,camera:this.camera,parent:this.scene}),l.lights_fragment_begin=x.lights_fragment_begin):(this.csm.camera=this.camera,this.camera instanceof h&&(this.csm.maxFar=this.camera.far)),this.csm.updateFrustums()}setSelectedObjects(e){const t=new Map;for(const i of e)t.set(i.uuid,i);for(const i of e)i.traverse((e=>{e.uuid!==i.uuid&&t.has(e.uuid)&&t.delete(e.uuid)}));this.outlinePass.selectedObjects=Array.from(t.values())}static createDepthRenderTarget(e,t){var i=!!e.extensions.get("WEBGL_depth_texture");const r=new s.WebGLRenderTarget(t.clientWidth*e.getPixelRatio(),t.clientHeight*e.getPixelRatio());return r.texture.minFilter=s.NearestFilter,r.texture.magFilter=s.NearestFilter,r.texture.generateMipmaps=!1,r.stencilBuffer=!1,!0===i&&(r.depthTexture=new s.DepthTexture(128,128),r.depthTexture.type=s.UnsignedShortType,r.depthTexture.minFilter=s.NearestFilter,r.depthTexture.magFilter=s.NearestFilter),r}static createAOMaskDepthRenderTarget(e,t){const i=new s.WebGLRenderTarget(t.clientWidth*e.getPixelRatio(),t.clientHeight*e.getPixelRatio(),{type:s.HalfFloatType});return i.texture.minFilter=s.NearestFilter,i.texture.magFilter=s.NearestFilter,i.texture.generateMipmaps=!1,i.stencilBuffer=!1,i.depthTexture=new s.DepthTexture(128,128),i.depthTexture.type=s.UnsignedInt248Type,i.depthTexture.minFilter=s.NearestFilter,i.depthTexture.magFilter=s.NearestFilter,i}setupEventListeners(){window.addEventListener("resize",this.onResize),window.addEventListener("orientationchange",this.onResize),document.addEventListener("visibilitychange",this.onVisiblityChane)}stop(){this.running=!1,window.removeEventListener("resize",this.onResize),window.removeEventListener("orientationchange",this.onResize),document.removeEventListener("visibilitychange",this.onVisiblityChane),this.onLoopCallbacks=[],this.renderer.dispose(),this.depthRenderTarget.dispose(),this.aoMaskDepthRenderTarget.dispose(),this.csm.dispose(),this.container.replaceChildren()}onLoop(e){this.onLoopCallbacks.push(e)}removeOnLoop(e){const t=this.onLoopCallbacks.find(e);t>=0&&this.onLoopCallbacks.splice(t,1)}set showStats(e){this._showStats=e,this._showStats&&!this.container.contains(this.stats.dom)?this.container.appendChild(this.stats.dom):!this._showStats&&this.container.contains(this.stats.dom)&&this.container.removeChild(this.stats.dom)}get showStats(){return this._showStats}applyEnvMap(e){null!=this.scene.environment&&e instanceof b&&(null==e.uniforms.envMap&&(e.uniforms.envMap={value:this.scene.environment}),null==e.uniforms.envMapIntensity&&(e.uniforms.envMapIntensity={value:1}),e.uniforms.envMap.value=this.scene.environment,e.uniforms.envMapIntensity.value=this.scene.environmentIntensity,e.envMap=this.scene.environment)}loop(e,t=!1){const i=this.stats,r=i.addPanel(new C.Panel("Calls","#83f","#002")),h=i.addPanel(new C.Panel("Triangles","#c32","#002"));let l;navigator.userAgent.includes("Chrome")&&navigator.userAgent.includes("HologyEngine")&&(l=new k(this.renderer.getContext()),i.addPanel(l)),this.showStats=t;let d=10,c=1e3;const m=()=>{const e=this.renderer.info.render.calls;e>d&&(d=e,setTimeout((()=>d=10),5e3)),r.update(e,d);const t=this.renderer.info.render.triangles;t>c&&(c=t,setTimeout((()=>c=1e3),5e3)),h.update(t,c)};performance.now();s.Ray.prototype.intersectTriangle;const p=[],u=[];let f=0;const g=new a,v=new a,x=t=>{const r=this.renderer.getContext();if(this.paused&&this.running&&r.drawingBufferHeight>1)return void setTimeout((()=>x(t)),500);this.renderer.autoClear=!1,this.renderer.clear(),this.renderer.setViewport(0,0,this.container.clientWidth,this.container.clientHeight),this.camera,i.begin();let a=(t*=.001)-f;if(f=t,g.copy(this.camera.matrixWorld),a>1){let t=a;for(;t>.05;)e(z),t-=z;e(t)}else e(a);this.onLoopCallbacks.forEach((e=>e(a))),this.camera?.updateMatrixWorld(),v.copy(this.camera.matrixWorld),v.equals(g)||(this.renderer.shadowMap.needsUpdate=!0),this.resizeRender(),p.length=0,u.length=0;const h=_;if(this.camera.updateMatrixWorld(),N.multiplyMatrices(this.camera.projectionMatrix,this.camera.matrixWorldInverse),h.setFromProjectionMatrix(N),this.scene.traverseVisible((e=>{if(null!=this.scene.environment&&(e instanceof o||e instanceof s.Sprite)&&function(e,t){if(Array.isArray(e.material))for(const i of e.material)t(i);else null!=e.material&&t(e.material)}(e,(e=>this.applyEnvMap(e))),(e instanceof o||e instanceof s.Sprite)&&e.visible&&(e.material?.userData?.water||e.material?.uniforms&&null!=e.material?.uniforms[S])&&isObjectInFrustum(e,h)?(e.visible=!1,p.push(e),this.initDepthUniform(e.material),e.renderOrder=100):(e instanceof T||(e instanceof o||e instanceof s.Sprite)&&function(e){if(e.material instanceof n)return e.material.transparent||e.material.alphaTest>0;if(Array.isArray(e.material))for(const t of e.material)if(t.transparent||t.alphaTest>0)return!0}(e))&&(e.visible=!1,u.push(e)),e instanceof o&&e.material?.uniforms&&null!=e.material?.uniforms[H])e.material.uniforms[H].value=t;else if(e instanceof o&&Array.isArray(e.material))for(const i of e.material)i.uniforms&&null!=i.uniforms[H]&&(i.uniforms[H].value=t)})),p.length>0){if(this.scene.overrideMaterial=B,this.renderer.setRenderTarget(this.depthRenderTarget),!this.paused&&null!=this.camera)try{this.renderer.clear(),this.renderer.render(this.scene,this.camera)}catch(e){console.warn(e)}this.renderer.setRenderTarget(null),this.scene.overrideMaterial=null}if(p.forEach((e=>e.visible=!0)),u.forEach((e=>e.visible=!0)),this.aoPass.enabled){if(this.scene.overrideMaterial=B,this.renderer.setRenderTarget(this.aoMaskDepthRenderTarget),!this.paused&&null!=this.camera)try{this.renderer.clear(),this.renderer.render(this.scene,this.camera)}catch(e){console.warn(e)}this.renderer.setRenderTarget(null),this.scene.overrideMaterial=null}try{!this.paused&&this.running&&(this.showStats&&l?.startQuery(),this.render(a),this.showStats&&l?.endQuery(),this.showStats&&m(),this.renderer.info.reset(),this.renderOverlay())}catch(e){console.warn(e)}i.end(),this.csm?.update(),this.running&&!0!==this.options.enableXR&&(this.fpsCap?setTimeout((()=>{requestAnimationFrame(x)}),1e3/this.fpsCap):requestAnimationFrame(x))};!0===this.options.enableXR?this.renderer.setAnimationLoop(x):requestAnimationFrame(x)}renderOverlay(){const e=Array.from(this.overlayCameras.values()).slice(0,this.maxInsetCameras),t=this.container.clientWidth/2,i=e.length*this.insetWidth+(e.length-1)*this.insetMargin;for(let s=0;s<e.length;s++)this.renderer.clearDepth(),this.renderer.setViewport(t-i/2+this.insetWidth*s+this.insetMargin*s,this.insetOffsetY,this.insetWidth,this.insetHeight),this.renderer.render(this.scene,e[s])}addOverlayCamera(e){this.overlayCameras.add(e)}clearOverlayCameras(){this.overlayCameras.clear()}removeOverlayCamera(e){this.overlayCameras.delete(e)}render(e){const t=this.hasBloom();if(t||this.hadBloom){const e=this.scene.fog;this.scene.fog=null;const t=this.renderer.getClearColor(this.prevClearColor);this.renderer.setClearColor(0),this.scene.traverseVisible((e=>this.darkenNonBloomed(e))),this.bloomComposer.render(),this.scene.traverse((e=>this.restoreMaterial(e))),this.bloomHidden.forEach((e=>e.visible=!0)),this.bloomHidden.length=0,this.renderer.setClearColor(t),this.scene.fog=e}this.hadBloom=t,this.composer.render(e)}hasBloom(){return null!=j(this.scene,(e=>e instanceof o&&!0===e.material?.userData?.hasBloom))}darkenNonBloomed(e){(e instanceof o||e instanceof s.Sprite||e instanceof s.Line)&&e.visible&&(null==e.material.userData||!0!==e.material.userData.hasBloom)?(this.bloomStoredMaterials[e.uuid]=e.material,!0!==e.material.transparent?e.material=E:e.visible=!1):"TransformControlsPlane"!==e.type&&"TransformControlsGizmo"!==e.type||(e.visible=!1,this.bloomHidden.push(e))}restoreMaterial(e){this.bloomStoredMaterials[e.uuid]&&(e.material=this.bloomStoredMaterials[e.uuid],delete this.bloomStoredMaterials[e.uuid],e.visible=!0)}initDepthUniform(e){e instanceof d&&(e.uniforms[S].value=this.isDepthTextureExtensionSupported?this.depthRenderTarget.depthTexture:this.depthRenderTarget.texture,null!=e.uniforms[W]&&e.uniforms[W].value.set(this.container.clientWidth*this.renderer.getPixelRatio(),this.container.clientHeight*this.renderer.getPixelRatio()),this.camera instanceof h&&(e.uniforms[F].value=this.camera.near,e.uniforms[D].value=this.camera.far))}};V=e=t([R(),i("design:paramtypes",[HTMLElement,Object])],V);export{V as RenderingView};export function setRenderingPaused(e){null!=window.editor?.viewer?.renderingView&&(window.editor.viewer.renderingView.paused=e)}const z=.05;P.prototype.overrideVisibility=function(){const e=this.scene,t=this._visibilityCache;e.traverse((function(e){if(t.set(e,e.visible),(e.isPoints||e.isLine||e.isTransformControls)&&(e.visible=!1),null!=e.material){let t=!1;if(Array.isArray(e.material)){for(const i of e.material)if(null!=i.alphaTest&&i.alphaTest>0){t=!0;break}}else null!=e.material.alphaTest&&e.material.alphaTest>0&&(t=!0);t&&(e.visible=!1)}}))};const _=new s.Frustum,I=new s.Box3,N=new s.Matrix4;export function isObjectInFrustum(e,t){const i=I.setFromObject(e);return t.intersectsBox(i)}/*
|
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":"asset-resource-loader.d.ts","sourceRoot":"","sources":["../../src/scene/asset-resource-loader.ts"],"names":[],"mappings":"AAAA,OAAO,EAA6G,QAAQ,EAAE,OAAO,EAA+B,MAAM,OAAO,CAAC;AAIlL,OAAO,EAAE,KAAK,EAAY,MAAM,YAAY,CAAC;AAG7C,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAEhE,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,0BAA0B,EAAE,MAAM,mBAAmB,CAAC;AAM/D,qBAAa,mBAAmB;IAC9B,OAAO,CAAC,QAAQ,CAAQ;IACxB,OAAO,CA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AAa,iBAAkB,SAAQ,QAAQ;IAC7C,eAAe,CAAC,EAAE,cAAc,EAAE,CAAA;IAClC,OAAO,CAAC,EAAE,0BAA0B,CAAA;CACrC;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAInD;AAoDD,MAAM,MAAM,cAAc,GAAG;IAC3B;;;;OAIG;IACH,cAAc,EAAE,OAAO,CAAA;CACxB,CAAA"}
|
@@ -1,5 +1,4 @@
|
|
1
|
-
import{AudioLoader as e,BufferGeometry as t,Group as s,LoadingManager as a,Mesh as i,Object3D as r,TextureLoader as n}from"three";import{GLTFLoader as o,MTLLoader as h,OBJLoader as c}from"three-stdlib";import{FBXLoader as l}from"three-stdlib";import{cloneMesh as d}from"../utils/mesh.js";import{pathJoin as m}from"../utils/files.js";import{Subject as p,firstValueFrom as u}from"rxjs";import{importCollisionShapes as g,isCollisionMesh as f}from"./collision/collision-shape-import.js";import*as w from"three";import{iterateMaterials as y}from"../utils/materials.js";import{BufferGeometryUtils as x,EXRLoader as L,KTX2Loader as M,TGALoader as b,UltraHDRLoader as A}from"three/examples/jsm/Addons.js";const S=["glb","gltf","fbx","obj"];export class AssetResourceLoader{onError(e){console.error(e)}constructor(){this.cache=new Map,this.textureCache=new Map,this.loadingManager=new a,this.glbLoader=new o(this.loadingManager),this.fbxLoader=new l(this.loadingManager),this.objLoader=new c(this.loadingManager),this.textureLoader=new n(this.loadingManager),this.tgaLoader=new b(this.loadingManager),this.exrLoader=new L(this.loadingManager),this.hdrLoader=new A(this.loadingManager),this.ktx2Loader=new M(this.loadingManager),this._textureLoader=new w.ImageBitmapLoader(this.loadingManager),this.audioLoader=new e(this.loadingManager),this.initialisedKtx2=!1,this.makeReady=new p,this.ready=u(this.makeReady),this.asyncMeshResults=new Map,this.collisionShapeCache=new Map,this.optimizedMeshes=new Set}initKtx2(e){this.initialisedKtx2=!0,this.ktx2Loader.setTranscoderPath("/assets/basis/"),this.ktx2Loader.detectSupport(e)}setDataDir(e){this.basePath=m(e,"asset-resources"),this.makeReady.next(!0)}getUri(e){return m(this.basePath,e)+`?windowId=${getElectronArg("windowId")}`}async getTexture(e){return null==e||null==e.fileKey?null:(await this.ready,this.textureCache.has(e.id)||await this._getTextureLoader(e.fileKey).loadAsync(this.getUri(e.fileKey)).then((t=>(t.wrapS=j(e.texture?.wrapS),t.wrapT=j(e.texture?.wrapT),t.flipY=e.texture?.flipY??!0,this.textureCache.set(e.id,t),t))),this.textureCache.get(e.id))}_getTextureLoader(e){return e?.toLowerCase().endsWith(".tga")?this.tgaLoader:e?.toLowerCase().endsWith(".ktx2")?this.ktx2Loader:e?.toLowerCase().endsWith(".exr")?this.exrLoader:this.textureLoader}async getMesh(e,t){if(await this.ready,null==e)return console.error("No asset was provided"),{scene:new s,animations:[]};if(!S.includes(e.fileFormat?.toLowerCase()))return console.error("Unsupported mesh file format "+e.fileFormat,e),{scene:new s,animations:[]};const a=e.fileKey+(!0===t?.mergeGeomtries?"1":"0");if(!this.cache.has(a))try{this.asyncMeshResults.has(a)||this.asyncMeshResults.set(a,this.loadMesh(e).finally((()=>this.asyncMeshResults.delete(a)))),this.cache.set(a,await this.asyncMeshResults.get(a))}catch(e){return this.onError(e),{scene:new s,animations:[]}}const r=this.cache.get(a).scene,n=this.computeCollisionShapes(e,r);!0===t?.mergeGeomtries&&this.optimizeDrawGroups(r);const o=d(r),h=this.cache.get(a).animations;o.traverse((e=>{e instanceof i&&e.material instanceof Array&&(e.material=e.material.slice())}));const c=new AssetMeshInstance;c.add(o),c.collisionShapes=n,c.animations=h;const l=e.receiveShadow??!0,m=e.castShadow??!1;return o.traverse((e=>{e.castShadow=m,e.receiveShadow=l})),{scene:c,animations:h}}async getAudio(e){return await this.ready,this.audioLoader.loadAsync(this.getUri(e.fileKey))}computeCollisionShapes(e,t){const s=e.id+e.mesh?.collisions?.shapeType;return this.collisionShapeCache.has(s)||this.collisionShapeCache.set(s,g(t,e)),this.collisionShapeCache.get(s)}async loadMesh(e){return await this.ready,await this.loadByAsset(e).then((e=>(e.scene=function(e,t){let s=!1;if(t.traverseVisible((e=>{v.test(e.name)&&(s=!0)})),!s)return t;const a=new w.LOD,i=[t];for(;i.length>0;){const e=i.shift(),t=e.name.match(v);if(null!=t){const s=parseInt(t[1]);0===s?a.addLevel(e,0):console.warn(`Skipping LOD level ${s} for now as LOD is not fully supported`)}else i.push(...e.children)}return a}(0,e.scene),e)))}optimizeDrawGroups(e){if(this.optimizedMeshes.has(e.uuid))return;this.optimizedMeshes.add(e.uuid);let s=!0,a=0,r=0;if(e.traverse((e=>{if(e instanceof i&&e.geometry instanceof t&&!f(e)){a++;const t=Object.keys(e.geometry.attributes).length;t!==r&&0!==r&&(s=!1),r=t}else(e instanceof w.SkinnedMesh||e instanceof w.Bone)&&(s=!1)})),a>1&&s){const s=[],a=[],r=[];e.updateWorldMatrix(!0,!0),e.traverse((e=>{e instanceof i&&e.geometry instanceof t&&!f(e)&&!Array.isArray(e.material)&&(e.updateWorldMatrix(!0,!0),e.geometry.applyMatrix4(e.matrixWorld),s.push(e.geometry),a.push(e.material),r.push(e))}));for(const e of r)e.removeFromParent();const n=x.mergeGeometries(s,!0),o=[];let h=0;e:for(const e of a){for(const t of o)if(t.m.id===e.id){t.indices.push(h),h++;continue e}o.push({m:e,indices:[h]}),h++}let c=0;for(const e of o){for(const t of e.indices)n.groups[t].materialIndex=c;c++}e.add(new i(n,o.map((e=>e.m))))}e.traverse((e=>{if(e instanceof i&&e.geometry instanceof t){const t=e.geometry;Array.isArray(e.material)&&t.groups.length>1&&t.groups.length>e.material.length&&x.mergeGroups(t)}}))}async loadByAsset(e){const t=this.getUri(e.fileKey);switch(e.fileFormat){case"glb":case"gltf":return this.glbLoader.loadAsync(t).then((e=>({scene:e.scene,animations:e.animations})));case"fbx":return this.fbxLoader.loadAsync(t).then((e=>({scene:e,animations:e.animations})));case"obj":if(null!=e.materialLib){const t=new h;t.materialOptions={normalizeRGB:!1};const s=await t.loadAsync(this.getUri(e.materialLib));this.objLoader.setMaterials(s)}return this.objLoader.loadAsync(t).then((e=>(C(e),e))).then((e=>({scene:e,animations:e.animations})))}}}function C(e){if(e instanceof i)for(const t of y(e.material))t instanceof w.MeshPhongMaterial&&!t.color.isLinear&&(t.color.isLinear=!0);e.children?.forEach(C)}export class AssetMeshInstance extends r{}export function getElectronArg(e){const t=`--${e}=`,s=window.process?.argv.find((e=>e.startsWith(t)));return s?.substring(t.length)}function j(e){switch(e){case"clamp":return w.ClampToEdgeWrapping;case"repeat":return w.RepeatWrapping;case"mirror":return w.MirroredRepeatWrapping}return w.RepeatWrapping}const v=/_LOD(\d+)
|
2
|
-
/*
|
1
|
+
import{AudioLoader as e,BufferGeometry as t,Group as s,LoadingManager as a,Mesh as i,Object3D as r,TextureLoader as n}from"three";import{GLTFLoader as o,MTLLoader as h,OBJLoader as c}from"three-stdlib";import{FBXLoader as l}from"three-stdlib";import{cloneMesh as d}from"../utils/mesh.js";import{pathJoin as m}from"../utils/files.js";import{Subject as p,firstValueFrom as u}from"rxjs";import{importCollisionShapes as g,isCollisionMesh as f}from"./collision/collision-shape-import.js";import*as w from"three";import{iterateMaterials as y}from"../utils/materials.js";import{BufferGeometryUtils as x,EXRLoader as L,KTX2Loader as M,TGALoader as b,UltraHDRLoader as A}from"three/examples/jsm/Addons.js";const S=["glb","gltf","fbx","obj"];export class AssetResourceLoader{onError(e){console.error(e)}constructor(){this.cache=new Map,this.textureCache=new Map,this.loadingManager=new a,this.glbLoader=new o(this.loadingManager),this.fbxLoader=new l(this.loadingManager),this.objLoader=new c(this.loadingManager),this.textureLoader=new n(this.loadingManager),this.tgaLoader=new b(this.loadingManager),this.exrLoader=new L(this.loadingManager),this.hdrLoader=new A(this.loadingManager),this.ktx2Loader=new M(this.loadingManager),this._textureLoader=new w.ImageBitmapLoader(this.loadingManager),this.audioLoader=new e(this.loadingManager),this.initialisedKtx2=!1,this.makeReady=new p,this.ready=u(this.makeReady),this.asyncMeshResults=new Map,this.collisionShapeCache=new Map,this.optimizedMeshes=new Set}initKtx2(e){this.initialisedKtx2=!0,this.ktx2Loader.setTranscoderPath("/assets/basis/"),this.ktx2Loader.detectSupport(e)}setDataDir(e){this.basePath=m(e,"asset-resources"),this.makeReady.next(!0)}getUri(e){return m(this.basePath,e)+`?windowId=${getElectronArg("windowId")}`}async getTexture(e){return null==e||null==e.fileKey?null:(await this.ready,this.textureCache.has(e.id)||await this._getTextureLoader(e.fileKey).loadAsync(this.getUri(e.fileKey)).then((t=>(t.wrapS=j(e.texture?.wrapS),t.wrapT=j(e.texture?.wrapT),t.flipY=e.texture?.flipY??!0,this.textureCache.set(e.id,t),t))),this.textureCache.get(e.id))}_getTextureLoader(e){return e?.toLowerCase().endsWith(".tga")?this.tgaLoader:e?.toLowerCase().endsWith(".ktx2")?this.ktx2Loader:e?.toLowerCase().endsWith(".exr")?this.exrLoader:this.textureLoader}async getMesh(e,t){if(await this.ready,null==e)return console.error("No asset was provided"),{scene:new s,animations:[]};if(!S.includes(e.fileFormat?.toLowerCase()))return console.error("Unsupported mesh file format "+e.fileFormat,e),{scene:new s,animations:[]};const a=e.fileKey+(!0===t?.mergeGeomtries?"1":"0");if(!this.cache.has(a))try{this.asyncMeshResults.has(a)||this.asyncMeshResults.set(a,this.loadMesh(e).finally((()=>this.asyncMeshResults.delete(a)))),this.cache.set(a,await this.asyncMeshResults.get(a))}catch(e){return this.onError(e),{scene:new s,animations:[]}}const r=this.cache.get(a).scene,n=this.computeCollisionShapes(e,r);!0===t?.mergeGeomtries&&this.optimizeDrawGroups(r);const o=d(r),h=this.cache.get(a).animations;o.traverse((e=>{e instanceof i&&e.material instanceof Array&&(e.material=e.material.slice())}));const c=new AssetMeshInstance;c.add(o),c.collisionShapes=n,c.animations=h;const l=e.receiveShadow??!0,m=e.castShadow??!1;return o.traverse((e=>{e.castShadow=m,e.receiveShadow=l})),{scene:c,animations:h}}async getAudio(e){return await this.ready,this.audioLoader.loadAsync(this.getUri(e.fileKey))}computeCollisionShapes(e,t){const s=e.id+e.mesh?.collisions?.shapeType;return this.collisionShapeCache.has(s)||this.collisionShapeCache.set(s,g(t,e)),this.collisionShapeCache.get(s)}async loadMesh(e){return await this.ready,await this.loadByAsset(e).then((e=>(e.scene=function(e,t){let s=!1;if(t.traverseVisible((e=>{v.test(e.name)&&(s=!0)})),!s)return t;const a=new w.LOD,i=[t];for(;i.length>0;){const e=i.shift(),t=e.name.match(v);if(null!=t){const s=parseInt(t[1]);0===s?a.addLevel(e,0):console.warn(`Skipping LOD level ${s} for now as LOD is not fully supported`)}else i.push(...e.children)}return a}(0,e.scene),e)))}optimizeDrawGroups(e){if(this.optimizedMeshes.has(e.uuid))return;this.optimizedMeshes.add(e.uuid);let s=!0,a=0,r=0;if(e.traverse((e=>{if(e instanceof i&&e.geometry instanceof t&&!f(e)){a++;const t=Object.keys(e.geometry.attributes).length;t!==r&&0!==r&&(s=!1),r=t}else(e instanceof w.SkinnedMesh||e instanceof w.Bone)&&(s=!1)})),a>1&&s){const s=[],a=[],r=[];e.updateWorldMatrix(!0,!0),e.traverse((e=>{e instanceof i&&e.geometry instanceof t&&!f(e)&&!Array.isArray(e.material)&&(e.updateWorldMatrix(!0,!0),e.geometry.applyMatrix4(e.matrixWorld),s.push(e.geometry),a.push(e.material),r.push(e))}));for(const e of r)e.removeFromParent();const n=x.mergeGeometries(s,!0),o=[];let h=0;e:for(const e of a){for(const t of o)if(t.m.id===e.id){t.indices.push(h),h++;continue e}o.push({m:e,indices:[h]}),h++}let c=0;for(const e of o){for(const t of e.indices)n.groups[t].materialIndex=c;c++}e.add(new i(n,o.map((e=>e.m))))}e.traverse((e=>{if(e instanceof i&&e.geometry instanceof t){const t=e.geometry;Array.isArray(e.material)&&t.groups.length>1&&t.groups.length>e.material.length&&x.mergeGroups(t)}}))}async loadByAsset(e){const t=this.getUri(e.fileKey);switch(e.fileFormat){case"glb":case"gltf":return this.glbLoader.loadAsync(t).then((e=>({scene:e.scene,animations:e.animations})));case"fbx":return this.fbxLoader.loadAsync(t).then((e=>({scene:e,animations:e.animations})));case"obj":if(null!=e.materialLib){const t=new h;t.materialOptions={normalizeRGB:!1};const s=await t.loadAsync(this.getUri(e.materialLib));this.objLoader.setMaterials(s)}return this.objLoader.loadAsync(t).then((e=>(C(e),e))).then((e=>({scene:e,animations:e.animations})))}}}function C(e){if(e instanceof i)for(const t of y(e.material))t instanceof w.MeshPhongMaterial&&!t.color.isLinear&&(t.color.isLinear=!0);e.children?.forEach(C)}export class AssetMeshInstance extends r{}export function getElectronArg(e){const t=`--${e}=`,s=window.process?.argv.find((e=>e.startsWith(t)));return s?.substring(t.length)}function j(e){switch(e){case"clamp":return w.ClampToEdgeWrapping;case"repeat":return w.RepeatWrapping;case"mirror":return w.MirroredRepeatWrapping}return w.RepeatWrapping}const v=/_LOD(\d+)$/;/*
|
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":"assets-provider.d.ts","sourceRoot":"","sources":["../../src/scene/assets-provider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAC/B,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAE5C,MAAM,WAAW,cAAc;IAC7B,QAAQ,EAAE,OAAO,CAAC,KAAK,CAAC,CAAA;IACxB,QAAQ,EAAE,OAAO,CAAC,KAAK,CAAC,CAAA;IACxB,QAAQ,EAAE,OAAO,CAAC,KAAK,CAAC,CAAA;IACxB,QAAQ,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,KAAK,CAAC,CAAA;IAC1C,SAAS,IAAI,OAAO,CAAC,KAAK,EAAE,CAAC,CAAA;CAC9B"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"bootstrap.d.ts","sourceRoot":"","sources":["../../src/scene/bootstrap.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAGjE,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAGrE,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AACrE,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAClE,OAAO,EAAc,UAAU,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAGxE,MAAM,MAAM,iBAAiB,GAAG;IAAC,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU,CAAA;CAAC,CAAA;AAC5D,MAAM,MAAM,gBAAgB,GAAG;IAAC,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,CAAA;CAAC,CAAA;AAI1D,wBAAsB,SAAS,CAAC,IAAI,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,iBAAiB,EAAE,MAAM,EAAE,gBAAgB,EAAE,aAAa,EAAE,aAAa,EACzK,cAAc,EAAE,qBAAqB,EACrC,aAAa,EAAE,oBAAoB,EACnC,mBAAmB,EAAE,mBAAmB;;;;;;;GA4CzC"}
|
package/dist/scene/bootstrap.js
CHANGED
@@ -1,5 +1,4 @@
|
|
1
|
-
import{polyfill as e}from"../utils/polyfill.js";import{SceneDataService as t}from"./scene-data-service.js";import{SceneMaterializer as n}from"./materializer.js";import{basicSceneSetup as i}from"./sky.js";export async function loadScene(r,a,s,o,c,m,l,p,d){e();const{scene:f,renderer:w,camera:j}=r;i(f);const u=await l.getScene(a);if(null==u)throw Error(`Could not find scene with name ${a}`);const y=await l.getSceneData(u.id),S=new t;S.initiate(y);const g=Object.entries(o).map((([e,t])=>({name:e,type:t}))),h=Object.entries(c).map((([e,t])=>({name:e,type:t}))),v=new n(f,S,p,d,r,g,h,m);return v.inEditor=!1,await v.initWithInstancing(),{scene:f,view:r,materializer:v,assetResourceLoader:d,assetsService:p,actors:v.actorInstances}}
|
2
|
-
/*
|
1
|
+
import{polyfill as e}from"../utils/polyfill.js";import{SceneDataService as t}from"./scene-data-service.js";import{SceneMaterializer as n}from"./materializer.js";import{basicSceneSetup as i}from"./sky.js";export async function loadScene(r,a,s,o,c,m,l,p,d){e();const{scene:f,renderer:w,camera:j}=r;i(f);const u=await l.getScene(a);if(null==u)throw Error(`Could not find scene with name ${a}`);const y=await l.getSceneData(u.id),S=new t;S.initiate(y);const g=Object.entries(o).map((([e,t])=>({name:e,type:t}))),h=Object.entries(c).map((([e,t])=>({name:e,type:t}))),v=new n(f,S,p,d,r,g,h,m);return v.inEditor=!1,await v.initWithInstancing(),{scene:f,view:r,materializer:v,assetResourceLoader:d,assetsService:p,actors:v.actorInstances}}/*
|
3
2
|
* Copyright (©) 2023. All rights reserved.
|
4
3
|
* See the LICENSE.md file for details.
|
5
4
|
*/
|
@@ -3,3 +3,4 @@ import { CollisionShape } from './collision-shape.js';
|
|
3
3
|
import { Asset } from "../../scene/model.js";
|
4
4
|
export declare function importCollisionShapes(group: Object3D, asset: Asset): CollisionShape[];
|
5
5
|
export declare function isCollisionMesh(object: Object3D): boolean;
|
6
|
+
//# sourceMappingURL=collision-shape-import.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"collision-shape-import.d.ts","sourceRoot":"","sources":["../../../src/scene/collision/collision-shape-import.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,QAAQ,EAA+B,MAAM,OAAO,CAAC;AACjF,OAAO,EAAqB,cAAc,EAA+E,MAAM,sBAAsB,CAAC;AAEtJ,OAAO,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAI7C,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,GAAG,cAAc,EAAE,CA8CrF;AAED,wBAAgB,eAAe,CAAC,MAAM,EAAE,QAAQ,WAK/C"}
|
@@ -1,5 +1,4 @@
|
|
1
|
-
import{Box3 as e,Euler as t,Mesh as n,Quaternion as s,Vector3 as i}from"three";import{BoxCollisionShape as o,ConvexPolyhedronCollisionShape as r,SphereCollisionShape as a,TrimeshCollisionShape as m}from"./collision-shape.js";const h=new s;export function importCollisionShapes(s,c){let u=c.mesh?.collisions?.shapeType;if(null==u){let e=!1;s.traverse((t=>{(t instanceof n||t.isMesh)&&isCollisionMesh(t)&&(e=!0)})),u=e?"imported":"convex"}const p=[];return s.traverse((s=>{if(s instanceof n||s.isMesh){let n;"imported"===u?n=function(t){if(t.name.startsWith(l.convex))return new r(t);if(t.name.startsWith(l.box)){const n=t.clone();n.quaternion.set(0,0,0,1),n.updateMatrixWorld();const s=(new e).setFromObject(n);return isFinite(s.min.lengthSq())?new o(new i(s.max.x-s.min.x,s.max.y-s.min.y,s.max.z-s.min.z)):null}if(t.name.startsWith(l.sphere)){t.geometry.computeBoundingSphere();const e=t.geometry.boundingSphere.radius*Math.max(t.scale.x,t.scale.y,t.scale.z);return new a(e)}if(t.name.startsWith(l.trimesh))return new m(t.geometry)}(s):"convex"===u?n=new r(s):"mesh"===u&&(n=new m(s.geometry)),null!=n&&(n.offset=s.getWorldPosition(new i),n.rotation=(new t).setFromQuaternion(s.getWorldQuaternion(h)),p.push(n),isCollisionMesh(s)&&(s.visible=!1))}})),p}export function isCollisionMesh(e){return e.name.startsWith(l.convex)||e.name.startsWith(l.box)||e.name.startsWith(l.sphere)||e.name.startsWith(l.trimesh)}var l;!function(e){e.convex="UCX_",e.box="UBX_",e.sphere="USP_",e.trimesh="UTM_"}(l||(l={}));new e
|
2
|
-
/*
|
1
|
+
import{Box3 as e,Euler as t,Mesh as n,Quaternion as s,Vector3 as i}from"three";import{BoxCollisionShape as o,ConvexPolyhedronCollisionShape as r,SphereCollisionShape as a,TrimeshCollisionShape as m}from"./collision-shape.js";const h=new s;export function importCollisionShapes(s,c){let u=c.mesh?.collisions?.shapeType;if(null==u){let e=!1;s.traverse((t=>{(t instanceof n||t.isMesh)&&isCollisionMesh(t)&&(e=!0)})),u=e?"imported":"convex"}const p=[];return s.traverse((s=>{if(s instanceof n||s.isMesh){let n;"imported"===u?n=function(t){if(t.name.startsWith(l.convex))return new r(t);if(t.name.startsWith(l.box)){const n=t.clone();n.quaternion.set(0,0,0,1),n.updateMatrixWorld();const s=(new e).setFromObject(n);return isFinite(s.min.lengthSq())?new o(new i(s.max.x-s.min.x,s.max.y-s.min.y,s.max.z-s.min.z)):null}if(t.name.startsWith(l.sphere)){t.geometry.computeBoundingSphere();const e=t.geometry.boundingSphere.radius*Math.max(t.scale.x,t.scale.y,t.scale.z);return new a(e)}if(t.name.startsWith(l.trimesh))return new m(t.geometry)}(s):"convex"===u?n=new r(s):"mesh"===u&&(n=new m(s.geometry)),null!=n&&(n.offset=s.getWorldPosition(new i),n.rotation=(new t).setFromQuaternion(s.getWorldQuaternion(h)),p.push(n),isCollisionMesh(s)&&(s.visible=!1))}})),p}export function isCollisionMesh(e){return e.name.startsWith(l.convex)||e.name.startsWith(l.box)||e.name.startsWith(l.sphere)||e.name.startsWith(l.trimesh)}var l;!function(e){e.convex="UCX_",e.box="UBX_",e.sphere="USP_",e.trimesh="UTM_"}(l||(l={}));new e;/*
|
3
2
|
* Copyright (©) 2023. All rights reserved.
|
4
3
|
* See the LICENSE.md file for details.
|
5
4
|
*/
|
@@ -65,3 +65,4 @@ export declare class PhysicalShapeMesh extends Mesh {
|
|
65
65
|
isPhysicalShapeMesh: boolean;
|
66
66
|
constructor(geometry: BufferGeometry, material: Material, collisionShape: CollisionShape, physics?: SceneObjectPhysicsSettings);
|
67
67
|
}
|
68
|
+
//# sourceMappingURL=collision-shape.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"collision-shape.d.ts","sourceRoot":"","sources":["../../../src/scene/collision/collision-shape.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,0BAA0B,EAAE,MAAM,6BA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otation=new s}withOffset(s){return this.offset.copy(s),this}withRotation(s){return this.rotation.copy(s),this}static box(s){return new BoxCollisionShape(s)}static plane(s,e){return new PlaneCollisionShape(s,e)}static sphere(s){return new SphereCollisionShape(s)}static cylinder(s,e,o,t,i){return new CylinderCollisionShape(s,e,o,t,i)}static cone(s,e){return new ConeCollisionShape(s,e)}static convexPolyhedron(s){return new ConvexPolyhedronCollisionShape(s)}static trimesh(s){return new TrimeshCollisionShape(s)}static mesh(s){return new MeshCollisionShape(s)}static capsule(s,e){return new CapsuleCollisionShape(s,e)}}export class BoxCollisionShape extends CollisionShape{constructor(s){super(),this.dimensions=s}}export class PlaneCollisionShape extends CollisionShape{constructor(s,e){super(),this.width=s,this.height=e}}export class SphereCollisionShape extends CollisionShape{constructor(s){super(),this.radius=s}}export class CylinderCollisionShape extends CollisionShape{constructor(s,e,o,t,i){super(),this.radiusTop=s,this.radiusBottom=e,this.height=o,this.segments=t,this.orentation=i}}export class ConeCollisionShape extends CollisionShape{constructor(s,e){super(),this.radiusBottom=s,this.height=e}}export class ConvexPolyhedronCollisionShape extends CollisionShape{constructor(s){super(),this.mesh=s}}export class TrimeshCollisionShape extends CollisionShape{constructor(s){super(),this.geometry=s}}export class MeshCollisionShape extends CollisionShape{constructor(s){super(),this.geometry=s}}export class CapsuleCollisionShape extends CollisionShape{constructor(s,e){super(),this.length=s,this.radius=e}}export class PhysicalShapeMesh extends e{constructor(s,e,o,t){super(s,e),this.collisionShape=o,this.physics=t,this.isPhysicalShapeMesh=!0}}
|
2
|
-
/*
|
1
|
+
import{Euler as s,Mesh as e,Vector3 as o}from"three";export class CollisionShape{constructor(){this.offset=new o,this.rotation=new s}withOffset(s){return this.offset.copy(s),this}withRotation(s){return this.rotation.copy(s),this}static box(s){return new BoxCollisionShape(s)}static plane(s,e){return new PlaneCollisionShape(s,e)}static sphere(s){return new SphereCollisionShape(s)}static cylinder(s,e,o,t,i){return new CylinderCollisionShape(s,e,o,t,i)}static cone(s,e){return new ConeCollisionShape(s,e)}static convexPolyhedron(s){return new ConvexPolyhedronCollisionShape(s)}static trimesh(s){return new TrimeshCollisionShape(s)}static mesh(s){return new MeshCollisionShape(s)}static capsule(s,e){return new CapsuleCollisionShape(s,e)}}export class BoxCollisionShape extends CollisionShape{constructor(s){super(),this.dimensions=s}}export class PlaneCollisionShape extends CollisionShape{constructor(s,e){super(),this.width=s,this.height=e}}export class SphereCollisionShape extends CollisionShape{constructor(s){super(),this.radius=s}}export class CylinderCollisionShape extends CollisionShape{constructor(s,e,o,t,i){super(),this.radiusTop=s,this.radiusBottom=e,this.height=o,this.segments=t,this.orentation=i}}export class ConeCollisionShape extends CollisionShape{constructor(s,e){super(),this.radiusBottom=s,this.height=e}}export class ConvexPolyhedronCollisionShape extends CollisionShape{constructor(s){super(),this.mesh=s}}export class TrimeshCollisionShape extends CollisionShape{constructor(s){super(),this.geometry=s}}export class MeshCollisionShape extends CollisionShape{constructor(s){super(),this.geometry=s}}export class CapsuleCollisionShape extends CollisionShape{constructor(s,e){super(),this.length=s,this.radius=e}}export class PhysicalShapeMesh extends e{constructor(s,e,o,t){super(s,e),this.collisionShape=o,this.physics=t,this.isPhysicalShapeMesh=!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":"landscape-manager.d.ts","sourceRoot":"","sources":["../../../src/scene/landscape/landscape-manager.ts"],"names":[],"mappings":"AACA,OAAO,EAAQ,eAAe,EAA+D,IAAI,EAA8G,OAAO,EAAE,MAAM,OAAO,CAAC;AACtO,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAChE,OAAO,EAAmB,WAAW,EAAqB,MAAM,6BAA6B,CAAC;AAE9F,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAIpD,OAAO,EAAE,mBA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,EAAE,KAAK,GAAE,OAAe,EAAE,SAAS,GAAE,CAAC,IAAI,EAAE,IAAI,KAAK,OAAoB;IAib7G,IAAI;IAKX,OAAO,CAAC,mBAAmB,CAAgB;IAC3C,OAAO,CAAC,eAAe,CAAgB;IAEvC,OAAO,CAAC,MAAM;IAaP,KAAK;IAIZ,OAAO,CAAC,mBAAmB;CA0C5B;AAGD,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,IAAI,EAAE,QAAQ,UAAQ,GAAG,eAAe,CAM9E"}
|
@@ -1,5 +1,4 @@
|
|
1
|
-
import{Subject as e,debounceTime as t}from"rxjs";import{Box3 as s,BufferAttribute as n,InstancedMesh as o,MathUtils as i,Matrix4 as a,Mesh as r,MeshStandardMaterial as c,PerspectiveCamera as l,PlaneGeometry as h,ShaderMaterial as u,Triangle as f,Vector2 as p,Vector3 as m}from"three";import{materialFromAsset as d}from"../../scene/materializer.js";import{getMaterialAttribute as w}from"../../scene/materials/utils/material-painting";import{whenIdle as g}from"../../utils/async.js";import{indexBy as y}from"../../utils/collections.js";import{meanVectors3withWeight as M}from"../../utils/math.js";import{LandscapeMesh as x,defaultLandscapeMaterial as b}from"./landscape.js";import{smoothNormalsCrossMeshes as S}from"./utils.js";export const grassGeometryTriangleLimit=400;new m,new m;const v=new m,A=new m,z=new m;export class LandscapeManager{constructor(s,n,o,i,r,c,l){this.view=n,this.landscape=o,this.assetManagerService=i,this.assetService=r,this.shaders=c,this.applyMaterial=l,this.scatterMeshes=new Map,this.loadedScatterSquares=new Set,this.refreshRequests=new e,this.defaultLandscapeMaterial=b.clone(),this.scatterMeshPool=[],this.onLoopHandler=()=>this.update(),this.sectionCache=new Map,this._matrix=new a,this.scatterGeometryCache=new Map,this._lastUpdatePosition=new m,this._cameraPosition=new m,this.source=JSON.parse(JSON.stringify(s)),this.view.onLoop(this.onLoopHandler),this.defaultLandscapeMaterial.name=b.name,this.defaultLandscapeMaterial.color=b.color,this.refreshRequests.pipe(t(500)).subscribe((e=>this.refreshScatter(e.origin,e.force,e.predicate)))}updateSource(e){this.source=JSON.parse(JSON.stringify(e))}updateShaders(e){this.shaders=e}async loadGrass(){const e=await this.assetService.getAsset("6ij937n72g");await this.assetManagerService.getMesh(e);this.grassGeometry=new h(2,2,3,3);const t=this.grassGeometry.getAttribute("normal");for(let e=0;e<t.count;e++)t.setXYZ(e,0,1,0);t.needsUpdate=!0,this.grassMaterial=new c({color:3765785})}refreshGeometry(){const e=this.source.landscape.options,t=(new m,new m);this.view.camera.getWorldPosition(t);const s=[];z.fromArray(this.source.position);const n=this.view.camera instanceof l?Math.min(this.view.camera.far,1e3):1e3,o=1.1*n,i=e.sections.y*e.sectionSize/-2,a=e.sections.x*e.sectionSize/-2;for(let r=0;r<e.sections.x;r++)if(v.x=a+r*e.sectionSize,!(Math.abs(t.x-v.x)>o))for(let c=0;c<e.sections.y;c++){v.z=i+c*e.sectionSize,A.copy(z).add(v);const l=A.distanceTo(t),h=`${r},${c}`,u=this.landscape.sections.find((e=>e.x===r&&e.y===c));if(l<=n){if(null==u){this.sectionCache.has(h)||this.sectionCache.set(h,this.createLandscapeMesh(this.source,e,a,i,r,c));const t=this.sectionCache.get(h);this.applyMaterial(t),this.landscape.add(t),s.push(t)}}else l>o&&this.landscape.remove(u)}S(s)}applyHeightMap(e,t,s,n=1){const o=Math.pow(s+1,2),i=e.getAttribute("position");if(1===n)for(const e of t.points)i.setY(e.i,e.y);else{const e=y(t.points??[],(e=>e.i));for(let t=0;t<i.count;t++){const s=P(t,i.count,o);let n=0;n=s%1==0?e.get(s)?.y??0:Math.floor(e.get(s)?.y),i.setY(t,n)}}i.needsUpdate=!0,e.computeVertexNormals()}deleteOldScatterMeshes(){const e=new Set;for(const[t,s]of this.source.grass?.layers.entries()??[])for(const[n,o]of s.meshes.entries()){const s=`${t}-${n}`;e.add(s)}for(const t of this.scatterMeshes.keys())if(!e.has(t)){this.scatterMeshes.get(t).forEach((e=>{e.parent?.remove(e),e.dispose()})),this.scatterMeshes.delete(t)}}queueRefreshScatter(e,t=!1,s=(()=>!0)){this.refreshRequests.next({origin:e,force:t,predicate:s})}async refreshScatter(e,t=!1,s=(()=>!0)){t&&this.scatterGeometryCache.clear(),this.deleteOldScatterMeshes();for(const[n,a]of this.source.grass?.layers.entries()??[])for(const[c,l]of a.meshes.entries()){const a=`${n}-${c}`;this.scatterMeshes.has(a)||this.scatterMeshes.set(a,new Map);const h=this.scatterMeshes.get(a),u=await this.assetService.getAsset(l.assetId);if(null==u){console.error(`Can not find asset with id ${l.assetId}`);continue}let p;try{p=await this.assetManagerService.getMesh(u)}catch(e){console.error(`Failed to load mesh in landscape manager for asset with name ${u.name}`,e);continue}const w=[];if(p.scene.traverse((e=>{e instanceof r&&w.push(e)})),1!==w.length){console.log(p),console.warn("Dynamic grass only works for meshes with a single geometry.");continue}if(!(w[0]instanceof r)){console.warn("Only meshes can be used for dynamic grass. Found:",p.scene);continue}const x=w[0];let b=x.geometry;this.scatterGeometryCache.has(x.geometry.uuid)?b=this.scatterGeometryCache.get(x.geometry.uuid):(b=x.geometry.clone(),!0===l.normalsUp&&F(b),null==b.userData.updatedMatrix&&(p.scene.updateMatrixWorld(),b.applyMatrix4(x.matrixWorld),b.userData.updatedMatrix=!0));const S=b.getIndex()??b.getAttribute("position"),v=null!=S?S.count/3:0;if(v>400){console.warn(`The triangle count of ${u.name} is too big ${v}. Keep it below 400`);continue}const A=null!=u.materialAssignments&&u.materialAssignments.length>0?u.materialAssignments[0].materialId:null,z=null!=A&&"null"!==A?await d(await this.assetService.getAsset(A),null,this.assetService,this.assetManagerService,this.shaders,!1):null;let P=null!=z?z:x.material;const L=i.degToRad(l.maxSlope??90),_=Math.cos(L),T=this.landscape.sections,q=T.filter(j(e,l.viewDistance)),I=q.filter((e=>!h.has(e.uuid)||t)).filter((e=>s(e)));T.filter($(e,2*l.viewDistance)).forEach((e=>{const t=h.get(e.uuid);null!=t&&(t.visible=!1)}));for(const e of q){const t=h.get(e.uuid);null!=t&&(t.visible=!0)}performance.now();const R=this.source.landscape.options,k=R.sectionSize,D=l.density??1??1,H=R.density,X=k/H,Y=D,E=X/Math.sqrt(Y),J=Math.pow(H,2),Z=E/X,K=Math.floor(J*Y),V=[0,0,0];for(const e of I)await g((async()=>{e.updateWorldMatrix(!0,!1);const s=this._matrix,i=new m,a=e.geometry.getAttribute("position"),r=e.geometry.getAttribute("normal"),c=(this.source.vertexMaterials??[]).filter((t=>t.m===e.name)),p=y(c,(e=>e.i));let d=h.get(e.uuid);if(null==d||d.count==K&&!t||(d.parent?.remove(d),this.scatterMeshPool.push(d),h.delete(e.uuid),d=null),null==d){const e=this.scatterMeshPool.findIndex((e=>e.count>=K));e>-1?(d=this.scatterMeshPool[e],d.geometry=b,d.material=P,this.scatterMeshPool.splice(e,1)):d=new o(b,P,K),d.raycast=()=>{},d.receiveShadow=!0}d.visible=!0;const w=new f(new m,new m,new m);let[g,x,S,v]=[new m,new m,new m,new m],[A,z,L]=[[],[],[]],[$,j,T]=[new m,new m,new m,new m];const q=new m,I=new m,R=new m,k=new m,D=new f(new m,new m,new m),F=new f(new m,new m,new m),X=new f(new m,new m,new m),E=new f(new m,new m,new m);let Q=0;e:for(let t=0;t<J;t++){const o=Math.floor(t/H);g.fromBufferAttribute(a,t+o),k.copy(g).applyMatrix4(e.matrixWorld),D.a.copy(g),D.b.fromBufferAttribute(a,t+1+o),D.c.fromBufferAttribute(a,t+H+1+o),F.a.copy(D.b),F.b.copy(D.c),F.c.fromBufferAttribute(a,t+H+2+o),X.a.fromBufferAttribute(r,t+o),X.b.fromBufferAttribute(r,t+1+o),X.c.fromBufferAttribute(r,t+H+1+o),E.a.copy(X.b),E.b.copy(X.c),E.c.fromBufferAttribute(r,t+H+2+o);const c=[];c[0]=p.get(t+o)?.w,c[1]=p.get(t+1+o)?.w,c[2]=p.get(t+H+1+o)?.w,c[3]=p.get(t+H+2+o)?.w;let h=0;for(let e=0;e<=1+Z;e+=Z)for(let t=0;t<=1+Z;t+=Z){if(Q>K)break e;if(h++,h>Y)continue e;1-e>t?(x=D.a,S=D.b,v=D.c,$=X.a,j=X.b,T=X.c,A=c[0],z=c[1],L=c[2]):(x=F.a,S=F.b,v=F.c,$=E.a,j=E.b,T=E.c,A=c[1],z=c[2],L=c[3]),w.a.copy(x),w.b.copy(S),w.c.copy(v),B(w),q.set(g.x,0,g.z),U(w,q),w.getBarycoord(q,i).toArray(V),C[0]=A,C[1]=z,C[2]=L;if(G(C,V,.2)!==n-1)continue;if(M([x,S,v],V,I),M([$,j,T],V,R),null!=l.maxSlope&&l.maxSlope<90&&R.y<_)continue;const o=I;o.y+=O(l.offsetMin,l.offsetMax);const a=O(l.scaleMin,l.scaleMax)*(u.mesh.rescale??1);s.makeScale(a,a,a);const r=s.elements;r[12]=o.x,r[13]=o.y,r[14]=o.z,!1!==l.randomRotation&&N(s,a),l.alignToNormal&&W(s,o,d.matrixWorld,R);const f=d.instanceMatrix.array,p=16*Q;f[p]=r[0],f[p+1]=r[1],f[p+2]=r[2],f[p+3]=r[3],f[p+4]=r[4],f[p+5]=r[5],f[p+6]=r[6],f[p+7]=r[7],f[p+8]=r[8],f[p+9]=r[9],f[p+10]=r[10],f[p+11]=r[11],f[p+12]=r[12],f[p+13]=r[13],f[p+14]=r[14],f[p+15]=r[15],Q++}}d.count=Q,d.instanceMatrix.needsUpdate=!0,d.position.copy(e.position),d.updateMatrix(),h.has(e.uuid)||this.landscape?.add(d),h.set(e.uuid,d),d.userData.meshConfig=l}));performance.now()}}stop(){this.view.removeOnLoop(this.onLoopHandler)}update(){this.view.camera&&(this.view.camera.getWorldPosition(this._cameraPosition),this._cameraPosition.distanceTo(this._lastUpdatePosition)>10&&(this._lastUpdatePosition.copy(this._cameraPosition),this.refreshGeometry(),this.refreshScatter(this._cameraPosition)))}clear(){this.scatterMeshes.forEach((e=>e.forEach((e=>e.parent?.remove(e)))))}createLandscapeMesh(e,t,s,n,o,i){const a=new h(t.sectionSize,t.sectionSize,t.density,t.density);a.rotateX(Math.PI/-2);const r=this.defaultLandscapeMaterial,c=new x(a,r);c.position.x=s+o*t.sectionSize,c.position.z=n+i*t.sectionSize,c.receiveShadow=!0,c.castShadow=!1,c.userData.landscape={x:o,y:i},c.x=o,c.y=i,c.name=`${o},${i}`,w(c,0,!0),w(c,4,!0);const l=e.landscape.heightMaps.find((e=>e.x===o&&e.y===i));if(null!=l&&this.applyHeightMap(a,l,t.density,1),a.computeBoundsTree(),null!=e.landscape.holes&&e.landscape.holes.length>0){const t=getHoleAttribute(c,!0);for(const s of e.landscape.holes)s.m===c.name&&t.setX(s.i,s.w[0])}return c}}export function getHoleAttribute(e,t=!1){if(!e.geometry.hasAttribute("hole")||t){const t=new Float32Array(e.geometry.getAttribute("position").array.length);e.geometry.setAttribute("hole",new n(t,1))}return e.geometry.getAttribute("hole")}function P(e,t,s){const n=Math.sqrt(t),o=Math.floor(e/n)/(n-1),i=e%n/(n-1),a=Math.sqrt(s);return(s-1)*o-(a-1)*o+(a-1)*i}new Map,new p(0,0),new p(1,0),new p(0,1),new p(1,0),new p(0,1),new p(1,1),new m;const L=new s;function $(e,t){return function(s){return L.setFromObject(s).distanceToPoint(e)>t}}function j(e,t){return function(s){return L.setFromObject(s).distanceToPoint(e)<t}}function B(e){e.a.y=0,e.b.y=0,e.c.y=0}const C=[];function G(e,t,s=.5){const n=C;let o=-1,i=-1;for(let e=0;e<n.length;e++)if(null!=n[e])for(let a=0;a<n[e].length;a++){const r=n[e][a]*t[e];r>s&&r>i&&(i=r,o=a)}return o}function O(e,t){let s=t-e,n=q();return n*=s,n+=e,n}const _=[];let T=1e3;for(;T--;)_.push(Math.random());function q(){return++T>=_.length?_[T=0]:_[T]}const I=[];let R=20;for(;R--;)I.push((new a).makeRotationY(q()*Math.PI/2));function U(e,t){let s=q(),n=q();s+n>1&&(s=1-s,n=1-n);const o=e.a,i=e.b,a=e.c;t.x=o.x+s*(i.x-o.x)+n*(a.x-o.x),t.z=o.z+s*(i.z-o.z)+n*(a.z-o.z)}new m;new m;const k=new m,D=new m(0,1,0),H=(new a).makeRotationX(Math.PI/-2);function W(e,t,s,n){e.lookAt(k,n,D).multiply(H)}new a;function N(e,t=1){const s=(++R>=I.length?I[R=0]:I[R]).elements,n=e.elements;n[0]=s[0]*t,n[4]=s[4]*t,n[8]=s[8]*t,n[1]=s[1]*t,n[5]=s[5]*t,n[9]=s[9]*t,n[2]=s[2]*t,n[6]=s[6]*t,n[10]=s[10]*t}function F(e){const t=e.getAttribute("normal");for(let e=0;e<t.count;e++)t.setXYZ(e,0,1,0);t.normalized=!0,t.needsUpdate=!0}
|
2
|
-
/*
|
1
|
+
import{Subject as e,debounceTime as t}from"rxjs";import{Box3 as s,BufferAttribute as n,InstancedMesh as o,MathUtils as i,Matrix4 as a,Mesh as r,MeshStandardMaterial as c,PerspectiveCamera as l,PlaneGeometry as h,ShaderMaterial as u,Triangle as f,Vector2 as p,Vector3 as m}from"three";import{materialFromAsset as d}from"../../scene/materializer.js";import{getMaterialAttribute as w}from"../../scene/materials/utils/material-painting";import{whenIdle as g}from"../../utils/async.js";import{indexBy as y}from"../../utils/collections.js";import{meanVectors3withWeight as M}from"../../utils/math.js";import{LandscapeMesh as x,defaultLandscapeMaterial as b}from"./landscape.js";import{smoothNormalsCrossMeshes as S}from"./utils.js";export const grassGeometryTriangleLimit=400;new m,new m;const v=new m,A=new m,z=new m;export class LandscapeManager{constructor(s,n,o,i,r,c,l){this.view=n,this.landscape=o,this.assetManagerService=i,this.assetService=r,this.shaders=c,this.applyMaterial=l,this.scatterMeshes=new Map,this.loadedScatterSquares=new Set,this.refreshRequests=new e,this.defaultLandscapeMaterial=b.clone(),this.scatterMeshPool=[],this.onLoopHandler=()=>this.update(),this.sectionCache=new Map,this._matrix=new a,this.scatterGeometryCache=new Map,this._lastUpdatePosition=new m,this._cameraPosition=new m,this.source=JSON.parse(JSON.stringify(s)),this.view.onLoop(this.onLoopHandler),this.defaultLandscapeMaterial.name=b.name,this.defaultLandscapeMaterial.color=b.color,this.refreshRequests.pipe(t(500)).subscribe((e=>this.refreshScatter(e.origin,e.force,e.predicate)))}updateSource(e){this.source=JSON.parse(JSON.stringify(e))}updateShaders(e){this.shaders=e}async loadGrass(){const e=await this.assetService.getAsset("6ij937n72g");await this.assetManagerService.getMesh(e);this.grassGeometry=new h(2,2,3,3);const t=this.grassGeometry.getAttribute("normal");for(let e=0;e<t.count;e++)t.setXYZ(e,0,1,0);t.needsUpdate=!0,this.grassMaterial=new c({color:3765785})}refreshGeometry(){const e=this.source.landscape.options,t=(new m,new m);this.view.camera.getWorldPosition(t);const s=[];z.fromArray(this.source.position);const n=this.view.camera instanceof l?Math.min(this.view.camera.far,1e3):1e3,o=1.1*n,i=e.sections.y*e.sectionSize/-2,a=e.sections.x*e.sectionSize/-2;for(let r=0;r<e.sections.x;r++)if(v.x=a+r*e.sectionSize,!(Math.abs(t.x-v.x)>o))for(let c=0;c<e.sections.y;c++){v.z=i+c*e.sectionSize,A.copy(z).add(v);const l=A.distanceTo(t),h=`${r},${c}`,u=this.landscape.sections.find((e=>e.x===r&&e.y===c));if(l<=n){if(null==u){this.sectionCache.has(h)||this.sectionCache.set(h,this.createLandscapeMesh(this.source,e,a,i,r,c));const t=this.sectionCache.get(h);this.applyMaterial(t),this.landscape.add(t),s.push(t)}}else l>o&&this.landscape.remove(u)}S(s)}applyHeightMap(e,t,s,n=1){const o=Math.pow(s+1,2),i=e.getAttribute("position");if(1===n)for(const e of t.points)i.setY(e.i,e.y);else{const e=y(t.points??[],(e=>e.i));for(let t=0;t<i.count;t++){const s=P(t,i.count,o);let n=0;n=s%1==0?e.get(s)?.y??0:Math.floor(e.get(s)?.y),i.setY(t,n)}}i.needsUpdate=!0,e.computeVertexNormals()}deleteOldScatterMeshes(){const e=new Set;for(const[t,s]of this.source.grass?.layers.entries()??[])for(const[n,o]of s.meshes.entries()){const s=`${t}-${n}`;e.add(s)}for(const t of this.scatterMeshes.keys())if(!e.has(t)){this.scatterMeshes.get(t).forEach((e=>{e.parent?.remove(e),e.dispose()})),this.scatterMeshes.delete(t)}}queueRefreshScatter(e,t=!1,s=()=>!0){this.refreshRequests.next({origin:e,force:t,predicate:s})}async refreshScatter(e,t=!1,s=()=>!0){t&&this.scatterGeometryCache.clear(),this.deleteOldScatterMeshes();for(const[n,a]of this.source.grass?.layers.entries()??[])for(const[c,l]of a.meshes.entries()){const a=`${n}-${c}`;this.scatterMeshes.has(a)||this.scatterMeshes.set(a,new Map);const h=this.scatterMeshes.get(a),u=await this.assetService.getAsset(l.assetId);if(null==u){console.error(`Can not find asset with id ${l.assetId}`);continue}let p;try{p=await this.assetManagerService.getMesh(u)}catch(e){console.error(`Failed to load mesh in landscape manager for asset with name ${u.name}`,e);continue}const w=[];if(p.scene.traverse((e=>{e instanceof r&&w.push(e)})),1!==w.length){console.log(p),console.warn("Dynamic grass only works for meshes with a single geometry.");continue}if(!(w[0]instanceof r)){console.warn("Only meshes can be used for dynamic grass. Found:",p.scene);continue}const x=w[0];let b=x.geometry;this.scatterGeometryCache.has(x.geometry.uuid)?b=this.scatterGeometryCache.get(x.geometry.uuid):(b=x.geometry.clone(),!0===l.normalsUp&&F(b),null==b.userData.updatedMatrix&&(p.scene.updateMatrixWorld(),b.applyMatrix4(x.matrixWorld),b.userData.updatedMatrix=!0));const S=b.getIndex()??b.getAttribute("position"),v=null!=S?S.count/3:0;if(v>400){console.warn(`The triangle count of ${u.name} is too big ${v}. Keep it below 400`);continue}const A=null!=u.materialAssignments&&u.materialAssignments.length>0?u.materialAssignments[0].materialId:null,z=null!=A&&"null"!==A?await d(await this.assetService.getAsset(A),null,this.assetService,this.assetManagerService,this.shaders,!1):null;let P=null!=z?z:x.material;const L=i.degToRad(l.maxSlope??90),_=Math.cos(L),T=this.landscape.sections,q=T.filter(j(e,l.viewDistance)),I=q.filter((e=>!h.has(e.uuid)||t)).filter((e=>s(e)));T.filter($(e,2*l.viewDistance)).forEach((e=>{const t=h.get(e.uuid);null!=t&&(t.visible=!1)}));for(const e of q){const t=h.get(e.uuid);null!=t&&(t.visible=!0)}performance.now();const R=this.source.landscape.options,k=R.sectionSize,D=l.density??1??1,H=R.density,X=k/H,Y=D,E=X/Math.sqrt(Y),J=Math.pow(H,2),Z=E/X,K=Math.floor(J*Y),V=[0,0,0];for(const e of I)await g((async()=>{e.updateWorldMatrix(!0,!1);const s=this._matrix,i=new m,a=e.geometry.getAttribute("position"),r=e.geometry.getAttribute("normal"),c=(this.source.vertexMaterials??[]).filter((t=>t.m===e.name)),p=y(c,(e=>e.i));let d=h.get(e.uuid);if(null==d||d.count==K&&!t||(d.parent?.remove(d),this.scatterMeshPool.push(d),h.delete(e.uuid),d=null),null==d){const e=this.scatterMeshPool.findIndex((e=>e.count>=K));e>-1?(d=this.scatterMeshPool[e],d.geometry=b,d.material=P,this.scatterMeshPool.splice(e,1)):d=new o(b,P,K),d.raycast=()=>{},d.receiveShadow=!0}d.visible=!0;const w=new f(new m,new m,new m);let[g,x,S,v]=[new m,new m,new m,new m],[A,z,L]=[[],[],[]],[$,j,T]=[new m,new m,new m,new m];const q=new m,I=new m,R=new m,k=new m,D=new f(new m,new m,new m),F=new f(new m,new m,new m),X=new f(new m,new m,new m),E=new f(new m,new m,new m);let Q=0;e:for(let t=0;t<J;t++){const o=Math.floor(t/H);g.fromBufferAttribute(a,t+o),k.copy(g).applyMatrix4(e.matrixWorld),D.a.copy(g),D.b.fromBufferAttribute(a,t+1+o),D.c.fromBufferAttribute(a,t+H+1+o),F.a.copy(D.b),F.b.copy(D.c),F.c.fromBufferAttribute(a,t+H+2+o),X.a.fromBufferAttribute(r,t+o),X.b.fromBufferAttribute(r,t+1+o),X.c.fromBufferAttribute(r,t+H+1+o),E.a.copy(X.b),E.b.copy(X.c),E.c.fromBufferAttribute(r,t+H+2+o);const c=[];c[0]=p.get(t+o)?.w,c[1]=p.get(t+1+o)?.w,c[2]=p.get(t+H+1+o)?.w,c[3]=p.get(t+H+2+o)?.w;let h=0;for(let e=0;e<=1+Z;e+=Z)for(let t=0;t<=1+Z;t+=Z){if(Q>K)break e;if(h++,h>Y)continue e;1-e>t?(x=D.a,S=D.b,v=D.c,$=X.a,j=X.b,T=X.c,A=c[0],z=c[1],L=c[2]):(x=F.a,S=F.b,v=F.c,$=E.a,j=E.b,T=E.c,A=c[1],z=c[2],L=c[3]),w.a.copy(x),w.b.copy(S),w.c.copy(v),B(w),q.set(g.x,0,g.z),U(w,q),w.getBarycoord(q,i).toArray(V),C[0]=A,C[1]=z,C[2]=L;if(G(C,V,.2)!==n-1)continue;if(M([x,S,v],V,I),M([$,j,T],V,R),null!=l.maxSlope&&l.maxSlope<90&&R.y<_)continue;const o=I;o.y+=O(l.offsetMin,l.offsetMax);const a=O(l.scaleMin,l.scaleMax)*(u.mesh.rescale??1);s.makeScale(a,a,a);const r=s.elements;r[12]=o.x,r[13]=o.y,r[14]=o.z,!1!==l.randomRotation&&N(s,a),l.alignToNormal&&W(s,o,d.matrixWorld,R);const f=d.instanceMatrix.array,p=16*Q;f[p]=r[0],f[p+1]=r[1],f[p+2]=r[2],f[p+3]=r[3],f[p+4]=r[4],f[p+5]=r[5],f[p+6]=r[6],f[p+7]=r[7],f[p+8]=r[8],f[p+9]=r[9],f[p+10]=r[10],f[p+11]=r[11],f[p+12]=r[12],f[p+13]=r[13],f[p+14]=r[14],f[p+15]=r[15],Q++}}d.count=Q,d.instanceMatrix.needsUpdate=!0,d.position.copy(e.position),d.updateMatrix(),h.has(e.uuid)||this.landscape?.add(d),h.set(e.uuid,d),d.userData.meshConfig=l}));performance.now()}}stop(){this.view.removeOnLoop(this.onLoopHandler)}update(){this.view.camera&&(this.view.camera.getWorldPosition(this._cameraPosition),this._cameraPosition.distanceTo(this._lastUpdatePosition)>10&&(this._lastUpdatePosition.copy(this._cameraPosition),this.refreshGeometry(),this.refreshScatter(this._cameraPosition)))}clear(){this.scatterMeshes.forEach((e=>e.forEach((e=>e.parent?.remove(e)))))}createLandscapeMesh(e,t,s,n,o,i){const a=new h(t.sectionSize,t.sectionSize,t.density,t.density);a.rotateX(Math.PI/-2);const r=this.defaultLandscapeMaterial,c=new x(a,r);c.position.x=s+o*t.sectionSize,c.position.z=n+i*t.sectionSize,c.receiveShadow=!0,c.castShadow=!1,c.userData.landscape={x:o,y:i},c.x=o,c.y=i,c.name=`${o},${i}`,w(c,0,!0),w(c,4,!0);const l=e.landscape.heightMaps.find((e=>e.x===o&&e.y===i));if(null!=l&&this.applyHeightMap(a,l,t.density,1),a.computeBoundsTree(),null!=e.landscape.holes&&e.landscape.holes.length>0){const t=getHoleAttribute(c,!0);for(const s of e.landscape.holes)s.m===c.name&&t.setX(s.i,s.w[0])}return c}}export function getHoleAttribute(e,t=!1){if(!e.geometry.hasAttribute("hole")||t){const t=new Float32Array(e.geometry.getAttribute("position").array.length);e.geometry.setAttribute("hole",new n(t,1))}return e.geometry.getAttribute("hole")}function P(e,t,s){const n=Math.sqrt(t),o=Math.floor(e/n)/(n-1),i=e%n/(n-1),a=Math.sqrt(s);return(s-1)*o-(a-1)*o+(a-1)*i}new Map,new p(0,0),new p(1,0),new p(0,1),new p(1,0),new p(0,1),new p(1,1),new m;const L=new s;function $(e,t){return function(s){return L.setFromObject(s).distanceToPoint(e)>t}}function j(e,t){return function(s){return L.setFromObject(s).distanceToPoint(e)<t}}function B(e){e.a.y=0,e.b.y=0,e.c.y=0}const C=[];function G(e,t,s=.5){const n=C;let o=-1,i=-1;for(let e=0;e<n.length;e++)if(null!=n[e])for(let a=0;a<n[e].length;a++){const r=n[e][a]*t[e];r>s&&r>i&&(i=r,o=a)}return o}function O(e,t){let s=t-e,n=q();return n*=s,n+=e,n}const _=[];let T=1e3;for(;T--;)_.push(Math.random());function q(){return++T>=_.length?_[T=0]:_[T]}const I=[];let R=20;for(;R--;)I.push((new a).makeRotationY(q()*Math.PI/2));function U(e,t){let s=q(),n=q();s+n>1&&(s=1-s,n=1-n);const o=e.a,i=e.b,a=e.c;t.x=o.x+s*(i.x-o.x)+n*(a.x-o.x),t.z=o.z+s*(i.z-o.z)+n*(a.z-o.z)}new m;new m;const k=new m,D=new m(0,1,0),H=(new a).makeRotationX(Math.PI/-2);function W(e,t,s,n){e.lookAt(k,n,D).multiply(H)}new a;function N(e,t=1){const s=(++R>=I.length?I[R=0]:I[R]).elements,n=e.elements;n[0]=s[0]*t,n[4]=s[4]*t,n[8]=s[8]*t,n[1]=s[1]*t,n[5]=s[5]*t,n[9]=s[9]*t,n[2]=s[2]*t,n[6]=s[6]*t,n[10]=s[10]*t}function F(e){const t=e.getAttribute("normal");for(let e=0;e<t.count;e++)t.setXYZ(e,0,1,0);t.normalized=!0,t.needsUpdate=!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":"landscape.d.ts","sourceRoot":"","sources":["../../../src/scene/landscape/landscape.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,IAAI,EAA2C,MAAM,OAAO,CAAC;AAE7E,OAAO,EAA6E,kBAAkB,EAAqF,MAAM,oBAAoB,CAAA;AAKrN,MAAM,WAAW,oBAAoB;IACnC,WAAW,EAAE,MAAM,CAAA;IACnB,QAAQ,EAAE;QAAC,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAC,CAAA;IAChC,OAAO,EAAE,MAAM,CAAA;CAChB;AAED,wBAAgB,aAAa,CAAC,IAAI,EAAE,oBAAoB,GAAG,cAAc,CAmCxE;AAgDD,wBAAgB,8BAA8B,uBA0C7C;AAED,eAAO,MAAM,wBAAwB,oBAAmC,CAAA;AAExE,qBAAa,aAAc,SAAQ,IAAI;IACrC,CAAC,EAAE,MAAM,CAAA;IACT,CAAC,EAAE,MAAM,CAAA;CACV;AAED,qBAAa,cAAe,SAAQ,KAAK;IACvC,IAAI,QAAQ,IAAI,aAAa,EAAE,CAE9B;CACF"}
|
@@ -1,5 +1,4 @@
|
|
1
|
-
import{Group as e,Mesh as a}from"three";import{Color as r}from"three";import{varyingAttributes as t,float as n,mod as o,dot as s,vec2 as c,step as i,fract as l,mix as p,rgb as d,NodeShaderMaterial as f,rgba as u,standardMaterial as m,attributeFloat as h,RgbNode as L,varying as x}from"three-shader-graph";import{mixColorsByLayer as S,select as w}from"../../shader-nodes/index.js";export function initLandscape(e){e.sections.y,e.sectionSize,e.sections.x,e.sectionSize;return new LandscapeGroup}export function createLandscapeDefaultMaterial(){const e=t.uv,a=n(10),L=n(7),w=o(s(c(1,1),i(c(.5,.5),l(e.multiplyScalar(a)))),n(2)),v=o(s(c(1,1),i(c(.5,.5),l(e.multiplyScalar(L.multiply(a))))),n(2)),y=p(d(new r(4473924).convertLinearToSRGB()),d(new r(5592405).convertLinearToSRGB()),w),D=p(y,y.addScalar(n(.1)),v),G=S({layerColors:[u(D).rgb,...["#f3cc91","#e9a135","#f4a4a6","#ef767a","#e6373d","#55DDE0","#33658A","#2F4858"].map((e=>new r(e).convertLinearToSRGB())).map((e=>d(e))).reverse()],enableNoise:!1}),M=h("hole"),g=new f({color:m({color:G}),discard:x(M).gt(.5)});return g.color=new r("#aaaaaa"),g.name="Default",g}export const defaultLandscapeMaterial=createLandscapeDefaultMaterial();export class LandscapeMesh extends a{}export class LandscapeGroup extends e{get sections(){return this.children.filter((e=>e instanceof LandscapeMesh))}}
|
2
|
-
/*
|
1
|
+
import{Group as e,Mesh as a}from"three";import{Color as r}from"three";import{varyingAttributes as t,float as n,mod as o,dot as s,vec2 as c,step as i,fract as l,mix as p,rgb as d,NodeShaderMaterial as f,rgba as u,standardMaterial as m,attributeFloat as h,RgbNode as L,varying as x}from"three-shader-graph";import{mixColorsByLayer as S,select as w}from"../../shader-nodes/index.js";export function initLandscape(e){e.sections.y,e.sectionSize,e.sections.x,e.sectionSize;return new LandscapeGroup}export function createLandscapeDefaultMaterial(){const e=t.uv,a=n(10),L=n(7),w=o(s(c(1,1),i(c(.5,.5),l(e.multiplyScalar(a)))),n(2)),v=o(s(c(1,1),i(c(.5,.5),l(e.multiplyScalar(L.multiply(a))))),n(2)),y=p(d(new r(4473924).convertLinearToSRGB()),d(new r(5592405).convertLinearToSRGB()),w),D=p(y,y.addScalar(n(.1)),v),G=S({layerColors:[u(D).rgb,...["#f3cc91","#e9a135","#f4a4a6","#ef767a","#e6373d","#55DDE0","#33658A","#2F4858"].map((e=>new r(e).convertLinearToSRGB())).map((e=>d(e))).reverse()],enableNoise:!1}),M=h("hole"),g=new f({color:m({color:G}),discard:x(M).gt(.5)});return g.color=new r("#aaaaaa"),g.name="Default",g}export const defaultLandscapeMaterial=createLandscapeDefaultMaterial();export class LandscapeMesh extends a{}export class LandscapeGroup extends e{get sections(){return this.children.filter((e=>e instanceof LandscapeMesh))}}/*
|
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":"utils.d.ts","sourceRoot":"","sources":["../../../src/scene/landscape/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,IAAI,EAAW,MAAM,OAAO,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAG/C,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,aAAa,EAAE,QA0D/D;AAKD,qBAAa,WAAW;IACtB,OAAO,CAAC,IAAI,CAAwC;gBAExC,MAAM,EAAE,aAAa,EAAE;IAUnC,IAAI,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,IAAI,GAAC,IAAI;CAGtC;AA4GD,wBAAgB,MAAM,CAAC,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,WAO9C"}
|
@@ -1,5 +1,4 @@
|
|
1
|
-
import{Vector3 as e}from"three";export function smoothNormalsCrossMeshes(t){const r=new SectionGrid(t);performance.now();const n=new e,o=new e,i=new e,s=new e;for(const e of t){const t=e.geometry.getAttribute("position"),c=e.geometry.getAttribute("normal");for(const d of u(t.count)){const{otherMesh:u,j:a}=f(d,t.count,e,r);if(null==u)continue;n.fromBufferAttribute(t,d),n.applyMatrix4(e.matrixWorld);const x=u.geometry.getAttribute("position"),h=u.geometry.getAttribute("normal");u.updateMatrixWorld(),o.fromBufferAttribute(x,a),o.applyMatrix4(u.matrixWorld),i.fromBufferAttribute(c,d),s.fromBufferAttribute(h,a);const m=i.add(s).divideScalar(2);c.setXYZ(d,m.x,m.y,m.z),h.setXYZ(a,m.x,m.y,m.z),c.needsUpdate=!0,h.needsUpdate=!0;const l=(t.getY(d)+x.getY(a))/2;t.setY(d,l),x.setY(a,l)}}performance.now()}export class SectionGrid{constructor(e){this.grid=new Map;for(const t of e){const{x:e,y:r}=t;this.grid.has(e)||this.grid.set(e,new Map),this.grid.get(e).set(r,t)}}find(e,t){return this.grid.get(e)?.get(t)}}const t={meshPredicate:(e,t)=>e.find(t.x,t.y-1),vertexFunc:(e,t)=>e+t*(t-1)},r={meshPredicate:(e,t)=>e.find(t.x-1,t.y-1),vertexFunc:(e,t)=>t*t-1},n={meshPredicate:(e,t)=>e.find(t.x+1,t.y-1),vertexFunc:(e,t)=>t*t-t},o={meshPredicate:(e,t)=>e.find(t.x,t.y+1),vertexFunc:(e,t)=>e-t*(t-1)},i={meshPredicate:(e,t)=>e.find(t.x-1,t.y+1),vertexFunc:(e,t)=>t-1},s={meshPredicate:(e,t)=>e.find(t.x+1,t.y+1),vertexFunc:(e,t)=>0},c={meshPredicate:(e,t)=>e.find(t.x-1,t.y),vertexFunc:(e,t)=>e+t-1},d={meshPredicate:(e,t)=>e.find(t.x+1,t.y),vertexFunc:(e,t)=>e-t+1};function f(e,f,u,a){const x=Math.sqrt(f),h=(e+1)%x==0,m=e%x==0;let l;if(e<x?(l=t,m&&(l=r),h&&(l=n)):e>=f-x?(l=o,m?l=i:h&&(l=s)):m?l=c:h&&(l=d),null==l)return{otherMesh:null,j:null};return{otherMesh:l.meshPredicate(a,u),j:l.vertexFunc(e,x)}}function*u(e){const t=Math.sqrt(e);for(let r=0;r<t;r++)yield r,yield r+e-t;for(let e=1,r=t-1;e<r;e++)yield e*t,yield e*t+t-1}export function onEdge(e,t){const r=Math.sqrt(t);return e<r||e%r==0||e>=t-r||(e+1)%r==0}
|
2
|
-
/*
|
1
|
+
import{Vector3 as e}from"three";export function smoothNormalsCrossMeshes(t){const r=new SectionGrid(t);performance.now();const n=new e,o=new e,i=new e,s=new e;for(const e of t){const t=e.geometry.getAttribute("position"),c=e.geometry.getAttribute("normal");for(const d of u(t.count)){const{otherMesh:u,j:a}=f(d,t.count,e,r);if(null==u)continue;n.fromBufferAttribute(t,d),n.applyMatrix4(e.matrixWorld);const x=u.geometry.getAttribute("position"),h=u.geometry.getAttribute("normal");u.updateMatrixWorld(),o.fromBufferAttribute(x,a),o.applyMatrix4(u.matrixWorld),i.fromBufferAttribute(c,d),s.fromBufferAttribute(h,a);const m=i.add(s).divideScalar(2);c.setXYZ(d,m.x,m.y,m.z),h.setXYZ(a,m.x,m.y,m.z),c.needsUpdate=!0,h.needsUpdate=!0;const l=(t.getY(d)+x.getY(a))/2;t.setY(d,l),x.setY(a,l)}}performance.now()}export class SectionGrid{constructor(e){this.grid=new Map;for(const t of e){const{x:e,y:r}=t;this.grid.has(e)||this.grid.set(e,new Map),this.grid.get(e).set(r,t)}}find(e,t){return this.grid.get(e)?.get(t)}}const t={meshPredicate:(e,t)=>e.find(t.x,t.y-1),vertexFunc:(e,t)=>e+t*(t-1)},r={meshPredicate:(e,t)=>e.find(t.x-1,t.y-1),vertexFunc:(e,t)=>t*t-1},n={meshPredicate:(e,t)=>e.find(t.x+1,t.y-1),vertexFunc:(e,t)=>t*t-t},o={meshPredicate:(e,t)=>e.find(t.x,t.y+1),vertexFunc:(e,t)=>e-t*(t-1)},i={meshPredicate:(e,t)=>e.find(t.x-1,t.y+1),vertexFunc:(e,t)=>t-1},s={meshPredicate:(e,t)=>e.find(t.x+1,t.y+1),vertexFunc:(e,t)=>0},c={meshPredicate:(e,t)=>e.find(t.x-1,t.y),vertexFunc:(e,t)=>e+t-1},d={meshPredicate:(e,t)=>e.find(t.x+1,t.y),vertexFunc:(e,t)=>e-t+1};function f(e,f,u,a){const x=Math.sqrt(f),h=(e+1)%x==0,m=e%x==0;let l;if(e<x?(l=t,m&&(l=r),h&&(l=n)):e>=f-x?(l=o,m?l=i:h&&(l=s)):m?l=c:h&&(l=d),null==l)return{otherMesh:null,j:null};return{otherMesh:l.meshPredicate(a,u),j:l.vertexFunc(e,x)}}function*u(e){const t=Math.sqrt(e);for(let r=0;r<t;r++)yield r,yield r+e-t;for(let e=1,r=t-1;e<r;e++)yield e*t,yield e*t+t-1}export function onEdge(e,t){const r=Math.sqrt(t);return e<r||e%r==0||e>=t-r||(e+1)%r==0}/*
|
3
2
|
* Copyright (©) 2023. All rights reserved.
|
4
3
|
* See the LICENSE.md file for details.
|
5
4
|
*/
|
@@ -315,3 +315,4 @@ export declare function serializeCustomParameter(type: ParameterType, value: unk
|
|
315
315
|
export declare const customParameterDefaultValueByType: Map<SerializedParamType, any>;
|
316
316
|
export declare function applyMaterial(object: Object3D, assignment: MaterialAssignment, materialProvider: (id: AssetId) => Promise<Material>, _originalMaterials?: Map<string | number, THREE.Material>): Promise<void[]>;
|
317
317
|
export {};
|
318
|
+
//# sourceMappingURL=materializer.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"materializer.d.ts","sourceRoot":"","sources":["../../src/scene/materializer.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAgB,MAAM,MAAM,CAAA;AAC5C,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAGE,KAAK,EAEZ,QAAQ,EAMR,QAAQ,EAGR,KAAK,EAIL,OAAO,EAER,MAAM,OAAO,CAAA;AAad,OAAO,EAAE,iBAAiB,EAAE,MAAM,QAAQ,CAAA;AAG1C,OAAO,EAAE,aAAa,EAAE,MAAM,qCAAqC,CAAA;AACnE,OAAO,EAAE,SAAS,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