@divinevoxel/vlox 0.0.75 → 0.0.77
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Builder/RayProvider.d.ts +6 -0
- package/Builder/Tools/Brush/BrushTool.d.ts +55 -0
- package/Builder/Tools/Brush/BrushTool.js +352 -0
- package/Builder/Tools/BuilderToolBase.d.ts +39 -0
- package/Builder/Tools/BuilderToolBase.js +42 -0
- package/Builder/Tools/Hand/HandTool.d.ts +24 -0
- package/Builder/Tools/Hand/HandTool.js +73 -0
- package/Builder/Tools/Path/PahtTool.d.ts +34 -0
- package/Builder/Tools/Path/PahtTool.js +128 -0
- package/Builder/Tools/Sculpt/SculptTool.d.ts +34 -0
- package/Builder/Tools/Sculpt/SculptTool.js +102 -0
- package/Builder/Tools/Shape/ShapeTool.d.ts +32 -0
- package/Builder/Tools/Shape/ShapeTool.js +78 -0
- package/Builder/Tools/Template/TemplateTool.d.ts +35 -0
- package/Builder/Tools/Template/TemplateTool.js +73 -0
- package/Builder/Tools/Wand/WandTool.d.ts +30 -0
- package/Builder/Tools/Wand/WandTool.js +90 -0
- package/Builder/Tools/Wrench/WrenchTool.d.ts +47 -0
- package/Builder/Tools/Wrench/WrenchTool.js +184 -0
- package/Builder/Util/FreeBoxSelection.d.ts +12 -0
- package/Builder/Util/FreeBoxSelection.js +21 -0
- package/Builder/Util/FreePointSelection.d.ts +14 -0
- package/Builder/Util/FreePointSelection.js +39 -0
- package/Builder/Util/SurfaceBoxSelection.d.ts +12 -0
- package/Builder/Util/SurfaceBoxSelection.js +25 -0
- package/Builder/VoxelBuildSpace.d.ts +73 -0
- package/Builder/VoxelBuildSpace.js +224 -0
- package/Builder/World/InitTasks.d.ts +1 -0
- package/Builder/World/InitTasks.js +129 -0
- package/Builder/World/VoxelBuildSpaceWorld.d.ts +4 -0
- package/Builder/World/VoxelBuildSpaceWorld.js +10 -0
- package/Contexts/Render/DivineVoxelEngineRender.d.ts +5 -5
- package/Contexts/World/DivineVoxelEngineWorld.d.ts +5 -5
- package/Mesher/Geomtry/Proto/ProtoMesh.d.ts +18 -0
- package/Mesher/Geomtry/Proto/ProtoMesh.js +73 -0
- package/Mesher/Geomtry/{VoxelMeshBuffers.d.ts → Proto/ProtoMeshBuffer.d.ts} +2 -2
- package/Mesher/Geomtry/{VoxelMeshBuffers.js → Proto/ProtoMeshBuffer.js} +2 -2
- package/Mesher/Geomtry/Shapes/Box.d.ts +2 -9
- package/Mesher/Geomtry/Shapes/Box.js +7 -12
- package/Mesher/Geomtry/Transform/TransformBox.js +5 -2
- package/Mesher/InitMesher.js +4 -4
- package/Mesher/InitTask.js +2 -2
- package/Mesher/Items/Base/CompactItemMesh.d.ts +3 -0
- package/Mesher/Items/Base/CompactItemMesh.js +20 -0
- package/Mesher/Items/Geomtry/ItemGeometryBuilder.d.ts +5 -0
- package/Mesher/Items/Geomtry/ItemGeometryBuilder.js +131 -0
- package/Mesher/Items/Geomtry/ItemMeshVertexStructCursor.d.ts +48 -0
- package/Mesher/Items/Geomtry/ItemMeshVertexStructCursor.js +114 -0
- package/Mesher/Items/MeshTexture.d.ts +1 -0
- package/Mesher/Items/MeshTexture.js +214 -0
- package/Mesher/Items/MeshTextureO.js +277 -0
- package/Mesher/Items/Models/ItemModelBuilder.d.ts +27 -0
- package/Mesher/Items/Models/ItemModelBuilder.js +64 -0
- package/Mesher/Types/ItemMesh.types.d.ts +5 -0
- package/Mesher/Types/ItemMesh.types.js +12 -0
- package/Mesher/Types/Mesher.types.d.ts +15 -9
- package/Mesher/Types/Mesher.types.js +14 -0
- package/Mesher/Types/VoxelMesh.types.js +7 -6
- package/Mesher/Voxels/Base/CompactTemplateMesh.d.ts +3 -0
- package/Mesher/{Functions/CompactVoxelMesh.js → Voxels/Base/CompactTemplateMesh.js} +4 -40
- package/Mesher/{Functions → Voxels/Base}/CompactVoxelSectionMesh.d.ts +2 -2
- package/Mesher/{Functions → Voxels}/Base/MeshSectionBase.d.ts +1 -1
- package/Mesher/{Functions → Voxels}/Base/MeshSectionBase.js +11 -7
- package/Mesher/{Geomtry → Voxels/Geomtry}/CompactedSectionVoxelMesh.d.ts +1 -1
- package/Mesher/{Geomtry → Voxels/Geomtry}/CompactedSectionVoxelMesh.js +1 -1
- package/Mesher/{Geomtry → Voxels/Geomtry}/VoxelGeometryBuilder.d.ts +2 -2
- package/Mesher/{Geomtry → Voxels/Geomtry}/VoxelGeometryBuilder.js +1 -1
- package/Mesher/{Geomtry → Voxels/Geomtry}/VoxelMeshBVHBuilder.d.ts +3 -3
- package/Mesher/{Geomtry → Voxels/Geomtry}/VoxelMeshBVHBuilder.js +2 -2
- package/Mesher/Voxels/MeshTemplate.d.ts +3 -0
- package/Mesher/Voxels/MeshTemplate.js +81 -0
- package/Mesher/{Functions → Voxels}/MeshVoxel.d.ts +1 -1
- package/Mesher/{Functions → Voxels}/MeshVoxel.js +6 -4
- package/Mesher/{Models → Voxels/Models}/Common/Calc/CalcConstants.d.ts +3 -3
- package/Mesher/{Models → Voxels/Models}/Common/Calc/CalcConstants.js +4 -4
- package/Mesher/{Models → Voxels/Models}/Common/Calc/FaceDataCalc.d.ts +1 -1
- package/Mesher/{Models → Voxels/Models}/Common/Calc/FaceDataCalc.js +2 -2
- package/Mesher/{Models → Voxels/Models}/Common/Faces/CullRulledFace.js +1 -1
- package/Mesher/{Models → Voxels/Models}/Common/Faces/ShadeRulelessFace.d.ts +1 -1
- package/Mesher/{Models → Voxels/Models}/Common/Faces/ShadeRulledFace.d.ts +1 -1
- package/Mesher/{Models → Voxels/Models}/Common/Faces/ShadeRulledFace.js +1 -1
- package/Mesher/{Models → Voxels/Models}/Common/GetTexture.d.ts +3 -3
- package/Mesher/{Models → Voxels/Models}/Nodes/Custom/Liquid/FlowGradient.d.ts +1 -1
- package/Mesher/{Models → Voxels/Models}/Nodes/Custom/Liquid/FlowGradient.js +1 -1
- package/Mesher/{Models → Voxels/Models}/Nodes/Custom/Liquid/LiquidGeomtryNode.d.ts +3 -3
- package/Mesher/{Models → Voxels/Models}/Nodes/Custom/Liquid/LiquidGeomtryNode.js +14 -16
- package/Mesher/{Models → Voxels/Models}/Nodes/Default/QuadVoxelGeometryNode.d.ts +2 -2
- package/Mesher/{Models → Voxels/Models}/Nodes/Default/QuadVoxelGeometryNode.js +1 -1
- package/Mesher/{Models → Voxels/Models}/Nodes/Default/TriangleVoxelGeometryNode.d.ts +2 -2
- package/Mesher/{Models → Voxels/Models}/Nodes/Default/TriangleVoxelGeometryNode.js +1 -1
- package/Mesher/{Models → Voxels/Models}/Nodes/Types/QuadVoxelGometryNodeTypes.d.ts +2 -2
- package/Mesher/{Models → Voxels/Models}/Nodes/Types/TriangleVoxelGometryNodeTypes.d.ts +1 -1
- package/Mesher/{Models → Voxels/Models}/Nodes/VoxelGeometryConstructor.d.ts +2 -2
- package/Mesher/Voxels/Models/Procedures/Default/ConsistentRotationTextureProcedure.d.ts +24 -0
- package/Mesher/{Models → Voxels/Models}/Procedures/Default/ConsistentRotationTextureProcedure.js +2 -2
- package/Mesher/{Models → Voxels/Models}/Procedures/Default/OutlinedTextureProcedure.d.ts +4 -5
- package/Mesher/Voxels/Models/Procedures/Default/OutlinedTextureProcedure.js +205 -0
- package/Mesher/Voxels/Models/Procedures/Default/PillarTextureProcedure.d.ts +28 -0
- package/Mesher/Voxels/Models/Procedures/Default/PillarTextureProcedure.js +109 -0
- package/Mesher/{Models → Voxels/Models}/Procedures/TextureProcedure.d.ts +3 -3
- package/Mesher/{Models → Voxels/Models}/Procedures/TextureProcedureRegister.js +2 -0
- package/Mesher/{Models → Voxels/Models}/VoxelConstructor.d.ts +4 -4
- package/Mesher/{Models → Voxels/Models}/VoxelConstructor.js +3 -3
- package/Mesher/{Models → Voxels/Models}/VoxelGeometryBuilderCacheSpace.d.ts +2 -2
- package/Mesher/{Models → Voxels/Models}/VoxelGeometryBuilderCacheSpace.js +2 -2
- package/Mesher/{Models → Voxels/Models}/VoxelModelBuilder.d.ts +7 -7
- package/Mesher/{Models → Voxels/Models}/VoxelModelBuilder.js +6 -5
- package/Mesher/{Models → Voxels/Models}/VoxelModelConstructorRegister.d.ts +4 -4
- package/Mesher/{Models → Voxels/Models}/VoxelModelConstructorRegister.js +2 -2
- package/Mesher/{Models → Voxels/Models}/VoxelModelEffect.d.ts +1 -1
- package/Mesher/{Models → Voxels/Models}/VoxelModelEffect.js +1 -1
- package/Renderer/Classes/DVESectionMeshes.d.ts +1 -1
- package/Renderer/MeshManager.js +1 -1
- package/Settings/EngineSettings.types.d.ts +2 -1
- package/Settings/EngineSettings.types.js +3 -1
- package/Tasks/Paint/Common.js +14 -9
- package/Tasks/Paint/Erase/EraseVoxel.js +1 -1
- package/Tasks/Paint/Erase/EraseVoxelSelection.d.ts +4 -0
- package/Tasks/Paint/Erase/EraseVoxelSelection.js +33 -0
- package/Tasks/Paint/Erase/EraseVoxelTemplate.js +1 -2
- package/Tasks/Paint/Paint/PaintVoxelTemplate.js +1 -1
- package/Tasks/Propagation/Illumanation/RGBUpdate.js +1 -1
- package/Tasks/Tasks.types.d.ts +2 -0
- package/Tasks/TasksIds.d.ts +1 -0
- package/Tasks/TasksIds.js +1 -0
- package/Tasks/WorldGeneration/InitTasks.js +3 -1
- package/Templates/Archive/ArchivedVoxelTemplate.d.ts +6 -5
- package/Templates/Archive/ArchivedVoxelTemplate.js +56 -49
- package/Templates/Archive/Functions/CreateArchivedTemplate.js +4 -4
- package/Templates/Archive/Functions/ExportArchiedTemplateJSON.js +0 -1
- package/Templates/Archive/Functions/ImportArchivedTemplateJSON.js +0 -2
- package/Templates/Cursor/TemplateCursor.d.ts +6 -1
- package/Templates/Cursor/TemplateCursor.js +16 -3
- package/Templates/Cursor/TemplateProxy.d.ts +1 -0
- package/Templates/Cursor/TemplateProxy.js +9 -0
- package/Templates/Cursor/TemplateVoxelCursor.d.ts +1 -0
- package/Templates/Cursor/TemplateVoxelCursor.js +6 -0
- package/Templates/Full/FullVoxelTemplate.d.ts +5 -4
- package/Templates/Full/FullVoxelTemplate.js +32 -17
- package/Templates/Functions/ExtrudeSelection.d.ts +5 -0
- package/Templates/Functions/ExtrudeSelection.js +44 -0
- package/Templates/Functions/FillSelection.d.ts +4 -0
- package/Templates/Functions/FillSelection.js +20 -0
- package/Templates/Functions/FlipTemplate.d.ts +2 -2
- package/Templates/Functions/FlipTemplate.js +8 -8
- package/Templates/Functions/RotateTemplate.d.ts +2 -2
- package/Templates/Path/VoxelPath.d.ts +4 -0
- package/Templates/Path/VoxelPath.js +18 -0
- package/Templates/Path/VoxelPath.types.d.ts +1 -0
- package/Templates/Selection/VoxelBFSSelection.d.ts +6 -6
- package/Templates/Selection/VoxelBFSSelection.js +29 -22
- package/Templates/Selection/VoxelBoundsSelection.d.ts +20 -0
- package/Templates/Selection/{VoxelBoxSelection.js → VoxelBoundsSelection.js} +38 -20
- package/Templates/Selection/VoxelPointSelection.d.ts +19 -0
- package/Templates/Selection/VoxelPointSelection.js +49 -0
- package/Templates/Selection/VoxelSelection.d.ts +18 -0
- package/Templates/Selection/VoxelSelection.js +1 -0
- package/Templates/Selection/VoxelSurfaceSelection.d.ts +8 -12
- package/Templates/Selection/VoxelSurfaceSelection.js +88 -84
- package/Templates/Selection/VoxelTemplateSelection.d.ts +13 -4
- package/Templates/Selection/VoxelTemplateSelection.js +27 -9
- package/Templates/Shapes/Selections/BoxVoxelShapeSelection.d.ts +28 -0
- package/Templates/Shapes/Selections/BoxVoxelShapeSelection.js +77 -0
- package/Templates/Shapes/Selections/ConeVoxelShapeSelection.d.ts +28 -0
- package/Templates/Shapes/Selections/ConeVoxelShapeSelection.js +77 -0
- package/Templates/Shapes/Selections/CylinderVoxelShapeSelection.d.ts +28 -0
- package/Templates/Shapes/Selections/CylinderVoxelShapeSelection.js +77 -0
- package/Templates/Shapes/Selections/EllipsoidVoxelShapeSelection.d.ts +28 -0
- package/Templates/Shapes/Selections/EllipsoidVoxelShapeSelection.js +92 -0
- package/Templates/Shapes/Selections/OctahedronVoxelShapeSelection.d.ts +28 -0
- package/Templates/Shapes/Selections/OctahedronVoxelShapeSelection.js +76 -0
- package/Templates/Shapes/Selections/PyramidVoxelShapeSelection.d.ts +37 -0
- package/Templates/Shapes/Selections/PyramidVoxelShapeSelection.js +137 -0
- package/Templates/Shapes/Selections/SphereVoxelShapeSelection.d.ts +20 -0
- package/Templates/Shapes/Selections/SphereVoxelShapeSelection.js +61 -0
- package/Templates/Shapes/Selections/TorusVoxelShapeSelection.d.ts +28 -0
- package/Templates/Shapes/Selections/TorusVoxelShapeSelection.js +76 -0
- package/Templates/Shapes/Selections/VoxelShapeSelection.d.ts +5 -0
- package/Templates/Shapes/Selections/VoxelShapeSelection.js +1 -0
- package/Templates/Shapes/VoxelShape.types.d.ts +2 -0
- package/Templates/Shapes/VoxelShape.types.js +8 -0
- package/Templates/Shapes/VoxelShapeTemplate.d.ts +37 -0
- package/Templates/Shapes/{BasicVoxelShapeTemplate.js → VoxelShapeTemplate.js} +43 -37
- package/Templates/Shapes/VoxelShapeTemplate.types.d.ts +5 -12
- package/Templates/Shapes/VoxelShapeTemplate.types.js +5 -1
- package/Templates/{VoxelTempateRegister.d.ts → VoxelTemplateRegister.d.ts} +4 -0
- package/Templates/VoxelTemplateRegister.js +60 -0
- package/Templates/VoxelTemplates.types.d.ts +3 -3
- package/Textures/Classes/CompiledTexture.d.ts +2 -0
- package/Textures/Classes/CompiledTexture.js +19 -1
- package/Textures/Classes/TextureAnimationTexture.d.ts +1 -1
- package/Textures/Functions/BuildTextureData.js +13 -0
- package/Textures/TextureManager.d.ts +1 -0
- package/Textures/TextureManager.js +11 -5
- package/Tools/Brush/Brush.d.ts +2 -0
- package/Tools/Brush/Brush.js +19 -0
- package/Tools/Tasks/TasksTool.d.ts +2 -1
- package/Tools/Tasks/TasksTool.js +2 -0
- package/Util/BinaryBuffer/Functions/BinaryBufferConvert.d.ts +1 -1
- package/Util/BinaryBuffer/Functions/BinaryBufferToTypedArray.d.ts +1 -1
- package/Util/LocationData.d.ts +1 -1
- package/Voxels/Cursor/DataCursor.interface.d.ts +4 -0
- package/Voxels/Cursor/VoxelCursor.interface.d.ts +2 -0
- package/Voxels/Cursor/VoxelCursor.interface.js +2 -0
- package/Voxels/Cursor/VoxelLightData.js +2 -2
- package/Voxels/Functions/BuildTagData.js +1 -1
- package/Voxels/Indexes/VoxelIndex.d.ts +1 -0
- package/Voxels/Indexes/VoxelIndex.js +11 -13
- package/Voxels/InitVoxelData.js +5 -14
- package/Voxels/Interaction/Functions/PickVoxel.d.ts +0 -5
- package/Voxels/Interaction/Functions/PickVoxel.js +64 -85
- package/Voxels/Interaction/Functions/PickVoxelWorld.js +21 -46
- package/Voxels/Interaction/VoxelPickResult.d.ts +1 -0
- package/Voxels/Interaction/VoxelPickResult.js +3 -0
- package/Voxels/Models/CompiledVoxelModel.types.d.ts +1 -1
- package/Voxels/Models/Defaults/CubeVoxelGeometry.js +11 -0
- package/Voxels/Models/Defaults/CubeVoxelModels.js +44 -99
- package/Voxels/Models/Defaults/PanelVoxelGeometry.d.ts +1 -3
- package/Voxels/Models/Defaults/PanelVoxelGeometry.js +2 -226
- package/Voxels/Models/Defaults/PanelVoxelModels.d.ts +1 -0
- package/Voxels/Models/Defaults/PanelVoxelModels.js +100 -258
- package/Voxels/Models/Defaults/StairVoxelModel.js +2 -2
- package/Voxels/Models/Rules/Classes/GeomtryInput.d.ts +4 -1
- package/Voxels/Models/Rules/Classes/GeomtryInput.js +26 -5
- package/Voxels/Models/Rules/Classes/VoxelRulesGeometry.d.ts +1 -1
- package/Voxels/Models/Rules/Functions/BuildFinalInputs.js +23 -8
- package/Voxels/Models/Rules/Functions/Compile/CompileGeomtryNodes.d.ts +1 -1
- package/Voxels/Models/Rules/Functions/Compile/Nodes/CompileBoxGeometryNode.d.ts +1 -1
- package/Voxels/Models/Rules/Functions/Compile/Nodes/CompileQuadGeometryNode.d.ts +1 -1
- package/Voxels/Models/Rules/Functions/Compile/Nodes/CompileQuadGeometryNode.js +1 -1
- package/Voxels/Models/Rules/Functions/Compile/Nodes/CompileTriangleGeometryNode.d.ts +1 -1
- package/Voxels/Models/Rules/Functions/Compile/Nodes/CompileTriangleGeometryNode.js +1 -1
- package/Voxels/Models/VoxelModel.types.d.ts +6 -1
- package/Voxels/State/Schema/BinarySchemaNode.d.ts +2 -1
- package/Voxels/State/Schema/BinarySchemaNode.js +5 -2
- package/Voxels/State/Schema/Conditions/SameVoxelConditions.js +2 -0
- package/Voxels/Types/PaintVoxelData.d.ts +13 -1
- package/Voxels/Types/PaintVoxelData.js +151 -14
- package/World/Archive/Functions/Shared/LightSegments.d.ts +1 -1
- package/World/Cursor/SectionCursor.d.ts +4 -0
- package/World/Cursor/SectionCursor.js +13 -16
- package/World/Cursor/SectorCursor.d.ts +4 -0
- package/World/Cursor/SectorCursor.js +13 -16
- package/World/Cursor/WorldCursor.d.ts +4 -0
- package/World/Cursor/WorldCursor.js +8 -0
- package/World/Sector/Sector.d.ts +1 -1
- package/World/Sector/SectorHeightMap.d.ts +6 -0
- package/World/Sector/SectorHeightMap.js +6 -0
- package/World/SnapShot/SectionSnapShotCursor.d.ts +3 -0
- package/World/SnapShot/SectionSnapShotCursor.js +6 -0
- package/World/WorldSpaces.js +3 -3
- package/WorldSimulation/Dimensions/DimensionSimulation.d.ts +5 -1
- package/WorldSimulation/Dimensions/DimensionSimulation.js +12 -0
- package/WorldSimulation/Dimensions/Generator.d.ts +1 -0
- package/WorldSimulation/Dimensions/Generator.js +1 -0
- package/WorldSimulation/Dimensions/SimulationSector.d.ts +4 -1
- package/WorldSimulation/Dimensions/SimulationSector.js +71 -41
- package/WorldSimulation/Internal/WorldSimulationTasks.js +5 -2
- package/WorldSimulation/Procedures/BuildOnly.d.ts +10 -0
- package/WorldSimulation/Procedures/BuildOnly.js +55 -0
- package/WorldSimulation/Procedures/InitalLoad.js +3 -0
- package/WorldSimulation/Tasks/SimulationTaskBase.d.ts +2 -0
- package/WorldSimulation/Tasks/SimulationTaskBase.js +11 -3
- package/WorldSimulation/Tasks/TaskSegment.d.ts +2 -1
- package/WorldSimulation/Tasks/TaskSegment.js +3 -1
- package/WorldSimulation/Tick/TickQueue.d.ts +2 -0
- package/WorldSimulation/Tick/TickQueue.js +26 -0
- package/WorldSimulation/Tools/SimulationBrush.d.ts +3 -0
- package/WorldSimulation/Tools/SimulationBrush.js +52 -0
- package/WorldSimulation/Voxels/Behaviors/Types/DefaultVoxelBehavior.js +3 -0
- package/WorldSimulation/Voxels/Behaviors/Types/LiquidVoxelBehavior.js +21 -1
- package/WorldSimulation/Voxels/Behaviors/VoxelBehaviors.d.ts +2 -0
- package/WorldSimulation/Voxels/Behaviors/VoxelBehaviors.js +6 -0
- package/WorldSimulation/Voxels/Ticks/Types/LiquidVoxelUpdate.js +39 -14
- package/WorldSimulation/WorldSimulation.d.ts +10 -0
- package/WorldSimulation/WorldSimulation.js +41 -1
- package/package.json +1 -30
- package/Mesher/Functions/CompactVoxelMesh.d.ts +0 -3
- package/Mesher/Functions/MeshTexture.js +0 -278
- package/Mesher/Geomtry/VoxelMesh.d.ts +0 -12
- package/Mesher/Geomtry/VoxelMesh.js +0 -25
- package/Mesher/Models/Procedures/Default/ConsistentRotationTextureProcedure.d.ts +0 -25
- package/Mesher/Models/Procedures/Default/OutlinedTextureProcedure.js +0 -162
- package/Templates/Selection/VoxelBoxSelection.d.ts +0 -14
- package/Templates/Selection/VoxelSelecton.d.ts +0 -6
- package/Templates/Shapes/BasicVoxelShapeTemplate.d.ts +0 -35
- package/Templates/Shapes/BoxVoxelTemplate.d.ts +0 -22
- package/Templates/Shapes/BoxVoxelTemplate.js +0 -75
- package/Templates/Shapes/ConeVoxelTemplate.d.ts +0 -22
- package/Templates/Shapes/ConeVoxelTemplate.js +0 -69
- package/Templates/Shapes/CylinderVoxelTemplate.d.ts +0 -22
- package/Templates/Shapes/CylinderVoxelTemplate.js +0 -69
- package/Templates/Shapes/OctahedronVoxelTemplate.d.ts +0 -22
- package/Templates/Shapes/OctahedronVoxelTemplate.js +0 -69
- package/Templates/Shapes/PyramidVoxelTemplate.d.ts +0 -30
- package/Templates/Shapes/PyramidVoxelTemplate.js +0 -140
- package/Templates/Shapes/SphereVoxelTemplate.d.ts +0 -24
- package/Templates/Shapes/SphereVoxelTemplate.js +0 -97
- package/Templates/Shapes/TorusVoxelTemplate.d.ts +0 -22
- package/Templates/Shapes/TorusVoxelTemplate.js +0 -69
- package/Templates/VoxelTempateRegister.js +0 -30
- /package/{Mesher/Models/Nodes/Types/GeomtryNode.types.js → Builder/RayProvider.js} +0 -0
- /package/Mesher/{Functions/MeshTexture.d.ts → Items/MeshTextureO.d.ts} +0 -0
- /package/Mesher/{Functions → Voxels/Base}/CompactVoxelSectionMesh.js +0 -0
- /package/Mesher/{Geomtry → Voxels/Geomtry}/VoxelMeshBVHStructCursor.d.ts +0 -0
- /package/Mesher/{Geomtry → Voxels/Geomtry}/VoxelMeshBVHStructCursor.js +0 -0
- /package/Mesher/{Geomtry → Voxels/Geomtry}/VoxelMeshVertexStructCursor.d.ts +0 -0
- /package/Mesher/{Geomtry → Voxels/Geomtry}/VoxelMeshVertexStructCursor.js +0 -0
- /package/Mesher/{Geomtry → Voxels/Geomtry}/VoxelShaderData.d.ts +0 -0
- /package/Mesher/{Geomtry → Voxels/Geomtry}/VoxelShaderData.js +0 -0
- /package/Mesher/{Functions → Voxels}/MeshSection.d.ts +0 -0
- /package/Mesher/{Functions → Voxels}/MeshSection.js +0 -0
- /package/Mesher/{Functions → Voxels}/MeshSectionSnapShot.d.ts +0 -0
- /package/Mesher/{Functions → Voxels}/MeshSectionSnapShot.js +0 -0
- /package/Mesher/{Models → Voxels/Models}/Common/Faces/CullRulledFace.d.ts +0 -0
- /package/Mesher/{Models → Voxels/Models}/Common/Faces/ShadeRulelessFace.js +0 -0
- /package/Mesher/{Models → Voxels/Models}/Common/GetTexture.js +0 -0
- /package/Mesher/{Models → Voxels/Models}/Nodes/Custom/index.d.ts +0 -0
- /package/Mesher/{Models → Voxels/Models}/Nodes/Custom/index.js +0 -0
- /package/Mesher/{Models → Voxels/Models}/Nodes/GeometryNode.d.ts +0 -0
- /package/Mesher/{Models → Voxels/Models}/Nodes/GeometryNode.js +0 -0
- /package/Mesher/{Models → Voxels/Models}/Nodes/Types/GeomtryNode.types.d.ts +0 -0
- /package/{Templates/Selection/VoxelSelecton.js → Mesher/Voxels/Models/Nodes/Types/GeomtryNode.types.js} +0 -0
- /package/Mesher/{Models → Voxels/Models}/Nodes/Types/QuadVoxelGometryNodeTypes.js +0 -0
- /package/Mesher/{Models → Voxels/Models}/Nodes/Types/TriangleVoxelGometryNodeTypes.js +0 -0
- /package/Mesher/{Models → Voxels/Models}/Nodes/VoxelGeometryConstructor.js +0 -0
- /package/Mesher/{Models → Voxels/Models}/Procedures/TextureProcedure.js +0 -0
- /package/Mesher/{Models → Voxels/Models}/Procedures/TextureProcedureRegister.d.ts +0 -0
- /package/Mesher/{Models → Voxels/Models}/RenderedMaterials.d.ts +0 -0
- /package/Mesher/{Models → Voxels/Models}/RenderedMaterials.js +0 -0
package/Renderer/MeshManager.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { MeshRegister } from "./MeshRegister.js";
|
|
2
|
-
import { CompactedSectionVoxelMesh } from "../Mesher/Geomtry/CompactedSectionVoxelMesh";
|
|
2
|
+
import { CompactedSectionVoxelMesh } from "../Mesher/Voxels/Geomtry/CompactedSectionVoxelMesh";
|
|
3
3
|
const added = new Set();
|
|
4
4
|
const compacted = new CompactedSectionVoxelMesh();
|
|
5
5
|
const location = [0, 0, 0, 0];
|
|
@@ -13,8 +13,9 @@ export interface RenderSettingsData {
|
|
|
13
13
|
export declare class RenderSettingsData {
|
|
14
14
|
/**Set the mode to change how mesh data is generated based on the underlying rendering API. */
|
|
15
15
|
mode: "webgl" | "webgpu";
|
|
16
|
-
/**
|
|
16
|
+
/**Renderer will not dispose of buffers to keep them renderering. */
|
|
17
17
|
cpuBound: boolean;
|
|
18
|
+
bufferMode: "single" | "multi";
|
|
18
19
|
}
|
|
19
20
|
export interface UpdatingSettings {
|
|
20
21
|
}
|
|
@@ -9,8 +9,10 @@ export class MesherSettingsData {
|
|
|
9
9
|
export class RenderSettingsData {
|
|
10
10
|
/**Set the mode to change how mesh data is generated based on the underlying rendering API. */
|
|
11
11
|
mode = "webgl";
|
|
12
|
-
/**
|
|
12
|
+
/**Renderer will not dispose of buffers to keep them renderering. */
|
|
13
13
|
cpuBound = false;
|
|
14
|
+
/* Single buffer mode will store vertex and indicies in single big buffer. While multi will store a buffer for each section mesh.*/
|
|
15
|
+
bufferMode = "multi";
|
|
14
16
|
}
|
|
15
17
|
export class UpdatingSettings {
|
|
16
18
|
/**Sector sections are marked as dirty so they can be processed later. */
|
package/Tasks/Paint/Common.js
CHANGED
|
@@ -61,7 +61,7 @@ export const checkLightUpdate = (x, y, z, tasks) => {
|
|
|
61
61
|
let needSunUpdate = false;
|
|
62
62
|
let needRGBRemove = false;
|
|
63
63
|
let needRGBUpdate = false;
|
|
64
|
-
|
|
64
|
+
let voxel = tasks.nDataCursor.getVoxel(x, y, z);
|
|
65
65
|
const lightValue = voxel.getLight();
|
|
66
66
|
const sunValue = lightData.getS(lightValue);
|
|
67
67
|
if (sunValue == 15) {
|
|
@@ -109,7 +109,7 @@ export const checkLightUpdate = (x, y, z, tasks) => {
|
|
|
109
109
|
}
|
|
110
110
|
if (hasRGBLight) {
|
|
111
111
|
const nRedValue = lightData.getR(nLight);
|
|
112
|
-
if (nRedValue
|
|
112
|
+
if (nRedValue < lowestRedValue) {
|
|
113
113
|
lowestRedValue = nRedValue;
|
|
114
114
|
}
|
|
115
115
|
if (nRedValue > redValue) {
|
|
@@ -123,16 +123,16 @@ export const checkLightUpdate = (x, y, z, tasks) => {
|
|
|
123
123
|
foundHigherGreen = true;
|
|
124
124
|
}
|
|
125
125
|
const nBlueValue = lightData.getB(nLight);
|
|
126
|
-
if (nBlueValue
|
|
126
|
+
if (nBlueValue < lowestBlueValue) {
|
|
127
127
|
lowestBlueValue = nBlueValue;
|
|
128
128
|
}
|
|
129
|
-
if (nBlueValue
|
|
129
|
+
if (nBlueValue > blueValue) {
|
|
130
130
|
foundHigherBlue = true;
|
|
131
131
|
}
|
|
132
132
|
}
|
|
133
133
|
}
|
|
134
134
|
if (hasSunLight) {
|
|
135
|
-
//sun
|
|
135
|
+
// sun
|
|
136
136
|
if (sunValue != 15 && sunValue != 0 && !foundHigherSun) {
|
|
137
137
|
needSunRemove = true;
|
|
138
138
|
}
|
|
@@ -141,15 +141,16 @@ export const checkLightUpdate = (x, y, z, tasks) => {
|
|
|
141
141
|
needSunUpdate = true;
|
|
142
142
|
}
|
|
143
143
|
}
|
|
144
|
-
|
|
145
|
-
|
|
144
|
+
voxel = tasks.nDataCursor.getVoxel(x, y, z);
|
|
145
|
+
if (hasRGBLight && !voxel.isLightSource()) {
|
|
146
|
+
// red
|
|
146
147
|
if (redValue != 15 && !foundHigherRed) {
|
|
147
148
|
needRGBRemove = true;
|
|
148
149
|
}
|
|
149
150
|
if ((foundHigherRed || redValue == 15) && lowestRedValue < redValue - 1) {
|
|
150
151
|
needRGBUpdate = true;
|
|
151
152
|
}
|
|
152
|
-
//green
|
|
153
|
+
// green
|
|
153
154
|
if (greenValue != 15 && !foundHigherGreen) {
|
|
154
155
|
needRGBRemove = true;
|
|
155
156
|
}
|
|
@@ -157,7 +158,7 @@ export const checkLightUpdate = (x, y, z, tasks) => {
|
|
|
157
158
|
lowestGreenValue < greenValue - 1) {
|
|
158
159
|
needRGBUpdate = true;
|
|
159
160
|
}
|
|
160
|
-
//blue
|
|
161
|
+
// blue
|
|
161
162
|
if (blueValue != 15 && !foundHigherBlue) {
|
|
162
163
|
needRGBRemove = true;
|
|
163
164
|
}
|
|
@@ -166,6 +167,10 @@ export const checkLightUpdate = (x, y, z, tasks) => {
|
|
|
166
167
|
needRGBUpdate = true;
|
|
167
168
|
}
|
|
168
169
|
}
|
|
170
|
+
else if (voxel.isLightSource()) {
|
|
171
|
+
needRGBUpdate = true;
|
|
172
|
+
needRGBRemove = false;
|
|
173
|
+
}
|
|
169
174
|
if (needSunRemove) {
|
|
170
175
|
tasks.sun.remove.push(x, y, z);
|
|
171
176
|
}
|
|
@@ -17,7 +17,7 @@ export function EraseVoxel(location, updateData) {
|
|
|
17
17
|
voxel.secondary[voxel._index] = 0;
|
|
18
18
|
voxel.light[voxel._index] = 0;
|
|
19
19
|
voxel.updateVoxel(1);
|
|
20
|
-
updateArea(tasks, x, y, z, x, y, z);
|
|
20
|
+
updateArea(tasks, x - 1, y - 1, z - 1, x + 1, y + 1, z + 1);
|
|
21
21
|
voxel = tasks.sDataCursor.getVoxel(x, y, z);
|
|
22
22
|
if (ES.doPower) {
|
|
23
23
|
if (foundPower > -1) {
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { VoxelUpdateData } from "../../Tasks.types";
|
|
2
|
+
import { Vec3Array } from "@amodx/math";
|
|
3
|
+
import { IVoxelSelectionData } from "../../../Templates/Selection/VoxelSelection";
|
|
4
|
+
export default function EraseVoxelSelection(dimension: number, [ox, oy, oz]: Vec3Array, selectionData: IVoxelSelectionData<any>, updateData: VoxelUpdateData): void;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { VoxelUpdateTask } from "../../VoxelUpdateTask";
|
|
2
|
+
import { canUpdate, updateArea } from "../Common";
|
|
3
|
+
import { VoxelTemplateRegister } from "../../../Templates/VoxelTemplateRegister";
|
|
4
|
+
const tasks = new VoxelUpdateTask();
|
|
5
|
+
export default function EraseVoxelSelection(dimension, [ox, oy, oz], selectionData, updateData) {
|
|
6
|
+
const selection = VoxelTemplateRegister.createSelection(selectionData);
|
|
7
|
+
tasks.setOriginAt([dimension, ox, oy, oz]);
|
|
8
|
+
const { x: sx, y: sy, z: sz } = selection.bounds.size;
|
|
9
|
+
for (let x = 0; x < sx; x++) {
|
|
10
|
+
for (let y = 0; y < sy; y++) {
|
|
11
|
+
for (let z = 0; z < sz; z++) {
|
|
12
|
+
const tx = ox + x;
|
|
13
|
+
const ty = oy + y;
|
|
14
|
+
const tz = oz + z;
|
|
15
|
+
if (!selection.isSelected(tx, ty, tz))
|
|
16
|
+
continue;
|
|
17
|
+
if (!canUpdate(tx, ty, tz, updateData))
|
|
18
|
+
continue;
|
|
19
|
+
if (!tasks.sDataCursor.inBounds(tx, ty, tz))
|
|
20
|
+
continue;
|
|
21
|
+
const voxel = tasks.sDataCursor.getVoxel(tx, ty, tz);
|
|
22
|
+
if (!voxel || voxel.isAir())
|
|
23
|
+
continue;
|
|
24
|
+
voxel.ids[voxel._index] = 0;
|
|
25
|
+
voxel.level[voxel._index] = 0;
|
|
26
|
+
voxel.secondary[voxel._index] = 0;
|
|
27
|
+
voxel.light[voxel._index] = 0;
|
|
28
|
+
voxel.updateVoxel(1);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
updateArea(tasks, ox, oy, oz, ox + sx, oy + sy, oz + sz);
|
|
33
|
+
}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { VoxelUpdateTask } from "../../VoxelUpdateTask";
|
|
2
2
|
import { canUpdate, updateArea } from "../Common";
|
|
3
|
-
import { VoxelTemplateRegister } from "../../../Templates/
|
|
3
|
+
import { VoxelTemplateRegister } from "../../../Templates/VoxelTemplateRegister";
|
|
4
4
|
const tasks = new VoxelUpdateTask();
|
|
5
|
-
const raw = [0, 0, 0, 0];
|
|
6
5
|
export default function EraseVoxelTemplate(dimension, [ox, oy, oz], templateData, updateData) {
|
|
7
6
|
const voxelTemplate = VoxelTemplateRegister.create(templateData);
|
|
8
7
|
tasks.setOriginAt([dimension, ox, oy, oz]);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { VoxelUpdateTask } from "../../VoxelUpdateTask";
|
|
2
2
|
import { canUpdate, updateArea } from "../Common";
|
|
3
|
-
import { VoxelTemplateRegister } from "../../../Templates/
|
|
3
|
+
import { VoxelTemplateRegister } from "../../../Templates/VoxelTemplateRegister";
|
|
4
4
|
const tasks = new VoxelUpdateTask();
|
|
5
5
|
const raw = [0, 0, 0, 0];
|
|
6
6
|
export default function PaintVoxelTemplate(dimension, [ox, oy, oz], templateData, updateData) {
|
|
@@ -35,7 +35,7 @@ export function RGBRemove(tasks) {
|
|
|
35
35
|
const remove = tasks.rgb.remove;
|
|
36
36
|
const update = tasks.rgb.update;
|
|
37
37
|
const removeMap = tasks.rgb.removeMap;
|
|
38
|
-
const updateMap = tasks.
|
|
38
|
+
const updateMap = tasks.rgb.updateMap;
|
|
39
39
|
while (remove.length) {
|
|
40
40
|
const x = remove.shift();
|
|
41
41
|
const y = remove.shift();
|
package/Tasks/Tasks.types.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ import type EraseVoxelTemplate from "./Paint/Erase/EraseVoxelTemplate.js";
|
|
|
5
5
|
import type EraseVoxelPath from "./Paint/Erase/EraseVoxelPath.js";
|
|
6
6
|
import { PaintVoxel } from "./Paint/Paint/PaintVoxel.js";
|
|
7
7
|
import PaintVoxelTemplate from "./Paint/Paint/PaintVoxelTemplate.js";
|
|
8
|
+
import EraseVoxelSelection from "./Paint/Erase/EraseVoxelSelection.js";
|
|
8
9
|
export type VoxelUpdateData = {
|
|
9
10
|
/**An array of allowed areas to update in. If not set will be ignored.*/
|
|
10
11
|
includedAreas?: [min: Vec3Array, max: Vec3Array][];
|
|
@@ -23,6 +24,7 @@ export type PaintVoxelPathTask = [
|
|
|
23
24
|
];
|
|
24
25
|
export type EraseVoxelTask = Parameters<typeof EraseVoxel>;
|
|
25
26
|
export type EraseVoxelTemplateTask = Parameters<typeof EraseVoxelTemplate>;
|
|
27
|
+
export type EraseVoxelSelectionTask = Parameters<typeof EraseVoxelSelection>;
|
|
26
28
|
export type EraseVoxelPathTask = Parameters<typeof EraseVoxelPath>;
|
|
27
29
|
export type WorldLockTasks = [
|
|
28
30
|
dimension: number,
|
package/Tasks/TasksIds.d.ts
CHANGED
package/Tasks/TasksIds.js
CHANGED
|
@@ -12,5 +12,6 @@ export var TasksIds;
|
|
|
12
12
|
TasksIds["PaintVoxelPath"] = "PaintVoxelPath";
|
|
13
13
|
TasksIds["EraseVoxel"] = "EraseVoxel";
|
|
14
14
|
TasksIds["EraseVoxelTemplate"] = "EraseVoxelTemplate";
|
|
15
|
+
TasksIds["EraseVoxelSelection"] = "EraseVoxelSelection";
|
|
15
16
|
TasksIds["EraseVoxelPath"] = "EraseVoxelPath";
|
|
16
17
|
})(TasksIds || (TasksIds = {}));
|
|
@@ -6,5 +6,7 @@ import { WorldGenRegister } from "./WorldGenRegister";
|
|
|
6
6
|
export default function (props) {
|
|
7
7
|
WorldGenRegister._worldThread = props.worldThread;
|
|
8
8
|
Threads.registerBinaryTask(TasksIds.Generate, (data) => new Promise((resolve) => WorldGeneration.generate(getLocationData(data), "generate", resolve)));
|
|
9
|
-
Threads.registerBinaryTask(TasksIds.Decorate, (data) => new Promise((resolve) =>
|
|
9
|
+
Threads.registerBinaryTask(TasksIds.Decorate, (data) => new Promise((resolve) => {
|
|
10
|
+
WorldGeneration.generate(getLocationData(data), "decorate", resolve);
|
|
11
|
+
}));
|
|
10
12
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Flat3DIndex, Vec3Array
|
|
1
|
+
import { Flat3DIndex, Vec3Array } from "@amodx/math";
|
|
2
2
|
import { ArchivedVoxelTemplateData } from "./ArchivedVoxelTemplate.types";
|
|
3
3
|
import type { RawVoxelData } from "../../Voxels/Types/Voxel.types";
|
|
4
4
|
import { NumberPalette } from "../../Util/NumberPalette";
|
|
@@ -11,9 +11,7 @@ type TemplateCursor = {
|
|
|
11
11
|
raw: RawVoxelData;
|
|
12
12
|
};
|
|
13
13
|
export declare class ArchivedVoxelTemplate implements IVoxelTemplate {
|
|
14
|
-
private _data;
|
|
15
14
|
index: Flat3DIndex;
|
|
16
|
-
position: Vector3Like;
|
|
17
15
|
bounds: BoundingBox;
|
|
18
16
|
ids: BinaryBuffer;
|
|
19
17
|
level: BinaryBuffer;
|
|
@@ -21,8 +19,9 @@ export declare class ArchivedVoxelTemplate implements IVoxelTemplate {
|
|
|
21
19
|
voxelPalette: VoxelPaletteArchiveReader;
|
|
22
20
|
levelPalette: NumberPalette;
|
|
23
21
|
secondaryPalette: NumberPalette;
|
|
24
|
-
|
|
25
|
-
|
|
22
|
+
private data;
|
|
23
|
+
constructor(data: ArchivedVoxelTemplateData);
|
|
24
|
+
inBounds(x: number, y: number, z: number): boolean;
|
|
26
25
|
isAir(index: number): boolean;
|
|
27
26
|
isIncluded(index: number): boolean;
|
|
28
27
|
getIndex(x: number, y: number, z: number): number;
|
|
@@ -31,7 +30,9 @@ export declare class ArchivedVoxelTemplate implements IVoxelTemplate {
|
|
|
31
30
|
getLight(index: number): number;
|
|
32
31
|
getSecondary(index: number): number;
|
|
33
32
|
traverse(curosr?: TemplateCursor): Generator<TemplateCursor>;
|
|
33
|
+
clone(): ArchivedVoxelTemplate;
|
|
34
34
|
getRaw(index: number, rawRef?: RawVoxelData): RawVoxelData;
|
|
35
35
|
toJSON(): ArchivedVoxelTemplateData;
|
|
36
|
+
fromJSON(data: ArchivedVoxelTemplateData): void;
|
|
36
37
|
}
|
|
37
38
|
export {};
|
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
import { Flat3DIndex } from "@amodx/math";
|
|
1
|
+
import { Flat3DIndex, Vector3Like } from "@amodx/math";
|
|
2
2
|
import { NumberPalette } from "../../Util/NumberPalette";
|
|
3
3
|
import { VoxelPalettesRegister } from "../../Voxels/Data/VoxelPalettesRegister";
|
|
4
4
|
import { VoxelTagsRegister } from "../../Voxels/Data/VoxelTagsRegister";
|
|
5
5
|
import { BinaryBuffer, BinaryBufferFormat, } from "../../Util/BinaryBuffer/index";
|
|
6
6
|
import { VoxelPaletteArchiveReader } from "../../Voxels/Archive/VoxelPaletteArchiveReader";
|
|
7
7
|
import { BoundingBox } from "@amodx/math/Geomtry/Bounds/BoundingBox";
|
|
8
|
+
const point = Vector3Like.Create();
|
|
8
9
|
export class ArchivedVoxelTemplate {
|
|
9
|
-
_data;
|
|
10
10
|
index = Flat3DIndex.GetXZYOrder();
|
|
11
|
-
position;
|
|
12
11
|
bounds;
|
|
13
12
|
ids;
|
|
14
13
|
level;
|
|
@@ -16,52 +15,15 @@ export class ArchivedVoxelTemplate {
|
|
|
16
15
|
voxelPalette;
|
|
17
16
|
levelPalette;
|
|
18
17
|
secondaryPalette;
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
this.
|
|
22
|
-
this.position = { ..._data.position };
|
|
23
|
-
this.bounds.setMinPositionAndSize(_data.position, _data.bounds);
|
|
24
|
-
this.index.setBounds(_data.bounds.x, _data.bounds.y, _data.bounds.z);
|
|
25
|
-
this.voxelPalette = new VoxelPaletteArchiveReader(_data.palettes);
|
|
26
|
-
if (_data.palettes.level) {
|
|
27
|
-
this.levelPalette = new NumberPalette(BinaryBuffer.ToTypedArray(_data.palettes.level));
|
|
28
|
-
}
|
|
29
|
-
else {
|
|
30
|
-
this.levelPalette = new NumberPalette([0]);
|
|
31
|
-
}
|
|
32
|
-
if (_data.palettes.secondary) {
|
|
33
|
-
this.secondaryPalette = new NumberPalette(BinaryBuffer.ToTypedArray(_data.palettes.secondary));
|
|
34
|
-
}
|
|
35
|
-
else {
|
|
36
|
-
this.secondaryPalette = new NumberPalette([0]);
|
|
37
|
-
}
|
|
38
|
-
const volume = this.index.size;
|
|
39
|
-
this.ids = _data.buffers.ids
|
|
40
|
-
? new BinaryBuffer(_data.buffers.ids)
|
|
41
|
-
: new BinaryBuffer(BinaryBuffer.Create({
|
|
42
|
-
format: BinaryBufferFormat.Uint16,
|
|
43
|
-
byteLength: volume,
|
|
44
|
-
buffer: 0,
|
|
45
|
-
}));
|
|
46
|
-
this.level = _data.buffers.level
|
|
47
|
-
? new BinaryBuffer(_data.buffers.level)
|
|
48
|
-
: new BinaryBuffer(BinaryBuffer.Create({
|
|
49
|
-
format: BinaryBufferFormat.Uint8,
|
|
50
|
-
byteLength: volume,
|
|
51
|
-
buffer: 0,
|
|
52
|
-
}));
|
|
53
|
-
this.secondary = _data.buffers.secondary
|
|
54
|
-
? new BinaryBuffer(_data.buffers.secondary)
|
|
55
|
-
: new BinaryBuffer(BinaryBuffer.Create({
|
|
56
|
-
format: BinaryBufferFormat.Uint16,
|
|
57
|
-
byteLength: volume,
|
|
58
|
-
buffer: 0,
|
|
59
|
-
}));
|
|
18
|
+
data;
|
|
19
|
+
constructor(data) {
|
|
20
|
+
this.fromJSON(data);
|
|
60
21
|
}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
22
|
+
inBounds(x, y, z) {
|
|
23
|
+
point.x = x + 0.5;
|
|
24
|
+
point.y = y + 0.5;
|
|
25
|
+
point.z = z + 0.5;
|
|
26
|
+
return this.bounds.intersectsPoint(point);
|
|
65
27
|
}
|
|
66
28
|
isAir(index) {
|
|
67
29
|
return this.getId(index) === 0;
|
|
@@ -111,6 +73,10 @@ export class ArchivedVoxelTemplate {
|
|
|
111
73
|
}
|
|
112
74
|
}
|
|
113
75
|
}
|
|
76
|
+
clone() {
|
|
77
|
+
const newTemplate = new ArchivedVoxelTemplate(structuredClone(this.toJSON()));
|
|
78
|
+
return newTemplate;
|
|
79
|
+
}
|
|
114
80
|
getRaw(index, rawRef = [0, 0, 0, 0]) {
|
|
115
81
|
rawRef[0] = this.getId(index);
|
|
116
82
|
rawRef[1] = this.getLight(index);
|
|
@@ -119,6 +85,47 @@ export class ArchivedVoxelTemplate {
|
|
|
119
85
|
return rawRef;
|
|
120
86
|
}
|
|
121
87
|
toJSON() {
|
|
122
|
-
return this.
|
|
88
|
+
return this.data;
|
|
89
|
+
}
|
|
90
|
+
fromJSON(data) {
|
|
91
|
+
this.data = data;
|
|
92
|
+
this.bounds = new BoundingBox();
|
|
93
|
+
this.bounds.setSize(data.bounds);
|
|
94
|
+
this.index.setBounds(data.bounds.x, data.bounds.y, data.bounds.z);
|
|
95
|
+
this.voxelPalette = new VoxelPaletteArchiveReader(data.palettes);
|
|
96
|
+
if (data.palettes.level) {
|
|
97
|
+
this.levelPalette = new NumberPalette(BinaryBuffer.ToTypedArray(data.palettes.level));
|
|
98
|
+
}
|
|
99
|
+
else {
|
|
100
|
+
this.levelPalette = new NumberPalette([0]);
|
|
101
|
+
}
|
|
102
|
+
if (data.palettes.secondary) {
|
|
103
|
+
this.secondaryPalette = new NumberPalette(BinaryBuffer.ToTypedArray(data.palettes.secondary));
|
|
104
|
+
}
|
|
105
|
+
else {
|
|
106
|
+
this.secondaryPalette = new NumberPalette([0]);
|
|
107
|
+
}
|
|
108
|
+
const volume = this.index.size;
|
|
109
|
+
this.ids = data.buffers.ids
|
|
110
|
+
? new BinaryBuffer(data.buffers.ids)
|
|
111
|
+
: new BinaryBuffer(BinaryBuffer.Create({
|
|
112
|
+
format: BinaryBufferFormat.Uint16,
|
|
113
|
+
byteLength: volume,
|
|
114
|
+
buffer: 0,
|
|
115
|
+
}));
|
|
116
|
+
this.level = data.buffers.level
|
|
117
|
+
? new BinaryBuffer(data.buffers.level)
|
|
118
|
+
: new BinaryBuffer(BinaryBuffer.Create({
|
|
119
|
+
format: BinaryBufferFormat.Uint8,
|
|
120
|
+
byteLength: volume,
|
|
121
|
+
buffer: 0,
|
|
122
|
+
}));
|
|
123
|
+
this.secondary = data.buffers.secondary
|
|
124
|
+
? new BinaryBuffer(data.buffers.secondary)
|
|
125
|
+
: new BinaryBuffer(BinaryBuffer.Create({
|
|
126
|
+
format: BinaryBufferFormat.Uint16,
|
|
127
|
+
byteLength: volume,
|
|
128
|
+
buffer: 0,
|
|
129
|
+
}));
|
|
123
130
|
}
|
|
124
131
|
}
|
|
@@ -147,14 +147,16 @@ export default function CreateArchivedTemplate(dataCursor, bounds) {
|
|
|
147
147
|
const palettes = {
|
|
148
148
|
...voxelPalette.toJSON(),
|
|
149
149
|
};
|
|
150
|
-
if (
|
|
150
|
+
if (levelPalette.size > 0 &&
|
|
151
|
+
!(levelPalette.size == 1 && levelPalette._palette[0] === 0)) {
|
|
151
152
|
palettes.level = BinaryBuffer.Create({
|
|
152
153
|
format: BinaryBufferFormat.Uint8,
|
|
153
154
|
byteLength: levelPalette._palette.length,
|
|
154
155
|
buffer: Uint8Array.from(levelPalette._palette).buffer,
|
|
155
156
|
});
|
|
156
157
|
}
|
|
157
|
-
if (
|
|
158
|
+
if (secondaryPalette.size > 0 &&
|
|
159
|
+
!(secondaryPalette.size == 1 && secondaryPalette._palette[0] === 0)) {
|
|
158
160
|
palettes.secondary = BinaryBuffer.Create({
|
|
159
161
|
format: BinaryBufferFormat.Uint16,
|
|
160
162
|
byteLength: secondaryPalette._palette.length,
|
|
@@ -173,12 +175,10 @@ export default function CreateArchivedTemplate(dataCursor, bounds) {
|
|
|
173
175
|
secondary: "YXZ",
|
|
174
176
|
},
|
|
175
177
|
},
|
|
176
|
-
position: Vector3Like.Create(),
|
|
177
178
|
bounds: Vector3Like.Create(...index.getBounds()),
|
|
178
179
|
palettes,
|
|
179
180
|
buffers,
|
|
180
181
|
};
|
|
181
|
-
console.log(data);
|
|
182
182
|
const archived = new ArchivedVoxelTemplate(data);
|
|
183
183
|
return archived;
|
|
184
184
|
}
|
|
@@ -35,7 +35,6 @@ export default async function ExportArchiedTemplateJSON(templateData) {
|
|
|
35
35
|
engineVersion: templateData.engineVersion,
|
|
36
36
|
formatVersion: templateData.formatVersion,
|
|
37
37
|
dataKey: templateData.dataKey,
|
|
38
|
-
position: templateData.position,
|
|
39
38
|
bounds: templateData.bounds,
|
|
40
39
|
type: templateData.type,
|
|
41
40
|
buffers,
|
|
@@ -27,11 +27,9 @@ export default async function ImportArchivedTemplateJSON(jsonData) {
|
|
|
27
27
|
formatVersion: jsonData.formatVersion,
|
|
28
28
|
dataKey: jsonData.dataKey,
|
|
29
29
|
type: jsonData.type,
|
|
30
|
-
position: jsonData.position,
|
|
31
30
|
bounds: jsonData.bounds,
|
|
32
31
|
buffers,
|
|
33
32
|
palettes,
|
|
34
33
|
};
|
|
35
|
-
console.warn("IMPORT TEMPLATE", data, jsonData);
|
|
36
34
|
return data;
|
|
37
35
|
}
|
|
@@ -2,12 +2,17 @@ import { TemplateVoxelCursor } from "./TemplateVoxelCursor";
|
|
|
2
2
|
import { DataCursorInterface } from "../../Voxels/Cursor/DataCursor.interface";
|
|
3
3
|
import { IVoxelTemplate } from "../../Templates/VoxelTemplates.types";
|
|
4
4
|
import { TemplateProxy } from "./TemplateProxy";
|
|
5
|
+
import { BoundingBox } from "@amodx/math/Geomtry/Bounds/BoundingBox";
|
|
5
6
|
export declare class TemplateCursor implements DataCursorInterface {
|
|
6
7
|
_voxelIndex: number;
|
|
7
8
|
_proxy: TemplateProxy | null;
|
|
9
|
+
private _airCursor;
|
|
10
|
+
baseLightValue: number;
|
|
8
11
|
private voxel;
|
|
12
|
+
volumeBounds: BoundingBox;
|
|
13
|
+
constructor();
|
|
9
14
|
inBounds(x: number, y: number, z: number): boolean;
|
|
10
15
|
setTemplate(template: IVoxelTemplate): void;
|
|
11
|
-
getVoxel(x: number, y: number, z: number): TemplateVoxelCursor
|
|
16
|
+
getVoxel(x: number, y: number, z: number): TemplateVoxelCursor;
|
|
12
17
|
clone(): DataCursorInterface;
|
|
13
18
|
}
|
|
@@ -1,18 +1,31 @@
|
|
|
1
1
|
import { TemplateVoxelCursor } from "./TemplateVoxelCursor";
|
|
2
2
|
import { TemplateProxy } from "./TemplateProxy";
|
|
3
|
+
import { VoxelCursor } from "../../Voxels/Cursor/VoxelCursor";
|
|
4
|
+
import { BoundingBox } from "@amodx/math/Geomtry/Bounds/BoundingBox";
|
|
5
|
+
const raw = [0, 0, 0, 0];
|
|
3
6
|
export class TemplateCursor {
|
|
4
7
|
_voxelIndex = 0;
|
|
5
8
|
_proxy = null;
|
|
9
|
+
_airCursor = new VoxelCursor();
|
|
10
|
+
baseLightValue = 0xf;
|
|
6
11
|
voxel = new TemplateVoxelCursor(this);
|
|
12
|
+
volumeBounds = new BoundingBox();
|
|
13
|
+
constructor() { }
|
|
7
14
|
inBounds(x, y, z) {
|
|
8
|
-
|
|
15
|
+
if (!this._proxy)
|
|
16
|
+
return false;
|
|
17
|
+
return this._proxy.inBounds(x, y, z);
|
|
9
18
|
}
|
|
10
19
|
setTemplate(template) {
|
|
11
20
|
this._proxy = new TemplateProxy(template);
|
|
21
|
+
this.volumeBounds.setMinMax(template.bounds.min, template.bounds.max);
|
|
12
22
|
}
|
|
13
23
|
getVoxel(x, y, z) {
|
|
14
|
-
if (!this._proxy)
|
|
15
|
-
|
|
24
|
+
if (!this._proxy || !this._proxy.inBounds(x, y, z)) {
|
|
25
|
+
raw[1] = this.baseLightValue;
|
|
26
|
+
this._airCursor.setRaw(raw);
|
|
27
|
+
return this._airCursor;
|
|
28
|
+
}
|
|
16
29
|
this._voxelIndex = this._proxy.template.index.getIndexXYZ(x, y, z);
|
|
17
30
|
this.voxel.loadIn();
|
|
18
31
|
return this.voxel;
|
|
@@ -19,4 +19,13 @@ export class TemplateProxy {
|
|
|
19
19
|
get: (_, index) => this.template.getSecondary(Number(index)),
|
|
20
20
|
});
|
|
21
21
|
}
|
|
22
|
+
inBounds(x, y, z) {
|
|
23
|
+
const inBounds = this.template.inBounds(x, y, z);
|
|
24
|
+
if (!inBounds)
|
|
25
|
+
return false;
|
|
26
|
+
const index = this.template.getIndex(x, y, z);
|
|
27
|
+
if (!this.template.isIncluded(index))
|
|
28
|
+
return false;
|
|
29
|
+
return true;
|
|
30
|
+
}
|
|
22
31
|
}
|
|
@@ -25,5 +25,11 @@ export class TemplateVoxelCursor extends VoxelCursorInterface {
|
|
|
25
25
|
this._index = this.dataCursor._voxelIndex;
|
|
26
26
|
this.process();
|
|
27
27
|
}
|
|
28
|
+
getLight() {
|
|
29
|
+
const light = super.getLight();
|
|
30
|
+
if (light <= 0)
|
|
31
|
+
return this.dataCursor.baseLightValue;
|
|
32
|
+
return light;
|
|
33
|
+
}
|
|
28
34
|
updateVoxel(mode) { }
|
|
29
35
|
}
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import { Flat3DIndex, Vec3Array
|
|
1
|
+
import { Flat3DIndex, Vec3Array } from "@amodx/math";
|
|
2
2
|
import { IVoxelTemplate } from "../VoxelTemplates.types";
|
|
3
3
|
import { FullVoxelTemplateData } from "./FullVoxelTemplate.types";
|
|
4
4
|
import { RawVoxelData } from "../../Voxels/Types/Voxel.types";
|
|
5
5
|
import { BoundingBox } from "@amodx/math/Geomtry/Bounds/BoundingBox";
|
|
6
|
-
export declare class FullVoxelTemplate implements IVoxelTemplate {
|
|
6
|
+
export declare class FullVoxelTemplate implements IVoxelTemplate<"full"> {
|
|
7
7
|
static CreateNew(bounds: Vec3Array, baseLightValue?: number): FullVoxelTemplateData;
|
|
8
8
|
index: Flat3DIndex;
|
|
9
|
-
position: Vector3Like;
|
|
10
9
|
bounds: BoundingBox;
|
|
11
10
|
ids: Uint16Array;
|
|
12
11
|
level: Uint8Array;
|
|
@@ -14,7 +13,7 @@ export declare class FullVoxelTemplate implements IVoxelTemplate {
|
|
|
14
13
|
secondary: Uint16Array;
|
|
15
14
|
mask?: Uint8Array;
|
|
16
15
|
constructor(data: FullVoxelTemplateData);
|
|
17
|
-
|
|
16
|
+
inBounds(x: number, y: number, z: number): boolean;
|
|
18
17
|
isAir(index: number): boolean;
|
|
19
18
|
isIncluded(index: number): boolean;
|
|
20
19
|
getIndex(x: number, y: number, z: number): number;
|
|
@@ -23,5 +22,7 @@ export declare class FullVoxelTemplate implements IVoxelTemplate {
|
|
|
23
22
|
getLevel(index: number): number;
|
|
24
23
|
getSecondary(index: number): number;
|
|
25
24
|
getRaw(index: number, rawRef?: RawVoxelData): RawVoxelData;
|
|
25
|
+
clone(): FullVoxelTemplate;
|
|
26
26
|
toJSON(): FullVoxelTemplateData;
|
|
27
|
+
fromJSON(data: FullVoxelTemplateData): void;
|
|
27
28
|
}
|