@hellpig/anarchy-engine 22.0.4 → 22.0.7

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 (406) hide show
  1. package/dist/Abstract/Entities/AbstractEntity.js.map +1 -1
  2. package/dist/Abstract/Factories/AbstractFactory.js.map +1 -1
  3. package/dist/Abstract/Factories/ReactiveFactory.js.map +1 -1
  4. package/dist/Abstract/Loaders/AbstractLoader.js.map +1 -1
  5. package/dist/Abstract/Mixins/WithWrapperIdMixin.d.ts +1 -1
  6. package/dist/Abstract/Mixins/WithWrapperIdMixin.js.map +1 -1
  7. package/dist/Abstract/Models/TAbstractOnLoadFunction.d.ts +1 -1
  8. package/dist/Abstract/Models/TEntityParams.d.ts +1 -1
  9. package/dist/Abstract/Models/THtmlElementStyleDeclaration.d.ts +4 -4
  10. package/dist/Abstract/Registries/AbstractEntityAsyncRegistry.js.map +1 -1
  11. package/dist/Abstract/Registries/AbstractEntityRegistry.js.map +1 -1
  12. package/dist/Abstract/Registries/AbstractResourceAsyncRegistry.js.map +1 -1
  13. package/dist/Abstract/Registries/AbstractSimpleRegistry.js.map +1 -1
  14. package/dist/Abstract/Registries/AbstractWatcherRegistry.js.map +1 -1
  15. package/dist/Abstract/Registries/Mixin/Registry/WithBaseAccessorsRegistry.js.map +1 -1
  16. package/dist/Abstract/Registries/Mixin/Registry/WithReactiveRegistry.js.map +1 -1
  17. package/dist/Abstract/Services/AbstractService.js.map +1 -1
  18. package/dist/Abstract/Watchers/AbstractWatcher.js.map +1 -1
  19. package/dist/Abstract/Watchers/AbstractWatcherWithState.js.map +1 -1
  20. package/dist/Abstract/Wrappers/AbstractWrapper.js.map +1 -1
  21. package/dist/Actor/Adapters/ConfigToParams.js.map +1 -1
  22. package/dist/Actor/Adapters/EntityToConfig.js.map +1 -1
  23. package/dist/Actor/Adapters/Helpers/ActorStatesConfigToParams.js.map +1 -1
  24. package/dist/Actor/Adapters/Helpers/Model3dSettingsConfigToParams.js.map +1 -1
  25. package/dist/Actor/Entities/Actor/Actor.js.map +1 -1
  26. package/dist/Actor/Factories/ActorFactory.js.map +1 -1
  27. package/dist/Actor/Mixins/WithActorStates.js.map +1 -1
  28. package/dist/Actor/Models/TActorParams.d.ts +1 -1
  29. package/dist/Actor/Registries/ActorRegistry.js.map +1 -1
  30. package/dist/Actor/Registries/Model3dToActorConnectionRegistry.js.map +1 -1
  31. package/dist/Actor/Services/ActorService.js.map +1 -1
  32. package/dist/Actor/TransformDrive/ActorTransformDrive.js.map +1 -1
  33. package/dist/Actor/Utils/ActorUtils.js.map +1 -1
  34. package/dist/Animations/Adapters/EntityToConfig.js.map +1 -1
  35. package/dist/Animations/Loader/AnimationsLoader.js.map +1 -1
  36. package/dist/Animations/Registries/AnimationsMetaInfoRegistry.js.map +1 -1
  37. package/dist/Animations/Registries/AnimationsResourceAsyncRegistry.js.map +1 -1
  38. package/dist/Animations/Services/AnimationsService.js.map +1 -1
  39. package/dist/Animations/Utils/SerializationUtils.js.map +1 -1
  40. package/dist/Audio/Adapters/AudioConfigToParams.js.map +1 -1
  41. package/dist/Audio/Adapters/EntityToConfig.js.map +1 -1
  42. package/dist/Audio/Factories/AudioFactory.js.map +1 -1
  43. package/dist/Audio/Loader/AudioLoader.js.map +1 -1
  44. package/dist/Audio/Registries/AudioListenersRegistry.js.map +1 -1
  45. package/dist/Audio/Registries/AudioMetaInfoRegistry.js.map +1 -1
  46. package/dist/Audio/Registries/AudioRegistry.js.map +1 -1
  47. package/dist/Audio/Registries/AudioResourceAsyncRegistry.js.map +1 -1
  48. package/dist/Audio/Services/AudioService.js.map +1 -1
  49. package/dist/Audio/TransformDrive/Audio3dTransformDrive.js.map +1 -1
  50. package/dist/Audio/Utils/AudioUtils.js.map +1 -1
  51. package/dist/Audio/Utils/DebugAudioRenderer.js.map +1 -1
  52. package/dist/Audio/Wrappers/AbstractAudioWrapper.js.map +1 -1
  53. package/dist/Audio/Wrappers/Audio3dWrapper.js.map +1 -1
  54. package/dist/Audio/Wrappers/AudioWrapper.js.map +1 -1
  55. package/dist/Camera/Adapters/ConfigToParams.js.map +1 -1
  56. package/dist/Camera/Adapters/EntityToConfig.js.map +1 -1
  57. package/dist/Camera/Factories/CameraFactory.js.map +1 -1
  58. package/dist/Camera/Models/index.d.ts +1 -0
  59. package/dist/Camera/Registries/AbstractCameraRegistry.js.map +1 -1
  60. package/dist/Camera/Services/CameraService.js.map +1 -1
  61. package/dist/Camera/TransformDrive/CameraTransformDrive.js.map +1 -1
  62. package/dist/Camera/Utils/CameraUtils.d.ts +1 -1
  63. package/dist/Camera/Utils/CameraUtils.js.map +1 -1
  64. package/dist/Camera/Wrappers/Accessors.d.ts +1 -1
  65. package/dist/Camera/Wrappers/Accessors.js.map +1 -1
  66. package/dist/Camera/Wrappers/OrthographicCameraWrapper.js.map +1 -1
  67. package/dist/Camera/Wrappers/PerspectiveCameraWrapper.js.map +1 -1
  68. package/dist/Collisions/Mixins/WithCollisions.js.map +1 -1
  69. package/dist/Collisions/Models/TCollisionsDataConfig.d.ts +1 -1
  70. package/dist/Collisions/Models/TCollisionsDataParams.d.ts +1 -1
  71. package/dist/Collisions/Services/BvhService.js.map +1 -1
  72. package/dist/Collisions/Services/CollisionsService.js.map +1 -1
  73. package/dist/Color/Adapters/EntityToConfig.js.map +1 -1
  74. package/dist/Color/Wrappers/ColorWrapper.js.map +1 -1
  75. package/dist/Context/AmbientContext/AmbientContext.js.map +1 -1
  76. package/dist/Controls/Adapters/ConfigToParams.js.map +1 -1
  77. package/dist/Controls/Adapters/EntityToConfig.js.map +1 -1
  78. package/dist/Controls/Factories/ControlsFactory.js.map +1 -1
  79. package/dist/Controls/Loop/ControlsLoopEffect.js.map +1 -1
  80. package/dist/Controls/Registries/ControlsRegistry.js.map +1 -1
  81. package/dist/Controls/Services/ControlsService.js.map +1 -1
  82. package/dist/Controls/Utils/ControlsUtils.js.map +1 -1
  83. package/dist/Controls/Wrappers/FpsControls/FpsControlsAccessors.d.ts +1 -1
  84. package/dist/Controls/Wrappers/FpsControls/FpsControlsAccessors.js.map +1 -1
  85. package/dist/Controls/Wrappers/FpsControls/FpsControlsWrapper.js.map +1 -1
  86. package/dist/Controls/Wrappers/FpsControls/FpsControlsWrapperHelper.js.map +1 -1
  87. package/dist/Controls/Wrappers/OrbitControls/OrbitControlsAccessors.d.ts +1 -1
  88. package/dist/Controls/Wrappers/OrbitControls/OrbitControlsAccessors.js.map +1 -1
  89. package/dist/Controls/Wrappers/OrbitControls/OrbitControlsWrapper.js.map +1 -1
  90. package/dist/Controls/Wrappers/OrbitControls/OrbitControlsWrapperHelper.js.map +1 -1
  91. package/dist/Distance/Utils/DistanceUtils.js.map +1 -1
  92. package/dist/EnvMap/Adapters/ConfigToParams.js.map +1 -1
  93. package/dist/EnvMap/Adapters/EntityToConfig.js.map +1 -1
  94. package/dist/EnvMap/Factories/EnvMapFactory.js.map +1 -1
  95. package/dist/EnvMap/Loader/EnvMapLoader.js.map +1 -1
  96. package/dist/EnvMap/Registries/EnvMapMetaInfoRegistry.js.map +1 -1
  97. package/dist/EnvMap/Registries/EnvMapRegistry.js.map +1 -1
  98. package/dist/EnvMap/Registries/EnvMapTextureAsyncRegistry.js.map +1 -1
  99. package/dist/EnvMap/Services/EnvMapService.js.map +1 -1
  100. package/dist/EnvMap/Wrappers/EnvMapWrapper.js.map +1 -1
  101. package/dist/Fog/Adapters/ConfigToParams.js.map +1 -1
  102. package/dist/Fog/Adapters/EntityToConfig.js.map +1 -1
  103. package/dist/Fog/Factories/FogFactory.js.map +1 -1
  104. package/dist/Fog/Registries/FogRegistry.js.map +1 -1
  105. package/dist/Fog/Services/FogService.js.map +1 -1
  106. package/dist/Fog/Wrappers/FogWrapper.js.map +1 -1
  107. package/dist/Fsm/Adapters/ConfigToParams.js.map +1 -1
  108. package/dist/Fsm/Adapters/EntityToConfig.js.map +1 -1
  109. package/dist/Fsm/Entities/FsmSource.js.map +1 -1
  110. package/dist/Fsm/Factories/FsmInstanceFactory.js.map +1 -1
  111. package/dist/Fsm/Factories/FsmSourceFactory.js.map +1 -1
  112. package/dist/Fsm/Registries/FsmInstanceRegistry.js.map +1 -1
  113. package/dist/Fsm/Registries/FsmSourceRegistry.js.map +1 -1
  114. package/dist/Fsm/Services/FsmInstanceService.js.map +1 -1
  115. package/dist/Fsm/Services/FsmService.js.map +1 -1
  116. package/dist/Fsm/Services/FsmSourceService.js.map +1 -1
  117. package/dist/Fsm/Wrappers/FsmWrapper.js.map +1 -1
  118. package/dist/Global/Decorators/ContainerDecorator.js.map +1 -1
  119. package/dist/Global/Utils/ContainerUtils.js.map +1 -1
  120. package/dist/Intersections/Adapters/ConfigToParams.js.map +1 -1
  121. package/dist/Intersections/Adapters/EntityToConfig.js.map +1 -1
  122. package/dist/Intersections/Factories/IntersectionsWatcherFactory.js.map +1 -1
  123. package/dist/Intersections/Registries/IntersectionsWatcherRegistry.js.map +1 -1
  124. package/dist/Intersections/Services/IntersectionsWatcherService.js.map +1 -1
  125. package/dist/Intersections/Utils/IntersectionsWatcherUtils.js.map +1 -1
  126. package/dist/Intersections/Watchers/AbstractIntersectionsWatcher.js.map +1 -1
  127. package/dist/Intersections/Watchers/IntersectionsCameraWatcher.js.map +1 -1
  128. package/dist/Intersections/Watchers/IntersectionsDirectionWatcher.js.map +1 -1
  129. package/dist/Keyboard/Factories/KeyWatcherFactory.js.map +1 -1
  130. package/dist/Keyboard/Registries/KeyWatcherRegistry.js.map +1 -1
  131. package/dist/Keyboard/Services/KeyboardService.js.map +1 -1
  132. package/dist/Keyboard/Utils/KeysRxJsUtils.js.map +1 -1
  133. package/dist/Keyboard/Utils/KeysUtils.js.map +1 -1
  134. package/dist/Keyboard/Watchers/KeyComboWatcher.js.map +1 -1
  135. package/dist/Keyboard/Watchers/KeyPressWatcher.js.map +1 -1
  136. package/dist/Keyboard/Watchers/KeyReleaseWatcher.js.map +1 -1
  137. package/dist/Kinematic/Adapters/ConfigToParams.js.map +1 -1
  138. package/dist/Kinematic/Adapters/EntityToConfig.js.map +1 -1
  139. package/dist/Kinematic/Constants/KinematicConstants.js.map +1 -1
  140. package/dist/Kinematic/Models/TKinematicConfig.d.ts +1 -1
  141. package/dist/Kinematic/Models/TKinematicData.d.ts +1 -1
  142. package/dist/Kinematic/Models/TKinematicParams.d.ts +1 -1
  143. package/dist/Kinematic/Utils/KinematicUtils.js.map +1 -1
  144. package/dist/Light/Adapters/ConfigToParams.js.map +1 -1
  145. package/dist/Light/Adapters/EntityToConfig.js.map +1 -1
  146. package/dist/Light/Factories/LightFactory.js.map +1 -1
  147. package/dist/Light/Registries/LightRegistry.js.map +1 -1
  148. package/dist/Light/Services/LightService.js.map +1 -1
  149. package/dist/Light/TransformDrive/LightTransformDrive.js.map +1 -1
  150. package/dist/Light/Utils/Utils.js.map +1 -1
  151. package/dist/Light/Wrappers/AbstractLightWrapper.js.map +1 -1
  152. package/dist/Light/Wrappers/AmbientLightWrapper.js.map +1 -1
  153. package/dist/Light/Wrappers/DirectionalLightWrapper.js.map +1 -1
  154. package/dist/Light/Wrappers/HemisphereLightWrapper.js.map +1 -1
  155. package/dist/Light/Wrappers/LightWrapperHelper.d.ts +1 -1
  156. package/dist/Light/Wrappers/LightWrapperHelper.js.map +1 -1
  157. package/dist/Light/Wrappers/PointLightWrapper.js.map +1 -1
  158. package/dist/Light/Wrappers/RectAreaLightWrapper.js.map +1 -1
  159. package/dist/Light/Wrappers/SpotLightWrapper.js.map +1 -1
  160. package/dist/LoadingManager/Factories/LoadingManagerFactory.js.map +1 -1
  161. package/dist/LoadingManager/Registries/LoadingManagerRegistry.js.map +1 -1
  162. package/dist/LoadingManager/Services/LoadingManagerService.js.map +1 -1
  163. package/dist/LoadingManager/Wrappers/LoadingManagerWrapper.js.map +1 -1
  164. package/dist/Loop/Constants/LoopsDefaultSettings.js.map +1 -1
  165. package/dist/Loop/Entities/DeltaCalculator.js.map +1 -1
  166. package/dist/Loop/Entities/Loop.js.map +1 -1
  167. package/dist/Loop/Factories/LoopFactory.js.map +1 -1
  168. package/dist/Loop/Registries/LoopRegistry.js.map +1 -1
  169. package/dist/Loop/Services/LoopService.js.map +1 -1
  170. package/dist/Loop/Utils/LoopDebugUtils.js.map +1 -1
  171. package/dist/Loop/Utils/LoopUtils.js.map +1 -1
  172. package/dist/Material/Adapters/ConfigToParams.js.map +1 -1
  173. package/dist/Material/Adapters/EntityToConfig.js.map +1 -1
  174. package/dist/Material/Constants/Material/MaterialMap.js.map +1 -1
  175. package/dist/Material/Factories/MaterialFactory.js.map +1 -1
  176. package/dist/Material/Mixins/WithMaterial.d.ts +1 -1
  177. package/dist/Material/Mixins/WithMaterial.js.map +1 -1
  178. package/dist/Material/Registries/MaterialRegistry.js.map +1 -1
  179. package/dist/Material/Services/MaterialService.js.map +1 -1
  180. package/dist/Material/Utils/MaterialUtils.js.map +1 -1
  181. package/dist/Material/Wrappers/MaterialWrapper.js.map +1 -1
  182. package/dist/Math/Utils/AnglesUtils.js.map +1 -1
  183. package/dist/Math/Utils/DistanceUtils.js.map +1 -1
  184. package/dist/Measurements/Constants/Distance.js.map +1 -1
  185. package/dist/Measurements/Constants/Time.js.map +1 -1
  186. package/dist/Measurements/Utils/MeasurementsUtils.d.ts +1 -1
  187. package/dist/Measurements/Utils/MeasurementsUtils.js.map +1 -1
  188. package/dist/Mixins/GameObjects/Mixins/Movable/WithMoveBy2dMixin.js.map +1 -1
  189. package/dist/Mixins/GameObjects/Mixins/Movable/WithMoveBy3dMixin.js.map +1 -1
  190. package/dist/Mixins/GameObjects/Mixins/Movable/WithMoveBy4dMixin.js.map +1 -1
  191. package/dist/Mixins/GameObjects/Mixins/Movable/WithMoveByWMixin.js.map +1 -1
  192. package/dist/Mixins/GameObjects/Mixins/Movable/WithMoveByXMixin.js.map +1 -1
  193. package/dist/Mixins/GameObjects/Mixins/Movable/WithMoveByYMixin.js.map +1 -1
  194. package/dist/Mixins/GameObjects/Mixins/Movable/WithMoveByZMixin.js.map +1 -1
  195. package/dist/Mixins/GameObjects/Mixins/Position/WithPosition2dMixin.js.map +1 -1
  196. package/dist/Mixins/GameObjects/Mixins/Position/WithPosition3dMixin.js.map +1 -1
  197. package/dist/Mixins/GameObjects/Mixins/Position/WithPosition4dMixin.js.map +1 -1
  198. package/dist/Mixins/GameObjects/Mixins/Position/WithPositionMixin.js.map +1 -1
  199. package/dist/Mixins/GameObjects/Mixins/Rotatable/WithRotationByWMixin.js.map +1 -1
  200. package/dist/Mixins/GameObjects/Mixins/Rotatable/WithRotationByXMixin.js.map +1 -1
  201. package/dist/Mixins/GameObjects/Mixins/Rotatable/WithRotationByXyzMixin.js.map +1 -1
  202. package/dist/Mixins/GameObjects/Mixins/Rotatable/WithRotationByYMixin.js.map +1 -1
  203. package/dist/Mixins/GameObjects/Mixins/Rotatable/WithRotationByZMixin.js.map +1 -1
  204. package/dist/Mixins/GameObjects/Mixins/Rotatable/WithRotationMixin.js.map +1 -1
  205. package/dist/Mixins/GameObjects/Mixins/Scalable/WithScaleMixin.js.map +1 -1
  206. package/dist/Mixins/GameObjects/Mixins/WithObject3D.js.map +1 -1
  207. package/dist/Mixins/Generics/DestroyableMixin.js.map +1 -1
  208. package/dist/Mixins/Generics/ExtractSerializableRegistrableFields.js.map +1 -1
  209. package/dist/Mixins/Generics/Models/TWithName.d.ts +1 -1
  210. package/dist/Mixins/Generics/WithActiveEntityServiceMixin.js.map +1 -1
  211. package/dist/Mixins/Generics/WithActiveMixin.js.map +1 -1
  212. package/dist/Mixins/Generics/WithNameAndNameAccessorsMixin.d.ts +1 -1
  213. package/dist/Mixins/Generics/WithNameAndNameAccessorsMixin.js.map +1 -1
  214. package/dist/Mixins/Services/WithCreateFromConfigService.js.map +1 -1
  215. package/dist/Mixins/Services/WithCreateService.js.map +1 -1
  216. package/dist/Mixins/Services/WithFactoryService.js.map +1 -1
  217. package/dist/Mixins/Services/WithRegistryService.js.map +1 -1
  218. package/dist/Mixins/Services/WithSceneGetterService.js.map +1 -1
  219. package/dist/Mixins/Services/WithSerializableEntities.js.map +1 -1
  220. package/dist/Mixins/Services/WithSerializeAllResources.js.map +1 -1
  221. package/dist/Models3d/Adapters/ConfigToParams.js.map +1 -1
  222. package/dist/Models3d/Adapters/EntityToConfig.js.map +1 -1
  223. package/dist/Models3d/Entities/Model3d.js.map +1 -1
  224. package/dist/Models3d/Factories/Models3dFactory.js.map +1 -1
  225. package/dist/Models3d/Loaders/Loader3dCore.js.map +1 -1
  226. package/dist/Models3d/Loaders/Models3dLoader.js.map +1 -1
  227. package/dist/Models3d/Mixins/WithModel3dEntities.js.map +1 -1
  228. package/dist/Models3d/Models/TModel3dConfig.d.ts +1 -1
  229. package/dist/Models3d/Models/TModel3dOptions.d.ts +1 -1
  230. package/dist/Models3d/Models/TModel3dResourceConfig.d.ts +1 -1
  231. package/dist/Models3d/Models/TModels3dService.d.ts +1 -1
  232. package/dist/Models3d/Models/index.d.ts +1 -0
  233. package/dist/Models3d/Registries/Model3dRawToModel3dConnectionRegistry.js.map +1 -1
  234. package/dist/Models3d/Registries/Models3dMetaInfoRegistry.js.map +1 -1
  235. package/dist/Models3d/Registries/Models3dRegistry.js.map +1 -1
  236. package/dist/Models3d/Registries/Models3dResourceAsyncRegistry.js.map +1 -1
  237. package/dist/Models3d/Services/Models3dService.js.map +1 -1
  238. package/dist/Models3d/Utils/SerializationUtils.js.map +1 -1
  239. package/dist/Models3d/Utils/UtilsModel3d.js.map +1 -1
  240. package/dist/Models3d/Utils/UtilsModels3dService.js.map +1 -1
  241. package/dist/Models3d/Utils/UtilsPrimitiveModels3d.js.map +1 -1
  242. package/dist/Mouse/Factories/MouseClickWatcherFactory.js.map +1 -1
  243. package/dist/Mouse/Factories/MousePositionWatcherFactory.js.map +1 -1
  244. package/dist/Mouse/Registries/MouseClickWatcherRegistry.js.map +1 -1
  245. package/dist/Mouse/Registries/MousePositionWatcherRegistry.js.map +1 -1
  246. package/dist/Mouse/Services/MouseService.js.map +1 -1
  247. package/dist/Mouse/Utils/MouseUtils.js.map +1 -1
  248. package/dist/Mouse/Watchers/MouseClickWatcher.js.map +1 -1
  249. package/dist/Mouse/Watchers/MousePositionWatcher.js.map +1 -1
  250. package/dist/Particles/Adapters/ConfigToParams.js.map +1 -1
  251. package/dist/Particles/Adapters/EntityToConfig.js.map +1 -1
  252. package/dist/Particles/Factories/ParticlesFactory.js.map +1 -1
  253. package/dist/Particles/Registries/ParticlesRegistry.js.map +1 -1
  254. package/dist/Particles/Services/ParticlesService.js.map +1 -1
  255. package/dist/Particles/TransformDrive/ParticlesTransformDrive.js.map +1 -1
  256. package/dist/Particles/Wrappers/ParticlesWrapper.js.map +1 -1
  257. package/dist/Physics/Adapters/EntityToConfig.d.ts +1 -1
  258. package/dist/Physics/Adapters/EntityToConfig.js.map +1 -1
  259. package/dist/Physics/Adapters/PhysicsBodyConfigToParams.js.map +1 -1
  260. package/dist/Physics/Adapters/PhysicsWorldConfigToParams.js.map +1 -1
  261. package/dist/Physics/Constants/RigidBodyTypesMap.d.ts +1 -1
  262. package/dist/Physics/Constants/RigidBodyTypesMap.js +1 -1
  263. package/dist/Physics/Constants/RigidBodyTypesMap.js.map +1 -1
  264. package/dist/Physics/Entities/PhysicsBody.js.map +1 -1
  265. package/dist/Physics/Entities/PhysicsBodyUtils.d.ts +2 -2
  266. package/dist/Physics/Entities/PhysicsBodyUtils.js.map +1 -1
  267. package/dist/Physics/Factories/PhysicsBodyFactory.js.map +1 -1
  268. package/dist/Physics/Mixins/WithPhysicsBodyEntities.js.map +1 -1
  269. package/dist/Physics/Models/TPhysicsWorldService.d.ts +1 -1
  270. package/dist/Physics/Registries/PhysicsBodyRegistry.js.map +1 -1
  271. package/dist/Physics/Renderers/PhysicsDebugRenderer.d.ts +1 -1
  272. package/dist/Physics/Renderers/PhysicsDebugRenderer.js.map +1 -1
  273. package/dist/Physics/Services/PhysicsBodyService.js.map +1 -1
  274. package/dist/Physics/Services/PhysicsWorldService.js.map +1 -1
  275. package/dist/Physics/Utils/ParamsUtils.d.ts +1 -1
  276. package/dist/Physics/Utils/ParamsUtils.js.map +1 -1
  277. package/dist/Physics/Utils/PhysicsMovementUtils.d.ts +2 -2
  278. package/dist/Physics/Utils/PhysicsMovementUtils.js.map +1 -1
  279. package/dist/Renderer/Adapters/ConfigToParams.js.map +1 -1
  280. package/dist/Renderer/Adapters/EntityToConfig.js.map +1 -1
  281. package/dist/Renderer/Factories/RendererFactory.js.map +1 -1
  282. package/dist/Renderer/Loop/RendererLoopEffect.js.map +1 -1
  283. package/dist/Renderer/Mixins/WithThreeJsRendererParamsAccessors.js.map +1 -1
  284. package/dist/Renderer/Mixins/WithThreeJsRendererPropsAccessors.js.map +1 -1
  285. package/dist/Renderer/Registries/RendererRegistry.js.map +1 -1
  286. package/dist/Renderer/Services/RendererService.js.map +1 -1
  287. package/dist/Renderer/Wrappers/Accessors.js.map +1 -1
  288. package/dist/Renderer/Wrappers/RendererWrapper.js.map +1 -1
  289. package/dist/Scene/Adapters/ConfigToParams.js.map +1 -1
  290. package/dist/Scene/Adapters/EntityToConfig.js.map +1 -1
  291. package/dist/Scene/Factories/SceneFactory.js.map +1 -1
  292. package/dist/Scene/Registries/SceneRegistry.js.map +1 -1
  293. package/dist/Scene/Services/ScenesService.js.map +1 -1
  294. package/dist/Scene/Wrappers/SceneWrapper.js.map +1 -1
  295. package/dist/Space/Adapters/ConfigToParams.js.map +1 -1
  296. package/dist/Space/Adapters/EntityToConfig.js.map +1 -1
  297. package/dist/Space/Entities/Space.js.map +1 -1
  298. package/dist/Space/Entities/SpaceFromConfig.js.map +1 -1
  299. package/dist/Space/Factories/SpaceFactory.js.map +1 -1
  300. package/dist/Space/Models/TSpaceSettings.d.ts +1 -1
  301. package/dist/Space/Registries/SpaceRegistry.js.map +1 -1
  302. package/dist/Space/Services/SpaceService.js.map +1 -1
  303. package/dist/Space/Utils/CanvasUtils.js.map +1 -1
  304. package/dist/Space/Utils/CreateEntitiesUtils.js.map +1 -1
  305. package/dist/Space/Utils/CreateLoopsUtils.js.map +1 -1
  306. package/dist/Space/Utils/LoadResourcesUtils.js.map +1 -1
  307. package/dist/Space/Utils/PrepareServicesUtils.js.map +1 -1
  308. package/dist/Space/Utils/SchemaValidationUtils.js.map +1 -1
  309. package/dist/Space/Validators/SchemasValidator.js.map +1 -1
  310. package/dist/Space/Validators/ValidateConfig.js.map +1 -1
  311. package/dist/Space/Validators/ValidateSpace.js.map +1 -1
  312. package/dist/Spatial/Adapters/ConfigToParams.js.map +1 -1
  313. package/dist/Spatial/Adapters/ConfigToParamsSpatialData.js.map +1 -1
  314. package/dist/Spatial/Adapters/EntityToConfig.js.map +1 -1
  315. package/dist/Spatial/Factories/SpatialGridFactory.js.map +1 -1
  316. package/dist/Spatial/Mixins/WithReactivePosition.js.map +1 -1
  317. package/dist/Spatial/Mixins/WithReactiveRotation.js.map +1 -1
  318. package/dist/Spatial/Mixins/WithSpatial.js.map +1 -1
  319. package/dist/Spatial/Mixins/WithUpdateSpatialCell.js.map +1 -1
  320. package/dist/Spatial/Models/TSpatialDataConfig.d.ts +1 -1
  321. package/dist/Spatial/Models/TSpatialDataParams.d.ts +1 -1
  322. package/dist/Spatial/Registries/SpatialGridRegistry.js.map +1 -1
  323. package/dist/Spatial/Services/SpatialGridService.js.map +1 -1
  324. package/dist/Spatial/Services/SpatialHelper.js.map +1 -1
  325. package/dist/Spatial/Wrappers/SpatialCellWrapper.js.map +1 -1
  326. package/dist/Spatial/Wrappers/SpatialGridWrapper.js.map +1 -1
  327. package/dist/Text/Adapters/ConfigToParams.js.map +1 -1
  328. package/dist/Text/Adapters/EntityToConfig.js.map +1 -1
  329. package/dist/Text/Factories/TextFactory.js.map +1 -1
  330. package/dist/Text/Loop/TextLoopEffect.js.map +1 -1
  331. package/dist/Text/Models/index.d.ts +1 -0
  332. package/dist/Text/Registries/Text2dRegistry.js.map +1 -1
  333. package/dist/Text/Registries/Text2dRendererRegistry.js.map +1 -1
  334. package/dist/Text/Registries/Text3dRegistry.js.map +1 -1
  335. package/dist/Text/Registries/Text3dRendererRegistry.js.map +1 -1
  336. package/dist/Text/Registries/Text3dTextureRegistry.js.map +1 -1
  337. package/dist/Text/Renderers/Text2dRenderer.js.map +1 -1
  338. package/dist/Text/Renderers/Text3dRenderer.js.map +1 -1
  339. package/dist/Text/Renderers/TextRendererBuilder.js.map +1 -1
  340. package/dist/Text/Services/TextService.js.map +1 -1
  341. package/dist/Text/TransformDrive/TextTransformDrive.js.map +1 -1
  342. package/dist/Text/Utils/TextUtils.js.map +1 -1
  343. package/dist/Text/Wrappers/Accessors.d.ts +1 -1
  344. package/dist/Text/Wrappers/Accessors.js.map +1 -1
  345. package/dist/Text/Wrappers/Text2dWrapper.js.map +1 -1
  346. package/dist/Text/Wrappers/Text3dTextureWrapper.js.map +1 -1
  347. package/dist/Text/Wrappers/Text3dWrapper.js.map +1 -1
  348. package/dist/Text/Wrappers/TextTextureWrapper.js.map +1 -1
  349. package/dist/Text/Wrappers/TextWrapper.js.map +1 -1
  350. package/dist/Text/Wrappers/TextWrapperBuilder.js.map +1 -1
  351. package/dist/Text/Wrappers/TextWrapperHelper.js.map +1 -1
  352. package/dist/Texture/Loaders/TexturesLoader.js.map +1 -1
  353. package/dist/Texture/Registries/TextureMetaInfoRegistry.js.map +1 -1
  354. package/dist/Texture/Registries/TextureResourceAsyncRegistry.js.map +1 -1
  355. package/dist/Texture/Services/TextureService.js.map +1 -1
  356. package/dist/Texture/Utils/TextureServiceHelper.d.ts +1 -1
  357. package/dist/Texture/Utils/TextureServiceHelper.js.map +1 -1
  358. package/dist/ThreeLib/Utils/Object3dUtils.js.map +1 -1
  359. package/dist/TransformDrive/Adapters/EntityToConfig.js.map +1 -1
  360. package/dist/TransformDrive/Entities/Agents/AbstractTransformAgent.js.map +1 -1
  361. package/dist/TransformDrive/Entities/Agents/ConnectedTransformAgent.js.map +1 -1
  362. package/dist/TransformDrive/Entities/Agents/DefaultTransformAgent.js.map +1 -1
  363. package/dist/TransformDrive/Entities/Agents/KinematicTransformAgent.js.map +1 -1
  364. package/dist/TransformDrive/Entities/Agents/PhysicsTransformAgent.js.map +1 -1
  365. package/dist/TransformDrive/Entities/Connectors/DriveToTargetConnector.js.map +1 -1
  366. package/dist/TransformDrive/Entities/Drive/TransformDrive.js.map +1 -1
  367. package/dist/TransformDrive/Factories/TransformDriveFactory.js.map +1 -1
  368. package/dist/TransformDrive/Mixins/WithMutablePositionConnector.js.map +1 -1
  369. package/dist/TransformDrive/Mixins/WithMutableRotationConnector.js.map +1 -1
  370. package/dist/TransformDrive/Mixins/WithMutableScaleConnector.js.map +1 -1
  371. package/dist/TransformDrive/Mixins/WithProxyTransform.js.map +1 -1
  372. package/dist/TransformDrive/Models/TGetTransformAgentsParams.d.ts +1 -1
  373. package/dist/TransformDrive/Models/TPhysicsTransformAgentParams.d.ts +1 -1
  374. package/dist/TransformDrive/Models/TTransformDriveService.d.ts +1 -1
  375. package/dist/TransformDrive/Models/TWithMutablePositionConnector.d.ts +1 -1
  376. package/dist/TransformDrive/Models/TWithMutableRotationConnector.d.ts +1 -1
  377. package/dist/TransformDrive/Models/TWithMutableScaleConnector.d.ts +1 -1
  378. package/dist/TransformDrive/Registries/TransformDriveRegistry.js.map +1 -1
  379. package/dist/TransformDrive/Services/TransformDriveService.js.map +1 -1
  380. package/dist/TransformDrive/Utils/ActorDriveUtils.d.ts +1 -1
  381. package/dist/TransformDrive/Utils/ActorDriveUtils.js.map +1 -1
  382. package/dist/TransformDrive/Utils/AgentUtils.d.ts +1 -1
  383. package/dist/TransformDrive/Utils/AgentUtils.js.map +1 -1
  384. package/dist/TransformDrive/Utils/KinematicAgentUtils.d.ts +1 -1
  385. package/dist/TransformDrive/Utils/KinematicAgentUtils.js.map +1 -1
  386. package/dist/TransformDrive/Utils/PhysicsTransformAgentUtils.d.ts +1 -1
  387. package/dist/TransformDrive/Utils/PhysicsTransformAgentUtils.js.map +1 -1
  388. package/dist/TransformDrive/Utils/TransformDriveUtils.js.map +1 -1
  389. package/dist/Utils/CheckUtils.js.map +1 -1
  390. package/dist/Utils/CoordsUtils.js.map +1 -1
  391. package/dist/Utils/DestroyUtils.js.map +1 -1
  392. package/dist/Utils/DomUtils.js.map +1 -1
  393. package/dist/Utils/EntityUtils.js.map +1 -1
  394. package/dist/Utils/RegistryAsyncUtils.js.map +1 -1
  395. package/dist/Utils/RegistryUtils.js.map +1 -1
  396. package/dist/Utils/ScreenUtils.js.map +1 -1
  397. package/dist/Utils/TagsUtils.js.map +1 -1
  398. package/dist/Utils/TransformUtils.js.map +1 -1
  399. package/dist/Utils/WrapperHelpers.js.map +1 -1
  400. package/dist/assets/Loop.worker-D1bMWlsN.js.map +1 -1
  401. package/dist/packages/anarchy-shared/src/Utils/AsyncUtils.js.map +1 -1
  402. package/dist/packages/anarchy-shared/src/Utils/CssUtils.js.map +1 -1
  403. package/dist/packages/anarchy-shared/src/Utils/ObjectUtils.js.map +1 -1
  404. package/legal/NOTICE.md +1 -1
  405. package/legal/THIRD_PARTY_LICENSES.md +1 -1
  406. package/package.json +6 -4
