@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
@@ -68,22 +68,22 @@ export class QuadVertexData {
68
68
  };
69
69
  }
70
70
  clone() {
71
- return new QuadVertexData({
72
- [QuadVerticies.TopRight]: structuredClone(this.vertices[QuadVerticies.TopRight]),
73
- [QuadVerticies.TopLeft]: structuredClone(this.vertices[QuadVerticies.TopLeft]),
74
- [QuadVerticies.BottomLeft]: structuredClone(this.vertices[QuadVerticies.BottomLeft]),
75
- [QuadVerticies.BottomRight]: structuredClone(this.vertices[QuadVerticies.BottomRight]),
76
- });
71
+ return new QuadVertexData([
72
+ structuredClone(this.vertices[QuadVerticies.TopRight]),
73
+ structuredClone(this.vertices[QuadVerticies.TopLeft]),
74
+ structuredClone(this.vertices[QuadVerticies.BottomLeft]),
75
+ structuredClone(this.vertices[QuadVerticies.BottomRight]),
76
+ ]);
77
77
  }
78
78
  }
79
79
  export class QuadVec3ArrayVertexData extends QuadVertexData {
80
80
  vertices;
81
- constructor(vertices = {
82
- [QuadVerticies.TopRight]: [0, 0, 0],
83
- [QuadVerticies.TopLeft]: [0, 0, 0],
84
- [QuadVerticies.BottomLeft]: [0, 0, 0],
85
- [QuadVerticies.BottomRight]: [0, 0, 0],
86
- }) {
81
+ constructor(vertices = [
82
+ [0, 0, 0],
83
+ [0, 0, 0],
84
+ [0, 0, 0],
85
+ [0, 0, 0],
86
+ ]) {
87
87
  super(vertices);
88
88
  this.vertices = vertices;
89
89
  }
@@ -124,24 +124,22 @@ export class QuadVec3ArrayVertexData extends QuadVertexData {
124
124
  Vector3Like.EqualsArray(this.vertices[QuadVerticies.BottomRight], v1));
125
125
  }
126
126
  clone() {
127
- return new QuadVec3ArrayVertexData({
128
- [QuadVerticies.TopRight]: [...this.vertices[QuadVerticies.TopRight]],
129
- [QuadVerticies.TopLeft]: [...this.vertices[QuadVerticies.TopLeft]],
130
- [QuadVerticies.BottomLeft]: [...this.vertices[QuadVerticies.BottomLeft]],
131
- [QuadVerticies.BottomRight]: [
132
- ...this.vertices[QuadVerticies.BottomRight],
133
- ],
134
- });
127
+ return new QuadVec3ArrayVertexData([
128
+ [...this.vertices[QuadVerticies.TopRight]],
129
+ [...this.vertices[QuadVerticies.TopLeft]],
130
+ [...this.vertices[QuadVerticies.BottomLeft]],
131
+ [...this.vertices[QuadVerticies.BottomRight]],
132
+ ]);
135
133
  }
136
134
  }
137
135
  export class QuadVector3VertexData extends QuadVertexData {
138
136
  vertices;
139
- constructor(vertices = {
140
- [QuadVerticies.TopRight]: Vector3Like.Create(),
141
- [QuadVerticies.TopLeft]: Vector3Like.Create(),
142
- [QuadVerticies.BottomLeft]: Vector3Like.Create(),
143
- [QuadVerticies.BottomRight]: Vector3Like.Create(),
144
- }) {
137
+ constructor(vertices = [
138
+ Vector3Like.Create(),
139
+ Vector3Like.Create(),
140
+ Vector3Like.Create(),
141
+ Vector3Like.Create(),
142
+ ]) {
145
143
  super(vertices);
146
144
  this.vertices = vertices;
147
145
  }
@@ -182,22 +180,22 @@ export class QuadVector3VertexData extends QuadVertexData {
182
180
  Vector3Like.Equals(this.vertices[QuadVerticies.BottomRight], v1));
183
181
  }
184
182
  clone() {
185
- return new QuadVector3VertexData({
186
- [QuadVerticies.TopRight]: Vector3Like.Clone(this.vertices[QuadVerticies.TopRight]),
187
- [QuadVerticies.TopLeft]: Vector3Like.Clone(this.vertices[QuadVerticies.TopLeft]),
188
- [QuadVerticies.BottomLeft]: Vector3Like.Clone(this.vertices[QuadVerticies.BottomLeft]),
189
- [QuadVerticies.BottomRight]: Vector3Like.Clone(this.vertices[QuadVerticies.BottomRight]),
190
- });
183
+ return new QuadVector3VertexData([
184
+ Vector3Like.Clone(this.vertices[QuadVerticies.TopRight]),
185
+ Vector3Like.Clone(this.vertices[QuadVerticies.TopLeft]),
186
+ Vector3Like.Clone(this.vertices[QuadVerticies.BottomLeft]),
187
+ Vector3Like.Clone(this.vertices[QuadVerticies.BottomRight]),
188
+ ]);
191
189
  }
192
190
  }
