Exemplo n.º 1
0
 public void SetBlockAt(int x, int y, int z, BlockInternal mat)
 {
     if (SucceededBy != null)
     {
         SucceededBy.SetBlockAt(x, y, z, mat);
     }
     BlocksInternal[BlockIndex(x, y, z)] = mat;
 }
Exemplo n.º 2
0
        /// <summary>
        /// Internal region call only.
        /// </summary>
        public void MakeVBONow()
        {
            if (SucceededBy != null)
            {
                SucceededBy.MakeVBONow();
                return;
            }
            Chunk        c_zp       = OwningRegion.GetChunk(WorldPosition + new Vector3i(0, 0, 1));
            Chunk        c_zm       = OwningRegion.GetChunk(WorldPosition + new Vector3i(0, 0, -1));
            Chunk        c_yp       = OwningRegion.GetChunk(WorldPosition + new Vector3i(0, 1, 0));
            Chunk        c_ym       = OwningRegion.GetChunk(WorldPosition + new Vector3i(0, -1, 0));
            Chunk        c_xp       = OwningRegion.GetChunk(WorldPosition + new Vector3i(1, 0, 0));
            Chunk        c_xm       = OwningRegion.GetChunk(WorldPosition + new Vector3i(-1, 0, 0));
            Chunk        c_zpxp     = OwningRegion.GetChunk(WorldPosition + new Vector3i(0, 1, 1));
            Chunk        c_zpxm     = OwningRegion.GetChunk(WorldPosition + new Vector3i(0, -1, 1));
            Chunk        c_zpyp     = OwningRegion.GetChunk(WorldPosition + new Vector3i(1, 0, 1));
            Chunk        c_zpym     = OwningRegion.GetChunk(WorldPosition + new Vector3i(-1, 0, 1));
            List <Chunk> potentials = new List <Chunk>();

            for (int x = -1; x <= 1; x++)
            {
                for (int y = -1; y <= 1; y++)
                {
                    for (int z = -1; z <= 1; z++)
                    {
                        Chunk tch = OwningRegion.GetChunk(WorldPosition + new Vector3i(x, y, z));
                        if (tch != null)
                        {
                            potentials.Add(tch);
                        }
                    }
                }
            }
            Action a = () => VBOHInternal(c_zp, c_zm, c_yp, c_ym, c_xp, c_xm, c_zpxp, c_zpxm, c_zpyp, c_zpym, potentials);

            if (rendering != null)
            {
                ASyncScheduleItem item = OwningRegion.TheClient.Schedule.AddASyncTask(a);
                rendering = rendering.ReplaceOrFollowWith(item);
            }
            else
            {
                rendering = OwningRegion.TheClient.Schedule.StartASyncTask(a);
            }
        }