@divinevoxel/vlox 0.0.75 → 0.0.77

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 (330) hide show
  1. package/Builder/RayProvider.d.ts +6 -0
  2. package/Builder/Tools/Brush/BrushTool.d.ts +55 -0
  3. package/Builder/Tools/Brush/BrushTool.js +352 -0
  4. package/Builder/Tools/BuilderToolBase.d.ts +39 -0
  5. package/Builder/Tools/BuilderToolBase.js +42 -0
  6. package/Builder/Tools/Hand/HandTool.d.ts +24 -0
  7. package/Builder/Tools/Hand/HandTool.js +73 -0
  8. package/Builder/Tools/Path/PahtTool.d.ts +34 -0
  9. package/Builder/Tools/Path/PahtTool.js +128 -0
  10. package/Builder/Tools/Sculpt/SculptTool.d.ts +34 -0
  11. package/Builder/Tools/Sculpt/SculptTool.js +102 -0
  12. package/Builder/Tools/Shape/ShapeTool.d.ts +32 -0
  13. package/Builder/Tools/Shape/ShapeTool.js +78 -0
  14. package/Builder/Tools/Template/TemplateTool.d.ts +35 -0
  15. package/Builder/Tools/Template/TemplateTool.js +73 -0
  16. package/Builder/Tools/Wand/WandTool.d.ts +30 -0
  17. package/Builder/Tools/Wand/WandTool.js +90 -0
  18. package/Builder/Tools/Wrench/WrenchTool.d.ts +47 -0
  19. package/Builder/Tools/Wrench/WrenchTool.js +184 -0
  20. package/Builder/Util/FreeBoxSelection.d.ts +12 -0
  21. package/Builder/Util/FreeBoxSelection.js +21 -0
  22. package/Builder/Util/FreePointSelection.d.ts +14 -0
  23. package/Builder/Util/FreePointSelection.js +39 -0
  24. package/Builder/Util/SurfaceBoxSelection.d.ts +12 -0
  25. package/Builder/Util/SurfaceBoxSelection.js +25 -0
  26. package/Builder/VoxelBuildSpace.d.ts +73 -0
  27. package/Builder/VoxelBuildSpace.js +224 -0
  28. package/Builder/World/InitTasks.d.ts +1 -0
  29. package/Builder/World/InitTasks.js +129 -0
  30. package/Builder/World/VoxelBuildSpaceWorld.d.ts +4 -0
  31. package/Builder/World/VoxelBuildSpaceWorld.js +10 -0
  32. package/Contexts/Render/DivineVoxelEngineRender.d.ts +5 -5
  33. package/Contexts/World/DivineVoxelEngineWorld.d.ts +5 -5
  34. package/Mesher/Geomtry/Proto/ProtoMesh.d.ts +18 -0
  35. package/Mesher/Geomtry/Proto/ProtoMesh.js +73 -0
  36. package/Mesher/Geomtry/{VoxelMeshBuffers.d.ts → Proto/ProtoMeshBuffer.d.ts} +2 -2
  37. package/Mesher/Geomtry/{VoxelMeshBuffers.js → Proto/ProtoMeshBuffer.js} +2 -2
  38. package/Mesher/Geomtry/Shapes/Box.d.ts +2 -9
  39. package/Mesher/Geomtry/Shapes/Box.js +7 -12
  40. package/Mesher/Geomtry/Transform/TransformBox.js +5 -2
  41. package/Mesher/InitMesher.js +4 -4
  42. package/Mesher/InitTask.js +2 -2
  43. package/Mesher/Items/Base/CompactItemMesh.d.ts +3 -0
  44. package/Mesher/Items/Base/CompactItemMesh.js +20 -0
  45. package/Mesher/Items/Geomtry/ItemGeometryBuilder.d.ts +5 -0
  46. package/Mesher/Items/Geomtry/ItemGeometryBuilder.js +131 -0
  47. package/Mesher/Items/Geomtry/ItemMeshVertexStructCursor.d.ts +48 -0
  48. package/Mesher/Items/Geomtry/ItemMeshVertexStructCursor.js +114 -0
  49. package/Mesher/Items/MeshTexture.d.ts +1 -0
  50. package/Mesher/Items/MeshTexture.js +214 -0
  51. package/Mesher/Items/MeshTextureO.js +277 -0
  52. package/Mesher/Items/Models/ItemModelBuilder.d.ts +27 -0
  53. package/Mesher/Items/Models/ItemModelBuilder.js +64 -0
  54. package/Mesher/Types/ItemMesh.types.d.ts +5 -0
  55. package/Mesher/Types/ItemMesh.types.js +12 -0
  56. package/Mesher/Types/Mesher.types.d.ts +15 -9
  57. package/Mesher/Types/Mesher.types.js +14 -0
  58. package/Mesher/Types/VoxelMesh.types.js +7 -6
  59. package/Mesher/Voxels/Base/CompactTemplateMesh.d.ts +3 -0
  60. package/Mesher/{Functions/CompactVoxelMesh.js → Voxels/Base/CompactTemplateMesh.js} +4 -40
  61. package/Mesher/{Functions → Voxels/Base}/CompactVoxelSectionMesh.d.ts +2 -2
  62. package/Mesher/{Functions → Voxels}/Base/MeshSectionBase.d.ts +1 -1
  63. package/Mesher/{Functions → Voxels}/Base/MeshSectionBase.js +11 -7
  64. package/Mesher/{Geomtry → Voxels/Geomtry}/CompactedSectionVoxelMesh.d.ts +1 -1
  65. package/Mesher/{Geomtry → Voxels/Geomtry}/CompactedSectionVoxelMesh.js +1 -1
  66. package/Mesher/{Geomtry → Voxels/Geomtry}/VoxelGeometryBuilder.d.ts +2 -2
  67. package/Mesher/{Geomtry → Voxels/Geomtry}/VoxelGeometryBuilder.js +1 -1
  68. package/Mesher/{Geomtry → Voxels/Geomtry}/VoxelMeshBVHBuilder.d.ts +3 -3
  69. package/Mesher/{Geomtry → Voxels/Geomtry}/VoxelMeshBVHBuilder.js +2 -2
  70. package/Mesher/Voxels/MeshTemplate.d.ts +3 -0
  71. package/Mesher/Voxels/MeshTemplate.js +81 -0
  72. package/Mesher/{Functions → Voxels}/MeshVoxel.d.ts +1 -1
  73. package/Mesher/{Functions → Voxels}/MeshVoxel.js +6 -4
  74. package/Mesher/{Models → Voxels/Models}/Common/Calc/CalcConstants.d.ts +3 -3
  75. package/Mesher/{Models → Voxels/Models}/Common/Calc/CalcConstants.js +4 -4
  76. package/Mesher/{Models → Voxels/Models}/Common/Calc/FaceDataCalc.d.ts +1 -1
  77. package/Mesher/{Models → Voxels/Models}/Common/Calc/FaceDataCalc.js +2 -2
  78. package/Mesher/{Models → Voxels/Models}/Common/Faces/CullRulledFace.js +1 -1
  79. package/Mesher/{Models → Voxels/Models}/Common/Faces/ShadeRulelessFace.d.ts +1 -1
  80. package/Mesher/{Models → Voxels/Models}/Common/Faces/ShadeRulledFace.d.ts +1 -1
  81. package/Mesher/{Models → Voxels/Models}/Common/Faces/ShadeRulledFace.js +1 -1
  82. package/Mesher/{Models → Voxels/Models}/Common/GetTexture.d.ts +3 -3
  83. package/Mesher/{Models → Voxels/Models}/Nodes/Custom/Liquid/FlowGradient.d.ts +1 -1
  84. package/Mesher/{Models → Voxels/Models}/Nodes/Custom/Liquid/FlowGradient.js +1 -1
  85. package/Mesher/{Models → Voxels/Models}/Nodes/Custom/Liquid/LiquidGeomtryNode.d.ts +3 -3
  86. package/Mesher/{Models → Voxels/Models}/Nodes/Custom/Liquid/LiquidGeomtryNode.js +14 -16
  87. package/Mesher/{Models → Voxels/Models}/Nodes/Default/QuadVoxelGeometryNode.d.ts +2 -2
  88. package/Mesher/{Models → Voxels/Models}/Nodes/Default/QuadVoxelGeometryNode.js +1 -1
  89. package/Mesher/{Models → Voxels/Models}/Nodes/Default/TriangleVoxelGeometryNode.d.ts +2 -2
  90. package/Mesher/{Models → Voxels/Models}/Nodes/Default/TriangleVoxelGeometryNode.js +1 -1
  91. package/Mesher/{Models → Voxels/Models}/Nodes/Types/QuadVoxelGometryNodeTypes.d.ts +2 -2
  92. package/Mesher/{Models → Voxels/Models}/Nodes/Types/TriangleVoxelGometryNodeTypes.d.ts +1 -1
  93. package/Mesher/{Models → Voxels/Models}/Nodes/VoxelGeometryConstructor.d.ts +2 -2
  94. package/Mesher/Voxels/Models/Procedures/Default/ConsistentRotationTextureProcedure.d.ts +24 -0
  95. package/Mesher/{Models → Voxels/Models}/Procedures/Default/ConsistentRotationTextureProcedure.js +2 -2
  96. package/Mesher/{Models → Voxels/Models}/Procedures/Default/OutlinedTextureProcedure.d.ts +4 -5
  97. package/Mesher/Voxels/Models/Procedures/Default/OutlinedTextureProcedure.js +205 -0
  98. package/Mesher/Voxels/Models/Procedures/Default/PillarTextureProcedure.d.ts +28 -0
  99. package/Mesher/Voxels/Models/Procedures/Default/PillarTextureProcedure.js +109 -0
  100. package/Mesher/{Models → Voxels/Models}/Procedures/TextureProcedure.d.ts +3 -3
  101. package/Mesher/{Models → Voxels/Models}/Procedures/TextureProcedureRegister.js +2 -0
  102. package/Mesher/{Models → Voxels/Models}/VoxelConstructor.d.ts +4 -4
  103. package/Mesher/{Models → Voxels/Models}/VoxelConstructor.js +3 -3
  104. package/Mesher/{Models → Voxels/Models}/VoxelGeometryBuilderCacheSpace.d.ts +2 -2
  105. package/Mesher/{Models → Voxels/Models}/VoxelGeometryBuilderCacheSpace.js +2 -2
  106. package/Mesher/{Models → Voxels/Models}/VoxelModelBuilder.d.ts +7 -7
  107. package/Mesher/{Models → Voxels/Models}/VoxelModelBuilder.js +6 -5
  108. package/Mesher/{Models → Voxels/Models}/VoxelModelConstructorRegister.d.ts +4 -4
  109. package/Mesher/{Models → Voxels/Models}/VoxelModelConstructorRegister.js +2 -2
  110. package/Mesher/{Models → Voxels/Models}/VoxelModelEffect.d.ts +1 -1
  111. package/Mesher/{Models → Voxels/Models}/VoxelModelEffect.js +1 -1
  112. package/Renderer/Classes/DVESectionMeshes.d.ts +1 -1
  113. package/Renderer/MeshManager.js +1 -1
  114. package/Settings/EngineSettings.types.d.ts +2 -1
  115. package/Settings/EngineSettings.types.js +3 -1
  116. package/Tasks/Paint/Common.js +14 -9
  117. package/Tasks/Paint/Erase/EraseVoxel.js +1 -1
  118. package/Tasks/Paint/Erase/EraseVoxelSelection.d.ts +4 -0
  119. package/Tasks/Paint/Erase/EraseVoxelSelection.js +33 -0
  120. package/Tasks/Paint/Erase/EraseVoxelTemplate.js +1 -2
  121. package/Tasks/Paint/Paint/PaintVoxelTemplate.js +1 -1
  122. package/Tasks/Propagation/Illumanation/RGBUpdate.js +1 -1
  123. package/Tasks/Tasks.types.d.ts +2 -0
  124. package/Tasks/TasksIds.d.ts +1 -0
  125. package/Tasks/TasksIds.js +1 -0
  126. package/Tasks/WorldGeneration/InitTasks.js +3 -1
  127. package/Templates/Archive/ArchivedVoxelTemplate.d.ts +6 -5
  128. package/Templates/Archive/ArchivedVoxelTemplate.js +56 -49
  129. package/Templates/Archive/Functions/CreateArchivedTemplate.js +4 -4
  130. package/Templates/Archive/Functions/ExportArchiedTemplateJSON.js +0 -1
  131. package/Templates/Archive/Functions/ImportArchivedTemplateJSON.js +0 -2
  132. package/Templates/Cursor/TemplateCursor.d.ts +6 -1
  133. package/Templates/Cursor/TemplateCursor.js +16 -3
  134. package/Templates/Cursor/TemplateProxy.d.ts +1 -0
  135. package/Templates/Cursor/TemplateProxy.js +9 -0
  136. package/Templates/Cursor/TemplateVoxelCursor.d.ts +1 -0
  137. package/Templates/Cursor/TemplateVoxelCursor.js +6 -0
  138. package/Templates/Full/FullVoxelTemplate.d.ts +5 -4
  139. package/Templates/Full/FullVoxelTemplate.js +32 -17
  140. package/Templates/Functions/ExtrudeSelection.d.ts +5 -0
  141. package/Templates/Functions/ExtrudeSelection.js +44 -0
  142. package/Templates/Functions/FillSelection.d.ts +4 -0
  143. package/Templates/Functions/FillSelection.js +20 -0
  144. package/Templates/Functions/FlipTemplate.d.ts +2 -2
  145. package/Templates/Functions/FlipTemplate.js +8 -8
  146. package/Templates/Functions/RotateTemplate.d.ts +2 -2
  147. package/Templates/Path/VoxelPath.d.ts +4 -0
  148. package/Templates/Path/VoxelPath.js +18 -0
  149. package/Templates/Path/VoxelPath.types.d.ts +1 -0
  150. package/Templates/Selection/VoxelBFSSelection.d.ts +6 -6
  151. package/Templates/Selection/VoxelBFSSelection.js +29 -22
  152. package/Templates/Selection/VoxelBoundsSelection.d.ts +20 -0
  153. package/Templates/Selection/{VoxelBoxSelection.js → VoxelBoundsSelection.js} +38 -20
  154. package/Templates/Selection/VoxelPointSelection.d.ts +19 -0
  155. package/Templates/Selection/VoxelPointSelection.js +49 -0
  156. package/Templates/Selection/VoxelSelection.d.ts +18 -0
  157. package/Templates/Selection/VoxelSelection.js +1 -0
  158. package/Templates/Selection/VoxelSurfaceSelection.d.ts +8 -12
  159. package/Templates/Selection/VoxelSurfaceSelection.js +88 -84
  160. package/Templates/Selection/VoxelTemplateSelection.d.ts +13 -4
  161. package/Templates/Selection/VoxelTemplateSelection.js +27 -9
  162. package/Templates/Shapes/Selections/BoxVoxelShapeSelection.d.ts +28 -0
  163. package/Templates/Shapes/Selections/BoxVoxelShapeSelection.js +77 -0
  164. package/Templates/Shapes/Selections/ConeVoxelShapeSelection.d.ts +28 -0
  165. package/Templates/Shapes/Selections/ConeVoxelShapeSelection.js +77 -0
  166. package/Templates/Shapes/Selections/CylinderVoxelShapeSelection.d.ts +28 -0
  167. package/Templates/Shapes/Selections/CylinderVoxelShapeSelection.js +77 -0
  168. package/Templates/Shapes/Selections/EllipsoidVoxelShapeSelection.d.ts +28 -0
  169. package/Templates/Shapes/Selections/EllipsoidVoxelShapeSelection.js +92 -0
  170. package/Templates/Shapes/Selections/OctahedronVoxelShapeSelection.d.ts +28 -0
  171. package/Templates/Shapes/Selections/OctahedronVoxelShapeSelection.js +76 -0
  172. package/Templates/Shapes/Selections/PyramidVoxelShapeSelection.d.ts +37 -0
  173. package/Templates/Shapes/Selections/PyramidVoxelShapeSelection.js +137 -0
  174. package/Templates/Shapes/Selections/SphereVoxelShapeSelection.d.ts +20 -0
  175. package/Templates/Shapes/Selections/SphereVoxelShapeSelection.js +61 -0
  176. package/Templates/Shapes/Selections/TorusVoxelShapeSelection.d.ts +28 -0
  177. package/Templates/Shapes/Selections/TorusVoxelShapeSelection.js +76 -0
  178. package/Templates/Shapes/Selections/VoxelShapeSelection.d.ts +5 -0
  179. package/Templates/Shapes/Selections/VoxelShapeSelection.js +1 -0
  180. package/Templates/Shapes/VoxelShape.types.d.ts +2 -0
  181. package/Templates/Shapes/VoxelShape.types.js +8 -0
  182. package/Templates/Shapes/VoxelShapeTemplate.d.ts +37 -0
  183. package/Templates/Shapes/{BasicVoxelShapeTemplate.js → VoxelShapeTemplate.js} +43 -37
  184. package/Templates/Shapes/VoxelShapeTemplate.types.d.ts +5 -12
  185. package/Templates/Shapes/VoxelShapeTemplate.types.js +5 -1
  186. package/Templates/{VoxelTempateRegister.d.ts → VoxelTemplateRegister.d.ts} +4 -0
  187. package/Templates/VoxelTemplateRegister.js +60 -0
  188. package/Templates/VoxelTemplates.types.d.ts +3 -3
  189. package/Textures/Classes/CompiledTexture.d.ts +2 -0
  190. package/Textures/Classes/CompiledTexture.js +19 -1
  191. package/Textures/Classes/TextureAnimationTexture.d.ts +1 -1
  192. package/Textures/Functions/BuildTextureData.js +13 -0
  193. package/Textures/TextureManager.d.ts +1 -0
  194. package/Textures/TextureManager.js +11 -5
  195. package/Tools/Brush/Brush.d.ts +2 -0
  196. package/Tools/Brush/Brush.js +19 -0
  197. package/Tools/Tasks/TasksTool.d.ts +2 -1
  198. package/Tools/Tasks/TasksTool.js +2 -0
  199. package/Util/BinaryBuffer/Functions/BinaryBufferConvert.d.ts +1 -1
  200. package/Util/BinaryBuffer/Functions/BinaryBufferToTypedArray.d.ts +1 -1
  201. package/Util/LocationData.d.ts +1 -1
  202. package/Voxels/Cursor/DataCursor.interface.d.ts +4 -0
  203. package/Voxels/Cursor/VoxelCursor.interface.d.ts +2 -0
  204. package/Voxels/Cursor/VoxelCursor.interface.js +2 -0
  205. package/Voxels/Cursor/VoxelLightData.js +2 -2
  206. package/Voxels/Functions/BuildTagData.js +1 -1
  207. package/Voxels/Indexes/VoxelIndex.d.ts +1 -0
  208. package/Voxels/Indexes/VoxelIndex.js +11 -13
  209. package/Voxels/InitVoxelData.js +5 -14
  210. package/Voxels/Interaction/Functions/PickVoxel.d.ts +0 -5
  211. package/Voxels/Interaction/Functions/PickVoxel.js +64 -85
  212. package/Voxels/Interaction/Functions/PickVoxelWorld.js +21 -46
  213. package/Voxels/Interaction/VoxelPickResult.d.ts +1 -0
  214. package/Voxels/Interaction/VoxelPickResult.js +3 -0
  215. package/Voxels/Models/CompiledVoxelModel.types.d.ts +1 -1
  216. package/Voxels/Models/Defaults/CubeVoxelGeometry.js +11 -0
  217. package/Voxels/Models/Defaults/CubeVoxelModels.js +44 -99
  218. package/Voxels/Models/Defaults/PanelVoxelGeometry.d.ts +1 -3
  219. package/Voxels/Models/Defaults/PanelVoxelGeometry.js +2 -226
  220. package/Voxels/Models/Defaults/PanelVoxelModels.d.ts +1 -0
  221. package/Voxels/Models/Defaults/PanelVoxelModels.js +100 -258
  222. package/Voxels/Models/Defaults/StairVoxelModel.js +2 -2
  223. package/Voxels/Models/Rules/Classes/GeomtryInput.d.ts +4 -1
  224. package/Voxels/Models/Rules/Classes/GeomtryInput.js +26 -5
  225. package/Voxels/Models/Rules/Classes/VoxelRulesGeometry.d.ts +1 -1
  226. package/Voxels/Models/Rules/Functions/BuildFinalInputs.js +23 -8
  227. package/Voxels/Models/Rules/Functions/Compile/CompileGeomtryNodes.d.ts +1 -1
  228. package/Voxels/Models/Rules/Functions/Compile/Nodes/CompileBoxGeometryNode.d.ts +1 -1
  229. package/Voxels/Models/Rules/Functions/Compile/Nodes/CompileQuadGeometryNode.d.ts +1 -1
  230. package/Voxels/Models/Rules/Functions/Compile/Nodes/CompileQuadGeometryNode.js +1 -1
  231. package/Voxels/Models/Rules/Functions/Compile/Nodes/CompileTriangleGeometryNode.d.ts +1 -1
  232. package/Voxels/Models/Rules/Functions/Compile/Nodes/CompileTriangleGeometryNode.js +1 -1
  233. package/Voxels/Models/VoxelModel.types.d.ts +6 -1
  234. package/Voxels/State/Schema/BinarySchemaNode.d.ts +2 -1
  235. package/Voxels/State/Schema/BinarySchemaNode.js +5 -2
  236. package/Voxels/State/Schema/Conditions/SameVoxelConditions.js +2 -0
  237. package/Voxels/Types/PaintVoxelData.d.ts +13 -1
  238. package/Voxels/Types/PaintVoxelData.js +151 -14
  239. package/World/Archive/Functions/Shared/LightSegments.d.ts +1 -1
  240. package/World/Cursor/SectionCursor.d.ts +4 -0
  241. package/World/Cursor/SectionCursor.js +13 -16
  242. package/World/Cursor/SectorCursor.d.ts +4 -0
  243. package/World/Cursor/SectorCursor.js +13 -16
  244. package/World/Cursor/WorldCursor.d.ts +4 -0
  245. package/World/Cursor/WorldCursor.js +8 -0
  246. package/World/Sector/Sector.d.ts +1 -1
  247. package/World/Sector/SectorHeightMap.d.ts +6 -0
  248. package/World/Sector/SectorHeightMap.js +6 -0
  249. package/World/SnapShot/SectionSnapShotCursor.d.ts +3 -0
  250. package/World/SnapShot/SectionSnapShotCursor.js +6 -0
  251. package/World/WorldSpaces.js +3 -3
  252. package/WorldSimulation/Dimensions/DimensionSimulation.d.ts +5 -1
  253. package/WorldSimulation/Dimensions/DimensionSimulation.js +12 -0
  254. package/WorldSimulation/Dimensions/Generator.d.ts +1 -0
  255. package/WorldSimulation/Dimensions/Generator.js +1 -0
  256. package/WorldSimulation/Dimensions/SimulationSector.d.ts +4 -1
  257. package/WorldSimulation/Dimensions/SimulationSector.js +71 -41
  258. package/WorldSimulation/Internal/WorldSimulationTasks.js +5 -2
  259. package/WorldSimulation/Procedures/BuildOnly.d.ts +10 -0
  260. package/WorldSimulation/Procedures/BuildOnly.js +55 -0
  261. package/WorldSimulation/Procedures/InitalLoad.js +3 -0
  262. package/WorldSimulation/Tasks/SimulationTaskBase.d.ts +2 -0
  263. package/WorldSimulation/Tasks/SimulationTaskBase.js +11 -3
  264. package/WorldSimulation/Tasks/TaskSegment.d.ts +2 -1
  265. package/WorldSimulation/Tasks/TaskSegment.js +3 -1
  266. package/WorldSimulation/Tick/TickQueue.d.ts +2 -0
  267. package/WorldSimulation/Tick/TickQueue.js +26 -0
  268. package/WorldSimulation/Tools/SimulationBrush.d.ts +3 -0
  269. package/WorldSimulation/Tools/SimulationBrush.js +52 -0
  270. package/WorldSimulation/Voxels/Behaviors/Types/DefaultVoxelBehavior.js +3 -0
  271. package/WorldSimulation/Voxels/Behaviors/Types/LiquidVoxelBehavior.js +21 -1
  272. package/WorldSimulation/Voxels/Behaviors/VoxelBehaviors.d.ts +2 -0
  273. package/WorldSimulation/Voxels/Behaviors/VoxelBehaviors.js +6 -0
  274. package/WorldSimulation/Voxels/Ticks/Types/LiquidVoxelUpdate.js +39 -14
  275. package/WorldSimulation/WorldSimulation.d.ts +10 -0
  276. package/WorldSimulation/WorldSimulation.js +41 -1
  277. package/package.json +1 -30
  278. package/Mesher/Functions/CompactVoxelMesh.d.ts +0 -3
  279. package/Mesher/Functions/MeshTexture.js +0 -278
  280. package/Mesher/Geomtry/VoxelMesh.d.ts +0 -12
  281. package/Mesher/Geomtry/VoxelMesh.js +0 -25
  282. package/Mesher/Models/Procedures/Default/ConsistentRotationTextureProcedure.d.ts +0 -25
  283. package/Mesher/Models/Procedures/Default/OutlinedTextureProcedure.js +0 -162
  284. package/Templates/Selection/VoxelBoxSelection.d.ts +0 -14
  285. package/Templates/Selection/VoxelSelecton.d.ts +0 -6
  286. package/Templates/Shapes/BasicVoxelShapeTemplate.d.ts +0 -35
  287. package/Templates/Shapes/BoxVoxelTemplate.d.ts +0 -22
  288. package/Templates/Shapes/BoxVoxelTemplate.js +0 -75
  289. package/Templates/Shapes/ConeVoxelTemplate.d.ts +0 -22
  290. package/Templates/Shapes/ConeVoxelTemplate.js +0 -69
  291. package/Templates/Shapes/CylinderVoxelTemplate.d.ts +0 -22
  292. package/Templates/Shapes/CylinderVoxelTemplate.js +0 -69
  293. package/Templates/Shapes/OctahedronVoxelTemplate.d.ts +0 -22
  294. package/Templates/Shapes/OctahedronVoxelTemplate.js +0 -69
  295. package/Templates/Shapes/PyramidVoxelTemplate.d.ts +0 -30
  296. package/Templates/Shapes/PyramidVoxelTemplate.js +0 -140
  297. package/Templates/Shapes/SphereVoxelTemplate.d.ts +0 -24
  298. package/Templates/Shapes/SphereVoxelTemplate.js +0 -97
  299. package/Templates/Shapes/TorusVoxelTemplate.d.ts +0 -22
  300. package/Templates/Shapes/TorusVoxelTemplate.js +0 -69
  301. package/Templates/VoxelTempateRegister.js +0 -30
  302. /package/{Mesher/Models/Nodes/Types/GeomtryNode.types.js → Builder/RayProvider.js} +0 -0
  303. /package/Mesher/{Functions/MeshTexture.d.ts → Items/MeshTextureO.d.ts} +0 -0
  304. /package/Mesher/{Functions → Voxels/Base}/CompactVoxelSectionMesh.js +0 -0
  305. /package/Mesher/{Geomtry → Voxels/Geomtry}/VoxelMeshBVHStructCursor.d.ts +0 -0
  306. /package/Mesher/{Geomtry → Voxels/Geomtry}/VoxelMeshBVHStructCursor.js +0 -0
  307. /package/Mesher/{Geomtry → Voxels/Geomtry}/VoxelMeshVertexStructCursor.d.ts +0 -0
  308. /package/Mesher/{Geomtry → Voxels/Geomtry}/VoxelMeshVertexStructCursor.js +0 -0
  309. /package/Mesher/{Geomtry → Voxels/Geomtry}/VoxelShaderData.d.ts +0 -0
  310. /package/Mesher/{Geomtry → Voxels/Geomtry}/VoxelShaderData.js +0 -0
  311. /package/Mesher/{Functions → Voxels}/MeshSection.d.ts +0 -0
  312. /package/Mesher/{Functions → Voxels}/MeshSection.js +0 -0
  313. /package/Mesher/{Functions → Voxels}/MeshSectionSnapShot.d.ts +0 -0
  314. /package/Mesher/{Functions → Voxels}/MeshSectionSnapShot.js +0 -0
  315. /package/Mesher/{Models → Voxels/Models}/Common/Faces/CullRulledFace.d.ts +0 -0
  316. /package/Mesher/{Models → Voxels/Models}/Common/Faces/ShadeRulelessFace.js +0 -0
  317. /package/Mesher/{Models → Voxels/Models}/Common/GetTexture.js +0 -0
  318. /package/Mesher/{Models → Voxels/Models}/Nodes/Custom/index.d.ts +0 -0
  319. /package/Mesher/{Models → Voxels/Models}/Nodes/Custom/index.js +0 -0
  320. /package/Mesher/{Models → Voxels/Models}/Nodes/GeometryNode.d.ts +0 -0
  321. /package/Mesher/{Models → Voxels/Models}/Nodes/GeometryNode.js +0 -0
  322. /package/Mesher/{Models → Voxels/Models}/Nodes/Types/GeomtryNode.types.d.ts +0 -0
  323. /package/{Templates/Selection/VoxelSelecton.js → Mesher/Voxels/Models/Nodes/Types/GeomtryNode.types.js} +0 -0
  324. /package/Mesher/{Models → Voxels/Models}/Nodes/Types/QuadVoxelGometryNodeTypes.js +0 -0
  325. /package/Mesher/{Models → Voxels/Models}/Nodes/Types/TriangleVoxelGometryNodeTypes.js +0 -0
  326. /package/Mesher/{Models → Voxels/Models}/Nodes/VoxelGeometryConstructor.js +0 -0
  327. /package/Mesher/{Models → Voxels/Models}/Procedures/TextureProcedure.js +0 -0
  328. /package/Mesher/{Models → Voxels/Models}/Procedures/TextureProcedureRegister.d.ts +0 -0
  329. /package/Mesher/{Models → Voxels/Models}/RenderedMaterials.d.ts +0 -0
  330. /package/Mesher/{Models → Voxels/Models}/RenderedMaterials.js +0 -0
