@hellpig/anarchy-engine 22.0.0 → 22.0.2

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 (228) hide show
  1. package/dist/Actor/Adapters/ConfigToParams.d.ts +1 -1
  2. package/dist/Actor/Adapters/ConfigToParams.js +1 -1
  3. package/dist/Actor/Adapters/ConfigToParams.js.map +1 -1
  4. package/dist/Actor/Adapters/EntityToConfig.d.ts +1 -1
  5. package/dist/Actor/Adapters/EntityToConfig.js +1 -1
  6. package/dist/Actor/Adapters/EntityToConfig.js.map +1 -1
  7. package/dist/Actor/Entities/Actor/Actor.js +1 -1
  8. package/dist/Actor/Entities/Actor/Actor.js.map +1 -1
  9. package/dist/Actor/Factories/ActorFactory.js +1 -1
  10. package/dist/Actor/Factories/ActorFactory.js.map +1 -1
  11. package/dist/Actor/index.d.ts +1 -0
  12. package/dist/Audio/Adapters/AudioConfigToParams.d.ts +2 -0
  13. package/dist/Audio/Adapters/AudioConfigToParams.js +2 -0
  14. package/dist/Audio/Adapters/AudioConfigToParams.js.map +1 -0
  15. package/dist/Audio/Adapters/EntityToConfig.d.ts +1 -1
  16. package/dist/Audio/Adapters/EntityToConfig.js +1 -1
  17. package/dist/Audio/Adapters/EntityToConfig.js.map +1 -1
  18. package/dist/Audio/Adapters/index.d.ts +1 -1
  19. package/dist/Audio/Factories/AudioFactory.js +1 -1
  20. package/dist/Audio/Factories/AudioFactory.js.map +1 -1
  21. package/dist/Audio/Wrappers/AbstractAudioWrapper.js +1 -1
  22. package/dist/Audio/Wrappers/AbstractAudioWrapper.js.map +1 -1
  23. package/dist/Camera/Adapters/ConfigToParams.d.ts +1 -1
  24. package/dist/Camera/Adapters/ConfigToParams.js +1 -1
  25. package/dist/Camera/Adapters/ConfigToParams.js.map +1 -1
  26. package/dist/Camera/Adapters/EntityToConfig.d.ts +1 -1
  27. package/dist/Camera/Adapters/EntityToConfig.js +1 -1
  28. package/dist/Camera/Adapters/EntityToConfig.js.map +1 -1
  29. package/dist/Camera/Adapters/index.d.ts +1 -1
  30. package/dist/Camera/Factories/CameraFactory.js +1 -1
  31. package/dist/Camera/Factories/CameraFactory.js.map +1 -1
  32. package/dist/Camera/Wrappers/OrthographicCameraWrapper.js +1 -1
  33. package/dist/Camera/Wrappers/OrthographicCameraWrapper.js.map +1 -1
  34. package/dist/Camera/Wrappers/PerspectiveCameraWrapper.js +1 -1
  35. package/dist/Camera/Wrappers/PerspectiveCameraWrapper.js.map +1 -1
  36. package/dist/Color/Adapters/EntityToConfig.d.ts +1 -1
  37. package/dist/Color/Adapters/EntityToConfig.js +1 -1
  38. package/dist/Color/Adapters/EntityToConfig.js.map +1 -1
  39. package/dist/Color/Wrappers/ColorWrapper.js +1 -1
  40. package/dist/Color/Wrappers/ColorWrapper.js.map +1 -1
  41. package/dist/Controls/Adapters/ConfigToParams.d.ts +1 -1
  42. package/dist/Controls/Adapters/ConfigToParams.js +1 -1
  43. package/dist/Controls/Adapters/ConfigToParams.js.map +1 -1
  44. package/dist/Controls/Factories/ControlsFactory.js +1 -1
  45. package/dist/Controls/Factories/ControlsFactory.js.map +1 -1
  46. package/dist/Controls/Wrappers/FpsControls/FpsControlsWrapper.js +1 -1
  47. package/dist/Controls/Wrappers/OrbitControls/OrbitControlsWrapper.js +1 -1
  48. package/dist/Controls/index.d.ts +1 -0
  49. package/dist/EnvMap/Adapters/ConfigToParams.d.ts +1 -1
  50. package/dist/EnvMap/Adapters/ConfigToParams.js +1 -1
  51. package/dist/EnvMap/Adapters/ConfigToParams.js.map +1 -1
  52. package/dist/EnvMap/Adapters/EntityToConfig.d.ts +1 -1
  53. package/dist/EnvMap/Adapters/EntityToConfig.js +1 -1
  54. package/dist/EnvMap/Adapters/EntityToConfig.js.map +1 -1
  55. package/dist/EnvMap/Factories/EnvMapFactory.js +1 -1
  56. package/dist/EnvMap/Factories/EnvMapFactory.js.map +1 -1
  57. package/dist/EnvMap/Wrappers/EnvMapWrapper.js +1 -1
  58. package/dist/EnvMap/Wrappers/EnvMapWrapper.js.map +1 -1
  59. package/dist/EnvMap/index.d.ts +1 -1
  60. package/dist/Fog/Adapters/ConfigToParams.d.ts +1 -1
  61. package/dist/Fog/Adapters/ConfigToParams.js +1 -1
  62. package/dist/Fog/Adapters/ConfigToParams.js.map +1 -1
  63. package/dist/Fog/Adapters/EntityToConfig.d.ts +1 -1
  64. package/dist/Fog/Adapters/EntityToConfig.js +1 -1
  65. package/dist/Fog/Adapters/EntityToConfig.js.map +1 -1
  66. package/dist/Fog/Factories/FogFactory.js +1 -1
  67. package/dist/Fog/Factories/FogFactory.js.map +1 -1
  68. package/dist/Fog/Wrappers/FogWrapper.js +1 -1
  69. package/dist/Fog/Wrappers/FogWrapper.js.map +1 -1
  70. package/dist/Fog/index.d.ts +1 -0
  71. package/dist/Fsm/Adapters/ConfigToParams.d.ts +1 -1
  72. package/dist/Fsm/Adapters/ConfigToParams.js +1 -1
  73. package/dist/Fsm/Adapters/ConfigToParams.js.map +1 -1
  74. package/dist/Fsm/Adapters/EntityToConfig.d.ts +1 -1
  75. package/dist/Fsm/Adapters/EntityToConfig.js +1 -1
  76. package/dist/Fsm/Adapters/EntityToConfig.js.map +1 -1
  77. package/dist/Fsm/Factories/FsmInstanceFactory.js +1 -1
  78. package/dist/Fsm/Factories/FsmInstanceFactory.js.map +1 -1
  79. package/dist/Fsm/Factories/FsmSourceFactory.js +1 -1
  80. package/dist/Fsm/Factories/FsmSourceFactory.js.map +1 -1
  81. package/dist/Fsm/Wrappers/FsmWrapper.js +1 -1
  82. package/dist/Fsm/Wrappers/FsmWrapper.js.map +1 -1
  83. package/dist/Intersections/Adapters/ConfigToParams.d.ts +1 -1
  84. package/dist/Intersections/Adapters/ConfigToParams.js +1 -1
  85. package/dist/Intersections/Adapters/ConfigToParams.js.map +1 -1
  86. package/dist/Intersections/Adapters/EntityToConfig.d.ts +1 -1
  87. package/dist/Intersections/Adapters/EntityToConfig.js +1 -1
  88. package/dist/Intersections/Adapters/EntityToConfig.js.map +1 -1
  89. package/dist/Intersections/Factories/IntersectionsWatcherFactory.js +1 -1
  90. package/dist/Intersections/Factories/IntersectionsWatcherFactory.js.map +1 -1
  91. package/dist/Intersections/Watchers/AbstractIntersectionsWatcher.js +1 -1
  92. package/dist/Intersections/Watchers/AbstractIntersectionsWatcher.js.map +1 -1
  93. package/dist/Intersections/index.d.ts +1 -1
  94. package/dist/Kinematic/Adapters/ConfigToParams.d.ts +1 -1
  95. package/dist/Kinematic/Adapters/ConfigToParams.js +1 -1
  96. package/dist/Kinematic/Adapters/ConfigToParams.js.map +1 -1
  97. package/dist/Kinematic/Adapters/EntityToConfig.d.ts +1 -1
  98. package/dist/Kinematic/Adapters/EntityToConfig.js +1 -1
  99. package/dist/Kinematic/Adapters/EntityToConfig.js.map +1 -1
  100. package/dist/Kinematic/Adapters/index.d.ts +1 -1
  101. package/dist/Light/Adapters/ConfigToParams.d.ts +1 -1
  102. package/dist/Light/Adapters/ConfigToParams.js +1 -1
  103. package/dist/Light/Adapters/ConfigToParams.js.map +1 -1
  104. package/dist/Light/Adapters/EntityToConfig.d.ts +1 -1
  105. package/dist/Light/Adapters/EntityToConfig.js +1 -1
  106. package/dist/Light/Adapters/EntityToConfig.js.map +1 -1
  107. package/dist/Light/Factories/LightFactory.js +1 -1
  108. package/dist/Light/Factories/LightFactory.js.map +1 -1
  109. package/dist/Light/Wrappers/AbstractLightWrapper.js +1 -1
  110. package/dist/Light/Wrappers/AbstractLightWrapper.js.map +1 -1
  111. package/dist/Light/index.d.ts +1 -0
  112. package/dist/Material/Adapters/ConfigToParams.d.ts +1 -1
  113. package/dist/Material/Adapters/ConfigToParams.js +1 -1
  114. package/dist/Material/Adapters/ConfigToParams.js.map +1 -1
  115. package/dist/Material/Adapters/EntityToConfig.d.ts +1 -1
  116. package/dist/Material/Adapters/EntityToConfig.js +1 -1
  117. package/dist/Material/Adapters/EntityToConfig.js.map +1 -1
  118. package/dist/Material/Factories/MaterialFactory.js +1 -1
  119. package/dist/Material/Factories/MaterialFactory.js.map +1 -1
  120. package/dist/Material/Wrappers/MaterialWrapper.js +1 -1
  121. package/dist/Material/Wrappers/MaterialWrapper.js.map +1 -1
  122. package/dist/Material/index.d.ts +1 -0
  123. package/dist/Models3d/Adapters/ConfigToParams.d.ts +1 -1
  124. package/dist/Models3d/Adapters/ConfigToParams.js +1 -1
  125. package/dist/Models3d/Adapters/ConfigToParams.js.map +1 -1
  126. package/dist/Models3d/Adapters/EntityToConfig.d.ts +1 -1
  127. package/dist/Models3d/Adapters/EntityToConfig.js +1 -1
  128. package/dist/Models3d/Adapters/EntityToConfig.js.map +1 -1
  129. package/dist/Models3d/Entities/Model3d.js +1 -1
  130. package/dist/Models3d/Entities/Model3d.js.map +1 -1
  131. package/dist/Models3d/Factories/Models3dFactory.js +1 -1
  132. package/dist/Models3d/Factories/Models3dFactory.js.map +1 -1
  133. package/dist/Models3d/index.d.ts +1 -1
  134. package/dist/Particles/Adapters/ConfigToParams.d.ts +1 -1
  135. package/dist/Particles/Adapters/ConfigToParams.js +1 -1
  136. package/dist/Particles/Adapters/ConfigToParams.js.map +1 -1
  137. package/dist/Particles/Adapters/EntityToConfig.d.ts +1 -1
  138. package/dist/Particles/Adapters/EntityToConfig.js +1 -1
  139. package/dist/Particles/Adapters/EntityToConfig.js.map +1 -1
  140. package/dist/Particles/Factories/ParticlesFactory.js +1 -1
  141. package/dist/Particles/Factories/ParticlesFactory.js.map +1 -1
  142. package/dist/Particles/Wrappers/ParticlesWrapper.js +1 -1
  143. package/dist/Particles/Wrappers/ParticlesWrapper.js.map +1 -1
  144. package/dist/Particles/index.d.ts +1 -1
  145. package/dist/Physics/Adapters/EntityToConfig.d.ts +1 -1
  146. package/dist/Physics/Adapters/EntityToConfig.js +1 -1
  147. package/dist/Physics/Adapters/EntityToConfig.js.map +1 -1
  148. package/dist/Physics/Adapters/PhysicsBodyConfigToParams.d.ts +1 -1
  149. package/dist/Physics/Adapters/PhysicsBodyConfigToParams.js +1 -1
  150. package/dist/Physics/Adapters/PhysicsBodyConfigToParams.js.map +1 -1
  151. package/dist/Physics/Adapters/PhysicsWorldConfigToParams.d.ts +1 -1
  152. package/dist/Physics/Adapters/PhysicsWorldConfigToParams.js +1 -1
  153. package/dist/Physics/Adapters/PhysicsWorldConfigToParams.js.map +1 -1
  154. package/dist/Physics/Entities/PhysicsBody.js +1 -1
  155. package/dist/Physics/Entities/PhysicsBody.js.map +1 -1
  156. package/dist/Physics/Factories/PhysicsBodyFactory.js +1 -1
  157. package/dist/Physics/Factories/PhysicsBodyFactory.js.map +1 -1
  158. package/dist/Renderer/Adapters/ConfigToParams.d.ts +1 -1
  159. package/dist/Renderer/Adapters/ConfigToParams.js +1 -1
  160. package/dist/Renderer/Adapters/ConfigToParams.js.map +1 -1
  161. package/dist/Renderer/Adapters/EntityToConfig.d.ts +1 -1
  162. package/dist/Renderer/Adapters/EntityToConfig.js +1 -1
  163. package/dist/Renderer/Adapters/EntityToConfig.js.map +1 -1
  164. package/dist/Renderer/Factories/RendererFactory.js +1 -1
  165. package/dist/Renderer/Factories/RendererFactory.js.map +1 -1
  166. package/dist/Renderer/Wrappers/RendererWrapper.js +1 -1
  167. package/dist/Renderer/Wrappers/RendererWrapper.js.map +1 -1
  168. package/dist/Renderer/index.d.ts +1 -1
  169. package/dist/Scene/Adapters/ConfigToParams.d.ts +1 -1
  170. package/dist/Scene/Adapters/ConfigToParams.js +1 -1
  171. package/dist/Scene/Adapters/ConfigToParams.js.map +1 -1
  172. package/dist/Scene/Adapters/EntityToConfig.d.ts +1 -1
  173. package/dist/Scene/Adapters/EntityToConfig.js +1 -1
  174. package/dist/Scene/Adapters/EntityToConfig.js.map +1 -1
  175. package/dist/Scene/Factories/SceneFactory.js +1 -1
  176. package/dist/Scene/Factories/SceneFactory.js.map +1 -1
  177. package/dist/Scene/Wrappers/SceneWrapper.js +1 -1
  178. package/dist/Scene/Wrappers/SceneWrapper.js.map +1 -1
  179. package/dist/Scene/index.d.ts +1 -0
  180. package/dist/Space/Adapters/ConfigToParams.d.ts +1 -1
  181. package/dist/Space/Adapters/ConfigToParams.js +1 -1
  182. package/dist/Space/Adapters/ConfigToParams.js.map +1 -1
  183. package/dist/Space/Adapters/EntityToConfig.d.ts +1 -1
  184. package/dist/Space/Adapters/EntityToConfig.js +1 -1
  185. package/dist/Space/Adapters/EntityToConfig.js.map +1 -1
  186. package/dist/Space/Entities/Space.js +1 -1
  187. package/dist/Space/Entities/Space.js.map +1 -1
  188. package/dist/Space/Factories/SpaceFactory.js +1 -1
  189. package/dist/Space/Factories/SpaceFactory.js.map +1 -1
  190. package/dist/Space/index.d.ts +1 -1
  191. package/dist/Spatial/Adapters/ConfigToParams.d.ts +1 -1
  192. package/dist/Spatial/Adapters/ConfigToParams.js +1 -1
  193. package/dist/Spatial/Adapters/ConfigToParams.js.map +1 -1
  194. package/dist/Spatial/Adapters/ConfigToParamsSpatialData.d.ts +1 -1
  195. package/dist/Spatial/Adapters/ConfigToParamsSpatialData.js +1 -1
  196. package/dist/Spatial/Adapters/ConfigToParamsSpatialData.js.map +1 -1
  197. package/dist/Spatial/Adapters/EntityToConfig.d.ts +1 -1
  198. package/dist/Spatial/Adapters/EntityToConfig.js +1 -1
  199. package/dist/Spatial/Adapters/EntityToConfig.js.map +1 -1
  200. package/dist/Spatial/Factories/SpatialGridFactory.js +1 -1
  201. package/dist/Spatial/Factories/SpatialGridFactory.js.map +1 -1
  202. package/dist/Spatial/Wrappers/SpatialGridWrapper.js +1 -1
  203. package/dist/Spatial/Wrappers/SpatialGridWrapper.js.map +1 -1
  204. package/dist/Text/Adapters/ConfigToParams.d.ts +1 -1
  205. package/dist/Text/Adapters/ConfigToParams.js +1 -1
  206. package/dist/Text/Adapters/ConfigToParams.js.map +1 -1
  207. package/dist/Text/Adapters/EntityToConfig.d.ts +1 -1
  208. package/dist/Text/Adapters/EntityToConfig.js +1 -1
  209. package/dist/Text/Adapters/EntityToConfig.js.map +1 -1
  210. package/dist/Text/Factories/TextFactory.js +1 -1
  211. package/dist/Text/Factories/TextFactory.js.map +1 -1
  212. package/dist/Text/Wrappers/TextTextureWrapper.js +1 -1
  213. package/dist/Text/Wrappers/TextTextureWrapper.js.map +1 -1
  214. package/dist/Text/Wrappers/TextWrapper.js +1 -1
  215. package/dist/Text/Wrappers/TextWrapper.js.map +1 -1
  216. package/dist/Text/index.d.ts +1 -0
  217. package/dist/ThreeLib/Utils/Object3dUtils.d.ts +1 -1
  218. package/dist/ThreeLib/Utils/Object3dUtils.js +1 -1
  219. package/dist/ThreeLib/Utils/Object3dUtils.js.map +1 -1
  220. package/dist/TransformDrive/Entities/Agents/KinematicTransformAgent.js +1 -1
  221. package/dist/TransformDrive/Entities/Agents/KinematicTransformAgent.js.map +1 -1
  222. package/dist/index.js +1 -1
  223. package/legal/NOTICE.md +1 -1
  224. package/legal/THIRD_PARTY_LICENSES.md +1 -1
  225. package/package.json +2 -1
  226. package/dist/Audio/Adapters/ConfigToParams.d.ts +0 -2
  227. package/dist/Audio/Adapters/ConfigToParams.js +0 -2
  228. package/dist/Audio/Adapters/ConfigToParams.js.map +0 -1
