@divinevoxel/vlox 0.0.72 → 0.0.74

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 (307) hide show
  1. package/Contexts/Base/Remote/InitDataSync.js +4 -0
  2. package/Contexts/Base/Remote/InitWorldDataSync.js +1 -1
  3. package/Contexts/Render/DivineVoxelEngineRender.d.ts +2 -1
  4. package/Contexts/World/DivineVoxelEngineWorld.d.ts +2 -1
  5. package/Init/StartConstructor.js +8 -4
  6. package/Init/StartWorld.d.ts +1 -1
  7. package/Math/index.d.ts +5 -1
  8. package/Mesher/Functions/CompactVoxelMesh.d.ts +2 -2
  9. package/Mesher/Functions/CompactVoxelMesh.js +1 -1
  10. package/Mesher/Functions/CompactVoxelSectionMesh.d.ts +4 -0
  11. package/Mesher/Functions/CompactVoxelSectionMesh.js +112 -0
  12. package/Mesher/Functions/MeshSection.d.ts +1 -1
  13. package/Mesher/Functions/MeshSection.js +27 -22
  14. package/Mesher/Functions/MeshTexture.d.ts +1 -1
  15. package/Mesher/Functions/MeshTexture.js +3 -4
  16. package/Mesher/Geomtry/CompactedSectionVoxelMesh.d.ts +23 -0
  17. package/Mesher/Geomtry/CompactedSectionVoxelMesh.js +144 -0
  18. package/Mesher/Geomtry/Primitives/QuadVertexData.d.ts +12 -10
  19. package/Mesher/Geomtry/Primitives/QuadVertexData.js +49 -56
  20. package/Mesher/Geomtry/VoxelGeometryBuilder.d.ts +2 -2
  21. package/Mesher/Geomtry/VoxelGeometryBuilder.js +120 -199
  22. package/Mesher/Geomtry/VoxelMesh.d.ts +1 -1
  23. package/Mesher/Geomtry/VoxelMesh.js +4 -4
  24. package/Mesher/Geomtry/VoxelMeshBVHBuilder.d.ts +16 -0
  25. package/Mesher/Geomtry/VoxelMeshBVHBuilder.js +51 -0
  26. package/Mesher/Geomtry/VoxelMeshBVHStructCursor.d.ts +22 -0
  27. package/Mesher/Geomtry/VoxelMeshBVHStructCursor.js +78 -0
  28. package/Mesher/Geomtry/{Buffers.js → VoxelMeshBuffers.js} +2 -2
  29. package/Mesher/Geomtry/index.d.ts +0 -1
  30. package/Mesher/Geomtry/index.js +0 -1
  31. package/Mesher/InitMesher.js +1 -1
  32. package/Mesher/InitTask.js +9 -23
  33. package/Mesher/Models/Common/BoxGeometryNode.js +7 -7
  34. package/Mesher/Models/Common/Calc/CalcConstants.d.ts +1 -1
  35. package/Mesher/Models/Common/Calc/CalcConstants.js +1 -1
  36. package/Mesher/Models/Common/Calc/FaceDataCalc.d.ts +2 -2
  37. package/Mesher/Models/Common/Calc/FaceDataCalc.js +37 -30
  38. package/Mesher/Models/Common/QuadGeometryNode.js +2 -2
  39. package/Mesher/Models/Nodes/Custom/Liquid/FlowGradient.d.ts +2 -2
  40. package/Mesher/Models/Nodes/Custom/Liquid/FlowGradient.js +1 -1
  41. package/Mesher/Models/Nodes/Custom/Liquid/LiquidGeomtryNode.js +18 -24
  42. package/Mesher/Models/Nodes/GeometryNode.d.ts +2 -2
  43. package/Mesher/Models/Nodes/Ruled/BoxVoxelGeometryNode.d.ts +1 -0
  44. package/Mesher/Models/Nodes/Ruled/BoxVoxelGeometryNode.js +40 -31
  45. package/Mesher/Models/Nodes/Ruled/QuadVoxelGeometryNode.js +2 -2
  46. package/Mesher/Models/Nodes/Ruleless/RulelessBoxVoxelGeometryNode.js +2 -2
  47. package/Mesher/Models/Nodes/Ruleless/RulelessQuadVoxelGeometryNode.js +2 -2
  48. package/Mesher/{Tools → Models/Protocols}/OutlinedVoxelTool.d.ts +1 -1
  49. package/Mesher/{Tools → Models/Protocols}/OutlinedVoxelTool.js +1 -1
  50. package/Mesher/Models/RenderedMaterials.d.ts +6 -0
  51. package/Mesher/{RenderedMaterials.js → Models/RenderedMaterials.js} +2 -2
  52. package/Mesher/Models/VoxelConstructor.d.ts +6 -6
  53. package/Mesher/Models/VoxelConstructor.js +8 -8
  54. package/Mesher/Models/VoxelGeometryBuilderCacheSpace.d.ts +3 -5
  55. package/Mesher/Models/VoxelGeometryBuilderCacheSpace.js +8 -32
  56. package/Mesher/{Tools/VoxelMesherDataTool.d.ts → Models/VoxelModelBuilder.d.ts} +4 -5
  57. package/Mesher/{Tools/VoxelMesherDataTool.js → Models/VoxelModelBuilder.js} +5 -8
  58. package/Mesher/Types/Mesher.types.d.ts +1 -0
  59. package/Models/Defaults/CubeVoxelGeometry.js +4 -0
  60. package/Models/Defaults/CubeVoxelModels.js +360 -383
  61. package/Models/Defaults/LiquidVoxelModel.js +5 -5
  62. package/Models/Defaults/PanelVoxelModels.js +442 -468
  63. package/Models/Defaults/StairVoxelModel.js +582 -597
  64. package/Models/Examples.js +490 -498
  65. package/Models/Rules/Classes/VoxelRulesModel.d.ts +1 -1
  66. package/Models/Rules/Classes/VoxelRulesModel.js +3 -3
  67. package/Models/Rules/Functions/BuildFinalInputs.d.ts +1 -1
  68. package/Models/Rules/Functions/BuildFinalInputs.js +21 -19
  69. package/Models/Rules/Functions/BuildGeomtryInputs.js +8 -5
  70. package/Models/Rules/Functions/BuildRules.js +2 -2
  71. package/Models/Rules/{VoxelModelManager.d.ts → VoxelModelRuleBuilderRegister.d.ts} +1 -1
  72. package/Models/Rules/VoxelModelRuleBuilderRegister.js +178 -0
  73. package/Models/VoxelModel.types.d.ts +17 -8
  74. package/Renderer/Classes/DVESectionMeshes.d.ts +2 -3
  75. package/Renderer/Classes/SectorMesh.d.ts +3 -4
  76. package/Renderer/Classes/SectorMesh.js +6 -11
  77. package/Renderer/InitTasks.js +1 -10
  78. package/Renderer/MeshManager.d.ts +1 -1
  79. package/Renderer/MeshManager.js +26 -25
  80. package/Renderer/MeshRegister.d.ts +5 -5
  81. package/Renderer/MeshRegister.js +4 -3
  82. package/Settings/EngineSettings.d.ts +2 -1
  83. package/Settings/EngineSettings.js +6 -5
  84. package/Settings/EngineSettings.types.d.ts +24 -39
  85. package/Settings/EngineSettings.types.js +22 -29
  86. package/Tasks/Logic/InitTasks.d.ts +1 -0
  87. package/Tasks/Logic/InitTasks.js +10 -0
  88. package/Tasks/Logic/VoxelLogicUpdate.d.ts +3 -0
  89. package/Tasks/Logic/VoxelLogicUpdate.js +71 -0
  90. package/Tasks/Propagation/Explosion/ExplosionManager.d.ts +2 -2
  91. package/Tasks/Propagation/Explosion/ExplosionManager.js +1 -2
  92. package/Tasks/Propagation/Flow/FlowManager.d.ts +4 -4
  93. package/Tasks/Propagation/Flow/FlowRemove.d.ts +2 -2
  94. package/Tasks/Propagation/Flow/FlowUpdate.d.ts +2 -2
  95. package/Tasks/Propagation/Flow/WorldFlow.d.ts +2 -2
  96. package/Tasks/Propagation/Illumanation/RGBUpdate.d.ts +3 -3
  97. package/Tasks/Propagation/Illumanation/SunUpdate.d.ts +3 -3
  98. package/Tasks/Propagation/Illumanation/WorldRGB.d.ts +2 -2
  99. package/Tasks/Propagation/Illumanation/WorldSun.d.ts +2 -2
  100. package/Tasks/Propagation/Illumanation/WorldSun.js +8 -15
  101. package/Tasks/Propagation/InitTasks.js +4 -4
  102. package/Tasks/Propagation/Power/PowerUpdate.d.ts +3 -0
  103. package/Tasks/Propagation/Power/PowerUpdate.js +80 -0
  104. package/Tasks/Tasks.types.d.ts +2 -2
  105. package/Tasks/TasksIds.d.ts +2 -1
  106. package/Tasks/TasksIds.js +1 -0
  107. package/Tasks/Update/Common.d.ts +3 -0
  108. package/Tasks/Update/Common.js +41 -0
  109. package/Tasks/Update/EreaseUpdate.d.ts +3 -0
  110. package/Tasks/Update/EreaseUpdate.js +66 -0
  111. package/Tasks/Update/InitTasks.d.ts +2 -2
  112. package/Tasks/Update/InitTasks.js +3 -1
  113. package/Tasks/Update/PaintUpdate.d.ts +3 -0
  114. package/Tasks/Update/PaintUpdate.js +89 -0
  115. package/Tasks/Update/VoxelUpdate.d.ts +2 -5
  116. package/Tasks/Update/VoxelUpdate.js +7 -143
  117. package/Tasks/{Update/UpdateTask.d.ts → VoxelUpdateTask.d.ts} +16 -6
  118. package/Tasks/{Update/UpdateTask.js → VoxelUpdateTask.js} +44 -5
  119. package/Tasks/WorldGeneration/WorldGenBrush.d.ts +3 -3
  120. package/Tasks/WorldGeneration/WorldGenBrush.js +3 -3
  121. package/Tasks/WorldGeneration/WorldGenRegister.d.ts +1 -1
  122. package/Templates/Cursor/TemplateCursor.d.ts +2 -2
  123. package/Templates/Cursor/TemplateCursor.js +1 -2
  124. package/Templates/Functions/CreateTemplate.d.ts +1 -1
  125. package/Templates/VoxelTemplates.types.d.ts +1 -1
  126. package/Textures/Classes/CompiledTexture.d.ts +18 -0
  127. package/Textures/Classes/CompiledTexture.js +50 -0
  128. package/Textures/Classes/CompiledTextureAnimation.d.ts +12 -0
  129. package/Textures/Classes/CompiledTextureAnimation.js +27 -0
  130. package/Textures/Classes/TextureAnimationTexture.d.ts +10 -0
  131. package/Textures/Classes/TextureAnimationTexture.js +32 -0
  132. package/Textures/Functions/BuildTextureData.d.ts +10 -0
  133. package/Textures/Functions/BuildTextureData.js +205 -0
  134. package/Textures/Texture.types.d.ts +50 -64
  135. package/Textures/TextureManager.d.ts +8 -19
  136. package/Textures/TextureManager.js +28 -166
  137. package/Tools/Brush/AdvancedBrushTool.js +1 -1
  138. package/Tools/Brush/Brush.d.ts +3 -3
  139. package/Tools/Brush/Brush.js +40 -8
  140. package/Tools/Tasks/TasksTool.d.ts +1 -0
  141. package/Tools/Tasks/TasksTool.js +2 -0
  142. package/Util/Binary/BinaryArrays.d.ts +6 -0
  143. package/Util/Binary/BinaryArrays.js +25 -0
  144. package/Util/Binary/BinaryBuffer.d.ts +35 -0
  145. package/Util/Binary/BinaryBuffer.js +136 -0
  146. package/Util/Binary/{BitArray.d.ts → BinaryFunctions.d.ts} +1 -2
  147. package/Util/Binary/BinaryFunctions.js +11 -0
  148. package/{Mesher/Tools/VoxelMeshBVHBuilder.d.ts → Util/Binary/BinaryTree.d.ts} +1 -33
  149. package/Util/Binary/BinaryTree.js +104 -0
  150. package/Voxels/Cursor/DataCursor.interface.d.ts +5 -0
  151. package/Voxels/Cursor/VoxelCursor.interface.d.ts +8 -3
  152. package/Voxels/Cursor/VoxelCursor.interface.js +54 -13
  153. package/Voxels/Cursor/VoxelLightData.js +1 -1
  154. package/Voxels/Data/VoxelPalettesRegister.d.ts +0 -5
  155. package/Voxels/Data/VoxelPalettesRegister.js +0 -9
  156. package/Voxels/Data/VoxelTag.types.d.ts +17 -2
  157. package/Voxels/Data/VoxelTag.types.js +6 -1
  158. package/Voxels/Data/VoxelTagsRegister.js +12 -7
  159. package/Voxels/Functions/BuildStateData.d.ts +6 -6
  160. package/Voxels/Functions/BuildStateData.js +37 -37
  161. package/Voxels/Functions/BuildTagAndPaletteData.js +6 -3
  162. package/Voxels/Indexes/VoxelIndex.d.ts +2 -2
  163. package/Voxels/Indexes/VoxelIndex.js +16 -18
  164. package/Voxels/InitVoxelData.js +24 -21
  165. package/Voxels/Logic/Classes/Default/Types/VoxelPoweredLogicType.d.ts +5 -0
  166. package/Voxels/Logic/Classes/Default/Types/VoxelPoweredLogicType.js +6 -0
  167. package/Voxels/Logic/Classes/VoxelLogic.d.ts +11 -0
  168. package/Voxels/Logic/Classes/VoxelLogic.js +49 -0
  169. package/Voxels/Logic/Classes/VoxelLogicType.d.ts +4 -0
  170. package/Voxels/Logic/Classes/VoxelLogicType.js +2 -0
  171. package/Voxels/Logic/VoxelLogic.types.d.ts +23 -0
  172. package/Voxels/Logic/VoxelLogic.types.js +1 -0
  173. package/Voxels/Logic/VoxelLogicRegister.d.ts +9 -0
  174. package/Voxels/Logic/VoxelLogicRegister.js +15 -0
  175. package/Voxels/State/Schema/StateSchema.d.ts +1 -1
  176. package/Voxels/State/SchemaRegister.js +10 -5
  177. package/Voxels/State/State.types.d.ts +1 -1
  178. package/Voxels/State/StateTreeReader.d.ts +1 -1
  179. package/Voxels/State/StateTreeReader.js +2 -3
  180. package/Voxels/Types/Voxel.types.d.ts +21 -0
  181. package/Voxels/Types/Voxel.types.js +6 -2
  182. package/Voxels/Types/VoxelModelCompiledData.types.d.ts +6 -4
  183. package/World/Archive/Archive.types.d.ts +65 -42
  184. package/World/Archive/Classes/ArchiveClasses.d.ts +66 -0
  185. package/World/Archive/Classes/ArchiveClasses.js +78 -0
  186. package/World/Archive/Classes/ImportedSection.d.ts +40 -0
  187. package/World/Archive/Classes/ImportedSection.js +307 -0
  188. package/World/Archive/Classes/ImportedSector.d.ts +23 -0
  189. package/World/Archive/Classes/ImportedSector.js +97 -0
  190. package/World/Archive/Functions/ArchiveArea.d.ts +1 -1
  191. package/World/Archive/Functions/ArchiveArea.js +49 -54
  192. package/World/Archive/Functions/ArchiveSector.js +373 -282
  193. package/World/Archive/Functions/CreateArchivedSection.d.ts +3 -0
  194. package/World/Archive/Functions/CreateArchivedSection.js +207 -0
  195. package/World/Archive/Functions/ImportSector.d.ts +2 -4
  196. package/World/Archive/Functions/ImportSector.js +50 -220
  197. package/World/Archive/Functions/RemoveDuplicates.d.ts +3 -0
  198. package/World/Archive/Functions/RemoveDuplicates.js +92 -0
  199. package/World/Archive/Functions/Shared.d.ts +6 -0
  200. package/World/Archive/Functions/Shared.js +50 -0
  201. package/World/Archive/InitTasks.js +37 -23
  202. package/World/Cursor/SectionCursor.d.ts +3 -3
  203. package/World/Cursor/SectionCursor.js +2 -3
  204. package/World/Cursor/SectorCursor.d.ts +3 -3
  205. package/World/Cursor/SectorCursor.js +1 -2
  206. package/World/Cursor/WorldCursor.d.ts +6 -5
  207. package/World/Cursor/WorldCursor.js +17 -15
  208. package/World/Cursor/WorldVoxelCursor.d.ts +0 -4
  209. package/World/Cursor/WorldVoxelCursor.js +24 -14
  210. package/World/Dimension/Dimension.d.ts +4 -1
  211. package/World/Dimension/Dimension.js +8 -1
  212. package/World/InitTasks.d.ts +1 -1
  213. package/World/Lock/WorldLock.d.ts +1 -1
  214. package/World/Section/Section.d.ts +27 -18
  215. package/World/Section/Section.js +125 -21
  216. package/World/Section/SectionState.d.ts +12 -0
  217. package/World/Section/SectionState.js +13 -0
  218. package/World/Sector/Sector.d.ts +20 -6
  219. package/World/Sector/Sector.js +100 -17
  220. package/World/Sector/SectorHeightMap.js +2 -2
  221. package/World/Sector/SectorState.d.ts +16 -7
  222. package/World/Sector/SectorState.js +29 -15
  223. package/World/Types/WorldData.types.d.ts +2 -7
  224. package/World/Types/WorldStorage.interface.js +1 -0
  225. package/World/WorldRegister.d.ts +13 -9
  226. package/World/WorldRegister.js +24 -9
  227. package/World/WorldSpaces.d.ts +4 -0
  228. package/World/WorldSpaces.js +25 -12
  229. package/{Tasks/IWG → WorldSimulation}/Internal/Classes/DimensionSegment.d.ts +2 -2
  230. package/{Tasks/IWG → WorldSimulation}/Internal/Classes/Generator.d.ts +10 -3
  231. package/{Tasks/IWG → WorldSimulation}/Internal/Classes/Generator.js +19 -3
  232. package/WorldSimulation/Internal/Classes/Queues/BuildQueue.d.ts +5 -0
  233. package/WorldSimulation/Internal/Classes/Queues/BuildQueue.js +6 -0
  234. package/WorldSimulation/Internal/Classes/Queues/LogiccQueue.d.ts +5 -0
  235. package/WorldSimulation/Internal/Classes/Queues/LogiccQueue.js +6 -0
  236. package/{Tasks/IWG → WorldSimulation}/Internal/Classes/SectorVisistedMap.js +1 -1
  237. package/WorldSimulation/Internal/Classes/TickQueue.d.ts +12 -0
  238. package/WorldSimulation/Internal/Classes/TickQueue.js +58 -0
  239. package/WorldSimulation/Internal/Classes/WorldSimulationTaskBase.d.ts +15 -0
  240. package/{Tasks/IWG/Internal/Classes/IWGTaskBase.js → WorldSimulation/Internal/Classes/WorldSimulationTaskBase.js} +8 -8
  241. package/{Tasks/IWG → WorldSimulation}/Internal/Functions/cullSectors.js +9 -9
  242. package/{Tasks/IWG → WorldSimulation}/Internal/Functions/getSectorState.d.ts +1 -1
  243. package/{Tasks/IWG → WorldSimulation}/Internal/Functions/getSectorState.js +4 -4
  244. package/WorldSimulation/Internal/Functions/runTickUpdate.d.ts +2 -0
  245. package/{Tasks/IWG/Internal/Functions/runBuildUpdate.js → WorldSimulation/Internal/Functions/runTickUpdate.js} +38 -9
  246. package/{Tasks/IWG → WorldSimulation}/Internal/Functions/runWorldUpdate.js +13 -13
  247. package/{Tasks/IWG → WorldSimulation}/Internal/TaskRegister.d.ts +2 -2
  248. package/{Tasks/IWG → WorldSimulation}/Internal/TaskRegister.js +1 -1
  249. package/WorldSimulation/Internal/WorldSimulationDimensions.d.ts +6 -0
  250. package/{Tasks/IWG/Internal/IWGDimensions.js → WorldSimulation/Internal/WorldSimulationDimensions.js} +1 -1
  251. package/WorldSimulation/Internal/WorldSimulationTasks.d.ts +30 -0
  252. package/{Tasks/IWG/Internal/IWGTasks.js → WorldSimulation/Internal/WorldSimulationTasks.js} +14 -24
  253. package/WorldSimulation/Internal/WorldSimulationTools.d.ts +8 -0
  254. package/{Tasks/IWG/Internal/IWGTools.js → WorldSimulation/Internal/WorldSimulationTools.js} +1 -1
  255. package/{Tasks/IWG → WorldSimulation}/Procedures/InitalLoad.d.ts +1 -1
  256. package/{Tasks/IWG → WorldSimulation}/Procedures/InitalLoad.js +11 -11
  257. package/{Tasks/IWG → WorldSimulation}/Procedures/SaveAllSectors.js +7 -5
  258. package/{Tasks/IWG/IWG.d.ts → WorldSimulation/WorldSimulation.d.ts} +6 -5
  259. package/{Tasks/IWG/IWG.js → WorldSimulation/WorldSimulation.js} +29 -23
  260. package/{Tasks/IWG → WorldSimulation}/index.d.ts +1 -1
  261. package/{Tasks/IWG → WorldSimulation}/index.js +1 -1
  262. package/package.json +1 -1
  263. package/Mesher/Functions/CompactMesh.d.ts +0 -2
  264. package/Mesher/Functions/CompactMesh.js +0 -42
  265. package/Mesher/Geomtry/GeometryNormals.d.ts +0 -10
  266. package/Mesher/Geomtry/GeometryNormals.js +0 -52
  267. package/Mesher/Geomtry/MeshData.types.d.ts +0 -13
  268. package/Mesher/Geomtry/MeshData.types.js +0 -6
  269. package/Mesher/Geomtry/Tools/MesherDataTools.d.ts +0 -7
  270. package/Mesher/Geomtry/Tools/MesherDataTools.js +0 -12
  271. package/Mesher/Geomtry/Tools/index.d.ts +0 -1
  272. package/Mesher/Geomtry/Tools/index.js +0 -1
  273. package/Mesher/RenderedMaterials.d.ts +0 -6
  274. package/Mesher/Tools/VoxelMeshBVHBuilder.js +0 -216
  275. package/Models/Rules/VoxelModelManager.js +0 -82
  276. package/Tasks/IWG/Internal/Classes/IWGTaskBase.d.ts +0 -15
  277. package/Tasks/IWG/Internal/Functions/runBuildUpdate.d.ts +0 -2
  278. package/Tasks/IWG/Internal/IWGDimensions.d.ts +0 -6
  279. package/Tasks/IWG/Internal/IWGTasks.d.ts +0 -34
  280. package/Tasks/IWG/Internal/IWGTools.d.ts +0 -8
  281. package/Textures/TextureAnimations.d.ts +0 -4
  282. package/Textures/TextureAnimations.js +0 -35
  283. package/Textures/TextureArray.d.ts +0 -47
  284. package/Textures/TextureArray.js +0 -202
  285. package/Textures/TextureBuilder.d.ts +0 -13
  286. package/Textures/TextureBuilder.js +0 -120
  287. package/Textures/TextureRegister.d.ts +0 -9
  288. package/Textures/TextureRegister.js +0 -28
  289. package/Tools/DataCursor.interface.d.ts +0 -5
  290. package/Tools/DataCursor.interface.js +0 -2
  291. package/Util/Binary/BitArray.js +0 -16
  292. package/World/Structs/WorldDataStructProperties.d.ts +0 -8
  293. package/World/Structs/WorldDataStructProperties.js +0 -9
  294. /package/Mesher/Geomtry/{Buffers.d.ts → VoxelMeshBuffers.d.ts} +0 -0
  295. /package/Mesher/{Tools → Geomtry}/VoxelMeshVertexStructCursor.d.ts +0 -0
  296. /package/Mesher/{Tools → Geomtry}/VoxelMeshVertexStructCursor.js +0 -0
  297. /package/Mesher/{VoxelShaderData.d.ts → Geomtry/VoxelShaderData.d.ts} +0 -0
  298. /package/Mesher/{VoxelShaderData.js → Geomtry/VoxelShaderData.js} +0 -0
  299. /package/{World/Storage/WorldStorage.interface.js → Voxels/Cursor/DataCursor.interface.js} +0 -0
  300. /package/World/{Storage → Types}/WorldStorage.interface.d.ts +0 -0
  301. /package/{Tasks/IWG → WorldSimulation}/Internal/Classes/DimensionSegment.js +0 -0
  302. /package/{Tasks/IWG → WorldSimulation}/Internal/Classes/SectorState.d.ts +0 -0
  303. /package/{Tasks/IWG → WorldSimulation}/Internal/Classes/SectorState.js +0 -0
  304. /package/{Tasks/IWG → WorldSimulation}/Internal/Classes/SectorVisistedMap.d.ts +0 -0
  305. /package/{Tasks/IWG → WorldSimulation}/Internal/Functions/cullSectors.d.ts +0 -0
  306. /package/{Tasks/IWG → WorldSimulation}/Internal/Functions/runWorldUpdate.d.ts +0 -0
  307. /package/{Tasks/IWG → WorldSimulation}/Procedures/SaveAllSectors.d.ts +0 -0
