@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
@@ -5,6 +5,7 @@ import { SchemaRegister } from "../../../Voxels/State/SchemaRegister";
5
5
  import { VoxelTagStates } from "../../../Voxels/Data/VoxelTagStates";
6
6
  import { VoxelPalettesRegister } from "../../../Voxels/Data/VoxelPalettesRegister";
7
7
  import { VoxelTagsRegister } from "../../../Voxels/Data/VoxelTagsRegister";
8
+ import { VoxelLogicRegister } from "../../../Voxels/Logic/VoxelLogicRegister";
8
9
  export default function InitDataSync(props) {
9
10
  Threads.registerTask("sync-data", (data) => {
10
11
  EngineSettings.syncSettings(data.settings);
@@ -23,6 +24,9 @@ export default function InitDataSync(props) {
23
24
  SchemaRegister.registerVoxel(voxel.id, voxel.modelId, voxel.modSchema);
24
25
  }
25
26
  VoxelTagStates.load(modelData.tagState);
27
+ for (const id in data.voxels.data.logic) {
28
+ VoxelLogicRegister.register(id, data.voxels.data.logic[id]);
29
+ }
26
30
  props.onSync(data);
27
31
  });
28
32
  }
@@ -3,7 +3,7 @@ import { WorldDataSyncIds } from "../../../World/Types/WorldDataSyncIds.js";
3
3
  import { WorldRegister } from "../../../World/WorldRegister.js";
