@divinevoxel/vlox 0.0.76 → 0.0.78

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
@@ -0,0 +1,214 @@
1
+ import { QuadVerticies } from "../Geomtry/Geometry.types";
2
+ import { Quad } from "../Geomtry/Primitives/Quad";
3
+ import { ItemModelBuilder } from "./Models/ItemModelBuilder";
4
+ import { addItemQuad } from "./Geomtry/ItemGeometryBuilder";
5
+ import { Flat2DIndex } from "@amodx/math";
6
+ import { Box } from "../Geomtry/Shapes/Box";
7
+ import { VoxelFaces } from "../../Math";
8
+ import { CompactItemMesh } from "./Base/CompactItemMesh";
9
+ const { quads: Quads } = Box.Create([
10
+ [0, 0, 0],
11
+ [1, 1, 1],
12
+ ]);
13
+ const addUvs = (quad, factor, sx, sy, ex, ey) => {
14
+ const uR = ex * factor;
15
+ const uL = sx * factor;
16
+ const vT = ey * factor;
17
+ const vB = sy * factor;
18
+ quad.uvs.vertices[QuadVerticies.TopRight].x = uR;
19
+ quad.uvs.vertices[QuadVerticies.TopRight].y = vT;
20
+ quad.uvs.vertices[QuadVerticies.TopLeft].x = uL;
21
+ quad.uvs.vertices[QuadVerticies.TopLeft].y = vT;
22
+ quad.uvs.vertices[QuadVerticies.BottomLeft].x = uL;
23
+ quad.uvs.vertices[QuadVerticies.BottomLeft].y = vB;
24
+ quad.uvs.vertices[QuadVerticies.BottomRight].x = uR;
25
+ quad.uvs.vertices[QuadVerticies.BottomRight].y = vB;
26
+ };
27
+ class TextureVoxelData {
28
+ width;
29
+ height;
30
+ textureData;
31
+ index = Flat2DIndex.GetXYOrder();
32
+ constructor(width, height, textureData) {
33
+ this.width = width;
34
+ this.height = height;
35
+ this.textureData = textureData;
36
+ this.index.setBounds(width, height);
37
+ }
38
+ inBounds(x, y) {
39
+ return x >= 0 && x < this.width && y >= 0 && y < this.height;
40
+ }
41
+ isSolid(x, y) {
42
+ if (!this.inBounds(x, y))
43
+ return false;
44
+ const a = this.textureData[this.index.getIndexXY(x, this.height - 1 - y) * 4 + 3];
45
+ return a > 0.01;
46
+ }
47
+ }
48
+ Quads[VoxelFaces.North].setUVs(Quad.FullUVs);
49
+ Quads[VoxelFaces.South].setUVs(Quad.FullUVs);
50
+ const tool = new ItemModelBuilder("dve_item");
51
+ export function MeshTexture(textureId, textureData) {
52
+ const width = Math.sqrt(textureData.length / 4);
53
+ const height = Math.sqrt(textureData.length / 4);
54
+ const factor = 1 / width;
55
+ const data = new TextureVoxelData(width, height, textureData);
56
+ {
57
+ //south face
58
+ tool.vars.textureIndex = textureId;
59
+ addItemQuad(tool, Quads[VoxelFaces.South]);
60
+ }
61
+ {
62
+ //north face
63
+ const backPositionZ = factor;
64
+ Quads[VoxelFaces.North].positions.vertices[QuadVerticies.TopRight].z =
65
+ backPositionZ;
66
+ Quads[VoxelFaces.North].positions.vertices[QuadVerticies.TopLeft].z =
67
+ backPositionZ;
68
+ Quads[VoxelFaces.North].positions.vertices[QuadVerticies.BottomLeft].z =
69
+ backPositionZ;
70
+ Quads[VoxelFaces.North].positions.vertices[QuadVerticies.BottomRight].z =
71
+ backPositionZ;
72
+ tool.vars.textureIndex = textureId;
73
+ addItemQuad(tool, Quads[VoxelFaces.North]);
74
+ }
75
+ for (let x = 0; x < width; x++) {
76
+ let eastFace = null;
77
+ let westFace = null;
78
+ for (let y = 0; y < height; y++) {
79
+ let eastFaceExposed = true;
80
+ let westFaceExposed = true;
81
+ if (!data.isSolid(x, y)) {
82
+ eastFaceExposed = false;
83
+ westFaceExposed = false;
84
+ }
85
+ if (data.isSolid(x + 1, y)) {
86
+ eastFaceExposed = false;
87
+ }
88
+ if (data.isSolid(x - 1, y)) {
89
+ westFaceExposed = false;
90
+ }
91
+ if (eastFace && !eastFaceExposed) {
92
+ const x1 = x * factor + factor;
93
+ const y0 = eastFace[1] * factor;
94
+ const y1 = y * factor;
95
+ const z0 = 0;
96
+ const z1 = factor;
97
+ // Flip winding vs previous: (p1 <-> p3)
98
+ const newQuad = Quad.Create([
99
+ [x1, y0, z0], // p0
100
+ [x1, y0, z1], // p1 (was p3)
101
+ [x1, y1, z1], // p2
102
+ [x1, y1, z0], // p3 (was p1)
103
+ ], Quad.FullUVs, false);
104
+ let [sx, sy] = eastFace;
105
+ let ex = x + 1;
106
+ let ey = y;
107
+ addUvs(newQuad, factor, sx, sy, ex, ey);
108
+ eastFace = null;
109
+ tool.vars.textureIndex = textureId;
110
+ addItemQuad(tool, newQuad);
111
+ }
112
+ if (westFace && !westFaceExposed) {
113
+ const x0 = x * factor;
114
+ const y0 = westFace[1] * factor;
115
+ const y1 = y * factor;
116
+ const z0 = 0;
117
+ const z1 = factor;
118
+ // Flip winding vs previous: (p1 <-> p3)
119
+ const newQuad = Quad.Create([
120
+ [x0, y0, z0], // p0
121
+ [x0, y1, z0], // p1 (was p3)
122
+ [x0, y1, z1], // p2
123
+ [x0, y0, z1], // p3 (was p1)
124
+ ], Quad.FullUVs, false);
125
+ let [sx, sy] = westFace;
126
+ let ex = x + 1;
127
+ let ey = y;
128
+ addUvs(newQuad, factor, sx, sy, ex, ey);
129
+ westFace = null;
130
+ tool.vars.textureIndex = textureId;
131
+ addItemQuad(tool, newQuad);
132
+ }
133
+ const isPixel = data.isSolid(x, y);
134
+ if (!data.isSolid(x + 1, y) && !eastFace && isPixel) {
135
+ eastFace = [x, y];
136
+ }
137
+ if (!data.isSolid(x - 1, y) && !westFace && isPixel) {
138
+ westFace = [x, y];
139
+ }
140
+ }
141
+ }
142
+ for (let y = 0; y < height; y++) {
143
+ let upFace = null;
144
+ let downFace = null;
145
+ for (let x = 0; x < width; x++) {
146
+ let upFaceExposed = true;
147
+ let downFaceExposed = true;
148
+ if (!data.isSolid(x, y)) {
149
+ upFaceExposed = false;
150
+ downFaceExposed = false;
151
+ }
152
+ if (data.isSolid(x, y + 1)) {
153
+ upFaceExposed = false;
154
+ }
155
+ if (data.isSolid(x, y - 1)) {
156
+ downFaceExposed = false;
157
+ }
158
+ if (upFace && !upFaceExposed) {
159
+ const x0 = upFace[0] * factor;
160
+ const x1 = x * factor;
161
+ const y1 = y * factor + factor;
162
+ const z0 = 0;
163
+ const z1 = factor;
164
+ // +Y normal — CCW when viewed from +Y
165
+ const newQuad = Quad.Create([
166
+ [x0, y1, z0], // p0
167
+ [x1, y1, z0], // p1
168
+ [x1, y1, z1], // p2
169
+ [x0, y1, z1], // p3
170
+ ], Quad.FullUVs, false
171
+ // 0
172
+ );
173
+ let [sx, sy] = upFace;
174
+ let [ex, ey] = [x, y];
175
+ ey += 1;
176
+ addUvs(newQuad, factor, sx, sy, ex, ey);
177
+ upFace = null;
178
+ tool.vars.textureIndex = textureId;
179
+ addItemQuad(tool, newQuad);
180
+ }
181
+ if (downFace && !downFaceExposed) {
182
+ const x0 = downFace[0] * factor;
183
+ const x1 = x * factor;
184
+ const y0 = y * factor;
185
+ const z0 = 0;
186
+ const z1 = factor;
187
+ // -Y normal — flip winding relative to +Y
188
+ const newQuad = Quad.Create([
189
+ [x0, y0, z0], // p0
190
+ [x0, y0, z1], // p1
191
+ [x1, y0, z1], // p2
192
+ [x1, y0, z0], // p3
193
+ ], Quad.FullUVs, false
194
+ // 1
195
+ );
196
+ let [sx, sy] = downFace;
197
+ let [ex, ey] = [x, y];
198
+ ey += 1;
199
+ addUvs(newQuad, factor, sx, sy, ex, ey);
200
+ downFace = null;
201
+ tool.vars.textureIndex = textureId;
202
+ addItemQuad(tool, newQuad);
203
+ }
204
+ const isPixel = data.isSolid(x, y);
205
+ if (!data.isSolid(x, y + 1) && !upFace && isPixel) {
206
+ upFace = [x, y];
207
+ }
208
+ if (!data.isSolid(x, y - 1) && !downFace && isPixel) {
209
+ downFace = [x, y];
210
+ }
211
+ }
212
+ }
213
+ return CompactItemMesh([tool]);
214
+ }
@@ -0,0 +1,277 @@
1
+ import { Quad } from "../Geomtry/Primitives/Quad";
2
+ const Quads = {
3
+ north: Quad.Create([
4
+ [1, 1, 0],
5
+ [0, 1, 0],
6
+ [0, 0, 0],
7
+ [1, 0, 0],
8
+ ], Quad.FullUVs),
9
+ south: Quad.Create([
10
+ [1, 1, 0],
11
+ [0, 1, 0],
12
+ [0, 0, 0],
13
+ [1, 0, 0],
14
+ ], Quad.FullUVs),
15
+ };
16
+ //const tool = new MesherDataTool();
17
+ //tool.startNewMesh();
18
+ //tool.mesh!.attributes.set("uv", [[], 2, BinaryNumberTypes.Float32]);
19
+ //tool.mesh!.attributes.set("textureIndex", [[], 3, BinaryNumberTypes.Float32]);
20
+ export function MeshTexture(textureId, textureData) {
21
+ /* const width = Math.sqrt(textureData.length / 4);
22
+ const height = Math.sqrt(textureData.length / 4);
23
+ const factor = 1 / width;
24
+
25
+ const textureDataIndex = Flat2DIndex.GetXYOrder();
26
+ textureDataIndex.setBounds(width, height);
27
+
28
+ const origin = Vector3Like.Create(-0.5, -0.5, -0.5);
29
+
30
+ const isSolid = (x: number, y: number) =>
31
+ x >= 0 &&
32
+ x < width &&
33
+ y >= 0 &&
34
+ y < height &&
35
+ textureData[textureDataIndex.getIndexXY(x, y) * 4 + 3] > 0.01
36
+ ? true
37
+ : false;
38
+
39
+ const uvs = tool.mesh!.getAttribute("uv");
40
+ const textureIndex = tool.mesh!.getAttribute("textureIndex");
41
+ const uvOffset = width > 16 ? -(2 / Math.max(width, height)) : 0;
42
+
43
+ const addUvs = (sx: number, sy: number, ex: number, ey: number) => {
44
+ uvs.push(
45
+ (ex + uvOffset) * factor,
46
+ (ey + uvOffset) * factor,
47
+ (sx - uvOffset) * factor,
48
+ (ey + uvOffset) * factor,
49
+ (sx - uvOffset) * factor,
50
+ (sy - uvOffset) * factor,
51
+ (ex + uvOffset) * factor,
52
+ (sy - uvOffset) * factor
53
+ );
54
+ textureIndex.push(
55
+ textureId,
56
+ 0,
57
+ 0,
58
+ textureId,
59
+ 0,
60
+ 0,
61
+ textureId,
62
+ 0,
63
+ 0,
64
+ textureId,
65
+ 0,
66
+ 0
67
+ );
68
+ };
69
+
70
+ {
71
+ GeometryBuilder.addQuad(tool, origin, Quads.south);
72
+ uvs.push(
73
+ Quads.south.uvs.vertices[QuadVerticies.TopRight].x,
74
+ Quads.south.uvs.vertices[QuadVerticies.TopRight].y,
75
+ Quads.south.uvs.vertices[QuadVerticies.TopLeft].x,
76
+ Quads.south.uvs.vertices[QuadVerticies.TopLeft].y,
77
+ Quads.south.uvs.vertices[QuadVerticies.BottomLeft].x,
78
+ Quads.south.uvs.vertices[QuadVerticies.BottomLeft].y,
79
+ Quads.south.uvs.vertices[QuadVerticies.BottomRight].x,
80
+ Quads.south.uvs.vertices[QuadVerticies.BottomRight].y
81
+ );
82
+
83
+ textureIndex.push(
84
+ textureId,
85
+ 0,
86
+ 0,
87
+ textureId,
88
+ 0,
89
+ 0,
90
+ textureId,
91
+ 0,
92
+ 0,
93
+ textureId,
94
+ 0,
95
+ 0
96
+ );
97
+ }
98
+
99
+ {
100
+ const backPositionZ = factor;
101
+ Quads.north.positions.vertices[QuadVerticies.TopRight].z = backPositionZ;
102
+ Quads.north.positions.vertices[QuadVerticies.TopLeft].z = backPositionZ;
103
+ Quads.north.positions.vertices[QuadVerticies.BottomLeft].z = backPositionZ;
104
+ Quads.north.positions.vertices[QuadVerticies.BottomRight].z = backPositionZ;
105
+ Quads.north.flip = true;
106
+ uvs.push(
107
+ Quads.north.uvs.vertices[QuadVerticies.TopLeft].x,
108
+ Quads.north.uvs.vertices[QuadVerticies.TopLeft].y,
109
+ Quads.north.uvs.vertices[QuadVerticies.TopRight].x,
110
+ Quads.north.uvs.vertices[QuadVerticies.TopRight].y,
111
+ Quads.north.uvs.vertices[QuadVerticies.BottomRight].x,
112
+ Quads.north.uvs.vertices[QuadVerticies.BottomRight].y,
113
+ Quads.north.uvs.vertices[QuadVerticies.BottomLeft].x,
114
+ Quads.north.uvs.vertices[QuadVerticies.BottomLeft].y
115
+ );
116
+ GeometryBuilder.addQuad(tool, origin, Quads.north);
117
+ textureIndex.push(
118
+ textureId,
119
+ 0,
120
+ 0,
121
+ textureId,
122
+ 0,
123
+ 0,
124
+ textureId,
125
+ 0,
126
+ 0,
127
+ textureId,
128
+ 0,
129
+ 0
130
+ );
131
+ }
132
+
133
+ for (let x = 0; x < width; x++) {
134
+ let eastFace: Vec2Array | null = null;
135
+ let westFace: Vec2Array | null = null;
136
+ for (let y = 0; y < height; y++) {
137
+ let eastFaceExposed = true;
138
+ let westFaceExposed = true;
139
+
140
+ if (!isSolid(x, y)) {
141
+ eastFaceExposed = false;
142
+ westFaceExposed = false;
143
+ }
144
+ if (isSolid(x + 1, y)) {
145
+ eastFaceExposed = false;
146
+ }
147
+ if (isSolid(x - 1, y)) {
148
+ westFaceExposed = false;
149
+ }
150
+
151
+ if (eastFace && !eastFaceExposed) {
152
+ const newQuad = Quad.Create(
153
+ [
154
+ [x * factor + factor, eastFace[1] * factor, 0],
155
+ [x * factor + factor, y * factor, factor],
156
+ ],
157
+ Quad.FullUVs as any,
158
+ false,
159
+ 0
160
+ );
161
+ GeometryBuilder.addQuad(tool, origin, newQuad);
162
+
163
+ let [sx, sy] = eastFace;
164
+ let ex = x;
165
+ let ey = y;
166
+ ex += 1;
167
+ addUvs(sx, sy, ex, ey);
168
+ eastFace = null;
169
+ }
170
+
171
+ if (westFace && !westFaceExposed) {
172
+ const newQuad = Quad.Create(
173
+ [
174
+ [x * factor, westFace[1] * factor, 0],
175
+ [x * factor, y * factor, factor],
176
+ ],
177
+ Quad.FullUVs as any,
178
+ false,
179
+ 1
180
+ );
181
+ GeometryBuilder.addQuad(tool, origin, newQuad);
182
+ let [sx, sy] = westFace;
183
+ let ex = x;
184
+ let ey = y;
185
+ ex += 1;
186
+ addUvs(sx, sy, ex, ey);
187
+ westFace = null;
188
+ }
189
+ const isPixel = isSolid(x, y);
190
+ if (!isSolid(x + 1, y) && !eastFace && isPixel) {
191
+ eastFace = [x, y];
192
+ }
193
+ if (!isSolid(x - 1, y) && !westFace && isPixel) {
194
+ westFace = [x, y];
195
+ }
196
+ }
197
+ }
198
+ for (let y = 0; y < height; y++) {
199
+ let upFace: Vec2Array | null = null;
200
+ let downFace: Vec2Array | null = null;
201
+
202
+ for (let x = 0; x < width; x++) {
203
+ let upFaceExposed = true;
204
+ let downFaceExposed = true;
205
+
206
+ if (!isSolid(x, y)) {
207
+ upFaceExposed = false;
208
+ downFaceExposed = false;
209
+ }
210
+ if (isSolid(x, y + 1)) {
211
+ upFaceExposed = false;
212
+ }
213
+ if (isSolid(x, y - 1)) {
214
+ downFaceExposed = false;
215
+ }
216
+
217
+ if (upFace && !upFaceExposed) {
218
+ const newQuad = Quad.Create(
219
+ [
220
+ [upFace[0] * factor, y * factor + factor, 0],
221
+ [x * factor, y * factor + factor, factor],
222
+ ],
223
+ Quad.FullUVs as any,
224
+ false,
225
+ 0
226
+ );
227
+ GeometryBuilder.addQuad(tool, origin, newQuad);
228
+ let [sx, sy] = upFace;
229
+ let [ex, ey] = [x, y];
230
+
231
+ ey += 1;
232
+ addUvs(sx, sy, ex, ey);
233
+ upFace = null;
234
+ }
235
+
236
+ if (downFace && !downFaceExposed) {
237
+ const newQuad = Quad.Create(
238
+ [
239
+ [downFace[0] * factor, y * factor, 0],
240
+ [x * factor, y * factor, factor],
241
+ ],
242
+ Quad.FullUVs as any,
243
+ false,
244
+ 1
245
+ );
246
+ GeometryBuilder.addQuad(tool, origin, newQuad);
247
+ let [sx, sy] = downFace;
248
+ let [ex, ey] = [x, y];
249
+ ey += 1;
250
+ addUvs(sx, sy, ex, ey);
251
+ downFace = null;
252
+ }
253
+
254
+ const isPixel = isSolid(x, y);
255
+ if (!isSolid(x, y + 1) && !upFace && isPixel) {
256
+ upFace = [x, y];
257
+ }
258
+ if (!isSolid(x, y - 1) && !downFace && isPixel) {
259
+ downFace = [x, y];
260
+ }
261
+ }
262
+ }
263
+
264
+ for (const [key, [data]] of tool.mesh!.attributes) {
265
+ if (key == "position") {
266
+ for (let i = 0; i < data.length; i += 3) {
267
+ (data as any as number[])[i] -= 0.5;
268
+ (data as any as number[])[i + 1] -= 0.5;
269
+ (data as any as number[])[i + 2];
270
+ }
271
+ }
272
+ }
273
+
274
+ const compacted = CompactMesh("dve_item", tool);
275
+ */
276
+ // return tool.mesh;
277
+ }
@@ -0,0 +1,27 @@
1
+ import { ProtoMesh } from "../../Geomtry/Proto/ProtoMesh";
2
+ import { Vec3Array, Vector3Like } from "@amodx/math";
3
+ declare class ItemVars {
4
+ textureIndex: number;
5
+ reset(): void;
6
+ }
7
+ export declare class ItemModelBuilder {
8
+ id: string;
9
+ /**The current world position */
10
+ position: Vector3Like;
11
+ /**The current local origin */
12
+ origin: Vector3Like;
13
+ mesh: ProtoMesh;
14
+ vars: ItemVars;
15
+ bounds: {
16
+ min: Vec3Array;
17
+ max: Vec3Array;
18
+ };
19
+ _indexStart: number;
20
+ constructor(id: string);
21
+ startConstruction(): void;
22
+ endConstruction(): boolean;
23
+ _boundsUpdate: boolean;
24
+ updateBounds(bounds: [Vec3Array, Vec3Array]): void;
25
+ clear(): this;
26
+ }
27
+ export {};
@@ -0,0 +1,64 @@
1
+ import { ProtoMesh } from "../../Geomtry/Proto/ProtoMesh";
2
+ import { Vector3Like } from "@amodx/math";
3
+ import { ItemMeshVertexStructCursor } from "../Geomtry/ItemMeshVertexStructCursor";
4
+ class ItemVars {
5
+ textureIndex = 0;
6
+ reset() {
7
+ this.textureIndex = 0;
8
+ }
9
+ }
10
+ export class ItemModelBuilder {
11
+ id;
12
+ /**The current world position */
13
+ position = Vector3Like.Create();
14
+ /**The current local origin */
15
+ origin = Vector3Like.Create();
16
+ mesh = new ProtoMesh(ItemMeshVertexStructCursor.VertexFloatSize);
17
+ vars = new ItemVars();
18
+ bounds = {
19
+ min: [0, 0, 0],
20
+ max: [0, 0, 0],
21
+ };
22
+ _indexStart = 0;
23
+ constructor(id) {
24
+ this.id = id;
25
+ }
26
+ startConstruction() {
27
+ this._indexStart = this.mesh.indicieCount;
28
+ this.bounds.min[0] = Infinity;
29
+ this.bounds.min[1] = Infinity;
30
+ this.bounds.min[2] = Infinity;
31
+ this.bounds.max[0] = -Infinity;
32
+ this.bounds.max[1] = -Infinity;
33
+ this.bounds.max[2] = -Infinity;
34
+ this._boundsUpdate = false;
35
+ }
36
+ endConstruction() {
37
+ this.vars.reset();
38
+ return true;
39
+ }
40
+ _boundsUpdate = false;
41
+ updateBounds(bounds) {
42
+ const origin = this.origin;
43
+ //min
44
+ if (origin.x + bounds[0][0] < this.bounds.min[0])
45
+ this.bounds.min[0] = origin.x + bounds[0][0];
46
+ if (origin.y + bounds[0][1] < this.bounds.min[1])
47
+ this.bounds.min[1] = origin.y + bounds[0][1];
48
+ if (origin.z + bounds[0][2] < this.bounds.min[2])
49
+ this.bounds.min[2] = origin.z + bounds[0][2];
50
+ //max
51
+ if (origin.x + bounds[1][0] > this.bounds.max[0])
52
+ this.bounds.max[0] = origin.x + bounds[1][0];
53
+ if (origin.y + bounds[1][1] > this.bounds.max[1])
54
+ this.bounds.max[1] = origin.y + bounds[1][1];
55
+ if (origin.z + bounds[1][2] > this.bounds.max[2])
56
+ this.bounds.max[2] = origin.z + bounds[1][2];
57
+ this._boundsUpdate = true;
58
+ }
59
+ clear() {
60
+ this.vars.reset();
61
+ this.mesh.clear();
62
+ return this;
63
+ }
64
+ }
@@ -0,0 +1,5 @@
1
+ export declare class ItemMeshTypes {
2
+ static vertexStrideBytes: number;
3
+ static vertexStrideFloats: number;
4
+ static VoxelMeshStructWGSL: string;
5
+ }
@@ -0,0 +1,12 @@
1
+ export class ItemMeshTypes {
2
+ static vertexStrideBytes = 96;
3
+ static vertexStrideFloats = 24;
4
+ static VoxelMeshStructWGSL = /* wgsl */ `
5
+ struct ItemMeshVertex {
6
+ position: vec3f,
7
+ normal: vec3f,
8
+ uv: vec2f,
9
+ textureIndex: f32,
10
+ };
11
+ `;
12
+ }
@@ -7,12 +7,18 @@ export type CompactSubMesh = [
7
7
  minBounds: Vec3Array,
8
8
  maxBounds: Vec3Array
9
9
  ];
