@divinevoxel/vlox 0.0.76 → 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/Tools/Brush/BrushTool.d.ts +16 -9
- package/Builder/Tools/Brush/BrushTool.js +258 -52
- package/Builder/Tools/BuilderToolBase.d.ts +36 -0
- package/Builder/Tools/BuilderToolBase.js +39 -0
- package/Builder/Tools/Hand/HandTool.d.ts +9 -7
- package/Builder/Tools/Hand/HandTool.js +40 -23
- package/Builder/Tools/Path/PahtTool.d.ts +12 -7
- package/Builder/Tools/Path/PahtTool.js +32 -21
- 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 +9 -7
- package/Builder/Tools/Wand/WandTool.js +43 -20
- package/Builder/Tools/Wrench/WrenchTool.d.ts +7 -7
- package/Builder/Tools/Wrench/WrenchTool.js +22 -13
- 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/{Tools/Box/BoxSelection.js → Util/SurfaceBoxSelection.js} +1 -3
- package/Builder/VoxelBuildSpace.d.ts +37 -25
- package/Builder/VoxelBuildSpace.js +99 -40
- package/Builder/World/InitTasks.js +17 -22
- 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 +9 -8
- 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 +1 -1
- 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 +4 -4
- package/Mesher/{Models → Voxels/Models}/Common/Calc/CalcConstants.d.ts +2 -2
- 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/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/PaintVoxel.js +1 -1
- 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 +5 -5
- package/Templates/Archive/ArchivedVoxelTemplate.js +52 -49
- package/Templates/Archive/Functions/CreateArchivedTemplate.js +0 -2
- 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 +13 -2
- package/Templates/Cursor/TemplateProxy.js +1 -6
- package/Templates/Cursor/TemplateVoxelCursor.d.ts +1 -0
- package/Templates/Cursor/TemplateVoxelCursor.js +6 -0
- package/Templates/Full/FullVoxelTemplate.d.ts +4 -4
- package/Templates/Full/FullVoxelTemplate.js +29 -18
- 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.js +2 -1
- package/Templates/Selection/VoxelBFSSelection.d.ts +3 -6
- package/Templates/Selection/VoxelBFSSelection.js +20 -24
- package/Templates/Selection/{VoxelBoxSelection.d.ts → VoxelBoundsSelection.d.ts} +9 -6
- package/Templates/Selection/{VoxelBoxSelection.js → VoxelBoundsSelection.js} +29 -22
- package/Templates/Selection/VoxelPointSelection.d.ts +8 -6
- package/Templates/Selection/VoxelPointSelection.js +25 -24
- package/Templates/Selection/VoxelSelection.d.ts +18 -0
- package/Templates/Selection/VoxelSurfaceSelection.d.ts +5 -12
- package/Templates/Selection/VoxelSurfaceSelection.js +76 -90
- package/Templates/Selection/VoxelTemplateSelection.d.ts +10 -4
- package/Templates/Selection/VoxelTemplateSelection.js +18 -10
- 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 +4 -13
- package/Templates/Shapes/VoxelShapeTemplate.types.js +0 -1
- package/Templates/{VoxelTempateRegister.d.ts → VoxelTemplateRegister.d.ts} +4 -0
- package/Templates/VoxelTemplateRegister.js +60 -0
- package/Templates/VoxelTemplates.types.d.ts +2 -3
- package/Textures/Classes/CompiledTexture.d.ts +2 -0
- package/Textures/Classes/CompiledTexture.js +19 -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/Voxels/Cursor/DataCursor.interface.d.ts +4 -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 +6 -3
- 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/Types/PaintVoxelData.d.ts +2 -0
- package/Voxels/Types/PaintVoxelData.js +51 -0
- 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/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 +3 -0
- 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/Builder/Tools/Box/BoxSelection.d.ts +0 -12
- package/Builder/Tools/Box/BoxTool.d.ts +0 -31
- package/Builder/Tools/Box/BoxTool.js +0 -91
- package/Builder/Tools/Box/BoxToolTemplate.d.ts +0 -13
- package/Builder/Tools/Box/BoxToolTemplate.js +0 -23
- package/Builder/VoxelBuilder.types.d.ts +0 -0
- package/Builder/VoxelBuilder.types.js +0 -1
- 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/VoxelSelecton.d.ts +0 -9
- package/Templates/Shapes/BasicVoxelShapeTemplate.d.ts +0 -36
- package/Templates/Shapes/BoxVoxelTemplate.d.ts +0 -23
- package/Templates/Shapes/BoxVoxelTemplate.js +0 -83
- package/Templates/Shapes/ConeVoxelTemplate.d.ts +0 -23
- package/Templates/Shapes/ConeVoxelTemplate.js +0 -73
- package/Templates/Shapes/CylinderVoxelTemplate.d.ts +0 -23
- package/Templates/Shapes/CylinderVoxelTemplate.js +0 -73
- package/Templates/Shapes/EllipsoidVoxelTemplate.d.ts +0 -23
- package/Templates/Shapes/EllipsoidVoxelTemplate.js +0 -89
- package/Templates/Shapes/OctahedronVoxelTemplate.d.ts +0 -23
- package/Templates/Shapes/OctahedronVoxelTemplate.js +0 -73
- package/Templates/Shapes/PyramidVoxelTemplate.d.ts +0 -31
- package/Templates/Shapes/PyramidVoxelTemplate.js +0 -148
- package/Templates/Shapes/SphereVoxelTemplate.d.ts +0 -15
- package/Templates/Shapes/SphereVoxelTemplate.js +0 -59
- package/Templates/Shapes/TorusVoxelTemplate.d.ts +0 -23
- package/Templates/Shapes/TorusVoxelTemplate.js +0 -73
- package/Templates/VoxelTempateRegister.js +0 -30
- /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/Mesher/{Models → 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/Templates/Selection/{VoxelSelecton.js → VoxelSelection.js} +0 -0
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { VoxelBuildSpace } from "../../VoxelBuildSpace";
|
|
2
|
-
import {
|
|
3
|
-
import { VoxelTemplateSelection } from "../../../Templates/Selection/VoxelTemplateSelection";
|
|
2
|
+
import { VoxelShapeTemplate } from "../../../Templates/Shapes/VoxelShapeTemplate";
|
|
4
3
|
import { VoxelPickResult } from "../../../Voxels/Interaction/VoxelPickResult";
|
|
5
4
|
import { Vector3Like } from "@amodx/math";
|
|
6
5
|
import { PaintVoxelData } from "../../../Voxels";
|
|
7
|
-
import { BuilderToolBase } from "../BuilderToolBase";
|
|
6
|
+
import { BuilderToolBase, ToolOptionsData } from "../BuilderToolBase";
|
|
8
7
|
export declare enum BrushPositionModes {
|
|
9
8
|
Start = "Start",
|
|
10
9
|
Center = "Center",
|
|
@@ -25,24 +24,32 @@ interface BrushToolEvents {
|
|
|
25
24
|
"shape-updated": null;
|
|
26
25
|
}
|
|
27
26
|
export declare class BrushTool extends BuilderToolBase<BrushToolEvents> {
|
|
28
|
-
space: VoxelBuildSpace;
|
|
29
27
|
static ToolId: string;
|
|
30
28
|
static ModeArray: BrushToolModes[];
|
|
31
29
|
static PositionModeArray: BrushPositionModes[];
|
|
32
30
|
static get ShapesArray(): string[];
|
|
33
|
-
static ShapeCreators: Record<string, () =>
|
|
31
|
+
static ShapeCreators: Record<string, () => VoxelShapeTemplate>;
|
|
32
|
+
static BaseToolOptions: ToolOptionsData;
|
|
33
|
+
static ShapeOptions: Record<string, () => ToolOptionsData>;
|
|
34
34
|
shape: string;
|
|
35
35
|
axisXPositionMode: BrushPositionModes;
|
|
36
36
|
axisYPositionMode: BrushPositionModes;
|
|
37
37
|
axisZPositionMode: BrushPositionModes;
|
|
38
38
|
mode: BrushToolModes;
|
|
39
|
-
template:
|
|
40
|
-
selection:
|
|
39
|
+
template: VoxelShapeTemplate;
|
|
40
|
+
get selection(): import("../../../Templates/Shapes/Selections/VoxelShapeSelection").IVoxelShapeSelection<any, import("../../../Templates/Shapes/Selections/VoxelShapeSelection").IVoxelShapeSelectionData<any>>;
|
|
41
|
+
voxelData: Partial<BrushVoxelData>;
|
|
42
|
+
usePlacingStrategy: boolean;
|
|
43
|
+
placePosition: Vector3Like;
|
|
41
44
|
protected _position: Vector3Like;
|
|
42
45
|
constructor(space: VoxelBuildSpace);
|
|
43
|
-
|
|
46
|
+
update(): Promise<void>;
|
|
47
|
+
cancel(): void;
|
|
48
|
+
use(): Promise<void>;
|
|
44
49
|
protected getPlacePosition(picked: VoxelPickResult): Vector3Like;
|
|
45
|
-
updatePlacer(picked: VoxelPickResult): false | undefined;
|
|
46
50
|
updateShape(shape: string): void;
|
|
51
|
+
getOptionValue(property: string): any;
|
|
52
|
+
getCurrentOptions(): ToolOptionsData;
|
|
53
|
+
updateOption(property: string, value: any): void;
|
|
47
54
|
}
|
|
48
55
|
export {};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { VoxelShapeTemplate } from "../../../Templates/Shapes/VoxelShapeTemplate";
|
|
2
|
+
import { SphereVoxelShapeSelection } from "../../../Templates/Shapes/Selections/SphereVoxelShapeSelection";
|
|
3
|
+
import { BoxVoxelShapeSelection } from "../../../Templates/Shapes/Selections/BoxVoxelShapeSelection";
|
|
4
|
+
import { PyramidVoxelShapeSelection } from "../../../Templates/Shapes/Selections/PyramidVoxelShapeSelection";
|
|
5
|
+
import { EllipsoidVoxelShapeSelection } from "../../../Templates/Shapes/Selections/EllipsoidVoxelShapeSelection";
|
|
5
6
|
import { Vector3Like } from "@amodx/math";
|
|
6
7
|
import { BuilderToolBase } from "../BuilderToolBase";
|
|
7
|
-
import { EllipsoidVoxelTemplate } from "../../../Templates/Shapes/EllipsoidVoxelTemplate";
|
|
8
8
|
export var BrushPositionModes;
|
|
9
9
|
(function (BrushPositionModes) {
|
|
10
10
|
BrushPositionModes["Start"] = "Start";
|
|
@@ -18,7 +18,6 @@ export var BrushToolModes;
|
|
|
18
18
|
BrushToolModes["Remove"] = "Remove";
|
|
19
19
|
})(BrushToolModes || (BrushToolModes = {}));
|
|
20
20
|
export class BrushTool extends BuilderToolBase {
|
|
21
|
-
space;
|
|
22
21
|
static ToolId = "Brush";
|
|
23
22
|
static ModeArray = [
|
|
24
23
|
BrushToolModes.Fill,
|
|
@@ -34,17 +33,164 @@ export class BrushTool extends BuilderToolBase {
|
|
|
34
33
|
return Object.keys(this.ShapeCreators);
|
|
35
34
|
}
|
|
36
35
|
static ShapeCreators = {
|
|
37
|
-
Sphere
|
|
38
|
-
return new
|
|
36
|
+
Sphere() {
|
|
37
|
+
return new VoxelShapeTemplate(VoxelShapeTemplate.CreateNew({
|
|
38
|
+
shapeSelection: SphereVoxelShapeSelection.CreateNew({}),
|
|
39
|
+
}));
|
|
39
40
|
},
|
|
40
|
-
Box
|
|
41
|
-
return new
|
|
41
|
+
Box() {
|
|
42
|
+
return new VoxelShapeTemplate(VoxelShapeTemplate.CreateNew({
|
|
43
|
+
shapeSelection: BoxVoxelShapeSelection.CreateNew({}),
|
|
44
|
+
}));
|
|
42
45
|
},
|
|
43
|
-
Pyramid
|
|
44
|
-
return new
|
|
46
|
+
Pyramid() {
|
|
47
|
+
return new VoxelShapeTemplate(VoxelShapeTemplate.CreateNew({
|
|
48
|
+
shapeSelection: PyramidVoxelShapeSelection.CreateNew({}),
|
|
49
|
+
}));
|
|
45
50
|
},
|
|
46
|
-
Ellipsoid
|
|
47
|
-
return new
|
|
51
|
+
Ellipsoid() {
|
|
52
|
+
return new VoxelShapeTemplate(VoxelShapeTemplate.CreateNew({
|
|
53
|
+
shapeSelection: EllipsoidVoxelShapeSelection.CreateNew({}),
|
|
54
|
+
}));
|
|
55
|
+
},
|
|
56
|
+
};
|
|
57
|
+
static BaseToolOptions = [
|
|
58
|
+
{
|
|
59
|
+
cateogry: "main",
|
|
60
|
+
property: "axisXPositionMode",
|
|
61
|
+
name: "X Axis Position Mode",
|
|
62
|
+
type: "string",
|
|
63
|
+
options: [
|
|
64
|
+
["End", BrushPositionModes.End],
|
|
65
|
+
["Center", BrushPositionModes.Center],
|
|
66
|
+
["Start", BrushPositionModes.Start],
|
|
67
|
+
],
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
cateogry: "main",
|
|
71
|
+
property: "axisYPositionMode",
|
|
72
|
+
name: "Y Axis Position Mode",
|
|
73
|
+
type: "string",
|
|
74
|
+
options: [
|
|
75
|
+
["End", BrushPositionModes.End],
|
|
76
|
+
["Center", BrushPositionModes.Center],
|
|
77
|
+
["Start", BrushPositionModes.Start],
|
|
78
|
+
],
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
cateogry: "main",
|
|
82
|
+
property: "axisZPositionMode",
|
|
83
|
+
name: "Z Axis Position Mode",
|
|
84
|
+
type: "string",
|
|
85
|
+
options: [
|
|
86
|
+
["End", BrushPositionModes.End],
|
|
87
|
+
["Center", BrushPositionModes.Center],
|
|
88
|
+
["Start", BrushPositionModes.Start],
|
|
89
|
+
],
|
|
90
|
+
},
|
|
91
|
+
];
|
|
92
|
+
static ShapeOptions = {
|
|
93
|
+
Sphere() {
|
|
94
|
+
return [
|
|
95
|
+
{
|
|
96
|
+
cateogry: "shape",
|
|
97
|
+
property: "radius",
|
|
98
|
+
name: "Radius",
|
|
99
|
+
type: "number",
|
|
100
|
+
min: 0,
|
|
101
|
+
max: 50,
|
|
102
|
+
},
|
|
103
|
+
];
|
|
104
|
+
},
|
|
105
|
+
Box() {
|
|
106
|
+
return [
|
|
107
|
+
{
|
|
108
|
+
cateogry: "shape",
|
|
109
|
+
property: "width",
|
|
110
|
+
name: "Width",
|
|
111
|
+
type: "number",
|
|
112
|
+
min: 0,
|
|
113
|
+
max: 50,
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
cateogry: "shape",
|
|
117
|
+
property: "height",
|
|
118
|
+
name: "Height",
|
|
119
|
+
type: "number",
|
|
120
|
+
min: 0,
|
|
121
|
+
max: 50,
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
cateogry: "shape",
|
|
125
|
+
property: "depth",
|
|
126
|
+
name: "Depth",
|
|
127
|
+
type: "number",
|
|
128
|
+
min: 0,
|
|
129
|
+
max: 50,
|
|
130
|
+
},
|
|
131
|
+
];
|
|
132
|
+
},
|
|
133
|
+
Pyramid() {
|
|
134
|
+
return [
|
|
135
|
+
{
|
|
136
|
+
cateogry: "shape",
|
|
137
|
+
property: "direction",
|
|
138
|
+
name: "Direction",
|
|
139
|
+
type: "string",
|
|
140
|
+
options: [
|
|
141
|
+
["Up", "+y"],
|
|
142
|
+
["Down", "-y"],
|
|
143
|
+
["East", "+x"],
|
|
144
|
+
["West", "-x"],
|
|
145
|
+
["North", "+z"],
|
|
146
|
+
["South", "-z"],
|
|
147
|
+
],
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
cateogry: "shape",
|
|
151
|
+
property: "height",
|
|
152
|
+
name: "Height",
|
|
153
|
+
type: "number",
|
|
154
|
+
min: 0,
|
|
155
|
+
max: 50,
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
cateogry: "shape",
|
|
159
|
+
property: "fallOff",
|
|
160
|
+
name: "Falloff",
|
|
161
|
+
type: "number",
|
|
162
|
+
min: 0,
|
|
163
|
+
max: 50,
|
|
164
|
+
},
|
|
165
|
+
];
|
|
166
|
+
},
|
|
167
|
+
Ellipsoid() {
|
|
168
|
+
return [
|
|
169
|
+
{
|
|
170
|
+
cateogry: "shape",
|
|
171
|
+
property: "radiusX",
|
|
172
|
+
name: "Radius X",
|
|
173
|
+
type: "number",
|
|
174
|
+
min: 0,
|
|
175
|
+
max: 50,
|
|
176
|
+
},
|
|
177
|
+
{
|
|
178
|
+
cateogry: "shape",
|
|
179
|
+
property: "radiusY",
|
|
180
|
+
name: "Radius Y",
|
|
181
|
+
type: "number",
|
|
182
|
+
min: 0,
|
|
183
|
+
max: 50,
|
|
184
|
+
},
|
|
185
|
+
{
|
|
186
|
+
cateogry: "shape",
|
|
187
|
+
property: "radiusZ",
|
|
188
|
+
name: "Radius Z",
|
|
189
|
+
type: "number",
|
|
190
|
+
min: 0,
|
|
191
|
+
max: 50,
|
|
192
|
+
},
|
|
193
|
+
];
|
|
48
194
|
},
|
|
49
195
|
};
|
|
50
196
|
shape = "Sphere";
|
|
@@ -53,94 +199,154 @@ export class BrushTool extends BuilderToolBase {
|
|
|
53
199
|
axisZPositionMode = BrushPositionModes.Center;
|
|
54
200
|
mode = BrushToolModes.Fill;
|
|
55
201
|
template;
|
|
56
|
-
selection
|
|
202
|
+
get selection() {
|
|
203
|
+
return this.template.shapeSelection;
|
|
204
|
+
}
|
|
205
|
+
voxelData = {};
|
|
206
|
+
usePlacingStrategy = true;
|
|
207
|
+
placePosition = Vector3Like.Create();
|
|
57
208
|
_position = Vector3Like.Create();
|
|
58
209
|
constructor(space) {
|
|
59
|
-
super();
|
|
60
|
-
this.space = space;
|
|
61
|
-
this.selection = new VoxelTemplateSelection();
|
|
210
|
+
super(space);
|
|
62
211
|
this.updateShape(this.shape);
|
|
63
212
|
}
|
|
64
|
-
async
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
213
|
+
async update() {
|
|
214
|
+
this._lastPicked = await this.space.pickWithProvider(this.rayProviderIndex);
|
|
215
|
+
if (!this._lastPicked)
|
|
216
|
+
return;
|
|
217
|
+
if (this.mode == BrushToolModes.Fill ||
|
|
218
|
+
this.mode == BrushToolModes.Extrude) {
|
|
219
|
+
if (!this.space.bounds.intersectsPoint(this._lastPicked.normalPosition)) {
|
|
220
|
+
this._lastPicked = null;
|
|
221
|
+
return;
|
|
70
222
|
}
|
|
71
223
|
}
|
|
72
|
-
if (this.mode == BrushToolModes.
|
|
73
|
-
if (!this.space.bounds.intersectsPoint(
|
|
224
|
+
if (this.mode == BrushToolModes.Remove) {
|
|
225
|
+
if (!this.space.bounds.intersectsPoint(this._lastPicked.position)) {
|
|
226
|
+
this._lastPicked = null;
|
|
74
227
|
return;
|
|
75
|
-
|
|
76
|
-
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
const place = this.getPlacePosition(this._lastPicked);
|
|
231
|
+
this.placePosition.x = place.x;
|
|
232
|
+
this.placePosition.y = place.y;
|
|
233
|
+
this.placePosition.z = place.z;
|
|
234
|
+
this.selection.origin.x = place.x;
|
|
235
|
+
this.selection.origin.y = place.y;
|
|
236
|
+
this.selection.origin.z = place.z;
|
|
237
|
+
}
|
|
238
|
+
cancel() {
|
|
239
|
+
this._lastPicked = null;
|
|
240
|
+
}
|
|
241
|
+
async use() {
|
|
242
|
+
if (!this._lastPicked)
|
|
243
|
+
return;
|
|
244
|
+
if (this.usePlacingStrategy) {
|
|
245
|
+
if (this.voxelData.fill) {
|
|
246
|
+
const newData = this.space.getPlaceState(this.voxelData.fill, this._lastPicked);
|
|
247
|
+
if (newData)
|
|
248
|
+
this.voxelData.fill = newData;
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
if (this.mode == BrushToolModes.Fill && this.voxelData.fill) {
|
|
252
|
+
this.template.setVoxels(this.voxelData.fill);
|
|
253
|
+
const place = this.getPlacePosition(this._lastPicked);
|
|
77
254
|
await this.space.paintTemplate([place.x, place.y, place.z], this.template.toJSON());
|
|
255
|
+
return;
|
|
256
|
+
}
|
|
257
|
+
if (this.mode == BrushToolModes.Extrude) {
|
|
258
|
+
const template = await this.space.getExtrudedSelectionTemplate(this.selection.toJSON(), this._lastPicked.normal);
|
|
259
|
+
await this.space.paintTemplate(this.selection.origin, template.toJSON());
|
|
260
|
+
return;
|
|
78
261
|
}
|
|
79
262
|
if (this.mode == BrushToolModes.Remove) {
|
|
80
|
-
|
|
81
|
-
return;
|
|
82
|
-
const voxel = picked.voxel;
|
|
263
|
+
const voxel = this._lastPicked.voxel;
|
|
83
264
|
if (voxel && !voxel.isAir()) {
|
|
84
|
-
const place = this.getPlacePosition(
|
|
265
|
+
const place = this.getPlacePosition(this._lastPicked);
|
|
85
266
|
await this.space.eraseTemplate([place.x, place.y, place.z], this.template.toJSON());
|
|
86
267
|
}
|
|
87
|
-
return
|
|
268
|
+
return;
|
|
88
269
|
}
|
|
89
270
|
}
|
|
90
271
|
getPlacePosition(picked) {
|
|
91
272
|
//x
|
|
92
273
|
if (this.axisXPositionMode == BrushPositionModes.Center) {
|
|
93
274
|
this._position.x =
|
|
94
|
-
picked.normalPosition.x -
|
|
275
|
+
picked.normalPosition.x -
|
|
276
|
+
Math.floor(this.template.shapeSelection.bounds.size.x / 2);
|
|
95
277
|
}
|
|
96
278
|
if (this.axisXPositionMode == BrushPositionModes.Start) {
|
|
97
279
|
this._position.x = picked.normalPosition.x;
|
|
98
280
|
}
|
|
99
281
|
if (this.axisXPositionMode == BrushPositionModes.End) {
|
|
100
|
-
this._position.x =
|
|
282
|
+
this._position.x =
|
|
283
|
+
picked.normalPosition.x - this.template.shapeSelection.bounds.size.x;
|
|
101
284
|
}
|
|
102
285
|
//y
|
|
103
286
|
if (this.axisYPositionMode == BrushPositionModes.Center) {
|
|
104
287
|
this._position.y =
|
|
105
|
-
picked.normalPosition.y -
|
|
288
|
+
picked.normalPosition.y -
|
|
289
|
+
Math.floor(this.template.shapeSelection.bounds.size.y / 2);
|
|
106
290
|
}
|
|
107
291
|
if (this.axisYPositionMode == BrushPositionModes.Start) {
|
|
108
292
|
this._position.y = picked.normalPosition.y;
|
|
109
293
|
}
|
|
110
294
|
if (this.axisYPositionMode == BrushPositionModes.End) {
|
|
111
|
-
this._position.y =
|
|
295
|
+
this._position.y =
|
|
296
|
+
picked.normalPosition.y - this.template.shapeSelection.bounds.size.y;
|
|
112
297
|
}
|
|
113
298
|
//z
|
|
114
299
|
if (this.axisZPositionMode == BrushPositionModes.Center) {
|
|
115
300
|
this._position.z =
|
|
116
|
-
picked.normalPosition.z -
|
|
301
|
+
picked.normalPosition.z -
|
|
302
|
+
Math.floor(this.template.shapeSelection.bounds.size.z / 2);
|
|
117
303
|
}
|
|
118
304
|
if (this.axisZPositionMode == BrushPositionModes.Start) {
|
|
119
305
|
this._position.z = picked.normalPosition.z;
|
|
120
306
|
}
|
|
121
307
|
if (this.axisXPositionMode == BrushPositionModes.End) {
|
|
122
|
-
this._position.z =
|
|
308
|
+
this._position.z =
|
|
309
|
+
picked.normalPosition.z - this.template.shapeSelection.bounds.size.z;
|
|
123
310
|
}
|
|
124
311
|
return this._position;
|
|
125
312
|
}
|
|
126
|
-
updatePlacer(picked) {
|
|
127
|
-
const place = this.getPlacePosition(picked);
|
|
128
|
-
if (!this.space.bounds.intersectsPoint(place))
|
|
129
|
-
return false;
|
|
130
|
-
this.selection.origin.x = place.x;
|
|
131
|
-
this.selection.origin.y = place.y;
|
|
132
|
-
this.selection.origin.z = place.z;
|
|
133
|
-
}
|
|
134
313
|
updateShape(shape) {
|
|
135
314
|
const shapeCreator = BrushTool.ShapeCreators[shape];
|
|
136
315
|
if (!shapeCreator)
|
|
137
316
|
throw new Error(`Shape with id ${shape} does not exist`);
|
|
138
317
|
this.shape = shape;
|
|
139
318
|
this.template = shapeCreator();
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
319
|
+
}
|
|
320
|
+
getOptionValue(property) {
|
|
321
|
+
const data = this.getOptionData(property);
|
|
322
|
+
if (!data)
|
|
323
|
+
return;
|
|
324
|
+
if (this.optionInCategory(property, "main")) {
|
|
325
|
+
return this[data.property];
|
|
326
|
+
}
|
|
327
|
+
if (this.optionInCategory(property, "shape")) {
|
|
328
|
+
return this.selection[data.property];
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
getCurrentOptions() {
|
|
332
|
+
const options = [
|
|
333
|
+
...BrushTool.BaseToolOptions,
|
|
334
|
+
...BrushTool.ShapeOptions[this.shape](),
|
|
335
|
+
];
|
|
336
|
+
this.processOptions(options);
|
|
337
|
+
return options;
|
|
338
|
+
}
|
|
339
|
+
updateOption(property, value) {
|
|
340
|
+
const data = this.getOptionData(property);
|
|
341
|
+
if (!data)
|
|
342
|
+
return;
|
|
343
|
+
if (this.optionInCategory(property, "main")) {
|
|
344
|
+
this[data.property] = value;
|
|
345
|
+
return;
|
|
346
|
+
}
|
|
347
|
+
if (this.optionInCategory(property, "shape")) {
|
|
348
|
+
this.selection[data.property] = value;
|
|
349
|
+
return;
|
|
350
|
+
}
|
|
145
351
|
}
|
|
146
352
|
}
|
|
@@ -1,3 +1,39 @@
|
|
|
1
|
+
import { VoxelPickResult } from "Voxels/Interaction/VoxelPickResult";
|
|
1
2
|
import { TypedEventTarget } from "../../Util/TypedEventTarget";
|
|
3
|
+
import { VoxelBuildSpace } from "../VoxelBuildSpace";
|
|
4
|
+
type ToolOptionBase<Data> = {
|
|
5
|
+
cateogry: string;
|
|
6
|
+
property: string;
|
|
7
|
+
name: string;
|
|
8
|
+
} & Data;
|
|
9
|
+
export type ToolOption = ToolOptionBase<{
|
|
10
|
+
type: "string";
|
|
11
|
+
options: [name: string, value: any][];
|
|
12
|
+
}> | ToolOptionBase<{
|
|
13
|
+
type: "number";
|
|
14
|
+
min: number;
|
|
15
|
+
max: number;
|
|
16
|
+
}>;
|
|
17
|
+
export type ToolOptionsData = ToolOption[];
|
|
2
18
|
export declare abstract class BuilderToolBase<Events extends Record<string, any>> extends TypedEventTarget<Events> {
|
|
19
|
+
space: VoxelBuildSpace;
|
|
20
|
+
rayProviderIndex: number;
|
|
21
|
+
protected _lastPicked: VoxelPickResult | null;
|
|
22
|
+
get picked(): Readonly<VoxelPickResult> | null;
|
|
23
|
+
constructor(space: VoxelBuildSpace);
|
|
24
|
+
protected _options: ToolOptionsData;
|
|
25
|
+
protected _optionsMap: Map<string, ToolOption>;
|
|
26
|
+
protected _categoryMap: Map<string, Set<string>>;
|
|
27
|
+
protected processOptions(data: ToolOptionsData): void;
|
|
28
|
+
getOptions(): ToolOptionsData;
|
|
29
|
+
getOptionCategories(): [string, Set<string>][];
|
|
30
|
+
abstract getOptionValue(id: string): any;
|
|
31
|
+
getOptionData(id: string): ToolOption | undefined;
|
|
32
|
+
optionInCategory(option: string, cateogry: string): boolean;
|
|
33
|
+
abstract getCurrentOptions(): ToolOptionsData;
|
|
34
|
+
abstract updateOption(property: string, value: any): void;
|
|
35
|
+
abstract cancel(): void;
|
|
36
|
+
abstract use(...args: any): Promise<void>;
|
|
37
|
+
abstract update(...args: any): Promise<void>;
|
|
3
38
|
}
|
|
39
|
+
export {};
|
|
@@ -1,3 +1,42 @@
|
|
|
1
1
|
import { TypedEventTarget } from "../../Util/TypedEventTarget";
|
|
2
2
|
export class BuilderToolBase extends TypedEventTarget {
|
|
3
|
+
space;
|
|
4
|
+
rayProviderIndex = 0;
|
|
5
|
+
_lastPicked = null;
|
|
6
|
+
get picked() {
|
|
7
|
+
return this._lastPicked;
|
|
8
|
+
}
|
|
9
|
+
constructor(space) {
|
|
10
|
+
super();
|
|
11
|
+
this.space = space;
|
|
12
|
+
}
|
|
13
|
+
_options = [];
|
|
14
|
+
_optionsMap = new Map();
|
|
15
|
+
_categoryMap = new Map();
|
|
16
|
+
processOptions(data) {
|
|
17
|
+
this._options = data;
|
|
18
|
+
this._optionsMap.clear();
|
|
19
|
+
this._categoryMap.clear();
|
|
20
|
+
for (const option of data) {
|
|
21
|
+
let categoryArray = this._categoryMap.get(option.cateogry);
|
|
22
|
+
if (!categoryArray) {
|
|
23
|
+
categoryArray = new Set();
|
|
24
|
+
this._categoryMap.set(option.cateogry, categoryArray);
|
|
25
|
+
}
|
|
26
|
+
categoryArray.add(option.property);
|
|
27
|
+
this._optionsMap.set(option.property, option);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
getOptions() {
|
|
31
|
+
return this._options;
|
|
32
|
+
}
|
|
33
|
+
getOptionCategories() {
|
|
34
|
+
return [...this._categoryMap];
|
|
35
|
+
}
|
|
36
|
+
getOptionData(id) {
|
|
37
|
+
return this._optionsMap.get(id);
|
|
38
|
+
}
|
|
39
|
+
optionInCategory(option, cateogry) {
|
|
40
|
+
return Boolean(this._categoryMap.get(cateogry)?.has(option));
|
|
41
|
+
}
|
|
3
42
|
}
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
import { VoxelPickResult } from "../../../Voxels/Interaction/VoxelPickResult";
|
|
2
|
-
import { VoxelBuildSpace } from "../../VoxelBuildSpace";
|
|
3
1
|
import { PaintVoxelData } from "../../../Voxels";
|
|
4
2
|
import { VoxelPointSelection } from "../../../Templates/Selection/VoxelPointSelection";
|
|
5
|
-
import { BuilderToolBase } from "../BuilderToolBase";
|
|
3
|
+
import { BuilderToolBase, ToolOptionsData } from "../BuilderToolBase";
|
|
6
4
|
export declare enum HandToolModes {
|
|
7
5
|
Place = "Place",
|
|
8
6
|
Remove = "Remove"
|
|
@@ -10,13 +8,17 @@ export declare enum HandToolModes {
|
|
|
10
8
|
interface HandToolEvents {
|
|
11
9
|
}
|
|
12
10
|
export declare class HandTool extends BuilderToolBase<HandToolEvents> {
|
|
13
|
-
space: VoxelBuildSpace;
|
|
14
11
|
static ToolId: string;
|
|
15
12
|
static ModeArray: HandToolModes[];
|
|
16
13
|
mode: HandToolModes;
|
|
17
14
|
selection: VoxelPointSelection;
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
15
|
+
voxelData: PaintVoxelData;
|
|
16
|
+
usePlacingStrategy: boolean;
|
|
17
|
+
update(): Promise<void>;
|
|
18
|
+
cancel(): void;
|
|
19
|
+
use(): Promise<void>;
|
|
20
|
+
getOptionValue(id: string): null;
|
|
21
|
+
getCurrentOptions(): ToolOptionsData;
|
|
22
|
+
updateOption(property: string, value: any): void;
|
|
21
23
|
}
|
|
22
24
|
export {};
|
|
@@ -6,7 +6,6 @@ export var HandToolModes;
|
|
|
6
6
|
HandToolModes["Remove"] = "Remove";
|
|
7
7
|
})(HandToolModes || (HandToolModes = {}));
|
|
8
8
|
export class HandTool extends BuilderToolBase {
|
|
9
|
-
space;
|
|
10
9
|
static ToolId = "Hand";
|
|
11
10
|
static ModeArray = [
|
|
12
11
|
HandToolModes.Place,
|
|
@@ -14,43 +13,61 @@ export class HandTool extends BuilderToolBase {
|
|
|
14
13
|
];
|
|
15
14
|
mode = HandToolModes.Place;
|
|
16
15
|
selection = new VoxelPointSelection();
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
16
|
+
voxelData;
|
|
17
|
+
usePlacingStrategy = true;
|
|
18
|
+
async update() {
|
|
19
|
+
this._lastPicked = await this.space.pickWithProvider(this.rayProviderIndex);
|
|
20
|
+
if (!this._lastPicked)
|
|
21
|
+
return;
|
|
22
22
|
if (this.mode == HandToolModes.Place) {
|
|
23
|
-
this.
|
|
23
|
+
if (!this.space.bounds.intersectsPoint(this._lastPicked.normalPosition)) {
|
|
24
|
+
this._lastPicked = null;
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
this.selection.reConstruct(this._lastPicked.normalPosition);
|
|
24
28
|
}
|
|
25
29
|
if (this.mode == HandToolModes.Remove) {
|
|
26
|
-
this.
|
|
30
|
+
if (!this.space.bounds.intersectsPoint(this._lastPicked.position)) {
|
|
31
|
+
this._lastPicked = null;
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
this.selection.reConstruct(this._lastPicked.position);
|
|
27
35
|
}
|
|
28
36
|
}
|
|
29
|
-
|
|
37
|
+
cancel() {
|
|
38
|
+
this._lastPicked = null;
|
|
39
|
+
}
|
|
40
|
+
async use() {
|
|
41
|
+
if (!this._lastPicked)
|
|
42
|
+
return;
|
|
30
43
|
if (this.mode == HandToolModes.Place) {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
const newData = this.space.getPlaceState(voxelData, picked);
|
|
44
|
+
let voxelData = this.voxelData;
|
|
45
|
+
if (this.usePlacingStrategy) {
|
|
46
|
+
const newData = this.space.getPlaceState(voxelData, this._lastPicked);
|
|
35
47
|
if (newData)
|
|
36
48
|
voxelData = newData;
|
|
37
49
|
}
|
|
38
50
|
await this.space.paintVoxel([
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
51
|
+
this._lastPicked.normalPosition.x,
|
|
52
|
+
this._lastPicked.normalPosition.y,
|
|
53
|
+
this._lastPicked.normalPosition.z,
|
|
42
54
|
], voxelData);
|
|
43
|
-
return
|
|
55
|
+
return;
|
|
44
56
|
}
|
|
45
57
|
if (this.mode == HandToolModes.Remove) {
|
|
46
|
-
if (!this.space.bounds.intersectsPoint(picked.position))
|
|
47
|
-
return false;
|
|
48
58
|
await this.space.eraseVoxel([
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
59
|
+
this._lastPicked.position.x,
|
|
60
|
+
this._lastPicked.position.y,
|
|
61
|
+
this._lastPicked.position.z,
|
|
52
62
|
]);
|
|
53
|
-
return
|
|
63
|
+
return;
|
|
54
64
|
}
|
|
55
65
|
}
|
|
66
|
+
getOptionValue(id) {
|
|
67
|
+
return null;
|
|
68
|
+
}
|
|
69
|
+
getCurrentOptions() {
|
|
70
|
+
return [];
|
|
71
|
+
}
|
|
72
|
+
updateOption(property, value) { }
|
|
56
73
|
}
|