@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
@@ -6,18 +6,12 @@ import { FullVoxelTemplate } from "../Full/FullVoxelTemplate";
6
6
  import { BoundingBox } from "@amodx/math/Geomtry/Bounds/BoundingBox";
7
7
  export class VoxelSurfaceSelection {
8
8
  origin = Vector3Like.Create();
9
- size = Vector3Like.Create();
10
9
  normal = Vector3Like.Create();
11
10
  bitIndex;
12
11
  index = Flat3DIndex.GetXZYOrder();
13
12
  bounds = new BoundingBox();
14
- extrusion = 0;
15
13
  isSelected(x, y, z) {
16
- if (x < this.origin.x || x >= this.origin.x + this.size.x)
17
- return false;
18
- if (y < this.origin.y || y >= this.origin.y + this.size.y)
19
- return false;
20
- if (z < this.origin.z || z >= this.origin.z + this.size.z)
14
+ if (!this.bounds.intersectsXYZ(x + 0.5, y + 0.5, z + 0.5))
21
15
  return false;
22
16
  return (getBitArrayIndex(this.bitIndex, this.index.getIndexXYZ(x - this.origin.x, y - this.origin.y, z - this.origin.z)) === 1);
23
17
  }
@@ -34,23 +28,24 @@ export class VoxelSurfaceSelection {
34
28
  axis = "z";
35
29
  const min = Vector3Like.Create(Infinity, Infinity, Infinity);
36
30
  const max = Vector3Like.Create(-Infinity, -Infinity, -Infinity);
31
+ // 1) BFS to collect the *surface-adjacent* air layer (offset 1 in +normal)
37
32
  const queue = [
38
33
  position.x + normal.x,
39
34
  position.y + normal.y,
40
35
  position.z + normal.z,
41
36
  ];
42
37
  let size = 0;
43
- const visted = new Set();
38
+ const visited = new Set();
44
39
  while (queue.length) {
45
40
  if (size > maxSize)
46
41
  break;
47
42
  const x = queue.shift();
48
43
  const y = queue.shift();
49
44
  const z = queue.shift();
50
- const key = `${x}-${y}-${z}`;
51
- if (visted.has(key))
45
+ const key = `${x} ${y} ${z}`;
46
+ if (visited.has(key))
52
47
  continue;
53
- visted.add(key);
48
+ visited.add(key);
54
49
  if (x < min.x)
55
50
  min.x = x;
56
51
  if (y < min.y)
@@ -63,11 +58,10 @@ export class VoxelSurfaceSelection {
63
58
  max.y = y;
64
59
  if (z > max.z)
65
60
  max.z = z;
61
+ // Expand only in the 2D tangent plane to the face normal.
66
62
  for (let i = 0; i < CardinalNeighbors2D.length; i++) {
67
63
  const n = CardinalNeighbors2D[i];
68
- let nx = x;
69
- let ny = y;
70
- let nz = z;
64
+ let nx = x, ny = y, nz = z;
71
65
  if (axis == "x") {
72
66
  ny += n[0];
73
67
  nz += n[1];
@@ -83,6 +77,7 @@ export class VoxelSurfaceSelection {
83
77
  const voxel = cursor.getVoxel(nx, ny, nz);
84
78
  if (!voxel || !voxel.isAir())
85
79
  continue;
80
+ // Must be "resting" on a solid (the face we clicked)
86
81
  const bottomVoxel = cursor.getVoxel(nx - normal.x, ny - normal.y, nz - normal.z);
87
82
  if (!bottomVoxel || bottomVoxel.isAir())
88
83
  continue;
@@ -94,6 +89,48 @@ export class VoxelSurfaceSelection {
94
89
  return false;
95
90
  if (max.x == -Infinity || max.y == -Infinity || max.z == -Infinity)
96
91
  return false;
92
+ // 2) Extrude outward along +normal for 'extrusion' layers.
93
+ // We grow layer-by-layer; each new layer must be air and contiguous to the previous layer stack.
94
+ if (extrusion > 0) {
95
+ // Collect the initial (surface-adjacent) layer as our starting front.
96
+ let front = [];
97
+ for (const key of visited) {
98
+ const [sx, sy, sz] = key.split(" ").map(Number);
99
+ front.push({ x: sx, y: sy, z: sz });
100
+ }
101
+ for (let d = 1; d <= extrusion; d++) {
102
+ const nextFront = [];
103
+ for (const p of front) {
104
+ const tx = p.x + normal.x;
105
+ const ty = p.y + normal.y;
106
+ const tz = p.z + normal.z;
107
+ const tKey = `${tx} ${ty} ${tz}`;
108
+ if (visited.has(tKey))
109
+ continue; // already added by another path
110
+ const world = cursor.getVoxel(tx, ty, tz);
111
+ if (!world || !world.isAir())
112
+ continue; // stop extrusion if we hit solid
113
+ visited.add(tKey);
114
+ nextFront.push({ x: tx, y: ty, z: tz });
115
+ if (tx < min.x)
116
+ min.x = tx;
117
+ if (ty < min.y)
118
+ min.y = ty;
119
+ if (tz < min.z)
120
+ min.z = tz;
121
+ if (tx > max.x)
122
+ max.x = tx;
123
+ if (ty > max.y)
124
+ max.y = ty;
125
+ if (tz > max.z)
126
+ max.z = tz;
127
+ }
128
+ if (nextFront.length === 0)
129
+ break; // nothing more to grow
130
+ front = nextFront;
131
+ }
132
+ }
133
+ // 3) Build compact bit mask over the final bounds.
97
134
  const sizeX = max.x - min.x + 1;
98
135
  const sizeY = max.y - min.y + 1;
99
136
  const sizeZ = max.z - min.z + 1;
@@ -102,96 +139,44 @@ export class VoxelSurfaceSelection {
102
139
  for (let x = min.x; x < min.x + sizeX; x++) {
103
140
  for (let y = min.y; y < min.y + sizeY; y++) {
104
141
  for (let z = min.z; z < min.z + sizeZ; z++) {
105
- const key = `${x}-${y}-${z}`;
106
- if (!visted.has(key))
142
+ const key = `${x} ${y} ${z}`;
143
+ if (!visited.has(key))
107
144
  continue;
108
145
  setBitArrayIndex(this.bitIndex, this.index.getIndexXYZ(x - min.x, y - min.y, z - min.z), 1);
109
146
  }
110
147
  }
111
148
  }
112
- this.size.x = sizeX;
113
- this.size.y = sizeY;
114
- this.size.z = sizeZ;
115
149
  this.origin.x = min.x;
116
150
  this.origin.y = min.y;
117
151
  this.origin.z = min.z;
118
152
  this.bounds.setMinMax(this.origin, {
119
- x: this.origin.x + this.size.x,
120
- y: this.origin.y + this.size.y,
121
- z: this.origin.z + this.size.z,
153
+ x: this.origin.x + sizeX,
154
+ y: this.origin.y + sizeY,
155
+ z: this.origin.z + sizeZ,
122
156
  });
157
+ return true;
123
158
  }
124
159
  clone() {
125
160
  const newSelection = new VoxelSurfaceSelection();
126
161
  Vector3Like.Copy(newSelection.origin, this.origin);
127
- Vector3Like.Copy(newSelection.size, this.size);
128
162
  newSelection.bounds.setMinMax(this.bounds.min, this.bounds.max);
129
- newSelection.extrusion = this.extrusion;
130
- newSelection.bitIndex = structuredClone(this.bitIndex);
163
+ newSelection.bitIndex = this.bitIndex.slice();
131
164
  newSelection.index.setBounds(...this.index.getBounds());
132
165
  newSelection.bounds.setMinMax(this.bounds.min, this.bounds.max);
133
166
  return newSelection;
134
167
  }
135
- toTemplate(cursor, voxelOrExtrude) {
136
- let extrude = false;
137
- let voxel = null;
138
- if (typeof voxelOrExtrude == "boolean") {
139
- extrude = true;
140
- }
141
- else {
142
- voxel = voxelOrExtrude;
143
- }
144
- const template = new FullVoxelTemplate(FullVoxelTemplate.CreateNew([this.size.x, this.size.y, this.size.z]));
145
- if (!extrude && voxel) {
146
- const raw = PaintVoxelData.ToRaw(voxel);
147
- for (let x = this.origin.x; x < this.origin.x + this.size.x; x++) {
148
- for (let y = this.origin.y; y < this.origin.y + this.size.y; y++) {
149
- for (let z = this.origin.z; z < this.origin.z + this.size.z; z++) {
150
- if (this.isSelected(x, y, z)) {
151
- const index = template.getIndex(x - this.origin.x, y - this.origin.y, z - this.origin.z);
152
- template.ids[index] = raw[0];
153
- template.level[index] = raw[2];
154
- template.secondary[index] = raw[3];
155
- }
156
- }
157
- }
158
- }
159
- return template;
160
- }
161
- for (let x = this.origin.x; x < this.origin.x + this.size.x; x++) {
162
- for (let y = this.origin.y; y < this.origin.y + this.size.y; y++) {
163
- for (let z = this.origin.z; z < this.origin.z + this.size.z; z++) {
168
+ toTemplate(voxel) {
169
+ const size = this.bounds.size;
170
+ const template = new FullVoxelTemplate(FullVoxelTemplate.CreateNew([size.x, size.y, size.z]));
171
+ const raw = PaintVoxelData.ToRaw(voxel);
172
+ for (let x = this.origin.x; x < this.origin.x + size.x; x++) {
173
+ for (let y = this.origin.y; y < this.origin.y + size.y; y++) {
174
+ for (let z = this.origin.z; z < this.origin.z + size.z; z++) {
164
175
  if (this.isSelected(x, y, z)) {
165
- let nx = x;
166
- let ny = y;
167
- let nz = z;
168
176
  const index = template.getIndex(x - this.origin.x, y - this.origin.y, z - this.origin.z);
169
- while (true) {
170
- nx -= this.normal.x;
171
- ny -= this.normal.y;
172
- nz -= this.normal.z;
173
- if (!this.isSelected(nx, ny, nz)) {
174
- const voxel = cursor.getVoxel(nx, ny, nz);
175
- if (!voxel || voxel.isAir())
176
- break;
177
- template.ids[index] = voxel.ids[voxel._index];
178
- template.level[index] = voxel.level[voxel._index];
179
- template.secondary[index] = voxel.secondary[voxel._index];
180
- break;
181
- }
182
- if (x < this.origin.x || x >= this.origin.x + this.size.x)
183
- continue;
184
- if (y < this.origin.y || y >= this.origin.y + this.size.y)
185
- continue;
186
- if (z < this.origin.z || z >= this.origin.z + this.size.z)
187
- continue;
188
- const nIndex = template.getIndex(nx - this.origin.x, ny - this.origin.y, nz - this.origin.z);
189
- if (!template.isAir(nIndex)) {
190
- template.ids[index] = template.ids[nIndex];
191
- template.level[index] = template.level[nIndex];
192
- template.secondary[index] = template.secondary[nIndex];
193
- }
194
- }
177
+ template.ids[index] = raw[0];
178
+ template.level[index] = raw[2];
179
+ template.secondary[index] = raw[3];
195
180
  }
196
181
  }
197
182
  }
@@ -200,11 +185,11 @@ export class VoxelSurfaceSelection {
200
185
  }
201
186
  toJSON() {
202
187
  return {
188
+ type: "surface",
203
189
  origin: { ...this.origin },
204
190
  normal: { ...this.normal },
205
- extrusion: this.extrusion,
206
191
  bitIndex: this.bitIndex.slice(),
207
- size: this.size,
192
+ bounds: { ...this.bounds.size },
208
193
  };
209
194
  }
210
195
  fromJSON(data) {
@@ -214,11 +199,12 @@ export class VoxelSurfaceSelection {
214
199
  this.normal.x = data.normal.x;
215
200
  this.normal.y = data.normal.y;
216
201
  this.normal.z = data.normal.z;
217
- this.extrusion = data.extrusion;
218
202
  this.bitIndex = data.bitIndex;
219
- this.size.x = data.size.x;
220
- this.size.y = data.size.y;
221
- this.size.z = data.size.z;
222
- this.index.setBounds(this.size.x, this.size.y, this.size.z);
203
+ this.bounds.setMinMax(this.origin, {
204
+ x: this.origin.x + data.bounds.x,
205
+ y: this.origin.y + data.bounds.y,
206
+ z: this.origin.z + data.bounds.z,
207
+ });
208
+ this.index.setBounds(data.bounds.x, data.bounds.y, data.bounds.z);
223
209
  }
224
210
  }
@@ -1,13 +1,19 @@
1
1
  import { Vector3Like } from "@amodx/math";
2
- import { IVoxelSelection } from "./VoxelSelecton";
3
- import { IVoxelTemplate } from "../VoxelTemplates.types";
2
+ import { IVoxelSelection, IVoxelSelectionData } from "./VoxelSelection";
3
+ import { IVoxelTemplate, IVoxelTemplateData } from "../VoxelTemplates.types";
4
4
  import { BoundingBox } from "@amodx/math/Geomtry/Bounds/BoundingBox";
5
- export declare class VoxelTemplateSelection implements IVoxelSelection {
5
+ import type { VoxelTemplateRegister } from "../VoxelTemplateRegister";
6
+ export interface VoxelTemplateSelectionData extends IVoxelSelectionData<"template"> {
7
+ template: IVoxelTemplateData<any>;
8
+ }
9
+ export declare class VoxelTemplateSelection implements IVoxelSelection<"template"> {
10
+ static Register: typeof VoxelTemplateRegister;
6
11
  origin: Vector3Like;
7
- size: Vector3Like;
8
12
  bounds: BoundingBox;
9
13
  template: IVoxelTemplate;
10
14
  isSelected(x: number, y: number, z: number): boolean;
11
15
  clone(): VoxelTemplateSelection;
12
16
  setTemplate(template: IVoxelTemplate): void;
17
+ toJSON(): VoxelTemplateSelectionData;
18
+ fromJSON(data: VoxelTemplateSelectionData): void;
13
19
  }
@@ -1,16 +1,12 @@
1
1
  import { Vector3Like } from "@amodx/math";
2
2
  import { BoundingBox } from "@amodx/math/Geomtry/Bounds/BoundingBox";
3
3
  export class VoxelTemplateSelection {
4
+ static Register;
4
5
  origin = Vector3Like.Create();
5
- size = Vector3Like.Create();
6
6
  bounds = new BoundingBox();
7
7
  template;
8
8
  isSelected(x, y, z) {
9
- if (x < this.origin.x || x >= this.origin.x + this.size.x)
10
- return false;
11
- if (y < this.origin.y || y >= this.origin.y + this.size.y)
12
- return false;
13
- if (z < this.origin.z || z >= this.origin.z + this.size.z)
9
+ if (!this.bounds.intersectsXYZ(x + 0.5, y + 0.5, z + 0.5))
14
10
  return false;
15
11
  const rx = x - this.origin.x;
16
12
  const ry = y - this.origin.y;
@@ -22,15 +18,27 @@ export class VoxelTemplateSelection {
22
18
  clone() {
23
19
  const newSelection = new VoxelTemplateSelection();
24
20
  Vector3Like.Copy(newSelection.origin, this.origin);
25
- Vector3Like.Copy(newSelection.size, this.size);
26
21
  newSelection.bounds.setMinMax(this.bounds.min, this.bounds.max);
27
22
  newSelection.template = this.template.clone();
28
23
  return newSelection;
29
24
  }
30
25
  setTemplate(template) {
31
26
  this.template = template;
32
- this.size.x = template.bounds.size.x;
33
- this.size.y = template.bounds.size.y;
34
- this.size.z = template.bounds.size.z;
27
+ this.bounds.setMinMax(this.origin, Vector3Like.Add(this.origin, template.bounds.size));
28
+ }
29
+ toJSON() {
30
+ return {
31
+ type: "template",
32
+ origin: { ...this.origin },
33
+ bounds: { ...this.bounds.size },
34
+ template: this.template.toJSON(),
35
+ };
36
+ }
37
+ fromJSON(data) {
38
+ this.origin.x = data.origin.x;
39
+ this.origin.y = data.origin.y;
40
+ this.origin.z = data.origin.z;
41
+ const template = VoxelTemplateSelection.Register.create(data.template);
42
+ this.setTemplate(template);
35
43
  }
36
44
  }
@@ -0,0 +1,28 @@
1
+ import { Vector3Like } from "@amodx/math";
2
+ import { BoundingBox } from "@amodx/math/Geomtry/Bounds/BoundingBox";
3
+ import { IVoxelShapeSelection, IVoxelShapeSelectionData } from "./VoxelShapeSelection";
4
+ export interface BoxVoxelShapeSelectionData extends IVoxelShapeSelectionData<"box-shape"> {
5
+ width: number;
6
+ height: number;
7
+ depth: number;
8
+ }
9
+ export declare class BoxVoxelShapeSelection implements IVoxelShapeSelection<"box-shape", BoxVoxelShapeSelectionData> {
10
+ static readonly Type = "box-shape";
11
+ static CreateNew(data: Partial<BoxVoxelShapeSelectionData>): BoxVoxelShapeSelectionData;
12
+ origin: Vector3Like;
13
+ bounds: BoundingBox;
14
+ _width: number;
15
+ get width(): number;
16
+ set width(width: number);
17
+ _height: number;
18
+ get height(): number;
19
+ set height(height: number);
20
+ _depth: number;
21
+ get depth(): number;
22
+ set depth(depth: number);
23
+ private _updateBounds;
24
+ isSelected(x: number, y: number, z: number): boolean;
25
+ clone(): BoxVoxelShapeSelection;
26
+ toJSON(): BoxVoxelShapeSelectionData;
27
+ fromJSON(data: BoxVoxelShapeSelectionData): void;
28
+ }
@@ -0,0 +1,77 @@
1
+ import { Vector3Like } from "@amodx/math";
2
+ import { BoundingBox } from "@amodx/math/Geomtry/Bounds/BoundingBox";
3
+ export class BoxVoxelShapeSelection {
4
+ static Type = "box-shape";
5
+ static CreateNew(data) {
6
+ return {
7
+ type: BoxVoxelShapeSelection.Type,
8
+ origin: data.origin || Vector3Like.Create(),
9
+ bounds: data.bounds ||
10
+ Vector3Like.Create(data.width || 5, data.height || 5, data.depth || 5),
11
+ width: data.width || 5,
12
+ height: data.height || 5,
13
+ depth: data.depth || 5,
14
+ };
15
+ }
16
+ origin = Vector3Like.Create();
17
+ bounds = new BoundingBox();
18
+ _width = 1;
19
+ get width() {
20
+ return this._width;
21
+ }
22
+ set width(width) {
23
+ this._width = width;
24
+ this._updateBounds();
25
+ }
26
+ _height = 1;
27
+ get height() {
28
+ return this._height;
29
+ }
30
+ set height(height) {
31
+ this._height = height;
32
+ this._updateBounds();
33
+ }
34
+ _depth = 1;
35
+ get depth() {
36
+ return this._depth;
37
+ }
38
+ set depth(depth) {
39
+ this._depth = depth;
40
+ this._updateBounds();
41
+ }
42
+ _updateBounds() {
43
+ this.bounds.setSize(Vector3Like.Create(this._width, this._height, this._depth));
44
+ }
45
+ isSelected(x, y, z) {
46
+ let rx = x - this.origin.x;
47
+ let ry = y - this.origin.y;
48
+ let rz = z - this.origin.z;
49
+ if (!this.bounds.intersectsXYZ(rx + 0.5, ry + 0.5, rz + 0.5))
50
+ return false;
51
+ return true;
52
+ }
53
+ clone() {
54
+ const newTemplate = new BoxVoxelShapeSelection();
55
+ newTemplate.fromJSON(this.toJSON());
56
+ return newTemplate;
57
+ }
58
+ toJSON() {
59
+ return {
60
+ type: BoxVoxelShapeSelection.Type,
61
+ origin: { ...this.origin },
62
+ bounds: { ...this.bounds.size },
63
+ width: this._width,
64
+ height: this._height,
65
+ depth: this._depth,
66
+ };
67
+ }
68
+ fromJSON(data) {
69
+ this.origin.x = data.origin.x;
70
+ this.origin.y = data.origin.y;
71
+ this.origin.z = data.origin.z;
72
+ this._width = data.width;
73
+ this._height = data.height;
74
+ this._depth = data.depth;
75
+ this._updateBounds();
76
+ }
77
+ }
@@ -0,0 +1,28 @@
1
+ import { Vector3Like } from "@amodx/math";
2
+ import { BoundingBox } from "@amodx/math/Geomtry/Bounds/BoundingBox";
3
+ import { IVoxelShapeSelection, IVoxelShapeSelectionData } from "./VoxelShapeSelection";
4
+ export interface ConeVoxelShapeSelectionData extends IVoxelShapeSelectionData<"cone-shape"> {
5
+ width: number;
6
+ height: number;
7
+ depth: number;
8
+ }
9
+ export declare class ConeVoxelShapeSelection implements IVoxelShapeSelection<"cone-shape", ConeVoxelShapeSelectionData> {
10
+ static readonly Type = "cone-shape";
11
+ static CreateNew(data: Partial<ConeVoxelShapeSelectionData>): ConeVoxelShapeSelectionData;
12
+ origin: Vector3Like;
13
+ bounds: BoundingBox;
14
+ _width: number;
15
+ get width(): number;
16
+ set width(width: number);
17
+ _height: number;
18
+ get height(): number;
19
+ set height(height: number);
20
+ _depth: number;
21
+ get depth(): number;
22
+ set depth(depth: number);
23
+ private _updateBounds;
24
+ isSelected(x: number, y: number, z: number): boolean;
25
+ clone(): ConeVoxelShapeSelection;
26
+ toJSON(): ConeVoxelShapeSelectionData;
27
+ fromJSON(data: ConeVoxelShapeSelectionData): void;
28
+ }
@@ -0,0 +1,77 @@
1
+ import { Vector3Like } from "@amodx/math";
2
+ import { BoundingBox } from "@amodx/math/Geomtry/Bounds/BoundingBox";
3
+ export class ConeVoxelShapeSelection {
4
+ static Type = "cone-shape";
5
+ static CreateNew(data) {
6
+ return {
7
+ type: ConeVoxelShapeSelection.Type,
8
+ origin: data.origin || Vector3Like.Create(),
9
+ bounds: data.bounds ||
10
+ Vector3Like.Create(data.width || 1, data.height || 1, data.depth || 1),
11
+ width: data.width || 1,
12
+ height: data.height || 1,
13
+ depth: data.depth || 1,
14
+ };
15
+ }
16
+ origin = Vector3Like.Create();
17
+ bounds = new BoundingBox();
18
+ _width = 1;
19
+ get width() {
20
+ return this._width;
21
+ }
22
+ set width(width) {
23
+ this._width = width;
24
+ this._updateBounds();
25
+ }
26
+ _height = 1;
27
+ get height() {
28
+ return this._height;
29
+ }
30
+ set height(height) {
31
+ this._height = height;
32
+ this._updateBounds();
33
+ }
34
+ _depth = 1;
35
+ get depth() {
36
+ return this._depth;
37
+ }
38
+ set depth(depth) {
39
+ this._depth = depth;
40
+ this._updateBounds();
41
+ }
42
+ _updateBounds() {
43
+ this.bounds.setSize(Vector3Like.Create(this._width, this._height, this._depth));
44
+ }
45
+ isSelected(x, y, z) {
46
+ let rx = x - this.origin.x;
47
+ let ry = y - this.origin.y;
48
+ let rz = z - this.origin.z;
49
+ if (!this.bounds.intersectsXYZ(rx + 0.5, ry + 0.5, rz + 0.5))
50
+ return false;
51
+ return true;
52
+ }
53
+ clone() {
54
+ const newTemplate = new ConeVoxelShapeSelection();
55
+ newTemplate.fromJSON(this.toJSON());
56
+ return newTemplate;
57
+ }
58
+ toJSON() {
59
+ return {
60
+ type: ConeVoxelShapeSelection.Type,
61
+ origin: { ...this.origin },
62
+ bounds: { ...this.bounds.size },
63
+ width: this._width,
64
+ height: this._height,
65
+ depth: this._depth,
66
+ };
67
+ }
68
+ fromJSON(data) {
69
+ this.origin.x = data.origin.x;
70
+ this.origin.y = data.origin.y;
71
+ this.origin.z = data.origin.z;
72
+ this._width = data.width;
73
+ this._height = data.height;
74
+ this._depth = data.depth;
75
+ this._updateBounds();
76
+ }
77
+ }
@@ -0,0 +1,28 @@
1
+ import { Vector3Like } from "@amodx/math";
2
+ import { BoundingBox } from "@amodx/math/Geomtry/Bounds/BoundingBox";
3
+ import { IVoxelShapeSelection, IVoxelShapeSelectionData } from "./VoxelShapeSelection";
4
+ export interface CylinderVoxelShapeSelectionData extends IVoxelShapeSelectionData<"cylinder-shape"> {
5
+ width: number;
6
+ height: number;
7
+ depth: number;
8
+ }
9
+ export declare class CylinderVoxelShapeSelection implements IVoxelShapeSelection<"cylinder-shape", CylinderVoxelShapeSelectionData> {
10
+ static readonly Type = "cylinder-shape";
11
+ static CreateNew(data: Partial<CylinderVoxelShapeSelectionData>): CylinderVoxelShapeSelectionData;
12
+ origin: Vector3Like;
13
+ bounds: BoundingBox;
14
+ _width: number;
15
+ get width(): number;
16
+ set width(width: number);
17
+ _height: number;
18
+ get height(): number;
19
+ set height(height: number);
20
+ _depth: number;
21
+ get depth(): number;
22
+ set depth(depth: number);
23
+ private _updateBounds;
24
+ isSelected(x: number, y: number, z: number): boolean;
25
+ clone(): CylinderVoxelShapeSelection;
26
+ toJSON(): CylinderVoxelShapeSelectionData;
27
+ fromJSON(data: CylinderVoxelShapeSelectionData): void;
28
+ }
@@ -0,0 +1,77 @@
1
+ import { Vector3Like } from "@amodx/math";
2
+ import { BoundingBox } from "@amodx/math/Geomtry/Bounds/BoundingBox";
3
+ export class CylinderVoxelShapeSelection {
4
+ static Type = "cylinder-shape";
5
+ static CreateNew(data) {
6
+ return {
7
+ type: CylinderVoxelShapeSelection.Type,
8
+ origin: data.origin || Vector3Like.Create(),
9
+ bounds: data.bounds ||
10
+ Vector3Like.Create(data.width || 1, data.height || 1, data.depth || 1),
11
+ width: data.width || 1,
12
+ height: data.height || 1,
13
+ depth: data.depth || 1,
14
+ };
15
+ }
16
+ origin = Vector3Like.Create();
17
+ bounds = new BoundingBox();
18
+ _width = 1;
19
+ get width() {
20
+ return this._width;
21
+ }
22
+ set width(width) {
23
+ this._width = width;
24
+ this._updateBounds();
25
+ }
26
+ _height = 1;
27
+ get height() {
28
+ return this._height;
29
+ }
30
+ set height(height) {
31
+ this._height = height;
32
+ this._updateBounds();
33
+ }
34
+ _depth = 1;
35
+ get depth() {
36
+ return this._depth;
37
+ }
38
+ set depth(depth) {
39
+ this._depth = depth;
40
+ this._updateBounds();
41
+ }
42
+ _updateBounds() {
43
+ this.bounds.setSize(Vector3Like.Create(this._width, this._height, this._depth));
44
+ }
45
+ isSelected(x, y, z) {
46
+ let rx = x - this.origin.x;
47
+ let ry = y - this.origin.y;
48
+ let rz = z - this.origin.z;
49
+ if (!this.bounds.intersectsXYZ(rx + 0.5, ry + 0.5, rz + 0.5))
50
+ return false;
51
+ return true;
52
+ }
53
+ clone() {
54
+ const newTemplate = new CylinderVoxelShapeSelection();
55
+ newTemplate.fromJSON(this.toJSON());
56
+ return newTemplate;
57
+ }
58
+ toJSON() {
59
+ return {
60
+ type: CylinderVoxelShapeSelection.Type,
61
+ origin: { ...this.origin },
62
+ bounds: { ...this.bounds.size },
63
+ width: this._width,
64
+ height: this._height,
65
+ depth: this._depth,
66
+ };
67
+ }
68
+ fromJSON(data) {
69
+ this.origin.x = data.origin.x;
70
+ this.origin.y = data.origin.y;
71
+ this.origin.z = data.origin.z;
72
+ this._width = data.width;
73
+ this._height = data.height;
74
+ this._depth = data.depth;
75
+ this._updateBounds();
76
+ }
77
+ }