@divinevoxel/vlox 0.0.73 → 0.0.74

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 (217) hide show
  1. package/Contexts/Base/Remote/InitDataSync.js +4 -0
  2. package/Contexts/Base/Remote/InitWorldDataSync.js +1 -1
  3. package/Contexts/Render/DivineVoxelEngineRender.d.ts +1 -0
  4. package/Contexts/World/DivineVoxelEngineWorld.d.ts +1 -0
  5. package/Init/StartConstructor.js +2 -0
  6. package/Math/index.d.ts +5 -1
  7. package/Mesher/Functions/CompactVoxelSectionMesh.d.ts +4 -0
  8. package/Mesher/Functions/CompactVoxelSectionMesh.js +112 -0
  9. package/Mesher/Functions/MeshSection.d.ts +1 -1
  10. package/Mesher/Functions/MeshSection.js +15 -22
  11. package/Mesher/Geomtry/CompactedSectionVoxelMesh.d.ts +23 -0
  12. package/Mesher/Geomtry/CompactedSectionVoxelMesh.js +144 -0
  13. package/Mesher/Geomtry/VoxelGeometryBuilder.d.ts +1 -1
  14. package/Mesher/Geomtry/VoxelGeometryBuilder.js +118 -197
  15. package/Mesher/Geomtry/VoxelMesh.js +2 -2
  16. package/Mesher/Geomtry/VoxelMeshBVHBuilder.d.ts +8 -70
  17. package/Mesher/Geomtry/VoxelMeshBVHBuilder.js +18 -183
  18. package/Mesher/Geomtry/VoxelMeshBVHStructCursor.d.ts +22 -0
  19. package/Mesher/Geomtry/VoxelMeshBVHStructCursor.js +78 -0
  20. package/Mesher/Geomtry/VoxelMeshBuffers.js +2 -2
  21. package/Mesher/InitTask.js +5 -1
  22. package/Mesher/Models/Common/BoxGeometryNode.js +7 -7
  23. package/Mesher/Models/Common/Calc/CalcConstants.d.ts +1 -1
  24. package/Mesher/Models/Common/Calc/CalcConstants.js +1 -1
  25. package/Mesher/Models/Common/QuadGeometryNode.js +2 -2
  26. package/Mesher/Models/Nodes/Custom/Liquid/LiquidGeomtryNode.js +7 -7
  27. package/Mesher/Models/Nodes/Ruled/BoxVoxelGeometryNode.js +22 -25
  28. package/Mesher/Models/Nodes/Ruled/QuadVoxelGeometryNode.js +2 -2
  29. package/Mesher/Models/Nodes/Ruleless/RulelessBoxVoxelGeometryNode.js +2 -2
  30. package/Mesher/Models/Nodes/Ruleless/RulelessQuadVoxelGeometryNode.js +2 -2
  31. package/Mesher/Models/VoxelConstructor.d.ts +3 -3
  32. package/Mesher/Models/VoxelConstructor.js +8 -8
  33. package/Mesher/Models/VoxelGeometryBuilderCacheSpace.d.ts +2 -2
  34. package/Mesher/Models/VoxelGeometryBuilderCacheSpace.js +8 -9
  35. package/Mesher/Models/VoxelModelBuilder.js +1 -8
  36. package/Mesher/Types/Mesher.types.d.ts +1 -0
  37. package/Models/Defaults/CubeVoxelModels.js +16 -39
  38. package/Models/Defaults/LiquidVoxelModel.js +3 -3
  39. package/Models/Defaults/PanelVoxelModels.js +10 -36
  40. package/Models/Defaults/StairVoxelModel.js +6 -21
  41. package/Models/Examples.js +23 -44
  42. package/Models/Rules/Classes/VoxelRulesModel.d.ts +1 -1
  43. package/Models/Rules/Classes/VoxelRulesModel.js +3 -3
  44. package/Models/Rules/Functions/BuildFinalInputs.d.ts +1 -1
  45. package/Models/Rules/Functions/BuildFinalInputs.js +13 -13
  46. package/Models/Rules/VoxelModelRuleBuilderRegister.js +8 -8
  47. package/Models/VoxelModel.types.d.ts +3 -3
  48. package/Renderer/Classes/DVESectionMeshes.d.ts +2 -3
  49. package/Renderer/InitTasks.js +1 -9
  50. package/Renderer/MeshManager.d.ts +1 -1
  51. package/Renderer/MeshManager.js +24 -23
  52. package/Renderer/MeshRegister.d.ts +5 -5
  53. package/Renderer/MeshRegister.js +2 -2
  54. package/Settings/EngineSettings.d.ts +1 -0
  55. package/Settings/EngineSettings.js +6 -3
  56. package/Settings/EngineSettings.types.d.ts +7 -21
  57. package/Settings/EngineSettings.types.js +6 -14
  58. package/Tasks/Logic/InitTasks.d.ts +1 -0
  59. package/Tasks/Logic/InitTasks.js +10 -0
  60. package/Tasks/Logic/VoxelLogicUpdate.d.ts +3 -0
  61. package/Tasks/Logic/VoxelLogicUpdate.js +71 -0
  62. package/Tasks/Propagation/Explosion/ExplosionManager.d.ts +2 -2
  63. package/Tasks/Propagation/Explosion/ExplosionManager.js +1 -2
  64. package/Tasks/Propagation/Flow/FlowManager.d.ts +4 -4
  65. package/Tasks/Propagation/Flow/FlowRemove.d.ts +2 -2
  66. package/Tasks/Propagation/Flow/FlowUpdate.d.ts +2 -2
  67. package/Tasks/Propagation/Flow/WorldFlow.d.ts +2 -2
  68. package/Tasks/Propagation/Illumanation/RGBUpdate.d.ts +3 -3
  69. package/Tasks/Propagation/Illumanation/SunUpdate.d.ts +3 -3
  70. package/Tasks/Propagation/Illumanation/WorldRGB.d.ts +2 -2
  71. package/Tasks/Propagation/Illumanation/WorldSun.d.ts +2 -2
  72. package/Tasks/Propagation/Illumanation/WorldSun.js +8 -15
  73. package/Tasks/Propagation/InitTasks.js +4 -4
  74. package/Tasks/Propagation/Power/PowerUpdate.d.ts +3 -0
  75. package/Tasks/Propagation/Power/PowerUpdate.js +80 -0
  76. package/Tasks/Tasks.types.d.ts +2 -2
  77. package/Tasks/TasksIds.d.ts +2 -1
  78. package/Tasks/TasksIds.js +1 -0
  79. package/Tasks/Update/Common.d.ts +3 -0
  80. package/Tasks/Update/Common.js +41 -0
  81. package/Tasks/Update/EreaseUpdate.d.ts +3 -0
  82. package/Tasks/Update/EreaseUpdate.js +66 -0
  83. package/Tasks/Update/InitTasks.d.ts +2 -2
  84. package/Tasks/Update/InitTasks.js +3 -1
  85. package/Tasks/Update/PaintUpdate.d.ts +3 -0
  86. package/Tasks/Update/PaintUpdate.js +89 -0
  87. package/Tasks/Update/VoxelUpdate.d.ts +2 -5
  88. package/Tasks/Update/VoxelUpdate.js +5 -147
  89. package/Tasks/{Update/UpdateTask.d.ts → VoxelUpdateTask.d.ts} +15 -7
  90. package/Tasks/{Update/UpdateTask.js → VoxelUpdateTask.js} +20 -7
  91. package/Tasks/WorldGeneration/WorldGenBrush.d.ts +3 -3
  92. package/Tasks/WorldGeneration/WorldGenBrush.js +2 -2
  93. package/Tasks/WorldGeneration/WorldGenRegister.d.ts +1 -1
  94. package/Templates/Functions/CreateTemplate.d.ts +1 -1
  95. package/Tools/Brush/AdvancedBrushTool.js +1 -1
  96. package/Tools/Brush/Brush.d.ts +2 -2
  97. package/Tools/Brush/Brush.js +1 -1
  98. package/Tools/Tasks/TasksTool.d.ts +1 -0
  99. package/Tools/Tasks/TasksTool.js +2 -0
  100. package/Util/Binary/BinaryBuffer.d.ts +17 -11
  101. package/Util/Binary/BinaryBuffer.js +65 -59
  102. package/Util/Binary/BinaryTree.d.ts +46 -0
  103. package/Util/Binary/BinaryTree.js +104 -0
  104. package/Voxels/Cursor/VoxelCursor.interface.d.ts +7 -2
  105. package/Voxels/Cursor/VoxelCursor.interface.js +46 -2
  106. package/Voxels/Cursor/VoxelLightData.js +1 -1
  107. package/Voxels/Data/VoxelTag.types.d.ts +17 -2
  108. package/Voxels/Data/VoxelTag.types.js +6 -1
  109. package/Voxels/Data/VoxelTagsRegister.js +5 -0
  110. package/Voxels/Functions/BuildStateData.d.ts +6 -6
  111. package/Voxels/Functions/BuildStateData.js +31 -31
  112. package/Voxels/Functions/BuildTagAndPaletteData.js +5 -0
  113. package/Voxels/Indexes/VoxelIndex.d.ts +2 -2
  114. package/Voxels/Indexes/VoxelIndex.js +16 -18
  115. package/Voxels/InitVoxelData.js +12 -8
  116. package/Voxels/Logic/Classes/Default/Types/VoxelPoweredLogicType.d.ts +5 -0
  117. package/Voxels/Logic/Classes/Default/Types/VoxelPoweredLogicType.js +6 -0
  118. package/Voxels/Logic/Classes/VoxelLogic.d.ts +11 -0
  119. package/Voxels/Logic/Classes/VoxelLogic.js +49 -0
  120. package/Voxels/Logic/Classes/VoxelLogicType.d.ts +4 -0
  121. package/Voxels/Logic/Classes/VoxelLogicType.js +2 -0
  122. package/Voxels/Logic/VoxelLogic.types.d.ts +23 -0
  123. package/Voxels/Logic/VoxelLogic.types.js +1 -0
  124. package/Voxels/Logic/VoxelLogicRegister.d.ts +9 -0
  125. package/Voxels/Logic/VoxelLogicRegister.js +15 -0
  126. package/Voxels/State/SchemaRegister.js +10 -5
  127. package/Voxels/State/State.types.d.ts +1 -1
  128. package/Voxels/State/StateTreeReader.d.ts +1 -1
  129. package/Voxels/State/StateTreeReader.js +2 -3
  130. package/Voxels/Types/Voxel.types.d.ts +3 -0
  131. package/Voxels/Types/VoxelModelCompiledData.types.d.ts +6 -4
  132. package/World/Archive/Archive.types.d.ts +31 -12
  133. package/World/Archive/Classes/ArchiveClasses.d.ts +66 -0
  134. package/World/Archive/Classes/ArchiveClasses.js +78 -0
  135. package/World/Archive/Classes/ImportedSection.d.ts +40 -0
  136. package/World/Archive/Classes/ImportedSection.js +307 -0
  137. package/World/Archive/Classes/ImportedSector.d.ts +23 -0
  138. package/World/Archive/Classes/ImportedSector.js +97 -0
  139. package/World/Archive/Functions/ArchiveArea.d.ts +1 -1
  140. package/World/Archive/Functions/ArchiveArea.js +39 -36
  141. package/World/Archive/Functions/ArchiveSector.js +210 -404
  142. package/World/Archive/Functions/CreateArchivedSection.d.ts +3 -0
  143. package/World/Archive/Functions/CreateArchivedSection.js +207 -0
  144. package/World/Archive/Functions/ImportSector.d.ts +1 -3
  145. package/World/Archive/Functions/ImportSector.js +13 -244
  146. package/World/Archive/Functions/RemoveDuplicates.d.ts +3 -0
  147. package/World/Archive/Functions/RemoveDuplicates.js +92 -0
  148. package/World/Archive/Functions/Shared.d.ts +2 -2
  149. package/World/Archive/Functions/Shared.js +15 -40
  150. package/World/Archive/InitTasks.js +7 -10
  151. package/World/Cursor/SectionCursor.d.ts +1 -1
  152. package/World/Cursor/SectorCursor.d.ts +1 -1
  153. package/World/Cursor/WorldCursor.d.ts +4 -3
  154. package/World/Cursor/WorldCursor.js +16 -13
  155. package/World/Cursor/WorldVoxelCursor.d.ts +0 -4
  156. package/World/Cursor/WorldVoxelCursor.js +23 -14
  157. package/World/Dimension/Dimension.d.ts +4 -1
  158. package/World/Dimension/Dimension.js +8 -1
  159. package/World/Section/Section.d.ts +17 -4
  160. package/World/Section/Section.js +68 -6
  161. package/World/Section/SectionState.d.ts +4 -2
  162. package/World/Section/SectionState.js +4 -2
  163. package/World/Sector/Sector.d.ts +7 -1
  164. package/World/Sector/Sector.js +37 -4
  165. package/World/Sector/SectorState.d.ts +3 -2
  166. package/World/Sector/SectorState.js +3 -2
  167. package/World/Types/WorldData.types.d.ts +2 -7
  168. package/World/WorldRegister.d.ts +9 -9
  169. package/World/WorldRegister.js +9 -6
  170. package/World/WorldSpaces.js +6 -6
  171. package/{Tasks/IWG → WorldSimulation}/Internal/Classes/DimensionSegment.d.ts +2 -2
  172. package/{Tasks/IWG → WorldSimulation}/Internal/Classes/Generator.d.ts +6 -4
  173. package/{Tasks/IWG → WorldSimulation}/Internal/Classes/Generator.js +9 -5
  174. package/WorldSimulation/Internal/Classes/Queues/BuildQueue.d.ts +5 -0
  175. package/WorldSimulation/Internal/Classes/Queues/BuildQueue.js +6 -0
  176. package/WorldSimulation/Internal/Classes/Queues/LogiccQueue.d.ts +5 -0
  177. package/WorldSimulation/Internal/Classes/Queues/LogiccQueue.js +6 -0
  178. package/{Tasks/IWG → WorldSimulation}/Internal/Classes/SectorVisistedMap.js +1 -1
  179. package/WorldSimulation/Internal/Classes/TickQueue.d.ts +12 -0
  180. package/{Tasks/IWG/Internal/Classes/BuildQueue.js → WorldSimulation/Internal/Classes/TickQueue.js} +16 -7
  181. package/WorldSimulation/Internal/Classes/WorldSimulationTaskBase.d.ts +15 -0
  182. package/{Tasks/IWG/Internal/Classes/IWGTaskBase.js → WorldSimulation/Internal/Classes/WorldSimulationTaskBase.js} +6 -6
  183. package/{Tasks/IWG → WorldSimulation}/Internal/Functions/cullSectors.js +9 -9
  184. package/{Tasks/IWG → WorldSimulation}/Internal/Functions/getSectorState.d.ts +1 -1
  185. package/{Tasks/IWG → WorldSimulation}/Internal/Functions/getSectorState.js +4 -4
  186. package/WorldSimulation/Internal/Functions/runTickUpdate.d.ts +2 -0
  187. package/{Tasks/IWG/Internal/Functions/runBuildUpdate.js → WorldSimulation/Internal/Functions/runTickUpdate.js} +29 -19
  188. package/{Tasks/IWG → WorldSimulation}/Internal/Functions/runWorldUpdate.js +13 -13
  189. package/{Tasks/IWG → WorldSimulation}/Internal/TaskRegister.d.ts +2 -2
  190. package/{Tasks/IWG → WorldSimulation}/Internal/TaskRegister.js +1 -1
  191. package/WorldSimulation/Internal/WorldSimulationDimensions.d.ts +6 -0
  192. package/{Tasks/IWG/Internal/IWGDimensions.js → WorldSimulation/Internal/WorldSimulationDimensions.js} +1 -1
  193. package/WorldSimulation/Internal/WorldSimulationTasks.d.ts +30 -0
  194. package/{Tasks/IWG/Internal/IWGTasks.js → WorldSimulation/Internal/WorldSimulationTasks.js} +14 -14
  195. package/WorldSimulation/Internal/WorldSimulationTools.d.ts +8 -0
  196. package/{Tasks/IWG/Internal/IWGTools.js → WorldSimulation/Internal/WorldSimulationTools.js} +1 -1
  197. package/{Tasks/IWG → WorldSimulation}/Procedures/InitalLoad.d.ts +1 -1
  198. package/{Tasks/IWG → WorldSimulation}/Procedures/InitalLoad.js +11 -11
  199. package/{Tasks/IWG → WorldSimulation}/Procedures/SaveAllSectors.js +5 -5
  200. package/{Tasks/IWG/IWG.d.ts → WorldSimulation/WorldSimulation.d.ts} +5 -5
  201. package/{Tasks/IWG/IWG.js → WorldSimulation/WorldSimulation.js} +21 -21
  202. package/{Tasks/IWG → WorldSimulation}/index.d.ts +1 -1
  203. package/{Tasks/IWG → WorldSimulation}/index.js +1 -1
  204. package/package.json +1 -1
  205. package/Tasks/IWG/Internal/Classes/BuildQueue.d.ts +0 -11
  206. package/Tasks/IWG/Internal/Classes/IWGTaskBase.d.ts +0 -15
  207. package/Tasks/IWG/Internal/Functions/runBuildUpdate.d.ts +0 -2
  208. package/Tasks/IWG/Internal/IWGDimensions.d.ts +0 -6
  209. package/Tasks/IWG/Internal/IWGTasks.d.ts +0 -30
  210. package/Tasks/IWG/Internal/IWGTools.d.ts +0 -8
  211. /package/{Tasks/IWG → WorldSimulation}/Internal/Classes/DimensionSegment.js +0 -0
  212. /package/{Tasks/IWG → WorldSimulation}/Internal/Classes/SectorState.d.ts +0 -0
  213. /package/{Tasks/IWG → WorldSimulation}/Internal/Classes/SectorState.js +0 -0
  214. /package/{Tasks/IWG → WorldSimulation}/Internal/Classes/SectorVisistedMap.d.ts +0 -0
  215. /package/{Tasks/IWG → WorldSimulation}/Internal/Functions/cullSectors.d.ts +0 -0
  216. /package/{Tasks/IWG → WorldSimulation}/Internal/Functions/runWorldUpdate.d.ts +0 -0
  217. /package/{Tasks/IWG → WorldSimulation}/Procedures/SaveAllSectors.d.ts +0 -0
