@divinevoxel/vlox 0.0.76 → 0.0.78

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 (315) hide show
  1. package/Builder/Tools/Brush/BrushTool.d.ts +16 -9
  2. package/Builder/Tools/Brush/BrushTool.js +258 -52
  3. package/Builder/Tools/BuilderToolBase.d.ts +36 -0
  4. package/Builder/Tools/BuilderToolBase.js +39 -0
  5. package/Builder/Tools/Hand/HandTool.d.ts +9 -7
  6. package/Builder/Tools/Hand/HandTool.js +40 -23
  7. package/Builder/Tools/Path/PahtTool.d.ts +12 -7
  8. package/Builder/Tools/Path/PahtTool.js +32 -21
  9. package/Builder/Tools/Sculpt/SculptTool.d.ts +34 -0
  10. package/Builder/Tools/Sculpt/SculptTool.js +102 -0
  11. package/Builder/Tools/Shape/ShapeTool.d.ts +32 -0
  12. package/Builder/Tools/Shape/ShapeTool.js +78 -0
  13. package/Builder/Tools/Template/TemplateTool.d.ts +35 -0
  14. package/Builder/Tools/Template/TemplateTool.js +73 -0
  15. package/Builder/Tools/Wand/WandTool.d.ts +9 -7
  16. package/Builder/Tools/Wand/WandTool.js +43 -20
  17. package/Builder/Tools/Wrench/WrenchTool.d.ts +7 -7
  18. package/Builder/Tools/Wrench/WrenchTool.js +22 -13
  19. package/Builder/Util/FreeBoxSelection.d.ts +12 -0
  20. package/Builder/Util/FreeBoxSelection.js +21 -0
  21. package/Builder/Util/FreePointSelection.d.ts +14 -0
  22. package/Builder/Util/FreePointSelection.js +39 -0
  23. package/Builder/Util/SurfaceBoxSelection.d.ts +12 -0
  24. package/Builder/{Tools/Box/BoxSelection.js → Util/SurfaceBoxSelection.js} +1 -3
  25. package/Builder/VoxelBuildSpace.d.ts +37 -25
  26. package/Builder/VoxelBuildSpace.js +99 -40
  27. package/Builder/World/InitTasks.js +17 -22
  28. package/Mesher/Geomtry/Proto/ProtoMesh.d.ts +18 -0
  29. package/Mesher/Geomtry/Proto/ProtoMesh.js +73 -0
  30. package/Mesher/Geomtry/{VoxelMeshBuffers.d.ts → Proto/ProtoMeshBuffer.d.ts} +2 -2
  31. package/Mesher/Geomtry/{VoxelMeshBuffers.js → Proto/ProtoMeshBuffer.js} +2 -2
  32. package/Mesher/Geomtry/Shapes/Box.d.ts +2 -9
  33. package/Mesher/Geomtry/Shapes/Box.js +7 -12
  34. package/Mesher/Geomtry/Transform/TransformBox.js +5 -2
  35. package/Mesher/InitMesher.js +4 -4
  36. package/Mesher/InitTask.js +2 -2
  37. package/Mesher/Items/Base/CompactItemMesh.d.ts +3 -0
  38. package/Mesher/Items/Base/CompactItemMesh.js +20 -0
  39. package/Mesher/Items/Geomtry/ItemGeometryBuilder.d.ts +5 -0
  40. package/Mesher/Items/Geomtry/ItemGeometryBuilder.js +131 -0
  41. package/Mesher/Items/Geomtry/ItemMeshVertexStructCursor.d.ts +48 -0
  42. package/Mesher/Items/Geomtry/ItemMeshVertexStructCursor.js +114 -0
  43. package/Mesher/Items/MeshTexture.d.ts +1 -0
  44. package/Mesher/Items/MeshTexture.js +214 -0
  45. package/Mesher/Items/MeshTextureO.js +277 -0
  46. package/Mesher/Items/Models/ItemModelBuilder.d.ts +27 -0
  47. package/Mesher/Items/Models/ItemModelBuilder.js +64 -0
  48. package/Mesher/Types/ItemMesh.types.d.ts +5 -0
  49. package/Mesher/Types/ItemMesh.types.js +12 -0
  50. package/Mesher/Types/Mesher.types.d.ts +15 -9
  51. package/Mesher/Types/Mesher.types.js +14 -0
  52. package/Mesher/Types/VoxelMesh.types.js +7 -6
  53. package/Mesher/Voxels/Base/CompactTemplateMesh.d.ts +3 -0
  54. package/Mesher/{Functions/CompactVoxelMesh.js → Voxels/Base/CompactTemplateMesh.js} +4 -40
  55. package/Mesher/{Functions → Voxels/Base}/CompactVoxelSectionMesh.d.ts +2 -2
  56. package/Mesher/{Functions → Voxels}/Base/MeshSectionBase.d.ts +1 -1
  57. package/Mesher/{Functions → Voxels}/Base/MeshSectionBase.js +9 -8
  58. package/Mesher/{Geomtry → Voxels/Geomtry}/CompactedSectionVoxelMesh.d.ts +1 -1
  59. package/Mesher/{Geomtry → Voxels/Geomtry}/CompactedSectionVoxelMesh.js +1 -1
  60. package/Mesher/{Geomtry → Voxels/Geomtry}/VoxelGeometryBuilder.d.ts +2 -2
  61. package/Mesher/{Geomtry → Voxels/Geomtry}/VoxelGeometryBuilder.js +1 -1
  62. package/Mesher/{Geomtry → Voxels/Geomtry}/VoxelMeshBVHBuilder.d.ts +1 -1
  63. package/Mesher/{Geomtry → Voxels/Geomtry}/VoxelMeshBVHBuilder.js +2 -2
  64. package/Mesher/Voxels/MeshTemplate.d.ts +3 -0
  65. package/Mesher/Voxels/MeshTemplate.js +81 -0
  66. package/Mesher/{Functions → Voxels}/MeshVoxel.d.ts +1 -1
  67. package/Mesher/{Functions → Voxels}/MeshVoxel.js +4 -4
  68. package/Mesher/{Models → Voxels/Models}/Common/Calc/CalcConstants.d.ts +2 -2
  69. package/Mesher/{Models → Voxels/Models}/Common/Calc/CalcConstants.js +4 -4
  70. package/Mesher/{Models → Voxels/Models}/Common/Calc/FaceDataCalc.d.ts +1 -1
  71. package/Mesher/{Models → Voxels/Models}/Common/Calc/FaceDataCalc.js +2 -2
  72. package/Mesher/{Models → Voxels/Models}/Common/Faces/CullRulledFace.js +1 -1
  73. package/Mesher/{Models → Voxels/Models}/Common/Faces/ShadeRulelessFace.d.ts +1 -1
  74. package/Mesher/{Models → Voxels/Models}/Common/Faces/ShadeRulledFace.d.ts +1 -1
  75. package/Mesher/{Models → Voxels/Models}/Common/Faces/ShadeRulledFace.js +1 -1
  76. package/Mesher/{Models → Voxels/Models}/Common/GetTexture.d.ts +3 -3
  77. package/Mesher/{Models → Voxels/Models}/Nodes/Custom/Liquid/FlowGradient.d.ts +1 -1
  78. package/Mesher/{Models → Voxels/Models}/Nodes/Custom/Liquid/FlowGradient.js +1 -1
  79. package/Mesher/{Models → Voxels/Models}/Nodes/Custom/Liquid/LiquidGeomtryNode.d.ts +3 -3
  80. package/Mesher/{Models → Voxels/Models}/Nodes/Custom/Liquid/LiquidGeomtryNode.js +14 -16
  81. package/Mesher/{Models → Voxels/Models}/Nodes/Default/QuadVoxelGeometryNode.d.ts +2 -2
  82. package/Mesher/{Models → Voxels/Models}/Nodes/Default/QuadVoxelGeometryNode.js +1 -1
  83. package/Mesher/{Models → Voxels/Models}/Nodes/Default/TriangleVoxelGeometryNode.d.ts +2 -2
  84. package/Mesher/{Models → Voxels/Models}/Nodes/Default/TriangleVoxelGeometryNode.js +1 -1
  85. package/Mesher/{Models → Voxels/Models}/Nodes/Types/QuadVoxelGometryNodeTypes.d.ts +2 -2
  86. package/Mesher/{Models → Voxels/Models}/Nodes/Types/TriangleVoxelGometryNodeTypes.d.ts +1 -1
  87. package/Mesher/{Models → Voxels/Models}/Nodes/VoxelGeometryConstructor.d.ts +2 -2
  88. package/Mesher/Voxels/Models/Procedures/Default/ConsistentRotationTextureProcedure.d.ts +24 -0
  89. package/Mesher/{Models → Voxels/Models}/Procedures/Default/ConsistentRotationTextureProcedure.js +2 -2
  90. package/Mesher/{Models → Voxels/Models}/Procedures/Default/OutlinedTextureProcedure.d.ts +4 -5
  91. package/Mesher/Voxels/Models/Procedures/Default/OutlinedTextureProcedure.js +205 -0
  92. package/Mesher/Voxels/Models/Procedures/Default/PillarTextureProcedure.d.ts +28 -0
  93. package/Mesher/Voxels/Models/Procedures/Default/PillarTextureProcedure.js +109 -0
  94. package/Mesher/{Models → Voxels/Models}/Procedures/TextureProcedure.d.ts +3 -3
  95. package/Mesher/{Models → Voxels/Models}/Procedures/TextureProcedureRegister.js +2 -0
  96. package/Mesher/{Models → Voxels/Models}/VoxelConstructor.d.ts +4 -4
  97. package/Mesher/{Models → Voxels/Models}/VoxelConstructor.js +3 -3
  98. package/Mesher/{Models → Voxels/Models}/VoxelGeometryBuilderCacheSpace.d.ts +2 -2
  99. package/Mesher/{Models → Voxels/Models}/VoxelGeometryBuilderCacheSpace.js +2 -2
  100. package/Mesher/{Models → Voxels/Models}/VoxelModelBuilder.d.ts +7 -7
  101. package/Mesher/{Models → Voxels/Models}/VoxelModelBuilder.js +6 -5
  102. package/Mesher/{Models → Voxels/Models}/VoxelModelConstructorRegister.d.ts +4 -4
  103. package/Mesher/{Models → Voxels/Models}/VoxelModelConstructorRegister.js +2 -2
  104. package/Mesher/{Models → Voxels/Models}/VoxelModelEffect.d.ts +1 -1
  105. package/Mesher/{Models → Voxels/Models}/VoxelModelEffect.js +1 -1
  106. package/Renderer/Classes/DVESectionMeshes.d.ts +1 -1
  107. package/Renderer/MeshManager.js +1 -1
  108. package/Settings/EngineSettings.types.d.ts +2 -1
  109. package/Settings/EngineSettings.types.js +3 -1
  110. package/Tasks/Paint/Common.js +14 -9
  111. package/Tasks/Paint/Erase/EraseVoxelSelection.d.ts +4 -0
  112. package/Tasks/Paint/Erase/EraseVoxelSelection.js +33 -0
  113. package/Tasks/Paint/Erase/EraseVoxelTemplate.js +1 -2
  114. package/Tasks/Paint/Paint/PaintVoxel.js +1 -1
  115. package/Tasks/Paint/Paint/PaintVoxelTemplate.js +1 -1
  116. package/Tasks/Propagation/Illumanation/RGBUpdate.js +1 -1
  117. package/Tasks/Tasks.types.d.ts +2 -0
  118. package/Tasks/TasksIds.d.ts +1 -0
  119. package/Tasks/TasksIds.js +1 -0
  120. package/Tasks/WorldGeneration/InitTasks.js +3 -1
  121. package/Templates/Archive/ArchivedVoxelTemplate.d.ts +5 -5
  122. package/Templates/Archive/ArchivedVoxelTemplate.js +52 -49
  123. package/Templates/Archive/Functions/CreateArchivedTemplate.js +0 -2
  124. package/Templates/Archive/Functions/ExportArchiedTemplateJSON.js +0 -1
  125. package/Templates/Archive/Functions/ImportArchivedTemplateJSON.js +0 -2
  126. package/Templates/Cursor/TemplateCursor.d.ts +6 -1
  127. package/Templates/Cursor/TemplateCursor.js +13 -2
  128. package/Templates/Cursor/TemplateProxy.js +1 -6
  129. package/Templates/Cursor/TemplateVoxelCursor.d.ts +1 -0
  130. package/Templates/Cursor/TemplateVoxelCursor.js +6 -0
  131. package/Templates/Full/FullVoxelTemplate.d.ts +4 -4
  132. package/Templates/Full/FullVoxelTemplate.js +29 -18
  133. package/Templates/Functions/ExtrudeSelection.d.ts +5 -0
  134. package/Templates/Functions/ExtrudeSelection.js +44 -0
  135. package/Templates/Functions/FillSelection.d.ts +4 -0
  136. package/Templates/Functions/FillSelection.js +20 -0
  137. package/Templates/Functions/FlipTemplate.d.ts +2 -2
  138. package/Templates/Functions/FlipTemplate.js +8 -8
  139. package/Templates/Functions/RotateTemplate.d.ts +2 -2
  140. package/Templates/Path/VoxelPath.js +2 -1
  141. package/Templates/Selection/VoxelBFSSelection.d.ts +3 -6
  142. package/Templates/Selection/VoxelBFSSelection.js +20 -24
  143. package/Templates/Selection/{VoxelBoxSelection.d.ts → VoxelBoundsSelection.d.ts} +9 -6
  144. package/Templates/Selection/{VoxelBoxSelection.js → VoxelBoundsSelection.js} +29 -22
  145. package/Templates/Selection/VoxelPointSelection.d.ts +8 -6
  146. package/Templates/Selection/VoxelPointSelection.js +25 -24
  147. package/Templates/Selection/VoxelSelection.d.ts +18 -0
  148. package/Templates/Selection/VoxelSurfaceSelection.d.ts +5 -12
  149. package/Templates/Selection/VoxelSurfaceSelection.js +76 -90
  150. package/Templates/Selection/VoxelTemplateSelection.d.ts +10 -4
  151. package/Templates/Selection/VoxelTemplateSelection.js +18 -10
  152. package/Templates/Shapes/Selections/BoxVoxelShapeSelection.d.ts +28 -0
  153. package/Templates/Shapes/Selections/BoxVoxelShapeSelection.js +77 -0
  154. package/Templates/Shapes/Selections/ConeVoxelShapeSelection.d.ts +28 -0
  155. package/Templates/Shapes/Selections/ConeVoxelShapeSelection.js +77 -0
  156. package/Templates/Shapes/Selections/CylinderVoxelShapeSelection.d.ts +28 -0
  157. package/Templates/Shapes/Selections/CylinderVoxelShapeSelection.js +77 -0
  158. package/Templates/Shapes/Selections/EllipsoidVoxelShapeSelection.d.ts +28 -0
  159. package/Templates/Shapes/Selections/EllipsoidVoxelShapeSelection.js +92 -0
  160. package/Templates/Shapes/Selections/OctahedronVoxelShapeSelection.d.ts +28 -0
  161. package/Templates/Shapes/Selections/OctahedronVoxelShapeSelection.js +76 -0
  162. package/Templates/Shapes/Selections/PyramidVoxelShapeSelection.d.ts +37 -0
  163. package/Templates/Shapes/Selections/PyramidVoxelShapeSelection.js +137 -0
  164. package/Templates/Shapes/Selections/SphereVoxelShapeSelection.d.ts +20 -0
  165. package/Templates/Shapes/Selections/SphereVoxelShapeSelection.js +61 -0
  166. package/Templates/Shapes/Selections/TorusVoxelShapeSelection.d.ts +28 -0
  167. package/Templates/Shapes/Selections/TorusVoxelShapeSelection.js +76 -0
  168. package/Templates/Shapes/Selections/VoxelShapeSelection.d.ts +5 -0
  169. package/Templates/Shapes/Selections/VoxelShapeSelection.js +1 -0
  170. package/Templates/Shapes/VoxelShape.types.d.ts +2 -0
  171. package/Templates/Shapes/VoxelShape.types.js +8 -0
  172. package/Templates/Shapes/VoxelShapeTemplate.d.ts +37 -0
  173. package/Templates/Shapes/{BasicVoxelShapeTemplate.js → VoxelShapeTemplate.js} +43 -37
  174. package/Templates/Shapes/VoxelShapeTemplate.types.d.ts +4 -13
  175. package/Templates/Shapes/VoxelShapeTemplate.types.js +0 -1
  176. package/Templates/{VoxelTempateRegister.d.ts → VoxelTemplateRegister.d.ts} +4 -0
  177. package/Templates/VoxelTemplateRegister.js +60 -0
  178. package/Templates/VoxelTemplates.types.d.ts +2 -3
  179. package/Textures/Classes/CompiledTexture.d.ts +2 -0
  180. package/Textures/Classes/CompiledTexture.js +19 -1
  181. package/Textures/Functions/BuildTextureData.js +13 -0
  182. package/Textures/TextureManager.d.ts +1 -0
  183. package/Textures/TextureManager.js +11 -5
  184. package/Tools/Brush/Brush.d.ts +2 -0
  185. package/Tools/Brush/Brush.js +19 -0
  186. package/Tools/Tasks/TasksTool.d.ts +2 -1
  187. package/Tools/Tasks/TasksTool.js +2 -0
  188. package/Voxels/Cursor/DataCursor.interface.d.ts +4 -0
  189. package/Voxels/Cursor/VoxelLightData.js +2 -2
  190. package/Voxels/Functions/BuildTagData.js +1 -1
  191. package/Voxels/Indexes/VoxelIndex.d.ts +1 -0
  192. package/Voxels/Indexes/VoxelIndex.js +11 -13
  193. package/Voxels/InitVoxelData.js +5 -14
  194. package/Voxels/Interaction/Functions/PickVoxel.d.ts +0 -5
  195. package/Voxels/Interaction/Functions/PickVoxel.js +64 -85
  196. package/Voxels/Interaction/Functions/PickVoxelWorld.js +6 -3
  197. package/Voxels/Models/CompiledVoxelModel.types.d.ts +1 -1
  198. package/Voxels/Models/Defaults/CubeVoxelGeometry.js +11 -0
  199. package/Voxels/Models/Defaults/CubeVoxelModels.js +44 -99
  200. package/Voxels/Models/Defaults/PanelVoxelGeometry.d.ts +1 -3
  201. package/Voxels/Models/Defaults/PanelVoxelGeometry.js +2 -226
  202. package/Voxels/Models/Defaults/PanelVoxelModels.d.ts +1 -0
  203. package/Voxels/Models/Defaults/PanelVoxelModels.js +100 -258
  204. package/Voxels/Models/Defaults/StairVoxelModel.js +2 -2
  205. package/Voxels/Models/Rules/Classes/GeomtryInput.d.ts +4 -1
  206. package/Voxels/Models/Rules/Classes/GeomtryInput.js +26 -5
  207. package/Voxels/Models/Rules/Classes/VoxelRulesGeometry.d.ts +1 -1
  208. package/Voxels/Models/Rules/Functions/BuildFinalInputs.js +23 -8
  209. package/Voxels/Models/Rules/Functions/Compile/CompileGeomtryNodes.d.ts +1 -1
  210. package/Voxels/Models/Rules/Functions/Compile/Nodes/CompileBoxGeometryNode.d.ts +1 -1
  211. package/Voxels/Models/Rules/Functions/Compile/Nodes/CompileQuadGeometryNode.d.ts +1 -1
  212. package/Voxels/Models/Rules/Functions/Compile/Nodes/CompileQuadGeometryNode.js +1 -1
  213. package/Voxels/Models/Rules/Functions/Compile/Nodes/CompileTriangleGeometryNode.d.ts +1 -1
  214. package/Voxels/Models/Rules/Functions/Compile/Nodes/CompileTriangleGeometryNode.js +1 -1
  215. package/Voxels/Models/VoxelModel.types.d.ts +6 -1
  216. package/Voxels/Types/PaintVoxelData.d.ts +2 -0
  217. package/Voxels/Types/PaintVoxelData.js +51 -0
  218. package/World/Cursor/SectionCursor.d.ts +4 -0
  219. package/World/Cursor/SectionCursor.js +13 -16
  220. package/World/Cursor/SectorCursor.d.ts +4 -0
  221. package/World/Cursor/SectorCursor.js +13 -16
  222. package/World/Cursor/WorldCursor.d.ts +4 -0
  223. package/World/Cursor/WorldCursor.js +8 -0
  224. package/World/Sector/SectorHeightMap.d.ts +6 -0
  225. package/World/Sector/SectorHeightMap.js +6 -0
  226. package/World/SnapShot/SectionSnapShotCursor.d.ts +3 -0
  227. package/World/SnapShot/SectionSnapShotCursor.js +6 -0
  228. package/World/WorldSpaces.js +3 -3
  229. package/WorldSimulation/Dimensions/DimensionSimulation.d.ts +5 -1
  230. package/WorldSimulation/Dimensions/DimensionSimulation.js +12 -0
  231. package/WorldSimulation/Dimensions/Generator.d.ts +1 -0
  232. package/WorldSimulation/Dimensions/Generator.js +1 -0
  233. package/WorldSimulation/Dimensions/SimulationSector.d.ts +3 -0
  234. package/WorldSimulation/Dimensions/SimulationSector.js +71 -41
  235. package/WorldSimulation/Internal/WorldSimulationTasks.js +5 -2
  236. package/WorldSimulation/Procedures/BuildOnly.d.ts +10 -0
  237. package/WorldSimulation/Procedures/BuildOnly.js +55 -0
  238. package/WorldSimulation/Procedures/InitalLoad.js +3 -0
  239. package/WorldSimulation/Tasks/SimulationTaskBase.d.ts +2 -0
  240. package/WorldSimulation/Tasks/SimulationTaskBase.js +11 -3
  241. package/WorldSimulation/Tasks/TaskSegment.d.ts +2 -1
  242. package/WorldSimulation/Tasks/TaskSegment.js +3 -1
  243. package/WorldSimulation/Tick/TickQueue.d.ts +2 -0
  244. package/WorldSimulation/Tick/TickQueue.js +26 -0
  245. package/WorldSimulation/Tools/SimulationBrush.d.ts +3 -0
  246. package/WorldSimulation/Tools/SimulationBrush.js +52 -0
  247. package/WorldSimulation/Voxels/Behaviors/Types/DefaultVoxelBehavior.js +3 -0
  248. package/WorldSimulation/Voxels/Behaviors/Types/LiquidVoxelBehavior.js +21 -1
  249. package/WorldSimulation/Voxels/Behaviors/VoxelBehaviors.d.ts +2 -0
  250. package/WorldSimulation/Voxels/Behaviors/VoxelBehaviors.js +6 -0
  251. package/WorldSimulation/Voxels/Ticks/Types/LiquidVoxelUpdate.js +39 -14
  252. package/WorldSimulation/WorldSimulation.d.ts +10 -0
  253. package/WorldSimulation/WorldSimulation.js +41 -1
  254. package/package.json +1 -30
  255. package/Builder/Tools/Box/BoxSelection.d.ts +0 -12
  256. package/Builder/Tools/Box/BoxTool.d.ts +0 -31
  257. package/Builder/Tools/Box/BoxTool.js +0 -91
  258. package/Builder/Tools/Box/BoxToolTemplate.d.ts +0 -13
  259. package/Builder/Tools/Box/BoxToolTemplate.js +0 -23
  260. package/Builder/VoxelBuilder.types.d.ts +0 -0
  261. package/Builder/VoxelBuilder.types.js +0 -1
  262. package/Mesher/Functions/CompactVoxelMesh.d.ts +0 -3
  263. package/Mesher/Functions/MeshTexture.js +0 -278
  264. package/Mesher/Geomtry/VoxelMesh.d.ts +0 -12
  265. package/Mesher/Geomtry/VoxelMesh.js +0 -25
  266. package/Mesher/Models/Procedures/Default/ConsistentRotationTextureProcedure.d.ts +0 -25
  267. package/Mesher/Models/Procedures/Default/OutlinedTextureProcedure.js +0 -162
  268. package/Templates/Selection/VoxelSelecton.d.ts +0 -9
  269. package/Templates/Shapes/BasicVoxelShapeTemplate.d.ts +0 -36
  270. package/Templates/Shapes/BoxVoxelTemplate.d.ts +0 -23
  271. package/Templates/Shapes/BoxVoxelTemplate.js +0 -83
  272. package/Templates/Shapes/ConeVoxelTemplate.d.ts +0 -23
  273. package/Templates/Shapes/ConeVoxelTemplate.js +0 -73
  274. package/Templates/Shapes/CylinderVoxelTemplate.d.ts +0 -23
  275. package/Templates/Shapes/CylinderVoxelTemplate.js +0 -73
  276. package/Templates/Shapes/EllipsoidVoxelTemplate.d.ts +0 -23
  277. package/Templates/Shapes/EllipsoidVoxelTemplate.js +0 -89
  278. package/Templates/Shapes/OctahedronVoxelTemplate.d.ts +0 -23
  279. package/Templates/Shapes/OctahedronVoxelTemplate.js +0 -73
  280. package/Templates/Shapes/PyramidVoxelTemplate.d.ts +0 -31
  281. package/Templates/Shapes/PyramidVoxelTemplate.js +0 -148
  282. package/Templates/Shapes/SphereVoxelTemplate.d.ts +0 -15
  283. package/Templates/Shapes/SphereVoxelTemplate.js +0 -59
  284. package/Templates/Shapes/TorusVoxelTemplate.d.ts +0 -23
  285. package/Templates/Shapes/TorusVoxelTemplate.js +0 -73
  286. package/Templates/VoxelTempateRegister.js +0 -30
  287. /package/Mesher/{Functions/MeshTexture.d.ts → Items/MeshTextureO.d.ts} +0 -0
  288. /package/Mesher/{Functions → Voxels/Base}/CompactVoxelSectionMesh.js +0 -0
  289. /package/Mesher/{Geomtry → Voxels/Geomtry}/VoxelMeshBVHStructCursor.d.ts +0 -0
  290. /package/Mesher/{Geomtry → Voxels/Geomtry}/VoxelMeshBVHStructCursor.js +0 -0
  291. /package/Mesher/{Geomtry → Voxels/Geomtry}/VoxelMeshVertexStructCursor.d.ts +0 -0
  292. /package/Mesher/{Geomtry → Voxels/Geomtry}/VoxelMeshVertexStructCursor.js +0 -0
  293. /package/Mesher/{Geomtry → Voxels/Geomtry}/VoxelShaderData.d.ts +0 -0
  294. /package/Mesher/{Geomtry → Voxels/Geomtry}/VoxelShaderData.js +0 -0
  295. /package/Mesher/{Functions → Voxels}/MeshSection.d.ts +0 -0
  296. /package/Mesher/{Functions → Voxels}/MeshSection.js +0 -0
  297. /package/Mesher/{Functions → Voxels}/MeshSectionSnapShot.d.ts +0 -0
  298. /package/Mesher/{Functions → Voxels}/MeshSectionSnapShot.js +0 -0
  299. /package/Mesher/{Models → Voxels/Models}/Common/Faces/CullRulledFace.d.ts +0 -0
  300. /package/Mesher/{Models → Voxels/Models}/Common/Faces/ShadeRulelessFace.js +0 -0
  301. /package/Mesher/{Models → Voxels/Models}/Common/GetTexture.js +0 -0
  302. /package/Mesher/{Models → Voxels/Models}/Nodes/Custom/index.d.ts +0 -0
  303. /package/Mesher/{Models → Voxels/Models}/Nodes/Custom/index.js +0 -0
  304. /package/Mesher/{Models → Voxels/Models}/Nodes/GeometryNode.d.ts +0 -0
  305. /package/Mesher/{Models → Voxels/Models}/Nodes/GeometryNode.js +0 -0
  306. /package/Mesher/{Models → Voxels/Models}/Nodes/Types/GeomtryNode.types.d.ts +0 -0
  307. /package/Mesher/{Models → Voxels/Models}/Nodes/Types/GeomtryNode.types.js +0 -0
  308. /package/Mesher/{Models → Voxels/Models}/Nodes/Types/QuadVoxelGometryNodeTypes.js +0 -0
  309. /package/Mesher/{Models → Voxels/Models}/Nodes/Types/TriangleVoxelGometryNodeTypes.js +0 -0
  310. /package/Mesher/{Models → Voxels/Models}/Nodes/VoxelGeometryConstructor.js +0 -0
  311. /package/Mesher/{Models → Voxels/Models}/Procedures/TextureProcedure.js +0 -0
  312. /package/Mesher/{Models → Voxels/Models}/Procedures/TextureProcedureRegister.d.ts +0 -0
  313. /package/Mesher/{Models → Voxels/Models}/RenderedMaterials.d.ts +0 -0
  314. /package/Mesher/{Models → Voxels/Models}/RenderedMaterials.js +0 -0
  315. /package/Templates/Selection/{VoxelSelecton.js → VoxelSelection.js} +0 -0
