@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
@@ -1,5 +1,6 @@
1
1
  import { VoxelTickUpdateRegister } from "../VoxelTickUpdateRegister";
2
2
  import { CardinalNeighbors3D } from "../../../../Math/CardinalNeighbors";
3
+ import { VoxelFaces } from "../../../../Math";
3
4
  const floodOutChecks = [
4
5
  [1, 0, 0],
5
6
  [-1, 0, 0],
@@ -56,7 +57,7 @@ VoxelTickUpdateRegister.registerType({
56
57
  const currentLevel = voxel.getLevel();
57
58
  const levelState = voxel.getLevelState();
58
59
  if (levelState == 1 && currentLevel < 7) {
59
- voxel.setLevel(currentLevel + 1);
60
+ voxel.setLevel(7);
60
61
  voxel.updateVoxel(0);
61
62
  simulation.scheduleUpdate("dve_liquid", x, y, z, liquidUpdateRate);
62
63
  simulation.bounds.updateDisplay(x, y, z);
@@ -83,9 +84,7 @@ VoxelTickUpdateRegister.registerType({
83
84
  downVoxel.getLevelState() == 1) {
84
85
  simulation.scheduleUpdate("dve_liquid", x, y - 1, z, liquidUpdateRate);
85
86
  }
86
- voxel.setAir();
87
- voxel.setLevel(0);
88
- voxel.updateVoxel(1);
87
+ simulation.brush.setXYZ(x, y, z).erase();
89
88
  simulation.bounds.updateDisplay(x, y, z);
90
89
  for (let i = 0; i < CardinalNeighbors3D.length; i++) {
91
90
  const nx = x + CardinalNeighbors3D[i][0];
@@ -128,12 +127,34 @@ VoxelTickUpdateRegister.registerType({
128
127
  simulation.bounds.updateDisplay(x, y, z);
129
128
  }
130
129
  const downVoxel = simulation.nDataCursor.getVoxel(x, y - 1, z);
131
- if (!downVoxel || downVoxel.isAir() || downVoxel.isSameVoxel(voxel)) {
132
- if (downVoxel) {
133
- downVoxel.setId(voxel.getId());
134
- downVoxel.setLevel(0);
135
- downVoxel.setLevelState(1);
136
- downVoxel.updateVoxel(0);
130
+ const below = simulation.tickCursor[VoxelFaces.Down].getVoxel(x, y - 2, z);
131
+ const isSame = downVoxel && downVoxel.isSameVoxel(voxel);
132
+ if (downVoxel && (downVoxel.isAir() || isSame)) {
133
+ let addToTick = false;
134
+ if (downVoxel.isAir()) {
135
+ simulation.brush
136
+ .setXYZ(x, y - 1, z)
137
+ .setId(voxel.getStringId())
138
+ .setLevel((!below?.isAir() && !below?.isSameVoxel(voxel)) ? 7 : 0)
139
+ .setLevelState((below?.isAir() || below?.isSameVoxel(voxel)) ? 1 : 0)
140
+ .paint()
141
+ .clear();
142
+ addToTick = true;
143
+ }
144
+ else {
145
+ /* if (
146
+ downVoxel.getLevelState() !== 1 &&
147
+ below &&
148
+ below.isSameVoxel(voxel)
149
+ ) {
150
+ downVoxel.setLevel(7);
151
+ downVoxel.setLevelState(1);
152
+ downVoxel.updateVoxel(0);
153
+ addToTick = true;
154
+ } */
155
+ }
156
+ if (addToTick) {
157
+ simulation.bounds.updateDisplay(x, y - 1, z);
137
158
  simulation.scheduleUpdate("dve_liquid", x, y - 1, z, liquidUpdateRate);
138
159
  }
139
160
  return;
@@ -142,7 +163,7 @@ VoxelTickUpdateRegister.registerType({
142
163
  const nx = floodOutChecks[i][0] + x;
143
164
  const ny = floodOutChecks[i][1] + y;
144
165
  const nz = floodOutChecks[i][2] + z;
145
- const nVoxel = simulation.sDataCursor.getVoxel(nx, ny, nz);
166
+ const nVoxel = simulation.nDataCursor.getVoxel(nx, ny, nz);
146
167
  if (!nVoxel || !(nVoxel.isSameVoxel(voxel) || nVoxel.isAir()))
147
168
  continue;
148
169
  const vLevel = nVoxel.getLevel();
@@ -150,14 +171,18 @@ VoxelTickUpdateRegister.registerType({
150
171
  if (nState == 2)
151
172
  continue;
152
173
  if (vLevel + 1 < currentLevel) {
153
- nVoxel.setId(voxel.getId());
154
- nVoxel.setLevel(vLevel + 1);
155
- nVoxel.updateVoxel(0);
174
+ simulation.brush
175
+ .setId(voxel.getStringId())
176
+ .setXYZ(nx, ny, nz)
177
+ .setLevel(vLevel + 1)
178
+ .setLevelState(1)
179
+ .paint();
156
180
  simulation.bounds.updateDisplay(nx, ny, nz);
157
181
  if (currentLevel - 1 > 0) {
158
182
  simulation.scheduleUpdate("dve_liquid", nx, ny, nz, liquidUpdateRate);
159
183
  }
160
184
  }
161
185
  }
186
+ simulation.brush.clear();
162
187
  },
163
188
  });
@@ -2,6 +2,7 @@ import { Thread, ThreadPool } from "@amodx/threads";
2
2
  import { WorldStorageInterface } from "../World/Types/WorldStorage.interface";
3
3
  import { Generator, GeneratorData } from "./Dimensions/Generator";
4
4
  import { InitalLoad } from "./Procedures/InitalLoad";
5
+ import { BuildOnly } from "./Procedures/BuildOnly";
5
6
  import SaveAllSectors from "./Procedures/SaveAllSectors";
6
7
  interface WorldSimulationInitData {
7
8
  parent: Thread;
@@ -19,6 +20,15 @@ export declare class WorldSimulation {
19
20
  static Procedures: {
20
21
  InitalLoad: typeof InitalLoad;
21
22
  SaveAllSectors: typeof SaveAllSectors;
23
+ BuildOnly: typeof BuildOnly;
24
+ };
25
+ static logTasks(): {
26
+ loading: number[];
27
+ generating: number[];
28
+ propagating: number[];
29
+ sun: number[];
30
+ building: number[];
31
+ unbuilding: number[];
22
32
  };
23
33
  static init(data: WorldSimulationInitData): void;
24
34
  static createGenerator(data: Partial<GeneratorData>): Generator;
@@ -5,6 +5,7 @@ import { WorldSimulationTools } from "./Internal/WorldSimulationTools";
5
5
  import { WorldSimulationDimensions } from "./Internal/WorldSimulationDimensions";
6
6
  import { Vector3Like } from "@amodx/math";
7
7
  import { InitalLoad } from "./Procedures/InitalLoad";
8
+ import { BuildOnly } from "./Procedures/BuildOnly";
8
9
  import SaveAllSectors from "./Procedures/SaveAllSectors";
9
10
  import { runActiveSectorUpdate } from "./Internal/runActiveSectorUpdate";
10
11
  let initalized = false;
@@ -20,7 +21,36 @@ export class WorldSimulation {
20
21
  static Procedures = {
21
22
  InitalLoad,
22
23
  SaveAllSectors,
24
+ BuildOnly,
23
25
  };
26
+ static logTasks() {
27
+ return {
28
+ loading: [
29
+ WorldSimulationTasks.worldLoadTasks.getTotal(0),
30
+ WorldSimulationTasks.worldLoadTasks.getTotalWaitingFor(0),
31
+ ],
32
+ generating: [
33
+ WorldSimulationTasks.worldGenTasks.getTotal(0),
34
+ WorldSimulationTasks.worldGenTasks.getTotalWaitingFor(0),
35
+ ],
36
+ propagating: [
37
+ WorldSimulationTasks.worldPropagationTasks.getTotal(0),
38
+ WorldSimulationTasks.worldPropagationTasks.getTotalWaitingFor(0),
39
+ ],
40
+ sun: [
41
+ WorldSimulationTasks.worldSunTasks.getTotal(0),
42
+ WorldSimulationTasks.worldSunTasks.getTotalWaitingFor(0),
43
+ ],
44
+ building: [
45
+ WorldSimulationTasks.buildTasks.getTotal(0),
46
+ WorldSimulationTasks.buildTasks.getTotalWaitingFor(0),
47
+ ],
48
+ unbuilding: [
49
+ WorldSimulationTasks.unbuildTasks.getTotal(0),
50
+ WorldSimulationTasks.unbuildTasks.getTotalWaitingFor(0),
51
+ ],
52
+ };
53
+ }
24
54
  static init(data) {
25
55
  initalized = true;
26
56
  WorldSimulationTools.parent = data.parent;
@@ -59,9 +89,11 @@ export class WorldSimulation {
59
89
  return false;
60
90
  }
61
91
  static tick(generationOnly = false) {
92
+ let total = 0;
62
93
  for (const [, dimension] of WorldSimulationDimensions._dimensions) {
63
94
  dimension.incrementTick();
64
95
  for (let i = 0; i < dimension.activeSectors._sectors.length; i++) {
96
+ total += dimension.activeSectors._sectors[i].tickQueue.getTotalTicks();
65
97
  dimension.activeSectors._sectors[i].tickUpdate();
66
98
  dimension.activeSectors._sectors[i].generateUpdate();
67
99
  }
@@ -83,9 +115,17 @@ export class WorldSimulation {
83
115
  WorldSimulationTasks.worldDecorateTasks.runTask();
84
116
  WorldSimulationTasks.worldSunTasks.runTask();
85
117
  WorldSimulationTasks.worldPropagationTasks.runTask();
118
+ /* console.log(
119
+ "total ticks",
120
+ total,
121
+ "building",
122
+ "building",
123
+ WorldSimulationTasks.buildTasks.getTotalWaitingFor(0),
124
+ WorldSimulationTasks.buildTasks.getTotal(0)
125
+ ); */
86
126
  if (generationOnly)
87
127
  return;
88
- WorldSimulationTasks.buildTasks.runTask(125);
128
+ WorldSimulationTasks.buildTasks.runTask(32);
89
129
  WorldSimulationTasks.saveTasks.runTask(50);
90
130
  WorldSimulationTasks.unloadTasks.runTask(50);
91
131
  WorldSimulationTasks.unbuildTasks.runTask();
package/package.json CHANGED
@@ -1,30 +1 @@
1
- {
2
- "name": "@divinevoxel/vlox",
3
- "version": "0.0.75",
4
- "description": "Vlox a block style voxel engine.",
5
- "main": "index.js",
6
- "types": "index.d.ts",
7
- "type": "module",
8
- "devDependencies": {},
9
- "scripts": {
10
- "build": "mkdir -p dist && rm -rf dist/* && cp package.json dist/package.json && cp README.md ./dist/README.md && cp ./LICENSE.md ./dist/LICENSE.md && cd ./src && npx tsc",
11
- "compile": "cd src && npx tsc --watch"
12
- },
13
- "keywords": [],
14
- "author": "Divine Star Software",
15
- "license": "MIT",
16
- "repository": {
17
- "url": "git+https://github.com/Divine-Star-Software/DivineVoxelEngine.git"
18
- },
19
- "bugs": {
20
- "url": "https://github.com/Divine-Star-Software/DivineVoxelEngine/issues"
21
- },
22
- "dependencies": {
23
- "@amodx/math": "latest",
24
- "@amodx/binary": "latest",
25
- "@amodx/threads": "latest"
26
- },
27
- "publishConfig": {
28
- "access": "public"
29
- }
30
- }
1
+ {"name":"@divinevoxel/vlox","version":"0.0.77","description":"Vlox a block style voxel engine.","main":"index.js","types":"index.d.ts","type":"module","devDependencies":{},"scripts":{"clean:dist-ts":"test -d dist && find dist -type f \\( -name \"*.js\" -o -name \"*.d.ts\" \\) -delete || true","build":"mkdir -p dist && npm run clean:dist-ts && cp package.json dist/package.json && cd ./src && npx tsc","publish":"mkdir -p dist && rm -rf dist/* && cp package.json dist/package.json && cp README.md ./dist/README.md && cp ./LICENSE.md ./dist/LICENSE.md && cd ./src && npx tsc","compile":"cd src && npx tsc --watch","compile:fresh":"npm run clean:dist-ts && cd src && npx tsc --watch"},"keywords":[],"author":"Divine Star Software","license":"MIT","repository":{"url":"git+https://github.com/Divine-Star-Software/DivineVoxelEngine.git"},"bugs":{"url":"https://github.com/Divine-Star-Software/DivineVoxelEngine/issues"},"dependencies":{"@amodx/math":"latest","@amodx/binary":"latest","@amodx/threads":"latest"},"publishConfig":{"access":"public"}}
@@ -1,3 +0,0 @@
1
- import { CompactMeshData } from "../Types/Mesher.types";
2
- import { VoxelModelBuilder } from "Mesher/Models/VoxelModelBuilder";
3
- export declare function CompactVoxelMesh(tools: VoxelModelBuilder[], transfers?: any[]): CompactMeshData;
@@ -1,278 +0,0 @@
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
- /*
22
- const width = Math.sqrt(textureData.length / 4);
23
- const height = Math.sqrt(textureData.length / 4);
24
- const factor = 1 / width;
25
-
26
- const textureDataIndex = Flat2DIndex.GetXYOrder();
27
- textureDataIndex.setBounds(width, height);
28
-
29
- const origin = Vector3Like.Create(-0.5, -0.5, -0.5);
30
-
31
- const isSolid = (x: number, y: number) =>
32
- x >= 0 &&
33
- x < width &&
34
- y >= 0 &&
35
- y < height &&
36
- textureData[textureDataIndex.getIndexXY(x, y) * 4 + 3] > 0.01
37
- ? true
38
- : false;
39
-
40
- const uvs = tool.mesh!.getAttribute("uv");
41
- const textureIndex = tool.mesh!.getAttribute("textureIndex");
42
- const uvOffset = width > 16 ? -(2 / Math.max(width, height)) : 0;
43
-
44
- const addUvs = (sx: number, sy: number, ex: number, ey: number) => {
45
- uvs.push(
46
- (ex + uvOffset) * factor,
47
- (ey + uvOffset) * factor,
48
- (sx - uvOffset) * factor,
49
- (ey + uvOffset) * factor,
50
- (sx - uvOffset) * factor,
51
- (sy - uvOffset) * factor,
52
- (ex + uvOffset) * factor,
53
- (sy - uvOffset) * factor
54
- );
55
- textureIndex.push(
56
- textureId,
57
- 0,
58
- 0,
59
- textureId,
60
- 0,
61
- 0,
62
- textureId,
63
- 0,
64
- 0,
65
- textureId,
66
- 0,
67
- 0
68
- );
69
- };
70
-
71
- {
72
- GeometryBuilder.addQuad(tool, origin, Quads.south);
73
- uvs.push(
74
- Quads.south.uvs.vertices[QuadVerticies.TopRight].x,
75
- Quads.south.uvs.vertices[QuadVerticies.TopRight].y,
76
- Quads.south.uvs.vertices[QuadVerticies.TopLeft].x,
77
- Quads.south.uvs.vertices[QuadVerticies.TopLeft].y,
78
- Quads.south.uvs.vertices[QuadVerticies.BottomLeft].x,
79
- Quads.south.uvs.vertices[QuadVerticies.BottomLeft].y,
80
- Quads.south.uvs.vertices[QuadVerticies.BottomRight].x,
81
- Quads.south.uvs.vertices[QuadVerticies.BottomRight].y
82
- );
83
-
84
- textureIndex.push(
85
- textureId,
86
- 0,
87
- 0,
88
- textureId,
89
- 0,
90
- 0,
91
- textureId,
92
- 0,
93
- 0,
94
- textureId,
95
- 0,
96
- 0
97
- );
98
- }
99
-
100
- {
101
- const backPositionZ = factor;
102
- Quads.north.positions.vertices[QuadVerticies.TopRight].z = backPositionZ;
103
- Quads.north.positions.vertices[QuadVerticies.TopLeft].z = backPositionZ;
104
- Quads.north.positions.vertices[QuadVerticies.BottomLeft].z = backPositionZ;
105
- Quads.north.positions.vertices[QuadVerticies.BottomRight].z = backPositionZ;
106
- Quads.north.flip = true;
107
- uvs.push(
108
- Quads.north.uvs.vertices[QuadVerticies.TopLeft].x,
109
- Quads.north.uvs.vertices[QuadVerticies.TopLeft].y,
110
- Quads.north.uvs.vertices[QuadVerticies.TopRight].x,
111
- Quads.north.uvs.vertices[QuadVerticies.TopRight].y,
112
- Quads.north.uvs.vertices[QuadVerticies.BottomRight].x,
113
- Quads.north.uvs.vertices[QuadVerticies.BottomRight].y,
114
- Quads.north.uvs.vertices[QuadVerticies.BottomLeft].x,
115
- Quads.north.uvs.vertices[QuadVerticies.BottomLeft].y
116
- );
117
- GeometryBuilder.addQuad(tool, origin, Quads.north);
118
- textureIndex.push(
119
- textureId,
120
- 0,
121
- 0,
122
- textureId,
123
- 0,
124
- 0,
125
- textureId,
126
- 0,
127
- 0,
128
- textureId,
129
- 0,
130
- 0
131
- );
132
- }
133
-
134
- for (let x = 0; x < width; x++) {
135
- let eastFace: Vec2Array | null = null;
136
- let westFace: Vec2Array | null = null;
137
- for (let y = 0; y < height; y++) {
138
- let eastFaceExposed = true;
139
- let westFaceExposed = true;
140
-
141
- if (!isSolid(x, y)) {
142
- eastFaceExposed = false;
143
- westFaceExposed = false;
144
- }
145
- if (isSolid(x + 1, y)) {
146
- eastFaceExposed = false;
147
- }
148
- if (isSolid(x - 1, y)) {
149
- westFaceExposed = false;
150
- }
151
-
152
- if (eastFace && !eastFaceExposed) {
153
- const newQuad = Quad.Create(
154
- [
155
- [x * factor + factor, eastFace[1] * factor, 0],
156
- [x * factor + factor, y * factor, factor],
157
- ],
158
- Quad.FullUVs as any,
159
- false,
160
- 0
161
- );
162
- GeometryBuilder.addQuad(tool, origin, newQuad);
163
-
164
- let [sx, sy] = eastFace;
165
- let ex = x;
166
- let ey = y;
167
- ex += 1;
168
- addUvs(sx, sy, ex, ey);
169
- eastFace = null;
170
- }
171
-
172
- if (westFace && !westFaceExposed) {
173
- const newQuad = Quad.Create(
174
- [
175
- [x * factor, westFace[1] * factor, 0],
176
- [x * factor, y * factor, factor],
177
- ],
178
- Quad.FullUVs as any,
179
- false,
180
- 1
181
- );
182
- GeometryBuilder.addQuad(tool, origin, newQuad);
183
- let [sx, sy] = westFace;
184
- let ex = x;
185
- let ey = y;
186
- ex += 1;
187
- addUvs(sx, sy, ex, ey);
188
- westFace = null;
189
- }
190
- const isPixel = isSolid(x, y);
191
- if (!isSolid(x + 1, y) && !eastFace && isPixel) {
192
- eastFace = [x, y];
193
- }
194
- if (!isSolid(x - 1, y) && !westFace && isPixel) {
195
- westFace = [x, y];
196
- }
197
- }
198
- }
199
- for (let y = 0; y < height; y++) {
200
- let upFace: Vec2Array | null = null;
201
- let downFace: Vec2Array | null = null;
202
-
203
- for (let x = 0; x < width; x++) {
204
- let upFaceExposed = true;
205
- let downFaceExposed = true;
206
-
207
- if (!isSolid(x, y)) {
208
- upFaceExposed = false;
209
- downFaceExposed = false;
210
- }
211
- if (isSolid(x, y + 1)) {
212
- upFaceExposed = false;
213
- }
214
- if (isSolid(x, y - 1)) {
215
- downFaceExposed = false;
216
- }
217
-
218
- if (upFace && !upFaceExposed) {
219
- const newQuad = Quad.Create(
220
- [
221
- [upFace[0] * factor, y * factor + factor, 0],
222
- [x * factor, y * factor + factor, factor],
223
- ],
224
- Quad.FullUVs as any,
225
- false,
226
- 0
227
- );
228
- GeometryBuilder.addQuad(tool, origin, newQuad);
229
- let [sx, sy] = upFace;
230
- let [ex, ey] = [x, y];
231
-
232
- ey += 1;
233
- addUvs(sx, sy, ex, ey);
234
- upFace = null;
235
- }
236
-
237
- if (downFace && !downFaceExposed) {
238
- const newQuad = Quad.Create(
239
- [
240
- [downFace[0] * factor, y * factor, 0],
241
- [x * factor, y * factor, factor],
242
- ],
243
- Quad.FullUVs as any,
244
- false,
245
- 1
246
- );
247
- GeometryBuilder.addQuad(tool, origin, newQuad);
248
- let [sx, sy] = downFace;
249
- let [ex, ey] = [x, y];
250
- ey += 1;
251
- addUvs(sx, sy, ex, ey);
252
- downFace = null;
253
- }
254
-
255
- const isPixel = isSolid(x, y);
256
- if (!isSolid(x, y + 1) && !upFace && isPixel) {
257
- upFace = [x, y];
258
- }
259
- if (!isSolid(x, y - 1) && !downFace && isPixel) {
260
- downFace = [x, y];
261
- }
262
- }
263
- }
264
-
265
- for (const [key, [data]] of tool.mesh!.attributes) {
266
- if (key == "position") {
267
- for (let i = 0; i < data.length; i += 3) {
268
- (data as any as number[])[i] -= 0.5;
269
- (data as any as number[])[i + 1] -= 0.5;
270
- (data as any as number[])[i + 2];
271
- }
272
- }
273
- }
274
-
275
- const compacted = CompactMesh("dve_node", tool);
276
- */
277
- // return tool.mesh;
278
- }
@@ -1,12 +0,0 @@
1
- import { Vector3Like } from "@amodx/math";
2
- import { VoxelVertexBuffer, VoxelIndiceBuffer } from "./VoxelMeshBuffers";
3
- export declare class VoxelMesh {
4
- indicieCount: number;
5
- vertexCount: number;
6
- minBounds: Vector3Like;
7
- maxBounds: Vector3Like;
8
- readonly buffer: VoxelVertexBuffer;
9
- readonly indices: VoxelIndiceBuffer;
10
- addVerticies(vertexCount: number, indicesCount: number): void;
11
- clear(): void;
12
- }
@@ -1,25 +0,0 @@
1
- import { Vector3Like } from "@amodx/math";
2
- import { VoxelVertexBuffer, VoxelIndiceBuffer } from "./VoxelMeshBuffers";
3
- import { VoxelMeshVertexStructCursor } from "./VoxelMeshVertexStructCursor";
4
- export class VoxelMesh {
5
- indicieCount = 0;
6
- vertexCount = 0;
7
- minBounds = Vector3Like.Create(Infinity, Infinity, Infinity);
8
- maxBounds = Vector3Like.Create(-Infinity, -Infinity, -Infinity);
9
- buffer = new VoxelVertexBuffer(VoxelMeshVertexStructCursor.VertexFloatSize, 1024);
10
- indices = new VoxelIndiceBuffer(1024);
11
- addVerticies(vertexCount, indicesCount) {
12
- this.vertexCount += vertexCount;
13
- this.indicieCount += indicesCount;
14
- }
15
- clear() {
16
- this.indicieCount = 0;
17
- this.vertexCount = 0;
18
- this.minBounds.x = Infinity;
19
- this.minBounds.y = Infinity;
20
- this.minBounds.z = Infinity;
21
- this.maxBounds.x = -Infinity;
22
- this.maxBounds.y = -Infinity;
23
- this.maxBounds.z = -Infinity;
24
- }
25
- }
@@ -1,25 +0,0 @@
1
- import { Vec3Array, Vector4Like } from "@amodx/math";
2
- import type { Quad } from "../../../Geomtry";
3
- import { VoxelModelBuilder } from "Mesher/Models/VoxelModelBuilder";
4
- import { TextureProcedure, BaseVoxelGeomtryTextureProcedureData } from "../TextureProcedure";
5
- import { TextureId } from "Textures";
6
- import { VoxelFaces } from "Math";
7
- /**
8
- * Extend your data type so we can add a seed if we want, and define
9
- * the rotations we can choose from.
10
- */
11
- interface VoxelGeometryConsistentRotationTextureProcedureData extends BaseVoxelGeomtryTextureProcedureData {
12
- type: "consistent-rotation";
13
- texture: TextureId | number;
14
- /**
15
- * You can allow (0 | 90 | 180 | 270), or remove 0 if you don’t want an unrotated option
16
- */
17
- rotations: (0 | 90 | 180 | 270)[];
18
- rotationBounds?: Vec3Array;
19
- }
20
- export declare class ConsistentRotationTextureProcedure extends TextureProcedure<VoxelGeometryConsistentRotationTextureProcedureData> {
21
- getTexture(builder: VoxelModelBuilder, data: VoxelGeometryConsistentRotationTextureProcedureData, closestFace: VoxelFaces, primitive: Quad): number;
22
- getOverlayTexture(builder: VoxelModelBuilder, data: VoxelGeometryConsistentRotationTextureProcedureData, closestFace: VoxelFaces, primitive: Quad, ref: Vector4Like): Vector4Like;
23
- transformUVs(builder: VoxelModelBuilder, data: VoxelGeometryConsistentRotationTextureProcedureData, closestFace: VoxelFaces, primitive: Quad): void;
24
- }
25
- export {};