public bool SafeWrite(BSVoxel voxel, int x, int y, int z, int lod = 0)
    {
        if (voxelWrite != null)
        {
            voxelWrite.Invoke(new int[] { x, y, z });
        }

        return(Block45Man.self.DataSource.SafeWrite(voxel.ToBlock(), x, y, z, lod));
    }
    public BSVoxel Add(BSVoxel voxel, int x, int y, int z, int lod = 0)
    {
        if ((voxel.value0 >> 2) == 0)
        {
            return(new BSVoxel(Block45Man.self.DataSource.Read(x, y, z)));
        }
        Block45Man.self.DataSource.Write(voxel.ToBlock(), x, y, z, lod);

        return(voxel);
    }
Beispiel #3
0
    bool OnCanClickSaveBtn()
    {
        if (PEBuildingMan.Self == null)
        {
            return(true);
        }


        if (!PEBuildingMan.Self.selectVoxel)
        {
            BSSelectBrush select_brush = m_CurBrush as BSSelectBrush;

            if (select_brush != null)
            {
                if (!select_brush.IsEmpty())
                {
                    PEBuildingMan.Self.IsoCaputure.Computer.ClearDataDS();
                    foreach (var kvp in select_brush.Selections)
                    {
                        BSVoxel voxel = BuildingMan.Blocks.Read(kvp.Key.x, kvp.Key.y, kvp.Key.z);
                        PEBuildingMan.Self.IsoCaputure.Computer.AlterBlockInBuild(kvp.Key.x, kvp.Key.y, kvp.Key.z, voxel.ToBlock());
                    }

                    PEBuildingMan.Self.IsoCaputure.Computer.RebuildMesh();
                    PEBuildingMan.Self.IsoCaputure.EnableCapture();

                    mSaveWnd.SetIsoItemContent(PEBuildingMan.Self.IsoCaputure.photoRT);
                    select_brush.canDo = false;
                    return(true);
                }
            }

            BSIsoSelectBrush iso_select = m_CurBrush as BSIsoSelectBrush;
            //BSIsoSelectBrush iso_select = PEBuildingMan.Self.Manipulator.activeBrush as BSIsoSelectBrush;
            if (iso_select != null)
            {
                List <IntVector3> voxels = iso_select.GetSelectionPos();
                if (voxels.Count != 0)
                {
                    PEBuildingMan.Self.IsoCaputure.Computer.ClearDataDS();
                    for (int i = 0; i < voxels.Count; i++)
                    {
                        BSVoxel voxel = BuildingMan.Blocks.Read(voxels[i].x, voxels[i].y, voxels[i].z);
                        PEBuildingMan.Self.IsoCaputure.Computer.AlterBlockInBuild(voxels[i].x, voxels[i].y, voxels[i].z, voxel.ToBlock());
                    }

                    PEBuildingMan.Self.IsoCaputure.Computer.RebuildMesh();
                    PEBuildingMan.Self.IsoCaputure.EnableCapture();

                    mSaveWnd.SetIsoItemContent(PEBuildingMan.Self.IsoCaputure.photoRT);
                    return(true);
                }
            }
        }

        return(false);
    }