@@ -1,7 +1,7 @@
1
1
  import { Quad } from "../../../../../../Mesher/Geomtry/Primitives/Quad";
2
2
  import { getQuadWeights, mapQuadUvs } from "./CalcFunctions";
3
3
  import { TransformQuad } from "../../../../../../Mesher/Geomtry/Transform/TransformQuad";
4
- import { QuadVoxelGometryInputs, } from "../../../../../../Mesher/Models/Nodes/Types/QuadVoxelGometryNodeTypes";
4
+ import { QuadVoxelGometryInputs, } from "../../../../../../Mesher/Voxels/Models/Nodes/Types/QuadVoxelGometryNodeTypes";
5
5
  import { OcclusionFaceRegister } from "../../../Classes/OcclusionFaceRegister";
6
6
  import { closestVoxelFace } from "../../../../../../Math/UtilFunctions";
7
7
  export function CompileQuadGeometryNode(buildRules, input, points, node, transform = {}) {
@@ -1,6 +1,6 @@
1
1
  import { Vec3Array } from "@amodx/math";
2
2
  import { VoxelGeometryTransform } from "../../../../../../Mesher/Geomtry/Geometry.types";
3
- import { CompiledTriangleVoxelGeomtryNode } from "../../../../../../Mesher/Models/Nodes/Types/TriangleVoxelGometryNodeTypes";
3
+ import { CompiledTriangleVoxelGeomtryNode } from "../../../../../../Mesher/Voxels/Models/Nodes/Types/TriangleVoxelGometryNodeTypes";
4
4
  import { GeomtryInput } from "../../../Classes/GeomtryInput";
5
5
  import { BaseVoxelTriangleData } from "../../../../VoxelModel.types";
6
6
  export declare function CompileTriangleGeometryNode(buildRules: boolean, input: GeomtryInput, points: [Vec3Array, Vec3Array, Vec3Array], node: BaseVoxelTriangleData, transform?: VoxelGeometryTransform): CompiledTriangleVoxelGeomtryNode;
@@ -1,7 +1,7 @@
1
1
  import { Triangle } from "../../../../../../Mesher/Geomtry/Primitives/Triangle";
2
2
  import { getVertexWeights } from "./CalcFunctions";
3
3
  import { TransformTriangle } from "../../../../../../Mesher/Geomtry/Transform/TransformTriangle";
4
- import { TriangleVoxelGometryInputs, } from "../../../../../../Mesher/Models/Nodes/Types/TriangleVoxelGometryNodeTypes";
4
+ import { TriangleVoxelGometryInputs, } from "../../../../../../Mesher/Voxels/Models/Nodes/Types/TriangleVoxelGometryNodeTypes";
5
5
  import { OcclusionFaceRegister } from "../../../Classes/OcclusionFaceRegister";
6
6
  import { closestVoxelFace } from "../../../../../../Math/UtilFunctions";
7
7
  export function CompileTriangleGeometryNode(buildRules, input, points, node, transform) {
@@ -51,6 +51,11 @@ export interface VoxelTriangleGeometryNode extends BaseVoxelTriangleData {
51
51
  export interface VoxelGeometryTextureArgument {
52
52
  type: "texture";
53
53
  }
54
+ /**Creates a way to set multiple arguments to the same thing. What ever value is passed in will be passed to the arguments. */
55
+ export interface VoxelGeometryArgumentAliasList {
56
+ type: "arg-list";
57
+ arguments: string[];
58
+ }
54
59
  export interface VoxelGeometryBooleanArgument {
55
60
  type: "boolean";
56
61
  default: boolean;
@@ -103,7 +108,7 @@ export interface VoxelGeometryData {
103
108
  * Define the culling procedure for faces
104
109
  */
105
110
  cullingProcedure?: CullingProcedureData;
106
- arguments: Record<string, VoxelGeometryTextureArgument | VoxelGeometryBoxUVArgument | VoxelGeometryUVArgument | VoxelGeometryVector3Argument | VoxelGeometryIntArgument | VoxelGeometryBooleanArgument | VoxelGeometryFloatArgument>;
111
+ arguments: Record<string, VoxelGeometryTextureArgument | VoxelGeometryBoxUVArgument | VoxelGeometryUVArgument | VoxelGeometryVector3Argument | VoxelGeometryIntArgument | VoxelGeometryBooleanArgument | VoxelGeometryFloatArgument | VoxelGeometryArgumentAliasList>;
107
112
  }
108
113
  export interface VoxelGeometryLinkData {
109
114
  geometryId: string;
@@ -23,5 +23,7 @@ export declare class PaintVoxelData {
23
23
  static Clear(data: PaintVoxelData): PaintVoxelData;
24
24
  /**Clears the target data and then copies properties from source to target. */
25
25
  static Set(target: PaintVoxelData, source: Partial<PaintVoxelData>): PaintVoxelData;
26
+ /**Takes PaintVoxelData and convert mod and state strings to numbers and then */
27
+ static Populate(data: Partial<PaintVoxelData>): Partial<PaintVoxelData>;
26
28
  private constructor();
27
29
  }
@@ -140,6 +140,57 @@ export class PaintVoxelData {
140
140
  target.secondaryStateString = source.secondaryStateString;
141
141
  return target;
142
142
  }
143
+ /**Takes PaintVoxelData and convert mod and state strings to numbers and then */
144
+ static Populate(data) {
145
+ let stringId = data.id
146
+ ? data.id
147
+ : data.name
148
+ ? VoxelPalettesRegister.voxelNametoIdMap.get(data.name)
149
+ : "dve_air";
150
+ let secondaryStringId = data.secondaryName
151
+ ? data.secondaryVoxelId
152
+ : data.secondaryName
153
+ ? VoxelPalettesRegister.voxelNametoIdMap.get(data.secondaryName)
154
+ : "dve_air";
155
+ if (data.name && !data.id) {
156
+ data.id = VoxelPalettesRegister.voxelNametoIdMap.get(data.name);
157
+ }
158
+ if (!data.name && !data.id) {
159
+ data.id = "dve_air";
160
+ }
161
+ delete data.name;
162
+ let state = data.state || 0;
163
+ let mod = data.mod || 0;
164
+ if (SchemaRegister.hasVoxelSchema(stringId)) {
165
+ const schema = SchemaRegister.getVoxelSchemas(stringId);
166
+ if (data.stateString && data.stateString !== "") {
167
+ state = schema.state.readString(data.stateString);
168
+ }
169
+ if (data.modString && data.modString !== "") {
170
+ mod = schema.mod.readString(data.modString);
171
+ }
172
+ }
173
+ data.state = state;
174
+ data.mod = mod;
175
+ delete data.stateString;
176
+ delete data.modString;
177
+ let secondaryState = data.secondaryState || 0;
178
+ let secondaryMod = data.secondaryMod || 0;
179
+ if (secondaryStringId && SchemaRegister.hasVoxelSchema(secondaryStringId)) {
180
+ const schema = SchemaRegister.getVoxelSchemas(secondaryStringId);
181
+ if (data.secondaryStateString && data.secondaryStateString !== "") {
182
+ secondaryState = schema.state.readString(data.secondaryStateString);
183
+ }
184
+ if (data.secondaryModString && data.secondaryModString !== "") {
185
+ secondaryMod = schema.mod.readString(data.secondaryModString);
186
+ }
187
+ }
188
+ data.secondaryState = secondaryState;
189
+ data.secondaryMod = secondaryMod;
190
+ delete data.secondaryModString;
191
+ delete data.secondaryStateString;
192
+ return data;
193
+ }
143
194
  constructor(id = "dve_air", name = "", state = 0, stateString = "", mod = 0, modString = "", level = 0, levelState = 0, secondaryVoxelId = "dve_air", secondaryName = "", secondaryMod = 0, secondaryModString = "", secondaryState = 0, secondaryStateString = "") {
144
195
  this.id = id;
145
196
  this.name = name;
@@ -3,12 +3,16 @@ import { Vector3Like } from "@amodx/math";
3
3
  import { DataCursorInterface } from "../../Voxels/Cursor/DataCursor.interface";
4
4
  import { WorldSectionCursorInterface } from "./WorldSectionCursor.interface";
5
5
  import type { Section } from "../Section/index";
6
+ import { BoundingBox } from "@amodx/math/Geomtry/Bounds/BoundingBox";
6
7
  export declare class SectionCursor implements WorldSectionCursorInterface, DataCursorInterface {
7
8
  _section: Section | null;
8
9
  private voxel;
9
10
  _voxelIndex: number;
10
11
  _voxelPosition: Vector3Like;
11
12
  _sectionPosition: Vector3Like;
13
+ volumeBounds: BoundingBox;
14
+ get volumePosition(): Vector3Like;
15
+ constructor();
12
16
  inBounds(x: number, y: number, z: number): boolean;
13
17
  setSection(section: Section): void;
14
18
  loadSection(dimension: number, x: number, y: number, z: number): boolean;
@@ -2,29 +2,26 @@ import { WorldRegister } from "../WorldRegister";
2
2
  import { WorldVoxelCursor } from "./WorldVoxelCursor";
3
3
  import { WorldSpaces } from "../WorldSpaces";
4
4
  import { Vector3Like } from "@amodx/math";
5
+ import { BoundingBox } from "@amodx/math/Geomtry/Bounds/BoundingBox";
6
+ const point = Vector3Like.Create();
5
7
  export class SectionCursor {
6
8
  _section;
7
9
  voxel = new WorldVoxelCursor(this);
8
10
  _voxelIndex = 0;
9
11
  _voxelPosition = Vector3Like.Create();
10
12
  _sectionPosition = Vector3Like.Create();
13
+ volumeBounds = new BoundingBox();
14
+ get volumePosition() {
15
+ return this._sectionPosition;
16
+ }
17
+ constructor() {
18
+ this.volumeBounds.setMinMax(Vector3Like.Create(0, 0, 0), Vector3Like.Create(WorldSpaces.section.bounds.x, WorldSpaces.section.bounds.y, WorldSpaces.section.bounds.z));
19
+ }
11
20
  inBounds(x, y, z) {
12
- const maxX = this._sectionPosition.x + WorldSpaces.section.bounds.x;
13
- const maxY = this._sectionPosition.y + WorldSpaces.section.bounds.y;
14
- const maxZ = this._sectionPosition.z + WorldSpaces.section.bounds.z;
15
- if (x < this._sectionPosition.x)
16
- return false;
17
- if (y < this._sectionPosition.y)
18
- return false;
19
- if (z < this._sectionPosition.z)
20
- return false;
21
- if (x > maxX)
22
- return false;
23
- if (y > maxY)
24
- return false;
25
- if (z > maxZ)
26
- return false;
27
- return true;
21
+ point.x = x - this._sectionPosition.x + 0.5;
22
+ point.y = y - this._sectionPosition.y + 0.5;
23
+ point.z = z - this._sectionPosition.z + 0.5;
24
+ return this.volumeBounds.intersectsPoint(point);
28
25
  }
29
26
  setSection(section) {
30
27
  this._section = section;
@@ -4,6 +4,7 @@ import { WorldVoxelCursor } from "./WorldVoxelCursor";
4
4
  import { Vector3Like } from "@amodx/math";
5
5
  import { DataCursorInterface } from "../../Voxels/Cursor/DataCursor.interface";
6
6
  import { WorldSectionCursorInterface } from "./WorldSectionCursor.interface";
7
+ import { BoundingBox } from "@amodx/math/Geomtry/Bounds/BoundingBox";
7
8
  export declare class SectorCursor implements DataCursorInterface, WorldSectionCursorInterface {
8
9
  _current: Sector | null;
9
10
  _section: Section | null;
@@ -11,6 +12,9 @@ export declare class SectorCursor implements DataCursorInterface, WorldSectionCu
11
12
  _voxelIndex: number;
12
13
  _voxelPosition: Vector3Like;
13
14
  _sectorPosition: Vector3Like;
15
+ volumeBounds: BoundingBox;
16
+ get volumePosition(): Vector3Like;
17
+ constructor();
14
18
  inBounds(x: number, y: number, z: number): boolean;
15
19
  setSector(sector: Sector): boolean;
16
20
  loadSector(dimension: number, x: number, y: number, z: number): boolean;
@@ -2,6 +2,8 @@ import { WorldRegister } from "../WorldRegister";
2
2
  import { WorldVoxelCursor } from "./WorldVoxelCursor";
3
3
  import { WorldSpaces } from "../WorldSpaces";
4
4
  import { Vector3Like } from "@amodx/math";
5
+ import { BoundingBox } from "@amodx/math/Geomtry/Bounds/BoundingBox";
6
+ const point = Vector3Like.Create();
5
7
  export class SectorCursor {
6
8
  _current = null;
7
9
  _section;
@@ -9,23 +11,18 @@ export class SectorCursor {
9
11
  _voxelIndex = 0;
10
12
  _voxelPosition = Vector3Like.Create();
11
13
  _sectorPosition = Vector3Like.Create();
14
+ volumeBounds = new BoundingBox();
15
+ get volumePosition() {
16
+ return this._sectorPosition;
17
+ }
18
+ constructor() {
19
+ this.volumeBounds.setMinMax(Vector3Like.Create(0, 0, 0), Vector3Like.Create(WorldSpaces.sector.bounds.x, WorldSpaces.sector.bounds.y, WorldSpaces.sector.bounds.z));
20
+ }
12
21
  inBounds(x, y, z) {
13
- const maxX = this._sectorPosition.x + WorldSpaces.sector.bounds.x;
14
- const maxY = this._sectorPosition.y + WorldSpaces.sector.bounds.y;
15
- const maxZ = this._sectorPosition.z + WorldSpaces.sector.bounds.z;
16
- if (x < this._sectorPosition.x)
17
- return false;
18
- if (y < this._sectorPosition.y)
19
- return false;
20
- if (z < this._sectorPosition.z)
21
- return false;
22
- if (x > maxX)
23
- return false;
24
- if (y > maxY)
25
- return false;
26
- if (z > maxZ)
27
- return false;
28
- return true;
22
+ point.x = x - this._sectorPosition.x + 0.5;
23
+ point.y = y - this._sectorPosition.y + 0.5;
24
+ point.z = z - this._sectorPosition.z + 0.5;
25
+ return this.volumeBounds.intersectsPoint(point);
29
26
  }
30
27
  setSector(sector) {
31
28
  this._current = sector;
@@ -1,11 +1,15 @@
1
1
  import { Vector3Like } from "@amodx/math";
2
2
  import { SectorCursor } from "./SectorCursor";
3
3
  import { DataCursorInterface } from "../../Voxels/Cursor/DataCursor.interface";
4
+ import { BoundingBox } from "@amodx/math/Geomtry/Bounds/BoundingBox";
4
5
  export declare class WorldCursor implements DataCursorInterface {
6
+ volumeBounds: BoundingBox;
5
7
  sectorCursors: Record<number, Record<number, SectorCursor | null>>;
6
8
  origin: Vector3Like;
7
9
  dimension: number;
8
10
  _lastPosition: Vector3Like;
11
+ constructor();
12
+ private updateBounds;
9
13
  setFocalPoint(dimension: number, x: number, y: number, z: number): void;
10
14
  inBounds(x: number, y: number, z: number): boolean;
11
15
  getSector(x: number, y: number, z: number): SectorCursor | null;
@@ -1,13 +1,21 @@
1
1
  import { Vector3Like } from "@amodx/math";
2
2
  import { SectorCursor } from "./SectorCursor";
3
3
  import { WorldSpaces } from "../WorldSpaces";
4
+ import { BoundingBox } from "@amodx/math/Geomtry/Bounds/BoundingBox";
4
5
  let cursorCache = [];
5
6
  const tempPosition = Vector3Like.Create();
6
7
  export class WorldCursor {
8
+ volumeBounds = new BoundingBox();
7
9
  sectorCursors = {};
8
10
  origin = Vector3Like.Create();
9
11
  dimension = 0;
10
12
  _lastPosition = Vector3Like.Create();
13
+ constructor() {
14
+ this.updateBounds();
15
+ }
16
+ updateBounds() {
17
+ this.volumeBounds.setMinMax(Vector3Like.Create(WorldSpaces.world.bounds.MinX, WorldSpaces.world.bounds.MinY, WorldSpaces.world.bounds.MinZ), Vector3Like.Create(WorldSpaces.world.bounds.MaxX, WorldSpaces.world.bounds.MaxY, WorldSpaces.world.bounds.MaxZ));
18
+ }
11
19
  setFocalPoint(dimension, x, y, z) {
12
20
  const sectorPos = WorldSpaces.sector.getPosition(x, y, z, tempPosition);
13
21
  for (const row in this.sectorCursors) {
@@ -1,5 +1,11 @@
1
1
  import { LocationData } from "../../Math";
2
2
  export declare class SectorHeightMap {
3
+ /**
4
+ * Gets the relative height of the sector. Meaning will get the tallest sector in a square around it.
5
+ */
3
6
  static getRelative(location: LocationData): number;
7
+ /**
8
+ * Gets the exact heigh of the single sector.
9
+ */
4
10
  static getAbsolute(dimension: number, x: number, sy: number, z: number): number;
5
11
  }
@@ -2,6 +2,9 @@ import { MooreNeighborhood2D } from "../../Math/CardinalNeighbors";
2
2
  import { WorldRegister } from "../WorldRegister";
3
3
  import { WorldSpaces } from "../WorldSpaces";
4
4
  export class SectorHeightMap {
5
+ /**
6
+ * Gets the relative height of the sector. Meaning will get the tallest sector in a square around it.
7
+ */
5
8
  static getRelative(location) {
6
9
  location = [...location];
7
10
  const sectionWidth = WorldSpaces.section.bounds.x;
@@ -18,6 +21,9 @@ export class SectorHeightMap {
18
21
  }
19
22
  return maxHeight;
20
23
  }
24
+ /**
25
+ * Gets the exact heigh of the single sector.
26
+ */
21
27
  static getAbsolute(dimension, x, sy, z) {
22
28
  const sector = WorldRegister.sectors.get(dimension, x, sy, z);
23
29
  if (!sector)
@@ -4,14 +4,17 @@ import { SectionSnapShot } from "./SectionSnapShot";
4
4
  import { Sector } from "../Sector";
5
5
  import { SectorCursor } from "../Cursor/SectorCursor";
6
6
  import { SectionCursor } from "../Cursor/SectionCursor";
7
+ import { BoundingBox } from "@amodx/math/Geomtry/Bounds/BoundingBox";
7
8
  export declare class SectionSnapshotCursor implements DataCursorInterface {
8
9
  origin: Vector3Like;
9
10
  sectorOrigin: Vector3Like;
10
11
  dimension: number;
12
+ volumeBounds: BoundingBox;
11
13
  sectors: Sector[];
12
14
  cursors: SectorCursor[];
13
15
  index: Flat3DIndex;
14
16
  constructor();
17
+ private updateBounds;
15
18
  private _snapShot;
16
19
  private _centeralCursor;
17
20
  getCenteralCursor(): SectionCursor | null;
@@ -3,11 +3,13 @@ import { WorldSpaces } from "../WorldSpaces";
3
3
  import { Sector } from "../Sector";
4
4
  import { SectorCursor } from "../Cursor/SectorCursor";
5
5
  import { SectionCursor } from "../Cursor/SectionCursor";
6
+ import { BoundingBox } from "@amodx/math/Geomtry/Bounds/BoundingBox";
6
7
  const tempPosition = Vector3Like.Create();
7
8
  export class SectionSnapshotCursor {
8
9
  origin = Vector3Like.Create();
9
10
  sectorOrigin = Vector3Like.Create();
10
11
  dimension = 0;
12
+ volumeBounds = new BoundingBox();
11
13
  sectors = [];
12
14
  cursors = [];
13
15
  index = Flat3DIndex.GetXYZOrder();
@@ -29,6 +31,10 @@ export class SectionSnapshotCursor {
29
31
  }
30
32
  }
31
33
  }
34
+ this.updateBounds();
35
+ }
36
+ updateBounds() {
37
+ this.volumeBounds.setMinMax(Vector3Like.Create(WorldSpaces.world.bounds.MinX, WorldSpaces.world.bounds.MinY, WorldSpaces.world.bounds.MinZ), Vector3Like.Create(WorldSpaces.world.bounds.MaxX, WorldSpaces.world.bounds.MaxY, WorldSpaces.world.bounds.MaxZ));
32
38
  }
33
39
  _snapShot;
34
40
  _centeralCursor = new SectionCursor();
@@ -137,13 +137,13 @@ class VoxelSpace {
137
137
  }
138
138
  class Hash {
139
139
  static hashVec3(vector3) {
140
- return `${vector3.x}-${vector3.y}-${vector3.z}`;
140
+ return `${vector3.x}_${vector3.y}_${vector3.z}`;
141
141
  }
142
142
  static hashVec3Array(vector3) {
143
- return `${vector3[0]}-${vector3[1]}-${vector3[2]}`;
143
+ return `${vector3[0]}_${vector3[1]}_${vector3[2]}`;
144
144
  }
145
145
  static hashXYZ(x, y, z) {
146
- return `${x}-${y}-${z}`;
146
+ return `${x}_${y}_${z}`;
147
147
  }
148
148
  }
149
149
  export class WorldSpaces {
@@ -1,22 +1,26 @@
1
+ import { VoxelFaces } from "../../Math";
1
2
  import { WorldCursor } from "../../World/Cursor/WorldCursor";
2
3
  import { DimensionSegment } from "./DimensionSegment";
3
4
  import { Vector3Like } from "@amodx/math";
4
5
  import { PriorityQueue } from "../../Util/PriorityQueue";
5
6
  import { VoxelUpdate } from "../Voxels/Behaviors";
7
+ import { SimulationBrush } from "../Tools/SimulationBrush";
6
8
  declare class UpdatedBounds {
7
9
  displayMin: Vector3Like;
8
10
  displayMax: Vector3Like;
9
11
  dimension: number;
10
12
  start(dimension?: number): void;
11
13
  updateDisplay(x: number, y: number, z: number): void;
12
- markDisplayDirty(): false | undefined;
14
+ markDisplayDirty(): boolean;
13
15
  }
14
16
  export declare class DimensionSimulation {
15
17
  dimension: DimensionSegment;
16
18
  private cursor;
17
19
  nDataCursor: WorldCursor;
18
20
  sDataCursor: WorldCursor;
21
+ tickCursor: Record<VoxelFaces, WorldCursor>;
19
22
  bounds: UpdatedBounds;
23
+ brush: SimulationBrush;
20
24
  updateQueue: PriorityQueue<VoxelUpdate>;
21
25
  constructor(dimension: DimensionSegment);
22
26
  setOrigin(x: number, y: number, z: number): void;
@@ -1,4 +1,5 @@
1
1
  import { WorldSpaces } from "../../World/WorldSpaces";
2
+ import { VoxelFaces } from "../../Math";
2
3
  import { WorldCursor } from "../../World/Cursor/WorldCursor";
3
4
  import { WorldRegister } from "../../World/WorldRegister";
4
5
  import { Vector3Like } from "@amodx/math";
@@ -62,6 +63,7 @@ class UpdatedBounds {
62
63
  }
63
64
  }
64
65
  }
66
+ return true;
65
67
  }
66
68
  }
67
69
  export class DimensionSimulation {
@@ -69,10 +71,20 @@ export class DimensionSimulation {
69
71
  cursor = new WorldCursor();
70
72
  nDataCursor = new WorldCursor();
71
73
  sDataCursor = new WorldCursor();
74
+ tickCursor = {
75
+ [VoxelFaces.Up]: new WorldCursor(),
76
+ [VoxelFaces.Down]: new WorldCursor(),
77
+ [VoxelFaces.North]: new WorldCursor(),
78
+ [VoxelFaces.South]: new WorldCursor(),
79
+ [VoxelFaces.East]: new WorldCursor(),
80
+ [VoxelFaces.West]: new WorldCursor(),
81
+ };
72
82
  bounds = new UpdatedBounds();
83
+ brush;
73
84
  updateQueue = new PriorityQueue();
74
85
  constructor(dimension) {
75
86
  this.dimension = dimension;
87
+ this.brush = dimension.getBrush();
76
88
  }
77
89
  setOrigin(x, y, z) {
78
90
  this.cursor.setFocalPoint(this.dimension.id, x, y, z);
@@ -14,6 +14,7 @@ export declare class Generator {
14
14
  position: Vector3Like;
15
15
  _dimension: number;
16
16
  _building: boolean;
17
+ _generating: boolean;
17
18
  _isNew: boolean;
18
19
  _dirty: boolean;
19
20
  _waitingForCull: boolean;
@@ -5,6 +5,7 @@ export class Generator {
5
5
  position;
6
6
  _dimension = 0;
7
7
  _building = true;
8
+ _generating = true;
8
9
  _isNew = true;
9
10
  _dirty = true;
10
11
  _waitingForCull = false;
@@ -4,6 +4,7 @@ import { Sector } from "../../World/Sector";
4
4
  import { TickQueue } from "../Tick/TickQueue";
5
5
  import { DimensionSegment } from "./DimensionSegment";
6
6
  import { Thread } from "@amodx/threads";
7
+ import { SectionCursor } from "../../World/Cursor/SectionCursor";
7
8
  export declare class SimulationSector {
8
9
  dimension: DimensionSegment;
9
10
  position: Vec3Array;
@@ -14,9 +15,11 @@ export declare class SimulationSector {
14
15
  sector: Sector | null;
15
16
  _rendered: boolean;
16
17
  _genAllDone: boolean;
18
+ _firstTick: boolean;
17
19
  /**An array of the last tick each section was built at */
18
20
  _displayTicks: Uint32Array<ArrayBuffer>;
19
21
  tickQueue: TickQueue;
22
+ sectionCursor: SectionCursor;
20
23
  neighbors: SimulationSector[];
21
24
  fullNeighbors: boolean;
22
25
  readonly maxNeighbors: number;
@@ -5,9 +5,11 @@ import { WorldSpaces } from "../../World/WorldSpaces";
5
5
  import { WorldRegister } from "../../World/WorldRegister";
6
6
  import { WorldSimulationTasks } from "../Internal/WorldSimulationTasks";
7
7
  import { TickQueue } from "../Tick/TickQueue";
8
+ import { VoxelBehaviorsRegister } from "../Voxels/Behaviors";
8
9
  import { MooreNeighborhood2D } from "../../Math/CardinalNeighbors";
9
10
  import { WorldDataSyncIds } from "../../World/Types/WorldDataSyncIds";
10
11
  import { EngineSettings } from "../../Settings/EngineSettings";
12
+ import { SectionCursor } from "../../World/Cursor/SectionCursor";
11
13
  const tempPosition = Vector3Like.Create();
12
14
  export class SimulationSector {
13
15
  dimension;
@@ -19,9 +21,11 @@ export class SimulationSector {
19
21
  sector = null;
20
22
  _rendered = false;
21
23
  _genAllDone = false;
24
+ _firstTick = false;
22
25
  /**An array of the last tick each section was built at */
23
26
  _displayTicks = new Uint32Array(WorldSpaces.sector.sectionVolumne);
24
27
  tickQueue;
28
+ sectionCursor = new SectionCursor();
25
29
  neighbors = [];
26
30
  fullNeighbors = false;
27
31
  maxNeighbors = MooreNeighborhood2D.length - 1;
@@ -114,48 +118,74 @@ export class SimulationSector {
114
118
  }
115
119
  this._rendered = true;
116
120
  }
117
- /* if (this.ticking) {
118
- this.dimension.simulation.setOrigin(...this.position);
119
- this.dimension.simulation.bounds.start();
120
- this.tickQueue.run();
121
-
122
- const [min, max] = sector.getMinMax();
123
- if (min == Math.abs(Infinity) || max == Math.abs(Infinity)) return true;
124
-
125
- const height = max - min + 1;
126
- let attempts = 100;
127
- let ticks = 20;
128
- while (attempts) {
129
- const randomX =
130
- Math.floor(WorldSpaces.section.bounds.x * Math.random()) +
131
- this.sector.position[0];
132
- const randomY =
133
- Math.floor(height * Math.random()) + min + this.sector.position[1];
134
- const randomZ =
135
- Math.floor(WorldSpaces.section.bounds.z * Math.random()) +
136
- this.sector.position[2];
137
- const voxel = this.dimension.simulation.nDataCursor.getVoxel(
138
- randomX,
139
- randomY,
140
- randomZ
141
- );
142
- if (!voxel || voxel.isAir()) {
143
- attempts--;
144
- continue;
121
+ if (this.ticking) {
122
+ this.dimension.simulation.setOrigin(...this.position);
123
+ this.dimension.simulation.bounds.start(this.dimension.id);
124
+ this.tickQueue.run();
125
+ const [min, max] = sector.getMinMax();
126
+ if (min == Math.abs(Infinity) || max == Math.abs(Infinity))
127
+ return true;
128
+ const height = max - min + 1;
129
+ let attempts = 100;
130
+ let ticks = 20;
131
+ while (attempts) {
132
+ const randomX = Math.floor(WorldSpaces.section.bounds.x * Math.random()) +
133
+ this.sector.position[0];
134
+ const randomY = Math.floor(height * Math.random()) + min + this.sector.position[1];
135
+ const randomZ = Math.floor(WorldSpaces.section.bounds.z * Math.random()) +
136
+ this.sector.position[2];
137
+ const voxel = this.dimension.simulation.nDataCursor.getVoxel(randomX, randomY, randomZ);
138
+ if (!voxel || voxel.isAir()) {
139
+ attempts--;
140
+ continue;
141
+ }
142
+ const behavior = VoxelBehaviorsRegister.get(voxel.tags["dve_simulation_behavior"]);
143
+ behavior.onTick(this.dimension.simulation, randomX, randomY, randomZ);
144
+ ticks--;
145
+ if (!ticks)
146
+ break;
145
147
  }
146
-
147
- const behavior = VoxelBehaviorsRegister.get(
148
- voxel.tags["dve_simulation_behavior"]
149
- );
150
- behavior.onTick(this.dimension.simulation, randomX, randomY, randomZ);
151
-
152
- ticks--;
153
-
154
- if (!ticks) break;
155
- }
156
-
157
- this.dimension.simulation.bounds.markDisplayDirty();
158
- } */
148
+ let allNeighborsTicking = true;
149
+ for (const neighbors of this.neighbors) {
150
+ if (!neighbors.ticking || !neighbors._genAllDone) {
151
+ allNeighborsTicking = false;
152
+ break;
153
+ }
154
+ }
155
+ if (!this._firstTick && this.renderering && allNeighborsTicking) {
156
+ for (const section of sector.sections) {
157
+ this.sectionCursor.setSection(section);
158
+ const [minY, maxY] = section.getMinMax();
159
+ if (minY == Infinity && maxY == -Infinity) {
160
+ continue;
161
+ }
162
+ const { x: cx, y: cy, z: cz } = this.sectionCursor._sectionPosition;
163
+ const slice = WorldSpaces.section.bounds.x * WorldSpaces.section.bounds.z;
164
+ const startY = minY * slice;
165
+ const endY = (maxY + 1) * slice;
166
+ // console.warn([startY,endY],{...this.sectionCursor._voxelPosition})
167
+ for (let i = startY; i < endY; i++) {
168
+ if (!(i % slice)) {
169
+ const y = i / slice;
170
+ if (!section.getHasVoxel(y) && !section.getHasVoxelDirty(y)) {
171
+ i += slice - 1;
172
+ continue;
173
+ }
174
+ }
175
+ if (!section.ids[i] || section.getBuried(i))
176
+ continue;
177
+ const voxel = this.sectionCursor.getVoxelAtIndex(i);
178
+ const x = cx + this.sectionCursor._voxelPosition.x;
179
+ const y = cy + this.sectionCursor._voxelPosition.y;
180
+ const z = cz + this.sectionCursor._voxelPosition.z;
181
+ const behavior = VoxelBehaviorsRegister.get(voxel.tags["dve_simulation_behavior"]);
182
+ behavior.needUpdate(this.dimension.simulation, x, y, z);
183
+ }
184
+ }
185
+ this._firstTick = true;
186
+ }
187
+ this.dimension.simulation.bounds.markDisplayDirty();
188
+ }
159
189
  return true;
160
190
  }
161
191
  generateUpdate() {
@@ -171,8 +171,11 @@ export class WorldSimulationTasks {
171
171
  .sector?.getSection(location[1], location[2], location[3])
172
172
  ?.setInProgress(true);
173
173
  if (EngineSettings.settings.memoryAndCPU.useSharedMemory) {
174
- task.completeTask(taskId);
175
- WorldSimulationTools.taskTool.build.section.run(location);
174
+ WorldSimulationTools.taskTool.build.section
175
+ .runAsync(location)
176
+ .then(() => {
177
+ task.completeTask(taskId);
178
+ });
176
179
  return;
177
180
  }
178
181
  const [dim, x, y, z] = location;
@@ -0,0 +1,10 @@
1
+ import { GeneratorData } from "../Dimensions/Generator";
2
+ /**# InitalLoad
3
+ * ---
4
+ * Load the world without building.
5
+ */
6
+ export declare function BuildOnly(props: {
7
+ dimension?: number;
8
+ logTasks?: true;
9
+ genData: Partial<GeneratorData>;
10
+ }): Promise<unknown>;