@hology/core 0.0.91 → 0.0.92

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (412) hide show
  1. package/LICENSE.md +14 -14
  2. package/README.md +2 -2
  3. package/dist/config/project-config.d.ts +1 -0
  4. package/dist/config/project-config.d.ts.map +1 -0
  5. package/dist/config/project-config.js +1 -2
  6. package/dist/controllers/base-game-controller.d.ts +1 -0
  7. package/dist/controllers/base-game-controller.d.ts.map +1 -0
  8. package/dist/controllers/base-game-controller.js +1 -2
  9. package/dist/csm.d.ts +1 -0
  10. package/dist/csm.d.ts.map +1 -0
  11. package/dist/csm.js +1 -2
  12. package/dist/effects/particles/examples.d.ts +1 -0
  13. package/dist/effects/particles/examples.d.ts.map +1 -0
  14. package/dist/effects/particles/examples.js +1 -2
  15. package/dist/effects/particles/particle-system-config.d.ts +1 -0
  16. package/dist/effects/particles/particle-system-config.d.ts.map +1 -0
  17. package/dist/effects/particles/particle-system-config.js +1 -2
  18. package/dist/effects/vfx/behaviours.d.ts +3 -1
  19. package/dist/effects/vfx/behaviours.d.ts.map +1 -0
  20. package/dist/effects/vfx/behaviours.js +1 -2
  21. package/dist/effects/vfx/index.d.ts +1 -0
  22. package/dist/effects/vfx/index.d.ts.map +1 -0
  23. package/dist/effects/vfx/index.js +1 -2
  24. package/dist/effects/vfx/initializsers.d.ts +20 -39
  25. package/dist/effects/vfx/initializsers.d.ts.map +1 -0
  26. package/dist/effects/vfx/initializsers.js +1 -2
  27. package/dist/effects/vfx/rates.d.ts +5 -4
  28. package/dist/effects/vfx/rates.d.ts.map +1 -0
  29. package/dist/effects/vfx/rates.js +1 -2
  30. package/dist/effects/vfx/stretched-sprite.d.ts +1 -0
  31. package/dist/effects/vfx/stretched-sprite.d.ts.map +1 -0
  32. package/dist/effects/vfx/stretched-sprite.js +1 -2
  33. package/dist/effects/vfx/trail-renderer.d.ts +1 -0
  34. package/dist/effects/vfx/trail-renderer.d.ts.map +1 -0
  35. package/dist/effects/vfx/trail-renderer.js +1 -2
  36. package/dist/effects/vfx/vfx-actor.d.ts +2 -1
  37. package/dist/effects/vfx/vfx-actor.d.ts.map +1 -0
  38. package/dist/effects/vfx/vfx-actor.js +1 -2
  39. package/dist/effects/vfx/vfx-asset.d.ts +11 -0
  40. package/dist/effects/vfx/vfx-asset.d.ts.map +1 -0
  41. package/dist/effects/vfx/vfx-asset.js +1 -2
  42. package/dist/effects/vfx/vfx-defs.d.ts +11 -7
  43. package/dist/effects/vfx/vfx-defs.d.ts.map +1 -0
  44. package/dist/effects/vfx/vfx-defs.js +1 -2
  45. package/dist/effects/vfx/vfx-materializer.d.ts +9 -1
  46. package/dist/effects/vfx/vfx-materializer.d.ts.map +1 -0
  47. package/dist/effects/vfx/vfx-materializer.js +1 -2
  48. package/dist/effects/vfx/vfx-old-materializer.d.ts +2 -11
  49. package/dist/effects/vfx/vfx-old-materializer.d.ts.map +1 -0
  50. package/dist/effects/vfx/vfx-old-materializer.js +1 -2
  51. package/dist/effects/vfx/vfx-param.d.ts +1 -0
  52. package/dist/effects/vfx/vfx-param.d.ts.map +1 -0
  53. package/dist/effects/vfx/vfx-param.js +1 -2
  54. package/dist/effects/vfx/vfx-renderers.d.ts +2 -1
  55. package/dist/effects/vfx/vfx-renderers.d.ts.map +1 -0
  56. package/dist/effects/vfx/vfx-renderers.js +1 -2
  57. package/dist/effects/vfx/vfx-service.d.ts +1 -0
  58. package/dist/effects/vfx/vfx-service.d.ts.map +1 -0
  59. package/dist/effects/vfx/vfx-service.js +1 -2
  60. package/dist/effects/vfx/zones.d.ts +2 -1
  61. package/dist/effects/vfx/zones.d.ts.map +1 -0
  62. package/dist/effects/vfx/zones.js +1 -2
  63. package/dist/game-component/component-decorators.d.ts +1 -0
  64. package/dist/game-component/component-decorators.d.ts.map +1 -0
  65. package/dist/game-component/component-decorators.js +1 -2
  66. package/dist/game-component/game-component.d.ts +1 -0
  67. package/dist/game-component/game-component.d.ts.map +1 -0
  68. package/dist/game-component/game-component.js +1 -2
  69. package/dist/gameplay/actors/actor.d.ts +1 -0
  70. package/dist/gameplay/actors/actor.d.ts.map +1 -0
  71. package/dist/gameplay/actors/actor.js +1 -2
  72. package/dist/gameplay/actors/builtin/camera-actor.d.ts +1 -0
  73. package/dist/gameplay/actors/builtin/camera-actor.d.ts.map +1 -0
  74. package/dist/gameplay/actors/builtin/camera-actor.js +1 -2
  75. package/dist/gameplay/actors/builtin/components/character/character-animation.d.ts +1 -0
  76. package/dist/gameplay/actors/builtin/components/character/character-animation.d.ts.map +1 -0
  77. package/dist/gameplay/actors/builtin/components/character/character-animation.js +1 -2
  78. package/dist/gameplay/actors/builtin/components/character/character-movement copy.d.ts +1 -0
  79. package/dist/gameplay/actors/builtin/components/character/character-movement copy.d.ts.map +1 -0
  80. package/dist/gameplay/actors/builtin/components/character/character-movement copy.js +1 -2
  81. package/dist/gameplay/actors/builtin/components/character/character-movement.d.ts +1 -0
  82. package/dist/gameplay/actors/builtin/components/character/character-movement.d.ts.map +1 -0
  83. package/dist/gameplay/actors/builtin/components/character/character-movement.js +1 -2
  84. package/dist/gameplay/actors/builtin/components/character/modes.d.ts +1 -0
  85. package/dist/gameplay/actors/builtin/components/character/modes.d.ts.map +1 -0
  86. package/dist/gameplay/actors/builtin/components/character/modes.js +1 -2
  87. package/dist/gameplay/actors/builtin/components/mesh-component.d.ts +1 -0
  88. package/dist/gameplay/actors/builtin/components/mesh-component.d.ts.map +1 -0
  89. package/dist/gameplay/actors/builtin/components/mesh-component.js +1 -2
  90. package/dist/gameplay/actors/builtin/components/scene-component.d.ts +1 -0
  91. package/dist/gameplay/actors/builtin/components/scene-component.d.ts.map +1 -0
  92. package/dist/gameplay/actors/builtin/components/scene-component.js +1 -2
  93. package/dist/gameplay/actors/builtin/index.d.ts +1 -0
  94. package/dist/gameplay/actors/builtin/index.d.ts.map +1 -0
  95. package/dist/gameplay/actors/builtin/index.js +1 -2
  96. package/dist/gameplay/actors/builtin/navmesh-actor.d.ts +1 -0
  97. package/dist/gameplay/actors/builtin/navmesh-actor.d.ts.map +1 -0
  98. package/dist/gameplay/actors/builtin/navmesh-actor.js +1 -2
  99. package/dist/gameplay/actors/builtin/positional-audio-actor.d.ts +1 -0
  100. package/dist/gameplay/actors/builtin/positional-audio-actor.d.ts.map +1 -0
  101. package/dist/gameplay/actors/builtin/positional-audio-actor.js +1 -2
  102. package/dist/gameplay/actors/builtin/spawn-point.d.ts +1 -0
  103. package/dist/gameplay/actors/builtin/spawn-point.d.ts.map +1 -0
  104. package/dist/gameplay/actors/builtin/spawn-point.js +1 -2
  105. package/dist/gameplay/actors/builtin/trigger-volume.d.ts +1 -0
  106. package/dist/gameplay/actors/builtin/trigger-volume.d.ts.map +1 -0
  107. package/dist/gameplay/actors/builtin/trigger-volume.js +1 -2
  108. package/dist/gameplay/actors/camera/camera-component.d.ts +1 -0
  109. package/dist/gameplay/actors/camera/camera-component.d.ts.map +1 -0
  110. package/dist/gameplay/actors/camera/camera-component.js +1 -2
  111. package/dist/gameplay/actors/camera/third-person-camera-component.d.ts +1 -0
  112. package/dist/gameplay/actors/camera/third-person-camera-component.d.ts.map +1 -0
  113. package/dist/gameplay/actors/camera/third-person-camera-component.js +1 -2
  114. package/dist/gameplay/actors/component.d.ts +1 -0
  115. package/dist/gameplay/actors/component.d.ts.map +1 -0
  116. package/dist/gameplay/actors/component.js +1 -2
  117. package/dist/gameplay/actors/factory.d.ts +1 -0
  118. package/dist/gameplay/actors/factory.d.ts.map +1 -0
  119. package/dist/gameplay/actors/factory.js +1 -2
  120. package/dist/gameplay/actors/index.d.ts +1 -0
  121. package/dist/gameplay/actors/index.d.ts.map +1 -0
  122. package/dist/gameplay/actors/index.js +1 -2
  123. package/dist/gameplay/actors/internal/component-init.d.ts +1 -0
  124. package/dist/gameplay/actors/internal/component-init.d.ts.map +1 -0
  125. package/dist/gameplay/actors/internal/component-init.js +1 -2
  126. package/dist/gameplay/actors/internal/container-map.d.ts +1 -0
  127. package/dist/gameplay/actors/internal/container-map.d.ts.map +1 -0
  128. package/dist/gameplay/actors/internal/container-map.js +1 -2
  129. package/dist/gameplay/ai/behavior-tree/bt.d.ts +1 -0
  130. package/dist/gameplay/ai/behavior-tree/bt.d.ts.map +1 -0
  131. package/dist/gameplay/ai/behavior-tree/bt.js +1 -2
  132. package/dist/gameplay/ai/behavior-tree/move.d.ts +1 -0
  133. package/dist/gameplay/ai/behavior-tree/move.d.ts.map +1 -0
  134. package/dist/gameplay/ai/behavior-tree/move.js +1 -2
  135. package/dist/gameplay/ai/build-tile.d.ts +1 -0
  136. package/dist/gameplay/ai/build-tile.d.ts.map +1 -0
  137. package/dist/gameplay/ai/build-tile.js +1 -2
  138. package/dist/gameplay/ai/dynamic-tiled-navmesh.d.ts +1 -0
  139. package/dist/gameplay/ai/dynamic-tiled-navmesh.d.ts.map +1 -0
  140. package/dist/gameplay/ai/dynamic-tiled-navmesh.js +1 -2
  141. package/dist/gameplay/ai/dynamic-tiled-navmesh.worker.d.ts +1 -0
  142. package/dist/gameplay/ai/dynamic-tiled-navmesh.worker.d.ts.map +1 -0
  143. package/dist/gameplay/ai/dynamic-tiled-navmesh.worker.js +1 -2
  144. package/dist/gameplay/ai/index.d.ts +1 -0
  145. package/dist/gameplay/ai/index.d.ts.map +1 -0
  146. package/dist/gameplay/ai/index.js +1 -2
  147. package/dist/gameplay/ai/navigation.d.ts +1 -0
  148. package/dist/gameplay/ai/navigation.d.ts.map +1 -0
  149. package/dist/gameplay/ai/navigation.js +1 -2
  150. package/dist/gameplay/animation/anim-sm.d.ts +1 -0
  151. package/dist/gameplay/animation/anim-sm.d.ts.map +1 -0
  152. package/dist/gameplay/animation/anim-sm.js +1 -2
  153. package/dist/gameplay/animation/root-motion.d.ts +1 -0
  154. package/dist/gameplay/animation/root-motion.d.ts.map +1 -0
  155. package/dist/gameplay/animation/root-motion.js +1 -2
  156. package/dist/gameplay/env.d.ts +1 -0
  157. package/dist/gameplay/env.d.ts.map +1 -0
  158. package/dist/gameplay/env.js +1 -2
  159. package/dist/gameplay/index.d.ts +1 -0
  160. package/dist/gameplay/index.d.ts.map +1 -0
  161. package/dist/gameplay/index.js +1 -2
  162. package/dist/gameplay/initiate.d.ts +1 -0
  163. package/dist/gameplay/initiate.d.ts.map +1 -0
  164. package/dist/gameplay/initiate.js +1 -2
  165. package/dist/gameplay/inject.d.ts +1 -0
  166. package/dist/gameplay/inject.d.ts.map +1 -0
  167. package/dist/gameplay/inject.js +1 -2
  168. package/dist/gameplay/input/index.d.ts +1 -0
  169. package/dist/gameplay/input/index.d.ts.map +1 -0
  170. package/dist/gameplay/input/index.js +1 -2
  171. package/dist/gameplay/input/input-service.d.ts +1 -0
  172. package/dist/gameplay/input/input-service.d.ts.map +1 -0
  173. package/dist/gameplay/input/input-service.js +1 -2
  174. package/dist/gameplay/input/input.d.ts +1 -0
  175. package/dist/gameplay/input/input.d.ts.map +1 -0
  176. package/dist/gameplay/input/input.js +1 -2
  177. package/dist/gameplay/input/keybind.d.ts +1 -0
  178. package/dist/gameplay/input/keybind.d.ts.map +1 -0
  179. package/dist/gameplay/input/keybind.js +1 -2
  180. package/dist/gameplay/polyfill.d.ts +1 -0
  181. package/dist/gameplay/polyfill.d.ts.map +1 -0
  182. package/dist/gameplay/polyfill.js +1 -2
  183. package/dist/gameplay/services/asset-loader.d.ts +1 -0
  184. package/dist/gameplay/services/asset-loader.d.ts.map +1 -0
  185. package/dist/gameplay/services/asset-loader.js +1 -2
  186. package/dist/gameplay/services/physics/abstract-physics-system.d.ts +1 -0
  187. package/dist/gameplay/services/physics/abstract-physics-system.d.ts.map +1 -0
  188. package/dist/gameplay/services/physics/abstract-physics-system.js +1 -2
  189. package/dist/gameplay/services/physics/collision-contact.d.ts +1 -0
  190. package/dist/gameplay/services/physics/collision-contact.d.ts.map +1 -0
  191. package/dist/gameplay/services/physics/collision-contact.js +1 -2
  192. package/dist/gameplay/services/physics/physics-system.d.ts +1 -0
  193. package/dist/gameplay/services/physics/physics-system.d.ts.map +1 -0
  194. package/dist/gameplay/services/physics/physics-system.js +1 -2
  195. package/dist/gameplay/services/pointer-events.d.ts +1 -0
  196. package/dist/gameplay/services/pointer-events.d.ts.map +1 -0
  197. package/dist/gameplay/services/pointer-events.js +1 -2
  198. package/dist/gameplay/services/render.d.ts +1 -0
  199. package/dist/gameplay/services/render.d.ts.map +1 -0
  200. package/dist/gameplay/services/render.js +1 -2
  201. package/dist/gameplay/services/world.d.ts +1 -0
  202. package/dist/gameplay/services/world.d.ts.map +1 -0
  203. package/dist/gameplay/services/world.js +1 -2
  204. package/dist/index.d.ts +1 -0
  205. package/dist/index.d.ts.map +1 -0
  206. package/dist/index.js +1 -2
  207. package/dist/rendering/shader-override.d.ts +1 -0
  208. package/dist/rendering/shader-override.d.ts.map +1 -0
  209. package/dist/rendering/shader-override.js +1 -2
  210. package/dist/rendering.d.ts +1 -0
  211. package/dist/rendering.d.ts.map +1 -0
  212. package/dist/rendering.js +1 -2
  213. package/dist/scene/asset-resource-loader.d.ts +1 -0
  214. package/dist/scene/asset-resource-loader.d.ts.map +1 -0
  215. package/dist/scene/asset-resource-loader.js +1 -2
  216. package/dist/scene/assets-provider.d.ts +1 -0
  217. package/dist/scene/assets-provider.d.ts.map +1 -0
  218. package/dist/scene/assets-provider.js +1 -2
  219. package/dist/scene/bootstrap.d.ts +1 -0
  220. package/dist/scene/bootstrap.d.ts.map +1 -0
  221. package/dist/scene/bootstrap.js +1 -2
  222. package/dist/scene/collision/collision-shape-import.d.ts +1 -0
  223. package/dist/scene/collision/collision-shape-import.d.ts.map +1 -0
  224. package/dist/scene/collision/collision-shape-import.js +1 -2
  225. package/dist/scene/collision/collision-shape.d.ts +1 -0
  226. package/dist/scene/collision/collision-shape.d.ts.map +1 -0
  227. package/dist/scene/collision/collision-shape.js +1 -2
  228. package/dist/scene/landscape/landscape-manager.d.ts +1 -0
  229. package/dist/scene/landscape/landscape-manager.d.ts.map +1 -0
  230. package/dist/scene/landscape/landscape-manager.js +1 -2
  231. package/dist/scene/landscape/landscape.d.ts +1 -0
  232. package/dist/scene/landscape/landscape.d.ts.map +1 -0
  233. package/dist/scene/landscape/landscape.js +1 -2
  234. package/dist/scene/landscape/utils.d.ts +1 -0
  235. package/dist/scene/landscape/utils.d.ts.map +1 -0
  236. package/dist/scene/landscape/utils.js +1 -2
  237. package/dist/scene/materializer.d.ts +1 -0
  238. package/dist/scene/materializer.d.ts.map +1 -0
  239. package/dist/scene/materializer.js +1 -2
  240. package/dist/scene/materials/grass-foliage.d.ts +1 -0
  241. package/dist/scene/materials/grass-foliage.d.ts.map +1 -0
  242. package/dist/scene/materials/grass-foliage.js +1 -2
  243. package/dist/scene/materials/grass.d.ts +1 -0
  244. package/dist/scene/materials/grass.d.ts.map +1 -0
  245. package/dist/scene/materials/grass.js +1 -2
  246. package/dist/scene/materials/utils/material-painting.d.ts +1 -0
  247. package/dist/scene/materials/utils/material-painting.d.ts.map +1 -0
  248. package/dist/scene/materials/utils/material-painting.js +1 -2
  249. package/dist/scene/materials/utils/noise.glsl.d.ts +1 -0
  250. package/dist/scene/materials/utils/noise.glsl.d.ts.map +1 -0
  251. package/dist/scene/materials/utils/noise.glsl.js +1 -2
  252. package/dist/scene/materials/water.d.ts +1 -0
  253. package/dist/scene/materials/water.d.ts.map +1 -0
  254. package/dist/scene/materials/water.js +1 -2
  255. package/dist/scene/model.d.ts +1 -0
  256. package/dist/scene/model.d.ts.map +1 -0
  257. package/dist/scene/model.js +1 -2
  258. package/dist/scene/objects/ramp-geometry.d.ts +1 -0
  259. package/dist/scene/objects/ramp-geometry.d.ts.map +1 -0
  260. package/dist/scene/objects/ramp-geometry.js +1 -2
  261. package/dist/scene/objects/shapes.d.ts +2 -2
  262. package/dist/scene/objects/shapes.d.ts.map +1 -0
  263. package/dist/scene/objects/shapes.js +1 -2
  264. package/dist/scene/objects/stairs-geometry.d.ts +1 -0
  265. package/dist/scene/objects/stairs-geometry.d.ts.map +1 -0
  266. package/dist/scene/objects/stairs-geometry.js +1 -2
  267. package/dist/scene/runtime-asset-service.d.ts +1 -0
  268. package/dist/scene/runtime-asset-service.d.ts.map +1 -0
  269. package/dist/scene/runtime-asset-service.js +1 -2
  270. package/dist/scene/runtime-backend-service.d.ts +1 -0
  271. package/dist/scene/runtime-backend-service.d.ts.map +1 -0
  272. package/dist/scene/runtime-backend-service.js +1 -2
  273. package/dist/scene/runtime-bundled-backend-service.d.ts +1 -0
  274. package/dist/scene/runtime-bundled-backend-service.d.ts.map +1 -0
  275. package/dist/scene/runtime-bundled-backend-service.js +1 -2
  276. package/dist/scene/scene-data-service.d.ts +1 -0
  277. package/dist/scene/scene-data-service.d.ts.map +1 -0
  278. package/dist/scene/scene-data-service.js +1 -2
  279. package/dist/scene/sky.d.ts +1 -0
  280. package/dist/scene/sky.d.ts.map +1 -0
  281. package/dist/scene/sky.js +1 -2
  282. package/dist/scene/storage/storage.d.ts +1 -0
  283. package/dist/scene/storage/storage.d.ts.map +1 -0
  284. package/dist/scene/storage/storage.js +1 -2
  285. package/dist/shader/builtin/index.d.ts +1 -0
  286. package/dist/shader/builtin/index.d.ts.map +1 -0
  287. package/dist/shader/builtin/index.js +1 -2
  288. package/dist/shader/builtin/lambert-shader.d.ts +1 -0
  289. package/dist/shader/builtin/lambert-shader.d.ts.map +1 -0
  290. package/dist/shader/builtin/lambert-shader.js +1 -2
  291. package/dist/shader/builtin/landscape-composite-shader.d.ts +1 -0
  292. package/dist/shader/builtin/landscape-composite-shader.d.ts.map +1 -0
  293. package/dist/shader/builtin/landscape-composite-shader.js +1 -2
  294. package/dist/shader/builtin/landscape-shader.d.ts +1 -0
  295. package/dist/shader/builtin/landscape-shader.d.ts.map +1 -0
  296. package/dist/shader/builtin/landscape-shader.js +1 -2
  297. package/dist/shader/builtin/standard-shader.d.ts +1 -0
  298. package/dist/shader/builtin/standard-shader.d.ts.map +1 -0
  299. package/dist/shader/builtin/standard-shader.js +1 -2
  300. package/dist/shader/builtin/unlit-shader.d.ts +1 -0
  301. package/dist/shader/builtin/unlit-shader.d.ts.map +1 -0
  302. package/dist/shader/builtin/unlit-shader.js +1 -2
  303. package/dist/shader/index.d.ts +1 -0
  304. package/dist/shader/index.d.ts.map +1 -0
  305. package/dist/shader/index.js +1 -2
  306. package/dist/shader/parameter.d.ts +1 -0
  307. package/dist/shader/parameter.d.ts.map +1 -0
  308. package/dist/shader/parameter.js +1 -2
  309. package/dist/shader/shader.d.ts +1 -0
  310. package/dist/shader/shader.d.ts.map +1 -0
  311. package/dist/shader/shader.js +1 -2
  312. package/dist/shader-nodes/bulge.d.ts +1 -0
  313. package/dist/shader-nodes/bulge.d.ts.map +1 -0
  314. package/dist/shader-nodes/bulge.js +1 -2
  315. package/dist/shader-nodes/depth.d.ts +1 -0
  316. package/dist/shader-nodes/depth.d.ts.map +1 -0
  317. package/dist/shader-nodes/depth.js +1 -2
  318. package/dist/shader-nodes/effects.d.ts +1 -0
  319. package/dist/shader-nodes/effects.d.ts.map +1 -0
  320. package/dist/shader-nodes/effects.js +1 -2
  321. package/dist/shader-nodes/glsl-node.d.ts +2 -1
  322. package/dist/shader-nodes/glsl-node.d.ts.map +1 -0
  323. package/dist/shader-nodes/glsl-node.js +1 -2
  324. package/dist/shader-nodes/index.d.ts +2 -0
  325. package/dist/shader-nodes/index.d.ts.map +1 -0
  326. package/dist/shader-nodes/index.js +1 -2
  327. package/dist/shader-nodes/landscape.d.ts +1 -0
  328. package/dist/shader-nodes/landscape.d.ts.map +1 -0
  329. package/dist/shader-nodes/landscape.js +1 -2
  330. package/dist/shader-nodes/layers.d.ts +1 -0
  331. package/dist/shader-nodes/layers.d.ts.map +1 -0
  332. package/dist/shader-nodes/layers.js +1 -2
  333. package/dist/shader-nodes/math.d.ts +1 -0
  334. package/dist/shader-nodes/math.d.ts.map +1 -0
  335. package/dist/shader-nodes/math.js +1 -2
  336. package/dist/shader-nodes/particle.d.ts +3 -0
  337. package/dist/shader-nodes/particle.d.ts.map +1 -0
  338. package/dist/shader-nodes/particle.js +1 -2
  339. package/dist/shader-nodes/shapes.d.ts +1 -0
  340. package/dist/shader-nodes/shapes.d.ts.map +1 -0
  341. package/dist/shader-nodes/shapes.js +1 -2
  342. package/dist/shader-nodes/texture-sequence.d.ts +2 -1
  343. package/dist/shader-nodes/texture-sequence.d.ts.map +1 -0
  344. package/dist/shader-nodes/texture-sequence.js +1 -2
  345. package/dist/shader-nodes/time.d.ts +1 -0
  346. package/dist/shader-nodes/time.d.ts.map +1 -0
  347. package/dist/shader-nodes/time.js +1 -2
  348. package/dist/shader-nodes/voronoi.d.ts +1 -0
  349. package/dist/shader-nodes/voronoi.d.ts.map +1 -0
  350. package/dist/shader-nodes/voronoi.js +1 -2
  351. package/dist/test/injection.test.d.ts +1 -0
  352. package/dist/test/injection.test.d.ts.map +1 -0
  353. package/dist/test/injection.test.js +1 -2
  354. package/dist/utils/async.d.ts +1 -0
  355. package/dist/utils/async.d.ts.map +1 -0
  356. package/dist/utils/async.js +1 -2
  357. package/dist/utils/buffer.d.ts +1 -0
  358. package/dist/utils/buffer.d.ts.map +1 -0
  359. package/dist/utils/buffer.js +1 -2
  360. package/dist/utils/collections.d.ts +1 -0
  361. package/dist/utils/collections.d.ts.map +1 -0
  362. package/dist/utils/collections.js +1 -2
  363. package/dist/utils/files.d.ts +1 -0
  364. package/dist/utils/files.d.ts.map +1 -0
  365. package/dist/utils/files.js +1 -2
  366. package/dist/utils/materials.d.ts +1 -0
  367. package/dist/utils/materials.d.ts.map +1 -0
  368. package/dist/utils/materials.js +1 -2
  369. package/dist/utils/math.d.ts +1 -0
  370. package/dist/utils/math.d.ts.map +1 -0
  371. package/dist/utils/math.js +1 -2
  372. package/dist/utils/mesh.d.ts +1 -0
  373. package/dist/utils/mesh.d.ts.map +1 -0
  374. package/dist/utils/mesh.js +1 -2
  375. package/dist/utils/polyfill.d.ts +1 -0
  376. package/dist/utils/polyfill.d.ts.map +1 -0
  377. package/dist/utils/polyfill.js +1 -2
  378. package/dist/utils/three/depth-pass.d.ts +1 -0
  379. package/dist/utils/three/depth-pass.d.ts.map +1 -0
  380. package/dist/utils/three/depth-pass.js +1 -2
  381. package/dist/utils/three/gpu-stats-panel.d.ts +1 -0
  382. package/dist/utils/three/gpu-stats-panel.d.ts.map +1 -0
  383. package/dist/utils/three/gpu-stats-panel.js +1 -2
  384. package/dist/utils/three/line-sphere.d.ts +1 -0
  385. package/dist/utils/three/line-sphere.d.ts.map +1 -0
  386. package/dist/utils/three/line-sphere.js +1 -2
  387. package/dist/utils/three/outline-pass.d.ts +1 -0
  388. package/dist/utils/three/outline-pass.d.ts.map +1 -0
  389. package/dist/utils/three/outline-pass.js +1 -2
  390. package/dist/utils/three/positional-audio-helper.d.ts +1 -0
  391. package/dist/utils/three/positional-audio-helper.d.ts.map +1 -0
  392. package/dist/utils/three/positional-audio-helper.js +1 -2
  393. package/dist/utils/three/stats.d.ts +1 -0
  394. package/dist/utils/three/stats.d.ts.map +1 -0
  395. package/dist/utils/three/stats.js +1 -2
  396. package/dist/utils/three/transform-controls.d.ts +1 -0
  397. package/dist/utils/three/transform-controls.d.ts.map +1 -0
  398. package/dist/utils/three/transform-controls.js +1 -2
  399. package/dist/utils/three/traverse.d.ts +1 -0
  400. package/dist/utils/three/traverse.d.ts.map +1 -0
  401. package/dist/utils/three/traverse.js +1 -2
  402. package/dist/utils/type.d.ts +1 -0
  403. package/dist/utils/type.d.ts.map +1 -0
  404. package/dist/utils/type.js +1 -2
  405. package/dist/utils/uuid.d.ts +1 -0
  406. package/dist/utils/uuid.d.ts.map +1 -0
  407. package/dist/utils/uuid.js +1 -2
  408. package/dist/worker/index.d.ts +1 -0
  409. package/dist/worker/index.d.ts.map +1 -0
  410. package/dist/worker/index.js +1 -2
  411. package/package.json +122 -122
  412. package/tsconfig.tsbuildinfo +1 -1
