@divinevoxel/vlox 0.0.80 → 0.0.81
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/Builder/Tools/Brush/BrushTool.d.ts +12 -2
- package/Builder/Tools/Brush/BrushTool.js +53 -28
- package/Builder/Tools/Debug/DebugTool.d.ts +18 -0
- package/Builder/Tools/Debug/DebugTool.js +36 -0
- package/Builder/Tools/Path/PahtTool.d.ts +1 -1
- package/Builder/Tools/Path/PahtTool.js +1 -1
- package/Builder/Tools/Sculpt/SculptTool.js +8 -0
- package/Builder/Tools/Wrench/WrenchTool.js +10 -23
- package/Builder/Util/SurfaceBoxSelection.js +2 -0
- package/Builder/VoxelBuildSpace.js +3 -3
- package/Contexts/Base/Remote/InitDataSync.js +1 -1
- package/Math/UtilFunctions.js +7 -8
- package/Math/VoxelFaces.d.ts +2 -2
- package/Math/VoxelFaces.js +46 -55
- package/Math/WorldIndexing.d.ts +11 -0
- package/Math/WorldIndexing.js +34 -0
- package/Mesher/Geometry/Geometry.types.d.ts +2 -2
- package/Mesher/Geometry/Geometry.types.js +7 -20
- package/Mesher/Geometry/Primitives/QuadVertexData.js +118 -119
- package/Mesher/Geometry/Primitives/TriangleVertexData.js +89 -90
- package/Mesher/Geometry/Proto/ProtoMesh.d.ts +1 -1
- package/Mesher/Geometry/Proto/ProtoMesh.js +22 -29
- package/Mesher/Geometry/Proto/ProtoMeshBuffer.d.ts +4 -2
- package/Mesher/Geometry/Proto/ProtoMeshBuffer.js +14 -6
- package/Mesher/Geometry/Shapes/Box.js +6 -7
- package/Mesher/Geometry/Transform/TransformBox.js +8 -9
- package/Mesher/Geometry/Transform/TransformQuad.js +4 -5
- package/Mesher/Geometry/Transform/TransformTriangle.js +3 -4
- package/Mesher/InitMesher.js +4 -9
- package/Mesher/Items/Geometry/ItemGeometryBuilder.js +7 -8
- package/Mesher/Items/MeshTexture.js +125 -57
- package/Mesher/Voxels/Base/BuildVoxel.d.ts +6 -0
- package/Mesher/Voxels/Base/BuildVoxel.js +101 -0
- package/Mesher/Voxels/Base/CompactVoxelSectionMesh.js +1 -21
- package/Mesher/Voxels/Base/MeshSectionBase.js +3 -26
- package/Mesher/Voxels/Geometry/VoxelGeometryBuilder.js +33 -31
- package/Mesher/Voxels/Geometry/VoxelShaderData.js +3 -7
- package/Mesher/Voxels/MeshTemplate.js +6 -26
- package/Mesher/Voxels/MeshVoxel.js +5 -10
- package/Mesher/Voxels/Models/Common/Calc/CalcConstants.js +41 -42
- package/Mesher/Voxels/Models/Common/Calc/FaceDataCalc.js +6 -9
- package/Mesher/Voxels/Models/Common/Faces/CullRulledFace.js +64 -47
- package/Mesher/Voxels/Models/Common/Faces/ShadeRulledFace.js +57 -43
- package/Mesher/Voxels/Models/Nodes/Custom/Liquid/FlowGradient.js +4 -5
- package/Mesher/Voxels/Models/Nodes/Custom/Liquid/LiquidGeometryNode.d.ts +1 -1
- package/Mesher/Voxels/Models/Nodes/Custom/Liquid/LiquidGeometryNode.js +116 -118
- package/Mesher/Voxels/Models/Nodes/Default/QuadVoxelGeometryNode.js +4 -4
- package/Mesher/Voxels/Models/Nodes/VoxelGeometryConstructor.js +2 -2
- package/Mesher/Voxels/Models/Procedures/Default/OutlinedTextureProcedure.js +19 -21
- package/Mesher/Voxels/Models/Procedures/Default/PillarTextureProcedure.js +45 -38
- package/Mesher/Voxels/Models/RenderedMaterials.d.ts +1 -1
- package/Mesher/Voxels/Models/RenderedMaterials.js +8 -5
- package/Mesher/Voxels/Models/VoxelGeometryBuilderCacheSpace.d.ts +18 -4
- package/Mesher/Voxels/Models/VoxelGeometryBuilderCacheSpace.js +135 -22
- package/Mesher/Voxels/Models/VoxelGeometryBuilderCacheSpaceN.d.ts +33 -0
- package/Mesher/Voxels/Models/VoxelGeometryBuilderCacheSpaceN.js +204 -0
- package/Mesher/Voxels/Models/{VoxelModelConstructorRegister.d.ts → VoxelGeometryConstructorRegister.d.ts} +1 -6
- package/Mesher/Voxels/Models/VoxelGeometryConstructorRegister.js +20 -0
- package/Mesher/Voxels/Models/VoxelModelBuilder.js +15 -16
- package/Mesher/Voxels/Models/VoxelModelEffect.d.ts +1 -3
- package/Mesher/Voxels/Models/VoxelModelEffect.js +1 -3
- package/Renderer/DVERenderNode.types.d.ts +1 -0
- package/Renderer/InitTasks.js +2 -0
- package/Tasks/Paint/Erase/EraseVoxel.js +1 -1
- package/Tasks/Propagation/Illumanation/RGBUpdate.js +191 -48
- package/Tasks/Propagation/Illumanation/SunUpdate.d.ts +1 -1
- package/Tasks/Propagation/Illumanation/SunUpdate.js +167 -63
- package/Tasks/Propagation/Illumanation/WorldSun.js +96 -60
- package/Tasks/WorldGeneration/WorldGenBrush.d.ts +2 -0
- package/Tasks/WorldGeneration/WorldGenBrush.js +31 -0
- package/Templates/Archive/ArchivedVoxelTemplate.js +1 -1
- package/Templates/Archive/Functions/CreateArchivedTemplate.js +1 -1
- package/Templates/Archive/Functions/CreateArchivedTemplateFromFull.d.ts +6 -0
- package/Templates/Archive/Functions/CreateArchivedTemplateFromFull.js +174 -0
- package/Textures/Classes/CompactedTextureReader.d.ts +22 -0
- package/Textures/Classes/CompactedTextureReader.js +90 -0
- package/Textures/Classes/CompiledTexture.d.ts +4 -1
- package/Textures/Classes/CompiledTexture.js +36 -8
- package/Textures/Classes/TextureAtlasIndex.d.ts +7 -0
- package/Textures/Classes/TextureAtlasIndex.js +14 -0
- package/Textures/Classes/TextureLoader.d.ts +20 -0
- package/Textures/Classes/TextureLoader.js +95 -0
- package/Textures/Functions/BuildTextureData.d.ts +1 -1
- package/Textures/Functions/BuildTextureData.js +19 -122
- package/Textures/Functions/CreateCompactedTexture.d.ts +6 -0
- package/Textures/Functions/CreateCompactedTexture.js +105 -0
- package/Textures/Functions/ReadCompactedTexture.d.ts +2 -0
- package/Textures/Functions/ReadCompactedTexture.js +42 -0
- package/Textures/Texture.types.d.ts +14 -0
- package/Textures/TextureManager.d.ts +7 -1
- package/Textures/TextureManager.js +13 -0
- package/Tools/Brush/Brush.d.ts +4 -2
- package/Tools/Brush/Brush.js +28 -6
- package/Util/BinaryBuffer/Functions/BinaryBufferConvert.d.ts +1 -1
- package/Util/TickInterval.d.ts +3 -0
- package/Util/TickInterval.js +31 -3
- package/Voxels/Archive/VoxelPaletteArchiveReader.d.ts +1 -0
- package/Voxels/Archive/VoxelPaletteArchiveReader.js +9 -10
- package/Voxels/Archive/VoxelPaletteArechive.js +5 -4
- package/Voxels/Cursor/VoxelCursor.interface.d.ts +1 -1
- package/Voxels/Cursor/VoxelCursor.interface.js +22 -16
- package/Voxels/Data/VoxelLUT.d.ts +69 -42
- package/Voxels/Data/VoxelLUT.js +110 -53
- package/Voxels/Functions/BuildLUTs.js +100 -45
- package/Voxels/Functions/Geometry/CalcFunctions.js +6 -7
- package/Voxels/Functions/Geometry/Inputs/BuildTriangleInputs.js +3 -0
- package/Voxels/Indexes/VoxelIndex.js +3 -1
- package/Voxels/InitVoxelData.js +3 -1
- package/Voxels/Interaction/Functions/PickVoxel.js +3 -5
- package/Voxels/Interaction/Functions/PickVoxelWorld.js +4 -6
- package/Voxels/Models/Defaults/Examples.d.ts +2 -0
- package/Voxels/Models/Defaults/Examples.js +151 -2
- package/Voxels/State/Reltional/ReltionalStateBuilder.js +2 -0
- package/Voxels/State/Schema/BinarySchema.d.ts +1 -0
- package/Voxels/State/Schema/BinarySchema.js +14 -0
- package/Voxels/State/VoxelSchemas.d.ts +11 -4
- package/Voxels/State/VoxelSchemas.js +42 -9
- package/Voxels/Types/PaintVoxelData.js +6 -2
- package/World/Archive/Classes/ImportedSection.js +1 -1
- package/World/Archive/Classes/ImportedSector.js +0 -1
- package/World/Archive/Functions/Sector/ArchiveSector.js +2 -2
- package/World/Archive/Functions/Sector/ImportSector.d.ts +1 -0
- package/World/Archive/Functions/Sector/ImportSector.js +183 -7
- package/World/Cursor/SectorCursor.js +1 -4
- package/World/Cursor/WorldCursor.d.ts +12 -3
- package/World/Cursor/WorldCursor.js +60 -30
- package/World/InitTasks.js +1 -1
- package/World/Lock/Function/LockSectors.js +5 -1
- package/World/Lock/Function/UnLockSectors.js +5 -1
- package/World/SnapShot/SectionSnapShot.d.ts +7 -3
- package/World/SnapShot/SectionSnapShot.js +47 -21
- package/World/SnapShot/SectionSnapShotCursor.d.ts +4 -2
- package/World/SnapShot/SectionSnapShotCursor.js +23 -11
- package/World/SnapShot/SnapShots.d.ts +1 -2
- package/World/SnapShot/SnapShots.js +3 -3
- package/World/WorldSpaces.d.ts +7 -0
- package/World/WorldSpaces.js +35 -13
- package/WorldSimulation/Dimensions/DimensionSegment.d.ts +2 -0
- package/WorldSimulation/Dimensions/DimensionSegment.js +9 -1
- package/WorldSimulation/Dimensions/DimensionSimulation.js +6 -7
- package/WorldSimulation/Dimensions/Generator.d.ts +4 -0
- package/WorldSimulation/Dimensions/Generator.js +15 -1
- package/WorldSimulation/Dimensions/SimulationSector.d.ts +1 -0
- package/WorldSimulation/Dimensions/SimulationSector.js +18 -0
- package/WorldSimulation/Internal/WorldSimulationTasks.js +11 -7
- package/WorldSimulation/Procedures/InitalLoad.d.ts +1 -0
- package/WorldSimulation/Procedures/InitalLoad.js +18 -8
- package/WorldSimulation/Tasks/SimulationTaskBase.d.ts +4 -1
- package/WorldSimulation/Tasks/SimulationTaskBase.js +13 -2
- package/WorldSimulation/Tasks/TaskSegment.d.ts +4 -2
- package/WorldSimulation/Tasks/TaskSegment.js +36 -22
- package/WorldSimulation/Voxels/Ticks/Types/LiquidVoxelUpdate.js +1 -2
- package/WorldSimulation/WorldSimulation.d.ts +6 -3
- package/WorldSimulation/WorldSimulation.js +44 -20
- package/package.json +1 -1
- package/Mesher/Items/MeshTextureO.d.ts +0 -1
- package/Mesher/Items/MeshTextureO.js +0 -277
- package/Mesher/Voxels/Models/VoxelConstructor.d.ts +0 -8
- package/Mesher/Voxels/Models/VoxelConstructor.js +0 -78
- package/Mesher/Voxels/Models/VoxelModelConstructorRegister.js +0 -37
- package/WorldSimulation/Procedures/BuildOnly.d.ts +0 -10
- package/WorldSimulation/Procedures/BuildOnly.js +0 -55
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
import { VoxelCursor } from "../../../Voxels/Cursor/VoxelCursor";
|
|
2
|
+
import { GetYXZOrderArrayIndex } from "../../../Math/Indexing";
|
|
3
|
+
import { VoxelSchemas } from "../../../Voxels/State/VoxelSchemas";
|
|
4
|
+
import { VoxelLUT } from "../../../Voxels/Data/VoxelLUT";
|
|
5
|
+
export class VoxelGeometryBuilderCacheSpace {
|
|
6
|
+
bounds;
|
|
7
|
+
foundHash;
|
|
8
|
+
lightCache;
|
|
9
|
+
//cache of the voxel ids
|
|
10
|
+
voxelCache;
|
|
11
|
+
//cache of the true voxel ids
|
|
12
|
+
trueVoxelCache;
|
|
13
|
+
//cache of the reltional voxel ids
|
|
14
|
+
reltionalVoxelCache;
|
|
15
|
+
//cache of the reltional state
|
|
16
|
+
reltionalStateCache;
|
|
17
|
+
//cache of the secondary voxel ids
|
|
18
|
+
secondaryVoxelCache;
|
|
19
|
+
//cache of the true secondary voxel ids
|
|
20
|
+
secondaryTrueVoxelCache;
|
|
21
|
+
//cache of the reltional secondary voxel ids
|
|
22
|
+
secondaryReltionalVoxelCache;
|
|
23
|
+
//cache of the secondary reltional state
|
|
24
|
+
secondaryReltionalStateCache;
|
|
25
|
+
hasSecondary;
|
|
26
|
+
noCastAO;
|
|
27
|
+
secondaryNoCastAO;
|
|
28
|
+
fullBlock;
|
|
29
|
+
offset = [0, 0, 0];
|
|
30
|
+
voxelCursor = new VoxelCursor();
|
|
31
|
+
constructor(bounds) {
|
|
32
|
+
this.bounds = bounds;
|
|
33
|
+
const volume = bounds.x * bounds.y * bounds.z;
|
|
34
|
+
this.foundHash = new Uint8Array(volume);
|
|
35
|
+
this.lightCache = new Int32Array(volume);
|
|
36
|
+
this.voxelCache = new Uint16Array(volume);
|
|
37
|
+
this.trueVoxelCache = new Uint16Array(volume);
|
|
38
|
+
this.reltionalVoxelCache = new Uint16Array(volume);
|
|
39
|
+
this.reltionalStateCache = new Uint16Array(volume);
|
|
40
|
+
this.secondaryVoxelCache = new Uint16Array(volume);
|
|
41
|
+
this.secondaryTrueVoxelCache = new Uint16Array(volume);
|
|
42
|
+
this.secondaryReltionalVoxelCache = new Uint16Array(volume);
|
|
43
|
+
this.secondaryReltionalStateCache = new Uint16Array(volume);
|
|
44
|
+
this.fullBlock = new Uint8Array(volume);
|
|
45
|
+
this.hasSecondary = new Uint8Array(volume);
|
|
46
|
+
this.noCastAO = new Uint8Array(volume);
|
|
47
|
+
this.secondaryNoCastAO = new Uint8Array(volume);
|
|
48
|
+
}
|
|
49
|
+
start(x, y, z) {
|
|
50
|
+
this.offset[0] = x;
|
|
51
|
+
this.offset[1] = y;
|
|
52
|
+
this.offset[2] = z;
|
|
53
|
+
this.fullBlock.fill(0);
|
|
54
|
+
this.lightCache.fill(0);
|
|
55
|
+
this.foundHash.fill(0);
|
|
56
|
+
this.voxelCache.fill(0);
|
|
57
|
+
this.trueVoxelCache.fill(0);
|
|
58
|
+
this.reltionalVoxelCache.fill(0);
|
|
59
|
+
this.reltionalStateCache.fill(0);
|
|
60
|
+
this.secondaryVoxelCache.fill(0);
|
|
61
|
+
this.secondaryTrueVoxelCache.fill(0);
|
|
62
|
+
this.secondaryReltionalVoxelCache.fill(0);
|
|
63
|
+
this.secondaryReltionalStateCache.fill(0);
|
|
64
|
+
this.hasSecondary.fill(0);
|
|
65
|
+
this.noCastAO.fill(0);
|
|
66
|
+
this.secondaryNoCastAO.fill(0);
|
|
67
|
+
}
|
|
68
|
+
getIndex(x, y, z) {
|
|
69
|
+
return GetYXZOrderArrayIndex(x - this.offset[0], y - this.offset[1], z - this.offset[2], this.bounds.x, this.bounds.y, this.bounds.z);
|
|
70
|
+
}
|
|
71
|
+
getHash(dataCursor, x, y, z) {
|
|
72
|
+
const hashed = this.getIndex(x, y, z);
|
|
73
|
+
if (this.foundHash[hashed] == 0) {
|
|
74
|
+
this.hashState(dataCursor, hashed, x, y, z);
|
|
75
|
+
}
|
|
76
|
+
return hashed;
|
|
77
|
+
}
|
|
78
|
+
getNoCastAO(index, secondary = false) {
|
|
79
|
+
return ((secondary ? this.secondaryNoCastAO[index] : this.noCastAO[index]) == 1);
|
|
80
|
+
}
|
|
81
|
+
getTrueVoxelId(index, secondary = false) {
|
|
82
|
+
return secondary
|
|
83
|
+
? this.secondaryTrueVoxelCache[index]
|
|
84
|
+
: this.trueVoxelCache[index];
|
|
85
|
+
}
|
|
86
|
+
getVoxelId(index, secondary = false) {
|
|
87
|
+
return secondary ? this.secondaryVoxelCache[index] : this.voxelCache[index];
|
|
88
|
+
}
|
|
89
|
+
getRelationalState(index, secondary = false) {
|
|
90
|
+
return secondary
|
|
91
|
+
? this.secondaryReltionalStateCache[index]
|
|
92
|
+
: this.reltionalStateCache[index];
|
|
93
|
+
}
|
|
94
|
+
getRelationalVoxelId(index, secondary = false) {
|
|
95
|
+
return secondary
|
|
96
|
+
? this.secondaryReltionalVoxelCache[index]
|
|
97
|
+
: this.reltionalVoxelCache[index];
|
|
98
|
+
}
|
|
99
|
+
getHasSecondary(index) {
|
|
100
|
+
return this.hasSecondary[index];
|
|
101
|
+
}
|
|
102
|
+
hashState(dataCursor, index, x, y, z) {
|
|
103
|
+
if (this.foundHash[index] > 0)
|
|
104
|
+
return;
|
|
105
|
+
const voxel = dataCursor.getVoxel(x, y, z);
|
|
106
|
+
if (voxel) {
|
|
107
|
+
this.lightCache[index] = voxel.getLight();
|
|
108
|
+
}
|
|
109
|
+
if (!voxel) {
|
|
110
|
+
this.foundHash[index] = 1;
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
const canHaveSecondary = voxel.canHaveSecondaryVoxel();
|
|
114
|
+
voxel.setSecondary(true);
|
|
115
|
+
const hasSecondary = canHaveSecondary && voxel.getStringId() !== "dve_air";
|
|
116
|
+
voxel.setSecondary(false);
|
|
117
|
+
if (!voxel.isRenderable() || !hasSecondary) {
|
|
118
|
+
this.foundHash[index] = 1;
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
const trueVoxelId = voxel.getVoxelId();
|
|
122
|
+
const voxelId = voxel.getId();
|
|
123
|
+
this.trueVoxelCache[index] = trueVoxelId;
|
|
124
|
+
this.voxelCache[index] = voxelId;
|
|
125
|
+
let secondaryOpaque = false;
|
|
126
|
+
let secondaryTrueVoxelId = 0;
|
|
127
|
+
let secondaryVoxelId = 0;
|
|
128
|
+
if (hasSecondary) {
|
|
129
|
+
voxel.setSecondary(true);
|
|
130
|
+
secondaryOpaque = voxel.isOpaque();
|
|
131
|
+
secondaryTrueVoxelId = voxel.getVoxelId();
|
|
132
|
+
secondaryVoxelId = voxel.getId();
|
|
133
|
+
this.hasSecondary[index] = 1;
|
|
134
|
+
this.secondaryVoxelCache[index] = secondaryVoxelId;
|
|
135
|
+
this.secondaryTrueVoxelCache[index] = secondaryTrueVoxelId;
|
|
136
|
+
voxel.setSecondary(false);
|
|
137
|
+
}
|
|
138
|
+
if (voxel.isOpaque() || secondaryOpaque) {
|
|
139
|
+
this.foundHash[index] = 2;
|
|
140
|
+
}
|
|
141
|
+
else {
|
|
142
|
+
this.foundHash[index] = 3;
|
|
143
|
+
}
|
|
144
|
+
this.fullBlock[index] = voxel.tags["dve_full_block"] ? 1 : 0;
|
|
145
|
+
//no ao
|
|
146
|
+
this.noCastAO[index] = voxel.isLightSource() || voxel.noAO() ? 1 : 0;
|
|
147
|
+
if (hasSecondary) {
|
|
148
|
+
voxel.setSecondary(true);
|
|
149
|
+
this.secondaryNoCastAO[index] =
|
|
150
|
+
voxel.isLightSource() || voxel.noAO() ? 1 : 0;
|
|
151
|
+
voxel.setSecondary(false);
|
|
152
|
+
}
|
|
153
|
+
this.voxelCursor.copy(voxel).process();
|
|
154
|
+
let secondaryRelationalState = 0;
|
|
155
|
+
let secondaryRelationalMod = 0;
|
|
156
|
+
const relationalBuilder = VoxelSchemas.reltionalStateBuilderMap[VoxelLUT.modelsIndex[trueVoxelId]];
|
|
157
|
+
relationalBuilder.position.x = x;
|
|
158
|
+
relationalBuilder.position.y = y;
|
|
159
|
+
relationalBuilder.position.z = z;
|
|
160
|
+
relationalBuilder.voxel = this.voxelCursor;
|
|
161
|
+
relationalBuilder.dataCursor = dataCursor;
|
|
162
|
+
const reltionalState = relationalBuilder.buildState();
|
|
163
|
+
this.reltionalStateCache[index] = reltionalState;
|
|
164
|
+
if (hasSecondary) {
|
|
165
|
+
const relationalBuilder = VoxelSchemas.reltionalStateBuilderMap[VoxelLUT.modelsIndex[secondaryTrueVoxelId]];
|
|
166
|
+
relationalBuilder.position.x = x;
|
|
167
|
+
relationalBuilder.position.y = y;
|
|
168
|
+
relationalBuilder.position.z = z;
|
|
169
|
+
relationalBuilder.voxel = this.voxelCursor;
|
|
170
|
+
relationalBuilder.dataCursor = dataCursor;
|
|
171
|
+
this.voxelCursor.setSecondary(true);
|
|
172
|
+
secondaryRelationalState = relationalBuilder.buildState();
|
|
173
|
+
this.secondaryReltionalStateCache[index] = secondaryRelationalState;
|
|
174
|
+
this.voxelCursor.setSecondary(false);
|
|
175
|
+
}
|
|
176
|
+
const relationalModBuilder = VoxelSchemas.reltionalModBuilderMap[trueVoxelId];
|
|
177
|
+
let reltionalMod = 0;
|
|
178
|
+
if (relationalModBuilder) {
|
|
179
|
+
relationalModBuilder.position.x = x;
|
|
180
|
+
relationalModBuilder.position.y = y;
|
|
181
|
+
relationalModBuilder.position.z = z;
|
|
182
|
+
relationalModBuilder.voxel = this.voxelCursor;
|
|
183
|
+
relationalModBuilder.dataCursor = dataCursor;
|
|
184
|
+
reltionalMod = relationalModBuilder.buildState();
|
|
185
|
+
}
|
|
186
|
+
if (hasSecondary) {
|
|
187
|
+
const relationalModBuilder = VoxelSchemas.reltionalModBuilderMap[secondaryTrueVoxelId];
|
|
188
|
+
if (relationalModBuilder) {
|
|
189
|
+
relationalModBuilder.position.x = x;
|
|
190
|
+
relationalModBuilder.position.y = y;
|
|
191
|
+
relationalModBuilder.position.z = z;
|
|
192
|
+
relationalModBuilder.voxel = this.voxelCursor;
|
|
193
|
+
relationalModBuilder.dataCursor = dataCursor;
|
|
194
|
+
this.voxelCursor.setSecondary(true);
|
|
195
|
+
secondaryRelationalMod = relationalModBuilder.buildState();
|
|
196
|
+
this.voxelCursor.setSecondary(false);
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
this.reltionalVoxelCache[index] = VoxelLUT.getReltionalVoxelId(trueVoxelId, reltionalState, reltionalMod);
|
|
200
|
+
if (hasSecondary) {
|
|
201
|
+
this.secondaryReltionalVoxelCache[index] = VoxelLUT.getReltionalVoxelId(secondaryTrueVoxelId, secondaryRelationalState, secondaryRelationalMod);
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
}
|
|
@@ -1,14 +1,9 @@
|
|
|
1
1
|
import { GeoemtryNodeConstructor } from "./Nodes/GeometryNode";
|
|
2
|
-
import { VoxelConstructor } from "./VoxelConstructor";
|
|
3
2
|
import { VoxelGeometryConstructor } from "./Nodes/VoxelGeometryConstructor";
|
|
4
|
-
export declare class
|
|
3
|
+
export declare class VoxelGeometryConstructorRegister {
|
|
5
4
|
static geometry: VoxelGeometryConstructor[];
|
|
6
5
|
static customNodes: Map<string, GeoemtryNodeConstructor<any, any>>;
|
|
7
6
|
static registerCustomNode(id: string, node: GeoemtryNodeConstructor<any, any>): void;
|
|
8
7
|
static getCustomNode(id: string): GeoemtryNodeConstructor<any, any>;
|
|
9
|
-
static constructorsPaltte: VoxelConstructor[];
|
|
10
|
-
static constructors: Map<string, VoxelConstructor>;
|
|
11
|
-
static getConstructor(id: string): VoxelConstructor;
|
|
12
|
-
static registerVoxel(voxel: VoxelConstructor | VoxelConstructor[]): void;
|
|
13
8
|
static init(): void;
|
|
14
9
|
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { VoxelGeometryConstructor } from "./Nodes/VoxelGeometryConstructor";
|
|
2
|
+
import { GeometryLUT } from "../../../Voxels/Data/GeometryLUT";
|
|
3
|
+
export class VoxelGeometryConstructorRegister {
|
|
4
|
+
static geometry = [];
|
|
5
|
+
static customNodes = new Map();
|
|
6
|
+
static registerCustomNode(id, node) {
|
|
7
|
+
this.customNodes.set(id, node);
|
|
8
|
+
}
|
|
9
|
+
static getCustomNode(id) {
|
|
10
|
+
const node = this.customNodes.get(id);
|
|
11
|
+
if (!node)
|
|
12
|
+
throw new Error(`Custom geometry node [${id}] does not exist.`);
|
|
13
|
+
return node;
|
|
14
|
+
}
|
|
15
|
+
static init() {
|
|
16
|
+
for (let i = 0; i < GeometryLUT.compiledGeometry.length; i++) {
|
|
17
|
+
this.geometry[i] = new VoxelGeometryConstructor(i);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
//tools
|
|
2
2
|
//data
|
|
3
3
|
import { QuadScalarVertexData } from "../../Geometry/Primitives/QuadVertexData";
|
|
4
|
-
import {
|
|
5
|
-
import { QuadVerticies } from "../../Geometry/Geometry.types";
|
|
4
|
+
import { VoxelFacesArray } from "../../../Math";
|
|
6
5
|
import calculateFaceData from "./Common/Calc/FaceDataCalc.js";
|
|
7
6
|
import { ProtoMesh } from "../../Geometry/Proto/ProtoMesh";
|
|
8
7
|
import { Vector3Like, Vector4Like } from "@amodx/math";
|
|
@@ -51,14 +50,14 @@ export class VoxelModelBuilder {
|
|
|
51
50
|
this.condiotnalGeometryData = [];
|
|
52
51
|
for (const face of VoxelFacesArray) {
|
|
53
52
|
this.condiotnalGeometryData[face] = [];
|
|
54
|
-
this.condiotnalGeometryData[face][QuadVerticies.TopRight] = [[], [], []];
|
|
55
|
-
this.condiotnalGeometryData[face][QuadVerticies.TopLeft] = [[], [], []];
|
|
56
|
-
this.condiotnalGeometryData[face][QuadVerticies.BottomLeft] = [
|
|
53
|
+
this.condiotnalGeometryData[face][0 /* QuadVerticies.TopRight */] = [[], [], []];
|
|
54
|
+
this.condiotnalGeometryData[face][1 /* QuadVerticies.TopLeft */] = [[], [], []];
|
|
55
|
+
this.condiotnalGeometryData[face][2 /* QuadVerticies.BottomLeft */] = [
|
|
57
56
|
[],
|
|
58
57
|
[],
|
|
59
58
|
[],
|
|
60
59
|
];
|
|
61
|
-
this.condiotnalGeometryData[face][QuadVerticies.BottomRight] = [
|
|
60
|
+
this.condiotnalGeometryData[face][3 /* QuadVerticies.BottomRight */] = [
|
|
62
61
|
[],
|
|
63
62
|
[],
|
|
64
63
|
[],
|
|
@@ -67,10 +66,10 @@ export class VoxelModelBuilder {
|
|
|
67
66
|
this.lightData = [];
|
|
68
67
|
for (const face of VoxelFacesArray) {
|
|
69
68
|
this.lightData[face] = [];
|
|
70
|
-
this.lightData[face][QuadVerticies.TopRight] = 0;
|
|
71
|
-
this.lightData[face][QuadVerticies.TopLeft] = 0;
|
|
72
|
-
this.lightData[face][QuadVerticies.BottomLeft] = 0;
|
|
73
|
-
this.lightData[face][QuadVerticies.BottomRight] = 0;
|
|
69
|
+
this.lightData[face][0 /* QuadVerticies.TopRight */] = 0;
|
|
70
|
+
this.lightData[face][1 /* QuadVerticies.TopLeft */] = 0;
|
|
71
|
+
this.lightData[face][2 /* QuadVerticies.BottomLeft */] = 0;
|
|
72
|
+
this.lightData[face][3 /* QuadVerticies.BottomRight */] = 0;
|
|
74
73
|
}
|
|
75
74
|
}
|
|
76
75
|
bounds = {
|
|
@@ -123,12 +122,12 @@ export class VoxelModelBuilder {
|
|
|
123
122
|
this.dataCalculated[direction] = true;
|
|
124
123
|
}
|
|
125
124
|
clearCalculatedData() {
|
|
126
|
-
this.dataCalculated[VoxelFaces.Up] = false;
|
|
127
|
-
this.dataCalculated[VoxelFaces.Down] = false;
|
|
128
|
-
this.dataCalculated[VoxelFaces.North] = false;
|
|
129
|
-
this.dataCalculated[VoxelFaces.South] = false;
|
|
130
|
-
this.dataCalculated[VoxelFaces.East] = false;
|
|
131
|
-
this.dataCalculated[VoxelFaces.West] = false;
|
|
125
|
+
this.dataCalculated[0 /* VoxelFaces.Up */] = false;
|
|
126
|
+
this.dataCalculated[1 /* VoxelFaces.Down */] = false;
|
|
127
|
+
this.dataCalculated[2 /* VoxelFaces.North */] = false;
|
|
128
|
+
this.dataCalculated[3 /* VoxelFaces.South */] = false;
|
|
129
|
+
this.dataCalculated[4 /* VoxelFaces.East */] = false;
|
|
130
|
+
this.dataCalculated[5 /* VoxelFaces.West */] = false;
|
|
132
131
|
}
|
|
133
132
|
clear() {
|
|
134
133
|
this.vars.reset();
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import { VoxelConstructor } from "./VoxelConstructor";
|
|
2
1
|
import { Vector3Like } from "@amodx/math";
|
|
3
2
|
export declare class VoxelModelEffect {
|
|
4
|
-
|
|
5
|
-
constructor(model: VoxelConstructor);
|
|
3
|
+
constructor();
|
|
6
4
|
addEffects(state: number, origin: Vector3Like, effects: Record<string, number[]>): void;
|
|
7
5
|
}
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
export class VoxelModelEffect {
|
|
2
|
-
model;
|
|
3
2
|
/* effects: { id: string; reader: StateTreeReader; palette: Vec3Array[][] }[] =
|
|
4
3
|
[]; */
|
|
5
|
-
constructor(
|
|
6
|
-
this.model = model;
|
|
4
|
+
constructor() {
|
|
7
5
|
/* for (const effect of model.data.effects) {
|
|
8
6
|
if (effect.type == "fx-points") {
|
|
9
7
|
this.effects.push({
|
package/Renderer/InitTasks.js
CHANGED
|
@@ -3,6 +3,7 @@ import { MeshManager } from "./MeshManager";
|
|
|
3
3
|
import { MeshRegister } from "./MeshRegister";
|
|
4
4
|
import { EngineSettings } from "../Settings/EngineSettings";
|
|
5
5
|
import { getLocationData } from "../Util/LocationData";
|
|
6
|
+
import { WorldRegister } from "../World/WorldRegister";
|
|
6
7
|
export default function RendererTasks() {
|
|
7
8
|
Threads.registerTask("set-section", (data, origin) => {
|
|
8
9
|
MeshManager.updateSection(data);
|
|
@@ -15,5 +16,6 @@ export default function RendererTasks() {
|
|
|
15
16
|
});
|
|
16
17
|
Threads.registerTask("clear-all", (data) => {
|
|
17
18
|
MeshRegister.clearAll();
|
|
19
|
+
WorldRegister.clearAll();
|
|
18
20
|
});
|
|
19
21
|
}
|
|
@@ -11,7 +11,6 @@ export function EraseVoxel(location, updateData) {
|
|
|
11
11
|
let voxel = tasks.sDataCursor.getVoxel(x, y, z);
|
|
12
12
|
if (!voxel)
|
|
13
13
|
return;
|
|
14
|
-
const foundPower = voxel.getPower();
|
|
15
14
|
voxel.ids[voxel._index] = 0;
|
|
16
15
|
voxel.level[voxel._index] = 0;
|
|
17
16
|
voxel.secondary[voxel._index] = 0;
|
|
@@ -20,6 +19,7 @@ export function EraseVoxel(location, updateData) {
|
|
|
20
19
|
updateArea(tasks, x - 1, y - 1, z - 1, x + 1, y + 1, z + 1);
|
|
21
20
|
voxel = tasks.sDataCursor.getVoxel(x, y, z);
|
|
22
21
|
if (ES.doPower) {
|
|
22
|
+
const foundPower = voxel.getPower();
|
|
23
23
|
if (foundPower > -1) {
|
|
24
24
|
voxel.setLevel(foundPower);
|
|
25
25
|
tasks.power.remove.push(x, y, z);
|
|
@@ -1,82 +1,225 @@
|
|
|
1
|
-
import { CardinalNeighbors3D } from "../../../Math/CardinalNeighbors";
|
|
2
1
|
import { getMinusOneForRGB, isGreaterOrEqualThanForRGBRemove, isLessThanForRGBAdd, isLessThanForRGBRemove, removeRGBLight, } from "./CommonFunctions";
|
|
3
|
-
//@todo change array to not use push and shift
|
|
4
2
|
export function RGBUpdate(tasks) {
|
|
5
3
|
const queue = tasks.rgb.update;
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
4
|
+
const sDataCursor = tasks.sDataCursor;
|
|
5
|
+
const nDataCursor = tasks.nDataCursor;
|
|
6
|
+
const bounds = tasks.bounds;
|
|
7
|
+
let queueIndex = 0;
|
|
8
|
+
while (queueIndex < queue.length) {
|
|
9
|
+
const x = queue[queueIndex++];
|
|
10
|
+
const y = queue[queueIndex++];
|
|
11
|
+
const z = queue[queueIndex++];
|
|
12
|
+
const voxel = sDataCursor.getVoxel(x, y, z);
|
|
11
13
|
if (!voxel)
|
|
12
14
|
continue;
|
|
13
15
|
const sl = voxel.getLight();
|
|
14
16
|
if (sl <= 0)
|
|
15
17
|
continue;
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
if (
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
18
|
+
let nx, ny, nz, nVoxel, nl;
|
|
19
|
+
nx = x + 1;
|
|
20
|
+
if (nDataCursor.inBounds(nx, y, z)) {
|
|
21
|
+
nVoxel = nDataCursor.getVoxel(nx, y, z);
|
|
22
|
+
if (nVoxel) {
|
|
23
|
+
nl = nVoxel.getLight();
|
|
24
|
+
if (nl > -1 && isLessThanForRGBAdd(nl, sl)) {
|
|
25
|
+
queue.push(nx, y, z);
|
|
26
|
+
nVoxel.setLight(getMinusOneForRGB(sl, nl));
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
nx = x - 1;
|
|
31
|
+
if (nDataCursor.inBounds(nx, y, z)) {
|
|
32
|
+
nVoxel = nDataCursor.getVoxel(nx, y, z);
|
|
33
|
+
if (nVoxel) {
|
|
34
|
+
nl = nVoxel.getLight();
|
|
35
|
+
if (nl > -1 && isLessThanForRGBAdd(nl, sl)) {
|
|
36
|
+
queue.push(nx, y, z);
|
|
37
|
+
nVoxel.setLight(getMinusOneForRGB(sl, nl));
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
ny = y + 1;
|
|
42
|
+
if (nDataCursor.inBounds(x, ny, z)) {
|
|
43
|
+
nVoxel = nDataCursor.getVoxel(x, ny, z);
|
|
44
|
+
if (nVoxel) {
|
|
45
|
+
nl = nVoxel.getLight();
|
|
46
|
+
if (nl > -1 && isLessThanForRGBAdd(nl, sl)) {
|
|
47
|
+
queue.push(x, ny, z);
|
|
48
|
+
nVoxel.setLight(getMinusOneForRGB(sl, nl));
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
ny = y - 1;
|
|
53
|
+
if (nDataCursor.inBounds(x, ny, z)) {
|
|
54
|
+
nVoxel = nDataCursor.getVoxel(x, ny, z);
|
|
55
|
+
if (nVoxel) {
|
|
56
|
+
nl = nVoxel.getLight();
|
|
57
|
+
if (nl > -1 && isLessThanForRGBAdd(nl, sl)) {
|
|
58
|
+
queue.push(x, ny, z);
|
|
59
|
+
nVoxel.setLight(getMinusOneForRGB(sl, nl));
|
|
60
|
+
}
|
|
29
61
|
}
|
|
30
62
|
}
|
|
31
|
-
|
|
63
|
+
nz = z + 1;
|
|
64
|
+
if (nDataCursor.inBounds(x, y, nz)) {
|
|
65
|
+
nVoxel = nDataCursor.getVoxel(x, y, nz);
|
|
66
|
+
if (nVoxel) {
|
|
67
|
+
nl = nVoxel.getLight();
|
|
68
|
+
if (nl > -1 && isLessThanForRGBAdd(nl, sl)) {
|
|
69
|
+
queue.push(x, y, nz);
|
|
70
|
+
nVoxel.setLight(getMinusOneForRGB(sl, nl));
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
nz = z - 1;
|
|
75
|
+
if (nDataCursor.inBounds(x, y, nz)) {
|
|
76
|
+
nVoxel = nDataCursor.getVoxel(x, y, nz);
|
|
77
|
+
if (nVoxel) {
|
|
78
|
+
nl = nVoxel.getLight();
|
|
79
|
+
if (nl > -1 && isLessThanForRGBAdd(nl, sl)) {
|
|
80
|
+
queue.push(x, y, nz);
|
|
81
|
+
nVoxel.setLight(getMinusOneForRGB(sl, nl));
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
bounds.updateDisplay(x, y, z);
|
|
32
86
|
}
|
|
87
|
+
queue.length = 0;
|
|
33
88
|
}
|
|
34
89
|
export function RGBRemove(tasks) {
|
|
35
90
|
const remove = tasks.rgb.remove;
|
|
36
91
|
const update = tasks.rgb.update;
|
|
37
92
|
const removeMap = tasks.rgb.removeMap;
|
|
38
93
|
const updateMap = tasks.rgb.updateMap;
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
94
|
+
const sDataCursor = tasks.sDataCursor;
|
|
95
|
+
const nDataCursor = tasks.nDataCursor;
|
|
96
|
+
const bounds = tasks.bounds;
|
|
97
|
+
let removeIndex = 0;
|
|
98
|
+
while (removeIndex < remove.length) {
|
|
99
|
+
const x = remove[removeIndex++];
|
|
100
|
+
const y = remove[removeIndex++];
|
|
101
|
+
const z = remove[removeIndex++];
|
|
43
102
|
if (removeMap.has(x, y, z))
|
|
44
103
|
continue;
|
|
45
104
|
removeMap.add(x, y, z);
|
|
46
|
-
const voxel =
|
|
105
|
+
const voxel = sDataCursor.getVoxel(x, y, z);
|
|
47
106
|
if (!voxel)
|
|
48
107
|
continue;
|
|
49
108
|
const sl = voxel.getLight();
|
|
50
109
|
if (sl <= 0)
|
|
51
110
|
continue;
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
if (
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
if (
|
|
66
|
-
|
|
111
|
+
let nx, ny, nz, nVoxel, nl, n1HasRGB;
|
|
112
|
+
nx = x + 1;
|
|
113
|
+
if (nDataCursor.inBounds(nx, y, z)) {
|
|
114
|
+
nVoxel = nDataCursor.getVoxel(nx, y, z);
|
|
115
|
+
if (nVoxel) {
|
|
116
|
+
nl = nVoxel.getLight();
|
|
117
|
+
n1HasRGB = nVoxel.hasRGBLight();
|
|
118
|
+
if (n1HasRGB && isLessThanForRGBRemove(nl, sl)) {
|
|
119
|
+
remove.push(nx, y, z);
|
|
120
|
+
if (nVoxel.isLightSource()) {
|
|
121
|
+
update.push(nx, y, z);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
else if (n1HasRGB && isGreaterOrEqualThanForRGBRemove(nl, sl) && !updateMap.has(nx, y, z)) {
|
|
125
|
+
updateMap.add(nx, y, z);
|
|
126
|
+
update.push(nx, y, z);
|
|
67
127
|
}
|
|
68
128
|
}
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
129
|
+
}
|
|
130
|
+
nx = x - 1;
|
|
131
|
+
if (nDataCursor.inBounds(nx, y, z)) {
|
|
132
|
+
nVoxel = nDataCursor.getVoxel(nx, y, z);
|
|
133
|
+
if (nVoxel) {
|
|
134
|
+
nl = nVoxel.getLight();
|
|
135
|
+
n1HasRGB = nVoxel.hasRGBLight();
|
|
136
|
+
if (n1HasRGB && isLessThanForRGBRemove(nl, sl)) {
|
|
137
|
+
remove.push(nx, y, z);
|
|
138
|
+
if (nVoxel.isLightSource()) {
|
|
139
|
+
update.push(nx, y, z);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
else if (n1HasRGB && isGreaterOrEqualThanForRGBRemove(nl, sl) && !updateMap.has(nx, y, z)) {
|
|
143
|
+
updateMap.add(nx, y, z);
|
|
144
|
+
update.push(nx, y, z);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
ny = y + 1;
|
|
149
|
+
if (nDataCursor.inBounds(x, ny, z)) {
|
|
150
|
+
nVoxel = nDataCursor.getVoxel(x, ny, z);
|
|
151
|
+
if (nVoxel) {
|
|
152
|
+
nl = nVoxel.getLight();
|
|
153
|
+
n1HasRGB = nVoxel.hasRGBLight();
|
|
154
|
+
if (n1HasRGB && isLessThanForRGBRemove(nl, sl)) {
|
|
155
|
+
remove.push(x, ny, z);
|
|
156
|
+
if (nVoxel.isLightSource()) {
|
|
157
|
+
update.push(x, ny, z);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
else if (n1HasRGB && isGreaterOrEqualThanForRGBRemove(nl, sl) && !updateMap.has(x, ny, z)) {
|
|
161
|
+
updateMap.add(x, ny, z);
|
|
162
|
+
update.push(x, ny, z);
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
ny = y - 1;
|
|
167
|
+
if (nDataCursor.inBounds(x, ny, z)) {
|
|
168
|
+
nVoxel = nDataCursor.getVoxel(x, ny, z);
|
|
169
|
+
if (nVoxel) {
|
|
170
|
+
nl = nVoxel.getLight();
|
|
171
|
+
n1HasRGB = nVoxel.hasRGBLight();
|
|
172
|
+
if (n1HasRGB && isLessThanForRGBRemove(nl, sl)) {
|
|
173
|
+
remove.push(x, ny, z);
|
|
174
|
+
if (nVoxel.isLightSource()) {
|
|
175
|
+
update.push(x, ny, z);
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
else if (n1HasRGB && isGreaterOrEqualThanForRGBRemove(nl, sl) && !updateMap.has(x, ny, z)) {
|
|
179
|
+
updateMap.add(x, ny, z);
|
|
180
|
+
update.push(x, ny, z);
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
nz = z + 1;
|
|
185
|
+
if (nDataCursor.inBounds(x, y, nz)) {
|
|
186
|
+
nVoxel = nDataCursor.getVoxel(x, y, nz);
|
|
187
|
+
if (nVoxel) {
|
|
188
|
+
nl = nVoxel.getLight();
|
|
189
|
+
n1HasRGB = nVoxel.hasRGBLight();
|
|
190
|
+
if (n1HasRGB && isLessThanForRGBRemove(nl, sl)) {
|
|
191
|
+
remove.push(x, y, nz);
|
|
192
|
+
if (nVoxel.isLightSource()) {
|
|
193
|
+
update.push(x, y, nz);
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
else if (n1HasRGB && isGreaterOrEqualThanForRGBRemove(nl, sl) && !updateMap.has(x, y, nz)) {
|
|
197
|
+
updateMap.add(x, y, nz);
|
|
198
|
+
update.push(x, y, nz);
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
nz = z - 1;
|
|
203
|
+
if (nDataCursor.inBounds(x, y, nz)) {
|
|
204
|
+
nVoxel = nDataCursor.getVoxel(x, y, nz);
|
|
205
|
+
if (nVoxel) {
|
|
206
|
+
nl = nVoxel.getLight();
|
|
207
|
+
n1HasRGB = nVoxel.hasRGBLight();
|
|
208
|
+
if (n1HasRGB && isLessThanForRGBRemove(nl, sl)) {
|
|
209
|
+
remove.push(x, y, nz);
|
|
210
|
+
if (nVoxel.isLightSource()) {
|
|
211
|
+
update.push(x, y, nz);
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
else if (n1HasRGB && isGreaterOrEqualThanForRGBRemove(nl, sl) && !updateMap.has(x, y, nz)) {
|
|
215
|
+
updateMap.add(x, y, nz);
|
|
216
|
+
update.push(x, y, nz);
|
|
75
217
|
}
|
|
76
218
|
}
|
|
77
219
|
}
|
|
78
|
-
|
|
220
|
+
bounds.updateDisplay(x, y, z);
|
|
79
221
|
voxel.setLight(removeRGBLight(sl));
|
|
80
222
|
}
|
|
223
|
+
remove.length = 0;
|
|
81
224
|
removeMap.clear();
|
|
82
225
|
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { VoxelUpdateTask } from "../../VoxelUpdateTask";
|
|
2
2
|
export declare function SunUpdate(tasks: VoxelUpdateTask): void;
|
|
3
|
-
export declare function SunRemove(tasks: VoxelUpdateTask
|
|
3
|
+
export declare function SunRemove(tasks: VoxelUpdateTask): void;
|