@hology/core 0.0.182 → 0.0.184

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.
Files changed (176) hide show
  1. package/dist/config/project-config.js +1 -1
  2. package/dist/controllers/base-game-controller.js +1 -1
  3. package/dist/csm.js +1 -1
  4. package/dist/effects/particles/examples.js +1 -1
  5. package/dist/effects/particles/particle-system-config.js +1 -1
  6. package/dist/effects/vfx/behaviours.js +1 -1
  7. package/dist/effects/vfx/index.js +1 -1
  8. package/dist/effects/vfx/initializsers.js +1 -1
  9. package/dist/effects/vfx/rates.js +1 -1
  10. package/dist/effects/vfx/stretched-sprite.js +1 -1
  11. package/dist/effects/vfx/trail-renderer.js +1 -1
  12. package/dist/effects/vfx/vfx-actor.js +1 -1
  13. package/dist/effects/vfx/vfx-asset.js +1 -1
  14. package/dist/effects/vfx/vfx-collision-behaviour.js +1 -1
  15. package/dist/effects/vfx/vfx-defs.js +1 -1
  16. package/dist/effects/vfx/vfx-materializer.js +1 -1
  17. package/dist/effects/vfx/vfx-old-materializer.js +1 -1
  18. package/dist/effects/vfx/vfx-param.js +1 -1
  19. package/dist/effects/vfx/vfx-renderers.js +1 -1
  20. package/dist/effects/vfx/vfx-service.js +1 -1
  21. package/dist/effects/vfx/zones.js +1 -1
  22. package/dist/game-component/component-decorators.js +1 -1
  23. package/dist/game-component/game-component.js +1 -1
  24. package/dist/gameplay/actors/actor.js +1 -1
  25. package/dist/gameplay/actors/builtin/camera-actor.js +1 -1
  26. package/dist/gameplay/actors/builtin/components/character/character-animation.js +1 -1
  27. package/dist/gameplay/actors/builtin/components/character/character-movement.js +1 -1
  28. package/dist/gameplay/actors/builtin/components/character/modes.js +1 -1
  29. package/dist/gameplay/actors/builtin/components/editor-sprite-component.js +1 -1
  30. package/dist/gameplay/actors/builtin/components/index.js +1 -1
  31. package/dist/gameplay/actors/builtin/components/mesh-component.js +1 -1
  32. package/dist/gameplay/actors/builtin/components/scene-component.js +1 -1
  33. package/dist/gameplay/actors/builtin/components/tween-component.js +1 -1
  34. package/dist/gameplay/actors/builtin/components/volume-editor-component.js +1 -1
  35. package/dist/gameplay/actors/builtin/index.js +1 -1
  36. package/dist/gameplay/actors/builtin/navmesh-actor.js +1 -1
  37. package/dist/gameplay/actors/builtin/positional-audio-actor.js +1 -1
  38. package/dist/gameplay/actors/builtin/post-process-volume-actor.js +1 -1
  39. package/dist/gameplay/actors/builtin/spawn-point.js +1 -1
  40. package/dist/gameplay/actors/builtin/trigger-volume.js +1 -1
  41. package/dist/gameplay/actors/camera/camera-component.js +1 -1
  42. package/dist/gameplay/actors/camera/third-person-camera-component.js +1 -1
  43. package/dist/gameplay/actors/component.js +1 -1
  44. package/dist/gameplay/actors/factory.js +1 -1
  45. package/dist/gameplay/actors/index.js +1 -1
  46. package/dist/gameplay/actors/internal/component-init.js +1 -1
  47. package/dist/gameplay/actors/internal/container-map.js +1 -1
  48. package/dist/gameplay/ai/behavior-tree/bt.js +1 -1
  49. package/dist/gameplay/ai/behavior-tree/move.js +1 -1
  50. package/dist/gameplay/ai/build-tile.js +1 -1
  51. package/dist/gameplay/ai/dynamic-tiled-navmesh.js +1 -1
  52. package/dist/gameplay/ai/dynamic-tiled-navmesh.worker.js +1 -1
  53. package/dist/gameplay/ai/index.js +1 -1
  54. package/dist/gameplay/ai/navigation.js +1 -1
  55. package/dist/gameplay/animation/anim-sm.js +1 -1
  56. package/dist/gameplay/animation/root-motion.js +1 -1
  57. package/dist/gameplay/env.js +1 -1
  58. package/dist/gameplay/index.js +1 -1
  59. package/dist/gameplay/initiate.js +2 -2
  60. package/dist/gameplay/inject.d.ts +3 -1
  61. package/dist/gameplay/inject.js +1 -1
  62. package/dist/gameplay/input/index.js +1 -1
  63. package/dist/gameplay/input/input-service.js +1 -1
  64. package/dist/gameplay/input/input.js +1 -1
  65. package/dist/gameplay/input/keybind.js +1 -1
  66. package/dist/gameplay/polyfill.js +1 -1
  67. package/dist/gameplay/services/asset-loader.js +1 -1
  68. package/dist/gameplay/services/physics/abstract-physics-system.js +1 -1
  69. package/dist/gameplay/services/physics/collision-contact.js +1 -1
  70. package/dist/gameplay/services/physics/physics-system.js +1 -1
  71. package/dist/gameplay/services/pointer-events.js +1 -1
  72. package/dist/gameplay/services/render.js +1 -1
  73. package/dist/gameplay/services/shader-provider.js +1 -1
  74. package/dist/gameplay/services/world.js +1 -1
  75. package/dist/index.js +1 -1
  76. package/dist/rendering/bloom/LuminosityHighPassShader.js +1 -1
  77. package/dist/rendering/bloom/UnrealBloomPass.js +1 -1
  78. package/dist/rendering/bloom/types.js +1 -1
  79. package/dist/rendering/color-pass.js +1 -1
  80. package/dist/rendering/fog/fog-volume-actor.js +1 -1
  81. package/dist/rendering/fog/fog-volume-object.js +1 -1
  82. package/dist/rendering/fog/volumetric-fog-pass.js +1 -1
  83. package/dist/rendering/outline-effect.js +1 -1
  84. package/dist/rendering/shader-override.js +1 -1
  85. package/dist/rendering/ssr/SSRPass.js +1 -1
  86. package/dist/rendering/ssr/SSRShader.js +1 -1
  87. package/dist/rendering/tone-mapping.js +1 -1
  88. package/dist/rendering.d.ts +7 -1
  89. package/dist/rendering.js +2 -2
  90. package/dist/scene/asset-resource-loader.js +1 -1
  91. package/dist/scene/assets-provider.js +1 -1
  92. package/dist/scene/batched-mesh-2.js +2 -2
  93. package/dist/scene/bootstrap.js +1 -1
  94. package/dist/scene/collision/collision-shape-import.js +1 -1
  95. package/dist/scene/collision/collision-shape.js +1 -1
  96. package/dist/scene/landscape/landscape-manager.js +1 -1
  97. package/dist/scene/landscape/landscape.js +1 -1
  98. package/dist/scene/landscape/utils.js +1 -1
  99. package/dist/scene/materializer.d.ts +5 -0
  100. package/dist/scene/materializer.js +2 -2
  101. package/dist/scene/materials/grass-foliage.js +1 -1
  102. package/dist/scene/materials/grass.js +1 -1
  103. package/dist/scene/materials/utils/material-painting.js +1 -1
  104. package/dist/scene/materials/utils/noise.glsl.js +1 -1
  105. package/dist/scene/materials/water.js +1 -1
  106. package/dist/scene/model.js +1 -1
  107. package/dist/scene/objects/prefab.js +1 -1
  108. package/dist/scene/objects/ramp-geometry.js +1 -1
  109. package/dist/scene/objects/shapes.js +1 -1
  110. package/dist/scene/objects/stairs-geometry.js +1 -1
  111. package/dist/scene/runtime-asset-service.js +1 -1
  112. package/dist/scene/runtime-backend-service.js +1 -1
  113. package/dist/scene/runtime-bundled-backend-service.js +1 -1
  114. package/dist/scene/scene-data-service.js +1 -1
  115. package/dist/scene/sky.js +1 -1
  116. package/dist/scene/storage/storage.js +1 -1
  117. package/dist/shader/builtin/decal-standard-shader.js +1 -1
  118. package/dist/shader/builtin/decal-unlit-shader.js +1 -1
  119. package/dist/shader/builtin/index.js +1 -1
  120. package/dist/shader/builtin/lambert-shader.js +1 -1
  121. package/dist/shader/builtin/landscape-composite-shader.js +1 -1
  122. package/dist/shader/builtin/landscape-shader.js +1 -1
  123. package/dist/shader/builtin/layered-shader.js +1 -1
  124. package/dist/shader/builtin/standard-shader.js +1 -1
  125. package/dist/shader/builtin/toon-shader.js +1 -1
  126. package/dist/shader/builtin/unlit-shader.js +1 -1
  127. package/dist/shader/color-layer.js +1 -1
  128. package/dist/shader/decal-shader.js +1 -1
  129. package/dist/shader/index.js +1 -1
  130. package/dist/shader/parameter.js +1 -1
  131. package/dist/shader/shader.js +1 -1
  132. package/dist/shader/sprite-shader.js +1 -1
  133. package/dist/shader/trail-shader.js +1 -1
  134. package/dist/shader-nodes/bulge.js +1 -1
  135. package/dist/shader-nodes/curve-sample.js +1 -1
  136. package/dist/shader-nodes/decal.js +1 -1
  137. package/dist/shader-nodes/depth.js +1 -1
  138. package/dist/shader-nodes/effects.js +1 -1
  139. package/dist/shader-nodes/glsl-node.js +1 -1
  140. package/dist/shader-nodes/index.js +1 -1
  141. package/dist/shader-nodes/landscape.js +1 -1
  142. package/dist/shader-nodes/layers.js +1 -1
  143. package/dist/shader-nodes/math.js +1 -1
  144. package/dist/shader-nodes/particle.js +1 -1
  145. package/dist/shader-nodes/pom.js +1 -1
  146. package/dist/shader-nodes/scene-sample.js +1 -1
  147. package/dist/shader-nodes/shapes.js +1 -1
  148. package/dist/shader-nodes/texture-sequence.js +1 -1
  149. package/dist/shader-nodes/time.js +1 -1
  150. package/dist/shader-nodes/voronoi.js +1 -1
  151. package/dist/test/injection.test.js +1 -1
  152. package/dist/utils/async.js +1 -1
  153. package/dist/utils/buffer.js +1 -1
  154. package/dist/utils/collections.js +1 -1
  155. package/dist/utils/curve.js +1 -1
  156. package/dist/utils/files.js +1 -1
  157. package/dist/utils/materials.js +1 -1
  158. package/dist/utils/math.js +1 -1
  159. package/dist/utils/mesh.js +1 -1
  160. package/dist/utils/polyfill.js +1 -1
  161. package/dist/utils/three/cleanup.js +1 -1
  162. package/dist/utils/three/depth-pass.js +1 -1
  163. package/dist/utils/three/gpu-stats-panel.js +1 -1
  164. package/dist/utils/three/line-sphere.js +1 -1
  165. package/dist/utils/three/outline-pass.js +1 -1
  166. package/dist/utils/three/positional-audio-helper.js +1 -1
  167. package/dist/utils/three/stats.js +1 -1
  168. package/dist/utils/three/transform-controls.js +1 -1
  169. package/dist/utils/three/traverse.js +1 -1
  170. package/dist/utils/three/unscaled-sprite.js +1 -1
  171. package/dist/utils/type.js +1 -1
  172. package/dist/utils/uuid.js +1 -1
  173. package/dist/utils/voxel-bitset.js +1 -1
  174. package/dist/worker/index.js +1 -1
  175. package/package.json +1 -1
  176. package/tsconfig.tsbuildinfo +1 -1
@@ -1,4 +1,4 @@
1
1
  import{__decorate as t,__metadata as s}from"tslib";import{EdgesGeometry as i,LineSegments as e,LineBasicMaterial as o,Vector3 as r,BoxGeometry as n,Mesh as h,MeshBasicMaterial as c,Group as p,Color as m}from"three";import{Actor as d,BaseActor as a}from"../actor.js";import{Component as y,ActorComponent as l,attach as f}from"../component.js";import{PhysicsSystem as v}from"../../services/physics/physics-system.js";import{BoxCollisionShape as w}from"../../../scene/collision/collision-shape.js";import{Parameter as g}from"../../../shader/parameter.js";import{firstValueFrom as O}from"rxjs";let u=class extends l{constructor(){super(...arguments),this.color=new m(16777215),this.dimensions=new r(1,1,1)}onInit(){const t=new n(this.dimensions.x,this.dimensions.y,this.dimensions.z),s=new i(t),r=new e(s,new o({color:this.color})),m=(new h(t,new c({color:this.color,transparent:!0,opacity:.3,visible:!1})),new p);m.add(r),this.actor.object.add(m)}};t([g(),s("design:type",m)],u.prototype,"color",void 0),t([g(),s("design:type",r)],u.prototype,"dimensions",void 0),u=t([y({inEditor:!0,editorOnly:!0})],u);export{u as TriggerVolumeMesh};let A=class extends l{constructor(t){super(),this.physicsSystem=t,this.dimensions=new r(1,1,1),this.offset=new r(0,0,0),this.editorMesh=f(u)}onInit(){this.physicsSystem.addActor(this.actor,[new w(this.dimensions).withOffset(this.offset)],{isTrigger:!0}),O(this.disposed).then(()=>{this.physicsSystem.removeActor(this.actor)})}onBeginOverlapWithActor(t){return this.physicsSystem.onBeginOverlapWithActor(this.actor,t)}onEndOverlapWithActor(t){return this.physicsSystem.onEndOverlapWithActor(this.actor,t)}onBeginOverlapWithActorType(t){return this.physicsSystem.onBeginOverlapWithActorType(this.actor,t)}onEndOverlapWithActorType(t){return this.physicsSystem.onEndOverlapWithActorType(this.actor,t)}};A=t([y({inEditor:!0,editorOnly:!1}),s("design:paramtypes",[v])],A);export{A as TriggerVolumeComponent};let x=class extends a{constructor(){super(...arguments),this.trigger=f(A)}};x=t([d()],x);export{x as TriggerVolume};/*
2
- * Copyright (©) 2025 Hology Interactive AB. All rights reserved.
2
+ * Copyright (©) 2026 Hology Interactive AB. All rights reserved.
3
3
  * See the LICENSE.md file for details.
4
4
  */
@@ -1,4 +1,4 @@
1
1
  import{__decorate as e,__metadata as t}from"tslib";import{ArrowHelper as r,ConeGeometry as i,EdgesGeometry as s,LineBasicMaterial as o,LineSegments as n,MeshStandardMaterial as a,PerspectiveCamera as l,Vector3 as h}from"three";import{Parameter as d}from"../../../shader/parameter.js";import{ViewController as c}from"../../services/render.js";import{ActorComponent as p,attach as w,Component as m}from"../component.js";const v=void 0!==window&&/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);let b=class extends p{constructor(e){super(),this.viewController=e,this.near=.5,this.far=500,this.viewAngle=v?30:45,this.debugMesh=w(y),this.aspect=this.viewController.htmlElement.clientWidth/this.viewController.htmlElement.clientHeight,this.instance=new l(this.viewAngle,this.aspect,this.near,this.far)}onInit(){this.actor.object.add(this.instance),this.instance.near=this.near,this.instance.far=this.far,this.instance.fov=this.viewAngle}};e([d(),t("design:type",Number)],b.prototype,"near",void 0),e([d(),t("design:type",Number)],b.prototype,"far",void 0),e([d(),t("design:type",Number)],b.prototype,"viewAngle",void 0),b=e([m({inEditor:!0}),t("design:paramtypes",[c])],b);export{b as CameraComponent};let y=class extends p{constructor(){super(...arguments),this.arrowColor=16101442}onInit(){const e=new i(1,1,4);e.rotateX(Math.PI/2),e.rotateZ(Math.PI/4),e.scale(1,9/16,1);const t=new s(e),l=(new a({color:3355443}),new n(t,new o({color:16777215}))),d=new r(new h(0,0,-1),new h(0,0,0),1.2,this.arrowColor,.15,.2);l.add(d),d.layers.disableAll(),d.layers.enable(19),d.traverse(e=>{e.layers.disableAll(),e.layers.enable(19)}),this.actor.object.add(l)}};y=e([m({inEditor:!0,editorOnly:!0})],y);export{y as CameraMesh};/*
2
- * Copyright (©) 2025 Hology Interactive AB. All rights reserved.
2
+ * Copyright (©) 2026 Hology Interactive AB. All rights reserved.
3
3
  * See the LICENSE.md file for details.
4
4
  */
