@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
@@ -1,8 +1,8 @@
1
- import { VoxelBuildSpace } from "../../VoxelBuildSpace";
2
1
  import { PaintVoxelData } from "../../../Voxels";
3
2
  import { VoxelPointSelection } from "../../../Templates/Selection/VoxelPointSelection";
4
- import { BuilderToolBase } from "../BuilderToolBase";
3
+ import { BuilderToolBase, ToolOptionsData } from "../BuilderToolBase";
5
4
  import { VoxelPath } from "../../../Templates/Path/VoxelPath";
5
+ import { FreePointSelection } from "../../Util/FreePointSelection";
6
6
  export declare enum PathToolModes {
7
7
  PlacePoints = "Place Points",
8
8
  MovePoints = "Move Points",
@@ -13,17 +13,22 @@ export declare enum PathToolModes {
13
13
  interface PathToolEvents {
14
14
  }
15
15
  export declare class PathTool extends BuilderToolBase<PathToolEvents> {
16
- space: VoxelBuildSpace;
17
16
  static ToolId: string;
18
17
  static ModeArray: PathToolModes[];
19
18
  mode: PathToolModes;
20
19
  selection: VoxelPointSelection;
20
+ pointSelection: FreePointSelection;
21
21
  path: VoxelPath;
22
- distance: number;
22
+ get distance(): number;
23
+ set distance(value: number);
24
+ voxelData: PaintVoxelData;
23
25
  private _placedSegment;
24
- constructor(space: VoxelBuildSpace);
25
26
  setMode(mode: PathToolModes): void;
26
- updatePlacer(): void;
27
- use(voxelData: PaintVoxelData, usePlacingStrategy?: boolean): Promise<void>;
27
+ cancel(): void;
28
+ update(): Promise<void>;
29
+ use(): Promise<void>;
30
+ getOptionValue(id: string): null;
31
+ getCurrentOptions(): ToolOptionsData;
32
+ updateOption(property: string, value: any): void;
28
33
  }
29
34
  export {};
@@ -1,7 +1,7 @@
1
1
  import { VoxelPointSelection } from "../../../Templates/Selection/VoxelPointSelection";
2
2
  import { BuilderToolBase } from "../BuilderToolBase";
3
3
  import { VoxelPath, VoxelPathSegment } from "../../../Templates/Path/VoxelPath";
4
- import { Vector3Like } from "@amodx/math";
4
+ import { FreePointSelection } from "../../Util/FreePointSelection";
5
5
  export var PathToolModes;
6
6
  (function (PathToolModes) {
7
7
  PathToolModes["PlacePoints"] = "Place Points";
@@ -11,7 +11,6 @@ export var PathToolModes;
11
11
  PathToolModes["RemovePath"] = "Remvoe Path";
12
12
  })(PathToolModes || (PathToolModes = {}));
13
13
  export class PathTool extends BuilderToolBase {
14
- space;
15
14
  static ToolId = "Path";
16
15
  static ModeArray = [
17
16
  PathToolModes.PlacePoints,
@@ -22,23 +21,29 @@ export class PathTool extends BuilderToolBase {
22
21
  ];
23
22
  mode = PathToolModes.PlacePoints;
24
23
  selection = new VoxelPointSelection();
24
+ pointSelection = new FreePointSelection(this.space, this.selection);
25
25
  path = new VoxelPath(VoxelPath.CreateNew({}));
26
- distance = 10;
27
- _placedSegment = false;
28
- constructor(space) {
29
- super();
30
- this.space = space;
26
+ get distance() {
27
+ return this.pointSelection.distance;
28
+ }
29
+ set distance(value) {
30
+ this.pointSelection.distance = value;
31
31
  }
32
+ voxelData;
33
+ _placedSegment = false;
32
34
  setMode(mode) {
33
35
  const lastMode = this.mode;
34
36
  this.mode = mode;
35
- if (lastMode == PathToolModes.PlacePoints && this._placedSegment) {
36
- this._placedSegment = false;
37
- if (this.path.lastSegment())
38
- this.path.removeSegment(this.path.lastSegment());
37
+ if (lastMode == PathToolModes.PlacePoints) {
38
+ for (const segment of this.path.segments) {
39
+ if (segment.transient) {
40
+ this.path.removeSegment(segment);
41
+ }
42
+ }
39
43
  }
40
44
  if (mode == PathToolModes.PlacePoints && this.path.segments.length) {
41
45
  const point = this.path.lastSegment().getPoint(1);
46
+ this._placedSegment = false;
42
47
  this.path.addSegment(VoxelPathSegment.CreateNew({
43
48
  transient: true,
44
49
  start: [...point],
@@ -50,15 +55,14 @@ export class PathTool extends BuilderToolBase {
50
55
  }));
51
56
  }
52
57
  }
53
- updatePlacer() {
58
+ cancel() {
59
+ this._lastPicked = null;
60
+ }
61
+ async update() {
54
62
  if (this.mode == PathToolModes.PlacePoints) {
55
- const rayPosition = Vector3Like.FloorInPlace(Vector3Like.Add(this.space.rayProvider.origin, Vector3Like.MultiplyScalar(this.space.rayProvider.direction, this.distance)));
56
- if (!this.space.bounds.intersectsPoint(rayPosition)) {
57
- //get point ray intersects with the space bounding box and use that instead
58
- }
59
- else {
60
- this.selection.reConstruct(rayPosition);
61
- }
63
+ const updated = this.pointSelection.update();
64
+ if (!updated)
65
+ return;
62
66
  const last = this.path.lastSegment();
63
67
  if (last) {
64
68
  last.setPoints(last.start, [
@@ -70,7 +74,7 @@ export class PathTool extends BuilderToolBase {
70
74
  return;
71
75
  }
72
76
  }
73
- async use(voxelData, usePlacingStrategy = true) {
77
+ async use() {
74
78
  if (this.mode == PathToolModes.PlacePoints) {
75
79
  this._placedSegment = true;
76
80
  if (!this.path.totalSegments) {
@@ -104,7 +108,7 @@ export class PathTool extends BuilderToolBase {
104
108
  }
105
109
  if (this.mode == PathToolModes.FillPath) {
106
110
  for (const segment of this.path.segments) {
107
- segment.voxel = voxelData;
111
+ segment.voxel = this.voxelData;
108
112
  }
109
113
  await this.space.paintPath([0, 0, 0], this.path.toJSON());
110
114
  return;
@@ -114,4 +118,11 @@ export class PathTool extends BuilderToolBase {
114
118
  return;
115
119
  }
116
120
  }
121
+ getOptionValue(id) {
122
+ return null;
123
+ }
124
+ getCurrentOptions() {
125
+ return [];
126
+ }
127
+ updateOption(property, value) { }
117
128
  }
@@ -0,0 +1,34 @@
1
+ import { VoxelBuildSpace } from "../../VoxelBuildSpace";
2
+ import { PaintVoxelData } from "../../../Voxels";
3
+ import { VoxelBoundsSelection } from "../../../Templates/Selection/VoxelBoundsSelection";
4
+ import { Vector3Like } from "@amodx/math";
5
+ import { SurfaceBoxSelection } from "../../Util/SurfaceBoxSelection";
6
+ import { BuilderToolBase, ToolOptionsData } from "../BuilderToolBase";
7
+ export declare enum SculptToolModes {
8
+ Fill = "Fill",
9
+ Extrude = "Extrude",
10
+ Remove = "Remove"
11
+ }
12
+ interface SculptToolEvents {
13
+ }
14
+ export declare class SculptTool extends BuilderToolBase<SculptToolEvents> {
15
+ static ToolId: string;
16
+ static ModeArray: SculptToolModes[];
17
+ mode: SculptToolModes;
18
+ selection: VoxelBoundsSelection;
19
+ boxSelection: SurfaceBoxSelection;
20
+ voxelData: PaintVoxelData;
21
+ usePlacingStrategy: boolean;
22
+ constructor(space: VoxelBuildSpace);
23
+ cancel(): void;
24
+ private _started;
25
+ isSelectionStarted(): boolean;
26
+ updateOffset(offset: number): void;
27
+ _normal: Vector3Like;
28
+ update(placerMode?: "start" | "end" | null): Promise<void>;
29
+ use(): Promise<void>;
30
+ getOptionValue(id: string): null;
31
+ getCurrentOptions(): ToolOptionsData;
32
+ updateOption(property: string, value: any): void;
33
+ }
34
+ export {};
@@ -0,0 +1,102 @@
1
+ import { VoxelBoundsSelection } from "../../../Templates/Selection/VoxelBoundsSelection";
2
+ import { Vector3Like } from "@amodx/math";
3
+ import { SurfaceBoxSelection } from "../../Util/SurfaceBoxSelection";
4
+ import { BuilderToolBase } from "../BuilderToolBase";
5
+ export var SculptToolModes;
6
+ (function (SculptToolModes) {
7
+ SculptToolModes["Fill"] = "Fill";
8
+ SculptToolModes["Extrude"] = "Extrude";
9
+ SculptToolModes["Remove"] = "Remove";
10
+ })(SculptToolModes || (SculptToolModes = {}));
11
+ export class SculptTool extends BuilderToolBase {
12
+ static ToolId = "Sculpt";
13
+ static ModeArray = [
14
+ SculptToolModes.Fill,
15
+ SculptToolModes.Extrude,
16
+ SculptToolModes.Remove,
17
+ ];
18
+ mode = SculptToolModes.Fill;
19
+ selection = new VoxelBoundsSelection();
20
+ boxSelection;
21
+ voxelData;
22
+ usePlacingStrategy = true;
23
+ constructor(space) {
24
+ super(space);
25
+ this.boxSelection = new SurfaceBoxSelection(this.space, this.selection);
26
+ }
27
+ cancel() {
28
+ this._started = false;
29
+ }
30
+ _started = false;
31
+ isSelectionStarted() {
32
+ return this._started;
33
+ }
34
+ updateOffset(offset) {
35
+ this.boxSelection.offset = offset;
36
+ this.boxSelection.update();
37
+ }
38
+ _normal;
39
+ async update(placerMode = null) {
40
+ const picked = this.isSelectionStarted()
41
+ ? null
42
+ : await this.space.pickWithProvider(this.rayProviderIndex);
43
+ this._lastPicked = picked;
44
+ if (!this._started && !placerMode && picked) {
45
+ if (this.mode == SculptToolModes.Fill ||
46
+ this.mode == SculptToolModes.Extrude) {
47
+ this.selection.reConstruct(picked.normalPosition, picked.normal, Vector3Like.Add(picked.normalPosition, Vector3Like.Create(1, 1, 1)), picked.normal);
48
+ }
49
+ if (this.mode == SculptToolModes.Remove) {
50
+ this.selection.reConstruct(picked.position, picked.normal, Vector3Like.Add(picked.position, Vector3Like.Create(1, 1, 1)), picked.normal);
51
+ }
52
+ this._normal = { ...picked.normal };
53
+ }
54
+ if (!this._started && placerMode == "start" && picked) {
55
+ this.boxSelection.offset = 0;
56
+ Vector3Like.Copy(this.boxSelection.planeNormal, picked.normal);
57
+ if (this.mode == SculptToolModes.Fill ||
58
+ this.mode == SculptToolModes.Extrude) {
59
+ Vector3Like.Copy(this.boxSelection.planeOrigin, picked.normalPosition);
60
+ }
61
+ if (this.mode == SculptToolModes.Remove) {
62
+ Vector3Like.Copy(this.boxSelection.planeOrigin, picked.position);
63
+ }
64
+ this.boxSelection.update();
65
+ this._started = true;
66
+ return;
67
+ }
68
+ if (this._started && !placerMode && !picked) {
69
+ this.boxSelection.update();
70
+ return;
71
+ }
72
+ if (this._started && placerMode == "end") {
73
+ this.boxSelection.update();
74
+ this._started = false;
75
+ }
76
+ }
77
+ async use() {
78
+ if (this.mode == SculptToolModes.Fill) {
79
+ await this.space.paintTemplate(Vector3Like.ToArray(this.selection.origin), this.selection
80
+ .toTemplate({
81
+ fillVoxel: this.voxelData,
82
+ })
83
+ .toJSON());
84
+ return;
85
+ }
86
+ if (this.mode == SculptToolModes.Extrude) {
87
+ const template = await this.space.getExtrudedSelectionTemplate(this.selection.toJSON(), this._normal);
88
+ await this.space.paintTemplate(this.selection.origin, template.toJSON());
89
+ return;
90
+ }
91
+ if (this.mode == SculptToolModes.Remove) {
92
+ await this.space.eraseTemplate(Vector3Like.ToArray(this.selection.origin), this.selection.toTemplate({}).toJSON());
93
+ }
94
+ }
95
+ getOptionValue(id) {
96
+ return null;
97
+ }
98
+ getCurrentOptions() {
99
+ return [];
100
+ }
101
+ updateOption(property, value) { }
102
+ }
@@ -0,0 +1,32 @@
1
+ import { PaintVoxelData } from "../../../Voxels";
2
+ import { BuilderToolBase, ToolOptionsData } from "../BuilderToolBase";
3
+ import { VoxelPointSelection } from "../../../Templates/Selection/VoxelPointSelection";
4
+ import { FreePointSelection } from "../../Util/FreePointSelection";
5
+ import { FreeBoxSelection } from "../../Util/FreeBoxSelection";
6
+ export declare enum ShapeToolModes {
7
+ Fill = "Fill",
8
+ Remove = "Remove"
9
+ }
10
+ interface BoxToolEvents {
11
+ }
12
+ export declare class ShapeTool extends BuilderToolBase<BoxToolEvents> {
13
+ static ToolId: string;
14
+ static ModeArray: ShapeToolModes[];
15
+ mode: ShapeToolModes;
16
+ selection: VoxelPointSelection;
17
+ pointSelection: FreePointSelection;
18
+ boxSelection: FreeBoxSelection | null;
19
+ voxelData: PaintVoxelData;
20
+ usePlacingStrategy: boolean;
21
+ get distance(): number;
22
+ set distance(distance: number);
23
+ private _started;
24
+ isSelectionStarted(): boolean;
25
+ cancel(): void;
26
+ update(placerMode?: "start" | "end" | null): Promise<void>;
27
+ use(): Promise<void>;
28
+ getOptionValue(id: string): null;
29
+ getCurrentOptions(): ToolOptionsData;
30
+ updateOption(property: string, value: any): void;
31
+ }
32
+ export {};
@@ -0,0 +1,78 @@
1
+ import { Vector3Like } from "@amodx/math";
2
+ import { BuilderToolBase } from "../BuilderToolBase";
3
+ import { VoxelPointSelection } from "../../../Templates/Selection/VoxelPointSelection";
4
+ import { FreePointSelection } from "../../Util/FreePointSelection";
5
+ import { FreeBoxSelection } from "../../Util/FreeBoxSelection";
6
+ export var ShapeToolModes;
7
+ (function (ShapeToolModes) {
8
+ ShapeToolModes["Fill"] = "Fill";
9
+ ShapeToolModes["Remove"] = "Remove";
10
+ })(ShapeToolModes || (ShapeToolModes = {}));
11
+ export class ShapeTool extends BuilderToolBase {
12
+ static ToolId = "Shape";
13
+ static ModeArray = [
14
+ ShapeToolModes.Fill,
15
+ ShapeToolModes.Remove,
16
+ ];
17
+ mode = ShapeToolModes.Fill;
18
+ selection = new VoxelPointSelection();
19
+ pointSelection = new FreePointSelection(this.space, this.selection);
20
+ boxSelection = null;
21
+ voxelData;
22
+ usePlacingStrategy = true;
23
+ get distance() {
24
+ return this.pointSelection.distance;
25
+ }
26
+ set distance(distance) {
27
+ if (this.boxSelection)
28
+ this.pointSelection.distance = distance;
29
+ }
30
+ _started = false;
31
+ isSelectionStarted() {
32
+ return this._started;
33
+ }
34
+ cancel() {
35
+ this._started = false;
36
+ this.boxSelection = null;
37
+ }
38
+ async update(placerMode = null) {
39
+ if (this.boxSelection) {
40
+ this.boxSelection.update();
41
+ }
42
+ else {
43
+ this.pointSelection.update();
44
+ }
45
+ if (placerMode == "start") {
46
+ this._started = true;
47
+ this.boxSelection = new FreeBoxSelection(this.space, this.pointSelection);
48
+ }
49
+ if (placerMode == "end") {
50
+ this._started = false;
51
+ }
52
+ }
53
+ async use() {
54
+ if (!this.boxSelection)
55
+ return;
56
+ if (this.mode == ShapeToolModes.Fill) {
57
+ await this.space.paintTemplate(Vector3Like.ToArray(this.boxSelection.selection.origin), this.boxSelection.selection
58
+ .toTemplate({
59
+ fillVoxel: this.voxelData,
60
+ })
61
+ .toJSON());
62
+ this.boxSelection = null;
63
+ return;
64
+ }
65
+ if (this.mode == ShapeToolModes.Remove) {
66
+ await this.space.eraseTemplate(Vector3Like.ToArray(this.boxSelection.selection.origin), this.boxSelection.selection.toTemplate({}).toJSON());
67
+ this.boxSelection = null;
68
+ return;
69
+ }
70
+ }
71
+ getOptionValue(id) {
72
+ return null;
73
+ }
74
+ getCurrentOptions() {
75
+ return [];
76
+ }
77
+ updateOption(property, value) { }
78
+ }
@@ -0,0 +1,35 @@
1
+ import { BuilderToolBase, ToolOptionsData } from "../BuilderToolBase";
2
+ import { VoxelBoundsSelection } from "../../../Templates/Selection/VoxelBoundsSelection";
3
+ import { FreeBoxSelection } from "../../Util/FreeBoxSelection";
4
+ import { FullVoxelTemplate } from "../../../Templates/Full/FullVoxelTemplate";
5
+ import { VoxelPointSelection } from "../../../Templates/Selection/VoxelPointSelection";
6
+ import { FreePointSelection } from "../../Util/FreePointSelection";
7
+ export declare enum TemplateToolModes {
8
+ Select = "Select",
9
+ Place = "Place",
10
+ Remove = "Remove"
11
+ }
12
+ interface TemplateToolEvents {
13
+ "selection-created": VoxelBoundsSelection;
14
+ }
15
+ export declare class TemplateTool extends BuilderToolBase<TemplateToolEvents> {
16
+ static ToolId: string;
17
+ static ModeArray: TemplateToolModes[];
18
+ mode: TemplateToolModes;
19
+ selection: VoxelPointSelection;
20
+ pointSelection: FreePointSelection;
21
+ boxSelection: FreeBoxSelection | null;
22
+ usePlacingStrategy: boolean;
23
+ get distance(): number;
24
+ set distance(distance: number);
25
+ private _started;
26
+ selectionToTemplate(selection: VoxelBoundsSelection): Promise<FullVoxelTemplate>;
27
+ isSelectionStarted(): boolean;
28
+ update(placerMode?: "start" | "end" | null): Promise<void>;
29
+ cancel(): void;
30
+ use(): Promise<void>;
31
+ getOptionValue(id: string): null;
32
+ getCurrentOptions(): ToolOptionsData;
33
+ updateOption(property: string, value: any): void;
34
+ }
35
+ export {};
@@ -0,0 +1,73 @@
1
+ import { BuilderToolBase } from "../BuilderToolBase";
2
+ import { FreeBoxSelection } from "../../Util/FreeBoxSelection";
3
+ import { VoxelPointSelection } from "../../../Templates/Selection/VoxelPointSelection";
4
+ import { FreePointSelection } from "../../Util/FreePointSelection";
5
+ export var TemplateToolModes;
6
+ (function (TemplateToolModes) {
7
+ TemplateToolModes["Select"] = "Select";
8
+ TemplateToolModes["Place"] = "Place";
9
+ TemplateToolModes["Remove"] = "Remove";
10
+ })(TemplateToolModes || (TemplateToolModes = {}));
11
+ export class TemplateTool extends BuilderToolBase {
12
+ static ToolId = "Template";
13
+ static ModeArray = [
14
+ TemplateToolModes.Select,
15
+ TemplateToolModes.Place,
16
+ TemplateToolModes.Remove,
17
+ ];
18
+ mode = TemplateToolModes.Select;
19
+ selection = new VoxelPointSelection();
20
+ pointSelection = new FreePointSelection(this.space, this.selection);
21
+ boxSelection = null;
22
+ usePlacingStrategy = true;
23
+ get distance() {
24
+ return this.pointSelection.distance;
25
+ }
26
+ set distance(distance) {
27
+ if (this.boxSelection)
28
+ this.pointSelection.distance = distance;
29
+ }
30
+ _started = false;
31
+ async selectionToTemplate(selection) {
32
+ const bounds = selection.bounds.getMinMax();
33
+ return await this.space.createTemplate(bounds);
34
+ }
35
+ isSelectionStarted() {
36
+ return this._started;
37
+ }
38
+ async update(placerMode = null) {
39
+ if (this.boxSelection) {
40
+ this.boxSelection.update();
41
+ }
42
+ else {
43
+ this.pointSelection.update();
44
+ }
45
+ if (placerMode == "start") {
46
+ this._started = true;
47
+ this.boxSelection = new FreeBoxSelection(this.space, this.pointSelection);
48
+ }
49
+ if (placerMode == "end") {
50
+ this._started = false;
51
+ this.boxSelection = null;
52
+ }
53
+ }
54
+ cancel() {
55
+ this._started = false;
56
+ this._lastPicked = null;
57
+ this.boxSelection = null;
58
+ }
59
+ async use() {
60
+ if (!this.boxSelection)
61
+ return;
62
+ if (this.mode == TemplateToolModes.Select) {
63
+ this.dispatch("selection-created", this.boxSelection.selection);
64
+ }
65
+ }
66
+ getOptionValue(id) {
67
+ return null;
68
+ }
69
+ getCurrentOptions() {
70
+ return [];
71
+ }
72
+ updateOption(property, value) { }
73
+ }
@@ -1,9 +1,7 @@
1
- import { VoxelPickResult } from "../../../Voxels/Interaction/VoxelPickResult";
2
- import { VoxelBuildSpace } from "../../VoxelBuildSpace";
3
1
  import { PaintVoxelData } from "../../../Voxels/Types/PaintVoxelData";
4
2
  import { VoxelSurfaceSelection } from "../../../Templates/Selection/VoxelSurfaceSelection";
5
3
  import { VoxelBFSSelection } from "../../../Templates/Selection/VoxelBFSSelection";
6
- import { BuilderToolBase } from "../BuilderToolBase";
4
+ import { BuilderToolBase, ToolOptionsData } from "../BuilderToolBase";
7
5
  export declare enum WandToolModes {
8
6
  Place = "Place",
9
7
  Extrude = "Extrude",
@@ -12,7 +10,6 @@ export declare enum WandToolModes {
12
10
  interface WandToolEvents {
13
11
  }
14
12
  export declare class WandTool extends BuilderToolBase<WandToolEvents> {
15
- space: VoxelBuildSpace;
16
13
  static ToolId: string;
17
14
  static ModeArray: WandToolModes[];
18
15
  mode: WandToolModes;
@@ -21,8 +18,13 @@ export declare class WandTool extends BuilderToolBase<WandToolEvents> {
21
18
  get selection(): VoxelSurfaceSelection | VoxelBFSSelection;
22
19
  surfaceSelection: VoxelSurfaceSelection;
23
20
  bfsSelection: VoxelBFSSelection;
24
- constructor(space: VoxelBuildSpace);
25
- updatePlacer(picked: VoxelPickResult): Promise<void>;
26
- use(picked: VoxelPickResult, voxelData: PaintVoxelData, usePlacingStrategy?: boolean): Promise<boolean | undefined>;
21
+ voxelData: PaintVoxelData;
22
+ usePlacingStrategy: boolean;
23
+ update(): Promise<void>;
24
+ cancel(): void;
25
+ use(): Promise<void>;
26
+ getOptionValue(id: string): null;
27
+ getCurrentOptions(): ToolOptionsData;
28
+ updateOption(property: string, value: any): void;
27
29
  }
28
30
  export {};
@@ -8,7 +8,6 @@ export var WandToolModes;
8
8
  WandToolModes["Remove"] = "Remove";
9
9
  })(WandToolModes || (WandToolModes = {}));
10
10
  export class WandTool extends BuilderToolBase {
11
- space;
12
11
  static ToolId = "Wand";
13
12
  static ModeArray = [
14
13
  WandToolModes.Place,
@@ -27,41 +26,65 @@ export class WandTool extends BuilderToolBase {
27
26
  }
28
27
  surfaceSelection = new VoxelSurfaceSelection();
29
28
  bfsSelection = new VoxelBFSSelection();
30
- constructor(space) {
31
- super();
32
- this.space = space;
33
- }
34
- async updatePlacer(picked) {
29
+ voxelData;
30
+ usePlacingStrategy = true;
31
+ async update() {
32
+ this._lastPicked = await this.space.pickWithProvider(this.rayProviderIndex);
33
+ if (!this._lastPicked)
34
+ return;
35
35
  if (this.mode == WandToolModes.Place ||
36
36
  this.mode == WandToolModes.Extrude) {
37
- this.surfaceSelection.fromJSON(await this.space.getSurfaceSelection(picked.position, picked.normal, this.extrusion, this.maxCount));
37
+ if (!this.space.bounds.intersectsPoint(this._lastPicked.normalPosition)) {
38
+ this._lastPicked = null;
39
+ return;
40
+ }
41
+ this.surfaceSelection.fromJSON(await this.space.getSurfaceSelection(this._lastPicked.position, this._lastPicked.normal, this.extrusion, this.maxCount));
38
42
  }
39
43
  if (this.mode == WandToolModes.Remove) {
40
- this.bfsSelection.fromJSON(await this.space.getBFSSelection(picked.position, this.maxCount));
44
+ if (!this.space.bounds.intersectsPoint(this._lastPicked.position)) {
45
+ this._lastPicked = null;
46
+ return;
47
+ }
48
+ this.bfsSelection.fromJSON(await this.space.getBFSSelection(this._lastPicked.position, this.maxCount));
41
49
  }
42
50
  }
43
- async use(picked, voxelData, usePlacingStrategy = true) {
51
+ cancel() {
52
+ this._lastPicked = null;
53
+ }
54
+ async use() {
55
+ const picked = this._lastPicked;
56
+ if (!picked)
57
+ return;
58
+ let voxelData = this.voxelData;
44
59
  if (this.mode == WandToolModes.Place) {
45
60
  if (!this.space.bounds.intersectsPoint(picked.normalPosition))
46
- return false;
47
- if (usePlacingStrategy) {
61
+ return;
62
+ if (this.usePlacingStrategy) {
48
63
  const newData = this.space.getPlaceState(voxelData, picked);
49
64
  if (newData)
50
65
  voxelData = newData;
51
66
  }
52
- const template = await this.space.getSurfaceSelectionTemplate(picked.position, picked.normal, this.extrusion, this.maxCount, voxelData);
53
- await this.space.paintTemplate(template.position, template.toJSON());
54
- return true;
67
+ this.surfaceSelection.fromJSON(await this.space.getSurfaceSelection(picked.position, picked.normal, this.extrusion, this.maxCount));
68
+ await this.space.paintTemplate(this.surfaceSelection.origin, this.surfaceSelection.toTemplate(voxelData).toJSON());
69
+ return;
55
70
  }
56
71
  if (this.mode == WandToolModes.Extrude) {
57
- const template = await this.space.getSurfaceSelectionTemplate(picked.position, picked.normal, this.extrusion, this.maxCount, true);
58
- await this.space.paintTemplate(template.position, template.toJSON());
59
- return true;
72
+ this.surfaceSelection.fromJSON(await this.space.getSurfaceSelection(picked.position, picked.normal, this.extrusion, this.maxCount));
73
+ const template = await this.space.getExtrudedSelectionTemplate(this.surfaceSelection.toJSON(), picked.normal);
74
+ await this.space.paintTemplate(this.surfaceSelection.origin, template.toJSON());
75
+ return;
60
76
  }
61
77
  if (this.mode == WandToolModes.Remove) {
62
- const template = await this.space.getBFSSelectionTemplate(picked.position, this.maxCount);
63
- await this.space.eraseTemplate(template.position, template.toJSON());
64
- return true;
78
+ const selection = await this.space.getBFSSelection(picked.position, this.maxCount);
79
+ await this.space.eraseSelection(selection);
80
+ return;
65
81
  }
66
82
  }
83
+ getOptionValue(id) {
84
+ return null;
85
+ }
86
+ getCurrentOptions() {
87
+ return [];
88
+ }
89
+ updateOption(property, value) { }
67
90
  }
@@ -1,8 +1,6 @@
1
- import { VoxelPickResult } from "../../../Voxels/Interaction/VoxelPickResult";
2
- import { VoxelBuildSpace } from "../../VoxelBuildSpace";
3
1
  import { PaintVoxelData } from "../../../Voxels";
4
2
  import { VoxelPointSelection } from "../../../Templates/Selection/VoxelPointSelection";
5
- import { BuilderToolBase } from "../BuilderToolBase";
3
+ import { BuilderToolBase, ToolOptionsData } from "../BuilderToolBase";
6
4
  interface WrenchToolEvents {
7
5
  picked: {};
8
6
  }
@@ -25,16 +23,14 @@ type WrenchToolSchemas = {
25
23
  modSchema: WrenchToolVoxelScehmaNodes[];
26
24
  };
27
25
  export declare class WrenchTool extends BuilderToolBase<WrenchToolEvents> {
28
- space: VoxelBuildSpace;
29
26
  static ToolId: string;
30
27
  private mode;
31
28
  selection: VoxelPointSelection;
32
29
  paintData: PaintVoxelData;
33
30
  private _pickedResult;
34
- constructor(space: VoxelBuildSpace);
35
31
  isUpdating(): boolean;
36
32
  stopUpdating(): void;
37
- updatePlacer(picked: VoxelPickResult): void;
33
+ update(): Promise<void>;
38
34
  private processSchema;
39
35
  updatePickedSchema(schema: WrenchToolSchemas): PaintVoxelData | undefined;
40
36
  getPickedSchema(): WrenchToolSchemas | null;
@@ -42,6 +38,10 @@ export declare class WrenchTool extends BuilderToolBase<WrenchToolEvents> {
42
38
  getStateValues(): PaintVoxelData[] | null;
43
39
  /**Get an array of all possible mod varations for the current state of the selected voxel. */
44
40
  getModValues(): PaintVoxelData[] | null;
45
- use(): Promise<true | undefined>;
41
+ cancel(): void;
42
+ use(): Promise<void>;
43
+ getOptionValue(id: string): null;
44
+ getCurrentOptions(): ToolOptionsData;
45
+ updateOption(property: string, value: any): void;
46
46
  }
47
47
  export {};