@@ -31,3 +31,4 @@ export declare class DynamicTiledNavMesh {
31
31
  getTilesForBounds(bounds: THREE.Box3): [x: number, y: number][];
32
32
  destroy(): void;
33
33
  }
34
+ //# sourceMappingURL=dynamic-t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AAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,CAAC,EAAE,YAAY,GAAE,OAAc;IAuE7H,aAAa,CAAC,SAAS,EAAE,YAAY,EAAE,OAAO,EAAE,WAAW;IAU3D,uBAAuB,CAAC,aAAa,EAAE,KAAK,CAAC,OAAO;IAOpD,iBAAiB,CAAC,MAAM,EAAE,KAAK,CAAC,IAAI;IAepC,OAAO;CAOV"}
@@ -1,5 +1,4 @@
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";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 c={...o,...e.recastConfig};this.recastConfig=c;const M=new t,{tileWidth:f,tileHeight:v,tcs:m,maxPolysPerTile:g}=r({recastConfig:c,navMeshBounds:a});this.tileWidth=f,this.tileHeight=v,this.tcs=m;const w=s.create({orig:u,tileWidth:c.tileSize*c.cs,tileHeight:c.tileSize*c.ch,maxTiles:e.maxTiles,maxPolys:g});if(M.initTiled(w),this.navMesh=M,this.workers=[],l())for(let t=0;t<e.workers;t++){const 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=M(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,c(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();for(const t of this.workers)t.terminate()}}const c=function(t){return btoa(String.fromCharCode(...t))},M=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
- /*
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";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 c={...o,...e.recastConfig};this.recastConfig=c;const M=new t,{tileWidth:f,tileHeight:v,tcs:m,maxPolysPerTile:g}=r({recastConfig:c,navMeshBounds:a});this.tileWidth=f,this.tileHeight=v,this.tcs=m;const w=s.create({orig:u,tileWidth:c.tileSize*c.cs,tileHeight:c.tileSize*c.ch,maxTiles:e.maxTiles,maxPolys:g});if(M.initTiled(w),this.navMesh=M,this.workers=[],l())for(let t=0;t<e.workers;t++){const 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=M(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,c(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();for(const t of this.workers)t.terminate()}}const c=function(t){return btoa(String.fromCharCode(...t))},M=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};/*
3
2
  * Copyright (©) 2023. All rights reserved.
4
3
  * See the LICENSE.md file for details.
5
4
  */
