@divinevoxel/vlox 0.0.71 → 0.0.73

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 (271) hide show
  1. package/Contexts/Base/Main/InitDataGenerator.js +0 -9
  2. package/Contexts/Base/Remote/DataSync.types.d.ts +0 -5
  3. package/Contexts/Base/Remote/InitDataSync.js +17 -31
  4. package/Contexts/Render/DivineVoxelEngineRender.d.ts +1 -1
  5. package/Contexts/World/DivineVoxelEngineWorld.d.ts +1 -1
  6. package/Init/StartConstructor.js +7 -7
  7. package/Init/StartWorld.d.ts +1 -1
  8. package/Init/StartWorld.js +0 -12
  9. package/Math/Indexing.d.ts +12 -3
  10. package/Math/Indexing.js +24 -15
  11. package/Mesher/Functions/CompactVoxelMesh.d.ts +2 -2
  12. package/Mesher/Functions/CompactVoxelMesh.js +4 -5
  13. package/Mesher/Functions/MeshSection.d.ts +1 -1
  14. package/Mesher/Functions/MeshSection.js +72 -66
  15. package/Mesher/Functions/MeshTexture.d.ts +1 -1
  16. package/Mesher/Functions/MeshTexture.js +3 -4
  17. package/Mesher/Functions/MeshVoxel.js +20 -26
  18. package/Mesher/Geomtry/Primitives/QuadVertexData.d.ts +12 -10
  19. package/Mesher/Geomtry/Primitives/QuadVertexData.js +49 -56
  20. package/Mesher/Geomtry/VoxelGeometryBuilder.d.ts +2 -2
  21. package/Mesher/Geomtry/VoxelGeometryBuilder.js +108 -125
  22. package/Mesher/Geomtry/VoxelMesh.d.ts +1 -1
  23. package/Mesher/Geomtry/VoxelMesh.js +2 -2
  24. package/Mesher/{Tools → Geomtry}/VoxelMeshBVHBuilder.d.ts +2 -9
  25. package/Mesher/{Tools → Geomtry}/VoxelMeshBVHBuilder.js +4 -16
  26. package/Mesher/Geomtry/{Buffers.d.ts → VoxelMeshBuffers.d.ts} +9 -8
  27. package/Mesher/Geomtry/VoxelMeshBuffers.js +49 -0
  28. package/Mesher/{Tools → Geomtry}/VoxelMeshVertexStructCursor.d.ts +10 -0
  29. package/Mesher/{Tools → Geomtry}/VoxelMeshVertexStructCursor.js +10 -0
  30. package/Mesher/Geomtry/index.d.ts +0 -1
  31. package/Mesher/Geomtry/index.js +0 -1
  32. package/Mesher/InitMesher.js +2 -11
  33. package/Mesher/InitTask.js +10 -22
  34. package/Mesher/Models/Common/BoundsFunctions.d.ts +1 -3
  35. package/Mesher/Models/Common/BoundsFunctions.js +0 -16
  36. package/Mesher/Models/Common/Calc/CalcConstants.js +14 -31
  37. package/Mesher/Models/Common/Calc/FaceDataCalc.d.ts +2 -8
  38. package/Mesher/Models/Common/Calc/FaceDataCalc.js +50 -52
  39. package/Mesher/Models/Nodes/Custom/Liquid/FlowGradient.d.ts +2 -2
  40. package/Mesher/Models/Nodes/Custom/Liquid/FlowGradient.js +1 -1
  41. package/Mesher/Models/Nodes/Custom/Liquid/LiquidGeomtryNode.d.ts +1 -5
  42. package/Mesher/Models/Nodes/Custom/Liquid/LiquidGeomtryNode.js +40 -42
  43. package/Mesher/Models/Nodes/GeometryNode.d.ts +3 -5
  44. package/Mesher/Models/Nodes/GeometryNode.js +1 -2
  45. package/Mesher/Models/Nodes/Ruled/BoxVoxelGeometryNode.d.ts +3 -6
  46. package/Mesher/Models/Nodes/Ruled/BoxVoxelGeometryNode.js +55 -40
  47. package/Mesher/Models/Nodes/Ruled/QuadVoxelGeometryNode.d.ts +2 -6
  48. package/Mesher/Models/Nodes/Ruled/QuadVoxelGeometryNode.js +52 -51
  49. package/Mesher/Models/Nodes/Ruleless/RulelessBoxVoxelGeometryNode.d.ts +2 -6
  50. package/Mesher/Models/Nodes/Ruleless/RulelessBoxVoxelGeometryNode.js +18 -19
  51. package/Mesher/Models/Nodes/Ruleless/RulelessQuadVoxelGeometryNode.d.ts +2 -6
  52. package/Mesher/Models/Nodes/Ruleless/RulelessQuadVoxelGeometryNode.js +37 -40
  53. package/Mesher/{Tools → Models/Protocols}/OutlinedVoxelTool.d.ts +1 -1
  54. package/Mesher/{Tools → Models/Protocols}/OutlinedVoxelTool.js +1 -1
  55. package/Mesher/Models/RenderedMaterials.d.ts +6 -0
  56. package/Mesher/{RenderedMaterials.js → Models/RenderedMaterials.js} +2 -2
  57. package/Mesher/Models/VoxelConstructor.d.ts +4 -5
  58. package/Mesher/Models/VoxelConstructor.js +23 -12
  59. package/Mesher/Models/{VoxelGeometryLookUp.d.ts → VoxelGeometryBuilderCacheSpace.d.ts} +6 -14
  60. package/Mesher/Models/{VoxelGeometryLookUp.js → VoxelGeometryBuilderCacheSpace.js} +26 -44
  61. package/Mesher/{Tools/VoxelMesherDataTool.d.ts → Models/VoxelModelBuilder.d.ts} +10 -8
  62. package/Mesher/{Tools/VoxelMesherDataTool.js → Models/VoxelModelBuilder.js} +44 -19
  63. package/Mesher/Models/VoxelModelConstructorRegister.js +3 -3
  64. package/Models/Defaults/CubeVoxelGeometry.js +4 -0
  65. package/Models/Defaults/CubeVoxelModels.js +344 -344
  66. package/Models/Defaults/LiquidVoxelModel.js +2 -2
  67. package/Models/Defaults/PanelVoxelModels.js +432 -432
  68. package/Models/Defaults/StairVoxelModel.js +576 -576
  69. package/Models/Examples.js +469 -456
  70. package/Models/Indexing/VoxelAOResultsIndex.d.ts +4 -4
  71. package/Models/Indexing/VoxelAOResultsIndex.js +15 -9
  72. package/Models/Indexing/VoxelFaceCullResultsIndex.d.ts +3 -3
  73. package/Models/Indexing/VoxelFaceCullResultsIndex.js +14 -9
  74. package/Models/Indexing/VoxelFaceTransparentResultsIndex.d.ts +1 -1
  75. package/Models/Indexing/VoxelFaceTransparentResultsIndex.js +1 -1
  76. package/Models/Rules/Functions/BuildFinalInputs.js +9 -7
  77. package/Models/Rules/Functions/BuildGeomtryInputs.js +8 -5
  78. package/Models/Rules/Functions/BuildRules.js +4 -4
  79. package/Models/Rules/{VoxelModelManager.d.ts → VoxelModelRuleBuilderRegister.d.ts} +1 -1
  80. package/Models/Rules/VoxelModelRuleBuilderRegister.js +178 -0
  81. package/Models/VoxelModel.types.d.ts +14 -5
  82. package/Renderer/Classes/SectorMesh.d.ts +3 -4
  83. package/Renderer/Classes/SectorMesh.js +6 -11
  84. package/Renderer/InitTasks.js +6 -7
  85. package/Renderer/MeshManager.js +2 -2
  86. package/Renderer/MeshRegister.js +2 -1
  87. package/Settings/EngineSettings.d.ts +1 -1
  88. package/Settings/EngineSettings.js +3 -5
  89. package/Settings/EngineSettings.types.d.ts +17 -18
  90. package/Settings/EngineSettings.types.js +16 -15
  91. package/Tasks/IWG/IWG.d.ts +2 -1
  92. package/Tasks/IWG/IWG.js +9 -3
  93. package/Tasks/IWG/Internal/Classes/BuildQueue.d.ts +11 -0
  94. package/Tasks/IWG/Internal/Classes/BuildQueue.js +49 -0
  95. package/Tasks/IWG/Internal/Classes/Generator.d.ts +6 -1
  96. package/Tasks/IWG/Internal/Classes/Generator.js +14 -2
  97. package/Tasks/IWG/Internal/Classes/IWGTaskBase.js +2 -2
  98. package/Tasks/IWG/Internal/Functions/getSectorState.js +4 -7
  99. package/Tasks/IWG/Internal/Functions/runBuildUpdate.js +21 -2
  100. package/Tasks/IWG/Internal/Functions/runWorldUpdate.js +5 -6
  101. package/Tasks/IWG/Internal/IWGTasks.d.ts +0 -4
  102. package/Tasks/IWG/Internal/IWGTasks.js +12 -31
  103. package/Tasks/IWG/Internal/IWGTools.d.ts +1 -1
  104. package/Tasks/IWG/Procedures/SaveAllSectors.js +2 -0
  105. package/Tasks/Propagation/Flow/FlowManager.d.ts +0 -2
  106. package/Tasks/Propagation/Flow/FlowManager.js +86 -87
  107. package/Tasks/Propagation/Flow/WorldFlow.js +2 -3
  108. package/Tasks/Propagation/Illumanation/WorldRGB.js +1 -2
  109. package/Tasks/Update/InitTasks.d.ts +2 -1
  110. package/Tasks/Update/InitTasks.js +6 -6
  111. package/Tasks/Update/UpdateTask.d.ts +3 -1
  112. package/Tasks/Update/UpdateTask.js +28 -2
  113. package/Tasks/Update/VoxelUpdate.js +21 -7
  114. package/Tasks/WorldGeneration/WorldGenBrush.js +2 -1
  115. package/Templates/Cursor/TemplateCursor.d.ts +2 -2
  116. package/Templates/Cursor/TemplateCursor.js +1 -2
  117. package/Templates/Functions/CreateTemplate.js +1 -1
  118. package/Templates/VoxelTemplate.js +6 -8
  119. package/Templates/VoxelTemplates.types.d.ts +1 -1
  120. package/Textures/Classes/CompiledTexture.d.ts +18 -0
  121. package/Textures/Classes/CompiledTexture.js +50 -0
  122. package/Textures/Classes/CompiledTextureAnimation.d.ts +12 -0
  123. package/Textures/Classes/CompiledTextureAnimation.js +27 -0
  124. package/Textures/Classes/TextureAnimationTexture.d.ts +10 -0
  125. package/Textures/Classes/TextureAnimationTexture.js +32 -0
  126. package/Textures/Functions/BuildTextureData.d.ts +10 -0
  127. package/Textures/Functions/BuildTextureData.js +205 -0
  128. package/Textures/Texture.types.d.ts +50 -64
  129. package/Textures/TextureManager.d.ts +8 -19
  130. package/Textures/TextureManager.js +28 -166
  131. package/Tools/Brush/Brush.d.ts +1 -3
  132. package/Tools/Brush/Brush.js +43 -12
  133. package/Util/Binary/BinaryArrays.d.ts +6 -0
  134. package/Util/Binary/BinaryArrays.js +25 -0
  135. package/Util/Binary/BinaryBuffer.d.ts +29 -0
  136. package/Util/Binary/BinaryBuffer.js +130 -0
  137. package/Util/Binary/BinaryFunctions.d.ts +3 -0
  138. package/Util/Binary/BinaryFunctions.js +11 -0
  139. package/Util/StringPalette.d.ts +1 -0
  140. package/Util/StringPalette.js +8 -0
  141. package/Voxels/Cursor/DataCursor.interface.d.ts +5 -0
  142. package/Voxels/Cursor/VoxelCursor.d.ts +6 -6
  143. package/Voxels/Cursor/VoxelCursor.interface.d.ts +11 -16
  144. package/Voxels/Cursor/VoxelCursor.interface.js +35 -58
  145. package/Voxels/Cursor/VoxelCursor.js +13 -12
  146. package/Voxels/Cursor/VoxelLightData.d.ts +3 -4
  147. package/Voxels/Cursor/VoxelLightData.js +8 -7
  148. package/Voxels/Data/VoxelPalettesRegister.d.ts +8 -0
  149. package/Voxels/Data/VoxelPalettesRegister.js +8 -0
  150. package/Voxels/Data/VoxelTag.types.d.ts +56 -0
  151. package/Voxels/Data/VoxelTag.types.js +23 -0
  152. package/Voxels/{State → Data}/VoxelTagStates.d.ts +2 -2
  153. package/Voxels/{State → Data}/VoxelTagStates.js +5 -5
  154. package/Voxels/Data/VoxelTagsRegister.d.ts +9 -0
  155. package/Voxels/Data/VoxelTagsRegister.js +32 -0
  156. package/Voxels/Functions/BuildStateData.js +12 -12
  157. package/Voxels/Functions/BuildTagAndPaletteData.d.ts +13 -0
  158. package/Voxels/Functions/BuildTagAndPaletteData.js +55 -0
  159. package/Voxels/Indexes/VoxelIndex.js +3 -3
  160. package/Voxels/InitVoxelData.js +31 -73
  161. package/Voxels/State/Schema/StateSchema.d.ts +1 -1
  162. package/Voxels/Types/Voxel.types.d.ts +20 -42
  163. package/Voxels/Types/Voxel.types.js +6 -17
  164. package/Voxels/Types/VoxelModelCompiledData.types.d.ts +11 -13
  165. package/Voxels/Types/VoxelSubstances.types.d.ts +2 -15
  166. package/Voxels/Types/VoxelSubstances.types.js +1 -9
  167. package/World/Archive/Archive.types.d.ts +38 -34
  168. package/World/Archive/Functions/ArchiveArea.js +18 -30
  169. package/World/Archive/Functions/ArchiveSector.js +484 -213
  170. package/World/Archive/Functions/ImportSector.d.ts +3 -3
  171. package/World/Archive/Functions/ImportSector.js +205 -151
  172. package/World/Archive/Functions/Shared.d.ts +6 -0
  173. package/World/Archive/Functions/Shared.js +75 -0
  174. package/World/Archive/InitTasks.js +30 -13
  175. package/World/Cursor/SectionCursor.d.ts +3 -2
  176. package/World/Cursor/SectionCursor.js +9 -4
  177. package/World/Cursor/SectorCursor.d.ts +3 -2
  178. package/World/Cursor/SectorCursor.js +5 -3
  179. package/World/Cursor/WorldCursor.d.ts +2 -2
  180. package/World/Cursor/WorldCursor.js +6 -3
  181. package/World/Cursor/WorldVoxelCursor.d.ts +7 -7
  182. package/World/Cursor/WorldVoxelCursor.js +21 -24
  183. package/World/InitTasks.d.ts +1 -1
  184. package/World/Lock/WorldLock.d.ts +1 -1
  185. package/World/Section/Section.d.ts +31 -23
  186. package/World/Section/Section.js +116 -18
  187. package/World/Section/SectionState.d.ts +10 -0
  188. package/World/Section/SectionState.js +11 -0
  189. package/World/Sector/Sector.d.ts +24 -9
  190. package/World/Sector/Sector.js +92 -21
  191. package/World/Sector/SectorHeightMap.js +3 -5
  192. package/World/Sector/SectorState.d.ts +21 -0
  193. package/World/Sector/SectorState.js +28 -0
  194. package/World/WorldRegister.d.ts +4 -0
  195. package/World/WorldRegister.js +15 -3
  196. package/World/WorldSpaces.d.ts +6 -0
  197. package/World/WorldSpaces.js +25 -6
  198. package/package.json +1 -1
  199. package/Data/Cursor/DataCursor.interface.d.ts +0 -5
  200. package/Data/Cursor/DataCursor.interface.js +0 -2
  201. package/Data/Register/MappedDataRegister.d.ts +0 -5
  202. package/Data/Register/MappedDataRegister.js +0 -9
  203. package/Data/Register/MappedRegisterBase.d.ts +0 -14
  204. package/Data/Register/MappedRegisterBase.js +0 -50
  205. package/Data/Structs/StructBuilder.d.ts +0 -34
  206. package/Data/Structs/StructBuilder.js +0 -157
  207. package/Data/Structs/StructBuilder.types.d.ts +0 -30
  208. package/Mesher/Functions/CompactMesh.d.ts +0 -2
  209. package/Mesher/Functions/CompactMesh.js +0 -42
  210. package/Mesher/Geomtry/Buffers.js +0 -81
  211. package/Mesher/Geomtry/GeometryNormals.d.ts +0 -10
  212. package/Mesher/Geomtry/GeometryNormals.js +0 -52
  213. package/Mesher/Geomtry/MeshData.types.d.ts +0 -13
  214. package/Mesher/Geomtry/MeshData.types.js +0 -6
  215. package/Mesher/Geomtry/Tools/MesherDataTools.d.ts +0 -7
  216. package/Mesher/Geomtry/Tools/MesherDataTools.js +0 -12
  217. package/Mesher/Geomtry/Tools/index.d.ts +0 -1
  218. package/Mesher/Geomtry/Tools/index.js +0 -1
  219. package/Mesher/RenderedMaterials.d.ts +0 -6
  220. package/Models/Rules/VoxelModelManager.js +0 -82
  221. package/Textures/TextureAnimations.d.ts +0 -4
  222. package/Textures/TextureAnimations.js +0 -35
  223. package/Textures/TextureArray.d.ts +0 -47
  224. package/Textures/TextureArray.js +0 -202
  225. package/Textures/TextureBuilder.d.ts +0 -13
  226. package/Textures/TextureBuilder.js +0 -120
  227. package/Textures/TextureRegister.d.ts +0 -9
  228. package/Textures/TextureRegister.js +0 -28
  229. package/Tools/Data/SubstanceDataTool.d.ts +0 -13
  230. package/Tools/Data/SubstanceDataTool.js +0 -51
  231. package/Voxels/Palettes/MaterialPalette.d.ts +0 -9
  232. package/Voxels/Palettes/MaterialPalette.js +0 -11
  233. package/Voxels/Palettes/SubstancePalette.d.ts +0 -9
  234. package/Voxels/Palettes/SubstancePalette.js +0 -11
  235. package/Voxels/Palettes/VoxelPalette.d.ts +0 -11
  236. package/Voxels/Palettes/VoxelPalette.js +0 -15
  237. package/Voxels/Segments/MaterialDataGenerator.d.ts +0 -6
  238. package/Voxels/Segments/MaterialDataGenerator.js +0 -12
  239. package/Voxels/Segments/SubstanceDataGenerator.d.ts +0 -6
  240. package/Voxels/Segments/SubstanceDataGenerator.js +0 -35
  241. package/Voxels/Segments/VoxelDataGenerator.d.ts +0 -10
  242. package/Voxels/Segments/VoxelDataGenerator.js +0 -56
  243. package/Voxels/Structs/Builder/SubstanceStructBuilder.d.ts +0 -2
  244. package/Voxels/Structs/Builder/SubstanceStructBuilder.js +0 -42
  245. package/Voxels/Structs/Builder/VoxelStructBuilder.d.ts +0 -2
  246. package/Voxels/Structs/Builder/VoxelStructBuilder.js +0 -68
  247. package/Voxels/Structs/SubstanceStruct.d.ts +0 -17
  248. package/Voxels/Structs/SubstanceStruct.js +0 -17
  249. package/Voxels/Structs/VoxelStruct.d.ts +0 -27
  250. package/Voxels/Structs/VoxelStruct.js +0 -29
  251. package/World/Section/SectionHeightMap.d.ts +0 -10
  252. package/World/Section/SectionHeightMap.js +0 -39
  253. package/World/Section/SectionStruct.d.ts +0 -8
  254. package/World/Section/SectionStruct.js +0 -29
  255. package/World/Section/SectionStructProperties.d.ts +0 -10
  256. package/World/Section/SectionStructProperties.js +0 -11
  257. package/World/Sector/SectorStruct.d.ts +0 -1
  258. package/World/Sector/SectorStruct.js +0 -46
  259. package/World/Sector/SectorStructIds.d.ts +0 -13
  260. package/World/Sector/SectorStructIds.js +0 -14
  261. package/World/Structs/WorldDataStructProperties.d.ts +0 -8
  262. package/World/Structs/WorldDataStructProperties.js +0 -9
  263. /package/Mesher/{VoxelShaderData.d.ts → Geomtry/VoxelShaderData.d.ts} +0 -0
  264. /package/Mesher/{VoxelShaderData.js → Geomtry/VoxelShaderData.js} +0 -0
  265. /package/{Data/Functions → Util/Binary}/Palettes.d.ts +0 -0
  266. /package/{Data/Functions → Util/Binary}/Palettes.js +0 -0
  267. /package/{Data/Structs/StructBuilder.types.js → Voxels/Cursor/DataCursor.interface.js} +0 -0
  268. /package/Voxels/{VoxelLevelReader.d.ts → Cursor/VoxelLevelReader.d.ts} +0 -0
  269. /package/Voxels/{VoxelLevelReader.js → Cursor/VoxelLevelReader.js} +0 -0
  270. /package/World/{Storage → Types}/WorldStorage.interface.d.ts +0 -0
  271. /package/World/{Storage → Types}/WorldStorage.interface.js +0 -0
