@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
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vfx-asset.d.ts","sourceRoot":"","sources":["../../../src/effects/vfx/vfx-asset.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAA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K,EAAE,gBAAgB,CAAC;IAExB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAA;IAOxC,QAAQ,EAAE,OAAO,CAAA;CAClB,GAAG,YAAY,CAAA;AAChB,MAAM,MAAM,aAAa,GAAG,YAAY,GAAG,UAAU,GAAG,WAAW,GAAG,qBAAqB,GAAG,WAAW,CAAA;AAEzG,MAAM,MAAM,WAAW,GAAG;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAA;IAIZ,IAAI,EAAE,QAAQ,CAAC;IACf,QAAQ,EAAE,WAAW,CAAC;IACtB,QAAQ,EAAE,WAAW,CAAC;IACtB,YAAY,EAAE,eAAe,EAAE,CAAC;IAChC,UAAU,EAAE,aAAa,EAAE,CAAC;IAC5B,QAAQ,CAAC,EAAE,WAAW,EAAE,CAAA;IAGxB,MAAM,EAAE,aAAa,CAAA;CACtB,CAAA;AAED,MAAM,MAAM,YAAY,GAAG;IACzB;;;;OAIG;IACH,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,QAAQ,EAAE,WAAW,EAAE,CAAA;CAExB,CAAA;AAGD,wBAAgB,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAsCrC"}
@@ -1,5 +1,4 @@
1
- import{SerializedParamType as t}from"../../scene/model.js";import*as e from"three";import{randomString as i}from"../../utils/math.js";export const BlendingModes=["additive","subtractive","multiply","normal"];export const ThreeBlendingMode={normal:e.NormalBlending,additive:e.AdditiveBlending,subtractive:e.SubtractiveBlending,multiply:e.MultiplyBlending};export function EmitterDataConstructor(){return{id:i(),name:"Emitter",rate:{type:"continuous",count:1,time:.5,delay:0},position:[0,0,0],rotation:[0,0,0],initializers:[{id:i(),type:"lifetime",params:{duration:{type:t.Number,value:1}}}],behaviours:[],children:[],output:{type:"sprite",texture:null,color:"#ffffff",blendingMode:"normal",space:"world",softness:0}}}
2
- /*
1
+ import{SerializedParamType as t}from"../../scene/model.js";import*as e from"three";import{randomString as i}from"../../utils/math.js";export const BlendingModes=["additive","subtractive","multiply","normal"];export const ThreeBlendingMode={normal:e.NormalBlending,additive:e.AdditiveBlending,subtractive:e.SubtractiveBlending,multiply:e.MultiplyBlending};export const FlipbookModes=["clamp","loop"];export function EmitterDataConstructor(){return{id:i(),name:"Emitter",rate:{type:"continuous",count:1,time:.5,delay:0},position:[0,0,0],rotation:[0,0,0],initializers:[{id:i(),type:"lifetime",params:{duration:{type:t.Number,value:1}}}],behaviours:[],children:[],output:{type:"sprite",texture:null,color:"#ffffff",blendingMode:"normal",space:"world",softness:0}}}/*
3
2
  * Copyright (©) 2023. All rights reserved.
4
3
  * See the LICENSE.md file for details.
5
4
  */
@@ -1,9 +1,5 @@
1
1
  import { Vector2, Vector3 } from "three";
2
- import { Behaviour, Emitter, Particle } from "three-nebula";
3
- declare const Initializer_base: any;
4
- declare class Initializer extends Initializer_base {
5
- init(emitter: Emitter, particle: Particle): void;
6
- }
2
+ import { Behaviour, Initializer } from "@hology/nebula";
7
3
  type HexColor = `#${string}`;
8
4
  export type ShapeParameterDef<T = boolean | number | string | Vector3 | Vector2 | HexColor> = {
9
5
  type: T extends number ? 'number' : T extends HexColor ? 'color' : T extends string ? 'string' | 'select' : T extends Vector2 ? 'vec2' : T extends Vector3 ? 'vec3' : T extends boolean ? 'boolean' : never;
@@ -167,6 +163,12 @@ declare class RotateDef extends BaseBevDef<RotateDef> {
167
163
  };
168
164
  make(params?: ParamsType<this>): Behaviour;
169
165
  }