@@ -1 +1,2 @@
1
1
  export declare function setupNavMeshWorker(): void;
2
+ //# sourceMappingURL=dynamic-tiled-navmesh.worker.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dynamic-tiled-navmesh.worker.d.ts","sourceRoot":"","sources":["../../../src/gameplay/ai/dynamic-tiled-navmesh.worker.ts"],"names":[],"mappings":"AAOA,wBAAgB,kBAAkB,SAiBjC"}
@@ -1,5 +1,4 @@
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
- /*
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])};/*
3
2
  * Copyright (©) 2023. All rights reserved.
4
3
  * See the LICENSE.md file for details.
5
4
  */
@@ -1,3 +1,4 @@
1
1
  export * from './navigation.js';
2
2
  export * from './behavior-tree/bt.js';
3
3
  export * from './behavior-tree/move.js';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/gameplay/ai/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAA;AAC/B,cAAc,uBAAuB,CAAA;AACrC,cAAc,yBAAyB,CAAA"}
@@ -1,5 +1,4 @@
1
- export*from"./navigation.js";export*from"./behavior-tree/bt.js";export*from"./behavior-tree/move.js";
2
- /*
1
+ export*from"./navigation.js";export*from"./behavior-tree/bt.js";export*from"./behavior-tree/move.js";/*
3
2
  * Copyright (©) 2023. All rights reserved.
4
3
  * See the LICENSE.md file for details.
5
4
  */
@@ -18,3 +18,4 @@ export declare class Navigation {
18
18
  */
19
19
  findClosestPoint(position: Vector3): Vector3 | null;
20
20
  }
21
+ //# sourceMappingURL=navigation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"navigation.d.ts","sourceRoot":"","sources":["../../../src/gameplay/ai/navigation.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAIhC,qBACa,UAAU;IACrB,OAAO,CAAC,YAAY,CAAe;IACnC,OAAO,CAAC,KAAK,CAAC,CAAc;IAC5B,OAAO,CAAC,KAAK,CAAgB;;IAwB7B,OAAO,CAAC,WAAW;IAMnB;;OAEG;IACH,QAAQ,CAAC,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,OAAO,GAAG;QAAC,OAAO,EAAE,OAAO,CAAC;QAAC,IAAI,EAAE,OAAO,EAAE,CAAA;KAAC;IAoB3E;;;OAGG;IACH,gBAAgB,CAAC,QAAQ,EAAE,OAAO,GAAG,OAAO,GAAC,IAAI;CAYlD"}
@@ -1,5 +1,4 @@
1
- import{__decorate as t,__metadata as e}from"tslib";import{NavMeshQuery as s}from"recast-navigation";import{Vector3 as n}from"three";import{inject as r,Service as o,World as i}from"../";import h,{safeRecastInit as u}from"../actors/builtin/navmesh-actor";let a=class{constructor(){this.world=r(i),u().then((()=>{const t=this.world.actors.find((t=>t instanceof h));null!=t&&(this.navMeshActor=t,this.query=null),this.world.actorAdded.subscribe((t=>{t instanceof h&&(this.navMeshActor=t,this.query=null)})),this.world.actorRemoved.subscribe((t=>{t instanceof h&&t.id===this.navMeshActor?.id&&(this.navMeshActor=null,this.query=null)}))}))}ensureQuery(){null==this.query&&null!=this.navMeshActor&&null!=this.navMeshActor.navMesh&&(this.query=new s(this.navMeshActor.navMesh))}findPath(t,e){if(this.ensureQuery(),null==this.query)return d("NavMesh has not been generated yet"),l;const s=this.findClosestPoint(t);if(null==s)return d("Start point could not be found on NavMesh",t),l;const{success:r,error:o,path:i}=this.query.computePath(s,e);return r?{success:!0,path:i.map((t=>new n(t.x,t.y,t.z)))}:(d("Failed to generate path",o),l)}findClosestPoint(t){if(this.ensureQuery(),null==this.query)return d("NavMesh has not been generated yet"),null;const{success:e,point:s}=this.query.findClosestPoint(t);return e?new n(s.x,s.y,s.z):null}};a=t([o(),e("design:paramtypes",[])],a);export{a as Navigation};const l={success:!1,path:[]};let c=new Set;function d(t,...e){c.has(t)||(c.add(t),setTimeout((()=>c.delete(t)),2e3),console.warn(t,...e))}
2
- /*
1
+ import{__decorate as t,__metadata as e}from"tslib";import{NavMeshQuery as s}from"recast-navigation";import{Vector3 as n}from"three";import{inject as r,Service as o,World as i}from"../";import h,{safeRecastInit as u}from"../actors/builtin/navmesh-actor";let a=class{constructor(){this.world=r(i),u().then((()=>{const t=this.world.actors.find((t=>t instanceof h));null!=t&&(this.navMeshActor=t,this.query=null),this.world.actorAdded.subscribe((t=>{t instanceof h&&(this.navMeshActor=t,this.query=null)})),this.world.actorRemoved.subscribe((t=>{t instanceof h&&t.id===this.navMeshActor?.id&&(this.navMeshActor=null,this.query=null)}))}))}ensureQuery(){null==this.query&&null!=this.navMeshActor&&null!=this.navMeshActor.navMesh&&(this.query=new s(this.navMeshActor.navMesh))}findPath(t,e){if(this.ensureQuery(),null==this.query)return d("NavMesh has not been generated yet"),l;const s=this.findClosestPoint(t);if(null==s)return d("Start point could not be found on NavMesh",t),l;const{success:r,error:o,path:i}=this.query.computePath(s,e);return r?{success:!0,path:i.map((t=>new n(t.x,t.y,t.z)))}:(d("Failed to generate path",o),l)}findClosestPoint(t){if(this.ensureQuery(),null==this.query)return d("NavMesh has not been generated yet"),null;const{success:e,point:s}=this.query.findClosestPoint(t);return e?new n(s.x,s.y,s.z):null}};a=t([o(),e("design:paramtypes",[])],a);export{a as Navigation};const l={success:!1,path:[]};let c=new Set;function d(t,...e){c.has(t)||(c.add(t),setTimeout((()=>c.delete(t)),2e3),console.warn(t,...e))}/*
3
2
  * Copyright (©) 2023. All rights reserved.
4
3
  * See the LICENSE.md file for details.
5
4
  */
@@ -41,3 +41,4 @@ export declare class AnimationStateMachine {
41
41
  private _getNext;
42
42
  }
43
43
  export {};
44
+ //# sourceMappingURL=anim-sm.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"anim-sm.d.ts","sourceRoot":"","sources":["../../../src/gameplay/animation/anim-sm.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAA;AAErC,KAAK,mBAAmB,GAAG,CAAC,WAAW,EAAE,MAAM,KAAK,OAAO,CAAA;AAI3D,cAAM,UAAU;aACc,KAAK,EAAE,cAAc;aAAkB,SAAS,EAAE,mBAAmB;gBAArE,KAAK,EAAE,cAAc,EAAkB,SAAS,EAAE,mBAAmB;CAClG;AAED,MAAM,MAAM,qBAAqB,GAAG;IAClC,uDAAuD;IACvD,IAAI,EAAE,OAAO,CAAA;CACd,CAAA;AAMD,qBAAa,cAAc;aAiBG,IAAI,CAAC,EAAE,aAAa;IAAS,OAAO,EAAE,OAAO,CAAC,qBAAqB,CAAC;IAhBhG,SAAgB,IAAI,SAAU;IACvB,MAAM,EAAE,cAAc,CAAA;IAC7B,SAAgB,WAAW,EAAE,UAAU,EAAE,CAAK;IACvC,IAAI,EAAE,MAAM,CAAA;IAOnB;;;;;OAKG;gBACyB,IAAI,CAAC,EAAE,aAAa,EAAS,OAAO,GAAE,OAAO,CAAC,qBAAqB,CAAgC;IAI/H,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAKzB,YAAY,IAAI,cAAc,EAAE;IAMhC,OAAO,IAAI,cAAc;IAMzB,WAAW,CAAC,IAAI,EAAE,aAAa,EAAE,SAAS,EAAE,mBAAmB;IAO/D,KAAK,CAAC,SAAS,EAAE,mBAAmB,EAAE,MAAM,GAAE,aAAoB,EAAE,SAAS,GAAE,aAAoB;IAOnG,aAAa,CAAC,KAAK,EAAE,cAAc,EAAE,SAAS,GAAE,mBAAgC;IAIhF,qBAAqB,CAAC,KAAK,EAAE,cAAc,EAAE,SAAS,CAAC,EAAE,mBAAmB;IAO5E,kBAAkB,CAAC,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,mBAAmB;CAIzE;AAED,qBAAa,qBAAqB;IAIpB,OAAO,CAAC,YAAY;IAHzB,OAAO,EAAE,cAAc,CAAA;IACvB,KAAK,SAAI;gBAEI,YAAY,EAAE,cAAc;IAIhD,IAAI,CAAC,SAAS,EAAE,MAAM;IAMtB,OAAO,CAAC,QAAQ;CAgCjB"}
@@ -1,5 +1,4 @@
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
- /*
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);/*
3
2
  * Copyright (©) 2023. All rights reserved.
4
3
  * See the LICENSE.md file for details.
5
4
  */
@@ -25,3 +25,4 @@ export declare class BoneLayer {
25
25
  boneMask: Bone[];
26
26
  }
27
27
  export {};
28
+ //# sourceMappingURL=root-motion.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"root-motion.d.ts","sourceRoot":"","sources":["../../../src/gameplay/animation/root-motion.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,mBAAmB,EAAE,IAAI,EAA4B,MAAM,OAAO,CAAA;AAiBzF,qBAAa,cAAe,SAAQ,aAAa;IACzC,WAAW,EAAE,mBAAmB,CAAA;IAGhC,YAAY,EAAE,MAAM,CAAI;IACxB,YAAY,UAAQ;IAC3B,OAAO,CAAC,QAAQ,CAAC,CAAM;IACvB,OAAO,CAAC,MAAM,CAAe;WAEf,QAAQ,CAAC,MAAM,EAAE,aAAa,EAAE,YAAY,UAAQ,EAAE,QAAQ,CAAC,EAAE,IAAI,GAAG,cAAc;IAqBpG;;;;;;;;OAQG;WACW,oBAAoB,CAAC,MAAM,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM;IAS1E,KAAK,IAAI,IAAI;CAMd;AAGD,KAAK,WAAW,GAAG,MAAM,CAAA;AAEzB,qBAAa,SAAS;IACpB,IAAI,EAAE,WAAW,CAAU;IAC3B,KAAK,EAAE,MAAM,CAAI;IACjB,QAAQ,EAAE,IAAI,EAAE,CAAK;CACtB"}
@@ -1,5 +1,4 @@
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,i){const n=new RootMotionClip(o.name,o.duration,o.tracks.slice(),o.blendMode);if(n.fixedInPlace=e,n.rootBone=i,n.source=o,n.uuid=o.uuid,n.motionTrack=null!=i?o.tracks.find((o=>o.name===`${i.name}.position`)):o.tracks.find((o=>o.name.endsWith(".position"))),n.motionTrack){n.tracks.splice(n.tracks.indexOf(n.motionTrack),1);const o=(new t).fromArray(n.motionTrack.values,0),e=(new t).fromArray(n.motionTrack.values,n.motionTrack.values.length-3);n.displacement=e.distanceTo(o)}else console.error("Could not find root motion track",o,i);return n}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
- /*
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,i){const n=new RootMotionClip(o.name,o.duration,o.tracks.slice(),o.blendMode);if(n.fixedInPlace=e,n.rootBone=i,n.source=o,n.uuid=o.uuid,n.motionTrack=null!=i?o.tracks.find((o=>o.name===`${i.name}.position`)):o.tracks.find((o=>o.name.endsWith(".position"))),n.motionTrack){n.tracks.splice(n.tracks.indexOf(n.motionTrack),1);const o=(new t).fromArray(n.motionTrack.values,0),e=(new t).fromArray(n.motionTrack.values,n.motionTrack.values.length-3);n.displacement=e.distanceTo(o)}else console.error("Could not find root motion track",o,i);return n}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=[]}}/*
3
2
  * Copyright (©) 2023. All rights reserved.
4
3
  * See the LICENSE.md file for details.
5
4
  */
@@ -1,3 +1,4 @@
1
1
  export interface EngineEnvironment {
2
2
  inEditor: boolean;
3
3
  }
4
+ //# sourceMappingURL=env.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"env.d.ts","sourceRoot":"","sources":["../../src/gameplay/env.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,iBAAiB;IAChC,QAAQ,EAAE,OAAO,CAAA;CAClB"}
@@ -1,5 +1,4 @@
1
- export{};
2
- /*
1
+ export{};/*
3
2
  * Copyright (©) 2023. All rights reserved.
4
3
  * See the LICENSE.md file for details.
5
4
  */
@@ -17,3 +17,4 @@ export { VisualEffect } from '../effects/vfx/vfx-param.js';
17
17
  export * from '../shader/parameter.js';
18
18
  export * from './ai/index.js';
19
19
  export * from '../effects/vfx';
20
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/gameplay/index.ts"],"names":[],"mappings":"AAAA,OAAO,kBAAkB,CAAA;AACzB,OAAO,EAAE,SAAS,IAAI,WAAW,EAAE,MAAM,QAAQ,CAAA;AACjD,cAAc,eAAe,CAAA;AAC7B,cAAc,aAAa,CAAA;AAC3B,OAAO,EAAE,OAAO,EAAG,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,KAAK,gBAAgB,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AACzG,cAAc,qBAAqB,CAAA;AACnC,cAAc,sBAAsB,CAAA;AACpC,cAAc,sCAAsC,CAAA;AAEpD,cAAc,wBAAwB,CAAA;AACtC,cAAc,4BAA4B,CAAA;AAC1C,cAAc,4BAA4B,CAAA;AAC1C,cAAc,8BAA8B,CAAA;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAA;AAC1D,cAAc,wBAAwB,CAAA;AACtC,cAAc,eAAe,CAAA;AAC7B,cAAc,gBAAgB,CAAA"}
@@ -1,5 +1,4 @@
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";
2
- /*
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";/*
3
2
  * Copyright (©) 2023. All rights reserved.
4
3
  * See the LICENSE.md file for details.
5
4
  */
@@ -63,3 +63,4 @@ export declare class HologyRuntime<T_Game = unknown> {
63
63
  shutdown(): void;
64
64
  }
65
65
  export {};