@@ -0,0 +1,12 @@
1
+ export declare enum SectionStateDefaultFlags {
2
+ displayDirty = 0,
3
+ logicDirty = 1,
4
+ inProgress = 2,
5
+ logicUpdateInProgress = 3
6
+ }
7
+ export declare class SectionState {
8
+ /**The default bit flags for sections */
9
+ static Flags: typeof SectionStateDefaultFlags;
10
+ /**A record of bit flags tht are preserved when the section is stored */
11
+ static StoredFlags: Record<string, number>;
12
+ }
@@ -0,0 +1,13 @@
1
+ export var SectionStateDefaultFlags;
2
+ (function (SectionStateDefaultFlags) {
3
+ SectionStateDefaultFlags[SectionStateDefaultFlags["displayDirty"] = 0] = "displayDirty";
4
+ SectionStateDefaultFlags[SectionStateDefaultFlags["logicDirty"] = 1] = "logicDirty";
5
+ SectionStateDefaultFlags[SectionStateDefaultFlags["inProgress"] = 2] = "inProgress";
6
+ SectionStateDefaultFlags[SectionStateDefaultFlags["logicUpdateInProgress"] = 3] = "logicUpdateInProgress";
7
+ })(SectionStateDefaultFlags || (SectionStateDefaultFlags = {}));
8
+ export class SectionState {
9
+ /**The default bit flags for sections */
10
+ static Flags = SectionStateDefaultFlags;
11
+ /**A record of bit flags tht are preserved when the section is stored */
12
+ static StoredFlags = {};
13
+ }
@@ -1,8 +1,7 @@
1
1
  import { Section, SectionData } from "../Section/Section.js";
