@divinevoxel/vlox 0.0.76 → 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 (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
@@ -9,16 +9,11 @@ var WrenchToolModes;
9
9
  WrenchToolModes["Update"] = "Update";
10
10
  })(WrenchToolModes || (WrenchToolModes = {}));
11
11
  export class WrenchTool extends BuilderToolBase {
12
- space;
13
12
  static ToolId = "Wrench";
14
13
  mode = WrenchToolModes.Pick;
15
14
  selection = new VoxelPointSelection();
16
15
  paintData = PaintVoxelData.Create();
17
16
  _pickedResult = null;
18
- constructor(space) {
19
- super();
20
- this.space = space;
21
- }
22
17
  isUpdating() {
23
18
  if (this._pickedResult !== null && this.mode == WrenchToolModes.Update)
24
19
  return true;
@@ -28,11 +23,16 @@ export class WrenchTool extends BuilderToolBase {
28
23
  this.mode = WrenchToolModes.Pick;
29
24
  this._pickedResult = null;
30
25
  }
31
- updatePlacer(picked) {
32
- console.log("update placer", this.mode);
26
+ async update() {
27
+ this._lastPicked = await this.space.pickWithProvider(this.rayProviderIndex);
28
+ if (!this._lastPicked)
29
+ return;
33
30
  if (this.mode == WrenchToolModes.Pick) {
34
- this._pickedResult = picked;
35
- this.selection.reConstruct(picked.position);
31
+ if (!this.space.bounds.intersectsPoint(this._lastPicked.position)) {
32
+ this._lastPicked = null;
33
+ return;
34
+ }
35
+ this.selection.reConstruct(this._lastPicked.position);
36
36
  }
37
37
  }
38
38
  processSchema(schema) {
@@ -100,7 +100,6 @@ export class WrenchTool extends BuilderToolBase {
100
100
  const voxelSchemas = SchemaRegister.getVoxelSchemas(id);
101
101
  voxelSchemas.state.startEncoding(this._pickedResult.voxel.getState());
102
102
  voxelSchemas.mod.startEncoding(this._pickedResult.voxel.getMod());
103
- console.warn("get picked schemas", { id }, SchemaRegister.stateSchemaData);
104
103
  return {
105
104
  stateSchema: this.processSchema(voxelSchemas.state),
106
105
  modSchema: this.processSchema(voxelSchemas.mod),
@@ -151,10 +150,13 @@ export class WrenchTool extends BuilderToolBase {
151
150
  }
152
151
  return voxelStates;
153
152
  }
153
+ cancel() {
154
+ this._lastPicked = null;
155
+ }
154
156
  async use() {
155
157
  if (this.mode == WrenchToolModes.Pick) {
156
- if (this._pickedResult && !this._pickedResult.voxel.isAir()) {
157
- this._pickedResult = this._pickedResult.clone();
158
+ if (this._lastPicked && !this._lastPicked.voxel.isAir()) {
159
+ this._pickedResult = this._lastPicked.clone();
158
160
  this.dispatch("picked", {});
159
161
  this.mode = WrenchToolModes.Update;
160
162
  return;
@@ -169,7 +171,14 @@ export class WrenchTool extends BuilderToolBase {
169
171
  this.selection.origin.y,
170
172
  this.selection.origin.z,
171
173
  ], this.paintData);
172
- return true;
174
+ return;
173
175
  }
174
176
  }
177
+ getOptionValue(id) {
178
+ return null;
179
+ }
180
+ getCurrentOptions() {
181
+ return [];
182
+ }
183
+ updateOption(property, value) { }
175
184
  }
@@ -0,0 +1,12 @@
1
+ import { VoxelBuildSpace } from "../VoxelBuildSpace";
2
+ import { VoxelBoundsSelection } from "../../Templates/Selection/VoxelBoundsSelection";
3
+ import { Vector3Like } from "@amodx/math";
4
+ import { FreePointSelection } from "./FreePointSelection";
5
+ export declare class FreeBoxSelection {
6
+ space: VoxelBuildSpace;
7
+ point: FreePointSelection;
8
+ start: Vector3Like;
9
+ selection: VoxelBoundsSelection;
10
+ constructor(space: VoxelBuildSpace, point: FreePointSelection);
11
+ update(): void;
12
+ }
@@ -0,0 +1,21 @@
1
+ import { VoxelBoundsSelection } from "../../Templates/Selection/VoxelBoundsSelection";
2
+ import { Axes } from "@amodx/math/Vectors/Axes";
3
+ export class FreeBoxSelection {
4
+ space;
5
+ point;
6
+ start;
7
+ selection;
8
+ constructor(space, point) {
9
+ this.space = space;
10
+ this.point = point;
11
+ this.start = { ...point.selection.origin };
12
+ this.selection = new VoxelBoundsSelection();
13
+ this.selection.reConstruct(this.start, Axes.UpReadOnly(), this.start, Axes.UpReadOnly());
14
+ }
15
+ update() {
16
+ const point = this.point.getPoint();
17
+ if (!point)
18
+ return;
19
+ this.selection.reConstruct(this.start, Axes.UpReadOnly(), point, Axes.UpReadOnly());
20
+ }
21
+ }
@@ -0,0 +1,14 @@
1
+ import { VoxelBuildSpace } from "../VoxelBuildSpace";
2
+ import { Vector3Like } from "@amodx/math";
3
+ import { VoxelPointSelection } from "../../Templates/Selection/VoxelPointSelection";
4
+ export declare class FreePointSelection {
5
+ space: VoxelBuildSpace;
6
+ selection: VoxelPointSelection;
7
+ distance: number;
8
+ planeOrigin: Vector3Like;
9
+ planeNormal: Vector3Like;
10
+ offset: number;
11
+ constructor(space: VoxelBuildSpace, selection: VoxelPointSelection, distance?: number);
12
+ getPoint(): Vector3Like | undefined;
13
+ update(): boolean;
14
+ }
@@ -0,0 +1,39 @@
1
+ import { Vector3Like } from "@amodx/math";
2
+ export class FreePointSelection {
3
+ space;
4
+ selection;
5
+ distance;
6
+ planeOrigin = Vector3Like.Create();
7
+ planeNormal = Vector3Like.Create();
8
+ offset = 0;
9
+ constructor(space, selection, distance = 10) {
10
+ this.space = space;
11
+ this.selection = selection;
12
+ this.distance = distance;
13
+ }
14
+ getPoint() {
15
+ let rayPosition = Vector3Like.FloorInPlace(Vector3Like.Add(this.space.rayProvider.origin, Vector3Like.MultiplyScalar(this.space.rayProvider.direction, this.distance)));
16
+ if (!this.space.bounds.intersectsPoint(rayPosition)) {
17
+ const rayIntersection = this.space.bounds.rayIntersection(this.space.rayProvider.origin, this.space.rayProvider.direction, this.space.rayProvider.length);
18
+ if (!isFinite(rayIntersection))
19
+ return;
20
+ if (rayIntersection == 0) {
21
+ const rayIntersectionFromWithin = this.space.bounds.rayIntersectionFromWithin(this.space.rayProvider.origin, this.space.rayProvider.direction, this.space.rayProvider.length);
22
+ if (!isFinite(rayIntersectionFromWithin))
23
+ return;
24
+ rayPosition = Vector3Like.FloorInPlace(Vector3Like.Add(this.space.rayProvider.origin, Vector3Like.MultiplyScalar(this.space.rayProvider.direction, rayIntersectionFromWithin)));
25
+ }
26
+ else {
27
+ rayPosition = Vector3Like.FloorInPlace(Vector3Like.Add(this.space.rayProvider.origin, Vector3Like.MultiplyScalar(this.space.rayProvider.direction, rayIntersection)));
28
+ }
29
+ }
30
+ return rayPosition;
31
+ }
32
+ update() {
33
+ const point = this.getPoint();
34
+ if (!point)
35
+ return false;
36
+ this.selection.reConstruct(point);
37
+ return true;
38
+ }
39
+ }
@@ -0,0 +1,12 @@
1
+ import { VoxelBuildSpace } from "../VoxelBuildSpace";
2
+ import { VoxelBoundsSelection } from "../../Templates/Selection/VoxelBoundsSelection";
3
+ import { Vector3Like } from "@amodx/math";
4
+ export declare class SurfaceBoxSelection {
5
+ space: VoxelBuildSpace;
6
+ selection: VoxelBoundsSelection;
7
+ planeOrigin: Vector3Like;
8
+ planeNormal: Vector3Like;
9
+ offset: number;
10
+ constructor(space: VoxelBuildSpace, selection: VoxelBoundsSelection);
11
+ update(): void;
12
+ }
@@ -1,5 +1,5 @@
1
1
  import { Vector3Like } from "@amodx/math";
2
- export class BoxSelection {
2
+ export class SurfaceBoxSelection {
3
3
  space;
4
4
  selection;
5
5
  planeOrigin = Vector3Like.Create();
@@ -12,8 +12,6 @@ export class BoxSelection {
12
12
  update() {
13
13
  const rayOrigin = this.space.rayProvider.origin;
14
14
  const rayDirection = this.space.rayProvider.direction;
15
- console.warn("SPACE", this.space);
16
- console.warn("UPDATE BOX TOOL", [rayOrigin.x, rayOrigin.y, rayOrigin.z], [rayDirection.x, rayDirection.y, rayDirection.z]);
17
15
  const distance = Vector3Like.Dot(Vector3Like.Subtract(this.planeOrigin, rayOrigin), this.planeNormal) / Vector3Like.Dot(rayDirection, this.planeNormal);
18
16
  const intersectionPoint = Vector3Like.FloorInPlace(Vector3Like.Add(rayOrigin, Vector3Like.MultiplyScalar(rayDirection, distance)));
19
17
  let offset = this.offset;
@@ -8,54 +8,66 @@ import { VoxelPickResult } from "../Voxels/Interaction/VoxelPickResult";
8
8
  import { RayProvider } from "./RayProvider";
9
9
  import { FullVoxelTemplate } from "../Templates/Full/FullVoxelTemplate";
10
10
  import { BoundsMinMaxData } from "@amodx/math/Geomtry/Bounds/BoundsInterface";
11
- import { VoxelSurfaceSelectionData } from "Templates/Selection/VoxelSurfaceSelection";
12
- import { VoxelBFSSelectionData } from "Templates/Selection/VoxelBFSSelection";
13
- export type VoxelSpaceUpdateData = {
14
- type: "clear";
15
- } | {
16
- type: "paint-voxel";
11
+ import type { VoxelSurfaceSelectionData } from "../Templates/Selection/VoxelSurfaceSelection";
12
+ import type { VoxelBFSSelectionData } from "../Templates/Selection/VoxelBFSSelection";
13
+ import { IVoxelSelectionData } from "../Templates/Selection/VoxelSelection";
14
+ import "../Templates/VoxelTemplateRegister";
15
+ type VoxelSpaceBaseUpdateData<Type extends string, Data extends any> = {
16
+ type: Type;
17
+ remote?: true;
18
+ } & Data;
19
+ export type VoxelSpaceUpdateData = VoxelSpaceBaseUpdateData<"paint-voxel", {
17
20
  position: Vec3Array;
18
21
  voxel: PaintVoxelData;
19
- } | {
20
- type: "erase-voxel";
22
+ }> | VoxelSpaceBaseUpdateData<"erase-voxel", {
21
23
  position: Vec3Array;
22
- } | {
23
- type: "paint-voxel-template";
24
+ }> | VoxelSpaceBaseUpdateData<"paint-voxel-template", {
24
25
  position: Vec3Array;
25
26
  template: IVoxelTemplateData<any>;
26
- } | {
27
- type: "erase-voxel-template";
27
+ }> | VoxelSpaceBaseUpdateData<"erase-voxel-template", {
28
28
  position: Vec3Array;
29
29
  template: IVoxelTemplateData<any>;
30
- } | {
31
- type: "paint-voxel-path";
30
+ }> | VoxelSpaceBaseUpdateData<"erase-voxel-selection", {
31
+ selection: IVoxelSelectionData<any>;
32
+ }> | VoxelSpaceBaseUpdateData<"paint-voxel-path", {
32
33
  position: Vec3Array;
33
34
  path: VoxelPathData;
34
- } | {
35
- type: "erase-voxel-path";
35
+ }> | VoxelSpaceBaseUpdateData<"erase-voxel-path", {
36
36
  position: Vec3Array;
37
37
  path: VoxelPathData;
38
- };
38
+ }>;
39
39
  export declare class VoxelBuildSpace {
40
40
  DVER: DivineVoxelEngineRender;
41
- rayProvider: RayProvider;
42
- beforeUpdate: (data: VoxelSpaceUpdateData) => void;
43
- afterUpdate: (data: VoxelSpaceUpdateData) => void;
41
+ /**Callback that is called before the update is ran. */
42
+ beforeUpdate: ((data: VoxelSpaceUpdateData) => Promise<void> | void) | null;
43
+ /**Callback that is called durning the update call using Promise.all. */
44
+ duringUpdate: ((data: VoxelSpaceUpdateData) => Promise<void> | void) | null;
45
+ /**Callback that is called after the update is ran. */
46
+ afterUpdate: ((data: VoxelSpaceUpdateData) => Promise<void> | void) | null;
44
47
  bounds: BoundingBox;
48
+ private _rayProviders;
49
+ get rayProvider(): RayProvider;
45
50
  constructor(DVER: DivineVoxelEngineRender, rayProvider: RayProvider, min?: Vector3Like, max?: Vector3Like);
46
- pick(rayOrigin: Vector3Like, rayDirection: Vector3Like, length: number): Promise<VoxelPickResult | null>;
51
+ addRayProvider(index: number, provider: RayProvider): void;
52
+ getRayProvider(index: number): RayProvider | null;
53
+ removeRayProvider(index: number): void;
54
+ /**Pick the current voxel space. Defaults to the rayProvider values. */
55
+ pick(rayOrigin?: Vector3Like, rayDirection?: Vector3Like, length?: number): Promise<VoxelPickResult | null>;
56
+ pickWithProvider(index: number): Promise<VoxelPickResult | null>;
47
57
  createTemplate(bounds: BoundsMinMaxData): Promise<FullVoxelTemplate>;
48
58
  getSurfaceSelection(position: Vector3Like, normal: Vector3Like, extrusion: number, maxSize?: number): Promise<VoxelSurfaceSelectionData>;
49
- getSurfaceSelectionTemplate(position: Vector3Like, normal: Vector3Like, extrusion: number, maxSize: number, voxelDataOrExtrude: true | PaintVoxelData): Promise<FullVoxelTemplate>;
50
59
  getBFSSelection(position: Vector3Like, maxSize?: number): Promise<VoxelBFSSelectionData>;
51
- getBFSSelectionTemplate(position: Vector3Like, maxSize?: number): Promise<FullVoxelTemplate>;
60
+ getExtrudedSelectionTemplate(selection: IVoxelSelectionData<any>, nomral: Vector3Like): Promise<FullVoxelTemplate>;
52
61
  getPlaceState(data: PaintVoxelData, picked: VoxelPickResult, alt?: number | null): PaintVoxelData | undefined;
53
- private _update;
54
- private _doUpdate;
62
+ clear(): Promise<boolean>;
63
+ private _updateFunctions;
64
+ update<T extends VoxelSpaceUpdateData>(data: T): Promise<void>;
55
65
  paintVoxel(position: Vec3Array | Vector3Like, voxel: PaintVoxelData): Promise<void>;
56
66
  eraseVoxel(position: Vec3Array | Vector3Like): Promise<void>;
57
67
  paintTemplate(position: Vec3Array | Vector3Like | Vector3Like, template: IVoxelTemplateData<any>): Promise<void>;
58
68
  eraseTemplate(position: Vec3Array | Vector3Like, template: IVoxelTemplateData<any>): Promise<void>;
69
+ eraseSelection(selection: IVoxelSelectionData<any>): Promise<void>;
59
70
  paintPath(position: Vec3Array | Vector3Like, path: VoxelPathData): Promise<void>;
60
71
  erasePath(position: Vec3Array | Vector3Like, path: VoxelPathData): Promise<void>;
61
72
  }
73
+ export {};
@@ -5,18 +5,38 @@ import { VoxelPlacingStrategyRegister } from "../Voxels/Interaction/Placing/Voxe
5
5
  import { VoxelPickResult } from "../Voxels/Interaction/VoxelPickResult";
6
6
  import { SchemaRegister } from "../Voxels/State/SchemaRegister";
7
7
  import { FullVoxelTemplate } from "../Templates/Full/FullVoxelTemplate";
8
+ import { VoxelShapeTemplate } from "../Templates/Shapes/VoxelShapeTemplate";
9
+ import { BoxVoxelShapeSelection } from "../Templates/Shapes/Selections/BoxVoxelShapeSelection";
10
+ import "../Templates/VoxelTemplateRegister";
8
11
  export class VoxelBuildSpace {
9
12
  DVER;
10
- rayProvider;
11
- beforeUpdate;
12
- afterUpdate;
13
+ /**Callback that is called before the update is ran. */
14
+ beforeUpdate = null;
15
+ /**Callback that is called durning the update call using Promise.all. */
16
+ duringUpdate = null;
17
+ /**Callback that is called after the update is ran. */
18
+ afterUpdate = null;
13
19
  bounds;
20
+ _rayProviders = [];
21
+ get rayProvider() {
22
+ return this.getRayProvider(0);
23
+ }
14
24
  constructor(DVER, rayProvider, min = Vector3Like.Create(-Infinity, -Infinity, -Infinity), max = Vector3Like.Create(Infinity, Infinity, Infinity)) {
15
25
  this.DVER = DVER;
16
- this.rayProvider = rayProvider;
17
26
  this.bounds = new BoundingBox(min, max);
27
+ this.addRayProvider(0, rayProvider);
28
+ }
29
+ addRayProvider(index, provider) {
30
+ this._rayProviders[index] = provider;
31
+ }
32
+ getRayProvider(index) {
33
+ return this._rayProviders[index];
18
34
  }
19
- async pick(rayOrigin, rayDirection, length) {
35
+ removeRayProvider(index) {
36
+ this._rayProviders[index] = null;
37
+ }
38
+ /**Pick the current voxel space. Defaults to the rayProvider values. */
39
+ async pick(rayOrigin = this.rayProvider.origin, rayDirection = this.rayProvider.direction, length = this.rayProvider.length) {
20
40
  const pickedVoxel = await this.DVER.threads.world.runTaskAsync("pick-voxel", [
21
41
  [rayOrigin.x, rayOrigin.y, rayOrigin.z],
22
42
  [rayDirection.x, rayDirection.y, rayDirection.z],
@@ -27,6 +47,13 @@ export class VoxelBuildSpace {
27
47
  }
28
48
  return VoxelPickResult.FromJSON(pickedVoxel);
29
49
  }
50
+ async pickWithProvider(index) {
51
+ const provider = this.getRayProvider(index);
52
+ if (!provider) {
53
+ throw new Error(`Ray Provider at index ${index} is not set`);
54
+ }
55
+ return await this.pick(provider.origin, this.rayProvider.direction, this.rayProvider.length);
56
+ }
30
57
  async createTemplate(bounds) {
31
58
  const templateData = await this.DVER.threads.world.runTaskAsync("create-voxel-template", [
32
59
  [0, ...Vector3Like.ToArray(bounds.min)],
@@ -37,14 +64,12 @@ export class VoxelBuildSpace {
37
64
  async getSurfaceSelection(position, normal, extrusion, maxSize) {
38
65
  return await this.DVER.threads.world.runTaskAsync("get-voxel-surface-selection", [position, normal, extrusion, maxSize]);
39
66
  }
40
- async getSurfaceSelectionTemplate(position, normal, extrusion, maxSize, voxelDataOrExtrude) {
41
- return new FullVoxelTemplate(await this.DVER.threads.world.runTaskAsync("get-voxel-surface-selection-template", [position, normal, extrusion, maxSize, voxelDataOrExtrude]));
42
- }
43
67
  async getBFSSelection(position, maxSize) {
44
68
  return await this.DVER.threads.world.runTaskAsync("get-voxel-bfs-selection", [position, maxSize]);
45
69
  }
46
- async getBFSSelectionTemplate(position, maxSize) {
47
- return new FullVoxelTemplate(await this.DVER.threads.world.runTaskAsync("get-voxel-bfs-selection-template", [position, maxSize]));
70
+ async getExtrudedSelectionTemplate(selection, nomral) {
71
+ const templateData = await this.DVER.threads.world.runTaskAsync("get-extruded-voxel-selection-template", [selection, nomral]);
72
+ return new FullVoxelTemplate(templateData);
48
73
  }
49
74
  getPlaceState(data, picked, alt = null) {
50
75
  const strategy = VoxelPlacingStrategyRegister.get(data.id);
@@ -58,59 +83,87 @@ export class VoxelBuildSpace {
58
83
  const schema = SchemaRegister.getVoxelSchemas(data.id);
59
84
  data.state = schema.state.readString(state);
60
85
  }
61
- async _update(update) {
62
- if (update.type == "paint-voxel") {
86
+ async clear() {
87
+ const size = this.bounds.size;
88
+ if (!isFinite(size.x) || !isFinite(size.y) || !isFinite(size.z))
89
+ return false;
90
+ const min = this.bounds.min;
91
+ await this.DVER.threads.world.runTaskAsync("erase-voxel-template", [
92
+ [0, min.x, min.y, min.z],
93
+ VoxelShapeTemplate.CreateNew({
94
+ shapeSelection: BoxVoxelShapeSelection.CreateNew({
95
+ width: this.bounds.size.x,
96
+ height: this.bounds.size.y,
97
+ depth: this.bounds.size.z,
98
+ }),
99
+ }),
100
+ ]);
101
+ return true;
102
+ }
103
+ _updateFunctions = {
104
+ "paint-voxel": async (update) => {
63
105
  await this.DVER.threads.world.runTaskAsync("paint-voxel", [
64
106
  [0, ...update.position],
65
107
  PaintVoxelData.ToRaw(update.voxel),
66
108
  ]);
67
- return;
68
- }
69
- if (update.type == "erase-voxel") {
109
+ },
110
+ "erase-voxel": async (update) => {
70
111
  await this.DVER.threads.world.runTaskAsync("erase-voxel", [
71
112
  0,
72
113
  ...update.position,
73
114
  ]);
74
- return;
75
- }
76
- if (update.type == "paint-voxel-template") {
115
+ },
116
+ "paint-voxel-template": async (update) => {
77
117
  await this.DVER.threads.world.runTaskAsync("paint-voxel-template", [
78
118
  [0, ...update.position],
79
119
  update.template,
80
120
  ]);
81
- return;
82
- }
83
- if (update.type == "erase-voxel-template") {
121
+ },
122
+ "erase-voxel-template": async (update) => {
84
123
  await this.DVER.threads.world.runTaskAsync("erase-voxel-template", [
85
124
  [0, ...update.position],
86
125
  update.template,
87
126
  ]);
88
- return;
89
- }
90
- if (update.type == "paint-voxel-path") {
127
+ },
128
+ "erase-voxel-selection": async (update) => {
129
+ await this.DVER.threads.world.runTaskAsync("erase-voxel-selection", [
130
+ [
131
+ 0,
132
+ update.selection.origin.x,
133
+ update.selection.origin.y,
134
+ update.selection.origin.z,
135
+ ],
136
+ update.selection,
137
+ ]);
138
+ },
139
+ "paint-voxel-path": async (update) => {
91
140
  await this.DVER.threads.world.runTaskAsync("paint-voxel-path", [
92
141
  [0, ...update.position],
93
142
  update.path,
94
143
  ]);
95
- return;
96
- }
97
- if (update.type == "erase-voxel-path") {
144
+ },
145
+ "erase-voxel-path": async (update) => {
98
146
  await this.DVER.threads.world.runTaskAsync("erase-voxel-path", [
99
147
  [0, ...update.position],
100
148
  update.path,
101
149
  ]);
102
- return;
103
- }
104
- }
105
- async _doUpdate(data) {
150
+ },
151
+ };
152
+ async update(data) {
106
153
  if (this.beforeUpdate)
107
- this.beforeUpdate(data);
108
- await this._update(data);
154
+ await this.beforeUpdate(data);
155
+ const run = this._updateFunctions[data.type];
156
+ if (this.duringUpdate) {
157
+ await Promise.all([run(data), this.duringUpdate(data)]);
158
+ }
159
+ else {
160
+ await run(data);
161
+ }
109
162
  if (this.afterUpdate)
110
- this.afterUpdate(data);
163
+ await this.afterUpdate(data);
111
164
  }
112
165
  async paintVoxel(position, voxel) {
113
- await this._doUpdate({
166
+ await this.update({
114
167
  type: "paint-voxel",
115
168
  position: Array.isArray(position)
116
169
  ? position
@@ -119,7 +172,7 @@ export class VoxelBuildSpace {
119
172
  });
120
173
  }
121
174
  async eraseVoxel(position) {
122
- await this._doUpdate({
175
+ await this.update({
123
176
  type: "erase-voxel",
124
177
  position: Array.isArray(position)
125
178
  ? position
@@ -127,7 +180,7 @@ export class VoxelBuildSpace {
127
180
  });
128
181
  }
129
182
  async paintTemplate(position, template) {
130
- await this._doUpdate({
183
+ await this.update({
131
184
  type: "paint-voxel-template",
132
185
  position: Array.isArray(position)
133
186
  ? position
@@ -136,7 +189,7 @@ export class VoxelBuildSpace {
136
189
  });
137
190
  }
138
191
  async eraseTemplate(position, template) {
139
- await this._doUpdate({
192
+ await this.update({
140
193
  type: "erase-voxel-template",
141
194
  position: Array.isArray(position)
142
195
  ? position
@@ -144,8 +197,14 @@ export class VoxelBuildSpace {
144
197
  template,
145
198
  });
146
199
  }
200
+ async eraseSelection(selection) {
201
+ await this.update({
202
+ type: "erase-voxel-selection",
203
+ selection,
204
+ });
205
+ }
147
206
  async paintPath(position, path) {
148
- await this._doUpdate({
207
+ await this.update({
149
208
  type: "paint-voxel-path",
150
209
  position: Array.isArray(position)
151
210
  ? position
@@ -154,7 +213,7 @@ export class VoxelBuildSpace {
154
213
  });
155
214
  }
156
215
  async erasePath(position, path) {
157
- await this._doUpdate({
216
+ await this.update({
158
217
  type: "erase-voxel-path",
159
218
  position: Array.isArray(position)
160
219
  ? position
@@ -1,7 +1,7 @@
1
1
  import { WorldSimulation } from "../../WorldSimulation";
2
2
  import { Threads } from "@amodx/threads";
3
3
  import { Vector3Like } from "@amodx/math";
4
- import { VoxelTemplateRegister } from "../../Templates/VoxelTempateRegister";
4
+ import { VoxelTemplateRegister } from "../../Templates/VoxelTemplateRegister";
5
5
  import { VoxelPath } from "../../Templates/Path/VoxelPath";
6
6
  import PickVoxelWorld from "../../Voxels/Interaction/Functions/PickVoxelWorld";
7
7
  import { WorldCursor } from "../../World";
@@ -11,6 +11,7 @@ import { BoundingBox } from "@amodx/math/Geomtry/Bounds/BoundingBox";
11
11
  import { VoxelSurfaceSelection } from "../../Templates/Selection/VoxelSurfaceSelection";
12
12
  import { VoxelBFSSelection } from "../../Templates/Selection/VoxelBFSSelection";
13
13
  import CreateFullTemplate from "../../Templates/Full/Functions/CreateFullTemplate";
14
+ import { ExtrudeSelection } from "../../Templates/Functions/ExtrudeSelection";
14
15
  export function InitTasks() {
15
16
  const dimension = WorldSimulation.getDimension(0);
16
17
  const brush = dimension.getBrush();
@@ -45,17 +46,12 @@ export function InitTasks() {
45
46
  await UnLockSectors(cursor.dimension, buildAreaBounds);
46
47
  return [surfaceSelection.toJSON()];
47
48
  });
48
- Threads.registerTask("get-voxel-surface-selection-template", async ([position, normal, extrusion, maxSize, voxelDataOrExtrude]) => {
49
- await LockSectors(cursor.dimension, buildAreaBounds);
50
- surfaceSelection.reConstruct(cursor, position, normal, extrusion, maxSize);
51
- await UnLockSectors(cursor.dimension, buildAreaBounds);
52
- const template = surfaceSelection
53
- .toTemplate(cursor, voxelDataOrExtrude)
54
- .toJSON();
55
- template.position.x = surfaceSelection.origin.x;
56
- template.position.y = surfaceSelection.origin.y;
57
- template.position.z = surfaceSelection.origin.z;
58
- return [template];
49
+ Threads.registerTask("get-extruded-voxel-selection-template", async ([selectionData, normal]) => {
50
+ const selection = VoxelTemplateRegister.createSelection(selectionData);
51
+ await LockSectors(cursor.dimension, selection.bounds);
52
+ const fullVoxelTemplate = ExtrudeSelection(cursor, selection, normal);
53
+ await UnLockSectors(cursor.dimension, selection.bounds);
54
+ return [fullVoxelTemplate.toJSON()];
59
55
  });
60
56
  Threads.registerTask("get-voxel-bfs-selection", async ([position, maxSize]) => {
61
57
  await LockSectors(cursor.dimension, buildAreaBounds);
@@ -63,16 +59,6 @@ export function InitTasks() {
63
59
  await UnLockSectors(cursor.dimension, buildAreaBounds);
64
60
  return [bfsSelection.toJSON()];
65
61
  });
66
- Threads.registerTask("get-voxel-bfs-selection-template", async ([position, maxSize]) => {
67
- await LockSectors(cursor.dimension, buildAreaBounds);
68
- bfsSelection.reConstruct(cursor, position, maxSize);
69
- await UnLockSectors(cursor.dimension, buildAreaBounds);
70
- const template = bfsSelection.toTemplate(cursor).toJSON();
71
- template.position.x = bfsSelection.origin.x;
72
- template.position.y = bfsSelection.origin.y;
73
- template.position.z = bfsSelection.origin.z;
74
- return [template];
75
- });
76
62
  /**
77
63
  * Painting
78
64
  */
@@ -115,6 +101,15 @@ export function InitTasks() {
115
101
  .eraseTemplate(template, updateData);
116
102
  await UnLockSectors(location[0], template.bounds);
117
103
  });
104
+ Threads.registerTask("erase-voxel-selection", async ([location, selectionData]) => {
105
+ brush.dimension = location[0];
106
+ const selection = VoxelTemplateRegister.createSelection(selectionData);
107
+ await LockSectors(location[0], selection.bounds);
108
+ brush
109
+ .setXYZ(location[1], location[2], location[3])
110
+ .eraseSelection(selection, updateData);
111
+ await UnLockSectors(location[0], selection.bounds);
112
+ });
118
113
  Threads.registerTask("paint-voxel-path", async ([location, data]) => {
119
114
  await LockSectors(location[0], buildAreaBounds);
120
115
  brush.dimension = location[0];
@@ -0,0 +1,18 @@
1
+ import { Vector3Like } from "@amodx/math";
2
+ import { ProtoVertexBuffer, ProtoIndiceBuffer } from "./ProtoMeshBuffer";
3
+ export declare class ProtoMesh {
4
+ vertexFloatSize: number;
5
+ indicieCount: number;
6
+ vertexCount: number;
7
+ minBounds: Vector3Like;
8
+ maxBounds: Vector3Like;
9
+ readonly buffer: ProtoVertexBuffer;
10
+ readonly indices: ProtoIndiceBuffer;
11
+ constructor(vertexFloatSize: number);
12
+ create(): {
13
+ vertexArray: Float32Array<ArrayBuffer>;
14
+ indiciesArray: Uint32Array<ArrayBuffer> | Uint16Array<ArrayBuffer>;
15
+ };
16
+ addVerticies(vertexCount: number, indicesCount: number): void;
17
+ clear(): void;
18
+ }