66
+ //# sourceMappingURL=initiate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"initiate.d.ts","sourceRoot":"","sources":["../../src/gameplay/initiate.ts"],"names":[],"mappings":"AAAA,OAAkB,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,QAAQ,CAAA;AAEpE,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAE5D,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAA;AAa3C,OAAO,EAAE,UAAU,EAAW,MAAM,MAAM,CAAA;AAK1C,KAAK,SAAS,CAAC,CAAC,IAAI,aAAa,CAAC,CAAC,CAAC,CAAA;AAGpC,MAAM,MAAM,kBAAkB,GAAG;IAC/B,OAAO,EAAE,WAAW,CAAA;IACpB,SAAS,EAAE,MAAM,CAAA;IACjB,OAAO,EAAE,MAAM,CAAA;IACf,OAAO,EAAE;QAAE,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU,CAAA;KAAE,CAAA;IACvC,MAAM,EAAE;QAAE,CAAC,IAAI,EAAE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ene/bootstrap.js";import{ActorFactory as n}from"./actors/factory.js";import{World as s}from"./services/world.js";import{ViewController as o}from"./services/render.js";import{RenderingView as r}from"../rendering.js";import{PhysicsSystem as i}from"./services/physics/physics-system.js";import{MeshComponent as a}from"./actors/builtin/components/mesh-component.js";import{activeContainerInstance as c}from"./actors/internal/container-map.js";import{InputService as m}from"./input/index.js";import{RuntimeAssetsService as d}from"../scene/runtime-asset-service.js";import{AssetResourceLoader as l}from"../scene/asset-resource-loader.js";import{AssetLoader as h}from"./services/asset-loader.js";import{polyfillClient as p}from"./polyfill.js";import{Subject as u}from"rxjs";import{PointerEvents as f}from"./services/pointer-events.js";import{RuntimeBundledBackendService as w}from"../scene/runtime-bundled-backend-service.js";import{Scene as g}from"three";export function initiateGame(m,u){if(p(),0!=u.element.childNodes.length)return console.error("Can not initialize the game with a non-empty html element"),null;e.has(o);const j=e.of("default"),v=new HologyRuntime(j),S=new n(j,{inEditor:!1});var y;e.set(n,S),y=u.element,Object.assign(y.style,{position:"absolute",top:"0",left:"0",width:"100%",height:"100%",overflow:"hidden"});const I=new r(u.element,{enableXR:!0===u.xr?.enabled,maxPixelRatio:u.rendering?.maxPixelRatio});I.renderer.shadowMap.enabled=u.rendering?.shadows?.enabled??!0,I.renderer.shadowMap.autoUpdate=u.rendering?.shadows?.autoUpdate??!0,null!=u?.rendering?.resolutionScale&&(I.resolutionScale=u.rendering.resolutionScale),e.set(r,I);const x=new o(I);e.set(o,x);const b=e.get(s);e.set(s,b);const D=new w,R=new d(D),G=new l;G.setDataDir(u.dataDir);const H=Object.entries(u.shaders).map((([e,t])=>({name:e,type:t}))),P=new h(G,R,H);return e.set(h,P),(async()=>{const n=e.get(i);if(await n.start(),v.isShutdown)return;if(await D.preloadData(),v.isShutdown)return;const s=new g;b.scene=s;const{scene:o,actors:r}=await t(I,u.sceneName,u.dataDir,u.shaders,u.actors,S,D,R,G);b.scene=o;for(const e of s.children)b.scene.add(e);if(v.isShutdown)return void I.stop();e.import([a]);for(const e of r)b.addActor(e);n.addFromScene(o),I.loop((e=>{})),v.status=5,c.value=j,j.remove(m),j.set({id:m,type:m});const d=j.get(m);c.value=null,v.gameInstance=d,j.get(f).start(),d instanceof GameInstance&&d.onStart(),v._resolver(!0)})(),v}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 u,this.ready=new Promise((e=>{this._resolver=e}))}getWorld(){return this.containerInstance.get(s)}getService(e){return this.containerInstance.get(e)}shutdown(){this.isShutdown=!0,this.shutdownStarted.next(),this.gameInstance instanceof GameInstance&&this.gameInstance.onShutdown(),this.containerInstance.get(m).stop();const e=this.containerInstance.get(r);e?.stop();for(const e of this.getWorld().actors)this.getWorld().removeActor(e);this.containerInstance.get(i).stop(),this.containerInstance.get(f).stop(),this.containerInstance.reset()}}
2
- /*
1
+ import e from"typedi";import{loadScene as t}from"../scene/bootstrap.js";import{ActorFactory as n}from"./actors/factory.js";import{World as s}from"./services/world.js";import{ViewController as o}from"./services/render.js";import{RenderingView as r}from"../rendering.js";import{PhysicsSystem as i}from"./services/physics/physics-system.js";import{MeshComponent as a}from"./actors/builtin/components/mesh-component.js";import{activeContainerInstance as c}from"./actors/internal/container-map.js";import{InputService as m}from"./input/index.js";import{RuntimeAssetsService as d}from"../scene/runtime-asset-service.js";import{AssetResourceLoader as l}from"../scene/asset-resource-loader.js";import{AssetLoader as h}from"./services/asset-loader.js";import{polyfillClient as p}from"./polyfill.js";import{Subject as u}from"rxjs";import{PointerEvents as f}from"./services/pointer-events.js";import{RuntimeBundledBackendService as w}from"../scene/runtime-bundled-backend-service.js";import{Scene as g}from"three";export function initiateGame(m,u){if(p(),0!=u.element.childNodes.length)return console.error("Can not initialize the game with a non-empty html element"),null;e.has(o);const j=e.of("default"),v=new HologyRuntime(j),S=new n(j,{inEditor:!1});var y;e.set(n,S),y=u.element,Object.assign(y.style,{position:"absolute",top:"0",left:"0",width:"100%",height:"100%",overflow:"hidden"});const I=new r(u.element,{enableXR:!0===u.xr?.enabled,maxPixelRatio:u.rendering?.maxPixelRatio});I.renderer.shadowMap.enabled=u.rendering?.shadows?.enabled??!0,I.renderer.shadowMap.autoUpdate=u.rendering?.shadows?.autoUpdate??!0,null!=u?.rendering?.resolutionScale&&(I.resolutionScale=u.rendering.resolutionScale),e.set(r,I);const x=new o(I);e.set(o,x);const b=e.get(s);e.set(s,b);const D=new w,R=new d(D),G=new l;G.setDataDir(u.dataDir);const H=Object.entries(u.shaders).map((([e,t])=>({name:e,type:t}))),P=new h(G,R,H);return e.set(h,P),(async()=>{const n=e.get(i);if(await n.start(),v.isShutdown)return;if(await D.preloadData(),v.isShutdown)return;const s=new g;b.scene=s;const{scene:o,actors:r}=await t(I,u.sceneName,u.dataDir,u.shaders,u.actors,S,D,R,G);b.scene=o;for(const e of s.children)b.scene.add(e);if(v.isShutdown)return void I.stop();e.import([a]);for(const e of r)b.addActor(e);n.addFromScene(o),I.loop((e=>{})),v.status=5,c.value=j,j.remove(m),j.set({id:m,type:m});const d=j.get(m);c.value=null,v.gameInstance=d,j.get(f).start(),d instanceof GameInstance&&d.onStart(),v._resolver(!0)})(),v}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 u,this.ready=new Promise((e=>{this._resolver=e}))}getWorld(){return this.containerInstance.get(s)}getService(e){return this.containerInstance.get(e)}shutdown(){this.isShutdown=!0,this.shutdownStarted.next(),this.gameInstance instanceof GameInstance&&this.gameInstance.onShutdown(),this.containerInstance.get(m).stop();const e=this.containerInstance.get(r);e?.stop();for(const e of this.getWorld().actors)this.getWorld().removeActor(e);this.containerInstance.get(i).stop(),this.containerInstance.get(f).stop(),this.containerInstance.reset()}}/*
3
2
  * Copyright (©) 2023. All rights reserved.
4
3
  * See the LICENSE.md file for details.
5
4
  */
@@ -1,3 +1,4 @@
1
1
  import { Constructable, ContainerInstance } from 'typedi';
2
2
  export declare function inject<T>(type: Constructable<T>): T;
3
3
  export declare function withInjectionContext(containerInstance: ContainerInstance, fn: (diContainer: ContainerInstance) => void): void;
4
+ //# sourceMappingURL=inject.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inject.d.ts","sourceRoot":"","sources":["../../src/gameplay/inject.ts"],"names":[],"mappings":"AAAA,OAAkB,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,QAAQ,CAAC;AAGrE,wBAAgB,MAAM,CAAC,CAAC,EAAE,IAAI,EAAE,aAAa,CAAC,CAAC,CAAC,GAAG,CAAC,CAanD;AAED,wBAAgB,oBAAoB,CAAC,iBAAiB,EAAE,iBAAiB,EAAE,EAAE,EAAE,CAAC,WAAW,EAAE,iBAAiB,KAAK,IAAI,QAKtH"}
@@ -1,5 +1,4 @@
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,n(t),e.value=o}
2
- /*
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,n(t),e.value=o}/*
3
2
  * Copyright (©) 2023. All rights reserved.
4
3
  * See the LICENSE.md file for details.
5
4
  */
@@ -1,3 +1,4 @@
1
1
  export * from './input-service.js';
2
2
  export * from './input.js';
3
3
  export * from './keybind.js';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/gameplay/input/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAA;AAClC,cAAc,YAAY,CAAA;AAC1B,cAAc,cAAc,CAAA"}
@@ -1,5 +1,4 @@
1
- export*from"./input-service.js";export*from"./input.js";export*from"./keybind.js";
2
- /*
1
+ export*from"./input-service.js";export*from"./input.js";export*from"./keybind.js";/*
3
2
  * Copyright (©) 2023. All rights reserved.
4
3
  * See the LICENSE.md file for details.
5
4
  */
@@ -35,3 +35,4 @@ export declare class InputService {
35
35
  removeWheelbind(name: ActionIdentifier): void;
36
36
  }
37
37
  export {};
38
+ //# sourceMappingURL=input-service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"input-service.d.ts","sourceRoot":"","sources":["../../../src/gameplay/input/input-service.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE7D,KAAK,aAAa,GAAG,CAAC,MAAM,EAAE,OAAO,GAAC,MAAM,KAAK,IAAI,CAAA;AACrD,KAAK,aAAa,GAAG,CAAC,KAAK,EAAE,MAAM,KAAK,GAAG,CAAA;AAC3C,KAAK,cAAc,GAAG,CAAC,MAAM,EAAE,OAAO,KAAK,GAAG,CAAA;AAC9C,KAAK,gBAAgB,GAAG,MAAM,GAAG,MAAM,CAAA;AAEvC,qBACa,YAAY;IAErB,OAAO,CAAC,MAAM,CAA6C;IAC3D,OAAO,CAAC,cAAc,CAA6C;IACnE,OAAO,CAAC,eAAe,CAA8C;IACrE,OAAO,CAAC,QAAQ,CAAyC;IACzD,OAAO,CAAC,UAAU,CAAyC;IAC3D,OAAO,CAAC,cAAc,CAAyC;IAC/D,OAAO,CAAC,UAAU,CAAyC;IAE3D,OAAO,CAAC,SAAS,CAchB;IAED,OAAO,CAAC,OAAO,CAcd;IAED,OAAO,CAAC,WAAW,CAkBlB;IAED,OAAO,CAAC,cAAc,CAA+B;IACrD,OAAO,CAAC,WAAW,CAsBlB;IAED,OAAO,CAAC,OAAO,CASd;IAGM,KAAK;IAWL,IAAI;IAUX;;OAEG;IACI,IAAI,CAAC,IAAI,EAAE,gBAAgB,EAAE,KAAK,EAAE,aAAa;IAIjD,UAAU,CAAC,IAAI,EAAE,gBAAgB,EAAE,KAAK,EAAE,cAAc;IAIxD,SAAS,CAAC,IAAI,EAAE,gBAAgB,EAAE,QAAQ,EAAE,aAAa;IAIzD,MAAM,CAAC,IAAI,EAAE,gBAAgB;IAM7B,UAAU,CAAC,IAAI,EAAE,gBAAgB,EAAE,GAAG,EAAE,OAAO;IAO/C,YAAY,CAAC,IAAI,EAAE,gBAAgB,EAAE,KAAK,EAAE,SAAS;IAIrD,gBAAgB,CAAC,IAAI,EAAE,gBAAgB,EAAE,KAAK,EAAE,SAAS;IAIzD,YAAY,CAAC,IAAI,EAAE,gBAAgB,EAAE,KAAK,EAAE,SAAS;IAIrD,aAAa,CAAC,IAAI,EAAE,gBAAgB;IAIpC,eAAe,CAAC,IAAI,EAAE,gBAAgB;IAItC,eAAe,CAAC,IAAI,EAAE,gBAAgB;CAIhD"}
@@ -1,5 +1,4 @@
1
- import{__decorate as e}from"tslib";import{Service as t}from"typedi";let s=class{constructor(){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.keybinds.forEach(((t,s)=>{for(const n of t)n.test(e)&&(this.inputs.has(s)?this.inputs.get(s)(!0):this.toggleCallbacks.has(s)?this.toggleCallbacks.get(s)(!0):console.warn("No input callback for registered for key bind "+n.display()))}))},this.onKeyUp=e=>{this.keybinds.forEach(((t,s)=>{for(const n of t)n.test(e)&&(this.inputs.has(s)?this.inputs.get(s)(!1):this.toggleCallbacks.has(s)?this.toggleCallbacks.get(s)(!1):console.warn("No input callback for registered for key bind "+n.display()))}))},this.onMouseMove=e=>{(null!=document.pointerLockElement||null!=document.mozPointerLockElement)&&this.mousebinds.forEach(((t,s)=>{const n=this.inputs.get(s)??this.deltaCallbacks.get(s);if(null!=n)switch(t.axis){case"x":n(e.movementX*t.multiplier);break;case"y":n(e.movementY*t.multiplier)}else console.warn("No input callback for registered for mouse bind "+t.axis)}))},this.onTouchMove=e=>{const t=e.touches[0];null!=t&&(null!=this.prevTouchEvent&&t.identifier===this.prevTouchEvent.identifier?(this.touchmoveBinds.forEach(((e,s)=>{const n=this.inputs.get(s)??this.deltaCallbacks.get(s);if(null!=n)switch(e.axis){case"x":n((t.clientX-this.prevTouchEvent.clientX)*e.multiplier);break;case"y":n((t.clientY-this.prevTouchEvent.clientY)*e.multiplier)}else console.warn("No input callback for registered for mouse bind "+e.axis)})),this.prevTouchEvent=t):this.prevTouchEvent=e.touches[0])},this.onWheel=e=>{this.wheelbinds.forEach(((t,s)=>{const n=this.inputs.get(s)??this.deltaCallbacks.get(s);null!=n?n(e.deltaY*t.multiplier):console.warn("No input callback for registered for wheel bind")}))}}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),document.addEventListener("touchmove",this.onTouchMove),document.addEventListener("wheel",this.onWheel)}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),document.removeEventListener("touchmove",this.onTouchMove),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)}};s=e([t()],s);export{s as InputService};
2
- /*
1
+ import{__decorate as e}from"tslib";import{Service as t}from"typedi";let s=class{constructor(){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.keybinds.forEach(((t,s)=>{for(const n of t)n.test(e)&&(this.inputs.has(s)?this.inputs.get(s)(!0):this.toggleCallbacks.has(s)?this.toggleCallbacks.get(s)(!0):console.warn("No input callback for registered for key bind "+n.display()))}))},this.onKeyUp=e=>{this.keybinds.forEach(((t,s)=>{for(const n of t)n.test(e)&&(this.inputs.has(s)?this.inputs.get(s)(!1):this.toggleCallbacks.has(s)?this.toggleCallbacks.get(s)(!1):console.warn("No input callback for registered for key bind "+n.display()))}))},this.onMouseMove=e=>{(null!=document.pointerLockElement||null!=document.mozPointerLockElement)&&this.mousebinds.forEach(((t,s)=>{const n=this.inputs.get(s)??this.deltaCallbacks.get(s);if(null!=n)switch(t.axis){case"x":n(e.movementX*t.multiplier);break;case"y":n(e.movementY*t.multiplier)}else console.warn("No input callback for registered for mouse bind "+t.axis)}))},this.onTouchMove=e=>{const t=e.touches[0];null!=t&&(null!=this.prevTouchEvent&&t.identifier===this.prevTouchEvent.identifier?(this.touchmoveBinds.forEach(((e,s)=>{const n=this.inputs.get(s)??this.deltaCallbacks.get(s);if(null!=n)switch(e.axis){case"x":n((t.clientX-this.prevTouchEvent.clientX)*e.multiplier);break;case"y":n((t.clientY-this.prevTouchEvent.clientY)*e.multiplier)}else console.warn("No input callback for registered for mouse bind "+e.axis)})),this.prevTouchEvent=t):this.prevTouchEvent=e.touches[0])},this.onWheel=e=>{this.wheelbinds.forEach(((t,s)=>{const n=this.inputs.get(s)??this.deltaCallbacks.get(s);null!=n?n(e.deltaY*t.multiplier):console.warn("No input callback for registered for wheel bind")}))}}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),document.addEventListener("touchmove",this.onTouchMove),document.addEventListener("wheel",this.onWheel)}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),document.removeEventListener("touchmove",this.onTouchMove),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)}};s=e([t()],s);export{s as InputService};/*
3
2
  * Copyright (©) 2023. All rights reserved.
4
3
  * See the LICENSE.md file for details.
5
4
  */
