@divinevoxel/vlox 0.0.72 → 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.
- package/Contexts/Base/Remote/InitDataSync.js +4 -0
- package/Contexts/Base/Remote/InitWorldDataSync.js +1 -1
- package/Contexts/Render/DivineVoxelEngineRender.d.ts +2 -1
- package/Contexts/World/DivineVoxelEngineWorld.d.ts +2 -1
- package/Init/StartConstructor.js +8 -4
- package/Init/StartWorld.d.ts +1 -1
- package/Math/index.d.ts +5 -1
- package/Mesher/Functions/CompactVoxelMesh.d.ts +2 -2
- package/Mesher/Functions/CompactVoxelMesh.js +1 -1
- package/Mesher/Functions/CompactVoxelSectionMesh.d.ts +4 -0
- package/Mesher/Functions/CompactVoxelSectionMesh.js +112 -0
- package/Mesher/Functions/MeshSection.d.ts +1 -1
- package/Mesher/Functions/MeshSection.js +27 -22
- package/Mesher/Functions/MeshTexture.d.ts +1 -1
- package/Mesher/Functions/MeshTexture.js +3 -4
- package/Mesher/Geomtry/CompactedSectionVoxelMesh.d.ts +23 -0
- package/Mesher/Geomtry/CompactedSectionVoxelMesh.js +144 -0
- package/Mesher/Geomtry/Primitives/QuadVertexData.d.ts +12 -10
- package/Mesher/Geomtry/Primitives/QuadVertexData.js +49 -56
- package/Mesher/Geomtry/VoxelGeometryBuilder.d.ts +2 -2
- package/Mesher/Geomtry/VoxelGeometryBuilder.js +120 -199
- package/Mesher/Geomtry/VoxelMesh.d.ts +1 -1
- package/Mesher/Geomtry/VoxelMesh.js +4 -4
- package/Mesher/Geomtry/VoxelMeshBVHBuilder.d.ts +16 -0
- package/Mesher/Geomtry/VoxelMeshBVHBuilder.js +51 -0
- package/Mesher/Geomtry/VoxelMeshBVHStructCursor.d.ts +22 -0
- package/Mesher/Geomtry/VoxelMeshBVHStructCursor.js +78 -0
- package/Mesher/Geomtry/{Buffers.js → VoxelMeshBuffers.js} +2 -2
- package/Mesher/Geomtry/index.d.ts +0 -1
- package/Mesher/Geomtry/index.js +0 -1
- package/Mesher/InitMesher.js +1 -1
- package/Mesher/InitTask.js +9 -23
- package/Mesher/Models/Common/BoxGeometryNode.js +7 -7
- package/Mesher/Models/Common/Calc/CalcConstants.d.ts +1 -1
- package/Mesher/Models/Common/Calc/CalcConstants.js +1 -1
- package/Mesher/Models/Common/Calc/FaceDataCalc.d.ts +2 -2
- package/Mesher/Models/Common/Calc/FaceDataCalc.js +37 -30
- package/Mesher/Models/Common/QuadGeometryNode.js +2 -2
- package/Mesher/Models/Nodes/Custom/Liquid/FlowGradient.d.ts +2 -2
- package/Mesher/Models/Nodes/Custom/Liquid/FlowGradient.js +1 -1
- package/Mesher/Models/Nodes/Custom/Liquid/LiquidGeomtryNode.js +18 -24
- package/Mesher/Models/Nodes/GeometryNode.d.ts +2 -2
- package/Mesher/Models/Nodes/Ruled/BoxVoxelGeometryNode.d.ts +1 -0
- package/Mesher/Models/Nodes/Ruled/BoxVoxelGeometryNode.js +40 -31
- package/Mesher/Models/Nodes/Ruled/QuadVoxelGeometryNode.js +2 -2
- package/Mesher/Models/Nodes/Ruleless/RulelessBoxVoxelGeometryNode.js +2 -2
- package/Mesher/Models/Nodes/Ruleless/RulelessQuadVoxelGeometryNode.js +2 -2
- package/Mesher/{Tools → Models/Protocols}/OutlinedVoxelTool.d.ts +1 -1
- package/Mesher/{Tools → Models/Protocols}/OutlinedVoxelTool.js +1 -1
- package/Mesher/Models/RenderedMaterials.d.ts +6 -0
- package/Mesher/{RenderedMaterials.js → Models/RenderedMaterials.js} +2 -2
- package/Mesher/Models/VoxelConstructor.d.ts +6 -6
- package/Mesher/Models/VoxelConstructor.js +8 -8
- package/Mesher/Models/VoxelGeometryBuilderCacheSpace.d.ts +3 -5
- package/Mesher/Models/VoxelGeometryBuilderCacheSpace.js +8 -32
- package/Mesher/{Tools/VoxelMesherDataTool.d.ts → Models/VoxelModelBuilder.d.ts} +4 -5
- package/Mesher/{Tools/VoxelMesherDataTool.js → Models/VoxelModelBuilder.js} +5 -8
- package/Mesher/Types/Mesher.types.d.ts +1 -0
- package/Models/Defaults/CubeVoxelGeometry.js +4 -0
- package/Models/Defaults/CubeVoxelModels.js +360 -383
- package/Models/Defaults/LiquidVoxelModel.js +5 -5
- package/Models/Defaults/PanelVoxelModels.js +442 -468
- package/Models/Defaults/StairVoxelModel.js +582 -597
- package/Models/Examples.js +490 -498
- package/Models/Rules/Classes/VoxelRulesModel.d.ts +1 -1
- package/Models/Rules/Classes/VoxelRulesModel.js +3 -3
- package/Models/Rules/Functions/BuildFinalInputs.d.ts +1 -1
- package/Models/Rules/Functions/BuildFinalInputs.js +21 -19
- package/Models/Rules/Functions/BuildGeomtryInputs.js +8 -5
- package/Models/Rules/Functions/BuildRules.js +2 -2
- package/Models/Rules/{VoxelModelManager.d.ts → VoxelModelRuleBuilderRegister.d.ts} +1 -1
- package/Models/Rules/VoxelModelRuleBuilderRegister.js +178 -0
- package/Models/VoxelModel.types.d.ts +17 -8
- package/Renderer/Classes/DVESectionMeshes.d.ts +2 -3
- package/Renderer/Classes/SectorMesh.d.ts +3 -4
- package/Renderer/Classes/SectorMesh.js +6 -11
- package/Renderer/InitTasks.js +1 -10
- package/Renderer/MeshManager.d.ts +1 -1
- package/Renderer/MeshManager.js +26 -25
- package/Renderer/MeshRegister.d.ts +5 -5
- package/Renderer/MeshRegister.js +4 -3
- package/Settings/EngineSettings.d.ts +2 -1
- package/Settings/EngineSettings.js +6 -5
- package/Settings/EngineSettings.types.d.ts +24 -39
- package/Settings/EngineSettings.types.js +22 -29
- package/Tasks/Logic/InitTasks.d.ts +1 -0
- package/Tasks/Logic/InitTasks.js +10 -0
- package/Tasks/Logic/VoxelLogicUpdate.d.ts +3 -0
- package/Tasks/Logic/VoxelLogicUpdate.js +71 -0
- package/Tasks/Propagation/Explosion/ExplosionManager.d.ts +2 -2
- package/Tasks/Propagation/Explosion/ExplosionManager.js +1 -2
- package/Tasks/Propagation/Flow/FlowManager.d.ts +4 -4
- package/Tasks/Propagation/Flow/FlowRemove.d.ts +2 -2
- package/Tasks/Propagation/Flow/FlowUpdate.d.ts +2 -2
- package/Tasks/Propagation/Flow/WorldFlow.d.ts +2 -2
- package/Tasks/Propagation/Illumanation/RGBUpdate.d.ts +3 -3
- package/Tasks/Propagation/Illumanation/SunUpdate.d.ts +3 -3
- package/Tasks/Propagation/Illumanation/WorldRGB.d.ts +2 -2
- package/Tasks/Propagation/Illumanation/WorldSun.d.ts +2 -2
- package/Tasks/Propagation/Illumanation/WorldSun.js +8 -15
- package/Tasks/Propagation/InitTasks.js +4 -4
- package/Tasks/Propagation/Power/PowerUpdate.d.ts +3 -0
- package/Tasks/Propagation/Power/PowerUpdate.js +80 -0
- package/Tasks/Tasks.types.d.ts +2 -2
- package/Tasks/TasksIds.d.ts +2 -1
- package/Tasks/TasksIds.js +1 -0
- package/Tasks/Update/Common.d.ts +3 -0
- package/Tasks/Update/Common.js +41 -0
- package/Tasks/Update/EreaseUpdate.d.ts +3 -0
- package/Tasks/Update/EreaseUpdate.js +66 -0
- package/Tasks/Update/InitTasks.d.ts +2 -2
- package/Tasks/Update/InitTasks.js +3 -1
- package/Tasks/Update/PaintUpdate.d.ts +3 -0
- package/Tasks/Update/PaintUpdate.js +89 -0
- package/Tasks/Update/VoxelUpdate.d.ts +2 -5
- package/Tasks/Update/VoxelUpdate.js +7 -143
- package/Tasks/{Update/UpdateTask.d.ts → VoxelUpdateTask.d.ts} +16 -6
- package/Tasks/{Update/UpdateTask.js → VoxelUpdateTask.js} +44 -5
- package/Tasks/WorldGeneration/WorldGenBrush.d.ts +3 -3
- package/Tasks/WorldGeneration/WorldGenBrush.js +3 -3
- package/Tasks/WorldGeneration/WorldGenRegister.d.ts +1 -1
- package/Templates/Cursor/TemplateCursor.d.ts +2 -2
- package/Templates/Cursor/TemplateCursor.js +1 -2
- package/Templates/Functions/CreateTemplate.d.ts +1 -1
- package/Templates/VoxelTemplates.types.d.ts +1 -1
- package/Textures/Classes/CompiledTexture.d.ts +18 -0
- package/Textures/Classes/CompiledTexture.js +50 -0
- package/Textures/Classes/CompiledTextureAnimation.d.ts +12 -0
- package/Textures/Classes/CompiledTextureAnimation.js +27 -0
- package/Textures/Classes/TextureAnimationTexture.d.ts +10 -0
- package/Textures/Classes/TextureAnimationTexture.js +32 -0
- package/Textures/Functions/BuildTextureData.d.ts +10 -0
- package/Textures/Functions/BuildTextureData.js +205 -0
- package/Textures/Texture.types.d.ts +50 -64
- package/Textures/TextureManager.d.ts +8 -19
- package/Textures/TextureManager.js +28 -166
- package/Tools/Brush/AdvancedBrushTool.js +1 -1
- package/Tools/Brush/Brush.d.ts +3 -3
- package/Tools/Brush/Brush.js +40 -8
- package/Tools/Tasks/TasksTool.d.ts +1 -0
- package/Tools/Tasks/TasksTool.js +2 -0
- package/Util/Binary/BinaryArrays.d.ts +6 -0
- package/Util/Binary/BinaryArrays.js +25 -0
- package/Util/Binary/BinaryBuffer.d.ts +35 -0
- package/Util/Binary/BinaryBuffer.js +136 -0
- package/Util/Binary/{BitArray.d.ts → BinaryFunctions.d.ts} +1 -2
- package/Util/Binary/BinaryFunctions.js +11 -0
- package/{Mesher/Tools/VoxelMeshBVHBuilder.d.ts → Util/Binary/BinaryTree.d.ts} +1 -33
- package/Util/Binary/BinaryTree.js +104 -0
- package/Voxels/Cursor/DataCursor.interface.d.ts +5 -0
- package/Voxels/Cursor/VoxelCursor.interface.d.ts +8 -3
- package/Voxels/Cursor/VoxelCursor.interface.js +54 -13
- package/Voxels/Cursor/VoxelLightData.js +1 -1
- package/Voxels/Data/VoxelPalettesRegister.d.ts +0 -5
- package/Voxels/Data/VoxelPalettesRegister.js +0 -9
- package/Voxels/Data/VoxelTag.types.d.ts +17 -2
- package/Voxels/Data/VoxelTag.types.js +6 -1
- package/Voxels/Data/VoxelTagsRegister.js +12 -7
- package/Voxels/Functions/BuildStateData.d.ts +6 -6
- package/Voxels/Functions/BuildStateData.js +37 -37
- package/Voxels/Functions/BuildTagAndPaletteData.js +6 -3
- package/Voxels/Indexes/VoxelIndex.d.ts +2 -2
- package/Voxels/Indexes/VoxelIndex.js +16 -18
- package/Voxels/InitVoxelData.js +24 -21
- package/Voxels/Logic/Classes/Default/Types/VoxelPoweredLogicType.d.ts +5 -0
- package/Voxels/Logic/Classes/Default/Types/VoxelPoweredLogicType.js +6 -0
- package/Voxels/Logic/Classes/VoxelLogic.d.ts +11 -0
- package/Voxels/Logic/Classes/VoxelLogic.js +49 -0
- package/Voxels/Logic/Classes/VoxelLogicType.d.ts +4 -0
- package/Voxels/Logic/Classes/VoxelLogicType.js +2 -0
- package/Voxels/Logic/VoxelLogic.types.d.ts +23 -0
- package/Voxels/Logic/VoxelLogic.types.js +1 -0
- package/Voxels/Logic/VoxelLogicRegister.d.ts +9 -0
- package/Voxels/Logic/VoxelLogicRegister.js +15 -0
- package/Voxels/State/Schema/StateSchema.d.ts +1 -1
- package/Voxels/State/SchemaRegister.js +10 -5
- package/Voxels/State/State.types.d.ts +1 -1
- package/Voxels/State/StateTreeReader.d.ts +1 -1
- package/Voxels/State/StateTreeReader.js +2 -3
- package/Voxels/Types/Voxel.types.d.ts +21 -0
- package/Voxels/Types/Voxel.types.js +6 -2
- package/Voxels/Types/VoxelModelCompiledData.types.d.ts +6 -4
- package/World/Archive/Archive.types.d.ts +65 -42
- package/World/Archive/Classes/ArchiveClasses.d.ts +66 -0
- package/World/Archive/Classes/ArchiveClasses.js +78 -0
- package/World/Archive/Classes/ImportedSection.d.ts +40 -0
- package/World/Archive/Classes/ImportedSection.js +307 -0
- package/World/Archive/Classes/ImportedSector.d.ts +23 -0
- package/World/Archive/Classes/ImportedSector.js +97 -0
- package/World/Archive/Functions/ArchiveArea.d.ts +1 -1
- package/World/Archive/Functions/ArchiveArea.js +49 -54
- package/World/Archive/Functions/ArchiveSector.js +373 -282
- package/World/Archive/Functions/CreateArchivedSection.d.ts +3 -0
- package/World/Archive/Functions/CreateArchivedSection.js +207 -0
- package/World/Archive/Functions/ImportSector.d.ts +2 -4
- package/World/Archive/Functions/ImportSector.js +50 -220
- package/World/Archive/Functions/RemoveDuplicates.d.ts +3 -0
- package/World/Archive/Functions/RemoveDuplicates.js +92 -0
- package/World/Archive/Functions/Shared.d.ts +6 -0
- package/World/Archive/Functions/Shared.js +50 -0
- package/World/Archive/InitTasks.js +37 -23
- package/World/Cursor/SectionCursor.d.ts +3 -3
- package/World/Cursor/SectionCursor.js +2 -3
- package/World/Cursor/SectorCursor.d.ts +3 -3
- package/World/Cursor/SectorCursor.js +1 -2
- package/World/Cursor/WorldCursor.d.ts +6 -5
- package/World/Cursor/WorldCursor.js +17 -15
- package/World/Cursor/WorldVoxelCursor.d.ts +0 -4
- package/World/Cursor/WorldVoxelCursor.js +24 -14
- package/World/Dimension/Dimension.d.ts +4 -1
- package/World/Dimension/Dimension.js +8 -1
- package/World/InitTasks.d.ts +1 -1
- package/World/Lock/WorldLock.d.ts +1 -1
- package/World/Section/Section.d.ts +27 -18
- package/World/Section/Section.js +125 -21
- package/World/Section/SectionState.d.ts +12 -0
- package/World/Section/SectionState.js +13 -0
- package/World/Sector/Sector.d.ts +20 -6
- package/World/Sector/Sector.js +100 -17
- package/World/Sector/SectorHeightMap.js +2 -2
- package/World/Sector/SectorState.d.ts +16 -7
- package/World/Sector/SectorState.js +29 -15
- package/World/Types/WorldData.types.d.ts +2 -7
- package/World/Types/WorldStorage.interface.js +1 -0
- package/World/WorldRegister.d.ts +13 -9
- package/World/WorldRegister.js +24 -9
- package/World/WorldSpaces.d.ts +4 -0
- package/World/WorldSpaces.js +25 -12
- package/{Tasks/IWG → WorldSimulation}/Internal/Classes/DimensionSegment.d.ts +2 -2
- package/{Tasks/IWG → WorldSimulation}/Internal/Classes/Generator.d.ts +10 -3
- package/{Tasks/IWG → WorldSimulation}/Internal/Classes/Generator.js +19 -3
- package/WorldSimulation/Internal/Classes/Queues/BuildQueue.d.ts +5 -0
- package/WorldSimulation/Internal/Classes/Queues/BuildQueue.js +6 -0
- package/WorldSimulation/Internal/Classes/Queues/LogiccQueue.d.ts +5 -0
- package/WorldSimulation/Internal/Classes/Queues/LogiccQueue.js +6 -0
- package/{Tasks/IWG → WorldSimulation}/Internal/Classes/SectorVisistedMap.js +1 -1
- package/WorldSimulation/Internal/Classes/TickQueue.d.ts +12 -0
- package/WorldSimulation/Internal/Classes/TickQueue.js +58 -0
- package/WorldSimulation/Internal/Classes/WorldSimulationTaskBase.d.ts +15 -0
- package/{Tasks/IWG/Internal/Classes/IWGTaskBase.js → WorldSimulation/Internal/Classes/WorldSimulationTaskBase.js} +8 -8
- package/{Tasks/IWG → WorldSimulation}/Internal/Functions/cullSectors.js +9 -9
- package/{Tasks/IWG → WorldSimulation}/Internal/Functions/getSectorState.d.ts +1 -1
- package/{Tasks/IWG → WorldSimulation}/Internal/Functions/getSectorState.js +4 -4
- package/WorldSimulation/Internal/Functions/runTickUpdate.d.ts +2 -0
- package/{Tasks/IWG/Internal/Functions/runBuildUpdate.js → WorldSimulation/Internal/Functions/runTickUpdate.js} +38 -9
- package/{Tasks/IWG → WorldSimulation}/Internal/Functions/runWorldUpdate.js +13 -13
- package/{Tasks/IWG → WorldSimulation}/Internal/TaskRegister.d.ts +2 -2
- package/{Tasks/IWG → WorldSimulation}/Internal/TaskRegister.js +1 -1
- package/WorldSimulation/Internal/WorldSimulationDimensions.d.ts +6 -0
- package/{Tasks/IWG/Internal/IWGDimensions.js → WorldSimulation/Internal/WorldSimulationDimensions.js} +1 -1
- package/WorldSimulation/Internal/WorldSimulationTasks.d.ts +30 -0
- package/{Tasks/IWG/Internal/IWGTasks.js → WorldSimulation/Internal/WorldSimulationTasks.js} +14 -24
- package/WorldSimulation/Internal/WorldSimulationTools.d.ts +8 -0
- package/{Tasks/IWG/Internal/IWGTools.js → WorldSimulation/Internal/WorldSimulationTools.js} +1 -1
- package/{Tasks/IWG → WorldSimulation}/Procedures/InitalLoad.d.ts +1 -1
- package/{Tasks/IWG → WorldSimulation}/Procedures/InitalLoad.js +11 -11
- package/{Tasks/IWG → WorldSimulation}/Procedures/SaveAllSectors.js +7 -5
- package/{Tasks/IWG/IWG.d.ts → WorldSimulation/WorldSimulation.d.ts} +6 -5
- package/{Tasks/IWG/IWG.js → WorldSimulation/WorldSimulation.js} +29 -23
- package/{Tasks/IWG → WorldSimulation}/index.d.ts +1 -1
- package/{Tasks/IWG → WorldSimulation}/index.js +1 -1
- package/package.json +1 -1
- package/Mesher/Functions/CompactMesh.d.ts +0 -2
- package/Mesher/Functions/CompactMesh.js +0 -42
- package/Mesher/Geomtry/GeometryNormals.d.ts +0 -10
- package/Mesher/Geomtry/GeometryNormals.js +0 -52
- package/Mesher/Geomtry/MeshData.types.d.ts +0 -13
- package/Mesher/Geomtry/MeshData.types.js +0 -6
- package/Mesher/Geomtry/Tools/MesherDataTools.d.ts +0 -7
- package/Mesher/Geomtry/Tools/MesherDataTools.js +0 -12
- package/Mesher/Geomtry/Tools/index.d.ts +0 -1
- package/Mesher/Geomtry/Tools/index.js +0 -1
- package/Mesher/RenderedMaterials.d.ts +0 -6
- package/Mesher/Tools/VoxelMeshBVHBuilder.js +0 -216
- package/Models/Rules/VoxelModelManager.js +0 -82
- package/Tasks/IWG/Internal/Classes/IWGTaskBase.d.ts +0 -15
- package/Tasks/IWG/Internal/Functions/runBuildUpdate.d.ts +0 -2
- package/Tasks/IWG/Internal/IWGDimensions.d.ts +0 -6
- package/Tasks/IWG/Internal/IWGTasks.d.ts +0 -34
- package/Tasks/IWG/Internal/IWGTools.d.ts +0 -8
- package/Textures/TextureAnimations.d.ts +0 -4
- package/Textures/TextureAnimations.js +0 -35
- package/Textures/TextureArray.d.ts +0 -47
- package/Textures/TextureArray.js +0 -202
- package/Textures/TextureBuilder.d.ts +0 -13
- package/Textures/TextureBuilder.js +0 -120
- package/Textures/TextureRegister.d.ts +0 -9
- package/Textures/TextureRegister.js +0 -28
- package/Tools/DataCursor.interface.d.ts +0 -5
- package/Tools/DataCursor.interface.js +0 -2
- package/Util/Binary/BitArray.js +0 -16
- package/World/Structs/WorldDataStructProperties.d.ts +0 -8
- package/World/Structs/WorldDataStructProperties.js +0 -9
- /package/Mesher/Geomtry/{Buffers.d.ts → VoxelMeshBuffers.d.ts} +0 -0
- /package/Mesher/{Tools → Geomtry}/VoxelMeshVertexStructCursor.d.ts +0 -0
- /package/Mesher/{Tools → Geomtry}/VoxelMeshVertexStructCursor.js +0 -0
- /package/Mesher/{VoxelShaderData.d.ts → Geomtry/VoxelShaderData.d.ts} +0 -0
- /package/Mesher/{VoxelShaderData.js → Geomtry/VoxelShaderData.js} +0 -0
- /package/{World/Storage/WorldStorage.interface.js → Voxels/Cursor/DataCursor.interface.js} +0 -0
- /package/World/{Storage → Types}/WorldStorage.interface.d.ts +0 -0
- /package/{Tasks/IWG → WorldSimulation}/Internal/Classes/DimensionSegment.js +0 -0
- /package/{Tasks/IWG → WorldSimulation}/Internal/Classes/SectorState.d.ts +0 -0
- /package/{Tasks/IWG → WorldSimulation}/Internal/Classes/SectorState.js +0 -0
- /package/{Tasks/IWG → WorldSimulation}/Internal/Classes/SectorVisistedMap.d.ts +0 -0
- /package/{Tasks/IWG → WorldSimulation}/Internal/Functions/cullSectors.d.ts +0 -0
- /package/{Tasks/IWG → WorldSimulation}/Internal/Functions/runWorldUpdate.d.ts +0 -0
- /package/{Tasks/IWG → WorldSimulation}/Procedures/SaveAllSectors.d.ts +0 -0
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { EngineSettings as ES } from "../../Settings/EngineSettings.js";
|
|
2
|
+
import { $3dCardinalNeighbors } from "../../Math/CardinalNeighbors.js";
|
|
3
|
+
export const updateLightTask = (tasks) => {
|
|
4
|
+
let doRGB = ES.doRGBPropagation;
|
|
5
|
+
let doSun = ES.doSunPropagation;
|
|
6
|
+
const [dimension, x, y, z] = tasks.origin;
|
|
7
|
+
tasks.nDataCursor.setFocalPoint(dimension, x, y, z);
|
|
8
|
+
for (const n of $3dCardinalNeighbors) {
|
|
9
|
+
const nx = n[0] + x;
|
|
10
|
+
const ny = n[1] + y;
|
|
11
|
+
const nz = n[2] + z;
|
|
12
|
+
const nVoxel = tasks.nDataCursor.getVoxel(nx, ny, nz);
|
|
13
|
+
if (!nVoxel)
|
|
14
|
+
continue;
|
|
15
|
+
if (doRGB) {
|
|
16
|
+
if (nVoxel.hasRGBLight()) {
|
|
17
|
+
tasks.rgb.update.push(nx, ny, nz);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
if (doSun) {
|
|
21
|
+
if (nVoxel.hasSunLight()) {
|
|
22
|
+
tasks.sun.update.push(nx, ny, nz);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
export const updatePowerTask = (tasks) => {
|
|
28
|
+
const [dimension, x, y, z] = tasks.origin;
|
|
29
|
+
tasks.nDataCursor.setFocalPoint(dimension, x, y, z);
|
|
30
|
+
for (const n of $3dCardinalNeighbors) {
|
|
31
|
+
const nx = n[0] + x;
|
|
32
|
+
const ny = n[1] + y;
|
|
33
|
+
const nz = n[2] + z;
|
|
34
|
+
const nVoxel = tasks.nDataCursor.getVoxel(nx, ny, nz);
|
|
35
|
+
if (!nVoxel)
|
|
36
|
+
continue;
|
|
37
|
+
if (nVoxel.getPower() > 0) {
|
|
38
|
+
tasks.power.update.push(nx, ny, nz);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
};
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { EngineSettings as ES } from "../../Settings/EngineSettings.js";
|
|
2
|
+
import { $3dCardinalNeighbors } from "../../Math/CardinalNeighbors.js";
|
|
3
|
+
import { VoxelUpdateTask } from "../VoxelUpdateTask.js";
|
|
4
|
+
import { RGBRemove, RGBUpdate } from "../Propagation/Illumanation/RGBUpdate.js";
|
|
5
|
+
import { SunUpdate } from "../Propagation/Illumanation/SunUpdate.js";
|
|
6
|
+
import { FlowRemove } from "../Propagation/Flow/FlowRemove.js";
|
|
7
|
+
import { updateLightTask } from "./Common.js";
|
|
8
|
+
import { PowerRemove, PowerUpdate } from "../Propagation/Power/PowerUpdate.js";
|
|
9
|
+
const tasks = new VoxelUpdateTask();
|
|
10
|
+
export async function EreaseAndUpdate(location) {
|
|
11
|
+
const [dimension, x, y, z] = location;
|
|
12
|
+
tasks.setOrigin(location);
|
|
13
|
+
let voxel = tasks.sDataCursor.getVoxel(x, y, z);
|
|
14
|
+
if (!voxel)
|
|
15
|
+
return false;
|
|
16
|
+
const substanceData = voxel.getSubstanceData();
|
|
17
|
+
const foundPower = voxel.getPower();
|
|
18
|
+
if (!voxel.isAir() && ES.doFlow && voxel.isRenderable()) {
|
|
19
|
+
if (substanceData["dve_is_liquid"]) {
|
|
20
|
+
FlowRemove(tasks);
|
|
21
|
+
return tasks;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
voxel = tasks.sDataCursor.getVoxel(x, y, z);
|
|
25
|
+
const light = voxel.getLight();
|
|
26
|
+
const isLightSource = voxel.isLightSource();
|
|
27
|
+
voxel.setSecondary(true).setId(0).setSecondary(false);
|
|
28
|
+
voxel
|
|
29
|
+
.setLight(light > 0 ? light : 0)
|
|
30
|
+
.setId(0)
|
|
31
|
+
.setLevel(0)
|
|
32
|
+
.setLevelState(0)
|
|
33
|
+
.setState(0)
|
|
34
|
+
.setMod(0)
|
|
35
|
+
.updateVoxel(1);
|
|
36
|
+
if (ES.doLight) {
|
|
37
|
+
if (ES.doRGBPropagation && isLightSource) {
|
|
38
|
+
tasks.rgb.remove.push(x, y, z);
|
|
39
|
+
RGBRemove(tasks);
|
|
40
|
+
}
|
|
41
|
+
updateLightTask(tasks);
|
|
42
|
+
if (ES.doRGBPropagation) {
|
|
43
|
+
RGBUpdate(tasks);
|
|
44
|
+
}
|
|
45
|
+
if (ES.doSunPropagation) {
|
|
46
|
+
SunUpdate(tasks);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
voxel = tasks.sDataCursor.getVoxel(x, y, z);
|
|
50
|
+
if (ES.doPower) {
|
|
51
|
+
if (foundPower > -1) {
|
|
52
|
+
voxel.setLevel(foundPower);
|
|
53
|
+
tasks.power.remove.push(x, y, z);
|
|
54
|
+
PowerRemove(tasks);
|
|
55
|
+
PowerUpdate(tasks);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
tasks.bounds.update(x, y, z);
|
|
59
|
+
tasks.bounds.update(x + 1, y + 1, z + 1);
|
|
60
|
+
for (let i = 0; i < $3dCardinalNeighbors.length; i++) {
|
|
61
|
+
tasks.sDataCursor
|
|
62
|
+
.getVoxel($3dCardinalNeighbors[i][0] + x, $3dCardinalNeighbors[i][1] + y, $3dCardinalNeighbors[i][2] + z)
|
|
63
|
+
?.updateVoxel(2);
|
|
64
|
+
}
|
|
65
|
+
return tasks;
|
|
66
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Thread } from "@amodx/threads";
|
|
2
|
-
import {
|
|
2
|
+
import { VoxelUpdateTask } from "../VoxelUpdateTask";
|
|
3
3
|
export default function (props: {
|
|
4
|
-
onDone(taks:
|
|
4
|
+
onDone(taks: VoxelUpdateTask, origin: Thread): void;
|
|
5
5
|
}): void;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { Threads } from "@amodx/threads";
|
|
2
2
|
import { TasksIds } from "../TasksIds";
|
|
3
|
-
import { VoxelUpdate
|
|
3
|
+
import { VoxelUpdate } from "./VoxelUpdate";
|
|
4
|
+
import { EreaseAndUpdate } from "./EreaseUpdate";
|
|
5
|
+
import { PaintAndUpdate } from "./PaintUpdate";
|
|
4
6
|
export default function (props) {
|
|
5
7
|
Threads.registerTask(TasksIds.VoxelUpdate, async (data, origin) => {
|
|
6
8
|
const tasks = await VoxelUpdate(data);
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { EngineSettings as ES } from "../../Settings/EngineSettings.js";
|
|
2
|
+
import { $3dCardinalNeighbors } from "../../Math/CardinalNeighbors.js";
|
|
3
|
+
import { VoxelUpdateTask } from "../VoxelUpdateTask.js";
|
|
4
|
+
import { RGBRemove, RGBUpdate } from "../Propagation/Illumanation/RGBUpdate.js";
|
|
5
|
+
import { SunRemove, SunUpdate } from "../Propagation/Illumanation/SunUpdate.js";
|
|
6
|
+
import { FlowUpdate } from "../Propagation/Flow/FlowUpdate.js";
|
|
7
|
+
import { updateLightTask, updatePowerTask } from "./Common.js";
|
|
8
|
+
import { PowerUpdate } from "../../Tasks/Propagation/Power/PowerUpdate.js";
|
|
9
|
+
const tasks = new VoxelUpdateTask();
|
|
10
|
+
export async function PaintAndUpdate(data) {
|
|
11
|
+
const [dimension, x, y, z] = data[0];
|
|
12
|
+
tasks.setOrigin(data[0]);
|
|
13
|
+
let voxel = tasks.sDataCursor.getVoxel(x, y, z);
|
|
14
|
+
if (!voxel)
|
|
15
|
+
return false;
|
|
16
|
+
const raw = data[1];
|
|
17
|
+
const isOpaque = voxel.isOpaque();
|
|
18
|
+
let doRGB = ES.doRGBPropagation;
|
|
19
|
+
let doSun = ES.doSunPropagation;
|
|
20
|
+
lighttest: if (ES.doLight) {
|
|
21
|
+
const light = voxel.getLight();
|
|
22
|
+
if (light <= 0)
|
|
23
|
+
break lighttest;
|
|
24
|
+
if (doSun) {
|
|
25
|
+
if (voxel.hasSunLight()) {
|
|
26
|
+
tasks.sun.remove.push(x, y, z);
|
|
27
|
+
SunRemove(tasks);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
if (doRGB) {
|
|
31
|
+
if (voxel.hasRGBLight() && isOpaque) {
|
|
32
|
+
tasks.rgb.remove.push(x, y, z);
|
|
33
|
+
RGBRemove(tasks);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
voxel = tasks.sDataCursor.getVoxel(x, y, z);
|
|
38
|
+
const id = raw[0];
|
|
39
|
+
if (id < 0)
|
|
40
|
+
return false;
|
|
41
|
+
voxel.setId(id);
|
|
42
|
+
voxel.setLevel(raw[2]);
|
|
43
|
+
voxel.setState(raw[3]);
|
|
44
|
+
voxel.setMod(raw[4]);
|
|
45
|
+
voxel.process();
|
|
46
|
+
if (raw[3] > 0 && voxel.canHaveSecondaryVoxel()) {
|
|
47
|
+
voxel.setSecondary(true);
|
|
48
|
+
voxel.setId(raw[5]);
|
|
49
|
+
voxel.setSecondary(false);
|
|
50
|
+
}
|
|
51
|
+
if (voxel.isLightSource() && voxel.getLightSourceValue()) {
|
|
52
|
+
voxel.setLight(voxel.getLightSourceValue());
|
|
53
|
+
}
|
|
54
|
+
voxel.updateVoxel(0);
|
|
55
|
+
if (ES.doLight) {
|
|
56
|
+
updateLightTask(tasks);
|
|
57
|
+
if (doRGB) {
|
|
58
|
+
tasks.rgb.update.push(x, y, z);
|
|
59
|
+
RGBUpdate(tasks);
|
|
60
|
+
}
|
|
61
|
+
if (doSun) {
|
|
62
|
+
SunUpdate(tasks);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
voxel = tasks.sDataCursor.getVoxel(x, y, z);
|
|
66
|
+
if (ES.doFlow) {
|
|
67
|
+
if (!voxel.isAir() && voxel.getSubstanceData()["dve_is_liquid"]) {
|
|
68
|
+
FlowUpdate(tasks);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
if (ES.doPower) {
|
|
72
|
+
if (voxel._tags["dve_can_be_powered"] ||
|
|
73
|
+
voxel._tags["dve_is_power_source"] ||
|
|
74
|
+
voxel._tags["dve_can_carry_power"] ||
|
|
75
|
+
voxel._tags["dve_can_hold_power"]) {
|
|
76
|
+
updatePowerTask(tasks);
|
|
77
|
+
tasks.power.update.push(x, y, z);
|
|
78
|
+
PowerUpdate(tasks);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
tasks.bounds.update(x, y, z);
|
|
82
|
+
tasks.bounds.update(x + 1, y + 1, z + 1);
|
|
83
|
+
for (let i = 0; i < $3dCardinalNeighbors.length; i++) {
|
|
84
|
+
tasks.sDataCursor
|
|
85
|
+
.getVoxel($3dCardinalNeighbors[i][0] + x, $3dCardinalNeighbors[i][1] + y, $3dCardinalNeighbors[i][2] + z)
|
|
86
|
+
?.updateVoxel(2);
|
|
87
|
+
}
|
|
88
|
+
return tasks;
|
|
89
|
+
}
|
|
@@ -1,6 +1,3 @@
|
|
|
1
1
|
import { VoxelUpdateTasks } from "../Tasks.types.js";
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
export declare function EreaseAndUpdate(location: LocationData): Promise<false | UpdateTask>;
|
|
5
|
-
export declare function PaintAndUpdate(data: VoxelUpdateTasks): Promise<false | UpdateTask>;
|
|
6
|
-
export declare function VoxelUpdate(data: VoxelUpdateTasks): Promise<false | UpdateTask>;
|
|
2
|
+
import { VoxelUpdateTask } from "../VoxelUpdateTask.js";
|
|
3
|
+
export declare function VoxelUpdate(data: VoxelUpdateTasks): Promise<false | VoxelUpdateTask>;
|
|
@@ -1,148 +1,10 @@
|
|
|
1
1
|
import { EngineSettings as ES } from "../../Settings/EngineSettings.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { SunRemove, SunUpdate } from "../Propagation/Illumanation/SunUpdate.js";
|
|
2
|
+
import { VoxelUpdateTask } from "../VoxelUpdateTask.js";
|
|
3
|
+
import { RGBUpdate } from "../Propagation/Illumanation/RGBUpdate.js";
|
|
4
|
+
import { SunUpdate } from "../Propagation/Illumanation/SunUpdate.js";
|
|
6
5
|
import { FlowUpdate } from "../Propagation/Flow/FlowUpdate.js";
|
|
7
|
-
import {
|
|
8
|
-
const tasks = new
|
|
9
|
-
const updateLightTask = (tasks) => {
|
|
10
|
-
let doRGB = ES.doRGBPropagation;
|
|
11
|
-
let doSun = ES.doSunPropagation;
|
|
12
|
-
const [dimension, x, y, z] = tasks.origin;
|
|
13
|
-
tasks.nDataCursor.setFocalPoint(dimension, x, y, z);
|
|
14
|
-
for (const n of $3dCardinalNeighbors) {
|
|
15
|
-
const nx = n[0] + x;
|
|
16
|
-
const ny = n[1] + y;
|
|
17
|
-
const nz = n[2] + z;
|
|
18
|
-
const nVoxel = tasks.nDataCursor.getVoxel(nx, ny, nz);
|
|
19
|
-
if (!nVoxel)
|
|
20
|
-
continue;
|
|
21
|
-
if (doRGB) {
|
|
22
|
-
if (nVoxel.hasRGBLight()) {
|
|
23
|
-
tasks.rgb.update.push(nx, ny, nz);
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
if (doSun) {
|
|
27
|
-
if (nVoxel.hasSunLight()) {
|
|
28
|
-
tasks.sun.update.push(nx, ny, nz);
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
};
|
|
33
|
-
export async function EreaseAndUpdate(location) {
|
|
34
|
-
const [dimension, x, y, z] = location;
|
|
35
|
-
tasks.setOrigin(location);
|
|
36
|
-
let voxel = tasks.sDataCursor.getVoxel(x, y, z);
|
|
37
|
-
if (!voxel)
|
|
38
|
-
return false;
|
|
39
|
-
const substanceData = voxel.getSubstanceData();
|
|
40
|
-
if (!voxel.isAir() && ES.doFlow && voxel.isRenderable()) {
|
|
41
|
-
if (substanceData["dve_is_liquid"]) {
|
|
42
|
-
FlowRemove(tasks);
|
|
43
|
-
return tasks;
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
voxel = tasks.sDataCursor.getVoxel(x, y, z);
|
|
47
|
-
const light = voxel.getLight();
|
|
48
|
-
const isLightSource = voxel.isLightSource();
|
|
49
|
-
voxel.setSecondary(true).setId(0).setSecondary(false);
|
|
50
|
-
voxel
|
|
51
|
-
.setLight(light > 0 ? light : 0)
|
|
52
|
-
.setId(0)
|
|
53
|
-
.setLevel(0)
|
|
54
|
-
.setLevelState(0)
|
|
55
|
-
.setState(0)
|
|
56
|
-
.setMod(0)
|
|
57
|
-
.updateVoxel(1);
|
|
58
|
-
if (ES.doLight) {
|
|
59
|
-
if (ES.doRGBPropagation && isLightSource) {
|
|
60
|
-
tasks.rgb.remove.push(x, y, z);
|
|
61
|
-
RGBRemove(tasks);
|
|
62
|
-
}
|
|
63
|
-
updateLightTask(tasks);
|
|
64
|
-
if (ES.doRGBPropagation) {
|
|
65
|
-
RGBUpdate(tasks);
|
|
66
|
-
}
|
|
67
|
-
if (ES.doSunPropagation) {
|
|
68
|
-
SunUpdate(tasks);
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
for (let i = 0; i < $3dCardinalNeighbors.length; i++) {
|
|
72
|
-
tasks.sDataCursor
|
|
73
|
-
.getVoxel($3dCardinalNeighbors[i][0] + x, $3dCardinalNeighbors[i][1] + y, $3dCardinalNeighbors[i][2] + z)
|
|
74
|
-
?.updateVoxel(2);
|
|
75
|
-
}
|
|
76
|
-
return tasks;
|
|
77
|
-
}
|
|
78
|
-
export async function PaintAndUpdate(data) {
|
|
79
|
-
const [dimension, x, y, z] = data[0];
|
|
80
|
-
tasks.setOrigin(data[0]);
|
|
81
|
-
let voxel = tasks.sDataCursor.getVoxel(x, y, z);
|
|
82
|
-
if (!voxel)
|
|
83
|
-
return false;
|
|
84
|
-
const raw = data[1];
|
|
85
|
-
const isOpaque = voxel.isOpaque();
|
|
86
|
-
let doRGB = ES.doRGBPropagation;
|
|
87
|
-
let doSun = ES.doSunPropagation;
|
|
88
|
-
lighttest: if (ES.doLight) {
|
|
89
|
-
const light = voxel.getLight();
|
|
90
|
-
if (light <= 0)
|
|
91
|
-
break lighttest;
|
|
92
|
-
if (doSun) {
|
|
93
|
-
if (voxel.hasSunLight()) {
|
|
94
|
-
tasks.sun.remove.push(x, y, z);
|
|
95
|
-
SunRemove(tasks);
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
if (doRGB) {
|
|
99
|
-
if (voxel.hasRGBLight() && isOpaque) {
|
|
100
|
-
tasks.rgb.remove.push(x, y, z);
|
|
101
|
-
RGBRemove(tasks);
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
voxel = tasks.sDataCursor.getVoxel(x, y, z);
|
|
106
|
-
const id = raw[0];
|
|
107
|
-
if (id < 0)
|
|
108
|
-
return false;
|
|
109
|
-
voxel.setId(id);
|
|
110
|
-
voxel.setLevel(raw[2]);
|
|
111
|
-
voxel.setState(raw[3]);
|
|
112
|
-
voxel.setMod(raw[4]);
|
|
113
|
-
voxel.process();
|
|
114
|
-
if (raw[3] > 0 && voxel.canHaveSecondaryVoxel()) {
|
|
115
|
-
voxel.setSecondary(true);
|
|
116
|
-
voxel.setId(raw[5]);
|
|
117
|
-
voxel.setSecondary(false);
|
|
118
|
-
}
|
|
119
|
-
if (voxel.isLightSource() && voxel.getLightSourceValue()) {
|
|
120
|
-
voxel.setLight(voxel.getLightSourceValue());
|
|
121
|
-
}
|
|
122
|
-
voxel.updateVoxel(0);
|
|
123
|
-
if (ES.doLight) {
|
|
124
|
-
updateLightTask(tasks);
|
|
125
|
-
if (doRGB) {
|
|
126
|
-
tasks.rgb.update.push(x, y, z);
|
|
127
|
-
RGBUpdate(tasks);
|
|
128
|
-
}
|
|
129
|
-
if (doSun) {
|
|
130
|
-
SunUpdate(tasks);
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
voxel = tasks.sDataCursor.getVoxel(x, y, z);
|
|
134
|
-
if (ES.doFlow) {
|
|
135
|
-
if (!voxel.isAir() && voxel.getSubstanceData()["dve_is_liquid"]) {
|
|
136
|
-
FlowUpdate(tasks);
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
for (let i = 0; i < $3dCardinalNeighbors.length; i++) {
|
|
140
|
-
tasks.sDataCursor
|
|
141
|
-
.getVoxel($3dCardinalNeighbors[i][0] + x, $3dCardinalNeighbors[i][1] + y, $3dCardinalNeighbors[i][2] + z)
|
|
142
|
-
?.updateVoxel(2);
|
|
143
|
-
}
|
|
144
|
-
return tasks;
|
|
145
|
-
}
|
|
6
|
+
import { updateLightTask } from "./Common.js";
|
|
7
|
+
const tasks = new VoxelUpdateTask();
|
|
146
8
|
export async function VoxelUpdate(data) {
|
|
147
9
|
const [dimension, x, y, z] = data[0];
|
|
148
10
|
tasks.setOrigin(data[0]);
|
|
@@ -167,5 +29,7 @@ export async function VoxelUpdate(data) {
|
|
|
167
29
|
FlowUpdate(tasks);
|
|
168
30
|
}
|
|
169
31
|
}
|
|
32
|
+
tasks.bounds.update(x, y, z);
|
|
33
|
+
tasks.bounds.update(x + 1, y + 1, z + 1);
|
|
170
34
|
return tasks;
|
|
171
35
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { WorldCursor } from "
|
|
1
|
+
import { WorldCursor } from "../World/Cursor/WorldCursor";
|
|
2
2
|
import { Vec3Array, Vector3Like } from "@amodx/math";
|
|
3
|
-
import { LocationData } from "
|
|
3
|
+
import { LocationData } from "../Math";
|
|
4
4
|
export declare class TaskMap {
|
|
5
5
|
_map: boolean[];
|
|
6
6
|
get size(): number;
|
|
@@ -12,18 +12,21 @@ export declare class TaskMap {
|
|
|
12
12
|
clear(): void;
|
|
13
13
|
}
|
|
14
14
|
declare class UpdatedBounds {
|
|
15
|
-
_task:
|
|
15
|
+
_task: VoxelUpdateTask;
|
|
16
16
|
min: Vector3Like;
|
|
17
17
|
max: Vector3Like;
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
dimension: number;
|
|
19
|
+
constructor(_task: VoxelUpdateTask);
|
|
20
|
+
start(dimension?: number): void;
|
|
20
21
|
update(x: number, y: number, z: number): void;
|
|
21
22
|
getSections(): Vec3Array[];
|
|
23
|
+
markSectionsAsDirty(): void;
|
|
22
24
|
}
|
|
23
|
-
export declare class
|
|
25
|
+
export declare class VoxelUpdateTask {
|
|
24
26
|
flow: FlowQueues;
|
|
25
27
|
rgb: LightQueue;
|
|
26
28
|
sun: LightQueue;
|
|
29
|
+
power: PowerQueue;
|
|
27
30
|
bounds: UpdatedBounds;
|
|
28
31
|
sDataCursor: WorldCursor;
|
|
29
32
|
nDataCursor: WorldCursor;
|
|
@@ -50,4 +53,11 @@ declare class LightQueue {
|
|
|
50
53
|
updateMap: TaskMap;
|
|
51
54
|
clear(): void;
|
|
52
55
|
}
|
|
56
|
+
declare class PowerQueue {
|
|
57
|
+
update: number[];
|
|
58
|
+
remove: number[];
|
|
59
|
+
removeMap: TaskMap;
|
|
60
|
+
updateMap: TaskMap;
|
|
61
|
+
clear(): void;
|
|
62
|
+
}
|
|
53
63
|
export {};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { WorldCursor } from "
|
|
1
|
+
import { WorldCursor } from "../World/Cursor/WorldCursor";
|
|
2
2
|
import { Vector3Like } from "@amodx/math";
|
|
3
|
-
import { WorldSpaces } from "
|
|
3
|
+
import { WorldSpaces } from "../World/WorldSpaces";
|
|
4
|
+
import { WorldRegister } from "../World/WorldRegister";
|
|
4
5
|
export class TaskMap {
|
|
5
6
|
_map = [];
|
|
6
7
|
get size() {
|
|
@@ -34,10 +35,12 @@ class UpdatedBounds {
|
|
|
34
35
|
_task;
|
|
35
36
|
min = Vector3Like.Clone(InfinityVec3);
|
|
36
37
|
max = Vector3Like.Clone(NegativeInfinityVec3);
|
|
38
|
+
dimension = 0;
|
|
37
39
|
constructor(_task) {
|
|
38
40
|
this._task = _task;
|
|
39
41
|
}
|
|
40
|
-
|
|
42
|
+
start(dimension) {
|
|
43
|
+
this.dimension = dimension || 0;
|
|
41
44
|
Vector3Like.Copy(this.min, InfinityVec3);
|
|
42
45
|
Vector3Like.Copy(this.max, NegativeInfinityVec3);
|
|
43
46
|
}
|
|
@@ -76,11 +79,35 @@ class UpdatedBounds {
|
|
|
76
79
|
}
|
|
77
80
|
return sectionPositions;
|
|
78
81
|
}
|
|
82
|
+
markSectionsAsDirty() {
|
|
83
|
+
const minSectionPos = WorldSpaces.section.getPosition(this.min.x - 1, this.min.y - 1, this.min.z - 1, tempPosition);
|
|
84
|
+
const minX = minSectionPos.x;
|
|
85
|
+
const minY = minSectionPos.y;
|
|
86
|
+
const minZ = minSectionPos.z;
|
|
87
|
+
const maxSectionPos = WorldSpaces.section.getPosition(this.max.x + 1, this.max.y + 1, this.max.z + 1, tempPosition);
|
|
88
|
+
const maxX = maxSectionPos.x;
|
|
89
|
+
const maxY = maxSectionPos.y;
|
|
90
|
+
const maxZ = maxSectionPos.z;
|
|
91
|
+
for (let x = minX; x <= maxX; x += WorldSpaces.section.bounds.x) {
|
|
92
|
+
for (let z = minZ; z <= maxZ; z += WorldSpaces.section.bounds.z) {
|
|
93
|
+
for (let y = minY; y <= maxY; y += WorldSpaces.section.bounds.y) {
|
|
94
|
+
if (!WorldSpaces.world.inBounds(x, y, z))
|
|
95
|
+
continue;
|
|
96
|
+
const sector = WorldRegister.sectors.get(this.dimension, x, y, z);
|
|
97
|
+
if (!sector)
|
|
98
|
+
continue;
|
|
99
|
+
const section = sector.getSection(x, y, z);
|
|
100
|
+
section.setDisplayDirty(true);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
79
105
|
}
|
|
80
|
-
export class
|
|
106
|
+
export class VoxelUpdateTask {
|
|
81
107
|
flow = new FlowQueues();
|
|
82
108
|
rgb = new LightQueue();
|
|
83
109
|
sun = new LightQueue();
|
|
110
|
+
power = new PowerQueue();
|
|
84
111
|
bounds = new UpdatedBounds(this);
|
|
85
112
|
sDataCursor = new WorldCursor();
|
|
86
113
|
nDataCursor = new WorldCursor();
|
|
@@ -96,13 +123,13 @@ export class UpdateTask {
|
|
|
96
123
|
this.flow.update.map.start(origin[1], origin[2], origin[3]);
|
|
97
124
|
this.flow.remove.map.start(origin[1], origin[2], origin[3]);
|
|
98
125
|
this.flow.remove.noRemoveMap.start(origin[1], origin[2], origin[3]);
|
|
126
|
+
this.bounds.start(origin[0]);
|
|
99
127
|
this.clear();
|
|
100
128
|
}
|
|
101
129
|
clear() {
|
|
102
130
|
this.rgb.clear();
|
|
103
131
|
this.sun.clear();
|
|
104
132
|
this.flow.clear();
|
|
105
|
-
this.bounds.reset();
|
|
106
133
|
}
|
|
107
134
|
}
|
|
108
135
|
class FlowQueues {
|
|
@@ -135,3 +162,15 @@ class LightQueue {
|
|
|
135
162
|
this.updateMap.clear();
|
|
136
163
|
}
|
|
137
164
|
}
|
|
165
|
+
class PowerQueue {
|
|
166
|
+
update = [];
|
|
167
|
+
remove = [];
|
|
168
|
+
removeMap = new TaskMap();
|
|
169
|
+
updateMap = new TaskMap();
|
|
170
|
+
clear() {
|
|
171
|
+
this.update.length = 0;
|
|
172
|
+
this.remove.length = 0;
|
|
173
|
+
this.removeMap.clear();
|
|
174
|
+
this.updateMap.clear();
|
|
175
|
+
}
|
|
176
|
+
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { Vec3Array } from "@amodx/math";
|
|
2
2
|
import { BrushTool } from "../../Tools/Brush/Brush.js";
|
|
3
|
-
import {
|
|
3
|
+
import { VoxelUpdateTask } from "../VoxelUpdateTask.js";
|
|
4
4
|
export declare class WorldGenBrush extends BrushTool {
|
|
5
5
|
constructor();
|
|
6
6
|
requestsId: "";
|
|
7
|
-
tasks:
|
|
8
|
-
start(dimension:
|
|
7
|
+
tasks: VoxelUpdateTask;
|
|
8
|
+
start(dimension: number, x: number, y: number, z: number): this;
|
|
9
9
|
paint(): this;
|
|
10
10
|
getUpdatedSections(): Vec3Array[];
|
|
11
11
|
update(): false | undefined;
|
|
@@ -3,7 +3,7 @@ import { BrushTool } from "../../Tools/Brush/Brush.js";
|
|
|
3
3
|
import { VoxelLightData } from "../../Voxels/Cursor/VoxelLightData.js";
|
|
4
4
|
import { WorldGeneration } from "./WorldGeneration.js";
|
|
5
5
|
import { DivineVoxelEngineConstructor } from "../../Contexts/Constructor/DivineVoxelEngineConstructor.js";
|
|
6
|
-
import {
|
|
6
|
+
import { VoxelUpdateTask } from "../VoxelUpdateTask.js";
|
|
7
7
|
import { RGBRemove, RGBUpdate } from "../Propagation/Illumanation/RGBUpdate.js";
|
|
8
8
|
import { SunRemove, SunUpdate } from "../Propagation/Illumanation/SunUpdate.js";
|
|
9
9
|
const lightData = new VoxelLightData();
|
|
@@ -13,7 +13,7 @@ export class WorldGenBrush extends BrushTool {
|
|
|
13
13
|
WorldGeneration._brushes.push(this);
|
|
14
14
|
}
|
|
15
15
|
requestsId;
|
|
16
|
-
tasks = new
|
|
16
|
+
tasks = new VoxelUpdateTask();
|
|
17
17
|
start(dimension, x, y, z) {
|
|
18
18
|
this.dataCursor.setFocalPoint(dimension, x, y, z);
|
|
19
19
|
this.tasks.setOrigin([dimension, x, y, z]);
|
|
@@ -56,7 +56,7 @@ export class WorldGenBrush extends BrushTool {
|
|
|
56
56
|
}
|
|
57
57
|
getUpdatedSections() {
|
|
58
58
|
const queue = this.tasks.bounds.getSections();
|
|
59
|
-
this.tasks.bounds.
|
|
59
|
+
this.tasks.bounds.start();
|
|
60
60
|
return queue;
|
|
61
61
|
}
|
|
62
62
|
update() {
|
|
@@ -4,7 +4,7 @@ export declare class WorldGenRegister {
|
|
|
4
4
|
static MAX_ATTEMPTS: number;
|
|
5
5
|
static _requests: Map<string, {
|
|
6
6
|
attempts: number;
|
|
7
|
-
dimension:
|
|
7
|
+
dimension: number;
|
|
8
8
|
sections: Map<string, [x: number, y: number, z: number]>;
|
|
9
9
|
voxels: [x: number, y: number, z: number, data: RawVoxelData][];
|
|
10
10
|
}>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { TemplateVoxelCursor } from "./TemplateVoxelCursor";
|
|
2
|
-
import { DataCursorInterface } from "../../
|
|
2
|
+
import { DataCursorInterface } from "../../Voxels/Cursor/DataCursor.interface";
|
|
3
3
|
import { FullVoxelTemplate } from "Templates/FullVoxelTemplate";
|
|
4
|
-
export declare class TemplateCursor
|
|
4
|
+
export declare class TemplateCursor implements DataCursorInterface {
|
|
5
5
|
_voxelIndex: number;
|
|
6
6
|
_template: FullVoxelTemplate | null;
|
|
7
7
|
private voxel;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { TemplateVoxelCursor } from "./TemplateVoxelCursor";
|
|
2
|
-
|
|
3
|
-
export class TemplateCursor extends DataCursorInterface {
|
|
2
|
+
export class TemplateCursor {
|
|
4
3
|
_voxelIndex = 0;
|
|
5
4
|
_template = null;
|
|
6
5
|
voxel = new TemplateVoxelCursor(this);
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { Vec3Array } from "@amodx/math";
|
|
2
2
|
import { VoxelTemplate } from "../VoxelTemplate";
|
|
3
|
-
export default function CreateTemplate(dimension:
|
|
3
|
+
export default function CreateTemplate(dimension: number, start: Vec3Array, end: Vec3Array): VoxelTemplate;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Vec2Array } from "@amodx/math";
|
|
2
|
+
import { TextureId } from "../../Textures/Texture.types";
|
|
3
|
+
import { CompiledTextureAnimation } from "./CompiledTextureAnimation";
|
|
4
|
+
import { TextureAnimationTexture } from "./TextureAnimationTexture";
|
|
5
|
+
export declare class CompiledTexture {
|
|
6
|
+
id: string;
|
|
7
|
+
static GetAtlasIndex: (x: number, y: number, boundsX: number) => number;
|
|
8
|
+
static GetAtlasPosition: (index: number, boundsX: number, position?: Vec2Array) => Vec2Array;
|
|
9
|
+
images: HTMLImageElement[];
|
|
10
|
+
atlasSizeMap: Record<string, [width: number, height: number]>;
|
|
11
|
+
textureMap: Record<string, number>;
|
|
12
|
+
animations: CompiledTextureAnimation[];
|
|
13
|
+
shaderTexture: any;
|
|
14
|
+
animatedTexture: TextureAnimationTexture;
|
|
15
|
+
constructor(id: string);
|
|
16
|
+
getTextureIndex(id: TextureId): number;
|
|
17
|
+
getTexturePath(id: TextureId): string;
|
|
18
|
+
}
|