193
191
  export class QuadVector2VertexData extends QuadVertexData {
194
192
  vertices;
195
- constructor(vertices = {
196
- [QuadVerticies.TopRight]: Vector2Like.Create(),
197
- [QuadVerticies.TopLeft]: Vector2Like.Create(),
198
- [QuadVerticies.BottomLeft]: Vector2Like.Create(),
199
- [QuadVerticies.BottomRight]: Vector2Like.Create(),
200
- }) {
193
+ constructor(vertices = [
194
+ Vector2Like.Create(),
195
+ Vector2Like.Create(),
196
+ Vector2Like.Create(),
197
+ Vector2Like.Create(),
198
+ ]) {
201
199
  super(vertices);
202
200
  this.vertices = vertices;
203
201
  }
@@ -238,22 +236,17 @@ export class QuadVector2VertexData extends QuadVertexData {
238
236
  Vector2Like.Equals(this.vertices[QuadVerticies.BottomRight], v1));
239
237
  }
240
238
  clone() {
241
- return new QuadVector2VertexData({
242
- [QuadVerticies.TopRight]: Vector2Like.Clone(this.vertices[QuadVerticies.TopRight]),
243
- [QuadVerticies.TopLeft]: Vector2Like.Clone(this.vertices[QuadVerticies.TopLeft]),
244
- [QuadVerticies.BottomLeft]: Vector2Like.Clone(this.vertices[QuadVerticies.BottomLeft]),
245
- [QuadVerticies.BottomRight]: Vector2Like.Clone(this.vertices[QuadVerticies.BottomRight]),
246
- });
239
+ return new QuadVector2VertexData([
240
+ Vector2Like.Clone(this.vertices[QuadVerticies.TopRight]),
241
+ Vector2Like.Clone(this.vertices[QuadVerticies.TopLeft]),
242
+ Vector2Like.Clone(this.vertices[QuadVerticies.BottomLeft]),
243
+ Vector2Like.Clone(this.vertices[QuadVerticies.BottomRight]),
244
+ ]);
247
245
  }
248
246
  }
