@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
|
@@ -2,6 +2,7 @@ import { Flat3DIndex, Vector3Like } from "@amodx/math";
|
|
|
2
2
|
import { getBitArrayIndex } from "../../Util/Binary/BinaryArrays";
|
|
3
3
|
import { EngineSettings } from "../../Settings/EngineSettings";
|
|
4
4
|
import { BoundingBox } from "@amodx/math/Geomtry/Bounds/BoundingBox";
|
|
5
|
+
const point = Vector3Like.Create();
|
|
5
6
|
export class FullVoxelTemplate {
|
|
6
7
|
static CreateNew(bounds, baseLightValue = 0) {
|
|
7
8
|
const voxelSize = bounds[0] * bounds[1] * bounds[2];
|
|
@@ -29,7 +30,6 @@ export class FullVoxelTemplate {
|
|
|
29
30
|
bufferStart += voxelSize;
|
|
30
31
|
return {
|
|
31
32
|
type: "full",
|
|
32
|
-
position: Vector3Like.Create(),
|
|
33
33
|
bounds: Vector3Like.Create(...bounds),
|
|
34
34
|
ids,
|
|
35
35
|
light,
|
|
@@ -38,7 +38,6 @@ export class FullVoxelTemplate {
|
|
|
38
38
|
};
|
|
39
39
|
}
|
|
40
40
|
index = Flat3DIndex.GetXZYOrder();
|
|
41
|
-
position = Vector3Like.Create();
|
|
42
41
|
bounds;
|
|
43
42
|
ids;
|
|
44
43
|
level;
|
|
@@ -46,26 +45,20 @@ export class FullVoxelTemplate {
|
|
|
46
45
|
secondary;
|
|
47
46
|
mask;
|
|
48
47
|
constructor(data) {
|
|
49
|
-
this.
|
|
50
|
-
this.bounds = new BoundingBox();
|
|
51
|
-
this.bounds.setMinPositionAndSize(data.position, data.bounds);
|
|
52
|
-
this.index.setBounds(data.bounds.x, data.bounds.y, data.bounds.z);
|
|
53
|
-
this.ids = data.ids;
|
|
54
|
-
this.level = data.level;
|
|
55
|
-
this.light = data.light;
|
|
56
|
-
this.secondary = data.secondary;
|
|
57
|
-
if (data.mask)
|
|
58
|
-
this.mask = data.mask;
|
|
48
|
+
this.fromJSON(data);
|
|
59
49
|
}
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
50
|
+
inBounds(x, y, z) {
|
|
51
|
+
point.x = x + 0.5;
|
|
52
|
+
point.y = y + 0.5;
|
|
53
|
+
point.z = z + 0.5;
|
|
54
|
+
return this.bounds.intersectsPoint(point);
|
|
64
55
|
}
|
|
65
56
|
isAir(index) {
|
|
66
57
|
return this.ids[index] === 0;
|
|
67
58
|
}
|
|
68
59
|
isIncluded(index) {
|
|
60
|
+
if (index < 0 || index >= this.index.size)
|
|
61
|
+
return false;
|
|
69
62
|
if (this.mask) {
|
|
70
63
|
return getBitArrayIndex(this.mask, index) === 1;
|
|
71
64
|
}
|
|
@@ -93,10 +86,21 @@ export class FullVoxelTemplate {
|
|
|
93
86
|
rawRef[3] = this.getSecondary(index);
|
|
94
87
|
return rawRef;
|
|
95
88
|
}
|
|
89
|
+
clone() {
|
|
90
|
+
const newTemplate = new FullVoxelTemplate({
|
|
91
|
+
type: "full",
|
|
92
|
+
bounds: { ...this.bounds.size },
|
|
93
|
+
ids: this.ids.slice(),
|
|
94
|
+
light: this.light.slice(),
|
|
95
|
+
level: this.level.slice(),
|
|
96
|
+
secondary: this.secondary.slice(),
|
|
97
|
+
...(this.mask ? { mask: this.mask.slice() } : {}),
|
|
98
|
+
});
|
|
99
|
+
return newTemplate;
|
|
100
|
+
}
|
|
96
101
|
toJSON() {
|
|
97
102
|
return {
|
|
98
103
|
type: "full",
|
|
99
|
-
position: this.position,
|
|
100
104
|
bounds: this.bounds.size,
|
|
101
105
|
ids: this.ids,
|
|
102
106
|
light: this.light,
|
|
@@ -105,4 +109,15 @@ export class FullVoxelTemplate {
|
|
|
105
109
|
...(this.mask ? { mask: this.mask } : {}),
|
|
106
110
|
};
|
|
107
111
|
}
|
|
112
|
+
fromJSON(data) {
|
|
113
|
+
this.bounds = new BoundingBox();
|
|
114
|
+
this.bounds.setSize(data.bounds);
|
|
115
|
+
this.index.setBounds(data.bounds.x, data.bounds.y, data.bounds.z);
|
|
116
|
+
this.ids = data.ids;
|
|
117
|
+
this.level = data.level;
|
|
118
|
+
this.light = data.light;
|
|
119
|
+
this.secondary = data.secondary;
|
|
120
|
+
if (data.mask)
|
|
121
|
+
this.mask = data.mask;
|
|
122
|
+
}
|
|
108
123
|
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { IVoxelSelection } from "../Selection/VoxelSelection";
|
|
2
|
+
import { DataCursorInterface } from "../../Voxels/Cursor/DataCursor.interface";
|
|
3
|
+
import { FullVoxelTemplate } from "../Full/FullVoxelTemplate";
|
|
4
|
+
import { Vector3Like } from "@amodx/math";
|
|
5
|
+
export declare function ExtrudeSelection(cursor: DataCursorInterface, selection: IVoxelSelection, normal: Vector3Like): FullVoxelTemplate;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { FullVoxelTemplate } from "../Full/FullVoxelTemplate";
|
|
2
|
+
export function ExtrudeSelection(cursor, selection, normal) {
|
|
3
|
+
const size = selection.bounds.size;
|
|
4
|
+
const template = new FullVoxelTemplate(FullVoxelTemplate.CreateNew([size.x, size.y, size.z]));
|
|
5
|
+
for (let x = selection.origin.x; x < selection.origin.x + size.x; x++) {
|
|
6
|
+
for (let y = selection.origin.y; y < selection.origin.y + size.y; y++) {
|
|
7
|
+
for (let z = selection.origin.z; z < selection.origin.z + size.z; z++) {
|
|
8
|
+
if (selection.isSelected(x, y, z)) {
|
|
9
|
+
let nx = x;
|
|
10
|
+
let ny = y;
|
|
11
|
+
let nz = z;
|
|
12
|
+
const index = template.getIndex(x - selection.origin.x, y - selection.origin.y, z - selection.origin.z);
|
|
13
|
+
while (true) {
|
|
14
|
+
nx -= normal.x;
|
|
15
|
+
ny -= normal.y;
|
|
16
|
+
nz -= normal.z;
|
|
17
|
+
if (!selection.isSelected(nx, ny, nz)) {
|
|
18
|
+
const voxel = cursor.getVoxel(nx, ny, nz);
|
|
19
|
+
if (!voxel || voxel.isAir())
|
|
20
|
+
break;
|
|
21
|
+
template.ids[index] = voxel.ids[voxel._index];
|
|
22
|
+
template.level[index] = voxel.level[voxel._index];
|
|
23
|
+
template.secondary[index] = voxel.secondary[voxel._index];
|
|
24
|
+
break;
|
|
25
|
+
}
|
|
26
|
+
if (x < selection.origin.x || x >= selection.origin.x + size.x)
|
|
27
|
+
continue;
|
|
28
|
+
if (y < selection.origin.y || y >= selection.origin.y + size.y)
|
|
29
|
+
continue;
|
|
30
|
+
if (z < selection.origin.z || z >= selection.origin.z + size.z)
|
|
31
|
+
continue;
|
|
32
|
+
const nIndex = template.getIndex(nx - selection.origin.x, ny - selection.origin.y, nz - selection.origin.z);
|
|
33
|
+
if (!template.isAir(nIndex)) {
|
|
34
|
+
template.ids[index] = template.ids[nIndex];
|
|
35
|
+
template.level[index] = template.level[nIndex];
|
|
36
|
+
template.secondary[index] = template.secondary[nIndex];
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
return template;
|
|
44
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { IVoxelSelection } from "../Selection/VoxelSelection";
|
|
2
|
+
import { FullVoxelTemplate } from "../Full/FullVoxelTemplate";
|
|
3
|
+
import { PaintVoxelData } from "../../Voxels/Types/PaintVoxelData";
|
|
4
|
+
export declare function FillSelection(voxel: PaintVoxelData, selection: IVoxelSelection): FullVoxelTemplate;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { FullVoxelTemplate } from "../Full/FullVoxelTemplate";
|
|
2
|
+
import { PaintVoxelData } from "../../Voxels/Types/PaintVoxelData";
|
|
3
|
+
export function FillSelection(voxel, selection) {
|
|
4
|
+
const size = selection.bounds.size;
|
|
5
|
+
const template = new FullVoxelTemplate(FullVoxelTemplate.CreateNew([size.x, size.y, size.z]));
|
|
6
|
+
const raw = PaintVoxelData.ToRaw(voxel);
|
|
7
|
+
for (let x = selection.origin.x; x < selection.origin.x + size.x; x++) {
|
|
8
|
+
for (let y = selection.origin.y; y < selection.origin.y + size.y; y++) {
|
|
9
|
+
for (let z = selection.origin.z; z < selection.origin.z + size.z; z++) {
|
|
10
|
+
if (selection.isSelected(x, y, z)) {
|
|
11
|
+
const index = template.getIndex(x - selection.origin.x, y - selection.origin.y, z - selection.origin.z);
|
|
12
|
+
template.ids[index] = raw[0];
|
|
13
|
+
template.level[index] = raw[2];
|
|
14
|
+
template.secondary[index] = raw[3];
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
return template;
|
|
20
|
+
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
+
import { Vector3Axes } from "@amodx/math";
|
|
1
2
|
import { FullVoxelTemplate } from "../../Templates/Full/FullVoxelTemplate";
|
|
2
|
-
export
|
|
3
|
-
export default function FlipTemplate(template: FullVoxelTemplate, direction: TemplateFlipDirections): void;
|
|
3
|
+
export default function FlipTemplate(template: FullVoxelTemplate, axes: Vector3Axes): void;
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { Flat3DIndex } from "@amodx/math";
|
|
2
|
-
const flipArray = ([sizeX, sizeY, sizeZ], array,
|
|
2
|
+
const flipArray = ([sizeX, sizeY, sizeZ], array, axes, index) => {
|
|
3
3
|
const newArray = new Array(array.length);
|
|
4
4
|
for (let x = 0; x < sizeX; x++) {
|
|
5
5
|
for (let y = 0; y < sizeY; y++) {
|
|
6
6
|
for (let z = 0; z < sizeZ; z++) {
|
|
7
7
|
const oldIndex = index.getIndexXYZ(x, y, z);
|
|
8
8
|
let newCoords = [x, y, z];
|
|
9
|
-
if (
|
|
9
|
+
if (axes === "x") {
|
|
10
10
|
newCoords[0] = sizeX - 1 - x;
|
|
11
11
|
}
|
|
12
|
-
else if (
|
|
12
|
+
else if (axes === "y") {
|
|
13
13
|
newCoords[1] = sizeY - 1 - y;
|
|
14
14
|
}
|
|
15
|
-
else if (
|
|
15
|
+
else if (axes === "z") {
|
|
16
16
|
newCoords[2] = sizeZ - 1 - z;
|
|
17
17
|
}
|
|
18
18
|
const newIndexFlat = index.getIndexXYZ(...newCoords);
|
|
@@ -24,20 +24,20 @@ const flipArray = ([sizeX, sizeY, sizeZ], array, direction, index) => {
|
|
|
24
24
|
array[i] = newArray[i];
|
|
25
25
|
}
|
|
26
26
|
};
|
|
27
|
-
export default function FlipTemplate(template,
|
|
27
|
+
export default function FlipTemplate(template, axes) {
|
|
28
28
|
const { x: sizeX, y: sizeY, z: sizeZ } = template.bounds.size;
|
|
29
29
|
const index = Flat3DIndex.GetXZYOrder();
|
|
30
30
|
index.setBounds(sizeX, sizeY, sizeZ);
|
|
31
31
|
if (typeof template.ids === "object") {
|
|
32
32
|
const ids = template.ids;
|
|
33
|
-
flipArray([sizeX, sizeY, sizeZ], ids,
|
|
33
|
+
flipArray([sizeX, sizeY, sizeZ], ids, axes, index);
|
|
34
34
|
}
|
|
35
35
|
if (typeof template.level === "object") {
|
|
36
36
|
const level = template.level;
|
|
37
|
-
flipArray([sizeX, sizeY, sizeZ], level,
|
|
37
|
+
flipArray([sizeX, sizeY, sizeZ], level, axes, index);
|
|
38
38
|
}
|
|
39
39
|
if (typeof template.secondary === "object") {
|
|
40
40
|
const secondary = template.secondary;
|
|
41
|
-
flipArray([sizeX, sizeY, sizeZ], secondary,
|
|
41
|
+
flipArray([sizeX, sizeY, sizeZ], secondary, axes, index);
|
|
42
42
|
}
|
|
43
43
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
+
import { Vector3Axes } from "@amodx/math";
|
|
1
2
|
import { FullVoxelTemplate } from "../Full/FullVoxelTemplate";
|
|
2
|
-
export type TemplateRotationAxes = "x" | "y" | "z";
|
|
3
3
|
export type TemplateRotationAngles = 90 | 180 | 270 | -90 | -180 | -270;
|
|
4
|
-
export default function RotateTemplate(template: FullVoxelTemplate, angle: TemplateRotationAngles, axes?:
|
|
4
|
+
export default function RotateTemplate(template: FullVoxelTemplate, angle: TemplateRotationAngles, axes?: Vector3Axes): void;
|
|
@@ -12,6 +12,7 @@ export declare class VoxelPathSegment extends TypedEventTarget<VoxelPathSegments
|
|
|
12
12
|
start: Vec3Array;
|
|
13
13
|
end: Vec3Array;
|
|
14
14
|
voxel: PaintVoxelData;
|
|
15
|
+
transient: boolean;
|
|
15
16
|
constructor(path: VoxelPath, index: number, data: VoxelPathSegmentData);
|
|
16
17
|
setPoints([sx, sy, sz]: Vec3Array, [ex, ey, ez]: Vec3Array): void;
|
|
17
18
|
getPoint(point: 0 | 1): Vec3Array;
|
|
@@ -27,6 +28,9 @@ export declare class VoxelPath extends TypedEventTarget<VoxelPathEvents> {
|
|
|
27
28
|
static CreateNew(data: Partial<VoxelPathData>): VoxelPathData;
|
|
28
29
|
segments: VoxelPathSegment[];
|
|
29
30
|
constructor(data: VoxelPathData);
|
|
31
|
+
get totalSegments(): number;
|
|
32
|
+
lastSegment(): VoxelPathSegment | null;
|
|
33
|
+
firstSegment(): VoxelPathSegment | null;
|
|
30
34
|
addSegment(data: VoxelPathSegmentData): boolean;
|
|
31
35
|
removeSegment(segment: VoxelPathSegment): boolean;
|
|
32
36
|
removePoint(segmentIndex: number, pointIndex: 0 | 1): false | undefined;
|
|
@@ -8,11 +8,13 @@ export class VoxelPathSegment extends TypedEventTarget {
|
|
|
8
8
|
start: data.start ? data.start : [0, 0, 0],
|
|
9
9
|
end: data.end ? data.end : [0, 0, 0],
|
|
10
10
|
voxel: data.voxel ? data.voxel : PaintVoxelData.Create(),
|
|
11
|
+
transient: data.transient ? data.transient : undefined,
|
|
11
12
|
};
|
|
12
13
|
}
|
|
13
14
|
start;
|
|
14
15
|
end;
|
|
15
16
|
voxel;
|
|
17
|
+
transient = false;
|
|
16
18
|
constructor(path, index, data) {
|
|
17
19
|
super();
|
|
18
20
|
this.path = path;
|
|
@@ -20,6 +22,7 @@ export class VoxelPathSegment extends TypedEventTarget {
|
|
|
20
22
|
this.start = data.start;
|
|
21
23
|
this.end = data.end;
|
|
22
24
|
this.voxel = data.voxel;
|
|
25
|
+
this.transient = data.transient || false;
|
|
23
26
|
}
|
|
24
27
|
setPoints([sx, sy, sz], [ex, ey, ez]) {
|
|
25
28
|
let updated = false;
|
|
@@ -60,6 +63,7 @@ export class VoxelPathSegment extends TypedEventTarget {
|
|
|
60
63
|
start: [...this.start],
|
|
61
64
|
end: [...this.end],
|
|
62
65
|
voxel: { ...this.voxel },
|
|
66
|
+
...(this.transient ? { transient: true } : {}),
|
|
63
67
|
};
|
|
64
68
|
}
|
|
65
69
|
}
|
|
@@ -78,6 +82,19 @@ export class VoxelPath extends TypedEventTarget {
|
|
|
78
82
|
this.segments.push(new VoxelPathSegment(this, i, data.segments[i]));
|
|
79
83
|
}
|
|
80
84
|
}
|
|
85
|
+
get totalSegments() {
|
|
86
|
+
return this.segments.length;
|
|
87
|
+
}
|
|
88
|
+
lastSegment() {
|
|
89
|
+
if (!this.segments.length)
|
|
90
|
+
return null;
|
|
91
|
+
return this.segments[(this.totalSegments - 1) % this.totalSegments];
|
|
92
|
+
}
|
|
93
|
+
firstSegment() {
|
|
94
|
+
if (!this.segments.length)
|
|
95
|
+
return null;
|
|
96
|
+
return this.segments[0];
|
|
97
|
+
}
|
|
81
98
|
addSegment(data) {
|
|
82
99
|
const segment = new VoxelPathSegment(this, this.segments.length, data);
|
|
83
100
|
this.segments.push(segment);
|
|
@@ -88,6 +105,7 @@ export class VoxelPath extends TypedEventTarget {
|
|
|
88
105
|
for (let i = this.segments.length - 1; i > -1; i--) {
|
|
89
106
|
this.segments[i].index--;
|
|
90
107
|
if (this.segments[i] == segment) {
|
|
108
|
+
console.log("found segment to remove", i);
|
|
91
109
|
this.segments.splice(i, 1);
|
|
92
110
|
break;
|
|
93
111
|
}
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import { Flat3DIndex, Vector3Like } from "@amodx/math";
|
|
2
|
-
import { IVoxelSelection } from "./
|
|
2
|
+
import { IVoxelSelection, IVoxelSelectionData } from "./VoxelSelection";
|
|
3
3
|
import { DataCursorInterface } from "../../Voxels/Cursor/DataCursor.interface";
|
|
4
4
|
import { FullVoxelTemplate } from "../Full/FullVoxelTemplate";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
size: Vector3Like;
|
|
5
|
+
import { BoundingBox } from "@amodx/math/Geomtry/Bounds/BoundingBox";
|
|
6
|
+
export interface VoxelBFSSelectionData extends IVoxelSelectionData<"bfs"> {
|
|
8
7
|
bitIndex: Uint8Array;
|
|
9
8
|
}
|
|
10
|
-
export declare class VoxelBFSSelection implements IVoxelSelection, VoxelBFSSelectionData {
|
|
9
|
+
export declare class VoxelBFSSelection implements IVoxelSelection<"bfs", VoxelBFSSelectionData> {
|
|
11
10
|
origin: Vector3Like;
|
|
12
|
-
size: Vector3Like;
|
|
13
11
|
bitIndex: Uint8Array;
|
|
14
12
|
index: Flat3DIndex;
|
|
13
|
+
bounds: BoundingBox;
|
|
15
14
|
isSelected(x: number, y: number, z: number): boolean;
|
|
16
15
|
reConstruct(cursor: DataCursorInterface, position: Vector3Like, maxSize?: number): false | undefined;
|
|
17
16
|
toTemplate(cursor: DataCursorInterface): FullVoxelTemplate;
|
|
17
|
+
clone(): VoxelBFSSelection;
|
|
18
18
|
toJSON(): VoxelBFSSelectionData;
|
|
19
19
|
fromJSON(data: VoxelBFSSelectionData): void;
|
|
20
20
|
}
|
|
@@ -2,17 +2,14 @@ import { Flat3DIndex, Vector3Like } from "@amodx/math";
|
|
|
2
2
|
import { CardinalNeighbors3D } from "../../Math/CardinalNeighbors";
|
|
3
3
|
import { getBitArrayIndex, setBitArrayIndex, } from "../../Util/Binary/BinaryArrays";
|
|
4
4
|
import { FullVoxelTemplate } from "../Full/FullVoxelTemplate";
|
|
5
|
+
import { BoundingBox } from "@amodx/math/Geomtry/Bounds/BoundingBox";
|
|
5
6
|
export class VoxelBFSSelection {
|
|
6
7
|
origin = Vector3Like.Create();
|
|
7
|
-
size = Vector3Like.Create();
|
|
8
8
|
bitIndex;
|
|
9
9
|
index = Flat3DIndex.GetXZYOrder();
|
|
10
|
+
bounds = new BoundingBox();
|
|
10
11
|
isSelected(x, y, z) {
|
|
11
|
-
if (
|
|
12
|
-
return false;
|
|
13
|
-
if (y < this.origin.y || y >= this.origin.y + this.size.y)
|
|
14
|
-
return false;
|
|
15
|
-
if (z < this.origin.z || z >= this.origin.z + this.size.z)
|
|
12
|
+
if (!this.bounds.intersectsXYZ(x + 0.5, y + 0.5, z + 0.5))
|
|
16
13
|
return false;
|
|
17
14
|
return (getBitArrayIndex(this.bitIndex, this.index.getIndexXYZ(x - this.origin.x, y - this.origin.y, z - this.origin.z)) === 1);
|
|
18
15
|
}
|
|
@@ -78,24 +75,23 @@ export class VoxelBFSSelection {
|
|
|
78
75
|
}
|
|
79
76
|
}
|
|
80
77
|
}
|
|
81
|
-
this.size.x = sizeX;
|
|
82
|
-
this.size.y = sizeY;
|
|
83
|
-
this.size.z = sizeZ;
|
|
84
78
|
this.origin.x = min.x;
|
|
85
79
|
this.origin.y = min.y;
|
|
86
80
|
this.origin.z = min.z;
|
|
81
|
+
this.bounds.setMinMax(this.origin, {
|
|
82
|
+
x: this.origin.x + sizeX,
|
|
83
|
+
y: this.origin.y + sizeY,
|
|
84
|
+
z: this.origin.z + sizeZ,
|
|
85
|
+
});
|
|
87
86
|
}
|
|
88
87
|
toTemplate(cursor) {
|
|
89
|
-
const
|
|
90
|
-
|
|
91
|
-
this.size.y,
|
|
92
|
-
this.size.z,
|
|
93
|
-
]);
|
|
88
|
+
const size = this.bounds.size;
|
|
89
|
+
const templateData = FullVoxelTemplate.CreateNew([size.x, size.y, size.z]);
|
|
94
90
|
templateData.mask = this.bitIndex.slice();
|
|
95
91
|
const template = new FullVoxelTemplate(templateData);
|
|
96
|
-
for (let x = this.origin.x; x < this.origin.x +
|
|
97
|
-
for (let y = this.origin.y; y < this.origin.y +
|
|
98
|
-
for (let z = this.origin.z; z < this.origin.z +
|
|
92
|
+
for (let x = this.origin.x; x < this.origin.x + size.x; x++) {
|
|
93
|
+
for (let y = this.origin.y; y < this.origin.y + size.y; y++) {
|
|
94
|
+
for (let z = this.origin.z; z < this.origin.z + size.z; z++) {
|
|
99
95
|
if (!this.isSelected(x, y, z))
|
|
100
96
|
continue;
|
|
101
97
|
const voxel = cursor.getVoxel(x, y, z);
|
|
@@ -110,10 +106,19 @@ export class VoxelBFSSelection {
|
|
|
110
106
|
}
|
|
111
107
|
return template;
|
|
112
108
|
}
|
|
109
|
+
clone() {
|
|
110
|
+
const newSelection = new VoxelBFSSelection();
|
|
111
|
+
Vector3Like.Copy(newSelection.origin, this.origin);
|
|
112
|
+
newSelection.bounds.setMinMax(this.bounds.min, this.bounds.max);
|
|
113
|
+
newSelection.bitIndex = this.bitIndex.slice();
|
|
114
|
+
newSelection.index.setBounds(...this.index.getBounds());
|
|
115
|
+
return newSelection;
|
|
116
|
+
}
|
|
113
117
|
toJSON() {
|
|
114
118
|
return {
|
|
119
|
+
type: "bfs",
|
|
115
120
|
origin: { ...this.origin },
|
|
116
|
-
|
|
121
|
+
bounds: { ...this.bounds.size },
|
|
117
122
|
bitIndex: this.bitIndex.slice(),
|
|
118
123
|
};
|
|
119
124
|
}
|
|
@@ -121,10 +126,12 @@ export class VoxelBFSSelection {
|
|
|
121
126
|
this.origin.x = data.origin.x;
|
|
122
127
|
this.origin.y = data.origin.y;
|
|
123
128
|
this.origin.z = data.origin.z;
|
|
124
|
-
this.size.x = data.size.x;
|
|
125
|
-
this.size.y = data.size.y;
|
|
126
|
-
this.size.z = data.size.z;
|
|
127
129
|
this.bitIndex = data.bitIndex;
|
|
128
|
-
this.
|
|
130
|
+
this.bounds.setMinMax(this.origin, {
|
|
131
|
+
x: this.origin.x + data.bounds.x,
|
|
132
|
+
y: this.origin.y + data.bounds.y,
|
|
133
|
+
z: this.origin.z + data.bounds.z,
|
|
134
|
+
});
|
|
135
|
+
this.index.setBounds(data.bounds.x, data.bounds.y, data.bounds.z);
|
|
129
136
|
}
|
|
130
137
|
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Vector3Like } from "@amodx/math";
|
|
2
|
+
import { IVoxelSelection, IVoxelSelectionData } from "./VoxelSelection";
|
|
3
|
+
import { VoxelShapeTemplate } from "../Shapes/VoxelShapeTemplate";
|
|
4
|
+
import { IVoxelshapeTemplateBaseData } from "../Shapes/VoxelShapeTemplate.types";
|
|
5
|
+
import { DataCursorInterface } from "../../Voxels/Cursor/DataCursor.interface";
|
|
6
|
+
import { BoundingBox } from "@amodx/math/Geomtry/Bounds/BoundingBox";
|
|
7
|
+
export interface VoxelBoundsSelectionData extends IVoxelSelectionData<"bounds"> {
|
|
8
|
+
}
|
|
9
|
+
export declare class VoxelBoundsSelection implements IVoxelSelection<"bounds", VoxelBoundsSelectionData> {
|
|
10
|
+
origin: Vector3Like;
|
|
11
|
+
end: Vector3Like;
|
|
12
|
+
bounds: BoundingBox;
|
|
13
|
+
isSelected(x: number, y: number, z: number): boolean;
|
|
14
|
+
reConstruct(startPosition: Vector3Like, startNormal: Vector3Like, endPosition: Vector3Like, endNormal: Vector3Like, offset?: number): void;
|
|
15
|
+
clone(): VoxelBoundsSelection;
|
|
16
|
+
toTemplate(data?: Partial<IVoxelshapeTemplateBaseData>): VoxelShapeTemplate;
|
|
17
|
+
toExtrudedTemplate(cursor: DataCursorInterface, normal: Vector3Like): void;
|
|
18
|
+
toJSON(): VoxelBoundsSelectionData;
|
|
19
|
+
fromJSON(data: VoxelBoundsSelectionData): void;
|
|
20
|
+
}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { Vec3ArrayLike, Vector3Like } from "@amodx/math";
|
|
2
|
-
import {
|
|
2
|
+
import { VoxelShapeTemplate } from "../Shapes/VoxelShapeTemplate";
|
|
3
|
+
import { BoxVoxelShapeSelection } from "../Shapes/Selections/BoxVoxelShapeSelection";
|
|
4
|
+
import { BoundingBox } from "@amodx/math/Geomtry/Bounds/BoundingBox";
|
|
3
5
|
const getMinMax = (...points) => {
|
|
4
6
|
if (points.length === 0) {
|
|
5
7
|
throw new Error("At least one point is required to calculate min/max.");
|
|
@@ -21,16 +23,12 @@ const getMinMax = (...points) => {
|
|
|
21
23
|
const getSize = (start, end) => {
|
|
22
24
|
return Vector3Like.Create(end.x - start.x, end.y - start.y, end.z - start.z);
|
|
23
25
|
};
|
|
24
|
-
export class
|
|
26
|
+
export class VoxelBoundsSelection {
|
|
25
27
|
origin = Vector3Like.Create();
|
|
26
28
|
end = Vector3Like.Create();
|
|
27
|
-
|
|
29
|
+
bounds = new BoundingBox();
|
|
28
30
|
isSelected(x, y, z) {
|
|
29
|
-
if (
|
|
30
|
-
return false;
|
|
31
|
-
if (y < this.origin.y || y >= this.end.y)
|
|
32
|
-
return false;
|
|
33
|
-
if (z < this.origin.z || z >= this.end.z)
|
|
31
|
+
if (!this.bounds.intersectsXYZ(x + 0.5, y + 0.5, z + 0.5))
|
|
34
32
|
return false;
|
|
35
33
|
return true;
|
|
36
34
|
}
|
|
@@ -76,9 +74,6 @@ export class VoxelBoxSelection {
|
|
|
76
74
|
this.end.x = startPosition.x + startNormal.x;
|
|
77
75
|
this.end.y = startPosition.y + startNormal.y;
|
|
78
76
|
this.end.z = startPosition.z + startNormal.z;
|
|
79
|
-
this.size.x = 1;
|
|
80
|
-
this.size.y = 1;
|
|
81
|
-
this.size.z = 1;
|
|
82
77
|
}
|
|
83
78
|
else {
|
|
84
79
|
this.origin.x = finalMin[0];
|
|
@@ -87,19 +82,42 @@ export class VoxelBoxSelection {
|
|
|
87
82
|
this.end.x = finalMax[0];
|
|
88
83
|
this.end.y = finalMax[1];
|
|
89
84
|
this.end.z = finalMax[2];
|
|
90
|
-
this.size.x = finalSize[0];
|
|
91
|
-
this.size.y = finalSize[1];
|
|
92
|
-
this.size.z = finalSize[2];
|
|
93
85
|
}
|
|
86
|
+
this.bounds.setMinMax(this.origin, this.end);
|
|
87
|
+
}
|
|
88
|
+
clone() {
|
|
89
|
+
const newSelection = new VoxelBoundsSelection();
|
|
90
|
+
Vector3Like.Copy(newSelection.origin, this.origin);
|
|
91
|
+
Vector3Like.Copy(newSelection.end, this.end);
|
|
92
|
+
newSelection.bounds.setMinMax(this.bounds.min, this.bounds.max);
|
|
93
|
+
return newSelection;
|
|
94
94
|
}
|
|
95
95
|
toTemplate(data) {
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
96
|
+
return new VoxelShapeTemplate(VoxelShapeTemplate.CreateNew({
|
|
97
|
+
shapeSelection: BoxVoxelShapeSelection.CreateNew({
|
|
98
|
+
width: this.bounds.size.x,
|
|
99
|
+
height: this.bounds.size.y,
|
|
100
|
+
depth: this.bounds.size.z,
|
|
101
|
+
}),
|
|
100
102
|
...(data ? data : {}),
|
|
101
|
-
});
|
|
102
|
-
return new BoxVoxelTemplate(boxTemplate);
|
|
103
|
+
}));
|
|
103
104
|
}
|
|
104
105
|
toExtrudedTemplate(cursor, normal) { }
|
|
106
|
+
toJSON() {
|
|
107
|
+
return {
|
|
108
|
+
type: "bounds",
|
|
109
|
+
origin: { ...this.origin },
|
|
110
|
+
bounds: { ...this.bounds.size },
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
fromJSON(data) {
|
|
114
|
+
this.origin.x = data.origin.x;
|
|
115
|
+
this.origin.y = data.origin.y;
|
|
116
|
+
this.origin.z = data.origin.z;
|
|
117
|
+
this.bounds.setMinMax(this.origin, {
|
|
118
|
+
x: this.origin.x + data.bounds.x,
|
|
119
|
+
y: this.origin.y + data.bounds.y,
|
|
120
|
+
z: this.origin.z + data.bounds.z,
|
|
121
|
+
});
|
|
122
|
+
}
|
|
105
123
|
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Vector3Like } from "@amodx/math";
|
|
2
|
+
import { IVoxelSelection, IVoxelSelectionData } from "./VoxelSelection";
|
|
3
|
+
import { VoxelShapeTemplate } from "../Shapes/VoxelShapeTemplate";
|
|
4
|
+
import { IVoxelshapeTemplateBaseData } from "../Shapes/VoxelShapeTemplate.types";
|
|
5
|
+
import { DataCursorInterface } from "../../Voxels/Cursor/DataCursor.interface";
|
|
6
|
+
import { BoundingBox } from "@amodx/math/Geomtry/Bounds/BoundingBox";
|
|
7
|
+
export interface VoxelPointSelectionData extends IVoxelSelectionData<"point"> {
|
|
8
|
+
}
|
|
9
|
+
export declare class VoxelPointSelection implements IVoxelSelection<"point", VoxelPointSelectionData> {
|
|
10
|
+
origin: Vector3Like;
|
|
11
|
+
bounds: BoundingBox;
|
|
12
|
+
isSelected(x: number, y: number, z: number): boolean;
|
|
13
|
+
reConstruct(position: Vector3Like): void;
|
|
14
|
+
clone(): VoxelPointSelection;
|
|
15
|
+
toTemplate(data?: Partial<IVoxelshapeTemplateBaseData>): VoxelShapeTemplate;
|
|
16
|
+
toExtrudedTemplate(cursor: DataCursorInterface, normal: Vector3Like): void;
|
|
17
|
+
toJSON(): VoxelPointSelectionData;
|
|
18
|
+
fromJSON(data: any): void;
|
|
19
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { Vector3Like } from "@amodx/math";
|
|
2
|
+
import { VoxelShapeTemplate } from "../Shapes/VoxelShapeTemplate";
|
|
3
|
+
import { BoxVoxelShapeSelection } from "../Shapes/Selections/BoxVoxelShapeSelection";
|
|
4
|
+
import { BoundingBox } from "@amodx/math/Geomtry/Bounds/BoundingBox";
|
|
5
|
+
export class VoxelPointSelection {
|
|
6
|
+
origin = Vector3Like.Create();
|
|
7
|
+
bounds = new BoundingBox();
|
|
8
|
+
isSelected(x, y, z) {
|
|
9
|
+
if (!this.bounds.intersectsXYZ(x + 0.5, y + 0.5, z + 0.5))
|
|
10
|
+
return false;
|
|
11
|
+
return true;
|
|
12
|
+
}
|
|
13
|
+
reConstruct(position) {
|
|
14
|
+
this.origin.x = position.x;
|
|
15
|
+
this.origin.y = position.y;
|
|
16
|
+
this.origin.z = position.z;
|
|
17
|
+
this.bounds.setMinMax(this.origin, Vector3Like.AddScalar(this.origin, 1));
|
|
18
|
+
}
|
|
19
|
+
clone() {
|
|
20
|
+
const newSelection = new VoxelPointSelection();
|
|
21
|
+
Vector3Like.Copy(newSelection.origin, this.origin);
|
|
22
|
+
newSelection.bounds.setMinMax(this.bounds.min, this.bounds.max);
|
|
23
|
+
return newSelection;
|
|
24
|
+
}
|
|
25
|
+
toTemplate(data) {
|
|
26
|
+
return new VoxelShapeTemplate(VoxelShapeTemplate.CreateNew({
|
|
27
|
+
shapeSelection: BoxVoxelShapeSelection.CreateNew({}),
|
|
28
|
+
...data,
|
|
29
|
+
}));
|
|
30
|
+
}
|
|
31
|
+
toExtrudedTemplate(cursor, normal) { }
|
|
32
|
+
toJSON() {
|
|
33
|
+
return {
|
|
34
|
+
type: "point",
|
|
35
|
+
origin: { ...this.origin },
|
|
36
|
+
bounds: { ...this.bounds.size },
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
fromJSON(data) {
|
|
40
|
+
this.origin.x = data.origin.x;
|
|
41
|
+
this.origin.y = data.origin.y;
|
|
42
|
+
this.origin.z = data.origin.z;
|
|
43
|
+
this.bounds.setMinMax(this.origin, {
|
|
44
|
+
x: this.origin.x + data.bounds.x,
|
|
45
|
+
y: this.origin.y + data.bounds.y,
|
|
46
|
+
z: this.origin.z + data.bounds.z,
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Vector3Like } from "@amodx/math";
|
|
2
|
+
import { BoundingBox } from "@amodx/math/Geomtry/Bounds/BoundingBox";
|
|
3
|
+
export interface IVoxelSelection<Type extends string = "", Data extends IVoxelSelectionData<Type> = any> {
|
|
4
|
+
origin: Vector3Like;
|
|
5
|
+
bounds: BoundingBox;
|
|
6
|
+
isSelected(x: number, y: number, z: number): boolean;
|
|
7
|
+
clone(): IVoxelSelection;
|
|
8
|
+
toJSON(): Data;
|
|
9
|
+
fromJSON(data: Data): void;
|
|
10
|
+
}
|
|
11
|
+
export interface IVoxelSelectionData<Type extends string> {
|
|
12
|
+
type: Type;
|
|
13
|
+
origin: Vector3Like;
|
|
14
|
+
bounds: Vector3Like;
|
|
15
|
+
}
|
|
16
|
+
export interface IVoxelSelectionConstructor<Type extends string, Data extends IVoxelSelectionData<Type> = any> {
|
|
17
|
+
new (): IVoxelSelection<Type, Data>;
|
|
18
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|