@@ -1,4 +1,4 @@
1
1
  import{__decorate as t,__metadata as e}from"tslib";import{ActorComponent as i,Component as s}from"../component.js";import{Vector3 as o,MathUtils as n,PerspectiveCamera as h,Object3D as r}from"three";import{ViewController as a}from"../../services/render.js";import{DecimalInput as c,RestrictedRotationInput as d}from"../../input/index.js";import{PhysicsSystem as l}from"../../services/physics/physics-system.js";import{Parameter as p}from"../../../shader/parameter.js";import{World as m}from"../../services/world.js";import{inject as f}from"../../inject.js";import{ease as u}from"@hology/nebula";const v=void 0!==window&&/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);let w=class extends i{constructor(){super(),this.viewController=f(a),this.physicsSystem=f(l),this.aspect=this.viewController.htmlElement.clientWidth/this.viewController.htmlElement.clientHeight,this.near=.5,this.far=500,this.viewAngle=v?30:45,this.collision=!0,this.collisionSphereRadius=.25,this.camera=new h(this.viewAngle,this.aspect,this.near,this.far),this.distance=9,this.minDistance=1.5,this.maxDistance=this.distance,this.height=3,this.offsetX=-1,this.offsetZ=1.5,this.autoActivate=!0,this.bounceBackSpeed=3,this.restrictedDistance=Math.max(this.distance,this.maxDistance),this.rotationInput=new d(-Math.PI/4,Math.PI/2-.7),this.zoomInput=new c(1,0,1),this.offset=new o,this.lookAtOffset=new o(this.offsetX,0,this.offsetZ),this.fixedBehind=!0,this.world=f(m),this.activated=!1,this.isMouseLocked=!1,this.prevFixedBehind=!1,this.blendDurationLeft=0,this.canvas=null,this.pointerLockInactivatedAt=null,this.onMouseDown=t=>{this.isMouseLocked||"mouse"!==t.pointerType||this.hideCursor()},this.onKeyDown=t=>{"Escape"===t.key&&this.showCursor()},this.onPointerLockChange=()=>{null!=document.pointerLockElement||null!=document.mozPointerLockElement||this.showCursor()},this.prevLookAt=new o}async onInit(){this.prevFixedBehind=this.fixedBehind,this.world.scene.add(this.camera),this.rotationInput.rotation.copy(this.actor.rotation),this.restrictedDistance=Math.max(this.distance,this.maxDistance),this.lookAtOffset.set(this.offsetX,0,this.offsetZ),this.autoActivate&&this.activate()}activate(){this.activated=!0,this.viewController.setCamera(this.camera);const t=this.element;null!=document.body.requestPointerLock&&(t.addEventListener("pointerdown",this.onMouseDown),t.addEventListener("keydown",this.onKeyDown),document.addEventListener("pointerlockchange",this.onPointerLockChange,!1),this.disposed.subscribe(()=>{t.removeEventListener("pointerdown",this.onMouseDown),t.removeEventListener("keydown",this.onKeyDown),document.removeEventListener("pointerlockchange",this.onPointerLockChange,!1)}))}onLateUpdate(t){this.activated&&this.setFromRotation(t)}get element(){return this.viewController.htmlElement}hideCursor(){null!=this.pointerLockInactivatedAt&&performance.now()-this.pointerLockInactivatedAt<1600||(this.element.style.cursor="none",null==this.canvas&&(this.canvas=this.element.getElementsByTagName("canvas")[0]),this.canvas&&(this.canvas.requestPointerLock(),this.isMouseLocked=!0))}showCursor(){this.pointerLockInactivatedAt=performance.now(),this.element.style.cursor="default",window.document.exitPointerLock(),this.isMouseLocked=!1}setFromRotation(t){this.lookAtOffset.set(this.offsetX,0,this.offsetZ),this.fixedBehind!==this.prevFixedBehind?(this.blendDurationLeft=1,this.prevFixedBehind=this.fixedBehind):this.blendDurationLeft>0&&(this.blendDurationLeft-=t),this.collision&&this.checkForCollision(t);const e=n.clamp(Math.min(this.restrictedDistance,this.distance),Math.min(this.minDistance,this.restrictedDistance),Math.max(this.distance*this.zoomInput.value,this.minDistance)),i=Math.cos(this.rotationInput.rotation.x)*e,s=this.fixedBehind?0:this.rotationInput.rotation.y;this.offset.x=Math.sin(-s)*i,this.offset.y=Math.sin(this.rotationInput.rotation.x)*e+2,this.offset.z=Math.cos(-s)*-i,this.fixedBehind&&this.offset.add(this.lookAtOffset),this.updateCameraPosition()}checkForCollision(t){const e=this.getLookAtPosition(),i=this.camera.getWorldPosition(x),s=L.subVectors(i,e),o=s.length();if(o<.001)return;s.divideScalar(o);const h=this.physicsSystem.sphereCast(e,this.collisionSphereRadius,s,this.distance,void 0,{excludeActor:this.actor,excludeTriggers:!0,collisionFilter:-2});if(h.hasHit){const t=Math.max(this.minDistance,h.distance-.05);t<this.restrictedDistance&&(this.restrictedDistance=t)}else this.restrictedDistance=n.lerp(this.restrictedDistance,this.distance,n.clamp(this.bounceBackSpeed*t,0,1))}getLookAtPosition(){const t=k;return t.set(0,0,0),t.y=this.height,this.fixedBehind&&t.add(this.lookAtOffset),t.applyMatrix4(this.actor.object.matrixWorld),t}updateCameraPosition(){this.fixedBehind?(y.position.set(this.offset.x,this.offset.y,this.offset.z),y.rotation.set(0,0,0),y.scale.set(1,1,1),y.applyMatrix4(this.actor.object.matrix)):y.position.copy(this.actor.position).add(this.offset);const t=u.easeInOutCubic(1-this.blendDurationLeft);this.blendDurationLeft>0?this.camera.position.lerp(y.position,t):this.camera.position.copy(y.position);const e=this.getLookAtPosition();this.blendDurationLeft>0?(this.prevLookAt.lerp(e,t),this.camera.lookAt(this.prevLookAt)):(this.camera.lookAt(e),this.prevLookAt.copy(e))}};t([p(),e("design:type",Number)],w.prototype,"near",void 0),t([p(),e("design:type",Number)],w.prototype,"far",void 0),t([p(),e("design:type",Number)],w.prototype,"viewAngle",void 0),t([p(),e("design:type",Boolean)],w.prototype,"collision",void 0),t([p(),e("design:type",Number)],w.prototype,"collisionSphereRadius",void 0),w=t([s(),e("design:paramtypes",[])],w);export{w as ThirdPersonCameraComponent};const y=new r,k=new o,L=(new o,new o),x=(new o,new o);export class ThirdPartyCameraComponent extends w{}/*
2
- * Copyright (©) 2025 Hology Interactive AB. All rights reserved.
2
+ * Copyright (©) 2026 Hology Interactive AB. All rights reserved.
3
3
  * See the LICENSE.md file for details.
4
4
  */
@@ -1,4 +1,4 @@
1
1
  import{Container as t,Service as n,Inject as o}from"typedi";import{_setupActorUpdateEventHandlers as e}from"./actor.js";import{activeContainerInstance as r}from"./internal/container-map.js";import{randomString as i}from"../../utils/math.js";export class ActorComponent{constructor(){e.call(this)}onInit(){}onBeginPlay(){}onEndPlay(){}onUpdate(t){}onLateUpdate(t){}get disposed(){return this.actor.disposed}attach(t,n){return this.actor.attach(t,n)}}ActorComponent.__isActorComponent=!0;export function Component(t={inEditor:!1,editorOnly:!1}){const o=n({transient:!0});return function(n){n.__inEditor=t.inEditor,n.__onlyEditor=t.editorOnly,o(n)}}export function Attach(n={},e){return function(r,i,a){if(null==r)return void Reflect.defineMetadata("design:type",e,e.prototype,i);const c=e??Reflect.getMetadata("design:type",r,i);o(()=>c)(r,i,a);const s=t.handlers.find(t=>t.object===r&&t.propertyName===i&&t.index===a),d=s.value;s.value=t=>{const o=d(t);return Object.assign(o,n)}}}export function attach(n,o){const e=r.value??t.of("default"),a=i();e.set({id:a,type:n,transient:!0});const c=e.get(a);if(null!=o)for(const t of Object.keys(o))c[t]=o[t];return c}/*
2
- * Copyright (©) 2025 Hology Interactive AB. All rights reserved.
2
+ * Copyright (©) 2026 Hology Interactive AB. All rights reserved.
3
3
  * See the LICENSE.md file for details.
4
4
  */
@@ -1,4 +1,4 @@
1
1
  import{__decorate as t,__metadata as i}from"tslib";import{ContainerInstance as n}from"typedi";import{Service as o}from"typedi";import{initComponents as e}from"./internal/component-init.js";import{activeContainerInstance as r,containerRefMap as a}from"./internal/container-map.js";let s=class{constructor(t,i){this.container=t,this.env=i}async create(t,i,n,o){const e=this.container;r.value=e;const s=(1e4*Math.random()).toString();e.set({id:s,type:t,transient:!0});const c=e.get(s);return r.value=null,e.remove(t),a.set(c,e),i&&c.object.position.copy(i),n&&c.object.rotation.copy(n),!0!==o&&await this.initActor(c),c}async initActor(t){await e(t,t,this.env.inEditor??!1),await t.onInit(),t.__isInitialised=!0}};s=t([o(),i("design:paramtypes",[n,Object])],s);export{s as ActorFactory};/*
2
- * Copyright (©) 2025 Hology Interactive AB. All rights reserved.
2
+ * Copyright (©) 2026 Hology Interactive AB. All rights reserved.
3
3
  * See the LICENSE.md file for details.
4
4
  */
@@ -1,4 +1,4 @@
1
1
  export{CameraActor}from"./builtin/camera-actor.js";export{CameraComponent}from"./camera/camera-component.js";export{ThirdPersonCameraComponent,ThirdPartyCameraComponent}from"./camera/third-person-camera-component.js";export{SpawnPoint}from"./builtin/spawn-point.js";export{TriggerVolume,TriggerVolumeComponent}from"./builtin/trigger-volume.js";export{PositionalAudioActor,PositionalAudioComponent}from"./builtin/positional-audio-actor.js";export*from"./builtin/components/mesh-component.js";export*from"./builtin/components/character/character-movement.js";export*from"./builtin/components/character/modes.js";export*from"./builtin/components/character/character-animation.js";export{builtInComponents}from"./builtin/components/index.js";/*
2
- * Copyright (©) 2025 Hology Interactive AB. All rights reserved.
2
+ * Copyright (©) 2026 Hology Interactive AB. All rights reserved.
3
3
  * See the LICENSE.md file for details.
4
4
  */
@@ -1,4 +1,4 @@
1
1
  import{ActorComponent as o}from"../component.js";const n=new WeakMap;export async function initComponents(t,c,i=!1){const s=[],r=[...Object.values(t)];t===c&&c.attachedComponents.forEach(o=>r.push(o));for(const t of r)if(t instanceof o||null!=t?.constructor&&!0===t.constructor.__isActorComponent){if(i&&!t.constructor.__inEditor)continue;if(!i&&t.constructor.__onlyEditor)continue;const o=t;if(o.actor=c,n.has(o))continue;n.set(o,!0),await o.onInit(),s.push(initComponents(t,c,i))}return Promise.all(s)}/*
2
- * Copyright (©) 2025 Hology Interactive AB. All rights reserved.
2
+ * Copyright (©) 2026 Hology Interactive AB. All rights reserved.
3
3
  * See the LICENSE.md file for details.
4
4
  */
@@ -1,4 +1,4 @@
1
1
  export const containerRefMap=new WeakMap;export const activeContainerInstance={value:null};/*
2
- * Copyright (©) 2025 Hology Interactive AB. All rights reserved.
2
+ * Copyright (©) 2026 Hology Interactive AB. All rights reserved.
3
3
  * See the LICENSE.md file for details.
4
4
  */
@@ -1,4 +1,4 @@
1
1
  export class Node{}export var NodeState;!function(t){t[t.SUCCESS=0]="SUCCESS",t[t.FAILURE=1]="FAILURE",t[t.RUNNING=2]="RUNNING"}(NodeState||(NodeState={}));export class LeafNode extends Node{}export class ActionNode extends LeafNode{constructor(t){super(),this.action=t}tick(){return this.action()}}export class SuccessNode extends LeafNode{constructor(t){super(),this.action=t}tick(){return this.action(),NodeState.SUCCESS}}export class FailNode extends LeafNode{constructor(t){super(),this.action=t}tick(){return this.action(),NodeState.FAILURE}}export class ConditionNode extends LeafNode{constructor(t){super(),this.condition=t}tick(){return this.condition()?NodeState.SUCCESS:NodeState.FAILURE}}export class CompositeNode extends Node{constructor(){super(...arguments),this.children=[]}addChild(t){this.children.push(t)}}export class SequenceNode extends CompositeNode{constructor(){super(...arguments),this.current=0}tick(t){if(0===this.children.length)return this.reset(),NodeState.SUCCESS;const e=this.children[this.current].tick(t);if(e===NodeState.FAILURE)return this.reset(),NodeState.FAILURE;if(e===NodeState.SUCCESS){if(this.current==this.children.length-1)return this.reset(),NodeState.SUCCESS;this.current++}return NodeState.SUCCESS}reset(){this.current=0}}export class SelectorNode extends CompositeNode{tick(t){for(const e of this.children){const s=e.tick(t);if(s!==NodeState.FAILURE)return s}return NodeState.FAILURE}}export class DecoratorNode extends Node{constructor(t){super(),this.child=t}}export class InverterNode extends DecoratorNode{tick(t){const e=this.child.tick(t);return e===NodeState.SUCCESS?NodeState.FAILURE:e===NodeState.FAILURE?NodeState.SUCCESS:e}}export class RepeatTimesNode extends DecoratorNode{constructor(t,e=1/0){super(t),this.counter=0,this.limit=e}tick(t){for(;this.counter<this.limit;){if(this.child.tick(t)===NodeState.RUNNING)return NodeState.RUNNING;this.counter++}return this.counter=0,NodeState.SUCCESS}}export class RepeatNode extends DecoratorNode{constructor(t){super(t)}tick(t){return this.child.tick(t),NodeState.RUNNING}}export class RepeatUntilNode extends DecoratorNode{constructor(t,e){super(t),this.condition=e}tick(t){if(this.condition())return NodeState.SUCCESS;return this.child.tick(t)===NodeState.FAILURE?NodeState.FAILURE:NodeState.RUNNING}}export class RepeatUntilFailNode extends DecoratorNode{constructor(t){super(t)}tick(t){return this.child.tick(t)===NodeState.FAILURE?NodeState.FAILURE:NodeState.RUNNING}}export class DelayNode extends DecoratorNode{constructor(t,e){super(t),this.state=NodeState.RUNNING,this.elapsed=null,this.delay=e}tick(t){return null===this.elapsed&&(this.elapsed=0),this.elapsed+=1e3*t,this.elapsed>=this.delay&&(this.state=this.child.tick(t),this.state!==NodeState.RUNNING&&(this.elapsed=null)),this.state}}export class DelayAfterNode extends DecoratorNode{constructor(t,e){super(t),this.state=NodeState.RUNNING,this.elapsed=null,this.delay=e}tick(t){if(null==this.elapsed){if(this.state=this.child.tick(t),this.state===NodeState.RUNNING)return this.state;this.elapsed=0}return this.elapsed+=1e3*t,this.elapsed<this.delay?NodeState.RUNNING:(this.elapsed=null,this.state)}}export class WaitNode extends LeafNode{constructor(t,e){super(),this.delayMin=t,this.delayMax=e,this.elapsed=null,this.delay=this.delayMin,this.reset()}tick(t){return null===this.elapsed&&(this.elapsed=0),this.elapsed+=1e3*t,this.elapsed>=this.delay?(this.elapsed=null,this.reset(),NodeState.SUCCESS):NodeState.RUNNING}reset(){null!=this.delayMax?this.delay=(this.delayMax-this.delayMin)*Math.random()+this.delayMin:this.delay=this.delayMin}}export class CooldownNode extends DecoratorNode{constructor(t,e){super(t),this.cooldownTime=e,this.lastExecutionTime=null}tick(t){const e=Date.now();if(null===this.lastExecutionTime||e-this.lastExecutionTime>=this.cooldownTime){const s=this.child.tick(t);return s===NodeState.SUCCESS&&(this.lastExecutionTime=e),s}return NodeState.FAILURE}}export class TimerNode extends DecoratorNode{constructor(t,e){super(t),this.startTime=null,this.duration=e}tick(t){null===this.startTime&&(this.startTime=Date.now());return Date.now()-this.startTime<this.duration?this.child.tick(t):(this.startTime=null,NodeState.FAILURE)}}export class WeightedRandomSelectorNode extends CompositeNode{constructor(t){super(),this.weights=t,this.totalWeight=this.weights.reduce((t,e)=>t+e,0)}getRandomIndex(){let t=Math.random()*this.totalWeight;for(let e=0;e<this.weights.length;e++)if(t-=this.weights[e],t<=0)return e;return this.weights.length-1}tick(t){const e=this.getRandomIndex();return this.children[e].tick(t)}}export class GuardNode extends DecoratorNode{constructor(t,e){super(t),this.condition=e}tick(t){return this.condition()?this.child.tick(t):NodeState.FAILURE}}export class ParallelSelectorNode extends CompositeNode{tick(t){let e=!0;for(const s of this.children){const i=s.tick(t);if(i===NodeState.SUCCESS)return NodeState.SUCCESS;i===NodeState.RUNNING&&(e=!1)}return e?NodeState.FAILURE:NodeState.RUNNING}}export class ParallelSequenceNode extends CompositeNode{tick(t){let e=!0;for(const s of this.children){const i=s.tick(t);if(i===NodeState.FAILURE)return NodeState.FAILURE;i===NodeState.RUNNING&&(e=!1)}return e?NodeState.SUCCESS:NodeState.RUNNING}}export class ThrottleNode extends DecoratorNode{constructor(t,e){super(t),this.duration=e,this.timeSinceLastTick=0}tick(t){return 0===this.timeSinceLastTick||this.timeSinceLastTick>this.duration?(this.timeSinceLastTick=t,this.child.tick(this.timeSinceLastTick)):(this.timeSinceLastTick+=t,NodeState.RUNNING)}}/*
2
- * Copyright (©) 2025 Hology Interactive AB. All rights reserved.
2
+ * Copyright (©) 2026 Hology Interactive AB. All rights reserved.
3
3
  * See the LICENSE.md file for details.
4
4
  */
@@ -1,4 +1,4 @@
1
1
  import{Vector3 as t}from"three";import{LeafNode as e,NodeState as o}from"./bt";import{clamp as n}from"../../../utils/math";export class CharacterMoveToNode extends e{constructor(t,e){super(),this.navigation=t,this.movement=e,this.distanceFrom=.5}tick(t){const e=this.movement.actor.object.position,c=null!=this.target?this.target():null;if(null==c)return this.movement.directionInput.vector.set(0,0),o.FAILURE;if(e.distanceTo(c)<this.distanceFrom)return this.movement.directionInput.vector.set(0,0),o.SUCCESS;const{success:m,path:a}=this.navigation.findPath(e,c);if(!m||a.length<2)return o.FAILURE;const h=a[1],u=i.subVectors(h,e);u.y=0,u.normalize(),this.movement.actor.object.getWorldDirection(r).normalize();const l=r.angleTo(u);s.crossVectors(r,u);const v=s.y<0?-l:l;return this.movement.rotationInput.rotation.y+=n(v,-.1,.1),this.movement.directionInput.togglePositiveY(!0),o.RUNNING}}const i=new t,r=new t,s=new t;/*
2
- * Copyright (©) 2025 Hology Interactive AB. All rights reserved.
2
+ * Copyright (©) 2026 Hology Interactive AB. All rights reserved.
3
3
  * See the LICENSE.md file for details.
4
4
  */