@@ -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
- _displayTicks: Uint32Array;
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>;
@@ -0,0 +1,55 @@
1
+ import { WorldSimulation } from "../WorldSimulation";
2
+ import { WorldSimulationDimensions } from "../Internal/WorldSimulationDimensions";
3
+ import { WorldSimulationTools } from "../Internal/WorldSimulationTools";
4
+ import SaveAllSectors from "./SaveAllSectors";
5
+ /**# InitalLoad
6
+ * ---
7
+ * Load the world without building.
8
+ */
9
+ export async function BuildOnly(props) {
10
+ return new Promise((resolve) => {
11
+ const generator = WorldSimulation.createGenerator({
12
+ ...props.genData,
13
+ building: false,
14
+ culling: false,
15
+ });
16
+ if (!WorldSimulationDimensions._dimensions.has(generator._dimension)) {
17
+ WorldSimulationDimensions.addDimension(generator._dimension);
18
+ }
19
+ const dimension = WorldSimulationDimensions.getDimension(props.dimension || 0);
20
+ let done = false;
21
+ generator._building = false;
22
+ WorldSimulation.addGenerator(generator);
23
+ let timeOut = null;
24
+ const update = () => {
25
+ if (done)
26
+ return;
27
+ WorldSimulation.tick(true);
28
+ timeOut = setTimeout(update, 0);
29
+ };
30
+ update();
31
+ const inte = setInterval(() => {
32
+ let allDone = true;
33
+ for (const [key, task] of dimension.tasks) {
34
+ if (!task.generationTask)
35
+ continue;
36
+ if (task.waitingFor > 0 || task._task.size > 0) {
37
+ allDone = false;
38
+ break;
39
+ }
40
+ }
41
+ if (!allDone)
42
+ return;
43
+ done = true;
44
+ clearInterval(inte);
45
+ clearTimeout(timeOut);
46
+ WorldSimulation.removeGenerator(generator);
47
+ (async () => {
48
+ if (WorldSimulationTools.worldStorage) {
49
+ await SaveAllSectors();
50
+ }
51
+ resolve(true);
52
+ })();
53
+ }, 250);
54
+ });
55
+ }
@@ -29,6 +29,9 @@ export async function InitalLoad(props) {
29
29
  };