@@ -1 +1 @@
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 { configToParams } 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 });\n}\n"],"names":["create","params","isIntersectionsCameraWatcherParams","IntersectionsCameraWatcher","isIntersectionsDirectionWatcherParams","IntersectionsDirectionWatcher","Error","name","IntersectionsWatcherFactory","factory","ReactiveFactory","FactoryType","IntersectionsWatcher","Object","assign","configToParams"],"mappings":"0eAOA,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,+BAClC"}
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,2 +1,2 @@
1
- import{isNotDefined,isDefined}from"../../packages/anarchy-shared/src/Utils/CheckUtils.js";import{Raycaster}from"three";import{AbstractWatcher}from"../../Abstract/Watchers/AbstractWatcher.js";import{WatcherType}from"../../Abstract/Constants/WatcherType.js";import{intersectionsToConfig}from"../Adapters/EntityToConfig.js";function AbstractIntersectionsWatcher({isAutoStart:isAutoStart,tags:tags,name:name,intersectionsLoop:intersectionsLoop,far:far,...rest}){const abstractWatcher=AbstractWatcher(WatcherType.IntersectionWatcher,name,tags);let raycaster=new Raycaster;const actors=new Map,addActors=actorsList=>actorsList.forEach(addActor),addActor=actor=>{if(actors.has(actor.id))throw new Error(`[IntersectionsWatcher]: Cannot add actor to intersection watcher: Actor "${actor.name} "(id: "${actor.id}") already exists in the watcher "${abstractWatcher.id}"`);actors.set(actor.id,actor)},removeActor=actor=>{actors.delete(actor.id)},removeActorById=actorId=>{actors.delete(actorId)},destroySub$=abstractWatcher.destroy$.subscribe(()=>{raycaster=null,actors.clear(),destroySub$.unsubscribe()}),result=Object.assign(abstractWatcher,{addActor:addActor,addActors:addActors,getActors:()=>actors,getIntersectionsLoop:()=>intersectionsLoop,isAutoStart:isAutoStart,isStarted:!1,removeActor:removeActor,removeActors:actors2=>actors2.forEach(removeActor),removeActorsByIds:actorsIds=>actorsIds.forEach(removeActorById),removeActorById:removeActorById,raycaster:raycaster,getModelsFromActors:function(){const models=[];for(const actor of actors.values())models.push(actor.model3d.getRawModel3d());return models},setFar:far2=>{if(isNotDefined(raycaster))throw new Error("[IntersectionsWatcher]: Cannot set far: raycaster is not defined");raycaster.far=far2},serialize:()=>intersectionsToConfig(result)});return isDefined(far)&&(raycaster.far=far),rest.actors.length>0&&addActors(rest.actors),isAutoStart&&result.enabled$.next(!0),result}export{AbstractIntersectionsWatcher};
1
+ import{isNotDefined,isDefined}from"../../packages/anarchy-shared/src/Utils/CheckUtils.js";import{Raycaster}from"three";import{AbstractWatcher}from"../../Abstract/Watchers/AbstractWatcher.js";import{WatcherType}from"../../Abstract/Constants/WatcherType.js";import{intersectionsEntityToConfig}from"../Adapters/EntityToConfig.js";function AbstractIntersectionsWatcher({isAutoStart:isAutoStart,tags:tags,name:name,intersectionsLoop:intersectionsLoop,far:far,...rest}){const abstractWatcher=AbstractWatcher(WatcherType.IntersectionWatcher,name,tags);let raycaster=new Raycaster;const actors=new Map,addActors=actorsList=>actorsList.forEach(addActor),addActor=actor=>{if(actors.has(actor.id))throw new Error(`[IntersectionsWatcher]: Cannot add actor to intersection watcher: Actor "${actor.name} "(id: "${actor.id}") already exists in the watcher "${abstractWatcher.id}"`);actors.set(actor.id,actor)},removeActor=actor=>{actors.delete(actor.id)},removeActorById=actorId=>{actors.delete(actorId)},destroySub$=abstractWatcher.destroy$.subscribe(()=>{raycaster=null,actors.clear(),destroySub$.unsubscribe()}),result=Object.assign(abstractWatcher,{addActor:addActor,addActors:addActors,getActors:()=>actors,getIntersectionsLoop:()=>intersectionsLoop,isAutoStart:isAutoStart,isStarted:!1,removeActor:removeActor,removeActors:actors2=>actors2.forEach(removeActor),removeActorsByIds:actorsIds=>actorsIds.forEach(removeActorById),removeActorById:removeActorById,raycaster:raycaster,getModelsFromActors:function(){const models=[];for(const actor of actors.values())models.push(actor.model3d.getRawModel3d());return models},setFar:far2=>{if(isNotDefined(raycaster))throw new Error("[IntersectionsWatcher]: Cannot set far: raycaster is not defined");raycaster.far=far2},serialize:()=>intersectionsEntityToConfig(result)});return isDefined(far)&&(raycaster.far=far),rest.actors.length>0&&addActors(rest.actors),isAutoStart&&result.enabled$.next(!0),result}export{AbstractIntersectionsWatcher};
2
2
  //# sourceMappingURL=AbstractIntersectionsWatcher.js.map
@@ -1 +1 @@
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 { intersectionsToConfig } 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 '@Anarchy/Shared/Utils';\nimport { isDefined, isNotDefined } from '@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 => intersectionsToConfig(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","intersectionsToConfig","isDefined","length","enabled$","next"],"mappings":"iUAkBO,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,sBAAsBlB,UAQzE,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 '@Anarchy/Shared/Utils';\nimport { isDefined, isNotDefined } from '@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,4 +1,4 @@
1
- export { configToParams as intersectionsWatcherConfigToParams } from './Adapters';
1
+ export * from './Adapters';
2
2
  export * from './Factories';
3
3
  export type * from './Models';
4
4
  export * from './Registries';
@@ -1,2 +1,2 @@
1
1
  import { TKinematicConfig, TKinematicParams } from '../Models';
2
- export declare function configToParams(config: TKinematicConfig): TKinematicParams;
2
+ export declare function kinematicConfigToParams(config: TKinematicConfig): TKinematicParams;
@@ -1,2 +1,2 @@
1
- import{isDefined}from"../../packages/anarchy-shared/src/Utils/CheckUtils.js";import{Quaternion,Vector3}from"three";import{toQuaternion}from"../../Math/Utils/AnglesUtils.js";function configToParams(config){const{state:state,target:target,...rest}=config,{linearDirection:linearDirection,angularDirection:angularDirection,...stateRest}=state??{},{positionThreshold:positionThreshold,position:position,rotationThreshold:rotationThreshold,rotation:rotation,...targetRest}=target??{};return{...rest,state:{...stateRest,linearDirection:isDefined(linearDirection)?new Vector3(linearDirection.x,linearDirection.y,linearDirection.z):new Vector3,angularDirection:isDefined(angularDirection)?toQuaternion(angularDirection):void 0},target:{...targetRest,positionThreshold:positionThreshold??.01,position:isDefined(position)?new Vector3(position.x,position.y,position.z):new Vector3,rotationThreshold:rotationThreshold??1e-4,rotation:isDefined(rotation)?new Quaternion(rotation.x,rotation.y,rotation.z,rotation.w):new Quaternion}}}export{configToParams};
1
+ import{isDefined}from"../../packages/anarchy-shared/src/Utils/CheckUtils.js";import{Quaternion,Vector3}from"three";import{toQuaternion}from"../../Math/Utils/AnglesUtils.js";function kinematicConfigToParams(config){const{state:state,target:target,...rest}=config,{linearDirection:linearDirection,angularDirection:angularDirection,...stateRest}=state??{},{positionThreshold:positionThreshold,position:position,rotationThreshold:rotationThreshold,rotation:rotation,...targetRest}=target??{};return{...rest,state:{...stateRest,linearDirection:isDefined(linearDirection)?new Vector3(linearDirection.x,linearDirection.y,linearDirection.z):new Vector3,angularDirection:isDefined(angularDirection)?toQuaternion(angularDirection):void 0},target:{...targetRest,positionThreshold:positionThreshold??.01,position:isDefined(position)?new Vector3(position.x,position.y,position.z):new Vector3,rotationThreshold:rotationThreshold??1e-4,rotation:isDefined(rotation)?new Quaternion(rotation.x,rotation.y,rotation.z,rotation.w):new Quaternion}}}export{kinematicConfigToParams};
2
2
  //# sourceMappingURL=ConfigToParams.js.map