@@ -1,4 +1,4 @@
1
1
  import{NavMeshCreateParams as e,Raw as t,RecastBuildContext as i,TriangleAreasArray as l,TrianglesArray as o,VerticesArray as r,allocCompactHeightfield as a,allocContourSet as s,allocHeightfield as n,allocPolyMesh as d,allocPolyMeshDetail as c,buildCompactHeightfield as h,buildContours as g,buildDistanceField as m,buildPolyMesh as u,buildPolyMeshDetail as b,buildRegions as f,calcGridSize as S,cloneRcConfig as R,createHeightfield as w,createNavMeshData as p,createRcConfig as C,erodeWalkableArea as M,filterLedgeSpans as _,filterLowHangingWalkableObstacles as x,filterWalkableLowHeightSpans as A,freeCompactHeightfield as k,freeContourSet as y,freeHeightfield as z,markWalkableTriangles as E,rasterizeTriangles as v,vec3 as T}from"@recast-navigation/core";import{dtIlog2 as B,dtNextPow2 as O}from"@recast-navigation/generators";import*as P from"three";export const buildConfig=({recastConfig:e,navMeshBounds:[t,i]})=>{const l=C(e),o=S(t,i,l.cs);l.width=o.width,l.height=o.height,l.minRegionArea=l.minRegionArea*l.minRegionArea,l.mergeRegionArea=l.mergeRegionArea*l.mergeRegionArea,l.tileSize=Math.floor(l.tileSize),l.borderSize=l.walkableRadius+3,l.width=l.tileSize+2*l.borderSize,l.height=l.tileSize+2*l.borderSize,l.detailSampleDist=l.detailSampleDist<.9?0:l.cs*l.detailSampleDist,l.detailSampleMaxError=l.ch*l.detailSampleMaxError;const r=Math.floor(l.tileSize),a=Math.floor((o.width+r-1)/r),s=Math.floor((o.height+r-1)/r),n=l.tileSize*l.cs,d=T.fromArray(t);let c=Math.min(Math.floor(B(O(a*s))),14);c>14&&(c=14);const h=22-c;return{config:l,orig:d,tileBits:c,polyBits:h,maxTiles:1<<c,maxPolysPerTile:1<<h,tcs:n,tileWidth:a,tileHeight:s}};export const buildTile=({positions:S,indices:C,navMeshBounds:T,recastConfig:B,tileX:O,tileY:H,tileBoundsMin:L,tileBoundsMax:G,keepIntermediates:D})=>{const $=new i,F=S,V=C.length,W=new r;W.copy(F);const I=C,K=C.length/3;(new o).copy(I);const X={tileX:O,tileY:H},Y=()=>{D||(X.compactHeightfield&&k(X.compactHeightfield),X.heightfield&&z(X.heightfield),X.contourSet&&y(X.contourSet))},N=e=>($.log(t.Module.RC_LOG_ERROR,e),Y(),{success:!1,error:e,tileIntermediates:X,buildContext:$}),{config:U}=buildConfig({recastConfig:B,navMeshBounds:T}),j=R(U),q=[...L],J=[...G];q[0]-=j.borderSize*j.cs,q[2]-=j.borderSize*j.cs,J[0]+=j.borderSize*j.cs,J[2]+=j.borderSize*j.cs,j.set_bmin(0,q[0]),j.set_bmin(1,q[1]),j.set_bmin(2,q[2]),j.set_bmax(0,J[0]),j.set_bmax(1,J[1]),j.set_bmax(2,J[2]),$.resetTimers(),$.startTimer(t.Module.RC_TIMER_TOTAL),$.log(t.Module.RC_LOG_PROGRESS,`Building tile at x: ${O}, y: ${H}`),$.log(t.Module.RC_LOG_PROGRESS,` - ${U.width} x ${U.height} cells`),$.log(t.Module.RC_LOG_PROGRESS,` - ${V/1e3}fK verts, ${K/1e3}K tris`);const Q=n();if(X.heightfield=Q,!w($,Q,j.width,j.height,q,J,j.cs,j.ch))return N("Could not create heightfield");const Z=((e,t,i)=>{const l=[],o=new P.Vector3,r=new P.Vector3,a=new P.Vector3,s=new P.Triangle;for(let n=0;n<t.length;n+=3){const d=t[n],c=t[n+1],h=t[n+2];o.fromArray(e,3*d),r.fromArray(e,3*c),a.fromArray(e,3*h),s.set(o,r,a),s.intersectsBox(i)&&l.push(d,c,h)}return l})(S,C,new P.Box3(new P.Vector3(q[0],q[1],q[2]),new P.Vector3(J[0],J[1],J[2]))),ee=Z.length/3,te=new o;te.copy(Z);const ie=new l;ie.resize(ee),E($,j.walkableSlopeAngle,W,V,te,ee,ie);const le=v($,W,V,te,ie,ee,Q,j.walkableClimb);if(ie.destroy(),!le)return N("Could not rasterize triangles");x($,j.walkableClimb,Q),_($,j.walkableHeight,j.walkableClimb,Q),A($,j.walkableHeight,Q);const oe=a();if(X.compactHeightfield=oe,!h($,j.walkableHeight,j.walkableClimb,Q,oe))return N("Could not build compact heightfield");if(D||(z(X.heightfield),X.heightfield=void 0),!M($,j.walkableRadius,oe))return N("Could not erode walkable area");if(!m($,oe))return N("Failed to build distance field");if(!f($,oe,j.borderSize,j.minRegionArea,j.mergeRegionArea))return N("Failed to build regions");const re=s();if(X.contourSet=re,!g($,oe,j.maxSimplificationError,j.maxEdgeLen,re,t.Module.RC_CONTOUR_TESS_WALL_EDGES))return N("Failed to create contours");const ae=d();if(!u($,re,j.maxVertsPerPoly,ae))return N("Failed to triangulate contours");const se=c();if(!b($,ae,oe,j.detailSampleDist,j.detailSampleMaxError,se))return N("Failed to build detail mesh");D||(k(oe),X.compactHeightfield=void 0,y(re),X.contourSet=void 0);for(let e=0;e<ae.npolys();e++)ae.areas(e)==t.Recast.WALKABLE_AREA&&ae.setAreas(e,0),0==ae.areas(e)&&ae.setFlags(e,1);const ne=new e;ne.setPolyMeshCreateParams(ae),ne.setPolyMeshDetailCreateParams(se),ne.setWalkableHeight(j.walkableHeight),ne.setWalkableRadius(j.walkableRadius),ne.setWalkableClimb(j.walkableClimb),ne.setCellSize(j.cs),ne.setCellHeight(j.ch),ne.setBuildBvTree(!0),ne.setTileX(O),ne.setTileY(H);const de=p(ne);return de.success?($.log(t.Module.RC_LOG_PROGRESS,`>> Polymesh: ${ae.nverts()} vertices ${ae.npolys()} polygons`),Y(),{success:!0,data:de.navMeshData,tileIntermediates:X,buildContext:$}):N("Failed to create Detour navmesh data")};/*
2
- * Copyright (©) 2025 Hology Interactive AB. All rights reserved.
2
+ * Copyright (©) 2026 Hology Interactive AB. All rights reserved.
3
3
  * See the LICENSE.md file for details.
4
4
  */
@@ -1,4 +1,4 @@
1
1
  import{NavMesh as t,NavMeshParams as s,Raw as e,UnsignedCharArray as i,recastConfigDefaults as o,statusToReadableString as n}from"recast-navigation";import{buildConfig as r,buildTile as a}from"./build-tile.js";import{Subject as h}from"rxjs";import{hasWorkerBuilder as l,createWorker as d}from"../../worker/index.js";import{hasSharedArrayBufferSupport as u}from"../../utils/buffer.js";const c=[];export class DynamicTiledNavMesh{constructor(e){this.navMeshVersion=0,this.onNavMeshUpdate=new h,this.workerRoundRobin=0;const i=e.navMeshBounds.min,n=e.navMeshBounds.max,a=[i.toArray(),n.toArray()],u=e.navMeshBounds.min;this.navMeshBoundsMin=i,this.navMeshBoundsMax=n,this.navMeshBounds=a,this.navMeshOrigin=u,this.cacheId=e.cacheId;const M={...o,...e.recastConfig};this.recastConfig=M;const f=new t,{tileWidth:v,tileHeight:m,tcs:g,maxPolysPerTile:w}=r({recastConfig:M,navMeshBounds:a});this.tileWidth=v,this.tileHeight=m,this.tcs=g;const B=s.create({orig:u,tileWidth:M.tileSize*M.cs,tileHeight:M.tileSize*M.cs,maxTiles:e.maxTiles,maxPolys:w});if(f.initTiled(B),this.navMesh=f,this.workers=[],l())for(let t=0;t<e.workers;t++){let t=c.pop();void 0===t&&(t=d()),t.onmessage=t=>{this.onResult(t)},this.workers.push(t)}}onResult(t){const{tileX:s,tileY:o,navMeshData:r}=t.data,a=new i;a.copy(r),this.navMesh.removeTile(this.navMesh.getTileRefAt(s,o,0));const h=this.navMesh.addTile(a,e.Module.DT_TILE_FREE_DATA,0);e.Detour.statusFailed(h.status)&&(console.error(e.Module.RC_LOG_WARNING,`Failed to add tile to nav mesh\n\ttx: ${s}, ty: ${o},status: ${n(h.status)} (${h.status})`),a.destroy()),this.navMeshVersion++,this.onNavMeshUpdate.next([this.navMeshVersion,[s,o]])}buildTile(t,s,[e,i],o=!0){const n=u&&t.buffer instanceof window.SharedArrayBuffer,r=n?t:new Float32Array(t),h=n?s:new Uint32Array(s),l={tileX:e,tileY:i,tileBoundsMin:[this.navMeshBoundsMin.x+e*this.tcs,this.navMeshBoundsMin.y,this.navMeshBoundsMin.z+i*this.tcs],tileBoundsMax:[this.navMeshBoundsMax.x+(e+1)*this.tcs,this.navMeshBoundsMax.y,this.navMeshBoundsMax.z+(i+1)*this.tcs],recastConfig:this.recastConfig,navMeshBounds:this.navMeshBounds,keepIntermediates:!1,positions:r,indices:h};if(this.workers.length>0){this.workerRoundRobin=++this.workerRoundRobin%this.workers.length;return this.workers[this.workerRoundRobin].postMessage(l,n?void 0:[r.buffer,h.buffer]),Promise.resolve()}return new Promise(t=>{requestIdleCallback(()=>{const s=this.cacheId+JSON.stringify({tileX:l.tileX,tileY:l.tileY});if(o){const e=localStorage.getItem(s);if(null!=e){const s=f(e);return this.onResult({data:{tileX:l.tileX,tileY:l.tileY,navMeshData:s}}),void t({})}}else localStorage.removeItem(s);const e=a(l);if(!e.success||!e.data)return;const i=e.data.toTypedArray();localStorage.setItem(s,M(i)),this.onResult({data:{tileX:l.tileX,tileY:l.tileY,navMeshData:i}}),t(e)})})}buildAllTiles(t,s){const{tileWidth:e,tileHeight:i}=this;for(let o=0;o<i;o++)for(let i=0;i<e;i++)this.buildTile(t,s,[i,o])}getTileForWorldPosition(t){return[Math.floor((t.x-this.navMeshBoundsMin.x)/this.tcs),Math.floor((t.z-this.navMeshBoundsMin.z)/this.tcs)]}getTilesForBounds(t){const s=this.getTileForWorldPosition(t.min),e=this.getTileForWorldPosition(t.max),i=[];for(let t=s[1];t<=e[1];t++)for(let o=s[0];o<=e[0];o++)i.push([o,t]);return i}destroy(){this.navMesh.destroy(),this.onNavMeshUpdate.complete();for(const t of this.workers)t.onmessage=null,c.push(t)}}const M=function(t){return btoa(String.fromCharCode(...t))},f=function(t){if(!t)return null;const s=atob(t),e=s.length,i=new Uint8Array(e);for(let t=0;t<e;t++)i[t]=s.charCodeAt(t);return i};/*
2
- * Copyright (©) 2025 Hology Interactive AB. All rights reserved.
2
+ * Copyright (©) 2026 Hology Interactive AB. All rights reserved.
3
3
  * See the LICENSE.md file for details.
4
4
  */
@@ -1,4 +1,4 @@
1
1
  import{init as t}from"recast-navigation";import{buildTile as e}from"./build-tile.js";let s=!1;const a=[];export function setupNavMeshWorker(){t().then(()=>{s=!0;for(const t of a)o(t)}),self.onmessage=t=>{s?o(t.data):a.push(t.data)}}const o=t=>{const s=e(t);if(!s.success||!s.data)return;const a=s.data.toTypedArray();s.data.destroy(),self.postMessage({tileX:t.tileX,tileY:t.tileY,navMeshData:a},[a.buffer])};/*
2
- * Copyright (©) 2025 Hology Interactive AB. All rights reserved.
2
+ * Copyright (©) 2026 Hology Interactive AB. All rights reserved.
3
3
  * See the LICENSE.md file for details.
4
4
  */
@@ -1,4 +1,4 @@
1
1
  export*from"./navigation.js";export*from"./behavior-tree/bt.js";export*from"./behavior-tree/move.js";/*
2
- * Copyright (©) 2025 Hology Interactive AB. All rights reserved.
2
+ * Copyright (©) 2026 Hology Interactive AB. All rights reserved.
3
3
  * See the LICENSE.md file for details.
4
4
  */
@@ -1,4 +1,4 @@
1
1
  import{__decorate as e,__metadata as t}from"tslib";import{NavMeshQuery as n}from"recast-navigation";import{Vector3 as s}from"three";import{inject as r,Service as o,World as i}from"../";import u,{safeRecastInit as a}from"../actors/builtin/navmesh-actor";let h=class{constructor(){this.world=r(i),a().then(()=>{const e=this.world.actors.find(e=>e instanceof u);null!=e&&(this.navMeshActor=e,this.query=null),this.world.actorAdded.subscribe(e=>{e instanceof u&&(this.navMeshActor=e,this.query=null)}),this.world.actorRemoved.subscribe(e=>{e instanceof u&&e.id===this.navMeshActor?.id&&(this.navMeshActor=null,this.query=null)})})}ensureQuery(){null==this.query&&null!=this.navMeshActor&&null!=this.navMeshActor.navMesh&&(this.query=new n(this.navMeshActor.navMesh))}findPath(e,t){if(this.ensureQuery(),null==this.query)return d("NavMesh has not been generated yet"),c;const n=this.findClosestPoint(e);if(null==n)return d("Start point could not be found on NavMesh",e),c;const{success:r,error:o,path:i}=this.query.computePath(n,t);return r?{success:!0,path:i.map(e=>new s(e.x,e.y,e.z))}:(d("Failed to generate path",o),c)}findClosestPoint(e){if(this.ensureQuery(),null==this.query)return d("NavMesh has not been generated yet"),null;const{success:t,point:n}=this.query.findClosestPoint(e);return t?new s(n.x,n.y,n.z):null}findRandomPoint(){if(this.ensureQuery(),null==this.query)return d("NavMesh has not been generated yet"),null;const e=this.query.findRandomPoint();return{success:e.success,randomPoint:(new s).copy(e.randomPoint)}}findRandomPointAroundCircle(e,t){if(this.ensureQuery(),null==this.query)return d("NavMesh has not been generated yet"),null;const n=this.query.findRandomPointAroundCircle(e,t);return{success:n.success,randomPoint:(new s).copy(n.randomPoint)}}};h=e([o(),t("design:paramtypes",[])],h);export{h as Navigation};const c={success:!1,path:[]};let l=new Set;function d(e,...t){l.has(e)||(l.add(e),setTimeout(()=>l.delete(e),2e3),console.warn(e,...t))}/*
2
- * Copyright (©) 2025 Hology Interactive AB. All rights reserved.
2
+ * Copyright (©) 2026 Hology Interactive AB. All rights reserved.
3
3
  * See the LICENSE.md file for details.
4
4
  */
@@ -1,4 +1,4 @@
1
1
  let t=0;class i{constructor(t,i){this.state=t,this.predicate=i}}const s={loop:!0};export class AnimationState{constructor(i,n=s){this.clip=i,this.options=n,this.uuid=t++,this.transitions=[],this.options={...s,...n}}named(t){return this.name=t,this}getAncestors(){return null!=this.parent?[this,...this.parent.getAncestors()]:[this]}getRoot(){return null!=this.parent?this.parent.getRoot():this}createChild(t,i){const s=new AnimationState(t);return s.parent=this,this.transitionsTo(s,i),s}split(t,i=null,s=null){return[this.createChild(i,t),this.createChild(s,e(t))]}transitionsTo(t,s=()=>!0){this.transitions.push(new i(t,s))}transitionsOnComplete(t,i){this.transitionsTo(t,t=>!!i&&i(t)||t>=this.clip.duration-.5)}transitionsBetween(t,i){this.transitionsTo(t,i),t.transitionsTo(this,e(i))}}export class AnimationStateMachine{constructor(t){this.initialState=t,this.timer=0,this.current=t}step(t){return this.timer+=t,this._getNext()}_getNext(t=1){const i=n(this.current.getRoot(),this.timer,this.current);return i.uuid!==this.current.uuid&&(this.timer=0,this.current=i),--t>0?this._getNext(t):this.current}}function n(t,i,s){for(const e of t.transitions)if(e.predicate(i))return n(e.state,e.state.uuid===s.uuid?i:0,s);return null==t.clip?t.getAncestors().find(t=>null!=t.clip)??t:t}const e=t=>i=>!t(i);/*
2
- * Copyright (©) 2025 Hology Interactive AB. All rights reserved.
2
+ * Copyright (©) 2026 Hology Interactive AB. All rights reserved.
3
3
  * See the LICENSE.md file for details.
4
4
  */
@@ -1,4 +1,4 @@
1
1
  import{AnimationClip as o,Vector3 as t}from"three";export class RootMotionClip extends o{constructor(){super(...arguments),this.displacement=0,this.fixedInPlace=!1}static fromClip(o,e=!1,n){const i=new RootMotionClip(o.name,o.duration,o.tracks.slice(),o.blendMode);if(i.fixedInPlace=e,i.rootBone=n,i.source=o,i.uuid=o.uuid,i.motionTrack=null!=n?o.tracks.find(o=>o.name===`${n.name}.position`):o.tracks.find(o=>o.name.endsWith(".position")),i.motionTrack){i.tracks.splice(i.tracks.indexOf(i.motionTrack),1);const o=(new t).fromArray(i.motionTrack.values,0),e=(new t).fromArray(i.motionTrack.values,i.motionTrack.values.length-3),n=i.motionTrack.clone();for(let o=0;o<i.motionTrack.values.length;o+=3)n.values[o+0]=0,n.values[o+2]=0;i.tracks.push(n),i.displacement=e.distanceTo(o)}else console.error("Could not find root motion track",o,n);return i}static fromClipWithDistance(o,t){const e=new RootMotionClip(o.name,o.duration,o.tracks.slice(),o.blendMode);return e.fixedInPlace=!0,e.source=o,e.uuid=o.uuid,e.displacement=t,e}clone(){const o=RootMotionClip.fromClip(this.source.clone(),this.fixedInPlace,this.rootBone);return o.displacement=this.displacement,o}}let e=53912381;export class BoneLayer{constructor(){this.uuid=e++,this.order=0,this.boneMask=[]}}/*
2
- * Copyright (©) 2025 Hology Interactive AB. All rights reserved.
2
+ * Copyright (©) 2026 Hology Interactive AB. All rights reserved.
3
3
  * See the LICENSE.md file for details.
4
4
  */
