@p100-web/core 100.2.16 → 100.2.18

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 (461) hide show
  1. package/dist/AdaptivePerformance.d.ts +20 -0
  2. package/dist/AdaptivePerformance.d.ts.map +1 -0
  3. package/dist/AdaptivePerformance.js +110 -0
  4. package/dist/AdaptivePerformance.js.map +1 -0
  5. package/dist/DevTools.d.ts +4 -0
  6. package/dist/DevTools.d.ts.map +1 -0
  7. package/dist/DevTools.js +10 -0
  8. package/dist/DevTools.js.map +1 -0
  9. package/dist/GameContext.d.ts +218 -0
  10. package/dist/GameContext.d.ts.map +1 -0
  11. package/dist/GameContext.js +814 -0
  12. package/dist/GameContext.js.map +1 -0
  13. package/dist/IAudioListener.d.ts +4 -0
  14. package/dist/IAudioListener.d.ts.map +1 -0
  15. package/dist/IAudioListener.js +2 -0
  16. package/dist/IAudioListener.js.map +1 -0
  17. package/dist/ICameraControls.d.ts +17 -0
  18. package/dist/ICameraControls.d.ts.map +1 -0
  19. package/dist/ICameraControls.js +2 -0
  20. package/dist/ICameraControls.js.map +1 -0
  21. package/dist/IComponentFactory.d.ts +8 -0
  22. package/dist/IComponentFactory.d.ts.map +1 -0
  23. package/dist/IComponentFactory.js +2 -0
  24. package/dist/IComponentFactory.js.map +1 -0
  25. package/dist/IDBApp.d.ts +27 -0
  26. package/dist/IDBApp.d.ts.map +1 -0
  27. package/dist/IDBApp.js +2 -0
  28. package/dist/IDBApp.js.map +1 -0
  29. package/dist/IDBEvent.d.ts +10 -0
  30. package/dist/IDBEvent.d.ts.map +1 -0
  31. package/dist/IDBEvent.js +2 -0
  32. package/dist/IDBEvent.js.map +1 -0
  33. package/dist/IDBFileUsage.d.ts +9 -0
  34. package/dist/IDBFileUsage.d.ts.map +1 -0
  35. package/dist/IDBFileUsage.js +2 -0
  36. package/dist/IDBFileUsage.js.map +1 -0
  37. package/dist/IDBItem.d.ts +9 -0
  38. package/dist/IDBItem.d.ts.map +1 -0
  39. package/dist/IDBItem.js +2 -0
  40. package/dist/IDBItem.js.map +1 -0
  41. package/dist/IDBLogic.d.ts +7 -0
  42. package/dist/IDBLogic.d.ts.map +1 -0
  43. package/dist/IDBLogic.js +2 -0
  44. package/dist/IDBLogic.js.map +1 -0
  45. package/dist/IDBNode.d.ts +21 -0
  46. package/dist/IDBNode.d.ts.map +1 -0
  47. package/dist/IDBNode.js +42 -0
  48. package/dist/IDBNode.js.map +1 -0
  49. package/dist/IDBScene.d.ts +7 -0
  50. package/dist/IDBScene.d.ts.map +1 -0
  51. package/dist/IDBScene.js +2 -0
  52. package/dist/IDBScene.js.map +1 -0
  53. package/dist/IDBValue.d.ts +19 -0
  54. package/dist/IDBValue.d.ts.map +1 -0
  55. package/dist/IDBValue.js +2 -0
  56. package/dist/IDBValue.js.map +1 -0
  57. package/dist/IDBVariable.d.ts +10 -0
  58. package/dist/IDBVariable.d.ts.map +1 -0
  59. package/dist/IDBVariable.js +2 -0
  60. package/dist/IDBVariable.js.map +1 -0
  61. package/dist/IEngine.d.ts +23 -0
  62. package/dist/IEngine.d.ts.map +1 -0
  63. package/dist/IEngine.js +2 -0
  64. package/dist/IEngine.js.map +1 -0
  65. package/dist/IEntity.d.ts +4 -0
  66. package/dist/IEntity.d.ts.map +1 -0
  67. package/dist/IEntity.js +2 -0
  68. package/dist/IEntity.js.map +1 -0
  69. package/dist/IPMaterial.d.ts +12 -0
  70. package/dist/IPMaterial.d.ts.map +1 -0
  71. package/dist/IPMaterial.js +2 -0
  72. package/dist/IPMaterial.js.map +1 -0
  73. package/dist/IPNodeRenderer.d.ts +25 -0
  74. package/dist/IPNodeRenderer.d.ts.map +1 -0
  75. package/dist/IPNodeRenderer.js +2 -0
  76. package/dist/IPNodeRenderer.js.map +1 -0
  77. package/dist/IStats.d.ts +9 -0
  78. package/dist/IStats.d.ts.map +1 -0
  79. package/dist/IStats.js +3 -0
  80. package/dist/IStats.js.map +1 -0
  81. package/dist/MathTools.d.ts +8 -0
  82. package/dist/MathTools.d.ts.map +1 -0
  83. package/dist/MathTools.js +20 -0
  84. package/dist/MathTools.js.map +1 -0
  85. package/dist/PCanvas.d.ts +171 -0
  86. package/dist/PCanvas.d.ts.map +1 -0
  87. package/dist/PCanvas.js +648 -0
  88. package/dist/PCanvas.js.map +1 -0
  89. package/dist/PComponent.d.ts +70 -0
  90. package/dist/PComponent.d.ts.map +1 -0
  91. package/dist/PComponent.js +144 -0
  92. package/dist/PComponent.js.map +1 -0
  93. package/dist/PEnums.d.ts +125 -0
  94. package/dist/PEnums.d.ts.map +1 -0
  95. package/dist/PEnums.js +155 -0
  96. package/dist/PEnums.js.map +1 -0
  97. package/dist/PEvent.d.ts +24 -0
  98. package/dist/PEvent.d.ts.map +1 -0
  99. package/dist/PEvent.js +50 -0
  100. package/dist/PEvent.js.map +1 -0
  101. package/dist/PFileSlot.d.ts +14 -0
  102. package/dist/PFileSlot.d.ts.map +1 -0
  103. package/dist/PFileSlot.js +14 -0
  104. package/dist/PFileSlot.js.map +1 -0
  105. package/dist/PFileUsage.d.ts +11 -0
  106. package/dist/PFileUsage.d.ts.map +1 -0
  107. package/dist/PFileUsage.js +24 -0
  108. package/dist/PFileUsage.js.map +1 -0
  109. package/dist/PItem.d.ts +14 -0
  110. package/dist/PItem.d.ts.map +1 -0
  111. package/dist/PItem.js +36 -0
  112. package/dist/PItem.js.map +1 -0
  113. package/dist/PLogic.d.ts +19 -0
  114. package/dist/PLogic.d.ts.map +1 -0
  115. package/dist/PLogic.js +24 -0
  116. package/dist/PLogic.js.map +1 -0
  117. package/dist/PNode.d.ts +147 -0
  118. package/dist/PNode.d.ts.map +1 -0
  119. package/dist/PNode.js +531 -0
  120. package/dist/PNode.js.map +1 -0
  121. package/dist/PPayload.d.ts +7 -0
  122. package/dist/PPayload.d.ts.map +1 -0
  123. package/dist/PPayload.js +19 -0
  124. package/dist/PPayload.js.map +1 -0
  125. package/dist/PScene.d.ts +8 -0
  126. package/dist/PScene.d.ts.map +1 -0
  127. package/dist/PScene.js +12 -0
  128. package/dist/PScene.js.map +1 -0
  129. package/dist/PTypes.d.ts +54 -0
  130. package/dist/PTypes.d.ts.map +1 -0
  131. package/dist/PTypes.js +2 -0
  132. package/dist/PTypes.js.map +1 -0
  133. package/dist/PValue.d.ts +20 -0
  134. package/dist/PValue.d.ts.map +1 -0
  135. package/dist/PValue.js +68 -0
  136. package/dist/PValue.js.map +1 -0
  137. package/dist/PVariable.d.ts +29 -0
  138. package/dist/PVariable.d.ts.map +1 -0
  139. package/dist/PVariable.js +52 -0
  140. package/dist/PVariable.js.map +1 -0
  141. package/dist/PVector2.d.ts +14 -0
  142. package/dist/PVector2.d.ts.map +1 -0
  143. package/dist/PVector2.js +25 -0
  144. package/dist/PVector2.js.map +1 -0
  145. package/dist/PVector3.d.ts +19 -0
  146. package/dist/PVector3.d.ts.map +1 -0
  147. package/dist/PVector3.js +44 -0
  148. package/dist/PVector3.js.map +1 -0
  149. package/dist/animations/AnimationTools.d.ts +3 -0
  150. package/dist/animations/AnimationTools.d.ts.map +1 -0
  151. package/dist/animations/AnimationTools.js +12 -0
  152. package/dist/animations/AnimationTools.js.map +1 -0
  153. package/dist/animations/IModelAnimation.d.ts +19 -0
  154. package/dist/animations/IModelAnimation.d.ts.map +1 -0
  155. package/dist/animations/IModelAnimation.js +2 -0
  156. package/dist/animations/IModelAnimation.js.map +1 -0
  157. package/dist/assets/AssetLoader.d.ts +10 -0
  158. package/dist/assets/AssetLoader.d.ts.map +1 -0
  159. package/dist/assets/AssetLoader.js +12 -0
  160. package/dist/assets/AssetLoader.js.map +1 -0
  161. package/dist/index.d.ts +166 -0
  162. package/dist/index.d.ts.map +1 -0
  163. package/dist/index.js +126 -0
  164. package/dist/index.js.map +1 -0
  165. package/dist/media/IDBFile.d.ts +18 -0
  166. package/dist/media/IDBFile.d.ts.map +1 -0
  167. package/dist/media/IDBFile.js +2 -0
  168. package/dist/media/IDBFile.js.map +1 -0
  169. package/dist/media/PFile.d.ts +13 -0
  170. package/dist/media/PFile.d.ts.map +1 -0
  171. package/dist/media/PFile.js +34 -0
  172. package/dist/media/PFile.js.map +1 -0
  173. package/dist/pcomponents/BaseMaterial.d.ts +48 -0
  174. package/dist/pcomponents/BaseMaterial.d.ts.map +1 -0
  175. package/dist/pcomponents/BaseMaterial.js +59 -0
  176. package/dist/pcomponents/BaseMaterial.js.map +1 -0
  177. package/dist/pcomponents/PAnimator.d.ts +48 -0
  178. package/dist/pcomponents/PAnimator.d.ts.map +1 -0
  179. package/dist/pcomponents/PAnimator.js +57 -0
  180. package/dist/pcomponents/PAnimator.js.map +1 -0
  181. package/dist/pcomponents/PBackground.d.ts +36 -0
  182. package/dist/pcomponents/PBackground.d.ts.map +1 -0
  183. package/dist/pcomponents/PBackground.js +45 -0
  184. package/dist/pcomponents/PBackground.js.map +1 -0
  185. package/dist/pcomponents/PBasicMaterial.d.ts +22 -0
  186. package/dist/pcomponents/PBasicMaterial.d.ts.map +1 -0
  187. package/dist/pcomponents/PBasicMaterial.js +30 -0
  188. package/dist/pcomponents/PBasicMaterial.js.map +1 -0
  189. package/dist/pcomponents/PCallAction.d.ts +24 -0
  190. package/dist/pcomponents/PCallAction.d.ts.map +1 -0
  191. package/dist/pcomponents/PCallAction.js +34 -0
  192. package/dist/pcomponents/PCallAction.js.map +1 -0
  193. package/dist/pcomponents/PCameraPosition.d.ts +33 -0
  194. package/dist/pcomponents/PCameraPosition.d.ts.map +1 -0
  195. package/dist/pcomponents/PCameraPosition.js +83 -0
  196. package/dist/pcomponents/PCameraPosition.js.map +1 -0
  197. package/dist/pcomponents/PCameraTarget.d.ts +33 -0
  198. package/dist/pcomponents/PCameraTarget.d.ts.map +1 -0
  199. package/dist/pcomponents/PCameraTarget.js +84 -0
  200. package/dist/pcomponents/PCameraTarget.js.map +1 -0
  201. package/dist/pcomponents/PCollider.d.ts +40 -0
  202. package/dist/pcomponents/PCollider.d.ts.map +1 -0
  203. package/dist/pcomponents/PCollider.js +57 -0
  204. package/dist/pcomponents/PCollider.js.map +1 -0
  205. package/dist/pcomponents/PCompare.d.ts +33 -0
  206. package/dist/pcomponents/PCompare.d.ts.map +1 -0
  207. package/dist/pcomponents/PCompare.js +75 -0
  208. package/dist/pcomponents/PCompare.js.map +1 -0
  209. package/dist/pcomponents/PControllerInput.d.ts +30 -0
  210. package/dist/pcomponents/PControllerInput.d.ts.map +1 -0
  211. package/dist/pcomponents/PControllerInput.js +38 -0
  212. package/dist/pcomponents/PControllerInput.js.map +1 -0
  213. package/dist/pcomponents/PCubeGeometry.d.ts +18 -0
  214. package/dist/pcomponents/PCubeGeometry.d.ts.map +1 -0
  215. package/dist/pcomponents/PCubeGeometry.js +23 -0
  216. package/dist/pcomponents/PCubeGeometry.js.map +1 -0
  217. package/dist/pcomponents/PDebug.d.ts +21 -0
  218. package/dist/pcomponents/PDebug.d.ts.map +1 -0
  219. package/dist/pcomponents/PDebug.js +31 -0
  220. package/dist/pcomponents/PDebug.js.map +1 -0
  221. package/dist/pcomponents/PEnvironment.d.ts +28 -0
  222. package/dist/pcomponents/PEnvironment.d.ts.map +1 -0
  223. package/dist/pcomponents/PEnvironment.js +34 -0
  224. package/dist/pcomponents/PEnvironment.js.map +1 -0
  225. package/dist/pcomponents/PFadeAnimation.d.ts +31 -0
  226. package/dist/pcomponents/PFadeAnimation.d.ts.map +1 -0
  227. package/dist/pcomponents/PFadeAnimation.js +112 -0
  228. package/dist/pcomponents/PFadeAnimation.js.map +1 -0
  229. package/dist/pcomponents/PHud.d.ts +12 -0
  230. package/dist/pcomponents/PHud.d.ts.map +1 -0
  231. package/dist/pcomponents/PHud.js +12 -0
  232. package/dist/pcomponents/PHud.js.map +1 -0
  233. package/dist/pcomponents/PImageCache.d.ts +16 -0
  234. package/dist/pcomponents/PImageCache.d.ts.map +1 -0
  235. package/dist/pcomponents/PImageCache.js +30 -0
  236. package/dist/pcomponents/PImageCache.js.map +1 -0
  237. package/dist/pcomponents/PImageDetector.d.ts +26 -0
  238. package/dist/pcomponents/PImageDetector.d.ts.map +1 -0
  239. package/dist/pcomponents/PImageDetector.js +32 -0
  240. package/dist/pcomponents/PImageDetector.js.map +1 -0
  241. package/dist/pcomponents/PInteger.d.ts +41 -0
  242. package/dist/pcomponents/PInteger.d.ts.map +1 -0
  243. package/dist/pcomponents/PInteger.js +73 -0
  244. package/dist/pcomponents/PInteger.js.map +1 -0
  245. package/dist/pcomponents/PIntegerAnimator.d.ts +37 -0
  246. package/dist/pcomponents/PIntegerAnimator.d.ts.map +1 -0
  247. package/dist/pcomponents/PIntegerAnimator.js +104 -0
  248. package/dist/pcomponents/PIntegerAnimator.js.map +1 -0
  249. package/dist/pcomponents/PLayerManager.d.ts +30 -0
  250. package/dist/pcomponents/PLayerManager.d.ts.map +1 -0
  251. package/dist/pcomponents/PLayerManager.js +57 -0
  252. package/dist/pcomponents/PLayerManager.js.map +1 -0
  253. package/dist/pcomponents/PLight.d.ts +15 -0
  254. package/dist/pcomponents/PLight.d.ts.map +1 -0
  255. package/dist/pcomponents/PLight.js +19 -0
  256. package/dist/pcomponents/PLight.js.map +1 -0
  257. package/dist/pcomponents/PLightDirectional.d.ts +19 -0
  258. package/dist/pcomponents/PLightDirectional.d.ts.map +1 -0
  259. package/dist/pcomponents/PLightDirectional.js +25 -0
  260. package/dist/pcomponents/PLightDirectional.js.map +1 -0
  261. package/dist/pcomponents/PMaskedMaterial.d.ts +19 -0
  262. package/dist/pcomponents/PMaskedMaterial.d.ts.map +1 -0
  263. package/dist/pcomponents/PMaskedMaterial.js +28 -0
  264. package/dist/pcomponents/PMaskedMaterial.js.map +1 -0
  265. package/dist/pcomponents/PMaterialModifier.d.ts +38 -0
  266. package/dist/pcomponents/PMaterialModifier.d.ts.map +1 -0
  267. package/dist/pcomponents/PMaterialModifier.js +67 -0
  268. package/dist/pcomponents/PMaterialModifier.js.map +1 -0
  269. package/dist/pcomponents/PModelAnnotation.d.ts +47 -0
  270. package/dist/pcomponents/PModelAnnotation.d.ts.map +1 -0
  271. package/dist/pcomponents/PModelAnnotation.js +118 -0
  272. package/dist/pcomponents/PModelAnnotation.js.map +1 -0
  273. package/dist/pcomponents/PModelAnnotations.d.ts +46 -0
  274. package/dist/pcomponents/PModelAnnotations.d.ts.map +1 -0
  275. package/dist/pcomponents/PModelAnnotations.js +127 -0
  276. package/dist/pcomponents/PModelAnnotations.js.map +1 -0
  277. package/dist/pcomponents/PModelGLTF.d.ts +34 -0
  278. package/dist/pcomponents/PModelGLTF.d.ts.map +1 -0
  279. package/dist/pcomponents/PModelGLTF.js +55 -0
  280. package/dist/pcomponents/PModelGLTF.js.map +1 -0
  281. package/dist/pcomponents/PModelNode.d.ts +16 -0
  282. package/dist/pcomponents/PModelNode.d.ts.map +1 -0
  283. package/dist/pcomponents/PModelNode.js +18 -0
  284. package/dist/pcomponents/PModelNode.js.map +1 -0
  285. package/dist/pcomponents/PMoveAnimation.d.ts +27 -0
  286. package/dist/pcomponents/PMoveAnimation.d.ts.map +1 -0
  287. package/dist/pcomponents/PMoveAnimation.js +64 -0
  288. package/dist/pcomponents/PMoveAnimation.js.map +1 -0
  289. package/dist/pcomponents/PMoveToAnimation.d.ts +26 -0
  290. package/dist/pcomponents/PMoveToAnimation.d.ts.map +1 -0
  291. package/dist/pcomponents/PMoveToAnimation.js +80 -0
  292. package/dist/pcomponents/PMoveToAnimation.js.map +1 -0
  293. package/dist/pcomponents/PNodeVariable.d.ts +34 -0
  294. package/dist/pcomponents/PNodeVariable.d.ts.map +1 -0
  295. package/dist/pcomponents/PNodeVariable.js +52 -0
  296. package/dist/pcomponents/PNodeVariable.js.map +1 -0
  297. package/dist/pcomponents/PNumberAnimator.d.ts +41 -0
  298. package/dist/pcomponents/PNumberAnimator.d.ts.map +1 -0
  299. package/dist/pcomponents/PNumberAnimator.js +102 -0
  300. package/dist/pcomponents/PNumberAnimator.js.map +1 -0
  301. package/dist/pcomponents/PPhysicalMaterial.d.ts +28 -0
  302. package/dist/pcomponents/PPhysicalMaterial.d.ts.map +1 -0
  303. package/dist/pcomponents/PPhysicalMaterial.js +34 -0
  304. package/dist/pcomponents/PPhysicalMaterial.js.map +1 -0
  305. package/dist/pcomponents/PPlaneDetector.d.ts +20 -0
  306. package/dist/pcomponents/PPlaneDetector.d.ts.map +1 -0
  307. package/dist/pcomponents/PPlaneDetector.js +24 -0
  308. package/dist/pcomponents/PPlaneDetector.js.map +1 -0
  309. package/dist/pcomponents/PPlaneGeometry.d.ts +20 -0
  310. package/dist/pcomponents/PPlaneGeometry.d.ts.map +1 -0
  311. package/dist/pcomponents/PPlaneGeometry.js +26 -0
  312. package/dist/pcomponents/PPlaneGeometry.js.map +1 -0
  313. package/dist/pcomponents/PProjectRoot.d.ts +42 -0
  314. package/dist/pcomponents/PProjectRoot.d.ts.map +1 -0
  315. package/dist/pcomponents/PProjectRoot.js +93 -0
  316. package/dist/pcomponents/PProjectRoot.js.map +1 -0
  317. package/dist/pcomponents/PRotateAnimation.d.ts +33 -0
  318. package/dist/pcomponents/PRotateAnimation.d.ts.map +1 -0
  319. package/dist/pcomponents/PRotateAnimation.js +80 -0
  320. package/dist/pcomponents/PRotateAnimation.js.map +1 -0
  321. package/dist/pcomponents/PScaleAnimation.d.ts +28 -0
  322. package/dist/pcomponents/PScaleAnimation.d.ts.map +1 -0
  323. package/dist/pcomponents/PScaleAnimation.js +81 -0
  324. package/dist/pcomponents/PScaleAnimation.js.map +1 -0
  325. package/dist/pcomponents/PSceneContainer.d.ts +23 -0
  326. package/dist/pcomponents/PSceneContainer.d.ts.map +1 -0
  327. package/dist/pcomponents/PSceneContainer.js +45 -0
  328. package/dist/pcomponents/PSceneContainer.js.map +1 -0
  329. package/dist/pcomponents/PSceneRoot.d.ts +16 -0
  330. package/dist/pcomponents/PSceneRoot.d.ts.map +1 -0
  331. package/dist/pcomponents/PSceneRoot.js +20 -0
  332. package/dist/pcomponents/PSceneRoot.js.map +1 -0
  333. package/dist/pcomponents/PSlider.d.ts +34 -0
  334. package/dist/pcomponents/PSlider.d.ts.map +1 -0
  335. package/dist/pcomponents/PSlider.js +38 -0
  336. package/dist/pcomponents/PSlider.js.map +1 -0
  337. package/dist/pcomponents/PSound.d.ts +33 -0
  338. package/dist/pcomponents/PSound.d.ts.map +1 -0
  339. package/dist/pcomponents/PSound.js +39 -0
  340. package/dist/pcomponents/PSound.js.map +1 -0
  341. package/dist/pcomponents/PSphereGeometry.d.ts +19 -0
  342. package/dist/pcomponents/PSphereGeometry.d.ts.map +1 -0
  343. package/dist/pcomponents/PSphereGeometry.js +25 -0
  344. package/dist/pcomponents/PSphereGeometry.js.map +1 -0
  345. package/dist/pcomponents/PSprite.d.ts +17 -0
  346. package/dist/pcomponents/PSprite.d.ts.map +1 -0
  347. package/dist/pcomponents/PSprite.js +21 -0
  348. package/dist/pcomponents/PSprite.js.map +1 -0
  349. package/dist/pcomponents/PSpriteSheet.d.ts +28 -0
  350. package/dist/pcomponents/PSpriteSheet.d.ts.map +1 -0
  351. package/dist/pcomponents/PSpriteSheet.js +41 -0
  352. package/dist/pcomponents/PSpriteSheet.js.map +1 -0
  353. package/dist/pcomponents/PText.d.ts +34 -0
  354. package/dist/pcomponents/PText.d.ts.map +1 -0
  355. package/dist/pcomponents/PText.js +43 -0
  356. package/dist/pcomponents/PText.js.map +1 -0
  357. package/dist/pcomponents/PTransform.d.ts +23 -0
  358. package/dist/pcomponents/PTransform.d.ts.map +1 -0
  359. package/dist/pcomponents/PTransform.js +67 -0
  360. package/dist/pcomponents/PTransform.js.map +1 -0
  361. package/dist/pcomponents/PVarList.d.ts +42 -0
  362. package/dist/pcomponents/PVarList.d.ts.map +1 -0
  363. package/dist/pcomponents/PVarList.js +84 -0
  364. package/dist/pcomponents/PVarList.js.map +1 -0
  365. package/dist/pcomponents/PVideoPlayer.d.ts +36 -0
  366. package/dist/pcomponents/PVideoPlayer.d.ts.map +1 -0
  367. package/dist/pcomponents/PVideoPlayer.js +93 -0
  368. package/dist/pcomponents/PVideoPlayer.js.map +1 -0
  369. package/dist/pcomponents/PVisibility.d.ts +43 -0
  370. package/dist/pcomponents/PVisibility.d.ts.map +1 -0
  371. package/dist/pcomponents/PVisibility.js +83 -0
  372. package/dist/pcomponents/PVisibility.js.map +1 -0
  373. package/dist/pcomponents/PXRTools.d.ts +32 -0
  374. package/dist/pcomponents/PXRTools.d.ts.map +1 -0
  375. package/dist/pcomponents/PXRTools.js +43 -0
  376. package/dist/pcomponents/PXRTools.js.map +1 -0
  377. package/dist/plogics/PLAnd.d.ts +18 -0
  378. package/dist/plogics/PLAnd.d.ts.map +1 -0
  379. package/dist/plogics/PLAnd.js +45 -0
  380. package/dist/plogics/PLAnd.js.map +1 -0
  381. package/dist/plogics/PLCompare.d.ts +31 -0
  382. package/dist/plogics/PLCompare.d.ts.map +1 -0
  383. package/dist/plogics/PLCompare.js +107 -0
  384. package/dist/plogics/PLCompare.js.map +1 -0
  385. package/dist/plogics/PLEquals.d.ts +18 -0
  386. package/dist/plogics/PLEquals.d.ts.map +1 -0
  387. package/dist/plogics/PLEquals.js +46 -0
  388. package/dist/plogics/PLEquals.js.map +1 -0
  389. package/dist/plogics/PLOr.d.ts +18 -0
  390. package/dist/plogics/PLOr.d.ts.map +1 -0
  391. package/dist/plogics/PLOr.js +43 -0
  392. package/dist/plogics/PLOr.js.map +1 -0
  393. package/dist/ports/IDBEventLink.d.ts +17 -0
  394. package/dist/ports/IDBEventLink.d.ts.map +1 -0
  395. package/dist/ports/IDBEventLink.js +2 -0
  396. package/dist/ports/IDBEventLink.js.map +1 -0
  397. package/dist/ports/IDBValueLink.d.ts +14 -0
  398. package/dist/ports/IDBValueLink.d.ts.map +1 -0
  399. package/dist/ports/IDBValueLink.js +2 -0
  400. package/dist/ports/IDBValueLink.js.map +1 -0
  401. package/dist/ports/PInEventPort.d.ts +18 -0
  402. package/dist/ports/PInEventPort.d.ts.map +1 -0
  403. package/dist/ports/PInEventPort.js +29 -0
  404. package/dist/ports/PInEventPort.js.map +1 -0
  405. package/dist/ports/PInValuePort.d.ts +21 -0
  406. package/dist/ports/PInValuePort.d.ts.map +1 -0
  407. package/dist/ports/PInValuePort.js +36 -0
  408. package/dist/ports/PInValuePort.js.map +1 -0
  409. package/dist/ports/PLink.d.ts +25 -0
  410. package/dist/ports/PLink.d.ts.map +1 -0
  411. package/dist/ports/PLink.js +53 -0
  412. package/dist/ports/PLink.js.map +1 -0
  413. package/dist/ports/POutEventPort.d.ts +22 -0
  414. package/dist/ports/POutEventPort.d.ts.map +1 -0
  415. package/dist/ports/POutEventPort.js +48 -0
  416. package/dist/ports/POutEventPort.js.map +1 -0
  417. package/dist/ports/POutValuePort.d.ts +23 -0
  418. package/dist/ports/POutValuePort.d.ts.map +1 -0
  419. package/dist/ports/POutValuePort.js +44 -0
  420. package/dist/ports/POutValuePort.js.map +1 -0
  421. package/dist/ports/PPort.d.ts +24 -0
  422. package/dist/ports/PPort.d.ts.map +1 -0
  423. package/dist/ports/PPort.js +25 -0
  424. package/dist/ports/PPort.js.map +1 -0
  425. package/dist/ports/PValueLink.d.ts +20 -0
  426. package/dist/ports/PValueLink.d.ts.map +1 -0
  427. package/dist/ports/PValueLink.js +39 -0
  428. package/dist/ports/PValueLink.js.map +1 -0
  429. package/dist/settings/ICameraSettings.d.ts +16 -0
  430. package/dist/settings/ICameraSettings.d.ts.map +1 -0
  431. package/dist/settings/ICameraSettings.js +2 -0
  432. package/dist/settings/ICameraSettings.js.map +1 -0
  433. package/dist/settings/IQualitySettings.d.ts +14 -0
  434. package/dist/settings/IQualitySettings.d.ts.map +1 -0
  435. package/dist/settings/IQualitySettings.js +2 -0
  436. package/dist/settings/IQualitySettings.js.map +1 -0
  437. package/dist/settings/IRenderSetting.d.ts +7 -0
  438. package/dist/settings/IRenderSetting.d.ts.map +1 -0
  439. package/dist/settings/IRenderSetting.js +2 -0
  440. package/dist/settings/IRenderSetting.js.map +1 -0
  441. package/dist/settings/ISetting.d.ts +4 -0
  442. package/dist/settings/ISetting.d.ts.map +1 -0
  443. package/dist/settings/ISetting.js +2 -0
  444. package/dist/settings/ISetting.js.map +1 -0
  445. package/dist/settings/IWebSettings.d.ts +6 -0
  446. package/dist/settings/IWebSettings.d.ts.map +1 -0
  447. package/dist/settings/IWebSettings.js +2 -0
  448. package/dist/settings/IWebSettings.js.map +1 -0
  449. package/dist/settings/Settings_Babylonjs.d.ts +101 -0
  450. package/dist/settings/Settings_Babylonjs.d.ts.map +1 -0
  451. package/dist/settings/Settings_Babylonjs.js +85 -0
  452. package/dist/settings/Settings_Babylonjs.js.map +1 -0
  453. package/dist/settings/Settings_Base.d.ts +11 -0
  454. package/dist/settings/Settings_Base.d.ts.map +1 -0
  455. package/dist/settings/Settings_Base.js +45 -0
  456. package/dist/settings/Settings_Base.js.map +1 -0
  457. package/dist/settings/Settings_Threejs.d.ts +106 -0
  458. package/dist/settings/Settings_Threejs.d.ts.map +1 -0
  459. package/dist/settings/Settings_Threejs.js +165 -0
  460. package/dist/settings/Settings_Threejs.js.map +1 -0
  461. package/package.json +1 -1