@@ -1 +1 @@
1
- {"version":3,"file":"ConfigToParams.js","sources":["../../../src/Intersections/Adapters/ConfigToParams.ts"],"sourcesContent":["import type { TActor, TActorService } from '@hellpig/anarchy-engine/Actor';\nimport type { TAnyCameraWrapper, TCameraService } from '@hellpig/anarchy-engine/Camera';\nimport type {\n TAbstractIntersectionsWatcherParams,\n TAnyIntersectionsWatcherConfig,\n TAnyIntersectionsWatcherParams,\n TIntersectionsCameraWatcherConfig,\n TIntersectionsCameraWatcherParams,\n TIntersectionsDirectionWatcherConfig,\n TIntersectionsDirectionWatcherParams,\n TIntersectionsLoop\n} from '@hellpig/anarchy-engine/Intersections/Models';\nimport { isIntersectionsCameraWatcherConfig, isIntersectionsDirectionWatcherConfig } from '@hellpig/anarchy-engine/Intersections/Utils';\nimport type { TLoopService } from '@hellpig/anarchy-engine/Loop';\nimport type { TMouseService } from '@hellpig/anarchy-engine/Mouse';\nimport { isNotDefined } from '@hellpig/anarchy-shared/Utils';\nimport { Vector3 } from 'three';\n\nexport function intersectionsWatcherConfigToParams(\n config: TAnyIntersectionsWatcherConfig,\n mouseService: TMouseService,\n cameraService: TCameraService,\n actorsService: TActorService,\n loopService: TLoopService\n): TAnyIntersectionsWatcherParams | never {\n const params: TAbstractIntersectionsWatcherParams = configToParamsAbstractIntersectionsWatcher(config, actorsService, loopService);\n\n let result: TAnyIntersectionsWatcherParams;\n if (isIntersectionsDirectionWatcherConfig(config)) {\n result = { ...params, ...configToParamsIntersectionsDirectionWatcher(config) };\n } else if (isIntersectionsCameraWatcherConfig(config)) {\n result = { ...params, ...configToParamsIntersectionsCameraWatcher(config, mouseService, cameraService) };\n } else {\n throw new Error(`[Intersections] configToParams: Unknown intersections watcher config type for \"${(config as TAnyIntersectionsWatcherConfig).name}\".`);\n }\n\n return result;\n}\n\nfunction configToParamsAbstractIntersectionsWatcher(config: TAnyIntersectionsWatcherConfig, actorsService: TActorService, loopService: TLoopService): TAbstractIntersectionsWatcherParams {\n const actors: ReadonlyArray<TActor> = config.actorNames.map((name: string): TActor => actorsService.getRegistry().getByName(name));\n\n const intersectionsLoop: TIntersectionsLoop | undefined = loopService.getIntersectionsLoop(config.intersectionsLoop);\n if (isNotDefined(intersectionsLoop)) throw new Error(`configToParams: Cannot find loop \"${config.intersectionsLoop}\" for intersections watcher \"${config.name}\".`);\n\n return {\n ...config,\n actors,\n intersectionsLoop\n };\n}\n\nfunction configToParamsIntersectionsCameraWatcher(\n config: TIntersectionsCameraWatcherConfig,\n mouseService: TMouseService,\n cameraService: TCameraService\n): Omit<TIntersectionsCameraWatcherParams, keyof TAbstractIntersectionsWatcherParams> {\n const camera: TAnyCameraWrapper = cameraService.getRegistry().getByName(config.cameraName);\n\n return {\n camera,\n position$: mouseService.normalizedPosition$\n };\n}\n\nfunction configToParamsIntersectionsDirectionWatcher(config: TIntersectionsDirectionWatcherConfig): Omit<TIntersectionsDirectionWatcherParams, keyof TAbstractIntersectionsWatcherParams> {\n return {\n origin: new Vector3().copy(config.origin),\n direction: new Vector3().copy(config.direction)\n };\n}\n"],"names":["intersectionsWatcherConfigToParams","config","mouseService","cameraService","actorsService","loopService","params","actors","actorNames","map","name","getRegistry","getByName","intersectionsLoop","getIntersectionsLoop","isNotDefined","Error","configToParamsAbstractIntersectionsWatcher","result","isIntersectionsDirectionWatcherConfig","configToParamsIntersectionsDirectionWatcher","isIntersectionsCameraWatcherConfig","configToParamsIntersectionsCameraWatcher","camera","cameraName","position$","normalizedPosition$","origin","Vector3","copy","direction"],"mappings":"uOAkBO,SAASA,mCACdC,OACAC,aACAC,cACAC,cACAC,aAEA,MAAMC,OAcR,SAAoDL,OAAwCG,cAA8BC,aACxH,MAAME,OAAgCN,OAAOO,WAAWC,IAAKC,MAAyBN,cAAcO,cAAcC,UAAUF,OAEtHG,kBAAoDR,YAAYS,qBAAqBb,OAAOY,mBAClG,GAAIE,aAAaF,mBAAoB,MAAM,IAAIG,MAAM,qCAAqCf,OAAOY,iDAAiDZ,OAAOS,UAEzJ,MAAO,IACFT,OACHM,cACAM,oCAEJ,CAzBsDI,CAA2ChB,OAAQG,cAAeC,aAEtH,IAAIa,OACJ,GAAIC,sCAAsClB,QACxCiB,OAAS,IAAKZ,UAAWc,4CAA4CnB,aACvE,KAAWoB,mCAAmCpB,QAG5C,MAAM,IAAIe,MAAM,kFAAmFf,OAA0CS,UAF7IQ,OAAS,IAAKZ,UAAWgB,yCAAyCrB,OAAQC,aAAcC,eAG1F,CAEA,OAAOe,MACT,CAeA,SAASI,yCACPrB,OACAC,aACAC,eAIA,MAAO,CACLoB,OAHgCpB,cAAcQ,cAAcC,UAAUX,OAAOuB,YAI7EC,UAAWvB,aAAawB,oBAE5B,CAEA,SAASN,4CAA4CnB,QACnD,MAAO,CACL0B,QAAQ,IAAIC,SAAUC,KAAK5B,OAAO0B,QAClCG,WAAW,IAAIF,SAAUC,KAAK5B,OAAO6B,WAEzC"}
1
+ {"version":3,"file":"ConfigToParams.js","sources":["../../../src/Intersections/Adapters/ConfigToParams.ts"],"sourcesContent":["import type { TActor, TActorService } from '@Anarchy/Engine/Actor';\nimport type { TAnyCameraWrapper, TCameraService } from '@Anarchy/Engine/Camera';\nimport type {\n TAbstractIntersectionsWatcherParams,\n TAnyIntersectionsWatcherConfig,\n TAnyIntersectionsWatcherParams,\n TIntersectionsCameraWatcherConfig,\n TIntersectionsCameraWatcherParams,\n TIntersectionsDirectionWatcherConfig,\n TIntersectionsDirectionWatcherParams,\n TIntersectionsLoop\n} from '@Anarchy/Engine/Intersections/Models';\nimport { isIntersectionsCameraWatcherConfig, isIntersectionsDirectionWatcherConfig } from '@Anarchy/Engine/Intersections/Utils';\nimport type { TLoopService } from '@Anarchy/Engine/Loop';\nimport type { TMouseService } from '@Anarchy/Engine/Mouse';\nimport { isNotDefined } from '@hellpig/anarchy-shared/Utils';\nimport { Vector3 } from 'three';\n\nexport function intersectionsWatcherConfigToParams(\n config: TAnyIntersectionsWatcherConfig,\n mouseService: TMouseService,\n cameraService: TCameraService,\n actorsService: TActorService,\n loopService: TLoopService\n): TAnyIntersectionsWatcherParams | never {\n const params: TAbstractIntersectionsWatcherParams = configToParamsAbstractIntersectionsWatcher(config, actorsService, loopService);\n\n let result: TAnyIntersectionsWatcherParams;\n if (isIntersectionsDirectionWatcherConfig(config)) {\n result = { ...params, ...configToParamsIntersectionsDirectionWatcher(config) };\n } else if (isIntersectionsCameraWatcherConfig(config)) {\n result = { ...params, ...configToParamsIntersectionsCameraWatcher(config, mouseService, cameraService) };\n } else {\n throw new Error(`[Intersections] configToParams: Unknown intersections watcher config type for \"${(config as TAnyIntersectionsWatcherConfig).name}\".`);\n }\n\n return result;\n}\n\nfunction configToParamsAbstractIntersectionsWatcher(config: TAnyIntersectionsWatcherConfig, actorsService: TActorService, loopService: TLoopService): TAbstractIntersectionsWatcherParams {\n const actors: ReadonlyArray<TActor> = config.actorNames.map((name: string): TActor => actorsService.getRegistry().getByName(name));\n\n const intersectionsLoop: TIntersectionsLoop | undefined = loopService.getIntersectionsLoop(config.intersectionsLoop);\n if (isNotDefined(intersectionsLoop)) throw new Error(`configToParams: Cannot find loop \"${config.intersectionsLoop}\" for intersections watcher \"${config.name}\".`);\n\n return {\n ...config,\n actors,\n intersectionsLoop\n };\n}\n\nfunction configToParamsIntersectionsCameraWatcher(\n config: TIntersectionsCameraWatcherConfig,\n mouseService: TMouseService,\n cameraService: TCameraService\n): Omit<TIntersectionsCameraWatcherParams, keyof TAbstractIntersectionsWatcherParams> {\n const camera: TAnyCameraWrapper = cameraService.getRegistry().getByName(config.cameraName);\n\n return {\n camera,\n position$: mouseService.normalizedPosition$\n };\n}\n\nfunction configToParamsIntersectionsDirectionWatcher(config: TIntersectionsDirectionWatcherConfig): Omit<TIntersectionsDirectionWatcherParams, keyof TAbstractIntersectionsWatcherParams> {\n return {\n origin: new Vector3().copy(config.origin),\n direction: new Vector3().copy(config.direction)\n };\n}\n"],"names":["intersectionsWatcherConfigToParams","config","mouseService","cameraService","actorsService","loopService","params","actors","actorNames","map","name","getRegistry","getByName","intersectionsLoop","getIntersectionsLoop","isNotDefined","Error","configToParamsAbstractIntersectionsWatcher","result","isIntersectionsDirectionWatcherConfig","configToParamsIntersectionsDirectionWatcher","isIntersectionsCameraWatcherConfig","configToParamsIntersectionsCameraWatcher","camera","cameraName","position$","normalizedPosition$","origin","Vector3","copy","direction"],"mappings":"uOAkBO,SAASA,mCACdC,OACAC,aACAC,cACAC,cACAC,aAEA,MAAMC,OAcR,SAAoDL,OAAwCG,cAA8BC,aACxH,MAAME,OAAgCN,OAAOO,WAAWC,IAAKC,MAAyBN,cAAcO,cAAcC,UAAUF,OAEtHG,kBAAoDR,YAAYS,qBAAqBb,OAAOY,mBAClG,GAAIE,aAAaF,mBAAoB,MAAM,IAAIG,MAAM,qCAAqCf,OAAOY,iDAAiDZ,OAAOS,UAEzJ,MAAO,IACFT,OACHM,cACAM,oCAEJ,CAzBsDI,CAA2ChB,OAAQG,cAAeC,aAEtH,IAAIa,OACJ,GAAIC,sCAAsClB,QACxCiB,OAAS,IAAKZ,UAAWc,4CAA4CnB,aACvE,KAAWoB,mCAAmCpB,QAG5C,MAAM,IAAIe,MAAM,kFAAmFf,OAA0CS,UAF7IQ,OAAS,IAAKZ,UAAWgB,yCAAyCrB,OAAQC,aAAcC,eAG1F,CAEA,OAAOe,MACT,CAeA,SAASI,yCACPrB,OACAC,aACAC,eAIA,MAAO,CACLoB,OAHgCpB,cAAcQ,cAAcC,UAAUX,OAAOuB,YAI7EC,UAAWvB,aAAawB,oBAE5B,CAEA,SAASN,4CAA4CnB,QACnD,MAAO,CACL0B,QAAQ,IAAIC,SAAUC,KAAK5B,OAAO0B,QAClCG,WAAW,IAAIF,SAAUC,KAAK5B,OAAO6B,WAEzC"}
@@ -1 +1 @@
1
- {"version":3,"file":"EntityToConfig.js","sources":["../../../src/Intersections/Adapters/EntityToConfig.ts"],"sourcesContent":["import type { TActor } from '@hellpig/anarchy-engine/Actor';\nimport type {\n TAbstractIntersectionsWatcherConfig,\n TAnyIntersectionsWatcher,\n TAnyIntersectionsWatcherConfig,\n TIntersectionsCameraWatcher,\n TIntersectionsCameraWatcherConfig,\n TIntersectionsDirectionWatcher,\n TIntersectionsDirectionWatcherConfig,\n TIntersectionsWatcher\n} from '@hellpig/anarchy-engine/Intersections/Models';\nimport type { TIntersectionsWatcherConfig } from '@hellpig/anarchy-engine/Intersections/Models/TIntersectionsWatcherConfig';\nimport { isIntersectionsCameraWatcher, isIntersectionsDirectionWatcher } from '@hellpig/anarchy-engine/Intersections/Utils';\nimport { extractSerializableRegistrableFields } from '@hellpig/anarchy-engine/Mixins';\nimport { vector3ToXyz } from '@hellpig/anarchy-engine/Utils';\nimport { filterOutEmptyFields } from '@hellpig/anarchy-shared/Utils';\n\nexport function intersectionsEntityToConfig(entity: TAnyIntersectionsWatcher): TAnyIntersectionsWatcherConfig {\n const config: TIntersectionsWatcherConfig = intersectionsAbstractToConfig(entity);\n let result: TAnyIntersectionsWatcherConfig;\n\n if (isIntersectionsDirectionWatcher(entity)) {\n result = { ...config, ...intersectionsDirectionToConfig(entity) };\n } else if (isIntersectionsCameraWatcher(entity)) {\n result = { ...config, ...intersectionsCameraToConfig(entity) };\n } else {\n throw new Error(`[Intersections]: Entity to config failed: Unknown intersections watcher type: ${(entity as TAnyIntersectionsWatcherConfig).name}`);\n }\n\n return result;\n}\n\nexport function intersectionsAbstractToConfig(entity: TIntersectionsWatcher): TIntersectionsWatcherConfig {\n return filterOutEmptyFields({\n actorNames: Array.from(entity.getActors().values(), (actor: TActor): string => actor.name),\n isAutoStart: entity.isAutoStart,\n intersectionsLoop: entity.getIntersectionsLoop()?.name,\n far: entity.raycaster?.far,\n performance: entity.getPerformanceSettings(),\n ...extractSerializableRegistrableFields(entity)\n });\n}\n\nexport function intersectionsCameraToConfig(entity: TIntersectionsCameraWatcher): Omit<TIntersectionsCameraWatcherConfig, keyof TAbstractIntersectionsWatcherConfig> {\n return filterOutEmptyFields({\n cameraName: entity.getCamera().name\n });\n}\n\nexport function intersectionsDirectionToConfig(entity: TIntersectionsDirectionWatcher): Omit<TIntersectionsDirectionWatcherConfig, keyof TAbstractIntersectionsWatcherConfig> {\n return filterOutEmptyFields({\n origin: vector3ToXyz(entity.origin$.value),\n direction: vector3ToXyz(entity.direction$.value)\n });\n}\n"],"names":["intersectionsEntityToConfig","entity","config","intersectionsAbstractToConfig","result","isIntersectionsDirectionWatcher","intersectionsDirectionToConfig","isIntersectionsCameraWatcher","Error","name","intersectionsCameraToConfig","filterOutEmptyFields","actorNames","Array","from","getActors","values","actor","isAutoStart","intersectionsLoop","getIntersectionsLoop","far","raycaster","performance","getPerformanceSettings","extractSerializableRegistrableFields","cameraName","getCamera","origin","vector3ToXyz","origin$","value","direction","direction$"],"mappings":"iXAiBO,SAASA,4BAA4BC,QAC1C,MAAMC,OAAsCC,8BAA8BF,QAC1E,IAAIG,OAEJ,GAAIC,gCAAgCJ,QAClCG,OAAS,IAAKF,UAAWI,+BAA+BL,aAC1D,KAAWM,6BAA6BN,QAGtC,MAAM,IAAIO,MAAM,iFAAkFP,OAA0CQ,QAF5IL,OAAS,IAAKF,UAAWQ,4BAA4BT,QAGvD,CAEA,OAAOG,MACT,CAEO,SAASD,8BAA8BF,QAC5C,OAAOU,qBAAqB,CAC1BC,WAAYC,MAAMC,KAAKb,OAAOc,YAAYC,SAAWC,OAA0BA,MAAMR,MACrFS,YAAajB,OAAOiB,YACpBC,kBAAmBlB,OAAOmB,wBAAwBX,KAClDY,IAAKpB,OAAOqB,WAAWD,IACvBE,YAAatB,OAAOuB,4BACjBC,qCAAqCxB,SAE5C,CAEO,SAASS,4BAA4BT,QAC1C,OAAOU,qBAAqB,CAC1Be,WAAYzB,OAAO0B,YAAYlB,MAEnC,CAEO,SAASH,+BAA+BL,QAC7C,OAAOU,qBAAqB,CAC1BiB,OAAQC,aAAa5B,OAAO6B,QAAQC,OACpCC,UAAWH,aAAa5B,OAAOgC,WAAWF,QAE9C"}
1
+ {"version":3,"file":"EntityToConfig.js","sources":["../../../src/Intersections/Adapters/EntityToConfig.ts"],"sourcesContent":["import type { TActor } from '@Anarchy/Engine/Actor';\nimport type {\n TAbstractIntersectionsWatcherConfig,\n TAnyIntersectionsWatcher,\n TAnyIntersectionsWatcherConfig,\n TIntersectionsCameraWatcher,\n TIntersectionsCameraWatcherConfig,\n TIntersectionsDirectionWatcher,\n TIntersectionsDirectionWatcherConfig,\n TIntersectionsWatcher\n} from '@Anarchy/Engine/Intersections/Models';\nimport type { TIntersectionsWatcherConfig } from '@Anarchy/Engine/Intersections/Models/TIntersectionsWatcherConfig';\nimport { isIntersectionsCameraWatcher, isIntersectionsDirectionWatcher } from '@Anarchy/Engine/Intersections/Utils';\nimport { extractSerializableRegistrableFields } from '@Anarchy/Engine/Mixins';\nimport { vector3ToXyz } from '@Anarchy/Engine/Utils';\nimport { filterOutEmptyFields } from '@hellpig/anarchy-shared/Utils';\n\nexport function intersectionsEntityToConfig(entity: TAnyIntersectionsWatcher): TAnyIntersectionsWatcherConfig {\n const config: TIntersectionsWatcherConfig = intersectionsAbstractToConfig(entity);\n let result: TAnyIntersectionsWatcherConfig;\n\n if (isIntersectionsDirectionWatcher(entity)) {\n result = { ...config, ...intersectionsDirectionToConfig(entity) };\n } else if (isIntersectionsCameraWatcher(entity)) {\n result = { ...config, ...intersectionsCameraToConfig(entity) };\n } else {\n throw new Error(`[Intersections]: Entity to config failed: Unknown intersections watcher type: ${(entity as TAnyIntersectionsWatcherConfig).name}`);\n }\n\n return result;\n}\n\nexport function intersectionsAbstractToConfig(entity: TIntersectionsWatcher): TIntersectionsWatcherConfig {\n return filterOutEmptyFields({\n actorNames: Array.from(entity.getActors().values(), (actor: TActor): string => actor.name),\n isAutoStart: entity.isAutoStart,\n intersectionsLoop: entity.getIntersectionsLoop()?.name,\n far: entity.raycaster?.far,\n performance: entity.getPerformanceSettings(),\n ...extractSerializableRegistrableFields(entity)\n });\n}\n\nexport function intersectionsCameraToConfig(entity: TIntersectionsCameraWatcher): Omit<TIntersectionsCameraWatcherConfig, keyof TAbstractIntersectionsWatcherConfig> {\n return filterOutEmptyFields({\n cameraName: entity.getCamera().name\n });\n}\n\nexport function intersectionsDirectionToConfig(entity: TIntersectionsDirectionWatcher): Omit<TIntersectionsDirectionWatcherConfig, keyof TAbstractIntersectionsWatcherConfig> {\n return filterOutEmptyFields({\n origin: vector3ToXyz(entity.origin$.value),\n direction: vector3ToXyz(entity.direction$.value)\n });\n}\n"],"names":["intersectionsEntityToConfig","entity","config","intersectionsAbstractToConfig","result","isIntersectionsDirectionWatcher","intersectionsDirectionToConfig","isIntersectionsCameraWatcher","Error","name","intersectionsCameraToConfig","filterOutEmptyFields","actorNames","Array","from","getActors","values","actor","isAutoStart","intersectionsLoop","getIntersectionsLoop","far","raycaster","performance","getPerformanceSettings","extractSerializableRegistrableFields","cameraName","getCamera","origin","vector3ToXyz","origin$","value","direction","direction$"],"mappings":"iXAiBO,SAASA,4BAA4BC,QAC1C,MAAMC,OAAsCC,8BAA8BF,QAC1E,IAAIG,OAEJ,GAAIC,gCAAgCJ,QAClCG,OAAS,IAAKF,UAAWI,+BAA+BL,aAC1D,KAAWM,6BAA6BN,QAGtC,MAAM,IAAIO,MAAM,iFAAkFP,OAA0CQ,QAF5IL,OAAS,IAAKF,UAAWQ,4BAA4BT,QAGvD,CAEA,OAAOG,MACT,CAEO,SAASD,8BAA8BF,QAC5C,OAAOU,qBAAqB,CAC1BC,WAAYC,MAAMC,KAAKb,OAAOc,YAAYC,SAAWC,OAA0BA,MAAMR,MACrFS,YAAajB,OAAOiB,YACpBC,kBAAmBlB,OAAOmB,wBAAwBX,KAClDY,IAAKpB,OAAOqB,WAAWD,IACvBE,YAAatB,OAAOuB,4BACjBC,qCAAqCxB,SAE5C,CAEO,SAASS,4BAA4BT,QAC1C,OAAOU,qBAAqB,CAC1Be,WAAYzB,OAAO0B,YAAYlB,MAEnC,CAEO,SAASH,+BAA+BL,QAC7C,OAAOU,qBAAqB,CAC1BiB,OAAQC,aAAa5B,OAAO6B,QAAQC,OACpCC,UAAWH,aAAa5B,OAAOgC,WAAWF,QAE9C"}
@@ -1 +1 @@
1
- {"version":3,"file":"IntersectionsWatcherFactory.js","sources":["../../../src/Intersections/Factories/IntersectionsWatcherFactory.ts"],"sourcesContent":["import type { TReactiveFactory } from '@hellpig/anarchy-engine/Abstract';\nimport { FactoryType, ReactiveFactory } from '@hellpig/anarchy-engine/Abstract';\nimport { intersectionsWatcherConfigToParams } from '@hellpig/anarchy-engine/Intersections/Adapters';\nimport type { TAnyIntersectionsWatcher, TAnyIntersectionsWatcherParams, TIntersectionsWatcherFactory } from '@hellpig/anarchy-engine/Intersections/Models';\nimport { isIntersectionsCameraWatcherParams, isIntersectionsDirectionWatcherParams } from '@hellpig/anarchy-engine/Intersections/Utils';\nimport { IntersectionsCameraWatcher, IntersectionsDirectionWatcher } from '@hellpig/anarchy-engine/Intersections/Watchers';\n\nfunction create(params: TAnyIntersectionsWatcherParams): TAnyIntersectionsWatcher | never {\n if (isIntersectionsCameraWatcherParams(params)) return IntersectionsCameraWatcher(params);\n else if (isIntersectionsDirectionWatcherParams(params)) return IntersectionsDirectionWatcher(params);\n else throw new Error(`[IntersectionsWatcherFactory]: Unknown params type. Name: \"${(params as TAnyIntersectionsWatcherParams).name}\"`);\n}\n\nexport function IntersectionsWatcherFactory(): TIntersectionsWatcherFactory {\n const factory: TReactiveFactory<TAnyIntersectionsWatcher, TAnyIntersectionsWatcherParams> = ReactiveFactory(FactoryType.IntersectionsWatcher, create);\n // eslint-disable-next-line functional/immutable-data\n return Object.assign(factory, { configToParams: intersectionsWatcherConfigToParams });\n}\n"],"names":["create","params","isIntersectionsCameraWatcherParams","IntersectionsCameraWatcher","isIntersectionsDirectionWatcherParams","IntersectionsDirectionWatcher","Error","name","IntersectionsWatcherFactory","factory","ReactiveFactory","FactoryType","IntersectionsWatcher","Object","assign","configToParams","intersectionsWatcherConfigToParams"],"mappings":"8fAOA,SAASA,OAAOC,QACd,GAAIC,mCAAmCD,QAAS,OAAOE,2BAA2BF,QAAM,GAC/EG,sCAAsCH,QAAS,OAAOI,8BAA8BJ,cAClF,IAAIK,MAAM,8DAA+DL,OAA0CM,QAChI,CAEO,SAASC,8BACd,MAAMC,QAAsFC,gBAAgBC,YAAYC,qBAAsBZ,QAE9I,OAAOa,OAAOC,OAAOL,QAAS,CAAEM,eAAgBC,oCAClD"}
1
+ {"version":3,"file":"IntersectionsWatcherFactory.js","sources":["../../../src/Intersections/Factories/IntersectionsWatcherFactory.ts"],"sourcesContent":["import type { TReactiveFactory } from '@Anarchy/Engine/Abstract';\nimport { FactoryType, ReactiveFactory } from '@Anarchy/Engine/Abstract';\nimport { intersectionsWatcherConfigToParams } from '@Anarchy/Engine/Intersections/Adapters';\nimport type { TAnyIntersectionsWatcher, TAnyIntersectionsWatcherParams, TIntersectionsWatcherFactory } from '@Anarchy/Engine/Intersections/Models';\nimport { isIntersectionsCameraWatcherParams, isIntersectionsDirectionWatcherParams } from '@Anarchy/Engine/Intersections/Utils';\nimport { IntersectionsCameraWatcher, IntersectionsDirectionWatcher } from '@Anarchy/Engine/Intersections/Watchers';\n\nfunction create(params: TAnyIntersectionsWatcherParams): TAnyIntersectionsWatcher | never {\n if (isIntersectionsCameraWatcherParams(params)) return IntersectionsCameraWatcher(params);\n else if (isIntersectionsDirectionWatcherParams(params)) return IntersectionsDirectionWatcher(params);\n else throw new Error(`[IntersectionsWatcherFactory]: Unknown params type. Name: \"${(params as TAnyIntersectionsWatcherParams).name}\"`);\n}\n\nexport function IntersectionsWatcherFactory(): TIntersectionsWatcherFactory {\n const factory: TReactiveFactory<TAnyIntersectionsWatcher, TAnyIntersectionsWatcherParams> = ReactiveFactory(FactoryType.IntersectionsWatcher, create);\n // eslint-disable-next-line functional/immutable-data\n return Object.assign(factory, { configToParams: intersectionsWatcherConfigToParams });\n}\n"],"names":["create","params","isIntersectionsCameraWatcherParams","IntersectionsCameraWatcher","isIntersectionsDirectionWatcherParams","IntersectionsDirectionWatcher","Error","name","IntersectionsWatcherFactory","factory","ReactiveFactory","FactoryType","IntersectionsWatcher","Object","assign","configToParams","intersectionsWatcherConfigToParams"],"mappings":"8fAOA,SAASA,OAAOC,QACd,GAAIC,mCAAmCD,QAAS,OAAOE,2BAA2BF,QAAM,GAC/EG,sCAAsCH,QAAS,OAAOI,8BAA8BJ,cAClF,IAAIK,MAAM,8DAA+DL,OAA0CM,QAChI,CAEO,SAASC,8BACd,MAAMC,QAAsFC,gBAAgBC,YAAYC,qBAAsBZ,QAE9I,OAAOa,OAAOC,OAAOL,QAAS,CAAEM,eAAgBC,oCAClD"}
@@ -1 +1 @@
1
- {"version":3,"file":"IntersectionsWatcherRegistry.js","sources":["../../../src/Intersections/Registries/IntersectionsWatcherRegistry.ts"],"sourcesContent":["import { RegistryType } from '@hellpig/anarchy-engine/Abstract/Constants';\nimport { AbstractWatcherRegistry } from '@hellpig/anarchy-engine/Abstract/Registries';\nimport type { TAnyIntersectionsWatcher, TIntersectionsWatcherRegistry } from '@hellpig/anarchy-engine/Intersections/Models';\n\nexport function IntersectionsWatcherRegistry(): TIntersectionsWatcherRegistry {\n return AbstractWatcherRegistry<TAnyIntersectionsWatcher>(RegistryType.IntersectionsWatcher);\n}\n"],"names":["IntersectionsWatcherRegistry","AbstractWatcherRegistry","RegistryType","IntersectionsWatcher"],"mappings":"6JAIO,SAASA,+BACd,OAAOC,wBAAkDC,aAAaC,qBACxE"}
1
+ {"version":3,"file":"IntersectionsWatcherRegistry.js","sources":["../../../src/Intersections/Registries/IntersectionsWatcherRegistry.ts"],"sourcesContent":["import { RegistryType } from '@Anarchy/Engine/Abstract/Constants';\nimport { AbstractWatcherRegistry } from '@Anarchy/Engine/Abstract/Registries';\nimport type { TAnyIntersectionsWatcher, TIntersectionsWatcherRegistry } from '@Anarchy/Engine/Intersections/Models';\n\nexport function IntersectionsWatcherRegistry(): TIntersectionsWatcherRegistry {\n return AbstractWatcherRegistry<TAnyIntersectionsWatcher>(RegistryType.IntersectionsWatcher);\n}\n"],"names":["IntersectionsWatcherRegistry","AbstractWatcherRegistry","RegistryType","IntersectionsWatcher"],"mappings":"6JAIO,SAASA,+BACd,OAAOC,wBAAkDC,aAAaC,qBACxE"}
@@ -1 +1 @@
1
- {"version":3,"file":"IntersectionsWatcherService.js","sources":["../../../src/Intersections/Services/IntersectionsWatcherService.ts"],"sourcesContent":["import type { TAbstractService } from '@hellpig/anarchy-engine/Abstract';\nimport { AbstractService } from '@hellpig/anarchy-engine/Abstract';\nimport type { TActorService } from '@hellpig/anarchy-engine/Actor';\nimport type { TCameraService } from '@hellpig/anarchy-engine/Camera';\nimport type {\n TAnyIntersectionsWatcher,\n TAnyIntersectionsWatcherConfig,\n TAnyIntersectionsWatcherParams,\n TIntersectionsCameraWatcher,\n TIntersectionsDirectionWatcher,\n TIntersectionsWatcherFactory,\n TIntersectionsWatcherRegistry,\n TIntersectionsWatcherService,\n TIntersectionsWatcherServiceWithFactory,\n TIntersectionsWatcherServiceWithRegistry\n} from '@hellpig/anarchy-engine/Intersections/Models';\nimport { isIntersectionsCameraWatcher, isIntersectionsDirectionWatcher } from '@hellpig/anarchy-engine/Intersections/Utils';\nimport type { TLoopService } from '@hellpig/anarchy-engine/Loop';\nimport type { TDisposable } from '@hellpig/anarchy-engine/Mixins';\nimport { withFactoryService, withRegistryService, withSerializableEntities } from '@hellpig/anarchy-engine/Mixins';\nimport type { TMouseService } from '@hellpig/anarchy-engine/Mouse';\nimport { mergeAll } from '@hellpig/anarchy-engine/Utils';\nimport { isDefined } from '@hellpig/anarchy-shared/Utils';\nimport type { Subscription } from 'rxjs';\n\nexport function IntersectionsWatcherService(factory: TIntersectionsWatcherFactory, registry: TIntersectionsWatcherRegistry): TIntersectionsWatcherService {\n const factorySub$: Subscription = factory.entityCreated$.subscribe((watcher: TAnyIntersectionsWatcher): void => registry.add(watcher));\n const disposable: ReadonlyArray<TDisposable> = [registry, factory, factorySub$];\n const abstractService: TAbstractService = AbstractService(disposable);\n\n const create = (params: TAnyIntersectionsWatcherParams): TAnyIntersectionsWatcher => factory.create(params, undefined);\n const createFromList = (list: ReadonlyArray<TAnyIntersectionsWatcherParams>): ReadonlyArray<TAnyIntersectionsWatcher> => list.map(create);\n const createFromConfig = (\n configs: ReadonlyArray<TAnyIntersectionsWatcherConfig>,\n mouseService: TMouseService,\n cameraService: TCameraService,\n actorService: TActorService,\n loopService: TLoopService\n ): ReadonlyArray<TAnyIntersectionsWatcher> =>\n configs.map((config: TAnyIntersectionsWatcherConfig): TAnyIntersectionsWatcher => create(factory.configToParams(config, mouseService, cameraService, actorService, loopService)));\n\n const withFactory: TIntersectionsWatcherServiceWithFactory = withFactoryService(factory);\n const withRegistry: TIntersectionsWatcherServiceWithRegistry = withRegistryService(registry);\n\n function findCameraWatcher(name: string): TIntersectionsCameraWatcher | undefined | never {\n const watcher: TAnyIntersectionsWatcher | undefined = registry.getByName(name);\n if (isDefined(watcher) && !isIntersectionsCameraWatcher(watcher)) {\n throw new Error(`[IntersectionsWatcherService]: Watcher \"${watcher.name}\" is not type of TIntersectionsCameraWatcher`);\n }\n return watcher;\n }\n\n function getCameraWatcher(name: string): TIntersectionsCameraWatcher | never {\n const watcher: TIntersectionsCameraWatcher | undefined = findCameraWatcher(name);\n if (watcher === undefined) throw new Error(`[IntersectionsWatcherService]: Cannot get camera watcher: \"${name}\" is not found`);\n return watcher;\n }\n\n function findDirectionWatcher(name: string): TIntersectionsDirectionWatcher | undefined | never {\n const watcher: TAnyIntersectionsWatcher | undefined = registry.getByName(name);\n if (isDefined(watcher) && !isIntersectionsDirectionWatcher(watcher)) {\n throw new Error(`[IntersectionsWatcherService]: Watcher \"${watcher.name}\" is not type of TIntersectionsDirectionWatcher`);\n }\n return watcher;\n }\n\n function getDirectionWatcher(name: string): TIntersectionsDirectionWatcher | never {\n const watcher: TAnyIntersectionsWatcher | undefined = findDirectionWatcher(name);\n if (watcher === undefined) throw new Error(`[IntersectionsWatcherService]: Cannot get direction watcher: \"${name}\" is not found`);\n return watcher;\n }\n\n return mergeAll(abstractService, withFactory, withRegistry, withSerializableEntities<TAnyIntersectionsWatcher, TAnyIntersectionsWatcherConfig, undefined>(registry), {\n create,\n createFromList,\n createFromConfig,\n findCameraWatcher,\n getCameraWatcher,\n findDirectionWatcher,\n getDirectionWatcher\n });\n}\n"],"names":["IntersectionsWatcherService","factory","registry","factorySub$","entityCreated$","subscribe","watcher","add","abstractService","AbstractService","create","params","withFactory","withFactoryService","withRegistry","withRegistryService","findCameraWatcher","name","getByName","isDefined","isIntersectionsCameraWatcher","Error","findDirectionWatcher","isIntersectionsDirectionWatcher","mergeAll","withSerializableEntities","createFromList","list","map","createFromConfig","configs","mouseService","cameraService","actorService","loopService","config","configToParams","getCameraWatcher","getDirectionWatcher"],"mappings":"wiBAyBO,SAASA,4BAA4BC,QAAuCC,UACjF,MAAMC,YAA4BF,QAAQG,eAAeC,UAAWC,SAA4CJ,SAASK,IAAID,UAEvHE,gBAAoCC,gBADK,CAACP,SAAUD,QAASE,cAG7DO,OAAUC,QAAqEV,QAAQS,OAAOC,eAW9FC,YAAuDC,mBAAmBZ,SAC1Ea,aAAyDC,oBAAoBb,UAEnF,SAASc,kBAAkBC,MACzB,MAAMX,QAAgDJ,SAASgB,UAAUD,MACzE,GAAIE,UAAUb,WAAac,6BAA6Bd,SACtD,MAAM,IAAIe,MAAM,2CAA2Cf,QAAQW,oDAErE,OAAOX,OACT,CAQA,SAASgB,qBAAqBL,MAC5B,MAAMX,QAAgDJ,SAASgB,UAAUD,MACzE,GAAIE,UAAUb,WAAaiB,gCAAgCjB,SACzD,MAAM,IAAIe,MAAM,2CAA2Cf,QAAQW,uDAErE,OAAOX,OACT,CAQA,OAAOkB,SAAShB,gBAAiBI,YAAaE,aAAcW,yBAA8FvB,UAAW,CACnKQ,cACAgB,eA3CsBC,MAAiGA,KAAKC,IAAIlB,QA4ChImB,iBA3CuB,CACvBC,QACAC,aACAC,cACAC,aACAC,cAEAJ,QAAQF,IAAKO,QAAqEzB,OAAOT,QAAQmC,eAAeD,OAAQJ,aAAcC,cAAeC,aAAcC,eAqCnKlB,oCACAqB,iBAzBF,SAA0BpB,MACxB,MAAMX,QAAmDU,kBAAkBC,MAC3E,QAAgB,IAAZX,QAAuB,MAAM,IAAIe,MAAM,8DAA8DJ,sBACzG,OAAOX,OACT,EAsBEgB,0CACAgB,oBAbF,SAA6BrB,MAC3B,MAAMX,QAAgDgB,qBAAqBL,MAC3E,QAAgB,IAAZX,QAAuB,MAAM,IAAIe,MAAM,iEAAiEJ,sBAC5G,OAAOX,OACT,GAWF"}
1
+ {"version":3,"file":"IntersectionsWatcherService.js","sources":["../../../src/Intersections/Services/IntersectionsWatcherService.ts"],"sourcesContent":["import type { TAbstractService } from '@Anarchy/Engine/Abstract';\nimport { AbstractService } from '@Anarchy/Engine/Abstract';\nimport type { TActorService } from '@Anarchy/Engine/Actor';\nimport type { TCameraService } from '@Anarchy/Engine/Camera';\nimport type {\n TAnyIntersectionsWatcher,\n TAnyIntersectionsWatcherConfig,\n TAnyIntersectionsWatcherParams,\n TIntersectionsCameraWatcher,\n TIntersectionsDirectionWatcher,\n TIntersectionsWatcherFactory,\n TIntersectionsWatcherRegistry,\n TIntersectionsWatcherService,\n TIntersectionsWatcherServiceWithFactory,\n TIntersectionsWatcherServiceWithRegistry\n} from '@Anarchy/Engine/Intersections/Models';\nimport { isIntersectionsCameraWatcher, isIntersectionsDirectionWatcher } from '@Anarchy/Engine/Intersections/Utils';\nimport type { TLoopService } from '@Anarchy/Engine/Loop';\nimport type { TDisposable } from '@Anarchy/Engine/Mixins';\nimport { withFactoryService, withRegistryService, withSerializableEntities } from '@Anarchy/Engine/Mixins';\nimport type { TMouseService } from '@Anarchy/Engine/Mouse';\nimport { mergeAll } from '@Anarchy/Engine/Utils';\nimport { isDefined } from '@hellpig/anarchy-shared/Utils';\nimport type { Subscription } from 'rxjs';\n\nexport function IntersectionsWatcherService(factory: TIntersectionsWatcherFactory, registry: TIntersectionsWatcherRegistry): TIntersectionsWatcherService {\n const factorySub$: Subscription = factory.entityCreated$.subscribe((watcher: TAnyIntersectionsWatcher): void => registry.add(watcher));\n const disposable: ReadonlyArray<TDisposable> = [registry, factory, factorySub$];\n const abstractService: TAbstractService = AbstractService(disposable);\n\n const create = (params: TAnyIntersectionsWatcherParams): TAnyIntersectionsWatcher => factory.create(params, undefined);\n const createFromList = (list: ReadonlyArray<TAnyIntersectionsWatcherParams>): ReadonlyArray<TAnyIntersectionsWatcher> => list.map(create);\n const createFromConfig = (\n configs: ReadonlyArray<TAnyIntersectionsWatcherConfig>,\n mouseService: TMouseService,\n cameraService: TCameraService,\n actorService: TActorService,\n loopService: TLoopService\n ): ReadonlyArray<TAnyIntersectionsWatcher> =>\n configs.map((config: TAnyIntersectionsWatcherConfig): TAnyIntersectionsWatcher => create(factory.configToParams(config, mouseService, cameraService, actorService, loopService)));\n\n const withFactory: TIntersectionsWatcherServiceWithFactory = withFactoryService(factory);\n const withRegistry: TIntersectionsWatcherServiceWithRegistry = withRegistryService(registry);\n\n function findCameraWatcher(name: string): TIntersectionsCameraWatcher | undefined | never {\n const watcher: TAnyIntersectionsWatcher | undefined = registry.getByName(name);\n if (isDefined(watcher) && !isIntersectionsCameraWatcher(watcher)) {\n throw new Error(`[IntersectionsWatcherService]: Watcher \"${watcher.name}\" is not type of TIntersectionsCameraWatcher`);\n }\n return watcher;\n }\n\n function getCameraWatcher(name: string): TIntersectionsCameraWatcher | never {\n const watcher: TIntersectionsCameraWatcher | undefined = findCameraWatcher(name);\n if (watcher === undefined) throw new Error(`[IntersectionsWatcherService]: Cannot get camera watcher: \"${name}\" is not found`);\n return watcher;\n }\n\n function findDirectionWatcher(name: string): TIntersectionsDirectionWatcher | undefined | never {\n const watcher: TAnyIntersectionsWatcher | undefined = registry.getByName(name);\n if (isDefined(watcher) && !isIntersectionsDirectionWatcher(watcher)) {\n throw new Error(`[IntersectionsWatcherService]: Watcher \"${watcher.name}\" is not type of TIntersectionsDirectionWatcher`);\n }\n return watcher;\n }\n\n function getDirectionWatcher(name: string): TIntersectionsDirectionWatcher | never {\n const watcher: TAnyIntersectionsWatcher | undefined = findDirectionWatcher(name);\n if (watcher === undefined) throw new Error(`[IntersectionsWatcherService]: Cannot get direction watcher: \"${name}\" is not found`);\n return watcher;\n }\n\n return mergeAll(abstractService, withFactory, withRegistry, withSerializableEntities<TAnyIntersectionsWatcher, TAnyIntersectionsWatcherConfig, undefined>(registry), {\n create,\n createFromList,\n createFromConfig,\n findCameraWatcher,\n getCameraWatcher,\n findDirectionWatcher,\n getDirectionWatcher\n });\n}\n"],"names":["IntersectionsWatcherService","factory","registry","factorySub$","entityCreated$","subscribe","watcher","add","abstractService","AbstractService","create","params","withFactory","withFactoryService","withRegistry","withRegistryService","findCameraWatcher","name","getByName","isDefined","isIntersectionsCameraWatcher","Error","findDirectionWatcher","isIntersectionsDirectionWatcher","mergeAll","withSerializableEntities","createFromList","list","map","createFromConfig","configs","mouseService","cameraService","actorService","loopService","config","configToParams","getCameraWatcher","getDirectionWatcher"],"mappings":"wiBAyBO,SAASA,4BAA4BC,QAAuCC,UACjF,MAAMC,YAA4BF,QAAQG,eAAeC,UAAWC,SAA4CJ,SAASK,IAAID,UAEvHE,gBAAoCC,gBADK,CAACP,SAAUD,QAASE,cAG7DO,OAAUC,QAAqEV,QAAQS,OAAOC,eAW9FC,YAAuDC,mBAAmBZ,SAC1Ea,aAAyDC,oBAAoBb,UAEnF,SAASc,kBAAkBC,MACzB,MAAMX,QAAgDJ,SAASgB,UAAUD,MACzE,GAAIE,UAAUb,WAAac,6BAA6Bd,SACtD,MAAM,IAAIe,MAAM,2CAA2Cf,QAAQW,oDAErE,OAAOX,OACT,CAQA,SAASgB,qBAAqBL,MAC5B,MAAMX,QAAgDJ,SAASgB,UAAUD,MACzE,GAAIE,UAAUb,WAAaiB,gCAAgCjB,SACzD,MAAM,IAAIe,MAAM,2CAA2Cf,QAAQW,uDAErE,OAAOX,OACT,CAQA,OAAOkB,SAAShB,gBAAiBI,YAAaE,aAAcW,yBAA8FvB,UAAW,CACnKQ,cACAgB,eA3CsBC,MAAiGA,KAAKC,IAAIlB,QA4ChImB,iBA3CuB,CACvBC,QACAC,aACAC,cACAC,aACAC,cAEAJ,QAAQF,IAAKO,QAAqEzB,OAAOT,QAAQmC,eAAeD,OAAQJ,aAAcC,cAAeC,aAAcC,eAqCnKlB,oCACAqB,iBAzBF,SAA0BpB,MACxB,MAAMX,QAAmDU,kBAAkBC,MAC3E,QAAgB,IAAZX,QAAuB,MAAM,IAAIe,MAAM,8DAA8DJ,sBACzG,OAAOX,OACT,EAsBEgB,0CACAgB,oBAbF,SAA6BrB,MAC3B,MAAMX,QAAgDgB,qBAAqBL,MAC3E,QAAgB,IAAZX,QAAuB,MAAM,IAAIe,MAAM,iEAAiEJ,sBAC5G,OAAOX,OACT,GAWF"}
@@ -1 +1 @@
1
- {"version":3,"file":"IntersectionsWatcherUtils.js","sources":["../../../src/Intersections/Utils/IntersectionsWatcherUtils.ts"],"sourcesContent":["import type {\n TIntersectionsCameraWatcher,\n TIntersectionsCameraWatcherConfig,\n TIntersectionsCameraWatcherParams,\n TIntersectionsDirectionWatcher,\n TIntersectionsDirectionWatcherConfig,\n TIntersectionsDirectionWatcherParams\n} from '@hellpig/anarchy-engine/Intersections/Models';\nimport type { TReadonlyVector2, TReadonlyVector3 } from '@hellpig/anarchy-engine/ThreeLib';\nimport { isDefined, isNotDefined } from '@hellpig/anarchy-shared/Utils';\nimport { Vector2, Vector3 } from 'three';\n\nexport function isIntersectionsDirectionWatcherConfig(config: TIntersectionsCameraWatcherConfig | TIntersectionsDirectionWatcherConfig): config is TIntersectionsDirectionWatcherConfig {\n return isDefined((config as TIntersectionsDirectionWatcherConfig).origin) && isDefined((config as TIntersectionsDirectionWatcherConfig).direction);\n}\n\nexport function isIntersectionsCameraWatcherConfig(config: TIntersectionsCameraWatcherConfig | TIntersectionsDirectionWatcherConfig): config is TIntersectionsCameraWatcherConfig {\n return isDefined((config as TIntersectionsCameraWatcherConfig).cameraName);\n}\n\nexport function isIntersectionsDirectionWatcherParams(params: TIntersectionsCameraWatcherParams | TIntersectionsDirectionWatcherParams): params is TIntersectionsDirectionWatcherParams {\n return isDefined((params as TIntersectionsDirectionWatcherParams).origin) && isDefined((params as TIntersectionsDirectionWatcherParams).direction);\n}\n\nexport function isIntersectionsCameraWatcherParams(params: TIntersectionsCameraWatcherParams | TIntersectionsDirectionWatcherParams): params is TIntersectionsCameraWatcherParams {\n return isDefined((params as TIntersectionsCameraWatcherParams).camera);\n}\n\nexport function isIntersectionsDirectionWatcher(watcher: TIntersectionsCameraWatcher | TIntersectionsDirectionWatcher): watcher is TIntersectionsDirectionWatcher {\n return isDefined((watcher as TIntersectionsDirectionWatcher).origin$) && isDefined((watcher as TIntersectionsDirectionWatcher).direction$);\n}\n\nexport function isIntersectionsCameraWatcher(watcher: TIntersectionsCameraWatcher | TIntersectionsDirectionWatcher): watcher is TIntersectionsCameraWatcher {\n return isDefined((watcher as TIntersectionsCameraWatcher).getCamera);\n}\n\nexport function getChangedOriginAndDirection(\n tmpOrigin: Float32Array,\n tmpDirection: Float32Array,\n prevOrigin: Float32Array,\n prevDirection: Float32Array,\n origin: TReadonlyVector3,\n direction: TReadonlyVector3,\n threshold: number\n): Readonly<{ origin: TReadonlyVector3; direction: TReadonlyVector3 }> | undefined {\n // eslint-disable-next-line functional/immutable-data\n tmpOrigin[0] = origin.x;\n // eslint-disable-next-line functional/immutable-data\n tmpOrigin[1] = origin.y;\n // eslint-disable-next-line functional/immutable-data\n tmpOrigin[2] = origin.z;\n\n // eslint-disable-next-line functional/immutable-data\n tmpDirection[0] = direction.x;\n // eslint-disable-next-line functional/immutable-data\n tmpDirection[1] = direction.y;\n // eslint-disable-next-line functional/immutable-data\n tmpDirection[2] = direction.z;\n\n const originChanged: boolean = Math.abs(tmpOrigin[0] - prevOrigin[0]) > threshold || Math.abs(tmpOrigin[1] - prevOrigin[1]) > threshold || Math.abs(tmpOrigin[2] - prevOrigin[2]) > threshold;\n\n const directionChanged: boolean =\n Math.abs(tmpDirection[0] - prevDirection[0]) > threshold || Math.abs(tmpDirection[1] - prevDirection[1]) > threshold || Math.abs(tmpDirection[2] - prevDirection[2]) > threshold;\n\n if (originChanged && !directionChanged) return undefined;\n\n prevOrigin.set(tmpOrigin);\n prevDirection.set(tmpDirection);\n\n return {\n origin: new Vector3(tmpOrigin[0], tmpOrigin[1], tmpOrigin[2]) as TReadonlyVector3,\n direction: new Vector3(tmpDirection[0], tmpDirection[1], tmpDirection[2]) as TReadonlyVector3\n };\n}\n\nexport function getChangedPosition(tmp: Float32Array, prev: Float32Array, position: TReadonlyVector2, threshold: number): Readonly<{ position: TReadonlyVector2 }> | undefined {\n if (isNotDefined(position)) return undefined;\n // eslint-disable-next-line functional/immutable-data\n tmp[0] = position.x;\n // eslint-disable-next-line functional/immutable-data\n tmp[1] = position.y;\n\n const changed: boolean = Math.abs(tmp[0] - prev[0]) > threshold || Math.abs(tmp[1] - prev[1]) > threshold;\n\n if (!changed) return undefined;\n\n prev.set(tmp);\n\n return {\n position: new Vector2(tmp[0], tmp[1]) as TReadonlyVector2\n };\n}\n"],"names":["isIntersectionsDirectionWatcherConfig","config","isDefined","origin","direction","isIntersectionsCameraWatcherConfig","cameraName","isIntersectionsDirectionWatcherParams","params","isIntersectionsCameraWatcherParams","camera","isIntersectionsDirectionWatcher","watcher","origin$","direction$","isIntersectionsCameraWatcher","getCamera","getChangedOriginAndDirection","tmpOrigin","tmpDirection","prevOrigin","prevDirection","threshold","x","y","z","originChanged","Math","abs","directionChanged","set","Vector3","getChangedPosition","tmp","prev","position","isNotDefined","Vector2"],"mappings":"6HAYO,SAASA,sCAAsCC,QACpD,OAAOC,UAAWD,OAAgDE,SAAWD,UAAWD,OAAgDG,UAC1I,CAEO,SAASC,mCAAmCJ,QACjD,OAAOC,UAAWD,OAA6CK,WACjE,CAEO,SAASC,sCAAsCC,QACpD,OAAON,UAAWM,OAAgDL,SAAWD,UAAWM,OAAgDJ,UAC1I,CAEO,SAASK,mCAAmCD,QACjD,OAAON,UAAWM,OAA6CE,OACjE,CAEO,SAASC,gCAAgCC,SAC9C,OAAOV,UAAWU,QAA2CC,UAAYX,UAAWU,QAA2CE,WACjI,CAEO,SAASC,6BAA6BH,SAC3C,OAAOV,UAAWU,QAAwCI,UAC5D,CAEO,SAASC,6BACdC,UACAC,aACAC,WACAC,cACAlB,OACAC,UACAkB,WAGAJ,UAAU,GAAKf,OAAOoB,EAEtBL,UAAU,GAAKf,OAAOqB,EAEtBN,UAAU,GAAKf,OAAOsB,EAGtBN,aAAa,GAAKf,UAAUmB,EAE5BJ,aAAa,GAAKf,UAAUoB,EAE5BL,aAAa,GAAKf,UAAUqB,EAE5B,MAAMC,cAAyBC,KAAKC,IAAIV,UAAU,GAAKE,WAAW,IAAME,WAAaK,KAAKC,IAAIV,UAAU,GAAKE,WAAW,IAAME,WAAaK,KAAKC,IAAIV,UAAU,GAAKE,WAAW,IAAME,UAE9KO,iBACJF,KAAKC,IAAIT,aAAa,GAAKE,cAAc,IAAMC,WAAaK,KAAKC,IAAIT,aAAa,GAAKE,cAAc,IAAMC,WAAaK,KAAKC,IAAIT,aAAa,GAAKE,cAAc,IAAMC,UAEzK,IAAII,eAAkBG,iBAKtB,OAHAT,WAAWU,IAAIZ,WACfG,cAAcS,IAAIX,cAEX,CACLhB,OAAQ,IAAI4B,QAAQb,UAAU,GAAIA,UAAU,GAAIA,UAAU,IAC1Dd,UAAW,IAAI2B,QAAQZ,aAAa,GAAIA,aAAa,GAAIA,aAAa,IAE1E,CAEO,SAASa,mBAAmBC,IAAmBC,KAAoBC,SAA4Bb,WACpG,IAAIc,aAAaD,UAQjB,OANAF,IAAI,GAAKE,SAASZ,EAElBU,IAAI,GAAKE,SAASX,EAEOG,KAAKC,IAAIK,IAAI,GAAKC,KAAK,IAAMZ,WAAaK,KAAKC,IAAIK,IAAI,GAAKC,KAAK,IAAMZ,WAIhGY,KAAKJ,IAAIG,KAEF,CACLE,SAAU,IAAIE,QAAQJ,IAAI,GAAIA,IAAI,WALpC,CAOF"}
1
+ {"version":3,"file":"IntersectionsWatcherUtils.js","sources":["../../../src/Intersections/Utils/IntersectionsWatcherUtils.ts"],"sourcesContent":["import type {\n TIntersectionsCameraWatcher,\n TIntersectionsCameraWatcherConfig,\n TIntersectionsCameraWatcherParams,\n TIntersectionsDirectionWatcher,\n TIntersectionsDirectionWatcherConfig,\n TIntersectionsDirectionWatcherParams\n} from '@Anarchy/Engine/Intersections/Models';\nimport type { TReadonlyVector2, TReadonlyVector3 } from '@Anarchy/Engine/ThreeLib';\nimport { isDefined, isNotDefined } from '@hellpig/anarchy-shared/Utils';\nimport { Vector2, Vector3 } from 'three';\n\nexport function isIntersectionsDirectionWatcherConfig(config: TIntersectionsCameraWatcherConfig | TIntersectionsDirectionWatcherConfig): config is TIntersectionsDirectionWatcherConfig {\n return isDefined((config as TIntersectionsDirectionWatcherConfig).origin) && isDefined((config as TIntersectionsDirectionWatcherConfig).direction);\n}\n\nexport function isIntersectionsCameraWatcherConfig(config: TIntersectionsCameraWatcherConfig | TIntersectionsDirectionWatcherConfig): config is TIntersectionsCameraWatcherConfig {\n return isDefined((config as TIntersectionsCameraWatcherConfig).cameraName);\n}\n\nexport function isIntersectionsDirectionWatcherParams(params: TIntersectionsCameraWatcherParams | TIntersectionsDirectionWatcherParams): params is TIntersectionsDirectionWatcherParams {\n return isDefined((params as TIntersectionsDirectionWatcherParams).origin) && isDefined((params as TIntersectionsDirectionWatcherParams).direction);\n}\n\nexport function isIntersectionsCameraWatcherParams(params: TIntersectionsCameraWatcherParams | TIntersectionsDirectionWatcherParams): params is TIntersectionsCameraWatcherParams {\n return isDefined((params as TIntersectionsCameraWatcherParams).camera);\n}\n\nexport function isIntersectionsDirectionWatcher(watcher: TIntersectionsCameraWatcher | TIntersectionsDirectionWatcher): watcher is TIntersectionsDirectionWatcher {\n return isDefined((watcher as TIntersectionsDirectionWatcher).origin$) && isDefined((watcher as TIntersectionsDirectionWatcher).direction$);\n}\n\nexport function isIntersectionsCameraWatcher(watcher: TIntersectionsCameraWatcher | TIntersectionsDirectionWatcher): watcher is TIntersectionsCameraWatcher {\n return isDefined((watcher as TIntersectionsCameraWatcher).getCamera);\n}\n\nexport function getChangedOriginAndDirection(\n tmpOrigin: Float32Array,\n tmpDirection: Float32Array,\n prevOrigin: Float32Array,\n prevDirection: Float32Array,\n origin: TReadonlyVector3,\n direction: TReadonlyVector3,\n threshold: number\n): Readonly<{ origin: TReadonlyVector3; direction: TReadonlyVector3 }> | undefined {\n // eslint-disable-next-line functional/immutable-data\n tmpOrigin[0] = origin.x;\n // eslint-disable-next-line functional/immutable-data\n tmpOrigin[1] = origin.y;\n // eslint-disable-next-line functional/immutable-data\n tmpOrigin[2] = origin.z;\n\n // eslint-disable-next-line functional/immutable-data\n tmpDirection[0] = direction.x;\n // eslint-disable-next-line functional/immutable-data\n tmpDirection[1] = direction.y;\n // eslint-disable-next-line functional/immutable-data\n tmpDirection[2] = direction.z;\n\n const originChanged: boolean = Math.abs(tmpOrigin[0] - prevOrigin[0]) > threshold || Math.abs(tmpOrigin[1] - prevOrigin[1]) > threshold || Math.abs(tmpOrigin[2] - prevOrigin[2]) > threshold;\n\n const directionChanged: boolean =\n Math.abs(tmpDirection[0] - prevDirection[0]) > threshold || Math.abs(tmpDirection[1] - prevDirection[1]) > threshold || Math.abs(tmpDirection[2] - prevDirection[2]) > threshold;\n\n if (originChanged && !directionChanged) return undefined;\n\n prevOrigin.set(tmpOrigin);\n prevDirection.set(tmpDirection);\n\n return {\n origin: new Vector3(tmpOrigin[0], tmpOrigin[1], tmpOrigin[2]) as TReadonlyVector3,\n direction: new Vector3(tmpDirection[0], tmpDirection[1], tmpDirection[2]) as TReadonlyVector3\n };\n}\n\nexport function getChangedPosition(tmp: Float32Array, prev: Float32Array, position: TReadonlyVector2, threshold: number): Readonly<{ position: TReadonlyVector2 }> | undefined {\n if (isNotDefined(position)) return undefined;\n // eslint-disable-next-line functional/immutable-data\n tmp[0] = position.x;\n // eslint-disable-next-line functional/immutable-data\n tmp[1] = position.y;\n\n const changed: boolean = Math.abs(tmp[0] - prev[0]) > threshold || Math.abs(tmp[1] - prev[1]) > threshold;\n\n if (!changed) return undefined;\n\n prev.set(tmp);\n\n return {\n position: new Vector2(tmp[0], tmp[1]) as TReadonlyVector2\n };\n}\n"],"names":["isIntersectionsDirectionWatcherConfig","config","isDefined","origin","direction","isIntersectionsCameraWatcherConfig","cameraName","isIntersectionsDirectionWatcherParams","params","isIntersectionsCameraWatcherParams","camera","isIntersectionsDirectionWatcher","watcher","origin$","direction$","isIntersectionsCameraWatcher","getCamera","getChangedOriginAndDirection","tmpOrigin","tmpDirection","prevOrigin","prevDirection","threshold","x","y","z","originChanged","Math","abs","directionChanged","set","Vector3","getChangedPosition","tmp","prev","position","isNotDefined","Vector2"],"mappings":"6HAYO,SAASA,sCAAsCC,QACpD,OAAOC,UAAWD,OAAgDE,SAAWD,UAAWD,OAAgDG,UAC1I,CAEO,SAASC,mCAAmCJ,QACjD,OAAOC,UAAWD,OAA6CK,WACjE,CAEO,SAASC,sCAAsCC,QACpD,OAAON,UAAWM,OAAgDL,SAAWD,UAAWM,OAAgDJ,UAC1I,CAEO,SAASK,mCAAmCD,QACjD,OAAON,UAAWM,OAA6CE,OACjE,CAEO,SAASC,gCAAgCC,SAC9C,OAAOV,UAAWU,QAA2CC,UAAYX,UAAWU,QAA2CE,WACjI,CAEO,SAASC,6BAA6BH,SAC3C,OAAOV,UAAWU,QAAwCI,UAC5D,CAEO,SAASC,6BACdC,UACAC,aACAC,WACAC,cACAlB,OACAC,UACAkB,WAGAJ,UAAU,GAAKf,OAAOoB,EAEtBL,UAAU,GAAKf,OAAOqB,EAEtBN,UAAU,GAAKf,OAAOsB,EAGtBN,aAAa,GAAKf,UAAUmB,EAE5BJ,aAAa,GAAKf,UAAUoB,EAE5BL,aAAa,GAAKf,UAAUqB,EAE5B,MAAMC,cAAyBC,KAAKC,IAAIV,UAAU,GAAKE,WAAW,IAAME,WAAaK,KAAKC,IAAIV,UAAU,GAAKE,WAAW,IAAME,WAAaK,KAAKC,IAAIV,UAAU,GAAKE,WAAW,IAAME,UAE9KO,iBACJF,KAAKC,IAAIT,aAAa,GAAKE,cAAc,IAAMC,WAAaK,KAAKC,IAAIT,aAAa,GAAKE,cAAc,IAAMC,WAAaK,KAAKC,IAAIT,aAAa,GAAKE,cAAc,IAAMC,UAEzK,IAAII,eAAkBG,iBAKtB,OAHAT,WAAWU,IAAIZ,WACfG,cAAcS,IAAIX,cAEX,CACLhB,OAAQ,IAAI4B,QAAQb,UAAU,GAAIA,UAAU,GAAIA,UAAU,IAC1Dd,UAAW,IAAI2B,QAAQZ,aAAa,GAAIA,aAAa,GAAIA,aAAa,IAE1E,CAEO,SAASa,mBAAmBC,IAAmBC,KAAoBC,SAA4Bb,WACpG,IAAIc,aAAaD,UAQjB,OANAF,IAAI,GAAKE,SAASZ,EAElBU,IAAI,GAAKE,SAASX,EAEOG,KAAKC,IAAIK,IAAI,GAAKC,KAAK,IAAMZ,WAAaK,KAAKC,IAAIK,IAAI,GAAKC,KAAK,IAAMZ,WAIhGY,KAAKJ,IAAIG,KAEF,CACLE,SAAU,IAAIE,QAAQJ,IAAI,GAAIA,IAAI,WALpC,CAOF"}
@@ -1 +1 @@
1
- {"version":3,"file":"AbstractIntersectionsWatcher.js","sources":["../../../src/Intersections/Watchers/AbstractIntersectionsWatcher.ts"],"sourcesContent":["import type { TAbstractWatcher } from '@hellpig/anarchy-engine/Abstract';\nimport { AbstractWatcher, WatcherType } from '@hellpig/anarchy-engine/Abstract';\nimport type { TActor } from '@hellpig/anarchy-engine/Actor';\nimport { intersectionsEntityToConfig } from '@hellpig/anarchy-engine/Intersections/Adapters';\nimport type {\n TAbstractIntersectionsWatcher,\n TAnyIntersectionsWatcher,\n TAnyIntersectionsWatcherConfig,\n TAnyIntersectionsWatcherParams,\n TIntersectionEvent,\n TIntersectionsLoop\n} from '@hellpig/anarchy-engine/Intersections/Models';\nimport type { TRawModel3d } from '@hellpig/anarchy-engine/Models3d';\nimport type { TWriteable } from '@hellpig/anarchy-shared/Utils';\nimport { isDefined, isNotDefined } from '@hellpig/anarchy-shared/Utils';\nimport type { Subscription } from 'rxjs';\nimport { Raycaster } from 'three';\n\nexport function AbstractIntersectionsWatcher({ isAutoStart, tags, name, intersectionsLoop, far, ...rest }: TAnyIntersectionsWatcherParams): TAbstractIntersectionsWatcher {\n const abstractWatcher: TAbstractWatcher<TIntersectionEvent> = AbstractWatcher<TIntersectionEvent>(WatcherType.IntersectionWatcher, name, tags);\n let raycaster: Raycaster | undefined = new Raycaster();\n const actors: Map<string, TActor> = new Map<string, TActor>();\n\n const addActors = (actorsList: ReadonlyArray<TActor> | ReadonlyMap<string, TActor>): void => actorsList.forEach(addActor);\n const addActor = (actor: TActor): void => {\n if (actors.has(actor.id))\n throw new Error(`[IntersectionsWatcher]: Cannot add actor to intersection watcher: Actor \"${actor.name} \"(id: \"${actor.id}\") already exists in the watcher \"${abstractWatcher.id}\"`);\n void actors.set(actor.id, actor);\n };\n\n const getActors = (): ReadonlyMap<string, TActor> => actors;\n const removeActors = (actors: ReadonlyArray<TActor> | ReadonlyMap<string, TActor>): void => actors.forEach(removeActor);\n const removeActorsByIds = (actorsIds: ReadonlyArray<string>): void => actorsIds.forEach(removeActorById);\n const removeActor = (actor: TActor): void => void actors.delete(actor.id);\n const removeActorById = (actorId: string): void => void actors.delete(actorId);\n\n const getIntersectionsLoop = (): TIntersectionsLoop => intersectionsLoop;\n\n function getModelsFromActors(): Array<TRawModel3d> {\n const models: TRawModel3d[] = [];\n // eslint-disable-next-line functional/no-loop-statements\n for (const actor of actors.values()) {\n // eslint-disable-next-line functional/immutable-data\n models.push(actor.model3d.getRawModel3d());\n }\n return models;\n }\n\n const destroySub$: Subscription = abstractWatcher.destroy$.subscribe((): void => {\n raycaster = null as any;\n actors.clear();\n\n destroySub$.unsubscribe();\n });\n\n // eslint-disable-next-line functional/immutable-data\n const result: TWriteable<TAbstractIntersectionsWatcher> = Object.assign(abstractWatcher, {\n addActor,\n addActors,\n getActors,\n getIntersectionsLoop,\n isAutoStart,\n isStarted: false,\n removeActor,\n removeActors,\n removeActorsByIds,\n removeActorById,\n raycaster,\n getModelsFromActors,\n setFar: (far: number): void => {\n if (isNotDefined(raycaster)) throw new Error('[IntersectionsWatcher]: Cannot set far: raycaster is not defined');\n // eslint-disable-next-line functional/immutable-data\n raycaster.far = far;\n },\n serialize: (): TAnyIntersectionsWatcherConfig => intersectionsEntityToConfig(result as TAnyIntersectionsWatcher)\n });\n\n // eslint-disable-next-line functional/immutable-data\n if (isDefined(far)) raycaster.far = far;\n if (rest.actors.length > 0) addActors(rest.actors);\n if (isAutoStart) result.enabled$.next(true);\n\n return result;\n}\n"],"names":["AbstractIntersectionsWatcher","isAutoStart","tags","name","intersectionsLoop","far","rest","abstractWatcher","AbstractWatcher","WatcherType","IntersectionWatcher","raycaster","Raycaster","actors","Map","addActors","actorsList","forEach","addActor","actor","has","id","Error","set","removeActor","delete","removeActorById","actorId","destroySub$","destroy$","subscribe","clear","unsubscribe","result","Object","assign","getActors","getIntersectionsLoop","isStarted","removeActors","removeActorsByIds","actorsIds","getModelsFromActors","models","values","push","model3d","getRawModel3d","setFar","isNotDefined","serialize","intersectionsEntityToConfig","isDefined","length","enabled$","next"],"mappings":"uUAkBO,SAASA,8BAA6BC,YAAEA,YAAAC,KAAaA,KAAAC,KAAMA,uBAAMC,kBAAAC,IAAmBA,OAAQC,OACjG,MAAMC,gBAAwDC,gBAAoCC,YAAYC,oBAAqBP,KAAMD,MACzI,IAAIS,UAAmC,IAAIC,UAC3C,MAAMC,WAAkCC,IAElCC,UAAaC,YAA0EA,WAAWC,QAAQC,UAC1GA,SAAYC,QAChB,GAAIN,OAAOO,IAAID,MAAME,IACnB,MAAM,IAAIC,MAAM,4EAA4EH,MAAMhB,eAAegB,MAAME,uCAAuCd,gBAAgBc,OAC3KR,OAAOU,IAAIJ,MAAME,GAAIF,QAMtBK,YAAeL,QAA6BN,OAAOY,OAAON,MAAME,KAChEK,gBAAmBC,UAA+Bd,OAAOY,OAAOE,UAchEC,YAA4BrB,gBAAgBsB,SAASC,UAAU,KACnEnB,UAAY,KACZE,OAAOkB,QAEPH,YAAYI,gBAIRC,OAAoDC,OAAOC,OAAO5B,gBAAiB,CACvFW,kBACAH,oBACAqB,UA7BgB,IAAmCvB,OA8BnDwB,qBAxB2B,IAA0BjC,kBAyBrDH,wBACAqC,WAAW,EACXd,wBACAe,aAjCoB1B,SAAsEA,QAAOI,QAAQO,aAkCzGgB,kBAjCyBC,WAA2CA,UAAUxB,QAAQS,iBAkCtFA,gCACAf,oBACA+B,oBA9BF,WACE,MAAMC,OAAwB,GAE9B,IAAA,MAAWxB,SAASN,OAAO+B,SAEzBD,OAAOE,KAAK1B,MAAM2B,QAAQC,iBAE5B,OAAOJ,MACT,EAuBEK,OAAS3C,OACP,GAAI4C,aAAatC,WAAY,MAAM,IAAIW,MAAM,oEAE7CX,UAAUN,IAAMA,MAElB6C,UAAW,IAAsCC,4BAA4BlB,UAQ/E,OAJImB,UAAU/C,OAAMM,UAAUN,IAAMA,KAChCC,KAAKO,OAAOwC,OAAS,GAAGtC,UAAUT,KAAKO,QACvCZ,aAAagC,OAAOqB,SAASC,MAAK,GAE/BtB,MACT"}
1
+ {"version":3,"file":"AbstractIntersectionsWatcher.js","sources":["../../../src/Intersections/Watchers/AbstractIntersectionsWatcher.ts"],"sourcesContent":["import type { TAbstractWatcher } from '@Anarchy/Engine/Abstract';\nimport { AbstractWatcher, WatcherType } from '@Anarchy/Engine/Abstract';\nimport type { TActor } from '@Anarchy/Engine/Actor';\nimport { intersectionsEntityToConfig } from '@Anarchy/Engine/Intersections/Adapters';\nimport type {\n TAbstractIntersectionsWatcher,\n TAnyIntersectionsWatcher,\n TAnyIntersectionsWatcherConfig,\n TAnyIntersectionsWatcherParams,\n TIntersectionEvent,\n TIntersectionsLoop\n} from '@Anarchy/Engine/Intersections/Models';\nimport type { TRawModel3d } from '@Anarchy/Engine/Models3d';\nimport type { TWriteable } from '@hellpig/anarchy-shared/Utils';\nimport { isDefined, isNotDefined } from '@hellpig/anarchy-shared/Utils';\nimport type { Subscription } from 'rxjs';\nimport { Raycaster } from 'three';\n\nexport function AbstractIntersectionsWatcher({ isAutoStart, tags, name, intersectionsLoop, far, ...rest }: TAnyIntersectionsWatcherParams): TAbstractIntersectionsWatcher {\n const abstractWatcher: TAbstractWatcher<TIntersectionEvent> = AbstractWatcher<TIntersectionEvent>(WatcherType.IntersectionWatcher, name, tags);\n let raycaster: Raycaster | undefined = new Raycaster();\n const actors: Map<string, TActor> = new Map<string, TActor>();\n\n const addActors = (actorsList: ReadonlyArray<TActor> | ReadonlyMap<string, TActor>): void => actorsList.forEach(addActor);\n const addActor = (actor: TActor): void => {\n if (actors.has(actor.id))\n throw new Error(`[IntersectionsWatcher]: Cannot add actor to intersection watcher: Actor \"${actor.name} \"(id: \"${actor.id}\") already exists in the watcher \"${abstractWatcher.id}\"`);\n void actors.set(actor.id, actor);\n };\n\n const getActors = (): ReadonlyMap<string, TActor> => actors;\n const removeActors = (actors: ReadonlyArray<TActor> | ReadonlyMap<string, TActor>): void => actors.forEach(removeActor);\n const removeActorsByIds = (actorsIds: ReadonlyArray<string>): void => actorsIds.forEach(removeActorById);\n const removeActor = (actor: TActor): void => void actors.delete(actor.id);\n const removeActorById = (actorId: string): void => void actors.delete(actorId);\n\n const getIntersectionsLoop = (): TIntersectionsLoop => intersectionsLoop;\n\n function getModelsFromActors(): Array<TRawModel3d> {\n const models: TRawModel3d[] = [];\n // eslint-disable-next-line functional/no-loop-statements\n for (const actor of actors.values()) {\n // eslint-disable-next-line functional/immutable-data\n models.push(actor.model3d.getRawModel3d());\n }\n return models;\n }\n\n const destroySub$: Subscription = abstractWatcher.destroy$.subscribe((): void => {\n raycaster = null as any;\n actors.clear();\n\n destroySub$.unsubscribe();\n });\n\n // eslint-disable-next-line functional/immutable-data\n const result: TWriteable<TAbstractIntersectionsWatcher> = Object.assign(abstractWatcher, {\n addActor,\n addActors,\n getActors,\n getIntersectionsLoop,\n isAutoStart,\n isStarted: false,\n removeActor,\n removeActors,\n removeActorsByIds,\n removeActorById,\n raycaster,\n getModelsFromActors,\n setFar: (far: number): void => {\n if (isNotDefined(raycaster)) throw new Error('[IntersectionsWatcher]: Cannot set far: raycaster is not defined');\n // eslint-disable-next-line functional/immutable-data\n raycaster.far = far;\n },\n serialize: (): TAnyIntersectionsWatcherConfig => intersectionsEntityToConfig(result as TAnyIntersectionsWatcher)\n });\n\n // eslint-disable-next-line functional/immutable-data\n if (isDefined(far)) raycaster.far = far;\n if (rest.actors.length > 0) addActors(rest.actors);\n if (isAutoStart) result.enabled$.next(true);\n\n return result;\n}\n"],"names":["AbstractIntersectionsWatcher","isAutoStart","tags","name","intersectionsLoop","far","rest","abstractWatcher","AbstractWatcher","WatcherType","IntersectionWatcher","raycaster","Raycaster","actors","Map","addActors","actorsList","forEach","addActor","actor","has","id","Error","set","removeActor","delete","removeActorById","actorId","destroySub$","destroy$","subscribe","clear","unsubscribe","result","Object","assign","getActors","getIntersectionsLoop","isStarted","removeActors","removeActorsByIds","actorsIds","getModelsFromActors","models","values","push","model3d","getRawModel3d","setFar","isNotDefined","serialize","intersectionsEntityToConfig","isDefined","length","enabled$","next"],"mappings":"uUAkBO,SAASA,8BAA6BC,YAAEA,YAAAC,KAAaA,KAAAC,KAAMA,uBAAMC,kBAAAC,IAAmBA,OAAQC,OACjG,MAAMC,gBAAwDC,gBAAoCC,YAAYC,oBAAqBP,KAAMD,MACzI,IAAIS,UAAmC,IAAIC,UAC3C,MAAMC,WAAkCC,IAElCC,UAAaC,YAA0EA,WAAWC,QAAQC,UAC1GA,SAAYC,QAChB,GAAIN,OAAOO,IAAID,MAAME,IACnB,MAAM,IAAIC,MAAM,4EAA4EH,MAAMhB,eAAegB,MAAME,uCAAuCd,gBAAgBc,OAC3KR,OAAOU,IAAIJ,MAAME,GAAIF,QAMtBK,YAAeL,QAA6BN,OAAOY,OAAON,MAAME,KAChEK,gBAAmBC,UAA+Bd,OAAOY,OAAOE,UAchEC,YAA4BrB,gBAAgBsB,SAASC,UAAU,KACnEnB,UAAY,KACZE,OAAOkB,QAEPH,YAAYI,gBAIRC,OAAoDC,OAAOC,OAAO5B,gBAAiB,CACvFW,kBACAH,oBACAqB,UA7BgB,IAAmCvB,OA8BnDwB,qBAxB2B,IAA0BjC,kBAyBrDH,wBACAqC,WAAW,EACXd,wBACAe,aAjCoB1B,SAAsEA,QAAOI,QAAQO,aAkCzGgB,kBAjCyBC,WAA2CA,UAAUxB,QAAQS,iBAkCtFA,gCACAf,oBACA+B,oBA9BF,WACE,MAAMC,OAAwB,GAE9B,IAAA,MAAWxB,SAASN,OAAO+B,SAEzBD,OAAOE,KAAK1B,MAAM2B,QAAQC,iBAE5B,OAAOJ,MACT,EAuBEK,OAAS3C,OACP,GAAI4C,aAAatC,WAAY,MAAM,IAAIW,MAAM,oEAE7CX,UAAUN,IAAMA,MAElB6C,UAAW,IAAsCC,4BAA4BlB,UAQ/E,OAJImB,UAAU/C,OAAMM,UAAUN,IAAMA,KAChCC,KAAKO,OAAOwC,OAAS,GAAGtC,UAAUT,KAAKO,QACvCZ,aAAagC,OAAOqB,SAASC,MAAK,GAE/BtB,MACT"}
@@ -1 +1 @@
1
- {"version":3,"file":"IntersectionsCameraWatcher.js","sources":["../../../src/Intersections/Watchers/IntersectionsCameraWatcher.ts"],"sourcesContent":["import type { TAnyCameraWrapper } from '@hellpig/anarchy-engine/Camera';\nimport type {\n TAbstractIntersectionsWatcher,\n TIntersectionEvent,\n TIntersectionsCameraWatcher,\n TIntersectionsCameraWatcherParams,\n TIntersectionsWatcherPerformanceOptions\n} from '@hellpig/anarchy-engine/Intersections/Models';\nimport { getChangedPosition } from '@hellpig/anarchy-engine/Intersections/Utils';\nimport { AbstractIntersectionsWatcher } from '@hellpig/anarchy-engine/Intersections/Watchers/AbstractIntersectionsWatcher';\nimport type { TMilliseconds } from '@hellpig/anarchy-engine/Math';\nimport type { TSceneObject } from '@hellpig/anarchy-engine/Scene';\nimport type { TReadonlyVector2 } from '@hellpig/anarchy-engine/ThreeLib';\nimport type { TWriteable } from '@hellpig/anarchy-shared/Utils';\nimport { isDefined, isNotDefined } from '@hellpig/anarchy-shared/Utils';\nimport type { Observable, Subscription } from 'rxjs';\nimport { distinctUntilChanged, EMPTY, filter, map, switchMap } from 'rxjs';\nimport type { Vector2Like } from 'three';\nimport { Vector2 } from 'three';\n\nexport function IntersectionsCameraWatcher(params: TIntersectionsCameraWatcherParams): TIntersectionsCameraWatcher {\n const { position$, performance, intersectionsLoop } = params;\n const abstractIntersectionsWatcher: TAbstractIntersectionsWatcher = AbstractIntersectionsWatcher(params);\n let camera: Readonly<TAnyCameraWrapper> | undefined;\n\n const setCamera = (c: TAnyCameraWrapper): void => void (camera = c);\n const findCamera = (): TAnyCameraWrapper | undefined => camera;\n const getCamera = (): TAnyCameraWrapper | never => {\n if (isNotDefined(camera)) throw new Error('[IntersectionsWatcher]: Cannot get camera: not defined');\n return camera;\n };\n\n let position: TReadonlyVector2 = new Vector2();\n const positionSub$: Subscription = position$.subscribe((value: Vector2Like): Vector2 => (position = new Vector2().copy(value)));\n\n const threshold: number = performance?.noiseThreshold ?? 0.001;\n // shouldReactOnlyOnChange might improve performance, however, won't fire an event if the mouse (position$) is not moving (and actor or scene is moving)\n const shouldReactOnlyOnChange: boolean = performance?.shouldReactOnlyOnChange ?? false;\n\n const tmpPosition = new Float32Array(2);\n const prevPosition = new Float32Array(2);\n let isPrevValueUndefined: boolean = true;\n\n const enabledSub$: Subscription = abstractIntersectionsWatcher.enabled$\n .pipe(\n distinctUntilChanged(),\n switchMap((isEnabled: boolean): Observable<TMilliseconds | never> => (isEnabled ? intersectionsLoop.tick$ : EMPTY)),\n map(\n ():\n | Readonly<{\n position: TReadonlyVector2;\n }>\n | undefined => (shouldReactOnlyOnChange ? getChangedPosition(tmpPosition, prevPosition, position, threshold) : { position })\n ),\n filter(isDefined)\n )\n .subscribe(({ position }: Readonly<{ position: TReadonlyVector2 }>): void => {\n if (isNotDefined(camera)) {\n enabledSub$.unsubscribe();\n throw new Error('[IntersectionsWatcher]: Cannot start: camera is not defined');\n }\n\n const intersection: TIntersectionEvent | undefined = getIntersection(position as Vector2, camera, abstractIntersectionsWatcher.getModelsFromActors());\n if (isDefined(intersection)) {\n if (!params.isDistinct || (params.isDistinct && isPrevValueUndefined)) {\n abstractIntersectionsWatcher.value$.next(intersection);\n isPrevValueUndefined = false;\n }\n } else if (params.triggerNoIntersections) {\n if (!params.isDistinct || (params.isDistinct && !isPrevValueUndefined)) {\n abstractIntersectionsWatcher.value$.next(undefined);\n isPrevValueUndefined = true;\n }\n }\n });\n\n function getIntersection(coords: Vector2, cameraWrapper: Readonly<TAnyCameraWrapper>, list: Array<TSceneObject>): TIntersectionEvent | undefined | never {\n if (isNotDefined(abstractIntersectionsWatcher.raycaster)) throw new Error('[IntersectionsWatcher]: Cannot get intersection: raycaster is not defined');\n abstractIntersectionsWatcher.raycaster.setFromCamera(coords, cameraWrapper.entity);\n return abstractIntersectionsWatcher.raycaster.intersectObjects(list)[0];\n }\n\n const destroySub$: Subscription = abstractIntersectionsWatcher.destroy$.subscribe((): void => {\n positionSub$?.unsubscribe();\n enabledSub$.unsubscribe();\n destroySub$.unsubscribe();\n });\n\n // eslint-disable-next-line functional/immutable-data\n const result: TWriteable<TIntersectionsCameraWatcher> = Object.assign(abstractIntersectionsWatcher, {\n findCamera,\n getCamera,\n setCamera,\n getPerformanceSettings: (): TIntersectionsWatcherPerformanceOptions => ({\n noiseThreshold: threshold,\n shouldReactOnlyOnChange\n })\n });\n\n setCamera(params.camera);\n\n return result;\n}\n"],"names":["IntersectionsCameraWatcher","params","position$","performance","intersectionsLoop","abstractIntersectionsWatcher","AbstractIntersectionsWatcher","camera","setCamera","c","position","Vector2","positionSub$","subscribe","value","copy","threshold","noiseThreshold","shouldReactOnlyOnChange","tmpPosition","Float32Array","prevPosition","isPrevValueUndefined","enabledSub$","enabled$","pipe","distinctUntilChanged","switchMap","isEnabled","tick$","EMPTY","map","getChangedPosition","filter","isDefined","isNotDefined","unsubscribe","Error","intersection","coords","cameraWrapper","list","raycaster","setFromCamera","entity","intersectObjects","getIntersection","getModelsFromActors","isDistinct","value$","next","triggerNoIntersections","destroySub$","destroy$","result","Object","assign","findCamera","getCamera","getPerformanceSettings"],"mappings":"isBAoBO,SAASA,2BAA2BC,QACzC,MAAMC,UAAEA,UAAAC,YAAWA,YAAAC,kBAAaA,mBAAsBH,OAChDI,6BAA8DC,6BAA6BL,QACjG,IAAIM,OAEJ,MAAMC,UAAaC,IAAqCF,OAASE,GAOjE,IAAIC,SAA6B,IAAIC,QACrC,MAAMC,aAA6BV,UAAUW,UAAWC,OAAiCJ,UAAW,IAAIC,SAAUI,KAAKD,QAEjHE,UAAoBb,aAAac,gBAAkB,KAEnDC,wBAAmCf,aAAae,0BAA2B,EAE3EC,YAAc,IAAIC,aAAa,GAC/BC,aAAe,IAAID,aAAa,GACtC,IAAIE,sBAAgC,EAEpC,MAAMC,YAA4BlB,6BAA6BmB,SAC5DC,KACCC,uBACAC,UAAWC,WAA2DA,UAAYxB,kBAAkByB,MAAQC,OAC5GC,IACE,IAIkBb,wBAA0Bc,mBAAmBb,YAAaE,aAAcX,SAAUM,WAAa,CAAEN,oBAErHuB,OAAOC,YAERrB,UAAU,EAAGH,SAAAA,cACZ,GAAIyB,aAAa5B,QAEf,MADAgB,YAAYa,cACN,IAAIC,MAAM,+DAGlB,MAAMC,aAcV,SAAyBC,OAAiBC,cAA4CC,MACpF,GAAIN,aAAa9B,6BAA6BqC,WAAY,MAAM,IAAIL,MAAM,6EAE1E,OADAhC,6BAA6BqC,UAAUC,cAAcJ,OAAQC,cAAcI,QACpEvC,6BAA6BqC,UAAUG,iBAAiBJ,MAAM,EACvE,CAlByDK,CAAgBpC,UAAqBH,OAAQF,6BAA6B0C,uBAC3Hb,UAAUI,gBACPrC,OAAO+C,YAAe/C,OAAO+C,YAAc1B,wBAC9CjB,6BAA6B4C,OAAOC,KAAKZ,cACzChB,sBAAuB,GAEhBrB,OAAOkD,0BACXlD,OAAO+C,YAAe/C,OAAO+C,aAAe1B,wBAC/CjB,6BAA6B4C,OAAOC,aACpC5B,sBAAuB,KAWzB8B,YAA4B/C,6BAA6BgD,SAASxC,UAAU,KAChFD,cAAcwB,cACdb,YAAYa,cACZgB,YAAYhB,gBAIRkB,OAAkDC,OAAOC,OAAOnD,6BAA8B,CAClGoD,WAhEiB,IAAqClD,OAiEtDmD,UAhEgB,KAChB,GAAIvB,aAAa5B,QAAS,MAAM,IAAI8B,MAAM,0DAC1C,OAAO9B,QA+DPC,oBACAmD,uBAAwB,KAAA,CACtB1C,eAAgBD,UAChBE,oDAMJ,OAFAV,UAAUP,OAAOM,QAEV+C,MACT"}
1
+ {"version":3,"file":"IntersectionsCameraWatcher.js","sources":["../../../src/Intersections/Watchers/IntersectionsCameraWatcher.ts"],"sourcesContent":["import type { TAnyCameraWrapper } from '@Anarchy/Engine/Camera';\nimport type {\n TAbstractIntersectionsWatcher,\n TIntersectionEvent,\n TIntersectionsCameraWatcher,\n TIntersectionsCameraWatcherParams,\n TIntersectionsWatcherPerformanceOptions\n} from '@Anarchy/Engine/Intersections/Models';\nimport { getChangedPosition } from '@Anarchy/Engine/Intersections/Utils';\nimport { AbstractIntersectionsWatcher } from '@Anarchy/Engine/Intersections/Watchers/AbstractIntersectionsWatcher';\nimport type { TMilliseconds } from '@Anarchy/Engine/Math';\nimport type { TSceneObject } from '@Anarchy/Engine/Scene';\nimport type { TReadonlyVector2 } from '@Anarchy/Engine/ThreeLib';\nimport type { TWriteable } from '@hellpig/anarchy-shared/Utils';\nimport { isDefined, isNotDefined } from '@hellpig/anarchy-shared/Utils';\nimport type { Observable, Subscription } from 'rxjs';\nimport { distinctUntilChanged, EMPTY, filter, map, switchMap } from 'rxjs';\nimport type { Vector2Like } from 'three';\nimport { Vector2 } from 'three';\n\nexport function IntersectionsCameraWatcher(params: TIntersectionsCameraWatcherParams): TIntersectionsCameraWatcher {\n const { position$, performance, intersectionsLoop } = params;\n const abstractIntersectionsWatcher: TAbstractIntersectionsWatcher = AbstractIntersectionsWatcher(params);\n let camera: Readonly<TAnyCameraWrapper> | undefined;\n\n const setCamera = (c: TAnyCameraWrapper): void => void (camera = c);\n const findCamera = (): TAnyCameraWrapper | undefined => camera;\n const getCamera = (): TAnyCameraWrapper | never => {\n if (isNotDefined(camera)) throw new Error('[IntersectionsWatcher]: Cannot get camera: not defined');\n return camera;\n };\n\n let position: TReadonlyVector2 = new Vector2();\n const positionSub$: Subscription = position$.subscribe((value: Vector2Like): Vector2 => (position = new Vector2().copy(value)));\n\n const threshold: number = performance?.noiseThreshold ?? 0.001;\n // shouldReactOnlyOnChange might improve performance, however, won't fire an event if the mouse (position$) is not moving (and actor or scene is moving)\n const shouldReactOnlyOnChange: boolean = performance?.shouldReactOnlyOnChange ?? false;\n\n const tmpPosition = new Float32Array(2);\n const prevPosition = new Float32Array(2);\n let isPrevValueUndefined: boolean = true;\n\n const enabledSub$: Subscription = abstractIntersectionsWatcher.enabled$\n .pipe(\n distinctUntilChanged(),\n switchMap((isEnabled: boolean): Observable<TMilliseconds | never> => (isEnabled ? intersectionsLoop.tick$ : EMPTY)),\n map(\n ():\n | Readonly<{\n position: TReadonlyVector2;\n }>\n | undefined => (shouldReactOnlyOnChange ? getChangedPosition(tmpPosition, prevPosition, position, threshold) : { position })\n ),\n filter(isDefined)\n )\n .subscribe(({ position }: Readonly<{ position: TReadonlyVector2 }>): void => {\n if (isNotDefined(camera)) {\n enabledSub$.unsubscribe();\n throw new Error('[IntersectionsWatcher]: Cannot start: camera is not defined');\n }\n\n const intersection: TIntersectionEvent | undefined = getIntersection(position as Vector2, camera, abstractIntersectionsWatcher.getModelsFromActors());\n if (isDefined(intersection)) {\n if (!params.isDistinct || (params.isDistinct && isPrevValueUndefined)) {\n abstractIntersectionsWatcher.value$.next(intersection);\n isPrevValueUndefined = false;\n }\n } else if (params.triggerNoIntersections) {\n if (!params.isDistinct || (params.isDistinct && !isPrevValueUndefined)) {\n abstractIntersectionsWatcher.value$.next(undefined);\n isPrevValueUndefined = true;\n }\n }\n });\n\n function getIntersection(coords: Vector2, cameraWrapper: Readonly<TAnyCameraWrapper>, list: Array<TSceneObject>): TIntersectionEvent | undefined | never {\n if (isNotDefined(abstractIntersectionsWatcher.raycaster)) throw new Error('[IntersectionsWatcher]: Cannot get intersection: raycaster is not defined');\n abstractIntersectionsWatcher.raycaster.setFromCamera(coords, cameraWrapper.entity);\n return abstractIntersectionsWatcher.raycaster.intersectObjects(list)[0];\n }\n\n const destroySub$: Subscription = abstractIntersectionsWatcher.destroy$.subscribe((): void => {\n positionSub$?.unsubscribe();\n enabledSub$.unsubscribe();\n destroySub$.unsubscribe();\n });\n\n // eslint-disable-next-line functional/immutable-data\n const result: TWriteable<TIntersectionsCameraWatcher> = Object.assign(abstractIntersectionsWatcher, {\n findCamera,\n getCamera,\n setCamera,\n getPerformanceSettings: (): TIntersectionsWatcherPerformanceOptions => ({\n noiseThreshold: threshold,\n shouldReactOnlyOnChange\n })\n });\n\n setCamera(params.camera);\n\n return result;\n}\n"],"names":["IntersectionsCameraWatcher","params","position$","performance","intersectionsLoop","abstractIntersectionsWatcher","AbstractIntersectionsWatcher","camera","setCamera","c","position","Vector2","positionSub$","subscribe","value","copy","threshold","noiseThreshold","shouldReactOnlyOnChange","tmpPosition","Float32Array","prevPosition","isPrevValueUndefined","enabledSub$","enabled$","pipe","distinctUntilChanged","switchMap","isEnabled","tick$","EMPTY","map","getChangedPosition","filter","isDefined","isNotDefined","unsubscribe","Error","intersection","coords","cameraWrapper","list","raycaster","setFromCamera","entity","intersectObjects","getIntersection","getModelsFromActors","isDistinct","value$","next","triggerNoIntersections","destroySub$","destroy$","result","Object","assign","findCamera","getCamera","getPerformanceSettings"],"mappings":"isBAoBO,SAASA,2BAA2BC,QACzC,MAAMC,UAAEA,UAAAC,YAAWA,YAAAC,kBAAaA,mBAAsBH,OAChDI,6BAA8DC,6BAA6BL,QACjG,IAAIM,OAEJ,MAAMC,UAAaC,IAAqCF,OAASE,GAOjE,IAAIC,SAA6B,IAAIC,QACrC,MAAMC,aAA6BV,UAAUW,UAAWC,OAAiCJ,UAAW,IAAIC,SAAUI,KAAKD,QAEjHE,UAAoBb,aAAac,gBAAkB,KAEnDC,wBAAmCf,aAAae,0BAA2B,EAE3EC,YAAc,IAAIC,aAAa,GAC/BC,aAAe,IAAID,aAAa,GACtC,IAAIE,sBAAgC,EAEpC,MAAMC,YAA4BlB,6BAA6BmB,SAC5DC,KACCC,uBACAC,UAAWC,WAA2DA,UAAYxB,kBAAkByB,MAAQC,OAC5GC,IACE,IAIkBb,wBAA0Bc,mBAAmBb,YAAaE,aAAcX,SAAUM,WAAa,CAAEN,oBAErHuB,OAAOC,YAERrB,UAAU,EAAGH,SAAAA,cACZ,GAAIyB,aAAa5B,QAEf,MADAgB,YAAYa,cACN,IAAIC,MAAM,+DAGlB,MAAMC,aAcV,SAAyBC,OAAiBC,cAA4CC,MACpF,GAAIN,aAAa9B,6BAA6BqC,WAAY,MAAM,IAAIL,MAAM,6EAE1E,OADAhC,6BAA6BqC,UAAUC,cAAcJ,OAAQC,cAAcI,QACpEvC,6BAA6BqC,UAAUG,iBAAiBJ,MAAM,EACvE,CAlByDK,CAAgBpC,UAAqBH,OAAQF,6BAA6B0C,uBAC3Hb,UAAUI,gBACPrC,OAAO+C,YAAe/C,OAAO+C,YAAc1B,wBAC9CjB,6BAA6B4C,OAAOC,KAAKZ,cACzChB,sBAAuB,GAEhBrB,OAAOkD,0BACXlD,OAAO+C,YAAe/C,OAAO+C,aAAe1B,wBAC/CjB,6BAA6B4C,OAAOC,aACpC5B,sBAAuB,KAWzB8B,YAA4B/C,6BAA6BgD,SAASxC,UAAU,KAChFD,cAAcwB,cACdb,YAAYa,cACZgB,YAAYhB,gBAIRkB,OAAkDC,OAAOC,OAAOnD,6BAA8B,CAClGoD,WAhEiB,IAAqClD,OAiEtDmD,UAhEgB,KAChB,GAAIvB,aAAa5B,QAAS,MAAM,IAAI8B,MAAM,0DAC1C,OAAO9B,QA+DPC,oBACAmD,uBAAwB,KAAA,CACtB1C,eAAgBD,UAChBE,oDAMJ,OAFAV,UAAUP,OAAOM,QAEV+C,MACT"}
@@ -1 +1 @@
1
- {"version":3,"file":"IntersectionsDirectionWatcher.js","sources":["../../../src/Intersections/Watchers/IntersectionsDirectionWatcher.ts"],"sourcesContent":["import type { TContainerDecorator } from '@hellpig/anarchy-engine/Global';\nimport type {\n TAbstractIntersectionsWatcher,\n TIntersectionEvent,\n TIntersectionsDirectionWatcher,\n TIntersectionsDirectionWatcherParams,\n TIntersectionsWatcherPerformanceOptions\n} from '@hellpig/anarchy-engine/Intersections/Models';\nimport { getChangedOriginAndDirection } from '@hellpig/anarchy-engine/Intersections/Utils';\nimport { AbstractIntersectionsWatcher } from '@hellpig/anarchy-engine/Intersections/Watchers/AbstractIntersectionsWatcher';\nimport type { TMilliseconds } from '@hellpig/anarchy-engine/Math';\nimport type { TSceneObject } from '@hellpig/anarchy-engine/Scene';\nimport type { TReadonlyVector3 } from '@hellpig/anarchy-engine/ThreeLib';\nimport { isDefined, isNotDefined } from '@hellpig/anarchy-shared/Utils';\nimport type { Observable, Subscription } from 'rxjs';\nimport { BehaviorSubject, distinctUntilChanged, EMPTY, filter, map, switchMap } from 'rxjs';\nimport type { ColorRepresentation, Vector3Like } from 'three';\nimport { Vector3 } from 'three';\nimport { Line2 } from 'three/examples/jsm/lines/Line2';\nimport { LineGeometry } from 'three/examples/jsm/lines/LineGeometry';\nimport { LineMaterial } from 'three/examples/jsm/lines/LineMaterial';\n\nexport function IntersectionsDirectionWatcher(params: TIntersectionsDirectionWatcherParams): TIntersectionsDirectionWatcher {\n const { performance, intersectionsLoop } = params;\n const abstractIntersectionsWatcher: TAbstractIntersectionsWatcher = AbstractIntersectionsWatcher(params);\n\n const origin$: BehaviorSubject<TReadonlyVector3> = new BehaviorSubject<TReadonlyVector3>(new Vector3().copy(params.origin));\n const direction$: BehaviorSubject<TReadonlyVector3> = new BehaviorSubject<TReadonlyVector3>(new Vector3().copy(params.direction));\n\n const threshold: number = performance?.noiseThreshold ?? 0.001;\n // shouldReactOnlyOnChange might improve performance, however, won't fire an event if the mouse (position$) is not moving (and actor or scene is moving)\n const shouldReactOnlyOnChange: boolean = performance?.shouldReactOnlyOnChange ?? false;\n\n const tmpOrigin = new Float32Array(3);\n const prevOrigin = new Float32Array(3);\n const tmpDirection = new Float32Array(3);\n const prevDirection = new Float32Array(3);\n\n const enabledSub$: Subscription = abstractIntersectionsWatcher.enabled$\n .pipe(\n distinctUntilChanged(),\n switchMap((isEnabled: boolean): Observable<TMilliseconds | never> => (isEnabled ? intersectionsLoop.tick$ : EMPTY)),\n map((): Readonly<{ origin: TReadonlyVector3; direction: TReadonlyVector3 }> | undefined =>\n shouldReactOnlyOnChange\n ? getChangedOriginAndDirection(tmpOrigin, tmpDirection, prevOrigin, prevDirection, origin$.value.clone(), direction$.value.clone(), threshold)\n : { origin: origin$.value.clone(), direction: direction$.value.clone() }\n ),\n filter(isDefined)\n )\n .subscribe(({ origin, direction }: Readonly<{ origin: TReadonlyVector3; direction: TReadonlyVector3 }>): void => {\n const intersection: TIntersectionEvent | undefined = getIntersection(origin as Vector3, direction as Vector3, abstractIntersectionsWatcher.getModelsFromActors());\n if (isDefined(intersection)) abstractIntersectionsWatcher.value$.next(intersection);\n });\n\n function getIntersection(origin: Vector3, direction: Vector3, list: Array<TSceneObject>): TIntersectionEvent | undefined | never {\n if (isNotDefined(abstractIntersectionsWatcher.raycaster)) throw new Error('[IntersectionsDirectionWatcher]: Cannot get intersection: raycaster is not defined');\n abstractIntersectionsWatcher.raycaster.set(origin, direction.normalize());\n return abstractIntersectionsWatcher.raycaster.intersectObjects(list)[0];\n }\n\n function getDistanceToTargetPoint(origin: Vector3Like, target: Vector3Like): number {\n return new Vector3(target.x - origin.x, target.y - origin.y, target.z - origin.z).length();\n }\n\n function targetPointToDirection(origin: Vector3Like, target: Vector3Like): TReadonlyVector3 {\n return new Vector3(target.x - origin.x, target.y - origin.y, target.z - origin.z).normalize();\n }\n\n function _debugGetRayVisualizationLine(container: TContainerDecorator, length: number = 100, color: ColorRepresentation = 0xff0000, lineWidth: number = 1): Line2 {\n const points: Array<number> = [\n origin$.value.x,\n origin$.value.y,\n origin$.value.z,\n origin$.value.x + direction$.value.x * length,\n origin$.value.y + direction$.value.y * length,\n origin$.value.z + direction$.value.z * length\n ];\n\n const geometry = new LineGeometry();\n geometry.setPositions(points);\n\n const material = new LineMaterial({\n color,\n linewidth: lineWidth,\n dashed: false,\n transparent: true\n });\n\n material.resolution.set(container.getWidth(), container.getHeight());\n\n const line = new Line2(geometry, material);\n line.computeLineDistances();\n // eslint-disable-next-line functional/immutable-data\n line.name = 'RayDebugLine2';\n\n return line;\n }\n\n const destroySub$: Subscription = abstractIntersectionsWatcher.destroy$.subscribe((): void => {\n enabledSub$.unsubscribe();\n destroySub$.unsubscribe();\n });\n\n // eslint-disable-next-line functional/immutable-data\n return Object.assign(abstractIntersectionsWatcher, {\n origin$,\n direction$,\n targetPointToDirection,\n getDistanceToTargetPoint,\n getPerformanceSettings: (): TIntersectionsWatcherPerformanceOptions => ({\n noiseThreshold: threshold,\n shouldReactOnlyOnChange\n }),\n _debugGetRayVisualizationLine\n });\n}\n"],"names":["IntersectionsDirectionWatcher","params","performance","intersectionsLoop","abstractIntersectionsWatcher","AbstractIntersectionsWatcher","origin$","BehaviorSubject","Vector3","copy","origin","direction$","direction","threshold","noiseThreshold","shouldReactOnlyOnChange","tmpOrigin","Float32Array","prevOrigin","tmpDirection","prevDirection","enabledSub$","enabled$","pipe","distinctUntilChanged","switchMap","isEnabled","tick$","EMPTY","map","getChangedOriginAndDirection","value","clone","filter","isDefined","subscribe","intersection","list","isNotDefined","raycaster","Error","set","normalize","intersectObjects","getIntersection","getModelsFromActors","value$","next","destroySub$","destroy$","unsubscribe","Object","assign","targetPointToDirection","target","x","y","z","getDistanceToTargetPoint","length","getPerformanceSettings","_debugGetRayVisualizationLine","container","color","lineWidth","points","geometry","LineGeometry","setPositions","material","LineMaterial","linewidth","dashed","transparent","resolution","getWidth","getHeight","line","Line2","computeLineDistances","name"],"mappings":"w9BAsBO,SAASA,8BAA8BC,QAC5C,MAAMC,YAAEA,YAAAC,kBAAaA,mBAAsBF,OACrCG,6BAA8DC,6BAA6BJ,QAE3FK,QAA6C,IAAIC,iBAAkC,IAAIC,SAAUC,KAAKR,OAAOS,SAC7GC,WAAgD,IAAIJ,iBAAkC,IAAIC,SAAUC,KAAKR,OAAOW,YAEhHC,UAAoBX,aAAaY,gBAAkB,KAEnDC,wBAAmCb,aAAaa,0BAA2B,EAE3EC,UAAY,IAAIC,aAAa,GAC7BC,WAAa,IAAID,aAAa,GAC9BE,aAAe,IAAIF,aAAa,GAChCG,cAAgB,IAAIH,aAAa,GAEjCI,YAA4BjB,6BAA6BkB,SAC5DC,KACCC,uBACAC,UAAWC,WAA2DA,UAAYvB,kBAAkBwB,MAAQC,OAC5GC,IAAI,IACFd,wBACIe,6BAA6Bd,UAAWG,aAAcD,WAAYE,cAAed,QAAQyB,MAAMC,QAASrB,WAAWoB,MAAMC,QAASnB,WAClI,CAAEH,OAAQJ,QAAQyB,MAAMC,QAASpB,UAAWD,WAAWoB,MAAMC,UAEnEC,OAAOC,YAERC,UAAU,EAAGzB,cAAQE,wBACpB,MAAMwB,aAIV,SAAyB1B,OAAiBE,UAAoByB,MAC5D,GAAIC,aAAalC,6BAA6BmC,WAAY,MAAM,IAAIC,MAAM,sFAE1E,OADApC,6BAA6BmC,UAAUE,IAAI/B,OAAQE,UAAU8B,aACtDtC,6BAA6BmC,UAAUI,iBAAiBN,MAAM,EACvE,CARyDO,CAAgBlC,OAAmBE,UAAsBR,6BAA6ByC,uBACvIX,UAAUE,eAAehC,6BAA6B0C,OAAOC,KAAKX,gBA+CpEY,YAA4B5C,6BAA6B6C,SAASd,UAAU,KAChFd,YAAY6B,cACZF,YAAYE,gBAId,OAAOC,OAAOC,OAAOhD,6BAA8B,CACjDE,gBACAK,sBACA0C,uBA3CF,SAAgC3C,OAAqB4C,QACnD,OAAO,IAAI9C,QAAQ8C,OAAOC,EAAI7C,OAAO6C,EAAGD,OAAOE,EAAI9C,OAAO8C,EAAGF,OAAOG,EAAI/C,OAAO+C,GAAGf,WACpF,EA0CEgB,yBAhDF,SAAkChD,OAAqB4C,QACrD,OAAO,IAAI9C,QAAQ8C,OAAOC,EAAI7C,OAAO6C,EAAGD,OAAOE,EAAI9C,OAAO8C,EAAGF,OAAOG,EAAI/C,OAAO+C,GAAGE,QACpF,EA+CEC,uBAAwB,KAAA,CACtB9C,eAAgBD,UAChBE,kDAEF8C,8BA7CF,SAAuCC,UAAgCH,OAAiB,IAAKI,MAA6B,SAAUC,UAAoB,GACtJ,MAAMC,OAAwB,CAC5B3D,QAAQyB,MAAMwB,EACdjD,QAAQyB,MAAMyB,EACdlD,QAAQyB,MAAM0B,EACdnD,QAAQyB,MAAMwB,EAAI5C,WAAWoB,MAAMwB,EAAII,OACvCrD,QAAQyB,MAAMyB,EAAI7C,WAAWoB,MAAMyB,EAAIG,OACvCrD,QAAQyB,MAAM0B,EAAI9C,WAAWoB,MAAM0B,EAAIE,QAGnCO,SAAW,IAAIC,aACrBD,SAASE,aAAaH,QAEtB,MAAMI,SAAW,IAAIC,aAAa,CAChCP,YACAQ,UAAWP,UACXQ,QAAQ,EACRC,aAAa,IAGfJ,SAASK,WAAWjC,IAAIqB,UAAUa,WAAYb,UAAUc,aAExD,MAAMC,KAAO,IAAIC,MAAMZ,SAAUG,UAKjC,OAJAQ,KAAKE,uBAELF,KAAKG,KAAO,gBAELH,IACT,GAmBF"}
1
+ {"version":3,"file":"IntersectionsDirectionWatcher.js","sources":["../../../src/Intersections/Watchers/IntersectionsDirectionWatcher.ts"],"sourcesContent":["import type { TContainerDecorator } from '@Anarchy/Engine/Global';\nimport type {\n TAbstractIntersectionsWatcher,\n TIntersectionEvent,\n TIntersectionsDirectionWatcher,\n TIntersectionsDirectionWatcherParams,\n TIntersectionsWatcherPerformanceOptions\n} from '@Anarchy/Engine/Intersections/Models';\nimport { getChangedOriginAndDirection } from '@Anarchy/Engine/Intersections/Utils';\nimport { AbstractIntersectionsWatcher } from '@Anarchy/Engine/Intersections/Watchers/AbstractIntersectionsWatcher';\nimport type { TMilliseconds } from '@Anarchy/Engine/Math';\nimport type { TSceneObject } from '@Anarchy/Engine/Scene';\nimport type { TReadonlyVector3 } from '@Anarchy/Engine/ThreeLib';\nimport { isDefined, isNotDefined } from '@hellpig/anarchy-shared/Utils';\nimport type { Observable, Subscription } from 'rxjs';\nimport { BehaviorSubject, distinctUntilChanged, EMPTY, filter, map, switchMap } from 'rxjs';\nimport type { ColorRepresentation, Vector3Like } from 'three';\nimport { Vector3 } from 'three';\nimport { Line2 } from 'three/examples/jsm/lines/Line2';\nimport { LineGeometry } from 'three/examples/jsm/lines/LineGeometry';\nimport { LineMaterial } from 'three/examples/jsm/lines/LineMaterial';\n\nexport function IntersectionsDirectionWatcher(params: TIntersectionsDirectionWatcherParams): TIntersectionsDirectionWatcher {\n const { performance, intersectionsLoop } = params;\n const abstractIntersectionsWatcher: TAbstractIntersectionsWatcher = AbstractIntersectionsWatcher(params);\n\n const origin$: BehaviorSubject<TReadonlyVector3> = new BehaviorSubject<TReadonlyVector3>(new Vector3().copy(params.origin));\n const direction$: BehaviorSubject<TReadonlyVector3> = new BehaviorSubject<TReadonlyVector3>(new Vector3().copy(params.direction));\n\n const threshold: number = performance?.noiseThreshold ?? 0.001;\n // shouldReactOnlyOnChange might improve performance, however, won't fire an event if the mouse (position$) is not moving (and actor or scene is moving)\n const shouldReactOnlyOnChange: boolean = performance?.shouldReactOnlyOnChange ?? false;\n\n const tmpOrigin = new Float32Array(3);\n const prevOrigin = new Float32Array(3);\n const tmpDirection = new Float32Array(3);\n const prevDirection = new Float32Array(3);\n\n const enabledSub$: Subscription = abstractIntersectionsWatcher.enabled$\n .pipe(\n distinctUntilChanged(),\n switchMap((isEnabled: boolean): Observable<TMilliseconds | never> => (isEnabled ? intersectionsLoop.tick$ : EMPTY)),\n map((): Readonly<{ origin: TReadonlyVector3; direction: TReadonlyVector3 }> | undefined =>\n shouldReactOnlyOnChange\n ? getChangedOriginAndDirection(tmpOrigin, tmpDirection, prevOrigin, prevDirection, origin$.value.clone(), direction$.value.clone(), threshold)\n : { origin: origin$.value.clone(), direction: direction$.value.clone() }\n ),\n filter(isDefined)\n )\n .subscribe(({ origin, direction }: Readonly<{ origin: TReadonlyVector3; direction: TReadonlyVector3 }>): void => {\n const intersection: TIntersectionEvent | undefined = getIntersection(origin as Vector3, direction as Vector3, abstractIntersectionsWatcher.getModelsFromActors());\n if (isDefined(intersection)) abstractIntersectionsWatcher.value$.next(intersection);\n });\n\n function getIntersection(origin: Vector3, direction: Vector3, list: Array<TSceneObject>): TIntersectionEvent | undefined | never {\n if (isNotDefined(abstractIntersectionsWatcher.raycaster)) throw new Error('[IntersectionsDirectionWatcher]: Cannot get intersection: raycaster is not defined');\n abstractIntersectionsWatcher.raycaster.set(origin, direction.normalize());\n return abstractIntersectionsWatcher.raycaster.intersectObjects(list)[0];\n }\n\n function getDistanceToTargetPoint(origin: Vector3Like, target: Vector3Like): number {\n return new Vector3(target.x - origin.x, target.y - origin.y, target.z - origin.z).length();\n }\n\n function targetPointToDirection(origin: Vector3Like, target: Vector3Like): TReadonlyVector3 {\n return new Vector3(target.x - origin.x, target.y - origin.y, target.z - origin.z).normalize();\n }\n\n function _debugGetRayVisualizationLine(container: TContainerDecorator, length: number = 100, color: ColorRepresentation = 0xff0000, lineWidth: number = 1): Line2 {\n const points: Array<number> = [\n origin$.value.x,\n origin$.value.y,\n origin$.value.z,\n origin$.value.x + direction$.value.x * length,\n origin$.value.y + direction$.value.y * length,\n origin$.value.z + direction$.value.z * length\n ];\n\n const geometry = new LineGeometry();\n geometry.setPositions(points);\n\n const material = new LineMaterial({\n color,\n linewidth: lineWidth,\n dashed: false,\n transparent: true\n });\n\n material.resolution.set(container.getWidth(), container.getHeight());\n\n const line = new Line2(geometry, material);\n line.computeLineDistances();\n // eslint-disable-next-line functional/immutable-data\n line.name = 'RayDebugLine2';\n\n return line;\n }\n\n const destroySub$: Subscription = abstractIntersectionsWatcher.destroy$.subscribe((): void => {\n enabledSub$.unsubscribe();\n destroySub$.unsubscribe();\n });\n\n // eslint-disable-next-line functional/immutable-data\n return Object.assign(abstractIntersectionsWatcher, {\n origin$,\n direction$,\n targetPointToDirection,\n getDistanceToTargetPoint,\n getPerformanceSettings: (): TIntersectionsWatcherPerformanceOptions => ({\n noiseThreshold: threshold,\n shouldReactOnlyOnChange\n }),\n _debugGetRayVisualizationLine\n });\n}\n"],"names":["IntersectionsDirectionWatcher","params","performance","intersectionsLoop","abstractIntersectionsWatcher","AbstractIntersectionsWatcher","origin$","BehaviorSubject","Vector3","copy","origin","direction$","direction","threshold","noiseThreshold","shouldReactOnlyOnChange","tmpOrigin","Float32Array","prevOrigin","tmpDirection","prevDirection","enabledSub$","enabled$","pipe","distinctUntilChanged","switchMap","isEnabled","tick$","EMPTY","map","getChangedOriginAndDirection","value","clone","filter","isDefined","subscribe","intersection","list","isNotDefined","raycaster","Error","set","normalize","intersectObjects","getIntersection","getModelsFromActors","value$","next","destroySub$","destroy$","unsubscribe","Object","assign","targetPointToDirection","target","x","y","z","getDistanceToTargetPoint","length","getPerformanceSettings","_debugGetRayVisualizationLine","container","color","lineWidth","points","geometry","LineGeometry","setPositions","material","LineMaterial","linewidth","dashed","transparent","resolution","getWidth","getHeight","line","Line2","computeLineDistances","name"],"mappings":"w9BAsBO,SAASA,8BAA8BC,QAC5C,MAAMC,YAAEA,YAAAC,kBAAaA,mBAAsBF,OACrCG,6BAA8DC,6BAA6BJ,QAE3FK,QAA6C,IAAIC,iBAAkC,IAAIC,SAAUC,KAAKR,OAAOS,SAC7GC,WAAgD,IAAIJ,iBAAkC,IAAIC,SAAUC,KAAKR,OAAOW,YAEhHC,UAAoBX,aAAaY,gBAAkB,KAEnDC,wBAAmCb,aAAaa,0BAA2B,EAE3EC,UAAY,IAAIC,aAAa,GAC7BC,WAAa,IAAID,aAAa,GAC9BE,aAAe,IAAIF,aAAa,GAChCG,cAAgB,IAAIH,aAAa,GAEjCI,YAA4BjB,6BAA6BkB,SAC5DC,KACCC,uBACAC,UAAWC,WAA2DA,UAAYvB,kBAAkBwB,MAAQC,OAC5GC,IAAI,IACFd,wBACIe,6BAA6Bd,UAAWG,aAAcD,WAAYE,cAAed,QAAQyB,MAAMC,QAASrB,WAAWoB,MAAMC,QAASnB,WAClI,CAAEH,OAAQJ,QAAQyB,MAAMC,QAASpB,UAAWD,WAAWoB,MAAMC,UAEnEC,OAAOC,YAERC,UAAU,EAAGzB,cAAQE,wBACpB,MAAMwB,aAIV,SAAyB1B,OAAiBE,UAAoByB,MAC5D,GAAIC,aAAalC,6BAA6BmC,WAAY,MAAM,IAAIC,MAAM,sFAE1E,OADApC,6BAA6BmC,UAAUE,IAAI/B,OAAQE,UAAU8B,aACtDtC,6BAA6BmC,UAAUI,iBAAiBN,MAAM,EACvE,CARyDO,CAAgBlC,OAAmBE,UAAsBR,6BAA6ByC,uBACvIX,UAAUE,eAAehC,6BAA6B0C,OAAOC,KAAKX,gBA+CpEY,YAA4B5C,6BAA6B6C,SAASd,UAAU,KAChFd,YAAY6B,cACZF,YAAYE,gBAId,OAAOC,OAAOC,OAAOhD,6BAA8B,CACjDE,gBACAK,sBACA0C,uBA3CF,SAAgC3C,OAAqB4C,QACnD,OAAO,IAAI9C,QAAQ8C,OAAOC,EAAI7C,OAAO6C,EAAGD,OAAOE,EAAI9C,OAAO8C,EAAGF,OAAOG,EAAI/C,OAAO+C,GAAGf,WACpF,EA0CEgB,yBAhDF,SAAkChD,OAAqB4C,QACrD,OAAO,IAAI9C,QAAQ8C,OAAOC,EAAI7C,OAAO6C,EAAGD,OAAOE,EAAI9C,OAAO8C,EAAGF,OAAOG,EAAI/C,OAAO+C,GAAGE,QACpF,EA+CEC,uBAAwB,KAAA,CACtB9C,eAAgBD,UAChBE,kDAEF8C,8BA7CF,SAAuCC,UAAgCH,OAAiB,IAAKI,MAA6B,SAAUC,UAAoB,GACtJ,MAAMC,OAAwB,CAC5B3D,QAAQyB,MAAMwB,EACdjD,QAAQyB,MAAMyB,EACdlD,QAAQyB,MAAM0B,EACdnD,QAAQyB,MAAMwB,EAAI5C,WAAWoB,MAAMwB,EAAII,OACvCrD,QAAQyB,MAAMyB,EAAI7C,WAAWoB,MAAMyB,EAAIG,OACvCrD,QAAQyB,MAAM0B,EAAI9C,WAAWoB,MAAM0B,EAAIE,QAGnCO,SAAW,IAAIC,aACrBD,SAASE,aAAaH,QAEtB,MAAMI,SAAW,IAAIC,aAAa,CAChCP,YACAQ,UAAWP,UACXQ,QAAQ,EACRC,aAAa,IAGfJ,SAASK,WAAWjC,IAAIqB,UAAUa,WAAYb,UAAUc,aAExD,MAAMC,KAAO,IAAIC,MAAMZ,SAAUG,UAKjC,OAJAQ,KAAKE,uBAELF,KAAKG,KAAO,gBAELH,IACT,GAmBF"}
@@ -1 +1 @@
1
- {"version":3,"file":"KeyWatcherFactory.js","sources":["../../../src/Keyboard/Factories/KeyWatcherFactory.ts"],"sourcesContent":["import { FactoryType, ReactiveFactory } from '@hellpig/anarchy-engine/Abstract';\nimport { KeyWatcherType } from '@hellpig/anarchy-engine/Keyboard/Constants';\nimport type { TKeyComboWatcher, TKeyComboWatcherDependencies, TKeyComboWatcherParams, TKeyWatcher, TKeyWatcherFactory, TKeyWatcherParams } from '@hellpig/anarchy-engine/Keyboard/Models';\nimport { KeyPressWatcher, KeyReleaseWatcher } from '@hellpig/anarchy-engine/Keyboard/Watchers';\nimport { KeyComboWatcher } from '@hellpig/anarchy-engine/Keyboard/Watchers/KeyComboWatcher';\n\nfunction create(params: TKeyWatcherParams | TKeyComboWatcherParams, deps?: TKeyComboWatcherDependencies): TKeyWatcher | TKeyComboWatcher | never {\n if (params.type === KeyWatcherType.Press) return KeyPressWatcher(params as TKeyWatcherParams);\n if (params.type === KeyWatcherType.Release) return KeyReleaseWatcher(params as TKeyWatcherParams);\n if (params.type === KeyWatcherType.Combo) return KeyComboWatcher(params as TKeyComboWatcherParams, deps as TKeyComboWatcherDependencies);\n else throw new Error(`[KeyWatcherFactory]: Cannot create key watcher from params: unknown watcher type \"${(params as any).type}\"`);\n}\n\nexport const KeyWatcherFactory = (): TKeyWatcherFactory => ReactiveFactory(FactoryType.KeyWatcher, create);\n"],"names":["create","params","deps","type","KeyWatcherType","Press","KeyPressWatcher","Release","KeyReleaseWatcher","Combo","KeyComboWatcher","Error","KeyWatcherFactory","ReactiveFactory","FactoryType","KeyWatcher"],"mappings":"6XAMA,SAASA,OAAOC,OAAoDC,MAClE,GAAID,OAAOE,OAASC,eAAeC,MAAO,OAAOC,gBAAgBL,QACjE,GAAIA,OAAOE,OAASC,eAAeG,QAAS,OAAOC,kBAAkBP,QACrE,GAAIA,OAAOE,OAASC,eAAeK,MAAO,OAAOC,gBAAgBT,OAAkCC,YACxF,IAAIS,MAAM,qFAAsFV,OAAeE,QAC5H,CAEO,MAAMS,kBAAoB,IAA0BC,gBAAgBC,YAAYC,WAAYf"}
1
+ {"version":3,"file":"KeyWatcherFactory.js","sources":["../../../src/Keyboard/Factories/KeyWatcherFactory.ts"],"sourcesContent":["import { FactoryType, ReactiveFactory } from '@Anarchy/Engine/Abstract';\nimport { KeyWatcherType } from '@Anarchy/Engine/Keyboard/Constants';\nimport type { TKeyComboWatcher, TKeyComboWatcherDependencies, TKeyComboWatcherParams, TKeyWatcher, TKeyWatcherFactory, TKeyWatcherParams } from '@Anarchy/Engine/Keyboard/Models';\nimport { KeyPressWatcher, KeyReleaseWatcher } from '@Anarchy/Engine/Keyboard/Watchers';\nimport { KeyComboWatcher } from '@Anarchy/Engine/Keyboard/Watchers/KeyComboWatcher';\n\nfunction create(params: TKeyWatcherParams | TKeyComboWatcherParams, deps?: TKeyComboWatcherDependencies): TKeyWatcher | TKeyComboWatcher | never {\n if (params.type === KeyWatcherType.Press) return KeyPressWatcher(params as TKeyWatcherParams);\n if (params.type === KeyWatcherType.Release) return KeyReleaseWatcher(params as TKeyWatcherParams);\n if (params.type === KeyWatcherType.Combo) return KeyComboWatcher(params as TKeyComboWatcherParams, deps as TKeyComboWatcherDependencies);\n else throw new Error(`[KeyWatcherFactory]: Cannot create key watcher from params: unknown watcher type \"${(params as any).type}\"`);\n}\n\nexport const KeyWatcherFactory = (): TKeyWatcherFactory => ReactiveFactory(FactoryType.KeyWatcher, create);\n"],"names":["create","params","deps","type","KeyWatcherType","Press","KeyPressWatcher","Release","KeyReleaseWatcher","Combo","KeyComboWatcher","Error","KeyWatcherFactory","ReactiveFactory","FactoryType","KeyWatcher"],"mappings":"6XAMA,SAASA,OAAOC,OAAoDC,MAClE,GAAID,OAAOE,OAASC,eAAeC,MAAO,OAAOC,gBAAgBL,QACjE,GAAIA,OAAOE,OAASC,eAAeG,QAAS,OAAOC,kBAAkBP,QACrE,GAAIA,OAAOE,OAASC,eAAeK,MAAO,OAAOC,gBAAgBT,OAAkCC,YACxF,IAAIS,MAAM,qFAAsFV,OAAeE,QAC5H,CAEO,MAAMS,kBAAoB,IAA0BC,gBAAgBC,YAAYC,WAAYf"}
@@ -1 +1 @@
1
- {"version":3,"file":"KeyWatcherRegistry.js","sources":["../../../src/Keyboard/Registries/KeyWatcherRegistry.ts"],"sourcesContent":["import { RegistryType } from '@hellpig/anarchy-engine/Abstract/Constants';\nimport { AbstractWatcherRegistry } from '@hellpig/anarchy-engine/Abstract/Registries';\nimport type { TKeyComboWatcher, TKeyWatcher, TKeyWatcherRegistry } from '@hellpig/anarchy-engine/Keyboard/Models';\n\nexport function KeyWatcherRegistry(): TKeyWatcherRegistry {\n return AbstractWatcherRegistry<TKeyWatcher | TKeyComboWatcher>(RegistryType.KeyWatcher);\n}\n"],"names":["KeyWatcherRegistry","AbstractWatcherRegistry","RegistryType","KeyWatcher"],"mappings":"6JAIO,SAASA,qBACd,OAAOC,wBAAwDC,aAAaC,WAC9E"}
1
+ {"version":3,"file":"KeyWatcherRegistry.js","sources":["../../../src/Keyboard/Registries/KeyWatcherRegistry.ts"],"sourcesContent":["import { RegistryType } from '@Anarchy/Engine/Abstract/Constants';\nimport { AbstractWatcherRegistry } from '@Anarchy/Engine/Abstract/Registries';\nimport type { TKeyComboWatcher, TKeyWatcher, TKeyWatcherRegistry } from '@Anarchy/Engine/Keyboard/Models';\n\nexport function KeyWatcherRegistry(): TKeyWatcherRegistry {\n return AbstractWatcherRegistry<TKeyWatcher | TKeyComboWatcher>(RegistryType.KeyWatcher);\n}\n"],"names":["KeyWatcherRegistry","AbstractWatcherRegistry","RegistryType","KeyWatcher"],"mappings":"6JAIO,SAASA,qBACd,OAAOC,wBAAwDC,aAAaC,WAC9E"}
@@ -1 +1 @@
1
- {"version":3,"file":"KeyboardService.js","sources":["../../../src/Keyboard/Services/KeyboardService.ts"],"sourcesContent":["import type { TAbstractService } from '@hellpig/anarchy-engine/Abstract';\nimport { AbstractService, WatcherTag } from '@hellpig/anarchy-engine/Abstract';\nimport type { TContainerDecorator } from '@hellpig/anarchy-engine/Global';\nimport { KeyWatcherType } from '@hellpig/anarchy-engine/Keyboard/Constants';\nimport type { TKeyboardService, TKeyComboWatcher, TKeyWatcher, TKeyWatcherFactory, TKeyWatcherRegistry } from '@hellpig/anarchy-engine/Keyboard/Models';\nimport { isDefined } from '@hellpig/anarchy-shared/Utils';\nimport type { Subscription } from 'rxjs';\n\nexport function KeyboardService(container: TContainerDecorator, keyWatcherFactory: TKeyWatcherFactory, keyWatcherRegistry: TKeyWatcherRegistry): TKeyboardService {\n keyWatcherFactory.entityCreated$.subscribe((watcher: TKeyWatcher | TKeyComboWatcher): void => keyWatcherRegistry.add(watcher));\n\n // Only focusable elements can receive keyboard events\n const element: HTMLElement = container.getElement() as HTMLElement;\n // eslint-disable-next-line functional/immutable-data\n if (isDefined(element?.tabIndex) && element?.tabIndex < 0) element.tabIndex = 0;\n\n const tags: ReadonlyArray<WatcherTag | string> = [WatcherTag.Initial, WatcherTag.Global];\n const keyPressWatcher: TKeyWatcher = keyWatcherFactory.create({ type: KeyWatcherType.Press, container, tags }, undefined) as TKeyWatcher;\n const keyReleaseWatcher: TKeyWatcher = keyWatcherFactory.create({ type: KeyWatcherType.Release, container, tags }, undefined) as TKeyWatcher;\n const keyComboWatcher: TKeyComboWatcher = keyWatcherFactory.create({ type: KeyWatcherType.Combo, container, tags }, { keyPressWatcher, keyReleaseWatcher }) as TKeyComboWatcher;\n\n keyComboWatcher.enabled$.next(true);\n keyReleaseWatcher.enabled$.next(true);\n keyPressWatcher.enabled$.next(true);\n\n const abstractService: TAbstractService = AbstractService([keyWatcherFactory, keyWatcherRegistry]);\n\n const destroySub$: Subscription = abstractService.destroy$.subscribe((): void => {\n destroySub$.unsubscribe();\n\n keyWatcherRegistry.destroy$.next();\n });\n\n // eslint-disable-next-line functional/immutable-data\n return Object.assign(abstractService, {\n keys$: keyComboWatcher.value$.asObservable(),\n currentKeys: keyComboWatcher.value$.value.keys,\n pressed$: keyPressWatcher.value$.asObservable(),\n released$: keyReleaseWatcher.value$.asObservable()\n });\n}\n"],"names":["KeyboardService","container","keyWatcherFactory","keyWatcherRegistry","entityCreated$","subscribe","watcher","add","element","getElement","isDefined","tabIndex","tags","WatcherTag","Initial","Global","keyPressWatcher","create","type","KeyWatcherType","Press","keyReleaseWatcher","Release","keyComboWatcher","Combo","enabled$","next","abstractService","AbstractService","destroySub$","destroy$","unsubscribe","Object","assign","keys$","value$","asObservable","currentKeys","value","keys","pressed$","released$"],"mappings":"+QAQO,SAASA,gBAAgBC,UAAgCC,kBAAuCC,oBACrGD,kBAAkBE,eAAeC,UAAWC,SAAkDH,mBAAmBI,IAAID,UAGrH,MAAME,QAAuBP,UAAUQ,aAEnCC,UAAUF,SAASG,WAAaH,SAASG,SAAW,YAAWA,SAAW,GAE9E,MAAMC,KAA2C,CAACC,WAAWC,QAASD,WAAWE,QAC3EC,gBAA+Bd,kBAAkBe,OAAO,CAAEC,KAAMC,eAAeC,MAAOnB,oBAAWW,mBACjGS,kBAAiCnB,kBAAkBe,OAAO,CAAEC,KAAMC,eAAeG,QAASrB,oBAAWW,mBACrGW,gBAAoCrB,kBAAkBe,OAAO,CAAEC,KAAMC,eAAeK,MAAOvB,oBAAWW,WAAQ,CAAEI,gCAAiBK,sCAEvIE,gBAAgBE,SAASC,MAAK,GAC9BL,kBAAkBI,SAASC,MAAK,GAChCV,gBAAgBS,SAASC,MAAK,GAE9B,MAAMC,gBAAoCC,gBAAgB,CAAC1B,kBAAmBC,qBAExE0B,YAA4BF,gBAAgBG,SAASzB,UAAU,KACnEwB,YAAYE,cAEZ5B,mBAAmB2B,SAASJ,SAI9B,OAAOM,OAAOC,OAAON,gBAAiB,CACpCO,MAAOX,gBAAgBY,OAAOC,eAC9BC,YAAad,gBAAgBY,OAAOG,MAAMC,KAC1CC,SAAUxB,gBAAgBmB,OAAOC,eACjCK,UAAWpB,kBAAkBc,OAAOC,gBAExC"}
1
+ {"version":3,"file":"KeyboardService.js","sources":["../../../src/Keyboard/Services/KeyboardService.ts"],"sourcesContent":["import type { TAbstractService } from '@Anarchy/Engine/Abstract';\nimport { AbstractService, WatcherTag } from '@Anarchy/Engine/Abstract';\nimport type { TContainerDecorator } from '@Anarchy/Engine/Global';\nimport { KeyWatcherType } from '@Anarchy/Engine/Keyboard/Constants';\nimport type { TKeyboardService, TKeyComboWatcher, TKeyWatcher, TKeyWatcherFactory, TKeyWatcherRegistry } from '@Anarchy/Engine/Keyboard/Models';\nimport { isDefined } from '@hellpig/anarchy-shared/Utils';\nimport type { Subscription } from 'rxjs';\n\nexport function KeyboardService(container: TContainerDecorator, keyWatcherFactory: TKeyWatcherFactory, keyWatcherRegistry: TKeyWatcherRegistry): TKeyboardService {\n keyWatcherFactory.entityCreated$.subscribe((watcher: TKeyWatcher | TKeyComboWatcher): void => keyWatcherRegistry.add(watcher));\n\n // Only focusable elements can receive keyboard events\n const element: HTMLElement = container.getElement() as HTMLElement;\n // eslint-disable-next-line functional/immutable-data\n if (isDefined(element?.tabIndex) && element?.tabIndex < 0) element.tabIndex = 0;\n\n const tags: ReadonlyArray<WatcherTag | string> = [WatcherTag.Initial, WatcherTag.Global];\n const keyPressWatcher: TKeyWatcher = keyWatcherFactory.create({ type: KeyWatcherType.Press, container, tags }, undefined) as TKeyWatcher;\n const keyReleaseWatcher: TKeyWatcher = keyWatcherFactory.create({ type: KeyWatcherType.Release, container, tags }, undefined) as TKeyWatcher;\n const keyComboWatcher: TKeyComboWatcher = keyWatcherFactory.create({ type: KeyWatcherType.Combo, container, tags }, { keyPressWatcher, keyReleaseWatcher }) as TKeyComboWatcher;\n\n keyComboWatcher.enabled$.next(true);\n keyReleaseWatcher.enabled$.next(true);\n keyPressWatcher.enabled$.next(true);\n\n const abstractService: TAbstractService = AbstractService([keyWatcherFactory, keyWatcherRegistry]);\n\n const destroySub$: Subscription = abstractService.destroy$.subscribe((): void => {\n destroySub$.unsubscribe();\n\n keyWatcherRegistry.destroy$.next();\n });\n\n // eslint-disable-next-line functional/immutable-data\n return Object.assign(abstractService, {\n keys$: keyComboWatcher.value$.asObservable(),\n currentKeys: keyComboWatcher.value$.value.keys,\n pressed$: keyPressWatcher.value$.asObservable(),\n released$: keyReleaseWatcher.value$.asObservable()\n });\n}\n"],"names":["KeyboardService","container","keyWatcherFactory","keyWatcherRegistry","entityCreated$","subscribe","watcher","add","element","getElement","isDefined","tabIndex","tags","WatcherTag","Initial","Global","keyPressWatcher","create","type","KeyWatcherType","Press","keyReleaseWatcher","Release","keyComboWatcher","Combo","enabled$","next","abstractService","AbstractService","destroySub$","destroy$","unsubscribe","Object","assign","keys$","value$","asObservable","currentKeys","value","keys","pressed$","released$"],"mappings":"+QAQO,SAASA,gBAAgBC,UAAgCC,kBAAuCC,oBACrGD,kBAAkBE,eAAeC,UAAWC,SAAkDH,mBAAmBI,IAAID,UAGrH,MAAME,QAAuBP,UAAUQ,aAEnCC,UAAUF,SAASG,WAAaH,SAASG,SAAW,YAAWA,SAAW,GAE9E,MAAMC,KAA2C,CAACC,WAAWC,QAASD,WAAWE,QAC3EC,gBAA+Bd,kBAAkBe,OAAO,CAAEC,KAAMC,eAAeC,MAAOnB,oBAAWW,mBACjGS,kBAAiCnB,kBAAkBe,OAAO,CAAEC,KAAMC,eAAeG,QAASrB,oBAAWW,mBACrGW,gBAAoCrB,kBAAkBe,OAAO,CAAEC,KAAMC,eAAeK,MAAOvB,oBAAWW,WAAQ,CAAEI,gCAAiBK,sCAEvIE,gBAAgBE,SAASC,MAAK,GAC9BL,kBAAkBI,SAASC,MAAK,GAChCV,gBAAgBS,SAASC,MAAK,GAE9B,MAAMC,gBAAoCC,gBAAgB,CAAC1B,kBAAmBC,qBAExE0B,YAA4BF,gBAAgBG,SAASzB,UAAU,KACnEwB,YAAYE,cAEZ5B,mBAAmB2B,SAASJ,SAI9B,OAAOM,OAAOC,OAAON,gBAAiB,CACpCO,MAAOX,gBAAgBY,OAAOC,eAC9BC,YAAad,gBAAgBY,OAAOG,MAAMC,KAC1CC,SAAUxB,gBAAgBmB,OAAOC,eACjCK,UAAWpB,kBAAkBc,OAAOC,gBAExC"}
@@ -1 +1 @@
1
- {"version":3,"file":"KeysRxJsUtils.js","sources":["../../../src/Keyboard/Utils/KeysRxJsUtils.ts"],"sourcesContent":["import type { TGameKey, TKeyEvent } from '@hellpig/anarchy-engine/Keyboard/Models';\nimport { hasKey, hasKeys } from '@hellpig/anarchy-engine/Keyboard/Utils/KeysUtils';\nimport type { Observable, OperatorFunction } from 'rxjs';\nimport { filter } from 'rxjs';\n\nimport { isKeyInEvent } from './KeysUtils';\n\nexport const onKeysCombo = (keys: ReadonlyArray<TGameKey>): OperatorFunction<TKeyEvent, TKeyEvent> => {\n return (source: Observable<TKeyEvent>): Observable<TKeyEvent> => source.pipe(filter((keyEvent: TKeyEvent): boolean => hasKeys(keys, keyEvent.keys)));\n};\n\nexport const onKey = (key: TGameKey): OperatorFunction<TKeyEvent, TKeyEvent> => {\n return (source: Observable<TKeyEvent>): Observable<TKeyEvent> => source.pipe(filter((keyEvent: TKeyEvent): boolean => hasKey(key, keyEvent.keys)));\n};\n\nexport const onKeyReleased = (key: TGameKey): OperatorFunction<TKeyEvent, TKeyEvent> => {\n return (source: Observable<TKeyEvent>): Observable<TKeyEvent> => source.pipe(filter((keyEvent: TKeyEvent): boolean => isKeyInEvent(key, keyEvent) && keyEvent.released === key));\n};\n"],"names":["onKeysCombo","keys","source","pipe","filter","keyEvent","hasKeys","onKey","key","hasKey","onKeyReleased","isKeyInEvent","released"],"mappings":"2IAOO,MAAMA,YAAeC,MAClBC,QAAyDA,OAAOC,KAAKC,OAAQC,UAAiCC,QAAQL,KAAMI,SAASJ,QAGlIM,MAASC,KACZN,QAAyDA,OAAOC,KAAKC,OAAQC,UAAiCI,OAAOD,IAAKH,SAASJ,QAGhIS,cAAiBF,KACpBN,QAAyDA,OAAOC,KAAKC,OAAQC,UAAiCM,aAAaH,IAAKH,WAAaA,SAASO,WAAaJ"}
1
+ {"version":3,"file":"KeysRxJsUtils.js","sources":["../../../src/Keyboard/Utils/KeysRxJsUtils.ts"],"sourcesContent":["import type { TGameKey, TKeyEvent } from '@Anarchy/Engine/Keyboard/Models';\nimport { hasKey, hasKeys } from '@Anarchy/Engine/Keyboard/Utils/KeysUtils';\nimport type { Observable, OperatorFunction } from 'rxjs';\nimport { filter } from 'rxjs';\n\nimport { isKeyInEvent } from './KeysUtils';\n\nexport const onKeysCombo = (keys: ReadonlyArray<TGameKey>): OperatorFunction<TKeyEvent, TKeyEvent> => {\n return (source: Observable<TKeyEvent>): Observable<TKeyEvent> => source.pipe(filter((keyEvent: TKeyEvent): boolean => hasKeys(keys, keyEvent.keys)));\n};\n\nexport const onKey = (key: TGameKey): OperatorFunction<TKeyEvent, TKeyEvent> => {\n return (source: Observable<TKeyEvent>): Observable<TKeyEvent> => source.pipe(filter((keyEvent: TKeyEvent): boolean => hasKey(key, keyEvent.keys)));\n};\n\nexport const onKeyReleased = (key: TGameKey): OperatorFunction<TKeyEvent, TKeyEvent> => {\n return (source: Observable<TKeyEvent>): Observable<TKeyEvent> => source.pipe(filter((keyEvent: TKeyEvent): boolean => isKeyInEvent(key, keyEvent) && keyEvent.released === key));\n};\n"],"names":["onKeysCombo","keys","source","pipe","filter","keyEvent","hasKeys","onKey","key","hasKey","onKeyReleased","isKeyInEvent","released"],"mappings":"2IAOO,MAAMA,YAAeC,MAClBC,QAAyDA,OAAOC,KAAKC,OAAQC,UAAiCC,QAAQL,KAAMI,SAASJ,QAGlIM,MAASC,KACZN,QAAyDA,OAAOC,KAAKC,OAAQC,UAAiCI,OAAOD,IAAKH,SAASJ,QAGhIS,cAAiBF,KACpBN,QAAyDA,OAAOC,KAAKC,OAAQC,UAAiCM,aAAaH,IAAKH,WAAaA,SAASO,WAAaJ"}
@@ -1 +1 @@
1
- {"version":3,"file":"KeysUtils.js","sources":["../../../src/Keyboard/Utils/KeysUtils.ts"],"sourcesContent":["import type { TGameKey, TKeyEvent, TKeysCombo } from '@hellpig/anarchy-engine/Keyboard/Models';\nimport { isDefined } from '@hellpig/anarchy-shared/Utils';\n\nexport const hasKey = (key: TGameKey, keys: TKeysCombo): boolean => keys.has(key);\nexport const hasNoKey = (key: TGameKey, keys: TKeysCombo): boolean => !hasKey(key, keys);\nexport const isKeyInEvent = (key: TGameKey, keyEvent: TKeyEvent | undefined): boolean => Boolean(keyEvent && keyEvent.event?.code === key);\nexport const isPressEvent = (keyEvent: TKeyEvent): boolean => isDefined(keyEvent.pressed);\nexport const isReleaseEvent = (keyEvent: TKeyEvent): boolean => isDefined(keyEvent.released);\n\nexport function hasKeys(keys: ReadonlyArray<TGameKey>, pressedKeys: TKeysCombo): boolean {\n // eslint-disable-next-line functional/no-loop-statements\n for (const key of keys) {\n if (!hasKey(key, pressedKeys)) return false;\n }\n return true;\n}\n"],"names":["hasKey","key","keys","has","hasNoKey","isKeyInEvent","keyEvent","Boolean","event","code","isPressEvent","isDefined","pressed","isReleaseEvent","released","hasKeys","pressedKeys"],"mappings":"6EAGO,MAAMA,OAAS,CAACC,IAAeC,OAA8BA,KAAKC,IAAIF,KAChEG,SAAW,CAACH,IAAeC,QAA+BF,OAAOC,IAAKC,MACtEG,aAAe,CAACJ,IAAeK,WAA6CC,QAAQD,UAAYA,SAASE,OAAOC,OAASR,KACzHS,aAAgBJ,UAAiCK,UAAUL,SAASM,SACpEC,eAAkBP,UAAiCK,UAAUL,SAASQ,UAE5E,SAASC,QAAQb,KAA+Bc,aAErD,IAAA,MAAWf,OAAOC,KAChB,IAAKF,OAAOC,IAAKe,aAAc,OAAO,EAExC,OAAO,CACT"}
1
+ {"version":3,"file":"KeysUtils.js","sources":["../../../src/Keyboard/Utils/KeysUtils.ts"],"sourcesContent":["import type { TGameKey, TKeyEvent, TKeysCombo } from '@Anarchy/Engine/Keyboard/Models';\nimport { isDefined } from '@hellpig/anarchy-shared/Utils';\n\nexport const hasKey = (key: TGameKey, keys: TKeysCombo): boolean => keys.has(key);\nexport const hasNoKey = (key: TGameKey, keys: TKeysCombo): boolean => !hasKey(key, keys);\nexport const isKeyInEvent = (key: TGameKey, keyEvent: TKeyEvent | undefined): boolean => Boolean(keyEvent && keyEvent.event?.code === key);\nexport const isPressEvent = (keyEvent: TKeyEvent): boolean => isDefined(keyEvent.pressed);\nexport const isReleaseEvent = (keyEvent: TKeyEvent): boolean => isDefined(keyEvent.released);\n\nexport function hasKeys(keys: ReadonlyArray<TGameKey>, pressedKeys: TKeysCombo): boolean {\n // eslint-disable-next-line functional/no-loop-statements\n for (const key of keys) {\n if (!hasKey(key, pressedKeys)) return false;\n }\n return true;\n}\n"],"names":["hasKey","key","keys","has","hasNoKey","isKeyInEvent","keyEvent","Boolean","event","code","isPressEvent","isDefined","pressed","isReleaseEvent","released","hasKeys","pressedKeys"],"mappings":"6EAGO,MAAMA,OAAS,CAACC,IAAeC,OAA8BA,KAAKC,IAAIF,KAChEG,SAAW,CAACH,IAAeC,QAA+BF,OAAOC,IAAKC,MACtEG,aAAe,CAACJ,IAAeK,WAA6CC,QAAQD,UAAYA,SAASE,OAAOC,OAASR,KACzHS,aAAgBJ,UAAiCK,UAAUL,SAASM,SACpEC,eAAkBP,UAAiCK,UAAUL,SAASQ,UAE5E,SAASC,QAAQb,KAA+Bc,aAErD,IAAA,MAAWf,OAAOC,KAChB,IAAKF,OAAOC,IAAKe,aAAc,OAAO,EAExC,OAAO,CACT"}
@@ -1 +1 @@
1
- {"version":3,"file":"KeyComboWatcher.js","sources":["../../../src/Keyboard/Watchers/KeyComboWatcher.ts"],"sourcesContent":["import type { TAbstractWatcherWithState } from '@hellpig/anarchy-engine/Abstract';\nimport { AbstractWatcherWithState, WatcherType } from '@hellpig/anarchy-engine/Abstract';\nimport { ContainerEvents } from '@hellpig/anarchy-engine/Global';\nimport type { TGameKey, TKeyComboWatcher, TKeyComboWatcherDependencies, TKeyComboWatcherParams, TKeyEvent, TKeysCombo } from '@hellpig/anarchy-engine/Keyboard/Models';\nimport type { Subscription } from 'rxjs';\nimport { distinctUntilChanged, takeUntil } from 'rxjs';\n\nexport function KeyComboWatcher({ container, tags }: TKeyComboWatcherParams, { keyPressWatcher, keyReleaseWatcher }: TKeyComboWatcherDependencies): TKeyComboWatcher {\n const keys: TKeysCombo = new Set<TGameKey>();\n const watcher: TAbstractWatcherWithState<TKeyEvent> = AbstractWatcherWithState(WatcherType.KeyPressWatcher, 'key_combo_watcher', { keys }, tags);\n\n function onPress(event: KeyboardEvent): void {\n if (keys.has(event.code as TGameKey)) return;\n (keys as Set<TGameKey>).add(event.code as TGameKey);\n watcher.value$.next({ keys, pressed: event.code as TGameKey, event });\n }\n\n function onRelease(event: KeyboardEvent): void {\n if (!keys.has(event.code as TGameKey)) return;\n\n (keys as Set<TGameKey>).delete(event.code as TGameKey);\n watcher.value$.next({ keys, released: event.code as TGameKey, event });\n }\n\n //When focus leave the container, release all keys\n const releaseAllKeys = (): void => watcher.value$.value.keys.forEach((key: TGameKey): void => onRelease({ code: key } as KeyboardEvent));\n container.startWatch(ContainerEvents.Blur, releaseAllKeys);\n\n watcher.enabled$.pipe(distinctUntilChanged(), takeUntil(watcher.destroy$)).subscribe((value: boolean): void => {\n if (value) {\n container.startWatch(ContainerEvents.Blur, releaseAllKeys);\n } else {\n container.stopWatch(ContainerEvents.Blur, releaseAllKeys);\n }\n });\n\n let pressSub$: Subscription | undefined;\n let releaseSub$: Subscription | undefined;\n\n watcher.enabled$.pipe(distinctUntilChanged(), takeUntil(watcher.destroy$)).subscribe((value: boolean): void => {\n if (value) {\n pressSub$ = keyPressWatcher.value$.subscribe(onPress);\n releaseSub$ = keyReleaseWatcher.value$.subscribe(onRelease);\n } else {\n pressSub$?.unsubscribe();\n releaseSub$?.unsubscribe();\n }\n });\n\n const destroySub$: Subscription = watcher.destroy$.subscribe((): void => {\n (keys as Set<TGameKey>).clear();\n destroySub$.unsubscribe();\n });\n\n return watcher;\n}\n"],"names":["KeyComboWatcher","container","tags","keyPressWatcher","keyReleaseWatcher","keys","Set","watcher","AbstractWatcherWithState","WatcherType","KeyPressWatcher","onPress","event","has","code","add","value$","next","pressed","onRelease","delete","released","releaseAllKeys","value","forEach","key","pressSub$","releaseSub$","startWatch","ContainerEvents","Blur","enabled$","pipe","distinctUntilChanged","takeUntil","destroy$","subscribe","stopWatch","unsubscribe","destroySub$","clear"],"mappings":"0aAOO,SAASA,iBAAgBC,UAAEA,UAAAC,KAAWA,OAAgCC,gBAAEA,gBAAAC,kBAAiBA,oBAC9F,MAAMC,SAAuBC,IACvBC,QAAgDC,yBAAyBC,YAAYC,gBAAiB,oBAAqB,CAAEL,WAAQH,MAE3I,SAASS,QAAQC,OACXP,KAAKQ,IAAID,MAAME,QAClBT,KAAuBU,IAAIH,MAAME,MAClCP,QAAQS,OAAOC,KAAK,CAAEZ,UAAMa,QAASN,MAAME,KAAkBF,cAC/D,CAEA,SAASO,UAAUP,OACZP,KAAKQ,IAAID,MAAME,QAEnBT,KAAuBe,OAAOR,MAAME,MACrCP,QAAQS,OAAOC,KAAK,CAAEZ,UAAMgB,SAAUT,MAAME,KAAkBF,cAChE,CAGA,MAAMU,eAAiB,IAAYf,QAAQS,OAAOO,MAAMlB,KAAKmB,QAASC,KAAwBN,UAAU,CAAEL,KAAMW,OAWhH,IAAIC,UACAC,YAXJ1B,UAAU2B,WAAWC,gBAAgBC,KAAMR,gBAE3Cf,QAAQwB,SAASC,KAAKC,uBAAwBC,UAAU3B,QAAQ4B,WAAWC,UAAWb,QAChFA,MACFtB,UAAU2B,WAAWC,gBAAgBC,KAAMR,gBAE3CrB,UAAUoC,UAAUR,gBAAgBC,KAAMR,kBAO9Cf,QAAQwB,SAASC,KAAKC,uBAAwBC,UAAU3B,QAAQ4B,WAAWC,UAAWb,QAChFA,OACFG,UAAYvB,gBAAgBa,OAAOoB,UAAUzB,SAC7CgB,YAAcvB,kBAAkBY,OAAOoB,UAAUjB,aAEjDO,WAAWY,cACXX,aAAaW,iBAIjB,MAAMC,YAA4BhC,QAAQ4B,SAASC,UAAU,KAC1D/B,KAAuBmC,QACxBD,YAAYD,gBAGd,OAAO/B,OACT"}
1
+ {"version":3,"file":"KeyComboWatcher.js","sources":["../../../src/Keyboard/Watchers/KeyComboWatcher.ts"],"sourcesContent":["import type { TAbstractWatcherWithState } from '@Anarchy/Engine/Abstract';\nimport { AbstractWatcherWithState, WatcherType } from '@Anarchy/Engine/Abstract';\nimport { ContainerEvents } from '@Anarchy/Engine/Global';\nimport type { TGameKey, TKeyComboWatcher, TKeyComboWatcherDependencies, TKeyComboWatcherParams, TKeyEvent, TKeysCombo } from '@Anarchy/Engine/Keyboard/Models';\nimport type { Subscription } from 'rxjs';\nimport { distinctUntilChanged, takeUntil } from 'rxjs';\n\nexport function KeyComboWatcher({ container, tags }: TKeyComboWatcherParams, { keyPressWatcher, keyReleaseWatcher }: TKeyComboWatcherDependencies): TKeyComboWatcher {\n const keys: TKeysCombo = new Set<TGameKey>();\n const watcher: TAbstractWatcherWithState<TKeyEvent> = AbstractWatcherWithState(WatcherType.KeyPressWatcher, 'key_combo_watcher', { keys }, tags);\n\n function onPress(event: KeyboardEvent): void {\n if (keys.has(event.code as TGameKey)) return;\n (keys as Set<TGameKey>).add(event.code as TGameKey);\n watcher.value$.next({ keys, pressed: event.code as TGameKey, event });\n }\n\n function onRelease(event: KeyboardEvent): void {\n if (!keys.has(event.code as TGameKey)) return;\n\n (keys as Set<TGameKey>).delete(event.code as TGameKey);\n watcher.value$.next({ keys, released: event.code as TGameKey, event });\n }\n\n //When focus leave the container, release all keys\n const releaseAllKeys = (): void => watcher.value$.value.keys.forEach((key: TGameKey): void => onRelease({ code: key } as KeyboardEvent));\n container.startWatch(ContainerEvents.Blur, releaseAllKeys);\n\n watcher.enabled$.pipe(distinctUntilChanged(), takeUntil(watcher.destroy$)).subscribe((value: boolean): void => {\n if (value) {\n container.startWatch(ContainerEvents.Blur, releaseAllKeys);\n } else {\n container.stopWatch(ContainerEvents.Blur, releaseAllKeys);\n }\n });\n\n let pressSub$: Subscription | undefined;\n let releaseSub$: Subscription | undefined;\n\n watcher.enabled$.pipe(distinctUntilChanged(), takeUntil(watcher.destroy$)).subscribe((value: boolean): void => {\n if (value) {\n pressSub$ = keyPressWatcher.value$.subscribe(onPress);\n releaseSub$ = keyReleaseWatcher.value$.subscribe(onRelease);\n } else {\n pressSub$?.unsubscribe();\n releaseSub$?.unsubscribe();\n }\n });\n\n const destroySub$: Subscription = watcher.destroy$.subscribe((): void => {\n (keys as Set<TGameKey>).clear();\n destroySub$.unsubscribe();\n });\n\n return watcher;\n}\n"],"names":["KeyComboWatcher","container","tags","keyPressWatcher","keyReleaseWatcher","keys","Set","watcher","AbstractWatcherWithState","WatcherType","KeyPressWatcher","onPress","event","has","code","add","value$","next","pressed","onRelease","delete","released","releaseAllKeys","value","forEach","key","pressSub$","releaseSub$","startWatch","ContainerEvents","Blur","enabled$","pipe","distinctUntilChanged","takeUntil","destroy$","subscribe","stopWatch","unsubscribe","destroySub$","clear"],"mappings":"0aAOO,SAASA,iBAAgBC,UAAEA,UAAAC,KAAWA,OAAgCC,gBAAEA,gBAAAC,kBAAiBA,oBAC9F,MAAMC,SAAuBC,IACvBC,QAAgDC,yBAAyBC,YAAYC,gBAAiB,oBAAqB,CAAEL,WAAQH,MAE3I,SAASS,QAAQC,OACXP,KAAKQ,IAAID,MAAME,QAClBT,KAAuBU,IAAIH,MAAME,MAClCP,QAAQS,OAAOC,KAAK,CAAEZ,UAAMa,QAASN,MAAME,KAAkBF,cAC/D,CAEA,SAASO,UAAUP,OACZP,KAAKQ,IAAID,MAAME,QAEnBT,KAAuBe,OAAOR,MAAME,MACrCP,QAAQS,OAAOC,KAAK,CAAEZ,UAAMgB,SAAUT,MAAME,KAAkBF,cAChE,CAGA,MAAMU,eAAiB,IAAYf,QAAQS,OAAOO,MAAMlB,KAAKmB,QAASC,KAAwBN,UAAU,CAAEL,KAAMW,OAWhH,IAAIC,UACAC,YAXJ1B,UAAU2B,WAAWC,gBAAgBC,KAAMR,gBAE3Cf,QAAQwB,SAASC,KAAKC,uBAAwBC,UAAU3B,QAAQ4B,WAAWC,UAAWb,QAChFA,MACFtB,UAAU2B,WAAWC,gBAAgBC,KAAMR,gBAE3CrB,UAAUoC,UAAUR,gBAAgBC,KAAMR,kBAO9Cf,QAAQwB,SAASC,KAAKC,uBAAwBC,UAAU3B,QAAQ4B,WAAWC,UAAWb,QAChFA,OACFG,UAAYvB,gBAAgBa,OAAOoB,UAAUzB,SAC7CgB,YAAcvB,kBAAkBY,OAAOoB,UAAUjB,aAEjDO,WAAWY,cACXX,aAAaW,iBAIjB,MAAMC,YAA4BhC,QAAQ4B,SAASC,UAAU,KAC1D/B,KAAuBmC,QACxBD,YAAYD,gBAGd,OAAO/B,OACT"}
@@ -1 +1 @@
1
- {"version":3,"file":"KeyPressWatcher.js","sources":["../../../src/Keyboard/Watchers/KeyPressWatcher.ts"],"sourcesContent":["import type { TAbstractWatcher } from '@hellpig/anarchy-engine/Abstract';\nimport { AbstractWatcher, WatcherType } from '@hellpig/anarchy-engine/Abstract';\nimport { KeyboardEventType } from '@hellpig/anarchy-engine/Keyboard/Constants';\nimport type { TKeyWatcher, TKeyWatcherParams } from '@hellpig/anarchy-engine/Keyboard/Models';\nimport { distinctUntilChanged, takeUntil } from 'rxjs';\n\nexport function KeyPressWatcher({ container, tags }: TKeyWatcherParams): TKeyWatcher {\n const abstractWatcher: TAbstractWatcher<KeyboardEvent> = AbstractWatcher(WatcherType.KeyPressWatcher, 'key_press_watcher', tags);\n\n function onChange(event: KeyboardEvent): void {\n if (event.repeat) return;\n if (isTextInputTarget(event.target)) return;\n abstractWatcher.value$.next(event);\n }\n\n abstractWatcher.enabled$.pipe(distinctUntilChanged(), takeUntil(abstractWatcher.destroy$)).subscribe((value: boolean): void => {\n if (value) {\n container.startWatch(KeyboardEventType.KeyDown, onChange);\n } else {\n container.stopWatch(KeyboardEventType.KeyDown, onChange);\n }\n });\n\n function isTextInputTarget(target: EventTarget | null | undefined): boolean {\n if (!(target instanceof HTMLElement)) return false;\n const tag: string = target.tagName.toLowerCase();\n if (tag === 'input' || tag === 'textarea' || tag === 'select') return true;\n if (target.isContentEditable) return true;\n\n return false;\n }\n\n return abstractWatcher;\n}\n"],"names":["KeyPressWatcher","container","tags","abstractWatcher","AbstractWatcher","WatcherType","onChange","event","repeat","target","HTMLElement","tag","tagName","toLowerCase","isContentEditable","isTextInputTarget","value$","next","enabled$","pipe","distinctUntilChanged","takeUntil","destroy$","subscribe","value","startWatch","KeyboardEventType","KeyDown","stopWatch"],"mappings":"kZAMO,SAASA,iBAAgBC,UAAEA,UAAAC,KAAWA,OAC3C,MAAMC,gBAAmDC,gBAAgBC,YAAYL,gBAAiB,oBAAqBE,MAE3H,SAASI,SAASC,OACZA,MAAMC,QAaZ,SAA2BC,QACzB,KAAMA,kBAAkBC,aAAc,OAAO,EAC7C,MAAMC,IAAcF,OAAOG,QAAQC,cACnC,MAAY,UAARF,KAA2B,aAARA,KAA8B,WAARA,OACzCF,OAAOK,iBAGb,CAnBMC,CAAkBR,MAAME,SAC5BN,gBAAgBa,OAAOC,KAAKV,MAC9B,CAmBA,OAjBAJ,gBAAgBe,SAASC,KAAKC,uBAAwBC,UAAUlB,gBAAgBmB,WAAWC,UAAWC,QAChGA,MACFvB,UAAUwB,WAAWC,kBAAkBC,QAASrB,UAEhDL,UAAU2B,UAAUF,kBAAkBC,QAASrB,YAa5CH,eACT"}
1
+ {"version":3,"file":"KeyPressWatcher.js","sources":["../../../src/Keyboard/Watchers/KeyPressWatcher.ts"],"sourcesContent":["import type { TAbstractWatcher } from '@Anarchy/Engine/Abstract';\nimport { AbstractWatcher, WatcherType } from '@Anarchy/Engine/Abstract';\nimport { KeyboardEventType } from '@Anarchy/Engine/Keyboard/Constants';\nimport type { TKeyWatcher, TKeyWatcherParams } from '@Anarchy/Engine/Keyboard/Models';\nimport { distinctUntilChanged, takeUntil } from 'rxjs';\n\nexport function KeyPressWatcher({ container, tags }: TKeyWatcherParams): TKeyWatcher {\n const abstractWatcher: TAbstractWatcher<KeyboardEvent> = AbstractWatcher(WatcherType.KeyPressWatcher, 'key_press_watcher', tags);\n\n function onChange(event: KeyboardEvent): void {\n if (event.repeat) return;\n if (isTextInputTarget(event.target)) return;\n abstractWatcher.value$.next(event);\n }\n\n abstractWatcher.enabled$.pipe(distinctUntilChanged(), takeUntil(abstractWatcher.destroy$)).subscribe((value: boolean): void => {\n if (value) {\n container.startWatch(KeyboardEventType.KeyDown, onChange);\n } else {\n container.stopWatch(KeyboardEventType.KeyDown, onChange);\n }\n });\n\n function isTextInputTarget(target: EventTarget | null | undefined): boolean {\n if (!(target instanceof HTMLElement)) return false;\n const tag: string = target.tagName.toLowerCase();\n if (tag === 'input' || tag === 'textarea' || tag === 'select') return true;\n if (target.isContentEditable) return true;\n\n return false;\n }\n\n return abstractWatcher;\n}\n"],"names":["KeyPressWatcher","container","tags","abstractWatcher","AbstractWatcher","WatcherType","onChange","event","repeat","target","HTMLElement","tag","tagName","toLowerCase","isContentEditable","isTextInputTarget","value$","next","enabled$","pipe","distinctUntilChanged","takeUntil","destroy$","subscribe","value","startWatch","KeyboardEventType","KeyDown","stopWatch"],"mappings":"kZAMO,SAASA,iBAAgBC,UAAEA,UAAAC,KAAWA,OAC3C,MAAMC,gBAAmDC,gBAAgBC,YAAYL,gBAAiB,oBAAqBE,MAE3H,SAASI,SAASC,OACZA,MAAMC,QAaZ,SAA2BC,QACzB,KAAMA,kBAAkBC,aAAc,OAAO,EAC7C,MAAMC,IAAcF,OAAOG,QAAQC,cACnC,MAAY,UAARF,KAA2B,aAARA,KAA8B,WAARA,OACzCF,OAAOK,iBAGb,CAnBMC,CAAkBR,MAAME,SAC5BN,gBAAgBa,OAAOC,KAAKV,MAC9B,CAmBA,OAjBAJ,gBAAgBe,SAASC,KAAKC,uBAAwBC,UAAUlB,gBAAgBmB,WAAWC,UAAWC,QAChGA,MACFvB,UAAUwB,WAAWC,kBAAkBC,QAASrB,UAEhDL,UAAU2B,UAAUF,kBAAkBC,QAASrB,YAa5CH,eACT"}
@@ -1 +1 @@
1
- {"version":3,"file":"KeyReleaseWatcher.js","sources":["../../../src/Keyboard/Watchers/KeyReleaseWatcher.ts"],"sourcesContent":["import type { TAbstractWatcher } from '@hellpig/anarchy-engine/Abstract';\nimport { AbstractWatcher, WatcherType } from '@hellpig/anarchy-engine/Abstract';\nimport { KeyboardEventType } from '@hellpig/anarchy-engine/Keyboard/Constants';\nimport type { TKeyWatcher, TKeyWatcherParams } from '@hellpig/anarchy-engine/Keyboard/Models';\nimport { distinctUntilChanged, takeUntil } from 'rxjs';\n\nexport function KeyReleaseWatcher({ container, tags }: TKeyWatcherParams): TKeyWatcher {\n const abstractWatcher: TAbstractWatcher<KeyboardEvent> = AbstractWatcher(WatcherType.KeyReleaseWatcher, 'key_release_watcher', tags);\n\n const onChange = (event: KeyboardEvent): void => abstractWatcher.value$.next(event);\n\n abstractWatcher.enabled$.pipe(distinctUntilChanged(), takeUntil(abstractWatcher.destroy$)).subscribe((value: boolean): void => {\n if (value) {\n container.startWatch(KeyboardEventType.KeyUp, onChange);\n } else {\n container.stopWatch(KeyboardEventType.KeyUp, onChange);\n }\n });\n\n return abstractWatcher;\n}\n"],"names":["KeyReleaseWatcher","container","tags","abstractWatcher","AbstractWatcher","WatcherType","onChange","event","value$","next","enabled$","pipe","distinctUntilChanged","takeUntil","destroy$","subscribe","value","startWatch","KeyboardEventType","KeyUp","stopWatch"],"mappings":"kZAMO,SAASA,mBAAkBC,UAAEA,UAAAC,KAAWA,OAC7C,MAAMC,gBAAmDC,gBAAgBC,YAAYL,kBAAmB,sBAAuBE,MAEzHI,SAAYC,OAA+BJ,gBAAgBK,OAAOC,KAAKF,OAU7E,OARAJ,gBAAgBO,SAASC,KAAKC,uBAAwBC,UAAUV,gBAAgBW,WAAWC,UAAWC,QAChGA,MACFf,UAAUgB,WAAWC,kBAAkBC,MAAOb,UAE9CL,UAAUmB,UAAUF,kBAAkBC,MAAOb,YAI1CH,eACT"}
1
+ {"version":3,"file":"KeyReleaseWatcher.js","sources":["../../../src/Keyboard/Watchers/KeyReleaseWatcher.ts"],"sourcesContent":["import type { TAbstractWatcher } from '@Anarchy/Engine/Abstract';\nimport { AbstractWatcher, WatcherType } from '@Anarchy/Engine/Abstract';\nimport { KeyboardEventType } from '@Anarchy/Engine/Keyboard/Constants';\nimport type { TKeyWatcher, TKeyWatcherParams } from '@Anarchy/Engine/Keyboard/Models';\nimport { distinctUntilChanged, takeUntil } from 'rxjs';\n\nexport function KeyReleaseWatcher({ container, tags }: TKeyWatcherParams): TKeyWatcher {\n const abstractWatcher: TAbstractWatcher<KeyboardEvent> = AbstractWatcher(WatcherType.KeyReleaseWatcher, 'key_release_watcher', tags);\n\n const onChange = (event: KeyboardEvent): void => abstractWatcher.value$.next(event);\n\n abstractWatcher.enabled$.pipe(distinctUntilChanged(), takeUntil(abstractWatcher.destroy$)).subscribe((value: boolean): void => {\n if (value) {\n container.startWatch(KeyboardEventType.KeyUp, onChange);\n } else {\n container.stopWatch(KeyboardEventType.KeyUp, onChange);\n }\n });\n\n return abstractWatcher;\n}\n"],"names":["KeyReleaseWatcher","container","tags","abstractWatcher","AbstractWatcher","WatcherType","onChange","event","value$","next","enabled$","pipe","distinctUntilChanged","takeUntil","destroy$","subscribe","value","startWatch","KeyboardEventType","KeyUp","stopWatch"],"mappings":"kZAMO,SAASA,mBAAkBC,UAAEA,UAAAC,KAAWA,OAC7C,MAAMC,gBAAmDC,gBAAgBC,YAAYL,kBAAmB,sBAAuBE,MAEzHI,SAAYC,OAA+BJ,gBAAgBK,OAAOC,KAAKF,OAU7E,OARAJ,gBAAgBO,SAASC,KAAKC,uBAAwBC,UAAUV,gBAAgBW,WAAWC,UAAWC,QAChGA,MACFf,UAAUgB,WAAWC,kBAAkBC,MAAOb,UAE9CL,UAAUmB,UAAUF,kBAAkBC,MAAOb,YAI1CH,eACT"}
@@ -1 +1 @@
1
- {"version":3,"file":"ConfigToParams.js","sources":["../../../src/Kinematic/Adapters/ConfigToParams.ts"],"sourcesContent":["import type { TKinematicConfig, TKinematicParams } from '@hellpig/anarchy-engine/Kinematic/Models';\nimport { toQuaternion } from '@hellpig/anarchy-engine/Math';\nimport { isDefined } from '@hellpig/anarchy-shared/Utils';\nimport { Quaternion, Vector3 } from 'three';\n\nexport function kinematicConfigToParams(config: TKinematicConfig): TKinematicParams {\n const { state, target, ...rest } = config;\n const { linearDirection, angularDirection, ...stateRest } = state ?? {};\n const { positionThreshold, position, rotationThreshold, rotation, ...targetRest } = target ?? {};\n\n return {\n ...rest,\n state: {\n ...stateRest,\n linearDirection: isDefined(linearDirection) ? new Vector3(linearDirection.x, linearDirection.y, linearDirection.z) : new Vector3(),\n angularDirection: isDefined(angularDirection) ? toQuaternion(angularDirection) : undefined\n },\n target: {\n ...targetRest,\n positionThreshold: positionThreshold ?? 0.01,\n position: isDefined(position) ? new Vector3(position.x, position.y, position.z) : new Vector3(),\n rotationThreshold: rotationThreshold ?? 0.0001, // 0.0001 rad = 0.0057 deg\n rotation: isDefined(rotation) ? new Quaternion(rotation.x, rotation.y, rotation.z, rotation.w) : new Quaternion()\n }\n };\n}\n"],"names":["kinematicConfigToParams","config","state","target","rest","linearDirection","angularDirection","stateRest","positionThreshold","position","rotationThreshold","rotation","targetRest","isDefined","Vector3","x","y","z","toQuaternion","Quaternion","w"],"mappings":"6KAKO,SAASA,wBAAwBC,QACtC,MAAMC,MAAEA,MAAAC,OAAOA,UAAWC,MAASH,QAC7BI,gBAAEA,gBAAAC,iBAAiBA,oBAAqBC,WAAcL,OAAS,CAAA,GAC/DM,kBAAEA,2BAAmBC,SAAAC,kBAAUA,kBAAAC,SAAmBA,YAAaC,YAAeT,QAAU,CAAA,EAE9F,MAAO,IACFC,KACHF,MAAO,IACFK,UACHF,gBAAiBQ,UAAUR,iBAAmB,IAAIS,QAAQT,gBAAgBU,EAAGV,gBAAgBW,EAAGX,gBAAgBY,GAAK,IAAIH,QACzHR,iBAAkBO,UAAUP,kBAAoBY,aAAaZ,uBAAoB,GAEnFH,OAAQ,IACHS,WACHJ,kBAAmBA,mBAAqB,IACxCC,SAAUI,UAAUJ,UAAY,IAAIK,QAAQL,SAASM,EAAGN,SAASO,EAAGP,SAASQ,GAAK,IAAIH,QACtFJ,kBAAmBA,mBAAqB,KACxCC,SAAUE,UAAUF,UAAY,IAAIQ,WAAWR,SAASI,EAAGJ,SAASK,EAAGL,SAASM,EAAGN,SAASS,GAAK,IAAID,YAG3G"}
1
+ {"version":3,"file":"ConfigToParams.js","sources":["../../../src/Kinematic/Adapters/ConfigToParams.ts"],"sourcesContent":["import type { TKinematicConfig, TKinematicParams } from '@Anarchy/Engine/Kinematic/Models';\nimport { toQuaternion } from '@Anarchy/Engine/Math';\nimport { isDefined } from '@hellpig/anarchy-shared/Utils';\nimport { Quaternion, Vector3 } from 'three';\n\nexport function kinematicConfigToParams(config: TKinematicConfig): TKinematicParams {\n const { state, target, ...rest } = config;\n const { linearDirection, angularDirection, ...stateRest } = state ?? {};\n const { positionThreshold, position, rotationThreshold, rotation, ...targetRest } = target ?? {};\n\n return {\n ...rest,\n state: {\n ...stateRest,\n linearDirection: isDefined(linearDirection) ? new Vector3(linearDirection.x, linearDirection.y, linearDirection.z) : new Vector3(),\n angularDirection: isDefined(angularDirection) ? toQuaternion(angularDirection) : undefined\n },\n target: {\n ...targetRest,\n positionThreshold: positionThreshold ?? 0.01,\n position: isDefined(position) ? new Vector3(position.x, position.y, position.z) : new Vector3(),\n rotationThreshold: rotationThreshold ?? 0.0001, // 0.0001 rad = 0.0057 deg\n rotation: isDefined(rotation) ? new Quaternion(rotation.x, rotation.y, rotation.z, rotation.w) : new Quaternion()\n }\n };\n}\n"],"names":["kinematicConfigToParams","config","state","target","rest","linearDirection","angularDirection","stateRest","positionThreshold","position","rotationThreshold","rotation","targetRest","isDefined","Vector3","x","y","z","toQuaternion","Quaternion","w"],"mappings":"6KAKO,SAASA,wBAAwBC,QACtC,MAAMC,MAAEA,MAAAC,OAAOA,UAAWC,MAASH,QAC7BI,gBAAEA,gBAAAC,iBAAiBA,oBAAqBC,WAAcL,OAAS,CAAA,GAC/DM,kBAAEA,2BAAmBC,SAAAC,kBAAUA,kBAAAC,SAAmBA,YAAaC,YAAeT,QAAU,CAAA,EAE9F,MAAO,IACFC,KACHF,MAAO,IACFK,UACHF,gBAAiBQ,UAAUR,iBAAmB,IAAIS,QAAQT,gBAAgBU,EAAGV,gBAAgBW,EAAGX,gBAAgBY,GAAK,IAAIH,QACzHR,iBAAkBO,UAAUP,kBAAoBY,aAAaZ,uBAAoB,GAEnFH,OAAQ,IACHS,WACHJ,kBAAmBA,mBAAqB,IACxCC,SAAUI,UAAUJ,UAAY,IAAIK,QAAQL,SAASM,EAAGN,SAASO,EAAGP,SAASQ,GAAK,IAAIH,QACtFJ,kBAAmBA,mBAAqB,KACxCC,SAAUE,UAAUF,UAAY,IAAIQ,WAAWR,SAASI,EAAGJ,SAASK,EAAGL,SAASM,EAAGN,SAASS,GAAK,IAAID,YAG3G"}
@@ -1 +1 @@
1
- {"version":3,"file":"EntityToConfig.js","sources":["../../../src/Kinematic/Adapters/EntityToConfig.ts"],"sourcesContent":["import type { TKinematicConfig, TKinematicConfigTarget } from '@hellpig/anarchy-engine/Kinematic/Models';\nimport type { TKinematicTransformAgent } from '@hellpig/anarchy-engine/TransformDrive';\nimport { eulerToXyz, quaternionToXyzw, vector3ToXyz } from '@hellpig/anarchy-engine/Utils';\nimport { filterOutEmptyFields, isDefined } from '@hellpig/anarchy-shared/Utils';\nimport { Euler } from 'three';\n\nexport function kinematicEntityToConfig(entity: TKinematicTransformAgent): TKinematicConfig {\n const { linearSpeed, linearDirection, angularSpeed, angularDirection, radius, forwardAxis, isInfiniteRotation } = entity.data.state;\n\n let target: TKinematicConfigTarget | undefined = undefined;\n if (isDefined(entity.data.target)) {\n target = filterOutEmptyFields({\n position: isDefined(entity.data.target.position) ? vector3ToXyz(entity.data.target.position) : undefined,\n rotation: isDefined(entity.data.target.rotation) ? quaternionToXyzw(entity.data.target.rotation) : undefined,\n positionThreshold: entity.data.target.positionThreshold,\n rotationThreshold: entity.data.target.rotationThreshold\n });\n }\n\n return filterOutEmptyFields({\n isAutoUpdate: entity.autoUpdate$.value,\n target,\n state: {\n linearSpeed,\n linearDirection: vector3ToXyz(linearDirection),\n angularSpeed,\n angularDirection: eulerToXyz(new Euler().setFromQuaternion(angularDirection)),\n radius,\n forwardAxis,\n isInfiniteRotation\n }\n });\n}\n"],"names":["kinematicEntityToConfig","entity","linearSpeed","linearDirection","angularSpeed","angularDirection","radius","forwardAxis","isInfiniteRotation","data","state","target","isDefined","filterOutEmptyFields","position","vector3ToXyz","rotation","quaternionToXyzw","positionThreshold","rotationThreshold","isAutoUpdate","autoUpdate$","value","eulerToXyz","Euler","setFromQuaternion"],"mappings":"mRAMO,SAASA,wBAAwBC,QACtC,MAAMC,YAAEA,YAAAC,gBAAaA,gBAAAC,aAAiBA,aAAAC,iBAAcA,iBAAAC,OAAkBA,mBAAQC,YAAAC,mBAAaA,oBAAuBP,OAAOQ,KAAKC,MAE9H,IAAIC,OAUJ,OATIC,UAAUX,OAAOQ,KAAKE,UACxBA,OAASE,qBAAqB,CAC5BC,SAAUF,UAAUX,OAAOQ,KAAKE,OAAOG,UAAYC,aAAad,OAAOQ,KAAKE,OAAOG,eAAY,EAC/FE,SAAUJ,UAAUX,OAAOQ,KAAKE,OAAOK,UAAYC,iBAAiBhB,OAAOQ,KAAKE,OAAOK,eAAY,EACnGE,kBAAmBjB,OAAOQ,KAAKE,OAAOO,kBACtCC,kBAAmBlB,OAAOQ,KAAKE,OAAOQ,qBAInCN,qBAAqB,CAC1BO,aAAcnB,OAAOoB,YAAYC,MACjCX,cACAD,MAAO,CACLR,wBACAC,gBAAiBY,aAAaZ,iBAC9BC,0BACAC,iBAAkBkB,YAAW,IAAIC,OAAQC,kBAAkBpB,mBAC3DC,cACAC,wBACAC,wCAGN"}
1
+ {"version":3,"file":"EntityToConfig.js","sources":["../../../src/Kinematic/Adapters/EntityToConfig.ts"],"sourcesContent":["import type { TKinematicConfig, TKinematicConfigTarget } from '@Anarchy/Engine/Kinematic/Models';\nimport type { TKinematicTransformAgent } from '@Anarchy/Engine/TransformDrive';\nimport { eulerToXyz, quaternionToXyzw, vector3ToXyz } from '@Anarchy/Engine/Utils';\nimport { filterOutEmptyFields, isDefined } from '@hellpig/anarchy-shared/Utils';\nimport { Euler } from 'three';\n\nexport function kinematicEntityToConfig(entity: TKinematicTransformAgent): TKinematicConfig {\n const { linearSpeed, linearDirection, angularSpeed, angularDirection, radius, forwardAxis, isInfiniteRotation } = entity.data.state;\n\n let target: TKinematicConfigTarget | undefined = undefined;\n if (isDefined(entity.data.target)) {\n target = filterOutEmptyFields({\n position: isDefined(entity.data.target.position) ? vector3ToXyz(entity.data.target.position) : undefined,\n rotation: isDefined(entity.data.target.rotation) ? quaternionToXyzw(entity.data.target.rotation) : undefined,\n positionThreshold: entity.data.target.positionThreshold,\n rotationThreshold: entity.data.target.rotationThreshold\n });\n }\n\n return filterOutEmptyFields({\n isAutoUpdate: entity.autoUpdate$.value,\n target,\n state: {\n linearSpeed,\n linearDirection: vector3ToXyz(linearDirection),\n angularSpeed,\n angularDirection: eulerToXyz(new Euler().setFromQuaternion(angularDirection)),\n radius,\n forwardAxis,\n isInfiniteRotation\n }\n });\n}\n"],"names":["kinematicEntityToConfig","entity","linearSpeed","linearDirection","angularSpeed","angularDirection","radius","forwardAxis","isInfiniteRotation","data","state","target","isDefined","filterOutEmptyFields","position","vector3ToXyz","rotation","quaternionToXyzw","positionThreshold","rotationThreshold","isAutoUpdate","autoUpdate$","value","eulerToXyz","Euler","setFromQuaternion"],"mappings":"mRAMO,SAASA,wBAAwBC,QACtC,MAAMC,YAAEA,YAAAC,gBAAaA,gBAAAC,aAAiBA,aAAAC,iBAAcA,iBAAAC,OAAkBA,mBAAQC,YAAAC,mBAAaA,oBAAuBP,OAAOQ,KAAKC,MAE9H,IAAIC,OAUJ,OATIC,UAAUX,OAAOQ,KAAKE,UACxBA,OAASE,qBAAqB,CAC5BC,SAAUF,UAAUX,OAAOQ,KAAKE,OAAOG,UAAYC,aAAad,OAAOQ,KAAKE,OAAOG,eAAY,EAC/FE,SAAUJ,UAAUX,OAAOQ,KAAKE,OAAOK,UAAYC,iBAAiBhB,OAAOQ,KAAKE,OAAOK,eAAY,EACnGE,kBAAmBjB,OAAOQ,KAAKE,OAAOO,kBACtCC,kBAAmBlB,OAAOQ,KAAKE,OAAOQ,qBAInCN,qBAAqB,CAC1BO,aAAcnB,OAAOoB,YAAYC,MACjCX,cACAD,MAAO,CACLR,wBACAC,gBAAiBY,aAAaZ,iBAC9BC,0BACAC,iBAAkBkB,YAAW,IAAIC,OAAQC,kBAAkBpB,mBAC3DC,cACAC,wBACAC,wCAGN"}
@@ -1 +1 @@
1
- {"version":3,"file":"KinematicConstants.js","sources":["../../../src/Kinematic/Constants/KinematicConstants.ts"],"sourcesContent":["import type { TKinematicConfigState, TKinematicState, TKinematicTarget } from '@hellpig/anarchy-engine/Kinematic/Models';\nimport type { TMeters } from '@hellpig/anarchy-engine/Math';\nimport { eulerToXyz, vector3ToXyz } from '@hellpig/anarchy-engine/Utils/TransformUtils';\nimport { Euler, Quaternion, Vector3 } from 'three';\n\nimport { ForwardAxis } from './ForwardAxis';\n\nexport enum KinematicSpeed {\n Instant = 'instant'\n}\n\nexport const DEFAULT_RADIUS: TMeters = 1e-3 as TMeters; // 1 millimeter\n\nexport const DefaultKinematicState: TKinematicState = {\n linearSpeed: 0,\n linearDirection: new Vector3(),\n angularSpeed: 0,\n radius: DEFAULT_RADIUS,\n angularDirection: new Quaternion(),\n forwardAxis: ForwardAxis.X,\n isInfiniteRotation: false\n};\n\nexport const DefaultKinematicConfigState: TKinematicConfigState = {\n ...DefaultKinematicState,\n angularDirection: eulerToXyz(new Euler().setFromQuaternion(DefaultKinematicState.angularDirection)),\n linearDirection: vector3ToXyz(DefaultKinematicState.linearDirection)\n};\n\nexport const DefaultKinematicTarget: TKinematicTarget = {\n positionThreshold: 0.01,\n position: undefined,\n rotationThreshold: 0.0001,\n rotation: undefined\n};\n\nexport const DefaultIsAutoUpdate: boolean = true;\n"],"names":["KinematicSpeed","DEFAULT_RADIUS","DefaultKinematicState","linearSpeed","linearDirection","Vector3","angularSpeed","radius","angularDirection","Quaternion","forwardAxis","ForwardAxis","X","isInfiniteRotation","DefaultKinematicConfigState","eulerToXyz","Euler","setFromQuaternion","vector3ToXyz","DefaultKinematicTarget","positionThreshold","position","rotationThreshold","rotation","DefaultIsAutoUpdate"],"mappings":"yJAOO,IAAKA,gBAAAA,kBACVA,gBAAA,QAAU,UADAA,kBAAAA,gBAAA,CAAA,GAIL,MAAMC,eAA0B,KAE1BC,sBAAyC,CACpDC,YAAa,EACbC,gBAAiB,IAAIC,QACrBC,aAAc,EACdC,OANqC,KAOrCC,iBAAkB,IAAIC,WACtBC,YAAaC,YAAYC,EACzBC,oBAAoB,GAGTC,4BAAqD,IAC7DZ,sBACHM,iBAAkBO,YAAW,IAAIC,OAAQC,kBAAkBf,sBAAsBM,mBACjFJ,gBAAiBc,aAAahB,sBAAsBE,kBAGzCe,uBAA2C,CACtDC,kBAAmB,IACnBC,cAAU,EACVC,kBAAmB,KACnBC,cAAU,GAGCC,qBAA+B"}
1
+ {"version":3,"file":"KinematicConstants.js","sources":["../../../src/Kinematic/Constants/KinematicConstants.ts"],"sourcesContent":["import type { TKinematicConfigState, TKinematicState, TKinematicTarget } from '@Anarchy/Engine/Kinematic/Models';\nimport type { TMeters } from '@Anarchy/Engine/Math';\nimport { eulerToXyz, vector3ToXyz } from '@Anarchy/Engine/Utils/TransformUtils';\nimport { Euler, Quaternion, Vector3 } from 'three';\n\nimport { ForwardAxis } from './ForwardAxis';\n\nexport enum KinematicSpeed {\n Instant = 'instant'\n}\n\nexport const DEFAULT_RADIUS: TMeters = 1e-3 as TMeters; // 1 millimeter\n\nexport const DefaultKinematicState: TKinematicState = {\n linearSpeed: 0,\n linearDirection: new Vector3(),\n angularSpeed: 0,\n radius: DEFAULT_RADIUS,\n angularDirection: new Quaternion(),\n forwardAxis: ForwardAxis.X,\n isInfiniteRotation: false\n};\n\nexport const DefaultKinematicConfigState: TKinematicConfigState = {\n ...DefaultKinematicState,\n angularDirection: eulerToXyz(new Euler().setFromQuaternion(DefaultKinematicState.angularDirection)),\n linearDirection: vector3ToXyz(DefaultKinematicState.linearDirection)\n};\n\nexport const DefaultKinematicTarget: TKinematicTarget = {\n positionThreshold: 0.01,\n position: undefined,\n rotationThreshold: 0.0001,\n rotation: undefined\n};\n\nexport const DefaultIsAutoUpdate: boolean = true;\n"],"names":["KinematicSpeed","DEFAULT_RADIUS","DefaultKinematicState","linearSpeed","linearDirection","Vector3","angularSpeed","radius","angularDirection","Quaternion","forwardAxis","ForwardAxis","X","isInfiniteRotation","DefaultKinematicConfigState","eulerToXyz","Euler","setFromQuaternion","vector3ToXyz","DefaultKinematicTarget","positionThreshold","position","rotationThreshold","rotation","DefaultIsAutoUpdate"],"mappings":"yJAOO,IAAKA,gBAAAA,kBACVA,gBAAA,QAAU,UADAA,kBAAAA,gBAAA,CAAA,GAIL,MAAMC,eAA0B,KAE1BC,sBAAyC,CACpDC,YAAa,EACbC,gBAAiB,IAAIC,QACrBC,aAAc,EACdC,OANqC,KAOrCC,iBAAkB,IAAIC,WACtBC,YAAaC,YAAYC,EACzBC,oBAAoB,GAGTC,4BAAqD,IAC7DZ,sBACHM,iBAAkBO,YAAW,IAAIC,OAAQC,kBAAkBf,sBAAsBM,mBACjFJ,gBAAiBc,aAAahB,sBAAsBE,kBAGzCe,uBAA2C,CACtDC,kBAAmB,IACnBC,cAAU,EACVC,kBAAmB,KACnBC,cAAU,GAGCC,qBAA+B"}
@@ -1,4 +1,4 @@
1
- import { TOptional } from '../../../../anarchy-shared/src/Utils';
1
+ import { TOptional } from '@hellpig/anarchy-shared/Utils';
2
2
  import { TKinematicDataConfig } from './TKinematicDataConfig';