@@ -1,4 +1,4 @@
1
1
  export{};/*
2
- * Copyright (©) 2025 Hology Interactive AB. All rights reserved.
2
+ * Copyright (©) 2026 Hology Interactive AB. All rights reserved.
3
3
  * See the LICENSE.md file for details.
4
4
  */
@@ -1,4 +1,4 @@
1
1
  import"reflect-metadata";export{Container as DIContainer}from"typedi";export*from"./initiate.js";export*from"./inject.js";export{Service,Inject}from"typedi";export{ActorFactory}from"./actors/factory.js";export{Actor,BaseActor}from"./actors/actor.js";export{Component,ActorComponent,attach,Attach}from"./actors/component.js";export*from"./services/world.js";export*from"./services/render.js";export*from"./services/physics/physics-system.js";export*from"./animation/anim-sm.js";export*from"./animation/root-motion.js";export*from"./services/asset-loader.js";export*from"./services/pointer-events.js";export{VisualEffect}from"../effects/vfx/vfx-param.js";export*from"../shader/parameter.js";export*from"./ai/index.js";export*from"../effects/vfx";export*from"./services/shader-provider.js";/*
2
- * Copyright (©) 2025 Hology Interactive AB. All rights reserved.
2
+ * Copyright (©) 2026 Hology Interactive AB. All rights reserved.
3
3
  * See the LICENSE.md file for details.
4
4
  */
@@ -1,4 +1,4 @@
1
- import e from"typedi";import{loadScene as t}from"../scene/bootstrap.js";import{ActorFactory as s}from"./actors/factory.js";import{World as n}from"./services/world.js";import{SceneMaterializer as r}from"../scene/materializer.js";import{ViewController as o}from"./services/render.js";import{RenderingView as i}from"../rendering.js";import{PhysicsSystem as a}from"./services/physics/physics-system.js";import{MeshComponent as c}from"./actors/builtin/components/mesh-component.js";import{builtInComponents as m}from"./actors/builtin/components/index.js";import{activeContainerInstance as d}from"./actors/internal/container-map.js";import{InputService as l}from"./input/index.js";import{RuntimeAssetsService as p}from"../scene/runtime-asset-service.js";import{AssetResourceLoader as h}from"../scene/asset-resource-loader.js";import{AssetLoader as f}from"./services/asset-loader.js";import{polyfillClient as u}from"./polyfill.js";import{Subject as g}from"rxjs";import{PointerEvents as w}from"./services/pointer-events.js";import{RuntimeBundledBackendService as j}from"../scene/runtime-bundled-backend-service.js";import{Scene as v}from"three";import{ShaderProvider as b}from"./services/shader-provider.js";import{SceneDataService as S}from"../scene/scene-data-service.js";import{AssetsProvider as y}from"../scene/assets-provider.js";export function initiateGame(l,g){if(u(),0!=g.element.childNodes.length)return console.error("Can not initialize the game with a non-empty html element"),null;e.has(o);const I=e.of("default"),x=new HologyRuntime(I),D=new s(I,{inEditor:!1});var R;e.set(s,D),R=g.element,Object.assign(R.style,{position:"absolute",top:"0",left:"0",width:"100%",height:"100%",overflow:"hidden"});const A=new i(g.element,{enableXR:!0===g.xr?.enabled,maxPixelRatio:g.rendering?.maxPixelRatio,resolutionScale:g.rendering?.resolutionScale,bloom:{enabled:!1!==g?.rendering?.bloom?.enabled},reflection:{enabled:!1!==g?.rendering?.reflection?.enabled},shadows:{cascadeUpdateIntervals:[22,135,250,500]}});A.renderer.shadowMap.enabled=g.rendering?.shadows?.enabled??!0,A.renderer.shadowMap.autoUpdate=g.rendering?.shadows?.autoUpdate??!0,A.renderer.debug.checkShaderErrors=!1,e.set(i,A);const G=new o(A);e.set(o,G);const M=new j,O=new p(M),P=new h;P.setDataDir(g.dataDir),P.initKtx2(A.renderer);const z=Object.entries(g.shaders).map(([e,t])=>({name:e,type:t})),E=Object.entries(g.actors).map(([e,t])=>({name:e,type:t})),H={...m,...g.components??{}},U=Object.entries(H).map(([e,t])=>({name:e,type:t})),W=new b(z);e.set(b,W);const k=new f(P,O,z);e.set(y,this.assetsService),e.set(h,this.assetManagerService),e.set(f,k);const F=new v,N=new r(F,new S,O,P,A,z,E,D,U);e.set(r,N);const T=e.get(n);return e.set(n,T),T.materializer=N,(async()=>{const s=e.get(a);if(await s.start(),x.isShutdown)return;if(await M.preloadData(),x.isShutdown)return;T.scene=F;const{scene:n,actors:r}=await t(A,g.sceneName,g.dataDir,g.shaders,g.actors,H,D,M,O,P,{detailTier:g.detailTier});T.scene=n,s.scene=T.scene;for(const e of F.children)T.scene.add(e);if(x.isShutdown)return void A.stop();e.import([c]);for(const e of r)T.addActor(e);s.addFromScene(n),console.log("Start compile shaders"),console.time("compile shaders"),await A.compileAsync(),console.timeEnd("compile shaders"),console.log("Finished compile shaders. Programs: ",A.renderer.info.programs?.length??0),A.loop(e=>{}),x.status=5,x.shutdownStarted.subscribe(()=>{P.disposeAll()}),d.value=I,I.remove(l),I.set({id:l,type:l});const o=I.get(l);d.value=null,x.gameInstance=o,I.get(w).start(),o instanceof GameInstance&&await o.onStart(),x._resolver(!0)})(),x}export class GameInstance{onStart(){}onShutdown(){}}export function createHologyScene(){}export class HologyRuntime{constructor(e){this.containerInstance=e,this.status=0,this.isShutdown=!1,this.shutdownStarted=new g,this.ready=new Promise(e=>{this._resolver=e})}getWorld(){return this.containerInstance.get(n)}getService(e){return this.containerInstance.get(e)}shutdown(){this.isShutdown=!0;const e=this.shutdownStarted;e.next(),e.complete(),this.gameInstance instanceof GameInstance&&this.gameInstance.onShutdown(),this.containerInstance.get(l).stop();const t=this.containerInstance.get(i);t?.stop();const s=this.containerInstance.get(o);s.setMuted(!0),s.dispose();for(const e of this.getWorld().actors)this.getWorld().removeActor(e);this.containerInstance.get(a).stop(),this.containerInstance.get(r).dispose(),this.containerInstance.get(w).stop(),this.containerInstance.reset()}}/*
2
- * Copyright (©) 2025 Hology Interactive AB. All rights reserved.
1
+ import e from"typedi";import{loadScene as t}from"../scene/bootstrap.js";import{ActorFactory as s}from"./actors/factory.js";import{World as n}from"./services/world.js";import{SceneMaterializer as o}from"../scene/materializer.js";import{ViewController as r}from"./services/render.js";import{RenderingView as i}from"../rendering.js";import{PhysicsSystem as a}from"./services/physics/physics-system.js";import{MeshComponent as c}from"./actors/builtin/components/mesh-component.js";import{builtInComponents as m}from"./actors/builtin/components/index.js";import{activeContainerInstance as d}from"./actors/internal/container-map.js";import{InputService as l}from"./input/index.js";import{RuntimeAssetsService as p}from"../scene/runtime-asset-service.js";import{AssetResourceLoader as h}from"../scene/asset-resource-loader.js";import{AssetLoader as u}from"./services/asset-loader.js";import{polyfillClient as f}from"./polyfill.js";import{Subject as g}from"rxjs";import{PointerEvents as w}from"./services/pointer-events.js";import{RuntimeBundledBackendService as j}from"../scene/runtime-bundled-backend-service.js";import{Scene as b}from"three";import{ShaderProvider as v}from"./services/shader-provider.js";import{SceneDataService as S}from"../scene/scene-data-service.js";import{AssetsProvider as x}from"../scene/assets-provider.js";export function initiateGame(l,g){if(f(),0!=g.element.childNodes.length)return console.error("Can not initialize the game with a non-empty html element"),null;e.has(r);const y=e.of("default"),I=new HologyRuntime(y),D=new s(y,{inEditor:!1});var R;e.set(s,D),R=g.element,Object.assign(R.style,{position:"absolute",top:"0",left:"0",width:"100%",height:"100%",overflow:"hidden"});const A=new i(g.element,{enableXR:!0===g.xr?.enabled,maxPixelRatio:g.rendering?.maxPixelRatio,resolutionScale:g.rendering?.resolutionScale,bloom:{enabled:!1!==g?.rendering?.bloom?.enabled},reflection:{enabled:!1!==g?.rendering?.reflection?.enabled},shadows:{cascadeUpdateIntervals:[22,135,250,500]}});A.renderer.shadowMap.enabled=g.rendering?.shadows?.enabled??!0,A.renderer.shadowMap.autoUpdate=g.rendering?.shadows?.autoUpdate??!0,A.renderer.debug.checkShaderErrors=!1,e.set(i,A);const E=new r(A);e.set(r,E);const G=new j,O=new p(G),P=new h;P.setDataDir(g.dataDir),P.initKtx2(A.renderer);const z=Object.entries(g.shaders).map(([e,t])=>({name:e,type:t})),H=Object.entries(g.actors).map(([e,t])=>({name:e,type:t})),M={...m,...g.components??{}},T=Object.entries(M).map(([e,t])=>({name:e,type:t})),U=new v(z);e.set(v,U);const W=new u(P,O,z);e.set(x,O),e.set(h,P),e.set(u,W);const k=new b,F=new o(k,new S,O,P,A,z,H,D,T);e.set(o,F);const N=e.get(n);return e.set(n,N),N.materializer=F,(async()=>{const s=e.get(a);if(await s.start(),I.isShutdown)return;if(await G.preloadData(),I.isShutdown)return;N.scene=k;const{scene:n,actors:o}=await t(A,g.sceneName,g.dataDir,g.shaders,g.actors,M,D,G,O,P,{detailTier:g.detailTier});N.scene=n,s.scene=N.scene;for(const e of k.children)N.scene.add(e);if(I.isShutdown)return void A.stop();e.import([c]);for(const e of o)N.addActor(e);s.addFromScene(n),console.log("Start compile shaders"),console.time("compile shaders"),await A.compileAsync(),console.timeEnd("compile shaders"),console.log("Finished compile shaders. Programs: ",A.renderer.info.programs?.length??0),console.log("Start init scene textures"),console.time("init scene textures"),A.initTextures(),console.timeEnd("init scene textures"),A.loop(e=>{}),I.status=5,I.shutdownStarted.subscribe(()=>{P.disposeAll()}),d.value=y,y.remove(l),y.set({id:l,type:l});const r=y.get(l);d.value=null,I.gameInstance=r,y.get(w).start(),r instanceof GameInstance&&await r.onStart(),I._resolver(!0)})(),I}export class GameInstance{onStart(){}onShutdown(){}}export function createHologyScene(){}export class HologyRuntime{constructor(e){this.containerInstance=e,this.status=0,this.isShutdown=!1,this.shutdownStarted=new g,this.ready=new Promise(e=>{this._resolver=e})}getWorld(){return this.containerInstance.get(n)}getService(e){return this.containerInstance.get(e)}shutdown(){this.isShutdown=!0;const e=this.shutdownStarted;e.next(),e.complete(),this.gameInstance instanceof GameInstance&&this.gameInstance.onShutdown(),this.containerInstance.get(l).stop();const t=this.containerInstance.get(i);t?.stop();const s=this.containerInstance.get(r);s.setMuted(!0),s.dispose();for(const e of this.getWorld().actors)this.getWorld().removeActor(e);this.containerInstance.get(a).stop(),this.containerInstance.get(o).dispose(),this.containerInstance.get(w).stop(),this.containerInstance.reset()}}/*
2
+ * Copyright (©) 2026 Hology Interactive AB. All rights reserved.
3
3
  * See the LICENSE.md file for details.
4
4
  */
@@ -1,4 +1,6 @@
1
- import { Constructable, ContainerInstance } from 'typedi';
1
+ import { ContainerInstance } from 'typedi';
2
+ type Constructable<T> = abstract new (...args: any[]) => T;
2
3
  export declare function inject<T>(type: Constructable<T>): T;
3
4
  export declare function withInjectionContext<T>(containerInstance: ContainerInstance, fn: (diContainer: ContainerInstance) => T): T;
5
+ export {};
4
6
  //# sourceMappingURL=inject.d.ts.map
@@ -1,4 +1,4 @@
1
1
  import t from"typedi";import{activeContainerInstance as e}from"./actors/internal/container-map.js";export function inject(n){return e.value?.get(n)??t.get(n)}export function withInjectionContext(t,n){const o=e.value;e.value=t;const r=n(t);return e.value=o,r}/*
2
- * Copyright (©) 2025 Hology Interactive AB. All rights reserved.
2
+ * Copyright (©) 2026 Hology Interactive AB. All rights reserved.
3
3
  * See the LICENSE.md file for details.
4
4
  */
@@ -1,4 +1,4 @@
1
1
  export*from"./input-service.js";export*from"./input.js";export*from"./keybind.js";/*
2
- * Copyright (©) 2025 Hology Interactive AB. All rights reserved.
2
+ * Copyright (©) 2026 Hology Interactive AB. All rights reserved.
3
3
  * See the LICENSE.md file for details.
4
4
  */
@@ -1,4 +1,4 @@
1
1
  import{__decorate as e}from"tslib";import{Service as t}from"typedi";import{inject as s}from"../inject.js";import{ViewController as i}from"../services/render.js";let n=class{constructor(){this.view=s(i),this.inputs=new Map,this.deltaCallbacks=new Map,this.toggleCallbacks=new Map,this.keybinds=new Map,this.mousebinds=new Map,this.touchmoveBinds=new Map,this.wheelbinds=new Map,this.onKeyDown=e=>{this.view.paused||this.keybinds.forEach((t,s)=>{for(const i of t)if(i.test(e))if(this.inputs.has(s))this.inputs.get(s)(!0);else if(this.toggleCallbacks.has(s)){this.toggleCallbacks.get(s)(!0);this.activeToggleCallbacks.findIndex(e=>e.keybind===i&&e.toggle===this.toggleCallbacks.get(s))<0&&this.activeToggleCallbacks.push({keybind:i,toggle:this.toggleCallbacks.get(s)})}else console.warn("No input callback for registered for key bind "+i.display())})},this.activeToggleCallbacks=[],this.onKeyUp=e=>{this.keybinds.forEach((t,s)=>{for(const i of t)if(i.test(e))if(this.inputs.has(s))this.inputs.get(s)(!1);else if(this.toggleCallbacks.has(s)){this.toggleCallbacks.get(s)(!1);const e=this.activeToggleCallbacks.findIndex(e=>e.keybind===i&&e.toggle===this.toggleCallbacks.get(s));e>=0&&this.activeToggleCallbacks.splice(e,1);for(const e of this.activeToggleCallbacks)e.toggle(!0)}else console.warn("No input callback for registered for key bind "+i.display())})},this.onMouseMove=e=>{if(this.view.paused)return;(null!=document.pointerLockElement||null!=document.mozPointerLockElement)&&this.mousebinds.forEach((t,s)=>{const i=this.inputs.get(s)??this.deltaCallbacks.get(s);if(null!=i)switch(t.axis){case"x":i(e.movementX*t.multiplier);break;case"y":i(e.movementY*t.multiplier)}else console.warn("No input callback for registered for mouse bind "+t.axis)})},this.onTouchStart=e=>{if(!this.view.paused){for(let t=0;t<=e.touches.length;t++){const s=e.touches[t];if(s.target instanceof HTMLCanvasElement)return void(this.prevTouchEvent=s)}e.preventDefault()}},this.onTouchMove=e=>{if(this.view.paused)return;if(null==this.prevTouchEvent)return;let t=null;for(let s=0;s<=e.touches.length;s++){const i=e.touches[s];i&&i.target instanceof HTMLCanvasElement&&i.identifier===this.prevTouchEvent.identifier&&(t=i)}this.debug.innerText=t.clientX-this.prevTouchEvent.clientX+"",this.touchmoveBinds.forEach((e,s)=>{const i=this.inputs.get(s)??this.deltaCallbacks.get(s);if(null!=i)switch(e.axis){case"x":i((t.clientX-this.prevTouchEvent.clientX)*e.multiplier);break;case"y":i((t.clientY-this.prevTouchEvent.clientY)*e.multiplier)}else console.warn("No input callback for registered for mouse bind "+e.axis)}),this.prevTouchEvent=t,e.preventDefault()},this.onTouchEnd=e=>{this.prevTouchEvent=null,e.preventDefault()},this.onWheel=e=>{this.view.paused||this.wheelbinds.forEach((t,s)=>{const i=this.inputs.get(s)??this.deltaCallbacks.get(s);null!=i?i(e.deltaY*t.multiplier):console.warn("No input callback for registered for wheel bind")})},this.debug=document.createElement("div")}start(){document.addEventListener("keydown",this.onKeyDown),document.addEventListener("mousedown",this.onKeyDown),document.addEventListener("mouseup",this.onKeyUp),document.addEventListener("keyup",this.onKeyUp),document.addEventListener("mousemove",this.onMouseMove),this.view.htmlElement.addEventListener("touchstart",this.onTouchStart,{passive:!1}),this.view.htmlElement.addEventListener("touchmove",this.onTouchMove,{passive:!1}),this.view.htmlElement.addEventListener("touchend",this.onTouchEnd,{passive:!1}),document.addEventListener("wheel",this.onWheel),this.debug.style.top="40%",this.debug.style.position="absolute",this.debug.style.color="black"}stop(){document.removeEventListener("keydown",this.onKeyDown),document.removeEventListener("mousedown",this.onKeyDown),document.removeEventListener("mouseup",this.onKeyUp),document.removeEventListener("keyup",this.onKeyUp),document.removeEventListener("mousemove",this.onMouseMove),this.view.htmlElement.removeEventListener("touchstart",this.onTouchStart),this.view.htmlElement.removeEventListener("touchmove",this.onTouchMove),this.view.htmlElement.removeEventListener("touchend",this.onTouchEnd),document.removeEventListener("wheel",this.onWheel)}bind(e,t){this.inputs.set(e,t)}bindToggle(e,t){this.toggleCallbacks.set(e,t)}bindDelta(e,t){this.deltaCallbacks.set(e,t)}unbind(e){this.inputs.delete(e),this.toggleCallbacks.delete(e),this.deltaCallbacks.delete(e)}setKeybind(e,t){this.keybinds.has(e)||this.keybinds.set(e,[]),this.keybinds.get(e).push(t)}setMousebind(e,t){this.mousebinds.set(e,t)}setTouchMoveBind(e,t){this.touchmoveBinds.set(e,t)}setWheelbind(e,t){this.wheelbinds.set(e,t)}removeKeybind(e){this.keybinds.delete(e)}removeMousebind(e){this.mousebinds.delete(e)}removeWheelbind(e){this.wheelbinds.delete(e)}};n=e([t()],n);export{n as InputService};/*
2
- * Copyright (©) 2025 Hology Interactive AB. All rights reserved.
2
+ * Copyright (©) 2026 Hology Interactive AB. All rights reserved.
3
3
  * See the LICENSE.md file for details.
4
4
  */
