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