@@ -1 +1 @@
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 '@Anarchy/Shared/Utils';\nimport { Quaternion, Vector3 } from 'three';\n\nexport function configToParams(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":["configToParams","config","state","target","rest","linearDirection","angularDirection","stateRest","positionThreshold","position","rotationThreshold","rotation","targetRest","isDefined","Vector3","x","y","z","toQuaternion","Quaternion","w"],"mappings":"6KAKO,SAASA,eAAeC,QAC7B,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 '@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,3 +1,3 @@
1
1
  import { TKinematicConfig } from '../Models';
2
2
  import { TKinematicTransformAgent } from '../../TransformDrive';
3
- export declare function kinematicToConfig(entity: TKinematicTransformAgent): TKinematicConfig;
3
+ export declare function kinematicEntityToConfig(entity: TKinematicTransformAgent): TKinematicConfig;
@@ -1,2 +1,2 @@
1
- import{isDefined}from"../../packages/anarchy-shared/src/Utils/CheckUtils.js";import{filterOutEmptyFields}from"../../packages/anarchy-shared/src/Utils/ObjectUtils.js";import{Euler}from"three";import{quaternionToXyzw,vector3ToXyz,eulerToXyz}from"../../Utils/TransformUtils.js";function kinematicToConfig(entity){const{linearSpeed:linearSpeed,linearDirection:linearDirection,angularSpeed:angularSpeed,angularDirection:angularDirection,radius:radius,forwardAxis:forwardAxis,isInfiniteRotation:isInfiniteRotation}=entity.data.state;let target;return isDefined(entity.data.target)&&(target=filterOutEmptyFields({position:isDefined(entity.data.target.position)?vector3ToXyz(entity.data.target.position):void 0,rotation:isDefined(entity.data.target.rotation)?quaternionToXyzw(entity.data.target.rotation):void 0,positionThreshold:entity.data.target.positionThreshold,rotationThreshold:entity.data.target.rotationThreshold})),filterOutEmptyFields({isAutoUpdate:entity.autoUpdate$.value,target:target,state:{linearSpeed:linearSpeed,linearDirection:vector3ToXyz(linearDirection),angularSpeed:angularSpeed,angularDirection:eulerToXyz((new Euler).setFromQuaternion(angularDirection)),radius:radius,forwardAxis:forwardAxis,isInfiniteRotation:isInfiniteRotation}})}export{kinematicToConfig};
1
+ import{isDefined}from"../../packages/anarchy-shared/src/Utils/CheckUtils.js";import{filterOutEmptyFields}from"../../packages/anarchy-shared/src/Utils/ObjectUtils.js";import{Euler}from"three";import{quaternionToXyzw,vector3ToXyz,eulerToXyz}from"../../Utils/TransformUtils.js";function kinematicEntityToConfig(entity){const{linearSpeed:linearSpeed,linearDirection:linearDirection,angularSpeed:angularSpeed,angularDirection:angularDirection,radius:radius,forwardAxis:forwardAxis,isInfiniteRotation:isInfiniteRotation}=entity.data.state;let target;return isDefined(entity.data.target)&&(target=filterOutEmptyFields({position:isDefined(entity.data.target.position)?vector3ToXyz(entity.data.target.position):void 0,rotation:isDefined(entity.data.target.rotation)?quaternionToXyzw(entity.data.target.rotation):void 0,positionThreshold:entity.data.target.positionThreshold,rotationThreshold:entity.data.target.rotationThreshold})),filterOutEmptyFields({isAutoUpdate:entity.autoUpdate$.value,target:target,state:{linearSpeed:linearSpeed,linearDirection:vector3ToXyz(linearDirection),angularSpeed:angularSpeed,angularDirection:eulerToXyz((new Euler).setFromQuaternion(angularDirection)),radius:radius,forwardAxis:forwardAxis,isInfiniteRotation:isInfiniteRotation}})}export{kinematicEntityToConfig};
2
2
  //# sourceMappingURL=EntityToConfig.js.map
@@ -1 +1 @@
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 '@Anarchy/Shared/Utils';\nimport { Euler } from 'three';\n\nexport function kinematicToConfig(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":["kinematicToConfig","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,kBAAkBC,QAChC,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 '@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,2 +1,2 @@
1
- export { configToParams as kinematicConfigToParams } from './ConfigToParams';
1
+ export * from './ConfigToParams';
2
2
  export * from './EntityToConfig';
@@ -1,2 +1,2 @@
1
1
  import { TAnyLightConfig, TLightParams } from '../Models';
2
- export declare function configToParams(config: TAnyLightConfig): TLightParams;
2
+ export declare function lightConfigToParams(config: TAnyLightConfig): TLightParams;
@@ -1,2 +1,2 @@
1
- import{configToParamsCameraOptionsOnly}from"../../Camera/Adapters/ConfigToParams.js";import{isNotDefined,isDefined}from"../../packages/anarchy-shared/src/Utils/CheckUtils.js";import{Vector2,Color}from"three";import{configToParamsObject3d}from"../../ThreeLib/Utils/Object3dUtils.js";function configToParams(config){const{position:position,rotation:rotation,scale:scale,layers:layers,color:color,shadow:shadow,...rest}=config;return{...rest,...configToParamsObject3d({position:position,rotation:rotation,scale:scale,layers:layers}),...(colorStr=color,{color:new Color(colorStr)}),...getLightShadowParams(shadow)};var colorStr}function getLightShadowParams(shadow){if(isNotDefined(shadow))return{};let camera={};return isDefined(shadow.camera)&&(camera=configToParamsCameraOptionsOnly(shadow.camera)),{shadow:{...shadow,camera:camera,mapSize:new Vector2(shadow.mapSize.x,shadow.mapSize.y)}}}export{configToParams};
1
+ import{configToParamsCameraOptionsOnly}from"../../Camera/Adapters/ConfigToParams.js";import{isNotDefined,isDefined}from"../../packages/anarchy-shared/src/Utils/CheckUtils.js";import{Vector2,Color}from"three";import{object3dConfigToParams}from"../../ThreeLib/Utils/Object3dUtils.js";function lightConfigToParams(config){const{position:position,rotation:rotation,scale:scale,layers:layers,color:color,shadow:shadow,...rest}=config;return{...rest,...object3dConfigToParams({position:position,rotation:rotation,scale:scale,layers:layers}),...(colorStr=color,{color:new Color(colorStr)}),...getLightShadowParams(shadow)};var colorStr}function getLightShadowParams(shadow){if(isNotDefined(shadow))return{};let camera={};return isDefined(shadow.camera)&&(camera=configToParamsCameraOptionsOnly(shadow.camera)),{shadow:{...shadow,camera:camera,mapSize:new Vector2(shadow.mapSize.x,shadow.mapSize.y)}}}export{lightConfigToParams};
2
2
  //# sourceMappingURL=ConfigToParams.js.map
@@ -1 +1 @@
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 { configToParamsObject3d } from '@Anarchy/Engine/ThreeLib';\nimport { isDefined, isNotDefined } from '@Anarchy/Shared/Utils';\nimport { Color, Vector2 } from 'three';\n\nexport function configToParams(config: TAnyLightConfig): TLightParams {\n const { position, rotation, scale, layers, color, shadow, ...rest } = config;\n\n return {\n ...rest,\n ...configToParamsObject3d({ 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":["configToParams","config","position","rotation","scale","layers","color","shadow","rest","configToParamsObject3d","colorStr","Color","getLightShadowParams","isNotDefined","camera","isDefined","configToParamsCameraOptionsOnly","mapSize","Vector2","x","y"],"mappings":"0RAMO,SAASA,eAAeC,QAC7B,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 '@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,5 +1,5 @@
1
1
  import { TAbstractLightWrapper, TAmbientLightConfig, TAnyLight, TDirectionalLightConfig, THemisphereLightConfig, THemisphereLightWrapper, TLightShadowConfig, TPointLightConfig, TPointLightWrapper, TRectAreaLightConfig, TRectAreaLightWrapper, TSpotLightConfig, TSpotLightWrapper } from '../Models';
2
- export declare function lightToConfig<T extends TAnyLight>(entity: TAbstractLightWrapper<T>): TDirectionalLightConfig | THemisphereLightConfig | TRectAreaLightConfig | TAmbientLightConfig | TSpotLightConfig;
2
+ export declare function lightEntityToConfig<T extends TAnyLight>(entity: TAbstractLightWrapper<T>): TDirectionalLightConfig | THemisphereLightConfig | TRectAreaLightConfig | TAmbientLightConfig | TSpotLightConfig;
3
3
  export declare function onlyHemisphereLightToConfig(entity: THemisphereLightWrapper): Partial<THemisphereLightConfig>;
4
4
  export declare function onlyRectAreaLightToConfig(entity: TRectAreaLightWrapper): Partial<TRectAreaLightConfig>;
5
5
  export declare function onlyPointLightToConfig(entity: TPointLightWrapper): Partial<TPointLightConfig>;
@@ -1,2 +1,2 @@
1
- import{isNotDefined,isDefined}from"../../packages/anarchy-shared/src/Utils/CheckUtils.js";import{filterOutEmptyFields}from"../../packages/anarchy-shared/src/Utils/ObjectUtils.js";import{Vector2}from"three";import{getCommonCameraConfig,getPerspectiveCameraOnlyConfig,getOrthographicCameraOnlyConfig}from"../../Camera/Adapters/EntityToConfig.js";import{LightType}from"../Constants/LightType.js";import{vector2ToXy}from"../../Utils/TransformUtils.js";import{extractSerializableRegistrableFields}from"../../Mixins/Generics/ExtractSerializableRegistrableFields.js";import{serializeColor}from"../../Color/Adapters/EntityToConfig.js";import{isPerspectiveCameraParams,isOrthographicCameraParams}from"../../Camera/Utils/CameraUtils.js";function lightToConfig(entity){const{drive:drive}=entity,json=entity.entity.toJSON().object;return filterOutEmptyFields({type:json.type,color:serializeColor(entity.entity.color),intensity:json.intensity,castShadow:json.castShadow,...onlyHemisphereLightToConfig(entity),...onlyRectAreaLightToConfig(entity),...onlyPointLightToConfig(entity),...onlySpotLightToConfig(entity),...onlyLightShadowToConfig(entity),...extractSerializableRegistrableFields(entity),...drive.serialize()})}function onlyHemisphereLightToConfig(entity){return entity.getType()!==LightType.Hemisphere?{}:filterOutEmptyFields({groundColor:serializeColor(entity.entity.groundColor)})}function onlyRectAreaLightToConfig(entity){if(entity.getType()!==LightType.RectArea)return{};const json=entity.entity.toJSON().object;return filterOutEmptyFields({width:json.width,height:json.height})}function onlyPointLightToConfig(entity){if(entity.getType()!==LightType.Point)return{};const json=entity.entity.toJSON().object;return filterOutEmptyFields({distance:json.distance,decay:json.decay})}function onlySpotLightToConfig(entity){if(entity.getType()!==LightType.Spot)return{};const json=entity.entity.toJSON().object;return filterOutEmptyFields({distance:json.distance,angle:json.angle,penumbra:json.penumbra,decay:json.decay})}function onlyLightShadowToConfig(entity){const shadow=entity.entity.toJSON().object.shadow;if(isNotDefined(shadow))return{};const camera=shadow.camera,result=filterOutEmptyFields({shadow:{...shadow,mapSize:getMapSize(shadow)??getMapSize(entity.entity.shadow),normalBias:shadow.normalBias??entity.entity.shadow?.normalBias,camera:void 0}});if(isNotDefined(camera))return result;const cameraConfig=Object.assign(getCommonCameraConfig(camera),{type:camera.type});return isPerspectiveCameraParams(camera)&&Object.assign(cameraConfig,getPerspectiveCameraOnlyConfig(camera)),isOrthographicCameraParams(camera)&&Object.assign(cameraConfig,getOrthographicCameraOnlyConfig(camera)),result.shadow.camera=cameraConfig,result}function getMapSize(shadow){let mapSize;return isDefined(shadow)&&isDefined(shadow.mapSize)&&(mapSize=isDefined(shadow?.mapSize)&&isDefined((shadow?.mapSize)[0])&&isDefined((shadow?.mapSize)[1])?{x:shadow.mapSize[0],y:shadow.mapSize[1]}:void 0),vector2ToXy(mapSize??new Vector2)}export{lightToConfig,onlyHemisphereLightToConfig,onlyLightShadowToConfig,onlyPointLightToConfig,onlyRectAreaLightToConfig,onlySpotLightToConfig};
1
+ import{isNotDefined,isDefined}from"../../packages/anarchy-shared/src/Utils/CheckUtils.js";import{filterOutEmptyFields}from"../../packages/anarchy-shared/src/Utils/ObjectUtils.js";import{Vector2}from"three";import{LightType}from"../Constants/LightType.js";import{getCommonCameraConfig,getPerspectiveCameraOnlyConfig,getOrthographicCameraOnlyConfig}from"../../Camera/Adapters/EntityToConfig.js";import{vector2ToXy}from"../../Utils/TransformUtils.js";import{extractSerializableRegistrableFields}from"../../Mixins/Generics/ExtractSerializableRegistrableFields.js";import{serializeColor}from"../../Color/Adapters/EntityToConfig.js";import{isPerspectiveCameraParams,isOrthographicCameraParams}from"../../Camera/Utils/CameraUtils.js";function lightEntityToConfig(entity){const{drive:drive}=entity,json=entity.entity.toJSON().object;return filterOutEmptyFields({type:json.type,color:serializeColor(entity.entity.color),intensity:json.intensity,castShadow:json.castShadow,...onlyHemisphereLightToConfig(entity),...onlyRectAreaLightToConfig(entity),...onlyPointLightToConfig(entity),...onlySpotLightToConfig(entity),...onlyLightShadowToConfig(entity),...extractSerializableRegistrableFields(entity),...drive.serialize()})}function onlyHemisphereLightToConfig(entity){return entity.getType()!==LightType.Hemisphere?{}:filterOutEmptyFields({groundColor:serializeColor(entity.entity.groundColor)})}function onlyRectAreaLightToConfig(entity){if(entity.getType()!==LightType.RectArea)return{};const json=entity.entity.toJSON().object;return filterOutEmptyFields({width:json.width,height:json.height})}function onlyPointLightToConfig(entity){if(entity.getType()!==LightType.Point)return{};const json=entity.entity.toJSON().object;return filterOutEmptyFields({distance:json.distance,decay:json.decay})}function onlySpotLightToConfig(entity){if(entity.getType()!==LightType.Spot)return{};const json=entity.entity.toJSON().object;return filterOutEmptyFields({distance:json.distance,angle:json.angle,penumbra:json.penumbra,decay:json.decay})}function onlyLightShadowToConfig(entity){const shadow=entity.entity.toJSON().object.shadow;if(isNotDefined(shadow))return{};const camera=shadow.camera,result=filterOutEmptyFields({shadow:{...shadow,mapSize:getMapSize(shadow)??getMapSize(entity.entity.shadow),normalBias:shadow.normalBias??entity.entity.shadow?.normalBias,camera:void 0}});if(isNotDefined(camera))return result;const cameraConfig=Object.assign(getCommonCameraConfig(camera),{type:camera.type});return isPerspectiveCameraParams(camera)&&Object.assign(cameraConfig,getPerspectiveCameraOnlyConfig(camera)),isOrthographicCameraParams(camera)&&Object.assign(cameraConfig,getOrthographicCameraOnlyConfig(camera)),result.shadow.camera=cameraConfig,result}function getMapSize(shadow){let mapSize;return isDefined(shadow)&&isDefined(shadow.mapSize)&&(mapSize=isDefined(shadow?.mapSize)&&isDefined((shadow?.mapSize)[0])&&isDefined((shadow?.mapSize)[1])?{x:shadow.mapSize[0],y:shadow.mapSize[1]}:void 0),vector2ToXy(mapSize??new Vector2)}export{lightEntityToConfig,onlyHemisphereLightToConfig,onlyLightShadowToConfig,onlyPointLightToConfig,onlyRectAreaLightToConfig,onlySpotLightToConfig};
2
2
  //# sourceMappingURL=EntityToConfig.js.map
@@ -1 +1 @@
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 '@Anarchy/Shared/Utils';\nimport { filterOutEmptyFields, isDefined, isNotDefined } from '@Anarchy/Shared/Utils';\nimport type { DirectionalLightShadow, Object3DJSONObject, PointLightShadow, SpotLightShadow, Vector2Like } from 'three';\nimport { Vector2 } from 'three';\n\nexport function lightToConfig<T extends TAnyLight>(entity: TAbstractLightWrapper<T>): 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":["lightToConfig","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,cAAmCC,QACjD,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 '@Anarchy/Shared/Utils';\nimport { filterOutEmptyFields, isDefined, isNotDefined } from '@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,2 +1,2 @@
1
- import{configToParams}from"../Adapters/ConfigToParams.js";import{isAmbientLightParams,isDirectionalLightParams,isPointLightParams,isHemisphereLightParams,isRectAreaLightParams,isSpotLightParams}from"../Utils/Utils.js";import{AmbientLightWrapper}from"../Wrappers/AmbientLightWrapper.js";import{DirectionalLightWrapper}from"../Wrappers/DirectionalLightWrapper.js";import{PointLightWrapper}from"../Wrappers/PointLightWrapper.js";import{HemisphereLightWrapper}from"../Wrappers/HemisphereLightWrapper.js";import{RectAreaLightWrapper}from"../Wrappers/RectAreaLightWrapper.js";import{SpotLightWrapper}from"../Wrappers/SpotLightWrapper.js";import{ReactiveFactory}from"../../Abstract/Factories/ReactiveFactory.js";import{FactoryType}from"../../Abstract/Constants/FactoryType.js";import{LightType}from"../Constants/LightType.js";function create(params,dependencies){if(params.type===LightType.Ambient&&isAmbientLightParams(params))return AmbientLightWrapper(params,dependencies);if(params.type===LightType.Directional&&isDirectionalLightParams(params))return DirectionalLightWrapper(params,dependencies);if(params.type===LightType.Point&&isPointLightParams(params))return PointLightWrapper(params,dependencies);if(params.type===LightType.Hemisphere&&isHemisphereLightParams(params))return HemisphereLightWrapper(params,dependencies);if(params.type===LightType.RectArea&&isRectAreaLightParams(params))return RectAreaLightWrapper(params,dependencies);if(params.type===LightType.Spot&&isSpotLightParams(params))return SpotLightWrapper(params,dependencies);throw new Error(`Unsupported light type: "${params.type}" or invalid params (does not match the light type)`)}function LightFactory(){const factory=ReactiveFactory(FactoryType.Light,create);return Object.assign(factory,{configToParams:configToParams})}export{LightFactory};
1
+ import{isAmbientLightParams,isDirectionalLightParams,isPointLightParams,isHemisphereLightParams,isRectAreaLightParams,isSpotLightParams}from"../Utils/Utils.js";import{lightConfigToParams}from"../Adapters/ConfigToParams.js";import{AmbientLightWrapper}from"../Wrappers/AmbientLightWrapper.js";import{DirectionalLightWrapper}from"../Wrappers/DirectionalLightWrapper.js";import{PointLightWrapper}from"../Wrappers/PointLightWrapper.js";import{HemisphereLightWrapper}from"../Wrappers/HemisphereLightWrapper.js";import{RectAreaLightWrapper}from"../Wrappers/RectAreaLightWrapper.js";import{SpotLightWrapper}from"../Wrappers/SpotLightWrapper.js";import{ReactiveFactory}from"../../Abstract/Factories/ReactiveFactory.js";import{FactoryType}from"../../Abstract/Constants/FactoryType.js";import{LightType}from"../Constants/LightType.js";function create(params,dependencies){if(params.type===LightType.Ambient&&isAmbientLightParams(params))return AmbientLightWrapper(params,dependencies);if(params.type===LightType.Directional&&isDirectionalLightParams(params))return DirectionalLightWrapper(params,dependencies);if(params.type===LightType.Point&&isPointLightParams(params))return PointLightWrapper(params,dependencies);if(params.type===LightType.Hemisphere&&isHemisphereLightParams(params))return HemisphereLightWrapper(params,dependencies);if(params.type===LightType.RectArea&&isRectAreaLightParams(params))return RectAreaLightWrapper(params,dependencies);if(params.type===LightType.Spot&&isSpotLightParams(params))return SpotLightWrapper(params,dependencies);throw new Error(`Unsupported light type: "${params.type}" or invalid params (does not match the light type)`)}function LightFactory(){const factory=ReactiveFactory(FactoryType.Light,create);return Object.assign(factory,{configToParams:lightConfigToParams})}export{LightFactory};
2
2
  //# sourceMappingURL=LightFactory.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"LightFactory.js","sources":["../../../src/Light/Factories/LightFactory.ts"],"sourcesContent":["import type { TReactiveFactory } from '@Anarchy/Engine/Abstract';\nimport { FactoryType, ReactiveFactory } from '@Anarchy/Engine/Abstract';\nimport { configToParams } from '@Anarchy/Engine/Light/Adapters';\nimport { LightType } from '@Anarchy/Engine/Light/Constants';\nimport type { TLightFactory, TLightParams, TLightServiceDependencies, TLightWrapper } from '@Anarchy/Engine/Light/Models';\nimport { isAmbientLightParams, isDirectionalLightParams, isHemisphereLightParams, isPointLightParams, isRectAreaLightParams, isSpotLightParams } from '@Anarchy/Engine/Light/Utils';\nimport { AmbientLightWrapper, DirectionalLightWrapper, HemisphereLightWrapper, PointLightWrapper, RectAreaLightWrapper, SpotLightWrapper } from '@Anarchy/Engine/Light/Wrappers';\n\nfunction create(params: TLightParams, dependencies: TLightServiceDependencies): TLightWrapper | never {\n if (params.type === LightType.Ambient && isAmbientLightParams(params)) return AmbientLightWrapper(params, dependencies);\n if (params.type === LightType.Directional && isDirectionalLightParams(params)) return DirectionalLightWrapper(params, dependencies);\n if (params.type === LightType.Point && isPointLightParams(params)) return PointLightWrapper(params, dependencies);\n if (params.type === LightType.Hemisphere && isHemisphereLightParams(params)) return HemisphereLightWrapper(params, dependencies);\n if (params.type === LightType.RectArea && isRectAreaLightParams(params)) return RectAreaLightWrapper(params, dependencies);\n if (params.type === LightType.Spot && isSpotLightParams(params)) return SpotLightWrapper(params, dependencies);\n throw new Error(`Unsupported light type: \"${params.type}\" or invalid params (does not match the light type)`);\n}\n\nexport function LightFactory(): TLightFactory {\n const factory: TReactiveFactory<TLightWrapper, TLightParams, TLightServiceDependencies> = ReactiveFactory(FactoryType.Light, create);\n\n // eslint-disable-next-line functional/immutable-data\n return Object.assign(factory, { configToParams });\n}\n"],"names":["create","params","dependencies","type","LightType","Ambient","isAmbientLightParams","AmbientLightWrapper","Directional","isDirectionalLightParams","DirectionalLightWrapper","Point","isPointLightParams","PointLightWrapper","Hemisphere","isHemisphereLightParams","HemisphereLightWrapper","RectArea","isRectAreaLightParams","RectAreaLightWrapper","Spot","isSpotLightParams","SpotLightWrapper","Error","LightFactory","factory","ReactiveFactory","FactoryType","Light","Object","assign","configToParams"],"mappings":"mzBAQA,SAASA,OAAOC,OAAsBC,cACpC,GAAID,OAAOE,OAASC,UAAUC,SAAWC,qBAAqBL,QAAS,OAAOM,oBAAoBN,OAAQC,cAC1G,GAAID,OAAOE,OAASC,UAAUI,aAAeC,yBAAyBR,QAAS,OAAOS,wBAAwBT,OAAQC,cACtH,GAAID,OAAOE,OAASC,UAAUO,OAASC,mBAAmBX,QAAS,OAAOY,kBAAkBZ,OAAQC,cACpG,GAAID,OAAOE,OAASC,UAAUU,YAAcC,wBAAwBd,QAAS,OAAOe,uBAAuBf,OAAQC,cACnH,GAAID,OAAOE,OAASC,UAAUa,UAAYC,sBAAsBjB,QAAS,OAAOkB,qBAAqBlB,OAAQC,cAC7G,GAAID,OAAOE,OAASC,UAAUgB,MAAQC,kBAAkBpB,QAAS,OAAOqB,iBAAiBrB,OAAQC,cACjG,MAAM,IAAIqB,MAAM,4BAA4BtB,OAAOE,0DACrD,CAEO,SAASqB,eACd,MAAMC,QAAoFC,gBAAgBC,YAAYC,MAAO5B,QAG7H,OAAO6B,OAAOC,OAAOL,QAAS,CAAEM,+BAClC"}
1
+ {"version":3,"file":"LightFactory.js","sources":["../../../src/Light/Factories/LightFactory.ts"],"sourcesContent":["import type { TReactiveFactory } from '@Anarchy/Engine/Abstract';\nimport { FactoryType, ReactiveFactory } from '@Anarchy/Engine/Abstract';\nimport { lightConfigToParams } from '@Anarchy/Engine/Light/Adapters';\nimport { LightType } from '@Anarchy/Engine/Light/Constants';\nimport type { TLightFactory, TLightParams, TLightServiceDependencies, TLightWrapper } from '@Anarchy/Engine/Light/Models';\nimport { isAmbientLightParams, isDirectionalLightParams, isHemisphereLightParams, isPointLightParams, isRectAreaLightParams, isSpotLightParams } from '@Anarchy/Engine/Light/Utils';\nimport { AmbientLightWrapper, DirectionalLightWrapper, HemisphereLightWrapper, PointLightWrapper, RectAreaLightWrapper, SpotLightWrapper } from '@Anarchy/Engine/Light/Wrappers';\n\nfunction create(params: TLightParams, dependencies: TLightServiceDependencies): TLightWrapper | never {\n if (params.type === LightType.Ambient && isAmbientLightParams(params)) return AmbientLightWrapper(params, dependencies);\n if (params.type === LightType.Directional && isDirectionalLightParams(params)) return DirectionalLightWrapper(params, dependencies);\n if (params.type === LightType.Point && isPointLightParams(params)) return PointLightWrapper(params, dependencies);\n if (params.type === LightType.Hemisphere && isHemisphereLightParams(params)) return HemisphereLightWrapper(params, dependencies);\n if (params.type === LightType.RectArea && isRectAreaLightParams(params)) return RectAreaLightWrapper(params, dependencies);\n if (params.type === LightType.Spot && isSpotLightParams(params)) return SpotLightWrapper(params, dependencies);\n throw new Error(`Unsupported light type: \"${params.type}\" or invalid params (does not match the light type)`);\n}\n\nexport function LightFactory(): TLightFactory {\n const factory: TReactiveFactory<TLightWrapper, TLightParams, TLightServiceDependencies> = ReactiveFactory(FactoryType.Light, create);\n\n // eslint-disable-next-line functional/immutable-data\n return Object.assign(factory, { configToParams: lightConfigToParams });\n}\n"],"names":["create","params","dependencies","type","LightType","Ambient","isAmbientLightParams","AmbientLightWrapper","Directional","isDirectionalLightParams","DirectionalLightWrapper","Point","isPointLightParams","PointLightWrapper","Hemisphere","isHemisphereLightParams","HemisphereLightWrapper","RectArea","isRectAreaLightParams","RectAreaLightWrapper","Spot","isSpotLightParams","SpotLightWrapper","Error","LightFactory","factory","ReactiveFactory","FactoryType","Light","Object","assign","configToParams","lightConfigToParams"],"mappings":"wzBAQA,SAASA,OAAOC,OAAsBC,cACpC,GAAID,OAAOE,OAASC,UAAUC,SAAWC,qBAAqBL,QAAS,OAAOM,oBAAoBN,OAAQC,cAC1G,GAAID,OAAOE,OAASC,UAAUI,aAAeC,yBAAyBR,QAAS,OAAOS,wBAAwBT,OAAQC,cACtH,GAAID,OAAOE,OAASC,UAAUO,OAASC,mBAAmBX,QAAS,OAAOY,kBAAkBZ,OAAQC,cACpG,GAAID,OAAOE,OAASC,UAAUU,YAAcC,wBAAwBd,QAAS,OAAOe,uBAAuBf,OAAQC,cACnH,GAAID,OAAOE,OAASC,UAAUa,UAAYC,sBAAsBjB,QAAS,OAAOkB,qBAAqBlB,OAAQC,cAC7G,GAAID,OAAOE,OAASC,UAAUgB,MAAQC,kBAAkBpB,QAAS,OAAOqB,iBAAiBrB,OAAQC,cACjG,MAAM,IAAIqB,MAAM,4BAA4BtB,OAAOE,0DACrD,CAEO,SAASqB,eACd,MAAMC,QAAoFC,gBAAgBC,YAAYC,MAAO5B,QAG7H,OAAO6B,OAAOC,OAAOL,QAAS,CAAEM,eAAgBC,qBAClD"}
@@ -1,2 +1,2 @@
1
- import{lightToConfig}from"../Adapters/EntityToConfig.js";import{getWrapperType}from"../Utils/Utils.js";import{applyShadowParams}from"./LightWrapperHelper.js";import{LightTransformDrive}from"../TransformDrive/LightTransformDrive.js";import{AbstractWrapper}from"../../Abstract/Wrappers/AbstractWrapper.js";import{DriveToTargetConnector}from"../../TransformDrive/Entities/Connectors/DriveToTargetConnector.js";import{withObject3d}from"../../Mixins/GameObjects/Mixins/WithObject3D.js";import{applyObject3dParams}from"../../Utils/WrapperHelpers.js";function AbstractLightWrapper(entity,params,dependencies){const wrapper=AbstractWrapper(entity,getWrapperType(entity),params),drive=LightTransformDrive(params,dependencies,wrapper.id),driveToTargetConnector=DriveToTargetConnector(drive,entity),result=Object.assign(wrapper,{drive:drive,driveToTargetConnector:driveToTargetConnector,...withObject3d(entity),entity:entity,getType:()=>entity.type,serialize:()=>lightToConfig(result)}),destroySub$=result.destroy$.subscribe(()=>{destroySub$.unsubscribe(),entity.shadow?.map?.dispose(),entity.dispose()});return applyShadowParams(params,result.entity),applyObject3dParams(result,params),result}export{AbstractLightWrapper};
1
+ import{getWrapperType}from"../Utils/Utils.js";import{applyShadowParams}from"./LightWrapperHelper.js";import{LightTransformDrive}from"../TransformDrive/LightTransformDrive.js";import{lightEntityToConfig}from"../Adapters/EntityToConfig.js";import{AbstractWrapper}from"../../Abstract/Wrappers/AbstractWrapper.js";import{DriveToTargetConnector}from"../../TransformDrive/Entities/Connectors/DriveToTargetConnector.js";import{withObject3d}from"../../Mixins/GameObjects/Mixins/WithObject3D.js";import{applyObject3dParams}from"../../Utils/WrapperHelpers.js";function AbstractLightWrapper(entity,params,dependencies){const wrapper=AbstractWrapper(entity,getWrapperType(entity),params),drive=LightTransformDrive(params,dependencies,wrapper.id),driveToTargetConnector=DriveToTargetConnector(drive,entity),result=Object.assign(wrapper,{drive:drive,driveToTargetConnector:driveToTargetConnector,...withObject3d(entity),entity:entity,getType:()=>entity.type,serialize:()=>lightEntityToConfig(result)}),destroySub$=result.destroy$.subscribe(()=>{destroySub$.unsubscribe(),entity.shadow?.map?.dispose(),entity.dispose()});return applyShadowParams(params,result.entity),applyObject3dParams(result,params),result}export{AbstractLightWrapper};
2
2
  //# sourceMappingURL=AbstractLightWrapper.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"AbstractLightWrapper.js","sources":["../../../src/Light/Wrappers/AbstractLightWrapper.ts"],"sourcesContent":["import type { TAbstractWrapper } from '@Anarchy/Engine/Abstract';\nimport { AbstractWrapper } from '@Anarchy/Engine/Abstract';\nimport { lightToConfig } from '@Anarchy/Engine/Light/Adapters';\nimport type { LightType } from '@Anarchy/Engine/Light/Constants';\nimport type { TAbstractLightConfig, TAbstractLightWrapper, TAnyLight, TLightParams, TLightServiceDependencies, TLightTransformDrive } from '@Anarchy/Engine/Light/Models';\nimport { LightTransformDrive } from '@Anarchy/Engine/Light/TransformDrive';\nimport { getWrapperType } from '@Anarchy/Engine/Light/Utils';\nimport { applyShadowParams } from '@Anarchy/Engine/Light/Wrappers/LightWrapperHelper';\nimport { withObject3d } from '@Anarchy/Engine/Mixins';\nimport type { TDriveToTargetConnector } from '@Anarchy/Engine/TransformDrive';\nimport { DriveToTargetConnector } from '@Anarchy/Engine/TransformDrive';\nimport { applyObject3dParams } from '@Anarchy/Engine/Utils';\nimport type { Subscription } from 'rxjs';\n\nexport function AbstractLightWrapper<T extends TAnyLight>(entity: T, params: TLightParams, dependencies: TLightServiceDependencies): TAbstractLightWrapper<T> {\n const wrapper: TAbstractWrapper<T> = AbstractWrapper(entity, getWrapperType(entity), params);\n const drive: TLightTransformDrive = LightTransformDrive(params, dependencies, wrapper.id);\n const driveToTargetConnector: TDriveToTargetConnector = DriveToTargetConnector(drive, entity);\n\n // eslint-disable-next-line functional/immutable-data\n const result: TAbstractLightWrapper<T> = Object.assign(wrapper, {\n drive,\n driveToTargetConnector,\n ...withObject3d(entity),\n entity,\n getType: (): LightType => entity.type as LightType,\n serialize: (): TAbstractLightConfig<T> => lightToConfig(result) as TAbstractLightConfig<T>\n });\n\n const destroySub$: Subscription = result.destroy$.subscribe((): void => {\n destroySub$.unsubscribe();\n\n (entity as any).shadow?.map?.dispose();\n entity.dispose();\n });\n\n applyShadowParams(params, result.entity);\n applyObject3dParams(result, params);\n\n return result;\n}\n"],"names":["AbstractLightWrapper","entity","params","dependencies","wrapper","AbstractWrapper","getWrapperType","drive","LightTransformDrive","id","driveToTargetConnector","DriveToTargetConnector","result","Object","assign","withObject3d","getType","type","serialize","lightToConfig","destroySub$","destroy$","subscribe","unsubscribe","shadow","map","dispose","applyShadowParams","applyObject3dParams"],"mappings":"giBAcO,SAASA,qBAA0CC,OAAWC,OAAsBC,cACzF,MAAMC,QAA+BC,gBAAgBJ,OAAQK,eAAeL,QAASC,QAC/EK,MAA8BC,oBAAoBN,OAAQC,aAAcC,QAAQK,IAChFC,uBAAkDC,uBAAuBJ,MAAON,QAGhFW,OAAmCC,OAAOC,OAAOV,QAAS,CAC9DG,YACAG,iDACGK,aAAad,QAChBA,cACAe,QAAS,IAAiBf,OAAOgB,KACjCC,UAAW,IAA+BC,cAAcP,UAGpDQ,YAA4BR,OAAOS,SAASC,UAAU,KAC1DF,YAAYG,cAEXtB,OAAeuB,QAAQC,KAAKC,UAC7BzB,OAAOyB,YAMT,OAHAC,kBAAkBzB,OAAQU,OAAOX,QACjC2B,oBAAoBhB,OAAQV,QAErBU,MACT"}
1
+ {"version":3,"file":"AbstractLightWrapper.js","sources":["../../../src/Light/Wrappers/AbstractLightWrapper.ts"],"sourcesContent":["import type { TAbstractWrapper } from '@Anarchy/Engine/Abstract';\nimport { AbstractWrapper } from '@Anarchy/Engine/Abstract';\nimport { lightEntityToConfig } from '@Anarchy/Engine/Light/Adapters';\nimport type { LightType } from '@Anarchy/Engine/Light/Constants';\nimport type { TAbstractLightConfig, TAbstractLightWrapper, TAnyLight, TLightParams, TLightServiceDependencies, TLightTransformDrive } from '@Anarchy/Engine/Light/Models';\nimport { LightTransformDrive } from '@Anarchy/Engine/Light/TransformDrive';\nimport { getWrapperType } from '@Anarchy/Engine/Light/Utils';\nimport { applyShadowParams } from '@Anarchy/Engine/Light/Wrappers/LightWrapperHelper';\nimport { withObject3d } from '@Anarchy/Engine/Mixins';\nimport type { TDriveToTargetConnector } from '@Anarchy/Engine/TransformDrive';\nimport { DriveToTargetConnector } from '@Anarchy/Engine/TransformDrive';\nimport { applyObject3dParams } from '@Anarchy/Engine/Utils';\nimport type { Subscription } from 'rxjs';\n\nexport function AbstractLightWrapper<T extends TAnyLight>(entity: T, params: TLightParams, dependencies: TLightServiceDependencies): TAbstractLightWrapper<T> {\n const wrapper: TAbstractWrapper<T> = AbstractWrapper(entity, getWrapperType(entity), params);\n const drive: TLightTransformDrive = LightTransformDrive(params, dependencies, wrapper.id);\n const driveToTargetConnector: TDriveToTargetConnector = DriveToTargetConnector(drive, entity);\n\n // eslint-disable-next-line functional/immutable-data\n const result: TAbstractLightWrapper<T> = Object.assign(wrapper, {\n drive,\n driveToTargetConnector,\n ...withObject3d(entity),\n entity,\n getType: (): LightType => entity.type as LightType,\n serialize: (): TAbstractLightConfig<T> => lightEntityToConfig(result) as TAbstractLightConfig<T>\n });\n\n const destroySub$: Subscription = result.destroy$.subscribe((): void => {\n destroySub$.unsubscribe();\n\n (entity as any).shadow?.map?.dispose();\n entity.dispose();\n });\n\n applyShadowParams(params, result.entity);\n applyObject3dParams(result, params);\n\n return result;\n}\n"],"names":["AbstractLightWrapper","entity","params","dependencies","wrapper","AbstractWrapper","getWrapperType","drive","LightTransformDrive","id","driveToTargetConnector","DriveToTargetConnector","result","Object","assign","withObject3d","getType","type","serialize","lightEntityToConfig","destroySub$","destroy$","subscribe","unsubscribe","shadow","map","dispose","applyShadowParams","applyObject3dParams"],"mappings":"siBAcO,SAASA,qBAA0CC,OAAWC,OAAsBC,cACzF,MAAMC,QAA+BC,gBAAgBJ,OAAQK,eAAeL,QAASC,QAC/EK,MAA8BC,oBAAoBN,OAAQC,aAAcC,QAAQK,IAChFC,uBAAkDC,uBAAuBJ,MAAON,QAGhFW,OAAmCC,OAAOC,OAAOV,QAAS,CAC9DG,YACAG,iDACGK,aAAad,QAChBA,cACAe,QAAS,IAAiBf,OAAOgB,KACjCC,UAAW,IAA+BC,oBAAoBP,UAG1DQ,YAA4BR,OAAOS,SAASC,UAAU,KAC1DF,YAAYG,cAEXtB,OAAeuB,QAAQC,KAAKC,UAC7BzB,OAAOyB,YAMT,OAHAC,kBAAkBzB,OAAQU,OAAOX,QACjC2B,oBAAoBhB,OAAQV,QAErBU,MACT"}
@@ -1,3 +1,4 @@
1
+ export * from './Adapters';
1
2
  export * from './Constants';
2
3
  export * from './Factories';
3
4
  export type * from './Models';
@@ -1,2 +1,2 @@
1
1
  import { TMaterialConfig, TMaterialConfigToParamsDependencies, TMaterialParams } from '../Models';
2
- export declare function configToParams(config: TMaterialConfig, { textureService }: TMaterialConfigToParamsDependencies): TMaterialParams;
2
+ export declare function materialConfigToParams(config: TMaterialConfig, { textureService }: TMaterialConfigToParamsDependencies): TMaterialParams;
@@ -1,2 +1,2 @@
1
- import{isDefined}from"../../packages/anarchy-shared/src/Utils/CheckUtils.js";import{Vector2}from"three";import{BlendingMap}from"../Constants/Blending/BlendingMap.js";import{BlendingDstFactorMap}from"../Constants/BlendingDstFactor/BlendingDstFactorMap.js";import{BlendEquationMap}from"../Constants/BlendEquation/BlendEquationMap.js";import{BlendingSrcFactorMap}from"../Constants/BlendingSrcFactorName/BlendingSrcFactorMap.js";import{SideMap}from"../Constants/Side/SideMap.js";import{StencilFuncMap}from"../Constants/StencilFuncName/StencilFuncMap.js";import{StencilOpMap}from"../Constants/StencilOpName/StencilOpMap.js";import{CombineMap}from"../Constants/Combine/CombineMap.js";import{DepthPackingStrategiesMap}from"../Constants/DepthPacking/DepthPackingStrategiesMap.js";import{NormalMapTypesMap}from"../Constants/NormalMapTypes/NormalMapTypesMap.js";function configToParams(config,{textureService:textureService}){let textures,options={};if(isDefined(config.options)){const{blending:blending,blendDst:blendDst,blendEquation:blendEquation,blendSrc:blendSrc,side:side,stencilFunc:stencilFunc,stencilFail:stencilFail,stencilZFail:stencilZFail,stencilZPass:stencilZPass,normalScale:normalScale,combine:combine,depthPacking:depthPacking,normalMapType:normalMapType,...rest}=config.options;options={...rest},isDefined(blending)&&(options={...options,blending:BlendingMap[blending]}),isDefined(blendDst)&&(options={...options,blendDst:BlendingDstFactorMap[blendDst]}),isDefined(blendEquation)&&(options={...options,blendEquation:BlendEquationMap[blendEquation]}),isDefined(blendSrc)&&(options={...options,blendSrc:{...BlendingSrcFactorMap,...BlendingDstFactorMap}[blendSrc]}),isDefined(side)&&(options={...options,side:SideMap[side]}),isDefined(stencilFunc)&&(options={...options,stencilFunc:StencilFuncMap[stencilFunc]}),isDefined(stencilFail)&&(options={...options,stencilFail:StencilOpMap[stencilFail]}),isDefined(stencilZFail)&&(options={...options,stencilZFail:StencilOpMap[stencilZFail]}),isDefined(stencilZPass)&&(options={...options,stencilZPass:StencilOpMap[stencilZPass]}),isDefined(combine)&&(options={...options,combine:CombineMap[combine]}),isDefined(depthPacking)&&(options={...options,depthPacking:DepthPackingStrategiesMap[depthPacking]}),isDefined(normalMapType)&&(options={...options,normalMapType:NormalMapTypesMap[normalMapType]}),isDefined(normalScale)&&(options={...options,normalScale:new Vector2(normalScale.x,normalScale.y)})}return isDefined(config.textures)&&(textures={},Object.entries(config.textures).forEach(([key,value])=>{const textureEntity=textureService.getResourceRegistry().getByKey(value);textures={...textures,[key]:textureEntity}})),{...config,textures:textures,options:options}}export{configToParams};
1
+ import{isDefined}from"../../packages/anarchy-shared/src/Utils/CheckUtils.js";import{Vector2}from"three";import{BlendingMap}from"../Constants/Blending/BlendingMap.js";import{BlendingDstFactorMap}from"../Constants/BlendingDstFactor/BlendingDstFactorMap.js";import{BlendEquationMap}from"../Constants/BlendEquation/BlendEquationMap.js";import{BlendingSrcFactorMap}from"../Constants/BlendingSrcFactorName/BlendingSrcFactorMap.js";import{SideMap}from"../Constants/Side/SideMap.js";import{StencilFuncMap}from"../Constants/StencilFuncName/StencilFuncMap.js";import{StencilOpMap}from"../Constants/StencilOpName/StencilOpMap.js";import{CombineMap}from"../Constants/Combine/CombineMap.js";import{DepthPackingStrategiesMap}from"../Constants/DepthPacking/DepthPackingStrategiesMap.js";import{NormalMapTypesMap}from"../Constants/NormalMapTypes/NormalMapTypesMap.js";function materialConfigToParams(config,{textureService:textureService}){let textures,options={};if(isDefined(config.options)){const{blending:blending,blendDst:blendDst,blendEquation:blendEquation,blendSrc:blendSrc,side:side,stencilFunc:stencilFunc,stencilFail:stencilFail,stencilZFail:stencilZFail,stencilZPass:stencilZPass,normalScale:normalScale,combine:combine,depthPacking:depthPacking,normalMapType:normalMapType,...rest}=config.options;options={...rest},isDefined(blending)&&(options={...options,blending:BlendingMap[blending]}),isDefined(blendDst)&&(options={...options,blendDst:BlendingDstFactorMap[blendDst]}),isDefined(blendEquation)&&(options={...options,blendEquation:BlendEquationMap[blendEquation]}),isDefined(blendSrc)&&(options={...options,blendSrc:{...BlendingSrcFactorMap,...BlendingDstFactorMap}[blendSrc]}),isDefined(side)&&(options={...options,side:SideMap[side]}),isDefined(stencilFunc)&&(options={...options,stencilFunc:StencilFuncMap[stencilFunc]}),isDefined(stencilFail)&&(options={...options,stencilFail:StencilOpMap[stencilFail]}),isDefined(stencilZFail)&&(options={...options,stencilZFail:StencilOpMap[stencilZFail]}),isDefined(stencilZPass)&&(options={...options,stencilZPass:StencilOpMap[stencilZPass]}),isDefined(combine)&&(options={...options,combine:CombineMap[combine]}),isDefined(depthPacking)&&(options={...options,depthPacking:DepthPackingStrategiesMap[depthPacking]}),isDefined(normalMapType)&&(options={...options,normalMapType:NormalMapTypesMap[normalMapType]}),isDefined(normalScale)&&(options={...options,normalScale:new Vector2(normalScale.x,normalScale.y)})}return isDefined(config.textures)&&(textures={},Object.entries(config.textures).forEach(([key,value])=>{const textureEntity=textureService.getResourceRegistry().getByKey(value);textures={...textures,[key]:textureEntity}})),{...config,textures:textures,options:options}}export{materialConfigToParams};
2
2
  //# sourceMappingURL=ConfigToParams.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ConfigToParams.js","sources":["../../../src/Material/Adapters/ConfigToParams.ts"],"sourcesContent":["import {\n BlendEquationMap,\n BlendingDstFactorMap,\n BlendingMap,\n BlendingSrcFactorMap,\n CombineMap,\n DepthPackingStrategiesMap,\n NormalMapTypesMap,\n SideMap,\n StencilOpMap\n} from '@Anarchy/Engine/Material/Constants';\nimport { StencilFuncMap } from '@Anarchy/Engine/Material/Constants/StencilFuncName';\nimport type { TMaterialConfig, TMaterialConfigToParamsDependencies, TMaterialParams, TMaterialParamsOptions, TMaterialParamsTextures } from '@Anarchy/Engine/Material/Models';\nimport type { TTexture } from '@Anarchy/Engine/Texture';\nimport { isDefined } from '@Anarchy/Shared/Utils';\nimport type { Vector2Like } from 'three';\nimport { Vector2 } from 'three';\n\nexport function configToParams(config: TMaterialConfig, { textureService }: TMaterialConfigToParamsDependencies): TMaterialParams {\n let options: TMaterialParamsOptions = {} as TMaterialParamsOptions;\n\n if (isDefined(config.options)) {\n const { blending, blendDst, blendEquation, blendSrc, side, stencilFunc, stencilFail, stencilZFail, stencilZPass, normalScale, combine, depthPacking, normalMapType, ...rest } =\n config.options as typeof config.options & Readonly<{ normalScale?: Vector2Like }>;\n\n options = { ...rest };\n\n if (isDefined(blending)) options = { ...options, blending: BlendingMap[blending] };\n if (isDefined(blendDst)) options = { ...options, blendDst: BlendingDstFactorMap[blendDst] };\n if (isDefined(blendEquation)) options = { ...options, blendEquation: BlendEquationMap[blendEquation] };\n if (isDefined(blendSrc)) options = { ...options, blendSrc: { ...BlendingSrcFactorMap, ...BlendingDstFactorMap }[blendSrc] };\n if (isDefined(side)) options = { ...options, side: SideMap[side] };\n // if (isDefined(format)) options = { ...options, format: PixelFormatMap[format] };\n if (isDefined(stencilFunc)) options = { ...options, stencilFunc: StencilFuncMap[stencilFunc] };\n if (isDefined(stencilFail)) options = { ...options, stencilFail: StencilOpMap[stencilFail] };\n if (isDefined(stencilZFail)) options = { ...options, stencilZFail: StencilOpMap[stencilZFail] };\n if (isDefined(stencilZPass)) options = { ...options, stencilZPass: StencilOpMap[stencilZPass] };\n if (isDefined(combine)) options = { ...options, combine: CombineMap[combine] };\n if (isDefined(depthPacking)) options = { ...options, depthPacking: DepthPackingStrategiesMap[depthPacking] };\n if (isDefined(normalMapType)) options = { ...options, normalMapType: NormalMapTypesMap[normalMapType] };\n // if (isDefined(referencePosition)) options = { ...options, referencePosition: new Vector3(referencePosition.x, referencePosition.y, referencePosition.z) };\n if (isDefined(normalScale)) options = { ...options, normalScale: new Vector2(normalScale.x, normalScale.y) };\n }\n\n let textures: TMaterialParamsTextures | undefined = undefined;\n if (isDefined(config.textures)) {\n textures = {};\n\n Object.entries(config.textures).forEach(([key, value]: [string, string]): void => {\n const textureEntity: TTexture = textureService.getResourceRegistry().getByKey(value);\n textures = { ...textures, [key]: textureEntity };\n });\n }\n\n return {\n ...config,\n textures,\n options\n };\n}\n"],"names":["configToParams","config","textureService","textures","options","isDefined","blending","blendDst","blendEquation","blendSrc","side","stencilFunc","stencilFail","stencilZFail","stencilZPass","normalScale","combine","depthPacking","normalMapType","rest","BlendingMap","BlendingDstFactorMap","BlendEquationMap","BlendingSrcFactorMap","SideMap","StencilFuncMap","StencilOpMap","CombineMap","DepthPackingStrategiesMap","NormalMapTypesMap","Vector2","x","y","Object","entries","forEach","key","value","textureEntity","getResourceRegistry","getByKey"],"mappings":"o1BAkBO,SAASA,eAAeC,QAAyBC,eAAEA,iBACxD,IAyBIC,SAzBAC,QAAkC,CAAA,EAEtC,GAAIC,UAAUJ,OAAOG,SAAU,CAC7B,MAAME,SAAEA,SAAAC,SAAUA,SAAAC,cAAUA,cAAAC,SAAeA,SAAAC,KAAUA,iBAAMC,YAAAC,YAAaA,YAAAC,aAAaA,aAAAC,aAAcA,aAAAC,YAAcA,oBAAaC,QAAAC,aAASA,aAAAC,cAAcA,iBAAkBC,MACrKlB,OAAOG,QAETA,QAAU,IAAKe,MAEXd,UAAUC,YAAWF,QAAU,IAAKA,QAASE,SAAUc,YAAYd,YACnED,UAAUE,YAAWH,QAAU,IAAKA,QAASG,SAAUc,qBAAqBd,YAC5EF,UAAUG,iBAAgBJ,QAAU,IAAKA,QAASI,cAAec,iBAAiBd,iBAClFH,UAAUI,YAAWL,QAAU,IAAKA,QAASK,SAAU,IAAKc,wBAAyBF,sBAAuBZ,YAC5GJ,UAAUK,QAAON,QAAU,IAAKA,QAASM,KAAMc,QAAQd,QAEvDL,UAAUM,eAAcP,QAAU,IAAKA,QAASO,YAAac,eAAed,eAC5EN,UAAUO,eAAcR,QAAU,IAAKA,QAASQ,YAAac,aAAad,eAC1EP,UAAUQ,gBAAeT,QAAU,IAAKA,QAASS,aAAca,aAAab,gBAC5ER,UAAUS,gBAAeV,QAAU,IAAKA,QAASU,aAAcY,aAAaZ,gBAC5ET,UAAUW,WAAUZ,QAAU,IAAKA,QAASY,QAASW,WAAWX,WAChEX,UAAUY,gBAAeb,QAAU,IAAKA,QAASa,aAAcW,0BAA0BX,gBACzFZ,UAAUa,iBAAgBd,QAAU,IAAKA,QAASc,cAAeW,kBAAkBX,iBAEnFb,UAAUU,eAAcX,QAAU,IAAKA,QAASW,YAAa,IAAIe,QAAQf,YAAYgB,EAAGhB,YAAYiB,IAC1G,CAYA,OATI3B,UAAUJ,OAAOE,YACnBA,SAAW,CAAA,EAEX8B,OAAOC,QAAQjC,OAAOE,UAAUgC,QAAQ,EAAEC,IAAKC,UAC7C,MAAMC,cAA0BpC,eAAeqC,sBAAsBC,SAASH,OAC9ElC,SAAW,IAAKA,SAAUiC,CAACA,KAAME,kBAI9B,IACFrC,OACHE,kBACAC,gBAEJ"}
1
+ {"version":3,"file":"ConfigToParams.js","sources":["../../../src/Material/Adapters/ConfigToParams.ts"],"sourcesContent":["import {\n BlendEquationMap,\n BlendingDstFactorMap,\n BlendingMap,\n BlendingSrcFactorMap,\n CombineMap,\n DepthPackingStrategiesMap,\n NormalMapTypesMap,\n SideMap,\n StencilOpMap\n} from '@Anarchy/Engine/Material/Constants';\nimport { StencilFuncMap } from '@Anarchy/Engine/Material/Constants/StencilFuncName';\nimport type { TMaterialConfig, TMaterialConfigToParamsDependencies, TMaterialParams, TMaterialParamsOptions, TMaterialParamsTextures } from '@Anarchy/Engine/Material/Models';\nimport type { TTexture } from '@Anarchy/Engine/Texture';\nimport { isDefined } from '@Anarchy/Shared/Utils';\nimport type { Vector2Like } from 'three';\nimport { Vector2 } from 'three';\n\nexport function materialConfigToParams(config: TMaterialConfig, { textureService }: TMaterialConfigToParamsDependencies): TMaterialParams {\n let options: TMaterialParamsOptions = {} as TMaterialParamsOptions;\n\n if (isDefined(config.options)) {\n const { blending, blendDst, blendEquation, blendSrc, side, stencilFunc, stencilFail, stencilZFail, stencilZPass, normalScale, combine, depthPacking, normalMapType, ...rest } =\n config.options as typeof config.options & Readonly<{ normalScale?: Vector2Like }>;\n\n options = { ...rest };\n\n if (isDefined(blending)) options = { ...options, blending: BlendingMap[blending] };\n if (isDefined(blendDst)) options = { ...options, blendDst: BlendingDstFactorMap[blendDst] };\n if (isDefined(blendEquation)) options = { ...options, blendEquation: BlendEquationMap[blendEquation] };\n if (isDefined(blendSrc)) options = { ...options, blendSrc: { ...BlendingSrcFactorMap, ...BlendingDstFactorMap }[blendSrc] };\n if (isDefined(side)) options = { ...options, side: SideMap[side] };\n // if (isDefined(format)) options = { ...options, format: PixelFormatMap[format] };\n if (isDefined(stencilFunc)) options = { ...options, stencilFunc: StencilFuncMap[stencilFunc] };\n if (isDefined(stencilFail)) options = { ...options, stencilFail: StencilOpMap[stencilFail] };\n if (isDefined(stencilZFail)) options = { ...options, stencilZFail: StencilOpMap[stencilZFail] };\n if (isDefined(stencilZPass)) options = { ...options, stencilZPass: StencilOpMap[stencilZPass] };\n if (isDefined(combine)) options = { ...options, combine: CombineMap[combine] };\n if (isDefined(depthPacking)) options = { ...options, depthPacking: DepthPackingStrategiesMap[depthPacking] };\n if (isDefined(normalMapType)) options = { ...options, normalMapType: NormalMapTypesMap[normalMapType] };\n // if (isDefined(referencePosition)) options = { ...options, referencePosition: new Vector3(referencePosition.x, referencePosition.y, referencePosition.z) };\n if (isDefined(normalScale)) options = { ...options, normalScale: new Vector2(normalScale.x, normalScale.y) };\n }\n\n let textures: TMaterialParamsTextures | undefined = undefined;\n if (isDefined(config.textures)) {\n textures = {};\n\n Object.entries(config.textures).forEach(([key, value]: [string, string]): void => {\n const textureEntity: TTexture = textureService.getResourceRegistry().getByKey(value);\n textures = { ...textures, [key]: textureEntity };\n });\n }\n\n return {\n ...config,\n textures,\n options\n };\n}\n"],"names":["materialConfigToParams","config","textureService","textures","options","isDefined","blending","blendDst","blendEquation","blendSrc","side","stencilFunc","stencilFail","stencilZFail","stencilZPass","normalScale","combine","depthPacking","normalMapType","rest","BlendingMap","BlendingDstFactorMap","BlendEquationMap","BlendingSrcFactorMap","SideMap","StencilFuncMap","StencilOpMap","CombineMap","DepthPackingStrategiesMap","NormalMapTypesMap","Vector2","x","y","Object","entries","forEach","key","value","textureEntity","getResourceRegistry","getByKey"],"mappings":"o1BAkBO,SAASA,uBAAuBC,QAAyBC,eAAEA,iBAChE,IAyBIC,SAzBAC,QAAkC,CAAA,EAEtC,GAAIC,UAAUJ,OAAOG,SAAU,CAC7B,MAAME,SAAEA,SAAAC,SAAUA,SAAAC,cAAUA,cAAAC,SAAeA,SAAAC,KAAUA,iBAAMC,YAAAC,YAAaA,YAAAC,aAAaA,aAAAC,aAAcA,aAAAC,YAAcA,oBAAaC,QAAAC,aAASA,aAAAC,cAAcA,iBAAkBC,MACrKlB,OAAOG,QAETA,QAAU,IAAKe,MAEXd,UAAUC,YAAWF,QAAU,IAAKA,QAASE,SAAUc,YAAYd,YACnED,UAAUE,YAAWH,QAAU,IAAKA,QAASG,SAAUc,qBAAqBd,YAC5EF,UAAUG,iBAAgBJ,QAAU,IAAKA,QAASI,cAAec,iBAAiBd,iBAClFH,UAAUI,YAAWL,QAAU,IAAKA,QAASK,SAAU,IAAKc,wBAAyBF,sBAAuBZ,YAC5GJ,UAAUK,QAAON,QAAU,IAAKA,QAASM,KAAMc,QAAQd,QAEvDL,UAAUM,eAAcP,QAAU,IAAKA,QAASO,YAAac,eAAed,eAC5EN,UAAUO,eAAcR,QAAU,IAAKA,QAASQ,YAAac,aAAad,eAC1EP,UAAUQ,gBAAeT,QAAU,IAAKA,QAASS,aAAca,aAAab,gBAC5ER,UAAUS,gBAAeV,QAAU,IAAKA,QAASU,aAAcY,aAAaZ,gBAC5ET,UAAUW,WAAUZ,QAAU,IAAKA,QAASY,QAASW,WAAWX,WAChEX,UAAUY,gBAAeb,QAAU,IAAKA,QAASa,aAAcW,0BAA0BX,gBACzFZ,UAAUa,iBAAgBd,QAAU,IAAKA,QAASc,cAAeW,kBAAkBX,iBAEnFb,UAAUU,eAAcX,QAAU,IAAKA,QAASW,YAAa,IAAIe,QAAQf,YAAYgB,EAAGhB,YAAYiB,IAC1G,CAYA,OATI3B,UAAUJ,OAAOE,YACnBA,SAAW,CAAA,EAEX8B,OAAOC,QAAQjC,OAAOE,UAAUgC,QAAQ,EAAEC,IAAKC,UAC7C,MAAMC,cAA0BpC,eAAeqC,sBAAsBC,SAASH,OAC9ElC,SAAW,IAAKA,SAAUiC,CAACA,KAAME,kBAI9B,IACFrC,OACHE,kBACAC,gBAEJ"}
@@ -1,2 +1,2 @@
1
1
  import { TAnyMaterialWrapper, TMaterialConfig, TMaterialEntityToConfigDependencies } from '../Models';
2
- export declare function materialToConfig(entity: TAnyMaterialWrapper, { textureResourceRegistry }: TMaterialEntityToConfigDependencies): TMaterialConfig;
2
+ export declare function materialEntityToConfig(entity: TAnyMaterialWrapper, { textureResourceRegistry }: TMaterialEntityToConfigDependencies): TMaterialConfig;
@@ -1,2 +1,2 @@
1
- import{filterOutEmptyFields}from"../../packages/anarchy-shared/src/Utils/ObjectUtils.js";import{nullsToUndefined}from"../../packages/anarchy-shared/src/Utils/TypesUtils.js";import{getOptionNameIfPossible,vector2ToXyIfPossible,eulerToXyzIfPossible}from"../Utils/MaterialUtils.js";import{StencilFailMap}from"../Constants/StencilFail/StencilFailMap.js";import{serializeColorWhenPossible}from"../../Color/Adapters/EntityToConfig.js";import isEmpty from"../../node_modules/lodash-es/isEmpty.js";import{extractSerializableRegistrableFields}from"../../Mixins/Generics/ExtractSerializableRegistrableFields.js";import{StencilOpMap}from"../Constants/StencilOpName/StencilOpMap.js";import{StencilFuncMap}from"../Constants/StencilFuncName/StencilFuncMap.js";import{SideMap}from"../Constants/Side/SideMap.js";import{NormalMapTypesMap}from"../Constants/NormalMapTypes/NormalMapTypesMap.js";import{DepthPackingStrategiesMap}from"../Constants/DepthPacking/DepthPackingStrategiesMap.js";import{CombineMap}from"../Constants/Combine/CombineMap.js";import{BlendingMap}from"../Constants/Blending/BlendingMap.js";import{BlendingDstFactorMap}from"../Constants/BlendingDstFactor/BlendingDstFactorMap.js";import{BlendingSrcFactorMap}from"../Constants/BlendingSrcFactorName/BlendingSrcFactorMap.js";import{BlendEquationMap}from"../Constants/BlendEquation/BlendEquationMap.js";function materialToConfig(entity,{textureResourceRegistry:textureResourceRegistry}){const options=function({entity:entity}){return filterOutEmptyFields(nullsToUndefined({alphaHash:entity.alphaHash,alphaToCoverage:entity.alphaToCoverage,anisotropy:entity.anisotropy,anisotropyRotation:entity.anisotropyRotation,aoMapIntensity:entity.aoMapIntensity,attenuationColor:serializeColorWhenPossible(entity.attenuationColor),attenuationDistance:entity.attenuationDistance,blendAlpha:entity.blendAlpha,blendColor:serializeColorWhenPossible(entity.blendColor),blendDst:getOptionNameIfPossible(entity.blendDst,BlendingDstFactorMap,"blendDst"),blendDstAlpha:entity.blendDstAlpha,blendEquation:getOptionNameIfPossible(entity.blendEquation,BlendEquationMap,"blendEquation"),blendEquationAlpha:entity.blendEquationAlpha,blendSrc:getOptionNameIfPossible(entity.blendSrc,{...BlendingSrcFactorMap,...BlendingDstFactorMap},"blendSrc"),blendSrcAlpha:entity.blendSrcAlpha,blending:getOptionNameIfPossible(entity.blending,BlendingMap,"blending"),bumpScale:entity.bumpScale,clearcoat:entity.clearcoat,clearcoatNormalScale:vector2ToXyIfPossible(entity.clearcoatNormalScale),clearcoatRoughness:entity.clearcoatRoughness,clipIntersection:entity.clipIntersection,clipShadows:entity.clipShadows,clippingPlanes:entity.clippingPlanes,color:serializeColorWhenPossible(entity.color),colorWrite:entity.colorWrite,combine:getOptionNameIfPossible(entity.combine,CombineMap,"combine"),dashSize:entity.dashSize,depthFunc:entity.depthFunc,depthPacking:getOptionNameIfPossible(entity.depthPacking,DepthPackingStrategiesMap,"depthPacking"),depthTest:entity.depthTest,depthWrite:entity.depthWrite,displacementBias:entity.displacementBias,displacementScale:entity.displacementScale,dithering:entity.dithering,emissive:serializeColorWhenPossible(entity.emissive),emissiveIntensity:entity.emissiveIntensity,envMapIntensity:entity.envMapIntensity,envMapRotation:eulerToXyzIfPossible(entity.envMapRotation),flatShading:entity.flatShading,fog:entity.fog,forceSinglePass:entity.forceSinglePass,gapSize:entity.gapSize,ior:entity.ior,iridescence:entity.iridescence,iridescenceIOR:entity.iridescenceIOR,iridescenceThicknessRange:entity.iridescenceThicknessRange,lightMapIntensity:entity.lightMapIntensity,linewidth:entity.linewidth,matcap:entity.matcap,metalness:entity.metalness,normalMapType:getOptionNameIfPossible(entity.normalMapType,NormalMapTypesMap,"normalMapType"),normalScale:vector2ToXyIfPossible(entity.normalScale),opacity:entity.opacity,polygonOffset:entity.polygonOffset,polygonOffsetFactor:entity.polygonOffsetFactor,polygonOffsetUnits:entity.polygonOffsetUnits,precision:entity.precision,premultipliedAlpha:entity.premultipliedAlpha,reflectivity:entity.reflectivity,refractionRatio:entity.refractionRatio,rotation:entity.rotation,roughness:entity.roughness,scale:entity.scale,shadowSide:entity.shadowSide,sheen:entity.sheen,sheenColor:serializeColorWhenPossible(entity.sheenColor),sheenRoughness:entity.sheenRoughness,shininess:entity.shininess,side:getOptionNameIfPossible(entity.side,SideMap,"side"),size:entity.size,sizeAttenuation:entity.sizeAttenuation,specular:serializeColorWhenPossible(entity.specular),specularColor:serializeColorWhenPossible(entity.specularColor),specularIntensity:entity.specularIntensity,stencilFail:getOptionNameIfPossible(entity.stencilFail,StencilFailMap,"stencilFail"),stencilFunc:getOptionNameIfPossible(entity.stencilFunc,StencilFuncMap,"stencilFunc"),stencilFuncMask:entity.stencilFuncMask,stencilRef:entity.stencilRef,stencilWrite:entity.stencilWrite,stencilWriteMask:entity.stencilWriteMask,stencilZFail:getOptionNameIfPossible(entity.stencilZFail,StencilOpMap,"stencilZFail"),stencilZPass:getOptionNameIfPossible(entity.stencilZPass,StencilOpMap,"stencilZPass"),thickness:entity.thickness,toneMapped:entity.toneMapped,transmission:entity.transmission,transparent:entity.transparent,vertexColors:entity.vertexColors,visible:entity.visible,wireframe:entity.wireframe,wireframeLinewidth:entity.wireframeLinewidth}))}(entity),textures=function({entity:entity},textureResourceRegistry){const maps=function(entity){return filterOutEmptyFields(Object.entries(entity).reduce((acc,[key,value])=>(function(key){return key.toLowerCase().endsWith("map")}(key)&&(acc[key]=value),acc),{}))}(entity),mapsKeys={};return Object.entries(maps).forEach(([key,value])=>{mapsKeys[key]=textureResourceRegistry.getKeyByValue(value)}),isEmpty(mapsKeys)?void 0:mapsKeys}(entity,textureResourceRegistry);return filterOutEmptyFields({type:entity.entity.type,options:options,textures:textures,...extractSerializableRegistrableFields(entity)})}export{materialToConfig};
1
+ import{filterOutEmptyFields}from"../../packages/anarchy-shared/src/Utils/ObjectUtils.js";import{nullsToUndefined}from"../../packages/anarchy-shared/src/Utils/TypesUtils.js";import{getOptionNameIfPossible,vector2ToXyIfPossible,eulerToXyzIfPossible}from"../Utils/MaterialUtils.js";import{StencilFailMap}from"../Constants/StencilFail/StencilFailMap.js";import{serializeColorWhenPossible}from"../../Color/Adapters/EntityToConfig.js";import isEmpty from"../../node_modules/lodash-es/isEmpty.js";import{extractSerializableRegistrableFields}from"../../Mixins/Generics/ExtractSerializableRegistrableFields.js";import{StencilOpMap}from"../Constants/StencilOpName/StencilOpMap.js";import{StencilFuncMap}from"../Constants/StencilFuncName/StencilFuncMap.js";import{SideMap}from"../Constants/Side/SideMap.js";import{NormalMapTypesMap}from"../Constants/NormalMapTypes/NormalMapTypesMap.js";import{DepthPackingStrategiesMap}from"../Constants/DepthPacking/DepthPackingStrategiesMap.js";import{CombineMap}from"../Constants/Combine/CombineMap.js";import{BlendingMap}from"../Constants/Blending/BlendingMap.js";import{BlendingDstFactorMap}from"../Constants/BlendingDstFactor/BlendingDstFactorMap.js";import{BlendingSrcFactorMap}from"../Constants/BlendingSrcFactorName/BlendingSrcFactorMap.js";import{BlendEquationMap}from"../Constants/BlendEquation/BlendEquationMap.js";function materialEntityToConfig(entity,{textureResourceRegistry:textureResourceRegistry}){const options=function({entity:entity}){return filterOutEmptyFields(nullsToUndefined({alphaHash:entity.alphaHash,alphaToCoverage:entity.alphaToCoverage,anisotropy:entity.anisotropy,anisotropyRotation:entity.anisotropyRotation,aoMapIntensity:entity.aoMapIntensity,attenuationColor:serializeColorWhenPossible(entity.attenuationColor),attenuationDistance:entity.attenuationDistance,blendAlpha:entity.blendAlpha,blendColor:serializeColorWhenPossible(entity.blendColor),blendDst:getOptionNameIfPossible(entity.blendDst,BlendingDstFactorMap,"blendDst"),blendDstAlpha:entity.blendDstAlpha,blendEquation:getOptionNameIfPossible(entity.blendEquation,BlendEquationMap,"blendEquation"),blendEquationAlpha:entity.blendEquationAlpha,blendSrc:getOptionNameIfPossible(entity.blendSrc,{...BlendingSrcFactorMap,...BlendingDstFactorMap},"blendSrc"),blendSrcAlpha:entity.blendSrcAlpha,blending:getOptionNameIfPossible(entity.blending,BlendingMap,"blending"),bumpScale:entity.bumpScale,clearcoat:entity.clearcoat,clearcoatNormalScale:vector2ToXyIfPossible(entity.clearcoatNormalScale),clearcoatRoughness:entity.clearcoatRoughness,clipIntersection:entity.clipIntersection,clipShadows:entity.clipShadows,clippingPlanes:entity.clippingPlanes,color:serializeColorWhenPossible(entity.color),colorWrite:entity.colorWrite,combine:getOptionNameIfPossible(entity.combine,CombineMap,"combine"),dashSize:entity.dashSize,depthFunc:entity.depthFunc,depthPacking:getOptionNameIfPossible(entity.depthPacking,DepthPackingStrategiesMap,"depthPacking"),depthTest:entity.depthTest,depthWrite:entity.depthWrite,displacementBias:entity.displacementBias,displacementScale:entity.displacementScale,dithering:entity.dithering,emissive:serializeColorWhenPossible(entity.emissive),emissiveIntensity:entity.emissiveIntensity,envMapIntensity:entity.envMapIntensity,envMapRotation:eulerToXyzIfPossible(entity.envMapRotation),flatShading:entity.flatShading,fog:entity.fog,forceSinglePass:entity.forceSinglePass,gapSize:entity.gapSize,ior:entity.ior,iridescence:entity.iridescence,iridescenceIOR:entity.iridescenceIOR,iridescenceThicknessRange:entity.iridescenceThicknessRange,lightMapIntensity:entity.lightMapIntensity,linewidth:entity.linewidth,matcap:entity.matcap,metalness:entity.metalness,normalMapType:getOptionNameIfPossible(entity.normalMapType,NormalMapTypesMap,"normalMapType"),normalScale:vector2ToXyIfPossible(entity.normalScale),opacity:entity.opacity,polygonOffset:entity.polygonOffset,polygonOffsetFactor:entity.polygonOffsetFactor,polygonOffsetUnits:entity.polygonOffsetUnits,precision:entity.precision,premultipliedAlpha:entity.premultipliedAlpha,reflectivity:entity.reflectivity,refractionRatio:entity.refractionRatio,rotation:entity.rotation,roughness:entity.roughness,scale:entity.scale,shadowSide:entity.shadowSide,sheen:entity.sheen,sheenColor:serializeColorWhenPossible(entity.sheenColor),sheenRoughness:entity.sheenRoughness,shininess:entity.shininess,side:getOptionNameIfPossible(entity.side,SideMap,"side"),size:entity.size,sizeAttenuation:entity.sizeAttenuation,specular:serializeColorWhenPossible(entity.specular),specularColor:serializeColorWhenPossible(entity.specularColor),specularIntensity:entity.specularIntensity,stencilFail:getOptionNameIfPossible(entity.stencilFail,StencilFailMap,"stencilFail"),stencilFunc:getOptionNameIfPossible(entity.stencilFunc,StencilFuncMap,"stencilFunc"),stencilFuncMask:entity.stencilFuncMask,stencilRef:entity.stencilRef,stencilWrite:entity.stencilWrite,stencilWriteMask:entity.stencilWriteMask,stencilZFail:getOptionNameIfPossible(entity.stencilZFail,StencilOpMap,"stencilZFail"),stencilZPass:getOptionNameIfPossible(entity.stencilZPass,StencilOpMap,"stencilZPass"),thickness:entity.thickness,toneMapped:entity.toneMapped,transmission:entity.transmission,transparent:entity.transparent,vertexColors:entity.vertexColors,visible:entity.visible,wireframe:entity.wireframe,wireframeLinewidth:entity.wireframeLinewidth}))}(entity),textures=function({entity:entity},textureResourceRegistry){const maps=function(entity){return filterOutEmptyFields(Object.entries(entity).reduce((acc,[key,value])=>(function(key){return key.toLowerCase().endsWith("map")}(key)&&(acc[key]=value),acc),{}))}(entity),mapsKeys={};return Object.entries(maps).forEach(([key,value])=>{mapsKeys[key]=textureResourceRegistry.getKeyByValue(value)}),isEmpty(mapsKeys)?void 0:mapsKeys}(entity,textureResourceRegistry);return filterOutEmptyFields({type:entity.entity.type,options:options,textures:textures,...extractSerializableRegistrableFields(entity)})}export{materialEntityToConfig};
2
2
  //# sourceMappingURL=EntityToConfig.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"EntityToConfig.js","sources":["../../../src/Material/Adapters/EntityToConfig.ts"],"sourcesContent":["import { serializeColorWhenPossible } from '@Anarchy/Engine/Color';\nimport type { MaterialType } from '@Anarchy/Engine/Material/Constants';\nimport {\n BlendEquationMap,\n BlendingDstFactorMap,\n BlendingMap,\n BlendingSrcFactorMap,\n CombineMap,\n DepthPackingStrategiesMap,\n NormalMapTypesMap,\n SideMap,\n StencilFailMap,\n StencilFuncMap,\n StencilOpMap\n} from '@Anarchy/Engine/Material/Constants';\nimport type {\n TAnyMaterialWrapper,\n TMaterialConfig,\n TMaterialConfigOptions,\n TMaterialConfigTextures,\n TMaterialEntityToConfigDependencies,\n TMaterialParamsTextures,\n TMaterials\n} from '@Anarchy/Engine/Material/Models';\nimport { eulerToXyzIfPossible, getOptionNameIfPossible, vector2ToXyIfPossible } from '@Anarchy/Engine/Material/Utils';\nimport { extractSerializableRegistrableFields } from '@Anarchy/Engine/Mixins';\nimport type { TTexture, TTextureAsyncRegistry } from '@Anarchy/Engine/Texture';\nimport type { TOptional } from '@Anarchy/Shared/Utils';\nimport { filterOutEmptyFields, nullsToUndefined } from '@Anarchy/Shared/Utils';\nimport { isEmpty } from 'lodash-es';\nimport type {\n LineDashedMaterial,\n MeshBasicMaterial,\n MeshDepthMaterial,\n MeshLambertMaterial,\n MeshMatcapMaterial,\n MeshPhongMaterial,\n MeshPhysicalMaterial,\n MeshStandardMaterial,\n PointsMaterial\n} from 'three';\nimport type { SpriteNodeMaterial } from 'three/src/materials/nodes/NodeMaterials';\n\nexport function materialToConfig(entity: TAnyMaterialWrapper, { textureResourceRegistry }: TMaterialEntityToConfigDependencies): TMaterialConfig {\n const options: TMaterialConfigOptions | undefined = getMaterialOptions(entity);\n const textures: TMaterialConfigTextures | undefined = getMaterialTextures(entity, textureResourceRegistry);\n\n return filterOutEmptyFields({\n type: entity.entity.type as MaterialType,\n options,\n textures,\n ...extractSerializableRegistrableFields(entity)\n });\n}\n\nfunction getMaterialOptions({ entity }: TAnyMaterialWrapper): TOptional<TMaterialConfigOptions> | undefined {\n return filterOutEmptyFields(\n nullsToUndefined({\n alphaHash: entity.alphaHash,\n // alphaTest: entity.alphaTest,\n alphaToCoverage: entity.alphaToCoverage,\n anisotropy: (entity as MeshPhysicalMaterial).anisotropy,\n anisotropyRotation: (entity as MeshPhysicalMaterial).anisotropyRotation,\n aoMapIntensity: (entity as MeshPhongMaterial).aoMapIntensity,\n attenuationColor: serializeColorWhenPossible((entity as MeshPhysicalMaterial).attenuationColor),\n attenuationDistance: (entity as MeshPhysicalMaterial).attenuationDistance,\n blendAlpha: entity.blendAlpha,\n blendColor: serializeColorWhenPossible(entity.blendColor),\n blendDst: getOptionNameIfPossible(entity.blendDst, BlendingDstFactorMap, 'blendDst'),\n blendDstAlpha: entity.blendDstAlpha,\n blendEquation: getOptionNameIfPossible(entity.blendEquation, BlendEquationMap, 'blendEquation'),\n blendEquationAlpha: entity.blendEquationAlpha,\n blendSrc: getOptionNameIfPossible(entity.blendSrc, { ...BlendingSrcFactorMap, ...BlendingDstFactorMap }, 'blendSrc'),\n blendSrcAlpha: entity.blendSrcAlpha,\n blending: getOptionNameIfPossible(entity.blending, BlendingMap, 'blending'),\n bumpScale: (entity as MeshPhongMaterial).bumpScale,\n clearcoat: (entity as MeshPhysicalMaterial).clearcoat,\n clearcoatNormalScale: vector2ToXyIfPossible((entity as MeshPhysicalMaterial).clearcoatNormalScale),\n clearcoatRoughness: (entity as MeshPhysicalMaterial).clearcoatRoughness,\n clipIntersection: entity.clipIntersection,\n clipShadows: entity.clipShadows,\n clippingPlanes: entity.clippingPlanes,\n color: serializeColorWhenPossible((entity as MeshBasicMaterial).color),\n colorWrite: entity.colorWrite,\n combine: getOptionNameIfPossible((entity as MeshBasicMaterial).combine, CombineMap, 'combine'),\n dashSize: (entity as LineDashedMaterial).dashSize,\n depthFunc: entity.depthFunc,\n depthPacking: getOptionNameIfPossible((entity as MeshDepthMaterial).depthPacking, DepthPackingStrategiesMap, 'depthPacking'),\n depthTest: entity.depthTest,\n depthWrite: entity.depthWrite,\n displacementBias: (entity as MeshPhongMaterial).displacementBias,\n displacementScale: (entity as MeshPhongMaterial).displacementScale,\n dithering: entity.dithering,\n emissive: serializeColorWhenPossible((entity as MeshLambertMaterial).emissive),\n emissiveIntensity: (entity as MeshLambertMaterial).emissiveIntensity,\n envMapIntensity: (entity as MeshStandardMaterial).envMapIntensity,\n envMapRotation: eulerToXyzIfPossible((entity as MeshPhongMaterial).envMapRotation),\n // farDistance: (entity as MeshDistanceMaterialParameters).farDistance,\n flatShading: (entity as MeshStandardMaterial).flatShading,\n fog: (entity as MeshPhongMaterial).fog,\n forceSinglePass: entity.forceSinglePass,\n gapSize: (entity as LineDashedMaterial).gapSize,\n ior: (entity as MeshPhysicalMaterial).ior,\n iridescence: (entity as MeshPhysicalMaterial).iridescence,\n iridescenceIOR: (entity as MeshPhysicalMaterial).iridescenceIOR,\n iridescenceThicknessRange: (entity as MeshPhysicalMaterial).iridescenceThicknessRange,\n lightMapIntensity: (entity as MeshPhongMaterial).lightMapIntensity,\n linewidth: (entity as LineDashedMaterial).linewidth,\n matcap: (entity as MeshMatcapMaterial).matcap,\n metalness: (entity as MeshStandardMaterial).metalness,\n // nearDistance: (entity as MeshDistanceMaterialParameters).nearDistance,\n normalMapType: getOptionNameIfPossible((entity as MeshStandardMaterial).normalMapType, NormalMapTypesMap, 'normalMapType'),\n normalScale: vector2ToXyIfPossible((entity as MeshStandardMaterial).normalScale),\n opacity: entity.opacity,\n polygonOffset: entity.polygonOffset,\n polygonOffsetFactor: entity.polygonOffsetFactor,\n polygonOffsetUnits: entity.polygonOffsetUnits,\n precision: entity.precision,\n premultipliedAlpha: entity.premultipliedAlpha,\n // referencePosition: vector3ToXyzIfPossible((entity as MeshDistanceMaterialParameters).referencePosition),\n reflectivity: (entity as MeshPhysicalMaterial).reflectivity,\n refractionRatio: (entity as MeshBasicMaterial).refractionRatio,\n rotation: (entity as SpriteNodeMaterial).rotation,\n roughness: (entity as MeshStandardMaterial).roughness,\n scale: (entity as LineDashedMaterial).scale,\n shadowSide: entity.shadowSide,\n sheen: (entity as MeshPhysicalMaterial).sheen,\n sheenColor: serializeColorWhenPossible((entity as MeshPhysicalMaterial).sheenColor),\n sheenRoughness: (entity as MeshPhysicalMaterial).sheenRoughness,\n shininess: (entity as MeshPhongMaterial).shininess,\n side: getOptionNameIfPossible(entity.side, SideMap, 'side'),\n size: (entity as PointsMaterial).size,\n sizeAttenuation: (entity as PointsMaterial).sizeAttenuation,\n specular: serializeColorWhenPossible((entity as MeshPhongMaterial).specular),\n specularColor: serializeColorWhenPossible((entity as MeshPhysicalMaterial).specularColor),\n specularIntensity: (entity as MeshPhysicalMaterial).specularIntensity,\n stencilFail: getOptionNameIfPossible(entity.stencilFail, StencilFailMap, 'stencilFail'),\n stencilFunc: getOptionNameIfPossible(entity.stencilFunc, StencilFuncMap, 'stencilFunc'),\n stencilFuncMask: entity.stencilFuncMask,\n stencilRef: entity.stencilRef,\n stencilWrite: entity.stencilWrite,\n stencilWriteMask: entity.stencilWriteMask,\n stencilZFail: getOptionNameIfPossible(entity.stencilZFail, StencilOpMap, 'stencilZFail'),\n stencilZPass: getOptionNameIfPossible(entity.stencilZPass, StencilOpMap, 'stencilZPass'),\n thickness: (entity as MeshPhysicalMaterial).thickness,\n toneMapped: entity.toneMapped,\n transmission: (entity as MeshPhysicalMaterial).transmission,\n transparent: entity.transparent,\n vertexColors: entity.vertexColors,\n visible: entity.visible,\n wireframe: (entity as MeshPhongMaterial).wireframe,\n // wireframeLinecap: (entity as MeshPhongMaterial).wireframeLinecap\n // wireframeLinejoin: (entity as MeshPhongMaterial).wireframeLinejoin\n wireframeLinewidth: (entity as MeshPhongMaterial).wireframeLinewidth\n })\n );\n}\n\nfunction getMaterialTextures({ entity }: TAnyMaterialWrapper, textureResourceRegistry: TTextureAsyncRegistry): TMaterialConfigTextures | undefined | never {\n const maps: TMaterialParamsTextures = getMaps(entity);\n const mapsKeys: { [key: string]: string } = {};\n\n Object.entries(maps).forEach(([key, value]: [string, TTexture]): void | never => {\n // eslint-disable-next-line functional/immutable-data\n mapsKeys[key] = textureResourceRegistry.getKeyByValue(value);\n });\n\n return isEmpty(mapsKeys) ? undefined : mapsKeys;\n}\n\nfunction isTextureKey(key: string): key is keyof TMaterialParamsTextures {\n return key.toLowerCase().endsWith('map');\n}\n\nfunction getMaps(entity: TMaterials): TMaterialParamsTextures {\n return filterOutEmptyFields(\n Object.entries(entity).reduce((acc: TMaterialParamsTextures, [key, value]): TMaterialParamsTextures => {\n if (isTextureKey(key)) {\n // eslint-disable-next-line functional/immutable-data\n acc[key] = value as TMaterialParamsTextures[typeof key];\n }\n return acc;\n }, {})\n );\n}\n"],"names":["materialToConfig","entity","textureResourceRegistry","options","filterOutEmptyFields","nullsToUndefined","alphaHash","alphaToCoverage","anisotropy","anisotropyRotation","aoMapIntensity","attenuationColor","serializeColorWhenPossible","attenuationDistance","blendAlpha","blendColor","blendDst","getOptionNameIfPossible","BlendingDstFactorMap","blendDstAlpha","blendEquation","BlendEquationMap","blendEquationAlpha","blendSrc","BlendingSrcFactorMap","blendSrcAlpha","blending","BlendingMap","bumpScale","clearcoat","clearcoatNormalScale","vector2ToXyIfPossible","clearcoatRoughness","clipIntersection","clipShadows","clippingPlanes","color","colorWrite","combine","CombineMap","dashSize","depthFunc","depthPacking","DepthPackingStrategiesMap","depthTest","depthWrite","displacementBias","displacementScale","dithering","emissive","emissiveIntensity","envMapIntensity","envMapRotation","eulerToXyzIfPossible","flatShading","fog","forceSinglePass","gapSize","ior","iridescence","iridescenceIOR","iridescenceThicknessRange","lightMapIntensity","linewidth","matcap","metalness","normalMapType","NormalMapTypesMap","normalScale","opacity","polygonOffset","polygonOffsetFactor","polygonOffsetUnits","precision","premultipliedAlpha","reflectivity","refractionRatio","rotation","roughness","scale","shadowSide","sheen","sheenColor","sheenRoughness","shininess","side","SideMap","size","sizeAttenuation","specular","specularColor","specularIntensity","stencilFail","StencilFailMap","stencilFunc","StencilFuncMap","stencilFuncMask","stencilRef","stencilWrite","stencilWriteMask","stencilZFail","StencilOpMap","stencilZPass","thickness","toneMapped","transmission","transparent","vertexColors","visible","wireframe","wireframeLinewidth","getMaterialOptions","textures","maps","Object","entries","reduce","acc","key","value","toLowerCase","endsWith","isTextureKey","getMaps","mapsKeys","forEach","getKeyByValue","isEmpty","getMaterialTextures","type","extractSerializableRegistrableFields"],"mappings":"s0CA2CO,SAASA,iBAAiBC,QAA6BC,wBAAEA,0BAC9D,MAAMC,QAWR,UAA4BF,OAAEA,SAC5B,OAAOG,qBACLC,iBAAiB,CACfC,UAAWL,OAAOK,UAElBC,gBAAiBN,OAAOM,gBACxBC,WAAaP,OAAgCO,WAC7CC,mBAAqBR,OAAgCQ,mBACrDC,eAAiBT,OAA6BS,eAC9CC,iBAAkBC,2BAA4BX,OAAgCU,kBAC9EE,oBAAsBZ,OAAgCY,oBACtDC,WAAYb,OAAOa,WACnBC,WAAYH,2BAA2BX,OAAOc,YAC9CC,SAAUC,wBAAwBhB,OAAOe,SAAUE,qBAAsB,YACzEC,cAAelB,OAAOkB,cACtBC,cAAeH,wBAAwBhB,OAAOmB,cAAeC,iBAAkB,iBAC/EC,mBAAoBrB,OAAOqB,mBAC3BC,SAAUN,wBAAwBhB,OAAOsB,SAAU,IAAKC,wBAAyBN,sBAAwB,YACzGO,cAAexB,OAAOwB,cACtBC,SAAUT,wBAAwBhB,OAAOyB,SAAUC,YAAa,YAChEC,UAAY3B,OAA6B2B,UACzCC,UAAY5B,OAAgC4B,UAC5CC,qBAAsBC,sBAAuB9B,OAAgC6B,sBAC7EE,mBAAqB/B,OAAgC+B,mBACrDC,iBAAkBhC,OAAOgC,iBACzBC,YAAajC,OAAOiC,YACpBC,eAAgBlC,OAAOkC,eACvBC,MAAOxB,2BAA4BX,OAA6BmC,OAChEC,WAAYpC,OAAOoC,WACnBC,QAASrB,wBAAyBhB,OAA6BqC,QAASC,WAAY,WACpFC,SAAWvC,OAA8BuC,SACzCC,UAAWxC,OAAOwC,UAClBC,aAAczB,wBAAyBhB,OAA6ByC,aAAcC,0BAA2B,gBAC7GC,UAAW3C,OAAO2C,UAClBC,WAAY5C,OAAO4C,WACnBC,iBAAmB7C,OAA6B6C,iBAChDC,kBAAoB9C,OAA6B8C,kBACjDC,UAAW/C,OAAO+C,UAClBC,SAAUrC,2BAA4BX,OAA+BgD,UACrEC,kBAAoBjD,OAA+BiD,kBACnDC,gBAAkBlD,OAAgCkD,gBAClDC,eAAgBC,qBAAsBpD,OAA6BmD,gBAEnEE,YAAcrD,OAAgCqD,YAC9CC,IAAMtD,OAA6BsD,IACnCC,gBAAiBvD,OAAOuD,gBACxBC,QAAUxD,OAA8BwD,QACxCC,IAAMzD,OAAgCyD,IACtCC,YAAc1D,OAAgC0D,YAC9CC,eAAiB3D,OAAgC2D,eACjDC,0BAA4B5D,OAAgC4D,0BAC5DC,kBAAoB7D,OAA6B6D,kBACjDC,UAAY9D,OAA8B8D,UAC1CC,OAAS/D,OAA8B+D,OACvCC,UAAYhE,OAAgCgE,UAE5CC,cAAejD,wBAAyBhB,OAAgCiE,cAAeC,kBAAmB,iBAC1GC,YAAarC,sBAAuB9B,OAAgCmE,aACpEC,QAASpE,OAAOoE,QAChBC,cAAerE,OAAOqE,cACtBC,oBAAqBtE,OAAOsE,oBAC5BC,mBAAoBvE,OAAOuE,mBAC3BC,UAAWxE,OAAOwE,UAClBC,mBAAoBzE,OAAOyE,mBAE3BC,aAAe1E,OAAgC0E,aAC/CC,gBAAkB3E,OAA6B2E,gBAC/CC,SAAW5E,OAA8B4E,SACzCC,UAAY7E,OAAgC6E,UAC5CC,MAAQ9E,OAA8B8E,MACtCC,WAAY/E,OAAO+E,WACnBC,MAAQhF,OAAgCgF,MACxCC,WAAYtE,2BAA4BX,OAAgCiF,YACxEC,eAAiBlF,OAAgCkF,eACjDC,UAAYnF,OAA6BmF,UACzCC,KAAMpE,wBAAwBhB,OAAOoF,KAAMC,QAAS,QACpDC,KAAOtF,OAA0BsF,KACjCC,gBAAkBvF,OAA0BuF,gBAC5CC,SAAU7E,2BAA4BX,OAA6BwF,UACnEC,cAAe9E,2BAA4BX,OAAgCyF,eAC3EC,kBAAoB1F,OAAgC0F,kBACpDC,YAAa3E,wBAAwBhB,OAAO2F,YAAaC,eAAgB,eACzEC,YAAa7E,wBAAwBhB,OAAO6F,YAAaC,eAAgB,eACzEC,gBAAiB/F,OAAO+F,gBACxBC,WAAYhG,OAAOgG,WACnBC,aAAcjG,OAAOiG,aACrBC,iBAAkBlG,OAAOkG,iBACzBC,aAAcnF,wBAAwBhB,OAAOmG,aAAcC,aAAc,gBACzEC,aAAcrF,wBAAwBhB,OAAOqG,aAAcD,aAAc,gBACzEE,UAAYtG,OAAgCsG,UAC5CC,WAAYvG,OAAOuG,WACnBC,aAAexG,OAAgCwG,aAC/CC,YAAazG,OAAOyG,YACpBC,aAAc1G,OAAO0G,aACrBC,QAAS3G,OAAO2G,QAChBC,UAAY5G,OAA6B4G,UAGzCC,mBAAqB7G,OAA6B6G,qBAGxD,CAhHsDC,CAAmB9G,QACjE+G,SAiHR,UAA6B/G,OAAEA,QAA+BC,yBAC5D,MAAM+G,KAeR,SAAiBhH,QACf,OAAOG,qBACL8G,OAAOC,QAAQlH,QAAQmH,OAAO,CAACC,KAA+BC,IAAKC,UANvE,SAAsBD,KACpB,OAAOA,IAAIE,cAAcC,SAAS,MACpC,CAKUC,CAAaJ,OAEfD,IAAIC,KAAOC,OAENF,KACN,CAAA,GAEP,CAzBwCM,CAAQ1H,QACxC2H,SAAsC,CAAA,EAO5C,OALAV,OAAOC,QAAQF,MAAMY,QAAQ,EAAEP,IAAKC,UAElCK,SAASN,KAAOpH,wBAAwB4H,cAAcP,SAGjDQ,QAAQH,eAAY,EAAYA,QACzC,CA3HwDI,CAAoB/H,OAAQC,yBAElF,OAAOE,qBAAqB,CAC1B6H,KAAMhI,OAAOA,OAAOgI,KACpB9H,gBACA6G,qBACGkB,qCAAqCjI,SAE5C"}
1
+ {"version":3,"file":"EntityToConfig.js","sources":["../../../src/Material/Adapters/EntityToConfig.ts"],"sourcesContent":["import { serializeColorWhenPossible } from '@Anarchy/Engine/Color';\nimport type { MaterialType } from '@Anarchy/Engine/Material/Constants';\nimport {\n BlendEquationMap,\n BlendingDstFactorMap,\n BlendingMap,\n BlendingSrcFactorMap,\n CombineMap,\n DepthPackingStrategiesMap,\n NormalMapTypesMap,\n SideMap,\n StencilFailMap,\n StencilFuncMap,\n StencilOpMap\n} from '@Anarchy/Engine/Material/Constants';\nimport type {\n TAnyMaterialWrapper,\n TMaterialConfig,\n TMaterialConfigOptions,\n TMaterialConfigTextures,\n TMaterialEntityToConfigDependencies,\n TMaterialParamsTextures,\n TMaterials\n} from '@Anarchy/Engine/Material/Models';\nimport { eulerToXyzIfPossible, getOptionNameIfPossible, vector2ToXyIfPossible } from '@Anarchy/Engine/Material/Utils';\nimport { extractSerializableRegistrableFields } from '@Anarchy/Engine/Mixins';\nimport type { TTexture, TTextureAsyncRegistry } from '@Anarchy/Engine/Texture';\nimport type { TOptional } from '@Anarchy/Shared/Utils';\nimport { filterOutEmptyFields, nullsToUndefined } from '@Anarchy/Shared/Utils';\nimport { isEmpty } from 'lodash-es';\nimport type {\n LineDashedMaterial,\n MeshBasicMaterial,\n MeshDepthMaterial,\n MeshLambertMaterial,\n MeshMatcapMaterial,\n MeshPhongMaterial,\n MeshPhysicalMaterial,\n MeshStandardMaterial,\n PointsMaterial\n} from 'three';\nimport type { SpriteNodeMaterial } from 'three/src/materials/nodes/NodeMaterials';\n\nexport function materialEntityToConfig(entity: TAnyMaterialWrapper, { textureResourceRegistry }: TMaterialEntityToConfigDependencies): TMaterialConfig {\n const options: TMaterialConfigOptions | undefined = getMaterialOptions(entity);\n const textures: TMaterialConfigTextures | undefined = getMaterialTextures(entity, textureResourceRegistry);\n\n return filterOutEmptyFields({\n type: entity.entity.type as MaterialType,\n options,\n textures,\n ...extractSerializableRegistrableFields(entity)\n });\n}\n\nfunction getMaterialOptions({ entity }: TAnyMaterialWrapper): TOptional<TMaterialConfigOptions> | undefined {\n return filterOutEmptyFields(\n nullsToUndefined({\n alphaHash: entity.alphaHash,\n // alphaTest: entity.alphaTest,\n alphaToCoverage: entity.alphaToCoverage,\n anisotropy: (entity as MeshPhysicalMaterial).anisotropy,\n anisotropyRotation: (entity as MeshPhysicalMaterial).anisotropyRotation,\n aoMapIntensity: (entity as MeshPhongMaterial).aoMapIntensity,\n attenuationColor: serializeColorWhenPossible((entity as MeshPhysicalMaterial).attenuationColor),\n attenuationDistance: (entity as MeshPhysicalMaterial).attenuationDistance,\n blendAlpha: entity.blendAlpha,\n blendColor: serializeColorWhenPossible(entity.blendColor),\n blendDst: getOptionNameIfPossible(entity.blendDst, BlendingDstFactorMap, 'blendDst'),\n blendDstAlpha: entity.blendDstAlpha,\n blendEquation: getOptionNameIfPossible(entity.blendEquation, BlendEquationMap, 'blendEquation'),\n blendEquationAlpha: entity.blendEquationAlpha,\n blendSrc: getOptionNameIfPossible(entity.blendSrc, { ...BlendingSrcFactorMap, ...BlendingDstFactorMap }, 'blendSrc'),\n blendSrcAlpha: entity.blendSrcAlpha,\n blending: getOptionNameIfPossible(entity.blending, BlendingMap, 'blending'),\n bumpScale: (entity as MeshPhongMaterial).bumpScale,\n clearcoat: (entity as MeshPhysicalMaterial).clearcoat,\n clearcoatNormalScale: vector2ToXyIfPossible((entity as MeshPhysicalMaterial).clearcoatNormalScale),\n clearcoatRoughness: (entity as MeshPhysicalMaterial).clearcoatRoughness,\n clipIntersection: entity.clipIntersection,\n clipShadows: entity.clipShadows,\n clippingPlanes: entity.clippingPlanes,\n color: serializeColorWhenPossible((entity as MeshBasicMaterial).color),\n colorWrite: entity.colorWrite,\n combine: getOptionNameIfPossible((entity as MeshBasicMaterial).combine, CombineMap, 'combine'),\n dashSize: (entity as LineDashedMaterial).dashSize,\n depthFunc: entity.depthFunc,\n depthPacking: getOptionNameIfPossible((entity as MeshDepthMaterial).depthPacking, DepthPackingStrategiesMap, 'depthPacking'),\n depthTest: entity.depthTest,\n depthWrite: entity.depthWrite,\n displacementBias: (entity as MeshPhongMaterial).displacementBias,\n displacementScale: (entity as MeshPhongMaterial).displacementScale,\n dithering: entity.dithering,\n emissive: serializeColorWhenPossible((entity as MeshLambertMaterial).emissive),\n emissiveIntensity: (entity as MeshLambertMaterial).emissiveIntensity,\n envMapIntensity: (entity as MeshStandardMaterial).envMapIntensity,\n envMapRotation: eulerToXyzIfPossible((entity as MeshPhongMaterial).envMapRotation),\n // farDistance: (entity as MeshDistanceMaterialParameters).farDistance,\n flatShading: (entity as MeshStandardMaterial).flatShading,\n fog: (entity as MeshPhongMaterial).fog,\n forceSinglePass: entity.forceSinglePass,\n gapSize: (entity as LineDashedMaterial).gapSize,\n ior: (entity as MeshPhysicalMaterial).ior,\n iridescence: (entity as MeshPhysicalMaterial).iridescence,\n iridescenceIOR: (entity as MeshPhysicalMaterial).iridescenceIOR,\n iridescenceThicknessRange: (entity as MeshPhysicalMaterial).iridescenceThicknessRange,\n lightMapIntensity: (entity as MeshPhongMaterial).lightMapIntensity,\n linewidth: (entity as LineDashedMaterial).linewidth,\n matcap: (entity as MeshMatcapMaterial).matcap,\n metalness: (entity as MeshStandardMaterial).metalness,\n // nearDistance: (entity as MeshDistanceMaterialParameters).nearDistance,\n normalMapType: getOptionNameIfPossible((entity as MeshStandardMaterial).normalMapType, NormalMapTypesMap, 'normalMapType'),\n normalScale: vector2ToXyIfPossible((entity as MeshStandardMaterial).normalScale),\n opacity: entity.opacity,\n polygonOffset: entity.polygonOffset,\n polygonOffsetFactor: entity.polygonOffsetFactor,\n polygonOffsetUnits: entity.polygonOffsetUnits,\n precision: entity.precision,\n premultipliedAlpha: entity.premultipliedAlpha,\n // referencePosition: vector3ToXyzIfPossible((entity as MeshDistanceMaterialParameters).referencePosition),\n reflectivity: (entity as MeshPhysicalMaterial).reflectivity,\n refractionRatio: (entity as MeshBasicMaterial).refractionRatio,\n rotation: (entity as SpriteNodeMaterial).rotation,\n roughness: (entity as MeshStandardMaterial).roughness,\n scale: (entity as LineDashedMaterial).scale,\n shadowSide: entity.shadowSide,\n sheen: (entity as MeshPhysicalMaterial).sheen,\n sheenColor: serializeColorWhenPossible((entity as MeshPhysicalMaterial).sheenColor),\n sheenRoughness: (entity as MeshPhysicalMaterial).sheenRoughness,\n shininess: (entity as MeshPhongMaterial).shininess,\n side: getOptionNameIfPossible(entity.side, SideMap, 'side'),\n size: (entity as PointsMaterial).size,\n sizeAttenuation: (entity as PointsMaterial).sizeAttenuation,\n specular: serializeColorWhenPossible((entity as MeshPhongMaterial).specular),\n specularColor: serializeColorWhenPossible((entity as MeshPhysicalMaterial).specularColor),\n specularIntensity: (entity as MeshPhysicalMaterial).specularIntensity,\n stencilFail: getOptionNameIfPossible(entity.stencilFail, StencilFailMap, 'stencilFail'),\n stencilFunc: getOptionNameIfPossible(entity.stencilFunc, StencilFuncMap, 'stencilFunc'),\n stencilFuncMask: entity.stencilFuncMask,\n stencilRef: entity.stencilRef,\n stencilWrite: entity.stencilWrite,\n stencilWriteMask: entity.stencilWriteMask,\n stencilZFail: getOptionNameIfPossible(entity.stencilZFail, StencilOpMap, 'stencilZFail'),\n stencilZPass: getOptionNameIfPossible(entity.stencilZPass, StencilOpMap, 'stencilZPass'),\n thickness: (entity as MeshPhysicalMaterial).thickness,\n toneMapped: entity.toneMapped,\n transmission: (entity as MeshPhysicalMaterial).transmission,\n transparent: entity.transparent,\n vertexColors: entity.vertexColors,\n visible: entity.visible,\n wireframe: (entity as MeshPhongMaterial).wireframe,\n // wireframeLinecap: (entity as MeshPhongMaterial).wireframeLinecap\n // wireframeLinejoin: (entity as MeshPhongMaterial).wireframeLinejoin\n wireframeLinewidth: (entity as MeshPhongMaterial).wireframeLinewidth\n })\n );\n}\n\nfunction getMaterialTextures({ entity }: TAnyMaterialWrapper, textureResourceRegistry: TTextureAsyncRegistry): TMaterialConfigTextures | undefined | never {\n const maps: TMaterialParamsTextures = getMaps(entity);\n const mapsKeys: { [key: string]: string } = {};\n\n Object.entries(maps).forEach(([key, value]: [string, TTexture]): void | never => {\n // eslint-disable-next-line functional/immutable-data\n mapsKeys[key] = textureResourceRegistry.getKeyByValue(value);\n });\n\n return isEmpty(mapsKeys) ? undefined : mapsKeys;\n}\n\nfunction isTextureKey(key: string): key is keyof TMaterialParamsTextures {\n return key.toLowerCase().endsWith('map');\n}\n\nfunction getMaps(entity: TMaterials): TMaterialParamsTextures {\n return filterOutEmptyFields(\n Object.entries(entity).reduce((acc: TMaterialParamsTextures, [key, value]): TMaterialParamsTextures => {\n if (isTextureKey(key)) {\n // eslint-disable-next-line functional/immutable-data\n acc[key] = value as TMaterialParamsTextures[typeof key];\n }\n return acc;\n }, {})\n );\n}\n"],"names":["materialEntityToConfig","entity","textureResourceRegistry","options","filterOutEmptyFields","nullsToUndefined","alphaHash","alphaToCoverage","anisotropy","anisotropyRotation","aoMapIntensity","attenuationColor","serializeColorWhenPossible","attenuationDistance","blendAlpha","blendColor","blendDst","getOptionNameIfPossible","BlendingDstFactorMap","blendDstAlpha","blendEquation","BlendEquationMap","blendEquationAlpha","blendSrc","BlendingSrcFactorMap","blendSrcAlpha","blending","BlendingMap","bumpScale","clearcoat","clearcoatNormalScale","vector2ToXyIfPossible","clearcoatRoughness","clipIntersection","clipShadows","clippingPlanes","color","colorWrite","combine","CombineMap","dashSize","depthFunc","depthPacking","DepthPackingStrategiesMap","depthTest","depthWrite","displacementBias","displacementScale","dithering","emissive","emissiveIntensity","envMapIntensity","envMapRotation","eulerToXyzIfPossible","flatShading","fog","forceSinglePass","gapSize","ior","iridescence","iridescenceIOR","iridescenceThicknessRange","lightMapIntensity","linewidth","matcap","metalness","normalMapType","NormalMapTypesMap","normalScale","opacity","polygonOffset","polygonOffsetFactor","polygonOffsetUnits","precision","premultipliedAlpha","reflectivity","refractionRatio","rotation","roughness","scale","shadowSide","sheen","sheenColor","sheenRoughness","shininess","side","SideMap","size","sizeAttenuation","specular","specularColor","specularIntensity","stencilFail","StencilFailMap","stencilFunc","StencilFuncMap","stencilFuncMask","stencilRef","stencilWrite","stencilWriteMask","stencilZFail","StencilOpMap","stencilZPass","thickness","toneMapped","transmission","transparent","vertexColors","visible","wireframe","wireframeLinewidth","getMaterialOptions","textures","maps","Object","entries","reduce","acc","key","value","toLowerCase","endsWith","isTextureKey","getMaps","mapsKeys","forEach","getKeyByValue","isEmpty","getMaterialTextures","type","extractSerializableRegistrableFields"],"mappings":"s0CA2CO,SAASA,uBAAuBC,QAA6BC,wBAAEA,0BACpE,MAAMC,QAWR,UAA4BF,OAAEA,SAC5B,OAAOG,qBACLC,iBAAiB,CACfC,UAAWL,OAAOK,UAElBC,gBAAiBN,OAAOM,gBACxBC,WAAaP,OAAgCO,WAC7CC,mBAAqBR,OAAgCQ,mBACrDC,eAAiBT,OAA6BS,eAC9CC,iBAAkBC,2BAA4BX,OAAgCU,kBAC9EE,oBAAsBZ,OAAgCY,oBACtDC,WAAYb,OAAOa,WACnBC,WAAYH,2BAA2BX,OAAOc,YAC9CC,SAAUC,wBAAwBhB,OAAOe,SAAUE,qBAAsB,YACzEC,cAAelB,OAAOkB,cACtBC,cAAeH,wBAAwBhB,OAAOmB,cAAeC,iBAAkB,iBAC/EC,mBAAoBrB,OAAOqB,mBAC3BC,SAAUN,wBAAwBhB,OAAOsB,SAAU,IAAKC,wBAAyBN,sBAAwB,YACzGO,cAAexB,OAAOwB,cACtBC,SAAUT,wBAAwBhB,OAAOyB,SAAUC,YAAa,YAChEC,UAAY3B,OAA6B2B,UACzCC,UAAY5B,OAAgC4B,UAC5CC,qBAAsBC,sBAAuB9B,OAAgC6B,sBAC7EE,mBAAqB/B,OAAgC+B,mBACrDC,iBAAkBhC,OAAOgC,iBACzBC,YAAajC,OAAOiC,YACpBC,eAAgBlC,OAAOkC,eACvBC,MAAOxB,2BAA4BX,OAA6BmC,OAChEC,WAAYpC,OAAOoC,WACnBC,QAASrB,wBAAyBhB,OAA6BqC,QAASC,WAAY,WACpFC,SAAWvC,OAA8BuC,SACzCC,UAAWxC,OAAOwC,UAClBC,aAAczB,wBAAyBhB,OAA6ByC,aAAcC,0BAA2B,gBAC7GC,UAAW3C,OAAO2C,UAClBC,WAAY5C,OAAO4C,WACnBC,iBAAmB7C,OAA6B6C,iBAChDC,kBAAoB9C,OAA6B8C,kBACjDC,UAAW/C,OAAO+C,UAClBC,SAAUrC,2BAA4BX,OAA+BgD,UACrEC,kBAAoBjD,OAA+BiD,kBACnDC,gBAAkBlD,OAAgCkD,gBAClDC,eAAgBC,qBAAsBpD,OAA6BmD,gBAEnEE,YAAcrD,OAAgCqD,YAC9CC,IAAMtD,OAA6BsD,IACnCC,gBAAiBvD,OAAOuD,gBACxBC,QAAUxD,OAA8BwD,QACxCC,IAAMzD,OAAgCyD,IACtCC,YAAc1D,OAAgC0D,YAC9CC,eAAiB3D,OAAgC2D,eACjDC,0BAA4B5D,OAAgC4D,0BAC5DC,kBAAoB7D,OAA6B6D,kBACjDC,UAAY9D,OAA8B8D,UAC1CC,OAAS/D,OAA8B+D,OACvCC,UAAYhE,OAAgCgE,UAE5CC,cAAejD,wBAAyBhB,OAAgCiE,cAAeC,kBAAmB,iBAC1GC,YAAarC,sBAAuB9B,OAAgCmE,aACpEC,QAASpE,OAAOoE,QAChBC,cAAerE,OAAOqE,cACtBC,oBAAqBtE,OAAOsE,oBAC5BC,mBAAoBvE,OAAOuE,mBAC3BC,UAAWxE,OAAOwE,UAClBC,mBAAoBzE,OAAOyE,mBAE3BC,aAAe1E,OAAgC0E,aAC/CC,gBAAkB3E,OAA6B2E,gBAC/CC,SAAW5E,OAA8B4E,SACzCC,UAAY7E,OAAgC6E,UAC5CC,MAAQ9E,OAA8B8E,MACtCC,WAAY/E,OAAO+E,WACnBC,MAAQhF,OAAgCgF,MACxCC,WAAYtE,2BAA4BX,OAAgCiF,YACxEC,eAAiBlF,OAAgCkF,eACjDC,UAAYnF,OAA6BmF,UACzCC,KAAMpE,wBAAwBhB,OAAOoF,KAAMC,QAAS,QACpDC,KAAOtF,OAA0BsF,KACjCC,gBAAkBvF,OAA0BuF,gBAC5CC,SAAU7E,2BAA4BX,OAA6BwF,UACnEC,cAAe9E,2BAA4BX,OAAgCyF,eAC3EC,kBAAoB1F,OAAgC0F,kBACpDC,YAAa3E,wBAAwBhB,OAAO2F,YAAaC,eAAgB,eACzEC,YAAa7E,wBAAwBhB,OAAO6F,YAAaC,eAAgB,eACzEC,gBAAiB/F,OAAO+F,gBACxBC,WAAYhG,OAAOgG,WACnBC,aAAcjG,OAAOiG,aACrBC,iBAAkBlG,OAAOkG,iBACzBC,aAAcnF,wBAAwBhB,OAAOmG,aAAcC,aAAc,gBACzEC,aAAcrF,wBAAwBhB,OAAOqG,aAAcD,aAAc,gBACzEE,UAAYtG,OAAgCsG,UAC5CC,WAAYvG,OAAOuG,WACnBC,aAAexG,OAAgCwG,aAC/CC,YAAazG,OAAOyG,YACpBC,aAAc1G,OAAO0G,aACrBC,QAAS3G,OAAO2G,QAChBC,UAAY5G,OAA6B4G,UAGzCC,mBAAqB7G,OAA6B6G,qBAGxD,CAhHsDC,CAAmB9G,QACjE+G,SAiHR,UAA6B/G,OAAEA,QAA+BC,yBAC5D,MAAM+G,KAeR,SAAiBhH,QACf,OAAOG,qBACL8G,OAAOC,QAAQlH,QAAQmH,OAAO,CAACC,KAA+BC,IAAKC,UANvE,SAAsBD,KACpB,OAAOA,IAAIE,cAAcC,SAAS,MACpC,CAKUC,CAAaJ,OAEfD,IAAIC,KAAOC,OAENF,KACN,CAAA,GAEP,CAzBwCM,CAAQ1H,QACxC2H,SAAsC,CAAA,EAO5C,OALAV,OAAOC,QAAQF,MAAMY,QAAQ,EAAEP,IAAKC,UAElCK,SAASN,KAAOpH,wBAAwB4H,cAAcP,SAGjDQ,QAAQH,eAAY,EAAYA,QACzC,CA3HwDI,CAAoB/H,OAAQC,yBAElF,OAAOE,qBAAqB,CAC1B6H,KAAMhI,OAAOA,OAAOgI,KACpB9H,gBACA6G,qBACGkB,qCAAqCjI,SAE5C"}
@@ -1,2 +1,2 @@
1
- import{configToParams}from"../Adapters/ConfigToParams.js";import{MaterialWrapper}from"../Wrappers/MaterialWrapper.js";import{ReactiveFactory}from"../../Abstract/Factories/ReactiveFactory.js";import{FactoryType}from"../../Abstract/Constants/FactoryType.js";function MaterialFactory(){const factory=ReactiveFactory(FactoryType.Material,MaterialWrapper);return Object.assign(factory,{configToParams:configToParams})}export{MaterialFactory};
1
+ import{materialConfigToParams}from"../Adapters/ConfigToParams.js";import{MaterialWrapper}from"../Wrappers/MaterialWrapper.js";import{ReactiveFactory}from"../../Abstract/Factories/ReactiveFactory.js";import{FactoryType}from"../../Abstract/Constants/FactoryType.js";function MaterialFactory(){const factory=ReactiveFactory(FactoryType.Material,MaterialWrapper);return Object.assign(factory,{configToParams:materialConfigToParams})}export{MaterialFactory};
2
2
  //# sourceMappingURL=MaterialFactory.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"MaterialFactory.js","sources":["../../../src/Material/Factories/MaterialFactory.ts"],"sourcesContent":["import type { TReactiveFactory } from '@Anarchy/Engine/Abstract';\nimport { FactoryType, ReactiveFactory } from '@Anarchy/Engine/Abstract';\nimport { configToParams } from '@Anarchy/Engine/Material/Adapters';\nimport type { TAnyMaterialWrapper, TMaterialFactory, TMaterialParams } from '@Anarchy/Engine/Material/Models';\nimport { MaterialWrapper } from '@Anarchy/Engine/Material/Wrappers';\n\nexport function MaterialFactory(): TMaterialFactory {\n const factory: TReactiveFactory<TAnyMaterialWrapper, TMaterialParams> = ReactiveFactory(FactoryType.Material, MaterialWrapper);\n // eslint-disable-next-line functional/immutable-data\n return Object.assign(factory, { configToParams });\n}\n"],"names":["MaterialFactory","factory","ReactiveFactory","FactoryType","Material","MaterialWrapper","Object","assign","configToParams"],"mappings":"gQAMO,SAASA,kBACd,MAAMC,QAAkEC,gBAAgBC,YAAYC,SAAUC,iBAE9G,OAAOC,OAAOC,OAAON,QAAS,CAAEO,+BAClC"}
1
+ {"version":3,"file":"MaterialFactory.js","sources":["../../../src/Material/Factories/MaterialFactory.ts"],"sourcesContent":["import type { TReactiveFactory } from '@Anarchy/Engine/Abstract';\nimport { FactoryType, ReactiveFactory } from '@Anarchy/Engine/Abstract';\nimport { materialConfigToParams } from '@Anarchy/Engine/Material/Adapters';\nimport type { TAnyMaterialWrapper, TMaterialFactory, TMaterialParams } from '@Anarchy/Engine/Material/Models';\nimport { MaterialWrapper } from '@Anarchy/Engine/Material/Wrappers';\n\nexport function MaterialFactory(): TMaterialFactory {\n const factory: TReactiveFactory<TAnyMaterialWrapper, TMaterialParams> = ReactiveFactory(FactoryType.Material, MaterialWrapper);\n // eslint-disable-next-line functional/immutable-data\n return Object.assign(factory, { configToParams: materialConfigToParams });\n}\n"],"names":["MaterialFactory","factory","ReactiveFactory","FactoryType","Material","MaterialWrapper","Object","assign","configToParams","materialConfigToParams"],"mappings":"wQAMO,SAASA,kBACd,MAAMC,QAAkEC,gBAAgBC,YAAYC,SAAUC,iBAE9G,OAAOC,OAAOC,OAAON,QAAS,CAAEO,eAAgBC,wBAClD"}
@@ -1,2 +1,2 @@
1
- import{materialToConfig}from"../Adapters/EntityToConfig.js";import{buildMaterial}from"../Utils/MaterialUtils.js";import{AbstractWrapper}from"../../Abstract/Wrappers/AbstractWrapper.js";import{WrapperType}from"../../Abstract/Constants/WrapperType.js";function MaterialWrapper(params){const entity=buildMaterial(params),result=Object.assign(AbstractWrapper(entity,WrapperType.Material,params),{entity:entity,serialize:dependencies=>materialToConfig(result,dependencies)});return result}export{MaterialWrapper};
1
+ import{buildMaterial}from"../Utils/MaterialUtils.js";import{materialEntityToConfig}from"../Adapters/EntityToConfig.js";import{AbstractWrapper}from"../../Abstract/Wrappers/AbstractWrapper.js";import{WrapperType}from"../../Abstract/Constants/WrapperType.js";function MaterialWrapper(params){const entity=buildMaterial(params),result=Object.assign(AbstractWrapper(entity,WrapperType.Material,params),{entity:entity,serialize:dependencies=>materialEntityToConfig(result,dependencies)});return result}export{MaterialWrapper};
2
2
  //# sourceMappingURL=MaterialWrapper.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"MaterialWrapper.js","sources":["../../../src/Material/Wrappers/MaterialWrapper.ts"],"sourcesContent":["import { AbstractWrapper, WrapperType } from '@Anarchy/Engine/Abstract';\nimport { materialToConfig } from '@Anarchy/Engine/Material/Adapters';\nimport type { TAnyMaterialWrapper, TMaterialConfig, TMaterialEntityToConfigDependencies, TMaterialParams, TMaterials } from '@Anarchy/Engine/Material/Models';\nimport { buildMaterial } from '@Anarchy/Engine/Material/Utils';\n\nexport function MaterialWrapper(params: TMaterialParams): TAnyMaterialWrapper {\n const entity: TMaterials = buildMaterial(params);\n\n const result: TAnyMaterialWrapper = Object.assign(AbstractWrapper(entity, WrapperType.Material, params), {\n entity,\n serialize: (dependencies: TMaterialEntityToConfigDependencies): TMaterialConfig => materialToConfig(result, dependencies)\n }) as TAnyMaterialWrapper;\n\n return result;\n}\n"],"names":["MaterialWrapper","params","entity","buildMaterial","result","Object","assign","AbstractWrapper","WrapperType","Material","serialize","dependencies","materialToConfig"],"mappings":"0PAKO,SAASA,gBAAgBC,QAC9B,MAAMC,OAAqBC,cAAcF,QAEnCG,OAA8BC,OAAOC,OAAOC,gBAAgBL,OAAQM,YAAYC,SAAUR,QAAS,CACvGC,cACAQ,UAAYC,cAAuEC,iBAAiBR,OAAQO,gBAG9G,OAAOP,MACT"}
1
+ {"version":3,"file":"MaterialWrapper.js","sources":["../../../src/Material/Wrappers/MaterialWrapper.ts"],"sourcesContent":["import { AbstractWrapper, WrapperType } from '@Anarchy/Engine/Abstract';\nimport { materialEntityToConfig } from '@Anarchy/Engine/Material/Adapters';\nimport type { TAnyMaterialWrapper, TMaterialConfig, TMaterialEntityToConfigDependencies, TMaterialParams, TMaterials } from '@Anarchy/Engine/Material/Models';\nimport { buildMaterial } from '@Anarchy/Engine/Material/Utils';\n\nexport function MaterialWrapper(params: TMaterialParams): TAnyMaterialWrapper {\n const entity: TMaterials = buildMaterial(params);\n\n const result: TAnyMaterialWrapper = Object.assign(AbstractWrapper(entity, WrapperType.Material, params), {\n entity,\n serialize: (dependencies: TMaterialEntityToConfigDependencies): TMaterialConfig => materialEntityToConfig(result, dependencies)\n }) as TAnyMaterialWrapper;\n\n return result;\n}\n"],"names":["MaterialWrapper","params","entity","buildMaterial","result","Object","assign","AbstractWrapper","WrapperType","Material","serialize","dependencies","materialEntityToConfig"],"mappings":"gQAKO,SAASA,gBAAgBC,QAC9B,MAAMC,OAAqBC,cAAcF,QAEnCG,OAA8BC,OAAOC,OAAOC,gBAAgBL,OAAQM,YAAYC,SAAUR,QAAS,CACvGC,cACAQ,UAAYC,cAAuEC,uBAAuBR,OAAQO,gBAGpH,OAAOP,MACT"}
@@ -1,3 +1,4 @@
1
+ export * from './Adapters';
1
2
  export * from './Constants';
2
3
  export * from './Factories';
3
4
  export * from './Mixins';
@@ -1,2 +1,2 @@
1
1
  import { TModel3dConfig, TModel3dConfigToParamsDependencies, TModel3dParams } from '../Models';
2
- export declare function configToParams(config: TModel3dConfig, { animationsResourceAsyncRegistry, materialRegistry, model3dResourceAsyncRegistry }: TModel3dConfigToParamsDependencies): TModel3dParams;
2
+ export declare function model3dConfigToParams(config: TModel3dConfig, { animationsResourceAsyncRegistry, materialRegistry, model3dResourceAsyncRegistry }: TModel3dConfigToParamsDependencies): TModel3dParams;
@@ -1,2 +1,2 @@
1
- import{isDefined,isNotDefined}from"../../packages/anarchy-shared/src/Utils/CheckUtils.js";import{isPrimitiveModel3dData}from"../Utils/UtilsPrimitiveModels3d.js";import{configToParamsObject3d}from"../../ThreeLib/Utils/Object3dUtils.js";function configToParams(config,{animationsResourceAsyncRegistry:animationsResourceAsyncRegistry,materialRegistry:materialRegistry,model3dResourceAsyncRegistry:model3dResourceAsyncRegistry}){const{position:position,rotation:rotation,material:material,scale:scale,...rest}=config;return{...rest,...configToParamsObject3d({position:position,rotation:rotation,scale:scale}),animationsSource:getAnimationsSource(config,animationsResourceAsyncRegistry),model3dSource:getModel3d(config,model3dResourceAsyncRegistry),material:isDefined(material)?materialRegistry.getByName(material):void 0}}function getModel3d(config,model3dResourceAsyncRegistry){let model3d;if(model3d=isPrimitiveModel3dData(config)?config.model3dSource:isDefined(config.model3dSource)?model3dResourceAsyncRegistry.getByKey(config.model3dSource):void 0,isNotDefined(model3d))throw new Error(`Model3dConfigAdapter: model3dSource not found: ${config.model3dSource}`);return model3d}function getAnimationsSource(config,animationsResourceAsyncRegistry){let animations=[];return isDefined(config.animationsSource)&&config.animationsSource.forEach(source=>{const loaded=animationsResourceAsyncRegistry.getByKey(source);animations=[...animations,...loaded]}),animations}export{configToParams};
1
+ import{isDefined,isNotDefined}from"../../packages/anarchy-shared/src/Utils/CheckUtils.js";import{isPrimitiveModel3dData}from"../Utils/UtilsPrimitiveModels3d.js";import{object3dConfigToParams}from"../../ThreeLib/Utils/Object3dUtils.js";function model3dConfigToParams(config,{animationsResourceAsyncRegistry:animationsResourceAsyncRegistry,materialRegistry:materialRegistry,model3dResourceAsyncRegistry:model3dResourceAsyncRegistry}){const{position:position,rotation:rotation,material:material,scale:scale,...rest}=config;return{...rest,...object3dConfigToParams({position:position,rotation:rotation,scale:scale}),animationsSource:getAnimationsSource(config,animationsResourceAsyncRegistry),model3dSource:getModel3d(config,model3dResourceAsyncRegistry),material:isDefined(material)?materialRegistry.getByName(material):void 0}}function getModel3d(config,model3dResourceAsyncRegistry){let model3d;if(model3d=isPrimitiveModel3dData(config)?config.model3dSource:isDefined(config.model3dSource)?model3dResourceAsyncRegistry.getByKey(config.model3dSource):void 0,isNotDefined(model3d))throw new Error(`Model3dConfigAdapter: model3dSource not found: ${config.model3dSource}`);return model3d}function getAnimationsSource(config,animationsResourceAsyncRegistry){let animations=[];return isDefined(config.animationsSource)&&config.animationsSource.forEach(source=>{const loaded=animationsResourceAsyncRegistry.getByKey(source);animations=[...animations,...loaded]}),animations}export{model3dConfigToParams};
2
2
  //# sourceMappingURL=ConfigToParams.js.map