@@ -0,0 +1,49 @@
1
+ export class VoxelVertexBuffer {
2
+ vertexFloatSize;
3
+ sectorVertexSize;
4
+ _buffers = [];
5
+ sectorSize = 0;
6
+ constructor(vertexFloatSize, sectorVertexSize, startingSectorSize = 4) {
7
+ this.vertexFloatSize = vertexFloatSize;
8
+ this.sectorVertexSize = sectorVertexSize;
9
+ this.sectorSize = vertexFloatSize * sectorVertexSize;
10
+ for (let i = 0; i < startingSectorSize; i++) {
11
+ this._buffers.push(new Float32Array(this.sectorSize));
12
+ }
13
+ }
14
+ currentArray;
15
+ curentIndex = 0;
16
+ _index = 0;
17
+ setIndex(index) {
18
+ this._index = index;
19
+ const bufferIndex = Math.floor((index * this.vertexFloatSize) / this.sectorSize);
20
+ if (!this._buffers[bufferIndex])
21
+ this._buffers[bufferIndex] = new Float32Array(this.sectorSize);
22
+ this.curentIndex =
23
+ (index * this.vertexFloatSize - bufferIndex * this.sectorSize) /
24
+ this.vertexFloatSize;
25
+ this.currentArray = this._buffers[bufferIndex];
26
+ }
27
+ }
28
+ export class VoxelIndiceBuffer {
29
+ sectorSize;
30
+ _buffers = [];
31
+ constructor(sectorSize, startingSectorSize = 4) {
32
+ this.sectorSize = sectorSize;
33
+ for (let i = 0; i < startingSectorSize; i++) {
34
+ this._buffers.push(new Uint32Array(sectorSize));
35
+ }
36
+ }
37
+ currentArray;
38
+ curentIndex = 0;
39
+ _index = 0;
40
+ setIndex(index) {
41
+ this._index = index;
42
+ const bufferIndex = Math.floor(index / this.sectorSize);
43
+ if (!this._buffers[bufferIndex])
44
+ this._buffers[bufferIndex] = new Uint32Array(this.sectorSize);
45
+ this.curentIndex = index - bufferIndex * this.sectorSize;
46
+ this.currentArray = this._buffers[bufferIndex];
47
+ return this;
48
+ }
49
+ }
@@ -1,3 +1,13 @@
1
+ export declare const VoxelMeshVertexConstants: {
2
+ VertexFloatSize: number;
3
+ VertexByteSize: number;
4
+ PositionOffset: number;
5
+ NormalOffset: number;
6
+ TextureIndexOffset: number;
7
+ UVOffset: number;
8
+ ColorOffset: number;
9
+ VoxelDataOFfset: number;
10
+ };
1
11
  export declare class VoxelMeshVertexStructCursor {
2
12
  static VertexFloatSize: number;
3
13
  static VertexByteSize: number;
@@ -1,3 +1,13 @@
1
+ export const VoxelMeshVertexConstants = {
2
+ VertexFloatSize: 24,
3
+ VertexByteSize: 24 * 4,
4
+ PositionOffset: 0,
5
+ NormalOffset: 4,
6
+ TextureIndexOffset: 8,
7
+ UVOffset: 12,
8
+ ColorOffset: 14,
9
+ VoxelDataOFfset: 18,
10
+ };
1
11
  export class VoxelMeshVertexStructCursor {
2
12
  static VertexFloatSize = 24;
3
13
  static VertexByteSize = this.VertexFloatSize * 4;
@@ -1,2 +1 @@
1
1
  export * from "./Primitives/index";
2
- export * from "./Tools/index.js";
@@ -1,2 +1 @@
1
1
  export * from "./Primitives/index";
2
- export * from "./Tools/index.js";
@@ -1,8 +1,6 @@
1
- import { RenderedMaterials } from "./RenderedMaterials";
1
+ import { RenderedMaterials } from "./Models/RenderedMaterials";
2
2
  import { VoxelModelConstructorRegister } from "./Models/VoxelModelConstructorRegister.js";
3
3
  import { LiquidGeometryNode } from "./Models/Nodes/Custom/Liquid/LiquidGeomtryNode.js";
4
- import { SchemaRegister } from "../Voxels/State/SchemaRegister.js";
5
- import { VoxelTagStates } from "../Voxels/State/VoxelTagStates.js";
6
4
  import { VoxelConstructor } from "./Models/VoxelConstructor.js";
7
5
  export default function (materials, modelData) {
8
6
  RenderedMaterials.register(materials);
@@ -10,14 +8,7 @@ export default function (materials, modelData) {
10
8
  VoxelModelConstructorRegister.setGeometryPalette(modelData.geometryPalette);
11
9
  VoxelModelConstructorRegister.registerGeometry(modelData.geometry);
12
10
  VoxelModelConstructorRegister.registerModels(modelData.models);
13
- for (const model of modelData.models) {
14
- SchemaRegister.registerModel(model.id, model.schema);
15
- }
16
- for (const voxel of modelData.voxels) {
17
- SchemaRegister.registerVoxel(voxel.id, voxel.modelId, voxel.modSchema);
18
- }
19
- VoxelTagStates.load(modelData.tagState);
20
11
  for (const voxel of modelData.voxels) {
21
- VoxelModelConstructorRegister.registerVoxel(new VoxelConstructor(voxel.id, VoxelModelConstructorRegister.modelData.get(voxel.modelId), voxel));
12
+ VoxelModelConstructorRegister.registerVoxel(new VoxelConstructor(voxel.id, RenderedMaterials.meshersMap.get(voxel.materialId), VoxelModelConstructorRegister.modelData.get(voxel.modelId), voxel));
22
13
  }
23
14
  }
@@ -1,43 +1,31 @@
1
1
  import { Threads } from "@amodx/threads";
2
2
  import { WorldRegister } from "../World/WorldRegister";
3
- import { WorldSpaces } from "../World/WorldSpaces";
4
3
  import { MeshSection } from "./Functions/MeshSection";
5
4
  import { TasksIds } from "../Tasks/TasksIds";
6
5
  export default function (rendererThread) {
7
6
  Threads.registerTask(TasksIds.BuildSection, (location) => {
8
- const section = MeshSection(location);
7
+ const transfers = [];
8
+ const section = MeshSection(location, transfers);
9
9
  if (!section)
10
10
  return;
11
- rendererThread.runTask("set-section", section[0], section[1]);
11
+ rendererThread.runTask("set-section", section, transfers);
12
12
  });
13
13
  Threads.registerTask(TasksIds.BuildSector, (location) => {
14
- const sectorPosition = WorldSpaces.sector.getPosition(location[1], location[2], location[3]);
15
- const sector = WorldRegister.sectors.get(location[0], sectorPosition.x, sectorPosition.y, sectorPosition.z);
14
+ const sector = WorldRegister.sectors.getAt(location);
16
15
  if (!sector) {
17
- console.warn("Tried building a sector that does not exists.", [
18
- sectorPosition.x,
19
- sectorPosition.y,
20
- sectorPosition.z,
21
- ]);
22
- return;
23
- }
24
- if (sector.sections.length == 0) {
25
- console.warn("Tried building a sector with no sections.", sector.position);
16
+ console.warn("Tried building a sector that does not exists.", location);
26
17
  return;
27
18
  }
28
19
  for (let i = 0; i < sector.sections.length; i++) {
29
20
  const section = sector.sections[i];
30
- if (!section)
21
+ let [minY, maxY] = section.getMinMax();
22
+ if (Math.abs(minY) == Infinity && Math.abs(maxY) == Infinity)
31
23
  continue;
32
- const sectionMesh = MeshSection([
33
- location[0],
34
- sector.position[0],
35
- sector.position[1] + i * WorldSpaces.section.bounds.y,
36
- sector.position[2],
37
- ]);
24
+ const transfers = [];
25
+ const sectionMesh = MeshSection([location[0], ...section.getPosition()], transfers);
38
26
  if (!sectionMesh)
39
27
  continue;
40
- rendererThread.runTask("set-section", sectionMesh[0], sectionMesh[1]);
28
+ rendererThread.runTask("set-section", sectionMesh, transfers);
41
29
  }
42
30
  });
43
31
  }
@@ -1,4 +1,2 @@
1
- import { Vec3Array, Vector3Like } from "@amodx/math";
2
- import { VoxelMesherDataTool } from "../../../Mesher/Tools/VoxelMesherDataTool";
3
- export declare function UpdateBounds(tool: VoxelMesherDataTool, origin: Vector3Like, bounds: [Vec3Array, Vec3Array]): void;
1
+ import { Vec3Array } from "@amodx/math";
4
2
  export declare function GetBounds(vectors: Vec3Array[]): [Vec3Array, Vec3Array];
@@ -1,19 +1,3 @@
1
- export function UpdateBounds(tool, origin, bounds) {
2
- //min
3
- if (origin.x + bounds[0][0] < tool.bounds.min[0])
4
- tool.bounds.min[0] = origin.x + bounds[0][0];
5
- if (origin.y + bounds[0][1] < tool.bounds.min[1])
6
- tool.bounds.min[1] = origin.y + bounds[0][1];
7
- if (origin.z + bounds[0][2] < tool.bounds.min[2])
8
- tool.bounds.min[2] = origin.z + bounds[0][2];
9
- //max
10
- if (origin.x + bounds[1][0] > tool.bounds.max[0])
11
- tool.bounds.max[0] = origin.x + bounds[1][0];
12
- if (origin.y + bounds[1][1] > tool.bounds.max[1])
13
- tool.bounds.max[1] = origin.y + bounds[1][1];
14
- if (origin.z + bounds[1][2] > tool.bounds.max[2])
15
- tool.bounds.max[2] = origin.z + bounds[1][2];
16
- }
17
1
  export function GetBounds(vectors) {
18
2
  let minX = Infinity;
19
3
  let minY = Infinity;
@@ -2,7 +2,6 @@ import { QuadVerticies, QuadVerticiesArray, } from "../../../Geomtry/Geometry.ty
2
2
  import { VoxelFaces, VoxelFacesArray } from "../../../../Math";
3
3
  import { VoxelRelativeCubeIndex } from "../../../../Models/Indexing/VoxelRelativeCubeIndex";
4
4
  import { VoxelLightData } from "../../../../Voxels/Cursor/VoxelLightData";
5
- const lightData = new VoxelLightData();
6
5
  export const GradientCheckSets = [];
7
6
  GradientCheckSets[VoxelFaces.Up] = [];
8
7
  GradientCheckSets[VoxelFaces.Up][QuadVerticies.TopRight] = [
@@ -311,37 +310,21 @@ export function getVertexWeights(face, x, y, z) {
311
310
  }
312
311
  return getInterpolationWeights(u, v, flip);
313
312
  }
314
- const lightValues1 = [0, 0, 0, 0];
315
- const lightValues2 = [0, 0, 0, 0];
316
- const lightValues3 = [0, 0, 0, 0];
317
- const lightValues4 = [0, 0, 0, 0];
318
- const lightValues5 = [0, 0, 0, 0];
313
+ const lightData = new VoxelLightData();
319
314
  export function getInterpolationValue(value, weights) {
320
- lightData.getLightValuesToRef(value[0], lightValues1);
321
- lightData.getLightValuesToRef(value[1], lightValues2);
322
- lightData.getLightValuesToRef(value[2], lightValues3);
323
- lightData.getLightValuesToRef(value[3], lightValues4);
324
- lightValues5[0] =
325
- lightValues1[0] * weights[0] +
326
- lightValues2[0] * weights[1] +
327
- lightValues3[0] * weights[2] +
328
- lightValues4[0] * weights[3];
329
- lightValues5[1] =
330
- lightValues1[1] * weights[0] +
331
- lightValues2[1] * weights[1] +
332
- lightValues3[1] * weights[2] +
333
- lightValues4[1] * weights[3];
334
- lightValues5[2] =
335
- lightValues1[2] * weights[0] +
336
- lightValues2[2] * weights[1] +
337
- lightValues3[2] * weights[2] +
338
- lightValues4[2] * weights[3];
339
- lightValues5[3] =
340
- lightValues1[3] * weights[0] +
341
- lightValues2[3] * weights[1] +
342
- lightValues3[3] * weights[2] +
343
- lightValues4[3] * weights[3];
344
- return lightData.setLightValues(lightValues5);
315
+ return lightData.createLightValue(lightData.getS(value[0]) * weights[0] +
316
+ lightData.getS(value[1]) * weights[1] +
317
+ lightData.getS(value[2]) * weights[2] +
318
+ lightData.getS(value[3]) * weights[3], lightData.getR(value[0]) * weights[0] +
319
+ lightData.getR(value[1]) * weights[1] +
320
+ lightData.getR(value[2]) * weights[2] +
321
+ lightData.getR(value[3]) * weights[3], lightData.getG(value[0]) * weights[0] +
322
+ lightData.getG(value[1]) * weights[1] +
323
+ lightData.getG(value[2]) * weights[2] +
324
+ lightData.getG(value[3]) * weights[3], lightData.getB(value[0]) * weights[0] +
325
+ lightData.getB(value[1]) * weights[1] +
326
+ lightData.getB(value[2]) * weights[2] +
327
+ lightData.getB(value[3]) * weights[3]);
345
328
  }
346
329
  export const addQuadWeights = (quad, direction) => {
347
330
  const returnArray = [];
@@ -1,9 +1,3 @@
1
- import type { VoxelMesherDataTool } from "../../../../Mesher/Tools/VoxelMesherDataTool.js";
1
+ import type { VoxelModelBuilder } from "../../VoxelModelBuilder.js";
2
2
  import { VoxelFaces } from "../../../../Math/index.js";
3
- export declare const FaceDataCalc: {
4
- settings: {
5
- doAO: boolean;
6
- doLight: boolean;
7
- };
8
- calculate(face: VoxelFaces, tool: VoxelMesherDataTool): void;
9
- };
3
+ export default function calculateFaceData(face: VoxelFaces, builder: VoxelModelBuilder): void;
@@ -2,56 +2,54 @@ import { VoxelFaceDirections } from "../../../../Math/index.js";
2
2
  import { GradientCheckSets } from "./CalcConstants.js";
3
3
  import { VoxelLightData } from "../../../../Voxels/Cursor/VoxelLightData.js";
4
4
  const lightData = new VoxelLightData();
5
- const currentLightValues = new Uint16Array([0, 0, 0, 0]);
6
- const loadedLightValues = new Uint16Array([0, 0, 0, 0]);
7
- const faceLength = 9 * 4;
8
- const settings = {
9
- doAO: true,
10
- doLight: true,
11
- };
12
- export const FaceDataCalc = {
13
- settings,
14
- calculate(face, tool) {
15
- let light = tool.voxel.getLight();
16
- const faceNormal = VoxelFaceDirections[face];
17
- const nVoxel = tool.nVoxel.getVoxel(tool.position.x + faceNormal[0], tool.position.y + faceNormal[1], tool.position.z + faceNormal[2]);
18
- const otherLight = nVoxel?.getLight() || 0;
19
- light = otherLight >= 0 ? otherLight : light >= 0 ? light : 0;
20
- for (let vertex = 0; vertex < 4; vertex++) {
21
- if (settings.doLight) {
22
- tool.lightData[face][vertex] = light;
23
- lightData.getLightValuesToRef(light, currentLightValues);
24
- }
25
- for (let i = 0; i < 9; i += 3) {
26
- const loadedVoxel = tool.nVoxel.getVoxel(GradientCheckSets[face][vertex][i] + tool.position.x, GradientCheckSets[face][vertex][i + 1] + tool.position.y, GradientCheckSets[face][vertex][i + 2] + tool.position.z);
27
- if (!settings.doLight || !loadedVoxel)
28
- continue;
29
- const nl = loadedVoxel.getLight();
30
- if (nl <= 0)
31
- continue;
32
- /*
33
- Do Light
34
- */
35
- lightData.getLightValuesToRef(nl, loadedLightValues);
36
- currentLightValues[0] =
37
- currentLightValues[0] < loadedLightValues[0]
38
- ? loadedLightValues[0]
39
- : currentLightValues[0];
40
- currentLightValues[1] =
41
- currentLightValues[1] < loadedLightValues[1]
42
- ? loadedLightValues[1]
43
- : currentLightValues[1];
44
- currentLightValues[2] =
45
- currentLightValues[2] < loadedLightValues[2]
46
- ? loadedLightValues[2]
47
- : currentLightValues[2];
48
- currentLightValues[3] =
49
- currentLightValues[3] < loadedLightValues[3]
50
- ? loadedLightValues[3]
51
- : currentLightValues[3];
52
- }
53
- tool.lightData[face][vertex] =
54
- lightData.setLightValues(currentLightValues);
5
+ export default function calculateFaceData(face, builder) {
6
+ const x = builder.position.x;
7
+ const y = builder.position.y;
8
+ const z = builder.position.z;
9
+ const vertexData = builder.lightData[face];
10
+ const nVoxel = builder.nVoxel;
11
+ const checkSet = GradientCheckSets[face];
12
+ let startLight = 0;
13
+ if (builder.voxel.isLightSource()) {
14
+ startLight = builder.voxel.getLightSourceValue();
15
+ }
16
+ else {
17
+ startLight =
18
+ nVoxel
19
+ .getVoxel(x + VoxelFaceDirections[face][0], y + VoxelFaceDirections[face][1], z + VoxelFaceDirections[face][2])
20
+ ?.getLight() || 0;
21
+ }
22
+ if (startLight < 0)
23
+ startLight = 0;
24
+ const startS = lightData.getS(startLight);
25
+ const startR = lightData.getR(startLight);
26
+ const startG = lightData.getG(startLight);
27
+ const startB = lightData.getB(startLight);
28
+ for (let vertex = 0; vertex < 4; vertex++) {
29
+ vertexData[vertex] = startLight;
30
+ let s = startS;
31
+ let r = startR;
32
+ let g = startG;
33
+ let b = startB;
34
+ for (let i = 0; i < 9; i += 3) {
35
+ const nl = nVoxel
36
+ .getVoxel(checkSet[vertex][i] + x, checkSet[vertex][i + 1] + y, checkSet[vertex][i + 2] + z)
37
+ ?.getLight() || -1;
38
+ if (nl <= 0)
39
+ continue;
40
+ let ns = lightData.getS(nl);
41
+ let nr = lightData.getR(nl);
42
+ let ng = lightData.getG(nl);
43
+ let nb = lightData.getB(nl);
44
+ if (s < ns)
45
+ s = ns;
46
+ if (r < nr)
47
+ r = nr;
48
+ if (g < ng)
49
+ g = ng;
50
+ if (b < nb)
51
+ b = nb;
55
52
  }
56
- },
57
- };
53
+ vertexData[vertex] = lightData.createLightValue(s, r, g, b);
54
+ }
55
+ }
@@ -1,4 +1,4 @@
1
- import type { VoxelMesherDataTool } from "../../../../../Mesher/Tools/VoxelMesherDataTool";
1
+ import type { VoxelModelBuilder } from "../../../VoxelModelBuilder";
2
2
  import { QuadScalarVertexData } from "../../../../Geomtry/Primitives/QuadVertexData";
3
3
  import { CompassAngles } from "@amodx/math";
4
4
  export declare enum FlowVerticies {
@@ -8,4 +8,4 @@ export declare enum FlowVerticies {
8
8
  SouthEsat = 3
9
9
  }
10
10
  export declare function getFlowAngle(vertexLevel: QuadScalarVertexData): [angle: CompassAngles, flow: number];
11
- export declare function getFlowGradient(tool: VoxelMesherDataTool, flowStates: QuadScalarVertexData): QuadScalarVertexData;
11
+ export declare function getFlowGradient(tool: VoxelModelBuilder, flowStates: QuadScalarVertexData): QuadScalarVertexData;
@@ -66,7 +66,7 @@ const returnData = [
66
66
  export function getFlowAngle(vertexLevel) {
67
67
  if (vertexLevel.isAllEqualTo(7)) {
68
68
  returnData[0] = 0;
69
- returnData[1] = FlowStates.None;
69
+ returnData[1] = FlowStates.Up;
70
70
  return returnData;
71
71
  }
72
72
  const upRight = vertexLevel.vertices[QuadVerticies.TopRight];
@@ -1,15 +1,11 @@
1
- import { Vector3Like } from "@amodx/math";
2
- import { VoxelMesherDataTool } from "Mesher/Tools/VoxelMesherDataTool";
3
1
  import { GeoemtryNode } from "../../GeometryNode";
4
2
  import { VoxelCustomGeomtryNode } from "../../../../../Models/VoxelModel.types";
5
- import { QuadScalarVertexData } from "../../../../Geomtry/Primitives/QuadVertexData";
6
3
  import { VoxelFaces } from "../../../../../Math";
7
4
  import type { LiquidVoxelModelArgs } from "../../../../../Models/Defaults/LiquidVoxelModel";
8
5
  export declare class LiquidGeometryNode extends GeoemtryNode<VoxelCustomGeomtryNode, LiquidVoxelModelArgs> {
9
- worldLight: QuadScalarVertexData;
10
6
  init(): void;
11
7
  isExposed(face: VoxelFaces): boolean;
12
8
  determineShading(face: VoxelFaces): void;
13
9
  shouldFlip(): boolean;
14
- add(tool: VoxelMesherDataTool, originHash: number, origin: Vector3Like, args: LiquidVoxelModelArgs): void;
10
+ add(args: LiquidVoxelModelArgs): boolean;
15
11
  }
@@ -4,7 +4,6 @@ import { Quad } from "../../../../Geomtry/Primitives/Quad";
4
4
  import { QuadVerticies } from "../../../../Geomtry/Geometry.types";
5
5
  import { QuadScalarVertexData } from "../../../../Geomtry/Primitives/QuadVertexData";
6
6
  import { VoxelFaceDirections, VoxelFaces } from "../../../../../Math";
7
- import { UpdateBounds } from "../../../Common/BoundsFunctions";
8
7
  import { shouldCauseFlip } from "../../../Common/Calc/CalcConstants";
9
8
  import { getFlowAngle, getFlowGradient, FlowVerticies } from "./FlowGradient";
10
9
  import { GetBoxGeometryNodeData } from "../../../Common/BoxGeometryNode";
@@ -37,44 +36,43 @@ const { quads: Quads, vertexWeights, quadBounds, } = GetBoxGeometryNodeData([
37
36
  Quads[VoxelFaces.Up].setUVs(uvs);
38
37
  Quads[VoxelFaces.Down].setUVs(uvs);
39
38
  export class LiquidGeometryNode extends GeoemtryNode {
40
- worldLight;
41
39
  init() {
42
40
  this.faceCount = 1;
43
41
  this.vertexCount = 0;
44
42
  }
45
43
  isExposed(face) {
46
- const nv = this.tool.nVoxel.getVoxel(VoxelFaceDirections[face][0] + this.tool.position.x, VoxelFaceDirections[face][1] + this.tool.position.y, VoxelFaceDirections[face][2] + this.tool.position.z);
44
+ const nv = this.builder.nVoxel.getVoxel(VoxelFaceDirections[face][0] + this.builder.position.x, VoxelFaceDirections[face][1] + this.builder.position.y, VoxelFaceDirections[face][2] + this.builder.position.z);
47
45
  if (!nv ||
48
46
  nv.isAir() ||
49
- (!this.tool.voxel.isSameVoxel(nv) && face == VoxelFaces.Up))
47
+ (!this.builder.voxel.isSameVoxel(nv) && face == VoxelFaces.Up))
50
48
  return true;
51
49
  return false;
52
50
  }
53
51
  determineShading(face) {
54
- const tool = this.tool;
55
- const lightData = tool.lightData[face];
56
- const worldLight = this.worldLight;
57
- for (let v = 0; v < 4; v++) {
58
- worldLight.vertices[v] = lightData[v];
59
- }
52
+ this.builder.calculateFaceData(face);
53
+ const lightData = this.builder.lightData[face];
54
+ const worldLight = this.builder.vars.light;
55
+ worldLight.vertices[0] = lightData[0];
56
+ worldLight.vertices[1] = lightData[1];
57
+ worldLight.vertices[2] = lightData[2];
58
+ worldLight.vertices[3] = lightData[3];
60
59
  }
61
60
  shouldFlip() {
62
- return (shouldCauseFlip(lightData.getS(this.worldLight.vertices[0]), lightData.getS(this.worldLight.vertices[1]), lightData.getS(this.worldLight.vertices[2]), lightData.getS(this.worldLight.vertices[3])) ||
63
- shouldCauseFlip(lightData.sumRGB(this.worldLight.vertices[0]), lightData.sumRGB(this.worldLight.vertices[1]), lightData.sumRGB(this.worldLight.vertices[2]), lightData.sumRGB(this.worldLight.vertices[3])));
61
+ const worldLight = this.builder.vars.light;
62
+ return (shouldCauseFlip(lightData.getS(worldLight.vertices[0]), lightData.getS(worldLight.vertices[1]), lightData.getS(worldLight.vertices[2]), lightData.getS(worldLight.vertices[3])) ||
63
+ shouldCauseFlip(lightData.sumRGB(worldLight.vertices[0]), lightData.sumRGB(worldLight.vertices[1]), lightData.sumRGB(worldLight.vertices[2]), lightData.sumRGB(worldLight.vertices[3])));
64
64
  }
65
- add(tool, originHash, origin, args) {
65
+ add(args) {
66
66
  vertexLevel.setAll(15);
67
67
  vertexValue.setAll(0);
68
- this.tool = tool;
69
- this.tool = tool;
70
- this.origin = tool.position;
71
- this.worldLight = tool.vars.light;
68
+ const tool = this.builder;
69
+ let added = false;
72
70
  let upFaceExposed = false;
73
71
  if (this.isExposed(VoxelFaces.Up)) {
74
72
  upFaceExposed = true;
73
+ added = true;
75
74
  getFlowGradient(tool, vertexLevel);
76
75
  const quad = Quads[VoxelFaces.Up];
77
- tool.calculateFaceData(VoxelFaces.Up);
78
76
  this.determineShading(VoxelFaces.Up);
79
77
  quad.flip = this.shouldFlip();
80
78
  tool.vars.textureIndex = args.stillTexture;
@@ -94,24 +92,23 @@ export class LiquidGeometryNode extends GeoemtryNode {
94
92
  quad.positions.vertices[1].y = vertexValue.vertices[1] * waterHeight;
95
93
  quad.positions.vertices[2].y = vertexValue.vertices[2] * waterHeight;
96
94
  quad.positions.vertices[3].y = vertexValue.vertices[3] * waterHeight;
97
- VoxelGeometryBuilder.addQuad(tool, origin, quad);
98
- UpdateBounds(tool, origin, quadBounds[VoxelFaces.Up]);
95
+ VoxelGeometryBuilder.addQuad(tool, tool.origin, quad);
96
+ tool.updateBounds(quadBounds[VoxelFaces.Up]);
99
97
  }
100
98
  if (this.isExposed(VoxelFaces.Down)) {
99
+ added = true;
101
100
  tool.vars.textureIndex = args.stillTexture;
102
101
  const quad = Quads[VoxelFaces.Down];
103
- tool.calculateFaceData(VoxelFaces.Down);
104
102
  this.determineShading(VoxelFaces.Down);
105
103
  quad.flip = this.shouldFlip();
106
- tool.vars.textureIndex = args.stillTexture;
107
- VoxelGeometryBuilder.addQuad(tool, origin, quad);
108
- UpdateBounds(tool, origin, quadBounds[VoxelFaces.Down]);
104
+ VoxelGeometryBuilder.addQuad(tool, tool.origin, quad);
105
+ tool.updateBounds(quadBounds[VoxelFaces.Down]);
109
106
  }
110
107
  if (this.isExposed(VoxelFaces.North)) {
111
- tool.vars.textureIndex = args.stillTexture;
108
+ added = true;
109
+ tool.vars.textureIndex = args.flowTexture;
112
110
  const quad = Quads[VoxelFaces.North];
113
111
  tool.vars.animation.setAll(1);
114
- tool.calculateFaceData(VoxelFaces.North);
115
112
  this.determineShading(VoxelFaces.North);
116
113
  quad.flip = this.shouldFlip();
117
114
  if (upFaceExposed) {
@@ -129,14 +126,14 @@ export class LiquidGeometryNode extends GeoemtryNode {
129
126
  quad.positions.vertices[QuadVerticies.TopLeft].y = 1;
130
127
  quad.setUVs(uvs);
131
128
  }
132
- VoxelGeometryBuilder.addQuad(tool, origin, quad);
133
- UpdateBounds(tool, origin, quadBounds[VoxelFaces.North]);
129
+ VoxelGeometryBuilder.addQuad(tool, tool.origin, quad);
130
+ tool.updateBounds(quadBounds[VoxelFaces.North]);
134
131
  }
135
132
  if (this.isExposed(VoxelFaces.South)) {
136
- tool.vars.textureIndex = args.stillTexture;
133
+ added = true;
134
+ tool.vars.textureIndex = args.flowTexture;
137
135
  const quad = Quads[VoxelFaces.South];
138
136
  tool.vars.animation.setAll(1);
139
- tool.calculateFaceData(VoxelFaces.South);
140
137
  this.determineShading(VoxelFaces.South);
141
138
  quad.flip = this.shouldFlip();
142
139
  if (upFaceExposed) {
@@ -154,16 +151,16 @@ export class LiquidGeometryNode extends GeoemtryNode {
154
151
  quad.positions.vertices[QuadVerticies.TopRight].y = 1;
155
152
  quad.setUVs(uvs);
156
153
  }
157
- VoxelGeometryBuilder.addQuad(tool, origin, quad);
158
- UpdateBounds(tool, origin, quadBounds[VoxelFaces.South]);
154
+ VoxelGeometryBuilder.addQuad(tool, tool.origin, quad);
155
+ tool.updateBounds(quadBounds[VoxelFaces.South]);
159
156
  }
160
157
  if (this.isExposed(VoxelFaces.East)) {
161
- tool.vars.textureIndex = args.stillTexture;
158
+ added = true;
159
+ tool.vars.textureIndex = args.flowTexture;
162
160
  const quad = Quads[VoxelFaces.East];
163
161
  tool.vars.animation.setAll(1);
164
- tool.calculateFaceData(VoxelFaces.East);
165
162
  this.determineShading(VoxelFaces.East);
166
- // quad.flip = this.shouldFlip();
163
+ quad.flip = this.shouldFlip();
167
164
  if (upFaceExposed) {
168
165
  quad.positions.vertices[QuadVerticies.TopRight].y =
169
166
  vertexValue.vertices[FlowVerticies.NorthEast] * waterHeight;
@@ -179,14 +176,14 @@ export class LiquidGeometryNode extends GeoemtryNode {
179
176
  quad.positions.vertices[QuadVerticies.TopRight].y = 1;
180
177
  quad.setUVs(uvs);
181
178
  }
182
- VoxelGeometryBuilder.addQuad(tool, origin, quad);
183
- UpdateBounds(tool, origin, quadBounds[VoxelFaces.East]);
179
+ VoxelGeometryBuilder.addQuad(tool, tool.origin, quad);
180
+ tool.updateBounds(quadBounds[VoxelFaces.East]);
184
181
  }
185
182
  if (this.isExposed(VoxelFaces.West)) {
186
- tool.vars.textureIndex = args.stillTexture;
183
+ added = true;
184
+ tool.vars.textureIndex = args.flowTexture;
187
185
  const quad = Quads[VoxelFaces.West];
188
186
  tool.vars.animation.setAll(1);
189
- tool.calculateFaceData(VoxelFaces.West);
190
187
  this.determineShading(VoxelFaces.West);
191
188
  quad.flip = this.shouldFlip();
192
189
  if (upFaceExposed) {
@@ -204,9 +201,10 @@ export class LiquidGeometryNode extends GeoemtryNode {
204
201
  quad.positions.vertices[QuadVerticies.TopRight].y = 1;
205
202
  quad.setUVs(uvs);
206
203
  }
207
- VoxelGeometryBuilder.addQuad(tool, origin, quad);
208
- UpdateBounds(tool, origin, quadBounds[VoxelFaces.West]);
204
+ VoxelGeometryBuilder.addQuad(tool, tool.origin, quad);
205
+ tool.updateBounds(quadBounds[VoxelFaces.West]);
209
206
  }
210
- this.worldLight.setAll(0);
207
+ this.builder.vars.light.setAll(0);
208
+ return added;
211
209
  }
212
210
  }
@@ -1,5 +1,4 @@
1
- import { VoxelMesherDataTool } from "../../../Mesher/Tools/VoxelMesherDataTool";
2
- import { Vector3Like } from "@amodx/math";
1
+ import { VoxelModelBuilder } from "../VoxelModelBuilder";
3
2
  import { VoxelGeometryConstructor } from "./VoxelGeometryConstructor";
4
3
  import { VoxelGeometryTransform } from "../../../Voxels/Types/VoxelModelCompiledData.types";
5
4
  export interface GeoemtryNodeConstructor<Data = any, Args = any> {
@@ -14,9 +13,8 @@ export declare abstract class GeoemtryNode<Data = any, Args = any> {
14
13
  vertexIndex: number;
15
14
  faceCount: number;
16
15
  vertexCount: number;
17
- tool: VoxelMesherDataTool;
18
- origin: Vector3Like;
16
+ builder: VoxelModelBuilder;
19
17
  constructor(geometryPaletteId: number, geomtry: VoxelGeometryConstructor, data: Data, transform: VoxelGeometryTransform);
20
18
  abstract init(): void;
21
- abstract add(tool: VoxelMesherDataTool, originHash: number, origin: Vector3Like, args: Args): void;
19
+ abstract add(args: Args): boolean;
22
20
  }
@@ -7,8 +7,7 @@ export class GeoemtryNode {
7
7
  vertexIndex = -1;
8
8
  faceCount = -1;
9
9
  vertexCount = -1;
10
- tool;
11
- origin;
10
+ builder;
12
11
  constructor(geometryPaletteId, geomtry, data, transform) {
13
12
  this.geometryPaletteId = geometryPaletteId;
14
13
  this.geomtry = geomtry;