166
+ declare class RotateAddDef extends BaseBevDef<RotateDef> {
167
+ parameters: {
168
+ rotation: ShapeParameterDef<Vector3>;
169
+ };
170
+ make(params?: ParamsType<this>): Behaviour;
171
+ }
170
172
  declare class FollowParentDef extends BaseBevDef<FollowParentDef> {
171
173
  parameters: {
172
174
  speed: FloatParameterDef;
@@ -251,6 +253,7 @@ declare const vfxBehaviours: {
251
253
  scale: ScaleDef;
252
254
  randomDrift: RandomDriftDef;
253
255
  rotate: RotateDef;
256
+ rotateAdd: RotateAddDef;
254
257
  changeColor: ChangeColorDef;
255
258
  changeOpacity: ChangeOpacityDef;
256
259
  vortex: VortexDef;
@@ -260,8 +263,9 @@ declare const vfxBehaviours: {
260
263
  };
261
264
  export type LibraryVfxInitalizerType = keyof typeof vfxInitializsers;
262
265
  export declare const VfxInitializserLibrary: Record<LibraryVfxInitalizerType, InitializerDefinition>;
263
- export declare const VfxInitializserLibraryKeys: ("rotation" | "mass" | "scale" | "velocity" | "lifetime" | "positionPoint" | "positionBox" | "positionSphere" | "positionLine" | "randomRotation" | "scaleComponents" | "randomScale" | "radialVelocity" | "randomDirection")[];
266
+ export declare const VfxInitializserLibraryKeys: ("rotation" | "mass" | "scale" | "randomDirection" | "velocity" | "lifetime" | "positionPoint" | "positionBox" | "positionSphere" | "positionLine" | "randomRotation" | "scaleComponents" | "randomScale" | "radialVelocity")[];
264
267
  export type LibraryVfxBehaviourType = keyof typeof vfxBehaviours;
265
268
  export declare const VfxBehaviourLibrary: Record<LibraryVfxBehaviourType, BehaviourDefinition>;
266
- export declare const VfxBehaviourLibraryKeys: ("scale" | "force" | "gravity" | "repulsion" | "attraction" | "randomDrift" | "rotate" | "changeColor" | "changeOpacity" | "vortex" | "moveTo" | "linearDamping" | "followParent")[];
269
+ export declare const VfxBehaviourLibraryKeys: ("scale" | "force" | "gravity" | "repulsion" | "attraction" | "randomDrift" | "rotate" | "rotateAdd" | "changeColor" | "changeOpacity" | "vortex" | "moveTo" | "linearDamping" | "followParent")[];
267
270
  export {};
271
+ //# sourceMappingURL=vfx-defs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vfx-defs.d.ts","sourceRoot":"","sources":["../../../src/effects/vfx/vfx-defs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAA;AAC1D,OAAO,EAAqB,SAAS,EAAgE,WAAW,EAAsG,MAAM,gBAAgB,CAAA;AAS5O,KAAK,QAAQ,GAA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G,eAAO,MAAM,0BAA0B,iOAAoE,CAAA;AAE3G,MAAM,MAAM,uBAAuB,GAAG,MAAM,OAAO,aAAa,CAAA;AAChE,eAAO,MAAM,mBAAmB,EAAE,MAAM,CAAC,uBAAuB,EAAE,mBAAmB,CAAiB,CAAA;AACtG,eAAO,MAAM,uBAAuB,oMAAgE,CAAA"}
@@ -1,5 +1,4 @@
1
- import{Color as e,MathUtils as r,Vector2 as t,Vector3 as s}from"three";import{Alpha as n,Attraction as a,BoxZone as o,Color as i,ease as c,Force as u,Gravity as p,Life as m,LineZone as d,Mass as l,Position as w,RadialVelocity as x,RandomDrift as f,Repulsion as y,Rotate as h,Vector3D as k}from"three-nebula";import{AxisDirection as g,AxisPlane as b,Disperse as v,FollowParent as z,LinearDamping as L,MoveOverLife as j,OrientAlongVelocity as V,RotatePosition as O,Scale as B}from"./behaviours.js";import{AdditiveVelocity as R,InitialScale as T,InitialScaleComponents as C,RandomDirection as D,RandomRotation as I,RandomScale as P,Rotation as A}from"./initializsers.js";import{PointZone as K,SphereZone as S}from"./zones.js";Object.getPrototypeOf(m);class q{build(e={}){const r=N(e,this.parameters);return this.make(r)}}class E{build(e={}){const r=N(e,this.parameters);return this.make(r)}}function F(e,r,t){return{type:"number",default:e,float:!0,min:r,max:t}}function G(e){return{type:"vec3",default:(new s).fromArray(e)}}function H(e){return{type:"color",default:e}}function J(e,r){return{type:"select",opts:e,default:r}}function M(){return J(Array.from(Object.keys(c)).map((e=>e.substring(4))),"Linear")}function N(e,r){const t={};for(let s in r)null==e[s]?t[s]=r[s].default:t[s]=e[s];return t}function Q(e){return null!=e?c["ease"+e]:c.easeLinear}const U={lifetime:new class extends E{constructor(){super(...arguments),this.parameters={duration:F(1,0,1e5)}}make(e={}){return new m(e.duration)}},positionPoint:new class extends E{constructor(){super(...arguments),this.parameters={position:G([0,0,0])}}make(e={}){const{x:r,y:t,z:s}=e.position;return new w(new K(r,t,s))}},positionBox:new class extends E{constructor(){super(...arguments),this.parameters={position:G([0,0,0]),dimensions:G([0,0,0])}}make(e={}){const{x:r,y:t,z:s}=e.position,{x:n,y:a,z:i}=e.dimensions;return new w(new o(r,t,s,n,a,i))}},positionSphere:new class extends E{constructor(){super(...arguments),this.parameters={position:G([0,0,0]),radius:F(1)}}make(e={}){const{x:r,y:t,z:s}=e.position;return new w(new S(r,t,s,e.radius))}},positionLine:new class extends E{constructor(){super(...arguments),this.parameters={a:G([0,0,0]),b:G([0,0,1])}}make(e={}){const{x:r,y:t,z:s}=e.a,{x:n,y:a,z:o}=e.b;return new w(new d(r,t,s,n,a,o))}},rotation:new class extends E{constructor(){super(...arguments),this.parameters={rotation:G([0,0,0])}}make(e={}){const{x:r,y:t,z:n}=e.rotation;return new A(new s(r,t,n))}},randomRotation:new class extends E{constructor(){super(...arguments),this.parameters={}}make(e={}){return new I}},scale:new class extends E{constructor(){super(...arguments),this.parameters={scale:F(1)}}make(e={}){return new T(e.scale)}},scaleComponents:new class extends E{constructor(){super(...arguments),this.parameters={scale:G([1,1,1])}}make(e={}){return new C(e.scale)}},randomScale:new class extends E{constructor(){super(...arguments),this.parameters={min:F(1),max:F(1)}}make(e={}){return new P(e.min,e.max)}},mass:new class extends E{constructor(){super(...arguments),this.parameters={min:F(1)}}make(e={}){return new l(e.min)}},velocity:new class extends E{constructor(){super(...arguments),this.parameters={velocity:G([0,0,0])}}make(e={}){const{x:r,y:t,z:n}=e.velocity;return new R(new s(r,t,n))}},radialVelocity:new class extends E{constructor(){super(...arguments),this.parameters={speed:F(1),direction:G([0,1,0]),spread:F(0)}}make(e={}){return new x(e.speed,new k(e.direction.x,e.direction.y,e.direction.z),e.spread)}},randomDirection:new class extends E{constructor(){super(...arguments),this.parameters={speed:F(1)}}make(e={}){return new D(e.speed)}}},W={force:new class extends q{constructor(){super(...arguments),this.parameters={force:G([0,0,0]),ease:M()}}make(e={}){return new u(e.force.x,e.force.y,e.force.z,void 0,Q(e.ease))}},gravity:new class extends q{constructor(){super(...arguments),this.parameters={gravity:F(8),easing:M()}}make(e={}){return new p(e.gravity,void 0,Q(e.easing))}},repulsion:new class extends q{constructor(){super(...arguments),this.parameters={target:G([0,0,0]),force:F(1),radius:F(1),easing:M()}}make(e={}){const r=new k(e.target.x,e.target.y,e.target.z);return new y(r,e.force,e.radius,void 0,Q(e.easing))}},attraction:new class extends q{constructor(){super(...arguments),this.parameters={target:G([0,0,0]),force:F(1),radius:F(1),easing:M()}}make(e={}){const r=new k(e.target.x,e.target.y,e.target.z);return new a(r,e.force,e.radius,void 0,Q(e.easing))}},scale:new class extends q{constructor(){super(...arguments),this.parameters={a:F(1),b:F(1),ease:M()}}make(e={}){return new B(e.a,e.b,Q(e.ease))}},randomDrift:new class extends q{constructor(){super(...arguments),this.parameters={drift:G([1,1,1]),delay:F(0),ease:M()}}make(e={}){return new f(e.drift.x,e.drift.y,e.drift.z,e.delay,void 0,Q(e.ease))}},rotate:new class extends q{constructor(){super(...arguments),this.parameters={rotation:G([0,0,0]),ease:M()}}make(e={}){const{x:t,y:s,z:n}=e.rotation;return new h(r.degToRad(t),r.degToRad(s),r.degToRad(n),void 0,Q(e.ease))}},changeColor:new class extends q{constructor(){super(...arguments),this.parameters={a:H("#ffffff"),b:H("#ffffff"),ease:M()}}make(r={}){return new i(new e(r.a),new e(r.b),void 0,Q(r.ease))}},changeOpacity:new class extends q{constructor(){super(...arguments),this.parameters={a:F(1,0,1),b:F(0,0,1),ease:M()}}make(e={}){return new n(e.a,e.b,void 0,Q(e.ease))}},vortex:new class extends q{constructor(){super(...arguments),this.parameters={axis:G([0,1,0]),amount:F(1)}}make(e={}){return new O(e.axis,e.amount)}},moveTo:new class extends q{constructor(){super(...arguments),this.parameters={target:G([0,1,0]),ease:M()}}make(e={}){return new j(e.target.x,e.target.y,e.target.z,Q(e.ease))}},linearDamping:new class extends q{constructor(){super(...arguments),this.parameters={factor:F(.1,0,1)}}make(e={}){return new L(e.factor)}},followParent:new class extends q{constructor(){super(...arguments),this.parameters={speed:F(1)}}make(e={}){return new z(e.speed)}}};export const VfxInitializserLibrary=U;export const VfxInitializserLibraryKeys=Object.keys(VfxInitializserLibrary);export const VfxBehaviourLibrary=W;export const VfxBehaviourLibraryKeys=Object.keys(VfxBehaviourLibrary);
2
- /*
1
+ import{MathUtils as e,Vector2 as r,Vector3 as t}from"three";import{Alpha as s,Attraction as n,BoxZone as a,Color as o,ease as i,Force as c,Gravity as u,Life as p,LineZone as m,Mass as d,Position as l,RadialVelocity as w,RandomDrift as x,Repulsion as f,Rotate as y,Vector3D as h}from"@hology/nebula";import{AxisDirection as k,AxisPlane as g,Disperse as b,FollowParent as v,LinearDamping as z,MoveOverLife as L,OrientAlongVelocity as T,RotatePosition as R,Scale as V}from"./behaviours.js";import{AdditiveVelocity as j,InitialScale as B,InitialScaleComponents as O,RandomDirection as A,RandomRotation as C,RandomScale as D,Rotation as I}from"./initializsers.js";import{PointZone as K,SphereZone as P}from"./zones.js";class S{build(e={}){const r=M(e,this.parameters);return this.make(r)}}class q{build(e={}){const r=M(e,this.parameters);return this.make(r)}}function E(e,r,t){return{type:"number",default:e,float:!0,min:r,max:t}}function F(e){return{type:"vec3",default:(new t).fromArray(e)}}function G(e){return{type:"color",default:e}}function H(e,r){return{type:"select",opts:e,default:r}}function J(){return H(Array.from(Object.keys(i)).map((e=>e.substring(4))),"Linear")}function M(e,r){const t={};for(let s in r)null==e[s]?t[s]=r[s].default:t[s]=e[s];return t}function N(e){return null!=e?i["ease"+e]:i.easeLinear}const Q={lifetime:new class extends q{constructor(){super(...arguments),this.parameters={duration:E(1,0,1e5)}}make(e={}){return new p(e.duration)}},positionPoint:new class extends q{constructor(){super(...arguments),this.parameters={position:F([0,0,0])}}make(e={}){const{x:r,y:t,z:s}=e.position;return new l(new K(r,t,s))}},positionBox:new class extends q{constructor(){super(...arguments),this.parameters={position:F([0,0,0]),dimensions:F([0,0,0])}}make(e={}){const{x:r,y:t,z:s}=e.position,{x:n,y:o,z:i}=e.dimensions;return new l(new a(r,t,s,n,o,i))}},positionSphere:new class extends q{constructor(){super(...arguments),this.parameters={position:F([0,0,0]),radius:E(1)}}make(e={}){const{x:r,y:t,z:s}=e.position;return new l(new P(r,t,s,e.radius))}},positionLine:new class extends q{constructor(){super(...arguments),this.parameters={a:F([0,0,0]),b:F([0,0,1])}}make(e={}){const{x:r,y:t,z:s}=e.a,{x:n,y:a,z:o}=e.b;return new l(new m(r,t,s,n,a,o))}},rotation:new class extends q{constructor(){super(...arguments),this.parameters={rotation:F([0,0,0])}}make(e={}){const{x:r,y:s,z:n}=e.rotation;return new I(new t(r,s,n))}},randomRotation:new class extends q{constructor(){super(...arguments),this.parameters={}}make(e={}){return new C}},scale:new class extends q{constructor(){super(...arguments),this.parameters={scale:E(1)}}make(e={}){return new B(e.scale)}},scaleComponents:new class extends q{constructor(){super(...arguments),this.parameters={scale:F([1,1,1])}}make(e={}){return new O(e.scale)}},randomScale:new class extends q{constructor(){super(...arguments),this.parameters={min:E(1),max:E(1)}}make(e={}){return new D(e.min,e.max)}},mass:new class extends q{constructor(){super(...arguments),this.parameters={min:E(1)}}make(e={}){return new d(e.min)}},velocity:new class extends q{constructor(){super(...arguments),this.parameters={velocity:F([0,0,0])}}make(e={}){const{x:r,y:s,z:n}=e.velocity;return new j(new t(r,s,n))}},radialVelocity:new class extends q{constructor(){super(...arguments),this.parameters={speed:E(1),direction:F([0,1,0]),spread:E(0)}}make(e={}){return new w(e.speed,new h(e.direction.x,e.direction.y,e.direction.z),e.spread)}},randomDirection:new class extends q{constructor(){super(...arguments),this.parameters={speed:E(1)}}make(e={}){return new A(e.speed)}}},U={force:new class extends S{constructor(){super(...arguments),this.parameters={force:F([0,0,0]),ease:J()}}make(e={}){return new c(e.force.x,e.force.y,e.force.z,void 0,N(e.ease))}},gravity:new class extends S{constructor(){super(...arguments),this.parameters={gravity:E(8),easing:J()}}make(e={}){return new u(e.gravity,void 0,N(e.easing))}},repulsion:new class extends S{constructor(){super(...arguments),this.parameters={target:F([0,0,0]),force:E(1),radius:E(1),easing:J()}}make(e={}){const r=new h(e.target.x,e.target.y,e.target.z);return new f(r,e.force,e.radius,void 0,N(e.easing))}},attraction:new class extends S{constructor(){super(...arguments),this.parameters={target:F([0,0,0]),force:E(1),radius:E(1),easing:J()}}make(e={}){const r=new h(e.target.x,e.target.y,e.target.z);return new n(r,e.force,e.radius,void 0,N(e.easing))}},scale:new class extends S{constructor(){super(...arguments),this.parameters={a:E(1),b:E(1),ease:J()}}make(e={}){return new V(e.a,e.b,N(e.ease))}},randomDrift:new class extends S{constructor(){super(...arguments),this.parameters={drift:F([1,1,1]),delay:E(0),ease:J()}}make(e={}){return new x(e.drift.x,e.drift.y,e.drift.z,e.delay,void 0,N(e.ease))}},rotate:new class extends S{constructor(){super(...arguments),this.parameters={rotation:F([0,0,0]),ease:J()}}make(r={}){const{x:t,y:s,z:n}=r.rotation;return new y(e.degToRad(t),e.degToRad(s),e.degToRad(n),void 0,N(r.ease))}},rotateAdd:new class extends S{constructor(){super(...arguments),this.parameters={rotation:F([0,0,0])}}make(r={}){const{x:t,y:s,z:n}=r.rotation,a=new y(e.degToRad(t),e.degToRad(s),e.degToRad(n),void 0);return a.rotationType="add",a}},changeColor:new class extends S{constructor(){super(...arguments),this.parameters={a:G("#ffffff"),b:G("#ffffff"),ease:J()}}make(e={}){return new o(e.a,e.b,void 0,N(e.ease))}},changeOpacity:new class extends S{constructor(){super(...arguments),this.parameters={a:E(1,0,1),b:E(0,0,1),ease:J()}}make(e={}){return new s(e.a,e.b,void 0,N(e.ease))}},vortex:new class extends S{constructor(){super(...arguments),this.parameters={axis:F([0,1,0]),amount:E(1)}}make(e={}){return new R(e.axis,e.amount)}},moveTo:new class extends S{constructor(){super(...arguments),this.parameters={target:F([0,1,0]),ease:J()}}make(e={}){return new L(e.target.x,e.target.y,e.target.z,N(e.ease))}},linearDamping:new class extends S{constructor(){super(...arguments),this.parameters={factor:E(.1,0,1)}}make(e={}){return new z(e.factor)}},followParent:new class extends S{constructor(){super(...arguments),this.parameters={speed:E(1)}}make(e={}){return new v(e.speed)}}};export const VfxInitializserLibrary=Q;export const VfxInitializserLibraryKeys=Object.keys(VfxInitializserLibrary);export const VfxBehaviourLibrary=U;export const VfxBehaviourLibraryKeys=Object.keys(VfxBehaviourLibrary);/*
3
2
  * Copyright (©) 2023. All rights reserved.
4
3
  * See the LICENSE.md file for details.
5
4
  */
@@ -1,6 +1,7 @@
1
+ import System from "@hology/nebula";
1
2
  import * as THREE from 'three';
2
3
  import { Object3D } from "three";
3
- import System from "three-nebula";
4
+ import { NodeShaderMaterial } from "three-shader-graph";
4
5
  import { ViewController } from '../../gameplay/index.js';
5
6
  import { Asset, VfxAsset } from '../../scene/model.js';
6
7
  export type VfxAssetProvider = {
@@ -14,6 +15,12 @@ export declare function materializeVfx(asset: VfxAsset, target: Object3D, assetP
14
15
  system: System;
15
16
  dispose: () => void;
16
17
  }>;
18
+ export declare class SpriteNodeShaderMaterial extends NodeShaderMaterial {
19
+ get color(): THREE.ColorRepresentation;
20
+ set color(value: THREE.ColorRepresentation);
21
+ get rotation(): number;
22
+ set rotation(value: number);
23
+ }
17
24
  export declare class EmitterPool<T> {
18
25
  private creator;
19
26
  instances: T[];
@@ -30,3 +37,4 @@ export declare class EmitterPool<T> {
30
37
  release(instance: T): void;
31
38
  dispose(): void;
32
39
  }
40
+ //# sourceMappingURL=vfx-materializer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vfx-materializer.d.ts","sourceRoot":"","sources":["../../../src/effects/vfx/vfx-materializer.ts"],"names":[],"mappings":"AAAA,OAAO,MAAiE,MAAM,gBAAgB,CAAC;AAC/F,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,EAAmD,kBAAkB,EAA4T,MAAM,oBAAoB,CAAC;AAEna,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAEzD,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAavD,MAAM,MAAM,gBAAgB,GAAG;IAC7B,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC,CAAA;IACzC,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;IACnD,OAAO,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAA;IACjD,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAA;CACtD,CAAA;AAGD,wBAAsB,cAAc,CAAC,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,aAAa,EAAE,gBAAgB,EAAE,IAAI,EAAE,cAAc;;;;GAyD5H;AA0WD,qBAAa,wBAAyB,SAAQ,kBAAkB;IAE9D,IAAI,KAAK,IAGQ,KAAK,CAAC,mBAAmB,CADzC;IACD,IAAI,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,mBAAmB,EAEzC;IACD,IAAI,QAAQ,IAGQ,MAAM,CADzB;IACD,IAAI,QAAQ,CAAC,KAAK,EAAE,MAAM,EAEzB;CACF;AAyPD,qBAAa,WAAW,CAAC,CAAC;IAIZ,OAAO,CAAC,OAAO;IAF3B,SAAS,EAAE,CAAC,EAAE,CAAK;gBAEC,OAAO,EAAE,MAAM,CAAC;IAEpC;;;OAGG;IACH,GAAG,IAAI,CAAC;IAQR;;;OAGG;IACH,OAAO,CAAC,QAAQ,EAAE,CAAC;IAMnB,OAAO;CAGR"}
@@ -1,5 +1,4 @@
1
- import*as t from"three";import{Object3D as e}from"three";import i,{Behaviour as n,Body as o,Emitter as s,Rate as r}from"three-nebula";import{AttributeVec3Node as a,AttributeVec4Node as l,NodeShaderMaterial as c,RgbNode as m,UniformVec3Node as u,Vec3ExpressionNode as p,Vec4Node as d,attributeFloat as h,attributeVec3 as f,attributeVec4 as g,attributes as w,float as y,glslFunction as A,lambertMaterial as v,log as x,pow as E,rgba as b,saturate as P,textureSampler2d as M,transformed as I,uniforms as R,varyingAttributes as z,varyingVec3 as V,varyingVec4 as B}from"three-shader-graph";import{prepareShapeParameters as T}from"../../scene/materializer.js";import{ShapeLibrary as S}from"../../scene/objects/shapes.js";import{fragmentLinearEyeDepth as j,linearEyeDepth as k}from"../../shader-nodes/depth.js";import{particleEnergyUniformName as C,particleVelcoityUniformName as F}from"../../shader-nodes/particle.js";import{DefaultInitializer as Q}from"./initializsers.js";import{DelayRate as U,OnceRate as H}from"./rates.js";import{ThreeBlendingMode as D}from"./vfx-asset.js";import{VfxBehaviourLibrary as G,VfxInitializserLibrary as J}from"./vfx-defs.js";import{MultiRenderer as q}from"./vfx-renderers.js";import{StretchedSprite as W}from"./stretched-sprite.js";export async function materializeVfx(n,o,s,r){let a=o;for(;null!=a.parent;)a=a.parent;const l=new e;l.name="particle system local",o.add(l);const c=new e;c.name="particle system world",a.add(c);const m=new q(c,l,t,r),u=new i;return(await Promise.all(n.vfx.emitters.map((async t=>{const e=await L(t,s,u);return e.setParentRecursive(u),e.emit()})))).forEach((t=>u.addEmitter(t))),u.addRenderer(m).emit({onEnd:()=>{console.log("ended")}}),{container:c,system:u,dispose:()=>{c.removeFromParent(),l.removeFromParent(),m.dispose()}}}async function L(i,n,s){const m=function(t){let e;switch(t.rate.type){case"continuous":e=new U(t.rate.delay??0,t.rate.count,t.rate.time);break;case"once":e=new H(t.rate.delay??0,t.rate.count);break;default:console.warn(`Failed to configure rate for emitter: ${JSON.stringify(t)}`),e=new r(0,1/0)}return e}(i);let C;switch(i.output.type){case"sprite":C=new o(await async function(e,i){const n=null!=e.texture?await i.getTexture(e.texture):N,o=M(n).sample(z.uv),s=new u("color").rgb,r=(new u("opacity").rgb,k.subtract(j).divide(k));let a=o.x;if("number"==typeof e.softness&&e.softness>0){const t=E(r,y(e.softness));a=a.multiply(t)}const l=A(d,{position:I.position,modelViewMatrix:R.modelViewMatrix},"\n vec2 center = vec2(0.5, 0.5);\n float rotation = 0.0;\n vec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\n // Using scale form instance matrix instead of modelMatrix\n vec2 scale;\n scale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );\n scale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );\n\n // This times 2 on scale seem to make it appear like when using regular sprites. \n // Not sure if this is correct though.\n vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * (scale);\n\n vec2 rotatedPosition;\n rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n\n mvPosition.xy += rotatedPosition;\n return projectionMatrix * mvPosition;\n ");var c=new K({color:b(s,a).multiply(o),transparent:!0,position:l,uniforms:{color:{value:new t.Color(e.color)}}});c.blending=D[e.blendingMode]??t.NormalBlending;const m=new t.Mesh(new t.PlaneGeometry(1,1),c);return m.name="sprite",m}(i.output,n));break;case"stretchedSprite":C=new o(await async function(e,i){const n=null!=e.texture?await i.getTexture(e.texture):N,o=M(n).sample(z.uv),s=B(new l("color")),r=s.rgb;let a=s.w;if("number"==typeof e.softness&&e.softness>0){const t=k.subtract(j).divide(x(k)),i=E(t,y(e.softness));a=P(a.multiply(i))}const c=A(d,{position:w.position,offset:g("offset"),modelViewMatrix:R.modelViewMatrix,velocity:g("velocity"),size:f("size"),rotation:h("rotation")},"\n float lengthFactor = velocity.w;\n float avgSize = (size.x + size.y) * 0.5;\n\n vec4 mvPosition = modelViewMatrix * vec4( offset , 1.0 );\n vec3 viewVelocity = normalMatrix * velocity.xyz;\n float vlength = length(viewVelocity); \n mvPosition.xyz += position.y * normalize(cross(mvPosition.xyz, viewVelocity)) * avgSize; \n mvPosition.xyz -= (position.x + 0.5) * viewVelocity * (1.0 + lengthFactor / vlength) * avgSize;\n return projectionMatrix * mvPosition;\n ");var m=new K({color:b(r,a).multiply(o),transparent:!0,position:c,uniforms:{}});m.blending=D[e.blendingMode]??t.NormalBlending;const u=new W(new t.PlaneGeometry(1,1),m);return u.scaleFactor=e.scale,u}(i.output,n));break;case"shape":C=new o(await async function(i,n){const o=S[i.shape];if(null==o)return console.error(`No shape with type ${i.shape}`),new e;const s=T(i.params??{}),r=o.geometry(s),l=null!=i.material?await n.getMaterial(i.material):function(){const t=V(new p("instanceColor")).rgb,e=V(new a("particleData")).x;return new c({color:v({color:t}).rgb.rgba(e),transparent:!0})}();return new t.Mesh(r,l)}(i.output,n));break;case"mesh":C=new o(await async function(i,n){if(null==i.assetId)return console.warn("Can't use mesh as particle without asset id"),new e;const o=await n.getMesh(i.assetId),s=await n.getAsset(i.assetId),r=[];if(null!=s.materialAssignments)for(const e of s.materialAssignments)o.traverse((i=>{i instanceof t.Mesh&&i.material instanceof t.Material&&i.material.color instanceof t.Color&&(i.material.name!=e.name&&null!=e.name||"#"+i.material.color.getHexString()!==e.color||r.push(n.getMaterial(e.materialId).then((t=>i.material=t))))}));return await Promise.all(r),o.traverse((t=>{})),o}(i.output,n));break;case"trail":C=new o({type:"trail",taper:i.output.taper,headGeometry:null,dragTexture:!1,color:i.output.color,colorEnd:i.output.colorEnd,length:i.output.length,opacityStart:i.output.opacityStart,opacityEnd:i.output.opacityEnd,bloom:i.output.bloom});break;default:console.error("Failed to create particly system body: "+JSON.stringify(i))}const F=new X;F.parent=s,F.setRate(m),F._space=i.output.space;const q=await Promise.all(i.initializers.filter((t=>null!=J[t.type])).map((async t=>{const e=J[t.type],i=await T(t.params??{});return e.build(i)})));q.push(C,new Q),F.addInitializers(q);const Y=await Promise.all(i.behaviours.filter((t=>null!=G[t.type])).map((async t=>{const e=G[t.type],i=await T(t.params??{});return e.build(i)})));Y.push(new O),F.addBehaviours(Y);for(const t of i.children){const e=await L(t,n,s),i=new EmitterPool((()=>{const t=e.clone();return t.onExpired=()=>{const e=F.childEmitters.findIndex((e=>e.id===t.id));-1!=e&&F.childEmitters.splice(e,1),i.release(t)},t})),o=F.eventDispatcher,r=new Map;F.bindEmitterEvent=!0,o.addEventListener("PARTICLE_DEAD",(t=>{const e=r.get(t.id);if(null!=e){const t=F.childEmitters.findIndex((t=>t.id===e.id));null!=t&&e.stopEmit()}})),o.addEventListener("PARTICLE_CREATED",(t=>{const e=i.get();e.age=0,e.totalEmitTimes=-1,e.particles.length=0,e.currentEmitTime=0,e.cID=0,F.childEmitters.push(e),r.set(t.id,e),e.parentParticle=t,e.emit()}))}return F}const N=(new t.TextureLoader).load("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABGdBTUEAAK/INwWK6QAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAJkSURBVHjaxJeJbusgEEW94S1L//83X18M2MSuLd2pbqc4wZGqRLrKBsyZhQHny7Jk73xVL8xpVhWrcmiB5lX+6GJ5YgQ2owbAm8oIwH1VgKZUmGcRqKGGPgtEQQAzGR8hQ59fAmhJHSAagigJ4E7GPWRXOYC6owAd1JM6wDQPADyMWUqZRMqmAojHp1Vn6EQQEgUNMJLnUjMyJsM49wygBkAPw9dVFwXRkncCIIW3GRgoTQUZn6HxCMAFEFd8TwEQ78X4rHbILoAUmeT+RFG4UhQ6MiIAE4W/UsYFjuVjAIa2nIY4q1R0GFtQWG3E84lqw2GO2QOoCKBVu0BAPgDSU0eUDjjQenNkV/AW/pWChhpMTelo1a64AOKM30vk18GzTHXCNtI/Knz3DFBgsUqBGIjTInXRY1yA9xkVoqW5tVq3pDR9A0hfF5BSARmVnh7RMDCaIdcNgbPBkgzn1Bu+SfIEFSpSBmkxyrMicb0fAEuCZrWnN89veA/4XcakrPcjBWzkTuLjlbfTQPOlBhz+HwkqqPXmPQDdrQItxE1moGof1S74j/8txk8EHhTQrAE8qlwfqS5yukm1x/rAJ9Jiaa6nyATqD78aUVBhFo8b1V4DdTXdCW+IxA1zB4JhiOhZMEWO1HqnvdoHZ4FAMIhV9REF8FiUm0jsYPEJx/Fm/N8OhH90HI9YRHesWbXXZwAShU8qThe7H8YAuJmw5yOd989uRINKRTJAhoF8jbqrHKfeCYdIISZfSq26bk/K+yO3YvfKrVgiwQBHnwt8ynPB25+M8hceTt/ybPhnryJ78+tLgAEAuCFyiQgQB30AAAAASUVORK5CYII=");class K extends c{get color(){return this.uniforms.color.value}set color(e){this.uniforms.color.value=new t.Color(e)}}class O extends n{initialize(e){if(e.body instanceof t.Mesh){const t=e.body.material;t instanceof c&&(null!=t.uniforms[C]||null!=t.uniforms[F])&&(e.body.material=t.clone())}}mutate(e,i,n){if(this.energize(e,i),e.target instanceof t.Mesh){const t=e.target.material;t instanceof c&&(null!=t.uniforms[C]&&(t.uniforms[C].value=this.energy),null!=t.uniforms[F]&&(t.uniforms[F].value=e.velocity))}}}class X extends s{constructor(){super(...arguments),this.childEmitters=[],this.bindEmitterEvent=!1,this.onExpired=()=>{}}update(t){if(!this.isEmitting&&0===this.particles.length)return;this.age+=t,(this.dead||this.age>=this.life)&&this.destroy(),this.generate(t),this.integrate(t);let e=this.particles.length;for(;e--;){const t=this.particles[e];t.dead&&(this.parent&&this.parent.dispatch("PARTICLE_DEAD",t),this.bindEmitterEvent&&this.dispatch("PARTICLE_DEAD",t),this.parent.pool.expire(t.reset()),this.particles.splice(e,1))}if(this.updateEmitterBehaviours(t),this.isEmitting||0!==this.particles.length)for(const e of this.childEmitters)null!=e.parentParticle?e.position.copy(e.parentParticle.position):e.setPosition(this.position),e.update(t);else this.onExpired()}clone(){const t=new X;return t.setRate(this.rate.clone()),t.behaviours=this.behaviours,t.initializers=this.initializers,t._space=this._space,t.body=this.body,t.parent=this.parent,t}setParentRecursive(t){this.parent=t,this.childEmitters.forEach((e=>e.setParentRecursive(t)))}}export class EmitterPool{constructor(t){this.creator=t,this.instances=[]}get(){0==this.instances.length&&this.instances.push(this.creator());return this.instances.pop()}release(t){this.instances.push(t)}dispose(){this.instances.length=0}}
2
- /*
1
+ import e,{Behaviour as t,Body as i,Emitter as n,Rate as o}from"@hology/nebula";import*as s from"three";import{Object3D as r}from"three";import{AttributeVec3Node as a,AttributeVec4Node as l,NodeShaderMaterial as c,RgbNode as m,UniformFloatNode as u,UniformVec3Node as p,Vec3ExpressionNode as d,Vec4Node as h,attributeFloat as f,attributeVec3 as g,attributeVec4 as w,attributes as y,float as v,glslFunction as A,lambertMaterial as x,log as b,pow as E,rgb as M,rgba as P,saturate as I,standardMaterial as S,textureSampler2d as R,transformed as B,uniforms as z,varying as V,varyingAttributes as k,varyingVec3 as T,varyingVec4 as j}from"three-shader-graph";import{prepareShapeParameters as C}from"../../scene/materializer.js";import{ShapeLibrary as F}from"../../scene/objects/shapes.js";import{fragmentLinearEyeDepth as D,linearEyeDepth as Q}from"../../shader-nodes/depth.js";import{particleEnergyUniformName as U,particleTimeUniformName as H,particleUniforms as q,particleVelcoityUniformName as G}from"../../shader-nodes/particle.js";import{sampleFlipbook as J}from"../../shader-nodes/texture-sequence.js";import{DefaultInitializer as W}from"./initializsers.js";import{DelayRate as N,OnceRate as L}from"./rates.js";import{StretchedSprite as K}from"./stretched-sprite.js";import{ThreeBlendingMode as O}from"./vfx-asset.js";import{VfxBehaviourLibrary as X,VfxInitializserLibrary as Y}from"./vfx-defs.js";import{MultiRenderer as Z}from"./vfx-renderers.js";export async function materializeVfx(t,i,n,o){let a=i;for(;null!=a.parent;)a=a.parent;const l=new r;l.name="particle system local",i.add(l);const c=new r;c.name="particle system world",a.add(c);const m=new Z(c,l,s,o),u=new e;return(await Promise.all(t.vfx.emitters.map((async e=>{const t=await _(e,n,u);return t.setParentRecursive(u),t.emit()})))).forEach((e=>u.addEmitter(e))),u.addRenderer(m).emit({onEnd:()=>{console.log("ended")}}),{container:c,system:u,dispose:()=>{c.removeFromParent(),l.removeFromParent(),m.dispose()}}}async function _(e,t,n){const m=function(e){let t;switch(e.rate.type){case"continuous":t=new N(e.rate.delay??0,e.rate.count,e.rate.time);break;case"once":t=new L(e.rate.delay??0,e.rate.count);break;default:console.warn(`Failed to configure rate for emitter: ${JSON.stringify(e)}`),t=new o(0,1/0)}return t}(e);let T;switch(e.output.type){case"sprite":T=new i(await async function(e,t){const i=null!=e.texture?await t.getTexture(e.texture):$,n=R(i);let o=n.sample(k.uv);e.flipbook?.enabled&&(o=J(n,y.uv,e.flipbook.columns,e.flipbook.rows,q.time,e.flipbook.fps,e.flipbook.mode));const r=new u("rotation",0),a=new p("color").rgb,l=(new p("opacity").rgb,Q.subtract(D).divide(Q));let c=o.x;if("number"==typeof e.softness&&e.softness>0){const t=E(l,v(e.softness));c=c.multiply(t)}const m=A(h,{position:B.position,modelViewMatrix:z.modelViewMatrix,rotation:r},"\n vec2 center = vec2(0.5, 0.5);\n vec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\n // Using scale form instance matrix instead of modelMatrix\n vec2 scale;\n scale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );\n scale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );\n\n // This times 2 on scale seem to make it appear like when using regular sprites. \n // Not sure if this is correct though.\n vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * (scale);\n\n vec2 rotatedPosition;\n rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n\n mvPosition.xy += rotatedPosition;\n return projectionMatrix * mvPosition;\n ");var d=new SpriteNodeShaderMaterial({color:P(a,c).multiply(o),transparent:!0,position:m,uniforms:{color:{value:new s.Color(e.color)}}});d.blending=O[e.blendingMode]??s.NormalBlending;const f=new s.Mesh(new s.PlaneGeometry(1,1),d);return f.name="sprite",f}(e.output,t));break;case"stretchedSprite":T=new i(await async function(e,t){const i=null!=e.texture?await t.getTexture(e.texture):$,n=R(i).sample(k.uv),o=j(new l("color")),r=o.rgb;let a=o.w;if("number"==typeof e.softness&&e.softness>0){const t=Q.subtract(D).divide(b(Q)),i=E(t,v(e.softness));a=I(a.multiply(i))}const c=A(h,{position:y.position,offset:w("offset"),modelViewMatrix:z.modelViewMatrix,velocity:w("velocity"),size:g("size"),rotation:f("rotation")},"\n float lengthFactor = velocity.w;\n float avgSize = (size.x + size.y) * 0.5;\n\n vec4 mvPosition = modelViewMatrix * vec4( offset , 1.0 );\n vec3 viewVelocity = normalMatrix * velocity.xyz;\n float vlength = length(viewVelocity); \n mvPosition.xyz += position.y * normalize(cross(mvPosition.xyz, viewVelocity)) * avgSize; \n mvPosition.xyz -= (position.x + 0.5) * viewVelocity * (1.0 + lengthFactor / vlength) * avgSize;\n return projectionMatrix * mvPosition;\n ");var m=new SpriteNodeShaderMaterial({color:P(r,a).multiply(n),transparent:!0,position:c,uniforms:{}});m.blending=O[e.blendingMode]??s.NormalBlending;const u=new K(new s.PlaneGeometry(1,1),m);return u.scaleFactor=e.scale,u}(e.output,t));break;case"shape":T=new i(await async function(e,t){const i=F[e.shape];if(null==i)return console.error(`No shape with type ${e.shape}`),new r;const n=C(e.params??{}),o=i.geometry(n),l=null!=e.material?function(e){const t=V(new d("instanceColor")).rgb,i=V(new a("particleData")).x;let n;if(e instanceof s.MeshStandardMaterial||e instanceof s.MeshLambertMaterial||e instanceof s.MeshBasicMaterial){let o=t.multiply(M(e.color));null!=e.map&&(o=o.multiply(R(e.map).sample(k.uv).rgb)),e instanceof s.MeshStandardMaterial?n=new c({color:S({color:o,emissive:M(e.emissive),emissiveIntensity:v(e.emissiveIntensity),roughness:e.roughness,metalness:e.metalness}).rgb.rgba(1),transparent:e.transparent}):e instanceof s.MeshLambertMaterial?n=new c({color:x({color:o}).rgb.rgba(i),transparent:e.transparent}):e instanceof s.MeshBasicMaterial&&(n=new c({color:o,transparent:e.transparent}))}null!=n&&(!0===e.userData?.hasBloom&&null!=n&&(n.userData.hasBloom=!0),n.side=e.side,n.transparent=e.transparent);return n??e}(await t.getMaterial(e.material)):function(){const e=V(new d("instanceColor")).rgb,t=V(new a("particleData")).x;return new c({color:x({color:e}).rgb.rgba(t),transparent:!0})}();return new s.Mesh(o,l)}(e.output,t));break;case"mesh":T=new i(await async function(e,t){if(null==e.assetId)return console.warn("Can't use mesh as particle without asset id"),new r;const i=await t.getMesh(e.assetId),n=await t.getAsset(e.assetId),o=[];if(null!=n.materialAssignments)for(const e of n.materialAssignments)i.traverse((i=>{i instanceof s.Mesh&&i.material instanceof s.Material&&i.material.color instanceof s.Color&&(i.material.name!=e.name&&null!=e.name||"#"+i.material.color.getHexString()!==e.color||o.push(t.getMaterial(e.materialId).then((e=>i.material=e))))}));return await Promise.all(o),i.traverse((e=>{})),i}(e.output,t));break;case"trail":T=new i({type:"trail",taper:e.output.taper,headGeometry:null,dragTexture:!1,color:e.output.color,colorEnd:e.output.colorEnd,length:e.output.length,opacityStart:e.output.opacityStart,opacityEnd:e.output.opacityEnd,bloom:e.output.bloom});break;default:console.error("Failed to create particly system body: "+JSON.stringify(e))}const U=new te;U.parent=n,U.setRate(m),U._space=e.output.space;const H=await Promise.all(e.initializers.filter((e=>null!=Y[e.type])).map((async e=>{const t=Y[e.type],i=await C(e.params??{});return t.build(i)})));H.push(T,new W),U.addInitializers(H);const G=await Promise.all(e.behaviours.filter((e=>null!=X[e.type])).map((async e=>{const t=X[e.type],i=await C(e.params??{});return t.build(i)})));G.push(new ee),U.addBehaviours(G);for(const i of e.children){const e=await _(i,t,n),o=new EmitterPool((()=>{const t=e.clone();return t.onExpired=()=>{const e=U.childEmitters.findIndex((e=>e.id===t.id));-1!=e&&U.childEmitters.splice(e,1),o.release(t)},t})),s=U.eventDispatcher,r=new Map;U.bindEmitterEvent=!0,s.addEventListener("PARTICLE_DEAD",(e=>{const t=r.get(e.id);if(null!=t){const e=U.childEmitters.findIndex((e=>e.id===t.id));null!=e&&t.stopEmit()}})),s.addEventListener("PARTICLE_CREATED",(e=>{const t=o.get();t.age=0,t.totalEmitTimes=-1,t.particles.length=0,t.currentEmitTime=0,t.cID=0,U.childEmitters.push(t),r.set(e.id,t),t.parentParticle=e,t.emit()}))}return U}const $=(new s.TextureLoader).load("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABGdBTUEAAK/INwWK6QAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAJkSURBVHjaxJeJbusgEEW94S1L//83X18M2MSuLd2pbqc4wZGqRLrKBsyZhQHny7Jk73xVL8xpVhWrcmiB5lX+6GJ5YgQ2owbAm8oIwH1VgKZUmGcRqKGGPgtEQQAzGR8hQ59fAmhJHSAagigJ4E7GPWRXOYC6owAd1JM6wDQPADyMWUqZRMqmAojHp1Vn6EQQEgUNMJLnUjMyJsM49wygBkAPw9dVFwXRkncCIIW3GRgoTQUZn6HxCMAFEFd8TwEQ78X4rHbILoAUmeT+RFG4UhQ6MiIAE4W/UsYFjuVjAIa2nIY4q1R0GFtQWG3E84lqw2GO2QOoCKBVu0BAPgDSU0eUDjjQenNkV/AW/pWChhpMTelo1a64AOKM30vk18GzTHXCNtI/Knz3DFBgsUqBGIjTInXRY1yA9xkVoqW5tVq3pDR9A0hfF5BSARmVnh7RMDCaIdcNgbPBkgzn1Bu+SfIEFSpSBmkxyrMicb0fAEuCZrWnN89veA/4XcakrPcjBWzkTuLjlbfTQPOlBhz+HwkqqPXmPQDdrQItxE1moGof1S74j/8txk8EHhTQrAE8qlwfqS5yukm1x/rAJ9Jiaa6nyATqD78aUVBhFo8b1V4DdTXdCW+IxA1zB4JhiOhZMEWO1HqnvdoHZ4FAMIhV9REF8FiUm0jsYPEJx/Fm/N8OhH90HI9YRHesWbXXZwAShU8qThe7H8YAuJmw5yOd989uRINKRTJAhoF8jbqrHKfeCYdIISZfSq26bk/K+yO3YvfKrVgiwQBHnwt8ynPB25+M8hceTt/ybPhnryJ78+tLgAEAuCFyiQgQB30AAAAASUVORK5CYII=");export class SpriteNodeShaderMaterial extends c{get color(){return this.uniforms.color.value}set color(e){this.uniforms.color.value=new s.Color(e)}get rotation(){return this.uniforms.rotation.value}set rotation(e){this.uniforms.rotation.value=e}}(new s.SpriteMaterial).rotation;class ee extends t{initialize(e){if(e.body instanceof s.Mesh){const t=e.body.material;t instanceof c&&(null!=t.uniforms[U]||null!=t.uniforms[H]||null!=t.uniforms[G])&&(e.body.material=t.clone())}}mutate(e,t,i){if(this.energize(e,t),e.target instanceof s.Mesh){const t=e.target.material;t instanceof c&&(null!=t.uniforms[U]&&(t.uniforms[U].value=this.energy),null!=t.uniforms[H]&&(t.uniforms[H].value=e.age),null!=t.uniforms[G]&&(t.uniforms[G].value=e.velocity))}}}class te extends n{constructor(){super(...arguments),this.childEmitters=[],this.bindEmitterEvent=!1,this.onExpired=()=>{}}update(e){if(!this.isEmitting&&0===this.particles.length)return;this.age+=e,(this.dead||this.age>=this.life)&&this.destroy(),this.generate(e),this.integrate(e);let t=this.particles.length;for(;t--;){const e=this.particles[t];e.dead&&(this.system&&this.system.dispatch("PARTICLE_DEAD",e),this.bindEmitterEvent&&this.dispatch("PARTICLE_DEAD",e),this.system.pool.expire(e.reset()),this.particles.splice(t,1))}if(this.updateEmitterBehaviours(e),this.isEmitting||0!==this.particles.length)for(const t of this.childEmitters)null!=t.parentParticle?t.position.copy(t.parentParticle.position):t.setPosition(this.position),t.update(e);else this.onExpired()}clone(){const e=new te;return e.setRate(this.rate.clone()),e.behaviours=this.behaviours,e.initializers=this.initializers,e._space=this._space,e.body=this.body,e.parent=this.parent,e.system=this.system,e}setParentRecursive(e){this.system=e,this.childEmitters.forEach((t=>t.setParentRecursive(e)))}}export class EmitterPool{constructor(e){this.creator=e,this.instances=[]}get(){0==this.instances.length&&this.instances.push(this.creator());return this.instances.pop()}release(e){this.instances.push(e)}dispose(){this.instances.length=0}}/*
3
2
  * Copyright (©) 2023. All rights reserved.
4
3
  * See the LICENSE.md file for details.
5
4
  */
@@ -1,11 +1,2 @@
1
- import { VfxAsset } from 'scene/model';
2
- import * as THREE from 'three';
3
- import { Object3D } from 'three';
4
- import System from 'three-nebula';
5
- import { MeshRenderer, Rate } from 'three-nebula';
6
- export declare function materializeVfxOld(asset: VfxAsset, target: Object3D): {
7
- system: System;
8
- rate: Rate;
9
- renderer: MeshRenderer;
10
- dispose: () => THREE.Object3D<THREE.Object3DEventMap>;
11
- };
1
+ export {};
2
+ //# sourceMappingURL=vfx-old-materializer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vfx-old-materializer.d.ts","sourceRoot":"","sources":["../../../src/effects/vfx/vfx-old-materializer.ts"],"names":[],"mappings":""}
@@ -1,5 +1,4 @@
1
- import*as e from"three";import{Object3D as n}from"three";import t from"three-nebula";import{Body as r,BoxZone as a,Emitter as o,Force as i,Life as w,Mass as d,MeshRenderer as m,PointZone as s,Position as l,RadialVelocity as f,Radius as p,Rate as c,Rotate as h,Scale as u,Span as v,Vector3D as x,ease as M}from"three-nebula";import{RotatePosition as b}from"./behaviours";import{OnceRate as E}from"./rates";export function materializeVfxOld(I,y){let z=y;if(!0!==I.vfx.localSpace)for(;null!=z.parent;)z=z.parent;const B=new n;B.name="particle system",z.add(B);const O=new m(B,e),P=new e.Mesh(new e.BoxGeometry(.3,.3,.3),new e.MeshStandardMaterial({color:16777215})),R=new c(new v(3,9),new v(.02,.15)),L=new o,S=new t;L.setLife(4).setRate(R).addInitializers([new d(1),new p(1),new w(1),new r(P),new l(new a(.5)),new f(10,new x(0,0,1),30)]).addBehaviours([new b(new e.Vector3(0,0,1),4),new i(0,0,.1),new h("random",2.5*-Math.PI,2*Math.PI,1,M.easeOutCubic),new u(1,.2)]).emit();const V=new E(0),g=(new o).setLife(5).addInitializers([new d(1),new p(1),new w(3),new r(P),new l(new s(0,0,0))]).addBehaviours([new u(4,6,void 0,M.easeOutExpo)]).setRate(V).emit();return V.nextTime=0,S.addEmitter(L).addEmitter(g).addRenderer(O).emit({onEnd:()=>{console.log("ended")}}),{system:S,rate:R,renderer:O,dispose:()=>B.removeFromParent()}}
2
- /*
1
+ export{};/*
3
2
  * Copyright (©) 2023. All rights reserved.
4
3
  * See the LICENSE.md file for details.
5
4
  */
@@ -38,3 +38,4 @@ export declare class VfxPool<T extends VfxActor = VfxActor> {
38
38
  release(instance: T): void;
39
39
  dispose(): void;
40
40
  }
41
+ //# sourceMappingURL=vfx-param.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vfx-param.d.ts","sourceRoot":"","sources":["../../../src/effects/vfx/vfx-param.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,EAAE,SAAS,EAAS,MAAM,yBAAyB,CAAC;AAG3D,qBAAa,YAAY;IAEX,OAAO,CAAC,aAAa;IAAiB,OAAO,CAAC,KAAK;gBAA3C,aAAa,EAAE,aAAa,EAAU,KAAK,EAAE,QAAQ;IAEzE;;;;;;OAMG;IACG,MAAM,CAAC,MAAM,EAAE,QAAQ,GAAC,SAAS,GAAG,OAAO,CAAC,QAAQ,CAAC;IAW3D;;;;OAIG;IACH,UAAU,CAAC,MAAM,EAAE,QAAQ,GAAC,SAAS,GAAG,OAAO,CAAC,QAAQ,CAAC;CAI1D;AAqBD,qBAAa,OAAO,CAAC,CAAC,SAAS,QAAQ,GAAG,QAAQ;IAIpC,OAAO,CAAC,OAAO;IAF3B,SAAS,EAAE,CAAC,EAAE,CAAK;gBAEC,OAAO,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC;IAE7C;;;OAGG;IACG,GAAG,IAAI,OAAO,CAAC,CAAC,CAAC;IASvB;;;OAGG;IACH,OAAO,CAAC,QAAQ,EAAE,CAAC;IAMnB,OAAO;CAGR"}
@@ -1,5 +1,4 @@
1
- import{VfxActor as t}from"./vfx-actor.js";import{BaseActor as s}from"../../gameplay/index.js";export class VisualEffect{constructor(t,s){this.actorProvider=t,this.asset=s}async create(e){const a=await this.actorProvider.create(t);return e instanceof s?e.object.add(a.object):e.add(a.object),await a.fromAsset(this.asset),a}createPool(t){return new VfxPool((()=>this.create(t)))}}export class VfxPool{constructor(t){this.creator=t,this.instances=[]}async get(){0==this.instances.length&&this.instances.push(await this.creator());const t=this.instances.shift();return t.restart(),t}release(t){this.instances.push(t)}dispose(){this.instances.length=0}}
2
- /*
1
+ import{VfxActor as t}from"./vfx-actor.js";import{BaseActor as s}from"../../gameplay/index.js";export class VisualEffect{constructor(t,s){this.actorProvider=t,this.asset=s}async create(e){const a=await this.actorProvider.create(t);return e instanceof s?e.object.add(a.object):e.add(a.object),await a.fromAsset(this.asset),a}createPool(t){return new VfxPool((()=>this.create(t)))}}export class VfxPool{constructor(t){this.creator=t,this.instances=[]}async get(){0==this.instances.length&&this.instances.push(await this.creator());const t=this.instances.shift();return t.restart(),t}release(t){this.instances.push(t)}dispose(){this.instances.length=0}}/*
3
2
  * Copyright (©) 2023. All rights reserved.
4
3
  * See the LICENSE.md file for details.
5
4
  */
@@ -1,6 +1,6 @@
1
+ import { CustomRenderer, MeshRenderer, Particle } from '@hology/nebula';
1
2
  import * as THREE from 'three';
2
3
  import { Object3D } from 'three';
3
- import { CustomRenderer, MeshRenderer, Particle } from 'three-nebula';
4
4
  import { ViewController } from '../../gameplay';
5
5
  export declare class MultiRenderer extends CustomRenderer {
6
6
  private worldContainer;
@@ -89,3 +89,4 @@ export declare class InstancedRenderer extends MeshRenderer {
89
89
  */
90
90
  declare function sortInstancedMeshByDistance(mesh: InstancedMeshInfo, camera: THREE.Camera): void;
91
91
  export { sortInstancedMeshByDistance };
92
+ //# sourceMappingURL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O,EAAE,MAAM,EAAE,CAAC;IAAC,SAAS,EAAE,QAAQ,EAAE,CAAA;CAAC,CAAA;AAEpI,qBAAa,iBAAkB,SAAQ,YAAY;IAEW,OAAO,CAAC,IAAI;gBAA5D,SAAS,EAAE,KAAK,CAAC,QAAQ,EAAE,KAAK,EAAE,OAAO,KAAK,EAAU,IAAI,EAAE,cAAc;IAGxF,OAAO;IAIP,cAAc;IAUd,OAAO,CAAC,MAAM,CAA0B;IAExC,iBAAiB,CAAC,QAAQ,EAAE,QAAQ,GAAG;QAAC,IAAI,CAAC,EAAE,YAAY,CAAC,OAAO,CAAC,CAAC;QAAC,MAAM,EAAE,GAAG,CAAA;KAAC;IAqElF,gBAAgB,CAAC,QAAQ,KAAA;IAkCzB,cAAc,CAAC,QAAQ,KAAA;CAcxB;AA+CD;;;;;GAKG;AACH,iBAAS,2BAA2B,CAAC,IAAI,EAAE,iBAAiB,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,GAAG,IAAI,CAqExF;AAED,OAAO,EAAE,2BAA2B,EAAE,CAAA"}
@@ -1,5 +1,4 @@
1
- import*as e from"three";import{InstancedBufferAttribute as t,Object3D as r}from"three";import{CustomRenderer as a,MeshRenderer as s,PUID as i}from"three-nebula";import{NodeShaderMaterial as o}from"three-shader-graph";import{StretchedSprite as n}from"./stretched-sprite.js";import{Trail as l}from"./trail-renderer.js";var c;!function(e){e[e.mesh=0]="mesh",e[e.instanced=1]="instanced",e[e.sprite=2]="sprite",e[e.stretchedBillboard=3]="stretchedBillboard",e[e.trail=4]="trail"}(c||(c={}));export class MultiRenderer extends a{constructor(e,t,r,a){super(),this.worldContainer=e,this.localContainer=t,this.three=r,this.view=a,this.localRenderers=[],this.worldRenderers=[]}onSystemUpdate(){for(const e of this.worldRenderers)e?.onSystemUpdate();for(const e of this.localRenderers)e?.onSystemUpdate()}onParticleCreated(e){this.getRenderer(e)?.onParticleCreated(e)}onParticleUpdate(e){this.getRenderer(e)?.onParticleUpdate(e)}onParticleDead(e){this.getRenderer(e)?.onParticleDead(e),e._renderer=null}getRenderer(t){if(t._renderer)return t._renderer;const r=t?.parent._space??"world",a="world"===r?this.worldContainer:this.localContainer,s="world"===r?this.worldRenderers:this.localRenderers;return"trail"===t.body.type?(null==s[c.trail]&&(s[c.trail]=new TrailRenderer(a,this.three)),t._renderer=s[c.trail]):t.body instanceof n?(null==s[c.stretchedBillboard]&&(s[c.stretchedBillboard]=new StretchedSpriteInstancedRenderer(a,this.three,this.view)),t._renderer=s[c.stretchedBillboard]):t.body instanceof e.Sprite||t.body instanceof e.Mesh&&"sprite"===t.body.name?(null==s[c.sprite]&&(s[c.sprite]=new CombinedRenderer(a,this.three)),t._renderer=s[c.sprite]):t.body instanceof e.Mesh&&0==t.body.children.length&&t.body.material instanceof o?(null==s[c.instanced]&&(s[c.instanced]=new InstancedRenderer(a,this.three,this.view)),t._renderer=s[c.instanced]):t.body instanceof e.Object3D?(null==s[c.mesh]&&(s[c.mesh]=new CombinedRenderer(a,this.three)),t._renderer=s[c.mesh]):void 0}dispose(){this.localRenderers.forEach((e=>{e instanceof InstancedRenderer&&e.dispose()})),this.worldRenderers.forEach((e=>{e instanceof InstancedRenderer&&e.dispose()}))}}export class TrailRenderer extends s{constructor(){super(...arguments),this.trails=[]}dispose(){}onSystemUpdate(){for(const e of this.trails)e.update()}onParticleCreated(t){const a=t.body,s=new l(this.container,!0),i=new r,o=l.createBaseMaterial();o.uniforms.taper.value=a.taper??!1;const n=new e.Color(a.color??0),c=new e.Color(a.colorEnd??0);o.uniforms.headColor.value.set(n.r,n.g,n.b,a.opacityStart??1),o.uniforms.tailColor.value.set(c.r,c.g,c.b,a.opacityEnd??1),a.bloom&&(o.userData.hasBloom=!0),s.initialize(o,Math.round(a.length??10),!1,0,null,i);const d=t.rotation;i.rotation.set(d.x,d.y,d.z);t.scale;s.activate(),this.trails.push(s),t.target=i}onParticleUpdate(e){const t=e.target;t.position.copy(e.position);e.velocity.clone().normalize();const r=this.trails.findIndex((e=>e.targetObject.id===t.id));if(-1!=r){const t=this.trails[r];if(e.useAlpha){t.material.uniforms.headColor.value.setW(e.alpha);t.material.uniforms.tailColor.value.setW(e.alpha)}}}onParticleDead(e){const t=e.target,r=this.trails.findIndex((e=>e.targetObject.id===t.id));if(-1!=r){const e=this.trails[r];e.removeFromParent(),e.mesh.removeFromParent(),t.removeFromParent(),this.trails.splice(r,1)}}}export class CombinedRenderer extends s{dispose(){}scale(t){const r=t.transform.initialScale;t.target instanceof e.Sprite?null!=r?t.target.scale.set(r.x*t.scale*t.radius,r.y*t.scale*t.radius,1):t.target.scale.set(t.scale*t.radius,t.scale*t.radius,1):null!=r?t.target.scale.set(r.x*t.scale,r.y*t.scale,r.z*t.scale):super.scale(t)}rotate(e){e.target.material.rotation=e.rotation.z}onParticleCreated(t){t.target||(t.target=this._targetPool.get(t.body),(t.useAlpha||t.useColor)&&(t.target instanceof e.Mesh||t.target instanceof e.Sprite&&t.target.material instanceof e.Material)&&(t.target.material.__puid=i.id(t.body.material),t.target.material=this._materialPool.get(t.target.material))),t.target&&t.target instanceof r&&(t.target.position.set(t.position.x,t.position.y,t.position.z),this.container.add(t.target))}onParticleUpdate(t){const{target:a,useAlpha:s,useColor:i,rotation:o}=t;if(a){if(a.position.copy(t.position),this.isThreeSprite(t)||a.rotation.set(o.x,o.y,o.z),this.scale(t),t.transform&&t.transform.orientAlongVelocity&&a instanceof r){const e=d.set(t.velocity.x,t.velocity.y,t.velocity.z).normalize(),r=a.getWorldDirection(m);r.applyAxisAngle(p,Math.PI/-2),h.setFromUnitVectors(r,e),a.quaternion.copy(h)}a.material instanceof e.Material&&(s&&(a.material.opacity=t.alpha,a.material.transparent=!0),i&&null!=a.material.color&&a.material.color.copy(t.color))}}onParticleDead(e){e.target&&(e.target.material&&(e.useAlpha||e.useColor)&&this._materialPool.expire(e.target.material),this._targetPool.expire(e.target),this.container.remove(e.target),e.target=null)}}export class StretchedSpriteInstancedRenderer extends s{constructor(e,t,r){super(e,t),this.view=r,this.meshes=[]}dispose(){this.meshes.forEach((e=>e.mesh.geometry.dispose()))}onSystemUpdate(){for(const t of this.meshes){const r=t.mesh.geometry.getAttribute("offset"),a=t.mesh.geometry.getAttribute("size"),s=t.mesh.geometry.getAttribute("velocity"),i=t.mesh.geometry.getAttribute("rotation"),o=t.mesh.geometry.getAttribute("color");let n=0;for(const l of t.particles){if(null==l||l.dead)continue;if(l.useColor||l.color instanceof e.Color){const e=A.copy(l.color).getRGB(U);o.setXYZW(n,e.r,e.g,e.b,1),o.needsUpdate=!0}l.useAlpha&&(o.setW(n,l.alpha),o.needsUpdate=!0),"number"==typeof l.rotation?i.setX(n,l.rotation):i.setX(n,l.rotation.x);const t=l.position;if(r.setXYZ(n,t.x,t.y,t.z),"number"!=typeof l.scale)throw new Error("Particle scale is not a number");a.setXYZ(n,l.scale,l.scale,l.scale);let c=l.body.scaleFactor;0===c&&(c=.001);const d=1,m=l.velocity;s.setXYZW(n,m.x*c,m.y*c,m.z*c,d),n++}n>0&&(r.clearUpdateRanges(),r.addUpdateRange(0,3*n),r.needsUpdate=!0,a.clearUpdateRanges(),a.addUpdateRange(0,3*n),a.needsUpdate=!0,o.clearUpdateRanges(),o.addUpdateRange(0,4*n),o.needsUpdate=!0,s.clearUpdateRanges(),s.addUpdateRange(0,4*n),s.needsUpdate=!0,i.clearUpdateRanges(),i.addUpdateRange(0,n),i.needsUpdate=!0)}}onParticleCreated(r){if(r.body instanceof n&&null==r.target){const a=r.body;let s=this.meshes.find((e=>e.mesh.material.uuid===a.material.uuid));if(null==s){const i=R(r),o=new e.InstancedBufferGeometry;o.setIndex(a.geometry.getIndex()),o.setAttribute("position",a.geometry.getAttribute("position")),a.geometry.hasAttribute("normal")&&o.setAttribute("normal",a.geometry.getAttribute("normal")),o.setAttribute("uv",a.geometry.getAttribute("uv"));const n=new t(new Float32Array(3*i),3);n.setUsage(e.DynamicDrawUsage),o.setAttribute("offset",n);const l=new t(new Float32Array(4*i),4);l.setUsage(e.DynamicDrawUsage),o.setAttribute("color",l);const c=new t(new Float32Array(3*i),3);c.setUsage(e.DynamicDrawUsage),o.setAttribute("size",c);const d=new t(new Float32Array(4*i),4);d.setUsage(e.DynamicDrawUsage),o.setAttribute("velocity",d);const m=new t(new Float32Array(4*i),1);m.setUsage(e.DynamicDrawUsage),o.setAttribute("rotation",m),s={mesh:new e.Mesh(o,a.material),indices:new Float32Array(i),particles:[]},this.meshes.push(s),this.container.add(s.mesh)}let i=s.indices.findIndex((e=>0===e));i<0&&(i=function(e){let t=e[0],r=0;for(let a=1;a<e.length;a++)e[a]<t&&(t=e[a],r=a);return r}(s.indices)),s.indices[i]=performance.now(),r.target=i,s.particles[i]=r}}onParticleUpdate(e){}onParticleDead(e){const t=e.body;let r=this.meshes.find((e=>e.mesh.material.uuid===t.material.uuid));r&&(r.particles[e.target]=null,r.indices[e.target]=0),e.target=null}}const d=new e.Vector3,m=new e.Vector3,h=new e.Quaternion,p=new e.Vector3(1,0,0);export class InstancedRenderer extends s{constructor(e,t,r){super(e,t),this.view=r,this.meshes=[]}dispose(){this.meshes.forEach((e=>e.mesh.dispose()))}onSystemUpdate(){for(const e of this.meshes);}onParticleCreated(t){if(!(t.body instanceof e.Sprite)){if(null==t.target){const r=t.body;let a=this.meshes.find((e=>e.mesh.geometry.uuid===r.geometry.uuid&&e.mesh.material.uuid===r.material.uuid));if(null==a){const s=t.parent.rate,i=Math.min(Math.ceil(s.numPan.b/Math.min(Math.max(s.timePan.a,.01),1)),1e5);a={mesh:new e.InstancedMesh(r.geometry,r.material,i),indices:new Array(i).fill(null),particles:[]},a.mesh.setColorAt(0,A.copy(new e.Color(t.color))),a.mesh.instanceColor.needsUpdate=!0;const o=new Float32Array(3*i);f.makeScale(0,0,0);for(let e=0;e<i;e++)o[3*e+0]=1,o[3*e+1]=1,a.mesh.setMatrixAt(e,f);a.mesh.instanceMatrix.needsUpdate=!0,a.mesh.geometry.setAttribute("particleData",new e.InstancedBufferAttribute(o,3)),this.meshes.push(a),this.container.add(a.mesh)}let s=a.indices.findIndex((e=>null==e));s<0&&(s=a.indices.indexOf(Math.min(...a.indices))),a.indices[s]=performance.now(),t.target=s,a.particles[s]=t}if("number"==typeof t.target){t.transform.initialScale;const e=t.body;let r=this.meshes.find((t=>t.mesh.geometry.uuid===e.geometry.uuid&&t.mesh.material.uuid===e.material.uuid));g(t,r.mesh),t.useAlpha&&(r.mesh.material.transparent=!0)}}}onParticleUpdate(e){const{target:t,useAlpha:r,useColor:a,rotation:s}=e;if(null==t)return;const i=e.body;let o=this.meshes.find((e=>e.mesh.geometry.uuid===i.geometry.uuid&&e.mesh.material.uuid===i.material.uuid));if(g(e,o.mesh),a&&(o.mesh.setColorAt(e.target,A.copy(e.color)),o.mesh.instanceColor.needsUpdate=!0),r){const t=o.mesh.geometry.getAttribute("particleData");t.setX(e.target,e.alpha),t.needsUpdate=!0}}onParticleDead(e){if(null!=e.target){const t=e.body;let r=this.meshes.find((e=>e.mesh.geometry.uuid===t.geometry.uuid&&e.mesh.material.uuid===t.material.uuid));r.indices[e.target]=null,e.scale=0,g(e,r.mesh),r.mesh.instanceMatrix.needsUpdate=!0,e.target=null}}}const u=new r;function g(e,t){if(b.set(e.position.x,e.position.y,e.position.z),e.transform&&e.transform.orientAlongVelocity){const r=d.set(e.position.x-e.old.position.x,e.position.y-e.old.position.y,e.position.z-e.old.position.z).normalize();t.getMatrixAt(e.target,u.matrix);const a=u.getWorldDirection(w);a.applyAxisAngle(p,Math.PI/-2),y.setFromUnitVectors(a,r)}else x.set(e.rotation.x,e.rotation.y,e.rotation.z),y.setFromEuler(x);const r=e.transform.initialScale;null!=r?w.set(r.x*e.scale,r.y*e.scale,r.z*e.scale):w.set(e.scale,e.scale,e.scale),f.compose(b,y,w),t.setMatrixAt(e.target,f),t.instanceMatrix.needsUpdate=!0}const f=new e.Matrix4,y=new e.Quaternion,b=new e.Vector3,w=new e.Vector3,x=new e.Euler,A=new e.Color(0),U={r:0,g:0,b:0};function P(t,r){const a=t.mesh,s=a.count,i=[],o=a.geometry.getAttribute("particleData"),n=new e.Vector3;for(let l=0;l<s;l++){const s=new e.Matrix4,c=new e.Color;a.getMatrixAt(l,s),a.getColorAt(l,c);const d=o.getX(l);n.setFromMatrixPosition(s);const m=n.distanceTo(r.position);i.push({index:l,distance:m,matrix:s,particle:t.particles[l],color:c,pdx:d})}i.sort(((e,t)=>t.distance-e.distance));for(let e=0;e<s;e++){const t=i[e].matrix;null==i[e].particle&&t.makeScale(0,0,0),a.setMatrixAt(e,t),a.setColorAt(e,i[e].color),o.setX(e,i[e].pdx)}a.instanceMatrix.needsUpdate=!0}export{P as sortInstancedMeshByDistance};function R(e){const t=null!=e.parent.parentParticle?R(e.parent.parentParticle):1,r=e.parent.rate;return Math.min(Math.ceil(r.numPan.b/Math.min(Math.max(r.timePan.a,.01),1)),1e5)*e.life*t}
2
- /*
1
+ import{CustomRenderer as e,MeshRenderer as t,PUID as r}from"@hology/nebula";import*as a from"three";import{InstancedBufferAttribute as s,Object3D as i}from"three";import{NodeShaderMaterial as n}from"three-shader-graph";import{SpriteNodeShaderMaterial as o}from"../../effects/vfx/vfx-materializer";import{StretchedSprite as l}from"./stretched-sprite.js";import{Trail as c}from"./trail-renderer.js";var d;!function(e){e[e.mesh=0]="mesh",e[e.instanced=1]="instanced",e[e.sprite=2]="sprite",e[e.stretchedBillboard=3]="stretchedBillboard",e[e.trail=4]="trail"}(d||(d={}));export class MultiRenderer extends e{constructor(e,t,r,a){super(),this.worldContainer=e,this.localContainer=t,this.three=r,this.view=a,this.localRenderers=[],this.worldRenderers=[]}onSystemUpdate(){for(const e of this.worldRenderers)e?.onSystemUpdate();for(const e of this.localRenderers)e?.onSystemUpdate()}onParticleCreated(e){this.getRenderer(e)?.onParticleCreated(e)}onParticleUpdate(e){this.getRenderer(e)?.onParticleUpdate(e)}onParticleDead(e){this.getRenderer(e)?.onParticleDead(e),e._renderer=null}getRenderer(e){if(e._renderer)return e._renderer;const t=(null!=e?.parent?e?.parent._space:null)??"world",r="world"===t?this.worldContainer:this.localContainer,s="world"===t?this.worldRenderers:this.localRenderers;return"trail"===e.body.type?(null==s[d.trail]&&(s[d.trail]=new TrailRenderer(r,this.three)),e._renderer=s[d.trail]):e.body instanceof l?(null==s[d.stretchedBillboard]&&(s[d.stretchedBillboard]=new StretchedSpriteInstancedRenderer(r,this.three,this.view)),e._renderer=s[d.stretchedBillboard]):e.body instanceof a.Sprite||e.body instanceof a.Mesh&&"sprite"===e.body.name?(null==s[d.sprite]&&(s[d.sprite]=new CombinedRenderer(r,this.three)),e._renderer=s[d.sprite]):e.body instanceof a.Mesh&&0==e.body.children.length&&e.body.material instanceof n?(null==s[d.instanced]&&(s[d.instanced]=new InstancedRenderer(r,this.three,this.view)),e._renderer=s[d.instanced]):e.body instanceof a.Object3D?(null==s[d.mesh]&&(s[d.mesh]=new CombinedRenderer(r,this.three)),e._renderer=s[d.mesh]):void 0}dispose(){this.localRenderers.forEach((e=>{e instanceof InstancedRenderer&&e.dispose()})),this.worldRenderers.forEach((e=>{e instanceof InstancedRenderer&&e.dispose()}))}}export class TrailRenderer extends t{constructor(){super(...arguments),this.trails=[]}dispose(){}onSystemUpdate(){for(const e of this.trails)e.update()}onParticleCreated(e){const t=e.body,r=new c(this.container,!0),s=new i,n=c.createBaseMaterial();n.uniforms.taper.value=t.taper??!1;const o=new a.Color(t.color??0),l=new a.Color(t.colorEnd??0);n.uniforms.headColor.value.set(o.r,o.g,o.b,t.opacityStart??1),n.uniforms.tailColor.value.set(l.r,l.g,l.b,t.opacityEnd??1),t.bloom&&(n.userData.hasBloom=!0),r.initialize(n,Math.round(t.length??10),!1,0,null,s);const d=e.rotation;s.rotation.set(d.x,d.y,d.z);e.scale;r.activate(),this.trails.push(r),e.target=s}onParticleUpdate(e){const t=e.target;t.position.copy(e.position);e.velocity.clone().normalize();const r=this.trails.findIndex((e=>e.targetObject.id===t.id));if(-1!=r){const t=this.trails[r];if(e.useAlpha){t.material.uniforms.headColor.value.setW(e.alpha);t.material.uniforms.tailColor.value.setW(e.alpha)}}}onParticleDead(e){const t=e.target,r=this.trails.findIndex((e=>e.targetObject.id===t.id));if(-1!=r){const e=this.trails[r];e.removeFromParent(),e.mesh.removeFromParent(),t.removeFromParent(),this.trails.splice(r,1)}}}export class CombinedRenderer extends t{dispose(){}scale(e){const t=e.transform.initialScale;e.target instanceof a.Sprite?null!=t?e.target.scale.set(t.x*e.scale*e.radius,t.y*e.scale*e.radius,1):e.target.scale.set(e.scale*e.radius,e.scale*e.radius,1):null!=t?e.target.scale.set(t.x*e.scale,t.y*e.scale,t.z*e.scale):super.scale(e)}rotate(e){e.target.material.rotation=e.rotation.z}onParticleCreated(e){e.target||(e.target=this._targetPool.get(e.body),(e.useAlpha||e.useColor)&&(e.target instanceof a.Mesh||e.target instanceof a.Sprite&&e.target.material instanceof a.Material)&&(e.target.material.__puid=r.id(e.body.material),e.target.material=this._materialPool.get(e.target.material))),e.target&&e.target instanceof i&&(e.target.position.set(e.position.x,e.position.y,e.position.z),this.container.add(e.target))}onParticleUpdate(e){const{target:t,useAlpha:r,useColor:s,rotation:n}=e;if(t){if(t.position.copy(e.position),this.isThreeSprite(e)||(t instanceof a.Mesh&&t.material instanceof o?e.target.material.rotation=e.rotation.z:t.rotation.set(n.x,n.y,n.z)),this.scale(e),e.transform&&e.transform.orientAlongVelocity&&t instanceof i){const r=m.set(e.velocity.x,e.velocity.y,e.velocity.z).normalize(),a=t.getWorldDirection(h);a.applyAxisAngle(u,Math.PI/-2),p.setFromUnitVectors(a,r),t.quaternion.copy(p)}t.material instanceof a.Material&&(r&&(t.material.opacity=e.alpha,t.material.transparent=!0),s&&null!=t.material.color&&t.material.color.copy(e.color))}}onParticleDead(e){e.target&&(e.target.material&&(e.useAlpha||e.useColor)&&this._materialPool.expire(e.target.material),this._targetPool.expire(e.target),this.container.remove(e.target),e.target=null)}}export class StretchedSpriteInstancedRenderer extends t{constructor(e,t,r){super(e,t),this.view=r,this.meshes=[]}dispose(){this.meshes.forEach((e=>e.mesh.geometry.dispose()))}onSystemUpdate(){for(const e of this.meshes){const t=e.mesh.geometry.getAttribute("offset"),r=e.mesh.geometry.getAttribute("size"),s=e.mesh.geometry.getAttribute("velocity"),i=e.mesh.geometry.getAttribute("rotation"),n=e.mesh.geometry.getAttribute("color");let o=0;for(const l of e.particles){if(null==l||l.dead)continue;if(l.useColor||l.color instanceof a.Color){const e=U.copy(l.color).getRGB(P);n.setXYZW(o,e.r,e.g,e.b,1),n.needsUpdate=!0}l.useAlpha&&(n.setW(o,l.alpha),n.needsUpdate=!0),"number"==typeof l.rotation?i.setX(o,l.rotation):i.setX(o,l.rotation.x);const e=l.position;if(t.setXYZ(o,e.x,e.y,e.z),"number"!=typeof l.scale)throw new Error("Particle scale is not a number");r.setXYZ(o,l.scale,l.scale,l.scale);let c=l.body.scaleFactor;0===c&&(c=.001);const d=1,m=l.velocity;s.setXYZW(o,m.x*c,m.y*c,m.z*c,d),o++}o>0&&(t.clearUpdateRanges(),t.addUpdateRange(0,3*o),t.needsUpdate=!0,r.clearUpdateRanges(),r.addUpdateRange(0,3*o),r.needsUpdate=!0,n.clearUpdateRanges(),n.addUpdateRange(0,4*o),n.needsUpdate=!0,s.clearUpdateRanges(),s.addUpdateRange(0,4*o),s.needsUpdate=!0,i.clearUpdateRanges(),i.addUpdateRange(0,o),i.needsUpdate=!0)}}onParticleCreated(e){if(e.body instanceof l&&null==e.target){const t=e.body;let r=this.meshes.find((e=>e.mesh.material.uuid===t.material.uuid));if(null==r){const i=M(e),n=new a.InstancedBufferGeometry;n.setIndex(t.geometry.getIndex()),n.setAttribute("position",t.geometry.getAttribute("position")),t.geometry.hasAttribute("normal")&&n.setAttribute("normal",t.geometry.getAttribute("normal")),n.setAttribute("uv",t.geometry.getAttribute("uv"));const o=new s(new Float32Array(3*i),3);o.setUsage(a.DynamicDrawUsage),n.setAttribute("offset",o);const l=new s(new Float32Array(4*i),4);l.setUsage(a.DynamicDrawUsage),n.setAttribute("color",l);const c=new s(new Float32Array(3*i),3);c.setUsage(a.DynamicDrawUsage),n.setAttribute("size",c);const d=new s(new Float32Array(4*i),4);d.setUsage(a.DynamicDrawUsage),n.setAttribute("velocity",d);const m=new s(new Float32Array(4*i),1);m.setUsage(a.DynamicDrawUsage),n.setAttribute("rotation",m),r={mesh:new a.Mesh(n,t.material),indices:new Float32Array(i),particles:[]},this.meshes.push(r),this.container.add(r.mesh)}let i=r.indices.findIndex((e=>0===e));i<0&&(i=function(e){let t=e[0],r=0;for(let a=1;a<e.length;a++)e[a]<t&&(t=e[a],r=a);return r}(r.indices)),r.indices[i]=performance.now(),e.target=i,r.particles[i]=e}}onParticleUpdate(e){}onParticleDead(e){const t=e.body;let r=this.meshes.find((e=>e.mesh.material.uuid===t.material.uuid));r&&(r.particles[e.target]=null,r.indices[e.target]=0),e.target=null}}const m=new a.Vector3,h=new a.Vector3,p=new a.Quaternion,u=new a.Vector3(1,0,0);export class InstancedRenderer extends t{constructor(e,t,r){super(e,t),this.view=r,this.meshes=[]}dispose(){this.meshes.forEach((e=>e.mesh.dispose()))}onSystemUpdate(){for(const e of this.meshes);}onParticleCreated(e){if(!(e.body instanceof a.Sprite)){if(null==e.target){const t=e.body;let r=this.meshes.find((e=>e.mesh.geometry.uuid===t.geometry.uuid&&e.mesh.material.uuid===t.material.uuid));if(null==r){const s=e.parent.rate;let i=Math.min(s.numPan.b*Math.ceil(e.life/Math.min(Math.max(s.timePan.a,.01),1)),1e5);r={mesh:new a.InstancedMesh(t.geometry,t.material,i),indices:new Array(i).fill(null),particles:[]},r.mesh.setColorAt(0,U.setScalar(1)),r.mesh.instanceColor.needsUpdate=!0;const n=new Float32Array(3*i);y.makeScale(0,0,0);for(let e=0;e<i;e++)n[3*e+0]=1,n[3*e+1]=1,r.mesh.setMatrixAt(e,y);r.mesh.instanceMatrix.needsUpdate=!0,r.mesh.geometry.setAttribute("particleData",new a.InstancedBufferAttribute(n,3)),this.meshes.push(r),this.container.add(r.mesh)}let s=r.indices.findIndex((e=>null==e));s<0&&(s=r.indices.indexOf(Math.min(...r.indices))),r.indices[s]=performance.now(),e.target=s,r.particles[s]=e}if("number"==typeof e.target){e.transform.initialScale;const t=e.body;let r=this.meshes.find((e=>e.mesh.geometry.uuid===t.geometry.uuid&&e.mesh.material.uuid===t.material.uuid));f(e,r.mesh),e.useAlpha&&(r.mesh.material.transparent=!0)}}}onParticleUpdate(e){const{target:t,useAlpha:r,useColor:a,rotation:s}=e;if(null==t)return;const i=e.body;let n=this.meshes.find((e=>e.mesh.geometry.uuid===i.geometry.uuid&&e.mesh.material.uuid===i.material.uuid));if(f(e,n.mesh),a&&(n.mesh.setColorAt(e.target,U.copy(e.color)),n.mesh.instanceColor.needsUpdate=!0),r){const t=n.mesh.geometry.getAttribute("particleData");t.setX(e.target,e.alpha),t.needsUpdate=!0}}onParticleDead(e){if(null!=e.target){const t=e.body;let r=this.meshes.find((e=>e.mesh.geometry.uuid===t.geometry.uuid&&e.mesh.material.uuid===t.material.uuid));r.indices[e.target]=null,e.scale=0,f(e,r.mesh),r.mesh.instanceMatrix.needsUpdate=!0,e.target=null}}}const g=new i;function f(e,t){if(w.set(e.position.x,e.position.y,e.position.z),e.transform&&e.transform.orientAlongVelocity){const r=m.set(e.position.x-e.old.position.x,e.position.y-e.old.position.y,e.position.z-e.old.position.z).normalize();t.getMatrixAt(e.target,g.matrix);const a=g.getWorldDirection(x);a.applyAxisAngle(u,Math.PI/-2),b.setFromUnitVectors(a,r)}else A.set(e.rotation.x,e.rotation.y,e.rotation.z),b.setFromEuler(A);const r=e.transform.initialScale;null!=r?x.set(r.x*e.scale,r.y*e.scale,r.z*e.scale):x.set(e.scale,e.scale,e.scale),y.compose(w,b,x),t.setMatrixAt(e.target,y),t.instanceMatrix.needsUpdate=!0}const y=new a.Matrix4,b=new a.Quaternion,w=new a.Vector3,x=new a.Vector3,A=new a.Euler,U=new a.Color(0),P={r:0,g:0,b:0};function R(e,t){const r=e.mesh,s=r.count,i=[],n=r.geometry.getAttribute("particleData"),o=new a.Vector3;for(let l=0;l<s;l++){const s=new a.Matrix4,c=new a.Color;r.getMatrixAt(l,s),r.getColorAt(l,c);const d=n.getX(l);o.setFromMatrixPosition(s);const m=o.distanceTo(t.position);i.push({index:l,distance:m,matrix:s,particle:e.particles[l],color:c,pdx:d})}i.sort(((e,t)=>t.distance-e.distance));for(let e=0;e<s;e++){const t=i[e].matrix;null==i[e].particle&&t.makeScale(0,0,0),r.setMatrixAt(e,t),r.setColorAt(e,i[e].color),n.setX(e,i[e].pdx)}r.instanceMatrix.needsUpdate=!0}export{R as sortInstancedMeshByDistance};function M(e){const t=null!=e.parent.parentParticle?M(e.parent.parentParticle):1,r=e.parent.rate;return Math.min(Math.ceil(r.numPan.b/Math.min(Math.max(r.timePan.a,.01),1)),1e5)*e.life*t}/*
3
2
  * Copyright (©) 2023. All rights reserved.
4
3
  * See the LICENSE.md file for details.
5
4
  */
@@ -12,3 +12,4 @@ export declare class VfxService {
12
12
  createPoolFromAssetId(assetId: AssetId, parent?: Object3D | BaseActor): Promise<VfxPool>;
13
13
  createPoolFromAsset(asset: Asset, parent?: Object3D | BaseActor): Promise<VfxPool<VfxActor>>;
14
14
  }
15
+ //# sourceMappingURL=vfx-service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vfx-service.d.ts","sourceRoot":"","sources":["../../../src/effects/vfx/vfx-service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,EAA6B,SAAS,EAAmB,QAAQ,EAAuB,MAAM,gBAAgB,CAAA;AACrH,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAGtC,qBACa,UAAU;IACrB,OAAO,CAAC,KAAK,CAA8B;IAE3C,OAAO,CAAC,YAAY,CAAuB;IAC3C,OAAO,CAAC,YAAY,CAAsB;IAC1C,OAAO,CAAC,KAAK,CAAgB;IAEvB,iBAAiB,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,GAAE,QAAQ,GAAC,SAA4B,GAAG,OAAO,CAAC,QAAQ,CAAC;IAKrG,eAAe,CAAC,KAAK,EAAE,KAAK,EAAE,MAAM,GAAE,QAAQ,GAAC,SAA4B;IAW3E,qBAAqB,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,GAAE,QAAQ,GAAC,SAA4B,GAAG,OAAO,CAAC,OAAO,CAAC;IAKxG,mBAAmB,CAAC,KAAK,EAAE,KAAK,EAAE,MAAM,GAAE,QAAQ,GAAC,SAA4B;CAStF"}
@@ -1,5 +1,4 @@
1
- import{__decorate as t}from"tslib";import{ActorFactory as s,AssetLoader as e,BaseActor as r,inject as o,Service as a,VfxActor as c,World as i}from"../../gameplay";import{VfxPool as n}from"./vfx-param";let h=class{constructor(){this.pools=new Map,this.actorFactory=o(s),this.assetService=o(e),this.world=o(i)}async createFromAssetId(t,s=this.world.scene){const e=await this.assetService.getAsset(t);return this.createFromAsset(e,s)}async createFromAsset(t,s=this.world.scene){const e=await this.actorFactory.create(c);return s instanceof r?s.object.add(e.object):s.add(e.object),await e.fromAsset(t),e}async createPoolFromAssetId(t,s=this.world.scene){const e=await this.assetService.getAsset(t);return this.createPoolFromAsset(e,s)}async createPoolFromAsset(t,s=this.world.scene){let e;return this.pools.has(t.id)||(e=new n((()=>this.createFromAsset(t,s))),this.pools.set(t.id,e)),e}};h=t([a()],h);export{h as VfxService};
2
- /*
1
+ import{__decorate as t}from"tslib";import{ActorFactory as s,AssetLoader as e,BaseActor as r,inject as o,Service as a,VfxActor as c,World as i}from"../../gameplay";import{VfxPool as n}from"./vfx-param";let h=class{constructor(){this.pools=new Map,this.actorFactory=o(s),this.assetService=o(e),this.world=o(i)}async createFromAssetId(t,s=this.world.scene){const e=await this.assetService.getAsset(t);return this.createFromAsset(e,s)}async createFromAsset(t,s=this.world.scene){const e=await this.actorFactory.create(c);return s instanceof r?s.object.add(e.object):s.add(e.object),await e.fromAsset(t),e}async createPoolFromAssetId(t,s=this.world.scene){const e=await this.assetService.getAsset(t);return this.createPoolFromAsset(e,s)}async createPoolFromAsset(t,s=this.world.scene){let e;return this.pools.has(t.id)||(e=new n((()=>this.createFromAsset(t,s))),this.pools.set(t.id,e)),e}};h=t([a()],h);export{h as VfxService};/*
3
2
  * Copyright (©) 2023. All rights reserved.
4
3
  * See the LICENSE.md file for details.
5
4
  */
@@ -1,4 +1,4 @@
1
- import { Vector3D } from "three-nebula";
1
+ import { Vector3D } from "@hology/nebula";
2
2
  declare const SphereZone_base: any;
3
3
  /**
4
4
  * A spherical zone for particles to be emitted within.
@@ -72,3 +72,4 @@ export declare class PointZone extends PointZone_base {
72
72
  getPosition(): any;
73
73
  }
74
74
  export {};
75
+ //# sourceMappingURL=zones.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"zones.d.ts","sourceRoot":"","sources":["../../../src/effects/vfx/zones.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;;AAM1C;;;GAGG;AACH,qBAAa,UAAW,SAAQ,eAAyC;IAc3D,OAAO,CAAC,CAAC;IAAU,OAAO,CAAC,CAAC;IAAU,OAAO,CAAC,CAAC;IAAU,OAAO,CAAC,MAAM;IAbnF,OAAO,CAAC,GAAG,CAAI;IACf,OAAO,CAAC,GAAG,CAAI;IACf,SAAS,CAAC,MAAM,EAAE,MAAM,CAAA;IACxB,SAAS,CAAC,MAAM,WAAiB;IACjC;;;;;;;;OAQG;gBACiB,CAAC,EAAE,MAAM,EAAU,CAAC,EAAE,MAAM,EAAU,CAAC,EAAE,MAAM,EAAU,MAAM,EAAE,MAAM;IAI3F;;;;OAIG;IACH,YAAY;IAIZ;;;;;OAKG;IACH,KAAK,CAAC,QAAQ,KAAA;IAMd;;;;OAIG;IACH,MAAM;IAGN,WAAW,iBAgBN;IACL,MAAM,0BAkBD;CACN;;AAKD,qBAAa,SAAU,SAAQ,cAAyC;IAa1D,OAAO,CAAC,CAAC;IAAU,OAAO,CAAC,CAAC;IAAU,OAAO,CAAC,CAAC;IAZ3D;;;;;;;;;;;OAWG;gBACiB,CAAC,EAAE,MAAM,EAAU,CAAC,EAAE,MAAM,EAAU,CAAC,EAAE,MAAM;IAInE;;;;OAIG;IACH,WAAW;IAIX,WAAW;CAOZ"}
@@ -1,5 +1,4 @@
1
- import{Vector3D as t}from"three-nebula";import{SphereZone as s}from"three-nebula";const o=Math.PI;export class SphereZone extends(Object.getPrototypeOf(s)){constructor(s,i,e,r){var h,n,a;super("SphereZone"),this.x=s,this.y=i,this.z=e,this.radius=r,this.the=0,this.phi=0,this.vector=new t,this.getPosition=(()=>{var t,s,i;return()=>(this.random=Math.random(),i=this.random*this.radius,t=o*Math.random(),s=2*o*Math.random(),this.vector.x=this.x+i*Math.sin(t)*Math.cos(s),this.vector.y=this.y+i*Math.sin(s)*Math.sin(t),this.vector.z=this.z+i*Math.cos(t),this.vector)})(),this._bound=(n=new t,a=new t,function(t){t.position.distanceTo(this)+t.radius>=this.radius&&(n.copy(t.position).sub(this).normalize(),a.copy(t.velocity),h=2*a.dot(n),t.velocity.sub(n.scalar(h)))})}isSphereZone(){return!0}_dead(t){t.position.distanceTo(this)-t.radius>this.radius&&(t.dead=!0)}_cross(){console.warn(`${this.constructor.name} does not support the _cross method`)}}export class PointZone extends(Object.getPrototypeOf(s)){constructor(t,s,o){super("PointZone"),this.x=t,this.y=s,this.z=o}isPointZone(){return!0}getPosition(){return this.vector.x=this.x,this.vector.y=this.y,this.vector.z=this.z,this.vector}}
2
- /*
1
+ import{Vector3D as t}from"@hology/nebula";import{SphereZone as s}from"@hology/nebula";const o=Math.PI;export class SphereZone extends(Object.getPrototypeOf(s)){constructor(s,i,e,r){var h,n,a;super("SphereZone"),this.x=s,this.y=i,this.z=e,this.radius=r,this.the=0,this.phi=0,this.vector=new t,this.getPosition=(()=>{var t,s,i;return()=>(this.random=Math.random(),i=this.random*this.radius,t=o*Math.random(),s=2*o*Math.random(),this.vector.x=this.x+i*Math.sin(t)*Math.cos(s),this.vector.y=this.y+i*Math.sin(s)*Math.sin(t),this.vector.z=this.z+i*Math.cos(t),this.vector)})(),this._bound=(n=new t,a=new t,function(t){t.position.distanceTo(this)+t.radius>=this.radius&&(n.copy(t.position).sub(this).normalize(),a.copy(t.velocity),h=2*a.dot(n),t.velocity.sub(n.multiplyScalar(h)))})}isSphereZone(){return!0}_dead(t){t.position.distanceTo(this)-t.radius>this.radius&&(t.dead=!0)}_cross(){console.warn(`${this.constructor.name} does not support the _cross method`)}}export class PointZone extends(Object.getPrototypeOf(s)){constructor(t,s,o){super("PointZone"),this.x=t,this.y=s,this.z=o}isPointZone(){return!0}getPosition(){return this.vector.x=this.x,this.vector.y=this.y,this.vector.z=this.z,this.vector}}/*
3
2
  * Copyright (©) 2023. All rights reserved.
4
3
  * See the LICENSE.md file for details.
5
4
  */
@@ -3,3 +3,4 @@ export declare function Param(name?: string, obj?: {}): {
3
3
  (target: Function): void;
4
4
  (target: Object, propertyKey: string | symbol): void;
5
5
  };
6
+ //# sourceMappingURL=component-decorators.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"component-decorators.d.ts","sourceRoot":"","sources":["../../src/game-component/component-decorators.ts"],"names":[],"mappings":"AAAA,OAAO,kBAAkB,CAAC;AAG1B,wBAAgB,KAAK,CAAC,IAAI,GAAE,MAAa,EAAE,GAAG,GAAE,EAAS;;;EAExD"}
@@ -1,5 +1,4 @@
1
- import"reflect-metadata";const t=Symbol("Param");export function Param(a=null,e=null){return Reflect.metadata(t,a)}
2
- /*
1
+ import"reflect-metadata";const t=Symbol("Param");export function Param(a=null,e=null){return Reflect.metadata(t,a)}/*
3
2
  * Copyright (©) 2023. All rights reserved.
4
3
  * See the LICENSE.md file for details.
5
4
  */
@@ -6,3 +6,4 @@ export declare abstract class GameComponent {
6
6
  update(deltaTime: number): void | Promise<void>;
7
7
  onInit(): void;
8
8
  }
9
+ //# sourceMappingURL=game-component.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"game-component.d.ts","sourceRoot":"","sources":["../../src/game-component/game-component.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEjC,8BAAsB,aAAa;IAC1B,EAAE,EAAE,MAAM,CAAA;IACV,MAAM,EAAE,QAAQ,CAAA;IAChB,KAAK,EAAE,GAAG,CAAA;IAEV,MAAM,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,GAAC,OAAO,CAAC,IAAI,CAAC;IAC7C,MAAM;CACd"}
@@ -1,5 +1,4 @@
1
- export class GameComponent{update(e){}onInit(){}}
2
- /*
1
+ export class GameComponent{update(e){}onInit(){}}/*
3
2
  * Copyright (©) 2023. All rights reserved.
4
3
  * See the LICENSE.md file for details.
5
4
  */
@@ -35,3 +35,4 @@ export declare abstract class BaseActor {
35
35
  getComponent<T extends ActorComponent>(type: Constructable<T>): T;
36
36
  }
37
37
  export declare function _setupActorUpdateEventHandlers(): void;
38
+ //# sourceMappingURL=actor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"actor.d.ts","sourceRoot":"","sources":["../../../src/gameplay/actors/actor.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAa,MAAM,MAAM,CAAA;AACzC,OAAO,EAAE,QAAQ,EAAS,MAAM,OAAO,CAAA;AACvC,OAAkB,EAAE,aAAa,EAAW,MAAM,QAAQ,CAAA;AAC1D,OAAO,EAAE,cAAc,EAAU,oBAAoB,EAAE,MAAM,gBAAgB,CAAA;AAO7E,wBAAgB,KAAK,qCAQpB;AAED,MAAM,MAAM,OAAO,GAAG,MAAM,CAAA;AAE5B;;GAEG;AACH,8BAAsB,SAAS;IAC7B,QAAQ,CAAC,EAAE,EAAE,OAAO,CAAY;IAIzB,eAAe,UAAQ;IAE9B,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAc;IACvC,QAAQ,CAAC,QAAQ,gBAAsB;IACvC,IACI,QAAQ,4BAEX;IACD,IACI,UAAU,+BAEb;IACD,IACI,QAAQ,0BAEX;IACD,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC,GAAC,IAAI;IAC5B,WAAW,IAAI,IAAI;IACnB,SAAS,IAAI,IAAI;IACjB;;;;OAIG;IACH,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI;IACjC;;;;OAIG;IACH,YAAY,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI;;IAYrC,MAAM,CAAC,CAAC,SAAS,cAAc,EAAE,IAAI,EAAE,aAAa,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,EAAE,oBAAoB,CAAC,CAAC,CAAC,GAAG,CAAC;IAiC5F,YAAY,CAAC,CAAC,SAAS,cAAc,EAAE,IAAI,EAAE,aAAa,CAAC,CAAC,CAAC,GAAG,CAAC;CAOlE;AAID,wBAAgB,8BAA8B,SAO7C"}
@@ -1,5 +1,4 @@
1
- import{__decorate as t,__metadata as e}from"tslib";import o,{ignore as i}from"@plumier/reflect";import{Subject as n,skipWhile as s}from"rxjs";import{Group as r}from"three";import a,{Service as p}from"typedi";import{ActorComponent as c}from"./component.js";import{initComponents as d}from"./internal/component-init.js";import{activeContainerInstance as m,containerRefMap as h}from"./internal/container-map.js";import{randomString as l}from"../../utils/math.js";import{inject as u}from"../inject.js";import{ViewController as f}from"../services/render.js";export function Actor(){const t=p({transient:!0});return function(e){e.__isActor=!0,t(e),o.noop()(e),o.parameterProperties()(e)}}let U=0;export class BaseActor{get position(){return this.object?.position}get quaternion(){return this.object?.quaternion}get rotation(){return this.object?.rotation}onInit(){}onBeginPlay(){}onEndPlay(){}onUpdate(t){}onLateUpdate(t){}constructor(){this.id=++U,this.__isInitialised=!1,this.object=new r,this.disposed=new n,this.onUpdate!==BaseActor.prototype.onUpdate&&u(f).onUpdate(this).pipe(s((()=>!this.__isInitialised))).subscribe((t=>this.onUpdate(t))),this.onLateUpdate!==BaseActor.prototype.onLateUpdate&&u(f).onLateUpdate(this).pipe(s((()=>!this.__isInitialised))).subscribe((t=>this.onLateUpdate(t)))}attach(t,e){const o=m.value,i=h.get(this)??m.value??a.of("default");m.value=i;const n=l();i.set({id:n,type:t,transient:!0});const s=i.get(n);if(m.value=o,null!=e)for(const t of Object.keys(e))s[t]=e[t];return this.__isInitialised&&(s.actor=this,s.onInit(),d(s,this)),s}getComponent(t){for(const e of Object.values(this))if(e instanceof t)return e}}t([i(),e("design:type",Object),e("design:paramtypes",[])],BaseActor.prototype,"position",null),t([i(),e("design:type",Object),e("design:paramtypes",[])],BaseActor.prototype,"quaternion",null),t([i(),e("design:type",Object),e("design:paramtypes",[])],BaseActor.prototype,"rotation",null);export function _setupActorUpdateEventHandlers(){this.onUpdate!==c.prototype.onUpdate&&u(f).onUpdate(this.actor).pipe(s((()=>!this.actor?.__isInitialised))).subscribe((t=>this.onUpdate(t))),this.onLateUpdate!==c.prototype.onLateUpdate&&u(f).onLateUpdate(this.actor).pipe(s((()=>!this.actor?.__isInitialised))).subscribe((t=>this.onLateUpdate(t)))}
2
- /*
1
+ import{__decorate as t,__metadata as e}from"tslib";import o,{ignore as i}from"@plumier/reflect";import{Subject as n,skipWhile as s}from"rxjs";import{Group as r}from"three";import a,{Service as p}from"typedi";import{ActorComponent as c}from"./component.js";import{initComponents as d}from"./internal/component-init.js";import{activeContainerInstance as m,containerRefMap as h}from"./internal/container-map.js";import{randomString as l}from"../../utils/math.js";import{inject as u}from"../inject.js";import{ViewController as f}from"../services/render.js";export function Actor(){const t=p({transient:!0});return function(e){e.__isActor=!0,t(e),o.noop()(e),o.parameterProperties()(e)}}let U=0;export class BaseActor{get position(){return this.object?.position}get quaternion(){return this.object?.quaternion}get rotation(){return this.object?.rotation}onInit(){}onBeginPlay(){}onEndPlay(){}onUpdate(t){}onLateUpdate(t){}constructor(){this.id=++U,this.__isInitialised=!1,this.object=new r,this.disposed=new n,this.onUpdate!==BaseActor.prototype.onUpdate&&u(f).onUpdate(this).pipe(s((()=>!this.__isInitialised))).subscribe((t=>this.onUpdate(t))),this.onLateUpdate!==BaseActor.prototype.onLateUpdate&&u(f).onLateUpdate(this).pipe(s((()=>!this.__isInitialised))).subscribe((t=>this.onLateUpdate(t)))}attach(t,e){const o=m.value,i=h.get(this)??m.value??a.of("default");m.value=i;const n=l();i.set({id:n,type:t,transient:!0});const s=i.get(n);if(m.value=o,null!=e)for(const t of Object.keys(e))s[t]=e[t];return this.__isInitialised&&(s.actor=this,s.onInit(),d(s,this)),s}getComponent(t){for(const e of Object.values(this))if(e instanceof t)return e}}t([i(),e("design:type",Object),e("design:paramtypes",[])],BaseActor.prototype,"position",null),t([i(),e("design:type",Object),e("design:paramtypes",[])],BaseActor.prototype,"quaternion",null),t([i(),e("design:type",Object),e("design:paramtypes",[])],BaseActor.prototype,"rotation",null);export function _setupActorUpdateEventHandlers(){this.onUpdate!==c.prototype.onUpdate&&u(f).onUpdate(this.actor).pipe(s((()=>!this.actor?.__isInitialised))).subscribe((t=>this.onUpdate(t))),this.onLateUpdate!==c.prototype.onLateUpdate&&u(f).onLateUpdate(this.actor).pipe(s((()=>!this.actor?.__isInitialised))).subscribe((t=>this.onLateUpdate(t)))}/*
3
2
  * Copyright (©) 2023. All rights reserved.
4
3
  * See the LICENSE.md file for details.
5
4
  */
@@ -3,3 +3,4 @@ import { CameraComponent } from '../camera/camera-component.js';
3
3
  export declare class CameraActor extends BaseActor {
4
4
  camera: CameraComponent;
5
5
  }
6
+ //# sourceMappingURL=camera-actor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"camera-actor.d.ts","sourceRoot":"","sources":["../../../../src/gameplay/actors/builtin/camera-actor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,SAAS,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAIhE,qBACa,WAAY,SAAQ,SAAS;IACtC,MAAM,EAAE,eAAe,CAA0B;CACpD"}
@@ -1,5 +1,4 @@
1
- import{__decorate as o}from"tslib";import{Actor as r,BaseActor as t}from"../actor.js";import{CameraComponent as m}from"../camera/camera-component.js";import{attach as e}from"../component.js";let s=class extends t{constructor(){super(...arguments),this.camera=e(m)}};s=o([r()],s);export{s as CameraActor};
2
- /*
1
+ import{__decorate as o}from"tslib";import{Actor as r,BaseActor as t}from"../actor.js";import{CameraComponent as m}from"../camera/camera-component.js";import{attach as e}from"../component.js";let s=class extends t{constructor(){super(...arguments),this.camera=e(m)}};s=o([r()],s);export{s as CameraActor};/*
3
2
  * Copyright (©) 2023. All rights reserved.
4
3
  * See the LICENSE.md file for details.
5
4
  */
@@ -61,3 +61,4 @@ export type PlayOptions = Partial<{
61
61
  priority: number;
62
62
  fadeTime: number;
63
63
  }>;
64
+ //# sourceMappingURL=character-animation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"character-animation.d.ts","sourceRoot":"","sources":["../../../../../../src/gameplay/actors/builtin/components/character/character-animation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAa,MAAM,uBAAuB,CAAC;AAClE,OAAO,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAA;AACxE,OAAO,EAAE,SAAS,EAAkB,MAAM,sCAAsC,CAAA;AAGhF,OAAO,EAAkB,eAAe,EAAE,aAAa,EAAE,IAAI,EAAE,QAAQ,EAAY,MAAM,OAAO,CAAA;AAIhG,qBACa,2BAA4B,SAAQ,cAAc;IAC7D,OAAO,CAAC,cAAc,CAAyB;IAC/C,OAAO,CAAC,KAAK,CAAgB;IAC7B,OAAO,CAAC,aAAa,CAA8B;IACnD,OAAO,CAAC,kBAAkB,CAA8B;IACxD,OAAO,CAAC,QAAQ,CAAK;IAErB,OAAO,CAAC,gBAAgB,CAAC,CAAQ;IACjC,OAAO,CAAC,qBAAqB,CAAC,CAAQ;IAK/B,aAAa,MAAO;IAK3B,OAAO,CAAC,cAAc,CAAiB;IACvC,OAAO,CAAC,eAAe,CAAiB;IACxC,O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AAQ,EAAE,MAAM,CAAA;IAChB,QAAQ,EAAE,MAAM,CAAA;CACjB,CAAC,CAAA"}
@@ -1,5 +1,4 @@
1
- import{__decorate as t}from"tslib";import{ActorComponent as e,Component as i}from"../../../component.js";import{RootMotionClip as o}from"../../../../animation/root-motion.js";import{inject as r}from"../../../../inject.js";import{ViewController as s}from"../../../../services/render.js";import{AnimationMixer as n,Bone as p,Object3D as l,LoopOnce as h}from"three";import{CharacterMovementComponent as u}from"./character-movement.js";let a=class extends e{constructor(){super(...arguments),this.viewController=r(s),this.stateMachines=[],this.upperStateMachines=[],this.fadeTime=.2,this.movementSpeed=null,this.upperBodyTimer=0,this.upperBodyOverride=!1,this.fullBodyTimer=0,this.currentFullBodyPriority=-1,this.currentUpperBodyPriority=-1,this.getFullBodyClip=y((t=>t.uuid),(t=>c(this.fullBodyMask,t))),this.getUpperBodyClip=y((t=>t.uuid),(t=>c(this.upperBodyMask,t)))}onInit(){this.viewController.onUpdate(this.actor).subscribe((t=>this.updateInternal(t))),this.characterMovement=this.actor.getComponent(u)}getRootMotionAction(){if(this.fullBodyAction.getClip()instanceof o)return this.fullBodyAction}setup(t,e,i){null!=e&&(this.upperBodyMask=d(e),this.fullBodyMask=function(t,e){const i=new Set(d(e).map((t=>t.uuid))),o=[];return t.traverse((t=>{(t instanceof p||t.isBone)&&!i.has(t.uuid)&&o.push(t)})),o}(function(t){let e;return t.traverse((t=>{(t instanceof p||t.isBone)&&null==e&&(e=t)})),e}(t),e)),null!=this.mixer&&this.mixer.stopAllAction(),this.mixer=new n(t)}updateStateMachines(t){this.stateMachines.forEach((e=>{e.step(t);const i=e.current.clip;null!=i&&this.play(i,{priority:0,loop:e.current.options.loop??!0})})),this.upperStateMachines.forEach((e=>{e.step(t);const i=e.current.clip;null!=i?this.playUpper(i,{priority:0,loop:e.current.options.loop??!0}):this.play(this.fullBodyClip)}))}updateInternal(t){null!=this.mixer&&(this.upperBodyTimer+=t,this.fullBodyTimer+=t,this.upperBodyAction&&this.upperBodyOverride&&this.upperBodyAction.getClip().duration-2*(this.overrideFadeTimeUpper??this.fadeTime)<this.upperBodyTimer&&(this.upperBodyOverride=!1,null!=this.fullBodyClip&&this.transition(this.upperBodyAction,this.getUpperBodyClip(this.fullBodyClip)),this.upperBodyAction=null,this.overrideFadeTimeUpper=null),this.fullBodyAction&&this.fullBodyAction.loop===h&&this.fullBodyAction.getClip().duration-2*(this.overrideFadeTime??this.fadeTime)<this.fullBodyTimer&&(this.currentFullBodyPriority=-1,this.overrideFadeTime=null),null!=this.characterMovement&&(this.movementSpeed=this.characterMovement.horizontalSpeed),this.updateStateMachines(t),this.syncMovementSpeed(this.fullBodyAction),this.upperBodyOverride||this.syncMovementSpeed(this.upperBodyAction),this.mixer.update(t))}syncMovementSpeed(t){if(null!=t){const e=t.getClip();if(e instanceof o&&e.fixedInPlace&&null!=this.movementSpeed){t.timeScale=e.duration/e.displacement*this.movementSpeed;const i=this.mixer.getRoot();i instanceof l&&(t.timeScale/=i.scale.x)}}}playStateMachine(t){this.stateMachines.push(t)}playUpperStateMachine(t){this.upperStateMachines.push(t)}removeStateMachine(t){const e=this.stateMachines.indexOf(t);e>=0&&this.stateMachines.splice(e,1)}removeUpperStateMachine(t){const e=this.upperStateMachines.indexOf(t);e>=0&&this.upperStateMachines.splice(e,1)}playUpper(t,e={}){const i=e?.priority??1;i<this.currentUpperBodyPriority||(this.currentUpperBodyPriority=i,this.upperBodyAction=this.transition(this.upperBodyAction,this.getUpperBodyClip(t),e),this.upperBodyTimer=0,this.upperBodyOverride=!0,this.overrideFadeTimeUpper=e.fadeTime)}play(t,e={}){!function(t,e){if(!1===t||"function"==typeof t&&!1===t())throw new Error(e)}(null!=this.mixer,"Can't play animation before setup is called");const i=e.priority??1;i<this.currentFullBodyPriority||(this.currentFullBodyPriority=i,this.fullBodyTimer=0,this.upperBodyOverride||(this.upperBodyAction=this.transition(this.upperBodyAction,this.getUpperBodyClip(t),e)),this.fullBodyClip=t,this.fullBodyAction=this.transition(this.fullBodyAction,this.getFullBodyClip(t),e),this.fullBodyAction.getClip().uuid==this.upperBodyAction.getClip().uuid&&this.upperBodyAction.syncWith(this.fullBodyAction),this.overrideFadeTime=e.fadeTime)}onActionDone(t){return new Promise((e=>{const i=o=>{o.action===t&&(e(o.action),this.mixer.removeEventListener("finished",i))};this.mixer.addEventListener("finished",i)}))}transition(t,e,i={}){if(null!=t&&t.getClip().uuid===e.uuid)return t;if(t){const o=t,r=t=this.mixer.clipAction(e);r.play(),r.enabled=!0,r.setEffectiveTimeScale(1),r.setEffectiveWeight(1),r.time=0,o.crossFadeTo(r,i?.fadeTime??this.fadeTime,!0)}else t=this.mixer.clipAction(e),t?.fadeIn(.3),t?.play();return!1===i.loop&&(t.setLoop(h,1),t.clampWhenFinished=!0,t.reset()),t}};a=t([i({inEditor:!0})],a);export{a as CharacterAnimationComponent};function c(t,e){if(null==t)return e;const i=e.clone(),o=new Set(t.map((t=>t.name)));return i.tracks=i.tracks.filter((t=>o.has(t.name.split(".")[0]))),i}function d(t){return t.flatMap((t=>function(t){const e=[];return t.traverse((t=>{e.push(t)})),e}(t))).filter((t=>t instanceof p))}function y(t,e){const i=new Map;return(o,...r)=>{const s=t(o);return i.has(s)||i.set(s,e(o,...r)),i.get(s)}}
2
- /*
1
+ import{__decorate as t}from"tslib";import{ActorComponent as e,Component as i}from"../../../component.js";import{RootMotionClip as o}from"../../../../animation/root-motion.js";import{inject as r}from"../../../../inject.js";import{ViewController as s}from"../../../../services/render.js";import{AnimationMixer as n,Bone as p,Object3D as l,LoopOnce as h}from"three";import{CharacterMovementComponent as u}from"./character-movement.js";let a=class extends e{constructor(){super(...arguments),this.viewController=r(s),this.stateMachines=[],this.upperStateMachines=[],this.fadeTime=.2,this.movementSpeed=null,this.upperBodyTimer=0,this.upperBodyOverride=!1,this.fullBodyTimer=0,this.currentFullBodyPriority=-1,this.currentUpperBodyPriority=-1,this.getFullBodyClip=y((t=>t.uuid),(t=>c(this.fullBodyMask,t))),this.getUpperBodyClip=y((t=>t.uuid),(t=>c(this.upperBodyMask,t)))}onInit(){this.viewController.onUpdate(this.actor).subscribe((t=>this.updateInternal(t))),this.characterMovement=this.actor.getComponent(u)}getRootMotionAction(){if(this.fullBodyAction.getClip()instanceof o)return this.fullBodyAction}setup(t,e,i){null!=e&&(this.upperBodyMask=d(e),this.fullBodyMask=function(t,e){const i=new Set(d(e).map((t=>t.uuid))),o=[];return t.traverse((t=>{(t instanceof p||t.isBone)&&!i.has(t.uuid)&&o.push(t)})),o}(function(t){let e;return t.traverse((t=>{(t instanceof p||t.isBone)&&null==e&&(e=t)})),e}(t),e)),null!=this.mixer&&this.mixer.stopAllAction(),this.mixer=new n(t)}updateStateMachines(t){this.stateMachines.forEach((e=>{e.step(t);const i=e.current.clip;null!=i&&this.play(i,{priority:0,loop:e.current.options.loop??!0})})),this.upperStateMachines.forEach((e=>{e.step(t);const i=e.current.clip;null!=i?this.playUpper(i,{priority:0,loop:e.current.options.loop??!0}):this.play(this.fullBodyClip)}))}updateInternal(t){null!=this.mixer&&(this.upperBodyTimer+=t,this.fullBodyTimer+=t,this.upperBodyAction&&this.upperBodyOverride&&this.upperBodyAction.getClip().duration-2*(this.overrideFadeTimeUpper??this.fadeTime)<this.upperBodyTimer&&(this.upperBodyOverride=!1,null!=this.fullBodyClip&&this.transition(this.upperBodyAction,this.getUpperBodyClip(this.fullBodyClip)),this.upperBodyAction=null,this.overrideFadeTimeUpper=null),this.fullBodyAction&&this.fullBodyAction.loop===h&&this.fullBodyAction.getClip().duration-2*(this.overrideFadeTime??this.fadeTime)<this.fullBodyTimer&&(this.currentFullBodyPriority=-1,this.overrideFadeTime=null),null!=this.characterMovement&&(this.movementSpeed=this.characterMovement.horizontalSpeed),this.updateStateMachines(t),this.syncMovementSpeed(this.fullBodyAction),this.upperBodyOverride||this.syncMovementSpeed(this.upperBodyAction),this.mixer.update(t))}syncMovementSpeed(t){if(null!=t){const e=t.getClip();if(e instanceof o&&e.fixedInPlace&&null!=this.movementSpeed){t.timeScale=e.duration/e.displacement*this.movementSpeed;const i=this.mixer.getRoot();i instanceof l&&(t.timeScale/=i.scale.x)}}}playStateMachine(t){this.stateMachines.push(t)}playUpperStateMachine(t){this.upperStateMachines.push(t)}removeStateMachine(t){const e=this.stateMachines.indexOf(t);e>=0&&this.stateMachines.splice(e,1)}removeUpperStateMachine(t){const e=this.upperStateMachines.indexOf(t);e>=0&&this.upperStateMachines.splice(e,1)}playUpper(t,e={}){const i=e?.priority??1;i<this.currentUpperBodyPriority||(this.currentUpperBodyPriority=i,this.upperBodyAction=this.transition(this.upperBodyAction,this.getUpperBodyClip(t),e),this.upperBodyTimer=0,this.upperBodyOverride=!0,this.overrideFadeTimeUpper=e.fadeTime)}play(t,e={}){!function(t,e){if(!1===t||"function"==typeof t&&!1===t())throw new Error(e)}(null!=this.mixer,"Can't play animation before setup is called");const i=e.priority??1;i<this.currentFullBodyPriority||(this.currentFullBodyPriority=i,this.fullBodyTimer=0,this.upperBodyOverride||(this.upperBodyAction=this.transition(this.upperBodyAction,this.getUpperBodyClip(t),e)),this.fullBodyClip=t,this.fullBodyAction=this.transition(this.fullBodyAction,this.getFullBodyClip(t),e),this.fullBodyAction.getClip().uuid==this.upperBodyAction.getClip().uuid&&this.upperBodyAction.syncWith(this.fullBodyAction),this.overrideFadeTime=e.fadeTime)}onActionDone(t){return new Promise((e=>{const i=o=>{o.action===t&&(e(o.action),this.mixer.removeEventListener("finished",i))};this.mixer.addEventListener("finished",i)}))}transition(t,e,i={}){if(null!=t&&t.getClip().uuid===e.uuid)return t;if(t){const o=t,r=t=this.mixer.clipAction(e);r.play(),r.enabled=!0,r.setEffectiveTimeScale(1),r.setEffectiveWeight(1),r.time=0,o.crossFadeTo(r,i?.fadeTime??this.fadeTime,!0)}else t=this.mixer.clipAction(e),t?.fadeIn(.3),t?.play();return!1===i.loop&&(t.setLoop(h,1),t.clampWhenFinished=!0,t.reset()),t}};a=t([i({inEditor:!0})],a);export{a as CharacterAnimationComponent};function c(t,e){if(null==t)return e;const i=e.clone(),o=new Set(t.map((t=>t.name)));return i.tracks=i.tracks.filter((t=>o.has(t.name.split(".")[0]))),i}function d(t){return t.flatMap((t=>function(t){const e=[];return t.traverse((t=>{e.push(t)})),e}(t))).filter((t=>t instanceof p))}function y(t,e){const i=new Map;return(o,...r)=>{const s=t(o);return i.has(s)||i.set(s,e(o,...r)),i.get(s)}}/*
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 CharacterMovementComponent extends ActorComponent {
35
35
  private step;
36
36
  private performMovement;
37
37
  }
38
+ //# sourceMappingURL=character-movement%20copy.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"character-movement copy.d.ts","sourceRoot":"","sources":["../../../../../../src/gameplay/actors/builtin/components/character/character-movement copy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,wCAAwC,CAAC;AAC/F,OAAO,EAAE,aAAa,EAAiB,MAAM,4DAA4D,CAAC;AAE1G,OAAO,EAAS,OAAO,EAAa,MAAM,OAAO,CAAC;AAClD,OAAO,EAAE,cAAc,EAAa,MAAM,uBAAuB,CAAC;AAClE,OAAO,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAMnD,qBACa,0BAA2B,SAAQ,cAAc;IA+B9C,OAAO,CAAC,aAAa;IA5BjC,QAAQ,CAAC,cAAc,YAAkB;IACzC,QAAQ,CAAC,SAAS,cAAoB;IACtC,QAAQ,CAAC,WAAW,cAAoB;IACxC,QAAQ,CAAC,aAAa,gBAAsB;IAGrC,eAAe,SAAI;IAGnB,QAAQ,SAAI;IACZ,iBAAiB,SAAI;IACrB,cAAc,SAAK;IACnB,oBAAoB,SAAK;IACzB,YAAY,SAAI;IAChB,sBAAsB,SAAK;IAC3B,oBAAoB,UAAQ;IAC5B,eAAe,EAAE,MAAM,CAAO;IAC9B,cAAc,EAAE,MAAM,CAAM;IAC5B,cAAc,EAAE,MAAM,CAAK;IAGlC,QAAQ,CAAC,QAAQ,UAAgB;IACjC,IAAI,wBAAgC;IACpC,WAAW,UAAQ;IACnB,WAAW,UAAQ;IAEnB,OAAO,CAAC,aAAa,CAAsB;gBAEvB,aAAa,EAAE,aAAa;IAEhD,MAAM,IAAI,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;IA4K9B,OAAO,CAAC,gBAAgB;IAMxB,OAAO,CAAC,MAAM;IAKP,mBAAmB;IAI1B,IAAW,UAAU,YAEpB;IAED,OAAO,CAAC,oBAAoB;IAM5B,OAAO,CAAC,IAAI;IA4BZ,OAAO,CAAC,eAAe;CAW1B"}
@@ -1,5 +1,4 @@
1
- import{__decorate as t,__metadata as i}from"tslib";import{ActionInput as s,AxisInput as e,RotationInput as o}from"../../../../../gameplay/input/index.js";import{PhysicsSystem as n,RayTestResult as r}from"../../../../../gameplay/services/physics/physics-system.js";import{toDegrees as a}from"../../../../../utils/math.js";import{Vector3 as h,MathUtils as l}from"three";import{ActorComponent as c,Component as p}from"../../../component.js";import{CharacterMovementMode as y}from"./modes.js";import{CapsuleCollisionShape as m}from"../../../../../scene/collision/collision-shape.js";import{takeUntil as d}from"rxjs";import{PhysicsBodyType as u}from"../../../../services/physics/physics-system.js";let g=class extends c{constructor(t){super(),this.physicsSystem=t,this.directionInput=new e,this.jumpInput=new s,this.sprintInput=new s,this.rotationInput=new o,this.horizontalSpeed=0,this.maxSpeed=8,this.maxSpeedBackwards=8,this.maxSpeedSprint=10,this.maxWalkingSlopeAngle=70,this.jumpVelocity=7,this.fallingMovementControl=.5,this.fallingReorientation=!1,this.gravityOverride=null,this.colliderHeight=2.5,this.colliderRadius=.5,this.velocity=new h,this.mode=y.walking,this.isSprinting=!1,this.pressedJump=!1,this.rayTestResult=new r}onInit(){this.physicsSystem.addActor(this.actor,[this.createCollisionShape()],{mass:0,type:u.kinematic}),this.rotationInput.rotation.copy(this.actor.rotation);let t=this.rotationInput.rotation.y;const i=new h,s=new h,e=new h,o=new h,n=new h;let c=0;this.physicsSystem.afterStep.pipe(d(this.disposed)).subscribe((r=>{this.pressedJump=this.jumpInput.activated,this.isSprinting=this.sprintInput.activated;let a=t-this.rotationInput.rotation.y;t=this.rotationInput.rotation.y,e.copy(this.actor.position),o.set(-this.directionInput.vector.x,0,this.directionInput.vector.y).normalize();const p=o.z<0?this.maxSpeedBackwards:this.isSprinting?this.maxSpeedSprint:this.maxSpeed,m=o.clone().applyAxisAngle(new h(0,1,0),this.rotationInput.rotation.y);this.mode===y.walking&&(0!==m.length()?(c=Math.min(p,c),c=l.lerp(c,p,4*r)):c=0,n.copy(m).multiplyScalar(c),this.pressedJump&&(this.mode=y.falling,this.velocity.copy(n),this.velocity.y=this.jumpVelocity)),this.mode===y.falling&&(this.velocity.y+=r*this.getEffectiveGravity(),n.copy(this.velocity),n.add(m.clone().multiplyScalar(p*this.fallingMovementControl*r)),this.fallingReorientation&&n.applyAxisAngle(new h(0,1,0),-a)),s.copy(n).normalize(),i.copy(n),this.actor.rotation.y-=a;const d=this.actor.position.add(n.multiplyScalar(r));this.moveTo(d),f(),this.isGrounded?this.velocity.y<=0&&(this.mode=y.walking,this.velocity.y=0):(this.mode=y.falling,this.velocity.copy(i)),this.mode===y.walking&&v(r),x(r),this.horizontalSpeed=c}));const p=new h(0,1,0),m=new h(0,-.1,0),g=new h,S=new h,f=()=>{const t=this.colliderHeight+2*this.colliderRadius;this.physicsSystem.rayTest(g.addVectors(this.actor.position,p.set(0,t/4,0)),S.addVectors(this.actor.position,m),this.rayTestResult,{excludeActor:this.actor})},v=t=>{if(this.isGrounded){const s=Math.acos(this.rayTestResult.hitNormal.y),o=this.rayTestResult.hitPoint.y;if(a(s)<this.maxWalkingSlopeAngle){this.actor.position.y=o;const s=this.actor.position.sub(e).normalize().multiplyScalar(i.length()*t);this.moveTo(e.clone().add(s))}}},w=new r,x=t=>{const i=this.physicsSystem.getActorContacts(this.actor,s).filter((t=>a(Math.acos(-t.ni.y))>this.maxWalkingSlopeAngle));if(i.length>0){if(i[0].ni.clone().dot(s)<=0)return;this.moveTo(e);const o=i[0].rj.clone(),n=this.getWallDirection(i[0].ni,s);if(!this.physicsSystem.rayTest(o,n.clone().multiplyScalar(this.colliderRadius).add(o),w,{debugColor:0}).hasHit){const i=s.dot(n),e=n.multiplyScalar(this.horizontalSpeed*i);e.y+=this.velocity.y,e.multiplyScalar(t);const o=this.actor.position.clone().add(e);this.moveTo(o)}}}}getWallDirection(t,i){const s=t.clone().negate().cross(new h(0,1,0));return s.dot(i)<0?s.negate():s}moveTo(t){this.actor.position.copy(t),this.physicsSystem.updateActorTransform(this.actor)}getEffectiveGravity(){return this.gravityOverride??this.physicsSystem.getGravity().y}get isGrounded(){return this.rayTestResult.hasHit}createCollisionShape(){const t=new m(this.colliderHeight,this.colliderRadius);return t.offset.y=this.colliderRadius+this.colliderHeight/2,t}step(t){}performMovement(t){}};g=t([p(),i("design:paramtypes",[n])],g);export{g as CharacterMovementComponent};
2
- /*
1
+ import{__decorate as t,__metadata as i}from"tslib";import{ActionInput as s,AxisInput as e,RotationInput as o}from"../../../../../gameplay/input/index.js";import{PhysicsSystem as n,RayTestResult as r}from"../../../../../gameplay/services/physics/physics-system.js";import{toDegrees as a}from"../../../../../utils/math.js";import{Vector3 as h,MathUtils as l}from"three";import{ActorComponent as c,Component as p}from"../../../component.js";import{CharacterMovementMode as y}from"./modes.js";import{CapsuleCollisionShape as m}from"../../../../../scene/collision/collision-shape.js";import{takeUntil as d}from"rxjs";import{PhysicsBodyType as u}from"../../../../services/physics/physics-system.js";let g=class extends c{constructor(t){super(),this.physicsSystem=t,this.directionInput=new e,this.jumpInput=new s,this.sprintInput=new s,this.rotationInput=new o,this.horizontalSpeed=0,this.maxSpeed=8,this.maxSpeedBackwards=8,this.maxSpeedSprint=10,this.maxWalkingSlopeAngle=70,this.jumpVelocity=7,this.fallingMovementControl=.5,this.fallingReorientation=!1,this.gravityOverride=null,this.colliderHeight=2.5,this.colliderRadius=.5,this.velocity=new h,this.mode=y.walking,this.isSprinting=!1,this.pressedJump=!1,this.rayTestResult=new r}onInit(){this.physicsSystem.addActor(this.actor,[this.createCollisionShape()],{mass:0,type:u.kinematic}),this.rotationInput.rotation.copy(this.actor.rotation);let t=this.rotationInput.rotation.y;const i=new h,s=new h,e=new h,o=new h,n=new h;let c=0;this.physicsSystem.afterStep.pipe(d(this.disposed)).subscribe((r=>{this.pressedJump=this.jumpInput.activated,this.isSprinting=this.sprintInput.activated;let a=t-this.rotationInput.rotation.y;t=this.rotationInput.rotation.y,e.copy(this.actor.position),o.set(-this.directionInput.vector.x,0,this.directionInput.vector.y).normalize();const p=o.z<0?this.maxSpeedBackwards:this.isSprinting?this.maxSpeedSprint:this.maxSpeed,m=o.clone().applyAxisAngle(new h(0,1,0),this.rotationInput.rotation.y);this.mode===y.walking&&(0!==m.length()?(c=Math.min(p,c),c=l.lerp(c,p,4*r)):c=0,n.copy(m).multiplyScalar(c),this.pressedJump&&(this.mode=y.falling,this.velocity.copy(n),this.velocity.y=this.jumpVelocity)),this.mode===y.falling&&(this.velocity.y+=r*this.getEffectiveGravity(),n.copy(this.velocity),n.add(m.clone().multiplyScalar(p*this.fallingMovementControl*r)),this.fallingReorientation&&n.applyAxisAngle(new h(0,1,0),-a)),s.copy(n).normalize(),i.copy(n),this.actor.rotation.y-=a;const d=this.actor.position.add(n.multiplyScalar(r));this.moveTo(d),f(),this.isGrounded?this.velocity.y<=0&&(this.mode=y.walking,this.velocity.y=0):(this.mode=y.falling,this.velocity.copy(i)),this.mode===y.walking&&v(r),x(r),this.horizontalSpeed=c}));const p=new h(0,1,0),m=new h(0,-.1,0),g=new h,S=new h,f=()=>{const t=this.colliderHeight+2*this.colliderRadius;this.physicsSystem.rayTest(g.addVectors(this.actor.position,p.set(0,t/4,0)),S.addVectors(this.actor.position,m),this.rayTestResult,{excludeActor:this.actor})},v=t=>{if(this.isGrounded){const s=Math.acos(this.rayTestResult.hitNormal.y),o=this.rayTestResult.hitPoint.y;if(a(s)<this.maxWalkingSlopeAngle){this.actor.position.y=o;const s=this.actor.position.sub(e).normalize().multiplyScalar(i.length()*t);this.moveTo(e.clone().add(s))}}},w=new r,x=t=>{const i=this.physicsSystem.getActorContacts(this.actor,s).filter((t=>a(Math.acos(-t.ni.y))>this.maxWalkingSlopeAngle));if(i.length>0){if(i[0].ni.clone().dot(s)<=0)return;this.moveTo(e);const o=i[0].rj.clone(),n=this.getWallDirection(i[0].ni,s);if(!this.physicsSystem.rayTest(o,n.clone().multiplyScalar(this.colliderRadius).add(o),w,{debugColor:0}).hasHit){const i=s.dot(n),e=n.multiplyScalar(this.horizontalSpeed*i);e.y+=this.velocity.y,e.multiplyScalar(t);const o=this.actor.position.clone().add(e);this.moveTo(o)}}}}getWallDirection(t,i){const s=t.clone().negate().cross(new h(0,1,0));return s.dot(i)<0?s.negate():s}moveTo(t){this.actor.position.copy(t),this.physicsSystem.updateActorTransform(this.actor)}getEffectiveGravity(){return this.gravityOverride??this.physicsSystem.getGravity().y}get isGrounded(){return this.rayTestResult.hasHit}createCollisionShape(){const t=new m(this.colliderHeight,this.colliderRadius);return t.offset.y=this.colliderRadius+this.colliderHeight/2,t}step(t){}performMovement(t){}};g=t([p(),i("design:paramtypes",[n])],g);export{g as CharacterMovementComponent};/*
3
2
  * Copyright (©) 2023. All rights reserved.
4
3
  * See the LICENSE.md file for details.
5
4
  */
@@ -75,3 +75,4 @@ export declare class CharacterMovementComponent extends ActorComponent {
75
75
  private performMovement;
76
76
  private arrowHelper;
77
77
  }
78
+ //# sourceMappingURL=character-movement.d.ts.map