@@ -1,4 +1,4 @@
1
1
  import{Euler as t,Vector2 as i}from"three";import{ArrayMap as s}from"../../utils/collections.js";import{clamp as e}from"../../utils/math.js";export class AxisInput{constructor(){this.vector=new i,this.togglePositiveY=t=>{this.vector.y=t?1:Math.min(this.vector.y,0)},this.toggleNegativeY=t=>{this.vector.y=t?-1:Math.max(this.vector.y,0)},this.togglePositiveX=t=>{this.vector.x=t?1:Math.min(this.vector.x,0)},this.toggleNegativeX=t=>{this.vector.x=t?-1:Math.max(this.vector.x,0)}}get horizontal(){return this.vector.x}get vertical(){return this.vector.y}}class o{constructor(){this.map=new s}emit(t){this.map.get(t).forEach(t=>t())}add(t,i){this.map.push(t,i)}}export class ActionInput{constructor(){this.emitter=new o,this.activated=!1,this.toggle=t=>{t&&!this.activated?this.emitter.emit("start"):!t&&this.activated&&this.emitter.emit("end"),this.activated=t}}onStart(t){this.emitter.add("start",t)}onEnd(t){this.emitter.add("end",t)}}export class ToggleInput{constructor(t){this.emitter=new o,this.activated=!1,this.toggle=t=>{t||(this.activated=!this.activated,this.activated?this.emitter.emit("start"):this.emitter.emit("end"))},this.activated=t}onStart(t){this.emitter.add("start",t)}onEnd(t){this.emitter.add("end",t)}}const h=2*Math.PI;export class RotationInput{constructor(){this.rotation=new t,this.rotateX=t=>{this.rotation.x=(this.rotation.x+t)%h},this.rotateY=t=>{this.rotation.y=(this.rotation.y+t)%h},this.rotateZ=t=>{this.rotation.z=(this.rotation.z+t)%h}}}export class RestrictedRotationInput extends RotationInput{constructor(i=-1/0,s=1/0,o=-1/0,h=1/0,a=-1/0,r=1/0){super(),this.minX=i,this.maxX=s,this.minY=o,this.maxY=h,this.minZ=a,this.maxZ=r,this.rotation=new t,this.rotateX=t=>{this.rotation.x=e(this.rotation.x+t,this.minX,this.maxX)},this.rotateY=t=>{this.rotation.y=e(this.rotation.y+t,this.minY,this.maxY)},this.rotateZ=t=>{this.rotation.z=e(this.rotation.z+t,this.minZ,this.maxZ)}}}export class DecimalInput{constructor(t=0,i,s){this.min=i,this.max=s,this.increment=t=>{this.value=e(this.value+t,this.min,this.max)},this.value=t}}/*
2
- * Copyright (©) 2025 Hology Interactive AB. All rights reserved.
2
+ * Copyright (©) 2026 Hology Interactive AB. All rights reserved.
3
3
  * See the LICENSE.md file for details.
4
4
  */
@@ -1,4 +1,4 @@
1
1
  const t=navigator.platform.toUpperCase().indexOf("MAC")>=0?"⌘":"Ctrl",i=["MouseLeft","MouseMiddle","MouseRight"];export class Keybind{constructor(t,i,s){this.key=t,this.shift=i,this.ctrl=s}test(t){const s=!(null!=this.shift&&"Shift"!==this.key&&this.shift!==t.shiftKey||null!=this.ctrl&&"Control"!==this.key&&this.ctrl!=t.ctrlKey);return"key"in t?t.key.toLowerCase()===this.key.toLowerCase()&&s:i[t.button]===this.key&&s}display(){return(this.shift?"⇧ + ":"")+(this.ctrl?t+" + ":"")+this.key}}export class Mousebind{constructor(t=1,i=!1,s="x"){this.sensitivity=t,this.flipped=i,this.axis=s}get multiplier(){return(this.flipped?-1:1)*this.sensitivity}}export class Wheelbind{constructor(t=1,i=!1){this.sensitivity=t,this.flipped=i}get multiplier(){return(this.flipped?-1:1)*this.sensitivity}}/*
2
- * Copyright (©) 2025 Hology Interactive AB. All rights reserved.
2
+ * Copyright (©) 2026 Hology Interactive AB. All rights reserved.
3
3
  * See the LICENSE.md file for details.
4
4
  */
@@ -1,4 +1,4 @@
1
1
  export function polyfillClient(){window.requestIdleCallback=window.requestIdleCallback||function(n){const e=Date.now();return setTimeout(function(){n({didTimeout:!1,timeRemaining:function(){return Math.max(0,50-(Date.now()-e))}})},1)},window.cancelIdleCallback=window.cancelIdleCallback||function(n){clearTimeout(n)}}/*
2
- * Copyright (©) 2025 Hology Interactive AB. All rights reserved.
2
+ * Copyright (©) 2026 Hology Interactive AB. All rights reserved.
3
3
  * See the LICENSE.md file for details.
4
4
  */
@@ -1,4 +1,4 @@
1
1
  import{__decorate as e,__metadata as t}from"tslib";import{AudioLoader as s,LoadingManager as a,TextureLoader as r}from"three";import{FBXLoader as i,GLTFLoader as o,MTLLoader as n,OBJLoader as h,TGALoader as d}from"three-stdlib";import{KTX2Loader as l}from"three/examples/jsm/Addons.js";import{Service as c}from"typedi";import{AssetResourceLoader as u}from"../../scene/asset-resource-loader.js";import{applyMaterial as g}from"../../scene/materializer";import{materialFromAsset as w}from"../../scene/materializer.js";import{Prefab as f}from"../../scene/objects/prefab.js";import{pathJoin as m}from"../../utils/files.js";let y=class{constructor(e,t,c){this.assetResourceLoader=e,this.assetService=t,this.shaders=c,this.baseUrl="",this.urlSuffix="",this.loadingManager=new a,this.glbLoader=new o(this.loadingManager),this.fbxLoader=new i(this.loadingManager),this.objLoader=new h(this.loadingManager),this.mtlLoader=new n(this.loadingManager),this.tgaLoader=new d(this.loadingManager),this.ktx2Loader=new l(this.loadingManager),this.textureLoader=new r(this.loadingManager),this.audioLoader=new s(this.loadingManager)}resolvePath(e){return m(this.baseUrl,e)+this.urlSuffix}getAudioAtPath(e){const t=this.resolvePath(e);return this.audioLoader.loadAsync(t)}async getAudioByAssetId(e){const t=await this.assetService.getAsset(e);if(null==t)throw new Error(`No audio could be found with asset id ${e}`);return this.assetResourceLoader.getAudio(t)}async getAudioByAssetName(e){const t=await this.assetService.getAsset(e);if(null==t)throw new Error(`No audio could be found with asset name ${e}`);return this.assetResourceLoader.getAudio(t)}async getModelAtPath(e){const t=this.resolvePath(e);switch(e.split(".").pop().toLowerCase()){case"glb":case"gltf":return(await this.glbLoader.loadAsync(t)).scene;case"fbx":return this.fbxLoader.loadAsync(t);case"obj":return this.objLoader.loadAsync(t);default:throw new Error(`File suffix is not supperted in file ${e}`)}}async getGltfAtPath(e){const t=this.resolvePath(e);return this.glbLoader.loadAsync(t)}async getModelByAssetName(e){const t=(await this.assetService.getAssets()).find(t=>t.name===e);if(null==t)throw new Error(`No model could be found with asset name ${e}`);const s=await this.assetResourceLoader.getMesh(t);return this.applyMaterials(t,s.scene),s}async getModelByAssetId(e){const t=await this.assetService.getAsset(e);if(null==t)throw new Error(`No model could be found with asset id ${e}`);const s=await this.assetResourceLoader.getMesh(t);return this.applyMaterials(t,s.scene),s}async applyMaterials(e,t){for(const s of e.materialAssignments??[])await g(t,s,async e=>this.getMaterialByAssetId(e))}async getTextureByAssetName(e){const t=(await this.assetService.getAssets()).find(t=>t.name===e);if(null==t)throw new Error(`No texture could be found with asset name ${e}`);return this.assetResourceLoader.getTexture(t)}async getTextureByAssetId(e){const t=await this.assetService.getAsset(e);if(null==t)throw new Error(`No texture could be found with asset id ${e}`);return this.assetResourceLoader.getTexture(t)}async getMaterialByAssetId(e){const t=await this.assetService.getAsset(e);if(null==t)throw new Error(`No material could be found with asset id ${e}`);return w(t,null,this.assetService,this.assetResourceLoader,this.shaders,!1)}async getAsset(e){return this.assetService.getAsset(e)}async getPrefabByName(e){const t=(await this.assetService.getAssets()).find(t=>t.name===e);if("prefab"!==t.type)throw`Asset with name ${e} is not a prefab`;return new f(t)}async getPrefabById(e){const t=await this.getAsset(e);if("prefab"!==t.type)throw`Asset with name ${name} is not a prefab`;return new f(t)}};y=e([c(),t("design:paramtypes",[u,Function,Array])],y);export{y as AssetLoader};/*
2
- * Copyright (©) 2025 Hology Interactive AB. All rights reserved.
2
+ * Copyright (©) 2026 Hology Interactive AB. All rights reserved.
3
3
  * See the LICENSE.md file for details.
4
4
  */
@@ -1,4 +1,4 @@
1
1
  export class AbstractPhysicsSystem{}/*
2
- * Copyright (©) 2025 Hology Interactive AB. All rights reserved.
2
+ * Copyright (©) 2026 Hology Interactive AB. All rights reserved.
3
3
  * See the LICENSE.md file for details.
4
4
  */
@@ -1,4 +1,4 @@
1
1
  export{};/*
2
- * Copyright (©) 2025 Hology Interactive AB. All rights reserved.
2
+ * Copyright (©) 2026 Hology Interactive AB. All rights reserved.
3
3
  * See the LICENSE.md file for details.
4
4
  */