30
30
  update();
31
31
  const inte = setInterval(() => {
32
+ if (props.logTasks) {
33
+ console.log(WorldSimulation.logTasks());
34
+ }
32
35
  let allDone = true;
33
36
  for (const [key, task] of dimension.tasks) {
34
37
  if (!task.generationTask)
@@ -14,6 +14,8 @@ export type SimulationTaskBaseData = {
14
14
  export declare class SimulationTaskBase {
15
15
  data: SimulationTaskBaseData;
16
16
  constructor(data: SimulationTaskBaseData);
17
+ getTotal(dimensionId: number): number;
18
+ getTotalWaitingFor(dimensionId: number): number;
17
19
  add(dimensionId: number, x: number, y: number, z: number): void;
18
20
  runTask(max?: number): void;
19
21
  }
@@ -4,6 +4,16 @@ export class SimulationTaskBase {
4
4
  constructor(data) {
5
5
  this.data = data;
6
6
  }
7
+ getTotal(dimensionId) {
8
+ const dimension = WorldSimulationDimensions.getDimension(dimensionId);
9
+ const task = dimension.getTask(this.data.id);
10
+ return task.nodes.length;
11
+ }
12
+ getTotalWaitingFor(dimensionId) {
13
+ const dimension = WorldSimulationDimensions.getDimension(dimensionId);
14
+ const task = dimension.getTask(this.data.id);
15
+ return task.waitingFor;
16
+ }
7
17
  add(dimensionId, x, y, z) {
8
18
  const dimension = WorldSimulationDimensions.getDimension(dimensionId);
9
19
  const task = dimension.getTask(this.data.id);
@@ -27,7 +37,6 @@ export class SimulationTaskBase {
27
37
  const updatePosition = dimension.getUpdatePosition();
28
38
  task.sort(updatePosition.x, updatePosition.y, updatePosition.z);
29
39
  }
30
- let count = 0;
31
40
  const addBack = [];
32
41
  for (const location of task.run()) {
33
42
  const [d, x, y, z] = location;
@@ -38,9 +47,8 @@ export class SimulationTaskBase {
38
47
  }
39
48
  const taskId = task.addTask(x, y, z);
40
49
  this.data.run(dimension, location, taskId, task, sector);
41
- if (count + task.waitingFor > max)
50
+ if (task.waitingFor > max)
42
51
  break;
43
- count++;
44
52
  }
45
53
  for (let i = 0; i < addBack.length; i += 3) {
46
54
  task.add(addBack[i], addBack[i + 1], addBack[i + 2]);
@@ -3,13 +3,14 @@ import { DimensionSegment } from "../Dimensions/DimensionSegment";
3
3
  export declare class TaskSegment {
4
4
  dimension: DimensionSegment;
5
5
  generationTask: boolean;
6
+ log: boolean;
6
7
  _hash: Set<unknown>;
7
8
  nodes: LocationData[];
8
9
  waitingFor: number;
9
10
  clear(): void;
10
11
  _taskCount: number;
11
12
  _task: Map<number, LocationData>;
12
- constructor(dimension: DimensionSegment, generationTask: boolean);
13
+ constructor(dimension: DimensionSegment, generationTask: boolean, log?: boolean);
13
14
  _getLocationData(dimension: number, x: number, y: number, z: number): LocationData;
14
15
  completeTask(id: number): boolean;
15
16
  addTask(x: number, y: number, z: number): number;
@@ -3,15 +3,17 @@ const pool = [];
3
3
  export class TaskSegment {
4
4
  dimension;
5
5
  generationTask;
6
+ log;
6
7
  _hash = new Set();
7
8
  nodes = [];
8
9
  waitingFor = 0;
9
10
  clear() { }
10
11
  _taskCount = 0;
11
12
  _task = new Map();
12
- constructor(dimension, generationTask) {
13
+ constructor(dimension, generationTask, log = false) {
13
14
  this.dimension = dimension;
14
15
  this.generationTask = generationTask;
16
+ this.log = log;
15
17
  }
16
18
  _getLocationData(dimension, x, y, z) {
17
19
  const location = pool.length ? pool.shift() : [0, 0, 0, 0];
@@ -4,6 +4,8 @@ export declare class TickQueue {
4
4
  dimension: DimensionSegment;
5
5
  constructor(dimension: DimensionSegment);
6
6
  ticks: Map<number, VoxelTickUpdate<null>[]>;
7
+ getTotalTicks(): number;
7
8
  addTick(data: VoxelTickUpdate, delay?: number): void;
9
+ private compareTick;
8
10
  run(): boolean;
9
11
  }
@@ -1,3 +1,4 @@
1
+ import { Vector3Like } from "@amodx/math";
1
2
  import { VoxelTickUpdateRegister, } from "../Voxels/Ticks/index";
2
3
  const tickArrayPool = [];
3
4
  export class TickQueue {
@@ -6,14 +7,39 @@ export class TickQueue {
6
7
  this.dimension = dimension;
7
8
  }
8
9
  ticks = new Map();
10
+ getTotalTicks() {
11
+ const tick = this.dimension.getTick();
12
+ const updates = this.ticks.get(tick);
13
+ if (!updates)
14
+ return 0;
15
+ return updates.length;
16
+ }
9
17
  addTick(data, delay = 0) {
10
18
  const trueTick = this.dimension.getTick() + 1 + delay;
11
19
  if (!this.ticks.get(trueTick)) {
12
20
  this.ticks.set(trueTick, tickArrayPool.length ? tickArrayPool.shift() : []);
13
21
  }
14
22
  const ticks = this.ticks.get(trueTick);
23
+ for (let i = 0; i < ticks.length; i++) {
24
+ if (this.compareTick(data, ticks[i])) {
25
+ return;
26
+ }
27
+ }
15
28
  ticks.push(data);
16
29
  }
30
+ compareTick(tick, otherTick) {
31
+ if (!(tick.type == otherTick.type && Vector3Like.Equals(otherTick, tick)))
32
+ return false;
33
+ if (!tick.data)
34
+ return true;
35
+ if (typeof tick.data == "number") {
36
+ return tick.data == otherTick.data;
37
+ }
38
+ if (typeof tick.data == "string") {
39
+ return tick.data == otherTick.data;
40
+ }
41
+ return JSON.stringify(tick.data) == JSON.stringify(otherTick.data);
42
+ }
17
43
  run() {
18
44
  const tick = this.dimension.getTick();
19
45
  const updates = this.ticks.get(tick);
@@ -4,6 +4,7 @@ import { LocationData } from "../../Math";
4
4
  import { IVoxelTemplate } from "../../Templates/VoxelTemplates.types";
5
5
  import { VoxelUpdateData } from "../../Tasks/Tasks.types";
6
6
  import { VoxelPath } from "../../Templates/Path/VoxelPath";
7
+ import { IVoxelSelection } from "../../Templates/Selection/VoxelSelection";
7
8
  export declare class SimulationBrush extends BrushTool {
8
9
  _dimension: DimensionSegment;
9
10
  private taskTool;
@@ -20,6 +21,8 @@ export declare class SimulationBrush extends BrushTool {
20
21
  eraseAsync(updateData?: VoxelUpdateData): Promise<void>;
21
22
  eraseTemplate(voxelTemplate: IVoxelTemplate, updateData?: VoxelUpdateData): this;
22
23
  eraseTemplateAsync(voxelTemplate: IVoxelTemplate, updateData?: VoxelUpdateData): Promise<this>;
24
+ eraseSelection(selection: IVoxelSelection, updateData?: VoxelUpdateData): this;
25
+ eraseSelectionAsync(selection: IVoxelSelection, updateData?: VoxelUpdateData): Promise<this>;
23
26
  erasePath(voxelPath: VoxelPath, updateData?: VoxelUpdateData): this;
24
27
  erasePathAsync(voxelPath: VoxelPath, updateData?: VoxelUpdateData): Promise<this>;
25
28
  }
@@ -9,6 +9,7 @@ import PaintVoxelPath from "../../Tasks/Paint/Paint/PaintVoxelPath";
9
9
  import { EraseVoxel } from "../../Tasks/Paint/Erase/EraseVoxel";
10
10
  import EraseVoxelTemplate from "../../Tasks/Paint/Erase/EraseVoxelTemplate";
11
11
  import EraseVoxelPath from "../../Tasks/Paint/Erase/EraseVoxelPath";
12
+ import EraseVoxelSelection from "../../Tasks/Paint/Erase/EraseVoxelSelection";
12
13
  export class SimulationBrush extends BrushTool {
13
14
  _dimension;
14
15
  taskTool;
@@ -187,6 +188,57 @@ export class SimulationBrush extends BrushTool {
187
188
  ]);
188
189
  return this;
189
190
  }
191
+ eraseSelection(selection, updateData = {}) {
192
+ const { x: ox, y: oy, z: oz } = this;
193
+ const { x: sx, y: sy, z: sz } = selection.bounds.size;
194
+ for (let x = 0; x < sx; x++) {
195
+ for (let y = 0; y < sy; y++) {
196
+ for (let z = 0; z < sz; z++) {
197
+ const tx = ox + x;
198
+ const ty = oy + y;
199
+ const tz = oz + z;
200
+ if (selection.isSelected(tx, ty, tz))
201
+ continue;
202
+ const voxel = this.dataCursor.getVoxel(tx, ty, tz);
203
+ if (!voxel)
204
+ continue;
205
+ const tags = VoxelTagsRegister.VoxelTags[VoxelPalettesRegister.voxelIds.getNumberId(this.data.id)];
206
+ const behavior = VoxelBehaviorsRegister.get(tags["dve_simulation_behavior"] || "default");
207
+ behavior.onErase(this._dimension.simulation, tx, ty, tz);
208
+ }
209
+ }
210
+ }
211
+ EraseVoxelSelection(this.dimension, [this.x, this.y, this.z], selection.toJSON(), updateData);
212
+ return this;
213
+ }
214
+ async eraseSelectionAsync(selection, updateData = {}) {
215
+ const { x: ox, y: oy, z: oz } = this;
216
+ const { x: sx, y: sy, z: sz } = selection.bounds.size;
217
+ for (let x = 0; x < sx; x++) {
218
+ for (let y = 0; y < sy; y++) {
219
+ for (let z = 0; z < sz; z++) {
220
+ const tx = ox + x;
221
+ const ty = oy + y;
222
+ const tz = oz + z;
223
+ if (selection.isSelected(tx, ty, tz))
224
+ continue;
225
+ const voxel = this.dataCursor.getVoxel(tx, ty, tz);
226
+ if (!voxel)
227
+ continue;
228
+ const tags = VoxelTagsRegister.VoxelTags[VoxelPalettesRegister.voxelIds.getNumberId(this.data.id)];
229
+ const behavior = VoxelBehaviorsRegister.get(tags["dve_simulation_behavior"] || "default");
230
+ behavior.onErase(this._dimension.simulation, tx, ty, tz);
231
+ }
232
+ }
233
+ }
234
+ await this.taskTool.voxel.eraseTemplate.runAsync([
235
+ this.dimension,
236
+ [this.x, this.y, this.z],
237
+ selection.toJSON(),
238
+ updateData,
239
+ ]);
240
+ return this;
241
+ }
190
242
  erasePath(voxelPath, updateData = {}) {
191
243
  EraseVoxelPath(this.dimension, [this.x, this.y, this.z], voxelPath.toJSON(), updateData);
192
244
  return this;
@@ -1,6 +1,9 @@
1
1
  import { VoxelBehaviorsRegister } from "../VoxelBehaviorsRegister";
2
2
  VoxelBehaviorsRegister.register({
3
3
  type: "dve_default",
4
+ needUpdate(simulation, voxel, x, y, z) {
5
+ return false;
6
+ },
4
7
  onInteract(simulation, voxel, x, y, z) { },
5
8
  onPaint(simulation, voxel, x, y, z) { },
6
9
  onErase(simulation, voxel, x, y, z) { },
@@ -1,7 +1,27 @@
1
- import { CardinalNeighbors3D } from "../../../../Math/CardinalNeighbors";
1
+ import { CardinalNeighbors2D, CardinalNeighbors3D } from "../../../../Math/CardinalNeighbors";
2
2
  import { VoxelBehaviorsRegister } from "../VoxelBehaviorsRegister";
3
3
  VoxelBehaviorsRegister.register({
4
4
  type: "dve_liquid",
5
+ needUpdate(simulation, voxel, x, y, z) {
6
+ let scheduleUpdate = false;
7
+ for (let i = 0; i < CardinalNeighbors2D.length; i++) {
8
+ const nx = CardinalNeighbors2D[i][0] + x;
9
+ const nz = CardinalNeighbors2D[i][1] + z;
10
+ const nVoxel = simulation.nDataCursor.getVoxel(nx, y, nz);
11
+ if (nVoxel && !nVoxel.isSameVoxel(voxel) && nVoxel.isAir()) {
12
+ scheduleUpdate = true;
13
+ break;
14
+ }
15
+ }
16
+ const downVoxel = simulation.nDataCursor.getVoxel(x, y - 1, z);
17
+ if (downVoxel && !downVoxel.isSameVoxel(voxel) && downVoxel.isAir()) {
18
+ scheduleUpdate = true;
19
+ }
20
+ if (scheduleUpdate) {
21
+ simulation.scheduleUpdate("dve_liquid", x, y, z, 0);
22
+ }
23
+ return scheduleUpdate;
24
+ },
5
25
  onPaint(simulation, voxel, x, y, z) {
6
26
  simulation.scheduleUpdate("dve_liquid", x, y, z, 0);
7
27
  },
@@ -3,6 +3,7 @@ import { VoxelCursorInterface } from "../../../Voxels/Cursor/VoxelCursor.interfa
3
3
  export interface VoxelBehaviorsData {
4
4
  type: string;
5
5
  inherits?: string;
6
+ needUpdate?(simulation: DimensionSimulation, voxel: VoxelCursorInterface, x: number, y: number, z: number): boolean;
6
7
  onInteract?(simulation: DimensionSimulation, voxel: VoxelCursorInterface, x: number, y: number, z: number): void;
7
8
  onPaint?(simulation: DimensionSimulation, voxel: VoxelCursorInterface, x: number, y: number, z: number): void;
8
9
  onErase?(simulation: DimensionSimulation, voxel: VoxelCursorInterface, x: number, y: number, z: number): void;
@@ -11,6 +12,7 @@ export interface VoxelBehaviorsData {
11
12
  export declare class VoxelBehavior {
12
13
  data: VoxelBehaviorsData;
13
14
  constructor(data: VoxelBehaviorsData);
15
+ needUpdate(simulation: DimensionSimulation, x: number, y: number, z: number): boolean | undefined;
14
16
  onInteract(simulation: DimensionSimulation, x: number, y: number, z: number): void;
15
17
  onPaint(simulation: DimensionSimulation, x: number, y: number, z: number): void;
16
18
  onErase(simulation: DimensionSimulation, x: number, y: number, z: number): void;
@@ -3,6 +3,12 @@ export class VoxelBehavior {
3
3
  constructor(data) {
4
4
  this.data = data;
5
5
  }
6
+ needUpdate(simulation, x, y, z) {
7
+ if (!this.data.needUpdate)
8
+ return;
9
+ const voxel = simulation.getVoxelForUpdate(x, y, z);
10
+ return this.data.needUpdate(simulation, voxel, x, y, z);
11
+ }
6
12
  onInteract(simulation, x, y, z) {
7
13
  if (!this.data.onInteract)
8
14
  return;