@divinevoxel/vlox 0.0.75 → 0.0.77

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (330) hide show
  1. package/Builder/RayProvider.d.ts +6 -0
  2. package/Builder/Tools/Brush/BrushTool.d.ts +55 -0
  3. package/Builder/Tools/Brush/BrushTool.js +352 -0
  4. package/Builder/Tools/BuilderToolBase.d.ts +39 -0
  5. package/Builder/Tools/BuilderToolBase.js +42 -0
  6. package/Builder/Tools/Hand/HandTool.d.ts +24 -0
  7. package/Builder/Tools/Hand/HandTool.js +73 -0
  8. package/Builder/Tools/Path/PahtTool.d.ts +34 -0
  9. package/Builder/Tools/Path/PahtTool.js +128 -0
  10. package/Builder/Tools/Sculpt/SculptTool.d.ts +34 -0
  11. package/Builder/Tools/Sculpt/SculptTool.js +102 -0
  12. package/Builder/Tools/Shape/ShapeTool.d.ts +32 -0
  13. package/Builder/Tools/Shape/ShapeTool.js +78 -0
  14. package/Builder/Tools/Template/TemplateTool.d.ts +35 -0
  15. package/Builder/Tools/Template/TemplateTool.js +73 -0
  16. package/Builder/Tools/Wand/WandTool.d.ts +30 -0
  17. package/Builder/Tools/Wand/WandTool.js +90 -0
  18. package/Builder/Tools/Wrench/WrenchTool.d.ts +47 -0
  19. package/Builder/Tools/Wrench/WrenchTool.js +184 -0
  20. package/Builder/Util/FreeBoxSelection.d.ts +12 -0
  21. package/Builder/Util/FreeBoxSelection.js +21 -0
  22. package/Builder/Util/FreePointSelection.d.ts +14 -0
  23. package/Builder/Util/FreePointSelection.js +39 -0
  24. package/Builder/Util/SurfaceBoxSelection.d.ts +12 -0
  25. package/Builder/Util/SurfaceBoxSelection.js +25 -0
  26. package/Builder/VoxelBuildSpace.d.ts +73 -0
  27. package/Builder/VoxelBuildSpace.js +224 -0
  28. package/Builder/World/InitTasks.d.ts +1 -0
  29. package/Builder/World/InitTasks.js +129 -0
  30. package/Builder/World/VoxelBuildSpaceWorld.d.ts +4 -0
  31. package/Builder/World/VoxelBuildSpaceWorld.js +10 -0
  32. package/Contexts/Render/DivineVoxelEngineRender.d.ts +5 -5
  33. package/Contexts/World/DivineVoxelEngineWorld.d.ts +5 -5
  34. package/Mesher/Geomtry/Proto/ProtoMesh.d.ts +18 -0
  35. package/Mesher/Geomtry/Proto/ProtoMesh.js +73 -0
  36. package/Mesher/Geomtry/{VoxelMeshBuffers.d.ts → Proto/ProtoMeshBuffer.d.ts} +2 -2
  37. package/Mesher/Geomtry/{VoxelMeshBuffers.js → Proto/ProtoMeshBuffer.js} +2 -2
  38. package/Mesher/Geomtry/Shapes/Box.d.ts +2 -9
  39. package/Mesher/Geomtry/Shapes/Box.js +7 -12
  40. package/Mesher/Geomtry/Transform/TransformBox.js +5 -2
  41. package/Mesher/InitMesher.js +4 -4
  42. package/Mesher/InitTask.js +2 -2
  43. package/Mesher/Items/Base/CompactItemMesh.d.ts +3 -0
  44. package/Mesher/Items/Base/CompactItemMesh.js +20 -0
  45. package/Mesher/Items/Geomtry/ItemGeometryBuilder.d.ts +5 -0
  46. package/Mesher/Items/Geomtry/ItemGeometryBuilder.js +131 -0
  47. package/Mesher/Items/Geomtry/ItemMeshVertexStructCursor.d.ts +48 -0
  48. package/Mesher/Items/Geomtry/ItemMeshVertexStructCursor.js +114 -0
  49. package/Mesher/Items/MeshTexture.d.ts +1 -0
  50. package/Mesher/Items/MeshTexture.js +214 -0
  51. package/Mesher/Items/MeshTextureO.js +277 -0
  52. package/Mesher/Items/Models/ItemModelBuilder.d.ts +27 -0
  53. package/Mesher/Items/Models/ItemModelBuilder.js +64 -0
  54. package/Mesher/Types/ItemMesh.types.d.ts +5 -0
  55. package/Mesher/Types/ItemMesh.types.js +12 -0
  56. package/Mesher/Types/Mesher.types.d.ts +15 -9
  57. package/Mesher/Types/Mesher.types.js +14 -0
  58. package/Mesher/Types/VoxelMesh.types.js +7 -6
  59. package/Mesher/Voxels/Base/CompactTemplateMesh.d.ts +3 -0
  60. package/Mesher/{Functions/CompactVoxelMesh.js → Voxels/Base/CompactTemplateMesh.js} +4 -40
  61. package/Mesher/{Functions → Voxels/Base}/CompactVoxelSectionMesh.d.ts +2 -2
  62. package/Mesher/{Functions → Voxels}/Base/MeshSectionBase.d.ts +1 -1
  63. package/Mesher/{Functions → Voxels}/Base/MeshSectionBase.js +11 -7
  64. package/Mesher/{Geomtry → Voxels/Geomtry}/CompactedSectionVoxelMesh.d.ts +1 -1
  65. package/Mesher/{Geomtry → Voxels/Geomtry}/CompactedSectionVoxelMesh.js +1 -1
  66. package/Mesher/{Geomtry → Voxels/Geomtry}/VoxelGeometryBuilder.d.ts +2 -2
  67. package/Mesher/{Geomtry → Voxels/Geomtry}/VoxelGeometryBuilder.js +1 -1
  68. package/Mesher/{Geomtry → Voxels/Geomtry}/VoxelMeshBVHBuilder.d.ts +3 -3
  69. package/Mesher/{Geomtry → Voxels/Geomtry}/VoxelMeshBVHBuilder.js +2 -2
  70. package/Mesher/Voxels/MeshTemplate.d.ts +3 -0
  71. package/Mesher/Voxels/MeshTemplate.js +81 -0
  72. package/Mesher/{Functions → Voxels}/MeshVoxel.d.ts +1 -1
  73. package/Mesher/{Functions → Voxels}/MeshVoxel.js +6 -4
  74. package/Mesher/{Models → Voxels/Models}/Common/Calc/CalcConstants.d.ts +3 -3
  75. package/Mesher/{Models → Voxels/Models}/Common/Calc/CalcConstants.js +4 -4
  76. package/Mesher/{Models → Voxels/Models}/Common/Calc/FaceDataCalc.d.ts +1 -1
  77. package/Mesher/{Models → Voxels/Models}/Common/Calc/FaceDataCalc.js +2 -2
  78. package/Mesher/{Models → Voxels/Models}/Common/Faces/CullRulledFace.js +1 -1
  79. package/Mesher/{Models → Voxels/Models}/Common/Faces/ShadeRulelessFace.d.ts +1 -1
  80. package/Mesher/{Models → Voxels/Models}/Common/Faces/ShadeRulledFace.d.ts +1 -1
  81. package/Mesher/{Models → Voxels/Models}/Common/Faces/ShadeRulledFace.js +1 -1
  82. package/Mesher/{Models → Voxels/Models}/Common/GetTexture.d.ts +3 -3
  83. package/Mesher/{Models → Voxels/Models}/Nodes/Custom/Liquid/FlowGradient.d.ts +1 -1
  84. package/Mesher/{Models → Voxels/Models}/Nodes/Custom/Liquid/FlowGradient.js +1 -1
  85. package/Mesher/{Models → Voxels/Models}/Nodes/Custom/Liquid/LiquidGeomtryNode.d.ts +3 -3
  86. package/Mesher/{Models → Voxels/Models}/Nodes/Custom/Liquid/LiquidGeomtryNode.js +14 -16
  87. package/Mesher/{Models → Voxels/Models}/Nodes/Default/QuadVoxelGeometryNode.d.ts +2 -2
  88. package/Mesher/{Models → Voxels/Models}/Nodes/Default/QuadVoxelGeometryNode.js +1 -1
  89. package/Mesher/{Models → Voxels/Models}/Nodes/Default/TriangleVoxelGeometryNode.d.ts +2 -2
  90. package/Mesher/{Models → Voxels/Models}/Nodes/Default/TriangleVoxelGeometryNode.js +1 -1
  91. package/Mesher/{Models → Voxels/Models}/Nodes/Types/QuadVoxelGometryNodeTypes.d.ts +2 -2
  92. package/Mesher/{Models → Voxels/Models}/Nodes/Types/TriangleVoxelGometryNodeTypes.d.ts +1 -1
  93. package/Mesher/{Models → Voxels/Models}/Nodes/VoxelGeometryConstructor.d.ts +2 -2
  94. package/Mesher/Voxels/Models/Procedures/Default/ConsistentRotationTextureProcedure.d.ts +24 -0
  95. package/Mesher/{Models → Voxels/Models}/Procedures/Default/ConsistentRotationTextureProcedure.js +2 -2
  96. package/Mesher/{Models → Voxels/Models}/Procedures/Default/OutlinedTextureProcedure.d.ts +4 -5
  97. package/Mesher/Voxels/Models/Procedures/Default/OutlinedTextureProcedure.js +205 -0
  98. package/Mesher/Voxels/Models/Procedures/Default/PillarTextureProcedure.d.ts +28 -0
  99. package/Mesher/Voxels/Models/Procedures/Default/PillarTextureProcedure.js +109 -0
  100. package/Mesher/{Models → Voxels/Models}/Procedures/TextureProcedure.d.ts +3 -3
  101. package/Mesher/{Models → Voxels/Models}/Procedures/TextureProcedureRegister.js +2 -0
  102. package/Mesher/{Models → Voxels/Models}/VoxelConstructor.d.ts +4 -4
  103. package/Mesher/{Models → Voxels/Models}/VoxelConstructor.js +3 -3
  104. package/Mesher/{Models → Voxels/Models}/VoxelGeometryBuilderCacheSpace.d.ts +2 -2
  105. package/Mesher/{Models → Voxels/Models}/VoxelGeometryBuilderCacheSpace.js +2 -2
  106. package/Mesher/{Models → Voxels/Models}/VoxelModelBuilder.d.ts +7 -7
  107. package/Mesher/{Models → Voxels/Models}/VoxelModelBuilder.js +6 -5
  108. package/Mesher/{Models → Voxels/Models}/VoxelModelConstructorRegister.d.ts +4 -4
  109. package/Mesher/{Models → Voxels/Models}/VoxelModelConstructorRegister.js +2 -2
  110. package/Mesher/{Models → Voxels/Models}/VoxelModelEffect.d.ts +1 -1
  111. package/Mesher/{Models → Voxels/Models}/VoxelModelEffect.js +1 -1
  112. package/Renderer/Classes/DVESectionMeshes.d.ts +1 -1
  113. package/Renderer/MeshManager.js +1 -1
  114. package/Settings/EngineSettings.types.d.ts +2 -1
  115. package/Settings/EngineSettings.types.js +3 -1
  116. package/Tasks/Paint/Common.js +14 -9
  117. package/Tasks/Paint/Erase/EraseVoxel.js +1 -1
  118. package/Tasks/Paint/Erase/EraseVoxelSelection.d.ts +4 -0
  119. package/Tasks/Paint/Erase/EraseVoxelSelection.js +33 -0
  120. package/Tasks/Paint/Erase/EraseVoxelTemplate.js +1 -2
  121. package/Tasks/Paint/Paint/PaintVoxelTemplate.js +1 -1
  122. package/Tasks/Propagation/Illumanation/RGBUpdate.js +1 -1
  123. package/Tasks/Tasks.types.d.ts +2 -0
  124. package/Tasks/TasksIds.d.ts +1 -0
  125. package/Tasks/TasksIds.js +1 -0
  126. package/Tasks/WorldGeneration/InitTasks.js +3 -1
  127. package/Templates/Archive/ArchivedVoxelTemplate.d.ts +6 -5
  128. package/Templates/Archive/ArchivedVoxelTemplate.js +56 -49
  129. package/Templates/Archive/Functions/CreateArchivedTemplate.js +4 -4
  130. package/Templates/Archive/Functions/ExportArchiedTemplateJSON.js +0 -1
  131. package/Templates/Archive/Functions/ImportArchivedTemplateJSON.js +0 -2
  132. package/Templates/Cursor/TemplateCursor.d.ts +6 -1
  133. package/Templates/Cursor/TemplateCursor.js +16 -3
  134. package/Templates/Cursor/TemplateProxy.d.ts +1 -0
  135. package/Templates/Cursor/TemplateProxy.js +9 -0
  136. package/Templates/Cursor/TemplateVoxelCursor.d.ts +1 -0
  137. package/Templates/Cursor/TemplateVoxelCursor.js +6 -0
  138. package/Templates/Full/FullVoxelTemplate.d.ts +5 -4
  139. package/Templates/Full/FullVoxelTemplate.js +32 -17
  140. package/Templates/Functions/ExtrudeSelection.d.ts +5 -0
  141. package/Templates/Functions/ExtrudeSelection.js +44 -0
  142. package/Templates/Functions/FillSelection.d.ts +4 -0
  143. package/Templates/Functions/FillSelection.js +20 -0
  144. package/Templates/Functions/FlipTemplate.d.ts +2 -2
  145. package/Templates/Functions/FlipTemplate.js +8 -8
  146. package/Templates/Functions/RotateTemplate.d.ts +2 -2
  147. package/Templates/Path/VoxelPath.d.ts +4 -0
  148. package/Templates/Path/VoxelPath.js +18 -0
  149. package/Templates/Path/VoxelPath.types.d.ts +1 -0
  150. package/Templates/Selection/VoxelBFSSelection.d.ts +6 -6
  151. package/Templates/Selection/VoxelBFSSelection.js +29 -22
  152. package/Templates/Selection/VoxelBoundsSelection.d.ts +20 -0
  153. package/Templates/Selection/{VoxelBoxSelection.js → VoxelBoundsSelection.js} +38 -20
  154. package/Templates/Selection/VoxelPointSelection.d.ts +19 -0
  155. package/Templates/Selection/VoxelPointSelection.js +49 -0
  156. package/Templates/Selection/VoxelSelection.d.ts +18 -0
  157. package/Templates/Selection/VoxelSelection.js +1 -0
  158. package/Templates/Selection/VoxelSurfaceSelection.d.ts +8 -12
  159. package/Templates/Selection/VoxelSurfaceSelection.js +88 -84
  160. package/Templates/Selection/VoxelTemplateSelection.d.ts +13 -4
  161. package/Templates/Selection/VoxelTemplateSelection.js +27 -9
  162. package/Templates/Shapes/Selections/BoxVoxelShapeSelection.d.ts +28 -0
  163. package/Templates/Shapes/Selections/BoxVoxelShapeSelection.js +77 -0
  164. package/Templates/Shapes/Selections/ConeVoxelShapeSelection.d.ts +28 -0
  165. package/Templates/Shapes/Selections/ConeVoxelShapeSelection.js +77 -0
  166. package/Templates/Shapes/Selections/CylinderVoxelShapeSelection.d.ts +28 -0
  167. package/Templates/Shapes/Selections/CylinderVoxelShapeSelection.js +77 -0
  168. package/Templates/Shapes/Selections/EllipsoidVoxelShapeSelection.d.ts +28 -0
  169. package/Templates/Shapes/Selections/EllipsoidVoxelShapeSelection.js +92 -0
  170. package/Templates/Shapes/Selections/OctahedronVoxelShapeSelection.d.ts +28 -0
  171. package/Templates/Shapes/Selections/OctahedronVoxelShapeSelection.js +76 -0
  172. package/Templates/Shapes/Selections/PyramidVoxelShapeSelection.d.ts +37 -0
  173. package/Templates/Shapes/Selections/PyramidVoxelShapeSelection.js +137 -0
  174. package/Templates/Shapes/Selections/SphereVoxelShapeSelection.d.ts +20 -0
  175. package/Templates/Shapes/Selections/SphereVoxelShapeSelection.js +61 -0
  176. package/Templates/Shapes/Selections/TorusVoxelShapeSelection.d.ts +28 -0
  177. package/Templates/Shapes/Selections/TorusVoxelShapeSelection.js +76 -0
  178. package/Templates/Shapes/Selections/VoxelShapeSelection.d.ts +5 -0
  179. package/Templates/Shapes/Selections/VoxelShapeSelection.js +1 -0
  180. package/Templates/Shapes/VoxelShape.types.d.ts +2 -0
  181. package/Templates/Shapes/VoxelShape.types.js +8 -0
  182. package/Templates/Shapes/VoxelShapeTemplate.d.ts +37 -0
  183. package/Templates/Shapes/{BasicVoxelShapeTemplate.js → VoxelShapeTemplate.js} +43 -37
  184. package/Templates/Shapes/VoxelShapeTemplate.types.d.ts +5 -12
  185. package/Templates/Shapes/VoxelShapeTemplate.types.js +5 -1
  186. package/Templates/{VoxelTempateRegister.d.ts → VoxelTemplateRegister.d.ts} +4 -0
  187. package/Templates/VoxelTemplateRegister.js +60 -0
  188. package/Templates/VoxelTemplates.types.d.ts +3 -3
  189. package/Textures/Classes/CompiledTexture.d.ts +2 -0
  190. package/Textures/Classes/CompiledTexture.js +19 -1
  191. package/Textures/Classes/TextureAnimationTexture.d.ts +1 -1
  192. package/Textures/Functions/BuildTextureData.js +13 -0
  193. package/Textures/TextureManager.d.ts +1 -0
  194. package/Textures/TextureManager.js +11 -5
  195. package/Tools/Brush/Brush.d.ts +2 -0
  196. package/Tools/Brush/Brush.js +19 -0
  197. package/Tools/Tasks/TasksTool.d.ts +2 -1
  198. package/Tools/Tasks/TasksTool.js +2 -0
  199. package/Util/BinaryBuffer/Functions/BinaryBufferConvert.d.ts +1 -1
  200. package/Util/BinaryBuffer/Functions/BinaryBufferToTypedArray.d.ts +1 -1
  201. package/Util/LocationData.d.ts +1 -1
  202. package/Voxels/Cursor/DataCursor.interface.d.ts +4 -0
  203. package/Voxels/Cursor/VoxelCursor.interface.d.ts +2 -0
  204. package/Voxels/Cursor/VoxelCursor.interface.js +2 -0
  205. package/Voxels/Cursor/VoxelLightData.js +2 -2
  206. package/Voxels/Functions/BuildTagData.js +1 -1
  207. package/Voxels/Indexes/VoxelIndex.d.ts +1 -0
  208. package/Voxels/Indexes/VoxelIndex.js +11 -13
  209. package/Voxels/InitVoxelData.js +5 -14
  210. package/Voxels/Interaction/Functions/PickVoxel.d.ts +0 -5
  211. package/Voxels/Interaction/Functions/PickVoxel.js +64 -85
  212. package/Voxels/Interaction/Functions/PickVoxelWorld.js +21 -46
  213. package/Voxels/Interaction/VoxelPickResult.d.ts +1 -0
  214. package/Voxels/Interaction/VoxelPickResult.js +3 -0
  215. package/Voxels/Models/CompiledVoxelModel.types.d.ts +1 -1
  216. package/Voxels/Models/Defaults/CubeVoxelGeometry.js +11 -0
  217. package/Voxels/Models/Defaults/CubeVoxelModels.js +44 -99
  218. package/Voxels/Models/Defaults/PanelVoxelGeometry.d.ts +1 -3
  219. package/Voxels/Models/Defaults/PanelVoxelGeometry.js +2 -226
  220. package/Voxels/Models/Defaults/PanelVoxelModels.d.ts +1 -0
  221. package/Voxels/Models/Defaults/PanelVoxelModels.js +100 -258
  222. package/Voxels/Models/Defaults/StairVoxelModel.js +2 -2
  223. package/Voxels/Models/Rules/Classes/GeomtryInput.d.ts +4 -1
  224. package/Voxels/Models/Rules/Classes/GeomtryInput.js +26 -5
  225. package/Voxels/Models/Rules/Classes/VoxelRulesGeometry.d.ts +1 -1
  226. package/Voxels/Models/Rules/Functions/BuildFinalInputs.js +23 -8
  227. package/Voxels/Models/Rules/Functions/Compile/CompileGeomtryNodes.d.ts +1 -1
  228. package/Voxels/Models/Rules/Functions/Compile/Nodes/CompileBoxGeometryNode.d.ts +1 -1
  229. package/Voxels/Models/Rules/Functions/Compile/Nodes/CompileQuadGeometryNode.d.ts +1 -1
  230. package/Voxels/Models/Rules/Functions/Compile/Nodes/CompileQuadGeometryNode.js +1 -1
  231. package/Voxels/Models/Rules/Functions/Compile/Nodes/CompileTriangleGeometryNode.d.ts +1 -1
  232. package/Voxels/Models/Rules/Functions/Compile/Nodes/CompileTriangleGeometryNode.js +1 -1
  233. package/Voxels/Models/VoxelModel.types.d.ts +6 -1
  234. package/Voxels/State/Schema/BinarySchemaNode.d.ts +2 -1
  235. package/Voxels/State/Schema/BinarySchemaNode.js +5 -2
  236. package/Voxels/State/Schema/Conditions/SameVoxelConditions.js +2 -0
  237. package/Voxels/Types/PaintVoxelData.d.ts +13 -1
  238. package/Voxels/Types/PaintVoxelData.js +151 -14
  239. package/World/Archive/Functions/Shared/LightSegments.d.ts +1 -1
  240. package/World/Cursor/SectionCursor.d.ts +4 -0
  241. package/World/Cursor/SectionCursor.js +13 -16
  242. package/World/Cursor/SectorCursor.d.ts +4 -0
  243. package/World/Cursor/SectorCursor.js +13 -16
  244. package/World/Cursor/WorldCursor.d.ts +4 -0
  245. package/World/Cursor/WorldCursor.js +8 -0
  246. package/World/Sector/Sector.d.ts +1 -1
  247. package/World/Sector/SectorHeightMap.d.ts +6 -0
  248. package/World/Sector/SectorHeightMap.js +6 -0
  249. package/World/SnapShot/SectionSnapShotCursor.d.ts +3 -0
  250. package/World/SnapShot/SectionSnapShotCursor.js +6 -0
  251. package/World/WorldSpaces.js +3 -3
  252. package/WorldSimulation/Dimensions/DimensionSimulation.d.ts +5 -1
  253. package/WorldSimulation/Dimensions/DimensionSimulation.js +12 -0
  254. package/WorldSimulation/Dimensions/Generator.d.ts +1 -0
  255. package/WorldSimulation/Dimensions/Generator.js +1 -0
  256. package/WorldSimulation/Dimensions/SimulationSector.d.ts +4 -1
  257. package/WorldSimulation/Dimensions/SimulationSector.js +71 -41
  258. package/WorldSimulation/Internal/WorldSimulationTasks.js +5 -2
  259. package/WorldSimulation/Procedures/BuildOnly.d.ts +10 -0
  260. package/WorldSimulation/Procedures/BuildOnly.js +55 -0
  261. package/WorldSimulation/Procedures/InitalLoad.js +3 -0
  262. package/WorldSimulation/Tasks/SimulationTaskBase.d.ts +2 -0
  263. package/WorldSimulation/Tasks/SimulationTaskBase.js +11 -3
  264. package/WorldSimulation/Tasks/TaskSegment.d.ts +2 -1
  265. package/WorldSimulation/Tasks/TaskSegment.js +3 -1
  266. package/WorldSimulation/Tick/TickQueue.d.ts +2 -0
  267. package/WorldSimulation/Tick/TickQueue.js +26 -0
  268. package/WorldSimulation/Tools/SimulationBrush.d.ts +3 -0
  269. package/WorldSimulation/Tools/SimulationBrush.js +52 -0
  270. package/WorldSimulation/Voxels/Behaviors/Types/DefaultVoxelBehavior.js +3 -0
  271. package/WorldSimulation/Voxels/Behaviors/Types/LiquidVoxelBehavior.js +21 -1
  272. package/WorldSimulation/Voxels/Behaviors/VoxelBehaviors.d.ts +2 -0
  273. package/WorldSimulation/Voxels/Behaviors/VoxelBehaviors.js +6 -0
  274. package/WorldSimulation/Voxels/Ticks/Types/LiquidVoxelUpdate.js +39 -14
  275. package/WorldSimulation/WorldSimulation.d.ts +10 -0
  276. package/WorldSimulation/WorldSimulation.js +41 -1
  277. package/package.json +1 -30
  278. package/Mesher/Functions/CompactVoxelMesh.d.ts +0 -3
  279. package/Mesher/Functions/MeshTexture.js +0 -278
  280. package/Mesher/Geomtry/VoxelMesh.d.ts +0 -12
  281. package/Mesher/Geomtry/VoxelMesh.js +0 -25
  282. package/Mesher/Models/Procedures/Default/ConsistentRotationTextureProcedure.d.ts +0 -25
  283. package/Mesher/Models/Procedures/Default/OutlinedTextureProcedure.js +0 -162
  284. package/Templates/Selection/VoxelBoxSelection.d.ts +0 -14
  285. package/Templates/Selection/VoxelSelecton.d.ts +0 -6
  286. package/Templates/Shapes/BasicVoxelShapeTemplate.d.ts +0 -35
  287. package/Templates/Shapes/BoxVoxelTemplate.d.ts +0 -22
  288. package/Templates/Shapes/BoxVoxelTemplate.js +0 -75
  289. package/Templates/Shapes/ConeVoxelTemplate.d.ts +0 -22
  290. package/Templates/Shapes/ConeVoxelTemplate.js +0 -69
  291. package/Templates/Shapes/CylinderVoxelTemplate.d.ts +0 -22
  292. package/Templates/Shapes/CylinderVoxelTemplate.js +0 -69
  293. package/Templates/Shapes/OctahedronVoxelTemplate.d.ts +0 -22
  294. package/Templates/Shapes/OctahedronVoxelTemplate.js +0 -69
  295. package/Templates/Shapes/PyramidVoxelTemplate.d.ts +0 -30
  296. package/Templates/Shapes/PyramidVoxelTemplate.js +0 -140
  297. package/Templates/Shapes/SphereVoxelTemplate.d.ts +0 -24
  298. package/Templates/Shapes/SphereVoxelTemplate.js +0 -97
  299. package/Templates/Shapes/TorusVoxelTemplate.d.ts +0 -22
  300. package/Templates/Shapes/TorusVoxelTemplate.js +0 -69
  301. package/Templates/VoxelTempateRegister.js +0 -30
  302. /package/{Mesher/Models/Nodes/Types/GeomtryNode.types.js → Builder/RayProvider.js} +0 -0
  303. /package/Mesher/{Functions/MeshTexture.d.ts → Items/MeshTextureO.d.ts} +0 -0
  304. /package/Mesher/{Functions → Voxels/Base}/CompactVoxelSectionMesh.js +0 -0
  305. /package/Mesher/{Geomtry → Voxels/Geomtry}/VoxelMeshBVHStructCursor.d.ts +0 -0
  306. /package/Mesher/{Geomtry → Voxels/Geomtry}/VoxelMeshBVHStructCursor.js +0 -0
  307. /package/Mesher/{Geomtry → Voxels/Geomtry}/VoxelMeshVertexStructCursor.d.ts +0 -0
  308. /package/Mesher/{Geomtry → Voxels/Geomtry}/VoxelMeshVertexStructCursor.js +0 -0
  309. /package/Mesher/{Geomtry → Voxels/Geomtry}/VoxelShaderData.d.ts +0 -0
  310. /package/Mesher/{Geomtry → Voxels/Geomtry}/VoxelShaderData.js +0 -0
  311. /package/Mesher/{Functions → Voxels}/MeshSection.d.ts +0 -0
  312. /package/Mesher/{Functions → Voxels}/MeshSection.js +0 -0
  313. /package/Mesher/{Functions → Voxels}/MeshSectionSnapShot.d.ts +0 -0
  314. /package/Mesher/{Functions → Voxels}/MeshSectionSnapShot.js +0 -0
  315. /package/Mesher/{Models → Voxels/Models}/Common/Faces/CullRulledFace.d.ts +0 -0
  316. /package/Mesher/{Models → Voxels/Models}/Common/Faces/ShadeRulelessFace.js +0 -0
  317. /package/Mesher/{Models → Voxels/Models}/Common/GetTexture.js +0 -0
  318. /package/Mesher/{Models → Voxels/Models}/Nodes/Custom/index.d.ts +0 -0
  319. /package/Mesher/{Models → Voxels/Models}/Nodes/Custom/index.js +0 -0
  320. /package/Mesher/{Models → Voxels/Models}/Nodes/GeometryNode.d.ts +0 -0
  321. /package/Mesher/{Models → Voxels/Models}/Nodes/GeometryNode.js +0 -0
  322. /package/Mesher/{Models → Voxels/Models}/Nodes/Types/GeomtryNode.types.d.ts +0 -0
  323. /package/{Templates/Selection/VoxelSelecton.js → Mesher/Voxels/Models/Nodes/Types/GeomtryNode.types.js} +0 -0
  324. /package/Mesher/{Models → Voxels/Models}/Nodes/Types/QuadVoxelGometryNodeTypes.js +0 -0
  325. /package/Mesher/{Models → Voxels/Models}/Nodes/Types/TriangleVoxelGometryNodeTypes.js +0 -0
  326. /package/Mesher/{Models → Voxels/Models}/Nodes/VoxelGeometryConstructor.js +0 -0
  327. /package/Mesher/{Models → Voxels/Models}/Procedures/TextureProcedure.js +0 -0
  328. /package/Mesher/{Models → Voxels/Models}/Procedures/TextureProcedureRegister.d.ts +0 -0
  329. /package/Mesher/{Models → Voxels/Models}/RenderedMaterials.d.ts +0 -0
  330. /package/Mesher/{Models → Voxels/Models}/RenderedMaterials.js +0 -0
