@divinevoxel/vlox 0.0.72 → 0.0.74
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Contexts/Base/Remote/InitDataSync.js +4 -0
- package/Contexts/Base/Remote/InitWorldDataSync.js +1 -1
- package/Contexts/Render/DivineVoxelEngineRender.d.ts +2 -1
- package/Contexts/World/DivineVoxelEngineWorld.d.ts +2 -1
- package/Init/StartConstructor.js +8 -4
- package/Init/StartWorld.d.ts +1 -1
- package/Math/index.d.ts +5 -1
- package/Mesher/Functions/CompactVoxelMesh.d.ts +2 -2
- package/Mesher/Functions/CompactVoxelMesh.js +1 -1
- package/Mesher/Functions/CompactVoxelSectionMesh.d.ts +4 -0
- package/Mesher/Functions/CompactVoxelSectionMesh.js +112 -0
- package/Mesher/Functions/MeshSection.d.ts +1 -1
- package/Mesher/Functions/MeshSection.js +27 -22
- package/Mesher/Functions/MeshTexture.d.ts +1 -1
- package/Mesher/Functions/MeshTexture.js +3 -4
- package/Mesher/Geomtry/CompactedSectionVoxelMesh.d.ts +23 -0
- package/Mesher/Geomtry/CompactedSectionVoxelMesh.js +144 -0
- package/Mesher/Geomtry/Primitives/QuadVertexData.d.ts +12 -10
- package/Mesher/Geomtry/Primitives/QuadVertexData.js +49 -56
- package/Mesher/Geomtry/VoxelGeometryBuilder.d.ts +2 -2
- package/Mesher/Geomtry/VoxelGeometryBuilder.js +120 -199
- package/Mesher/Geomtry/VoxelMesh.d.ts +1 -1
- package/Mesher/Geomtry/VoxelMesh.js +4 -4
- package/Mesher/Geomtry/VoxelMeshBVHBuilder.d.ts +16 -0
- package/Mesher/Geomtry/VoxelMeshBVHBuilder.js +51 -0
- package/Mesher/Geomtry/VoxelMeshBVHStructCursor.d.ts +22 -0
- package/Mesher/Geomtry/VoxelMeshBVHStructCursor.js +78 -0
- package/Mesher/Geomtry/{Buffers.js → VoxelMeshBuffers.js} +2 -2
- package/Mesher/Geomtry/index.d.ts +0 -1
- package/Mesher/Geomtry/index.js +0 -1
- package/Mesher/InitMesher.js +1 -1
- package/Mesher/InitTask.js +9 -23
- package/Mesher/Models/Common/BoxGeometryNode.js +7 -7
- package/Mesher/Models/Common/Calc/CalcConstants.d.ts +1 -1
- package/Mesher/Models/Common/Calc/CalcConstants.js +1 -1
- package/Mesher/Models/Common/Calc/FaceDataCalc.d.ts +2 -2
- package/Mesher/Models/Common/Calc/FaceDataCalc.js +37 -30
- package/Mesher/Models/Common/QuadGeometryNode.js +2 -2
- package/Mesher/Models/Nodes/Custom/Liquid/FlowGradient.d.ts +2 -2
- package/Mesher/Models/Nodes/Custom/Liquid/FlowGradient.js +1 -1
- package/Mesher/Models/Nodes/Custom/Liquid/LiquidGeomtryNode.js +18 -24
- package/Mesher/Models/Nodes/GeometryNode.d.ts +2 -2
- package/Mesher/Models/Nodes/Ruled/BoxVoxelGeometryNode.d.ts +1 -0
- package/Mesher/Models/Nodes/Ruled/BoxVoxelGeometryNode.js +40 -31
- package/Mesher/Models/Nodes/Ruled/QuadVoxelGeometryNode.js +2 -2
- package/Mesher/Models/Nodes/Ruleless/RulelessBoxVoxelGeometryNode.js +2 -2
- package/Mesher/Models/Nodes/Ruleless/RulelessQuadVoxelGeometryNode.js +2 -2
- package/Mesher/{Tools → Models/Protocols}/OutlinedVoxelTool.d.ts +1 -1
- package/Mesher/{Tools → Models/Protocols}/OutlinedVoxelTool.js +1 -1
- package/Mesher/Models/RenderedMaterials.d.ts +6 -0
- package/Mesher/{RenderedMaterials.js → Models/RenderedMaterials.js} +2 -2
- package/Mesher/Models/VoxelConstructor.d.ts +6 -6
- package/Mesher/Models/VoxelConstructor.js +8 -8
- package/Mesher/Models/VoxelGeometryBuilderCacheSpace.d.ts +3 -5
- package/Mesher/Models/VoxelGeometryBuilderCacheSpace.js +8 -32
- package/Mesher/{Tools/VoxelMesherDataTool.d.ts → Models/VoxelModelBuilder.d.ts} +4 -5
- package/Mesher/{Tools/VoxelMesherDataTool.js → Models/VoxelModelBuilder.js} +5 -8
- package/Mesher/Types/Mesher.types.d.ts +1 -0
- package/Models/Defaults/CubeVoxelGeometry.js +4 -0
- package/Models/Defaults/CubeVoxelModels.js +360 -383
- package/Models/Defaults/LiquidVoxelModel.js +5 -5
- package/Models/Defaults/PanelVoxelModels.js +442 -468
- package/Models/Defaults/StairVoxelModel.js +582 -597
- package/Models/Examples.js +490 -498
- package/Models/Rules/Classes/VoxelRulesModel.d.ts +1 -1
- package/Models/Rules/Classes/VoxelRulesModel.js +3 -3
- package/Models/Rules/Functions/BuildFinalInputs.d.ts +1 -1
- package/Models/Rules/Functions/BuildFinalInputs.js +21 -19
- package/Models/Rules/Functions/BuildGeomtryInputs.js +8 -5
- package/Models/Rules/Functions/BuildRules.js +2 -2
- package/Models/Rules/{VoxelModelManager.d.ts → VoxelModelRuleBuilderRegister.d.ts} +1 -1
- package/Models/Rules/VoxelModelRuleBuilderRegister.js +178 -0
- package/Models/VoxelModel.types.d.ts +17 -8
- package/Renderer/Classes/DVESectionMeshes.d.ts +2 -3
- package/Renderer/Classes/SectorMesh.d.ts +3 -4
- package/Renderer/Classes/SectorMesh.js +6 -11
- package/Renderer/InitTasks.js +1 -10
- package/Renderer/MeshManager.d.ts +1 -1
- package/Renderer/MeshManager.js +26 -25
- package/Renderer/MeshRegister.d.ts +5 -5
- package/Renderer/MeshRegister.js +4 -3
- package/Settings/EngineSettings.d.ts +2 -1
- package/Settings/EngineSettings.js +6 -5
- package/Settings/EngineSettings.types.d.ts +24 -39
- package/Settings/EngineSettings.types.js +22 -29
- package/Tasks/Logic/InitTasks.d.ts +1 -0
- package/Tasks/Logic/InitTasks.js +10 -0
- package/Tasks/Logic/VoxelLogicUpdate.d.ts +3 -0
- package/Tasks/Logic/VoxelLogicUpdate.js +71 -0
- package/Tasks/Propagation/Explosion/ExplosionManager.d.ts +2 -2
- package/Tasks/Propagation/Explosion/ExplosionManager.js +1 -2
- package/Tasks/Propagation/Flow/FlowManager.d.ts +4 -4
- package/Tasks/Propagation/Flow/FlowRemove.d.ts +2 -2
- package/Tasks/Propagation/Flow/FlowUpdate.d.ts +2 -2
- package/Tasks/Propagation/Flow/WorldFlow.d.ts +2 -2
- package/Tasks/Propagation/Illumanation/RGBUpdate.d.ts +3 -3
- package/Tasks/Propagation/Illumanation/SunUpdate.d.ts +3 -3
- package/Tasks/Propagation/Illumanation/WorldRGB.d.ts +2 -2
- package/Tasks/Propagation/Illumanation/WorldSun.d.ts +2 -2
- package/Tasks/Propagation/Illumanation/WorldSun.js +8 -15
- package/Tasks/Propagation/InitTasks.js +4 -4
- package/Tasks/Propagation/Power/PowerUpdate.d.ts +3 -0
- package/Tasks/Propagation/Power/PowerUpdate.js +80 -0
- package/Tasks/Tasks.types.d.ts +2 -2
- package/Tasks/TasksIds.d.ts +2 -1
- package/Tasks/TasksIds.js +1 -0
- package/Tasks/Update/Common.d.ts +3 -0
- package/Tasks/Update/Common.js +41 -0
- package/Tasks/Update/EreaseUpdate.d.ts +3 -0
- package/Tasks/Update/EreaseUpdate.js +66 -0
- package/Tasks/Update/InitTasks.d.ts +2 -2
- package/Tasks/Update/InitTasks.js +3 -1
- package/Tasks/Update/PaintUpdate.d.ts +3 -0
- package/Tasks/Update/PaintUpdate.js +89 -0
- package/Tasks/Update/VoxelUpdate.d.ts +2 -5
- package/Tasks/Update/VoxelUpdate.js +7 -143
- package/Tasks/{Update/UpdateTask.d.ts → VoxelUpdateTask.d.ts} +16 -6
- package/Tasks/{Update/UpdateTask.js → VoxelUpdateTask.js} +44 -5
- package/Tasks/WorldGeneration/WorldGenBrush.d.ts +3 -3
- package/Tasks/WorldGeneration/WorldGenBrush.js +3 -3
- package/Tasks/WorldGeneration/WorldGenRegister.d.ts +1 -1
- package/Templates/Cursor/TemplateCursor.d.ts +2 -2
- package/Templates/Cursor/TemplateCursor.js +1 -2
- package/Templates/Functions/CreateTemplate.d.ts +1 -1
- package/Templates/VoxelTemplates.types.d.ts +1 -1
- package/Textures/Classes/CompiledTexture.d.ts +18 -0
- package/Textures/Classes/CompiledTexture.js +50 -0
- package/Textures/Classes/CompiledTextureAnimation.d.ts +12 -0
- package/Textures/Classes/CompiledTextureAnimation.js +27 -0
- package/Textures/Classes/TextureAnimationTexture.d.ts +10 -0
- package/Textures/Classes/TextureAnimationTexture.js +32 -0
- package/Textures/Functions/BuildTextureData.d.ts +10 -0
- package/Textures/Functions/BuildTextureData.js +205 -0
- package/Textures/Texture.types.d.ts +50 -64
- package/Textures/TextureManager.d.ts +8 -19
- package/Textures/TextureManager.js +28 -166
- package/Tools/Brush/AdvancedBrushTool.js +1 -1
- package/Tools/Brush/Brush.d.ts +3 -3
- package/Tools/Brush/Brush.js +40 -8
- package/Tools/Tasks/TasksTool.d.ts +1 -0
- package/Tools/Tasks/TasksTool.js +2 -0
- package/Util/Binary/BinaryArrays.d.ts +6 -0
- package/Util/Binary/BinaryArrays.js +25 -0
- package/Util/Binary/BinaryBuffer.d.ts +35 -0
- package/Util/Binary/BinaryBuffer.js +136 -0
- package/Util/Binary/{BitArray.d.ts → BinaryFunctions.d.ts} +1 -2
- package/Util/Binary/BinaryFunctions.js +11 -0
- package/{Mesher/Tools/VoxelMeshBVHBuilder.d.ts → Util/Binary/BinaryTree.d.ts} +1 -33
- package/Util/Binary/BinaryTree.js +104 -0
- package/Voxels/Cursor/DataCursor.interface.d.ts +5 -0
- package/Voxels/Cursor/VoxelCursor.interface.d.ts +8 -3
- package/Voxels/Cursor/VoxelCursor.interface.js +54 -13
- package/Voxels/Cursor/VoxelLightData.js +1 -1
- package/Voxels/Data/VoxelPalettesRegister.d.ts +0 -5
- package/Voxels/Data/VoxelPalettesRegister.js +0 -9
- package/Voxels/Data/VoxelTag.types.d.ts +17 -2
- package/Voxels/Data/VoxelTag.types.js +6 -1
- package/Voxels/Data/VoxelTagsRegister.js +12 -7
- package/Voxels/Functions/BuildStateData.d.ts +6 -6
- package/Voxels/Functions/BuildStateData.js +37 -37
- package/Voxels/Functions/BuildTagAndPaletteData.js +6 -3
- package/Voxels/Indexes/VoxelIndex.d.ts +2 -2
- package/Voxels/Indexes/VoxelIndex.js +16 -18
- package/Voxels/InitVoxelData.js +24 -21
- package/Voxels/Logic/Classes/Default/Types/VoxelPoweredLogicType.d.ts +5 -0
- package/Voxels/Logic/Classes/Default/Types/VoxelPoweredLogicType.js +6 -0
- package/Voxels/Logic/Classes/VoxelLogic.d.ts +11 -0
- package/Voxels/Logic/Classes/VoxelLogic.js +49 -0
- package/Voxels/Logic/Classes/VoxelLogicType.d.ts +4 -0
- package/Voxels/Logic/Classes/VoxelLogicType.js +2 -0
- package/Voxels/Logic/VoxelLogic.types.d.ts +23 -0
- package/Voxels/Logic/VoxelLogic.types.js +1 -0
- package/Voxels/Logic/VoxelLogicRegister.d.ts +9 -0
- package/Voxels/Logic/VoxelLogicRegister.js +15 -0
- package/Voxels/State/Schema/StateSchema.d.ts +1 -1
- package/Voxels/State/SchemaRegister.js +10 -5
- package/Voxels/State/State.types.d.ts +1 -1
- package/Voxels/State/StateTreeReader.d.ts +1 -1
- package/Voxels/State/StateTreeReader.js +2 -3
- package/Voxels/Types/Voxel.types.d.ts +21 -0
- package/Voxels/Types/Voxel.types.js +6 -2
- package/Voxels/Types/VoxelModelCompiledData.types.d.ts +6 -4
- package/World/Archive/Archive.types.d.ts +65 -42
- package/World/Archive/Classes/ArchiveClasses.d.ts +66 -0
- package/World/Archive/Classes/ArchiveClasses.js +78 -0
- package/World/Archive/Classes/ImportedSection.d.ts +40 -0
- package/World/Archive/Classes/ImportedSection.js +307 -0
- package/World/Archive/Classes/ImportedSector.d.ts +23 -0
- package/World/Archive/Classes/ImportedSector.js +97 -0
- package/World/Archive/Functions/ArchiveArea.d.ts +1 -1
- package/World/Archive/Functions/ArchiveArea.js +49 -54
- package/World/Archive/Functions/ArchiveSector.js +373 -282
- package/World/Archive/Functions/CreateArchivedSection.d.ts +3 -0
- package/World/Archive/Functions/CreateArchivedSection.js +207 -0
- package/World/Archive/Functions/ImportSector.d.ts +2 -4
- package/World/Archive/Functions/ImportSector.js +50 -220
- package/World/Archive/Functions/RemoveDuplicates.d.ts +3 -0
- package/World/Archive/Functions/RemoveDuplicates.js +92 -0
- package/World/Archive/Functions/Shared.d.ts +6 -0
- package/World/Archive/Functions/Shared.js +50 -0
- package/World/Archive/InitTasks.js +37 -23
- package/World/Cursor/SectionCursor.d.ts +3 -3
- package/World/Cursor/SectionCursor.js +2 -3
- package/World/Cursor/SectorCursor.d.ts +3 -3
- package/World/Cursor/SectorCursor.js +1 -2
- package/World/Cursor/WorldCursor.d.ts +6 -5
- package/World/Cursor/WorldCursor.js +17 -15
- package/World/Cursor/WorldVoxelCursor.d.ts +0 -4
- package/World/Cursor/WorldVoxelCursor.js +24 -14
- package/World/Dimension/Dimension.d.ts +4 -1
- package/World/Dimension/Dimension.js +8 -1
- package/World/InitTasks.d.ts +1 -1
- package/World/Lock/WorldLock.d.ts +1 -1
- package/World/Section/Section.d.ts +27 -18
- package/World/Section/Section.js +125 -21
- package/World/Section/SectionState.d.ts +12 -0
- package/World/Section/SectionState.js +13 -0
- package/World/Sector/Sector.d.ts +20 -6
- package/World/Sector/Sector.js +100 -17
- package/World/Sector/SectorHeightMap.js +2 -2
- package/World/Sector/SectorState.d.ts +16 -7
- package/World/Sector/SectorState.js +29 -15
- package/World/Types/WorldData.types.d.ts +2 -7
- package/World/Types/WorldStorage.interface.js +1 -0
- package/World/WorldRegister.d.ts +13 -9
- package/World/WorldRegister.js +24 -9
- package/World/WorldSpaces.d.ts +4 -0
- package/World/WorldSpaces.js +25 -12
- package/{Tasks/IWG → WorldSimulation}/Internal/Classes/DimensionSegment.d.ts +2 -2
- package/{Tasks/IWG → WorldSimulation}/Internal/Classes/Generator.d.ts +10 -3
- package/{Tasks/IWG → WorldSimulation}/Internal/Classes/Generator.js +19 -3
- package/WorldSimulation/Internal/Classes/Queues/BuildQueue.d.ts +5 -0
- package/WorldSimulation/Internal/Classes/Queues/BuildQueue.js +6 -0
- package/WorldSimulation/Internal/Classes/Queues/LogiccQueue.d.ts +5 -0
- package/WorldSimulation/Internal/Classes/Queues/LogiccQueue.js +6 -0
- package/{Tasks/IWG → WorldSimulation}/Internal/Classes/SectorVisistedMap.js +1 -1
- package/WorldSimulation/Internal/Classes/TickQueue.d.ts +12 -0
- package/WorldSimulation/Internal/Classes/TickQueue.js +58 -0
- package/WorldSimulation/Internal/Classes/WorldSimulationTaskBase.d.ts +15 -0
- package/{Tasks/IWG/Internal/Classes/IWGTaskBase.js → WorldSimulation/Internal/Classes/WorldSimulationTaskBase.js} +8 -8
- package/{Tasks/IWG → WorldSimulation}/Internal/Functions/cullSectors.js +9 -9
- package/{Tasks/IWG → WorldSimulation}/Internal/Functions/getSectorState.d.ts +1 -1
- package/{Tasks/IWG → WorldSimulation}/Internal/Functions/getSectorState.js +4 -4
- package/WorldSimulation/Internal/Functions/runTickUpdate.d.ts +2 -0
- package/{Tasks/IWG/Internal/Functions/runBuildUpdate.js → WorldSimulation/Internal/Functions/runTickUpdate.js} +38 -9
- package/{Tasks/IWG → WorldSimulation}/Internal/Functions/runWorldUpdate.js +13 -13
- package/{Tasks/IWG → WorldSimulation}/Internal/TaskRegister.d.ts +2 -2
- package/{Tasks/IWG → WorldSimulation}/Internal/TaskRegister.js +1 -1
- package/WorldSimulation/Internal/WorldSimulationDimensions.d.ts +6 -0
- package/{Tasks/IWG/Internal/IWGDimensions.js → WorldSimulation/Internal/WorldSimulationDimensions.js} +1 -1
- package/WorldSimulation/Internal/WorldSimulationTasks.d.ts +30 -0
- package/{Tasks/IWG/Internal/IWGTasks.js → WorldSimulation/Internal/WorldSimulationTasks.js} +14 -24
- package/WorldSimulation/Internal/WorldSimulationTools.d.ts +8 -0
- package/{Tasks/IWG/Internal/IWGTools.js → WorldSimulation/Internal/WorldSimulationTools.js} +1 -1
- package/{Tasks/IWG → WorldSimulation}/Procedures/InitalLoad.d.ts +1 -1
- package/{Tasks/IWG → WorldSimulation}/Procedures/InitalLoad.js +11 -11
- package/{Tasks/IWG → WorldSimulation}/Procedures/SaveAllSectors.js +7 -5
- package/{Tasks/IWG/IWG.d.ts → WorldSimulation/WorldSimulation.d.ts} +6 -5
- package/{Tasks/IWG/IWG.js → WorldSimulation/WorldSimulation.js} +29 -23
- package/{Tasks/IWG → WorldSimulation}/index.d.ts +1 -1
- package/{Tasks/IWG → WorldSimulation}/index.js +1 -1
- package/package.json +1 -1
- package/Mesher/Functions/CompactMesh.d.ts +0 -2
- package/Mesher/Functions/CompactMesh.js +0 -42
- package/Mesher/Geomtry/GeometryNormals.d.ts +0 -10
- package/Mesher/Geomtry/GeometryNormals.js +0 -52
- package/Mesher/Geomtry/MeshData.types.d.ts +0 -13
- package/Mesher/Geomtry/MeshData.types.js +0 -6
- package/Mesher/Geomtry/Tools/MesherDataTools.d.ts +0 -7
- package/Mesher/Geomtry/Tools/MesherDataTools.js +0 -12
- package/Mesher/Geomtry/Tools/index.d.ts +0 -1
- package/Mesher/Geomtry/Tools/index.js +0 -1
- package/Mesher/RenderedMaterials.d.ts +0 -6
- package/Mesher/Tools/VoxelMeshBVHBuilder.js +0 -216
- package/Models/Rules/VoxelModelManager.js +0 -82
- package/Tasks/IWG/Internal/Classes/IWGTaskBase.d.ts +0 -15
- package/Tasks/IWG/Internal/Functions/runBuildUpdate.d.ts +0 -2
- package/Tasks/IWG/Internal/IWGDimensions.d.ts +0 -6
- package/Tasks/IWG/Internal/IWGTasks.d.ts +0 -34
- package/Tasks/IWG/Internal/IWGTools.d.ts +0 -8
- package/Textures/TextureAnimations.d.ts +0 -4
- package/Textures/TextureAnimations.js +0 -35
- package/Textures/TextureArray.d.ts +0 -47
- package/Textures/TextureArray.js +0 -202
- package/Textures/TextureBuilder.d.ts +0 -13
- package/Textures/TextureBuilder.js +0 -120
- package/Textures/TextureRegister.d.ts +0 -9
- package/Textures/TextureRegister.js +0 -28
- package/Tools/DataCursor.interface.d.ts +0 -5
- package/Tools/DataCursor.interface.js +0 -2
- package/Util/Binary/BitArray.js +0 -16
- package/World/Structs/WorldDataStructProperties.d.ts +0 -8
- package/World/Structs/WorldDataStructProperties.js +0 -9
- /package/Mesher/Geomtry/{Buffers.d.ts → VoxelMeshBuffers.d.ts} +0 -0
- /package/Mesher/{Tools → Geomtry}/VoxelMeshVertexStructCursor.d.ts +0 -0
- /package/Mesher/{Tools → Geomtry}/VoxelMeshVertexStructCursor.js +0 -0
- /package/Mesher/{VoxelShaderData.d.ts → Geomtry/VoxelShaderData.d.ts} +0 -0
- /package/Mesher/{VoxelShaderData.js → Geomtry/VoxelShaderData.js} +0 -0
- /package/{World/Storage/WorldStorage.interface.js → Voxels/Cursor/DataCursor.interface.js} +0 -0
- /package/World/{Storage → Types}/WorldStorage.interface.d.ts +0 -0
- /package/{Tasks/IWG → WorldSimulation}/Internal/Classes/DimensionSegment.js +0 -0
- /package/{Tasks/IWG → WorldSimulation}/Internal/Classes/SectorState.d.ts +0 -0
- /package/{Tasks/IWG → WorldSimulation}/Internal/Classes/SectorState.js +0 -0
- /package/{Tasks/IWG → WorldSimulation}/Internal/Classes/SectorVisistedMap.d.ts +0 -0
- /package/{Tasks/IWG → WorldSimulation}/Internal/Functions/cullSectors.d.ts +0 -0
- /package/{Tasks/IWG → WorldSimulation}/Internal/Functions/runWorldUpdate.d.ts +0 -0
- /package/{Tasks/IWG → WorldSimulation}/Procedures/SaveAllSectors.d.ts +0 -0
|
@@ -4,13 +4,14 @@ import { getInterpolationValue, shouldCauseFlip, } from "../../Common/Calc/CalcC
|
|
|
4
4
|
import { VoxelRelativeCubeIndexPositionMap } from "../../../../Models/Indexing/VoxelRelativeCubeIndex";
|
|
5
5
|
import { GetBoxGeometryNodeData } from "../../Common/BoxGeometryNode";
|
|
6
6
|
import { VoxelLightData } from "../../../../Voxels/Cursor/VoxelLightData";
|
|
7
|
-
import {
|
|
7
|
+
import { addVoxelQuad, } from "../../../Geomtry/VoxelGeometryBuilder";
|
|
8
8
|
import { VoxelModelConstructorRegister } from "../../../Models/VoxelModelConstructorRegister";
|
|
9
9
|
const ArgIndexes = BoxVoxelGometryInputs.ArgIndexes;
|
|
10
10
|
export class BoxVoxelGometryNode extends GeoemtryNode {
|
|
11
11
|
quads;
|
|
12
12
|
quadBounds = [];
|
|
13
13
|
vertexWeights;
|
|
14
|
+
_wasAOShaded = false;
|
|
14
15
|
lightData = new VoxelLightData();
|
|
15
16
|
init() {
|
|
16
17
|
this.faceCount = 6;
|
|
@@ -25,15 +26,15 @@ export class BoxVoxelGometryNode extends GeoemtryNode {
|
|
|
25
26
|
const faceIndexes = this.geomtry.faceCullMap[trueFaceIndex];
|
|
26
27
|
if (!faceIndexes)
|
|
27
28
|
return true;
|
|
28
|
-
const
|
|
29
|
+
const builder = this.builder;
|
|
29
30
|
for (let positionIndex = 0; positionIndex < faceIndexes.length; positionIndex++) {
|
|
30
31
|
const currentIndex = faceIndexes[positionIndex];
|
|
31
32
|
const p = VoxelRelativeCubeIndexPositionMap[currentIndex];
|
|
32
|
-
const hashed = this.builder.space.getHash(
|
|
33
|
+
const hashed = this.builder.space.getHash(builder.nVoxel, builder.position.x + p[0], builder.position.y + p[1], builder.position.z + p[2]);
|
|
33
34
|
if (this.builder.space.foundHash[hashed] < 2)
|
|
34
35
|
continue;
|
|
36
|
+
const constructor = this.builder.space.getConstructor(hashed);
|
|
35
37
|
const offsetBaseGometry = this.builder.space.getGeomtry(hashed);
|
|
36
|
-
const offsetConditonalGeometry = this.builder.space.getConditionalGeomtry(hashed);
|
|
37
38
|
if (offsetBaseGometry) {
|
|
38
39
|
for (let i = 0; i < offsetBaseGometry.length; i++) {
|
|
39
40
|
const geoId = offsetBaseGometry[i];
|
|
@@ -41,27 +42,24 @@ export class BoxVoxelGometryNode extends GeoemtryNode {
|
|
|
41
42
|
continue;
|
|
42
43
|
const faceIndex = this.geomtry.cullIndex.getValue(geoId, currentIndex, trueFaceIndex);
|
|
43
44
|
if (faceIndex > -1 &&
|
|
44
|
-
!this.builder
|
|
45
|
-
.space.getConstructor(hashed)
|
|
46
|
-
?.isShapeStateFaceTransparent(this.builder.space.modCache[hashed], this.builder.space.stateCache[hashed], geoId, faceIndex)) {
|
|
45
|
+
!constructor.isShapeStateFaceTransparent(this.builder.space.modCache[hashed], this.builder.space.stateCache[hashed], geoId, faceIndex)) {
|
|
47
46
|
return false;
|
|
48
47
|
}
|
|
49
48
|
}
|
|
50
49
|
}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
return false;
|
|
50
|
+
const offsetConditonalGeometry = this.builder.space.getConditionalGeomtry(hashed);
|
|
51
|
+
if (offsetConditonalGeometry) {
|
|
52
|
+
for (let i = 0; i < offsetConditonalGeometry.length; i++) {
|
|
53
|
+
const cond = offsetConditonalGeometry[i];
|
|
54
|
+
for (let k = 0; k < cond.length; k++) {
|
|
55
|
+
const geoId = cond[k];
|
|
56
|
+
if (VoxelModelConstructorRegister.rulesless[geoId])
|
|
57
|
+
continue;
|
|
58
|
+
const faceIndex = this.geomtry.cullIndex.getValue(geoId, currentIndex, trueFaceIndex);
|
|
59
|
+
if (faceIndex > -1 &&
|
|
60
|
+
!constructor.isCondtionalStateFaceTransparent(this.builder.space.modCache[hashed], this.builder.space.stateCache[hashed], geoId, faceIndex))
|
|
61
|
+
return false;
|
|
62
|
+
}
|
|
65
63
|
}
|
|
66
64
|
}
|
|
67
65
|
}
|
|
@@ -99,21 +97,28 @@ export class BoxVoxelGometryNode extends GeoemtryNode {
|
|
|
99
97
|
length = baseGeo.length;
|
|
100
98
|
for (let geoIndex = 0; geoIndex < length; geoIndex++) {
|
|
101
99
|
if (this.geomtry.aoIndex.getValue(baseGeo[geoIndex], currentIndex, trueVertexIndex)) {
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
100
|
+
this._wasAOShaded = true;
|
|
101
|
+
worldAO.vertices[v]++;
|
|
102
|
+
if (worldAO.vertices[v] >= 3) {
|
|
103
|
+
shaded = true;
|
|
104
|
+
break;
|
|
105
|
+
}
|
|
105
106
|
}
|
|
106
107
|
}
|
|
107
108
|
}
|
|
108
|
-
if (!conditonalGeo)
|
|
109
|
+
if (!conditonalGeo || shaded)
|
|
109
110
|
continue;
|
|
110
111
|
length = conditonalGeo.length;
|
|
111
112
|
for (let condtionsIndex = 0; condtionsIndex < length; condtionsIndex++) {
|
|
112
113
|
const condiotnalength = conditonalGeo[condtionsIndex].length;
|
|
113
114
|
for (let geoIndex = 0; geoIndex < condiotnalength; geoIndex++) {
|
|
114
115
|
if (this.geomtry.aoIndex.getValue(conditonalGeo[condtionsIndex][geoIndex], currentIndex, trueVertexIndex)) {
|
|
115
|
-
|
|
116
|
-
|
|
116
|
+
this._wasAOShaded = true;
|
|
117
|
+
worldAO.vertices[v]++;
|
|
118
|
+
if (worldAO.vertices[v] >= 3) {
|
|
119
|
+
shaded = true;
|
|
120
|
+
break;
|
|
121
|
+
}
|
|
117
122
|
}
|
|
118
123
|
}
|
|
119
124
|
}
|
|
@@ -122,9 +127,12 @@ export class BoxVoxelGometryNode extends GeoemtryNode {
|
|
|
122
127
|
}
|
|
123
128
|
shouldFlip() {
|
|
124
129
|
const worldAO = this.builder.vars.ao;
|
|
125
|
-
|
|
126
|
-
|
|
130
|
+
if (shouldCauseFlip(worldAO.vertices[0], worldAO.vertices[1], worldAO.vertices[2], worldAO.vertices[3]) &&
|
|
131
|
+
this._wasAOShaded)
|
|
127
132
|
return true;
|
|
133
|
+
if (this._wasAOShaded)
|
|
134
|
+
return false;
|
|
135
|
+
const worldLight = this.builder.vars.light;
|
|
128
136
|
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])) ||
|
|
129
137
|
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])));
|
|
130
138
|
}
|
|
@@ -134,10 +142,10 @@ export class BoxVoxelGometryNode extends GeoemtryNode {
|
|
|
134
142
|
for (let face = 0; face < 6; face++) {
|
|
135
143
|
if (args[face][ArgIndexes.Enabled] && this.isExposed(face)) {
|
|
136
144
|
added = true;
|
|
145
|
+
const quad = this.quads[face];
|
|
137
146
|
tool.calculateFaceData(face);
|
|
138
147
|
this.determineShading(face);
|
|
139
148
|
const faceArgs = args[face];
|
|
140
|
-
const quad = this.quads[face];
|
|
141
149
|
quad.flip = this.shouldFlip() || faceArgs[ArgIndexes.Fliped];
|
|
142
150
|
tool.vars.textureIndex = faceArgs[ArgIndexes.Texture];
|
|
143
151
|
const uvs = faceArgs[ArgIndexes.UVs];
|
|
@@ -153,12 +161,13 @@ export class BoxVoxelGometryNode extends GeoemtryNode {
|
|
|
153
161
|
//4
|
|
154
162
|
quad.uvs.vertices[3].x = uvs[3][0];
|
|
155
163
|
quad.uvs.vertices[3].y = uvs[3][1];
|
|
156
|
-
|
|
164
|
+
addVoxelQuad(tool, this.builder.origin, quad);
|
|
157
165
|
tool.updateBounds(this.quadBounds[face]);
|
|
158
166
|
}
|
|
159
167
|
}
|
|
160
168
|
this.builder.vars.ao.setAll(0);
|
|
161
169
|
this.builder.vars.light.setAll(0);
|
|
170
|
+
this._wasAOShaded = false;
|
|
162
171
|
return added;
|
|
163
172
|
}
|
|
164
173
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { VoxelFaces } from "../../../../Math";
|
|
2
|
-
import {
|
|
2
|
+
import { addVoxelQuad } from "../../../Geomtry/VoxelGeometryBuilder";
|
|
3
3
|
import { GeoemtryNode } from "../GeometryNode";
|
|
4
4
|
import { getInterpolationValue, shouldCauseFlip, } from "../../Common/Calc/CalcConstants";
|
|
5
5
|
import { VoxelRelativeCubeIndexPositionMap } from "../../../../Models/Indexing/VoxelRelativeCubeIndex";
|
|
@@ -148,7 +148,7 @@ export class QuadVoxelGometryNode extends GeoemtryNode {
|
|
|
148
148
|
//4
|
|
149
149
|
quad.uvs.vertices[3].x = uvs[3][0];
|
|
150
150
|
quad.uvs.vertices[3].y = uvs[3][1];
|
|
151
|
-
|
|
151
|
+
addVoxelQuad(this.builder, this.builder.origin, quad);
|
|
152
152
|
this.builder.updateBounds(this.quadBounds);
|
|
153
153
|
this.builder.vars.light.setAll(0);
|
|
154
154
|
this.builder.vars.ao.setAll(0);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { addVoxelQuad } from "../../../Geomtry/VoxelGeometryBuilder";
|
|
2
2
|
import { BoxVoxelGometryInputs, } from "../../../../Models/Input/BoxVoxelGometryInputs";
|
|
3
3
|
import { getInterpolationValue, shouldCauseFlip, } from "../../Common/Calc/CalcConstants";
|
|
4
4
|
import { VoxelLightData } from "../../../../Voxels/Cursor/VoxelLightData";
|
|
@@ -64,7 +64,7 @@ export class RulelessBoxVoxelGeometryNode extends GeoemtryNode {
|
|
|
64
64
|
//4
|
|
65
65
|
quad.uvs.vertices[3].x = uvs[3][0];
|
|
66
66
|
quad.uvs.vertices[3].y = uvs[3][1];
|
|
67
|
-
|
|
67
|
+
addVoxelQuad(tool, tool.position, quad);
|
|
68
68
|
this.builder.updateBounds(this.quadBounds[face]);
|
|
69
69
|
}
|
|
70
70
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { VoxelFaces } from "../../../../Math";
|
|
2
|
-
import {
|
|
2
|
+
import { addVoxelQuad, } from "../../../Geomtry/VoxelGeometryBuilder";
|
|
3
3
|
import { getInterpolationValue, shouldCauseFlip, } from "../../Common/Calc/CalcConstants";
|
|
4
4
|
import { QuadVoxelGometryInputs, } from "../../../../Models/Input/QuadVoxelGometryInputs";
|
|
5
5
|
import { GeoemtryNode } from "../GeometryNode";
|
|
@@ -68,7 +68,7 @@ export class RulelessQuadVoxelGeometryNode extends GeoemtryNode {
|
|
|
68
68
|
//4
|
|
69
69
|
quad.uvs.vertices[3].x = uvs[3][0];
|
|
70
70
|
quad.uvs.vertices[3].y = uvs[3][1];
|
|
71
|
-
|
|
71
|
+
addVoxelQuad(tool, tool.position, quad);
|
|
72
72
|
this.builder.updateBounds(this.quadBounds);
|
|
73
73
|
this.builder.vars.light.setAll(0);
|
|
74
74
|
this.builder.vars.ao.setAll(0);
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { VoxelModelBuilder } from "./VoxelModelBuilder";
|
|
2
2
|
export class RenderedMaterials {
|
|
3
3
|
static meshersMap = new Map();
|
|
4
4
|
static meshers = [];
|
|
5
5
|
static register(materials) {
|
|
6
6
|
for (let i = 0; i < materials.length; i++) {
|
|
7
|
-
const newTool = new
|
|
7
|
+
const newTool = new VoxelModelBuilder(materials[i], i);
|
|
8
8
|
this.meshersMap.set(materials[i], newTool);
|
|
9
9
|
this.meshers[i] = newTool;
|
|
10
10
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { VoxelModelBuilder } from "./VoxelModelBuilder";
|
|
2
2
|
import { CompiledVoxelModelInputData, CompiledVoxelModelData } from "../../Voxels/Types/VoxelModelCompiledData.types";
|
|
3
3
|
import { StateSchema } from "../../Voxels/State/Schema/StateSchema";
|
|
4
4
|
import { StateTreeReader } from "../../Voxels/State/StateTreeReader";
|
|
@@ -7,7 +7,7 @@ import { VoxelModelEffect } from "./VoxelModelEffect";
|
|
|
7
7
|
import { CondtionalTreeReader } from "../../Voxels/State/CondiotnalTreeReader";
|
|
8
8
|
export declare class VoxelConstructor {
|
|
9
9
|
id: string;
|
|
10
|
-
builder:
|
|
10
|
+
builder: VoxelModelBuilder;
|
|
11
11
|
data: CompiledVoxelModelData;
|
|
12
12
|
isModel: true;
|
|
13
13
|
geometries: number[][];
|
|
@@ -18,10 +18,10 @@ export declare class VoxelConstructor {
|
|
|
18
18
|
conditonalInputMap: any[];
|
|
19
19
|
schema: StateSchema;
|
|
20
20
|
effects: VoxelModelEffect;
|
|
21
|
-
|
|
21
|
+
stateTree: StateTreeReader;
|
|
22
22
|
condtioanlShapeStateTree: CondtionalTreeReader;
|
|
23
|
-
constructor(id: string, builder:
|
|
24
|
-
isShapeStateFaceTransparent(modState: number,
|
|
25
|
-
isCondtionalStateFaceTransparent(modState: number,
|
|
23
|
+
constructor(id: string, builder: VoxelModelBuilder, data: CompiledVoxelModelData, voxleData: CompiledVoxelModelInputData);
|
|
24
|
+
isShapeStateFaceTransparent(modState: number, stateTree: number, geoId: number, faceIndex: number): boolean;
|
|
25
|
+
isCondtionalStateFaceTransparent(modState: number, state: number, geoId: number, faceIndex: number): boolean;
|
|
26
26
|
process(): boolean;
|
|
27
27
|
}
|
|
@@ -17,7 +17,7 @@ export class VoxelConstructor {
|
|
|
17
17
|
conditonalInputMap;
|
|
18
18
|
schema;
|
|
19
19
|
effects;
|
|
20
|
-
|
|
20
|
+
stateTree;
|
|
21
21
|
condtioanlShapeStateTree;
|
|
22
22
|
constructor(id, builder, data, voxleData) {
|
|
23
23
|
this.id = id;
|
|
@@ -27,17 +27,17 @@ export class VoxelConstructor {
|
|
|
27
27
|
this.conditonalInputMap = voxleData.condiotnalGeometryInputMap;
|
|
28
28
|
this.transparentIndex = new VoxelFaceTransparentResultsIndex(voxleData.transparentFaceIndex);
|
|
29
29
|
this.schema = new StateSchema(data.schema);
|
|
30
|
-
this.
|
|
30
|
+
this.stateTree = new StateTreeReader(this.schema, 0, data.stateTree);
|
|
31
31
|
this.condtioanlShapeStateTree = new CondtionalTreeReader(this.schema, data.condiotnalStatements, data.condiotnalStateTree);
|
|
32
32
|
this.modSchema = new StateSchema(voxleData.modSchema);
|
|
33
33
|
this.modTree = new StateTreeReader(this.modSchema, 0, voxleData.modStateTree);
|
|
34
34
|
this.effects = new VoxelModelEffect(this);
|
|
35
35
|
}
|
|
36
|
-
isShapeStateFaceTransparent(modState,
|
|
37
|
-
return (this.transparentIndex.getValue(modState, this.data.relativeGeometryByteIndexMap[this.data.
|
|
36
|
+
isShapeStateFaceTransparent(modState, stateTree, geoId, faceIndex) {
|
|
37
|
+
return (this.transparentIndex.getValue(modState, this.data.relativeGeometryByteIndexMap[this.data.stateRelativeGeometryMap[stateTree][geoId]], faceIndex) == 1);
|
|
38
38
|
}
|
|
39
|
-
isCondtionalStateFaceTransparent(modState,
|
|
40
|
-
return (this.transparentIndex.getValue(modState, this.data.relativeGeometryByteIndexMap[this.data.condiotnalShapeStateRelativeGeometryMap[
|
|
39
|
+
isCondtionalStateFaceTransparent(modState, state, geoId, faceIndex) {
|
|
40
|
+
return (this.transparentIndex.getValue(modState, this.data.relativeGeometryByteIndexMap[this.data.condiotnalShapeStateRelativeGeometryMap[state][geoId]], faceIndex) == 1);
|
|
41
41
|
}
|
|
42
42
|
process() {
|
|
43
43
|
let added = false;
|
|
@@ -46,8 +46,8 @@ export class VoxelConstructor {
|
|
|
46
46
|
const treeState = builder.space.stateCache[hashed];
|
|
47
47
|
const modState = builder.space.modCache[hashed];
|
|
48
48
|
if (treeState > -1) {
|
|
49
|
-
const geoLinks = this.data.
|
|
50
|
-
const geometries = this.data.
|
|
49
|
+
const geoLinks = this.data.stateMap[treeState];
|
|
50
|
+
const geometries = this.data.stateGeometryMap[treeState];
|
|
51
51
|
const geometriesLength = geoLinks.length;
|
|
52
52
|
const inputs = this.baseInputMap[modState][treeState];
|
|
53
53
|
for (let i = 0; i < geometriesLength; i++) {
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import { DataCursorInterface } from "../../
|
|
1
|
+
import { DataCursorInterface } from "../../Voxels/Cursor/DataCursor.interface";
|
|
2
2
|
import { Vec3Array, Vector3Like } from "@amodx/math";
|
|
3
3
|
import { VoxelCursor } from "../../Voxels/Cursor/VoxelCursor";
|
|
4
4
|
export declare class VoxelGeometryBuilderCacheSpace {
|
|
5
5
|
bounds: Vector3Like;
|
|
6
6
|
foundHash: Uint8Array;
|
|
7
7
|
voxelCache: Uint16Array;
|
|
8
|
-
lightCache: Int32Array;
|
|
9
8
|
modCache: Int32Array;
|
|
10
9
|
stateCache: Int32Array;
|
|
11
10
|
conditonalStateCache: Int32Array;
|
|
@@ -16,9 +15,8 @@ export declare class VoxelGeometryBuilderCacheSpace {
|
|
|
16
15
|
start(x: number, y: number, z: number): void;
|
|
17
16
|
getIndex(x: number, y: number, z: number): number;
|
|
18
17
|
getConstructor(index: number): import("./VoxelConstructor").VoxelConstructor | null;
|
|
19
|
-
getGeomtry(index: number):
|
|
20
|
-
getConditionalGeomtry(index: number):
|
|
18
|
+
getGeomtry(index: number): number[] | null;
|
|
19
|
+
getConditionalGeomtry(index: number): number[][] | null;
|
|
21
20
|
getHash(dataCursor: DataCursorInterface, x: number, y: number, z: number): number;
|
|
22
|
-
getLight(dataCursor: DataCursorInterface, x: number, y: number, z: number): number;
|
|
23
21
|
private hashState;
|
|
24
22
|
}
|
|
@@ -5,7 +5,6 @@ export class VoxelGeometryBuilderCacheSpace {
|
|
|
5
5
|
bounds;
|
|
6
6
|
foundHash;
|
|
7
7
|
voxelCache;
|
|
8
|
-
lightCache;
|
|
9
8
|
modCache;
|
|
10
9
|
stateCache;
|
|
11
10
|
conditonalStateCache;
|
|
@@ -16,7 +15,6 @@ export class VoxelGeometryBuilderCacheSpace {
|
|
|
16
15
|
this.bounds = bounds;
|
|
17
16
|
const volume = bounds.x * bounds.y * bounds.z;
|
|
18
17
|
this.foundHash = new Uint8Array(volume);
|
|
19
|
-
this.lightCache = new Int32Array(volume);
|
|
20
18
|
this.voxelCache = new Uint16Array(volume);
|
|
21
19
|
this.modCache = new Int32Array(volume);
|
|
22
20
|
this.stateCache = new Int32Array(volume);
|
|
@@ -27,7 +25,6 @@ export class VoxelGeometryBuilderCacheSpace {
|
|
|
27
25
|
this.offset[0] = x;
|
|
28
26
|
this.offset[1] = y;
|
|
29
27
|
this.offset[2] = z;
|
|
30
|
-
this.lightCache.fill(-1);
|
|
31
28
|
this.foundHash.fill(0);
|
|
32
29
|
this.voxelCache.fill(0);
|
|
33
30
|
this.modCache.fill(-1);
|
|
@@ -45,12 +42,12 @@ export class VoxelGeometryBuilderCacheSpace {
|
|
|
45
42
|
}
|
|
46
43
|
getGeomtry(index) {
|
|
47
44
|
if (this.foundHash[index] < 2)
|
|
48
|
-
return
|
|
49
|
-
return VoxelModelConstructorRegister.constructorsPaltte[this.voxelCache[index]].data.
|
|
45
|
+
return null;
|
|
46
|
+
return VoxelModelConstructorRegister.constructorsPaltte[this.voxelCache[index]].data.stateGeometryMap[this.stateCache[index]];
|
|
50
47
|
}
|
|
51
48
|
getConditionalGeomtry(index) {
|
|
52
49
|
if (this.foundHash[index] < 2)
|
|
53
|
-
return
|
|
50
|
+
return null;
|
|
54
51
|
return VoxelModelConstructorRegister.constructorsPaltte[this.voxelCache[index]].data.condiotnalShapeStateGeometryMap[this.conditonalStateCache[index]];
|
|
55
52
|
}
|
|
56
53
|
getHash(dataCursor, x, y, z) {
|
|
@@ -60,48 +57,28 @@ export class VoxelGeometryBuilderCacheSpace {
|
|
|
60
57
|
}
|
|
61
58
|
return hashed;
|
|
62
59
|
}
|
|
63
|
-
getLight(dataCursor, x, y, z) {
|
|
64
|
-
const index = this.getIndex(x, y, z);
|
|
65
|
-
if (this.lightCache[index] == -1) {
|
|
66
|
-
this.lightCache[index] = 0;
|
|
67
|
-
const voxel = dataCursor.getVoxel(x, y, z);
|
|
68
|
-
if (voxel) {
|
|
69
|
-
const light = voxel.getLight();
|
|
70
|
-
if (light > 0) {
|
|
71
|
-
this.lightCache[index] = light;
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
return this.lightCache[index];
|
|
76
|
-
}
|
|
77
60
|
hashState(dataCursor, index, x, y, z) {
|
|
78
61
|
if (this.foundHash[index] == 1)
|
|
79
|
-
return
|
|
62
|
+
return;
|
|
80
63
|
if (this.foundHash[index] == 2)
|
|
81
|
-
return
|
|
64
|
+
return;
|
|
82
65
|
const voxel = dataCursor.getVoxel(x, y, z);
|
|
83
|
-
if (voxel) {
|
|
84
|
-
const light = voxel.getLight();
|
|
85
|
-
if (light > 0) {
|
|
86
|
-
this.lightCache[index] = light;
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
66
|
if (!voxel || !voxel.isRenderable()) {
|
|
90
67
|
this.foundHash[index] = 1;
|
|
91
|
-
return
|
|
68
|
+
return;
|
|
92
69
|
}
|
|
93
70
|
const voxelId = voxel.getId();
|
|
94
71
|
const voxelConstructor = VoxelModelConstructorRegister.constructorsPaltte[voxelId];
|
|
95
72
|
if (!voxelConstructor) {
|
|
96
73
|
this.foundHash[index] = 1;
|
|
97
|
-
return
|
|
74
|
+
return;
|
|
98
75
|
}
|
|
99
76
|
this.voxelCache[index] = voxelId;
|
|
100
77
|
this.foundHash[index] = 2;
|
|
101
78
|
//no ao
|
|
102
79
|
this.noCastAO[index] = voxel.isLightSource() || voxel.noAO() ? 1 : 0;
|
|
103
80
|
//state
|
|
104
|
-
const state = voxelConstructor.
|
|
81
|
+
const state = voxelConstructor.stateTree.getState(voxel.getState());
|
|
105
82
|
this.stateCache[index] = state;
|
|
106
83
|
//mod
|
|
107
84
|
const mod = voxelConstructor.modTree.getState(voxel.getMod());
|
|
@@ -114,6 +91,5 @@ export class VoxelGeometryBuilderCacheSpace {
|
|
|
114
91
|
voxelConstructor.schema.dataCursor = dataCursor;
|
|
115
92
|
const conditonalState = voxelConstructor.condtioanlShapeStateTree.getState();
|
|
116
93
|
this.conditonalStateCache[index] = conditonalState;
|
|
117
|
-
return 1;
|
|
118
94
|
}
|
|
119
95
|
}
|
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import { MesherDataTool } from "../Geomtry/Tools/MesherDataTools";
|
|
2
1
|
import { QuadScalarVertexData } from "../Geomtry/Primitives/QuadVertexData";
|
|
3
2
|
import { VoxelFaces } from "../../Math";
|
|
4
3
|
import { QuadVerticies } from "../Geomtry/Geometry.types";
|
|
5
4
|
import { VoxelMesh } from "../Geomtry/VoxelMesh";
|
|
6
|
-
import { VoxelMeshBVHBuilder } from "
|
|
5
|
+
import { VoxelMeshBVHBuilder } from "../Geomtry/VoxelMeshBVHBuilder";
|
|
7
6
|
import { Vec3Array, Vector3Like, Vector4Like } from "@amodx/math";
|
|
8
7
|
import { VoxelCursorInterface } from "../../Voxels/Cursor/VoxelCursor.interface.js";
|
|
9
|
-
import { DataCursorInterface } from "../../
|
|
10
|
-
import { VoxelGeometryBuilderCacheSpace } from "
|
|
8
|
+
import { DataCursorInterface } from "../../Voxels/Cursor/DataCursor.interface.js";
|
|
9
|
+
import { VoxelGeometryBuilderCacheSpace } from "./VoxelGeometryBuilderCacheSpace";
|
|
11
10
|
declare class VoxelVars {
|
|
12
11
|
faceFlipped: boolean;
|
|
13
12
|
textureIndex: number;
|
|
@@ -18,7 +17,7 @@ declare class VoxelVars {
|
|
|
18
17
|
level: QuadScalarVertexData;
|
|
19
18
|
reset(): void;
|
|
20
19
|
}
|
|
21
|
-
export declare class
|
|
20
|
+
export declare class VoxelModelBuilder {
|
|
22
21
|
id: string;
|
|
23
22
|
materialIndex: number;
|
|
24
23
|
space: VoxelGeometryBuilderCacheSpace;
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
//tools
|
|
2
|
-
import { MesherDataTool } from "../Geomtry/Tools/MesherDataTools";
|
|
3
2
|
//data
|
|
4
3
|
import { QuadScalarVertexData } from "../Geomtry/Primitives/QuadVertexData";
|
|
5
4
|
import { VoxelFaces, VoxelFacesArray } from "../../Math";
|
|
6
5
|
import { QuadVerticies } from "../Geomtry/Geometry.types";
|
|
7
|
-
import calculateFaceData from "
|
|
6
|
+
import calculateFaceData from "./Common/Calc/FaceDataCalc.js";
|
|
8
7
|
import { VoxelMesh } from "../Geomtry/VoxelMesh";
|
|
9
8
|
import { Vector3Like, Vector4Like } from "@amodx/math";
|
|
10
9
|
class VoxelVars {
|
|
@@ -23,7 +22,7 @@ class VoxelVars {
|
|
|
23
22
|
this.overlayTextures.z = 0;
|
|
24
23
|
}
|
|
25
24
|
}
|
|
26
|
-
export class
|
|
25
|
+
export class VoxelModelBuilder {
|
|
27
26
|
id;
|
|
28
27
|
materialIndex;
|
|
29
28
|
space;
|
|
@@ -41,11 +40,10 @@ export class VoxelMesherDataTool extends MesherDataTool {
|
|
|
41
40
|
lightData;
|
|
42
41
|
effects;
|
|
43
42
|
constructor(id, materialIndex) {
|
|
44
|
-
super();
|
|
45
|
-
this.id = id;
|
|
46
|
-
this.materialIndex = materialIndex;
|
|
47
43
|
// this.faceDataOverride.currentVoxel = this.voxel;
|
|
48
44
|
// this.faceDataOverride.neighborVoxel = this.nVoxel;
|
|
45
|
+
this.id = id;
|
|
46
|
+
this.materialIndex = materialIndex;
|
|
49
47
|
this.dataCalculated = [];
|
|
50
48
|
for (const face of VoxelFacesArray) {
|
|
51
49
|
this.dataCalculated[face] = false;
|
|
@@ -74,7 +72,6 @@ export class VoxelMesherDataTool extends MesherDataTool {
|
|
|
74
72
|
this.lightData[face][QuadVerticies.BottomLeft] = 0;
|
|
75
73
|
this.lightData[face][QuadVerticies.BottomRight] = 0;
|
|
76
74
|
}
|
|
77
|
-
this.startNewMesh(new VoxelMesh());
|
|
78
75
|
}
|
|
79
76
|
bounds = {
|
|
80
77
|
min: [0, 0, 0],
|
|
@@ -89,7 +86,7 @@ export class VoxelMesherDataTool extends MesherDataTool {
|
|
|
89
86
|
this.bounds.max[0] = -Infinity;
|
|
90
87
|
this.bounds.max[1] = -Infinity;
|
|
91
88
|
this.bounds.max[2] = -Infinity;
|
|
92
|
-
this._boundsUpdate =
|
|
89
|
+
this._boundsUpdate = false;
|
|
93
90
|
}
|
|
94
91
|
endConstruction() {
|
|
95
92
|
this.vars.reset();
|