10
- export type CompactMeshData = [type: 0, meshes: CompactSubMesh[]] | [
11
- type: 1,
12
- vertexBuffer: ArrayBuffer,
13
- indexBuffer: Uint32Array,
14
- bvhTreeBuffer: Float32Array,
15
- bvhIndexBuffer: Uint32Array,
16
- minBounds: Vec3Array,
17
- maxBounds: Vec3Array
18
- ];
10
+ export type CompactMeshData = CompactSubMesh[];
11
+ /**
12
+ * old web gpu data
13
+ [
14
+ type: 1,
15
+ vertexBuffer: ArrayBuffer,
16
+ indexBuffer: Uint32Array,
17
+ bvhTreeBuffer: Float32Array,
18
+ bvhIndexBuffer: Uint32Array,
19
+ minBounds: Vec3Array,
20
+ maxBounds: Vec3Array,
21
+ ];
22
+
23
+ *
24
+ */
@@ -1 +1,15 @@
1
1
  export {};
2
+ /**
3
+ * old web gpu data
4
+ [
5
+ type: 1,
6
+ vertexBuffer: ArrayBuffer,
7
+ indexBuffer: Uint32Array,
8
+ bvhTreeBuffer: Float32Array,
9
+ bvhIndexBuffer: Uint32Array,
10
+ minBounds: Vec3Array,
11
+ maxBounds: Vec3Array,
12
+ ];
13
+
14
+ *
15
+ */
@@ -3,12 +3,13 @@ export class VoxelMeshTypes {
3
3
  static vertexStrideFloats = 24;
4
4
  static VoxelMeshStructWGSL = /* wgsl */ `
5
5
  struct VoxelMeshVertex {
6
- position: vec3f,
7
- normal: vec3f,
8
- voxelData: f32,
9
- textureIndex: vec3f,
10
- uv: vec2f,
11
- colors: vec3f,
6
+ position: vec3f,
7
+ normal: vec3f,
8
+ textureIndex: vec3f,
9
+ uv: vec2f,
10
+ colors: vec3f,
11
+ voxelData: f32,
12
+ _padding: vec4f
12
13
  };
13
14
  `;
14
15
  }
@@ -0,0 +1,3 @@
1
+ import { CompactMeshData } from "../../Types/Mesher.types";
2
+ import { VoxelModelBuilder } from "../Models/VoxelModelBuilder";
3
+ export declare function CompactTemplateMesh(tools: VoxelModelBuilder[], transfers?: any[]): CompactMeshData;