/// <summary>
 ///   Create a new walker state.
 /// </summary>
 /// <param name="node"></param>
 public WalkerMapState(IMapVoxelMesh node)
 {
   this._node = node;
   this._nodeKeys = this._node.Keys();
   this._location = VoxelLocation.Zero;
   this._lastKey = null;
 }
 /// <summary>
 ///   Create a copy of an existing class.
 /// </summary>
 /// <param name="toCopy"></param>
 public WalkerMapState(WalkerMapState toCopy)
 {
   this._node = toCopy._node;
   this._nodeKeys = new HashSet<VoxelLocation>(toCopy._nodeKeys);
   this._location = new VoxelLocation(toCopy._location);
   this._lastKey = null;
 }
    public void TranslateMap(VoxelLocation start, IMapVoxelMesh map)
    {

      VoxelLocation chunckStart = new VoxelLocation();
      foreach (VoxelLocation chunckLocation in map.Keys())
      {
        IVoxelMesh chunck = map.GetChild(chunckLocation);
        chunckStart.Set(chunckLocation).Mul(map.ChildWidth, map.ChildHeight, map.ChildDepth);
        
        if (chunck is IOctreeVoxelMesh)
        {
          this.TranslateTree(chunckStart, (IOctreeVoxelMesh)chunck);
        }
        else
        {
          this.TranslateLeaf(chunckStart, chunck);
        }
      }
    }
    public void DebugMap(VoxelLocation start, IMapVoxelMesh map, int startDeep, int endDeep)
    {
      this.DebugLeaf(start, map, startDeep, endDeep);

      VoxelLocation chunckStart = new VoxelLocation();
      foreach (VoxelLocation chunckLocation in map.Keys())
      {
        IVoxelMesh chunck = map.GetChild(chunckLocation);
        chunckStart.Set(chunckLocation).Mul(map.ChildWidth, map.ChildHeight, map.ChildDepth);

        if (chunck is IOctreeVoxelMesh)
        {
          this.DebugTree(chunckStart, (IOctreeVoxelMesh)chunck, startDeep - 1, endDeep - 1);
        }
        else
        {
          this.DebugLeaf(chunckStart, chunck, startDeep - 1, endDeep - 1);
        }
      }
    }