planetgrid.h
上传用户:center1979
上传日期:2022-07-26
资源大小:50633k
文件大小:2k
源码类别:

OpenGL

开发平台:

Visual C++

  1. // planetgrid.h
  2. //
  3. // Longitude/latitude grids for ellipsoidal bodies.
  4. //
  5. // Copyright (C) 2008, the Celestia Development Team
  6. // Initial version by Chris Laurel, claurel@gmail.com
  7. //
  8. // This program is free software; you can redistribute it and/or
  9. // modify it under the terms of the GNU General Public License
  10. // as published by the Free Software Foundation; either version 2
  11. // of the License, or (at your option) any later version.
  12. #ifndef _CELENGINE_PLANETGRID_H_
  13. #define _CELENGINE_PLANETGRID_H_
  14. #include <celengine/referencemark.h>
  15. class Body;
  16. class PlanetographicGrid : public ReferenceMark
  17. {
  18. public:
  19.     /*! Three different longitude conventions are in use for
  20.      *  solar system bodies:
  21.      *      Westward is for prograde rotators (rotation pole above the ecliptic)
  22.      *      Eastward is for retrograde rotators
  23.      *      EastWest measures longitude both east and west, and is used only
  24.      *         for the Earth and Moon (strictly because of convention.)
  25.      */
  26.     enum LongitudeConvention
  27.     {
  28.         EastWest,
  29.         Westward,
  30.         Eastward,
  31.     };
  32.     /*! NorthReversed indicates that the north pole for this body is /not/
  33.      *  the rotation north. It should be set for retrograde rotators in
  34.      *  order to conform with IAU conventions.
  35.      */
  36.     enum NorthDirection
  37.     {
  38.         NorthNormal,
  39.         NorthReversed
  40.     };
  41.     PlanetographicGrid(const Body& _body);
  42.     ~PlanetographicGrid();
  43.     void render(Renderer* renderer,
  44.                 const Point3f& pos,
  45.                 float discSizeInPixels,
  46.                 double tdb) const;
  47.     float boundingSphereRadius() const;
  48.     void setIAULongLatConvention();
  49. private:
  50.     static void InitializeGeometry();
  51. private:
  52.     const Body& body;
  53.     float minLongitudeStep;
  54.     float minLatitudeStep;
  55.     LongitudeConvention longitudeConvention;
  56.     NorthDirection northDirection;
  57.     static unsigned int circleSubdivisions;
  58.     static float* xyCircle;
  59.     static float* xzCircle;
  60. };
  61. #endif // _CELENGINE_PLANETGRID_H_