/// <summary> /// Crée une nouvelle instance de Planet. /// </summary> public Planet() { LoadGraphics(); // m_planet = new PlanetCell(Vector3.Zero, new Vector2(0, 0), 1.0f, new Vector3(40000, 40000, -20f), 45087027, false, 0); m_mainCell = new QuadTreeCell(Vector3.Zero, new Vector2(0, 0), 1.0f, new Vector3(40, 40, -0.020f), 45087027, 0, PlanetRadius); m_mainCell.Ressources.Add(new TerrainRessource(m_mainCell)); //m_mainCell.Ressources.Add(new WaterRessource(m_mainCell)); // m_mainCell.Ressources.Add(new AtmosphereRessource(m_mainCell)); m_mainCell.InitializeRessources(); m_atmosphere = new Objects.Atmosphere(); m_ocean = new Objects.Ocean(); }
/// <summary> /// Initialise les cellules de l'étage inférieur du quadtree. /// </summary> void CreateSubCells() { float newScale = m_scale / 2; for (int i = 0; i < 4; i++) { int x = i % 2; int y = i / 2; Vector2 cellPos = new Vector2(m_gridPosition.X + x * newScale, m_gridPosition.Y + y * newScale); QuadTreeCell newCell = new QuadTreeCell(m_planetPosition, cellPos, newScale, m_globalScale, m_seed, m_depth + 1, m_planetRadius); foreach (QuadTreeCellRessource rsc in m_ressources) { newCell.Ressources.Add(rsc.Subdivide(newCell)); } newCell.InitializeRessources(); m_subCells[i] = newCell; } }
/// <summary> /// Initialise les cellules de l'étage inférieur du quadtree. /// </summary> void CreateSubCells() { float newScale = m_scale / 2; for(int i = 0; i < 4; i++) { int x = i % 2; int y = i / 2; Vector2 cellPos = new Vector2(m_gridPosition.X + x * newScale, m_gridPosition.Y + y * newScale); QuadTreeCell newCell = new QuadTreeCell(m_planetPosition, cellPos, newScale, m_globalScale, m_seed, m_depth + 1, m_planetRadius); foreach(QuadTreeCellRessource rsc in m_ressources) { newCell.Ressources.Add(rsc.Subdivide(newCell)); } newCell.InitializeRessources(); m_subCells[i] = newCell; } }