4
4
  export default function () {
5
5
  Threads.registerTask(WorldDataSyncIds.SyncDimension, (data) => {
6
- WorldRegister.dimensions.add(data.id);
6
+ WorldRegister.dimensions.add(data.index, data.id);
7
7
  });
8
8
  Threads.registerTask(WorldDataSyncIds.UnSyncDimension, (data) => {
9
9
  // register.dimensions.re(data.id);
@@ -19,11 +19,12 @@ export declare class DivineVoxelEngineRender {
19
19
  settings: {
20
20
  enviorment: "node" | "browser";
21
21
  settings: EngineSettingsData;
22
+ version: string;
22
23
  readonly doSunPropagation: boolean;
23
24
  readonly doRGBPropagation: boolean;
24
25
  readonly doLight: boolean;
25
26
  readonly doFlow: boolean;
26
- readonly isClient: boolean;
27
+ readonly doPower: boolean;
27
28
  getSettings(): EngineSettingsData;
28
29
  syncSettings(data: EngineSettingsData): void;
29
30
  getSettingsCopy(): any;
@@ -11,11 +11,12 @@ export declare class DivineVoxelEngineWorld {
11
11
  settings: {
12
12
  enviorment: "node" | "browser";
13
13
  settings: import("../../Settings/EngineSettings.types.js").EngineSettingsData;
14
+ version: string;
14
15
  readonly doSunPropagation: boolean;
15
16
  readonly doRGBPropagation: boolean;
16
17
  readonly doLight: boolean;
17
18
  readonly doFlow: boolean;
18
- readonly isClient: boolean;
19
+ readonly doPower: boolean;
19
20
  getSettings(): import("../../Settings/EngineSettings.types.js").EngineSettingsData;
20
21
  syncSettings(data: import("../../Settings/EngineSettings.types.js").EngineSettingsData): void;
21
22
  getSettingsCopy(): any;
@@ -3,6 +3,7 @@ import { DivineVoxelEngineConstructor } from "../Contexts/Constructor/DivineVoxe
3
3
  import { Threads } from "@amodx/threads";
4
4
  import { Environment } from "../Util/Environment";
5
5
  import { WorldRegister } from "../World/WorldRegister";
6
+ import InitLogicTasks from "../Tasks/Logic/InitTasks";
6
7
  import InitUpdateTasks from "../Tasks/Update/InitTasks";
7
8
  import InitPropagationTasks from "../Tasks/Propagation/InitTasks";
8
9
  import InitMesherTasks from "../Mesher/InitTask";
@@ -42,12 +43,15 @@ export async function StartContrusctor(data = {}) {
42
43
  InitWorldDataSync();
43
44
  InitPropagationTasks();
44
45
  InitMesherTasks(DVEC.threads.parent);
46
+ InitLogicTasks();
45
47
  InitUpdateTasks({
46
48
  onDone(tasks, origin) {
47
- origin.runTask("build-queue", [
48
- tasks.origin[0],
49
- tasks.bounds.getSections(),
50
- ]);
49
+ tasks.bounds.markSectionsAsDirty();
50
+ /*
51
+ origin.runTask("build-queue", [
52
+ tasks.origin[0],
53
+ tasks.bounds.getSections(),
54
+ ]); */
51
55
  },
52
56
  });
53
57
  InitWorldGenerationTasks();
@@ -1,5 +1,5 @@
1
1
  import { DivineVoxelEngineWorld } from "../Contexts/World/DivineVoxelEngineWorld";
2
- import { WorldStorageInterface } from "World/Storage/WorldStorage.interface";
2
+ import { WorldStorageInterface } from "World/Types/WorldStorage.interface";
3
3
  type StartWorldProps = {
4
4
  worldStorage?: WorldStorageInterface;
5
5
  };
package/Math/index.d.ts CHANGED
@@ -1,8 +1,12 @@
1
1
  export * from "./VoxelFaces.js";
2
2
  export * from "./VoxelFaces.js";
3
3
  export type LocationData = [
4
- dimensionId: string,
4
+ /**Index for the dimension */
5
+ dimensionIndex: number,
6
+ /**x position */
5
7
  x: number,
8
+ /**y position */
6
9
  y: number,
10
+ /**z position */
7
11
  z: number
8
12
  ];
@@ -1,3 +1,3 @@
1
1
  import { CompactMeshData } from "../Types/Mesher.types";
2
- import { VoxelMesherDataTool } from "Mesher/Tools/VoxelMesherDataTool";
3
- export declare function CompactVoxelMesh(tools: VoxelMesherDataTool[], transfers?: any[]): CompactMeshData;
2
+ import { VoxelModelBuilder } from "Mesher/Models/VoxelModelBuilder";
3
+ export declare function CompactVoxelMesh(tools: VoxelModelBuilder[], transfers?: any[]): CompactMeshData;
@@ -1,4 +1,4 @@
1
- import { VoxelMeshVertexStructCursor } from "../Tools/VoxelMeshVertexStructCursor";
1
+ import { VoxelMeshVertexStructCursor } from "../Geomtry/VoxelMeshVertexStructCursor";
2
2
  const structCursor = new VoxelMeshVertexStructCursor();
3
3
  /*
4
4
  function MakeWebGPUMesh(tool: VoxelMesherDataTool): CompactMeshData {
@@ -0,0 +1,4 @@
1
+ import { SetSectionMeshTask } from "../Types/Mesher.types";
2
+ import { VoxelModelBuilder } from "../Models/VoxelModelBuilder";
3
+ import { LocationData } from "../../Math";
4
+ export declare function CompactVoxelSectionMesh(location: LocationData, tools: VoxelModelBuilder[], transfers?: any[]): SetSectionMeshTask;
@@ -0,0 +1,112 @@
1
+ import { VoxelMeshVertexStructCursor } from "../Geomtry/VoxelMeshVertexStructCursor";
2
+ import { CompactedSectionVoxelMesh, CompactedMeshData, } from "../Geomtry/CompactedSectionVoxelMesh";
3
+ const meshData = new CompactedMeshData();
4
+ const compactedMesh = new CompactedSectionVoxelMesh();
5
+ /** Utility to ensure a value is aligned to 4 bytes. */
6
+ function align4(value) {
7
+ return (value + 3) & ~3;
8
+ }
9
+ export function CompactVoxelSectionMesh(location, tools, transfers = []) {
10
+ // 1) First compute how large the final buffer needs to be (with 4-byte alignment).
11
+ let headerSize = CompactedSectionVoxelMesh.GetHeaderByteSize(tools.length);
12
+ // Make the header itself 4-byte aligned
13
+ headerSize = align4(headerSize);
14
+ let totalByteCount = headerSize;
15
+ for (let i = 0; i < tools.length; i++) {
16
+ const tool = tools[i];
17
+ // Add the vertex data
18
+ const vertexByteSize = tool.mesh.vertexCount * VoxelMeshVertexStructCursor.VertexByteSize;
19
+ totalByteCount += vertexByteSize;
20
+ // Align after writing vertex data
21
+ totalByteCount = align4(totalByteCount);
22
+ // Add the index data
23
+ const indexByteSize = tool.mesh.indicieCount > 65535
24
+ ? tool.mesh.indicieCount * 4
25
+ : tool.mesh.indicieCount * 2;
26
+ totalByteCount += indexByteSize;
27
+ // Align after writing index data
28
+ totalByteCount = align4(totalByteCount);
29
+ }
30
+ // 2) Allocate the final buffer
31
+ const buffer = new ArrayBuffer(totalByteCount);
32
+ compactedMesh.setData(buffer);
33
+ compactedMesh.setLocation(...location);
34
+ compactedMesh.setTotalMeshes(tools.length);
35
+ // We'll track our position in the buffer here
36
+ let byteCount = headerSize;
37
+ for (let i = 0; i < tools.length; i++) {
38
+ const tool = tools[i];
39
+ // Fill out the meshData structure
40
+ meshData.material = tool.id;
41
+ const minBounds = tool.mesh.minBounds;
42
+ const maxBounds = tool.mesh.maxBounds;
43
+ meshData.minBounds[0] = minBounds.x;
44
+ meshData.minBounds[1] = minBounds.y;
45
+ meshData.minBounds[2] = minBounds.z;
46
+ meshData.maxBounds[0] = maxBounds.x;
47
+ meshData.maxBounds[1] = maxBounds.y;
48
+ meshData.maxBounds[2] = maxBounds.z;
49
+ // Vertex info
50
+ const totalVertFloats = tool.mesh.vertexCount * VoxelMeshVertexStructCursor.VertexFloatSize;
51
+ const vertexByteCount = totalVertFloats * 4;
52
+ meshData.vertexIndex[0] = byteCount;
53
+ meshData.vertexIndex[1] = totalVertFloats;
54
+ // Now move the pointer
55
+ byteCount += vertexByteCount;
56
+ // Align to 4 bytes again before writing indices
57
+ byteCount = align4(byteCount);
58
+ // Index info
59
+ meshData.indiceIndex[0] = byteCount;
60
+ meshData.indiceIndex[1] = tool.mesh.indicieCount;
61
+ const indexByteCount = tool.mesh.indicieCount > 65535
62
+ ? tool.mesh.indicieCount * 4
63
+ : tool.mesh.indicieCount * 2;
64
+ byteCount += indexByteCount;
65
+ // Align to 4 bytes for the next iteration (or final)
66
+ byteCount = align4(byteCount);
67
+ // Store the meta info
68
+ compactedMesh.setMeshData(i, meshData);
69
+ // Write vertex data
70
+ const vertexArray = new Float32Array(buffer, meshData.vertexIndex[0], totalVertFloats);
71
+ const vertexBuffers = tool.mesh.buffer._buffers;
72
+ let start = 0;
73
+ let done = false;
74
+ for (let b = 0; b < vertexBuffers.length; b++) {
75
+ const buf = vertexBuffers[b];
76
+ for (let j = 0; j < buf.length; j++) {
77
+ vertexArray[start] = buf[j];
78
+ start++;
79
+ if (start >= totalVertFloats) {
80
+ done = true;
81
+ break;
82
+ }
83
+ }
84
+ if (done)
85
+ break;
86
+ }
87
+ // Write index data
88
+ const indicesArray = tool.mesh.indicieCount > 65535
89
+ ? new Uint32Array(buffer, meshData.indiceIndex[0], tool.mesh.indicieCount)
90
+ : new Uint16Array(buffer, meshData.indiceIndex[0], tool.mesh.indicieCount);
91
+ const indiceBuffers = tool.mesh.indices._buffers;
92
+ start = 0;
93
+ done = false;
94
+ for (let b = 0; b < indiceBuffers.length; b++) {
95
+ const buf = indiceBuffers[b];
96
+ for (let j = 0; j < buf.length; j++) {
97
+ indicesArray[start] = buf[j];
98
+ start++;
99
+ if (start >= tool.mesh.indicieCount) {
100
+ done = true;
101
+ break;
102
+ }
103
+ }
104
+ if (done)
105
+ break;
106
+ }
107
+ }
108
+ // Transfer the ArrayBuffer to your worker if needed
109
+ transfers.push(buffer);
110
+ // Return the buffer or the task object as needed
111
+ return buffer;
112
+ }
@@ -1,3 +1,3 @@
1
1
  import { LocationData } from "../../Math";
2
- import type { SetSectionMeshTask } from "../../Renderer/Renderer.types.js";
2
+ import type { SetSectionMeshTask } from "../Types/Mesher.types";
3
3
  export declare function MeshSection(location: LocationData, transfers?: any[]): SetSectionMeshTask | null;
@@ -2,14 +2,14 @@
2
2
  import { WorldSpaces } from "../../World/WorldSpaces.js";
3
3
  //tools
4
4
  import { VoxelGeometryBuilderCacheSpace } from "../Models/VoxelGeometryBuilderCacheSpace.js";
5
- import { CompactVoxelMesh } from "./CompactVoxelMesh.js";
6
5
  import { WorldCursor } from "../../World/Cursor/WorldCursor.js";
7
6
  import { SectionCursor } from "../../World/Cursor/SectionCursor.js";
8
7
  import { VoxelModelConstructorRegister } from "../Models/VoxelModelConstructorRegister.js";
9
8
  import { WorldRegister } from "../../World/WorldRegister.js";
10
- import { VoxelMeshBVHBuilder } from "../Tools/VoxelMeshBVHBuilder";
9
+ import { VoxelMeshBVHBuilder } from "../Geomtry/VoxelMeshBVHBuilder";
11
10
  import { Vector3Like } from "@amodx/math";
12
- import { RenderedMaterials } from "../../Mesher/RenderedMaterials";
11
+ import { RenderedMaterials } from "../Models/RenderedMaterials";
12
+ import { CompactVoxelSectionMesh } from "./CompactVoxelSectionMesh";
13
13
  const sectionCursor = new SectionCursor();
14
14
  const worldCursor = new WorldCursor();
15
15
  let space;
@@ -39,16 +39,19 @@ export function MeshSection(location, transfers = []) {
39
39
  y: WorldSpaces.section.bounds.y + padding.y,
40
40
  z: WorldSpaces.section.bounds.z + padding.z,
41
41
  });
42
- const [dimension, cx, cy, cz] = location;
43
- const sector = WorldRegister.sectors.get(dimension, cx, cy, cz);
42
+ const sector = WorldRegister.sectors.getAt(location);
44
43
  if (!sector)
45
44
  return null;
46
- const section = sector.getSection(cy);
45
+ const section = sector.getSection(location[1], location[2], location[3]);
46
+ const [cx, cy, cz] = section.getPosition();
47
47
  worldCursor.setFocalPoint(...location);
48
48
  sectionCursor.setSection(...location);
49
49
  let [minY, maxY] = section.getMinMax();
50
- if (Math.abs(minY) == Infinity && Math.abs(maxY) == Infinity)
50
+ if (minY == Infinity && maxY == -Infinity) {
51
+ section.setDisplayDirty(false);
52
+ section.setInProgress(false);
51
53
  return null;
54
+ }
52
55
  space.start(cx - (padding.x - 1), cy - (padding.y - 1), cz - (padding.z - 1));
53
56
  bvhTool.reset();
54
57
  const effects = {};
@@ -58,17 +61,19 @@ export function MeshSection(location, transfers = []) {
58
61
  mesher.bvhTool = bvhTool;
59
62
  mesher.effects = effects;
60
63
  }
61
- const volume = WorldSpaces.section.volumne;
62
64
  const slice = WorldSpaces.section.bounds.x * WorldSpaces.section.bounds.z;
63
- //const t = performance.now();
64
- for (let i = 0; i < volume; i++) {
65
+ const startY = minY * slice;
66
+ const endY = (maxY + 1) * slice;
67
+ for (let i = startY; i < endY; i++) {
65
68
  if (!(i % slice)) {
66
69
  const y = i / slice;
67
70
  if (!section.getHasVoxel(y) && !section.getHasVoxelDirty(y)) {
68
- i += slice;
71
+ i += slice - 1;
69
72
  continue;
70
73
  }
71
74
  }
75
+ if (!section.ids[i])
76
+ continue;
72
77
  if (!section.ids[i] || section.getBuried(i))
73
78
  continue;
74
79
  const voxel = sectionCursor.getVoxelAtIndex(i);
@@ -86,29 +91,29 @@ export function MeshSection(location, transfers = []) {
86
91
  }
87
92
  section.setBuried(i, !addedVoxel);
88
93
  }
89
- // console.log(performance.now() - t);
90
- const sectionEffects = [];
91
- const sections = [location, [], sectionEffects, 0];
92
94
  const meshed = [];
93
95
  for (let i = 0; i < RenderedMaterials.meshers.length; i++) {
94
96
  const mesher = RenderedMaterials.meshers[i];
95
- for (const e in mesher.effects) {
96
- const float = Float32Array.from(mesher.effects[e]);
97
- transfers.push(float.buffer);
98
- sectionEffects.push([e, float]);
99
- }
100
97
  if (!mesher.mesh.vertexCount) {
101
98
  mesher.clear();
102
99
  mesher.bvhTool = null;
103
100
  continue;
104
101
  }
102
+ const { min, max } = mesher.bvhTool.getMeshBounds();
103
+ mesher.mesh.minBounds.x = min[0];
104
+ mesher.mesh.minBounds.y = min[1];
105
+ mesher.mesh.minBounds.z = min[2];
106
+ mesher.mesh.maxBounds.x = max[0];
107
+ mesher.mesh.maxBounds.y = max[1];
108
+ mesher.mesh.maxBounds.z = max[2];
105
109
  meshed.push(mesher);
106
110
  }
107
- const compactMesh = CompactVoxelMesh(meshed, transfers);
108
- sections[1] = compactMesh;
111
+ const compactMesh = CompactVoxelSectionMesh(location, meshed, transfers);
109
112
  for (let i = 0; i < meshed.length; i++) {
110
113
  meshed[i].clear();
111
114
  meshed[i].bvhTool = null;
112
115
  }
113
- return sections;
116
+ section.setDisplayDirty(false);
117
+ section.setInProgress(false);
118
+ return compactMesh;
114
119
  }
@@ -1 +1 @@
1
- export declare function MeshTexture(textureId: number, textureData: number[]): import("../Geomtry/VoxelMesh").VoxelMesh | null;
1
+ export declare function MeshTexture(textureId: number, textureData: number[]): void;
@@ -1,4 +1,3 @@
1
- import { MesherDataTool } from "../Geomtry/Tools/MesherDataTools";
2
1
  import { Quad } from "../Geomtry/Primitives/Quad";
3
2
  const Quads = {
4
3
  north: Quad.Create([
@@ -10,8 +9,8 @@ const Quads = {
10
9
  [1, 1, 0],
11
10
  ], Quad.FullUVs, false, 0),
12
11
  };
13
- const tool = new MesherDataTool();
14
- tool.startNewMesh();
12
+ //const tool = new MesherDataTool();
13
+ //tool.startNewMesh();
15
14
  //tool.mesh!.attributes.set("uv", [[], 2, BinaryNumberTypes.Float32]);
16
15
  //tool.mesh!.attributes.set("textureIndex", [[], 3, BinaryNumberTypes.Float32]);
17
16
  export function MeshTexture(textureId, textureData) {
@@ -271,5 +270,5 @@ export function MeshTexture(textureId, textureData) {
271
270
 
272
271
  const compacted = CompactMesh("dve_node", tool);
273
272
  */
274
- return tool.mesh;
273
+ // return tool.mesh;
275
274
  }
@@ -0,0 +1,23 @@
1
+ import { Vec3Array } from "@amodx/math";
2
+ import { LocationData } from "../../Math";
3
+ export declare class CompactedMeshData {
4
+ material: string;
5
+ minBounds: Vec3Array;
6
+ maxBounds: Vec3Array;
7
+ vertexIndex: [start: number, length: number];
8
+ indiceIndex: [start: number, length: number];
9
+ verticies: Float32Array;
10
+ indices: Uint16Array | Uint32Array;
11
+ }
12
+ export declare class CompactedSectionVoxelMesh {
13
+ static GetHeaderByteSize(totalMeshes?: number): number;
14
+ static GetMeshHeaderByteSize(): number;
15
+ data: DataView;
16
+ setData(data: ArrayBuffer): void;
17
+ setTotalMeshes(amount: number): void;
18
+ getTotalMeshes(): number;
19
+ setLocation(dimesion: number, x: number, y: number, z: number): void;
20
+ getLocation(location?: LocationData): LocationData;
21
+ setMeshData(index: number, mesh: CompactedMeshData): void;
22
+ getMeshData(index: number, mesh: CompactedMeshData): CompactedMeshData;
23
+ }
@@ -0,0 +1,144 @@
1
+ import { VoxelPalettesRegister } from "../../Voxels/Data/VoxelPalettesRegister";
2
+ export class CompactedMeshData {
3
+ material = "dve_solid";
4
+ minBounds = [0, 0, 0];
5
+ maxBounds = [0, 0, 0];
6
+ vertexIndex = [0, 0];
7
+ indiceIndex = [0, 0];
8
+ verticies;
9
+ indices;
10
+ }
11
+ export class CompactedSectionVoxelMesh {
12
+ static GetHeaderByteSize(totalMeshes = 0) {
13
+ return (
14
+ //dimension index 2 bytes uint16
15
+ 2 +
16
+ //position x 4 bytes int32
17
+ 4 +
18
+ //position y 4 bytes int32
19
+ 4 +
20
+ //position z 4 bytes int32
21
+ 4 +
22
+ //total meshes
23
+ 1 +
24
+ //other mehes
25
+ totalMeshes * this.GetMeshHeaderByteSize());
26
+ }
27
+ static GetMeshHeaderByteSize() {
28
+ return (
29
+ //material index 1 byte
30
+ 1 +
31
+ //min x 4 bytes Float32
32
+ 4 +
33
+ //min y 4 bytes Float32
34
+ 4 +
35
+ //min z 4 bytes Float32
36
+ 4 +
37
+ //max x 4 bytes Float32
38
+ 4 +
39
+ //max y 4 bytes Float32
40
+ 4 +
41
+ //max z 4 bytes Float32
42
+ 4 +
43
+ //Vertex Start Byte uint32
44
+ 4 +
45
+ //Vertex Length
46
+ 4 +
47
+ //Indice Start Byte uint32
48
+ 4 +
49
+ //Indice Length
50
+ 4);
51
+ }
52
+ data;
53
+ setData(data) {
54
+ this.data = new DataView(data);
55
+ }
56
+ setTotalMeshes(amount) {
57
+ this.data.setUint8(14, amount);
58
+ }
59
+ getTotalMeshes() {
60
+ return this.data.getUint8(14);
61
+ }
62
+ setLocation(dimesion, x, y, z) {
63
+ this.data.setInt16(0, dimesion);
64
+ this.data.setInt32(2, x);
65
+ this.data.setInt32(6, y);
66
+ this.data.setInt32(10, z);
67
+ }
68
+ getLocation(location = [0, 0, 0, 0]) {
69
+ location[0] = this.data.getInt16(0);
70
+ location[1] = this.data.getInt32(2);
71
+ location[2] = this.data.getInt32(6);
72
+ location[3] = this.data.getInt32(10);
73
+ return location;
74
+ }
75
+ setMeshData(index, mesh) {
76
+ const { material, minBounds, maxBounds, vertexIndex, indiceIndex } = mesh;
77
+ let startByte = CompactedSectionVoxelMesh.GetHeaderByteSize(0) +
78
+ CompactedSectionVoxelMesh.GetMeshHeaderByteSize() * index;
79
+ //material index
80
+ this.data.setUint8(startByte, VoxelPalettesRegister.material.getNumberId(material));
81
+ startByte++;
82
+ //min bounds
83
+ this.data.setFloat32(startByte, minBounds[0]);
84
+ startByte += 4;
85
+ this.data.setFloat32(startByte, minBounds[1]);
86
+ startByte += 4;
87
+ this.data.setFloat32(startByte, minBounds[2]);
88
+ startByte += 4;
89
+ //max bounds
90
+ this.data.setFloat32(startByte, maxBounds[0]);
91
+ startByte += 4;
92
+ this.data.setFloat32(startByte, maxBounds[1]);
93
+ startByte += 4;
94
+ this.data.setFloat32(startByte, maxBounds[2]);
95
+ startByte += 4;
96
+ //vertex index
97
+ this.data.setUint32(startByte, vertexIndex[0]);
98
+ startByte += 4;
99
+ this.data.setUint32(startByte, vertexIndex[1]);
100
+ startByte += 4;
101
+ //indice index
102
+ this.data.setUint32(startByte, indiceIndex[0]);
103
+ startByte += 4;
104
+ this.data.setUint32(startByte, indiceIndex[1]);
105
+ startByte += 4;
106
+ }
107
+ getMeshData(index, mesh) {
108
+ let startByte = CompactedSectionVoxelMesh.GetHeaderByteSize(0) +
109
+ CompactedSectionVoxelMesh.GetMeshHeaderByteSize() * index;
110
+ // material index
111
+ mesh.material = VoxelPalettesRegister.material.getStringId(this.data.getUint8(startByte));
112
+ startByte++;
113
+ // min bounds
114
+ mesh.minBounds[0] = this.data.getFloat32(startByte);
115
+ startByte += 4;
116
+ mesh.minBounds[1] = this.data.getFloat32(startByte);
117
+ startByte += 4;
118
+ mesh.minBounds[2] = this.data.getFloat32(startByte);
119
+ startByte += 4;
120
+ // max bounds
121
+ mesh.maxBounds[0] = this.data.getFloat32(startByte);
122
+ startByte += 4;
123
+ mesh.maxBounds[1] = this.data.getFloat32(startByte);
124
+ startByte += 4;
125
+ mesh.maxBounds[2] = this.data.getFloat32(startByte);
126
+ startByte += 4;
127
+ // vertex index
128
+ mesh.vertexIndex[0] = this.data.getUint32(startByte);
129
+ startByte += 4;
130
+ mesh.vertexIndex[1] = this.data.getUint32(startByte);
131
+ startByte += 4;
132
+ // indice index
133
+ mesh.indiceIndex[0] = this.data.getUint32(startByte);
134
+ startByte += 4;
135
+ mesh.indiceIndex[1] = this.data.getUint32(startByte);
136
+ startByte += 4;
137
+ mesh.verticies = new Float32Array(this.data.buffer, ...mesh.vertexIndex);
138
+ mesh.indices =
139
+ mesh.indiceIndex[1] > 65535
140
+ ? new Uint32Array(this.data.buffer, ...mesh.indiceIndex)
141
+ : new Uint16Array(this.data.buffer, ...mesh.indiceIndex);
142
+ return mesh;
143
+ }
144
+ }
@@ -1,8 +1,9 @@
1
1
  import { QuadVerticies } from "../Geometry.types.js";
2
2
  import { Vector3Like, Vector2Like, Vec3Array } from "@amodx/math";
3
+ type QuadDataType<Data> = [Data, Data, Data, Data];
3
4
  export declare class QuadVertexData<Data> {
4
- vertices: Record<QuadVerticies, Data>;
5
- constructor(vertices: Record<QuadVerticies, Data>);
5
+ vertices: QuadDataType<Data>;
6
+ constructor(vertices: QuadDataType<Data>);
6
7
  getAsArray(): Data[];
7
8
  setVertex(vertex: QuadVerticies, value: Data): void;
8
9
  getVertex(vertex: QuadVerticies): Data;
@@ -14,8 +15,8 @@ export declare class QuadVertexData<Data> {
14
15
  clone(): QuadVertexData<Data>;
15
16
  }
16
17
  export declare class QuadVec3ArrayVertexData extends QuadVertexData<Vec3Array> {
17
- vertices: Record<QuadVerticies, Vec3Array>;
18
- constructor(vertices?: Record<QuadVerticies, Vec3Array>);
18
+ vertices: QuadDataType<Vec3Array>;
19
+ constructor(vertices?: QuadDataType<Vec3Array>);
19
20
  setFromQuadData(vertexData: QuadVertexData<Vec3Array>): void;
20
21
  addToVertex(vertex: QuadVerticies, value: Vec3Array): void;
21
22
  subtractFromVertex(vertex: QuadVerticies, value: Vec3Array): void;
@@ -26,8 +27,8 @@ export declare class QuadVec3ArrayVertexData extends QuadVertexData<Vec3Array> {
26
27
  clone(): QuadVec3ArrayVertexData;
27
28
  }
28
29
  export declare class QuadVector3VertexData extends QuadVertexData<Vector3Like> {
29
- vertices: Record<QuadVerticies, Vector3Like>;
30
- constructor(vertices?: Record<QuadVerticies, Vector3Like>);
30
+ vertices: QuadDataType<Vector3Like>;
31
+ constructor(vertices?: QuadDataType<Vector3Like>);
31
32
  setFromQuadData(vertexData: QuadVertexData<Vector3Like>): void;
32
33
  addToVertex(vertex: QuadVerticies, value: Vector3Like): void;
33
34
  subtractFromVertex(vertex: QuadVerticies, value: Vector3Like): void;
@@ -38,8 +39,8 @@ export declare class QuadVector3VertexData extends QuadVertexData<Vector3Like> {
38
39
  clone(): QuadVector3VertexData;
39
40
  }
40
41
  export declare class QuadVector2VertexData extends QuadVertexData<Vector2Like> {
41
- vertices: Record<QuadVerticies, Vector2Like>;
42
- constructor(vertices?: Record<QuadVerticies, Vector2Like>);
42
+ vertices: QuadDataType<Vector2Like>;
43
+ constructor(vertices?: QuadDataType<Vector2Like>);
43
44
  setFromQuadData(vertexData: QuadVertexData<Vector3Like>): void;
44
45
  addToVertex(vertex: QuadVerticies, value: Vector2Like): void;
45
46
  subtractFromVertex(vertex: QuadVerticies, value: Vector2Like): void;
@@ -50,8 +51,8 @@ export declare class QuadVector2VertexData extends QuadVertexData<Vector2Like> {
50
51
  clone(): QuadVector2VertexData;
51
52
  }
52
53
  export declare class QuadScalarVertexData extends QuadVertexData<number> {
53
- vertices: Record<QuadVerticies, number>;
54
- constructor(vertices?: Record<QuadVerticies, number>);
54
+ vertices: QuadDataType<number>;
55
+ constructor(vertices?: QuadDataType<number>);
55
56
  setFromQuadData(vertexData: QuadVertexData<number>): void;
56
57
  subtractFromVertex(vertex: QuadVerticies, value: number): void;
57
58
  addAll(value: number): void;
@@ -64,3 +65,4 @@ export declare class QuadScalarVertexData extends QuadVertexData<number> {
64
65
  isAllLessThan(value: number): boolean;
65
66
  clone(): QuadScalarVertexData;
66
67
  }
68
+ export {};