@@ -1,4 +1,4 @@
1
1
  import{__decorate as t,__metadata as e}from"tslib";import*as i from"@dimforge/rapier3d-compat";import{QueryFilterFlags as s}from"@dimforge/rapier3d-compat";import{BehaviorSubject as o,distinctUntilChanged as n,filter as r,map as a,Subject as l,takeUntil as c}from"rxjs";import*as d from"three";import{ArrowHelper as h,BufferAttribute as y,BufferGeometry as u,Group as p,LineSegments as g,Matrix4 as m,Object3D as f,Quaternion as w,Raycaster as B,Scene as x,Vector3 as b}from"three";import{Service as v}from"typedi";import{AssetMeshInstance as C}from"../../../scene/asset-resource-loader.js";import{BoxCollisionShape as A,CapsuleCollisionShape as S,CollisionShapeSource as R,ConeCollisionShape as D,ConvexPolyhedronCollisionShape as z,CylinderCollisionShape as T,PhysicalShapeMesh as E,PlaneCollisionShape as M,SphereCollisionShape as P,TrimeshCollisionShape as V}from"../../../index.js";import{LandscapeGroup as _}from"../../../scene/landscape/landscape.js";import{ViewController as F}from"../render.js";import{World as I}from"../world.js";import*as k from"three/examples/jsm/utils/BufferGeometryUtils.js";import{calculateEffectiveScale as W}from"../../../utils/three/traverse.js";import{AbstractPhysicsSystem as N}from"./abstract-physics-system.js";import{ActorComponent as j,Component as L}from"../../../gameplay/actors/component.js";import{inject as O}from"../../../gameplay/inject.js";export{Component,ActorComponent,attach,Attach}from"../../actors/component.js";export class RayTestResult{constructor(){this.hasHit=!1,this.hitPoint=new b,this.hitNormal=new b}}export class ShapeCastResult{constructor(){this.hasHit=!1,this.hitPoint=new b,this.normal=new b}reset(){this.actor=void 0,this.hasHit=!1,this.distance=0,this.hitPoint.set(0,0,0),this.normal.set(0,0,0)}}ShapeCastResult.shared=new ShapeCastResult;export var PhysicsBodyType;!function(t){t[t.dynamic=1]="dynamic",t[t.static=2]="static",t[t.kinematic=4]="kinematic",t[t.kinematicVelocityBased=8]="kinematicVelocityBased"}(PhysicsBodyType||(PhysicsBodyType={}));const G=new b,K=new b,U=new w,q=new w,H=(new w,[]);let Q=class extends N{set showDebug(t){this.shouldRenderDebug=t,this.debugMesh&&(this.debugMesh.visible=t)}get showDebug(){return this.shouldRenderDebug}constructor(){super(),this.staticMeshes=new Map,this.staticBodies=new Map,this.actorBodies=new Map,this.bodyActors=new Map,this.colliders=new Map,this.collisionEvents=new l,this.beforeStep=new l,this.afterStep=new l,this.shouldRenderDebug=!1,this.viewController=O(F),this.shapeCacheBox=new Map,this.shapeCacheBall=new Map,this._raycaster=new B,this._reusableResult=new RayTestResult,this._raytestDiff=new b,this._raytestDirection=new b,this.controlledActors=new Set,this.ready=this.setup()}getBallShape(t){let e=this.shapeCacheBall.get(t);return null==e&&(e=new i.Ball(t),this.shapeCacheBall.set(t,e)),e}getBoxShape(t,e,s){const o=t+1e6*e+1e12*s;let n=this.shapeCacheBox.get(o);return null==n&&(n=new i.Cuboid(t,e,s),this.shapeCacheBox.set(o,n)),n}hasBoxIntersection(t){const e=t.getCenter(G),i=t.getSize(K),s=this.getBoxShape(i.x/2,i.y/2,i.z/2);return null!=this.world.intersectionWithShape(e,U,s)}hasSphereIntersection(t){const e=this.getBallShape(t.radius);return null!=this.world.intersectionWithShape(t.center,U,e)}findActorsInRadius(t,e,i){const s=this.getBallShape(e),o=[];for(const[e,n]of this.bodyActors)if(n instanceof i||null==i)for(let i=0,r=e.numColliders();i<r;i++){e.collider(i).intersectsShape(s,t,U)&&o.push(n)}return o}createDebugMesh(){return new g(new u,new d.LineBasicMaterial({color:255}))}async start(){return await this.ready,this.handleTick(),this.handleCollisionEvents(),this.ready}handleCollisionEvents(){this.collisionSub=this.collisionEvents.subscribe(t=>{const e=this.colliders.get(t.handle1);if(null==e)return;const i=this.world.getCollider(t.handle2);if(null==i||null==i.parent())return;const s=this.bodyActors.get(i.parent());null!=s&&(t.started?e.onBeginOverlapActor.next({actor:s}):e.onEndOverlapActor.next({actor:s}))})}renderDebug(){if(null==this.scene)return;null==this.debugMesh&&(this.debugMesh=this.createDebugMesh(),this.debugMesh.visible=this.shouldRenderDebug,this.debugMesh.raycast=function(){},this.scene?.add(this.debugMesh));const t=this.world.debugRender().vertices,e=this.debugMesh.geometry,i=e.getAttribute("position");null==i||(i.array.length,t.length);{const i=new y(t,3);i.setUsage(d.DynamicDrawUsage),e.setAttribute("position",i)}e.setDrawRange(0,t.length/3)}async setup(){if(null!=this.rapier)throw new Error("Rapier is already estup");this.rapier=await rt(),this.eventQueue=new this.rapier.EventQueue(!0),this.setupWorld()}handleTick(){this.fixedupdateSub=this.viewController.onUpdate().subscribe(t=>{t=Math.min(.1,t),this.beforeStep.next(t),this.updatePhysics(t),this.showDebug&&this.renderDebug(),this.world.bodies.forEach(t=>{if(t.isFixed())return;const e=this.staticMeshes.get(t)??this.bodyActors.get(t)?.object;null!=e&&e.parent instanceof x&&(ct(e.position,t.translation()),(t.isDynamic()||t.isKinematic()&&!this.controlledActors.has(this.bodyActors.get(t)?.id))&&dt(e.quaternion,t.rotation()),e.matrixWorldNeedsUpdate=!0)}),this.afterStep.next(t)})}_updateWorld(){this.world.timestep=0,this.world.step()}updatePhysics(t){this.world.timestep=t,this.world.step(this.eventQueue),this.eventQueue.drainCollisionEvents((t,e,i)=>{this.collisionEvents.next({handle1:t,handle2:e,started:i}),this.collisionEvents.next({handle1:e,handle2:t,started:i})})}rayTestFromCamera(t,e,i){this._raycaster.setFromCamera(st,this.viewController.getCamera());const s=this._raycaster.ray.origin,o=this._raycaster.ray.direction.multiplyScalar(t).add(s);return this.rayTest(s,o,e,i)}rayTest(t,e,i,s){null==i&&(i=this._reusableResult);const o=this._raytestDiff,n=this._raytestDirection;if(o.subVectors(e,t),n.copy(o).normalize(),0===n.length())return console.warn("Ray test called with to and from being equal"),i;at(mt.origin,t),at(mt.dir,n);const r=o.length(),a=this.world.castRayAndGetNormal(mt,r,!1,void 0,s?.collisionFilter,void 0,null!=s?.excludeActor?this.actorBodies.get(s.excludeActor.id):void 0,s?.excludeTriggers?t=>!t.isSensor():void 0);if(i.hasHit=null!=a,i.hasHit){const e=mt.pointAt(a.timeOfImpact);i._internal=a,ct(i.hitNormal,a.normal),ct(i.hitPoint,e),i.distance=yt.subVectors(i.hitPoint,t).length();const s=this.world.bodies.getAll().find(t=>function(t,e){for(let i=0,s=t.numColliders();i<s;i++){const s=t.collider(i);if(e(s))return s}}(t,t=>t===a.collider));i.actor=null!=s?this.bodyActors.get(s):null}if(this.showDebug){let e;H.length>0?(e=H.pop(),e.setDirection(n),e.position.copy(t),e.setLength(r,.2,.1),e.setColor(s?.debugColor??255)):e=new h(n,t,r,s?.debugColor??255),this.scene?.add(e),setTimeout(()=>{this.scene?.remove(e),H.push(e)},s?.debugLifetime??200)}return i}setGravity(t,e,i){this.world.gravity.x=t,this.world.gravity.y=e,this.world.gravity.z=i}getGravity(){return J.set(this.world.gravity.x,this.world.gravity.y,this.world.gravity.z)}addFromScene(t){this.addRecursively(t);for(const t of this.staticBodies.values())ht(t,t=>t.setActiveEvents(i.ActiveEvents.COLLISION_EVENTS))}addRecursively(t){if(this.removeSceneObject(t),!function(t){if(null!=t.userData?.src){const e=t.userData?.src;return"actor"===e.type}return!1}(t))if(t instanceof E&&null!=t.collisionShape){const e=this.createStaticBody(t,[t.collisionShape],t.physics);this.staticMeshes.set(e,t),this.staticBodies.set(t,e)}else if(t instanceof C){const e=!1!==t.userData?.src?.collisionDetection;if(t.children[0]&&(t.children[0].instanceMatrix&&e||t.children[0].isBatchedMesh))this.createForInstancedMesh(t.children[0],t.collisionShapes);else if(e){const e=this.createStaticBody(t,t.collisionShapes,t.physics);this.staticMeshes.set(e,t),this.staticBodies.set(t,e)}}else t instanceof _?this.addLandscapeGroup(t):(t instanceof p||t instanceof x)&&t.children.forEach(t=>this.addRecursively(t))}createForInstancedMesh(t,e){const i=new m;if(t instanceof d.BatchedMesh){const e=t._instanceInfo??t._drawInfo,s=new Map;for(let o=0;o<e.length;o++){if(null!=t.userData.hasCollision&&!t.userData.hasCollision[o])continue;let e=t.userData.collisionShapes?.[o];if(null==e&&t.parent instanceof C&&(e=t.parent.collisionShapes),null==e)continue;let n=s.get(e);null==n&&(n=this.instancedShapeReset(e),s.set(e,n));const r=new f;r.matrix.identity(),t.getMatrixAt(o,i),r.applyMatrix4(i);this.createStaticBody(r,n)}}else{const s=this.instancedShapeReset(e);for(let e=0;e<t.count;e++){if(null!=t.userData.hasCollision&&!t.userData.hasCollision[e])continue;const o=new f;o.matrix.identity(),i.fromArray(t.instanceMatrix.array,16*e),o.applyMatrix4(i);this.createStaticBody(o,s)}}}instancedShapeReset(t){return t.filter(t=>null!=t).map(t=>t.source===R.rendered?t.withOffset(wt):t)}getCharacterController(t){return this.world?.createCharacterController(t)}getActorComputedMovement(t,e,i,o=null){const n=this.actorBodies.get(t.id);this.controlledActors.add(t.id);const r=n.collider(0);e.computeColliderMovement(r,i,s.EXCLUDE_SENSORS,o,pt);const a=e.computedMovement();return ct(ut,a),ut}createCollider(t,e){const i=this.addShape(e?.body,t),s=new PhysicsCollider(i,this.world);return this.colliders.set(i.handle,s),s.disposed.subscribe(()=>{this.colliders.delete(i.handle)}),s}createBody(t=PhysicsBodyType.dynamic,e={}){const s=(()=>{switch(t){case PhysicsBodyType.dynamic:return i.RigidBodyDesc.dynamic();case PhysicsBodyType.static:return i.RigidBodyDesc.fixed();case PhysicsBodyType.kinematic:return i.RigidBodyDesc.kinematicPositionBased();case PhysicsBodyType.kinematicVelocityBased:return i.RigidBodyDesc.kinematicVelocityBased();default:return i.RigidBodyDesc.dynamic()}})();e.position&&s.setTranslation(e.position.x,e.position.y,e.position.z),e.rotation&&s.setRotation({x:e.rotation.x,y:e.rotation.y,z:e.rotation.z,w:e.rotation.w}),"boolean"==typeof e.canSleep&&s.setCanSleep(e.canSleep),"boolean"==typeof e.ccdEnabled&&s.setCcdEnabled(e.ccdEnabled),"number"==typeof e.gravityScale&&s.setGravityScale(e.gravityScale),"number"==typeof e.mass&&s.setAdditionalMass(e.mass),void 0!==e.userData&&(s.userData=e.userData);const o=this.world.createRigidBody(s);return new PhysicsBody(o,this.world)}getCharacterComputedMovement(t,e,i,o=null){const n=t.collider;e.computeColliderMovement(n,i,s.EXCLUDE_SENSORS,o,pt);const r=e.computedMovement();return ct(ut,r),ut}setNextKinematicTranslation(t,e){const i=this.actorBodies.get(t.id),s=i.translation();s.x+=e.x,s.y+=e.y,s.z+=e.z,i?.setNextKinematicTranslation(s)}setNextKinematicPosition(t,e){this.actorBodies.get(t.id).setNextKinematicTranslation(e)}setNextKinematicRotation(t,e){this.actorBodies.get(t.id).setNextKinematicRotation(e)}setNextKinematicTransform(t){!function(t,e){const i=e.getWorldPosition(X),s=e.getWorldQuaternion(Y);t.setNextKinematicTranslation(ot(i)),t.setNextKinematicRotation(nt(s))}(this.actorBodies.get(t.id),t.object)}setAngularVelocity(t,e){const i=this.actorBodies.get(t.id);tt.x=e.x,tt.y=e.y,tt.z=e.z,i?.setAngvel(tt,!0)}setLinearVelocity(t,e){const i=this.actorBodies.get(t.id);tt.x=e.x,tt.y=e.y,tt.z=e.z,i?.setLinvel(tt,!0)}getLinearVelocity(t,e=new b){const i=this.actorBodies.get(t.id).linvel();return e.x=i.x,e.y=i.y,e.z=i.z,e}getAngularVelocity(t,e=new b){const i=this.actorBodies.get(t.id).angvel();return e.x=i.x,e.y=i.y,e.z=i.z,e}setLinearDamping(t,e){const i=this.actorBodies.get(t.id);i?.setLinearDamping(e)}getLienarDamping(t){const e=this.actorBodies.get(t.id);return e?.linearDamping()??0}setAngularDamping(t,e){const i=this.actorBodies.get(t.id);i?.setAngularDamping(e)}getAngularDamping(t){const e=this.actorBodies.get(t.id);e?.angularDamping()}setPosition(t,e){const i=this.actorBodies.get(t.id);i?.setTranslation(ot(e),!1)}getPosition(t,e=new b){const i=this.actorBodies.get(t.id);i&&ct(e,i.translation())}setRotation(t,e){const i=this.actorBodies.get(t.id);i?.setTranslation(nt(e),!1)}getRotation(t,e=new w){const i=this.actorBodies.get(t.id);i&&dt(e,i.rotation())}lockTranslations(t,e){const i=this.actorBodies.get(t.id);i?.lockTranslations(e,!1)}lockRotations(t,e){const i=this.actorBodies.get(t.id);i?.lockRotations(e,!1)}setEnabledTranslations(t,e,i,s){const o=this.actorBodies.get(t.id);o?.setEnabledTranslations(e,i,s,!1)}setEnabledRotations(t,e,i,s){const o=this.actorBodies.get(t.id);o?.setEnabledRotations(e,i,s,!1)}addLandscapeGroup(t){const e=t.userData.src,s=e.landscape.heightMaps;for(const n of t.sections){this.staticBodies.has(n)&&this.world.removeRigidBody(this.staticBodies.get(n));var o=n.getWorldPosition(new b);if(e.landscape.holes&&e.landscape.holes.some(t=>t.m===n.name&&0!==t.w[0])){const t=n.geometry.clone(),s=n.scale,r=n.geometry.getAttribute("hole"),a=new Float32Array(t.getAttribute("position").array);for(let t=0;t<a.length;t+=3)a[t]*=s.x,a[t+1]*=s.y,a[t+2]*=s.z;const l=t.index;for(let t=0;t<l.count;t+=3){const e=r.getX(l.getX(t)),i=r.getX(l.getY(t)),s=r.getX(l.getZ(t));(e>.5||i>.5||s>.5)&&(l.setX(t,0),l.setY(t,0),l.setZ(t,0))}const c=i.ColliderDesc.trimesh(a,new Uint32Array(t.getIndex().array));if(!1!==e.collisionDetection){const t=this.world.createRigidBody(i.RigidBodyDesc.fixed()),e=new i.Vector3(0,0,0);at(e,o),t.setTranslation(e,!1),this.world.createCollider(c,t),this.staticBodies.set(n,t)}continue}const t=e.landscape.options.density+1,r=e.landscape.options.sectionSize,a=new Array(t);for(let e=0;e<t;e++)a[e]=new Array(t).fill(0);const l=s.find(t=>t.x===n.x&&t.y==n.y);if(null!=l)for(const e of l.points){if(null==a[e.i%t])continue;const i=t-1-Math.floor(e.i/t);i in a[e.i%t]?a[e.i%t][i]=e.y/r:console.warn("wrong index",{points:a,point:e,i:e.i%t,k:i,heightMap:l})}const c=e.landscape.options.density,d=a.flatMap(t=>t.reverse()),h=i.ColliderDesc.heightfield(c,c,new Float32Array(d),new i.Vector3(r,r,r));if(!1!==e.collisionDetection){const t=this.world.createRigidBody(i.RigidBodyDesc.fixed()),e=new i.Vector3(0,0,0);at(e,o),t.setTranslation(e,!1),this.world.createCollider(h,t),this.staticBodies.set(n,t)}}}setEnabled(t,e){const i=this.actorBodies.get(t.id);i?.setEnabled(e)}addActor(t,e,s={}){if(0==e.length)return void console.error("No collision shapes were defined when adding actor to the physics system.");this.removeActor(t);const o=t.object;let n;switch(s.type??PhysicsBodyType.static){case PhysicsBodyType.dynamic:n=i.RigidBodyDesc.dynamic(),n.mass=s.mass??1;break;case PhysicsBodyType.kinematic:n=i.RigidBodyDesc.kinematicPositionBased();break;case PhysicsBodyType.kinematicVelocityBased:n=i.RigidBodyDesc.kinematicVelocityBased();break;default:n=s.isTrigger?i.RigidBodyDesc.kinematicVelocityBased():i.RigidBodyDesc.fixed()}const r=this.world.createRigidBody(n);r.enableCcd(1==s.continousCollisionDetection);for(const t of e)this.addShape(r,t,o);return ht(r,t=>{null!=s.isTrigger&&(t.setSensor(s.isTrigger),t.setActiveCollisionTypes(i.ActiveCollisionTypes.ALL),t.setActiveEvents(i.ActiveEvents.COLLISION_EVENTS)),null!=s.friction&&t.setFriction(s.friction),null!=s.density&&t.setDensity(s.density),null!=s.mass&&t.setMass(s.mass),null!=s.restitution&&t.setRestitution(s.restitution)}),Z(r,o),!0===s.ignoreForNavMesh&&(r.userData={ignoreForNavMesh:!0}),this.actorBodies.set(t.id,r),this.bodyActors.set(r,t),new PhysicsBody(r,this.world)}applyTorque(t,e){const i=this.actorBodies.get(t.id);tt.x=e.x,tt.y=e.y,tt.z=e.z,i?.addTorque(tt,!0)}applyTorqueImpulse(t,e){const i=this.actorBodies.get(t.id);tt.x=e.x,tt.y=e.y,tt.z=e.z,i?.applyTorqueImpulse(tt,!0)}resetForces(t){const e=this.actorBodies.get(t.id);e?.resetForces(!1)}resetTorques(t){const e=this.actorBodies.get(t.id);e?.resetTorques(!1)}applyForce(t,e){const i=this.actorBodies.get(t.id);tt.x=e.x,tt.y=e.y,tt.z=e.z,i?.addForce(tt,!0)}applyImpulse(t,e){const i=this.actorBodies.get(t.id);tt.x=e.x,tt.y=e.y,tt.z=e.z,i?.applyImpulse(tt,!0)}applyLocalForce(t,e,i){const s=this.actorBodies.get(t.id);at(tt,e),null==i?s?.addForce(tt,!0):(at(et,i),s?.addForceAtPoint(tt,et,!0))}applyLocalImpulse(t,e,i){const s=this.actorBodies.get(t.id);at(tt,e),null==i?s.applyImpulse(tt,!0):(at(et,i),s.applyImpulseAtPoint(tt,et,!0))}applyRadiusImpulse(t,e,s){this.world.bodies.forEach(o=>{if(o.collider(0)?.isSensor())return;if(o.bodyType()!==i.RigidBodyType.Dynamic)return;const n=it;ct(n,o.translation());const r=n.clone().sub(t);if(r.length()>e)return;const a=r.clone().normalize().multiplyScalar(s);tt.x=a.x,tt.y=a.y,tt.z=a.z,o.applyImpulse(tt,!0)})}removeActor(t){if(null==t)return;this.controlledActors.delete(t.id);const e=this.actorBodies.get(t.id);null!=e&&(this.bodyActors.delete(e),this.world.removeRigidBody(e)),this.actorBodies.delete(t.id)}removeRemoved(t){if(null==t)return;const e=new Set;t.traverse(t=>{e.add(t.uuid)});for(const[t,i]of this.staticBodies.entries())e.has(t.uuid)&&this.world.getRigidBody(i.handle)&&(this.staticBodies.delete(t),this.world.removeRigidBody(i))}removeSceneObject(t){if(t instanceof _){for(const e of t.sections)this.removeSceneObject(e);return}let e=this.staticBodies.get(t);null!=e&&this.world.getRigidBody(e.handle)&&this.world.removeRigidBody(e),this.staticBodies.delete(t)}activateActorEvents(t){this.actorBodies.get(t.id)}_onCollisionWithActorEvent(t,e,i){return this.activateActorEvents(t),this.collisionEvents.pipe(c(t.disposed),r(({started:t})=>t===i),a(({handle1:t,handle2:e,started:i})=>({a1:this.bodyActors.get(this.world.getCollider(t)?.parent()),a2:this.bodyActors.get(this.world.getCollider(e)?.parent()),started:i})),r(({a1:i,a2:s})=>null!=i&&null!=s&&i.id===t.id&&e(i,s)),a(({a2:t})=>t))}onBeginContact(t){return this.activateActorEvents(t),this.collisionEvents.pipe(c(t.disposed),r(t=>t.started),r(({handle1:e})=>{const i=this.bodyActors.get(this.world.getCollider(e)?.parent());return null!=i&&i.id===t.id}),a(t=>t.handle2))}onEndContact(t){return this.activateActorEvents(t),this.collisionEvents.pipe(c(t.disposed),r(t=>!t.started),r(({handle1:e})=>{const i=this.bodyActors.get(this.world.getCollider(e)?.parent());return null!=i&&i.id===t.id}),a(t=>t.handle2))}onHasContactChanged(t){const e=new Set,i=new o(!1);return this.onBeginContact(t).subscribe(t=>{e.add(t),i.next(e.size>0)}),this.onEndContact(t).subscribe(t=>{e.delete(t),i.next(e.size>0)}),i.pipe(n())}onBeginOverlapWithActorType(t,e){return this._onCollisionWithActorEvent(t,(t,i)=>i instanceof e,!0)}onEndOverlapWithActorType(t,e){return this._onCollisionWithActorEvent(t,(t,i)=>i instanceof e,!1)}onBeginOverlapWithActor(t,e){return this._onCollisionWithActorEvent(t,(t,i)=>e.id===i.id,!0)}onEndOverlapWithActor(t,e){return this._onCollisionWithActorEvent(t,(t,i)=>e.id===i.id,!1)}onCollisionWithActor(t,e){return this.onBeginOverlapWithActor(t,e)}onCollisionWithActorType(t,e){return this.onBeginOverlapWithActorType(t,e)}updateActorTransform(t){const e=this.actorBodies.get(t.id);null!=e&&Z(e,t.object)}setupWorld(){const t=new this.rapier.World({x:0,y:-9.81,z:0});this.world=t}sphereCast(t,e,i,s,o=ShapeCastResult.shared,n){o.reset();const r=this.getBallShape(e);this.shapeCacheBall.get;const a={x:t.x,y:t.y,z:t.z},l={x:i.x,y:i.y,z:i.z},c=n?.excludeActor?this.actorBodies.get(n.excludeActor.id):null,d=this.world.castShape(a,{x:0,y:0,z:0,w:1},l,r,.01,s,!0,null,n?.collisionFilter??void 0,null,c,n?.excludeTriggers?t=>!t.isSensor():void 0);if(null!=d){ct(o.hitPoint,d.witness1),o.normal.set(d.normal1.x,d.normal1.y,d.normal1.z),o.distance=d.time_of_impact,o.hasHit=!0;const t=d.collider.parent();if(t){const e=this.bodyActors.get(t);e&&(o.actor=e)}}return o}castActorShape(t,e,i,s=ShapeCastResult.shared,o=void 0){s.reset();const n=this.actorBodies.get(t.id);if(n&&n.numColliders()>0){for(let t=0;t<n.numColliders();t++){const r=n.collider(t);let a=r.shape,l=r.translation(),c=r.rotation(),d=e,h=i;const y=this.world.castShape(l,c,d,a,.01,h,!0,null,o,null,n,void 0);if(null!=y){y.collider;const t=r;return ct(s.hitPoint,y.witness1),Bt(t.rotation(),y.normal1,s.normal,q),s.distance=y.time_of_impact,s.actor=this.bodyActors.get(y.collider.parent()),s.hasHit=!0,s}}return s}return console.warn("Actor is not added to the physics system"),s}stop(){this.world?.bodies.forEach(t=>this.world.removeRigidBody(t)),this.world?.free(),this.fixedupdateSub?.unsubscribe(),this.collisionSub?.unsubscribe(),H.length=0}createStaticBody(t,e,s){const o=s?.type===PhysicsBodyType.dynamic?i.RigidBodyDesc.dynamic():i.RigidBodyDesc.fixed();o.setSleeping(!0);const n=this.world.createRigidBody(o);for(const i of e){if(null==i){console.warn("Collision shape is missing for object",t);continue}const o=this.addShape(n,i,t);null!=s?.friction&&o.setFriction(s.friction),null!=s?.density&&o.setDensity(s.density),null!=s?.mass&&o.setMass(s.mass/e.length),null!=s?.restitution&&o.setRestitution(s.restitution)}return Z(n,t),n.userData=t.uuid,n.sleep(),n}addShape(t=void 0,e,i){const s=i?.getWorldScale(gt)??$,o=this.createShape(e,s);this.applyShapeSettings(o,e);const n=e.offset.clone().multiply(s);at(o.translation,n);const r=(new w).setFromEuler(e.rotation);e instanceof z&&e.mesh instanceof d.Mesh&&r.multiply(e.mesh.getWorldQuaternion(Y)),lt(o.rotation,r);return this.world.createCollider(o,t)}applyShapeSettings(t,e){null!=e.collisionGroup&&t.setCollisionGroups(e.collisionGroup),t.friction=e.friction??.1,null!=e.restitution&&(t.restitution=e.restitution),null!=e.density&&(t.density=e.density,t.massPropsMode=i.MassPropsMode.Density),null!=e.mass&&(t.mass=e.mass,t.massPropsMode=i.MassPropsMode.Mass)}createShape(t,e){if(t instanceof A)return i.ColliderDesc.cuboid(t.dimensions.x*e.x/2,t.dimensions.y*e.y/2,t.dimensions.z*e.z/2);if(t instanceof S){return i.ColliderDesc.capsule(t.length/2*e.y,t.radius*Math.max(e.z,e.x))}if(t instanceof V){const s=null!=t.geometry.getIndex()?t.geometry:k.mergeVertices(t.geometry),o=extractFloat32Array(s.getAttribute("position"));for(let t=0;t<o.length;t+=3)o[t]*=e.x,o[t+1]*=e.y,o[t+2]*=e.z;return i.ColliderDesc.trimesh(o,new Uint32Array(s.getIndex().array))}if(t instanceof z){let s;t.mesh instanceof d.Mesh?s=t.mesh.geometry:t.mesh instanceof d.BufferGeometry?s=t.mesh:console.log("Unknownd shape",{shapeInfo:t});const o=extractFloat32Array(s.getAttribute("position"));if(t.mesh instanceof d.Mesh){const e=W(t.mesh);for(let t=0;t<o.length;t+=3)o[t]*=e.x,o[t+1]*=e.y,o[t+2]*=e.z}for(let t=0;t<o.length;t+=3)o[t]*=e.x,o[t+1]*=e.y,o[t+2]*=e.z;const n=o;n.length;return i.ColliderDesc.convexHull(n)}if(t instanceof P){const s=2*e.x-e.y-e.z;return Math.abs(s)>.01?this.createShape(new z(new d.SphereGeometry(t.radius).scale(e.x,e.y,e.z)),new b(1,1,1)):i.ColliderDesc.ball(t.radius*Math.max(e.x,e.y,e.z))}return t instanceof T?i.ColliderDesc.cylinder(t.height/2*e.y,t.radiusTop*Math.max(e.z,e.x)):t instanceof D?i.ColliderDesc.cone(t.height*e.y,t.radiusBottom/2*Math.max(e.z,e.x)):t instanceof M?i.ColliderDesc.cuboid(t.width/2*e.x,t.height/2*e.y,.001):(console.error("Unsupported shape",t),i.ColliderDesc.cuboid(1,1,1))}createCharacterCollision(){return new i.CharacterCollision}};Q=t([v(),e("design:paramtypes",[])],Q);export{Q as PhysicsSystem};const X=new b,Y=new d.Quaternion;function Z(t,e){const i=e.getWorldPosition(X),s=e.getWorldQuaternion(Y);t.setTranslation(ot(i),!1),t.setRotation(nt(s),!1)}const J=new b,$=new b(1,1,1),tt=new i.Vector3(0,0,0),et=new i.Vector3(0,0,0),it=new b,st=new d.Vector2;function ot(t){return at(tt,t),tt}function nt(t){return lt(q,t),q}const rt=async()=>{let t=await import("@dimforge/rapier3d-compat");return await t.init(),t};function at(t,e){t.x=e.x,t.y=e.y,t.z=e.z}function lt(t,e){t.x=e.x,t.y=e.y,t.z=e.z,t.w=e.w}function ct(t,e){t.x=e.x,t.y=e.y,t.z=e.z}function dt(t,e){t.x=e.x,t.y=e.y,t.z=e.z,t.w=e.w}function ht(t,e){for(let i=0,s=t.numColliders();i<s;i++){e(t.collider(i))}}const yt=new b,ut=new b,pt=t=>!t.isSensor(),gt=new b;const mt=new i.Ray(new i.Vector3(0,0,0),new i.Vector3(0,1,0));let ft=class extends j{constructor(){super(...arguments),this._active=!0,this.physics=O(Q),this.world=O(I)}set active(t){this._active=t,t?(this.world.scene.remove(this.actor.object),this.physics.setEnabled(this.actor,t)):(this.world.scene.add(this.actor.object),this.physics.setEnabled(this.actor,t))}get active(){return this._active}};ft=t([L()],ft);export function extractFloat32Array(t){const e=t.itemSize,i=t.count,s=new Float32Array(i*e);for(let o=0;o<i;o++)for(let i=0;i<e;i++)s[o*e+i]=t.getComponent(o,i);return s}const wt=new b;function Bt(t,e,i,s){return s.set(t.x,t.y,t.z,t.w),i.set(e.x,e.y,e.z),i.applyQuaternion(s),i}export class PhysicsCollider{constructor(t,e){this.collider=t,this.world=e,this.disposed=new l,this.onBeginOverlapActor=new l,this.onEndOverlapActor=new l}dispose(){this.world.removeCollider(this.collider,!1),this.disposed.next(!0),this.disposed.complete(),this.onBeginOverlapActor.complete(),this.onEndOverlapActor.complete()}set mass(t){this.collider.setMass(t)}get mass(){return this.collider.mass()}set friction(t){this.collider.setFriction(t)}get friction(){return this.collider.friction()}set restitution(t){this.collider.setRestitution(t)}get restitution(){return this.collider.restitution()}set density(t){this.collider.setDensity(t)}get density(){return this.collider.density()}set isTrigger(t){this.collider.setSensor(t)}get isTrigger(){return this.collider.isSensor()}set collisionGroups(t){this.collider.setCollisionGroups(t)}get collisionGroups(){return this.collider.collisionGroups()}set enabled(t){this.collider.setEnabled(t)}get enabled(){return this.collider.isEnabled()}}export class PhysicsBody{constructor(t,e){this.body=t,this.world=e}dispose(){this.world.removeRigidBody(this.body)}setEnabled(t){this.body.setEnabled(t)}isEnabled(){return this.body.isEnabled()}getPosition(t){const e=this.body.translation();return t.set(e.x,e.y,e.z),t}setPosition(t){this.body.setTranslation({x:t.x,y:t.y,z:t.z},!0)}getRotation(t){const e=this.body.rotation();return t.set(e.x,e.y,e.z,e.w),t}setRotation(t){this.body.setRotation({x:t.x,y:t.y,z:t.z,w:t.w},!0)}getLinearVelocity(t){const e=this.body.linvel();return t.set(e.x,e.y,e.z),t}setLinearVelocity(t){this.body.setLinvel({x:t.x,y:t.y,z:t.z},!0)}getAngularVelocity(t){const e=this.body.angvel();return t.set(e.x,e.y,e.z),t}setAngularVelocity(t){this.body.setAngvel({x:t.x,y:t.y,z:t.z},!0)}applyImpulse(t,e=!0){this.body.applyImpulse({x:t.x,y:t.y,z:t.z},e)}applyTorqueImpulse(t,e=!0){this.body.applyTorqueImpulse({x:t.x,y:t.y,z:t.z},e)}setNextKinematicPosition(t){this.body.setNextKinematicTranslation(t)}setNextKinematicRotation(t){this.body.setNextKinematicRotation(t)}setType(t){this.body.setBodyType(function(t){switch(t){case PhysicsBodyType.dynamic:return i.RigidBodyType.Dynamic;case PhysicsBodyType.static:return i.RigidBodyType.Fixed;case PhysicsBodyType.kinematic:return i.RigidBodyType.KinematicPositionBased;case PhysicsBodyType.kinematicVelocityBased:return i.RigidBodyType.KinematicVelocityBased}}(t),t!==PhysicsBodyType.static)}setGravityScale(t){this.body.setGravityScale(t,!1)}getGravityScale(){return this.body.gravityScale()}isDynamic(){return this.body.isDynamic()}isKinematic(){return this.body.isKinematic()}isStatic(){return this.body.isFixed()}sleep(){this.body.sleep()}wakeUp(){this.body.wakeUp()}}/*
2
- * Copyright (©) 2025 Hology Interactive AB. All rights reserved.
2
+ * Copyright (©) 2026 Hology Interactive AB. All rights reserved.
3
3
  * See the LICENSE.md file for details.
4
4
  */