@@ -0,0 +1,6 @@
1
+ import { Vector3Like } from "@amodx/math";
2
+ export interface RayProvider {
3
+ origin: Vector3Like;
4
+ direction: Vector3Like;
5
+ length: number;
6
+ }
@@ -0,0 +1,55 @@
1
+ import { VoxelBuildSpace } from "../../VoxelBuildSpace";
2
+ import { VoxelShapeTemplate } from "../../../Templates/Shapes/VoxelShapeTemplate";
3
+ import { VoxelPickResult } from "../../../Voxels/Interaction/VoxelPickResult";
4
+ import { Vector3Like } from "@amodx/math";
5
+ import { PaintVoxelData } from "../../../Voxels";
6
+ import { BuilderToolBase, ToolOptionsData } from "../BuilderToolBase";
7
+ export declare enum BrushPositionModes {
8
+ Start = "Start",
9
+ Center = "Center",
10
+ End = "End"
11
+ }
12
+ export declare enum BrushToolModes {
13
+ Fill = "Fill",
14
+ Extrude = "Extrude",
15
+ Remove = "Remove"
16
+ }
17
+ type BrushVoxelData = {
18
+ fill: PaintVoxelData;
19
+ face: PaintVoxelData;
20
+ edge: PaintVoxelData;
21
+ point: PaintVoxelData;
22
+ };
23
+ interface BrushToolEvents {
24
+ "shape-updated": null;
25
+ }
26
+ export declare class BrushTool extends BuilderToolBase<BrushToolEvents> {
27
+ static ToolId: string;
28
+ static ModeArray: BrushToolModes[];
29
+ static PositionModeArray: BrushPositionModes[];
30
+ static get ShapesArray(): string[];
31
+ static ShapeCreators: Record<string, () => VoxelShapeTemplate>;
32
+ static BaseToolOptions: ToolOptionsData;
33
+ static ShapeOptions: Record<string, () => ToolOptionsData>;
34
+ shape: string;
35
+ axisXPositionMode: BrushPositionModes;
36
+ axisYPositionMode: BrushPositionModes;
37
+ axisZPositionMode: BrushPositionModes;
38
+ mode: BrushToolModes;
39
+ template: VoxelShapeTemplate;
40
+ get selection(): import("../../../Templates/Shapes/Selections/VoxelShapeSelection").IVoxelShapeSelection<any, import("../../../Templates/Shapes/Selections/VoxelShapeSelection").IVoxelShapeSelectionData<any>>;
41
+ voxelData: Partial<BrushVoxelData>;
42
+ usePlacingStrategy: boolean;
43
+ placePosition: Vector3Like;
44
+ protected _position: Vector3Like;
45
+ constructor(space: VoxelBuildSpace);
46
+ update(): Promise<void>;
47
+ cancel(): void;
48
+ use(): Promise<void>;
49
+ protected getPlacePosition(picked: VoxelPickResult): Vector3Like;
50
+ updateShape(shape: string): void;
51
+ getOptionValue(property: string): any;
52
+ getCurrentOptions(): ToolOptionsData;
53
+ updateOption(property: string, value: any): void;
54
+ }
55
+ export {};
@@ -0,0 +1,352 @@
1
+ import { VoxelShapeTemplate } from "../../../Templates/Shapes/VoxelShapeTemplate";
2
+ import { SphereVoxelShapeSelection } from "../../../Templates/Shapes/Selections/SphereVoxelShapeSelection";
3
+ import { BoxVoxelShapeSelection } from "../../../Templates/Shapes/Selections/BoxVoxelShapeSelection";
4
+ import { PyramidVoxelShapeSelection } from "../../../Templates/Shapes/Selections/PyramidVoxelShapeSelection";
5
+ import { EllipsoidVoxelShapeSelection } from "../../../Templates/Shapes/Selections/EllipsoidVoxelShapeSelection";
6
+ import { Vector3Like } from "@amodx/math";
7
+ import { BuilderToolBase } from "../BuilderToolBase";
8
+ export var BrushPositionModes;
9
+ (function (BrushPositionModes) {
10
+ BrushPositionModes["Start"] = "Start";
11
+ BrushPositionModes["Center"] = "Center";
12
+ BrushPositionModes["End"] = "End";
13
+ })(BrushPositionModes || (BrushPositionModes = {}));
14
+ export var BrushToolModes;
15
+ (function (BrushToolModes) {
16
+ BrushToolModes["Fill"] = "Fill";
17
+ BrushToolModes["Extrude"] = "Extrude";
18
+ BrushToolModes["Remove"] = "Remove";
19
+ })(BrushToolModes || (BrushToolModes = {}));
20
+ export class BrushTool extends BuilderToolBase {
21
+ static ToolId = "Brush";
22
+ static ModeArray = [
23
+ BrushToolModes.Fill,
24
+ BrushToolModes.Extrude,
25
+ BrushToolModes.Remove,
26
+ ];
27
+ static PositionModeArray = [
28
+ BrushPositionModes.Start,
29
+ BrushPositionModes.Center,
30
+ BrushPositionModes.End,
31
+ ];
32
+ static get ShapesArray() {
33
+ return Object.keys(this.ShapeCreators);
34
+ }
35
+ static ShapeCreators = {
36
+ Sphere() {
37
+ return new VoxelShapeTemplate(VoxelShapeTemplate.CreateNew({
38
+ shapeSelection: SphereVoxelShapeSelection.CreateNew({}),
39
+ }));
40
+ },
41
+ Box() {
42
+ return new VoxelShapeTemplate(VoxelShapeTemplate.CreateNew({
43
+ shapeSelection: BoxVoxelShapeSelection.CreateNew({}),
44
+ }));
45
+ },
46
+ Pyramid() {
47
+ return new VoxelShapeTemplate(VoxelShapeTemplate.CreateNew({
48
+ shapeSelection: PyramidVoxelShapeSelection.CreateNew({}),
49
+ }));
50
+ },
51
+ Ellipsoid() {
52
+ return new VoxelShapeTemplate(VoxelShapeTemplate.CreateNew({
53
+ shapeSelection: EllipsoidVoxelShapeSelection.CreateNew({}),
54
+ }));
55
+ },
56
+ };
57
+ static BaseToolOptions = [
58
+ {
59
+ cateogry: "main",
60
+ property: "axisXPositionMode",
61
+ name: "X Axis Position Mode",
62
+ type: "string",
63
+ options: [
64
+ ["End", BrushPositionModes.End],
65
+ ["Center", BrushPositionModes.Center],
66
+ ["Start", BrushPositionModes.Start],
67
+ ],
68
+ },
69
+ {
70
+ cateogry: "main",
71
+ property: "axisYPositionMode",
72
+ name: "Y Axis Position Mode",
73
+ type: "string",
74
+ options: [
75
+ ["End", BrushPositionModes.End],
76
+ ["Center", BrushPositionModes.Center],
77
+ ["Start", BrushPositionModes.Start],
78
+ ],
79
+ },
80
+ {
81
+ cateogry: "main",
82
+ property: "axisZPositionMode",
83
+ name: "Z Axis Position Mode",
84
+ type: "string",
85
+ options: [
86
+ ["End", BrushPositionModes.End],
87
+ ["Center", BrushPositionModes.Center],
88
+ ["Start", BrushPositionModes.Start],
89
+ ],
90
+ },
91
+ ];
92
+ static ShapeOptions = {
93
+ Sphere() {
94
+ return [
95
+ {
96
+ cateogry: "shape",
97
+ property: "radius",
98
+ name: "Radius",
99
+ type: "number",
100
+ min: 0,
101
+ max: 50,
102
+ },
103
+ ];
104
+ },
105
+ Box() {
106
+ return [
107
+ {
108
+ cateogry: "shape",
109
+ property: "width",
110
+ name: "Width",
111
+ type: "number",
112
+ min: 0,
113
+ max: 50,
114
+ },
115
+ {
116
+ cateogry: "shape",
117
+ property: "height",
118
+ name: "Height",
119
+ type: "number",
120
+ min: 0,
121
+ max: 50,
122
+ },
123
+ {
124
+ cateogry: "shape",
125
+ property: "depth",
126
+ name: "Depth",
127
+ type: "number",
128
+ min: 0,
129
+ max: 50,
130
+ },
131
+ ];
132
+ },
133
+ Pyramid() {
134
+ return [
135
+ {
136
+ cateogry: "shape",
137
+ property: "direction",
138
+ name: "Direction",
139
+ type: "string",
140
+ options: [
141
+ ["Up", "+y"],
142
+ ["Down", "-y"],
143
+ ["East", "+x"],
144
+ ["West", "-x"],
145
+ ["North", "+z"],
146
+ ["South", "-z"],
147
+ ],
148
+ },
149
+ {
150
+ cateogry: "shape",
151
+ property: "height",
152
+ name: "Height",
153
+ type: "number",
154
+ min: 0,
155
+ max: 50,
156
+ },
157
+ {
158
+ cateogry: "shape",
159
+ property: "fallOff",
160
+ name: "Falloff",
161
+ type: "number",
162
+ min: 0,
163
+ max: 50,
164
+ },
165
+ ];
166
+ },
167
+ Ellipsoid() {
168
+ return [
169
+ {
170
+ cateogry: "shape",
171
+ property: "radiusX",
172
+ name: "Radius X",
173
+ type: "number",
174
+ min: 0,
175
+ max: 50,
176
+ },
177
+ {
178
+ cateogry: "shape",
179
+ property: "radiusY",
180
+ name: "Radius Y",
181
+ type: "number",
182
+ min: 0,
183
+ max: 50,
184
+ },
185
+ {
186
+ cateogry: "shape",
187
+ property: "radiusZ",
188
+ name: "Radius Z",
189
+ type: "number",
190
+ min: 0,
191
+ max: 50,
192
+ },
193
+ ];
194
+ },
195
+ };
196
+ shape = "Sphere";
197
+ axisXPositionMode = BrushPositionModes.Center;
198
+ axisYPositionMode = BrushPositionModes.Center;
199
+ axisZPositionMode = BrushPositionModes.Center;
200
+ mode = BrushToolModes.Fill;
201
+ template;
202
+ get selection() {
203
+ return this.template.shapeSelection;
204
+ }
205
+ voxelData = {};
206
+ usePlacingStrategy = true;
207
+ placePosition = Vector3Like.Create();
208
+ _position = Vector3Like.Create();
209
+ constructor(space) {
210
+ super(space);
211
+ this.updateShape(this.shape);
212
+ }
213
+ async update() {
214
+ this._lastPicked = await this.space.pickWithProvider(this.rayProviderIndex);
215
+ if (!this._lastPicked)
216
+ return;
217
+ if (this.mode == BrushToolModes.Fill ||
218
+ this.mode == BrushToolModes.Extrude) {
219
+ if (!this.space.bounds.intersectsPoint(this._lastPicked.normalPosition)) {
220
+ this._lastPicked = null;
221
+ return;
222
+ }
223
+ }
224
+ if (this.mode == BrushToolModes.Remove) {
225
+ if (!this.space.bounds.intersectsPoint(this._lastPicked.position)) {
226
+ this._lastPicked = null;
227
+ return;
228
+ }
229
+ }
230
+ const place = this.getPlacePosition(this._lastPicked);
231
+ this.placePosition.x = place.x;
232
+ this.placePosition.y = place.y;
233
+ this.placePosition.z = place.z;
234
+ this.selection.origin.x = place.x;
235
+ this.selection.origin.y = place.y;
236
+ this.selection.origin.z = place.z;
237
+ }
238
+ cancel() {
239
+ this._lastPicked = null;
240
+ }
241
+ async use() {
242
+ if (!this._lastPicked)
243
+ return;
244
+ if (this.usePlacingStrategy) {
245
+ if (this.voxelData.fill) {
246
+ const newData = this.space.getPlaceState(this.voxelData.fill, this._lastPicked);
247
+ if (newData)
248
+ this.voxelData.fill = newData;
249
+ }
250
+ }
251
+ if (this.mode == BrushToolModes.Fill && this.voxelData.fill) {
252
+ this.template.setVoxels(this.voxelData.fill);
253
+ const place = this.getPlacePosition(this._lastPicked);
254
+ await this.space.paintTemplate([place.x, place.y, place.z], this.template.toJSON());
255
+ return;
256
+ }
257
+ if (this.mode == BrushToolModes.Extrude) {
258
+ const template = await this.space.getExtrudedSelectionTemplate(this.selection.toJSON(), this._lastPicked.normal);
259
+ await this.space.paintTemplate(this.selection.origin, template.toJSON());
260
+ return;
261
+ }
262
+ if (this.mode == BrushToolModes.Remove) {
263
+ const voxel = this._lastPicked.voxel;
264
+ if (voxel && !voxel.isAir()) {
265
+ const place = this.getPlacePosition(this._lastPicked);
266
+ await this.space.eraseTemplate([place.x, place.y, place.z], this.template.toJSON());
267
+ }
268
+ return;
269
+ }
270
+ }
271
+ getPlacePosition(picked) {
272
+ //x
273
+ if (this.axisXPositionMode == BrushPositionModes.Center) {
274
+ this._position.x =
275
+ picked.normalPosition.x -
276
+ Math.floor(this.template.shapeSelection.bounds.size.x / 2);
277
+ }
278
+ if (this.axisXPositionMode == BrushPositionModes.Start) {
279
+ this._position.x = picked.normalPosition.x;
280
+ }
281
+ if (this.axisXPositionMode == BrushPositionModes.End) {
282
+ this._position.x =
283
+ picked.normalPosition.x - this.template.shapeSelection.bounds.size.x;
284
+ }
285
+ //y
286
+ if (this.axisYPositionMode == BrushPositionModes.Center) {
287
+ this._position.y =
288
+ picked.normalPosition.y -
289
+ Math.floor(this.template.shapeSelection.bounds.size.y / 2);
290
+ }
291
+ if (this.axisYPositionMode == BrushPositionModes.Start) {
292
+ this._position.y = picked.normalPosition.y;
293
+ }
294
+ if (this.axisYPositionMode == BrushPositionModes.End) {
295
+ this._position.y =
296
+ picked.normalPosition.y - this.template.shapeSelection.bounds.size.y;
297
+ }
298
+ //z
299
+ if (this.axisZPositionMode == BrushPositionModes.Center) {
300
+ this._position.z =
301
+ picked.normalPosition.z -
302
+ Math.floor(this.template.shapeSelection.bounds.size.z / 2);
303
+ }
304
+ if (this.axisZPositionMode == BrushPositionModes.Start) {
305
+ this._position.z = picked.normalPosition.z;
306
+ }
307
+ if (this.axisXPositionMode == BrushPositionModes.End) {
308
+ this._position.z =
309
+ picked.normalPosition.z - this.template.shapeSelection.bounds.size.z;
310
+ }
311
+ return this._position;
312
+ }
313
+ updateShape(shape) {
314
+ const shapeCreator = BrushTool.ShapeCreators[shape];
315
+ if (!shapeCreator)
316
+ throw new Error(`Shape with id ${shape} does not exist`);
317
+ this.shape = shape;
318
+ this.template = shapeCreator();
319
+ }
320
+ getOptionValue(property) {
321
+ const data = this.getOptionData(property);
322
+ if (!data)
323
+ return;
324
+ if (this.optionInCategory(property, "main")) {
325
+ return this[data.property];
326
+ }
327
+ if (this.optionInCategory(property, "shape")) {
328
+ return this.selection[data.property];
329
+ }
330
+ }
331
+ getCurrentOptions() {
332
+ const options = [
333
+ ...BrushTool.BaseToolOptions,
334
+ ...BrushTool.ShapeOptions[this.shape](),
335
+ ];
336
+ this.processOptions(options);
337
+ return options;
338
+ }
339
+ updateOption(property, value) {
340
+ const data = this.getOptionData(property);
341
+ if (!data)
342
+ return;
343
+ if (this.optionInCategory(property, "main")) {
344
+ this[data.property] = value;
345
+ return;
346
+ }
347
+ if (this.optionInCategory(property, "shape")) {
348
+ this.selection[data.property] = value;
349
+ return;
350
+ }
351
+ }
352
+ }
@@ -0,0 +1,39 @@
1
+ import { VoxelPickResult } from "Voxels/Interaction/VoxelPickResult";
2
+ import { TypedEventTarget } from "../../Util/TypedEventTarget";
3
+ import { VoxelBuildSpace } from "../VoxelBuildSpace";
4
+ type ToolOptionBase<Data> = {
5
+ cateogry: string;
6
+ property: string;
7
+ name: string;
8
+ } & Data;
9
+ export type ToolOption = ToolOptionBase<{
10
+ type: "string";
11
+ options: [name: string, value: any][];
12
+ }> | ToolOptionBase<{
13
+ type: "number";
14
+ min: number;
15
+ max: number;
16
+ }>;
17
+ export type ToolOptionsData = ToolOption[];
18
+ export declare abstract class BuilderToolBase<Events extends Record<string, any>> extends TypedEventTarget<Events> {
19
+ space: VoxelBuildSpace;
20
+ rayProviderIndex: number;
21
+ protected _lastPicked: VoxelPickResult | null;
22
+ get picked(): Readonly<VoxelPickResult> | null;
23
+ constructor(space: VoxelBuildSpace);
24
+ protected _options: ToolOptionsData;
25
+ protected _optionsMap: Map<string, ToolOption>;
26
+ protected _categoryMap: Map<string, Set<string>>;
27
+ protected processOptions(data: ToolOptionsData): void;
28
+ getOptions(): ToolOptionsData;
29
+ getOptionCategories(): [string, Set<string>][];
30
+ abstract getOptionValue(id: string): any;
31
+ getOptionData(id: string): ToolOption | undefined;
32
+ optionInCategory(option: string, cateogry: string): boolean;
33
+ abstract getCurrentOptions(): ToolOptionsData;
34
+ abstract updateOption(property: string, value: any): void;
35
+ abstract cancel(): void;
36
+ abstract use(...args: any): Promise<void>;
37
+ abstract update(...args: any): Promise<void>;
38
+ }
39
+ export {};
@@ -0,0 +1,42 @@
1
+ import { TypedEventTarget } from "../../Util/TypedEventTarget";
2
+ export class BuilderToolBase extends TypedEventTarget {
3
+ space;
4
+ rayProviderIndex = 0;
5
+ _lastPicked = null;
6
+ get picked() {
7
+ return this._lastPicked;
8
+ }
9
+ constructor(space) {
10
+ super();
11
+ this.space = space;
12
+ }
13
+ _options = [];
14
+ _optionsMap = new Map();
15
+ _categoryMap = new Map();
16
+ processOptions(data) {
17
+ this._options = data;
18
+ this._optionsMap.clear();
19
+ this._categoryMap.clear();
20
+ for (const option of data) {
21
+ let categoryArray = this._categoryMap.get(option.cateogry);
22
+ if (!categoryArray) {
23
+ categoryArray = new Set();
24
+ this._categoryMap.set(option.cateogry, categoryArray);
25
+ }
26
+ categoryArray.add(option.property);
27
+ this._optionsMap.set(option.property, option);
28
+ }
29
+ }
30
+ getOptions() {
31
+ return this._options;
32
+ }
33
+ getOptionCategories() {
34
+ return [...this._categoryMap];
35
+ }
36
+ getOptionData(id) {
37
+ return this._optionsMap.get(id);
38
+ }
39
+ optionInCategory(option, cateogry) {
40
+ return Boolean(this._categoryMap.get(cateogry)?.has(option));
41
+ }
42
+ }
@@ -0,0 +1,24 @@
1
+ import { PaintVoxelData } from "../../../Voxels";
2
+ import { VoxelPointSelection } from "../../../Templates/Selection/VoxelPointSelection";
3
+ import { BuilderToolBase, ToolOptionsData } from "../BuilderToolBase";
4
+ export declare enum HandToolModes {
5
+ Place = "Place",
6
+ Remove = "Remove"
7
+ }
8
+ interface HandToolEvents {
9
+ }
10
+ export declare class HandTool extends BuilderToolBase<HandToolEvents> {
11
+ static ToolId: string;
12
+ static ModeArray: HandToolModes[];
13
+ mode: HandToolModes;
14
+ selection: VoxelPointSelection;
15
+ voxelData: PaintVoxelData;
16
+ usePlacingStrategy: boolean;
17
+ update(): Promise<void>;
18
+ cancel(): void;
19
+ use(): Promise<void>;
20
+ getOptionValue(id: string): null;
21
+ getCurrentOptions(): ToolOptionsData;
22
+ updateOption(property: string, value: any): void;
23
+ }
24
+ export {};
@@ -0,0 +1,73 @@
1
+ import { VoxelPointSelection } from "../../../Templates/Selection/VoxelPointSelection";
2
+ import { BuilderToolBase } from "../BuilderToolBase";
3
+ export var HandToolModes;
4
+ (function (HandToolModes) {
5
+ HandToolModes["Place"] = "Place";
6
+ HandToolModes["Remove"] = "Remove";
7
+ })(HandToolModes || (HandToolModes = {}));
8
+ export class HandTool extends BuilderToolBase {
9
+ static ToolId = "Hand";
10
+ static ModeArray = [
11
+ HandToolModes.Place,
12
+ HandToolModes.Remove,
13
+ ];
14
+ mode = HandToolModes.Place;
15
+ selection = new VoxelPointSelection();
16
+ voxelData;
17
+ usePlacingStrategy = true;
18
+ async update() {
19
+ this._lastPicked = await this.space.pickWithProvider(this.rayProviderIndex);
20
+ if (!this._lastPicked)
21
+ return;
22
+ if (this.mode == HandToolModes.Place) {
23
+ if (!this.space.bounds.intersectsPoint(this._lastPicked.normalPosition)) {
24
+ this._lastPicked = null;
25
+ return;
26
+ }
27
+ this.selection.reConstruct(this._lastPicked.normalPosition);
28
+ }
29
+ if (this.mode == HandToolModes.Remove) {
30
+ if (!this.space.bounds.intersectsPoint(this._lastPicked.position)) {
31
+ this._lastPicked = null;
32
+ return;
33
+ }
34
+ this.selection.reConstruct(this._lastPicked.position);
35
+ }
36
+ }
37
+ cancel() {
38
+ this._lastPicked = null;
39
+ }
40
+ async use() {
41
+ if (!this._lastPicked)
42
+ return;
43
+ if (this.mode == HandToolModes.Place) {
44
+ let voxelData = this.voxelData;
45
+ if (this.usePlacingStrategy) {
46
+ const newData = this.space.getPlaceState(voxelData, this._lastPicked);
47
+ if (newData)
48
+ voxelData = newData;
49
+ }
50
+ await this.space.paintVoxel([
51
+ this._lastPicked.normalPosition.x,
52
+ this._lastPicked.normalPosition.y,
53
+ this._lastPicked.normalPosition.z,
54
+ ], voxelData);
55
+ return;
56
+ }
57
+ if (this.mode == HandToolModes.Remove) {
58
+ await this.space.eraseVoxel([
59
+ this._lastPicked.position.x,
60
+ this._lastPicked.position.y,
61
+ this._lastPicked.position.z,
62
+ ]);
63
+ return;
64
+ }
65
+ }
66
+ getOptionValue(id) {
67
+ return null;
68
+ }
69
+ getCurrentOptions() {
70
+ return [];
71
+ }
72
+ updateOption(property, value) { }
73
+ }
@@ -0,0 +1,34 @@
1
+ import { PaintVoxelData } from "../../../Voxels";
2
+ import { VoxelPointSelection } from "../../../Templates/Selection/VoxelPointSelection";
3
+ import { BuilderToolBase, ToolOptionsData } from "../BuilderToolBase";
4
+ import { VoxelPath } from "../../../Templates/Path/VoxelPath";
5
+ import { FreePointSelection } from "../../Util/FreePointSelection";
6
+ export declare enum PathToolModes {
7
+ PlacePoints = "Place Points",
8
+ MovePoints = "Move Points",
9
+ RemovePoints = "Remove Points",
10
+ FillPath = "Fill Path",
11
+ RemovePath = "Remvoe Path"
12
+ }
13
+ interface PathToolEvents {
14
+ }
15
+ export declare class PathTool extends BuilderToolBase<PathToolEvents> {
16
+ static ToolId: string;
17
+ static ModeArray: PathToolModes[];
18
+ mode: PathToolModes;
19
+ selection: VoxelPointSelection;
20
+ pointSelection: FreePointSelection;
21
+ path: VoxelPath;
22
+ get distance(): number;
23
+ set distance(value: number);
24
+ voxelData: PaintVoxelData;
25
+ private _placedSegment;
26
+ setMode(mode: PathToolModes): 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;
33
+ }
34
+ export {};