2
2
  import { Vec3Array } from "@amodx/math";
3
- import { SectorStateFlags, SectorTimestampFlags } from "./SectorState.js";
3
+ import { SectorStateDefaultBitFlags } from "./SectorState.js";
4
4
  export interface SectorData {
5
- position: Vec3Array;
6
5
  buffer: ArrayBufferLike;
7
6
  /**Array of timestamps for the sector */
8
7
  timeStampArray: Uint32Array;
@@ -13,18 +12,33 @@ export interface SectorData {
13
12
  export interface Sector extends SectorData {
14
13
  }
15
14
  export declare class Sector {
16
- static FlagIds: typeof SectorStateFlags;
17
- static TimeStampIds: typeof SectorTimestampFlags;
15
+ position: Vec3Array;
16
+ static FlagIds: typeof SectorStateDefaultBitFlags;
17
+ static TimeStampIds: typeof import("./SectorState.js").SectorStateDefaultTimeStamps;
18
18
  static GetHeaderSize(): number;
19
19
  static GetBufferSize(): number;
20
20
  static CreateNew(): SectorData;
21
21
  sections: Section[];
22
22
  bufferView: Uint8Array;
23
- constructor(data: SectorData);
24
- getSection(y: number): Section;
23
+ constructor(data: SectorData, position: Vec3Array);
24
+ getSection(x: number, y: number, z: number): Section;
25
25
  setBitFlag(index: number, value: boolean): void;
26
26
  getBitFlag(index: number): boolean;
27
+ isDisplayDirty(): boolean;
28
+ setDisplayDirty(stored: boolean): void;
29
+ isLogicDirty(): boolean;
30
+ setLogicDirty(stored: boolean): void;
31
+ setStored(stored: boolean): void;
32
+ isStored(): boolean;
27
33
  setTimeStamp(index: number, value: number): void;
28
34
  getTimeStamp(index: number): number;
35
+ getRenerableSections(): Generator<Section>;
36
+ getLogicDirtySections(): Generator<Section>;
37
+ anySectionDisplayDirty(): boolean;
38
+ anySectionLogicDirty(): boolean;
39
+ storeFlags(): Record<string, boolean>;
40
+ loadFlags(flags: Record<string, boolean>): void;
41
+ storeTimestamps(): Record<string, number>;
42
+ loadTimestamps(stored: Record<string, number>): void;
29
43
  toJSON(): SectorData;
30
44
  }
@@ -1,13 +1,12 @@
1
1
  import { Section } from "../Section/Section.js";
2
2
  import { WorldSpaces } from "../WorldSpaces";
3
- import { getBitArrayIndex, setBitArrayIndex, } from "../../Util/Binary/BitArray.js";
4
- import { SectorStateFlags, SectorTimestampFlags } from "./SectorState.js";
5
- function forceMultipleOf2(n) {
6
- return n % 2 === 0 ? n : n + 1;
7
- }
3
+ import { getBitArrayIndex, setBitArrayIndex, } from "../../Util/Binary/BinaryArrays.js";
4
+ import { SectorState, SectorStateDefaultBitFlags } from "./SectorState.js";
5
+ import { forceMultipleOf2 } from "../../Util/Binary/BinaryFunctions.js";
8
6
  export class Sector {
9
- static FlagIds = SectorStateFlags;
10
- static TimeStampIds = SectorTimestampFlags;
7
+ position;
8
+ static FlagIds = SectorState.Flags;
9
+ static TimeStampIds = SectorState.TimeStamps;
11
10
  static GetHeaderSize() {
12
11
  return forceMultipleOf2(
13
12
  //12 bytes fot flags
@@ -22,14 +21,13 @@ export class Sector {
22
21
  static CreateNew() {
23
22
  const buffer = new SharedArrayBuffer(this.GetBufferSize());
24
23
  const flagArray = new Uint8Array(buffer, 0, 12);
25
- const timeStampArray = new Uint32Array(buffer, 12, 12 * 4);
24
+ const timeStampArray = new Uint32Array(buffer, 12, 12);
26
25
  const sections = [];
27
- const totalSections = WorldSpaces.sector.bounds.y / WorldSpaces.section.bounds.y;
26
+ const totalSections = WorldSpaces.sector.sectionVolumne;
28
27
  for (let i = 0; i < totalSections; i++) {
29
28
  sections[i] = Section.CreateNew(i, buffer);
30
29
  }
31
30
  return {
32
- position: [0, 0, 0],
33
31
  buffer,
34
32
  flagArray,
35
33
  timeStampArray,
@@ -38,8 +36,8 @@ export class Sector {
38
36
  }
39
37
  sections = [];
40
38
  bufferView;
41
- constructor(data) {
42
- this.position = data.position;
39
+ constructor(data, position) {
40
+ this.position = position;
43
41
  this.flagArray = data.flagArray;
44
42
  this.timeStampArray = data.timeStampArray;
45
43
  this.buffer = data.buffer;
@@ -48,10 +46,8 @@ export class Sector {
48
46
  this.sections[i] = new Section(this, i, data.sections[i]);
49
47
  }
50
48
  }
51
- getSection(y) {
52
- const ry = y - this.position[1];
53
- const index = ry / WorldSpaces.section.bounds.y;
54
- return this.sections[index];
49
+ getSection(x, y, z) {
50
+ return this.sections[WorldSpaces.section.getIndex(x, y, z)];
55
51
  }
56
52
  setBitFlag(index, value) {
57
53
  setBitArrayIndex(this.flagArray, index, value ? 1 : 0);
@@ -59,19 +55,106 @@ export class Sector {
59
55
  getBitFlag(index) {
60
56
  return getBitArrayIndex(this.flagArray, index) == 1;
61
57
  }
58
+ isDisplayDirty() {
59
+ return this.getBitFlag(SectorStateDefaultBitFlags.displayDirty);
60
+ }
61
+ setDisplayDirty(stored) {
62
+ this.setBitFlag(SectorStateDefaultBitFlags.displayDirty, stored);
63
+ }
64
+ isLogicDirty() {
65
+ return this.getBitFlag(SectorStateDefaultBitFlags.logicDirty);
66
+ }
67
+ setLogicDirty(stored) {
68
+ this.setBitFlag(SectorStateDefaultBitFlags.logicDirty, stored);
69
+ }
70
+ setStored(stored) {
71
+ this.setBitFlag(SectorStateDefaultBitFlags.stored, stored);
72
+ }
73
+ isStored() {
74
+ return this.getBitFlag(SectorStateDefaultBitFlags.stored);
75
+ }
62
76
  setTimeStamp(index, value) {
63
77
  this.timeStampArray[index] = value;
64
78
  }
65
79
  getTimeStamp(index) {
66
80
  return this.timeStampArray[index];
67
81
  }
82
+ *getRenerableSections() {
83
+ for (const section of this.sections) {
84
+ const [min, max] = section.getMinMax();
85
+ if (min == Infinity || max == -Infinity)
86
+ continue;
87
+ yield section;
88
+ }
89
+ }
90
+ *getLogicDirtySections() {
91
+ for (const section of this.sections) {
92
+ const [min, max] = section.getLogicMinMax();
93
+ if (min == Infinity || max == -Infinity)
94
+ continue;
95
+ yield section;
96
+ }
97
+ }
98
+ anySectionDisplayDirty() {
99
+ if (!this.isDisplayDirty())
100
+ return false;
101
+ for (let i = 0; i < this.sections.length; i++) {
102
+ if (this.sections[i].isDisplayDirty() && !this.sections[i].isInProgress())
103
+ return true;
104
+ }
105
+ this.setDisplayDirty(false);
106
+ return false;
107
+ }
108
+ anySectionLogicDirty() {
109
+ if (!this.isLogicDirty())
110
+ return false;
111
+ for (let i = 0; i < this.sections.length; i++) {
112
+ if (this.sections[i].isLogicDirty() && !this.sections[i].isLogicUpdateInProgress())
113
+ return true;
114
+ }
115
+ this.setLogicDirty(false);
116
+ return false;
117
+ }
118
+ storeFlags() {
119
+ const stored = {};
120
+ for (const key in SectorState.StoredFlags) {
121
+ stored[key] = this.getBitFlag(SectorState.StoredFlags[key]);
122
+ }
123
+ return stored;
124
+ }
125
+ loadFlags(flags) {
126
+ for (const flag in flags) {
127
+ const storedIndex = SectorState.StoredFlags[flag];
128
+ if (storedIndex === undefined) {
129
+ console.warn(`${flag} does not exist on stored flags for sector`);
130
+ continue;
131
+ }
132
+ this.setBitFlag(storedIndex, flags[flag]);
133
+ }
134
+ }
135
+ storeTimestamps() {
136
+ const stored = {};
137
+ for (const key in SectorState.StoredTimeStamps) {
138
+ stored[key] = this.getTimeStamp(SectorState.StoredTimeStamps[key]);
139
+ }
140
+ return stored;
141
+ }
142
+ loadTimestamps(stored) {
143
+ for (const timeStamp in stored) {
144
+ const storedIndex = SectorState.StoredTimeStamps[timeStamp];
145
+ if (storedIndex === undefined) {
146
+ console.warn(`${timeStamp} does not exist on stored timestamps for sector`);
147
+ continue;
148
+ }
149
+ this.setTimeStamp(storedIndex, stored[timeStamp]);
150
+ }
151
+ }
68
152
  toJSON() {
69
153
  const sections = [];
70
154
  for (const section of this.sections) {
71
155
  sections.push(section.toJSON());
72
156
  }
73
157
  return {
74
- position: this.position,
75
158
  buffer: this.buffer,
76
159
  flagArray: this.flagArray,
77
160
  timeStampArray: this.timeStampArray,
@@ -31,11 +31,11 @@ export class SectorHeightMap {
31
31
  const section = sector.sections[i];
32
32
  if (!section)
33
33
  continue;
34
- const sectionPOS = y + i * WorldSpaces.section.bounds.y;
34
+ const sectionPOS = section.getPosition();
35
35
  let [sectionMin, sectionMax] = section.getMinMax();
36
36
  if (Math.abs(sectionMax) == Infinity)
37
37
  continue;
38
- sectionMax = sectionPOS + sectionMax;
38
+ sectionMax = sectionPOS[1] + sectionMax;
39
39
  if (maxHeight < sectionMax) {
40
40
  maxHeight = sectionMax;
41
41
  }
@@ -1,13 +1,22 @@
1
- export declare enum SectorStateFlags {
1
+ export declare enum SectorStateDefaultBitFlags {
2
2
  isWorldGenDone = 0,
3
3
  isWorldDecorDone = 1,
4
4
  isWorldPropagationDone = 2,
5
5
  isWorldSunDone = 3,
6
- isDirty = 4,
7
- isStored = 5,
8
- persistent = 6
6
+ displayDirty = 4,
7
+ logicDirty = 5,
8
+ stored = 6
9
9
  }
10
- export declare enum SectorTimestampFlags {
11
- lastSaveTimestamp = 0,
12
- lastAnalyzerUpdateTimestamp = 1
10
+ export declare enum SectorStateDefaultTimeStamps {
11
+ lastSaveTimestamp = 0
12
+ }
13
+ export declare class SectorState {
14
+ /**The default bit flags for secotrs */
15
+ static Flags: typeof SectorStateDefaultBitFlags;
16
+ /**An array of bit flags tht are preserved when the sector is stored */
17
+ static StoredFlags: Record<string, number>;
18
+ /**The default timestamps for secotrs */
19
+ static TimeStamps: typeof SectorStateDefaultTimeStamps;
20
+ /**An array of bit timestamps tht are preserved when the sector is stored */
21
+ static StoredTimeStamps: Record<string, number>;
13
22
  }
@@ -1,15 +1,29 @@
1
- export var SectorStateFlags;
2
- (function (SectorStateFlags) {
3
- SectorStateFlags[SectorStateFlags["isWorldGenDone"] = 0] = "isWorldGenDone";
4
- SectorStateFlags[SectorStateFlags["isWorldDecorDone"] = 1] = "isWorldDecorDone";
5
- SectorStateFlags[SectorStateFlags["isWorldPropagationDone"] = 2] = "isWorldPropagationDone";
6
- SectorStateFlags[SectorStateFlags["isWorldSunDone"] = 3] = "isWorldSunDone";
7
- SectorStateFlags[SectorStateFlags["isDirty"] = 4] = "isDirty";
8
- SectorStateFlags[SectorStateFlags["isStored"] = 5] = "isStored";
9
- SectorStateFlags[SectorStateFlags["persistent"] = 6] = "persistent";
10
- })(SectorStateFlags || (SectorStateFlags = {}));
11
- export var SectorTimestampFlags;
12
- (function (SectorTimestampFlags) {
13
- SectorTimestampFlags[SectorTimestampFlags["lastSaveTimestamp"] = 0] = "lastSaveTimestamp";
14
- SectorTimestampFlags[SectorTimestampFlags["lastAnalyzerUpdateTimestamp"] = 1] = "lastAnalyzerUpdateTimestamp";
15
- })(SectorTimestampFlags || (SectorTimestampFlags = {}));
1
+ export var SectorStateDefaultBitFlags;
2
+ (function (SectorStateDefaultBitFlags) {
3
+ SectorStateDefaultBitFlags[SectorStateDefaultBitFlags["isWorldGenDone"] = 0] = "isWorldGenDone";
4
+ SectorStateDefaultBitFlags[SectorStateDefaultBitFlags["isWorldDecorDone"] = 1] = "isWorldDecorDone";
5
+ SectorStateDefaultBitFlags[SectorStateDefaultBitFlags["isWorldPropagationDone"] = 2] = "isWorldPropagationDone";
6
+ SectorStateDefaultBitFlags[SectorStateDefaultBitFlags["isWorldSunDone"] = 3] = "isWorldSunDone";
7
+ SectorStateDefaultBitFlags[SectorStateDefaultBitFlags["displayDirty"] = 4] = "displayDirty";
8
+ SectorStateDefaultBitFlags[SectorStateDefaultBitFlags["logicDirty"] = 5] = "logicDirty";
9
+ SectorStateDefaultBitFlags[SectorStateDefaultBitFlags["stored"] = 6] = "stored";
10
+ })(SectorStateDefaultBitFlags || (SectorStateDefaultBitFlags = {}));
11
+ export var SectorStateDefaultTimeStamps;
12
+ (function (SectorStateDefaultTimeStamps) {
13
+ SectorStateDefaultTimeStamps[SectorStateDefaultTimeStamps["lastSaveTimestamp"] = 0] = "lastSaveTimestamp";
14
+ })(SectorStateDefaultTimeStamps || (SectorStateDefaultTimeStamps = {}));
15
+ export class SectorState {
16
+ /**The default bit flags for secotrs */
17
+ static Flags = SectorStateDefaultBitFlags;
18
+ /**An array of bit flags tht are preserved when the sector is stored */
19
+ static StoredFlags = {
20
+ dve_is_world_gen_done: SectorStateDefaultBitFlags.isWorldGenDone,
21
+ dve_is_world_decoration_done: SectorStateDefaultBitFlags.isWorldDecorDone,
22
+ dve_is_world_progation_done: SectorStateDefaultBitFlags.isWorldPropagationDone,
23
+ dve_is_world_sun_done: SectorStateDefaultBitFlags.isWorldSunDone,
24
+ };
25
+ /**The default timestamps for secotrs */
26
+ static TimeStamps = SectorStateDefaultTimeStamps;
27
+ /**An array of bit timestamps tht are preserved when the sector is stored */
28
+ static StoredTimeStamps = {};
29
+ }
@@ -1,11 +1,6 @@
1
- export type DimensionOptions = {
2
- liquidFlowSpeed: number;
3
- magmaFlowSpeed: number;
4
- sunLight: boolean;
5
- };
6
- export type DimensionData = {
1
+ export type DimensionSyncData = {
7
2
  id: string;
8
- options: DimensionOptions;
3
+ index: number;
9
4
  };
10
5
  export type RichDataSchema = Record<string, Record<string, any>>;
11
6
  export type RichSector = {
@@ -0,0 +1 @@
1
+ export {};
@@ -1,10 +1,10 @@
1
1
  import { Dimension } from "./Dimension/Dimension";
2
2
  import { Sector, SectorData } from "./Sector/Sector.js";
3
3
  import type { LocationData } from "../Math/index.js";
4
- import { DimensionData } from "./Types/WorldData.types.js";
4
+ import { DimensionSyncData } from "./Types/WorldData.types.js";
5
5
  declare class WorldDataHooks {
6
6
  static dimension: {
7
- onNew: (dimension: DimensionData) => void;
7
+ onNew: (dimension: DimensionSyncData) => void;
8
8
  onRemove: (location: LocationData) => void;
9
9
  };
10
10
  static sectors: {
@@ -13,18 +13,22 @@ declare class WorldDataHooks {
13
13
  };
14
14
  }
15
15
  declare class WorldRegisterDimensions {
16
- static add(id: string): Dimension;
17
- static get(id: string): Dimension | undefined;
16
+ static add(index: number, id?: string): Dimension;
17
+ static get(index: number): Dimension | undefined;
18
18
  }
19
19
  declare class WorldRegisterSectors {
20
20
  static setSecotrPool(enabled: boolean): void;
21
- static add(dimensionId: string, x: number, y: number, z: number, sector: SectorData): Sector;
22
- static new(dimensionId: string, x: number, y: number, z: number): boolean;
23
- static get(dimensionId: string, x: number, y: number, z: number): false | Sector;
24
- static remove(dimensionId: string, x: number, y: number, z: number): boolean;
21
+ static add(dimensionId: number, x: number, y: number, z: number, sector: SectorData): Sector;
22
+ static addAt(location: LocationData, sector: SectorData): Sector;
23
+ static new(dimensionId: number, x: number, y: number, z: number): boolean;
24
+ static newAt(location: LocationData): boolean;
25
+ static get(dimensionId: number, x: number, y: number, z: number): false | Sector;
26
+ static getAt(location: LocationData): false | Sector;
27
+ static remove(dimensionId: number, x: number, y: number, z: number): boolean;
28
+ static removeAt(location: LocationData): boolean;
25
29
  }
26
30
  export declare class WorldRegister {
27
- static _dimensions: Map<string, Dimension>;
31
+ static _dimensions: Map<number, Dimension>;
28
32
  static _hooks: typeof WorldDataHooks;
29
33
  static dimensions: typeof WorldRegisterDimensions;
30
34
  static sectors: typeof WorldRegisterSectors;
@@ -13,13 +13,14 @@ class WorldDataHooks {
13
13
  };
14
14
  }
15
15
  class WorldRegisterDimensions {
16
- static add(id) {
17
- const dimesnion = Dimension.CreateNew(id);
18
- WorldRegister._dimensions.set(id, dimesnion);
16
+ static add(index, id = "") {
17
+ const dimesnion = Dimension.CreateNew(index, id);
18
+ WorldRegister._dimensions.set(index, dimesnion);
19
+ WorldDataHooks.dimension.onNew(dimesnion.getData());
19
20
  return dimesnion;
20
21
  }
21
- static get(id) {
22
- return WorldRegister._dimensions.get(id);
22
+ static get(index) {
23
+ return WorldRegister._dimensions.get(index);
23
24
  }
24
25
  }
25
26
  const tempPosition = Vector3Like.Create();
@@ -35,6 +36,7 @@ class SectorPool {
35
36
  }
36
37
  static returnSector(secotr) {
37
38
  secotr.bufferView.fill(0);
39
+ this._secotrs.push(secotr.toJSON());
38
40
  }
39
41
  }
40
42
  class WorldRegisterSectors {
@@ -46,21 +48,26 @@ class WorldRegisterSectors {
46
48
  let dimension = WorldRegister.dimensions.get(dimensionId);
47
49
  if (!dimension)
48
50
  dimension = WorldRegister.dimensions.add(dimensionId);
49
- WorldSpaces.sector.getPositionVec3Array(x, y, z, sector.position);
50
- const newSector = new Sector(sector);
51
+ const newSector = new Sector(sector, WorldSpaces.sector.getPositionVec3Array(x, y, z));
51
52
  dimension.sectors.set(WorldSpaces.hash.hashVec3Array(newSector.position), newSector);
52
53
  return newSector;
53
54
  }
55
+ static addAt(location, sector) {
56
+ return this.add(...location, sector);
57
+ }
54
58
  static new(dimensionId, x, y, z) {
55
59
  if (this.get(dimensionId, x, y, z))
56
60
  return false;
57
61
  let dimension = WorldRegister.dimensions.get(dimensionId);
58
62
  if (!dimension)
59
63
  dimension = WorldRegister.dimensions.add(dimensionId);
60
- const sector = this.add(dimensionId, x, y, z, Sector.CreateNew());
64
+ const sector = this.add(dimensionId, x, y, z, SectorPool.getSector());
61
65
  WorldDataHooks.sectors.onNew([dimensionId, x, y, z], sector);
62
66
  return true;
63
67
  }
68
+ static newAt(location) {
69
+ return this.new(...location);
70
+ }
64
71
  static get(dimensionId, x, y, z) {
65
72
  let dimension = WorldRegister.dimensions.get(dimensionId);
66
73
  if (!dimension)
@@ -68,6 +75,9 @@ class WorldRegisterSectors {
68
75
  const sector = dimension.sectors.get(WorldSpaces.hash.hashVec3(WorldSpaces.sector.getPosition(x, y, z, tempPosition)));
69
76
  return sector || false;
70
77
  }
78
+ static getAt(location) {
79
+ return this.get(...location);
80
+ }
71
81
  static remove(dimensionId, x, y, z) {
72
82
  let dimension = WorldRegister.dimensions.get(dimensionId);
73
83
  if (!dimension)
@@ -83,9 +93,14 @@ class WorldRegisterSectors {
83
93
  dimension.sectors.delete(sectorKey);
84
94
  return true;
85
95
  }
96
+ static removeAt(location) {
97
+ return this.remove(...location);
98
+ }
86
99
  }
87
100
  export class WorldRegister {
88
- static _dimensions = new Map();
101
+ static _dimensions = new Map([
102
+ [0, new Dimension(Dimension.CreateNew(0, "main"))],
103
+ ]);
89
104
  static _hooks = WorldDataHooks;
90
105
  static dimensions = WorldRegisterDimensions;
91
106
  static sectors = WorldRegisterSectors;
@@ -23,6 +23,8 @@ declare class SectorSpace {
23
23
  static power2Axes: Vector3Like;
24
24
  static bounds: Vector3Like;
25
25
  static volumne: number;
26
+ static sectionBounds: Vector3Like;
27
+ static sectionVolumne: number;
26
28
  static getPosition(x: number, y: number, z: number, refPosition?: Vector3Like): Vector3Like;
27
29
  static getPositionVec3Array(x: number, y: number, z: number, refPosition?: Vec3Array): Vec3Array;
28
30
  }
@@ -33,6 +35,8 @@ declare class SectionSpace {
33
35
  static getPosition(x: number, y: number, z: number, refPosition?: Vector3Like): Vector3Like;
34
36
  static getPositionVec3Array(x: number, y: number, z: number, refPosition?: Vec3Array): Vec3Array;
35
37
  static getIndex(x: number, y: number, z: number): number;
38
+ static getPositionFromIndex(index: number, refPosition?: Vector3Like): Vector3Like;
39
+ static getPositionFromIndexVec3Array(index: number, refPosition?: Vec3Array): Vec3Array;
36
40
  }
37
41
  declare class VoxelSpace {
38
42
  static bounds: Vector3Like;
@@ -1,7 +1,7 @@
1
1
  //types
2
2
  import { EngineSettings } from "../Settings/EngineSettings.js";
3
3
  import { Vector3Like } from "@amodx/math";
4
- import { CubeHashVec3, CubeHashVec3Array, GetYXZOrderArrayIndex, GetYXZOrderArrayPositionVec3, } from "../Math/Indexing.js";
4
+ import { CubeHashVec3, CubeHashVec3Array, GetYXZOrderArrayIndex, GetYXZOrderArrayPositionVec3, GetYXZOrderArrayPositionVec3Array, } from "../Math/Indexing.js";
5
5
  const tempPosition = Vector3Like.Create();
6
6
  const tempPosition2 = Vector3Like.Create();
7
7
  class WorldBounds {
@@ -57,6 +57,8 @@ class SectorSpace {
57
57
  static power2Axes = Vector3Like.Create();
58
58
  static bounds = Vector3Like.Create();
59
59
  static volumne = 0;
60
+ static sectionBounds = Vector3Like.Create();
61
+ static sectionVolumne = 0;
60
62
  static getPosition(x, y, z, refPosition = Vector3Like.Create()) {
61
63
  CubeHashVec3(x, y, z, SectorSpace.power2Axes.x, SectorSpace.power2Axes.y, SectorSpace.power2Axes.z, refPosition);
62
64
  return refPosition;
@@ -81,7 +83,13 @@ class SectionSpace {
81
83
  static getIndex(x, y, z) {
82
84
  SectionSpace.getPosition(x, y, z, tempPosition);
83
85
  SectorSpace.getPosition(x, y, z, tempPosition2);
84
- return (tempPosition.y - tempPosition2.y) / SectionSpace.bounds.y;
86
+ return GetYXZOrderArrayIndex((tempPosition.x - tempPosition2.x) / SectionSpace.bounds.x, (tempPosition.y - tempPosition2.y) / SectionSpace.bounds.y, (tempPosition.z - tempPosition2.z) / SectionSpace.bounds.z, SectorSpace.sectionBounds.x, SectorSpace.sectionBounds.y, SectorSpace.sectionBounds.z);
87
+ }
88
+ static getPositionFromIndex(index, refPosition = Vector3Like.Create()) {
89
+ return GetYXZOrderArrayPositionVec3(index, SectorSpace.sectionBounds.x, SectorSpace.sectionBounds.y, SectorSpace.sectionBounds.z, refPosition);
90
+ }
91
+ static getPositionFromIndexVec3Array(index, refPosition = [0, 0, 0]) {
92
+ return GetYXZOrderArrayPositionVec3Array(index, SectorSpace.sectionBounds.x, SectorSpace.sectionBounds.y, SectorSpace.sectionBounds.z, refPosition);
85
93
  }
86
94
  }
87
95
  class VoxelSpace {
@@ -132,22 +140,27 @@ export class WorldSpaces {
132
140
  EngineSettings.addEventListener("synced", (event) => {
133
141
  const { settings } = event.detail.settings;
134
142
  WorldBounds.setWorldBounds(settings.world.min.x, settings.world.min.y, settings.world.min.z, settings.world.max.x, settings.world.max.y, settings.world.max.z);
135
- SectorSpace.power2Axes.x = settings.sectors.power2Size.x;
136
- SectorSpace.power2Axes.y = settings.sectors.power2Size.y;
137
- SectorSpace.power2Axes.z = settings.sectors.power2Size.z;
143
+ SectorSpace.power2Axes.x = settings.world.sectorPower2Size.x;
144
+ SectorSpace.power2Axes.y = settings.world.sectorPower2Size.y;
145
+ SectorSpace.power2Axes.z = settings.world.sectorPower2Size.z;
138
146
  SectorSpace.bounds.x = 1 << SectorSpace.power2Axes.x;
139
147
  SectorSpace.bounds.y = 1 << SectorSpace.power2Axes.y;
140
148
  SectorSpace.bounds.z = 1 << SectorSpace.power2Axes.z;
141
- SectionSpace.power2Axes.x = settings.sections.power2Size.x;
142
- SectionSpace.power2Axes.y = settings.sections.power2Size.y;
143
- SectionSpace.power2Axes.z = settings.sections.power2Size.z;
149
+ SectorSpace.volumne =
150
+ SectorSpace.bounds.x * SectorSpace.bounds.y * SectorSpace.bounds.z;
151
+ SectionSpace.power2Axes.x = settings.world.sectionPower2Size.x;
152
+ SectionSpace.power2Axes.y = settings.world.sectionPower2Size.y;
153
+ SectionSpace.power2Axes.z = settings.world.sectionPower2Size.z;
144
154
  SectionSpace.bounds.x = 1 << SectionSpace.power2Axes.x;
145
155
  SectionSpace.bounds.y = 1 << SectionSpace.power2Axes.y;
146
156
  SectionSpace.bounds.z = 1 << SectionSpace.power2Axes.z;
147
157
  SectionSpace.volumne =
148
158
  SectionSpace.bounds.x * SectionSpace.bounds.y * SectionSpace.bounds.z;
149
- SectorSpace.volumne =
150
- (SectorSpace.bounds.x / SectionSpace.bounds.x) *
151
- (SectorSpace.bounds.y / SectionSpace.bounds.y) *
152
- (SectorSpace.bounds.z / SectionSpace.bounds.z);
159
+ SectorSpace.sectionBounds.x = SectorSpace.bounds.x / SectionSpace.bounds.x;
160
+ SectorSpace.sectionBounds.y = SectorSpace.bounds.y / SectionSpace.bounds.y;
161
+ SectorSpace.sectionBounds.z = SectorSpace.bounds.z / SectionSpace.bounds.z;
162
+ SectorSpace.sectionVolumne =
163
+ SectorSpace.sectionBounds.x *
164
+ SectorSpace.sectionBounds.y *
165
+ SectorSpace.sectionBounds.z;
153
166
  });
@@ -20,7 +20,7 @@ declare class SectorQueue {
20
20
  addSector(sector: Sector): void;
21
21
  }
22
22
  export declare class DimensionSegment {
23
- id: string;
23
+ id: number;
24
24
  tasks: Map<string, TaskSegment>;
25
25
  queue: number[];
26
26
  vistedMap: SectorVisistedMap;
@@ -28,7 +28,7 @@ export declare class DimensionSegment {
28
28
  inProgress: SectorVisistedMap;
29
29
  unRenderQueue: SectorQueue;
30
30
  unLoadQueue: SectorQueue;
31
- constructor(id: string);
31
+ constructor(id: number);
32
32
  addTask(id: string): void;
33
33
  getTask(id: string): TaskSegment;
34
34
  clearAllTasks(): void;
@@ -1,7 +1,10 @@
1
1
  import { Vector3Like } from "@amodx/math";
2
2
  import { Circle } from "@amodx/math/Shapes";
3
+ import { TaskTool } from "../../../Tools/Tasks/TasksTool";
4
+ import { BuildQueue } from "./Queues/BuildQueue";
5
+ import { LogicQueue } from "./Queues/LogiccQueue";
3
6
  export interface GeneratorData {
4
- dimension: string;
7
+ dimension: number;
5
8
  building?: boolean;
6
9
  culling?: boolean;
7
10
  position: Vector3Like;
@@ -10,8 +13,9 @@ export interface GeneratorData {
10
13
  maxRadius: number;
11
14
  }
12
15
  export declare class Generator {
16
+ taskTool: TaskTool;
13
17
  position: Vector3Like;
14
- _dimension: string;
18
+ _dimension: number;
15
19
  _building: boolean;
16
20
  _positonChanged: boolean;
17
21
  _waitingForCull: boolean;
@@ -22,6 +26,9 @@ export declare class Generator {
22
26
  _genCircle: Circle;
23
27
  _renderCircle: Circle;
24
28
  _maxCircle: Circle;
25
- constructor(data: GeneratorData);
29
+ buildQueue: BuildQueue;
30
+ logicQueue: LogicQueue;
31
+ constructor(taskTool: TaskTool, data: GeneratorData);
26
32
  update(): void;
33
+ tick(): void;
27
34
  }