@@ -0,0 +1,814 @@
1
+ import PFile from "./media/PFile";
2
+ import { Platform, Language, Coordinates, PortTypes, LogicTypes, } from "./PEnums";
3
+ import PEvent from "./PEvent";
4
+ import PNode from "./PNode";
5
+ import { PVariable } from "./PVariable";
6
+ import PFileUsage from "./PFileUsage";
7
+ import PScene from "./PScene";
8
+ import PValue from "./PValue";
9
+ import PLAnd from "./plogics/PLAnd";
10
+ import PLOr from "./plogics/PLOr";
11
+ import PLEquals from "./plogics/PLEquals";
12
+ import PLCompare from "./plogics/PLCompare";
13
+ var Workers;
14
+ (function (Workers) {
15
+ Workers[Workers["None"] = 0] = "None";
16
+ Workers[Workers["System"] = 1] = "System";
17
+ Workers[Workers["CameraControls"] = 2] = "CameraControls";
18
+ Workers[Workers["Animating"] = 4] = "Animating";
19
+ Workers[Workers["Updators"] = 8] = "Updators";
20
+ Workers[Workers["Admin"] = 16] = "Admin";
21
+ Workers[Workers["SceneLoader"] = 32] = "SceneLoader";
22
+ Workers[Workers["AdaptivePerformance"] = 64] = "AdaptivePerformance";
23
+ })(Workers || (Workers = {}));
24
+ export { Workers };
25
+ export default class GameContext {
26
+ _owner;
27
+ _root = null;
28
+ _pcanvas = null;
29
+ _running = false;
30
+ _pnodeRenderer = null;
31
+ _engine = null;
32
+ _audioListener = null;
33
+ _componentFactory = null;
34
+ _assetLoader = null;
35
+ editor = false;
36
+ debug_fastVideo = false;
37
+ isAdmin() {
38
+ return false;
39
+ }
40
+ s3Url = "https://p100-pw.s3.eu-north-1.amazonaws.com/";
41
+ constructor(owner, platform, baseUrl) {
42
+ this._owner = owner;
43
+ this._platform = platform;
44
+ if (baseUrl)
45
+ this.s3Url = baseUrl + "/";
46
+ }
47
+ setEngine(engine) {
48
+ this._engine = engine;
49
+ if (engine) {
50
+ this._pnodeRenderer = engine.setupNodeRenderer(this);
51
+ this._componentFactory = engine.getComponentFactory();
52
+ }
53
+ else {
54
+ this._pnodeRenderer = null;
55
+ this._componentFactory = null;
56
+ }
57
+ }
58
+ getOwner() {
59
+ return this._owner;
60
+ }
61
+ //
62
+ // PID
63
+ //
64
+ pid() {
65
+ console.error("MISSING PID");
66
+ return 0;
67
+ }
68
+ //
69
+ // PRENDERER
70
+ //
71
+ getIEngine() {
72
+ return this._engine;
73
+ }
74
+ getEngine() {
75
+ return this._engine;
76
+ }
77
+ getNodeRenderer() {
78
+ return this._pnodeRenderer;
79
+ }
80
+ //
81
+ // PCANVAS
82
+ //
83
+ getEngineScene() {
84
+ return this._pcanvas.getScene();
85
+ }
86
+ getCanvas() {
87
+ return this._pcanvas;
88
+ }
89
+ getPCanvas() {
90
+ return this._pcanvas;
91
+ }
92
+ getCanvasElement() {
93
+ return this._pcanvas?.getCanvasElement() || null;
94
+ }
95
+ setPCanvas(canvas) {
96
+ if (this._pcanvas !== null && canvas !== null) {
97
+ this.error("GameContext already had a canvas");
98
+ return;
99
+ }
100
+ this._pcanvas = canvas;
101
+ }
102
+ //
103
+ // ASSETS
104
+ //
105
+ assetLoader() {
106
+ if (this._assetLoader === null) {
107
+ this._assetLoader = this._engine.setupAssetLoader(this);
108
+ }
109
+ return this._assetLoader;
110
+ }
111
+ async loadAssetsAsync() {
112
+ return this._assetLoader?.loadAsync();
113
+ }
114
+ //
115
+ // MEDIA LOADERS
116
+ //
117
+ hasMediaQueue() {
118
+ return this._assetLoader?.hasQueue() || false;
119
+ }
120
+ //
121
+ // IEmitter
122
+ //
123
+ getContext() {
124
+ return this;
125
+ }
126
+ //
127
+ // LIFE CYCLE
128
+ //
129
+ /**
130
+ * Init and render scene
131
+ */
132
+ enable() {
133
+ this._sceneLoaderCounter = 0;
134
+ if (this._root) {
135
+ if (this._root.hasValidPlatform()) {
136
+ this._root.enable();
137
+ this._root.initialHideCheck();
138
+ this.setWorkFlag(Workers.System);
139
+ // pcanvas.enable();
140
+ this.clearWorkFlag(Workers.System);
141
+ }
142
+ else {
143
+ this.error("Root is not enabled or valid platform");
144
+ }
145
+ }
146
+ }
147
+ disable() {
148
+ this.disableInput();
149
+ this._root?.disable();
150
+ }
151
+ /**
152
+ * Destroy everything
153
+ */
154
+ dispose() {
155
+ this._assetLoader?.dispose();
156
+ this._assetLoader = null;
157
+ // Dispose ALL nodes, not just mounted ones
158
+ for (const node of this._nodes) {
159
+ node.dispose(false);
160
+ }
161
+ this._root = null;
162
+ this._nodes.length = 0;
163
+ this._events.length = 0;
164
+ this._fileUsages.length = 0;
165
+ this._pfiles.length = 0;
166
+ this._variables.length = 0;
167
+ if (this._audioListener !== null) {
168
+ const audioListener = this._audioListener;
169
+ if (audioListener.dispose) {
170
+ audioListener.dispose();
171
+ }
172
+ }
173
+ this.disposeCanvas();
174
+ }
175
+ /**
176
+ * Call when we need to dispose the old PCanvas and canvas element
177
+ */
178
+ disposeCanvas() {
179
+ this._pcanvas?.dispose();
180
+ this._assetLoader?.dispose();
181
+ this._assetLoader = null;
182
+ this._pcanvas = null;
183
+ this._engine = null;
184
+ }
185
+ /**
186
+ * use hard = true if we want to tear down and free all resources. Not
187
+ * to use while restarting.
188
+ */
189
+ soft_dispose() {
190
+ // Dispose ALL nodes, not just mounted ones
191
+ for (const node of this._nodes) {
192
+ node.dispose(false);
193
+ }
194
+ this._root = null;
195
+ this._nodes = [];
196
+ }
197
+ isLoading() {
198
+ return this.hasMediaQueue();
199
+ }
200
+ _sceneLoaderCounter = 0;
201
+ increaseSceneLoader() {
202
+ this._sceneLoaderCounter++;
203
+ if (this._sceneLoaderCounter === 1) {
204
+ this.setWorkFlag(Workers.SceneLoader);
205
+ }
206
+ }
207
+ decreaseSceneLoader() {
208
+ this._sceneLoaderCounter--;
209
+ if (this._sceneLoaderCounter === 0) {
210
+ this.clearWorkFlag(Workers.SceneLoader);
211
+ }
212
+ }
213
+ async play() {
214
+ if (this._root === null)
215
+ return;
216
+ if (this._running === true) {
217
+ console.error("play() GameContext was already running.");
218
+ return;
219
+ }
220
+ const pRootComponent = this._root.findComponent("PProjectRoot");
221
+ if (pRootComponent === null) {
222
+ this.error("play() PProjectRoot not found");
223
+ return;
224
+ }
225
+ this.increaseSceneLoader();
226
+ for (const variable of Object.values(this._variables)) {
227
+ variable.reset();
228
+ }
229
+ this._running = true;
230
+ await this.setupAudioListener();
231
+ this._root.play();
232
+ pRootComponent.native_OnPlay();
233
+ await this._assetLoader?.loadAsync();
234
+ pRootComponent.native_OnPlaying();
235
+ this._pcanvas?.updateEditorMode(false);
236
+ this._pcanvas.onSceneRunning();
237
+ this.decreaseSceneLoader();
238
+ }
239
+ stop() {
240
+ if (this._root === null)
241
+ return;
242
+ if (this._running === false)
243
+ return;
244
+ this._running = false;
245
+ for (const variable of Object.values(this._variables)) {
246
+ variable.reset();
247
+ }
248
+ this._root.stop();
249
+ this._pcanvas?.updateEditorMode(true);
250
+ }
251
+ //
252
+ // WORKER
253
+ //
254
+ _workFlags = 0;
255
+ isWorking() {
256
+ return this._workFlags > 0;
257
+ }
258
+ setWorkFlag(worker) {
259
+ const wasWorking = this._workFlags > 0;
260
+ this._workFlags = this._workFlags | worker;
261
+ // console.log(
262
+ // "setWorkState (" + Workers[worker] + ") _workFlags: ",
263
+ // this._workFlags
264
+ // );
265
+ if (!wasWorking && this._workFlags > 0 && this._pcanvas !== null) {
266
+ this._pcanvas.onWorkStarted(this._workFlags);
267
+ this.getOwner().setWorkState(true);
268
+ }
269
+ }
270
+ clearWorkFlag(flag) {
271
+ const wasWorking = this._workFlags > 0;
272
+ this._workFlags = this._workFlags & ~flag;
273
+ // console.log(
274
+ // "clearWorkState (" + Workers[flag] + ") _workState: ",
275
+ // this._workFlags
276
+ // );
277
+ if (wasWorking && this._workFlags === 0 && this._pcanvas !== null) {
278
+ this._pcanvas.onWorkStopped(flag);
279
+ this.getOwner().setWorkState(false);
280
+ }
281
+ }
282
+ /**
283
+ * Render a single frame if sleeping
284
+ */
285
+ snooze() {
286
+ this._pcanvas.snooze();
287
+ }
288
+ //
289
+ // NATIVE EVENTS
290
+ //
291
+ onClick = (node, ctrl, shift) => {
292
+ this._owner?.onClick(node, ctrl, shift);
293
+ };
294
+ onHoverEnter = (node) => {
295
+ this._owner?.onHoverEnter(node);
296
+ };
297
+ onHoverExit = (node) => {
298
+ this._owner?.onHoverExit(node);
299
+ };
300
+ //
301
+ // PEVENTS
302
+ //
303
+ _events = [];
304
+ registerEvent(dbEvent) {
305
+ const pevent = new PEvent(dbEvent, this);
306
+ this._events.push(pevent);
307
+ return pevent;
308
+ }
309
+ getEvents() {
310
+ return this._events;
311
+ }
312
+ getEventByPid(pid) {
313
+ return this._events.find((e) => e.pid === pid) || null;
314
+ }
315
+ getExternalEvent(name) {
316
+ return this._events.find((e) => e.external && e.name === name) || null;
317
+ }
318
+ //
319
+ // PVARIABLES
320
+ //
321
+ _variables = [];
322
+ registerVariable(dbVariable) {
323
+ const pvariable = new PVariable(dbVariable);
324
+ this._variables.push(pvariable);
325
+ return pvariable;
326
+ }
327
+ getVariables() {
328
+ return this._variables;
329
+ }
330
+ getVariableByPid(pid) {
331
+ return this._variables.find((v) => v.pid === pid) || null;
332
+ }
333
+ getVariable(id) {
334
+ console.error("do not use getVariable(id: string)");
335
+ return this._variables.find((v) => v._id === id) || null;
336
+ }
337
+ //
338
+ // FILES
339
+ //
340
+ // This is overriden by EGameContext
341
+ _pfiles = [];
342
+ // This is overriden by EGameContext
343
+ registerFile(dbItem) {
344
+ const item = new PFile(dbItem);
345
+ this._pfiles.push(item);
346
+ return item;
347
+ }
348
+ //
349
+ // FILE USAGES
350
+ //
351
+ _fileUsages = [];
352
+ registerFileUsage(dbItem) {
353
+ const item = new PFileUsage(dbItem);
354
+ this._fileUsages.push(item);
355
+ return item;
356
+ }
357
+ findFileUsage(nodePid, componentPid, slot) {
358
+ return (this._fileUsages.find((f) => f.node === nodePid && f.component === componentPid && f.slot === slot) || null);
359
+ }
360
+ findFile(id) {
361
+ return this._pfiles.find((f) => f._id === id) || null;
362
+ }
363
+ /**
364
+ * Called when a component slot changes value. Used in admin.
365
+ */
366
+ setFileSlot(_fileSlot, _id) {
367
+ return null;
368
+ }
369
+ //
370
+ // PLINKS & PVALUELINKS
371
+ //
372
+ linkPorts(eventLinks, valueLinks, showErrors) {
373
+ //
374
+ // Link event links
375
+ for (const link of eventLinks) {
376
+ const outPort = this.findOutEventPort(link);
377
+ const inPort = this.findInEventPort(link);
378
+ if (!outPort) {
379
+ if (showErrors) {
380
+ this.error("[Link Ports] out event port not found");
381
+ console.log("link: ", link);
382
+ }
383
+ continue;
384
+ }
385
+ // Update PLink in port
386
+ if (!inPort) {
387
+ if (showErrors)
388
+ this.error("[Link Ports] in event port not found");
389
+ continue;
390
+ }
391
+ // Link
392
+ outPort.link(inPort, link);
393
+ }
394
+ //
395
+ // Link value links
396
+ for (const link of valueLinks) {
397
+ const outPort = this.findOutValuePort(link);
398
+ const inPort = this.findInValuePort(link, eventLinks);
399
+ if (!outPort) {
400
+ if (showErrors)
401
+ this.error("[Link Ports] out value port not found");
402
+ console.log(link);
403
+ continue;
404
+ }
405
+ if (!inPort) {
406
+ if (showErrors)
407
+ this.error("[Link Ports] in value port not found");
408
+ continue;
409
+ }
410
+ // Link
411
+ outPort.link(inPort, link);
412
+ }
413
+ }
414
+ //
415
+ // PCOMPONENTS
416
+ //
417
+ createComponents(pnode, components) {
418
+ return components
419
+ .map((c) => this._componentFactory.component(c, pnode, this))
420
+ .filter((c) => c !== null);
421
+ }
422
+ //
423
+ // NODES
424
+ //
425
+ _nodes = [];
426
+ createPNodeTree(dbItem, dbNodes, parent) {
427
+ const pnode = new PNode(dbItem, this, this._pnodeRenderer);
428
+ pnode.updateByComponent();
429
+ this._nodes.push(pnode);
430
+ if (parent) {
431
+ parent.add(pnode);
432
+ }
433
+ const res = dbNodes.filter((n) => n.parent === dbItem.pid);
434
+ for (const childNode of res) {
435
+ this.createPNodeTree(childNode, dbNodes, pnode);
436
+ }
437
+ return pnode;
438
+ }
439
+ /**
440
+ * [CREATE NODES]
441
+ * Create root node. For project or new nodes
442
+ */
443
+ createRootNode(dbRoot, dbNodes) {
444
+ // Create root PNode
445
+ const root = this.createPNodeTree(dbRoot, dbNodes);
446
+ // root.traverse((n) => n.linkPorts());
447
+ return root;
448
+ }
449
+ findNode(id) {
450
+ return this._nodes.find((n) => n._id === id) || null;
451
+ }
452
+ findNodeByPid(pid) {
453
+ return this._nodes.find((n) => n.pid === pid) || null;
454
+ }
455
+ rerenderNode(_node) {
456
+ // Editor
457
+ }
458
+ editor_render() { }
459
+ getRoot() {
460
+ return this._root;
461
+ }
462
+ setRoot(root) {
463
+ this._root = root;
464
+ }
465
+ //
466
+ // PORTS & LINKS
467
+ //
468
+ findInEventPort(link) {
469
+ // Supports only
470
+ if (link.inPortType === PortTypes.Event) {
471
+ const pevent = this.getEventByPid(link.inPid);
472
+ if (pevent)
473
+ return pevent.inPort;
474
+ }
475
+ else if (link.inPortType === PortTypes.Variable) {
476
+ const pvariable = this.getVariableByPid(link.inPid);
477
+ if (pvariable)
478
+ return pvariable.inPort;
479
+ }
480
+ else if (link.inPortType === PortTypes.Logic) {
481
+ const plogic = this.getLogic(link.inPid);
482
+ if (plogic)
483
+ return (plogic.inEventPorts.find((p) => p.portId === link.inPortId) || null);
484
+ }
485
+ else if (link.inPortType === PortTypes.PNode) {
486
+ const pnode = this.findNodeByPid(link.inPid);
487
+ if (pnode) {
488
+ const pcomponent = pnode.findComponentByPid(link.inComponentPid);
489
+ if (pcomponent)
490
+ return (pcomponent.inEventPorts.find((p) => p.portId === link.inPortId) ||
491
+ null);
492
+ }
493
+ }
494
+ return null;
495
+ }
496
+ findOutEventPort(link) {
497
+ // Supports only
498
+ if (link.outPortType === PortTypes.Event) {
499
+ const pevent = this.getEventByPid(link.outPid);
500
+ if (pevent)
501
+ return pevent.outPort;
502
+ }
503
+ else if (link.outPortType === PortTypes.Variable) {
504
+ const pvariable = this.getVariableByPid(link.outPid);
505
+ if (pvariable)
506
+ return pvariable.outPort;
507
+ }
508
+ else if (link.outPortType === PortTypes.Logic) {
509
+ const plogic = this.getLogic(link.outPid);
510
+ if (plogic)
511
+ return (plogic.outEventPorts.find((p) => p.portId === link.outPortId) || null);
512
+ }
513
+ else if (link.outPortType === PortTypes.PNode) {
514
+ const pnode = this.findNodeByPid(link.outPid);
515
+ if (pnode) {
516
+ const pcomponent = pnode.findComponentByPid(link.outComponentPid);
517
+ if (pcomponent)
518
+ return (pcomponent.outEventPorts.find((p) => p.portId === link.outPortId) ||
519
+ null);
520
+ }
521
+ }
522
+ return null;
523
+ }
524
+ findInValuePort(link, eventLinks) {
525
+ // Supports only
526
+ if (link.inPortType === PortTypes.PNode) {
527
+ const pnode = this.findNodeByPid(link.inPid);
528
+ if (pnode) {
529
+ const pcomponent = pnode.findComponentByPid(link.inComponentPid);
530
+ if (pcomponent) {
531
+ return (pcomponent.inValuePorts.find((v) => v.portId === link.inPortId) ||
532
+ null);
533
+ }
534
+ }
535
+ }
536
+ else if (link.inPortType === PortTypes.EventLink) {
537
+ const plink = eventLinks.find((l) => l.pid === link.inPid);
538
+ return plink?.inValuePort || null;
539
+ }
540
+ else if (link.inPortType === PortTypes.Logic) {
541
+ const plogic = this.getLogic(link.inPid);
542
+ if (plogic)
543
+ return (plogic.inValuePorts.find((p) => p.portId === link.inPortId) || null);
544
+ }
545
+ else {
546
+ console.error("Unsupported valuePortType", link);
547
+ }
548
+ return null;
549
+ }
550
+ findOutValuePort(link) {
551
+ // Supports only
552
+ if (link.outPortType === PortTypes.PNode) {
553
+ const pnode = this.findNodeByPid(link.outPid);
554
+ if (pnode) {
555
+ const pcomponent = pnode.findComponentByPid(link.outComponentPid);
556
+ if (pcomponent) {
557
+ return (pcomponent.outValuePorts.find((v) => v.portId === link.outPortId) ||
558
+ null);
559
+ }
560
+ }
561
+ }
562
+ else if (link.outPortType === PortTypes.Variable) {
563
+ const pvariable = this.getVariableByPid(link.outPid);
564
+ if (pvariable)
565
+ return pvariable.outValue;
566
+ }
567
+ else if (link.outPortType === PortTypes.Logic) {
568
+ const plogic = this.getLogic(link.outPid);
569
+ if (plogic)
570
+ return (plogic.outValuePorts.find((p) => p.portId === link.outPortId) || null);
571
+ }
572
+ else if (link.outPortType === PortTypes.Value) {
573
+ const pvalue = this.getValue(link.outPid);
574
+ if (pvalue)
575
+ return (pvalue.outValuePorts.find((p) => p.portId === link.outPortId) || null);
576
+ }
577
+ else {
578
+ console.error("Unsupported valuePortType", link);
579
+ }
580
+ return null;
581
+ }
582
+ //
583
+ // VALUES
584
+ //
585
+ _values = [];
586
+ registerValue(dbItem) {
587
+ const pvalue = new PValue(dbItem);
588
+ this._values.push(pvalue);
589
+ return pvalue;
590
+ }
591
+ getValue(pid) {
592
+ return this._values.find((s) => s.pid === pid) || null;
593
+ }
594
+ setValueVersions() {
595
+ for (const value of this._values) {
596
+ value.language = this._language;
597
+ value.platform = this._platform;
598
+ }
599
+ }
600
+ //
601
+ // LOGICS
602
+ //
603
+ _logics = [];
604
+ registerLogic(dbItem) {
605
+ let plogic;
606
+ if (dbItem.logicType === LogicTypes.And)
607
+ plogic = new PLAnd(dbItem);
608
+ else if (dbItem.logicType === LogicTypes.Or)
609
+ plogic = new PLOr(dbItem);
610
+ else if (dbItem.logicType === LogicTypes.Equals)
611
+ plogic = new PLEquals(dbItem);
612
+ else if (dbItem.logicType === LogicTypes.Compare)
613
+ plogic = new PLCompare(dbItem);
614
+ else
615
+ throw new Error("Invalid plogic " + dbItem.logicType);
616
+ this._logics.push(plogic);
617
+ return plogic;
618
+ }
619
+ getLogic(pid) {
620
+ return this._logics.find((s) => s.pid === pid) || null;
621
+ }
622
+ //
623
+ // SCENES
624
+ //
625
+ _loadedScenePids = [];
626
+ _scenes = [];
627
+ registerScene = (dbScene) => {
628
+ const pscene = new PScene(dbScene);
629
+ this._scenes.push(pscene);
630
+ return pscene;
631
+ };
632
+ getScene(pid) {
633
+ return this._scenes.find((s) => s.pid === pid) || null;
634
+ }
635
+ isSceneLoaded(scenePid) {
636
+ return this._loadedScenePids.includes(scenePid);
637
+ }
638
+ getSceneRoot(pid) {
639
+ return (this._nodes.find((s) => s.parentPid === 0 && s.scenePid === pid) || null);
640
+ }
641
+ async loadScene(scenePid, loader, loadAssets, onLoadedEvent = null) {
642
+ const root = this.getSceneRoot(scenePid);
643
+ const pscene = this.getScene(scenePid);
644
+ if (!pscene || !root || !root.scenePid)
645
+ throw new Error("Scene not found");
646
+ if (pscene.isLoaded)
647
+ throw new Error("Scene was already loaded");
648
+ pscene.isLoaded = true;
649
+ this.increaseSceneLoader();
650
+ this._loadedScenePids.push(root.scenePid);
651
+ loader.add(root);
652
+ root.enable();
653
+ root.initialHideCheck();
654
+ this._owner.onLoadScene(root);
655
+ if (this.isRunning()) {
656
+ root.play();
657
+ }
658
+ if (loadAssets) {
659
+ await this._assetLoader?.loadAsync();
660
+ }
661
+ if (onLoadedEvent !== null)
662
+ onLoadedEvent.emit(root._id);
663
+ if (this.isRunning()) {
664
+ const pscene = root.findComponent("PSceneRoot");
665
+ pscene.outport_onSceneLoaded?.emit(root._id);
666
+ }
667
+ this.decreaseSceneLoader();
668
+ }
669
+ __unloadScene(pscene, root) {
670
+ if (!pscene.isLoaded)
671
+ throw new Error("Scene was not loaded");
672
+ pscene.isLoaded = false;
673
+ if (this.isRunning()) {
674
+ root.stop();
675
+ }
676
+ this._loadedScenePids = this._loadedScenePids.filter((id) => id !== root.scenePid);
677
+ this._owner.onUnloadScene(root);
678
+ root.disable();
679
+ root.removeFromParent();
680
+ }
681
+ unloadScene(pscene) {
682
+ const root = this.getSceneRoot(pscene.pid);
683
+ this.__unloadScene(pscene, root);
684
+ }
685
+ unloadSceneNode(root) {
686
+ const pscene = this.getScene(root.scenePid);
687
+ this.__unloadScene(pscene, root);
688
+ }
689
+ //
690
+ // LAYERS
691
+ //
692
+ _mask = 1;
693
+ mask = () => {
694
+ return this._mask;
695
+ };
696
+ /**
697
+ * Camera layer changed
698
+ */
699
+ setLayers(mask, updateNodes) {
700
+ this._mask = mask;
701
+ // Loop through nodes and update visiblity
702
+ if (updateNodes && this._root) {
703
+ // Need to force update children since layer affects all
704
+ this._root.updateVisibility(true);
705
+ }
706
+ }
707
+ //
708
+ // COORDINATE SYSTEM
709
+ //
710
+ _coordinates = Coordinates.LeftHanded;
711
+ setCoordinates(coordinates) {
712
+ this._coordinates = coordinates;
713
+ }
714
+ /**
715
+ * Return coordinats of the selected engine
716
+ */
717
+ getEngineCoordinates() {
718
+ return this._engine.getCoordinates();
719
+ }
720
+ getCoordinates() {
721
+ return this._coordinates;
722
+ }
723
+ isInverted() {
724
+ return this._engine.getCoordinates() !== this._coordinates;
725
+ }
726
+ //
727
+ // PLATFORM
728
+ //
729
+ _platform = Platform.Threejs;
730
+ setPlatform(platform) {
731
+ this._platform = platform;
732
+ }
733
+ platform() {
734
+ return this._platform;
735
+ }
736
+ //
737
+ // LANGUAGES
738
+ //
739
+ _language = Language.English;
740
+ setLanguage(language) {
741
+ this._language = language;
742
+ }
743
+ language() {
744
+ return this._language;
745
+ }
746
+ //
747
+ // RUNNING
748
+ //
749
+ isRunning() {
750
+ return this._running;
751
+ }
752
+ //
753
+ // CAMERA
754
+ //
755
+ setCameraControlSettings(cameraSettings) {
756
+ const cameraControls = this._engine.setupCameraControls(this, cameraSettings);
757
+ this._pcanvas.setCameraControls(cameraControls);
758
+ return cameraControls;
759
+ }
760
+ getCameraControls() {
761
+ return this._pcanvas?.getCameraControls() || null;
762
+ }
763
+ //
764
+ // AUDIO
765
+ //
766
+ async setupAudioListener() {
767
+ if (this._audioListener === null) {
768
+ this._audioListener = await this._engine.setupAudioListener();
769
+ }
770
+ }
771
+ getAudioListener() {
772
+ return this._audioListener;
773
+ }
774
+ //
775
+ // INTERACTION
776
+ //
777
+ _inputEnabled = false;
778
+ enableInput() {
779
+ if (this._inputEnabled || !this._pcanvas)
780
+ return;
781
+ this._inputEnabled = true;
782
+ this._pcanvas.getCameraControls()?.enable();
783
+ this._pcanvas.enableRaycaster();
784
+ }
785
+ disableInput() {
786
+ if (!this._inputEnabled || !this._pcanvas)
787
+ return;
788
+ this._inputEnabled = false;
789
+ this._pcanvas.getCameraControls()?.disable();
790
+ this._pcanvas.disableRaycaster();
791
+ }
792
+ isInputEnabled() {
793
+ return this._inputEnabled;
794
+ }
795
+ //
796
+ // TWEENS
797
+ //
798
+ addTween(tween) {
799
+ this._pcanvas?.addTween(tween);
800
+ }
801
+ //
802
+ // NOTIFICATIONS
803
+ //
804
+ error(msg, details) {
805
+ this._owner.error(msg, details);
806
+ }
807
+ msg(msg, details) {
808
+ this._owner.msg(msg, details);
809
+ }
810
+ catch(error) {
811
+ this._owner.catch(error);
812
+ }
813
+ }
814
+ //# sourceMappingURL=GameContext.js.map