@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
|
@@ -1,27 +1,23 @@
|
|
|
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 { PaintVoxelData } from "../../Voxels/Types/PaintVoxelData";
|
|
5
5
|
import { FullVoxelTemplate } from "../Full/FullVoxelTemplate";
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
size: Vector3Like;
|
|
6
|
+
import { BoundingBox } from "@amodx/math/Geomtry/Bounds/BoundingBox";
|
|
7
|
+
export interface VoxelSurfaceSelectionData extends IVoxelSelectionData<"surface"> {
|
|
9
8
|
normal: Vector3Like;
|
|
10
9
|
bitIndex: Uint8Array;
|
|
11
|
-
extrusion: number;
|
|
12
10
|
}
|
|
13
|
-
export declare class VoxelSurfaceSelection implements IVoxelSelection
|
|
11
|
+
export declare class VoxelSurfaceSelection implements IVoxelSelection<"surface"> {
|
|
14
12
|
origin: Vector3Like;
|
|
15
|
-
size: Vector3Like;
|
|
16
13
|
normal: Vector3Like;
|
|
17
14
|
bitIndex: Uint8Array;
|
|
18
15
|
index: Flat3DIndex;
|
|
19
|
-
|
|
16
|
+
bounds: BoundingBox;
|
|
20
17
|
isSelected(x: number, y: number, z: number): boolean;
|
|
21
|
-
reConstruct(cursor: DataCursorInterface, position: Vector3Like, normal: Vector3Like, extrusion: number, maxSize?: number):
|
|
22
|
-
|
|
23
|
-
toTemplate(
|
|
24
|
-
toTemplate(cursor: DataCursorInterface, voxel: PaintVoxelData): FullVoxelTemplate;
|
|
18
|
+
reConstruct(cursor: DataCursorInterface, position: Vector3Like, normal: Vector3Like, extrusion: number, maxSize?: number): boolean;
|
|
19
|
+
clone(): VoxelSurfaceSelection;
|
|
20
|
+
toTemplate(voxel: PaintVoxelData): FullVoxelTemplate;
|
|
25
21
|
toJSON(): VoxelSurfaceSelectionData;
|
|
26
22
|
fromJSON(data: VoxelSurfaceSelectionData): void;
|
|
27
23
|
}
|
|
@@ -3,19 +3,15 @@ import { CardinalNeighbors2D } from "../../Math/CardinalNeighbors";
|
|
|
3
3
|
import { getBitArrayIndex, setBitArrayIndex, } from "../../Util/Binary/BinaryArrays";
|
|
4
4
|
import { PaintVoxelData } from "../../Voxels/Types/PaintVoxelData";
|
|
5
5
|
import { FullVoxelTemplate } from "../Full/FullVoxelTemplate";
|
|
6
|
+
import { BoundingBox } from "@amodx/math/Geomtry/Bounds/BoundingBox";
|
|
6
7
|
export class VoxelSurfaceSelection {
|
|
7
8
|
origin = Vector3Like.Create();
|
|
8
|
-
size = Vector3Like.Create();
|
|
9
9
|
normal = Vector3Like.Create();
|
|
10
10
|
bitIndex;
|
|
11
11
|
index = Flat3DIndex.GetXZYOrder();
|
|
12
|
-
|
|
12
|
+
bounds = new BoundingBox();
|
|
13
13
|
isSelected(x, y, z) {
|
|
14
|
-
if (
|
|
15
|
-
return false;
|
|
16
|
-
if (y < this.origin.y || y >= this.origin.y + this.size.y)
|
|
17
|
-
return false;
|
|
18
|
-
if (z < this.origin.z || z >= this.origin.z + this.size.z)
|
|
14
|
+
if (!this.bounds.intersectsXYZ(x + 0.5, y + 0.5, z + 0.5))
|
|
19
15
|
return false;
|
|
20
16
|
return (getBitArrayIndex(this.bitIndex, this.index.getIndexXYZ(x - this.origin.x, y - this.origin.y, z - this.origin.z)) === 1);
|
|
21
17
|
}
|
|
@@ -32,23 +28,24 @@ export class VoxelSurfaceSelection {
|
|
|
32
28
|
axis = "z";
|
|
33
29
|
const min = Vector3Like.Create(Infinity, Infinity, Infinity);
|
|
34
30
|
const max = Vector3Like.Create(-Infinity, -Infinity, -Infinity);
|
|
31
|
+
// 1) BFS to collect the *surface-adjacent* air layer (offset 1 in +normal)
|
|
35
32
|
const queue = [
|
|
36
33
|
position.x + normal.x,
|
|
37
34
|
position.y + normal.y,
|
|
38
35
|
position.z + normal.z,
|
|
39
36
|
];
|
|
40
37
|
let size = 0;
|
|
41
|
-
const
|
|
38
|
+
const visited = new Set();
|
|
42
39
|
while (queue.length) {
|
|
43
40
|
if (size > maxSize)
|
|
44
41
|
break;
|
|
45
42
|
const x = queue.shift();
|
|
46
43
|
const y = queue.shift();
|
|
47
44
|
const z = queue.shift();
|
|
48
|
-
const key = `${x}
|
|
49
|
-
if (
|
|
45
|
+
const key = `${x} ${y} ${z}`;
|
|
46
|
+
if (visited.has(key))
|
|
50
47
|
continue;
|
|
51
|
-
|
|
48
|
+
visited.add(key);
|
|
52
49
|
if (x < min.x)
|
|
53
50
|
min.x = x;
|
|
54
51
|
if (y < min.y)
|
|
@@ -61,11 +58,10 @@ export class VoxelSurfaceSelection {
|
|
|
61
58
|
max.y = y;
|
|
62
59
|
if (z > max.z)
|
|
63
60
|
max.z = z;
|
|
61
|
+
// Expand only in the 2D tangent plane to the face normal.
|
|
64
62
|
for (let i = 0; i < CardinalNeighbors2D.length; i++) {
|
|
65
63
|
const n = CardinalNeighbors2D[i];
|
|
66
|
-
let nx = x;
|
|
67
|
-
let ny = y;
|
|
68
|
-
let nz = z;
|
|
64
|
+
let nx = x, ny = y, nz = z;
|
|
69
65
|
if (axis == "x") {
|
|
70
66
|
ny += n[0];
|
|
71
67
|
nz += n[1];
|
|
@@ -81,6 +77,7 @@ export class VoxelSurfaceSelection {
|
|
|
81
77
|
const voxel = cursor.getVoxel(nx, ny, nz);
|
|
82
78
|
if (!voxel || !voxel.isAir())
|
|
83
79
|
continue;
|
|
80
|
+
// Must be "resting" on a solid (the face we clicked)
|
|
84
81
|
const bottomVoxel = cursor.getVoxel(nx - normal.x, ny - normal.y, nz - normal.z);
|
|
85
82
|
if (!bottomVoxel || bottomVoxel.isAir())
|
|
86
83
|
continue;
|
|
@@ -92,6 +89,48 @@ export class VoxelSurfaceSelection {
|
|
|
92
89
|
return false;
|
|
93
90
|
if (max.x == -Infinity || max.y == -Infinity || max.z == -Infinity)
|
|
94
91
|
return false;
|
|
92
|
+
// 2) Extrude outward along +normal for 'extrusion' layers.
|
|
93
|
+
// We grow layer-by-layer; each new layer must be air and contiguous to the previous layer stack.
|
|
94
|
+
if (extrusion > 0) {
|
|
95
|
+
// Collect the initial (surface-adjacent) layer as our starting front.
|
|
96
|
+
let front = [];
|
|
97
|
+
for (const key of visited) {
|
|
98
|
+
const [sx, sy, sz] = key.split(" ").map(Number);
|
|
99
|
+
front.push({ x: sx, y: sy, z: sz });
|
|
100
|
+
}
|
|
101
|
+
for (let d = 1; d <= extrusion; d++) {
|
|
102
|
+
const nextFront = [];
|
|
103
|
+
for (const p of front) {
|
|
104
|
+
const tx = p.x + normal.x;
|
|
105
|
+
const ty = p.y + normal.y;
|
|
106
|
+
const tz = p.z + normal.z;
|
|
107
|
+
const tKey = `${tx} ${ty} ${tz}`;
|
|
108
|
+
if (visited.has(tKey))
|
|
109
|
+
continue; // already added by another path
|
|
110
|
+
const world = cursor.getVoxel(tx, ty, tz);
|
|
111
|
+
if (!world || !world.isAir())
|
|
112
|
+
continue; // stop extrusion if we hit solid
|
|
113
|
+
visited.add(tKey);
|
|
114
|
+
nextFront.push({ x: tx, y: ty, z: tz });
|
|
115
|
+
if (tx < min.x)
|
|
116
|
+
min.x = tx;
|
|
117
|
+
if (ty < min.y)
|
|
118
|
+
min.y = ty;
|
|
119
|
+
if (tz < min.z)
|
|
120
|
+
min.z = tz;
|
|
121
|
+
if (tx > max.x)
|
|
122
|
+
max.x = tx;
|
|
123
|
+
if (ty > max.y)
|
|
124
|
+
max.y = ty;
|
|
125
|
+
if (tz > max.z)
|
|
126
|
+
max.z = tz;
|
|
127
|
+
}
|
|
128
|
+
if (nextFront.length === 0)
|
|
129
|
+
break; // nothing more to grow
|
|
130
|
+
front = nextFront;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
// 3) Build compact bit mask over the final bounds.
|
|
95
134
|
const sizeX = max.x - min.x + 1;
|
|
96
135
|
const sizeY = max.y - min.y + 1;
|
|
97
136
|
const sizeZ = max.z - min.z + 1;
|
|
@@ -100,80 +139,44 @@ export class VoxelSurfaceSelection {
|
|
|
100
139
|
for (let x = min.x; x < min.x + sizeX; x++) {
|
|
101
140
|
for (let y = min.y; y < min.y + sizeY; y++) {
|
|
102
141
|
for (let z = min.z; z < min.z + sizeZ; z++) {
|
|
103
|
-
const key = `${x}
|
|
104
|
-
if (!
|
|
142
|
+
const key = `${x} ${y} ${z}`;
|
|
143
|
+
if (!visited.has(key))
|
|
105
144
|
continue;
|
|
106
145
|
setBitArrayIndex(this.bitIndex, this.index.getIndexXYZ(x - min.x, y - min.y, z - min.z), 1);
|
|
107
146
|
}
|
|
108
147
|
}
|
|
109
148
|
}
|
|
110
|
-
this.size.x = sizeX;
|
|
111
|
-
this.size.y = sizeY;
|
|
112
|
-
this.size.z = sizeZ;
|
|
113
149
|
this.origin.x = min.x;
|
|
114
150
|
this.origin.y = min.y;
|
|
115
151
|
this.origin.z = min.z;
|
|
152
|
+
this.bounds.setMinMax(this.origin, {
|
|
153
|
+
x: this.origin.x + sizeX,
|
|
154
|
+
y: this.origin.y + sizeY,
|
|
155
|
+
z: this.origin.z + sizeZ,
|
|
156
|
+
});
|
|
157
|
+
return true;
|
|
116
158
|
}
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
const index = template.getIndex(x - this.origin.x, y - this.origin.y, z - this.origin.z);
|
|
134
|
-
template.ids[index] = raw[0];
|
|
135
|
-
template.level[index] = raw[2];
|
|
136
|
-
template.secondary[index] = raw[3];
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
return template;
|
|
142
|
-
}
|
|
143
|
-
for (let x = this.origin.x; x < this.origin.x + this.size.x; x++) {
|
|
144
|
-
for (let y = this.origin.y; y < this.origin.y + this.size.y; y++) {
|
|
145
|
-
for (let z = this.origin.z; z < this.origin.z + this.size.z; z++) {
|
|
159
|
+
clone() {
|
|
160
|
+
const newSelection = new VoxelSurfaceSelection();
|
|
161
|
+
Vector3Like.Copy(newSelection.origin, this.origin);
|
|
162
|
+
newSelection.bounds.setMinMax(this.bounds.min, this.bounds.max);
|
|
163
|
+
newSelection.bitIndex = this.bitIndex.slice();
|
|
164
|
+
newSelection.index.setBounds(...this.index.getBounds());
|
|
165
|
+
newSelection.bounds.setMinMax(this.bounds.min, this.bounds.max);
|
|
166
|
+
return newSelection;
|
|
167
|
+
}
|
|
168
|
+
toTemplate(voxel) {
|
|
169
|
+
const size = this.bounds.size;
|
|
170
|
+
const template = new FullVoxelTemplate(FullVoxelTemplate.CreateNew([size.x, size.y, size.z]));
|
|
171
|
+
const raw = PaintVoxelData.ToRaw(voxel);
|
|
172
|
+
for (let x = this.origin.x; x < this.origin.x + size.x; x++) {
|
|
173
|
+
for (let y = this.origin.y; y < this.origin.y + size.y; y++) {
|
|
174
|
+
for (let z = this.origin.z; z < this.origin.z + size.z; z++) {
|
|
146
175
|
if (this.isSelected(x, y, z)) {
|
|
147
|
-
let nx = x;
|
|
148
|
-
let ny = y;
|
|
149
|
-
let nz = z;
|
|
150
176
|
const index = template.getIndex(x - this.origin.x, y - this.origin.y, z - this.origin.z);
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
nz -= this.normal.z;
|
|
155
|
-
if (!this.isSelected(nx, ny, nz)) {
|
|
156
|
-
const voxel = cursor.getVoxel(nx, ny, nz);
|
|
157
|
-
if (!voxel || voxel.isAir())
|
|
158
|
-
break;
|
|
159
|
-
template.ids[index] = voxel.ids[voxel._index];
|
|
160
|
-
template.level[index] = voxel.level[voxel._index];
|
|
161
|
-
template.secondary[index] = voxel.secondary[voxel._index];
|
|
162
|
-
break;
|
|
163
|
-
}
|
|
164
|
-
if (x < this.origin.x || x >= this.origin.x + this.size.x)
|
|
165
|
-
continue;
|
|
166
|
-
if (y < this.origin.y || y >= this.origin.y + this.size.y)
|
|
167
|
-
continue;
|
|
168
|
-
if (z < this.origin.z || z >= this.origin.z + this.size.z)
|
|
169
|
-
continue;
|
|
170
|
-
const nIndex = template.getIndex(nx - this.origin.x, ny - this.origin.y, nz - this.origin.z);
|
|
171
|
-
if (!template.isAir(nIndex)) {
|
|
172
|
-
template.ids[index] = template.ids[nIndex];
|
|
173
|
-
template.level[index] = template.level[nIndex];
|
|
174
|
-
template.secondary[index] = template.secondary[nIndex];
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
+
template.ids[index] = raw[0];
|
|
178
|
+
template.level[index] = raw[2];
|
|
179
|
+
template.secondary[index] = raw[3];
|
|
177
180
|
}
|
|
178
181
|
}
|
|
179
182
|
}
|
|
@@ -182,11 +185,11 @@ export class VoxelSurfaceSelection {
|
|
|
182
185
|
}
|
|
183
186
|
toJSON() {
|
|
184
187
|
return {
|
|
188
|
+
type: "surface",
|
|
185
189
|
origin: { ...this.origin },
|
|
186
190
|
normal: { ...this.normal },
|
|
187
|
-
extrusion: this.extrusion,
|
|
188
191
|
bitIndex: this.bitIndex.slice(),
|
|
189
|
-
|
|
192
|
+
bounds: { ...this.bounds.size },
|
|
190
193
|
};
|
|
191
194
|
}
|
|
192
195
|
fromJSON(data) {
|
|
@@ -196,11 +199,12 @@ export class VoxelSurfaceSelection {
|
|
|
196
199
|
this.normal.x = data.normal.x;
|
|
197
200
|
this.normal.y = data.normal.y;
|
|
198
201
|
this.normal.z = data.normal.z;
|
|
199
|
-
this.extrusion = data.extrusion;
|
|
200
202
|
this.bitIndex = data.bitIndex;
|
|
201
|
-
this.
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
203
|
+
this.bounds.setMinMax(this.origin, {
|
|
204
|
+
x: this.origin.x + data.bounds.x,
|
|
205
|
+
y: this.origin.y + data.bounds.y,
|
|
206
|
+
z: this.origin.z + data.bounds.z,
|
|
207
|
+
});
|
|
208
|
+
this.index.setBounds(data.bounds.x, data.bounds.y, data.bounds.z);
|
|
205
209
|
}
|
|
206
210
|
}
|
|
@@ -1,10 +1,19 @@
|
|
|
1
1
|
import { Vector3Like } from "@amodx/math";
|
|
2
|
-
import { IVoxelSelection } from "./
|
|
3
|
-
import { IVoxelTemplate } from "../VoxelTemplates.types";
|
|
4
|
-
|
|
2
|
+
import { IVoxelSelection, IVoxelSelectionData } from "./VoxelSelection";
|
|
3
|
+
import { IVoxelTemplate, IVoxelTemplateData } from "../VoxelTemplates.types";
|
|
4
|
+
import { BoundingBox } from "@amodx/math/Geomtry/Bounds/BoundingBox";
|
|
5
|
+
import type { VoxelTemplateRegister } from "../VoxelTemplateRegister";
|
|
6
|
+
export interface VoxelTemplateSelectionData extends IVoxelSelectionData<"template"> {
|
|
7
|
+
template: IVoxelTemplateData<any>;
|
|
8
|
+
}
|
|
9
|
+
export declare class VoxelTemplateSelection implements IVoxelSelection<"template"> {
|
|
10
|
+
static Register: typeof VoxelTemplateRegister;
|
|
5
11
|
origin: Vector3Like;
|
|
6
|
-
|
|
12
|
+
bounds: BoundingBox;
|
|
7
13
|
template: IVoxelTemplate;
|
|
8
14
|
isSelected(x: number, y: number, z: number): boolean;
|
|
15
|
+
clone(): VoxelTemplateSelection;
|
|
9
16
|
setTemplate(template: IVoxelTemplate): void;
|
|
17
|
+
toJSON(): VoxelTemplateSelectionData;
|
|
18
|
+
fromJSON(data: VoxelTemplateSelectionData): void;
|
|
10
19
|
}
|
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
import { Vector3Like } from "@amodx/math";
|
|
2
|
+
import { BoundingBox } from "@amodx/math/Geomtry/Bounds/BoundingBox";
|
|
2
3
|
export class VoxelTemplateSelection {
|
|
4
|
+
static Register;
|
|
3
5
|
origin = Vector3Like.Create();
|
|
4
|
-
|
|
6
|
+
bounds = new BoundingBox();
|
|
5
7
|
template;
|
|
6
8
|
isSelected(x, y, z) {
|
|
7
|
-
if (
|
|
8
|
-
return false;
|
|
9
|
-
if (y < this.origin.y || y >= this.origin.y + this.size.y)
|
|
10
|
-
return false;
|
|
11
|
-
if (z < this.origin.z || z >= this.origin.z + this.size.z)
|
|
9
|
+
if (!this.bounds.intersectsXYZ(x + 0.5, y + 0.5, z + 0.5))
|
|
12
10
|
return false;
|
|
13
11
|
const rx = x - this.origin.x;
|
|
14
12
|
const ry = y - this.origin.y;
|
|
@@ -17,10 +15,30 @@ export class VoxelTemplateSelection {
|
|
|
17
15
|
return false;
|
|
18
16
|
return true;
|
|
19
17
|
}
|
|
18
|
+
clone() {
|
|
19
|
+
const newSelection = new VoxelTemplateSelection();
|
|
20
|
+
Vector3Like.Copy(newSelection.origin, this.origin);
|
|
21
|
+
newSelection.bounds.setMinMax(this.bounds.min, this.bounds.max);
|
|
22
|
+
newSelection.template = this.template.clone();
|
|
23
|
+
return newSelection;
|
|
24
|
+
}
|
|
20
25
|
setTemplate(template) {
|
|
21
26
|
this.template = template;
|
|
22
|
-
this.
|
|
23
|
-
|
|
24
|
-
|
|
27
|
+
this.bounds.setMinMax(this.origin, Vector3Like.Add(this.origin, template.bounds.size));
|
|
28
|
+
}
|
|
29
|
+
toJSON() {
|
|
30
|
+
return {
|
|
31
|
+
type: "template",
|
|
32
|
+
origin: { ...this.origin },
|
|
33
|
+
bounds: { ...this.bounds.size },
|
|
34
|
+
template: this.template.toJSON(),
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
fromJSON(data) {
|
|
38
|
+
this.origin.x = data.origin.x;
|
|
39
|
+
this.origin.y = data.origin.y;
|
|
40
|
+
this.origin.z = data.origin.z;
|
|
41
|
+
const template = VoxelTemplateSelection.Register.create(data.template);
|
|
42
|
+
this.setTemplate(template);
|
|
25
43
|
}
|
|
26
44
|
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Vector3Like } from "@amodx/math";
|
|
2
|
+
import { BoundingBox } from "@amodx/math/Geomtry/Bounds/BoundingBox";
|
|
3
|
+
import { IVoxelShapeSelection, IVoxelShapeSelectionData } from "./VoxelShapeSelection";
|
|
4
|
+
export interface BoxVoxelShapeSelectionData extends IVoxelShapeSelectionData<"box-shape"> {
|
|
5
|
+
width: number;
|
|
6
|
+
height: number;
|
|
7
|
+
depth: number;
|
|
8
|
+
}
|
|
9
|
+
export declare class BoxVoxelShapeSelection implements IVoxelShapeSelection<"box-shape", BoxVoxelShapeSelectionData> {
|
|
10
|
+
static readonly Type = "box-shape";
|
|
11
|
+
static CreateNew(data: Partial<BoxVoxelShapeSelectionData>): BoxVoxelShapeSelectionData;
|
|
12
|
+
origin: Vector3Like;
|
|
13
|
+
bounds: BoundingBox;
|
|
14
|
+
_width: number;
|
|
15
|
+
get width(): number;
|
|
16
|
+
set width(width: number);
|
|
17
|
+
_height: number;
|
|
18
|
+
get height(): number;
|
|
19
|
+
set height(height: number);
|
|
20
|
+
_depth: number;
|
|
21
|
+
get depth(): number;
|
|
22
|
+
set depth(depth: number);
|
|
23
|
+
private _updateBounds;
|
|
24
|
+
isSelected(x: number, y: number, z: number): boolean;
|
|
25
|
+
clone(): BoxVoxelShapeSelection;
|
|
26
|
+
toJSON(): BoxVoxelShapeSelectionData;
|
|
27
|
+
fromJSON(data: BoxVoxelShapeSelectionData): void;
|
|
28
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { Vector3Like } from "@amodx/math";
|
|
2
|
+
import { BoundingBox } from "@amodx/math/Geomtry/Bounds/BoundingBox";
|
|
3
|
+
export class BoxVoxelShapeSelection {
|
|
4
|
+
static Type = "box-shape";
|
|
5
|
+
static CreateNew(data) {
|
|
6
|
+
return {
|
|
7
|
+
type: BoxVoxelShapeSelection.Type,
|
|
8
|
+
origin: data.origin || Vector3Like.Create(),
|
|
9
|
+
bounds: data.bounds ||
|
|
10
|
+
Vector3Like.Create(data.width || 5, data.height || 5, data.depth || 5),
|
|
11
|
+
width: data.width || 5,
|
|
12
|
+
height: data.height || 5,
|
|
13
|
+
depth: data.depth || 5,
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
origin = Vector3Like.Create();
|
|
17
|
+
bounds = new BoundingBox();
|
|
18
|
+
_width = 1;
|
|
19
|
+
get width() {
|
|
20
|
+
return this._width;
|
|
21
|
+
}
|
|
22
|
+
set width(width) {
|
|
23
|
+
this._width = width;
|
|
24
|
+
this._updateBounds();
|
|
25
|
+
}
|
|
26
|
+
_height = 1;
|
|
27
|
+
get height() {
|
|
28
|
+
return this._height;
|
|
29
|
+
}
|
|
30
|
+
set height(height) {
|
|
31
|
+
this._height = height;
|
|
32
|
+
this._updateBounds();
|
|
33
|
+
}
|
|
34
|
+
_depth = 1;
|
|
35
|
+
get depth() {
|
|
36
|
+
return this._depth;
|
|
37
|
+
}
|
|
38
|
+
set depth(depth) {
|
|
39
|
+
this._depth = depth;
|
|
40
|
+
this._updateBounds();
|
|
41
|
+
}
|
|
42
|
+
_updateBounds() {
|
|
43
|
+
this.bounds.setSize(Vector3Like.Create(this._width, this._height, this._depth));
|
|
44
|
+
}
|
|
45
|
+
isSelected(x, y, z) {
|
|
46
|
+
let rx = x - this.origin.x;
|
|
47
|
+
let ry = y - this.origin.y;
|
|
48
|
+
let rz = z - this.origin.z;
|
|
49
|
+
if (!this.bounds.intersectsXYZ(rx + 0.5, ry + 0.5, rz + 0.5))
|
|
50
|
+
return false;
|
|
51
|
+
return true;
|
|
52
|
+
}
|
|
53
|
+
clone() {
|
|
54
|
+
const newTemplate = new BoxVoxelShapeSelection();
|
|
55
|
+
newTemplate.fromJSON(this.toJSON());
|
|
56
|
+
return newTemplate;
|
|
57
|
+
}
|
|
58
|
+
toJSON() {
|
|
59
|
+
return {
|
|
60
|
+
type: BoxVoxelShapeSelection.Type,
|
|
61
|
+
origin: { ...this.origin },
|
|
62
|
+
bounds: { ...this.bounds.size },
|
|
63
|
+
width: this._width,
|
|
64
|
+
height: this._height,
|
|
65
|
+
depth: this._depth,
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
fromJSON(data) {
|
|
69
|
+
this.origin.x = data.origin.x;
|
|
70
|
+
this.origin.y = data.origin.y;
|
|
71
|
+
this.origin.z = data.origin.z;
|
|
72
|
+
this._width = data.width;
|
|
73
|
+
this._height = data.height;
|
|
74
|
+
this._depth = data.depth;
|
|
75
|
+
this._updateBounds();
|
|
76
|
+
}
|
|
77
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Vector3Like } from "@amodx/math";
|
|
2
|
+
import { BoundingBox } from "@amodx/math/Geomtry/Bounds/BoundingBox";
|
|
3
|
+
import { IVoxelShapeSelection, IVoxelShapeSelectionData } from "./VoxelShapeSelection";
|
|
4
|
+
export interface ConeVoxelShapeSelectionData extends IVoxelShapeSelectionData<"cone-shape"> {
|
|
5
|
+
width: number;
|
|
6
|
+
height: number;
|
|
7
|
+
depth: number;
|
|
8
|
+
}
|
|
9
|
+
export declare class ConeVoxelShapeSelection implements IVoxelShapeSelection<"cone-shape", ConeVoxelShapeSelectionData> {
|
|
10
|
+
static readonly Type = "cone-shape";
|
|
11
|
+
static CreateNew(data: Partial<ConeVoxelShapeSelectionData>): ConeVoxelShapeSelectionData;
|
|
12
|
+
origin: Vector3Like;
|
|
13
|
+
bounds: BoundingBox;
|
|
14
|
+
_width: number;
|
|
15
|
+
get width(): number;
|
|
16
|
+
set width(width: number);
|
|
17
|
+
_height: number;
|
|
18
|
+
get height(): number;
|
|
19
|
+
set height(height: number);
|
|
20
|
+
_depth: number;
|
|
21
|
+
get depth(): number;
|
|
22
|
+
set depth(depth: number);
|
|
23
|
+
private _updateBounds;
|
|
24
|
+
isSelected(x: number, y: number, z: number): boolean;
|
|
25
|
+
clone(): ConeVoxelShapeSelection;
|
|
26
|
+
toJSON(): ConeVoxelShapeSelectionData;
|
|
27
|
+
fromJSON(data: ConeVoxelShapeSelectionData): void;
|
|
28
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { Vector3Like } from "@amodx/math";
|
|
2
|
+
import { BoundingBox } from "@amodx/math/Geomtry/Bounds/BoundingBox";
|
|
3
|
+
export class ConeVoxelShapeSelection {
|
|
4
|
+
static Type = "cone-shape";
|
|
5
|
+
static CreateNew(data) {
|
|
6
|
+
return {
|
|
7
|
+
type: ConeVoxelShapeSelection.Type,
|
|
8
|
+
origin: data.origin || Vector3Like.Create(),
|
|
9
|
+
bounds: data.bounds ||
|
|
10
|
+
Vector3Like.Create(data.width || 1, data.height || 1, data.depth || 1),
|
|
11
|
+
width: data.width || 1,
|
|
12
|
+
height: data.height || 1,
|
|
13
|
+
depth: data.depth || 1,
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
origin = Vector3Like.Create();
|
|
17
|
+
bounds = new BoundingBox();
|
|
18
|
+
_width = 1;
|
|
19
|
+
get width() {
|
|
20
|
+
return this._width;
|
|
21
|
+
}
|
|
22
|
+
set width(width) {
|
|
23
|
+
this._width = width;
|
|
24
|
+
this._updateBounds();
|
|
25
|
+
}
|
|
26
|
+
_height = 1;
|
|
27
|
+
get height() {
|
|
28
|
+
return this._height;
|
|
29
|
+
}
|
|
30
|
+
set height(height) {
|
|
31
|
+
this._height = height;
|
|
32
|
+
this._updateBounds();
|
|
33
|
+
}
|
|
34
|
+
_depth = 1;
|
|
35
|
+
get depth() {
|
|
36
|
+
return this._depth;
|
|
37
|
+
}
|
|
38
|
+
set depth(depth) {
|
|
39
|
+
this._depth = depth;
|
|
40
|
+
this._updateBounds();
|
|
41
|
+
}
|
|
42
|
+
_updateBounds() {
|
|
43
|
+
this.bounds.setSize(Vector3Like.Create(this._width, this._height, this._depth));
|
|
44
|
+
}
|
|
45
|
+
isSelected(x, y, z) {
|
|
46
|
+
let rx = x - this.origin.x;
|
|
47
|
+
let ry = y - this.origin.y;
|
|
48
|
+
let rz = z - this.origin.z;
|
|
49
|
+
if (!this.bounds.intersectsXYZ(rx + 0.5, ry + 0.5, rz + 0.5))
|
|
50
|
+
return false;
|
|
51
|
+
return true;
|
|
52
|
+
}
|
|
53
|
+
clone() {
|
|
54
|
+
const newTemplate = new ConeVoxelShapeSelection();
|
|
55
|
+
newTemplate.fromJSON(this.toJSON());
|
|
56
|
+
return newTemplate;
|
|
57
|
+
}
|
|
58
|
+
toJSON() {
|
|
59
|
+
return {
|
|
60
|
+
type: ConeVoxelShapeSelection.Type,
|
|
61
|
+
origin: { ...this.origin },
|
|
62
|
+
bounds: { ...this.bounds.size },
|
|
63
|
+
width: this._width,
|
|
64
|
+
height: this._height,
|
|
65
|
+
depth: this._depth,
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
fromJSON(data) {
|
|
69
|
+
this.origin.x = data.origin.x;
|
|
70
|
+
this.origin.y = data.origin.y;
|
|
71
|
+
this.origin.z = data.origin.z;
|
|
72
|
+
this._width = data.width;
|
|
73
|
+
this._height = data.height;
|
|
74
|
+
this._depth = data.depth;
|
|
75
|
+
this._updateBounds();
|
|
76
|
+
}
|
|
77
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Vector3Like } from "@amodx/math";
|
|
2
|
+
import { BoundingBox } from "@amodx/math/Geomtry/Bounds/BoundingBox";
|
|
3
|
+
import { IVoxelShapeSelection, IVoxelShapeSelectionData } from "./VoxelShapeSelection";
|
|
4
|
+
export interface CylinderVoxelShapeSelectionData extends IVoxelShapeSelectionData<"cylinder-shape"> {
|
|
5
|
+
width: number;
|
|
6
|
+
height: number;
|
|
7
|
+
depth: number;
|
|
8
|
+
}
|
|
9
|
+
export declare class CylinderVoxelShapeSelection implements IVoxelShapeSelection<"cylinder-shape", CylinderVoxelShapeSelectionData> {
|
|
10
|
+
static readonly Type = "cylinder-shape";
|
|
11
|
+
static CreateNew(data: Partial<CylinderVoxelShapeSelectionData>): CylinderVoxelShapeSelectionData;
|
|
12
|
+
origin: Vector3Like;
|
|
13
|
+
bounds: BoundingBox;
|
|
14
|
+
_width: number;
|
|
15
|
+
get width(): number;
|
|
16
|
+
set width(width: number);
|
|
17
|
+
_height: number;
|
|
18
|
+
get height(): number;
|
|
19
|
+
set height(height: number);
|
|
20
|
+
_depth: number;
|
|
21
|
+
get depth(): number;
|
|
22
|
+
set depth(depth: number);
|
|
23
|
+
private _updateBounds;
|
|
24
|
+
isSelected(x: number, y: number, z: number): boolean;
|
|
25
|
+
clone(): CylinderVoxelShapeSelection;
|
|
26
|
+
toJSON(): CylinderVoxelShapeSelectionData;
|
|
27
|
+
fromJSON(data: CylinderVoxelShapeSelectionData): void;
|
|
28
|
+
}
|