예제 #1
0
파일: Planet.cs 프로젝트: crissian/planets
        /// <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();
        }
예제 #2
0
파일: Planet.cs 프로젝트: crissian/planets
        /// <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();
        }
예제 #3
0
        /// <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;
            }
        }
예제 #4
0
 /// <summary>
 /// Crée et retourne la ressource fille correspondant à la cellule parent passée en argument.
 /// </summary>
 /// <returns></returns>
 public abstract QuadTreeCellRessource Subdivide(QuadTreeCell parentCells);
예제 #5
0
 /// <summary>
 /// Crée une nouvelle instance de QuadTreeCellRessource ayant pour parant la cellule précisée.
 /// </summary>
 /// <param name="parentCell"></param>
 public QuadTreeCellRessource(QuadTreeCell parentCell)
 {
     Parent = parentCell;
 }
예제 #6
0
 /// <summary>
 /// Crée une nouvelle instance de PlanetCell.
 /// </summary>
 public TerrainRessource(QuadTreeCell parent)
     : base(parent)
 {
     m_genTask = new PlanetCellGenerationTask();
     InitializeEffect();
 }
예제 #7
0
 /// <summary>
 /// Crée la ressource fille correspondant à la cellule mère passée en argument.
 /// </summary>
 public override QuadTreeCellRessource Subdivide(QuadTreeCell parentCells)
 {
     return new TerrainRessource(parentCells);
 }
예제 #8
0
 /// <summary>
 /// Crée une nouvelle instance de PlanetCell.
 /// </summary>
 public TerrainRessource(QuadTreeCell parent) : base(parent)
 {
     m_genTask = new PlanetCellGenerationTask();
     InitializeEffect();
 }
예제 #9
0
 /// <summary>
 /// Crée la ressource fille correspondant à la cellule mère passée en argument.
 /// </summary>
 public override QuadTreeCellRessource Subdivide(QuadTreeCell parentCells)
 {
     return(new TerrainRessource(parentCells));
 }
예제 #10
0
 /// <summary>
 /// Crée et retourne la ressource fille correspondant à la cellule parent passée en argument.
 /// </summary>
 /// <returns></returns>
 public abstract QuadTreeCellRessource Subdivide(QuadTreeCell parentCells);
예제 #11
0
 /// <summary>
 /// Crée une nouvelle instance de QuadTreeCellRessource ayant pour parant la cellule précisée.
 /// </summary>
 /// <param name="parentCell"></param>
 public QuadTreeCellRessource(QuadTreeCell parentCell)
 {
     Parent = parentCell;
 }
예제 #12
0
 /// <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;
     }
 }