public QuadTree(QuadTree parent) { this.parent = parent; }
public QuadTreeZ(QuadTree parent, TerrainQuad quad) : base(parent) { this.quad = quad; readBack = false; }
protected override void GetTiles(QuadTree parent, ref QuadTree tree, TerrainQuad quad) { if (tree == null) { tree = new QuadTreeZ(parent, quad); tree.needTile = NeedTile(quad); } QuadTreeZ t = tree as QuadTreeZ; //If tile needs elevation data read back add to container if(t.tile != null && t.tile.GetTask().IsDone() && !t.readBack && m_maxReadBacksPerFrame > 0) { if(!m_needReadBack.ContainsKey(t.tile.GetId())) { t.readBack = true; m_needReadBack.Add(t.tile.GetId(), t); } } base.GetTiles(parent, ref tree, quad); //Check if this quad is below the camera. If so store a reference to it. if (m_cameraQuad == null && t.tile != null && t.tile.GetTask().IsDone()) { Vector3d2 c = quad.GetOwner().GetLocalCameraPos(); double l = quad.GetLength(); double ox = quad.GetOX(); double oy = quad.GetOY(); if (c.x >= ox && c.x < ox + l && c.y >= oy && c.y < oy + l) { m_cameraQuadCoords = new Vector2((float)((c.x - ox) / l), (float)((c.y - oy) / l)); m_cameraQuad = t; } } }