@@ -1,4 +1,4 @@
1
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"../inject.js";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
- * Copyright (©) 2025 Hology Interactive AB. All rights reserved.
2
+ * Copyright (©) 2026 Hology Interactive AB. All rights reserved.
3
3
  * See the LICENSE.md file for details.
4
4
  */
@@ -1,4 +1,4 @@
1
1
  import{__decorate as e,__metadata as t}from"tslib";import{Service as i}from"typedi";import{Camera as s}from"three";import{RenderingView as n}from"../../rendering.js";import{BehaviorSubject as r,Observable as o,Subject as a,takeUntil as h}from"rxjs";import*as u from"three";let d=class{constructor(e){this.view=e,this.tick=new a,this.lateTick=new a,this.audioListener=new u.AudioListener,this.pausedChanged=new r(!1),this.mutedChanged=new r(!1),this._muted=!1,this.activeTimers=new Map,this.nextTimerId=0,this.outlined=[],e.onLoop(e=>{this.tick.next(e),this.lateTick.next(e)}),e.camera.add(this.audioListener),window.hology_view=this}set fpsCap(e){this.view.fpsCap=e}get fpsCap(){return this.view.fpsCap}set showStats(e){this.view.showStats=e}get showStats(){return this.view.showStats}addPostProcessVolume(e){this.view.addPostProcessVolume(e)}removePostProcessVolume(e){this.view.removePostProcessVolume(e)}onUpdate(e){return null!=e&&this.tick.pipe(h(e.disposed)),this.tick}onLateUpdate(e){return null!=e&&this.lateTick.pipe(h(e.disposed)),this.lateTick}setCamera(e){const t=e instanceof s?e:e.camera.instance;this.view.setCamera(t),t.add(this.audioListener)}getCamera(){return this.view.camera}setMuted(e){this._muted=e,this.audioListener.gain.gain.setValueAtTime(e?0:1,this.audioListener.context.currentTime),this.mutedChanged.next(e)}getMuted(){return this._muted}setOutlined(e){this.outlined.length=0;const t=this.outlined;for(let i=0;i<e.length;i++)t[i]=e[i];this.view.setSelectedObjects(t),this.view.setEnableOutlines(e.length>0)}getOutlined(){return this.outlined}addOutlined(e){this.outlined.includes(e)||(this.outlined.push(e),this.view.setSelectedObjects(this.outlined),this.view.setEnableOutlines(!0))}removeOutlined(e){const t=this.outlined.indexOf(e);-1!==t&&(this.outlined.splice(t,1),this.view.setSelectedObjects(this.outlined))}setOutlineColor(e){this.view.outlinePass?.visibleEdgeColor.copy(e)}getOutlineColor(){return this.view.outlinePass?.visibleEdgeColor}setOutlineThickness(e){this.view.outlinePass.edgeThickness=e}getOutlineThickness(){return this.view.outlinePass.edgeThickness}get htmlElement(){return this.view.container}get paused(){return this.view.paused}set paused(e){e!=this.paused&&(e?this.pauseRendering():this.unpauseRendering())}pauseRendering(){this.view.paused=!0,this.pausedChanged.next(this.view.paused);for(const[e,t]of this.activeTimers){clearTimeout(t.timeoutId);const e=Date.now()-t.startTime;t.remainingMs=Math.max(0,t.remainingMs-e)}}unpauseRendering(){this.view.paused=!1,this.pausedChanged.next(this.view.paused);for(const[e,t]of this.activeTimers)t.remainingMs>0&&(t.timeoutId=setTimeout(()=>{t.subscriber.next(),t.subscriber.complete(),this.activeTimers.delete(e)},t.remainingMs),t.startTime=Date.now())}dispose(){this.view.running&&this.view.stop(),this.audioListener.removeFromParent(),this.tick.complete(),this.lateTick.complete(),this.paused=!0}createTimer(e){const t=this.nextTimerId++;return new o(i=>{const s=Date.now(),n=setTimeout(()=>{i.next(),i.complete(),this.activeTimers.delete(t)},e);return this.activeTimers.set(t,{timeoutId:n,remainingMs:e,startTime:s,subscriber:i}),()=>{clearTimeout(n),this.activeTimers.delete(t)}})}getScreenPosition(e,t=c){const i=this.getCamera();return l.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),i instanceof u.PerspectiveCamera&&(m.setFromProjectionMatrix(l),!m.containsPoint(e))?null:(t.copy(e),t.project(i),t.x=(t.x+1)/2*this.htmlElement.clientWidth,t.y=(1-t.y)/2*this.htmlElement.clientHeight,t)}};d=e([i(),t("design:paramtypes",[n])],d);export{d as ViewController};const l=new u.Matrix4,c=new u.Vector3,m=new u.Frustum;/*
2
- * Copyright (©) 2025 Hology Interactive AB. All rights reserved.
2
+ * Copyright (©) 2026 Hology Interactive AB. All rights reserved.
3
3
  * See the LICENSE.md file for details.
4
4
  */
@@ -1,4 +1,4 @@
1
1
  import{__decorate as r,__metadata as t}from"tslib";import{Service as s}from"typedi";let e=class{constructor(r=[]){this.shaders=r}get(r){return this.shaders.find(t=>t.name===r)}};e=r([s(),t("design:paramtypes",[Array])],e);export{e as ShaderProvider};/*
2
- * Copyright (©) 2025 Hology Interactive AB. All rights reserved.
2
+ * Copyright (©) 2026 Hology Interactive AB. All rights reserved.
3
3
  * See the LICENSE.md file for details.
4
4
  */
@@ -1,4 +1,4 @@
1
1
  import{__decorate as t}from"tslib";import{Service as r}from"typedi";import{BaseActor as e}from"../actors/actor.js";import{ActorFactory as o}from"../actors/factory.js";import{Vector3 as i}from"three";import{ActorComponent as s}from"../../gameplay/actors/component.js";import{Subject as n}from"rxjs";import{RenderingView as c}from"../../rendering.js";import{randomUUID as a}from"../../utils/uuid";import{PrefabInstance as h}from"../../scene/objects/prefab";import{PhysicsSystem as m}from"./physics/physics-system.js";import{inject as p}from"../../gameplay/inject.js";const l=new i;class f{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?l:this.view.csm.lights[0].position}}let d=class{constructor(){this.actorFactory=p(o),this.view=p(c),this.physics=p(m),this.actors=[],this.actorAdded=new n,this.actorRemoved=new n,this.directionalLight=new f(this.view)}async spawnActor(t,r,e){if(null==t)throw new Error("Cannot spawn actor with null type");if("prefab"in t){const o=await this.spawnPrefab(t.prefab,r,e),i=o.mainActor;if(null==i)throw new Error(`Prefab has no main actor or there was an error when spwaning it. Prefab: ${JSON.stringify(t.prefab)}`);return i.disposed.subscribe(()=>this.removePrefab(o)),i}const o=await this.actorFactory.create(t,r,e);return this.addActor(o,r,e),o}addActor(t,r,e){r&&t.object.position.copy(r),e&&t.object.rotation.copy(e),null==t.object.parent&&this.scene.add(t.object),this.actors.push(t),y(t,t=>t.onBeginPlay()),this.actorAdded.next(t)}removeActor(t){y(t,t=>t.onEndPlay());const r=this.actors.indexOf(t);r>=0&&this.actors.splice(r,1),t.object.removeFromParent(),t.disposed.next(!0),this.actorRemoved.next(t),this.physics.removeActor(t)}findActorByType(t,r){return this.actors.find(e=>e instanceof t&&(null==r||e.object.name==r))}findActorsByType(t,r){return this.actors.filter(e=>e instanceof t&&(null==r||e.object.name==r))}async spawnPrefab(t,r,e){if(null==this.materializer)return console.error("Internal error: Materializer is missing on World"),null;const o=new h,{object:i,actors:s,mainActor:n}=await this.materializer.createFromPrefabAsset(t.asset,{sceneObjectChain:["r-"+a()]},void 0,void 0,!1);return o.object=i,o.actors=s,o.mainActor=n,this.scene.add(i),null!=r&&i.position.copy(r),null!=e&&i.rotation.copy(e),s.forEach(t=>{this.addActor(t)}),this.physics.addFromScene(i),o}removePrefab(t){t.actors.forEach(t=>this.removeActor(t)),t.object?.removeFromParent(),this.physics.removeRemoved(t.object)}};d=t([r()],d);export{d as World};function y(t,r){return r(t),t instanceof e&&t.attachedComponents.forEach(t=>{y(t,r)}),Object.entries(t).filter(([t,r])=>r instanceof s).forEach(([t,e])=>{y(e,r)})}/*
2
- * Copyright (©) 2025 Hology Interactive AB. All rights reserved.
2
+ * Copyright (©) 2026 Hology Interactive AB. All rights reserved.
3
3
  * See the LICENSE.md file for details.
4
4
  */
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
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";export*from"./shader";export*from"./gameplay/actors/builtin/post-process-volume-actor.js";export*from"./scene/objects/prefab.js";/*
2
- * Copyright (©) 2025 Hology Interactive AB. All rights reserved.
2
+ * Copyright (©) 2026 Hology Interactive AB. All rights reserved.
3
3
  * See the LICENSE.md file for details.
4
4
  */