@@ -43,3 +43,4 @@ export declare class DecimalInput {
43
43
  readonly increment: (delta: number) => void;
44
44
  }
45
45
  export {};
46
+ //# sourceMappingURL=input.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"input.d.ts","sourceRoot":"","sources":["../../../src/gameplay/input/input.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,OAAO,EAAW,MAAM,OAAO,CAAC;AAMhD,qBAAa,SAAS;IAClB,QAAQ,CAAC,MAAM,UAAgB;IAC/B,IAAI,UAAU,WAEb;IACD,IAAI,QAAQ,WAEX;IACD,SAAgB,eAAe,WAAY,OAAO,UAEjD;IACD,SAAgB,eAAe,WAAY,OAAO,UAEjD;IACD,SAAgB,eAAe,WAAY,OAAO,UAEjD;IACD,S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SAAS,UAAW,MAAM,UAEzC;CACJ"}
@@ -1,5 +1,4 @@
1
- import{Euler as t,Vector2 as i}from"three";import{ArrayMap as s}from"../../utils/collections.js";import{clamp as o}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 h{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 h,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)}}const e=2*Math.PI;export class RotationInput{constructor(){this.rotation=new t,this.rotateX=t=>{this.rotation.x=(this.rotation.x+t)%e},this.rotateY=t=>{this.rotation.y=(this.rotation.y+t)%e},this.rotateZ=t=>{this.rotation.z=(this.rotation.z+t)%e}}}export class RestrictedRotationInput extends RotationInput{constructor(i=-1/0,s=1/0,h=-1/0,e=1/0,r=-1/0,a=1/0){super(),this.minX=i,this.maxX=s,this.minY=h,this.maxY=e,this.minZ=r,this.maxZ=a,this.rotation=new t,this.rotateX=t=>{this.rotation.x=o(this.rotation.x+t,this.minX,this.maxX)},this.rotateY=t=>{this.rotation.y=o(this.rotation.y+t,this.minY,this.maxY)},this.rotateZ=t=>{this.rotation.z=o(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=o(this.value+t,this.min,this.max)},this.value=t}}
2
- /*
1
+ import{Euler as t,Vector2 as i}from"three";import{ArrayMap as s}from"../../utils/collections.js";import{clamp as o}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 h{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 h,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)}}const e=2*Math.PI;export class RotationInput{constructor(){this.rotation=new t,this.rotateX=t=>{this.rotation.x=(this.rotation.x+t)%e},this.rotateY=t=>{this.rotation.y=(this.rotation.y+t)%e},this.rotateZ=t=>{this.rotation.z=(this.rotation.z+t)%e}}}export class RestrictedRotationInput extends RotationInput{constructor(i=-1/0,s=1/0,h=-1/0,e=1/0,r=-1/0,a=1/0){super(),this.minX=i,this.maxX=s,this.minY=h,this.maxY=e,this.minZ=r,this.maxZ=a,this.rotation=new t,this.rotateX=t=>{this.rotation.x=o(this.rotation.x+t,this.minX,this.maxX)},this.rotateY=t=>{this.rotation.y=o(this.rotation.y+t,this.minY,this.maxY)},this.rotateZ=t=>{this.rotation.z=o(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=o(this.value+t,this.min,this.max)},this.value=t}}/*
3
2
  * Copyright (©) 2023. All rights reserved.
4
3
  * See the LICENSE.md file for details.
5
4
  */
@@ -21,3 +21,4 @@ export declare class Wheelbind {
21
21
  constructor(sensitivity?: number, flipped?: boolean);
22
22
  get multiplier(): number;
23
23
  }
24
+ //# sourceMappingURL=keybind.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"keybind.d.ts","sourceRoot":"","sources":["../../../src/gameplay/input/keybind.ts"],"names":[],"mappings":"AAIA,MAAM,MAAM,cAAc,GAAG,WAAW,GAAC,aAAa,GAAC,YAAY,CAAA;AACnE,MAAM,MAAM,SAAS,GAAG,OAAO,GAAC,OAAO,GAAC,QAAQ,GAAC,SAAS,GAAC,KAAK,GAAC,MAAM,GAAC,cAAc,GAAC,MAAM,CAAA;AAM7F,qBAAa,OAAO;IACG,GAAG,EAAE,SAAS;IAAS,KAAK,CAAC,EAAE,OAAO;IAAS,IAAI,CAAC,EAAE,OAAO;gBAA7D,GAAG,EAAE,SAAS,EAAS,KAAK,CAAC,EAAE,OAAO,EAAS,IAAI,CAAC,EAAE,OAAO;IAEzE,IAAI,CAAC,KAAK,EAAE,aAAa,GAAC,UAAU;IAWpC,OAAO;CAKf;AAGH,qBAAa,SAAS;IAEhB,QAAQ,CAAC,WAAW;IACpB,QAAQ,CAAC,OAAO;IAChB,QAAQ,CAAC,IAAI,EAAE,GAAG,GAAC,GAAG;gBAFb,WAAW,SAAI,EACf,OAAO,UAAQ,EACf,IAAI,GAAE,GAAG,GAAC,GAAS;IAG9B,IAAI,UAAU,WAGb;CACJ;AAGD,qBAAa,SAAS;IAElB,QAAQ,CAAC,WAAW;IACpB,QAAQ,CAAC,OAAO;gBADP,WAAW,SAAI,EACf,OAAO,UAAQ;IAG1B,IAAI,UAAU,WAEb;CACF"}
@@ -1,5 +1,4 @@
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
- /*
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}}/*
3
2
  * Copyright (©) 2023. All rights reserved.
4
3
  * See the LICENSE.md file for details.
5
4
  */
@@ -1 +1,2 @@
1
1
  export declare function polyfillClient(): void;
2
+ //# sourceMappingURL=polyfill.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"polyfill.d.ts","sourceRoot":"","sources":["../../src/gameplay/polyfill.ts"],"names":[],"mappings":"AACA,wBAAgB,cAAc,SAqB7B"}
@@ -1,5 +1,4 @@
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
- /*
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)}}/*
3
2
  * Copyright (©) 2023. All rights reserved.
4
3
  * See the LICENSE.md file for details.
5
4
  */
@@ -44,3 +44,4 @@ export declare class AssetLoader {
44
44
  getMaterialByAssetId(id: AssetId): Promise<Material>;
45
45
  getAsset(id: AssetId): Promise<import("../../scene/model.js").Asset>;
46
46
  }
47
+ //# sourceMappingURL=asset-loader.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"asset-loader.d.ts","sourceRoot":"","sources":["../../../src/gameplay/services/asset-loader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,UAAU,EAAkB,MAAM,sCAAsC,CAAC;AACvG,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,gCAAgC,CAAC;AACrE,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAC/C,OAAO,EAAa,IAAI,EAA+C,MAAM,cAAc,CAAC;AAC5F,OAAO,EAAuC,QAAQ,EAA2C,MAAM,OAAO,CAAC;AAI/G,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAG9B,qBACa,WAAW;IAgBpB,SAAS,CAAC,mBAAmB,EAAE,mBAAmB;IAClD,SAAS,CAAC,YAAY,EAAE,cAAc;IAC/B,OAAO,EAAE,UAAU,EAAE;IAjB9B,SAAS,CAAC,OAAO,SAAK;IACtB,SAAS,CAAC,SAAS,SAAK;IAExB,OAAO,CAAC,cAAc,CAAuB;IAC7C,OAAO,CAAC,SAAS,CAAuC;IACxD,OAAO,CAAC,SAAS,CAAsC;IACvD,OAAO,CAAC,SAAS,CAAqC;IACtD,OAAO,CAAC,SAAS,CA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i,TGALoader as n}from"three-stdlib";import{AudioLoader as d,LoadingManager as h,TextureLoader as l}from"three";import{pathJoin as u}from"../../utils/files.js";import{Service as c}from"typedi";import{materialFromAsset as g}from"../../scene/materializer.js";import{KTX2Loader as w}from"three/examples/jsm/Addons.js";let f=class{constructor(e,t,s){this.assetResourceLoader=e,this.assetService=t,this.shaders=s,this.baseUrl="",this.urlSuffix="",this.loadingManager=new h,this.glbLoader=new a(this.loadingManager),this.fbxLoader=new r(this.loadingManager),this.objLoader=new i(this.loadingManager),this.mtlLoader=new o(this.loadingManager),this.tgaLoader=new n(this.loadingManager),this.ktx2Loader=new w(this.loadingManager),this.textureLoader=new l(this.loadingManager),this.audioLoader=new d(this.loadingManager)}resolvePath(e){return u(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}`);return this.assetResourceLoader.getMesh(t)}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}`);return this.assetResourceLoader.getMesh(t)}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 g(t,null,this.assetService,this.assetResourceLoader,this.shaders,!1)}async getAsset(e){return this.assetService.getAsset(e)}};f=e([c(),t("design:paramtypes",[s,Object,Array])],f);export{f as AssetLoader};
2
- /*
1
+ import{__decorate as e,__metadata as t}from"tslib";import{AssetResourceLoader as s}from"../../scene/asset-resource-loader.js";import{FBXLoader as r,GLTFLoader as a,MTLLoader as o,OBJLoader as i,TGALoader as n}from"three-stdlib";import{AudioLoader as d,LoadingManager as h,TextureLoader as l}from"three";import{pathJoin as u}from"../../utils/files.js";import{Service as c}from"typedi";import{materialFromAsset as g}from"../../scene/materializer.js";import{KTX2Loader as w}from"three/examples/jsm/Addons.js";let f=class{constructor(e,t,s){this.assetResourceLoader=e,this.assetService=t,this.shaders=s,this.baseUrl="",this.urlSuffix="",this.loadingManager=new h,this.glbLoader=new a(this.loadingManager),this.fbxLoader=new r(this.loadingManager),this.objLoader=new i(this.loadingManager),this.mtlLoader=new o(this.loadingManager),this.tgaLoader=new n(this.loadingManager),this.ktx2Loader=new w(this.loadingManager),this.textureLoader=new l(this.loadingManager),this.audioLoader=new d(this.loadingManager)}resolvePath(e){return u(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}`);return this.assetResourceLoader.getMesh(t)}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}`);return this.assetResourceLoader.getMesh(t)}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 g(t,null,this.assetService,this.assetResourceLoader,this.shaders,!1)}async getAsset(e){return this.assetService.getAsset(e)}};f=e([c(),t("design:paramtypes",[s,Object,Array])],f);export{f as AssetLoader};/*
3
2
  * Copyright (©) 2023. All rights reserved.
4
3
  * See the LICENSE.md file for details.
5
4
  */
@@ -199,3 +199,4 @@ export declare abstract class AbstractPhysicsSystem {
199
199
  */
200
200
  abstract stop(): void;
201
201
  }
202
+ //# sourceMappingURL=abstract-physics-system.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"abstract-physics-system.d.ts","sourceRoot":"","sources":["../../../../src/gameplay/services/physics/abstract-physics-system.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,MAAM,CAAA;AAC1C,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AACzC,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AAC9C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OAEG;aACa,uBAAuB,CAAC,CAAC,SAAS,SAAS,EAAE,CAAC,SAAS,SAAS,EAC9E,IAAI,EAAE,CAAC,EACP,KAAK,EAAE,CAAC,GACP,UAAU,CAAC,CAAC,CAAC;IAEhB;;OAEG;aACa,qBAAqB,CAAC,CAAC,SAAS,SAAS,EAAE,CAAC,SAAS,SAAS,EAC5E,IAAI,EAAE,CAAC,EACP,KAAK,EAAE,CAAC,GACP,UAAU,CAAC,CAAC,CAAC;IAEhB;;OAEG;aACa,oBAAoB,CAAC,CAAC,SAAS,SAAS,EAAE,CAAC,SAAS,SAAS,EAC3E,IAAI,EAAE,CAAC,EACP,KAAK,EAAE,CAAC,GACP,UAAU,CAAC,CAAC,CAAC;IAEhB;;OAEG;aACa,wBAAwB,CAAC,CAAC,SAAS,SAAS,EAAE,CAAC,SAAS,SAAS,EAC/E,IAAI,EAAE,CAAC,EACP,SAAS,EAAE,YAAY,CAAC,CAAC,CAAC,GACzB,UAAU,CAAC,CAAC,CAAC;IAEhB;;OAEG;aACa,oBAAoB,CAAC,KAAK,EAAE,SAAS,GAAG,IAAI;IAE5D;;OAEG;aACa,gBAAgB,CAAC,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,OAAO,GAAG;QACtE,EAAE,EAAE,OAAO,CAAC;QACZ,EAAE,EAAE,OAAO,CAAC;QACZ,EAAE,EAAE,OAAO,CAAA;KACZ,EAAE;IAEH;;OAEG;aACa,IAAI,IAAI,IAAI;CAC7B"}
@@ -1,5 +1,4 @@
1
- export class AbstractPhysicsSystem{}
2
- /*
1
+ export class AbstractPhysicsSystem{}/*
3
2
  * Copyright (©) 2023. All rights reserved.
4
3
  * See the LICENSE.md file for details.
5
4
  */
@@ -1,2 +1,3 @@
1
1
  export interface CollisionContact {
2
2
  }
3
+ //# sourceMappingURL=collision-contact.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"collision-contact.d.ts","sourceRoot":"","sources":["../../../../src/gameplay/services/physics/collision-contact.ts"],"names":[],"mappings":"AACA,MAAM,WAAW,gBAAgB;CAEhC"}
@@ -1,5 +1,4 @@
1
- export{};
2
- /*
1
+ export{};/*
3
2
  * Copyright (©) 2023. All rights reserved.
4
3
  * See the LICENSE.md file for details.
5
4
  */
@@ -407,3 +407,4 @@ export declare class PhysicsSystem extends AbstractPhysicsSystem {
407
407
  createCharacterCollision(): RAPIER.CharacterCollision;
408
408
  }
409
409
  export {};
410
+ //# sourceMappingURL=physics-system.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"physics-system.d.ts","sourceRoot":"","sources":["../../../../src/gameplay/services/physics/physics-system.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,2BAA2B,CAAA;AAEnD,OAAO,EAAgE,UAAU,EAAE,OAAO,EAA2B,MAAM,MAAM,CAAA;AAEjI,OAAO,EAGL,mBAAmB,EAE6C,QAAQ,EAIxE,OAAO,EACR,MAAM,OAAO,CAAA;AAGd,OAAO,EAGL,cAAc,EAQf,MAAM,mBAAmB,CAAA;AAM1B,OAAO,EAAE,YAAY,EAAQ,MAAM,wBAAwB,CAAA;AAC3D,OAAO,EAAW,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAC7C,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AAKnC,OAAO,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAA;AAGzF,qBAAa,aAAa;IAGxB,KAAK,CAAC,EAAE,SAAS,CAAA;IACjB,MAAM,EAAE,OAAO,CAAQ;IACvB,QAAQ,EAAE,MAAM,CAAA;IAChB,QAAQ,EAAE,OAAO,CAAgB;IACjC,SAAS,EAAE,OAAO,CAAgB;CACnC;AAED,UAAU,cAAc;IACtB,UAAU,CAAC,EAAE,mBAAmB,CAAA;IAChC,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,eAAe,CAAC,EAAE,MAAM,CAAA;IACx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AC,UAAU;IAKlB;;;;;OAKG;IACI,gBAAgB,CAAC,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,OAAO,GAAG;QAC7D,EAAE,EAAE,OAAO,CAAC;QACZ,EAAE,EAAE,OAAO,CAAC;QACZ,EAAE,EAAE,OAAO,CAAA;KACZ,EAAE;IA8BH;;OAEG;IACI,IAAI;IAMX;;;;;;;OAOG;IACH,OAAO,CAAC,gBAAgB;IA2BxB;;;;;;;OAOG;IACH,OAAO,CAAC,QAAQ;IAmBhB;;;;;;OAMG;IACH,OAAO,CAAC,WAAW;IAyEnB;;;OAGG;IACI,wBAAwB,IAAI,MAAM,CAAC,kBAAkB;CAG7D"}
@@ -1,5 +1,4 @@
1
- import{__decorate as e,__metadata as t}from"tslib";import*as i from"@dimforge/rapier3d-compat";import{QueryFilterFlags as s}from"@dimforge/rapier3d-compat";import{BehaviorSubject as o,distinctUntilChanged as r,filter as n,map as a,Subject as c,takeUntil as l}from"rxjs";import*as d from"three";import{ArrowHelper as h,BufferAttribute as u,BufferGeometry as y,Group as p,LineSegments as g,Matrix4 as m,Object3D as f,Quaternion as w,Raycaster as v,Scene as x,Vector3 as B}from"three";import{Service as b}from"typedi";import{AssetMeshInstance as A}from"../../../scene/asset-resource-loader.js";import{BoxCollisionShape as C,CapsuleCollisionShape as D,ConeCollisionShape as z,ConvexPolyhedronCollisionShape as R,CylinderCollisionShape as S,PhysicalShapeMesh as T,PlaneCollisionShape as M,SphereCollisionShape as E,TrimeshCollisionShape as W}from"../../../index.js";import{LandscapeGroup as F}from"../../../scene/landscape/landscape.js";import{ViewController as V}from"../render.js";import{World as _}from"../world.js";import*as I from"three/examples/jsm/utils/BufferGeometryUtils.js";import{calculateEffectiveScale as j}from"../../../utils/three/traverse.js";import{AbstractPhysicsSystem as L}from"./abstract-physics-system.js";export class RayTestResult{constructor(){this.hasHit=!1,this.hitPoint=new B,this.hitNormal=new B}}export var PhysicsBodyType;!function(e){e[e.dynamic=1]="dynamic",e[e.static=2]="static",e[e.kinematic=4]="kinematic",e[e.kinematicVelocityBased=8]="kinematicVelocityBased"}(PhysicsBodyType||(PhysicsBodyType={}));let P=class extends L{set showDebug(e){this.shouldRenderDebug=e,this.debugMesh&&(this.debugMesh.visible=e)}get showDebug(){return this.shouldRenderDebug}constructor(e,t){super(),this.viewController=e,this.gameWorld=t,this.staticMeshes=new Map,this.staticBodies=new Map,this.actorBodies=new Map,this.bodyActors=new Map,this.collisionEvents=new c,this.beforeStep=new c,this.afterStep=new c,this.shouldRenderDebug=!1,this._raycaster=new v,this._reusableResult=new RayTestResult,this._raytestDiff=new B,this._raytestDirection=new B,this.controlledActors=new Set,this.ready=this.setup()}createDebugMesh(){return new g(new y,new d.LineBasicMaterial({color:255}))}async start(){return await this.ready,this.handleTick(),this.ready}renderDebug(){null==this.debugMesh&&(this.debugMesh=this.createDebugMesh(),this.debugMesh.visible=this.shouldRenderDebug,this.debugMesh.raycast=function(){},this.gameWorld.scene.add(this.debugMesh));const e=this.world.debugRender();this.debugMesh.geometry.setAttribute("position",new u(e.vertices,3))}async setup(){if(null!=this.rapier)throw new Error("Rapier is already estup");this.rapier=await X(),this.eventQueue=new i.EventQueue(!0),this.setupWorld()}handleTick(){this.fixedupdateSub=this.viewController.onUpdate().subscribe((e=>{e=Math.min(.1,e),this.beforeStep.next(e),this.updatePhysics(e),this.afterStep.next(e),this.showDebug&&this.renderDebug(),this.world.bodies.forEach((e=>{if(e.isFixed())return;const t=this.staticMeshes.get(e)??this.bodyActors.get(e)?.object;var i,s;null!=t&&(t.parent instanceof x&&(Y(t.position,e.translation()),(e.isDynamic()||e.isKinematic()&&!this.controlledActors.has(this.bodyActors.get(e)?.id))&&(i=t.quaternion,s=e.rotation(),i.x=s.x,i.y=s.y,i.z=s.z,i.w=s.w)))}))}))}_updateWorld(){this.world.timestep=0,this.world.step()}updatePhysics(e){this.world.timestep=e,this.world.step(this.eventQueue),this.eventQueue.drainCollisionEvents(((e,t,i)=>{this.collisionEvents.next({handle1:e,handle2:t,started:i}),this.collisionEvents.next({handle1:t,handle2:e,started:i})}))}rayTestFromCamera(e,t,i){this._raycaster.setFromCamera(H,this.viewController.getCamera());const s=this._raycaster.ray.origin,o=this._raycaster.ray.direction.multiplyScalar(e).add(s);return this.rayTest(s,o,t,i)}rayTest(e,t,s,o){null==s&&(s=this._reusableResult);const r=this._raytestDiff,n=this._raytestDirection;if(r.subVectors(t,e),n.copy(r).normalize(),0===n.length())return console.warn("Ray test called with to and from being equal"),s;const a=new i.Ray(e,n),c=r.length(),l=this.world.castRayAndGetNormal(a,c,!1,void 0,void 0,void 0,null!=o?.excludeActor?this.actorBodies.get(o.excludeActor.id):void 0,o?.excludeTriggers?e=>!e.isSensor():void 0);if(s.hasHit=null!=l,s.hasHit){const t=a.pointAt(l.timeOfImpact);s._internal=l,Y(s.hitNormal,l.normal),Y(s.hitPoint,t),s.distance=J.subVectors(s.hitPoint,e).length();const i=this.world.bodies.getAll().find((e=>function(e,t){for(let i=0,s=e.numColliders();i<s;i++){const s=e.collider(i);if(t(s))return s}}(e,(e=>e===l.collider))));s.actor=null!=i?this.bodyActors.get(i):null}if(this.showDebug){const t=new h(n,e,c,o?.debugColor??255);this.gameWorld.scene.add(t),setTimeout((()=>this.gameWorld.scene.remove(t)),o?.debugLifetime??200)}return this._reusableResult}setGravity(e,t,i){this.world.gravity.x=e,this.world.gravity.y=t,this.world.gravity.z=i}getGravity(){return G.set(this.world.gravity.x,this.world.gravity.y,this.world.gravity.z)}addFromScene(e){this.addRecursively(e);for(const e of this.staticBodies.values())Z(e,(e=>e.setActiveEvents(i.ActiveEvents.COLLISION_EVENTS)))}addRecursively(e){if(this.removeSceneObject(e),!function(e){if(null!=e.userData?.src){const t=e.userData?.src;return"actor"===t.type}return!1}(e))if(e instanceof T&&null!=e.collisionShape){const t=this.createStaticBody(e,[e.collisionShape],e.physics);this.staticMeshes.set(t,e),this.staticBodies.set(e,t)}else if(e instanceof A&&!1!==e.userData?.src?.collisionDetection)if(e.children[0]&&e.children[0].instanceMatrix)this.createForInstancedMesh(e.children[0],e.collisionShapes);else{const t=this.createStaticBody(e,e.collisionShapes,e.physics);this.staticMeshes.set(t,e),this.staticBodies.set(e,t)}else e instanceof F?this.addLandscapeGroup(e):(e instanceof p||e instanceof x)&&e.children.forEach((e=>this.addRecursively(e)))}createForInstancedMesh(e,t){const i=new m;for(let s=0;s<e.count;s++){const o=new f;o.matrix.identity(),i.fromArray(e.instanceMatrix.array,16*s),o.applyMatrix4(i);this.createStaticBody(o,t)}}getCharacterController(e){return this.world?.createCharacterController(e)}getActorComputedMovement(e,t,i,o=null){const r=this.actorBodies.get(e.id);this.controlledActors.add(e.id);const n=r.collider(0);t.computeColliderMovement(n,i,s.EXCLUDE_SENSORS,o,ee);const a=t.computedMovement();return Y($,a),$}setNextKinematicTranslation(e,t){const i=this.actorBodies.get(e.id),s=i.translation();s.x+=t.x,s.y+=t.y,s.z+=t.z,i?.setNextKinematicTranslation(s)}setAngularVelocity(e,t){const i=this.actorBodies.get(e.id);q.x=t.x,q.y=t.y,q.z=t.z,i?.setAngvel(q,!0)}setLinearVelocity(e,t){const i=this.actorBodies.get(e.id);q.x=t.x,q.y=t.y,q.z=t.z,i?.setLinvel(q,!0)}getLinearVelocity(e,t){const i=this.actorBodies.get(e.id).linvel();return t.x=i.x,t.y=i.y,t.z=i.z,t}getAngularVelocity(e,t){const i=this.actorBodies.get(e.id).angvel();return t.x=i.x,t.y=i.y,t.z=i.z,t}setLinearDamping(e,t){const i=this.actorBodies.get(e.id);i?.setLinearDamping(t)}setAngularDamping(e,t){const i=this.actorBodies.get(e.id);i?.setAngularDamping(t)}addLandscapeGroup(e){const t=e.userData.src,s=t.landscape.heightMaps;for(const r of e.sections){this.staticBodies.has(r)&&this.world.removeRigidBody(this.staticBodies.get(r));var o=r.getWorldPosition(new B);if(t.landscape.holes&&t.landscape.holes.some((e=>e.m===r.name&&0!==e.w[0]))){const e=r.geometry.clone(),s=r.scale,n=r.geometry.getAttribute("hole"),a=new Float32Array(e.getAttribute("position").array);for(let e=0;e<a.length;e+=3)a[e]*=s.x,a[e+1]*=s.y,a[e+2]*=s.z;const c=e.index;for(let e=0;e<c.count;e+=3){const t=n.getX(c.getX(e)),i=n.getX(c.getY(e)),s=n.getX(c.getZ(e));(t>.5||i>.5||s>.5)&&(c.setX(e,0),c.setY(e,0),c.setZ(e,0))}const l=i.ColliderDesc.trimesh(a,new Uint32Array(e.getIndex().array));if(!1!==t.collisionDetection){const e=this.world.createRigidBody(i.RigidBodyDesc.fixed()),t=new i.Vector3(0,0,0);K(t,o),e.setTranslation(t,!1),this.world.createCollider(l,e),this.staticBodies.set(r,e)}continue}const e=t.landscape.options.density+1,n=t.landscape.options.sectionSize,a=new Array(e);for(let t=0;t<e;t++)a[t]=new Array(e).fill(0);const c=s.find((e=>e.x===r.x&&e.y==r.y));if(null!=c)for(const t of c.points){if(null==a[t.i%e])continue;const i=e-1-Math.floor(t.i/e);i in a[t.i%e]?a[t.i%e][i]=t.y/n:console.warn("wrong index",{points:a,point:t,i:t.i%e,k:i,heightMap:c})}const l=t.landscape.options.density,d=a.flatMap((e=>e.reverse())),h=i.ColliderDesc.heightfield(l,l,new Float32Array(d),new i.Vector3(n,n,n));if(!1!==t.collisionDetection){const e=this.world.createRigidBody(i.RigidBodyDesc.fixed()),t=new i.Vector3(0,0,0);K(t,o),e.setTranslation(t,!1),this.world.createCollider(h,e),this.staticBodies.set(r,e)}}}addActor(e,t,s={}){if(0==t.length)return void console.error("No collision shapes were defined when adding actor to the physics system.");this.removeActor(e);const o=e.object;let r;switch(s.type??PhysicsBodyType.static){case PhysicsBodyType.dynamic:r=i.RigidBodyDesc.dynamic(),r.mass=s.mass??1;break;case PhysicsBodyType.kinematic:r=i.RigidBodyDesc.kinematicPositionBased();break;case PhysicsBodyType.kinematicVelocityBased:r=i.RigidBodyDesc.kinematicVelocityBased();break;default:r=s.isTrigger?i.RigidBodyDesc.kinematicVelocityBased():i.RigidBodyDesc.fixed()}const n=this.world.createRigidBody(r);n.enableCcd(1==s.continousCollisionDetection);for(const e of t)this.addShape(n,e,o);Z(n,(e=>{null!=s.isTrigger&&(e.setSensor(s.isTrigger),e.setActiveCollisionTypes(i.ActiveCollisionTypes.ALL),e.setActiveEvents(i.ActiveEvents.COLLISION_EVENTS)),null!=s.friction&&e.setFriction(s.friction),null!=s.density&&e.setDensity(s.density),null!=s.mass&&e.setMass(s.mass),null!=s.restitution&&e.setRestitution(s.restitution)})),N(n,o),!0===s.ignoreForNavMesh&&(n.userData={ignoreForNavMesh:!0}),this.actorBodies.set(e.id,n),this.bodyActors.set(n,e)}applyTorque(e,t){const i=this.actorBodies.get(e.id);q.x=t.x,q.y=t.y,q.z=t.z,i?.addTorque(q,!0)}applyTorqueImpulse(e,t){const i=this.actorBodies.get(e.id);q.x=t.x,q.y=t.y,q.z=t.z,i?.applyTorqueImpulse(q,!0)}resetForces(e){const t=this.actorBodies.get(e.id);t?.resetForces(!1)}resetTorques(e){const t=this.actorBodies.get(e.id);t?.resetTorques(!1)}applyForce(e,t){const i=this.actorBodies.get(e.id);q.x=t.x,q.y=t.y,q.z=t.z,i?.addForce(q,!0)}applyImpulse(e,t){const i=this.actorBodies.get(e.id);q.x=t.x,q.y=t.y,q.z=t.z,i?.applyImpulse(q,!0)}applyLocalForce(e,t,i){const s=this.actorBodies.get(e.id);K(q,t),null==i?s?.addForce(q,!0):(K(Q,i),s?.addForceAtPoint(q,Q,!0))}applyLocalImpulse(e,t,i){const s=this.actorBodies.get(e.id);K(q,t),null==i?s.applyImpulse(q,!0):(K(Q,i),s.applyImpulseAtPoint(q,Q,!0))}applyRadiusImpulse(e,t,s){this.world.bodies.forEach((o=>{if(o.collider(0)?.isSensor())return;if(o.bodyType()!==i.RigidBodyType.Dynamic)return;const r=U;Y(r,o.translation());const n=r.clone().sub(e);if(n.length()>t)return;const a=n.clone().normalize().multiplyScalar(s);q.x=a.x,q.y=a.y,q.z=a.z,o.applyImpulse(q,!0)}))}removeActor(e){if(null==e)return;this.controlledActors.delete(e.id);const t=this.actorBodies.get(e.id);null!=t&&(this.bodyActors.delete(t),this.world.removeRigidBody(t)),this.actorBodies.delete(e.id)}removeRemoved(e){const t=new Set;e.traverse((e=>{t.add(e.uuid)}));for(const[e,i]of this.staticBodies.entries())!t.has(e.uuid)&&this.world.getRigidBody(i.handle)&&(this.staticBodies.delete(e),this.world.removeRigidBody(i))}removeSceneObject(e){if(e instanceof F){for(const t of e.sections)this.removeSceneObject(t);return}let t=this.staticBodies.get(e);null!=t&&this.world.getRigidBody(t.handle)&&this.world.removeRigidBody(t),this.staticBodies.delete(e)}activateActorEvents(e){this.actorBodies.get(e.id)}_onCollisionWithActorEvent(e,t,i){return this.activateActorEvents(e),this.collisionEvents.pipe(l(e.disposed),n((({started:e})=>e===i)),a((({handle1:e,handle2:t,started:i})=>({a1:this.bodyActors.get(this.world.getCollider(e)?.parent()),a2:this.bodyActors.get(this.world.getCollider(t)?.parent()),started:i}))),n((({a1:i,a2:s})=>null!=i&&null!=s&&i.id===e.id&&t(i,s))),a((({a2:e})=>e)))}onBeginContact(e){return this.activateActorEvents(e),this.collisionEvents.pipe(l(e.disposed),n((e=>e.started)),n((({handle1:t})=>{const i=this.bodyActors.get(this.world.getCollider(t)?.parent());return null!=i&&i.id===e.id})),a((e=>e.handle2)))}onEndContact(e){return this.activateActorEvents(e),this.collisionEvents.pipe(l(e.disposed),n((e=>!e.started)),n((({handle1:t})=>{const i=this.bodyActors.get(this.world.getCollider(t)?.parent());return null!=i&&i.id===e.id})),a((e=>e.handle2)))}onHasContactChanged(e){const t=new Set,i=new o(!1);return this.onBeginContact(e).subscribe((e=>{t.add(e),i.next(t.size>0)})),this.onEndContact(e).subscribe((e=>{t.delete(e),i.next(t.size>0)})),i.pipe(r())}onBeginOverlapWithActorType(e,t){return this._onCollisionWithActorEvent(e,((e,i)=>i instanceof t),!0)}onEndOverlapWithActorType(e,t){return this._onCollisionWithActorEvent(e,((e,i)=>i instanceof t),!1)}onBeginOverlapWithActor(e,t){return this._onCollisionWithActorEvent(e,((e,i)=>t.id===i.id),!0)}onEndOverlapWithActor(e,t){return this._onCollisionWithActorEvent(e,((e,i)=>t.id===i.id),!1)}onCollisionWithActor(e,t){return this.onBeginOverlapWithActor(e,t)}onCollisionWithActorType(e,t){return this.onBeginOverlapWithActorType(e,t)}updateActorTransform(e){const t=this.actorBodies.get(e.id);null!=t?N(t,e.object):console.warn("Actor has not been added to physics world",e)}setupWorld(){const e=new i.World({x:0,y:-9.81,z:0});this.world=e}getActorContacts(e,t){const s=this.actorBodies.get(e.id);if(s&&s.numColliders()>0){const o=s.collider(0);let r=o.shape,n=o.translation(),a=o.rotation(),c=t,l=.3;const d=this.world.castShape(n,a,c,r,.1,l,!0,null,null,null,this.actorBodies.get(e.id),(e=>e.shape.type!=i.ShapeType.HeightField));if(null!=d){const e=new B,t=new B,i=new B;return Y(e,d.witness2),Y(t,d.witness1),Y(i,d.normal1),i.negate(),[{ri:e,rj:t,ni:i}]}return[]}return console.warn("Actor is not added to the physics system"),[]}stop(){this.world?.bodies.forEach((e=>this.world.removeRigidBody(e))),this.world?.free(),this.fixedupdateSub?.unsubscribe()}createStaticBody(e,t,s){const o=s?.type===PhysicsBodyType.dynamic?i.RigidBodyDesc.dynamic():i.RigidBodyDesc.fixed(),r=this.world.createRigidBody(o);for(const i of t){if(null==i){console.warn("Collision shape is missing for object",e);continue}const o=this.addShape(r,i,e);null!=s?.friction&&o.setFriction(s.friction),null!=s?.density&&o.setDensity(s.density),null!=s?.mass&&o.setMass(s.mass/t.length),null!=s?.restitution&&o.setRestitution(s.restitution)}return N(r,e),r.userData=e.uuid,r}addShape(e,t,i){const s=i.getWorldScale(te),o=this.createShape(t,s);null!=t.collisionGroup&&o.setCollisionGroups(t.collisionGroup),o.friction=.1;const r=t.offset.clone().multiply(s);var n,a;K(o.translation,r),n=o.rotation,a=(new w).setFromEuler(t.rotation),n.x=a.x,n.y=a.y,n.z=a.z,n.w=a.w;return this.world.createCollider(o,e)}createShape(e,t){if(e instanceof C)return i.ColliderDesc.cuboid(e.dimensions.x*t.x/2,e.dimensions.y*t.y/2,e.dimensions.z*t.z/2);if(e instanceof D){return i.ColliderDesc.capsule(e.length/2*t.y,e.radius*Math.max(t.z,t.x))}if(e instanceof W){const s=null!=e.geometry.getIndex()?e.geometry:I.mergeVertices(e.geometry),o=new Float32Array(s.getAttribute("position").array);for(let e=0;e<o.length;e+=3)o[e]*=t.x,o[e+1]*=t.y,o[e+2]*=t.z;return i.ColliderDesc.trimesh(o,new Uint32Array(s.getIndex().array))}if(e instanceof R){let s;e.mesh instanceof d.Mesh?s=e.mesh.geometry:e.mesh instanceof d.BufferGeometry?s=e.mesh:console.log("Unknownd shape",{shapeInfo:e});const o=new Float32Array(s.getAttribute("position").array);if(e.mesh instanceof d.Mesh){const t=j(e.mesh);for(let e=0;e<o.length;e+=3)o[e]*=t.x,o[e+1]*=t.y,o[e+2]*=t.z}for(let e=0;e<o.length;e+=3)o[e]*=t.x,o[e+1]*=t.y,o[e+2]*=t.z;const r=o;return i.ColliderDesc.convexHull(r)}if(e instanceof E){const s=2*t.x-t.y-t.z;return Math.abs(s)>.01?this.createShape(new R(new d.SphereGeometry(e.radius).scale(t.x,t.y,t.z)),new B(1,1,1)):i.ColliderDesc.ball(e.radius*Math.max(t.x,t.y,t.z))}return e instanceof S?i.ColliderDesc.cylinder(e.height/2*t.y,e.radiusTop*Math.max(t.z,t.x)):e instanceof z?i.ColliderDesc.cone(e.height*t.y,e.radiusBottom/2*Math.max(t.z,t.x)):e instanceof M?i.ColliderDesc.cuboid(e.width/2*t.x,e.height/2*t.y,.01):(console.error("Unsupported shape",e),i.ColliderDesc.cuboid(1,1,1))}createCharacterCollision(){return new i.CharacterCollision}};P=e([b(),t("design:paramtypes",[V,_])],P);export{P as PhysicsSystem};const k=new B,O=new d.Quaternion;function N(e,t){const s=t.getWorldPosition(k),o=t.getWorldQuaternion(O);e.setTranslation(new i.Vector3(s.x,s.y,s.z),!1),e.setRotation(new i.Quaternion(o.x,o.y,o.z,o.w),!1)}const G=new B,q=new i.Vector3(0,0,0),Q=new i.Vector3(0,0,0),U=new B,H=new d.Vector2,X=async()=>{let e=await import("@dimforge/rapier3d-compat");return await e.init(),e};function K(e,t){e.x=t.x,e.y=t.y,e.z=t.z}function Y(e,t){e.x=t.x,e.y=t.y,e.z=t.z}function Z(e,t){for(let i=0,s=e.numColliders();i<s;i++){t(e.collider(i))}}const J=new B,$=new B,ee=e=>!e.isSensor(),te=new B;
2
- /*
1
+ import{__decorate as e,__metadata as t}from"tslib";import*as i from"@dimforge/rapier3d-compat";import{QueryFilterFlags as s}from"@dimforge/rapier3d-compat";import{BehaviorSubject as o,distinctUntilChanged as r,filter as n,map as a,Subject as c,takeUntil as l}from"rxjs";import*as d from"three";import{ArrowHelper as h,BufferAttribute as u,BufferGeometry as y,Group as p,LineSegments as g,Matrix4 as m,Object3D as f,Quaternion as w,Raycaster as v,Scene as x,Vector3 as B}from"three";import{Service as b}from"typedi";import{AssetMeshInstance as A}from"../../../scene/asset-resource-loader.js";import{BoxCollisionShape as C,CapsuleCollisionShape as D,ConeCollisionShape as z,ConvexPolyhedronCollisionShape as R,CylinderCollisionShape as S,PhysicalShapeMesh as T,PlaneCollisionShape as M,SphereCollisionShape as E,TrimeshCollisionShape as W}from"../../../index.js";import{LandscapeGroup as F}from"../../../scene/landscape/landscape.js";import{ViewController as V}from"../render.js";import{World as _}from"../world.js";import*as I from"three/examples/jsm/utils/BufferGeometryUtils.js";import{calculateEffectiveScale as j}from"../../../utils/three/traverse.js";import{AbstractPhysicsSystem as L}from"./abstract-physics-system.js";export class RayTestResult{constructor(){this.hasHit=!1,this.hitPoint=new B,this.hitNormal=new B}}export var PhysicsBodyType;!function(e){e[e.dynamic=1]="dynamic",e[e.static=2]="static",e[e.kinematic=4]="kinematic",e[e.kinematicVelocityBased=8]="kinematicVelocityBased"}(PhysicsBodyType||(PhysicsBodyType={}));let P=class extends L{set showDebug(e){this.shouldRenderDebug=e,this.debugMesh&&(this.debugMesh.visible=e)}get showDebug(){return this.shouldRenderDebug}constructor(e,t){super(),this.viewController=e,this.gameWorld=t,this.staticMeshes=new Map,this.staticBodies=new Map,this.actorBodies=new Map,this.bodyActors=new Map,this.collisionEvents=new c,this.beforeStep=new c,this.afterStep=new c,this.shouldRenderDebug=!1,this._raycaster=new v,this._reusableResult=new RayTestResult,this._raytestDiff=new B,this._raytestDirection=new B,this.controlledActors=new Set,this.ready=this.setup()}createDebugMesh(){return new g(new y,new d.LineBasicMaterial({color:255}))}async start(){return await this.ready,this.handleTick(),this.ready}renderDebug(){null==this.debugMesh&&(this.debugMesh=this.createDebugMesh(),this.debugMesh.visible=this.shouldRenderDebug,this.debugMesh.raycast=function(){},this.gameWorld.scene.add(this.debugMesh));const e=this.world.debugRender();this.debugMesh.geometry.setAttribute("position",new u(e.vertices,3))}async setup(){if(null!=this.rapier)throw new Error("Rapier is already estup");this.rapier=await X(),this.eventQueue=new i.EventQueue(!0),this.setupWorld()}handleTick(){this.fixedupdateSub=this.viewController.onUpdate().subscribe((e=>{e=Math.min(.1,e),this.beforeStep.next(e),this.updatePhysics(e),this.afterStep.next(e),this.showDebug&&this.renderDebug(),this.world.bodies.forEach((e=>{if(e.isFixed())return;const t=this.staticMeshes.get(e)??this.bodyActors.get(e)?.object;var i,s;null!=t&&(t.parent instanceof x&&(Y(t.position,e.translation()),(e.isDynamic()||e.isKinematic()&&!this.controlledActors.has(this.bodyActors.get(e)?.id))&&(i=t.quaternion,s=e.rotation(),i.x=s.x,i.y=s.y,i.z=s.z,i.w=s.w)))}))}))}_updateWorld(){this.world.timestep=0,this.world.step()}updatePhysics(e){this.world.timestep=e,this.world.step(this.eventQueue),this.eventQueue.drainCollisionEvents(((e,t,i)=>{this.collisionEvents.next({handle1:e,handle2:t,started:i}),this.collisionEvents.next({handle1:t,handle2:e,started:i})}))}rayTestFromCamera(e,t,i){this._raycaster.setFromCamera(H,this.viewController.getCamera());const s=this._raycaster.ray.origin,o=this._raycaster.ray.direction.multiplyScalar(e).add(s);return this.rayTest(s,o,t,i)}rayTest(e,t,s,o){null==s&&(s=this._reusableResult);const r=this._raytestDiff,n=this._raytestDirection;if(r.subVectors(t,e),n.copy(r).normalize(),0===n.length())return console.warn("Ray test called with to and from being equal"),s;const a=new i.Ray(e,n),c=r.length(),l=this.world.castRayAndGetNormal(a,c,!1,void 0,void 0,void 0,null!=o?.excludeActor?this.actorBodies.get(o.excludeActor.id):void 0,o?.excludeTriggers?e=>!e.isSensor():void 0);if(s.hasHit=null!=l,s.hasHit){const t=a.pointAt(l.timeOfImpact);s._internal=l,Y(s.hitNormal,l.normal),Y(s.hitPoint,t),s.distance=J.subVectors(s.hitPoint,e).length();const i=this.world.bodies.getAll().find((e=>function(e,t){for(let i=0,s=e.numColliders();i<s;i++){const s=e.collider(i);if(t(s))return s}}(e,(e=>e===l.collider))));s.actor=null!=i?this.bodyActors.get(i):null}if(this.showDebug){const t=new h(n,e,c,o?.debugColor??255);this.gameWorld.scene.add(t),setTimeout((()=>this.gameWorld.scene.remove(t)),o?.debugLifetime??200)}return this._reusableResult}setGravity(e,t,i){this.world.gravity.x=e,this.world.gravity.y=t,this.world.gravity.z=i}getGravity(){return G.set(this.world.gravity.x,this.world.gravity.y,this.world.gravity.z)}addFromScene(e){this.addRecursively(e);for(const e of this.staticBodies.values())Z(e,(e=>e.setActiveEvents(i.ActiveEvents.COLLISION_EVENTS)))}addRecursively(e){if(this.removeSceneObject(e),!function(e){if(null!=e.userData?.src){const t=e.userData?.src;return"actor"===t.type}return!1}(e))if(e instanceof T&&null!=e.collisionShape){const t=this.createStaticBody(e,[e.collisionShape],e.physics);this.staticMeshes.set(t,e),this.staticBodies.set(e,t)}else if(e instanceof A&&!1!==e.userData?.src?.collisionDetection)if(e.children[0]&&e.children[0].instanceMatrix)this.createForInstancedMesh(e.children[0],e.collisionShapes);else{const t=this.createStaticBody(e,e.collisionShapes,e.physics);this.staticMeshes.set(t,e),this.staticBodies.set(e,t)}else e instanceof F?this.addLandscapeGroup(e):(e instanceof p||e instanceof x)&&e.children.forEach((e=>this.addRecursively(e)))}createForInstancedMesh(e,t){const i=new m;for(let s=0;s<e.count;s++){const o=new f;o.matrix.identity(),i.fromArray(e.instanceMatrix.array,16*s),o.applyMatrix4(i);this.createStaticBody(o,t)}}getCharacterController(e){return this.world?.createCharacterController(e)}getActorComputedMovement(e,t,i,o=null){const r=this.actorBodies.get(e.id);this.controlledActors.add(e.id);const n=r.collider(0);t.computeColliderMovement(n,i,s.EXCLUDE_SENSORS,o,ee);const a=t.computedMovement();return Y($,a),$}setNextKinematicTranslation(e,t){const i=this.actorBodies.get(e.id),s=i.translation();s.x+=t.x,s.y+=t.y,s.z+=t.z,i?.setNextKinematicTranslation(s)}setAngularVelocity(e,t){const i=this.actorBodies.get(e.id);q.x=t.x,q.y=t.y,q.z=t.z,i?.setAngvel(q,!0)}setLinearVelocity(e,t){const i=this.actorBodies.get(e.id);q.x=t.x,q.y=t.y,q.z=t.z,i?.setLinvel(q,!0)}getLinearVelocity(e,t){const i=this.actorBodies.get(e.id).linvel();return t.x=i.x,t.y=i.y,t.z=i.z,t}getAngularVelocity(e,t){const i=this.actorBodies.get(e.id).angvel();return t.x=i.x,t.y=i.y,t.z=i.z,t}setLinearDamping(e,t){const i=this.actorBodies.get(e.id);i?.setLinearDamping(t)}setAngularDamping(e,t){const i=this.actorBodies.get(e.id);i?.setAngularDamping(t)}addLandscapeGroup(e){const t=e.userData.src,s=t.landscape.heightMaps;for(const r of e.sections){this.staticBodies.has(r)&&this.world.removeRigidBody(this.staticBodies.get(r));var o=r.getWorldPosition(new B);if(t.landscape.holes&&t.landscape.holes.some((e=>e.m===r.name&&0!==e.w[0]))){const e=r.geometry.clone(),s=r.scale,n=r.geometry.getAttribute("hole"),a=new Float32Array(e.getAttribute("position").array);for(let e=0;e<a.length;e+=3)a[e]*=s.x,a[e+1]*=s.y,a[e+2]*=s.z;const c=e.index;for(let e=0;e<c.count;e+=3){const t=n.getX(c.getX(e)),i=n.getX(c.getY(e)),s=n.getX(c.getZ(e));(t>.5||i>.5||s>.5)&&(c.setX(e,0),c.setY(e,0),c.setZ(e,0))}const l=i.ColliderDesc.trimesh(a,new Uint32Array(e.getIndex().array));if(!1!==t.collisionDetection){const e=this.world.createRigidBody(i.RigidBodyDesc.fixed()),t=new i.Vector3(0,0,0);K(t,o),e.setTranslation(t,!1),this.world.createCollider(l,e),this.staticBodies.set(r,e)}continue}const e=t.landscape.options.density+1,n=t.landscape.options.sectionSize,a=new Array(e);for(let t=0;t<e;t++)a[t]=new Array(e).fill(0);const c=s.find((e=>e.x===r.x&&e.y==r.y));if(null!=c)for(const t of c.points){if(null==a[t.i%e])continue;const i=e-1-Math.floor(t.i/e);i in a[t.i%e]?a[t.i%e][i]=t.y/n:console.warn("wrong index",{points:a,point:t,i:t.i%e,k:i,heightMap:c})}const l=t.landscape.options.density,d=a.flatMap((e=>e.reverse())),h=i.ColliderDesc.heightfield(l,l,new Float32Array(d),new i.Vector3(n,n,n));if(!1!==t.collisionDetection){const e=this.world.createRigidBody(i.RigidBodyDesc.fixed()),t=new i.Vector3(0,0,0);K(t,o),e.setTranslation(t,!1),this.world.createCollider(h,e),this.staticBodies.set(r,e)}}}addActor(e,t,s={}){if(0==t.length)return void console.error("No collision shapes were defined when adding actor to the physics system.");this.removeActor(e);const o=e.object;let r;switch(s.type??PhysicsBodyType.static){case PhysicsBodyType.dynamic:r=i.RigidBodyDesc.dynamic(),r.mass=s.mass??1;break;case PhysicsBodyType.kinematic:r=i.RigidBodyDesc.kinematicPositionBased();break;case PhysicsBodyType.kinematicVelocityBased:r=i.RigidBodyDesc.kinematicVelocityBased();break;default:r=s.isTrigger?i.RigidBodyDesc.kinematicVelocityBased():i.RigidBodyDesc.fixed()}const n=this.world.createRigidBody(r);n.enableCcd(1==s.continousCollisionDetection);for(const e of t)this.addShape(n,e,o);Z(n,(e=>{null!=s.isTrigger&&(e.setSensor(s.isTrigger),e.setActiveCollisionTypes(i.ActiveCollisionTypes.ALL),e.setActiveEvents(i.ActiveEvents.COLLISION_EVENTS)),null!=s.friction&&e.setFriction(s.friction),null!=s.density&&e.setDensity(s.density),null!=s.mass&&e.setMass(s.mass),null!=s.restitution&&e.setRestitution(s.restitution)})),N(n,o),!0===s.ignoreForNavMesh&&(n.userData={ignoreForNavMesh:!0}),this.actorBodies.set(e.id,n),this.bodyActors.set(n,e)}applyTorque(e,t){const i=this.actorBodies.get(e.id);q.x=t.x,q.y=t.y,q.z=t.z,i?.addTorque(q,!0)}applyTorqueImpulse(e,t){const i=this.actorBodies.get(e.id);q.x=t.x,q.y=t.y,q.z=t.z,i?.applyTorqueImpulse(q,!0)}resetForces(e){const t=this.actorBodies.get(e.id);t?.resetForces(!1)}resetTorques(e){const t=this.actorBodies.get(e.id);t?.resetTorques(!1)}applyForce(e,t){const i=this.actorBodies.get(e.id);q.x=t.x,q.y=t.y,q.z=t.z,i?.addForce(q,!0)}applyImpulse(e,t){const i=this.actorBodies.get(e.id);q.x=t.x,q.y=t.y,q.z=t.z,i?.applyImpulse(q,!0)}applyLocalForce(e,t,i){const s=this.actorBodies.get(e.id);K(q,t),null==i?s?.addForce(q,!0):(K(Q,i),s?.addForceAtPoint(q,Q,!0))}applyLocalImpulse(e,t,i){const s=this.actorBodies.get(e.id);K(q,t),null==i?s.applyImpulse(q,!0):(K(Q,i),s.applyImpulseAtPoint(q,Q,!0))}applyRadiusImpulse(e,t,s){this.world.bodies.forEach((o=>{if(o.collider(0)?.isSensor())return;if(o.bodyType()!==i.RigidBodyType.Dynamic)return;const r=U;Y(r,o.translation());const n=r.clone().sub(e);if(n.length()>t)return;const a=n.clone().normalize().multiplyScalar(s);q.x=a.x,q.y=a.y,q.z=a.z,o.applyImpulse(q,!0)}))}removeActor(e){if(null==e)return;this.controlledActors.delete(e.id);const t=this.actorBodies.get(e.id);null!=t&&(this.bodyActors.delete(t),this.world.removeRigidBody(t)),this.actorBodies.delete(e.id)}removeRemoved(e){const t=new Set;e.traverse((e=>{t.add(e.uuid)}));for(const[e,i]of this.staticBodies.entries())!t.has(e.uuid)&&this.world.getRigidBody(i.handle)&&(this.staticBodies.delete(e),this.world.removeRigidBody(i))}removeSceneObject(e){if(e instanceof F){for(const t of e.sections)this.removeSceneObject(t);return}let t=this.staticBodies.get(e);null!=t&&this.world.getRigidBody(t.handle)&&this.world.removeRigidBody(t),this.staticBodies.delete(e)}activateActorEvents(e){this.actorBodies.get(e.id)}_onCollisionWithActorEvent(e,t,i){return this.activateActorEvents(e),this.collisionEvents.pipe(l(e.disposed),n((({started:e})=>e===i)),a((({handle1:e,handle2:t,started:i})=>({a1:this.bodyActors.get(this.world.getCollider(e)?.parent()),a2:this.bodyActors.get(this.world.getCollider(t)?.parent()),started:i}))),n((({a1:i,a2:s})=>null!=i&&null!=s&&i.id===e.id&&t(i,s))),a((({a2:e})=>e)))}onBeginContact(e){return this.activateActorEvents(e),this.collisionEvents.pipe(l(e.disposed),n((e=>e.started)),n((({handle1:t})=>{const i=this.bodyActors.get(this.world.getCollider(t)?.parent());return null!=i&&i.id===e.id})),a((e=>e.handle2)))}onEndContact(e){return this.activateActorEvents(e),this.collisionEvents.pipe(l(e.disposed),n((e=>!e.started)),n((({handle1:t})=>{const i=this.bodyActors.get(this.world.getCollider(t)?.parent());return null!=i&&i.id===e.id})),a((e=>e.handle2)))}onHasContactChanged(e){const t=new Set,i=new o(!1);return this.onBeginContact(e).subscribe((e=>{t.add(e),i.next(t.size>0)})),this.onEndContact(e).subscribe((e=>{t.delete(e),i.next(t.size>0)})),i.pipe(r())}onBeginOverlapWithActorType(e,t){return this._onCollisionWithActorEvent(e,((e,i)=>i instanceof t),!0)}onEndOverlapWithActorType(e,t){return this._onCollisionWithActorEvent(e,((e,i)=>i instanceof t),!1)}onBeginOverlapWithActor(e,t){return this._onCollisionWithActorEvent(e,((e,i)=>t.id===i.id),!0)}onEndOverlapWithActor(e,t){return this._onCollisionWithActorEvent(e,((e,i)=>t.id===i.id),!1)}onCollisionWithActor(e,t){return this.onBeginOverlapWithActor(e,t)}onCollisionWithActorType(e,t){return this.onBeginOverlapWithActorType(e,t)}updateActorTransform(e){const t=this.actorBodies.get(e.id);null!=t?N(t,e.object):console.warn("Actor has not been added to physics world",e)}setupWorld(){const e=new i.World({x:0,y:-9.81,z:0});this.world=e}getActorContacts(e,t){const s=this.actorBodies.get(e.id);if(s&&s.numColliders()>0){const o=s.collider(0);let r=o.shape,n=o.translation(),a=o.rotation(),c=t,l=.3;const d=this.world.castShape(n,a,c,r,.1,l,!0,null,null,null,this.actorBodies.get(e.id),(e=>e.shape.type!=i.ShapeType.HeightField));if(null!=d){const e=new B,t=new B,i=new B;return Y(e,d.witness2),Y(t,d.witness1),Y(i,d.normal1),i.negate(),[{ri:e,rj:t,ni:i}]}return[]}return console.warn("Actor is not added to the physics system"),[]}stop(){this.world?.bodies.forEach((e=>this.world.removeRigidBody(e))),this.world?.free(),this.fixedupdateSub?.unsubscribe()}createStaticBody(e,t,s){const o=s?.type===PhysicsBodyType.dynamic?i.RigidBodyDesc.dynamic():i.RigidBodyDesc.fixed(),r=this.world.createRigidBody(o);for(const i of t){if(null==i){console.warn("Collision shape is missing for object",e);continue}const o=this.addShape(r,i,e);null!=s?.friction&&o.setFriction(s.friction),null!=s?.density&&o.setDensity(s.density),null!=s?.mass&&o.setMass(s.mass/t.length),null!=s?.restitution&&o.setRestitution(s.restitution)}return N(r,e),r.userData=e.uuid,r}addShape(e,t,i){const s=i.getWorldScale(te),o=this.createShape(t,s);null!=t.collisionGroup&&o.setCollisionGroups(t.collisionGroup),o.friction=.1;const r=t.offset.clone().multiply(s);var n,a;K(o.translation,r),n=o.rotation,a=(new w).setFromEuler(t.rotation),n.x=a.x,n.y=a.y,n.z=a.z,n.w=a.w;return this.world.createCollider(o,e)}createShape(e,t){if(e instanceof C)return i.ColliderDesc.cuboid(e.dimensions.x*t.x/2,e.dimensions.y*t.y/2,e.dimensions.z*t.z/2);if(e instanceof D){return i.ColliderDesc.capsule(e.length/2*t.y,e.radius*Math.max(t.z,t.x))}if(e instanceof W){const s=null!=e.geometry.getIndex()?e.geometry:I.mergeVertices(e.geometry),o=new Float32Array(s.getAttribute("position").array);for(let e=0;e<o.length;e+=3)o[e]*=t.x,o[e+1]*=t.y,o[e+2]*=t.z;return i.ColliderDesc.trimesh(o,new Uint32Array(s.getIndex().array))}if(e instanceof R){let s;e.mesh instanceof d.Mesh?s=e.mesh.geometry:e.mesh instanceof d.BufferGeometry?s=e.mesh:console.log("Unknownd shape",{shapeInfo:e});const o=new Float32Array(s.getAttribute("position").array);if(e.mesh instanceof d.Mesh){const t=j(e.mesh);for(let e=0;e<o.length;e+=3)o[e]*=t.x,o[e+1]*=t.y,o[e+2]*=t.z}for(let e=0;e<o.length;e+=3)o[e]*=t.x,o[e+1]*=t.y,o[e+2]*=t.z;const r=o;return i.ColliderDesc.convexHull(r)}if(e instanceof E){const s=2*t.x-t.y-t.z;return Math.abs(s)>.01?this.createShape(new R(new d.SphereGeometry(e.radius).scale(t.x,t.y,t.z)),new B(1,1,1)):i.ColliderDesc.ball(e.radius*Math.max(t.x,t.y,t.z))}return e instanceof S?i.ColliderDesc.cylinder(e.height/2*t.y,e.radiusTop*Math.max(t.z,t.x)):e instanceof z?i.ColliderDesc.cone(e.height*t.y,e.radiusBottom/2*Math.max(t.z,t.x)):e instanceof M?i.ColliderDesc.cuboid(e.width/2*t.x,e.height/2*t.y,.01):(console.error("Unsupported shape",e),i.ColliderDesc.cuboid(1,1,1))}createCharacterCollision(){return new i.CharacterCollision}};P=e([b(),t("design:paramtypes",[V,_])],P);export{P as PhysicsSystem};const k=new B,O=new d.Quaternion;function N(e,t){const s=t.getWorldPosition(k),o=t.getWorldQuaternion(O);e.setTranslation(new i.Vector3(s.x,s.y,s.z),!1),e.setRotation(new i.Quaternion(o.x,o.y,o.z,o.w),!1)}const G=new B,q=new i.Vector3(0,0,0),Q=new i.Vector3(0,0,0),U=new B,H=new d.Vector2,X=async()=>{let e=await import("@dimforge/rapier3d-compat");return await e.init(),e};function K(e,t){e.x=t.x,e.y=t.y,e.z=t.z}function Y(e,t){e.x=t.x,e.y=t.y,e.z=t.z}function Z(e,t){for(let i=0,s=e.numColliders();i<s;i++){t(e.collider(i))}}const J=new B,$=new B,ee=e=>!e.isSensor(),te=new B;/*
3
2
  * Copyright (©) 2023. All rights reserved.
4
3
  * See the LICENSE.md file for details.
5
4
  */
@@ -56,3 +56,4 @@ export declare class PointerEvents {
56
56
  private handlers;
57
57
  }
58
58
  export {};
59
+ //# sourceMappingURL=pointer-events.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pointer-events.d.ts","sourceRoot":"","sources":["../../../src/gameplay/services/pointer-events.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAC3C,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAsB,MAAM,OAAO,CAAA;AAKlE,OAAO,EAAE,UAAU,EAAyG,MAAM,MAAM,CAAA;AACxI,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAA;AAGvC,KAAK,kBAAkB,GAAG;IACxB,MAAM,EAAE,QAAQ,CAAA;IAChB,YAAY,EAAE,YAAY,CAAA;CAC3B,CAAA;AAED,KAAK,iBAAiB,CAAC,CAAC,SAAS,SAAS,IAAI;IAC5C,KAAK,EAAE,CAAC,CAAA;IACR,YAAY,EAAE,YAAY,CAAA;CAC3B,CAAA;AAED,qBACa,aAAa;IACxB,OAAO,CAAC,IAAI,CAAyB;IACrC,OAAO,CAAC,KAAK,CAAgB;IAC7B,OAAO,CAAC,OAAO,CAAQ;IACvB,OAAO,CAAC,OAAO,CAAsB;;IAwCrC,OAAO,CAAC,gBAAgB,CAA8B;IAEtD,OAAO,CAAC,kBAAkB;IAI1B,OAAO,CAAC,sBAAsB;IAY9B,OAAO,CAAC,QAAQ,CAAQ;IACxB,OAAO,CAAC,oBAAoB,CAAgB;IAC5C,OAAO,CA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