@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
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
import { PaintVoxelData } from "../../../Voxels";
|
|
2
|
+
import { VoxelPointSelection } from "../../../Templates/Selection/VoxelPointSelection";
|
|
3
|
+
import { BuilderToolBase } from "../BuilderToolBase";
|
|
4
|
+
import { SchemaRegister } from "../../../Voxels/State/SchemaRegister";
|
|
5
|
+
import { VoxelPalettesRegister } from "../../../Voxels/Data/VoxelPalettesRegister";
|
|
6
|
+
var WrenchToolModes;
|
|
7
|
+
(function (WrenchToolModes) {
|
|
8
|
+
WrenchToolModes["Pick"] = "Pick";
|
|
9
|
+
WrenchToolModes["Update"] = "Update";
|
|
10
|
+
})(WrenchToolModes || (WrenchToolModes = {}));
|
|
11
|
+
export class WrenchTool extends BuilderToolBase {
|
|
12
|
+
static ToolId = "Wrench";
|
|
13
|
+
mode = WrenchToolModes.Pick;
|
|
14
|
+
selection = new VoxelPointSelection();
|
|
15
|
+
paintData = PaintVoxelData.Create();
|
|
16
|
+
_pickedResult = null;
|
|
17
|
+
isUpdating() {
|
|
18
|
+
if (this._pickedResult !== null && this.mode == WrenchToolModes.Update)
|
|
19
|
+
return true;
|
|
20
|
+
return false;
|
|
21
|
+
}
|
|
22
|
+
stopUpdating() {
|
|
23
|
+
this.mode = WrenchToolModes.Pick;
|
|
24
|
+
this._pickedResult = null;
|
|
25
|
+
}
|
|
26
|
+
async update() {
|
|
27
|
+
this._lastPicked = await this.space.pickWithProvider(this.rayProviderIndex);
|
|
28
|
+
if (!this._lastPicked)
|
|
29
|
+
return;
|
|
30
|
+
if (this.mode == WrenchToolModes.Pick) {
|
|
31
|
+
if (!this.space.bounds.intersectsPoint(this._lastPicked.position)) {
|
|
32
|
+
this._lastPicked = null;
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
this.selection.reConstruct(this._lastPicked.position);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
processSchema(schema) {
|
|
39
|
+
const nodes = [];
|
|
40
|
+
for (const node of schema.nodes) {
|
|
41
|
+
if (node.valuePalette) {
|
|
42
|
+
nodes.push({
|
|
43
|
+
id: node.name,
|
|
44
|
+
label: node.name,
|
|
45
|
+
values: [...node.valuePalette._palette],
|
|
46
|
+
type: "string",
|
|
47
|
+
value: "",
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
nodes.push({
|
|
52
|
+
id: node.name,
|
|
53
|
+
label: node.name,
|
|
54
|
+
min: 0,
|
|
55
|
+
max: Math.pow(2, node.data.bitSize) - 1,
|
|
56
|
+
type: "number",
|
|
57
|
+
value: 0,
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
return nodes;
|
|
62
|
+
}
|
|
63
|
+
updatePickedSchema(schema) {
|
|
64
|
+
if (!this._pickedResult)
|
|
65
|
+
return;
|
|
66
|
+
const trueVoxelId = this._pickedResult.voxel.getVoxelId();
|
|
67
|
+
const voxelSchemas = SchemaRegister.getVoxelSchemas(this._pickedResult.voxel.getStringId());
|
|
68
|
+
voxelSchemas.state.startEncoding(this._pickedResult.voxel.getState());
|
|
69
|
+
voxelSchemas.mod.startEncoding(this._pickedResult.voxel.getMod());
|
|
70
|
+
for (const node of schema.stateSchema) {
|
|
71
|
+
if (node.type == "string") {
|
|
72
|
+
voxelSchemas.state.setValue(node.id, node.value);
|
|
73
|
+
}
|
|
74
|
+
else {
|
|
75
|
+
voxelSchemas.state.setNumber(node.id, node.value);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
for (const node of schema.modSchema) {
|
|
79
|
+
if (node.type == "string") {
|
|
80
|
+
voxelSchemas.mod.setValue(node.id, node.value);
|
|
81
|
+
}
|
|
82
|
+
else {
|
|
83
|
+
voxelSchemas.mod.setNumber(node.id, node.value);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
const currentRaw = this._pickedResult.voxel.getRaw();
|
|
87
|
+
const rawVoxelData = [
|
|
88
|
+
VoxelPalettesRegister.getVoxelId(trueVoxelId, voxelSchemas.state.getEncoded(), voxelSchemas.mod.getEncoded()),
|
|
89
|
+
currentRaw[1],
|
|
90
|
+
currentRaw[2],
|
|
91
|
+
currentRaw[3],
|
|
92
|
+
];
|
|
93
|
+
this.paintData = PaintVoxelData.FromRaw(rawVoxelData);
|
|
94
|
+
return this.paintData;
|
|
95
|
+
}
|
|
96
|
+
getPickedSchema() {
|
|
97
|
+
if (!this._pickedResult)
|
|
98
|
+
return null;
|
|
99
|
+
const id = this._pickedResult.voxel.getStringId();
|
|
100
|
+
const voxelSchemas = SchemaRegister.getVoxelSchemas(id);
|
|
101
|
+
voxelSchemas.state.startEncoding(this._pickedResult.voxel.getState());
|
|
102
|
+
voxelSchemas.mod.startEncoding(this._pickedResult.voxel.getMod());
|
|
103
|
+
return {
|
|
104
|
+
stateSchema: this.processSchema(voxelSchemas.state),
|
|
105
|
+
modSchema: this.processSchema(voxelSchemas.mod),
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
/**Get an array of all possible state varations for the current mod of the selected voxel. */
|
|
109
|
+
getStateValues() {
|
|
110
|
+
if (!this._pickedResult)
|
|
111
|
+
return null;
|
|
112
|
+
const voxelStates = [];
|
|
113
|
+
const voxelId = this._pickedResult.voxel.id;
|
|
114
|
+
const [trueId, , mod] = VoxelPalettesRegister.voxels[voxelId];
|
|
115
|
+
const stateArray = VoxelPalettesRegister.voxelRecord[trueId][mod];
|
|
116
|
+
const rawVoxelData = [0, 0, 0, 0];
|
|
117
|
+
for (let i = 0; i < stateArray.length; i++) {
|
|
118
|
+
const value = stateArray[i];
|
|
119
|
+
if (value === undefined || value <= 0)
|
|
120
|
+
continue;
|
|
121
|
+
rawVoxelData[0] = value;
|
|
122
|
+
voxelStates.push(PaintVoxelData.FromRaw(rawVoxelData));
|
|
123
|
+
}
|
|
124
|
+
return voxelStates;
|
|
125
|
+
}
|
|
126
|
+
/**Get an array of all possible mod varations for the current state of the selected voxel. */
|
|
127
|
+
getModValues() {
|
|
128
|
+
if (!this._pickedResult)
|
|
129
|
+
return null;
|
|
130
|
+
const voxelStates = [];
|
|
131
|
+
const voxelId = this._pickedResult.voxel.id;
|
|
132
|
+
const [trueId, state] = VoxelPalettesRegister.voxels[voxelId];
|
|
133
|
+
const modArray = VoxelPalettesRegister.voxelRecord[trueId];
|
|
134
|
+
const rawVoxelData = [0, 0, 0, 0];
|
|
135
|
+
for (let i = 0; i < modArray.length; i++) {
|
|
136
|
+
const stateArray = modArray[i];
|
|
137
|
+
if (stateArray === undefined || !stateArray.length)
|
|
138
|
+
continue;
|
|
139
|
+
let id = -1;
|
|
140
|
+
for (let j = 0; j < stateArray.length; j++) {
|
|
141
|
+
id = VoxelPalettesRegister.voxelRecord[trueId][i][state];
|
|
142
|
+
if (id === undefined || id < 0)
|
|
143
|
+
continue;
|
|
144
|
+
rawVoxelData[0] = id;
|
|
145
|
+
break;
|
|
146
|
+
}
|
|
147
|
+
if (id === undefined || id < 0)
|
|
148
|
+
continue;
|
|
149
|
+
voxelStates.push(PaintVoxelData.FromRaw(rawVoxelData));
|
|
150
|
+
}
|
|
151
|
+
return voxelStates;
|
|
152
|
+
}
|
|
153
|
+
cancel() {
|
|
154
|
+
this._lastPicked = null;
|
|
155
|
+
}
|
|
156
|
+
async use() {
|
|
157
|
+
if (this.mode == WrenchToolModes.Pick) {
|
|
158
|
+
if (this._lastPicked && !this._lastPicked.voxel.isAir()) {
|
|
159
|
+
this._pickedResult = this._lastPicked.clone();
|
|
160
|
+
this.dispatch("picked", {});
|
|
161
|
+
this.mode = WrenchToolModes.Update;
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
164
|
+
else {
|
|
165
|
+
this._pickedResult = null;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
if (this.mode == WrenchToolModes.Update) {
|
|
169
|
+
await this.space.paintVoxel([
|
|
170
|
+
this.selection.origin.x,
|
|
171
|
+
this.selection.origin.y,
|
|
172
|
+
this.selection.origin.z,
|
|
173
|
+
], this.paintData);
|
|
174
|
+
return;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
getOptionValue(id) {
|
|
178
|
+
return null;
|
|
179
|
+
}
|
|
180
|
+
getCurrentOptions() {
|
|
181
|
+
return [];
|
|
182
|
+
}
|
|
183
|
+
updateOption(property, value) { }
|
|
184
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { VoxelBuildSpace } from "../VoxelBuildSpace";
|
|
2
|
+
import { VoxelBoundsSelection } from "../../Templates/Selection/VoxelBoundsSelection";
|
|
3
|
+
import { Vector3Like } from "@amodx/math";
|
|
4
|
+
import { FreePointSelection } from "./FreePointSelection";
|
|
5
|
+
export declare class FreeBoxSelection {
|
|
6
|
+
space: VoxelBuildSpace;
|
|
7
|
+
point: FreePointSelection;
|
|
8
|
+
start: Vector3Like;
|
|
9
|
+
selection: VoxelBoundsSelection;
|
|
10
|
+
constructor(space: VoxelBuildSpace, point: FreePointSelection);
|
|
11
|
+
update(): void;
|
|
12
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { VoxelBoundsSelection } from "../../Templates/Selection/VoxelBoundsSelection";
|
|
2
|
+
import { Axes } from "@amodx/math/Vectors/Axes";
|
|
3
|
+
export class FreeBoxSelection {
|
|
4
|
+
space;
|
|
5
|
+
point;
|
|
6
|
+
start;
|
|
7
|
+
selection;
|
|
8
|
+
constructor(space, point) {
|
|
9
|
+
this.space = space;
|
|
10
|
+
this.point = point;
|
|
11
|
+
this.start = { ...point.selection.origin };
|
|
12
|
+
this.selection = new VoxelBoundsSelection();
|
|
13
|
+
this.selection.reConstruct(this.start, Axes.UpReadOnly(), this.start, Axes.UpReadOnly());
|
|
14
|
+
}
|
|
15
|
+
update() {
|
|
16
|
+
const point = this.point.getPoint();
|
|
17
|
+
if (!point)
|
|
18
|
+
return;
|
|
19
|
+
this.selection.reConstruct(this.start, Axes.UpReadOnly(), point, Axes.UpReadOnly());
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { VoxelBuildSpace } from "../VoxelBuildSpace";
|
|
2
|
+
import { Vector3Like } from "@amodx/math";
|
|
3
|
+
import { VoxelPointSelection } from "../../Templates/Selection/VoxelPointSelection";
|
|
4
|
+
export declare class FreePointSelection {
|
|
5
|
+
space: VoxelBuildSpace;
|
|
6
|
+
selection: VoxelPointSelection;
|
|
7
|
+
distance: number;
|
|
8
|
+
planeOrigin: Vector3Like;
|
|
9
|
+
planeNormal: Vector3Like;
|
|
10
|
+
offset: number;
|
|
11
|
+
constructor(space: VoxelBuildSpace, selection: VoxelPointSelection, distance?: number);
|
|
12
|
+
getPoint(): Vector3Like | undefined;
|
|
13
|
+
update(): boolean;
|
|
14
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { Vector3Like } from "@amodx/math";
|
|
2
|
+
export class FreePointSelection {
|
|
3
|
+
space;
|
|
4
|
+
selection;
|
|
5
|
+
distance;
|
|
6
|
+
planeOrigin = Vector3Like.Create();
|
|
7
|
+
planeNormal = Vector3Like.Create();
|
|
8
|
+
offset = 0;
|
|
9
|
+
constructor(space, selection, distance = 10) {
|
|
10
|
+
this.space = space;
|
|
11
|
+
this.selection = selection;
|
|
12
|
+
this.distance = distance;
|
|
13
|
+
}
|
|
14
|
+
getPoint() {
|
|
15
|
+
let rayPosition = Vector3Like.FloorInPlace(Vector3Like.Add(this.space.rayProvider.origin, Vector3Like.MultiplyScalar(this.space.rayProvider.direction, this.distance)));
|
|
16
|
+
if (!this.space.bounds.intersectsPoint(rayPosition)) {
|
|
17
|
+
const rayIntersection = this.space.bounds.rayIntersection(this.space.rayProvider.origin, this.space.rayProvider.direction, this.space.rayProvider.length);
|
|
18
|
+
if (!isFinite(rayIntersection))
|
|
19
|
+
return;
|
|
20
|
+
if (rayIntersection == 0) {
|
|
21
|
+
const rayIntersectionFromWithin = this.space.bounds.rayIntersectionFromWithin(this.space.rayProvider.origin, this.space.rayProvider.direction, this.space.rayProvider.length);
|
|
22
|
+
if (!isFinite(rayIntersectionFromWithin))
|
|
23
|
+
return;
|
|
24
|
+
rayPosition = Vector3Like.FloorInPlace(Vector3Like.Add(this.space.rayProvider.origin, Vector3Like.MultiplyScalar(this.space.rayProvider.direction, rayIntersectionFromWithin)));
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
rayPosition = Vector3Like.FloorInPlace(Vector3Like.Add(this.space.rayProvider.origin, Vector3Like.MultiplyScalar(this.space.rayProvider.direction, rayIntersection)));
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
return rayPosition;
|
|
31
|
+
}
|
|
32
|
+
update() {
|
|
33
|
+
const point = this.getPoint();
|
|
34
|
+
if (!point)
|
|
35
|
+
return false;
|
|
36
|
+
this.selection.reConstruct(point);
|
|
37
|
+
return true;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { VoxelBuildSpace } from "../VoxelBuildSpace";
|
|
2
|
+
import { VoxelBoundsSelection } from "../../Templates/Selection/VoxelBoundsSelection";
|
|
3
|
+
import { Vector3Like } from "@amodx/math";
|
|
4
|
+
export declare class SurfaceBoxSelection {
|
|
5
|
+
space: VoxelBuildSpace;
|
|
6
|
+
selection: VoxelBoundsSelection;
|
|
7
|
+
planeOrigin: Vector3Like;
|
|
8
|
+
planeNormal: Vector3Like;
|
|
9
|
+
offset: number;
|
|
10
|
+
constructor(space: VoxelBuildSpace, selection: VoxelBoundsSelection);
|
|
11
|
+
update(): void;
|
|
12
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Vector3Like } from "@amodx/math";
|
|
2
|
+
export class SurfaceBoxSelection {
|
|
3
|
+
space;
|
|
4
|
+
selection;
|
|
5
|
+
planeOrigin = Vector3Like.Create();
|
|
6
|
+
planeNormal = Vector3Like.Create();
|
|
7
|
+
offset = 0;
|
|
8
|
+
constructor(space, selection) {
|
|
9
|
+
this.space = space;
|
|
10
|
+
this.selection = selection;
|
|
11
|
+
}
|
|
12
|
+
update() {
|
|
13
|
+
const rayOrigin = this.space.rayProvider.origin;
|
|
14
|
+
const rayDirection = this.space.rayProvider.direction;
|
|
15
|
+
const distance = Vector3Like.Dot(Vector3Like.Subtract(this.planeOrigin, rayOrigin), this.planeNormal) / Vector3Like.Dot(rayDirection, this.planeNormal);
|
|
16
|
+
const intersectionPoint = Vector3Like.FloorInPlace(Vector3Like.Add(rayOrigin, Vector3Like.MultiplyScalar(rayDirection, distance)));
|
|
17
|
+
let offset = this.offset;
|
|
18
|
+
if (this.planeNormal.x > 0 ||
|
|
19
|
+
this.planeNormal.y > 0 ||
|
|
20
|
+
this.planeNormal.z > 0) {
|
|
21
|
+
offset++;
|
|
22
|
+
}
|
|
23
|
+
this.selection.reConstruct(this.planeOrigin, this.planeNormal, intersectionPoint, this.planeNormal, offset);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { Vec3Array, Vector3Like } from "@amodx/math";
|
|
2
|
+
import { BoundingBox } from "@amodx/math/Geomtry/Bounds/BoundingBox";
|
|
3
|
+
import { DivineVoxelEngineRender } from "../Contexts/Render";
|
|
4
|
+
import { VoxelPathData } from "../Templates/Path/VoxelPath.types";
|
|
5
|
+
import { IVoxelTemplateData } from "../Templates/VoxelTemplates.types";
|
|
6
|
+
import { PaintVoxelData } from "../Voxels";
|
|
7
|
+
import { VoxelPickResult } from "../Voxels/Interaction/VoxelPickResult";
|
|
8
|
+
import { RayProvider } from "./RayProvider";
|
|
9
|
+
import { FullVoxelTemplate } from "../Templates/Full/FullVoxelTemplate";
|
|
10
|
+
import { BoundsMinMaxData } from "@amodx/math/Geomtry/Bounds/BoundsInterface";
|
|
11
|
+
import type { VoxelSurfaceSelectionData } from "../Templates/Selection/VoxelSurfaceSelection";
|
|
12
|
+
import type { VoxelBFSSelectionData } from "../Templates/Selection/VoxelBFSSelection";
|
|
13
|
+
import { IVoxelSelectionData } from "../Templates/Selection/VoxelSelection";
|
|
14
|
+
import "../Templates/VoxelTemplateRegister";
|
|
15
|
+
type VoxelSpaceBaseUpdateData<Type extends string, Data extends any> = {
|
|
16
|
+
type: Type;
|
|
17
|
+
remote?: true;
|
|
18
|
+
} & Data;
|
|
19
|
+
export type VoxelSpaceUpdateData = VoxelSpaceBaseUpdateData<"paint-voxel", {
|
|
20
|
+
position: Vec3Array;
|
|
21
|
+
voxel: PaintVoxelData;
|
|
22
|
+
}> | VoxelSpaceBaseUpdateData<"erase-voxel", {
|
|
23
|
+
position: Vec3Array;
|
|
24
|
+
}> | VoxelSpaceBaseUpdateData<"paint-voxel-template", {
|
|
25
|
+
position: Vec3Array;
|
|
26
|
+
template: IVoxelTemplateData<any>;
|
|
27
|
+
}> | VoxelSpaceBaseUpdateData<"erase-voxel-template", {
|
|
28
|
+
position: Vec3Array;
|
|
29
|
+
template: IVoxelTemplateData<any>;
|
|
30
|
+
}> | VoxelSpaceBaseUpdateData<"erase-voxel-selection", {
|
|
31
|
+
selection: IVoxelSelectionData<any>;
|
|
32
|
+
}> | VoxelSpaceBaseUpdateData<"paint-voxel-path", {
|
|
33
|
+
position: Vec3Array;
|
|
34
|
+
path: VoxelPathData;
|
|
35
|
+
}> | VoxelSpaceBaseUpdateData<"erase-voxel-path", {
|
|
36
|
+
position: Vec3Array;
|
|
37
|
+
path: VoxelPathData;
|
|
38
|
+
}>;
|
|
39
|
+
export declare class VoxelBuildSpace {
|
|
40
|
+
DVER: DivineVoxelEngineRender;
|
|
41
|
+
/**Callback that is called before the update is ran. */
|
|
42
|
+
beforeUpdate: ((data: VoxelSpaceUpdateData) => Promise<void> | void) | null;
|
|
43
|
+
/**Callback that is called durning the update call using Promise.all. */
|
|
44
|
+
duringUpdate: ((data: VoxelSpaceUpdateData) => Promise<void> | void) | null;
|
|
45
|
+
/**Callback that is called after the update is ran. */
|
|
46
|
+
afterUpdate: ((data: VoxelSpaceUpdateData) => Promise<void> | void) | null;
|
|
47
|
+
bounds: BoundingBox;
|
|
48
|
+
private _rayProviders;
|
|
49
|
+
get rayProvider(): RayProvider;
|
|
50
|
+
constructor(DVER: DivineVoxelEngineRender, rayProvider: RayProvider, min?: Vector3Like, max?: Vector3Like);
|
|
51
|
+
addRayProvider(index: number, provider: RayProvider): void;
|
|
52
|
+
getRayProvider(index: number): RayProvider | null;
|
|
53
|
+
removeRayProvider(index: number): void;
|
|
54
|
+
/**Pick the current voxel space. Defaults to the rayProvider values. */
|
|
55
|
+
pick(rayOrigin?: Vector3Like, rayDirection?: Vector3Like, length?: number): Promise<VoxelPickResult | null>;
|
|
56
|
+
pickWithProvider(index: number): Promise<VoxelPickResult | null>;
|
|
57
|
+
createTemplate(bounds: BoundsMinMaxData): Promise<FullVoxelTemplate>;
|
|
58
|
+
getSurfaceSelection(position: Vector3Like, normal: Vector3Like, extrusion: number, maxSize?: number): Promise<VoxelSurfaceSelectionData>;
|
|
59
|
+
getBFSSelection(position: Vector3Like, maxSize?: number): Promise<VoxelBFSSelectionData>;
|
|
60
|
+
getExtrudedSelectionTemplate(selection: IVoxelSelectionData<any>, nomral: Vector3Like): Promise<FullVoxelTemplate>;
|
|
61
|
+
getPlaceState(data: PaintVoxelData, picked: VoxelPickResult, alt?: number | null): PaintVoxelData | undefined;
|
|
62
|
+
clear(): Promise<boolean>;
|
|
63
|
+
private _updateFunctions;
|
|
64
|
+
update<T extends VoxelSpaceUpdateData>(data: T): Promise<void>;
|
|
65
|
+
paintVoxel(position: Vec3Array | Vector3Like, voxel: PaintVoxelData): Promise<void>;
|
|
66
|
+
eraseVoxel(position: Vec3Array | Vector3Like): Promise<void>;
|
|
67
|
+
paintTemplate(position: Vec3Array | Vector3Like | Vector3Like, template: IVoxelTemplateData<any>): Promise<void>;
|
|
68
|
+
eraseTemplate(position: Vec3Array | Vector3Like, template: IVoxelTemplateData<any>): Promise<void>;
|
|
69
|
+
eraseSelection(selection: IVoxelSelectionData<any>): Promise<void>;
|
|
70
|
+
paintPath(position: Vec3Array | Vector3Like, path: VoxelPathData): Promise<void>;
|
|
71
|
+
erasePath(position: Vec3Array | Vector3Like, path: VoxelPathData): Promise<void>;
|
|
72
|
+
}
|
|
73
|
+
export {};
|
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
import { Vector3Like } from "@amodx/math";
|
|
2
|
+
import { BoundingBox } from "@amodx/math/Geomtry/Bounds/BoundingBox";
|
|
3
|
+
import { PaintVoxelData } from "../Voxels";
|
|
4
|
+
import { VoxelPlacingStrategyRegister } from "../Voxels/Interaction/Placing/VoxelPlacingStrategyRegister";
|
|
5
|
+
import { VoxelPickResult } from "../Voxels/Interaction/VoxelPickResult";
|
|
6
|
+
import { SchemaRegister } from "../Voxels/State/SchemaRegister";
|
|
7
|
+
import { FullVoxelTemplate } from "../Templates/Full/FullVoxelTemplate";
|
|
8
|
+
import { VoxelShapeTemplate } from "../Templates/Shapes/VoxelShapeTemplate";
|
|
9
|
+
import { BoxVoxelShapeSelection } from "../Templates/Shapes/Selections/BoxVoxelShapeSelection";
|
|
10
|
+
import "../Templates/VoxelTemplateRegister";
|
|
11
|
+
export class VoxelBuildSpace {
|
|
12
|
+
DVER;
|
|
13
|
+
/**Callback that is called before the update is ran. */
|
|
14
|
+
beforeUpdate = null;
|
|
15
|
+
/**Callback that is called durning the update call using Promise.all. */
|
|
16
|
+
duringUpdate = null;
|
|
17
|
+
/**Callback that is called after the update is ran. */
|
|
18
|
+
afterUpdate = null;
|
|
19
|
+
bounds;
|
|
20
|
+
_rayProviders = [];
|
|
21
|
+
get rayProvider() {
|
|
22
|
+
return this.getRayProvider(0);
|
|
23
|
+
}
|
|
24
|
+
constructor(DVER, rayProvider, min = Vector3Like.Create(-Infinity, -Infinity, -Infinity), max = Vector3Like.Create(Infinity, Infinity, Infinity)) {
|
|
25
|
+
this.DVER = DVER;
|
|
26
|
+
this.bounds = new BoundingBox(min, max);
|
|
27
|
+
this.addRayProvider(0, rayProvider);
|
|
28
|
+
}
|
|
29
|
+
addRayProvider(index, provider) {
|
|
30
|
+
this._rayProviders[index] = provider;
|
|
31
|
+
}
|
|
32
|
+
getRayProvider(index) {
|
|
33
|
+
return this._rayProviders[index];
|
|
34
|
+
}
|
|
35
|
+
removeRayProvider(index) {
|
|
36
|
+
this._rayProviders[index] = null;
|
|
37
|
+
}
|
|
38
|
+
/**Pick the current voxel space. Defaults to the rayProvider values. */
|
|
39
|
+
async pick(rayOrigin = this.rayProvider.origin, rayDirection = this.rayProvider.direction, length = this.rayProvider.length) {
|
|
40
|
+
const pickedVoxel = await this.DVER.threads.world.runTaskAsync("pick-voxel", [
|
|
41
|
+
[rayOrigin.x, rayOrigin.y, rayOrigin.z],
|
|
42
|
+
[rayDirection.x, rayDirection.y, rayDirection.z],
|
|
43
|
+
length,
|
|
44
|
+
]);
|
|
45
|
+
if (pickedVoxel === null) {
|
|
46
|
+
return null;
|
|
47
|
+
}
|
|
48
|
+
return VoxelPickResult.FromJSON(pickedVoxel);
|
|
49
|
+
}
|
|
50
|
+
async pickWithProvider(index) {
|
|
51
|
+
const provider = this.getRayProvider(index);
|
|
52
|
+
if (!provider) {
|
|
53
|
+
throw new Error(`Ray Provider at index ${index} is not set`);
|
|
54
|
+
}
|
|
55
|
+
return await this.pick(provider.origin, this.rayProvider.direction, this.rayProvider.length);
|
|
56
|
+
}
|
|
57
|
+
async createTemplate(bounds) {
|
|
58
|
+
const templateData = await this.DVER.threads.world.runTaskAsync("create-voxel-template", [
|
|
59
|
+
[0, ...Vector3Like.ToArray(bounds.min)],
|
|
60
|
+
bounds,
|
|
61
|
+
]);
|
|
62
|
+
return new FullVoxelTemplate(templateData);
|
|
63
|
+
}
|
|
64
|
+
async getSurfaceSelection(position, normal, extrusion, maxSize) {
|
|
65
|
+
return await this.DVER.threads.world.runTaskAsync("get-voxel-surface-selection", [position, normal, extrusion, maxSize]);
|
|
66
|
+
}
|
|
67
|
+
async getBFSSelection(position, maxSize) {
|
|
68
|
+
return await this.DVER.threads.world.runTaskAsync("get-voxel-bfs-selection", [position, maxSize]);
|
|
69
|
+
}
|
|
70
|
+
async getExtrudedSelectionTemplate(selection, nomral) {
|
|
71
|
+
const templateData = await this.DVER.threads.world.runTaskAsync("get-extruded-voxel-selection-template", [selection, nomral]);
|
|
72
|
+
return new FullVoxelTemplate(templateData);
|
|
73
|
+
}
|
|
74
|
+
getPlaceState(data, picked, alt = null) {
|
|
75
|
+
const strategy = VoxelPlacingStrategyRegister.get(data.id);
|
|
76
|
+
if (!strategy)
|
|
77
|
+
return data;
|
|
78
|
+
const state = strategy.getState(picked, alt);
|
|
79
|
+
if (!state) {
|
|
80
|
+
data.state = 0;
|
|
81
|
+
return data;
|
|
82
|
+
}
|
|
83
|
+
const schema = SchemaRegister.getVoxelSchemas(data.id);
|
|
84
|
+
data.state = schema.state.readString(state);
|
|
85
|
+
}
|
|
86
|
+
async clear() {
|
|
87
|
+
const size = this.bounds.size;
|
|
88
|
+
if (!isFinite(size.x) || !isFinite(size.y) || !isFinite(size.z))
|
|
89
|
+
return false;
|
|
90
|
+
const min = this.bounds.min;
|
|
91
|
+
await this.DVER.threads.world.runTaskAsync("erase-voxel-template", [
|
|
92
|
+
[0, min.x, min.y, min.z],
|
|
93
|
+
VoxelShapeTemplate.CreateNew({
|
|
94
|
+
shapeSelection: BoxVoxelShapeSelection.CreateNew({
|
|
95
|
+
width: this.bounds.size.x,
|
|
96
|
+
height: this.bounds.size.y,
|
|
97
|
+
depth: this.bounds.size.z,
|
|
98
|
+
}),
|
|
99
|
+
}),
|
|
100
|
+
]);
|
|
101
|
+
return true;
|
|
102
|
+
}
|
|
103
|
+
_updateFunctions = {
|
|
104
|
+
"paint-voxel": async (update) => {
|
|
105
|
+
await this.DVER.threads.world.runTaskAsync("paint-voxel", [
|
|
106
|
+
[0, ...update.position],
|
|
107
|
+
PaintVoxelData.ToRaw(update.voxel),
|
|
108
|
+
]);
|
|
109
|
+
},
|
|
110
|
+
"erase-voxel": async (update) => {
|
|
111
|
+
await this.DVER.threads.world.runTaskAsync("erase-voxel", [
|
|
112
|
+
0,
|
|
113
|
+
...update.position,
|
|
114
|
+
]);
|
|
115
|
+
},
|
|
116
|
+
"paint-voxel-template": async (update) => {
|
|
117
|
+
await this.DVER.threads.world.runTaskAsync("paint-voxel-template", [
|
|
118
|
+
[0, ...update.position],
|
|
119
|
+
update.template,
|
|
120
|
+
]);
|
|
121
|
+
},
|
|
122
|
+
"erase-voxel-template": async (update) => {
|
|
123
|
+
await this.DVER.threads.world.runTaskAsync("erase-voxel-template", [
|
|
124
|
+
[0, ...update.position],
|
|
125
|
+
update.template,
|
|
126
|
+
]);
|
|
127
|
+
},
|
|
128
|
+
"erase-voxel-selection": async (update) => {
|
|
129
|
+
await this.DVER.threads.world.runTaskAsync("erase-voxel-selection", [
|
|
130
|
+
[
|
|
131
|
+
0,
|
|
132
|
+
update.selection.origin.x,
|
|
133
|
+
update.selection.origin.y,
|
|
134
|
+
update.selection.origin.z,
|
|
135
|
+
],
|
|
136
|
+
update.selection,
|
|
137
|
+
]);
|
|
138
|
+
},
|
|
139
|
+
"paint-voxel-path": async (update) => {
|
|
140
|
+
await this.DVER.threads.world.runTaskAsync("paint-voxel-path", [
|
|
141
|
+
[0, ...update.position],
|
|
142
|
+
update.path,
|
|
143
|
+
]);
|
|
144
|
+
},
|
|
145
|
+
"erase-voxel-path": async (update) => {
|
|
146
|
+
await this.DVER.threads.world.runTaskAsync("erase-voxel-path", [
|
|
147
|
+
[0, ...update.position],
|
|
148
|
+
update.path,
|
|
149
|
+
]);
|
|
150
|
+
},
|
|
151
|
+
};
|
|
152
|
+
async update(data) {
|
|
153
|
+
if (this.beforeUpdate)
|
|
154
|
+
await this.beforeUpdate(data);
|
|
155
|
+
const run = this._updateFunctions[data.type];
|
|
156
|
+
if (this.duringUpdate) {
|
|
157
|
+
await Promise.all([run(data), this.duringUpdate(data)]);
|
|
158
|
+
}
|
|
159
|
+
else {
|
|
160
|
+
await run(data);
|
|
161
|
+
}
|
|
162
|
+
if (this.afterUpdate)
|
|
163
|
+
await this.afterUpdate(data);
|
|
164
|
+
}
|
|
165
|
+
async paintVoxel(position, voxel) {
|
|
166
|
+
await this.update({
|
|
167
|
+
type: "paint-voxel",
|
|
168
|
+
position: Array.isArray(position)
|
|
169
|
+
? position
|
|
170
|
+
: Vector3Like.ToArray(position),
|
|
171
|
+
voxel,
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
async eraseVoxel(position) {
|
|
175
|
+
await this.update({
|
|
176
|
+
type: "erase-voxel",
|
|
177
|
+
position: Array.isArray(position)
|
|
178
|
+
? position
|
|
179
|
+
: Vector3Like.ToArray(position),
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
async paintTemplate(position, template) {
|
|
183
|
+
await this.update({
|
|
184
|
+
type: "paint-voxel-template",
|
|
185
|
+
position: Array.isArray(position)
|
|
186
|
+
? position
|
|
187
|
+
: Vector3Like.ToArray(position),
|
|
188
|
+
template,
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
async eraseTemplate(position, template) {
|
|
192
|
+
await this.update({
|
|
193
|
+
type: "erase-voxel-template",
|
|
194
|
+
position: Array.isArray(position)
|
|
195
|
+
? position
|
|
196
|
+
: Vector3Like.ToArray(position),
|
|
197
|
+
template,
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
async eraseSelection(selection) {
|
|
201
|
+
await this.update({
|
|
202
|
+
type: "erase-voxel-selection",
|
|
203
|
+
selection,
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
async paintPath(position, path) {
|
|
207
|
+
await this.update({
|
|
208
|
+
type: "paint-voxel-path",
|
|
209
|
+
position: Array.isArray(position)
|
|
210
|
+
? position
|
|
211
|
+
: Vector3Like.ToArray(position),
|
|
212
|
+
path,
|
|
213
|
+
});
|
|
214
|
+
}
|
|
215
|
+
async erasePath(position, path) {
|
|
216
|
+
await this.update({
|
|
217
|
+
type: "erase-voxel-path",
|
|
218
|
+
position: Array.isArray(position)
|
|
219
|
+
? position
|
|
220
|
+
: Vector3Like.ToArray(position),
|
|
221
|
+
path,
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function InitTasks(): void;
|