@@ -1,4 +1,4 @@
1
1
  import{Color as t}from"three";export const LuminosityHighPassShader={shaderID:"luminosityHighPass",uniforms:{tDiffuse:{value:null},luminosityThreshold:{value:1},smoothWidth:{value:1},defaultColor:{value:new t(0)},defaultOpacity:{value:0}},vertexShader:"\n varying vec2 vUv;\n\n void main() {\n\n \tvUv = uv;\n\n \tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n }\n ",fragmentShader:"\n uniform sampler2D tDiffuse;\n uniform vec3 defaultColor;\n uniform float defaultOpacity;\n uniform float luminosityThreshold;\n uniform float smoothWidth;\n\n varying vec2 vUv;\n\n void main() {\n\n \tvec4 texel = texture2D( tDiffuse, vUv );\n\n \tvec3 luma = vec3( 0.299, 0.587, 0.114 );\n\n \tfloat v = dot( texel.xyz, luma );\n\n \tvec4 outputColor = vec4( defaultColor.rgb, defaultOpacity );\n\n \tfloat alpha = smoothstep( luminosityThreshold, luminosityThreshold + smoothWidth, v );\n\n \tgl_FragColor = mix( outputColor, texel, alpha );\n\n }\n "};/*
2
- * Copyright (©) 2025 Hology Interactive AB. All rights reserved.
2
+ * Copyright (©) 2026 Hology Interactive AB. All rights reserved.
3
3
  * See the LICENSE.md file for details.
4
4
  */
@@ -1,4 +1,4 @@
1
1
  import{AdditiveBlending as e,Color as t,HalfFloatType as r,MeshBasicMaterial as i,ShaderMaterial as o,UniformsUtils as s,Vector2 as a,Vector3 as l,WebGLRenderTarget as n}from"three";import{CopyShader as u}from"three-stdlib";import{FullScreenQuad as h,Pass as m}from"three/examples/jsm/Addons.js";class d extends m{constructor(m,d,f,v){super(),this.strength=void 0!==d?d:1,this.radius=f,this.threshold=v,this.resolution=void 0!==m?new a(m.x,m.y):new a(256,256),this.clearColor=new t(0,0,0),this.renderTargetsHorizontal=[],this.renderTargetsVertical=[],this.nMips=5;let c=Math.round(this.resolution.x/2),p=Math.round(this.resolution.y/2);this.renderTargetBright=new n(c,p,{type:r}),this.renderTargetBright.texture.name="UnrealBloomPass.bright",this.renderTargetBright.texture.generateMipmaps=!1;for(let e=0;e<this.nMips;e++){const t=new n(c,p,{type:r});t.texture.name="UnrealBloomPass.h"+e,t.texture.generateMipmaps=!1,this.renderTargetsHorizontal.push(t);const i=new n(c,p,{type:r});i.texture.name="UnrealBloomPass.v"+e,i.texture.generateMipmaps=!1,this.renderTargetsVertical.push(i),c=Math.round(c/2),p=Math.round(p/2)}const g=LuminosityHighPassShader;this.highPassUniforms=s.clone(g.uniforms),this.highPassUniforms.luminosityThreshold.value=v,this.highPassUniforms.smoothWidth.value=.01,this.materialHighPassFilter=new o({uniforms:this.highPassUniforms,vertexShader:g.vertexShader,fragmentShader:g.fragmentShader,defines:{}}),this.separableBlurMaterials=[];const x=[3,5,7,9,11];c=Math.round(this.resolution.x/2),p=Math.round(this.resolution.y/2);for(let e=0;e<this.nMips;e++)this.separableBlurMaterials.push(this.getSeperableBlurMaterial(x[e])),this.separableBlurMaterials[e].uniforms.texSize.value=new a(c,p),c=Math.round(c/2),p=Math.round(p/2);this.compositeMaterial=this.getCompositeMaterial(this.nMips),this.compositeMaterial.uniforms.blurTexture1.value=this.renderTargetsVertical[0].texture,this.compositeMaterial.uniforms.blurTexture2.value=this.renderTargetsVertical[1].texture,this.compositeMaterial.uniforms.blurTexture3.value=this.renderTargetsVertical[2].texture,this.compositeMaterial.uniforms.blurTexture4.value=this.renderTargetsVertical[3].texture,this.compositeMaterial.uniforms.blurTexture5.value=this.renderTargetsVertical[4].texture,this.compositeMaterial.uniforms.bloomStrength.value=d,this.compositeMaterial.uniforms.bloomRadius.value=.1,this.compositeMaterial.needsUpdate=!0;this.compositeMaterial.uniforms.bloomFactors.value=[1,.8,.6,.4,.2],this.bloomTintColors=[new l(1,1,1),new l(1,1,1),new l(1,1,1),new l(1,1,1),new l(1,1,1)],this.compositeMaterial.uniforms.bloomTintColors.value=this.bloomTintColors;const T=u;this.copyUniforms=s.clone(T.uniforms),this.copyUniforms.opacity.value=1,this.materialCopy=new o({uniforms:this.copyUniforms,vertexShader:T.vertexShader,fragmentShader:T.fragmentShader,blending:e,depthTest:!1,depthWrite:!1,transparent:!0}),this.enabled=!0,this.needsSwap=!1,this._oldClearColor=new t,this.oldClearAlpha=1,this.basic=new i,this.fsQuad=new h(null)}dispose(){for(let e=0;e<this.renderTargetsHorizontal.length;e++)this.renderTargetsHorizontal[e].dispose();for(let e=0;e<this.renderTargetsVertical.length;e++)this.renderTargetsVertical[e].dispose();this.renderTargetBright.dispose();for(let e=0;e<this.separableBlurMaterials.length;e++)this.separableBlurMaterials[e].dispose();this.compositeMaterial.dispose(),this.materialCopy.dispose(),this.basic.dispose(),this.fsQuad.dispose()}setSize(e,t){let r=Math.round(e/2),i=Math.round(t/2);this.renderTargetBright.setSize(r,i);for(let e=0;e<this.nMips;e++)this.renderTargetsHorizontal[e].setSize(r,i),this.renderTargetsVertical[e].setSize(r,i),this.separableBlurMaterials[e].uniforms.texSize.value=new a(r,i),r=Math.round(r/2),i=Math.round(i/2)}render(e,t,r,i,o){e.getClearColor(this._oldClearColor),this.oldClearAlpha=e.getClearAlpha();const s=e.autoClear;e.autoClear=!1,e.setClearColor(this.clearColor,0),o&&e.state.buffers.stencil.setTest(!1),this.renderToScreen&&(this.fsQuad.material=this.basic,this.basic.map=r.texture,e.setRenderTarget(null),e.clear(),this.fsQuad.render(e)),this.highPassUniforms.tDiffuse.value=this.emissiveTexture??r.texture,this.highPassUniforms.luminosityThreshold.value=this.threshold,this.fsQuad.material=this.materialHighPassFilter,e.setRenderTarget(this.renderTargetBright),e.clear(),this.fsQuad.render(e);let a=this.renderTargetBright;for(let t=0;t<this.nMips;t++)this.fsQuad.material=this.separableBlurMaterials[t],this.separableBlurMaterials[t].uniforms.colorTexture.value=a.texture,this.separableBlurMaterials[t].uniforms.direction.value=d.BlurDirectionX,e.setRenderTarget(this.renderTargetsHorizontal[t]),e.clear(),this.fsQuad.render(e),this.separableBlurMaterials[t].uniforms.colorTexture.value=this.renderTargetsHorizontal[t].texture,this.separableBlurMaterials[t].uniforms.direction.value=d.BlurDirectionY,e.setRenderTarget(this.renderTargetsVertical[t]),e.clear(),this.fsQuad.render(e),a=this.renderTargetsVertical[t];this.fsQuad.material=this.compositeMaterial,this.compositeMaterial.uniforms.bloomStrength.value=this.strength,this.compositeMaterial.uniforms.bloomRadius.value=this.radius,this.compositeMaterial.uniforms.bloomTintColors.value=this.bloomTintColors,e.setRenderTarget(this.renderTargetsHorizontal[0]),e.clear(),this.fsQuad.render(e),this.fsQuad.material=this.materialCopy,this.copyUniforms.tDiffuse.value=this.renderTargetsHorizontal[0].texture,o&&e.state.buffers.stencil.setTest(!0),this.renderToScreen?(e.setRenderTarget(null),this.fsQuad.render(e)):(e.setRenderTarget(r),this.fsQuad.render(e)),e.setClearColor(this._oldClearColor,this.oldClearAlpha),e.autoClear=s}getSeperableBlurMaterial(e){return new o({defines:{KERNEL_RADIUS:e,SIGMA:e},uniforms:{colorTexture:{value:null},texSize:{value:new a(.5,.5)},direction:{value:new a(.5,.5)}},vertexShader:"varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n }",fragmentShader:"#include <common>\n varying vec2 vUv;\n uniform sampler2D colorTexture;\n uniform vec2 texSize;\n uniform vec2 direction;\n\n float gaussianPdf(in float x, in float sigma) {\n return 0.39894 * exp( -0.5 * x * x/( sigma * sigma))/sigma;\n }\n void main() {\n vec2 invSize = 1.0 / texSize;\n float fSigma = float(SIGMA);\n float weightSum = gaussianPdf(0.0, fSigma);\n vec3 diffuseSum = texture2D( colorTexture, vUv).rgb * weightSum;\n for( int i = 1; i < KERNEL_RADIUS; i ++ ) {\n float x = float(i);\n float w = gaussianPdf(x, fSigma);\n vec2 uvOffset = direction * invSize * x;\n vec3 sample1 = texture2D( colorTexture, vUv + uvOffset).rgb;\n vec3 sample2 = texture2D( colorTexture, vUv - uvOffset).rgb;\n diffuseSum += (sample1 + sample2) * w;\n weightSum += 2.0 * w;\n }\n gl_FragColor = vec4(diffuseSum/weightSum, 1.0);\n }"})}getCompositeMaterial(e){return new o({defines:{NUM_MIPS:e},uniforms:{blurTexture1:{value:null},blurTexture2:{value:null},blurTexture3:{value:null},blurTexture4:{value:null},blurTexture5:{value:null},bloomStrength:{value:1},bloomFactors:{value:null},bloomTintColors:{value:null},bloomRadius:{value:0}},vertexShader:"varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n }",fragmentShader:"varying vec2 vUv;\n uniform sampler2D blurTexture1;\n uniform sampler2D blurTexture2;\n uniform sampler2D blurTexture3;\n uniform sampler2D blurTexture4;\n uniform sampler2D blurTexture5;\n uniform float bloomStrength;\n uniform float bloomRadius;\n uniform float bloomFactors[NUM_MIPS];\n uniform vec3 bloomTintColors[NUM_MIPS];\n\n float lerpBloomFactor(const in float factor) {\n float mirrorFactor = 1.2 - factor;\n return mix(factor, mirrorFactor, bloomRadius);\n }\n\n void main() {\n gl_FragColor = bloomStrength * ( lerpBloomFactor(bloomFactors[0]) * vec4(bloomTintColors[0], 1.0) * texture2D(blurTexture1, vUv) +\n lerpBloomFactor(bloomFactors[1]) * vec4(bloomTintColors[1], 1.0) * texture2D(blurTexture2, vUv) +\n lerpBloomFactor(bloomFactors[2]) * vec4(bloomTintColors[2], 1.0) * texture2D(blurTexture3, vUv) +\n lerpBloomFactor(bloomFactors[3]) * vec4(bloomTintColors[3], 1.0) * texture2D(blurTexture4, vUv) +\n lerpBloomFactor(bloomFactors[4]) * vec4(bloomTintColors[4], 1.0) * texture2D(blurTexture5, vUv) );\n }"})}}d.BlurDirectionX=new a(1,0),d.BlurDirectionY=new a(0,1);export{d as UnrealBloomPass};export const LuminosityHighPassShader={shaderID:"luminosityHighPass",uniforms:{tDiffuse:{value:null},luminosityThreshold:{value:1},smoothWidth:{value:1},defaultColor:{value:new t(0)},defaultOpacity:{value:0}},vertexShader:"\n varying vec2 vUv;\n\n void main() {\n\n \tvUv = uv;\n\n \tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n }\n ",fragmentShader:"\n uniform sampler2D tDiffuse;\n uniform vec3 defaultColor;\n uniform float defaultOpacity;\n uniform float luminosityThreshold;\n uniform float smoothWidth;\n\n varying vec2 vUv;\n\n void main() {\n\n \tvec4 texel = texture2D( tDiffuse, vUv );\n\n \tvec3 luma = vec3( 0.299, 0.587, 0.114 );\n\n \tfloat v = dot( texel.xyz, luma );\n\n \tvec4 outputColor = vec4( defaultColor.rgb, defaultOpacity );\n\n \tfloat alpha = smoothstep( luminosityThreshold, luminosityThreshold + smoothWidth, v );\n\n \tgl_FragColor = mix( outputColor, texel, alpha );\n\n }\n "};/*
2
- * Copyright (©) 2025 Hology Interactive AB. All rights reserved.
2
+ * Copyright (©) 2026 Hology Interactive AB. All rights reserved.
3
3
  * See the LICENSE.md file for details.
4
4
  */
@@ -1,4 +1,4 @@
1
1
  export{};/*
2
- * Copyright (©) 2025 Hology Interactive AB. All rights reserved.
2
+ * Copyright (©) 2026 Hology Interactive AB. All rights reserved.
3
3
  * See the LICENSE.md file for details.
4
4
  */
@@ -1,4 +1,4 @@
1
1
  import{Color as t,Texture as e,Vector3 as i}from"three";import{ShaderPass as n}from"three-stdlib";import{clamp as r,distance as s,float as u,ifDefApply as o,log as l,mix as a,NodeShaderMaterial as m,pow as c,select as p,smoothstep as f,uniformFloat as d,uniformSampler2d as v,uniformVec3 as g,varyingAttributes as T,vec2 as h,vec3 as y}from"../shader-nodes/index.js";export class ColorPass extends n{set vignetteEnabled(t){this.defines.USE_VIGNETTE=!!t}get vignetteEnabled(){return!!this.defines.USE_VIGNETTE}set vignetteIntensity(t){null!=this.material.uniforms.vignetteIntensity?this.material.uniforms.vignetteIntensity={value:t}:this.material.uniforms.vignetteIntensity.value=t}get vignetteIntensity(){return this.material.uniforms.vignetteIntensity?.value}set colorTint(t){this.uniforms.colorTint.value=t}get colorTint(){const e=this.uniforms.colorTint.value;return e instanceof t?e:(new t).setFromVector3(e)}set colorTintIntensity(t){this.uniforms.colorTintIntensity.value=t}get colorTintIntensity(){return this.uniforms.colorTintIntensity?.value}set temperature(t){this.uniforms.temperature&&(this.uniforms.temperature.value=t)}get temperature(){return this.uniforms.temperature?.value}set temperatureTint(t){this.uniforms.temperatureTint&&(this.uniforms.temperatureTint.value=t)}get temperatureTint(){return this.uniforms.temperatureTint?.value}constructor(){let t=v("tDiffuse",new e).sample(T.uv);const n=g("colorTint",new i(1,1,1)),I=d("colorTintIntensity",1);t=a(t.rgb,t.rgb.multiply(n),I).rgba(1);const E=d("temperature",6500),b=d("temperatureTint",0);t=function(t,e,i){function n(t){const e=t.divide(100),i=p(e.lte(66),u(1),r(u(1.292936186062745).multiply(c(e.subtract(60),-.1332047592)),0,1)),n=p(e.lte(66),r(u(.3900815787690196).multiply(l(e)).subtract(.6318414437886275),0,1),r(u(1.1298908608952942).multiply(c(e.subtract(60),-.0755148492)),0,1)),s=p(e.gte(66),u(1),p(e.lte(19),u(0),r(u(.543206789110196).multiply(l(e.subtract(10))).subtract(1.19625408914),0,1)));return y(i,n,s)}const s=n(r(e,1e3,4e4)),o=r(i,-1,1),a=y(1,u(1).add(o.multiply(.2)),1),m=s.multiply(a),f=m.divideScalar(m.y);return r(t.divide(f),y(0,0,0),y(1,1,1))}(t.rgb,E,b).rgba(1);const S=d("vignetteIntensity",.5),U=h(.5),V=s(T.uv,U),w=t.multiplyScalar(f(.8,.2*.799,V.multiply(S.add(.2))));t=o("USE_VIGNETTE",t,()=>w);const G=new m({fog:!1,outputEncoding:!1,color:t});G.lights=!1,super(G),this.defines={USE_VIGNETTE:!1},G.defines=this.defines,G.needsUpdate=!0}}/*
2
- * Copyright (©) 2025 Hology Interactive AB. All rights reserved.
2
+ * Copyright (©) 2026 Hology Interactive AB. All rights reserved.
3
3
  * See the LICENSE.md file for details.
4
4
  */
@@ -1,4 +1,4 @@
1
1
  import{__decorate as e,__metadata as t}from"tslib";import{Color as i}from"three";import{Actor as o,attach as s,BaseActor as r,Parameter as n}from"../../gameplay";import{FogVolumeObject as a}from"./fog-volume-object";import{EditorSpriteComponent as p}from"../../gameplay/actors/builtin/components/editor-sprite-component";let h=class extends r{constructor(){super(...arguments),this.baseDensity=.5,this.heightFalloff=1,this.heightOffset=0,this.startDistance=3,this.scatteringDistribution=0,this.albedo=new i(1,1,.6),this.sprite=s(p,{file:"assets/cloud-icon.webp"})}onInit(){this.object.add(new a(this))}};e([n({range:[0,5],stepSize:.01,help:"The density (or thickness) of fog."}),t("design:type",Number)],h.prototype,"baseDensity",void 0),e([n(),t("design:type",Number)],h.prototype,"heightFalloff",void 0),e([n(),t("design:type",Number)],h.prototype,"heightOffset",void 0),e([n(),t("design:type",Number)],h.prototype,"startDistance",void 0),e([n({range:[-1,1],help:"\n Controls the direction in which light scatters inside the fog.\n\n - Positive values (> 0): More light is scattered forward, making beams and shafts more visible when looking toward the directional light source. (for dramatic god rays).\n - Zero: Even scattering in all directions—fog appears uniform.\n - Negative values (< 0): Fog is brighter when looking away from the directional light source.\n "}),t("design:type",Number)],h.prototype,"scatteringDistribution",void 0),e([n(),t("design:type",i)],h.prototype,"albedo",void 0),h=e([o()],h);export{h as FogVolume};/*
2
- * Copyright (©) 2025 Hology Interactive AB. All rights reserved.
2
+ * Copyright (©) 2026 Hology Interactive AB. All rights reserved.
3
3
  * See the LICENSE.md file for details.
4
4
  */
@@ -1,4 +1,4 @@
1
1
  import{Object3D as e}from"three";export class FogVolumeObject extends e{constructor(e){super(),this.volume=e,this.isFogVolumeObject=!0}}/*
2
- * Copyright (©) 2025 Hology Interactive AB. All rights reserved.
2
+ * Copyright (©) 2026 Hology Interactive AB. All rights reserved.
3
3
  * See the LICENSE.md file for details.
4
4
  */