@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,37 @@
|
|
|
1
|
+
import { Flat3DIndex } from "@amodx/math";
|
|
2
|
+
import { PaintVoxelData, RawVoxelData } from "../../Voxels";
|
|
3
|
+
import { VoxelShapeTemplateData, VoxelShapeTemplateFillModes } from "./VoxelShapeTemplate.types";
|
|
4
|
+
import { BoundingBox } from "@amodx/math/Geomtry/Bounds/BoundingBox";
|
|
5
|
+
import { IVoxelTemplate } from "../VoxelTemplates.types";
|
|
6
|
+
import { IVoxelShapeSelection, IVoxelShapeSelectionData } from "./Selections/VoxelShapeSelection";
|
|
7
|
+
import type { VoxelTemplateRegister } from "../VoxelTemplateRegister";
|
|
8
|
+
export declare class VoxelShapeTemplate implements IVoxelTemplate<"shape", VoxelShapeTemplateData> {
|
|
9
|
+
static Register: typeof VoxelTemplateRegister;
|
|
10
|
+
static CreateNew(data: Partial<VoxelShapeTemplateData>): VoxelShapeTemplateData;
|
|
11
|
+
index: Flat3DIndex;
|
|
12
|
+
bounds: BoundingBox;
|
|
13
|
+
fillMode: VoxelShapeTemplateFillModes;
|
|
14
|
+
fillVoxel: PaintVoxelData;
|
|
15
|
+
faceVoxel: PaintVoxelData;
|
|
16
|
+
edgeVoxel: PaintVoxelData;
|
|
17
|
+
pointVoxel: PaintVoxelData;
|
|
18
|
+
_fillVoxel: RawVoxelData;
|
|
19
|
+
_faceVoxel: RawVoxelData;
|
|
20
|
+
_edgeVoxel: RawVoxelData;
|
|
21
|
+
_pointVoxel: RawVoxelData;
|
|
22
|
+
shapeSelection: IVoxelShapeSelection<any, IVoxelShapeSelectionData<any>>;
|
|
23
|
+
constructor(data?: VoxelShapeTemplateData);
|
|
24
|
+
inBounds(x: number, y: number, z: number): boolean;
|
|
25
|
+
setVoxels(fill: PaintVoxelData, face?: PaintVoxelData, edge?: PaintVoxelData, point?: PaintVoxelData): void;
|
|
26
|
+
getIndex(x: number, y: number, z: number): number;
|
|
27
|
+
isIncluded(index: number): boolean;
|
|
28
|
+
isAir(index: number): boolean;
|
|
29
|
+
getId(index: number): number;
|
|
30
|
+
getLight(index: number): number;
|
|
31
|
+
getLevel(index: number): number;
|
|
32
|
+
getSecondary(index: number): number;
|
|
33
|
+
getRaw(index: number, rawRef?: RawVoxelData): RawVoxelData;
|
|
34
|
+
clone(): VoxelShapeTemplate;
|
|
35
|
+
toJSON(): VoxelShapeTemplateData;
|
|
36
|
+
fromJSON(data: VoxelShapeTemplateData): void;
|
|
37
|
+
}
|
|
@@ -1,25 +1,24 @@
|
|
|
1
|
-
import { Flat3DIndex
|
|
1
|
+
import { Flat3DIndex } from "@amodx/math";
|
|
2
2
|
import { PaintVoxelData } from "../../Voxels";
|
|
3
|
-
import { TypedEventTarget } from "../../Util/TypedEventTarget";
|
|
4
3
|
import { BoundingBox } from "@amodx/math/Geomtry/Bounds/BoundingBox";
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
import { BoxVoxelShapeSelection } from "./Selections/BoxVoxelShapeSelection";
|
|
5
|
+
export class VoxelShapeTemplate {
|
|
6
|
+
static Register;
|
|
7
|
+
static CreateNew(data) {
|
|
7
8
|
return {
|
|
8
|
-
type,
|
|
9
|
-
bounds: data.bounds ||
|
|
10
|
-
|
|
11
|
-
fillMode: "full",
|
|
12
|
-
fillVoxel: PaintVoxelData.Create(),
|
|
13
|
-
faceVoxel: PaintVoxelData.Create(),
|
|
14
|
-
edgeVoxel: PaintVoxelData.Create(),
|
|
15
|
-
pointVoxel: PaintVoxelData.Create(),
|
|
16
|
-
|
|
9
|
+
type: "shape",
|
|
10
|
+
bounds: data.bounds ||
|
|
11
|
+
data.shapeSelection?.bounds || { x: 1, y: 1, z: 1 },
|
|
12
|
+
fillMode: data.fillMode || "full",
|
|
13
|
+
fillVoxel: data.fillVoxel || PaintVoxelData.Create(),
|
|
14
|
+
faceVoxel: data.faceVoxel || PaintVoxelData.Create(),
|
|
15
|
+
edgeVoxel: data.edgeVoxel || PaintVoxelData.Create(),
|
|
16
|
+
pointVoxel: data.pointVoxel || PaintVoxelData.Create(),
|
|
17
|
+
shapeSelection: data.shapeSelection || BoxVoxelShapeSelection.CreateNew({}),
|
|
17
18
|
};
|
|
18
19
|
}
|
|
19
|
-
position = Vector3Like.Create();
|
|
20
20
|
index = Flat3DIndex.GetXZYOrder();
|
|
21
21
|
bounds;
|
|
22
|
-
type = "";
|
|
23
22
|
fillMode;
|
|
24
23
|
fillVoxel;
|
|
25
24
|
faceVoxel;
|
|
@@ -29,14 +28,13 @@ export class BasicVoxelShapeTemplate extends TypedEventTarget {
|
|
|
29
28
|
_faceVoxel;
|
|
30
29
|
_edgeVoxel;
|
|
31
30
|
_pointVoxel;
|
|
31
|
+
shapeSelection;
|
|
32
32
|
constructor(data) {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
this.bounds.
|
|
38
|
-
this.index.setBounds(data.bounds.x, data.bounds.y, data.bounds.z);
|
|
39
|
-
this.setVoxels(data.fillVoxel, data.faceVoxel, data.edgeVoxel, data.pointVoxel);
|
|
33
|
+
if (data)
|
|
34
|
+
this.fromJSON(data);
|
|
35
|
+
}
|
|
36
|
+
inBounds(x, y, z) {
|
|
37
|
+
return this.bounds.intersectsXYZ(x + 0.5, y + 0.5, z + 0.5);
|
|
40
38
|
}
|
|
41
39
|
setVoxels(fill, face, edge, point) {
|
|
42
40
|
this.fillVoxel = fill;
|
|
@@ -51,10 +49,9 @@ export class BasicVoxelShapeTemplate extends TypedEventTarget {
|
|
|
51
49
|
getIndex(x, y, z) {
|
|
52
50
|
return this.index.getIndexXYZ(x, y, z);
|
|
53
51
|
}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
this.
|
|
57
|
-
this.position.z = z;
|
|
52
|
+
isIncluded(index) {
|
|
53
|
+
const [x, y, z] = this.index.getXYZ(index);
|
|
54
|
+
return this.shapeSelection.isSelected(x + this.shapeSelection.origin.x, y + this.shapeSelection.origin.y, z + this.shapeSelection.origin.z);
|
|
58
55
|
}
|
|
59
56
|
isAir(index) {
|
|
60
57
|
if (!this.isIncluded(index))
|
|
@@ -107,20 +104,29 @@ export class BasicVoxelShapeTemplate extends TypedEventTarget {
|
|
|
107
104
|
rawRef[3] = this.getSecondary(index);
|
|
108
105
|
return rawRef;
|
|
109
106
|
}
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
107
|
+
clone() {
|
|
108
|
+
const newTemplate = new VoxelShapeTemplate();
|
|
109
|
+
newTemplate.fromJSON(this.toJSON());
|
|
110
|
+
return newTemplate;
|
|
113
111
|
}
|
|
114
|
-
|
|
112
|
+
toJSON() {
|
|
115
113
|
return {
|
|
116
|
-
type:
|
|
117
|
-
|
|
118
|
-
bounds: this.bounds.size,
|
|
114
|
+
type: "shape",
|
|
115
|
+
bounds: { ...this.bounds.size },
|
|
119
116
|
fillMode: this.fillMode,
|
|
120
|
-
fillVoxel: this.fillVoxel,
|
|
121
|
-
faceVoxel: this.faceVoxel,
|
|
122
|
-
edgeVoxel: this.edgeVoxel,
|
|
123
|
-
pointVoxel: this.pointVoxel,
|
|
117
|
+
fillVoxel: { ...this.fillVoxel },
|
|
118
|
+
faceVoxel: { ...this.faceVoxel },
|
|
119
|
+
edgeVoxel: { ...this.edgeVoxel },
|
|
120
|
+
pointVoxel: { ...this.pointVoxel },
|
|
121
|
+
shapeSelection: this.shapeSelection.toJSON(),
|
|
124
122
|
};
|
|
125
123
|
}
|
|
124
|
+
fromJSON(data) {
|
|
125
|
+
this.fillMode = data.fillMode;
|
|
126
|
+
this.bounds = new BoundingBox();
|
|
127
|
+
this.shapeSelection = VoxelShapeTemplate.Register.createSelection(data.shapeSelection);
|
|
128
|
+
this.bounds.setSize(this.shapeSelection.bounds.size);
|
|
129
|
+
this.index.setBounds(this.bounds.size.x, this.bounds.size.y, this.bounds.size.z);
|
|
130
|
+
this.setVoxels(data.fillVoxel, data.faceVoxel, data.edgeVoxel, data.pointVoxel);
|
|
131
|
+
}
|
|
126
132
|
}
|
|
@@ -1,25 +1,18 @@
|
|
|
1
|
-
import { TypedEventTarget } from "../../Util/TypedEventTarget";
|
|
2
1
|
import { PaintVoxelData } from "../../Voxels/Types/PaintVoxelData";
|
|
3
|
-
import {
|
|
2
|
+
import { IVoxelTemplateData } from "../VoxelTemplates.types";
|
|
3
|
+
import { IVoxelShapeSelectionData } from "./Selections/VoxelShapeSelection";
|
|
4
4
|
export interface IVoxelShapeTemplateEvents {
|
|
5
5
|
updated: null;
|
|
6
6
|
}
|
|
7
7
|
export type VoxelShapeTemplateFillModes = "full" | "outline" | "shell";
|
|
8
|
-
export
|
|
9
|
-
export interface IVoxelShapeTemplate<Type extends string, Data extends IVoxelShapeTemplateData<Type>, Events extends IVoxelShapeTemplateEvents = IVoxelShapeTemplateEvents> extends IVoxelTemplate<Type, Data>, TypedEventTarget<Events> {
|
|
10
|
-
fillMode: VoxelShapeTemplateFillModes;
|
|
11
|
-
fillVoxel: PaintVoxelData;
|
|
12
|
-
faceVoxel: PaintVoxelData;
|
|
13
|
-
edgeVoxel: PaintVoxelData;
|
|
14
|
-
pointVoxel: PaintVoxelData;
|
|
15
|
-
setVoxels(fill: PaintVoxelData, face?: PaintVoxelData, edge?: PaintVoxelData, point?: PaintVoxelData): void;
|
|
16
|
-
}
|
|
8
|
+
export declare const VoxelShapeTemplateFillModesArray: VoxelShapeTemplateFillModes[];
|
|
17
9
|
export interface IVoxelshapeTemplateBaseData {
|
|
18
10
|
fillVoxel: PaintVoxelData;
|
|
19
11
|
faceVoxel: PaintVoxelData;
|
|
20
12
|
edgeVoxel: PaintVoxelData;
|
|
21
13
|
pointVoxel: PaintVoxelData;
|
|
22
14
|
fillMode: VoxelShapeTemplateFillModes;
|
|
15
|
+
shapeSelection: IVoxelShapeSelectionData<any>;
|
|
23
16
|
}
|
|
24
|
-
export interface
|
|
17
|
+
export interface VoxelShapeTemplateData extends IVoxelTemplateData<"shape">, IVoxelshapeTemplateBaseData {
|
|
25
18
|
}
|
|
@@ -1,6 +1,10 @@
|
|
|
1
|
+
import { IVoxelSelection, IVoxelSelectionConstructor, IVoxelSelectionData } from "./Selection/VoxelSelection";
|
|
1
2
|
import { IVoxelTemplate, IVoxelTemplateConstructor, IVoxelTemplateData } from "./VoxelTemplates.types";
|
|
2
3
|
export declare class VoxelTemplateRegister {
|
|
3
4
|
static _templates: Map<string, IVoxelTemplateConstructor<any, any>>;
|
|
5
|
+
static _selections: Map<string, IVoxelSelectionConstructor<any, any>>;
|
|
4
6
|
static register(id: string, constructor: IVoxelTemplateConstructor<any>): void;
|
|
5
7
|
static create<Template extends IVoxelTemplate>(data: IVoxelTemplateData<any>): Template;
|
|
8
|
+
static registerSelection(id: string, constructor: IVoxelSelectionConstructor<any>): void;
|
|
9
|
+
static createSelection<Selection extends IVoxelSelection>(data: IVoxelSelectionData<any>): Selection;
|
|
6
10
|
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { ArchivedVoxelTemplate } from "./Archive/ArchivedVoxelTemplate";
|
|
2
|
+
import { FullVoxelTemplate } from "./Full/FullVoxelTemplate";
|
|
3
|
+
import { VoxelBFSSelection } from "./Selection/VoxelBFSSelection";
|
|
4
|
+
import { VoxelBoundsSelection } from "./Selection/VoxelBoundsSelection";
|
|
5
|
+
import { VoxelPointSelection } from "./Selection/VoxelPointSelection";
|
|
6
|
+
import { VoxelSurfaceSelection } from "./Selection/VoxelSurfaceSelection";
|
|
7
|
+
import { VoxelTemplateSelection } from "./Selection/VoxelTemplateSelection";
|
|
8
|
+
import { BoxVoxelShapeSelection } from "./Shapes/Selections/BoxVoxelShapeSelection";
|
|
9
|
+
import { ConeVoxelShapeSelection } from "./Shapes/Selections/ConeVoxelShapeSelection";
|
|
10
|
+
import { CylinderVoxelShapeSelection } from "./Shapes/Selections/CylinderVoxelShapeSelection";
|
|
11
|
+
import { OctahedronVoxelShapeSelection } from "./Shapes/Selections/OctahedronVoxelShapeSelection";
|
|
12
|
+
import { PyramidVoxelShapeSelection } from "./Shapes/Selections/PyramidVoxelShapeSelection";
|
|
13
|
+
import { SphereVoxelShapeSelection } from "./Shapes/Selections/SphereVoxelShapeSelection";
|
|
14
|
+
import { EllipsoidVoxelShapeSelection } from "./Shapes/Selections/EllipsoidVoxelShapeSelection";
|
|
15
|
+
import { TorusVoxelShapeSelection } from "./Shapes/Selections/TorusVoxelShapeSelection";
|
|
16
|
+
import { VoxelShapeTemplate } from "./Shapes/VoxelShapeTemplate";
|
|
17
|
+
export class VoxelTemplateRegister {
|
|
18
|
+
static _templates = new Map();
|
|
19
|
+
static _selections = new Map();
|
|
20
|
+
static register(id, constructor) {
|
|
21
|
+
this._templates.set(id, constructor);
|
|
22
|
+
}
|
|
23
|
+
static create(data) {
|
|
24
|
+
const TemplateClass = this._templates.get(data.type);
|
|
25
|
+
if (!TemplateClass)
|
|
26
|
+
throw new Error(`Voxel template with type id [${data.type}] does not exist`);
|
|
27
|
+
return new TemplateClass(data);
|
|
28
|
+
}
|
|
29
|
+
static registerSelection(id, constructor) {
|
|
30
|
+
this._selections.set(id, constructor);
|
|
31
|
+
}
|
|
32
|
+
static createSelection(data) {
|
|
33
|
+
const SelectionClass = this._selections.get(data.type);
|
|
34
|
+
if (!SelectionClass)
|
|
35
|
+
throw new Error(`Voxel template with type id [${data.type}] does not exist`);
|
|
36
|
+
const selection = new SelectionClass();
|
|
37
|
+
selection.fromJSON(data);
|
|
38
|
+
return selection;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
//templates
|
|
42
|
+
VoxelTemplateRegister.register("full", FullVoxelTemplate);
|
|
43
|
+
VoxelTemplateRegister.register("archived", ArchivedVoxelTemplate);
|
|
44
|
+
VoxelTemplateRegister.register("shape", VoxelShapeTemplate);
|
|
45
|
+
VoxelShapeTemplate.Register = VoxelTemplateRegister;
|
|
46
|
+
//selections
|
|
47
|
+
VoxelTemplateRegister.registerSelection("point", VoxelPointSelection);
|
|
48
|
+
VoxelTemplateRegister.registerSelection("bounds", VoxelBoundsSelection);
|
|
49
|
+
VoxelTemplateRegister.registerSelection("bfs", VoxelBFSSelection);
|
|
50
|
+
VoxelTemplateRegister.registerSelection("surface", VoxelSurfaceSelection);
|
|
51
|
+
VoxelTemplateRegister.registerSelection("template", VoxelTemplateSelection);
|
|
52
|
+
VoxelTemplateSelection.Register = VoxelTemplateRegister;
|
|
53
|
+
VoxelTemplateRegister.registerSelection("box-shape", BoxVoxelShapeSelection);
|
|
54
|
+
VoxelTemplateRegister.registerSelection("sphere-shape", SphereVoxelShapeSelection);
|
|
55
|
+
VoxelTemplateRegister.registerSelection("ellipsoid-shape", EllipsoidVoxelShapeSelection);
|
|
56
|
+
VoxelTemplateRegister.registerSelection("pyramid-shape", PyramidVoxelShapeSelection);
|
|
57
|
+
VoxelTemplateRegister.registerSelection("cylinder-shape", CylinderVoxelShapeSelection);
|
|
58
|
+
VoxelTemplateRegister.registerSelection("cone-shape", ConeVoxelShapeSelection);
|
|
59
|
+
VoxelTemplateRegister.registerSelection("octahedron-shape", OctahedronVoxelShapeSelection);
|
|
60
|
+
VoxelTemplateRegister.registerSelection("torus-shape", TorusVoxelShapeSelection);
|
|
@@ -2,23 +2,23 @@ import { Flat3DIndex, Vector3Like } from "@amodx/math";
|
|
|
2
2
|
import { BoundingBox } from "@amodx/math/Geomtry/Bounds/BoundingBox";
|
|
3
3
|
import { RawVoxelData } from "../Voxels/Types/Voxel.types";
|
|
4
4
|
export interface IVoxelTemplate<Type extends string = "", Data extends IVoxelTemplateData<Type> = any> {
|
|
5
|
-
position: Vector3Like;
|
|
6
5
|
bounds: BoundingBox;
|
|
7
6
|
index: Flat3DIndex;
|
|
8
|
-
setPosition(x: number, y: number, z: number): void;
|
|
9
7
|
getIndex(x: number, y: number, z: number): number;
|
|
10
8
|
isAir(index: number): boolean;
|
|
11
9
|
isIncluded(index: number): boolean;
|
|
10
|
+
inBounds(x: number, y: number, z: number): boolean;
|
|
12
11
|
getId(index: number): number;
|
|
13
12
|
getLevel(index: number): number;
|
|
14
13
|
getLight(index: number): number;
|
|
15
14
|
getSecondary(index: number): number;
|
|
15
|
+
clone(): IVoxelTemplate;
|
|
16
16
|
getRaw(index: number, rawRef?: RawVoxelData): RawVoxelData;
|
|
17
17
|
toJSON(): Data;
|
|
18
|
+
fromJSON(data: Data): void;
|
|
18
19
|
}
|
|
19
20
|
export interface IVoxelTemplateData<Type extends string> {
|
|
20
21
|
type: Type;
|
|
21
|
-
position: Vector3Like;
|
|
22
22
|
bounds: Vector3Like;
|
|
23
23
|
}
|
|
24
24
|
export interface IVoxelTemplateConstructor<Type extends string, Data extends IVoxelTemplateData<Type> = any> {
|
|
@@ -6,6 +6,7 @@ export declare class CompiledTexture {
|
|
|
6
6
|
id: string;
|
|
7
7
|
static GetAtlasIndex: (x: number, y: number, boundsX: number) => number;
|
|
8
8
|
static GetAtlasPosition: (index: number, boundsX: number, position?: Vec2Array) => Vec2Array;
|
|
9
|
+
originalImages: HTMLImageElement[];
|
|
9
10
|
images: HTMLImageElement[];
|
|
10
11
|
/**Maps texture ids to their atlas sizes */
|
|
11
12
|
atlasSizeMap: Record<string, [width: number, height: number]>;
|
|
@@ -18,4 +19,5 @@ export declare class CompiledTexture {
|
|
|
18
19
|
constructor(id: string);
|
|
19
20
|
getTextureIndex(id: TextureId): number;
|
|
20
21
|
getTexturePath(id: TextureId): string;
|
|
22
|
+
getTextureData(id: TextureId): Promise<Uint8ClampedArray>;
|
|
21
23
|
}
|
|
@@ -7,6 +7,7 @@ export class CompiledTexture {
|
|
|
7
7
|
position[0] = Math.floor(index % boundsX);
|
|
8
8
|
return position;
|
|
9
9
|
};
|
|
10
|
+
originalImages = [];
|
|
10
11
|
images = [];
|
|
11
12
|
/**Maps texture ids to their atlas sizes */
|
|
12
13
|
atlasSizeMap = {};
|
|
@@ -21,6 +22,9 @@ export class CompiledTexture {
|
|
|
21
22
|
this.animatedTexture = new TextureAnimationTexture(this);
|
|
22
23
|
}
|
|
23
24
|
getTextureIndex(id) {
|
|
25
|
+
if (typeof id == "number") {
|
|
26
|
+
return id;
|
|
27
|
+
}
|
|
24
28
|
let finalId = "";
|
|
25
29
|
let frameIndex = 0;
|
|
26
30
|
if (!Array.isArray(id)) {
|
|
@@ -42,7 +46,7 @@ export class CompiledTexture {
|
|
|
42
46
|
}
|
|
43
47
|
const index = this.textureMap[finalId];
|
|
44
48
|
if (index === undefined) {
|
|
45
|
-
console.warn(`Texture with id [passed in: ${id.toString()}] [final: ${finalId}] does not exist on compiled texture [${this.id}]
|
|
49
|
+
console.warn(`Texture with id [passed in: ${id.toString()}] [final: ${finalId}] does not exist on compiled texture [${this.id}]`, this.textureMap);
|
|
46
50
|
return 0;
|
|
47
51
|
}
|
|
48
52
|
return index + frameIndex;
|
|
@@ -50,4 +54,18 @@ export class CompiledTexture {
|
|
|
50
54
|
getTexturePath(id) {
|
|
51
55
|
return this.images[this.getTextureIndex(id)].src;
|
|
52
56
|
}
|
|
57
|
+
async getTextureData(id) {
|
|
58
|
+
const path = this.originalImages[this.getTextureIndex(id)].src;
|
|
59
|
+
const res = await fetch(path);
|
|
60
|
+
if (!res.ok)
|
|
61
|
+
throw new Error(`Failed to fetch texture: ${path}`);
|
|
62
|
+
const blob = await res.blob();
|
|
63
|
+
const bitmap = await createImageBitmap(blob);
|
|
64
|
+
const canvas = new OffscreenCanvas(bitmap.width, bitmap.height);
|
|
65
|
+
const ctx = canvas.getContext("2d");
|
|
66
|
+
if (!ctx)
|
|
67
|
+
throw new Error("OffscreenCanvas context unavailable");
|
|
68
|
+
ctx.drawImage(bitmap, 0, 0);
|
|
69
|
+
return ctx.getImageData(0, 0, bitmap.width, bitmap.height).data;
|
|
70
|
+
}
|
|
53
71
|
}
|
|
@@ -114,6 +114,17 @@ async function loadImageForShader(imgSrcData) {
|
|
|
114
114
|
};
|
|
115
115
|
});
|
|
116
116
|
}
|
|
117
|
+
async function loadImageForOriginal(imgSrcData) {
|
|
118
|
+
return new Promise((resolve, reject) => {
|
|
119
|
+
const image = typeof imgSrcData === "string" ? new Image() : imgSrcData;
|
|
120
|
+
image.onerror = reject;
|
|
121
|
+
if (typeof imgSrcData === "string")
|
|
122
|
+
image.src = imgSrcData;
|
|
123
|
+
image.onload = () => {
|
|
124
|
+
resolve(image);
|
|
125
|
+
};
|
|
126
|
+
});
|
|
127
|
+
}
|
|
117
128
|
function getImagePath(data, parentId = null) {
|
|
118
129
|
if (data.base64)
|
|
119
130
|
return data.base64;
|
|
@@ -168,11 +179,13 @@ async function process(compiled, data, textureIndex, parent, cache = false) {
|
|
|
168
179
|
}
|
|
169
180
|
if (!data.atlas) {
|
|
170
181
|
compiled.images[textureIndex] = await loadImageForShader(imagePath);
|
|
182
|
+
compiled.originalImages[textureIndex] = await loadImageForOriginal(imagePath);
|
|
171
183
|
return textureIndex + 1;
|
|
172
184
|
}
|
|
173
185
|
const tiles = await sliceImageIntoTiles(imagePath, ...data.atlas.tiles);
|
|
174
186
|
for (let i = 0; i < tiles.length; i++) {
|
|
175
187
|
compiled.images[textureIndex + i] = await loadImageForShader(tiles[i]);
|
|
188
|
+
compiled.originalImages[textureIndex + i] = await loadImageForOriginal(tiles[i]);
|
|
176
189
|
}
|
|
177
190
|
compiled.atlasSizeMap[textureId] = data.atlas.tiles;
|
|
178
191
|
if (data.animated) {
|
|
@@ -5,6 +5,7 @@ import type { TextureData } from "./Texture.types";
|
|
|
5
5
|
export declare class TextureManager {
|
|
6
6
|
static _textureTypes: Map<string, TextureData[]>;
|
|
7
7
|
static _compiledTextures: Map<string, CompiledTexture>;
|
|
8
|
+
static addTextureType(typeId: string): TextureData[];
|
|
8
9
|
static registerTexture(textureData: TextureData[]): void;
|
|
9
10
|
static getTexture(id: string): CompiledTexture;
|
|
10
11
|
static compiledTextures(props?: Omit<BuildTextureDataProps, "textures" | "type">, progress?: WorkItemProgress): Promise<void>;
|
|
@@ -7,14 +7,18 @@ const missingTexture = {
|
|
|
7
7
|
export class TextureManager {
|
|
8
8
|
static _textureTypes = new Map();
|
|
9
9
|
static _compiledTextures = new Map();
|
|
10
|
+
static addTextureType(typeId) {
|
|
11
|
+
let type = this._textureTypes.get(typeId);
|
|
12
|
+
if (!type) {
|
|
13
|
+
type = [missingTexture];
|
|
14
|
+
this._textureTypes.set(typeId, type);
|
|
15
|
+
}
|
|
16
|
+
return type;
|
|
17
|
+
}
|
|
10
18
|
static registerTexture(textureData) {
|
|
11
19
|
for (const texture of textureData) {
|
|
12
20
|
const typeId = texture.type || "dve_voxel";
|
|
13
|
-
let type = this.
|
|
14
|
-
if (!type) {
|
|
15
|
-
type = [missingTexture];
|
|
16
|
-
this._textureTypes.set(typeId, type);
|
|
17
|
-
}
|
|
21
|
+
let type = this.addTextureType(typeId);
|
|
18
22
|
type.push(texture);
|
|
19
23
|
}
|
|
20
24
|
}
|
|
@@ -37,3 +41,5 @@ export class TextureManager {
|
|
|
37
41
|
}
|
|
38
42
|
}
|
|
39
43
|
}
|
|
44
|
+
TextureManager.addTextureType("dve_item");
|
|
45
|
+
TextureManager.addTextureType("dve_voxel");
|
package/Tools/Brush/Brush.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ import { VoxelCursor } from "../../Voxels/Cursor/VoxelCursor.js";
|
|
|
4
4
|
import { IVoxelTemplate } from "../../Templates/VoxelTemplates.types.js";
|
|
5
5
|
import { PaintVoxelData } from "../../Voxels/Types/PaintVoxelData.js";
|
|
6
6
|
import { VoxelPathData } from "../../Templates/Path/VoxelPath.types.js";
|
|
7
|
+
import { IVoxelSelection } from "../../Templates/Selection/VoxelSelection.js";
|
|
7
8
|
export declare class BrushTool {
|
|
8
9
|
data: PaintVoxelData;
|
|
9
10
|
dimension: number;
|
|
@@ -34,6 +35,7 @@ export declare class BrushTool {
|
|
|
34
35
|
paintPath(data: VoxelPathData): void;
|
|
35
36
|
erase(): this;
|
|
36
37
|
eraseTemplate(voxelTemplate: IVoxelTemplate): void;
|
|
38
|
+
eraseSelection(selection: IVoxelSelection): void;
|
|
37
39
|
erasePath(data: VoxelPathData): void;
|
|
38
40
|
start(dimension: number, x: number, y: number, z: number): this;
|
|
39
41
|
stop(): this;
|
package/Tools/Brush/Brush.js
CHANGED
|
@@ -5,6 +5,7 @@ import { VoxelPalettesRegister } from "../../Voxels/Data/VoxelPalettesRegister.j
|
|
|
5
5
|
import { PaintVoxelData } from "../../Voxels/Types/PaintVoxelData.js";
|
|
6
6
|
const air = [0, 0, 0, 0];
|
|
7
7
|
const temp = [0, 0, 0, 0];
|
|
8
|
+
PaintVoxelData.Set;
|
|
8
9
|
export class BrushTool {
|
|
9
10
|
data = PaintVoxelData.Create();
|
|
10
11
|
dimension = 0;
|
|
@@ -199,6 +200,24 @@ export class BrushTool {
|
|
|
199
200
|
}
|
|
200
201
|
}
|
|
201
202
|
}
|
|
203
|
+
eraseSelection(selection) {
|
|
204
|
+
const { x: ox, y: oy, z: oz } = selection.origin;
|
|
205
|
+
const { x: sx, y: sy, z: sz } = selection.bounds.size;
|
|
206
|
+
for (let x = 0; x < sx; x++) {
|
|
207
|
+
for (let y = 0; y < sy; y++) {
|
|
208
|
+
for (let z = 0; z < sz; z++) {
|
|
209
|
+
const tx = ox + x;
|
|
210
|
+
const ty = oy + y;
|
|
211
|
+
const tz = oz + z;
|
|
212
|
+
if (!this.dataCursor.inBounds(tx, ty, tz))
|
|
213
|
+
continue;
|
|
214
|
+
if (!selection.isSelected(tx, ty, tz))
|
|
215
|
+
continue;
|
|
216
|
+
this.setXYZ(x, y, z).erase();
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
}
|
|
202
221
|
erasePath(data) {
|
|
203
222
|
throw new Error("Erase path not implemented.");
|
|
204
223
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Thread, ThreadPool } from "@amodx/threads/";
|
|
2
|
-
import { PaintVoxelTemplateTask, PaintVoxelTask, EraseVoxelTask, EraseVoxelTemplateTask, PaintVoxelPathTask, EraseVoxelPathTask } from "../../Tasks/Tasks.types";
|
|
2
|
+
import { PaintVoxelTemplateTask, PaintVoxelTask, EraseVoxelTask, EraseVoxelTemplateTask, PaintVoxelPathTask, EraseVoxelPathTask, EraseVoxelSelectionTask } from "../../Tasks/Tasks.types";
|
|
3
3
|
import { LocationData } from "../../Math";
|
|
4
4
|
import { SectionSnapShotTransferData } from "../../World/SnapShot/SectionSnapShot";
|
|
5
5
|
export type TaskRunModes = "async" | "sync";
|
|
@@ -39,6 +39,7 @@ declare class VoxelTasks {
|
|
|
39
39
|
paintPath: TaskToolTask<PaintVoxelPathTask>;
|
|
40
40
|
erase: TaskToolTask<EraseVoxelTask>;
|
|
41
41
|
eraseTemplate: TaskToolTask<EraseVoxelTemplateTask>;
|
|
42
|
+
eraseSelection: TaskToolTask<EraseVoxelSelectionTask>;
|
|
42
43
|
erasePath: TaskToolTask<EraseVoxelPathTask>;
|
|
43
44
|
constructor(tool: TaskTool);
|
|
44
45
|
}
|
package/Tools/Tasks/TasksTool.js
CHANGED
|
@@ -95,6 +95,7 @@ class VoxelTasks {
|
|
|
95
95
|
paintPath;
|
|
96
96
|
erase;
|
|
97
97
|
eraseTemplate;
|
|
98
|
+
eraseSelection;
|
|
98
99
|
erasePath;
|
|
99
100
|
constructor(tool) {
|
|
100
101
|
this.tool = tool;
|
|
@@ -103,6 +104,7 @@ class VoxelTasks {
|
|
|
103
104
|
this.paintPath = new TaskToolTask(TasksIds.PaintVoxelPath, tool.generators);
|
|
104
105
|
this.erase = new TaskToolTask(TasksIds.EraseVoxel, tool.generators);
|
|
105
106
|
this.eraseTemplate = new TaskToolTask(TasksIds.EraseVoxelTemplate, tool.generators);
|
|
107
|
+
this.eraseSelection = new TaskToolTask(TasksIds.EraseVoxelSelection, tool.generators);
|
|
106
108
|
this.erasePath = new TaskToolTask(TasksIds.EraseVoxelPath, tool.generators);
|
|
107
109
|
}
|
|
108
110
|
}
|
|
@@ -2,4 +2,4 @@ import { BinaryBufferFormat } from "../BinaryBuffer.types";
|
|
|
2
2
|
export declare function DetermineSubByteArrayForBinaryBuffer(paletteSize: number): BinaryBufferFormat | null;
|
|
3
3
|
export declare function GetConvertedBinaryBufferSize(source: Uint8Array | Uint16Array, format: BinaryBufferFormat): number;
|
|
4
4
|
export declare function GetBinaryBufferIndexLength(source: Uint8Array | Uint16Array, format: BinaryBufferFormat): number;
|
|
5
|
-
export declare function ConvertBinaryBuffer(source: Uint8Array | Uint16Array, sourceType: BinaryBufferFormat, destinationType: BinaryBufferFormat):
|
|
5
|
+
export declare function ConvertBinaryBuffer(source: Uint8Array | Uint16Array, sourceType: BinaryBufferFormat, destinationType: BinaryBufferFormat): Uint8Array<ArrayBuffer> | Uint16Array<ArrayBuffer>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { BinaryBufferData } from "../BinaryBuffer.types";
|
|
2
|
-
export default function BinaryBufferToTypedArray(buffer: BinaryBufferData): Uint16Array | Uint8Array | undefined;
|
|
2
|
+
export default function BinaryBufferToTypedArray(buffer: BinaryBufferData): Uint16Array<ArrayBuffer | SharedArrayBuffer> | Uint8Array<ArrayBuffer | SharedArrayBuffer> | undefined;
|
package/Util/LocationData.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { LocationData } from "Math";
|
|
2
2
|
export declare function getLocationData(view: DataView, location?: LocationData): LocationData;
|
|
3
|
-
export declare function setLocationData(view: DataView, location: LocationData): DataView
|
|
3
|
+
export declare function setLocationData(view: DataView, location: LocationData): DataView<ArrayBufferLike>;
|
|
@@ -1,5 +1,9 @@
|
|
|
1
|
+
import { BoundingBox } from "@amodx/math/Geomtry/Bounds/BoundingBox";
|
|
1
2
|
import { VoxelCursorInterface } from "./VoxelCursor.interface";
|
|
3
|
+
import { Vector3Like } from "@amodx/math";
|
|
2
4
|
export interface DataCursorInterface {
|
|
5
|
+
volumeBounds: BoundingBox;
|
|
6
|
+
volumePosition?: Vector3Like;
|
|
3
7
|
getVoxel(x: number, y: number, z: number): VoxelCursorInterface | null;
|
|
4
8
|
inBounds(x: number, y: number, z: number): boolean;
|
|
5
9
|
clone(): DataCursorInterface;
|
|
@@ -53,8 +53,10 @@ export declare abstract class VoxelCursorInterface {
|
|
|
53
53
|
isRenderable(): boolean;
|
|
54
54
|
isAir(): boolean;
|
|
55
55
|
setAir(): this;
|
|
56
|
+
/**Get the voxels palette id. The id is the combination of the true id, state, and mod. */
|
|
56
57
|
getId(): number;
|
|
57
58
|
setId(id: number): this;
|
|
59
|
+
/**Get the true voxel id. Meaning the numeric id for the string id of the voxel */
|
|
58
60
|
getVoxelId(): number;
|
|
59
61
|
setVoxelId(id: number, state?: number, mod?: number): this;
|
|
60
62
|
setStringId(id: string, state?: number, mod?: number): this;
|
|
@@ -173,6 +173,7 @@ export class VoxelCursorInterface {
|
|
|
173
173
|
this.ids[this._index] = 0;
|
|
174
174
|
return this;
|
|
175
175
|
}
|
|
176
|
+
/**Get the voxels palette id. The id is the combination of the true id, state, and mod. */
|
|
176
177
|
getId() {
|
|
177
178
|
if (this.__readingSecondaryVoxel) {
|
|
178
179
|
return this.secondaryId;
|
|
@@ -187,6 +188,7 @@ export class VoxelCursorInterface {
|
|
|
187
188
|
this.ids[this._index] = id;
|
|
188
189
|
return this;
|
|
189
190
|
}
|
|
191
|
+
/**Get the true voxel id. Meaning the numeric id for the string id of the voxel */
|
|
190
192
|
getVoxelId() {
|
|
191
193
|
return this.getIndexData()[0];
|
|
192
194
|
}
|
|
@@ -31,7 +31,7 @@ export function BuildTagAndPaletteData(props) {
|
|
|
31
31
|
}
|
|
32
32
|
for (const tag of VoxelTagsRegister.IncludedVoxelTags) {
|
|
33
33
|
if (voxel.properties[tag] === undefined) {
|
|
34
|
-
tags[tag] = VoxelTagsRegister.VoxelTagDefaults[tag]
|
|
34
|
+
tags[tag] = VoxelTagsRegister.VoxelTagDefaults[tag] ?? false;
|
|
35
35
|
continue;
|
|
36
36
|
}
|
|
37
37
|
if (props?.voxelsOverrides?.[tag]) {
|
|
@@ -33,6 +33,7 @@ export declare class VoxelIndex {
|
|
|
33
33
|
stateArray: VoxelNamedStateContainer[];
|
|
34
34
|
tagIndexes: Map<string, TagIndex>;
|
|
35
35
|
constructor(data: VoxelData[]);
|
|
36
|
+
private findState;
|
|
36
37
|
getStateFromPaintData(data: PaintVoxelData): VoxelNamedState | false;
|
|
37
38
|
getStateFromRawData(data: RawVoxelData): VoxelNamedState | false;
|
|
38
39
|
}
|
|
@@ -104,11 +104,7 @@ export class VoxelIndex {
|
|
|
104
104
|
}
|
|
105
105
|
}
|
|
106
106
|
}
|
|
107
|
-
|
|
108
|
-
const conatiner = this.states.get(data.id);
|
|
109
|
-
if (!conatiner)
|
|
110
|
-
return false;
|
|
111
|
-
const { mod, state } = data;
|
|
107
|
+
findState(conatiner, mod, state) {
|
|
112
108
|
for (const modelState of conatiner?.stateArray) {
|
|
113
109
|
if ((mod == modelState.compiled.mod || modelState.compiled.modAny) &&
|
|
114
110
|
(state == modelState.compiled.state || modelState.compiled.stateAny))
|
|
@@ -116,17 +112,19 @@ export class VoxelIndex {
|
|
|
116
112
|
}
|
|
117
113
|
return false;
|
|
118
114
|
}
|
|
115
|
+
getStateFromPaintData(data) {
|
|
116
|
+
const conatiner = this.states.get(data.id);
|
|
117
|
+
if (!conatiner)
|
|
118
|
+
return false;
|
|
119
|
+
const { mod, state } = data;
|
|
120
|
+
return this.findState(conatiner, mod, state);
|
|
121
|
+
}
|
|
119
122
|
getStateFromRawData(data) {
|
|
120
123
|
const [id, light, secondary] = data;
|
|
121
|
-
const [,
|
|
122
|
-
const conatiner = this.states.get(VoxelPalettesRegister.voxelIds.getStringId(
|
|
124
|
+
const [trueId, state, mod] = VoxelPalettesRegister.voxels[id];
|
|
125
|
+
const conatiner = this.states.get(VoxelPalettesRegister.voxelIds.getStringId(trueId));
|
|
123
126
|
if (!conatiner)
|
|
124
127
|
return false;
|
|
125
|
-
|
|
126
|
-
if ((mod == modelState.compiled.mod || modelState.compiled.modAny) &&
|
|
127
|
-
(state == modelState.compiled.state || modelState.compiled.stateAny))
|
|
128
|
-
return modelState;
|
|
129
|
-
}
|
|
130
|
-
return false;
|
|
128
|
+
return this.findState(conatiner, mod, state);
|
|
131
129
|
}
|
|
132
130
|
}
|