249
247
  export class QuadScalarVertexData extends QuadVertexData {
250
248
  vertices;
251
- constructor(vertices = {
252
- [QuadVerticies.TopRight]: 0,
253
- [QuadVerticies.TopLeft]: 0,
254
- [QuadVerticies.BottomLeft]: 0,
255
- [QuadVerticies.BottomRight]: 0,
256
- }) {
249
+ constructor(vertices = [0, 0, 0, 0]) {
257
250
  super(vertices);
258
251
  this.vertices = vertices;
259
252
  }
@@ -339,11 +332,11 @@ export class QuadScalarVertexData extends QuadVertexData {
339
332
  return true;
340
333
  }
341
334
  clone() {
342
- return new QuadScalarVertexData({
343
- [QuadVerticies.TopRight]: this.vertices[QuadVerticies.TopRight],
344
- [QuadVerticies.TopLeft]: this.vertices[QuadVerticies.TopLeft],
345
- [QuadVerticies.BottomLeft]: this.vertices[QuadVerticies.BottomLeft],
346
- [QuadVerticies.BottomRight]: this.vertices[QuadVerticies.BottomRight],
347
- });
335
+ return new QuadScalarVertexData([
336
+ this.vertices[QuadVerticies.TopRight],
337
+ this.vertices[QuadVerticies.TopLeft],
338
+ this.vertices[QuadVerticies.BottomLeft],
339
+ this.vertices[QuadVerticies.BottomRight],
340
+ ]);
348
341
  }
349
342
  }
@@ -1,6 +1,6 @@
1
1
  import { Vector3Like } from "@amodx/math";
2
- import { VoxelMesherDataTool } from "../Tools/VoxelMesherDataTool";
2
+ import { VoxelModelBuilder } from "../Models/VoxelModelBuilder";
3
3
  import { Quad } from "./Primitives/Quad";
4
4
  export declare class VoxelGeometryBuilder {
5
- static addQuad(tool: VoxelMesherDataTool, origin: Vector3Like, quad: Quad): void;
6
5
  }
6
+ export declare function addVoxelQuad(tool: VoxelModelBuilder, origin: Vector3Like, quad: Quad): void;
@@ -1,208 +1,129 @@
1
- import { VoxelShaderData } from "../VoxelShaderData";
1
+ import { VoxelShaderData } from "./VoxelShaderData";
2
2
  import { QuadVerticies } from "./Geometry.types";
3
- import { VoxelMeshVertexConstants, VoxelMeshVertexStructCursor, } from "../../Mesher/Tools/VoxelMeshVertexStructCursor";
3
+ import { VoxelMeshVertexConstants, VoxelMeshVertexStructCursor, } from "./VoxelMeshVertexStructCursor";
4
4
  const empty = [];
5
5
  const structCursor = new VoxelMeshVertexStructCursor();
6
6
  export class VoxelGeometryBuilder {
7
- /* static addTriangle(
8
- tool: VoxelMesherDataTool,
9
- origin: Vector3Like,
10
- points: [Vec3Array, Vec3Array, Vec3Array],
11
- [[u1, v1], [u2, v2], [u3, v3]]: [Vec2Array, Vec2Array, Vec2Array]
12
- ) {
13
- if (!tool.mesh) return;
14
- const worldLight = tool.vars.light;
15
- const worldAO = tool.vars.ao;
16
- const texture = tool.vars.textureIndex;
17
- GeometryBuilder.addTriangle(tool, origin, points);
18
- {
19
- const attribute = tool.mesh.getAttribute("voxelData");
20
-
21
- attribute.push(
22
- VoxelShaderData.createAttribute(
23
- worldLight.vertices[1],
24
- worldAO.vertices[1],
25
- 0
26
- ),
27
- VoxelShaderData.createAttribute(
28
- worldLight.vertices[2],
29
- worldAO.vertices[2],
30
- 0
31
- ),
32
- VoxelShaderData.createAttribute(
33
- worldLight.vertices[3],
34
- worldAO.vertices[3],
35
- 9
36
- )
37
- );
38
- }
39
- {
40
- const uvs = tool.mesh.getAttribute("uv");
41
- uvs.push(u1, v1, texture, u2, v2, texture, u3, v3, texture);
42
- }
43
- {
44
- const uvs = tool.mesh.getAttribute("textureIndex");
45
-
46
- uvs.push(
47
- //v1
48
- 0,
49
- 0,
50
- 0,
51
- 0,
52
- //v2
53
- 0,
54
- 0,
55
- 0,
56
- 0,
57
- //v3
58
- 0,
59
- 0,
60
- 0,
61
- 0
62
- );
63
- }
64
- {
65
- const colors = tool.mesh.getAttribute("colors");
66
- colors.push(
67
- //v1
68
- 0,
69
- 0,
70
- 0,
71
- //v2
72
- 0,
73
- 0,
74
- 0,
75
- //v3
76
- 0,
77
- 0,
78
- 0
79
- );
80
- }
81
- } */
82
- static addQuad(tool, origin, quad) {
83
- if (!tool.mesh)
84
- return;
85
- const worldLight = tool.vars.light;
86
- const worldAO = tool.vars.ao;
87
- const animData = tool.vars.animation;
88
- const texture = tool.vars.textureIndex;
89
- const overlayTextures = tool.vars.overlayTextures;
90
- const topRightPos = quad.positions.vertices[0];
91
- const topLeftPos = quad.positions.vertices[1];
92
- const bottomLeftPos = quad.positions.vertices[2];
93
- const bottomRightPos = quad.positions.vertices[3];
94
- const topRightNor = quad.normals.vertices[0];
95
- const topLeftNor = quad.normals.vertices[1];
96
- const bottomLeftNor = quad.normals.vertices[2];
97
- const bottomRightNor = quad.normals.vertices[3];
98
- const topRightVoxelData = VoxelShaderData.createAttribute(worldLight.vertices[QuadVerticies.TopRight], worldAO.vertices[QuadVerticies.TopRight], animData.vertices[QuadVerticies.TopRight]);
99
- const topLeftVoxelData = VoxelShaderData.createAttribute(worldLight.vertices[QuadVerticies.TopLeft], worldAO.vertices[QuadVerticies.TopLeft], animData.vertices[QuadVerticies.TopLeft]);
100
- const bottomLeftVoxelData = VoxelShaderData.createAttribute(worldLight.vertices[QuadVerticies.BottomLeft], worldAO.vertices[QuadVerticies.BottomLeft], animData.vertices[QuadVerticies.BottomLeft]);
101
- const bottomRightVoxelData = VoxelShaderData.createAttribute(worldLight.vertices[QuadVerticies.BottomRight], worldAO.vertices[QuadVerticies.BottomRight], animData.vertices[QuadVerticies.BottomRight]);
102
- const indices = tool.mesh.indices;
103
- let indIndex = tool.mesh.indicieCount;
104
- let sides = quad.doubleSided ? 2 : 1;
105
- const flip = quad.flip;
106
- let orientation = quad.orientation;
107
- while (sides--) {
108
- const baseIndex = tool.mesh.vertexCount;
109
- if (!flip) {
110
- tool.mesh.buffer.setIndex(baseIndex);
111
- structCursor.data = tool.mesh.buffer.currentArray;
112
- structCursor.index = tool.mesh.buffer.curentIndex;
113
- addVertex(tool.mesh.buffer.curentIndex, tool.mesh.buffer.currentArray, origin, topRightPos, topRightNor, quad.uvs.vertices[QuadVerticies.TopRight], topRightVoxelData, texture, overlayTextures);
114
- tool.mesh.buffer.setIndex(baseIndex + 1);
115
- structCursor.data = tool.mesh.buffer.currentArray;
116
- structCursor.index = tool.mesh.buffer.curentIndex;
117
- addVertex(tool.mesh.buffer.curentIndex, tool.mesh.buffer.currentArray, origin, topLeftPos, topLeftNor, quad.uvs.vertices[QuadVerticies.TopLeft], topLeftVoxelData, texture, overlayTextures);
118
- tool.mesh.buffer.setIndex(baseIndex + 2);
119
- structCursor.data = tool.mesh.buffer.currentArray;
120
- structCursor.index = tool.mesh.buffer.curentIndex;
121
- addVertex(tool.mesh.buffer.curentIndex, tool.mesh.buffer.currentArray, origin, bottomLeftPos, bottomLeftNor, quad.uvs.vertices[QuadVerticies.BottomLeft], bottomLeftVoxelData, texture, overlayTextures);
122
- tool.mesh.buffer.setIndex(baseIndex + 3);
123
- structCursor.data = tool.mesh.buffer.currentArray;
124
- structCursor.index = tool.mesh.buffer.curentIndex;
125
- addVertex(tool.mesh.buffer.curentIndex, tool.mesh.buffer.currentArray, origin, bottomRightPos, bottomRightNor, quad.uvs.vertices[QuadVerticies.BottomRight], bottomRightVoxelData, texture, overlayTextures);
126
- }
127
- if (flip) {
128
- tool.mesh.buffer.setIndex(baseIndex);
129
- structCursor.data = tool.mesh.buffer.currentArray;
130
- structCursor.index = tool.mesh.buffer.curentIndex;
131
- addVertex(tool.mesh.buffer.curentIndex, tool.mesh.buffer.currentArray, origin, topLeftPos, topLeftNor, quad.uvs.vertices[QuadVerticies.TopLeft], topLeftVoxelData, texture, overlayTextures);
132
- tool.mesh.buffer.setIndex(baseIndex + 1);
133
- structCursor.data = tool.mesh.buffer.currentArray;
134
- structCursor.index = tool.mesh.buffer.curentIndex;
135
- addVertex(tool.mesh.buffer.curentIndex, tool.mesh.buffer.currentArray, origin, topRightPos, topRightNor, quad.uvs.vertices[QuadVerticies.TopRight], topRightVoxelData, texture, overlayTextures);
136
- tool.mesh.buffer.setIndex(baseIndex + 2);
137
- structCursor.data = tool.mesh.buffer.currentArray;
138
- structCursor.index = tool.mesh.buffer.curentIndex;
139
- addVertex(tool.mesh.buffer.curentIndex, tool.mesh.buffer.currentArray, origin, bottomRightPos, bottomRightNor, quad.uvs.vertices[QuadVerticies.BottomRight], bottomRightVoxelData, texture, overlayTextures);
140
- tool.mesh.buffer.setIndex(baseIndex + 3);
141
- structCursor.data = tool.mesh.buffer.currentArray;
142
- structCursor.index = tool.mesh.buffer.curentIndex;
143
- addVertex(tool.mesh.buffer.curentIndex, tool.mesh.buffer.currentArray, origin, bottomLeftPos, bottomLeftNor, quad.uvs.vertices[QuadVerticies.BottomLeft], bottomLeftVoxelData, texture, overlayTextures);
144
- }
145
- if (!orientation && !flip) {
146
- indices.setIndex(indIndex).currentArray[indices.curentIndex] =
147
- baseIndex;
148
- indices.setIndex(indIndex + 1).currentArray[indices.curentIndex] =
149
- baseIndex + 1;
150
- indices.setIndex(indIndex + 2).currentArray[indices.curentIndex] =
151
- baseIndex + 2;
152
- indices.setIndex(indIndex + 3).currentArray[indices.curentIndex] =
153
- baseIndex + 2;
154
- indices.setIndex(indIndex + 4).currentArray[indices.curentIndex] =
155
- baseIndex + 3;
156
- indices.setIndex(indIndex + 5).currentArray[indices.curentIndex] =
157
- baseIndex;
158
- }
159
- else if (!orientation && flip) {
160
- indices.setIndex(indIndex).currentArray[indices.curentIndex] =
161
- baseIndex;
162
- indices.setIndex(indIndex + 1).currentArray[indices.curentIndex] =
163
- baseIndex + 3;
164
- indices.setIndex(indIndex + 2).currentArray[indices.curentIndex] =
165
- baseIndex + 2;
166
- indices.setIndex(indIndex + 3).currentArray[indices.curentIndex] =
167
- baseIndex + 2;
168
- indices.setIndex(indIndex + 4).currentArray[indices.curentIndex] =
169
- baseIndex + 1;
170
- indices.setIndex(indIndex + 5).currentArray[indices.curentIndex] =
171
- baseIndex;
172
- }
173
- if (orientation && !flip) {
174
- indices.setIndex(indIndex).currentArray[indices.curentIndex] =
175
- baseIndex;
176
- indices.setIndex(indIndex + 1).currentArray[indices.curentIndex] =
177
- baseIndex + 3;
178
- indices.setIndex(indIndex + 2).currentArray[indices.curentIndex] =
179
- baseIndex + 2;
180
- indices.setIndex(indIndex + 3).currentArray[indices.curentIndex] =
181
- baseIndex + 2;
182
- indices.setIndex(indIndex + 4).currentArray[indices.curentIndex] =
183
- baseIndex + 1;
184
- indices.setIndex(indIndex + 5).currentArray[indices.curentIndex] =
185
- baseIndex;
186
- }
187
- else if (orientation && flip) {
188
- indices.setIndex(indIndex).currentArray[indices.curentIndex] =
189
- baseIndex;
190
- indices.setIndex(indIndex + 1).currentArray[indices.curentIndex] =
191
- baseIndex + 1;
192
- indices.setIndex(indIndex + 2).currentArray[indices.curentIndex] =
193
- baseIndex + 2;
194
- indices.setIndex(indIndex + 3).currentArray[indices.curentIndex] =
195
- baseIndex + 2;
196
- indices.setIndex(indIndex + 4).currentArray[indices.curentIndex] =
197
- baseIndex + 3;
198
- indices.setIndex(indIndex + 5).currentArray[indices.curentIndex] =
199
- baseIndex;
200
- }
201
- tool.mesh.addVerticies(4, 6);
7
+ }
8
+ export function addVoxelQuad(tool, origin, quad) {
9
+ if (!tool.mesh)
10
+ return;
11
+ const worldLight = tool.vars.light;
12
+ const worldAO = tool.vars.ao;
13
+ const animData = tool.vars.animation;
14
+ const texture = tool.vars.textureIndex;
15
+ const overlayTextures = tool.vars.overlayTextures;
16
+ const topRightPos = quad.positions.vertices[0];
17
+ const topLeftPos = quad.positions.vertices[1];
18
+ const bottomLeftPos = quad.positions.vertices[2];
19
+ const bottomRightPos = quad.positions.vertices[3];
20
+ const topRightNor = quad.normals.vertices[0];
21
+ const topLeftNor = quad.normals.vertices[1];
22
+ const bottomLeftNor = quad.normals.vertices[2];
23
+ const bottomRightNor = quad.normals.vertices[3];
24
+ const topRightVoxelData = VoxelShaderData.createAttribute(worldLight.vertices[QuadVerticies.TopRight], worldAO.vertices[QuadVerticies.TopRight], animData.vertices[QuadVerticies.TopRight]);
25
+ const topLeftVoxelData = VoxelShaderData.createAttribute(worldLight.vertices[QuadVerticies.TopLeft], worldAO.vertices[QuadVerticies.TopLeft], animData.vertices[QuadVerticies.TopLeft]);
26
+ const bottomLeftVoxelData = VoxelShaderData.createAttribute(worldLight.vertices[QuadVerticies.BottomLeft], worldAO.vertices[QuadVerticies.BottomLeft], animData.vertices[QuadVerticies.BottomLeft]);
27
+ const bottomRightVoxelData = VoxelShaderData.createAttribute(worldLight.vertices[QuadVerticies.BottomRight], worldAO.vertices[QuadVerticies.BottomRight], animData.vertices[QuadVerticies.BottomRight]);
28
+ const indices = tool.mesh.indices;
29
+ let indIndex = tool.mesh.indicieCount;
30
+ let sides = quad.doubleSided ? 2 : 1;
31
+ const flip = quad.flip;
32
+ let orientation = quad.orientation;
33
+ while (sides--) {
34
+ const baseIndex = tool.mesh.vertexCount;
35
+ if (!flip) {
36
+ tool.mesh.buffer.setIndex(baseIndex);
37
+ structCursor.data = tool.mesh.buffer.currentArray;
38
+ structCursor.index = tool.mesh.buffer.curentIndex;
39
+ addVertex(tool.mesh.buffer.curentIndex, tool.mesh.buffer.currentArray, origin, topRightPos, topRightNor, quad.uvs.vertices[QuadVerticies.TopRight], topRightVoxelData, texture, overlayTextures);
40
+ tool.mesh.buffer.setIndex(baseIndex + 1);
41
+ structCursor.data = tool.mesh.buffer.currentArray;
42
+ structCursor.index = tool.mesh.buffer.curentIndex;
43
+ addVertex(tool.mesh.buffer.curentIndex, tool.mesh.buffer.currentArray, origin, topLeftPos, topLeftNor, quad.uvs.vertices[QuadVerticies.TopLeft], topLeftVoxelData, texture, overlayTextures);
44
+ tool.mesh.buffer.setIndex(baseIndex + 2);
45
+ structCursor.data = tool.mesh.buffer.currentArray;
46
+ structCursor.index = tool.mesh.buffer.curentIndex;
47
+ addVertex(tool.mesh.buffer.curentIndex, tool.mesh.buffer.currentArray, origin, bottomLeftPos, bottomLeftNor, quad.uvs.vertices[QuadVerticies.BottomLeft], bottomLeftVoxelData, texture, overlayTextures);
48
+ tool.mesh.buffer.setIndex(baseIndex + 3);
49
+ structCursor.data = tool.mesh.buffer.currentArray;
50
+ structCursor.index = tool.mesh.buffer.curentIndex;
51
+ addVertex(tool.mesh.buffer.curentIndex, tool.mesh.buffer.currentArray, origin, bottomRightPos, bottomRightNor, quad.uvs.vertices[QuadVerticies.BottomRight], bottomRightVoxelData, texture, overlayTextures);
52
+ }
53
+ if (flip) {
54
+ tool.mesh.buffer.setIndex(baseIndex);
55
+ structCursor.data = tool.mesh.buffer.currentArray;
56
+ structCursor.index = tool.mesh.buffer.curentIndex;
57
+ addVertex(tool.mesh.buffer.curentIndex, tool.mesh.buffer.currentArray, origin, topLeftPos, topLeftNor, quad.uvs.vertices[QuadVerticies.TopLeft], topLeftVoxelData, texture, overlayTextures);
58
+ tool.mesh.buffer.setIndex(baseIndex + 1);
59
+ structCursor.data = tool.mesh.buffer.currentArray;
60
+ structCursor.index = tool.mesh.buffer.curentIndex;
61
+ addVertex(tool.mesh.buffer.curentIndex, tool.mesh.buffer.currentArray, origin, topRightPos, topRightNor, quad.uvs.vertices[QuadVerticies.TopRight], topRightVoxelData, texture, overlayTextures);
62
+ tool.mesh.buffer.setIndex(baseIndex + 2);
63
+ structCursor.data = tool.mesh.buffer.currentArray;
64
+ structCursor.index = tool.mesh.buffer.curentIndex;
65
+ addVertex(tool.mesh.buffer.curentIndex, tool.mesh.buffer.currentArray, origin, bottomRightPos, bottomRightNor, quad.uvs.vertices[QuadVerticies.BottomRight], bottomRightVoxelData, texture, overlayTextures);
66
+ tool.mesh.buffer.setIndex(baseIndex + 3);
67
+ structCursor.data = tool.mesh.buffer.currentArray;
68
+ structCursor.index = tool.mesh.buffer.curentIndex;
69
+ addVertex(tool.mesh.buffer.curentIndex, tool.mesh.buffer.currentArray, origin, bottomLeftPos, bottomLeftNor, quad.uvs.vertices[QuadVerticies.BottomLeft], bottomLeftVoxelData, texture, overlayTextures);
70
+ }
71
+ if (!orientation && !flip) {
72
+ indices.setIndex(indIndex).currentArray[indices.curentIndex] = baseIndex;
73
+ indices.setIndex(indIndex + 1).currentArray[indices.curentIndex] =
74
+ baseIndex + 1;
75
+ indices.setIndex(indIndex + 2).currentArray[indices.curentIndex] =
76
+ baseIndex + 2;
77
+ indices.setIndex(indIndex + 3).currentArray[indices.curentIndex] =
78
+ baseIndex + 2;
79
+ indices.setIndex(indIndex + 4).currentArray[indices.curentIndex] =
80
+ baseIndex + 3;
81
+ indices.setIndex(indIndex + 5).currentArray[indices.curentIndex] =
82
+ baseIndex;
83
+ }
84
+ else if (!orientation && flip) {
85
+ indices.setIndex(indIndex).currentArray[indices.curentIndex] = baseIndex;
86
+ indices.setIndex(indIndex + 1).currentArray[indices.curentIndex] =
87
+ baseIndex + 3;
88
+ indices.setIndex(indIndex + 2).currentArray[indices.curentIndex] =
89
+ baseIndex + 2;
90
+ indices.setIndex(indIndex + 3).currentArray[indices.curentIndex] =
91
+ baseIndex + 2;
92
+ indices.setIndex(indIndex + 4).currentArray[indices.curentIndex] =
93
+ baseIndex + 1;
94
+ indices.setIndex(indIndex + 5).currentArray[indices.curentIndex] =
95
+ baseIndex;
202
96
  }
97
+ if (orientation && !flip) {
98
+ indices.setIndex(indIndex).currentArray[indices.curentIndex] = baseIndex;
99
+ indices.setIndex(indIndex + 1).currentArray[indices.curentIndex] =
100
+ baseIndex + 3;
101
+ indices.setIndex(indIndex + 2).currentArray[indices.curentIndex] =
102
+ baseIndex + 2;
103
+ indices.setIndex(indIndex + 3).currentArray[indices.curentIndex] =
104
+ baseIndex + 2;
105
+ indices.setIndex(indIndex + 4).currentArray[indices.curentIndex] =
106
+ baseIndex + 1;
107
+ indices.setIndex(indIndex + 5).currentArray[indices.curentIndex] =
108
+ baseIndex;
109
+ }
110
+ else if (orientation && flip) {
111
+ indices.setIndex(indIndex).currentArray[indices.curentIndex] = baseIndex;
112
+ indices.setIndex(indIndex + 1).currentArray[indices.curentIndex] =
113
+ baseIndex + 1;
114
+ indices.setIndex(indIndex + 2).currentArray[indices.curentIndex] =
115
+ baseIndex + 2;
116
+ indices.setIndex(indIndex + 3).currentArray[indices.curentIndex] =
117
+ baseIndex + 2;
118
+ indices.setIndex(indIndex + 4).currentArray[indices.curentIndex] =
119
+ baseIndex + 3;
120
+ indices.setIndex(indIndex + 5).currentArray[indices.curentIndex] =
121
+ baseIndex;
122
+ }
123
+ tool.mesh.addVerticies(4, 6);
203
124
  }
204
125
  }
205
- const addVertex = (index, array, origin, position, normal, uvs, voxelData, texture, overlayTextures) => {
126
+ function addVertex(index, array, origin, position, normal, uvs, voxelData, texture, overlayTextures) {
206
127
  index *= VoxelMeshVertexConstants.VertexFloatSize;
207
128
  array[VoxelMeshVertexConstants.PositionOffset + index] =
208
129
  position.x + origin.x;
@@ -222,4 +143,4 @@ const addVertex = (index, array, origin, position, normal, uvs, voxelData, textu
222
143
  array[VoxelMeshVertexConstants.TextureIndexOffset + index + 2] =
223
144
  VoxelShaderData.createTextureIndex(overlayTextures.w, 0);
224
145
  array[VoxelMeshVertexConstants.VoxelDataOFfset + index] = voxelData;
225
- };
146
+ }
@@ -1,5 +1,5 @@
1
1
  import { Vector3Like } from "@amodx/math";
2
- import { VoxelVertexBuffer, VoxelIndiceBuffer } from "./Buffers";
2
+ import { VoxelVertexBuffer, VoxelIndiceBuffer } from "./VoxelMeshBuffers";
3
3
  export declare class VoxelMesh {
4
4
  indicieCount: number;
5
5
  vertexCount: number;
@@ -1,13 +1,13 @@
1
1
  import { Vector3Like } from "@amodx/math";
2
- import { VoxelVertexBuffer, VoxelIndiceBuffer } from "./Buffers";
3
- import { VoxelMeshVertexStructCursor } from "../Tools/VoxelMeshVertexStructCursor";
2
+ import { VoxelVertexBuffer, VoxelIndiceBuffer } from "./VoxelMeshBuffers";
3
+ import { VoxelMeshVertexStructCursor } from "./VoxelMeshVertexStructCursor";
4
4
  export class VoxelMesh {
5
5
  indicieCount = 0;
6
6
  vertexCount = 0;
7
7
  minBounds = Vector3Like.Create(Infinity, Infinity, Infinity);
8
8
  maxBounds = Vector3Like.Create(-Infinity, -Infinity, -Infinity);
9
- buffer = new VoxelVertexBuffer(VoxelMeshVertexStructCursor.VertexFloatSize, 1000);
10
- indices = new VoxelIndiceBuffer(1000);
9
+ buffer = new VoxelVertexBuffer(VoxelMeshVertexStructCursor.VertexFloatSize, 1024);
10
+ indices = new VoxelIndiceBuffer(1024);
11
11
  addVerticies(vertexCount, indicesCount) {
12
12
  this.vertexCount += vertexCount;
13
13
  this.indicieCount += indicesCount;
@@ -0,0 +1,16 @@
1
+ import { Vec3Array } from "@amodx/math";
2
+ import { VoxelMeshBVHStructCursor } from "./VoxelMeshBVHStructCursor";
3
+ import { FlatBinaryTreeIndex } from "../../Util/Binary/BinaryTree";
4
+ export declare class VoxelMeshBVHBuilder {
5
+ static AABBStructByteSize: number;
6
+ treeIndex: FlatBinaryTreeIndex;
7
+ tree: Float32Array;
8
+ structCursor: VoxelMeshBVHStructCursor;
9
+ indices: Uint32Array;
10
+ reset(): void;
11
+ getMeshBounds(): {
12
+ min: Vec3Array;
13
+ max: Vec3Array;
14
+ };
15
+ updateVoxel(voxelX: number, voxelY: number, voxelZ: number, meshIndex: number, indicesStart: number, indicesEnd: number, minX: number, minY: number, minZ: number, maxX: number, maxY: number, maxZ: number): void;
16
+ }
@@ -0,0 +1,51 @@
1
+ import { WorldSpaces } from "../../World/WorldSpaces";
2
+ import { VoxelMeshBVHStructCursor } from "./VoxelMeshBVHStructCursor";
3
+ import { FlatBinaryTreeIndex } from "../../Util/Binary/BinaryTree";
4
+ const MAX_FLOAT32 = new Float32Array([Infinity])[0];
5
+ export class VoxelMeshBVHBuilder {
6
+ static AABBStructByteSize = (4 + 4) * 4;
7
+ treeIndex = new FlatBinaryTreeIndex(13);
8
+ tree = new Float32Array(new ArrayBuffer(this.treeIndex.getTotalSize() * VoxelMeshBVHBuilder.AABBStructByteSize));
9
+ structCursor = new VoxelMeshBVHStructCursor(this.tree);
10
+ indices = new Uint32Array(this.treeIndex.getLevelSize(12) * 2);
11
+ reset() {
12
+ this.tree.fill(-MAX_FLOAT32);
13
+ this.indices.fill(0);
14
+ }
15
+ getMeshBounds() {
16
+ const leafIndex = this.treeIndex.getIndexAtLevel(0, 0);
17
+ return {
18
+ min: [
19
+ this.tree[leafIndex],
20
+ this.tree[leafIndex + 1],
21
+ this.tree[leafIndex + 2],
22
+ ],
23
+ max: [
24
+ this.tree[leafIndex + 4],
25
+ this.tree[leafIndex + 5],
26
+ this.tree[leafIndex + 6],
27
+ ],
28
+ };
29
+ }
30
+ updateVoxel(voxelX, voxelY, voxelZ, meshIndex, indicesStart, indicesEnd, minX, minY, minZ, maxX, maxY, maxZ) {
31
+ const voxelIndex = WorldSpaces.voxel.getIndex(voxelX, voxelY, voxelZ);
32
+ const leafIndex = this.treeIndex.getIndexAtLevel(12, voxelIndex);
33
+ this.indices[voxelIndex * 2] = indicesStart;
34
+ this.indices[voxelIndex * 2 + 1] = indicesEnd;
35
+ this.structCursor.setIndex(leafIndex);
36
+ this.structCursor.updateMin(minX, minY, minZ);
37
+ this.structCursor.updateMax(maxX, maxY, maxZ);
38
+ this.structCursor.setVoxelIndex(voxelIndex);
39
+ this.structCursor.setGeomtryNode();
40
+ let current = leafIndex;
41
+ for (let level = 1; level < 13; level++) {
42
+ let parentNode = this.treeIndex.getParent(current);
43
+ this.structCursor.setIndex(parentNode);
44
+ this.structCursor.updateMin(minX, minY, minZ);
45
+ this.structCursor.updateMax(maxX, maxY, maxZ);
46
+ this.structCursor.setActive();
47
+ this.structCursor.setInnerNode();
48
+ current = parentNode;
49
+ }
50
+ }
51
+ }
@@ -0,0 +1,22 @@
1
+ export declare class VoxelMeshBVHStructCursor {
2
+ data: Float32Array;
3
+ get minX(): number;
4
+ get minY(): number;
5
+ get minZ(): number;
6
+ get maxX(): number;
7
+ get maxY(): number;
8
+ get maxZ(): number;
9
+ get voxelIndex(): number;
10
+ get active(): number;
11
+ get nodeType(): number;
12
+ trueIndex: number;
13
+ private index;
14
+ setIndex(index: number): void;
15
+ constructor(data: Float32Array);
16
+ setActive(): void;
17
+ setVoxelIndex(value: number): void;
18
+ setInnerNode(): void;
19
+ setGeomtryNode(): void;
20
+ updateMin(x: number, y: number, z: number): void;
21
+ updateMax(x: number, y: number, z: number): void;
22
+ }