@@ -0,0 +1,78 @@
1
+ export class VoxelMeshBVHStructCursor {
2
+ data;
3
+ get minX() {
4
+ return this.data[this.trueIndex];
5
+ }
6
+ get minY() {
7
+ return this.data[this.trueIndex + 1];
8
+ }
9
+ get minZ() {
10
+ return this.data[this.trueIndex + 2];
11
+ }
12
+ get maxX() {
13
+ return this.data[this.trueIndex + 4];
14
+ }
15
+ get maxY() {
16
+ return this.data[this.trueIndex + 5];
17
+ }
18
+ get maxZ() {
19
+ return this.data[this.trueIndex + 6];
20
+ }
21
+ get voxelIndex() {
22
+ return this.data[this.trueIndex + 3];
23
+ }
24
+ get active() {
25
+ return this.data[this.trueIndex + 3];
26
+ }
27
+ get nodeType() {
28
+ return this.data[this.trueIndex + 7];
29
+ }
30
+ trueIndex = 0;
31
+ index = 0;
32
+ setIndex(index) {
33
+ this.trueIndex = index * 8;
34
+ }
35
+ constructor(data) {
36
+ this.data = data;
37
+ }
38
+ setActive() {
39
+ this.data[this.trueIndex + 3] = 1;
40
+ }
41
+ setVoxelIndex(value) {
42
+ this.data[this.trueIndex + 3] = value;
43
+ }
44
+ setInnerNode() {
45
+ this.data[this.trueIndex + 7] = 1;
46
+ }
47
+ setGeomtryNode() {
48
+ this.data[this.trueIndex + 7] = 2;
49
+ }
50
+ updateMin(x, y, z) {
51
+ const ix = this.trueIndex;
52
+ const iy = this.trueIndex + 1;
53
+ const iz = this.trueIndex + 2;
54
+ if (x < this.data[ix] || this.data[ix] == -Infinity) {
55
+ this.data[ix] = x;
56
+ }
57
+ if (y < this.data[iy] || this.data[iy] == -Infinity) {
58
+ this.data[iy] = y;
59
+ }
60
+ if (z < this.data[iz] || this.data[iz] == -Infinity) {
61
+ this.data[iz] = z;
62
+ }
63
+ }
64
+ updateMax(x, y, z) {
65
+ const ix = this.trueIndex + 4;
66
+ const iy = this.trueIndex + 5;
67
+ const iz = this.trueIndex + 6;
68
+ if (x > this.data[ix] || this.data[ix] == -Infinity) {
69
+ this.data[ix] = x;
70
+ }
71
+ if (y > this.data[iy] || this.data[iy] == -Infinity) {
72
+ this.data[iy] = y;
73
+ }
74
+ if (z > this.data[iz] || this.data[iz] == -Infinity) {
75
+ this.data[iz] = z;
76
+ }
77
+ }
78
+ }
@@ -3,7 +3,7 @@ export class VoxelVertexBuffer {
3
3
  sectorVertexSize;
4
4
  _buffers = [];
5
5
  sectorSize = 0;
6
- constructor(vertexFloatSize, sectorVertexSize, startingSectorSize = 4) {
6
+ constructor(vertexFloatSize, sectorVertexSize, startingSectorSize = 8) {
7
7
  this.vertexFloatSize = vertexFloatSize;
8
8
  this.sectorVertexSize = sectorVertexSize;
9
9
  this.sectorSize = vertexFloatSize * sectorVertexSize;
@@ -28,7 +28,7 @@ export class VoxelVertexBuffer {
28
28
  export class VoxelIndiceBuffer {
29
29
  sectorSize;
30
30
  _buffers = [];
31
- constructor(sectorSize, startingSectorSize = 4) {
31
+ constructor(sectorSize, startingSectorSize = 8) {
32
32
  this.sectorSize = sectorSize;
33
33
  for (let i = 0; i < startingSectorSize; i++) {
34
34
  this._buffers.push(new Uint32Array(sectorSize));
@@ -10,7 +10,7 @@ export default function (rendererThread) {
10
10
  return;
11
11
  rendererThread.runTask("set-section", section, transfers);
12
12
  });
13
- Threads.registerTask(TasksIds.BuildSector, (location) => {
13
+ Threads.registerTask(TasksIds.BuildSector, (location, origin) => {
14
14
  const sector = WorldRegister.sectors.getAt(location);
15
15
  if (!sector) {
16
16
  console.warn("Tried building a sector that does not exists.", location);
@@ -21,11 +21,15 @@ export default function (rendererThread) {
21
21
  let [minY, maxY] = section.getMinMax();
22
22
  if (Math.abs(minY) == Infinity && Math.abs(maxY) == Infinity)
23
23
  continue;
24
+ const t = performance.now();
24
25
  const transfers = [];
25
26
  const sectionMesh = MeshSection([location[0], ...section.getPosition()], transfers);
26
27
  if (!sectionMesh)
27
28
  continue;
28
29
  rendererThread.runTask("set-section", sectionMesh, transfers);
30
+ const buildTime = performance.now() - t;
31
+ origin.runTask("add-build-time", buildTime);
32
+ console.log("BUILD TIME", buildTime);
29
33
  }
30
34
  });
31
35
  }
@@ -1,7 +1,7 @@
1
1
  import { Vector3Like } from "@amodx/math";
2
2
  import { VoxelFaces } from "../../../Math";
3
3
  import { Quad } from "../../Geomtry/Primitives/Quad";
4
- import { addQuadWeights } from "./Calc/CalcConstants";
4
+ import { getQuadWeights } from "./Calc/CalcConstants";
5
5
  import { TransformBox } from "../../../Models/Shared/Transform";
6
6
  import { GetBounds } from "./BoundsFunctions";
7
7
  export function GetBoxGeometryNodeData(points, transform) {
@@ -66,12 +66,12 @@ export function GetBoxGeometryNodeData(points, transform) {
66
66
  }
67
67
  quadBounds[i] = GetBounds(positions);
68
68
  }
69
- vertexWeights[VoxelFaces.Up] = addQuadWeights(quads[VoxelFaces.Up], VoxelFaces.Up);
70
- vertexWeights[VoxelFaces.Down] = addQuadWeights(quads[VoxelFaces.Down], VoxelFaces.Down);
71
- vertexWeights[VoxelFaces.North] = addQuadWeights(quads[VoxelFaces.North], VoxelFaces.North);
72
- vertexWeights[VoxelFaces.South] = addQuadWeights(quads[VoxelFaces.South], VoxelFaces.South);
73
- vertexWeights[VoxelFaces.East] = addQuadWeights(quads[VoxelFaces.East], VoxelFaces.East);
74
- vertexWeights[VoxelFaces.West] = addQuadWeights(quads[VoxelFaces.West], VoxelFaces.West);
69
+ vertexWeights[VoxelFaces.Up] = getQuadWeights(quads[VoxelFaces.Up], VoxelFaces.Up);
70
+ vertexWeights[VoxelFaces.Down] = getQuadWeights(quads[VoxelFaces.Down], VoxelFaces.Down);
71
+ vertexWeights[VoxelFaces.North] = getQuadWeights(quads[VoxelFaces.North], VoxelFaces.North);
72
+ vertexWeights[VoxelFaces.South] = getQuadWeights(quads[VoxelFaces.South], VoxelFaces.South);
73
+ vertexWeights[VoxelFaces.East] = getQuadWeights(quads[VoxelFaces.East], VoxelFaces.East);
74
+ vertexWeights[VoxelFaces.West] = getQuadWeights(quads[VoxelFaces.West], VoxelFaces.West);
75
75
  return {
76
76
  quads,
77
77
  vertexWeights,
@@ -11,5 +11,5 @@ export declare function shouldCauseFlip(topRight: number, topLeft: number, botto
11
11
  export declare function getVertexWeights(face: VoxelFaces, x: number, y: number, z: number): Vec4Array;
12
12
  export declare function getInterpolationValue(value: Vec4Array, weights: Vec4Array): number;
13
13
  export type QuadVertexWeights = [Vec4Array, Vec4Array, Vec4Array, Vec4Array];
14
- export declare const addQuadWeights: (quad: Quad, direction: VoxelFaces) => QuadVertexWeights;
14
+ export declare const getQuadWeights: (quad: Quad, direction: VoxelFaces) => QuadVertexWeights;
15
15
  export declare function closestUnitNormal(v: Vec3Array): Vec3Array;
@@ -326,7 +326,7 @@ export function getInterpolationValue(value, weights) {
326
326
  lightData.getB(value[2]) * weights[2] +
327
327
  lightData.getB(value[3]) * weights[3]);
328
328
  }
329
- export const addQuadWeights = (quad, direction) => {
329
+ export const getQuadWeights = (quad, direction) => {
330
330
  const returnArray = [];
331
331
  for (const vertex of QuadVerticiesArray) {
332
332
  const { x, y, z } = quad.positions.vertices[vertex];
@@ -1,7 +1,7 @@
1
1
  import { Vector3Like } from "@amodx/math";
2
2
  import { VoxelFaces } from "../../../Math";
3
3
  import { Quad } from "../../Geomtry/Primitives/Quad";
4
- import { addQuadWeights, closestUnitNormal, } from "./Calc/CalcConstants";
4
+ import { getQuadWeights, closestUnitNormal, } from "./Calc/CalcConstants";
5
5
  import { TransformQuad } from "../../../Models/Shared/Transform";
6
6
  import { GetBounds } from "./BoundsFunctions";
7
7
  export function GetQuadGeometryData(data, transform) {
@@ -40,7 +40,7 @@ export function GetQuadGeometryData(data, transform) {
40
40
  closestFace = VoxelFaces.North;
41
41
  if (unitNormal[2] == -1)
42
42
  closestFace = VoxelFaces.South;
43
- const vertexWeights = addQuadWeights(quad, closestFace);
43
+ const vertexWeights = getQuadWeights(quad, closestFace);
44
44
  closestFace = closestFace;
45
45
  return {
46
46
  quad,
@@ -8,7 +8,7 @@ import { shouldCauseFlip } from "../../../Common/Calc/CalcConstants";
8
8
  import { getFlowAngle, getFlowGradient, FlowVerticies } from "./FlowGradient";
9
9
  import { GetBoxGeometryNodeData } from "../../../Common/BoxGeometryNode";
10
10
  import { VoxelLightData } from "../../../../../Voxels/Cursor/VoxelLightData";
11
- import { VoxelGeometryBuilder } from "../../../../Geomtry/VoxelGeometryBuilder";
11
+ import { addVoxelQuad } from "../../../../Geomtry/VoxelGeometryBuilder";
12
12
  const vertexValue = new QuadScalarVertexData();
13
13
  const vertexLevel = new QuadScalarVertexData();
14
14
  const lightData = new VoxelLightData();
@@ -92,7 +92,7 @@ export class LiquidGeometryNode extends GeoemtryNode {
92
92
  quad.positions.vertices[1].y = vertexValue.vertices[1] * waterHeight;
93
93
  quad.positions.vertices[2].y = vertexValue.vertices[2] * waterHeight;
94
94
  quad.positions.vertices[3].y = vertexValue.vertices[3] * waterHeight;
95
- VoxelGeometryBuilder.addQuad(tool, tool.origin, quad);
95
+ addVoxelQuad(tool, tool.origin, quad);
96
96
  tool.updateBounds(quadBounds[VoxelFaces.Up]);
97
97
  }
98
98
  if (this.isExposed(VoxelFaces.Down)) {
@@ -101,7 +101,7 @@ export class LiquidGeometryNode extends GeoemtryNode {
101
101
  const quad = Quads[VoxelFaces.Down];
102
102
  this.determineShading(VoxelFaces.Down);
103
103
  quad.flip = this.shouldFlip();
104
- VoxelGeometryBuilder.addQuad(tool, tool.origin, quad);
104
+ addVoxelQuad(tool, tool.origin, quad);
105
105
  tool.updateBounds(quadBounds[VoxelFaces.Down]);
106
106
  }
107
107
  if (this.isExposed(VoxelFaces.North)) {
@@ -126,7 +126,7 @@ export class LiquidGeometryNode extends GeoemtryNode {
126
126
  quad.positions.vertices[QuadVerticies.TopLeft].y = 1;
127
127
  quad.setUVs(uvs);
128
128
  }
129
- VoxelGeometryBuilder.addQuad(tool, tool.origin, quad);
129
+ addVoxelQuad(tool, tool.origin, quad);
130
130
  tool.updateBounds(quadBounds[VoxelFaces.North]);
131
131
  }
132
132
  if (this.isExposed(VoxelFaces.South)) {
@@ -151,7 +151,7 @@ export class LiquidGeometryNode extends GeoemtryNode {
151
151
  quad.positions.vertices[QuadVerticies.TopRight].y = 1;
152
152
  quad.setUVs(uvs);
153
153
  }
154
- VoxelGeometryBuilder.addQuad(tool, tool.origin, quad);
154
+ addVoxelQuad(tool, tool.origin, quad);
155
155
  tool.updateBounds(quadBounds[VoxelFaces.South]);
156
156
  }
157
157
  if (this.isExposed(VoxelFaces.East)) {
@@ -176,7 +176,7 @@ export class LiquidGeometryNode extends GeoemtryNode {
176
176
  quad.positions.vertices[QuadVerticies.TopRight].y = 1;
177
177
  quad.setUVs(uvs);
178
178
  }
179
- VoxelGeometryBuilder.addQuad(tool, tool.origin, quad);
179
+ addVoxelQuad(tool, tool.origin, quad);
180
180
  tool.updateBounds(quadBounds[VoxelFaces.East]);
181
181
  }
182
182
  if (this.isExposed(VoxelFaces.West)) {
@@ -201,7 +201,7 @@ export class LiquidGeometryNode extends GeoemtryNode {
201
201
  quad.positions.vertices[QuadVerticies.TopRight].y = 1;
202
202
  quad.setUVs(uvs);
203
203
  }
204
- VoxelGeometryBuilder.addQuad(tool, tool.origin, quad);
204
+ addVoxelQuad(tool, tool.origin, quad);
205
205
  tool.updateBounds(quadBounds[VoxelFaces.West]);
206
206
  }
207
207
  this.builder.vars.light.setAll(0);
@@ -4,7 +4,7 @@ import { getInterpolationValue, shouldCauseFlip, } from "../../Common/Calc/CalcC
4
4
  import { VoxelRelativeCubeIndexPositionMap } from "../../../../Models/Indexing/VoxelRelativeCubeIndex";
5
5
  import { GetBoxGeometryNodeData } from "../../Common/BoxGeometryNode";
6
6
  import { VoxelLightData } from "../../../../Voxels/Cursor/VoxelLightData";
7
- import { VoxelGeometryBuilder } from "../../../Geomtry/VoxelGeometryBuilder";
7
+ import { addVoxelQuad, } from "../../../Geomtry/VoxelGeometryBuilder";
8
8
  import { VoxelModelConstructorRegister } from "../../../Models/VoxelModelConstructorRegister";
9
9
  const ArgIndexes = BoxVoxelGometryInputs.ArgIndexes;
10
10
  export class BoxVoxelGometryNode extends GeoemtryNode {
@@ -26,15 +26,15 @@ export class BoxVoxelGometryNode extends GeoemtryNode {
26
26
  const faceIndexes = this.geomtry.faceCullMap[trueFaceIndex];
27
27
  if (!faceIndexes)
28
28
  return true;
29
- const tool = this.builder;
29
+ const builder = this.builder;
30
30
  for (let positionIndex = 0; positionIndex < faceIndexes.length; positionIndex++) {
31
31
  const currentIndex = faceIndexes[positionIndex];
32
32
  const p = VoxelRelativeCubeIndexPositionMap[currentIndex];
33
- const hashed = this.builder.space.getHash(tool.nVoxel, tool.position.x + p[0], tool.position.y + p[1], tool.position.z + p[2]);
33
+ const hashed = this.builder.space.getHash(builder.nVoxel, builder.position.x + p[0], builder.position.y + p[1], builder.position.z + p[2]);
34
34
  if (this.builder.space.foundHash[hashed] < 2)
35
35
  continue;
36
+ const constructor = this.builder.space.getConstructor(hashed);
36
37
  const offsetBaseGometry = this.builder.space.getGeomtry(hashed);
37
- const offsetConditonalGeometry = this.builder.space.getConditionalGeomtry(hashed);
38
38
  if (offsetBaseGometry) {
39
39
  for (let i = 0; i < offsetBaseGometry.length; i++) {
40
40
  const geoId = offsetBaseGometry[i];
@@ -42,27 +42,24 @@ export class BoxVoxelGometryNode extends GeoemtryNode {
42
42
  continue;
43
43
  const faceIndex = this.geomtry.cullIndex.getValue(geoId, currentIndex, trueFaceIndex);
44
44
  if (faceIndex > -1 &&
45
- !this.builder.space
46
- .getConstructor(hashed)
47
- ?.isShapeStateFaceTransparent(this.builder.space.modCache[hashed], this.builder.space.stateCache[hashed], geoId, faceIndex)) {
45
+ !constructor.isShapeStateFaceTransparent(this.builder.space.modCache[hashed], this.builder.space.stateCache[hashed], geoId, faceIndex)) {
48
46
  return false;
49
47
  }
50
48
  }
51
49
  }
52
- if (!offsetConditonalGeometry)
53
- continue;
54
- for (let i = 0; i < offsetConditonalGeometry.length; i++) {
55
- const cond = offsetConditonalGeometry[i];
56
- for (let k = 0; k < cond.length; k++) {
57
- const geoId = cond[k];
58
- if (VoxelModelConstructorRegister.rulesless[geoId])
59
- continue;
60
- const faceIndex = this.geomtry.cullIndex.getValue(geoId, currentIndex, trueFaceIndex);
61
- if (faceIndex > -1 &&
62
- !this.builder.space
63
- .getConstructor(hashed)
64
- ?.isCondtionalStateFaceTransparent(this.builder.space.modCache[hashed], this.builder.space.stateCache[hashed], geoId, faceIndex))
65
- return false;
50
+ const offsetConditonalGeometry = this.builder.space.getConditionalGeomtry(hashed);
51
+ if (offsetConditonalGeometry) {
52
+ for (let i = 0; i < offsetConditonalGeometry.length; i++) {
53
+ const cond = offsetConditonalGeometry[i];
54
+ for (let k = 0; k < cond.length; k++) {
55
+ const geoId = cond[k];
56
+ if (VoxelModelConstructorRegister.rulesless[geoId])
57
+ continue;
58
+ const faceIndex = this.geomtry.cullIndex.getValue(geoId, currentIndex, trueFaceIndex);
59
+ if (faceIndex > -1 &&
60
+ !constructor.isCondtionalStateFaceTransparent(this.builder.space.modCache[hashed], this.builder.space.stateCache[hashed], geoId, faceIndex))
61
+ return false;
62
+ }
66
63
  }
67
64
  }
68
65
  }
@@ -102,7 +99,7 @@ export class BoxVoxelGometryNode extends GeoemtryNode {
102
99
  if (this.geomtry.aoIndex.getValue(baseGeo[geoIndex], currentIndex, trueVertexIndex)) {
103
100
  this._wasAOShaded = true;
104
101
  worldAO.vertices[v]++;
105
- if (worldAO.vertices[v] > 4) {
102
+ if (worldAO.vertices[v] >= 3) {
106
103
  shaded = true;
107
104
  break;
108
105
  }
@@ -118,7 +115,7 @@ export class BoxVoxelGometryNode extends GeoemtryNode {
118
115
  if (this.geomtry.aoIndex.getValue(conditonalGeo[condtionsIndex][geoIndex], currentIndex, trueVertexIndex)) {
119
116
  this._wasAOShaded = true;
120
117
  worldAO.vertices[v]++;
121
- if (worldAO.vertices[v] > 4) {
118
+ if (worldAO.vertices[v] >= 3) {
122
119
  shaded = true;
123
120
  break;
124
121
  }
@@ -145,10 +142,10 @@ export class BoxVoxelGometryNode extends GeoemtryNode {
145
142
  for (let face = 0; face < 6; face++) {
146
143
  if (args[face][ArgIndexes.Enabled] && this.isExposed(face)) {
147
144
  added = true;
145
+ const quad = this.quads[face];
148
146
  tool.calculateFaceData(face);
149
147
  this.determineShading(face);
150
148
  const faceArgs = args[face];
151
- const quad = this.quads[face];
152
149
  quad.flip = this.shouldFlip() || faceArgs[ArgIndexes.Fliped];
153
150
  tool.vars.textureIndex = faceArgs[ArgIndexes.Texture];
154
151
  const uvs = faceArgs[ArgIndexes.UVs];
@@ -164,7 +161,7 @@ export class BoxVoxelGometryNode extends GeoemtryNode {
164
161
  //4
165
162
  quad.uvs.vertices[3].x = uvs[3][0];
166
163
  quad.uvs.vertices[3].y = uvs[3][1];
167
- VoxelGeometryBuilder.addQuad(tool, this.builder.origin, quad);
164
+ addVoxelQuad(tool, this.builder.origin, quad);
168
165
  tool.updateBounds(this.quadBounds[face]);
169
166
  }
170
167
  }
@@ -1,5 +1,5 @@
1
1
  import { VoxelFaces } from "../../../../Math";
2
- import { VoxelGeometryBuilder } from "../../../Geomtry/VoxelGeometryBuilder";
2
+ import { addVoxelQuad } from "../../../Geomtry/VoxelGeometryBuilder";
3
3
  import { GeoemtryNode } from "../GeometryNode";
4
4
  import { getInterpolationValue, shouldCauseFlip, } from "../../Common/Calc/CalcConstants";
5
5
  import { VoxelRelativeCubeIndexPositionMap } from "../../../../Models/Indexing/VoxelRelativeCubeIndex";
@@ -148,7 +148,7 @@ export class QuadVoxelGometryNode extends GeoemtryNode {
148
148
  //4
149
149
  quad.uvs.vertices[3].x = uvs[3][0];
150
150
  quad.uvs.vertices[3].y = uvs[3][1];
151
- VoxelGeometryBuilder.addQuad(this.builder, this.builder.origin, quad);
151
+ addVoxelQuad(this.builder, this.builder.origin, quad);
152
152
  this.builder.updateBounds(this.quadBounds);
153
153
  this.builder.vars.light.setAll(0);
154
154
  this.builder.vars.ao.setAll(0);
@@ -1,4 +1,4 @@
1
- import { VoxelGeometryBuilder } from "../../../Geomtry/VoxelGeometryBuilder";
1
+ import { addVoxelQuad } from "../../../Geomtry/VoxelGeometryBuilder";
2
2
  import { BoxVoxelGometryInputs, } from "../../../../Models/Input/BoxVoxelGometryInputs";
3
3
  import { getInterpolationValue, shouldCauseFlip, } from "../../Common/Calc/CalcConstants";
4
4
  import { VoxelLightData } from "../../../../Voxels/Cursor/VoxelLightData";
@@ -64,7 +64,7 @@ export class RulelessBoxVoxelGeometryNode extends GeoemtryNode {
64
64
  //4
65
65
  quad.uvs.vertices[3].x = uvs[3][0];
66
66
  quad.uvs.vertices[3].y = uvs[3][1];
67
- VoxelGeometryBuilder.addQuad(tool, tool.position, quad);
67
+ addVoxelQuad(tool, tool.position, quad);
68
68
  this.builder.updateBounds(this.quadBounds[face]);
69
69
  }
70
70
  }
@@ -1,5 +1,5 @@
1
1
  import { VoxelFaces } from "../../../../Math";
2
- import { VoxelGeometryBuilder } from "../../../Geomtry/VoxelGeometryBuilder";
2
+ import { addVoxelQuad, } from "../../../Geomtry/VoxelGeometryBuilder";
3
3
  import { getInterpolationValue, shouldCauseFlip, } from "../../Common/Calc/CalcConstants";
4
4
  import { QuadVoxelGometryInputs, } from "../../../../Models/Input/QuadVoxelGometryInputs";
5
5
  import { GeoemtryNode } from "../GeometryNode";
@@ -68,7 +68,7 @@ export class RulelessQuadVoxelGeometryNode extends GeoemtryNode {
68
68
  //4
69
69
  quad.uvs.vertices[3].x = uvs[3][0];
70
70
  quad.uvs.vertices[3].y = uvs[3][1];
71
- VoxelGeometryBuilder.addQuad(tool, tool.position, quad);
71
+ addVoxelQuad(tool, tool.position, quad);
72
72
  this.builder.updateBounds(this.quadBounds);
73
73
  this.builder.vars.light.setAll(0);
74
74
  this.builder.vars.ao.setAll(0);
@@ -18,10 +18,10 @@ export declare class VoxelConstructor {
18
18
  conditonalInputMap: any[];
19
19
  schema: StateSchema;
20
20
  effects: VoxelModelEffect;
21
- shapeStateTree: StateTreeReader;
21
+ stateTree: StateTreeReader;
22
22
  condtioanlShapeStateTree: CondtionalTreeReader;
23
23
  constructor(id: string, builder: VoxelModelBuilder, data: CompiledVoxelModelData, voxleData: CompiledVoxelModelInputData);
24
- isShapeStateFaceTransparent(modState: number, shapeState: number, geoId: number, faceIndex: number): boolean;
25
- isCondtionalStateFaceTransparent(modState: number, shapeState: number, geoId: number, faceIndex: number): boolean;
24
+ isShapeStateFaceTransparent(modState: number, stateTree: number, geoId: number, faceIndex: number): boolean;
25
+ isCondtionalStateFaceTransparent(modState: number, state: number, geoId: number, faceIndex: number): boolean;
26
26
  process(): boolean;
27
27
  }
@@ -17,7 +17,7 @@ export class VoxelConstructor {
17
17
  conditonalInputMap;
18
18
  schema;
19
19
  effects;
20
- shapeStateTree;
20
+ stateTree;
21
21
  condtioanlShapeStateTree;
22
22
  constructor(id, builder, data, voxleData) {
23
23
  this.id = id;
@@ -27,17 +27,17 @@ export class VoxelConstructor {
27
27
  this.conditonalInputMap = voxleData.condiotnalGeometryInputMap;
28
28
  this.transparentIndex = new VoxelFaceTransparentResultsIndex(voxleData.transparentFaceIndex);
29
29
  this.schema = new StateSchema(data.schema);
30
- this.shapeStateTree = new StateTreeReader(this.schema, 0, data.shapeStateTree);
30
+ this.stateTree = new StateTreeReader(this.schema, 0, data.stateTree);
31
31
  this.condtioanlShapeStateTree = new CondtionalTreeReader(this.schema, data.condiotnalStatements, data.condiotnalStateTree);
32
32
  this.modSchema = new StateSchema(voxleData.modSchema);
33
33
  this.modTree = new StateTreeReader(this.modSchema, 0, voxleData.modStateTree);
34
34
  this.effects = new VoxelModelEffect(this);
35
35
  }
36
- isShapeStateFaceTransparent(modState, shapeState, geoId, faceIndex) {
37
- return (this.transparentIndex.getValue(modState, this.data.relativeGeometryByteIndexMap[this.data.shapeStateRelativeGeometryMap[shapeState][geoId]], faceIndex) == 1);
36
+ isShapeStateFaceTransparent(modState, stateTree, geoId, faceIndex) {
37
+ return (this.transparentIndex.getValue(modState, this.data.relativeGeometryByteIndexMap[this.data.stateRelativeGeometryMap[stateTree][geoId]], faceIndex) == 1);
38
38
  }
39
- isCondtionalStateFaceTransparent(modState, shapeState, geoId, faceIndex) {
40
- return (this.transparentIndex.getValue(modState, this.data.relativeGeometryByteIndexMap[this.data.condiotnalShapeStateRelativeGeometryMap[shapeState][geoId]], faceIndex) == 1);
39
+ isCondtionalStateFaceTransparent(modState, state, geoId, faceIndex) {
40
+ return (this.transparentIndex.getValue(modState, this.data.relativeGeometryByteIndexMap[this.data.condiotnalShapeStateRelativeGeometryMap[state][geoId]], faceIndex) == 1);
41
41
  }
42
42
  process() {
43
43
  let added = false;
@@ -46,8 +46,8 @@ export class VoxelConstructor {
46
46
  const treeState = builder.space.stateCache[hashed];
47
47
  const modState = builder.space.modCache[hashed];
48
48
  if (treeState > -1) {
49
- const geoLinks = this.data.shapeStateMap[treeState];
50
- const geometries = this.data.shapeStateGeometryMap[treeState];
49
+ const geoLinks = this.data.stateMap[treeState];
50
+ const geometries = this.data.stateGeometryMap[treeState];
51
51
  const geometriesLength = geoLinks.length;
52
52
  const inputs = this.baseInputMap[modState][treeState];
53
53
  for (let i = 0; i < geometriesLength; i++) {
@@ -15,8 +15,8 @@ export declare class VoxelGeometryBuilderCacheSpace {
15
15
  start(x: number, y: number, z: number): void;
16
16
  getIndex(x: number, y: number, z: number): number;
17
17
  getConstructor(index: number): import("./VoxelConstructor").VoxelConstructor | null;
18
- getGeomtry(index: number): false | number[];
19
- getConditionalGeomtry(index: number): false | number[][];
18
+ getGeomtry(index: number): number[] | null;
19
+ getConditionalGeomtry(index: number): number[][] | null;
20
20
  getHash(dataCursor: DataCursorInterface, x: number, y: number, z: number): number;
21
21
  private hashState;
22
22
  }
@@ -42,12 +42,12 @@ export class VoxelGeometryBuilderCacheSpace {
42
42
  }
43
43
  getGeomtry(index) {
44
44
  if (this.foundHash[index] < 2)
45
- return false;
46
- return VoxelModelConstructorRegister.constructorsPaltte[this.voxelCache[index]].data.shapeStateGeometryMap[this.stateCache[index]];
45
+ return null;
46
+ return VoxelModelConstructorRegister.constructorsPaltte[this.voxelCache[index]].data.stateGeometryMap[this.stateCache[index]];
47
47
  }
48
48
  getConditionalGeomtry(index) {
49
49
  if (this.foundHash[index] < 2)
50
- return false;
50
+ return null;
51
51
  return VoxelModelConstructorRegister.constructorsPaltte[this.voxelCache[index]].data.condiotnalShapeStateGeometryMap[this.conditonalStateCache[index]];
52
52
  }
53
53
  getHash(dataCursor, x, y, z) {
@@ -59,26 +59,26 @@ export class VoxelGeometryBuilderCacheSpace {
59
59
  }
60
60
  hashState(dataCursor, index, x, y, z) {
61
61
  if (this.foundHash[index] == 1)
62
- return -1;
62
+ return;
63
63
  if (this.foundHash[index] == 2)
64
- return this.stateCache[index];
64
+ return;
65
65
  const voxel = dataCursor.getVoxel(x, y, z);
66
66
  if (!voxel || !voxel.isRenderable()) {
67
67
  this.foundHash[index] = 1;
68
- return -1;
68
+ return;
69
69
  }
70
70
  const voxelId = voxel.getId();
71
71
  const voxelConstructor = VoxelModelConstructorRegister.constructorsPaltte[voxelId];
72
72
  if (!voxelConstructor) {
73
73
  this.foundHash[index] = 1;
74
- return -1;
74
+ return;
75
75
  }
76
76
  this.voxelCache[index] = voxelId;
77
77
  this.foundHash[index] = 2;
78
78
  //no ao
79
79
  this.noCastAO[index] = voxel.isLightSource() || voxel.noAO() ? 1 : 0;
80
80
  //state
81
- const state = voxelConstructor.shapeStateTree.getState(voxel.getState());
81
+ const state = voxelConstructor.stateTree.getState(voxel.getState());
82
82
  this.stateCache[index] = state;
83
83
  //mod
84
84
  const mod = voxelConstructor.modTree.getState(voxel.getMod());
@@ -91,6 +91,5 @@ export class VoxelGeometryBuilderCacheSpace {
91
91
  voxelConstructor.schema.dataCursor = dataCursor;
92
92
  const conditonalState = voxelConstructor.condtioanlShapeStateTree.getState();
93
93
  this.conditonalStateCache[index] = conditonalState;
94
- return 1;
95
94
  }
96
95
  }
@@ -86,7 +86,7 @@ export class VoxelModelBuilder {
86
86
  this.bounds.max[0] = -Infinity;
87
87
  this.bounds.max[1] = -Infinity;
88
88
  this.bounds.max[2] = -Infinity;
89
- this._boundsUpdate = true;
89
+ this._boundsUpdate = false;
90
90
  }
91
91
  endConstruction() {
92
92
  this.vars.reset();
@@ -94,13 +94,6 @@ export class VoxelModelBuilder {
94
94
  if (!this._boundsUpdate)
95
95
  return false;
96
96
  this.bvhTool.updateVoxel(this.position.x, this.position.y, this.position.z, this._indexStart, this.materialIndex, this.mesh.indicieCount, this.bounds.min[0], this.bounds.min[1], this.bounds.min[2], this.bounds.max[0], this.bounds.max[1], this.bounds.max[2]);
97
- this.bvhTool.structCursor.setIndex(0);
98
- this.mesh.minBounds.x = this.bvhTool.structCursor.minX;
99
- this.mesh.minBounds.y = this.bvhTool.structCursor.minY;
100
- this.mesh.minBounds.z = this.bvhTool.structCursor.minZ;
101
- this.mesh.maxBounds.x = this.bvhTool.structCursor.maxX;
102
- this.mesh.maxBounds.y = this.bvhTool.structCursor.maxY;
103
- this.mesh.maxBounds.z = this.bvhTool.structCursor.maxZ;
104
97
  }
105
98
  return true;
106
99
  }
@@ -1,4 +1,5 @@
1
1
  import { Vec3Array } from "@amodx/math";
2
+ export type SetSectionMeshTask = ArrayBuffer;
2
3
  export type CompactSubMesh = [
3
4
  materialId: string,
4
5
  vertexBuffer: Float32Array,