@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
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import { Vec3Array, Vec4Array
|
|
1
|
+
import { Vec3Array, Vec4Array } from "@amodx/math";
|
|
2
2
|
import { VoxelFaces } from "../../../../Math";
|
|
3
|
-
import { QuadScalarVertexData } from "../../../Geomtry/Primitives/QuadVertexData";
|
|
4
3
|
import { VoxelBoxGeometryNode } from "../../../../Models/VoxelModel.types";
|
|
5
4
|
import { Quad } from "../../../Geomtry/Primitives/Quad";
|
|
6
|
-
import { VoxelMesherDataTool } from "../../../../Mesher/Tools/VoxelMesherDataTool";
|
|
7
5
|
import { BoxVoxelGometryArgs } from "../../../../Models/Input/BoxVoxelGometryInputs";
|
|
8
6
|
import { GeoemtryNode } from "../GeometryNode";
|
|
9
7
|
import { VoxelLightData } from "../../../../Voxels/Cursor/VoxelLightData";
|
|
@@ -16,12 +14,11 @@ export declare class BoxVoxelGometryNode extends GeoemtryNode<VoxelBoxGeometryNo
|
|
|
16
14
|
Vec4Array,
|
|
17
15
|
Vec4Array
|
|
18
16
|
]>;
|
|
19
|
-
|
|
20
|
-
worldAO: QuadScalarVertexData;
|
|
17
|
+
_wasAOShaded: boolean;
|
|
21
18
|
lightData: VoxelLightData;
|
|
22
19
|
init(): void;
|
|
23
20
|
isExposed(face: VoxelFaces): boolean;
|
|
24
21
|
determineShading(face: VoxelFaces): void;
|
|
25
22
|
shouldFlip(): boolean;
|
|
26
|
-
add(
|
|
23
|
+
add(args: BoxVoxelGometryArgs): boolean;
|
|
27
24
|
}
|
|
@@ -1,19 +1,17 @@
|
|
|
1
1
|
import { BoxVoxelGometryInputs, } from "../../../../Models/Input/BoxVoxelGometryInputs";
|
|
2
|
-
import { VoxelGeometryLookUp } from "../../VoxelGeometryLookUp";
|
|
3
2
|
import { GeoemtryNode } from "../GeometryNode";
|
|
4
3
|
import { getInterpolationValue, shouldCauseFlip, } from "../../Common/Calc/CalcConstants";
|
|
5
4
|
import { VoxelRelativeCubeIndexPositionMap } from "../../../../Models/Indexing/VoxelRelativeCubeIndex";
|
|
6
5
|
import { GetBoxGeometryNodeData } from "../../Common/BoxGeometryNode";
|
|
7
|
-
import { UpdateBounds } from "../../Common/BoundsFunctions";
|
|
8
6
|
import { VoxelLightData } from "../../../../Voxels/Cursor/VoxelLightData";
|
|
9
7
|
import { VoxelGeometryBuilder } from "../../../Geomtry/VoxelGeometryBuilder";
|
|
8
|
+
import { VoxelModelConstructorRegister } from "../../../Models/VoxelModelConstructorRegister";
|
|
10
9
|
const ArgIndexes = BoxVoxelGometryInputs.ArgIndexes;
|
|
11
10
|
export class BoxVoxelGometryNode extends GeoemtryNode {
|
|
12
11
|
quads;
|
|
13
12
|
quadBounds = [];
|
|
14
13
|
vertexWeights;
|
|
15
|
-
|
|
16
|
-
worldAO;
|
|
14
|
+
_wasAOShaded = false;
|
|
17
15
|
lightData = new VoxelLightData();
|
|
18
16
|
init() {
|
|
19
17
|
this.faceCount = 6;
|
|
@@ -28,23 +26,25 @@ export class BoxVoxelGometryNode extends GeoemtryNode {
|
|
|
28
26
|
const faceIndexes = this.geomtry.faceCullMap[trueFaceIndex];
|
|
29
27
|
if (!faceIndexes)
|
|
30
28
|
return true;
|
|
31
|
-
const tool = this.
|
|
29
|
+
const tool = this.builder;
|
|
32
30
|
for (let positionIndex = 0; positionIndex < faceIndexes.length; positionIndex++) {
|
|
33
31
|
const currentIndex = faceIndexes[positionIndex];
|
|
34
32
|
const p = VoxelRelativeCubeIndexPositionMap[currentIndex];
|
|
35
|
-
const hashed =
|
|
36
|
-
if (
|
|
33
|
+
const hashed = this.builder.space.getHash(tool.nVoxel, tool.position.x + p[0], tool.position.y + p[1], tool.position.z + p[2]);
|
|
34
|
+
if (this.builder.space.foundHash[hashed] < 2)
|
|
37
35
|
continue;
|
|
38
|
-
const offsetBaseGometry =
|
|
39
|
-
const offsetConditonalGeometry =
|
|
36
|
+
const offsetBaseGometry = this.builder.space.getGeomtry(hashed);
|
|
37
|
+
const offsetConditonalGeometry = this.builder.space.getConditionalGeomtry(hashed);
|
|
40
38
|
if (offsetBaseGometry) {
|
|
41
39
|
for (let i = 0; i < offsetBaseGometry.length; i++) {
|
|
42
40
|
const geoId = offsetBaseGometry[i];
|
|
43
|
-
if (
|
|
41
|
+
if (VoxelModelConstructorRegister.rulesless[geoId])
|
|
44
42
|
continue;
|
|
45
43
|
const faceIndex = this.geomtry.cullIndex.getValue(geoId, currentIndex, trueFaceIndex);
|
|
46
44
|
if (faceIndex > -1 &&
|
|
47
|
-
!
|
|
45
|
+
!this.builder.space
|
|
46
|
+
.getConstructor(hashed)
|
|
47
|
+
?.isShapeStateFaceTransparent(this.builder.space.modCache[hashed], this.builder.space.stateCache[hashed], geoId, faceIndex)) {
|
|
48
48
|
return false;
|
|
49
49
|
}
|
|
50
50
|
}
|
|
@@ -55,11 +55,13 @@ export class BoxVoxelGometryNode extends GeoemtryNode {
|
|
|
55
55
|
const cond = offsetConditonalGeometry[i];
|
|
56
56
|
for (let k = 0; k < cond.length; k++) {
|
|
57
57
|
const geoId = cond[k];
|
|
58
|
-
if (
|
|
58
|
+
if (VoxelModelConstructorRegister.rulesless[geoId])
|
|
59
59
|
continue;
|
|
60
60
|
const faceIndex = this.geomtry.cullIndex.getValue(geoId, currentIndex, trueFaceIndex);
|
|
61
61
|
if (faceIndex > -1 &&
|
|
62
|
-
!
|
|
62
|
+
!this.builder.space
|
|
63
|
+
.getConstructor(hashed)
|
|
64
|
+
?.isCondtionalStateFaceTransparent(this.builder.space.modCache[hashed], this.builder.space.stateCache[hashed], geoId, faceIndex))
|
|
63
65
|
return false;
|
|
64
66
|
}
|
|
65
67
|
}
|
|
@@ -67,11 +69,11 @@ export class BoxVoxelGometryNode extends GeoemtryNode {
|
|
|
67
69
|
return true;
|
|
68
70
|
}
|
|
69
71
|
determineShading(face) {
|
|
70
|
-
const tool = this.
|
|
72
|
+
const tool = this.builder;
|
|
71
73
|
const lightData = tool.lightData[face];
|
|
72
|
-
const noAO = this.
|
|
73
|
-
const worldLight = this.
|
|
74
|
-
const worldAO = this.
|
|
74
|
+
const noAO = this.builder.voxel.isLightSource() || this.builder.voxel.noAO();
|
|
75
|
+
const worldLight = this.builder.vars.light;
|
|
76
|
+
const worldAO = this.builder.vars.ao;
|
|
75
77
|
for (let v = 0; v < 4; v++) {
|
|
76
78
|
worldAO.vertices[v] = 0;
|
|
77
79
|
worldLight.vertices[v] = getInterpolationValue(lightData, this.vertexWeights[face][v]);
|
|
@@ -84,12 +86,12 @@ export class BoxVoxelGometryNode extends GeoemtryNode {
|
|
|
84
86
|
for (let positionIndex = 0; positionIndex < aoIndexes.length; positionIndex++) {
|
|
85
87
|
const currentIndex = aoIndexes[positionIndex];
|
|
86
88
|
const p = VoxelRelativeCubeIndexPositionMap[currentIndex];
|
|
87
|
-
const hashed =
|
|
88
|
-
if (
|
|
89
|
-
|
|
89
|
+
const hashed = this.builder.space.getHash(tool.nVoxel, tool.position.x + p[0], tool.position.y + p[1], tool.position.z + p[2]);
|
|
90
|
+
if (this.builder.space.foundHash[hashed] < 2 ||
|
|
91
|
+
this.builder.space.noCastAO[hashed] === 1)
|
|
90
92
|
continue;
|
|
91
|
-
const baseGeo =
|
|
92
|
-
const conditonalGeo =
|
|
93
|
+
const baseGeo = this.builder.space.getGeomtry(hashed);
|
|
94
|
+
const conditonalGeo = this.builder.space.getConditionalGeomtry(hashed);
|
|
93
95
|
if (!baseGeo && !conditonalGeo)
|
|
94
96
|
continue;
|
|
95
97
|
let length = 0;
|
|
@@ -98,21 +100,28 @@ export class BoxVoxelGometryNode extends GeoemtryNode {
|
|
|
98
100
|
length = baseGeo.length;
|
|
99
101
|
for (let geoIndex = 0; geoIndex < length; geoIndex++) {
|
|
100
102
|
if (this.geomtry.aoIndex.getValue(baseGeo[geoIndex], currentIndex, trueVertexIndex)) {
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
103
|
+
this._wasAOShaded = true;
|
|
104
|
+
worldAO.vertices[v]++;
|
|
105
|
+
if (worldAO.vertices[v] > 4) {
|
|
106
|
+
shaded = true;
|
|
107
|
+
break;
|
|
108
|
+
}
|
|
104
109
|
}
|
|
105
110
|
}
|
|
106
111
|
}
|
|
107
|
-
if (!conditonalGeo)
|
|
112
|
+
if (!conditonalGeo || shaded)
|
|
108
113
|
continue;
|
|
109
114
|
length = conditonalGeo.length;
|
|
110
115
|
for (let condtionsIndex = 0; condtionsIndex < length; condtionsIndex++) {
|
|
111
116
|
const condiotnalength = conditonalGeo[condtionsIndex].length;
|
|
112
117
|
for (let geoIndex = 0; geoIndex < condiotnalength; geoIndex++) {
|
|
113
118
|
if (this.geomtry.aoIndex.getValue(conditonalGeo[condtionsIndex][geoIndex], currentIndex, trueVertexIndex)) {
|
|
114
|
-
|
|
115
|
-
|
|
119
|
+
this._wasAOShaded = true;
|
|
120
|
+
worldAO.vertices[v]++;
|
|
121
|
+
if (worldAO.vertices[v] > 4) {
|
|
122
|
+
shaded = true;
|
|
123
|
+
break;
|
|
124
|
+
}
|
|
116
125
|
}
|
|
117
126
|
}
|
|
118
127
|
}
|
|
@@ -120,18 +129,22 @@ export class BoxVoxelGometryNode extends GeoemtryNode {
|
|
|
120
129
|
}
|
|
121
130
|
}
|
|
122
131
|
shouldFlip() {
|
|
123
|
-
|
|
132
|
+
const worldAO = this.builder.vars.ao;
|
|
133
|
+
if (shouldCauseFlip(worldAO.vertices[0], worldAO.vertices[1], worldAO.vertices[2], worldAO.vertices[3]) &&
|
|
134
|
+
this._wasAOShaded)
|
|
124
135
|
return true;
|
|
125
|
-
|
|
126
|
-
|
|
136
|
+
if (this._wasAOShaded)
|
|
137
|
+
return false;
|
|
138
|
+
const worldLight = this.builder.vars.light;
|
|
139
|
+
return (shouldCauseFlip(this.lightData.getS(worldLight.vertices[0]), this.lightData.getS(worldLight.vertices[1]), this.lightData.getS(worldLight.vertices[2]), this.lightData.getS(worldLight.vertices[3])) ||
|
|
140
|
+
shouldCauseFlip(this.lightData.sumRGB(worldLight.vertices[0]), this.lightData.sumRGB(worldLight.vertices[1]), this.lightData.sumRGB(worldLight.vertices[2]), this.lightData.sumRGB(worldLight.vertices[3])));
|
|
127
141
|
}
|
|
128
|
-
add(
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
this.worldAO = tool.vars.ao;
|
|
132
|
-
this.worldLight = tool.vars.light;
|
|
142
|
+
add(args) {
|
|
143
|
+
let added = false;
|
|
144
|
+
const tool = this.builder;
|
|
133
145
|
for (let face = 0; face < 6; face++) {
|
|
134
146
|
if (args[face][ArgIndexes.Enabled] && this.isExposed(face)) {
|
|
147
|
+
added = true;
|
|
135
148
|
tool.calculateFaceData(face);
|
|
136
149
|
this.determineShading(face);
|
|
137
150
|
const faceArgs = args[face];
|
|
@@ -151,11 +164,13 @@ export class BoxVoxelGometryNode extends GeoemtryNode {
|
|
|
151
164
|
//4
|
|
152
165
|
quad.uvs.vertices[3].x = uvs[3][0];
|
|
153
166
|
quad.uvs.vertices[3].y = uvs[3][1];
|
|
154
|
-
VoxelGeometryBuilder.addQuad(tool, origin, quad);
|
|
155
|
-
|
|
167
|
+
VoxelGeometryBuilder.addQuad(tool, this.builder.origin, quad);
|
|
168
|
+
tool.updateBounds(this.quadBounds[face]);
|
|
156
169
|
}
|
|
157
170
|
}
|
|
158
|
-
this.
|
|
159
|
-
this.
|
|
171
|
+
this.builder.vars.ao.setAll(0);
|
|
172
|
+
this.builder.vars.light.setAll(0);
|
|
173
|
+
this._wasAOShaded = false;
|
|
174
|
+
return added;
|
|
160
175
|
}
|
|
161
176
|
}
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import { Vec3Array, Vec4Array
|
|
1
|
+
import { Vec3Array, Vec4Array } from "@amodx/math";
|
|
2
2
|
import { VoxelFaces } from "../../../../Math";
|
|
3
|
-
import { QuadScalarVertexData } from "../../../Geomtry/Primitives/QuadVertexData";
|
|
4
3
|
import { VoxelQuadGeometryNode } from "../../../../Models/VoxelModel.types";
|
|
5
4
|
import { Quad } from "../../../Geomtry/Primitives/Quad";
|
|
6
|
-
import { VoxelMesherDataTool } from "../../../../Mesher/Tools/VoxelMesherDataTool";
|
|
7
5
|
import { GeoemtryNode } from "../GeometryNode";
|
|
8
6
|
import { QuadVoxelGometryArgs } from "../../../../Models/Input/QuadVoxelGometryInputs";
|
|
9
7
|
import { VoxelLightData } from "../../../../Voxels/Cursor/VoxelLightData";
|
|
@@ -11,13 +9,11 @@ export declare class QuadVoxelGometryNode extends GeoemtryNode<VoxelQuadGeometry
|
|
|
11
9
|
quad: Quad;
|
|
12
10
|
quadBounds: [Vec3Array, Vec3Array];
|
|
13
11
|
vertexWeights: [Vec4Array, Vec4Array, Vec4Array, Vec4Array];
|
|
14
|
-
worldLight: QuadScalarVertexData;
|
|
15
|
-
worldAO: QuadScalarVertexData;
|
|
16
12
|
closestFace: VoxelFaces;
|
|
17
13
|
lightData: VoxelLightData;
|
|
18
14
|
init(): void;
|
|
19
15
|
isExposed(): boolean;
|
|
20
16
|
determineShading(): void;
|
|
21
17
|
shouldFlip(): boolean;
|
|
22
|
-
add(
|
|
18
|
+
add(args: QuadVoxelGometryArgs): boolean;
|
|
23
19
|
}
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import { VoxelFaces } from "../../../../Math";
|
|
2
2
|
import { VoxelGeometryBuilder } from "../../../Geomtry/VoxelGeometryBuilder";
|
|
3
|
-
import { VoxelGeometryLookUp } from "../../VoxelGeometryLookUp";
|
|
4
3
|
import { GeoemtryNode } from "../GeometryNode";
|
|
5
4
|
import { getInterpolationValue, shouldCauseFlip, } from "../../Common/Calc/CalcConstants";
|
|
6
5
|
import { VoxelRelativeCubeIndexPositionMap } from "../../../../Models/Indexing/VoxelRelativeCubeIndex";
|
|
7
6
|
import { QuadVoxelGometryInputs, } from "../../../../Models/Input/QuadVoxelGometryInputs";
|
|
8
7
|
import { GetQuadGeometryData } from "../../Common/QuadGeometryNode";
|
|
9
|
-
import { UpdateBounds } from "../../Common/BoundsFunctions";
|
|
10
8
|
import { VoxelLightData } from "../../../../Voxels/Cursor/VoxelLightData";
|
|
11
9
|
const ArgIndexes = QuadVoxelGometryInputs.ArgIndexes;
|
|
12
10
|
export class QuadVoxelGometryNode extends GeoemtryNode {
|
|
@@ -16,8 +14,6 @@ export class QuadVoxelGometryNode extends GeoemtryNode {
|
|
|
16
14
|
[0, 0, 0],
|
|
17
15
|
];
|
|
18
16
|
vertexWeights;
|
|
19
|
-
worldLight;
|
|
20
|
-
worldAO;
|
|
21
17
|
closestFace;
|
|
22
18
|
lightData = new VoxelLightData();
|
|
23
19
|
init() {
|
|
@@ -34,18 +30,20 @@ export class QuadVoxelGometryNode extends GeoemtryNode {
|
|
|
34
30
|
const faceIndexes = this.geomtry.faceCullMap[trueFaceIndex];
|
|
35
31
|
if (!faceIndexes)
|
|
36
32
|
return true;
|
|
37
|
-
const tool = this.
|
|
33
|
+
const tool = this.builder;
|
|
38
34
|
for (let positionIndex = 0; positionIndex < faceIndexes.length; positionIndex++) {
|
|
39
35
|
const currentIndex = faceIndexes[positionIndex];
|
|
40
36
|
const p = VoxelRelativeCubeIndexPositionMap[currentIndex];
|
|
41
|
-
const hashed =
|
|
42
|
-
const offsetBaseGometry =
|
|
43
|
-
const offsetConditonalGeometry =
|
|
37
|
+
const hashed = this.builder.space.getHash(tool.nVoxel, tool.position.x + p[0], tool.position.y + p[1], tool.position.z + p[2]);
|
|
38
|
+
const offsetBaseGometry = this.builder.space.getGeomtry(hashed);
|
|
39
|
+
const offsetConditonalGeometry = this.builder.space.getConditionalGeomtry(hashed);
|
|
44
40
|
if (offsetBaseGometry) {
|
|
45
41
|
for (let i = 0; i < offsetBaseGometry.length; i++) {
|
|
46
42
|
const faceIndex = this.geomtry.cullIndex.getValue(offsetBaseGometry[i], currentIndex, trueFaceIndex);
|
|
47
43
|
if (faceIndex > -1 &&
|
|
48
|
-
!
|
|
44
|
+
!this.builder
|
|
45
|
+
.space.getConstructor(hashed)
|
|
46
|
+
?.isShapeStateFaceTransparent(this.builder.space.modCache[hashed], this.builder.space.stateCache[hashed], offsetBaseGometry[i], faceIndex)) {
|
|
49
47
|
return false;
|
|
50
48
|
}
|
|
51
49
|
}
|
|
@@ -57,7 +55,9 @@ export class QuadVoxelGometryNode extends GeoemtryNode {
|
|
|
57
55
|
for (let k = 0; k < cond.length; k++) {
|
|
58
56
|
const faceIndex = this.geomtry.cullIndex.getValue(cond[k], currentIndex, trueFaceIndex);
|
|
59
57
|
if (faceIndex > -1 &&
|
|
60
|
-
!
|
|
58
|
+
!this.builder
|
|
59
|
+
.space.getConstructor(hashed)
|
|
60
|
+
?.isCondtionalStateFaceTransparent(this.builder.space.modCache[hashed], this.builder.space.stateCache[hashed], cond[i], faceIndex))
|
|
61
61
|
return false;
|
|
62
62
|
}
|
|
63
63
|
}
|
|
@@ -65,11 +65,11 @@ export class QuadVoxelGometryNode extends GeoemtryNode {
|
|
|
65
65
|
return true;
|
|
66
66
|
}
|
|
67
67
|
determineShading() {
|
|
68
|
-
const tool = this.
|
|
68
|
+
const tool = this.builder;
|
|
69
69
|
const lightData = tool.lightData[VoxelFaces.Up];
|
|
70
|
-
const noAO = this.
|
|
71
|
-
const worldLight =
|
|
72
|
-
const worldAO =
|
|
70
|
+
const noAO = this.builder.voxel.isLightSource() || this.builder.voxel.noAO();
|
|
71
|
+
const worldLight = tool.vars.light;
|
|
72
|
+
const worldAO = tool.vars.ao;
|
|
73
73
|
for (let v = 0; v < 4; v++) {
|
|
74
74
|
worldAO.vertices[v] = 0;
|
|
75
75
|
worldLight.vertices[v] = getInterpolationValue(lightData, this.vertexWeights[v]);
|
|
@@ -82,11 +82,11 @@ export class QuadVoxelGometryNode extends GeoemtryNode {
|
|
|
82
82
|
for (let positionIndex = 0; positionIndex < aoIndexes.length; positionIndex++) {
|
|
83
83
|
const currentIndex = aoIndexes[positionIndex];
|
|
84
84
|
const p = VoxelRelativeCubeIndexPositionMap[currentIndex];
|
|
85
|
-
const hashed =
|
|
86
|
-
if (
|
|
85
|
+
const hashed = this.builder.space.getHash(tool.nVoxel, tool.position.x + p[0], tool.position.y + p[1], tool.position.z + p[2]);
|
|
86
|
+
if (this.builder.space.noCastAO[hashed] === 1)
|
|
87
87
|
continue;
|
|
88
|
-
const baseGeo =
|
|
89
|
-
const conditonalGeo =
|
|
88
|
+
const baseGeo = this.builder.space.getGeomtry(hashed);
|
|
89
|
+
const conditonalGeo = this.builder.space.getConditionalGeomtry(hashed);
|
|
90
90
|
if (!baseGeo && !conditonalGeo)
|
|
91
91
|
continue;
|
|
92
92
|
let length = 0;
|
|
@@ -117,40 +117,41 @@ export class QuadVoxelGometryNode extends GeoemtryNode {
|
|
|
117
117
|
}
|
|
118
118
|
}
|
|
119
119
|
shouldFlip() {
|
|
120
|
-
|
|
120
|
+
const worldAO = this.builder.vars.ao;
|
|
121
|
+
const worldLight = this.builder.vars.light;
|
|
122
|
+
if (shouldCauseFlip(worldAO.vertices[0], worldAO.vertices[1], worldAO.vertices[2], worldAO.vertices[3]))
|
|
121
123
|
return true;
|
|
122
|
-
return (shouldCauseFlip(this.lightData.getS(
|
|
123
|
-
shouldCauseFlip(this.lightData.sumRGB(
|
|
124
|
+
return (shouldCauseFlip(this.lightData.getS(worldLight.vertices[0]), this.lightData.getS(worldLight.vertices[1]), this.lightData.getS(worldLight.vertices[2]), this.lightData.getS(worldLight.vertices[3])) ||
|
|
125
|
+
shouldCauseFlip(this.lightData.sumRGB(worldLight.vertices[0]), this.lightData.sumRGB(worldLight.vertices[1]), this.lightData.sumRGB(worldLight.vertices[2]), this.lightData.sumRGB(worldLight.vertices[3])));
|
|
124
126
|
}
|
|
125
|
-
add(
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
this.
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
this.worldAO.setAll(0);
|
|
127
|
+
add(args) {
|
|
128
|
+
if (!args[ArgIndexes.Enabled])
|
|
129
|
+
return false;
|
|
130
|
+
if (!this.isExposed())
|
|
131
|
+
return false;
|
|
132
|
+
this.builder.calculateFaceData(this.closestFace);
|
|
133
|
+
this.determineShading();
|
|
134
|
+
const quad = this.quad;
|
|
135
|
+
quad.flip = this.shouldFlip() || args[ArgIndexes.Fliped];
|
|
136
|
+
this.builder.vars.textureIndex = args[ArgIndexes.Texture];
|
|
137
|
+
quad.doubleSided = args[ArgIndexes.DoubleSided];
|
|
138
|
+
const uvs = args[ArgIndexes.UVs];
|
|
139
|
+
//1
|
|
140
|
+
quad.uvs.vertices[0].x = uvs[0][0];
|
|
141
|
+
quad.uvs.vertices[0].y = uvs[0][1];
|
|
142
|
+
//2
|
|
143
|
+
quad.uvs.vertices[1].x = uvs[1][0];
|
|
144
|
+
quad.uvs.vertices[1].y = uvs[1][1];
|
|
145
|
+
//3
|
|
146
|
+
quad.uvs.vertices[2].x = uvs[2][0];
|
|
147
|
+
quad.uvs.vertices[2].y = uvs[2][1];
|
|
148
|
+
//4
|
|
149
|
+
quad.uvs.vertices[3].x = uvs[3][0];
|
|
150
|
+
quad.uvs.vertices[3].y = uvs[3][1];
|
|
151
|
+
VoxelGeometryBuilder.addQuad(this.builder, this.builder.origin, quad);
|
|
152
|
+
this.builder.updateBounds(this.quadBounds);
|
|
153
|
+
this.builder.vars.light.setAll(0);
|
|
154
|
+
this.builder.vars.ao.setAll(0);
|
|
155
|
+
return true;
|
|
155
156
|
}
|
|
156
157
|
}
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import { Vec3Array, Vec4Array
|
|
1
|
+
import { Vec3Array, Vec4Array } from "@amodx/math";
|
|
2
2
|
import { VoxelFaces } from "../../../../Math";
|
|
3
|
-
import { QuadScalarVertexData } from "../../../Geomtry/Primitives/QuadVertexData";
|
|
4
3
|
import { VoxelBoxGeometryNode } from "../../../../Models/VoxelModel.types";
|
|
5
4
|
import { Quad } from "../../../Geomtry/Primitives/Quad";
|
|
6
|
-
import { VoxelMesherDataTool } from "../../../../Mesher/Tools/VoxelMesherDataTool";
|
|
7
5
|
import { BoxVoxelGometryArgs } from "../../../../Models/Input/BoxVoxelGometryInputs";
|
|
8
6
|
import { VoxelLightData } from "../../../../Voxels/Cursor/VoxelLightData";
|
|
9
7
|
import { GeoemtryNode } from "../GeometryNode";
|
|
@@ -16,11 +14,9 @@ export declare class RulelessBoxVoxelGeometryNode extends GeoemtryNode<VoxelBoxG
|
|
|
16
14
|
Vec4Array,
|
|
17
15
|
Vec4Array
|
|
18
16
|
]>;
|
|
19
|
-
worldLight: QuadScalarVertexData;
|
|
20
|
-
worldAO: QuadScalarVertexData;
|
|
21
17
|
lightData: VoxelLightData;
|
|
22
18
|
init(): void;
|
|
23
19
|
determineShading(face: VoxelFaces): void;
|
|
24
20
|
shouldFlip(): boolean;
|
|
25
|
-
add(
|
|
21
|
+
add(args: BoxVoxelGometryArgs): boolean;
|
|
26
22
|
}
|
|
@@ -4,14 +4,11 @@ import { getInterpolationValue, shouldCauseFlip, } from "../../Common/Calc/CalcC
|
|
|
4
4
|
import { VoxelLightData } from "../../../../Voxels/Cursor/VoxelLightData";
|
|
5
5
|
import { GeoemtryNode } from "../GeometryNode";
|
|
6
6
|
import { GetBoxGeometryNodeData } from "../../Common/BoxGeometryNode";
|
|
7
|
-
import { UpdateBounds } from "../../Common/BoundsFunctions";
|
|
8
7
|
const ArgIndexes = BoxVoxelGometryInputs.ArgIndexes;
|
|
9
8
|
export class RulelessBoxVoxelGeometryNode extends GeoemtryNode {
|
|
10
9
|
quads;
|
|
11
10
|
quadBounds = [];
|
|
12
11
|
vertexWeights;
|
|
13
|
-
worldLight;
|
|
14
|
-
worldAO;
|
|
15
12
|
lightData = new VoxelLightData();
|
|
16
13
|
init() {
|
|
17
14
|
this.faceCount = 6;
|
|
@@ -22,11 +19,11 @@ export class RulelessBoxVoxelGeometryNode extends GeoemtryNode {
|
|
|
22
19
|
this.vertexWeights = vertexWeights;
|
|
23
20
|
}
|
|
24
21
|
determineShading(face) {
|
|
25
|
-
const tool = this.
|
|
22
|
+
const tool = this.builder;
|
|
26
23
|
const lightData = tool.lightData[face];
|
|
27
|
-
const noAO = this.
|
|
28
|
-
const worldLight = this.
|
|
29
|
-
const worldAO = this.
|
|
24
|
+
const noAO = this.builder.voxel.isLightSource() || this.builder.voxel.noAO();
|
|
25
|
+
const worldLight = this.builder.vars.light;
|
|
26
|
+
const worldAO = this.builder.vars.ao;
|
|
30
27
|
for (let v = 0; v < 4; v++) {
|
|
31
28
|
worldAO.vertices[v] = 0;
|
|
32
29
|
worldLight.vertices[v] = getInterpolationValue(lightData, this.vertexWeights[face][v]);
|
|
@@ -35,18 +32,19 @@ export class RulelessBoxVoxelGeometryNode extends GeoemtryNode {
|
|
|
35
32
|
}
|
|
36
33
|
}
|
|
37
34
|
shouldFlip() {
|
|
38
|
-
|
|
35
|
+
const worldLight = this.builder.vars.light;
|
|
36
|
+
const worldAO = this.builder.vars.ao;
|
|
37
|
+
if (shouldCauseFlip(worldAO.vertices[0], worldAO.vertices[1], worldAO.vertices[2], worldAO.vertices[3]))
|
|
39
38
|
return true;
|
|
40
|
-
return (shouldCauseFlip(this.lightData.getS(
|
|
41
|
-
shouldCauseFlip(this.lightData.sumRGB(
|
|
39
|
+
return (shouldCauseFlip(this.lightData.getS(worldLight.vertices[0]), this.lightData.getS(worldLight.vertices[1]), this.lightData.getS(worldLight.vertices[2]), this.lightData.getS(worldLight.vertices[3])) ||
|
|
40
|
+
shouldCauseFlip(this.lightData.sumRGB(worldLight.vertices[0]), this.lightData.sumRGB(worldLight.vertices[1]), this.lightData.sumRGB(worldLight.vertices[2]), this.lightData.sumRGB(worldLight.vertices[3])));
|
|
42
41
|
}
|
|
43
|
-
add(
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
this.worldAO = tool.vars.ao;
|
|
47
|
-
this.worldLight = tool.vars.light;
|
|
42
|
+
add(args) {
|
|
43
|
+
const tool = this.builder;
|
|
44
|
+
let added = false;
|
|
48
45
|
for (let face = 0; face < 6; face++) {
|
|
49
46
|
if (args[face][ArgIndexes.Enabled]) {
|
|
47
|
+
added = true;
|
|
50
48
|
tool.calculateFaceData(face);
|
|
51
49
|
this.determineShading(face);
|
|
52
50
|
const faceArgs = args[face];
|
|
@@ -66,11 +64,12 @@ export class RulelessBoxVoxelGeometryNode extends GeoemtryNode {
|
|
|
66
64
|
//4
|
|
67
65
|
quad.uvs.vertices[3].x = uvs[3][0];
|
|
68
66
|
quad.uvs.vertices[3].y = uvs[3][1];
|
|
69
|
-
VoxelGeometryBuilder.addQuad(tool,
|
|
70
|
-
|
|
67
|
+
VoxelGeometryBuilder.addQuad(tool, tool.position, quad);
|
|
68
|
+
this.builder.updateBounds(this.quadBounds[face]);
|
|
71
69
|
}
|
|
72
70
|
}
|
|
73
|
-
this.
|
|
74
|
-
this.
|
|
71
|
+
this.builder.vars.light.setAll(0);
|
|
72
|
+
this.builder.vars.ao.setAll(0);
|
|
73
|
+
return added;
|
|
75
74
|
}
|
|
76
75
|
}
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import { Vec3Array, Vec4Array
|
|
1
|
+
import { Vec3Array, Vec4Array } from "@amodx/math";
|
|
2
2
|
import { VoxelFaces } from "../../../../Math";
|
|
3
|
-
import { QuadScalarVertexData } from "../../../Geomtry/Primitives/QuadVertexData";
|
|
4
3
|
import { VoxelQuadGeometryNode } from "../../../../Models/VoxelModel.types";
|
|
5
4
|
import { Quad } from "../../../Geomtry/Primitives/Quad";
|
|
6
|
-
import { VoxelMesherDataTool } from "../../../../Mesher/Tools/VoxelMesherDataTool";
|
|
7
5
|
import { QuadVoxelGometryArgs } from "../../../../Models/Input/QuadVoxelGometryInputs";
|
|
8
6
|
import { GeoemtryNode } from "../GeometryNode";
|
|
9
7
|
import { VoxelLightData } from "../../../../Voxels/Cursor/VoxelLightData";
|
|
@@ -11,12 +9,10 @@ export declare class RulelessQuadVoxelGeometryNode extends GeoemtryNode<VoxelQua
|
|
|
11
9
|
quad: Quad;
|
|
12
10
|
quadBounds: [Vec3Array, Vec3Array];
|
|
13
11
|
vertexWeights: [Vec4Array, Vec4Array, Vec4Array, Vec4Array];
|
|
14
|
-
worldLight: QuadScalarVertexData;
|
|
15
|
-
worldAO: QuadScalarVertexData;
|
|
16
12
|
closestFace: VoxelFaces;
|
|
17
13
|
lightData: VoxelLightData;
|
|
18
14
|
init(): void;
|
|
19
15
|
determineShading(): void;
|
|
20
16
|
shouldFlip(): boolean;
|
|
21
|
-
add(
|
|
17
|
+
add(args: QuadVoxelGometryArgs): boolean;
|
|
22
18
|
}
|