3
3
  export type TKinematicConfig = TOptional<TKinematicDataConfig> & Readonly<{
4
4
  isAutoUpdate: boolean;
@@ -1,4 +1,4 @@
1
- import { TOptional, TWriteable } from '../../../../anarchy-shared/src/Utils';
1
+ import { TOptional, TWriteable } from '@hellpig/anarchy-shared/Utils';
2
2
  import { TKinematicState } from './TKinematicState';
3
3
  import { TKinematicTarget } from './TKinematicTarget';
4
4
  export type TKinematicData = Readonly<{
@@ -1,4 +1,4 @@
1
- import { TOptional } from '../../../../anarchy-shared/src/Utils';
1
+ import { TOptional } from '@hellpig/anarchy-shared/Utils';
2
2
  import { TKinematicOptionalData } from './TKinematicData';
3
3
  export type TKinematicParams = TOptional<TKinematicOptionalData> & Readonly<{
4
4
  isAutoUpdate: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"KinematicUtils.js","sources":["../../../src/Kinematic/Utils/KinematicUtils.ts"],"sourcesContent":["import { DefaultIsAutoUpdate, DefaultKinematicConfigState, DefaultKinematicTarget } from '@hellpig/anarchy-engine/Kinematic/Constants';\nimport type { TKinematicConfig } from '@hellpig/anarchy-engine/Kinematic/Models';\nimport { isNotDefined } from '@hellpig/anarchy-shared/Utils';\nimport { isEqual } from 'lodash-es';\n\nexport function ignoreDefaultStateKinematic(config: TKinematicConfig | undefined): TKinematicConfig | undefined {\n if (isNotDefined(config)) return undefined;\n\n const { state, target, isAutoUpdate } = config;\n const isDefaultState: boolean = isEqual(state, DefaultKinematicConfigState);\n const isDefaultTarget: boolean = isEqual(target, DefaultKinematicTarget);\n const isDefaultAutoUpdate: boolean = isEqual(isAutoUpdate, DefaultIsAutoUpdate);\n\n return isDefaultState && isDefaultTarget && isDefaultAutoUpdate ? undefined : config;\n}\n"],"names":["ignoreDefaultStateKinematic","config","isNotDefined","state","target","isAutoUpdate","isDefaultState","isEqual","DefaultKinematicConfigState","isDefaultTarget","DefaultKinematicTarget","isDefaultAutoUpdate","DefaultIsAutoUpdate"],"mappings":"oQAKO,SAASA,4BAA4BC,QAC1C,GAAIC,aAAaD,QAAS,OAE1B,MAAME,MAAEA,MAAAC,OAAOA,OAAAC,aAAQA,cAAiBJ,OAClCK,eAA0BC,QAAQJ,MAAOK,6BACzCC,gBAA2BF,QAAQH,OAAQM,wBAC3CC,oBAA+BJ,QAAQF,aAAcO,qBAE3D,OAAON,gBAAkBG,iBAAmBE,yBAAsB,EAAYV,MAChF"}
1
+ {"version":3,"file":"KinematicUtils.js","sources":["../../../src/Kinematic/Utils/KinematicUtils.ts"],"sourcesContent":["import { DefaultIsAutoUpdate, DefaultKinematicConfigState, DefaultKinematicTarget } from '@Anarchy/Engine/Kinematic/Constants';\nimport type { TKinematicConfig } from '@Anarchy/Engine/Kinematic/Models';\nimport { isNotDefined } from '@hellpig/anarchy-shared/Utils';\nimport { isEqual } from 'lodash-es';\n\nexport function ignoreDefaultStateKinematic(config: TKinematicConfig | undefined): TKinematicConfig | undefined {\n if (isNotDefined(config)) return undefined;\n\n const { state, target, isAutoUpdate } = config;\n const isDefaultState: boolean = isEqual(state, DefaultKinematicConfigState);\n const isDefaultTarget: boolean = isEqual(target, DefaultKinematicTarget);\n const isDefaultAutoUpdate: boolean = isEqual(isAutoUpdate, DefaultIsAutoUpdate);\n\n return isDefaultState && isDefaultTarget && isDefaultAutoUpdate ? undefined : config;\n}\n"],"names":["ignoreDefaultStateKinematic","config","isNotDefined","state","target","isAutoUpdate","isDefaultState","isEqual","DefaultKinematicConfigState","isDefaultTarget","DefaultKinematicTarget","isDefaultAutoUpdate","DefaultIsAutoUpdate"],"mappings":"oQAKO,SAASA,4BAA4BC,QAC1C,GAAIC,aAAaD,QAAS,OAE1B,MAAME,MAAEA,MAAAC,OAAOA,OAAAC,aAAQA,cAAiBJ,OAClCK,eAA0BC,QAAQJ,MAAOK,6BACzCC,gBAA2BF,QAAQH,OAAQM,wBAC3CC,oBAA+BJ,QAAQF,aAAcO,qBAE3D,OAAON,gBAAkBG,iBAAmBE,yBAAsB,EAAYV,MAChF"}
@@ -1 +1 @@
1
- {"version":3,"file":"ConfigToParams.js","sources":["../../../src/Light/Adapters/ConfigToParams.ts"],"sourcesContent":["import { configToParamsCameraOptionsOnly } from '@hellpig/anarchy-engine/Camera/Adapters/ConfigToParams';\nimport type { TAnyLightConfig, TLightParams, TLightShadowConfig, TLightShadowParams, TShadowCameraConfig, TShadowCameraParams } from '@hellpig/anarchy-engine/Light/Models';\nimport { object3dConfigToParams } from '@hellpig/anarchy-engine/ThreeLib';\nimport { isDefined, isNotDefined } from '@hellpig/anarchy-shared/Utils';\nimport { Color, Vector2 } from 'three';\n\nexport function lightConfigToParams(config: TAnyLightConfig): TLightParams {\n const { position, rotation, scale, layers, color, shadow, ...rest } = config;\n\n return {\n ...rest,\n ...object3dConfigToParams({ position, rotation, scale, layers }),\n ...getLightColorParams(color),\n ...getLightShadowParams(shadow)\n };\n}\n\nfunction getLightColorParams(colorStr: string): Readonly<{ color: Color }> {\n return { color: new Color(colorStr) };\n}\n\nfunction getLightShadowParams(shadow: TLightShadowConfig | undefined): Readonly<{ shadow?: TLightShadowParams }> {\n if (isNotDefined(shadow)) return {};\n let camera: TShadowCameraParams = {} as any;\n if (isDefined(shadow.camera)) {\n const cameraConfig: TShadowCameraConfig | undefined = shadow.camera;\n camera = configToParamsCameraOptionsOnly(cameraConfig);\n }\n\n return { shadow: { ...shadow, camera, mapSize: new Vector2(shadow.mapSize.x, shadow.mapSize.y) } };\n}\n"],"names":["lightConfigToParams","config","position","rotation","scale","layers","color","shadow","rest","object3dConfigToParams","colorStr","Color","getLightShadowParams","isNotDefined","camera","isDefined","configToParamsCameraOptionsOnly","mapSize","Vector2","x","y"],"mappings":"0RAMO,SAASA,oBAAoBC,QAClC,MAAMC,SAAEA,kBAAUC,SAAAC,MAAUA,MAAAC,OAAOA,aAAQC,MAAAC,OAAOA,UAAWC,MAASP,OAEtE,MAAO,IACFO,QACAC,uBAAuB,CAAEP,kBAAUC,kBAAUC,YAAOC,oBAM9BK,SALFJ,MAMlB,CAAEA,MAAO,IAAIK,MAAMD,eALrBE,qBAAqBL,SAI5B,IAA6BG,QAF7B,CAMA,SAASE,qBAAqBL,QAC5B,GAAIM,aAAaN,QAAS,MAAO,CAAA,EACjC,IAAIO,OAA8B,CAAA,EAMlC,OALIC,UAAUR,OAAOO,UAEnBA,OAASE,gCAD6CT,OAAOO,SAIxD,CAAEP,OAAQ,IAAKA,OAAQO,cAAQG,QAAS,IAAIC,QAAQX,OAAOU,QAAQE,EAAGZ,OAAOU,QAAQG,IAC9F"}
1
+ {"version":3,"file":"ConfigToParams.js","sources":["../../../src/Light/Adapters/ConfigToParams.ts"],"sourcesContent":["import { configToParamsCameraOptionsOnly } from '@Anarchy/Engine/Camera/Adapters/ConfigToParams';\nimport type { TAnyLightConfig, TLightParams, TLightShadowConfig, TLightShadowParams, TShadowCameraConfig, TShadowCameraParams } from '@Anarchy/Engine/Light/Models';\nimport { object3dConfigToParams } from '@Anarchy/Engine/ThreeLib';\nimport { isDefined, isNotDefined } from '@hellpig/anarchy-shared/Utils';\nimport { Color, Vector2 } from 'three';\n\nexport function lightConfigToParams(config: TAnyLightConfig): TLightParams {\n const { position, rotation, scale, layers, color, shadow, ...rest } = config;\n\n return {\n ...rest,\n ...object3dConfigToParams({ position, rotation, scale, layers }),\n ...getLightColorParams(color),\n ...getLightShadowParams(shadow)\n };\n}\n\nfunction getLightColorParams(colorStr: string): Readonly<{ color: Color }> {\n return { color: new Color(colorStr) };\n}\n\nfunction getLightShadowParams(shadow: TLightShadowConfig | undefined): Readonly<{ shadow?: TLightShadowParams }> {\n if (isNotDefined(shadow)) return {};\n let camera: TShadowCameraParams = {} as any;\n if (isDefined(shadow.camera)) {\n const cameraConfig: TShadowCameraConfig | undefined = shadow.camera;\n camera = configToParamsCameraOptionsOnly(cameraConfig);\n }\n\n return { shadow: { ...shadow, camera, mapSize: new Vector2(shadow.mapSize.x, shadow.mapSize.y) } };\n}\n"],"names":["lightConfigToParams","config","position","rotation","scale","layers","color","shadow","rest","object3dConfigToParams","colorStr","Color","getLightShadowParams","isNotDefined","camera","isDefined","configToParamsCameraOptionsOnly","mapSize","Vector2","x","y"],"mappings":"0RAMO,SAASA,oBAAoBC,QAClC,MAAMC,SAAEA,kBAAUC,SAAAC,MAAUA,MAAAC,OAAOA,aAAQC,MAAAC,OAAOA,UAAWC,MAASP,OAEtE,MAAO,IACFO,QACAC,uBAAuB,CAAEP,kBAAUC,kBAAUC,YAAOC,oBAM9BK,SALFJ,MAMlB,CAAEA,MAAO,IAAIK,MAAMD,eALrBE,qBAAqBL,SAI5B,IAA6BG,QAF7B,CAMA,SAASE,qBAAqBL,QAC5B,GAAIM,aAAaN,QAAS,MAAO,CAAA,EACjC,IAAIO,OAA8B,CAAA,EAMlC,OALIC,UAAUR,OAAOO,UAEnBA,OAASE,gCAD6CT,OAAOO,SAIxD,CAAEP,OAAQ,IAAKA,OAAQO,cAAQG,QAAS,IAAIC,QAAQX,OAAOU,QAAQE,EAAGZ,OAAOU,QAAQG,IAC9F"}
@@ -1 +1 @@
1
- {"version":3,"file":"EntityToConfig.js","sources":["../../../src/Light/Adapters/EntityToConfig.ts"],"sourcesContent":["import type { TCommonCameraParams } from '@hellpig/anarchy-engine/Camera';\nimport { getCommonCameraConfig, getOrthographicCameraOnlyConfig, getPerspectiveCameraOnlyConfig, isOrthographicCameraParams, isPerspectiveCameraParams } from '@hellpig/anarchy-engine/Camera';\nimport { serializeColor } from '@hellpig/anarchy-engine/Color';\nimport { LightType } from '@hellpig/anarchy-engine/Light/Constants';\nimport type {\n TAbstractLightConfig,\n TAbstractLightWrapper,\n TAmbientLightConfig,\n TAnyLight,\n TDirectionalLightConfig,\n TDirectionalLightParams,\n THemisphereLightConfig,\n THemisphereLightWrapper,\n TLightShadowConfig,\n TLightShadowParams,\n TPointLightConfig,\n TPointLightParams,\n TPointLightWrapper,\n TRectAreaLightConfig,\n TRectAreaLightWrapper,\n TShadowCameraConfig,\n TShadowCameraParams,\n TSpotLightConfig,\n TSpotLightParams,\n TSpotLightWrapper\n} from '@hellpig/anarchy-engine/Light/Models';\nimport { extractSerializableRegistrableFields } from '@hellpig/anarchy-engine/Mixins';\nimport { vector2ToXy } from '@hellpig/anarchy-engine/Utils';\nimport type { TWriteable } from '@hellpig/anarchy-shared/Utils';\nimport { filterOutEmptyFields, isDefined, isNotDefined } from '@hellpig/anarchy-shared/Utils';\nimport type { DirectionalLightShadow, Object3DJSONObject, PointLightShadow, SpotLightShadow, Vector2Like } from 'three';\nimport { Vector2 } from 'three';\n\nexport function lightEntityToConfig<T extends TAnyLight>(\n entity: TAbstractLightWrapper<T>\n): TDirectionalLightConfig | THemisphereLightConfig | TRectAreaLightConfig | TAmbientLightConfig | TSpotLightConfig {\n const { drive } = entity;\n\n const json: Object3DJSONObject = entity.entity.toJSON().object;\n\n return filterOutEmptyFields({\n type: json.type as LightType,\n color: serializeColor(entity.entity.color),\n intensity: (json as unknown as TAbstractLightConfig<T>).intensity,\n castShadow: json.castShadow,\n // ...onlyDirectionalLightToConfig(entity as TDirectionalLightWrapper),\n ...onlyHemisphereLightToConfig(entity as THemisphereLightWrapper),\n ...onlyRectAreaLightToConfig(entity as TRectAreaLightWrapper),\n ...onlyPointLightToConfig(entity as TPointLightWrapper),\n ...onlySpotLightToConfig(entity as TSpotLightWrapper),\n ...onlyLightShadowToConfig(entity),\n ...extractSerializableRegistrableFields(entity),\n ...drive.serialize()\n });\n}\n\n// export function onlyDirectionalLightToConfig(entity: TDirectionalLightWrapper): Partial<TDirectionalLightConfig> {\n// const json: Object3DJSONObject = entity.entity.toJSON().object;\n//\n// return filterOutEmptyFields({\n// layers: json.layers,\n// // matrix: json.matrix,\n// // up: json.up\n// });\n// }\n\nexport function onlyHemisphereLightToConfig(entity: THemisphereLightWrapper): Partial<THemisphereLightConfig> {\n if (entity.getType() !== LightType.Hemisphere) return {} as THemisphereLightConfig;\n return filterOutEmptyFields({\n groundColor: serializeColor(entity.entity.groundColor)\n });\n}\n\nexport function onlyRectAreaLightToConfig(entity: TRectAreaLightWrapper): Partial<TRectAreaLightConfig> {\n if (entity.getType() !== LightType.RectArea) return {} as TRectAreaLightConfig;\n const json: Object3DJSONObject = entity.entity.toJSON().object;\n\n return filterOutEmptyFields({\n width: (json as unknown as TRectAreaLightConfig).width,\n height: (json as unknown as TRectAreaLightConfig).height\n });\n}\n\nexport function onlyPointLightToConfig(entity: TPointLightWrapper): Partial<TPointLightConfig> {\n if (entity.getType() !== LightType.Point) return {} as TPointLightConfig;\n const json: Object3DJSONObject = entity.entity.toJSON().object;\n\n return filterOutEmptyFields({\n distance: (json as unknown as TPointLightConfig).distance,\n decay: (json as unknown as TPointLightConfig).decay\n });\n}\n\nexport function onlySpotLightToConfig(entity: TSpotLightWrapper): Partial<TSpotLightConfig> {\n if (entity.getType() !== LightType.Spot) return {} as TSpotLightConfig;\n const json: Object3DJSONObject = entity.entity.toJSON().object;\n\n return filterOutEmptyFields({\n distance: (json as unknown as TSpotLightConfig).distance,\n angle: (json as unknown as TSpotLightConfig).angle,\n penumbra: (json as unknown as TSpotLightConfig).penumbra,\n decay: (json as unknown as TSpotLightConfig).decay\n });\n}\n\nexport function onlyLightShadowToConfig<T extends TAnyLight>(\n entity: TAbstractLightWrapper<T>\n): Readonly<{\n shadow?: TLightShadowConfig;\n}> {\n const json: Object3DJSONObject = entity.entity.toJSON().object;\n\n const lightConfig = json as unknown as TDirectionalLightParams | TPointLightParams | TSpotLightParams;\n const shadow: TLightShadowParams | undefined = lightConfig.shadow;\n if (isNotDefined(shadow)) return {};\n const camera: TShadowCameraParams = shadow.camera;\n\n const result: Readonly<{ shadow: TWriteable<TLightShadowConfig> }> = filterOutEmptyFields({\n shadow: {\n ...shadow,\n mapSize: getMapSize(shadow) ?? getMapSize(entity.entity.shadow),\n normalBias: shadow.normalBias ?? entity.entity.shadow?.normalBias,\n camera: undefined as unknown as TCommonCameraParams\n }\n });\n\n if (isNotDefined(camera)) return result;\n\n const cameraConfig: TShadowCameraConfig = Object.assign(getCommonCameraConfig(camera), { type: camera.type });\n // eslint-disable-next-line functional/immutable-data\n if (isPerspectiveCameraParams(camera)) Object.assign(cameraConfig, getPerspectiveCameraOnlyConfig(camera));\n // eslint-disable-next-line functional/immutable-data\n if (isOrthographicCameraParams(camera)) Object.assign(cameraConfig, getOrthographicCameraOnlyConfig(camera));\n\n // eslint-disable-next-line functional/immutable-data\n result.shadow.camera = cameraConfig;\n\n return result;\n}\n\nfunction getMapSize(shadow: TLightShadowConfig | TLightShadowParams | DirectionalLightShadow | PointLightShadow | SpotLightShadow | undefined): Vector2Like {\n let mapSize: Vector2Like | undefined = undefined;\n if (isDefined(shadow) && isDefined(shadow.mapSize)) {\n mapSize =\n isDefined(shadow?.mapSize) && isDefined((shadow?.mapSize as any)[0]) && isDefined((shadow?.mapSize as any)[1])\n ? { x: (shadow.mapSize as any)[0] as number, y: (shadow.mapSize as any)[1] as number }\n : undefined;\n }\n return vector2ToXy(mapSize ?? new Vector2());\n}\n"],"names":["lightEntityToConfig","entity","drive","json","toJSON","object","filterOutEmptyFields","type","color","serializeColor","intensity","castShadow","onlyHemisphereLightToConfig","onlyRectAreaLightToConfig","onlyPointLightToConfig","onlySpotLightToConfig","onlyLightShadowToConfig","extractSerializableRegistrableFields","serialize","getType","LightType","Hemisphere","groundColor","RectArea","width","height","Point","distance","decay","Spot","angle","penumbra","shadow","isNotDefined","camera","result","mapSize","getMapSize","normalBias","cameraConfig","Object","assign","getCommonCameraConfig","isPerspectiveCameraParams","getPerspectiveCameraOnlyConfig","isOrthographicCameraParams","getOrthographicCameraOnlyConfig","isDefined","x","y","vector2ToXy","Vector2"],"mappings":"utBAiCO,SAASA,oBACdC,QAEA,MAAMC,MAAEA,OAAUD,OAEZE,KAA2BF,OAAOA,OAAOG,SAASC,OAExD,OAAOC,qBAAqB,CAC1BC,KAAMJ,KAAKI,KACXC,MAAOC,eAAeR,OAAOA,OAAOO,OACpCE,UAAYP,KAA4CO,UACxDC,WAAYR,KAAKQ,cAEdC,4BAA4BX,WAC5BY,0BAA0BZ,WAC1Ba,uBAAuBb,WACvBc,sBAAsBd,WACtBe,wBAAwBf,WACxBgB,qCAAqChB,WACrCC,MAAMgB,aAEb,CAYO,SAASN,4BAA4BX,QAC1C,OAAIA,OAAOkB,YAAcC,UAAUC,WAAmB,CAAA,EAC/Cf,qBAAqB,CAC1BgB,YAAab,eAAeR,OAAOA,OAAOqB,cAE9C,CAEO,SAAST,0BAA0BZ,QACxC,GAAIA,OAAOkB,YAAcC,UAAUG,eAAiB,CAAA,EACpD,MAAMpB,KAA2BF,OAAOA,OAAOG,SAASC,OAExD,OAAOC,qBAAqB,CAC1BkB,MAAQrB,KAAyCqB,MACjDC,OAAStB,KAAyCsB,QAEtD,CAEO,SAASX,uBAAuBb,QACrC,GAAIA,OAAOkB,YAAcC,UAAUM,YAAc,CAAA,EACjD,MAAMvB,KAA2BF,OAAOA,OAAOG,SAASC,OAExD,OAAOC,qBAAqB,CAC1BqB,SAAWxB,KAAsCwB,SACjDC,MAAQzB,KAAsCyB,OAElD,CAEO,SAASb,sBAAsBd,QACpC,GAAIA,OAAOkB,YAAcC,UAAUS,WAAa,CAAA,EAChD,MAAM1B,KAA2BF,OAAOA,OAAOG,SAASC,OAExD,OAAOC,qBAAqB,CAC1BqB,SAAWxB,KAAqCwB,SAChDG,MAAQ3B,KAAqC2B,MAC7CC,SAAW5B,KAAqC4B,SAChDH,MAAQzB,KAAqCyB,OAEjD,CAEO,SAASZ,wBACdf,QAIA,MAGM+B,OAH2B/B,OAAOA,OAAOG,SAASC,OAGG2B,OAC3D,GAAIC,aAAaD,QAAS,MAAO,CAAA,EACjC,MAAME,OAA8BF,OAAOE,OAErCC,OAA+D7B,qBAAqB,CACxF0B,OAAQ,IACHA,OACHI,QAASC,WAAWL,SAAWK,WAAWpC,OAAOA,OAAO+B,QACxDM,WAAYN,OAAOM,YAAcrC,OAAOA,OAAO+B,QAAQM,WACvDJ,YAAQ,KAIZ,GAAID,aAAaC,QAAS,OAAOC,OAEjC,MAAMI,aAAoCC,OAAOC,OAAOC,sBAAsBR,QAAS,CAAE3B,KAAM2B,OAAO3B,OAStG,OAPIoC,0BAA0BT,SAASM,OAAOC,OAAOF,aAAcK,+BAA+BV,SAE9FW,2BAA2BX,SAASM,OAAOC,OAAOF,aAAcO,gCAAgCZ,SAGpGC,OAAOH,OAAOE,OAASK,aAEhBJ,MACT,CAEA,SAASE,WAAWL,QAClB,IAAII,QAOJ,OANIW,UAAUf,SAAWe,UAAUf,OAAOI,WACxCA,QACEW,UAAUf,QAAQI,UAAYW,WAAWf,QAAQI,SAAgB,KAAOW,WAAWf,QAAQI,SAAgB,IACvG,CAAEY,EAAIhB,OAAOI,QAAgB,GAAca,EAAIjB,OAAOI,QAAgB,SACtE,GAEDc,YAAYd,SAAW,IAAIe,QACpC"}
1
+ {"version":3,"file":"EntityToConfig.js","sources":["../../../src/Light/Adapters/EntityToConfig.ts"],"sourcesContent":["import type { TCommonCameraParams } from '@Anarchy/Engine/Camera';\nimport { getCommonCameraConfig, getOrthographicCameraOnlyConfig, getPerspectiveCameraOnlyConfig, isOrthographicCameraParams, isPerspectiveCameraParams } from '@Anarchy/Engine/Camera';\nimport { serializeColor } from '@Anarchy/Engine/Color';\nimport { LightType } from '@Anarchy/Engine/Light/Constants';\nimport type {\n TAbstractLightConfig,\n TAbstractLightWrapper,\n TAmbientLightConfig,\n TAnyLight,\n TDirectionalLightConfig,\n TDirectionalLightParams,\n THemisphereLightConfig,\n THemisphereLightWrapper,\n TLightShadowConfig,\n TLightShadowParams,\n TPointLightConfig,\n TPointLightParams,\n TPointLightWrapper,\n TRectAreaLightConfig,\n TRectAreaLightWrapper,\n TShadowCameraConfig,\n TShadowCameraParams,\n TSpotLightConfig,\n TSpotLightParams,\n TSpotLightWrapper\n} from '@Anarchy/Engine/Light/Models';\nimport { extractSerializableRegistrableFields } from '@Anarchy/Engine/Mixins';\nimport { vector2ToXy } from '@Anarchy/Engine/Utils';\nimport type { TWriteable } from '@hellpig/anarchy-shared/Utils';\nimport { filterOutEmptyFields, isDefined, isNotDefined } from '@hellpig/anarchy-shared/Utils';\nimport type { DirectionalLightShadow, Object3DJSONObject, PointLightShadow, SpotLightShadow, Vector2Like } from 'three';\nimport { Vector2 } from 'three';\n\nexport function lightEntityToConfig<T extends TAnyLight>(\n entity: TAbstractLightWrapper<T>\n): TDirectionalLightConfig | THemisphereLightConfig | TRectAreaLightConfig | TAmbientLightConfig | TSpotLightConfig {\n const { drive } = entity;\n\n const json: Object3DJSONObject = entity.entity.toJSON().object;\n\n return filterOutEmptyFields({\n type: json.type as LightType,\n color: serializeColor(entity.entity.color),\n intensity: (json as unknown as TAbstractLightConfig<T>).intensity,\n castShadow: json.castShadow,\n // ...onlyDirectionalLightToConfig(entity as TDirectionalLightWrapper),\n ...onlyHemisphereLightToConfig(entity as THemisphereLightWrapper),\n ...onlyRectAreaLightToConfig(entity as TRectAreaLightWrapper),\n ...onlyPointLightToConfig(entity as TPointLightWrapper),\n ...onlySpotLightToConfig(entity as TSpotLightWrapper),\n ...onlyLightShadowToConfig(entity),\n ...extractSerializableRegistrableFields(entity),\n ...drive.serialize()\n });\n}\n\n// export function onlyDirectionalLightToConfig(entity: TDirectionalLightWrapper): Partial<TDirectionalLightConfig> {\n// const json: Object3DJSONObject = entity.entity.toJSON().object;\n//\n// return filterOutEmptyFields({\n// layers: json.layers,\n// // matrix: json.matrix,\n// // up: json.up\n// });\n// }\n\nexport function onlyHemisphereLightToConfig(entity: THemisphereLightWrapper): Partial<THemisphereLightConfig> {\n if (entity.getType() !== LightType.Hemisphere) return {} as THemisphereLightConfig;\n return filterOutEmptyFields({\n groundColor: serializeColor(entity.entity.groundColor)\n });\n}\n\nexport function onlyRectAreaLightToConfig(entity: TRectAreaLightWrapper): Partial<TRectAreaLightConfig> {\n if (entity.getType() !== LightType.RectArea) return {} as TRectAreaLightConfig;\n const json: Object3DJSONObject = entity.entity.toJSON().object;\n\n return filterOutEmptyFields({\n width: (json as unknown as TRectAreaLightConfig).width,\n height: (json as unknown as TRectAreaLightConfig).height\n });\n}\n\nexport function onlyPointLightToConfig(entity: TPointLightWrapper): Partial<TPointLightConfig> {\n if (entity.getType() !== LightType.Point) return {} as TPointLightConfig;\n const json: Object3DJSONObject = entity.entity.toJSON().object;\n\n return filterOutEmptyFields({\n distance: (json as unknown as TPointLightConfig).distance,\n decay: (json as unknown as TPointLightConfig).decay\n });\n}\n\nexport function onlySpotLightToConfig(entity: TSpotLightWrapper): Partial<TSpotLightConfig> {\n if (entity.getType() !== LightType.Spot) return {} as TSpotLightConfig;\n const json: Object3DJSONObject = entity.entity.toJSON().object;\n\n return filterOutEmptyFields({\n distance: (json as unknown as TSpotLightConfig).distance,\n angle: (json as unknown as TSpotLightConfig).angle,\n penumbra: (json as unknown as TSpotLightConfig).penumbra,\n decay: (json as unknown as TSpotLightConfig).decay\n });\n}\n\nexport function onlyLightShadowToConfig<T extends TAnyLight>(\n entity: TAbstractLightWrapper<T>\n): Readonly<{\n shadow?: TLightShadowConfig;\n}> {\n const json: Object3DJSONObject = entity.entity.toJSON().object;\n\n const lightConfig = json as unknown as TDirectionalLightParams | TPointLightParams | TSpotLightParams;\n const shadow: TLightShadowParams | undefined = lightConfig.shadow;\n if (isNotDefined(shadow)) return {};\n const camera: TShadowCameraParams = shadow.camera;\n\n const result: Readonly<{ shadow: TWriteable<TLightShadowConfig> }> = filterOutEmptyFields({\n shadow: {\n ...shadow,\n mapSize: getMapSize(shadow) ?? getMapSize(entity.entity.shadow),\n normalBias: shadow.normalBias ?? entity.entity.shadow?.normalBias,\n camera: undefined as unknown as TCommonCameraParams\n }\n });\n\n if (isNotDefined(camera)) return result;\n\n const cameraConfig: TShadowCameraConfig = Object.assign(getCommonCameraConfig(camera), { type: camera.type });\n // eslint-disable-next-line functional/immutable-data\n if (isPerspectiveCameraParams(camera)) Object.assign(cameraConfig, getPerspectiveCameraOnlyConfig(camera));\n // eslint-disable-next-line functional/immutable-data\n if (isOrthographicCameraParams(camera)) Object.assign(cameraConfig, getOrthographicCameraOnlyConfig(camera));\n\n // eslint-disable-next-line functional/immutable-data\n result.shadow.camera = cameraConfig;\n\n return result;\n}\n\nfunction getMapSize(shadow: TLightShadowConfig | TLightShadowParams | DirectionalLightShadow | PointLightShadow | SpotLightShadow | undefined): Vector2Like {\n let mapSize: Vector2Like | undefined = undefined;\n if (isDefined(shadow) && isDefined(shadow.mapSize)) {\n mapSize =\n isDefined(shadow?.mapSize) && isDefined((shadow?.mapSize as any)[0]) && isDefined((shadow?.mapSize as any)[1])\n ? { x: (shadow.mapSize as any)[0] as number, y: (shadow.mapSize as any)[1] as number }\n : undefined;\n }\n return vector2ToXy(mapSize ?? new Vector2());\n}\n"],"names":["lightEntityToConfig","entity","drive","json","toJSON","object","filterOutEmptyFields","type","color","serializeColor","intensity","castShadow","onlyHemisphereLightToConfig","onlyRectAreaLightToConfig","onlyPointLightToConfig","onlySpotLightToConfig","onlyLightShadowToConfig","extractSerializableRegistrableFields","serialize","getType","LightType","Hemisphere","groundColor","RectArea","width","height","Point","distance","decay","Spot","angle","penumbra","shadow","isNotDefined","camera","result","mapSize","getMapSize","normalBias","cameraConfig","Object","assign","getCommonCameraConfig","isPerspectiveCameraParams","getPerspectiveCameraOnlyConfig","isOrthographicCameraParams","getOrthographicCameraOnlyConfig","isDefined","x","y","vector2ToXy","Vector2"],"mappings":"utBAiCO,SAASA,oBACdC,QAEA,MAAMC,MAAEA,OAAUD,OAEZE,KAA2BF,OAAOA,OAAOG,SAASC,OAExD,OAAOC,qBAAqB,CAC1BC,KAAMJ,KAAKI,KACXC,MAAOC,eAAeR,OAAOA,OAAOO,OACpCE,UAAYP,KAA4CO,UACxDC,WAAYR,KAAKQ,cAEdC,4BAA4BX,WAC5BY,0BAA0BZ,WAC1Ba,uBAAuBb,WACvBc,sBAAsBd,WACtBe,wBAAwBf,WACxBgB,qCAAqChB,WACrCC,MAAMgB,aAEb,CAYO,SAASN,4BAA4BX,QAC1C,OAAIA,OAAOkB,YAAcC,UAAUC,WAAmB,CAAA,EAC/Cf,qBAAqB,CAC1BgB,YAAab,eAAeR,OAAOA,OAAOqB,cAE9C,CAEO,SAAST,0BAA0BZ,QACxC,GAAIA,OAAOkB,YAAcC,UAAUG,eAAiB,CAAA,EACpD,MAAMpB,KAA2BF,OAAOA,OAAOG,SAASC,OAExD,OAAOC,qBAAqB,CAC1BkB,MAAQrB,KAAyCqB,MACjDC,OAAStB,KAAyCsB,QAEtD,CAEO,SAASX,uBAAuBb,QACrC,GAAIA,OAAOkB,YAAcC,UAAUM,YAAc,CAAA,EACjD,MAAMvB,KAA2BF,OAAOA,OAAOG,SAASC,OAExD,OAAOC,qBAAqB,CAC1BqB,SAAWxB,KAAsCwB,SACjDC,MAAQzB,KAAsCyB,OAElD,CAEO,SAASb,sBAAsBd,QACpC,GAAIA,OAAOkB,YAAcC,UAAUS,WAAa,CAAA,EAChD,MAAM1B,KAA2BF,OAAOA,OAAOG,SAASC,OAExD,OAAOC,qBAAqB,CAC1BqB,SAAWxB,KAAqCwB,SAChDG,MAAQ3B,KAAqC2B,MAC7CC,SAAW5B,KAAqC4B,SAChDH,MAAQzB,KAAqCyB,OAEjD,CAEO,SAASZ,wBACdf,QAIA,MAGM+B,OAH2B/B,OAAOA,OAAOG,SAASC,OAGG2B,OAC3D,GAAIC,aAAaD,QAAS,MAAO,CAAA,EACjC,MAAME,OAA8BF,OAAOE,OAErCC,OAA+D7B,qBAAqB,CACxF0B,OAAQ,IACHA,OACHI,QAASC,WAAWL,SAAWK,WAAWpC,OAAOA,OAAO+B,QACxDM,WAAYN,OAAOM,YAAcrC,OAAOA,OAAO+B,QAAQM,WACvDJ,YAAQ,KAIZ,GAAID,aAAaC,QAAS,OAAOC,OAEjC,MAAMI,aAAoCC,OAAOC,OAAOC,sBAAsBR,QAAS,CAAE3B,KAAM2B,OAAO3B,OAStG,OAPIoC,0BAA0BT,SAASM,OAAOC,OAAOF,aAAcK,+BAA+BV,SAE9FW,2BAA2BX,SAASM,OAAOC,OAAOF,aAAcO,gCAAgCZ,SAGpGC,OAAOH,OAAOE,OAASK,aAEhBJ,MACT,CAEA,SAASE,WAAWL,QAClB,IAAII,QAOJ,OANIW,UAAUf,SAAWe,UAAUf,OAAOI,WACxCA,QACEW,UAAUf,QAAQI,UAAYW,WAAWf,QAAQI,SAAgB,KAAOW,WAAWf,QAAQI,SAAgB,IACvG,CAAEY,EAAIhB,OAAOI,QAAgB,GAAca,EAAIjB,OAAOI,QAAgB,SACtE,GAEDc,YAAYd,SAAW,IAAIe,QACpC"}