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

OpenGL

开发平台:

Visual C++

  1. // render.h
  2. //
  3. // Copyright (C) 2001-2008, Celestia Development Team
  4. // Contact: Chris Laurel <claurel@gmail.com>
  5. //
  6. // This program is free software; you can redistribute it and/or
  7. // modify it under the terms of the GNU General Public License
  8. // as published by the Free Software Foundation; either version 2
  9. // of the License, or (at your option) any later version.
  10. #ifndef _CELENGINE_RENDER_H_
  11. #define _CELENGINE_RENDER_H_
  12. #include <vector>
  13. #include <list>
  14. #include <string>
  15. #include <celmath/frustum.h>
  16. #include <celengine/observer.h>
  17. #include <celengine/universe.h>
  18. #include <celengine/selection.h>
  19. #include <celengine/glcontext.h>
  20. #include <celengine/starcolors.h>
  21. #include <celengine/rendcontext.h>
  22. #include <celtxf/texturefont.h>
  23. class RendererWatcher;
  24. class FrameTree;
  25. class ReferenceMark;
  26. struct LightSource
  27. {
  28.     Vec3d position;
  29.     Color color;
  30.     float luminosity;
  31.     float radius;
  32. };
  33. struct RenderListEntry
  34. {
  35.     enum RenderableType
  36.     {
  37.         RenderableStar,
  38.         RenderableBody,
  39.         RenderableCometTail,
  40.         RenderableReferenceMark,
  41.     };
  42.     union
  43.     {
  44.         const Star* star;
  45.         Body* body;
  46.         const ReferenceMark* refMark;
  47.     };
  48.     Point3f position;
  49.     Vec3f sun;
  50.     float distance;
  51.     float radius;
  52.     float centerZ;
  53.     float nearZ;
  54.     float farZ;
  55.     float discSizeInPixels;
  56.     float appMag;
  57.     RenderableType renderableType;
  58.     bool isOpaque;
  59.     //std::vector<LightSource>* lightSourceList;
  60. };
  61. struct SecondaryIlluminator
  62. {
  63.     const Body* body;
  64.     Vec3d position_v;       // viewer relative position
  65.     float radius;           // radius in km
  66.     float reflectedIrradiance;  // albedo times total irradiance from direct sources
  67. };
  68. class Renderer
  69. {
  70.  public:
  71.     Renderer();
  72.     ~Renderer();
  73.     struct DetailOptions
  74.     {
  75.         DetailOptions();
  76.         unsigned int ringSystemSections;
  77.         unsigned int orbitPathSamplePoints;
  78.         unsigned int shadowTextureSize;
  79.         unsigned int eclipseTextureSize;
  80.     };
  81.     bool init(GLContext*, int, int, DetailOptions&);
  82.     void shutdown() {};
  83.     void resize(int, int);
  84.     float calcPixelSize(float fov, float windowHeight);
  85.     void setFaintestAM45deg(float);
  86.     float getFaintestAM45deg() const;
  87.     void setRenderMode(int);
  88.     void autoMag(float& faintestMag);
  89.     void render(const Observer&,
  90.                 const Universe&,
  91.                 float faintestVisible,
  92.                 const Selection& sel);
  93.     void draw(const Observer&,
  94.               const Universe&,
  95.               float faintestVisible,
  96.               const Selection& sel);
  97.     enum {
  98.         NoLabels            = 0x000,
  99.         StarLabels          = 0x001,
  100.         PlanetLabels        = 0x002,
  101.         MoonLabels          = 0x004,
  102.         ConstellationLabels = 0x008,
  103.         GalaxyLabels        = 0x010,
  104.         AsteroidLabels      = 0x020,
  105.         SpacecraftLabels    = 0x040,
  106.         LocationLabels      = 0x080,
  107.         CometLabels         = 0x100,
  108.         NebulaLabels        = 0x200,
  109.         OpenClusterLabels   = 0x400,
  110.         I18nConstellationLabels = 0x800,
  111.         DwarfPlanetLabels   = 0x1000,
  112.         MinorMoonLabels     = 0x2000,
  113. GlobularLabels      = 0x4000,         
  114. BodyLabelMask       = (PlanetLabels | DwarfPlanetLabels | MoonLabels | MinorMoonLabels | AsteroidLabels | SpacecraftLabels | CometLabels),    
  115. };
  116.     enum {
  117.         ShowNothing         =   0x0000,
  118.         ShowStars           =   0x0001,
  119.         ShowPlanets         =   0x0002,
  120.         ShowGalaxies        =   0x0004,
  121.         ShowDiagrams        =   0x0008,
  122.         ShowCloudMaps       =   0x0010,
  123.         ShowOrbits          =   0x0020,
  124.         ShowCelestialSphere =   0x0040,
  125.         ShowNightMaps       =   0x0080,
  126.         ShowAtmospheres     =   0x0100,
  127.         ShowSmoothLines     =   0x0200,
  128.         ShowEclipseShadows  =   0x0400,
  129.         ShowStarsAsPoints   =   0x0800,
  130.         ShowRingShadows     =   0x1000,
  131.         ShowBoundaries      =   0x2000,
  132.         ShowAutoMag         =   0x4000,
  133.         ShowCometTails      =   0x8000,
  134.         ShowMarkers         =  0x10000,
  135.         ShowPartialTrajectories = 0x20000,
  136.         ShowNebulae         =  0x40000,
  137.         ShowOpenClusters    =  0x80000,
  138. ShowGlobulars       =  0x100000,         
  139. ShowCloudShadows    =  0x200000,
  140.         ShowGalacticGrid    =  0x400000,
  141.         ShowEclipticGrid    =  0x800000,
  142.         ShowHorizonGrid     = 0x1000000,
  143.         ShowEcliptic        = 0x2000000,
  144.     };
  145.     enum StarStyle 
  146.     {
  147.         FuzzyPointStars  = 0,
  148.         PointStars       = 1,
  149.         ScaledDiscStars  = 2,
  150.         StarStyleCount   = 3,
  151.     };
  152.     // constants
  153.     static const int DefaultRenderFlags = Renderer::ShowStars          |
  154.                                           Renderer::ShowPlanets        |
  155.                                           Renderer::ShowGalaxies       |
  156.   Renderer::ShowGlobulars      |  
  157.                                           Renderer::ShowCloudMaps      |
  158.                                           Renderer::ShowAtmospheres    |
  159.                                           Renderer::ShowEclipseShadows |
  160.                                           Renderer::ShowRingShadows    |
  161.                                           Renderer::ShowCometTails     |
  162.                                           Renderer::ShowNebulae        |
  163.                                           Renderer::ShowOpenClusters   |
  164.                                           Renderer::ShowAutoMag        |
  165.                                           Renderer::ShowSmoothLines;
  166.     int getRenderFlags() const;
  167.     void setRenderFlags(int);
  168.     int getLabelMode() const;
  169.     void setLabelMode(int);
  170.     float getAmbientLightLevel() const;
  171.     void setAmbientLightLevel(float);
  172.     float getMinimumOrbitSize() const;
  173.     void setMinimumOrbitSize(float);
  174.     float getMinimumFeatureSize() const;
  175.     void setMinimumFeatureSize(float);
  176.     float getDistanceLimit() const;
  177.     void setDistanceLimit(float);
  178.     int getOrbitMask() const;
  179.     void setOrbitMask(int);
  180.     int getScreenDpi() const;
  181.     void setScreenDpi(int);
  182.     const ColorTemperatureTable* getStarColorTable() const;
  183.     void setStarColorTable(const ColorTemperatureTable*);
  184.     bool getVideoSync() const;
  185.     void setVideoSync(bool);
  186.     bool getFragmentShaderEnabled() const;
  187.     void setFragmentShaderEnabled(bool);
  188.     bool fragmentShaderSupported() const;
  189.     bool getVertexShaderEnabled() const;
  190.     void setVertexShaderEnabled(bool);
  191.     bool vertexShaderSupported() const;
  192. #ifdef USE_HDR
  193.     bool getBloomEnabled();
  194.     void setBloomEnabled(bool);
  195.     void increaseBrightness();
  196.     void decreaseBrightness();
  197.     float getBrightness();
  198. #endif
  199.     GLContext* getGLContext() { return context; }
  200.     void setStarStyle(StarStyle);
  201.     StarStyle getStarStyle() const;
  202.     void setResolution(unsigned int resolution);
  203.     unsigned int getResolution() const;
  204.     void loadTextures(Body*);
  205.     // Label related methods
  206.     enum LabelAlignment
  207.     {
  208.         AlignCenter,
  209.         AlignLeft,
  210.         AlignRight
  211.     };
  212.     
  213.     enum LabelVerticalAlignment
  214.     {
  215.         VerticalAlignCenter,
  216.         VerticalAlignBottom,
  217.         VerticalAlignTop,
  218.     };
  219.         
  220.     static const int MaxLabelLength = 32;
  221.     struct Annotation
  222.     {
  223.         char labelText[MaxLabelLength];
  224.         const MarkerRepresentation* markerRep;
  225.         Color color;
  226.         Point3f position;
  227.         LabelAlignment halign : 3;
  228.         LabelVerticalAlignment valign : 3;
  229.         float size;
  230.         bool operator<(const Annotation&) const;
  231.     };
  232.         
  233.     void addForegroundAnnotation(const MarkerRepresentation* markerRep,
  234.                                  const std::string& labelText,
  235.                                  Color color,
  236.                                  const Point3f& position,
  237.                                  LabelAlignment halign = AlignLeft,
  238.                                  LabelVerticalAlignment valign = VerticalAlignBottom,
  239.                                  float size = 0.0f);
  240.     void addBackgroundAnnotation(const MarkerRepresentation* markerRep,
  241.                                  const std::string& labelText,
  242.                                  Color color,
  243.                                  const Point3f& position,
  244.                                  LabelAlignment halign = AlignLeft,
  245.                                  LabelVerticalAlignment valign = VerticalAlignBottom,
  246.                                  float size = 0.0f);
  247.     void addSortedAnnotation(const MarkerRepresentation* markerRep,
  248.                              const std::string& labelText,
  249.                              Color color,
  250.                              const Point3f& position,
  251.                              LabelAlignment halign = AlignLeft,
  252.                              LabelVerticalAlignment valign = VerticalAlignBottom,
  253.                              float size = 0.0f);
  254.     // Callbacks for renderables; these belong in a special renderer interface
  255.     // only visible in object's render methods.
  256.     void beginObjectAnnotations();
  257.     void addObjectAnnotation(const MarkerRepresentation* markerRep, const std::string& labelText, Color, const Point3f&);
  258.     void endObjectAnnotations();
  259.     Quatf getCameraOrientation() const;
  260.     float getNearPlaneDistance() const;
  261.     
  262.     void clearAnnotations(std::vector<Annotation>&);
  263. void clearSortedAnnotations();
  264.     void invalidateOrbitCache();
  265.     
  266.     struct OrbitPathListEntry
  267.     {
  268.         float centerZ;
  269.         float radius;
  270.         Body* body;
  271.         const Star* star;
  272.         Point3f origin;
  273.         float opacity;
  274.         bool operator<(const OrbitPathListEntry&) const;
  275.     };        
  276.     enum FontStyle
  277.     {
  278.         FontNormal = 0,
  279.         FontLarge  = 1,
  280.         FontCount  = 2,
  281.     };
  282.     
  283.     void setFont(FontStyle, TextureFont*);
  284.     TextureFont* getFont(FontStyle) const;
  285.     bool settingsHaveChanged() const;
  286.     void markSettingsChanged();
  287.     void addWatcher(RendererWatcher*);
  288.     void removeWatcher(RendererWatcher*);
  289.     void notifyWatchers() const;
  290.  public:
  291.     // Internal types
  292.     // TODO: Figure out how to make these private.  Even with a friend
  293.     // 
  294.     struct Particle
  295.     {
  296.         Point3f center;
  297.         float size;
  298.         Color color;
  299.         float pad0, pad1, pad2;
  300.     };
  301.     struct RenderProperties
  302.     {
  303.         RenderProperties() :
  304.             surface(NULL),
  305.             atmosphere(NULL),
  306.             rings(NULL),
  307.             radius(1.0f),
  308.             geometryScale(1.0f),
  309.             semiAxes(1.0f, 1.0f, 1.0f),
  310.             geometry(InvalidResource),
  311.             orientation(1.0f)
  312.         {};
  313.         Surface* surface;
  314.         const Atmosphere* atmosphere;
  315.         RingSystem* rings;
  316.         float radius;
  317.         float geometryScale;
  318.         Vec3f semiAxes;
  319.         ResourceHandle geometry;
  320.         Quatf orientation;
  321.         std::vector<EclipseShadow>* eclipseShadows;
  322.     };
  323.     class StarVertexBuffer
  324.     {
  325.     public:
  326.         StarVertexBuffer(unsigned int _capacity);
  327.         ~StarVertexBuffer();
  328.         void start();
  329.         void render();
  330.         void finish();
  331.         void addStar(const Vec3f&, const Color&, float);
  332.         void setBillboardOrientation(const Quatf&);
  333.     private:
  334.         unsigned int capacity;
  335.         unsigned int nStars;
  336.         float* vertices;
  337.         float* texCoords;
  338.         unsigned char* colors;
  339.         Vec3f v0, v1, v2, v3;
  340.     };
  341.     class PointStarVertexBuffer
  342.     {
  343.     public:
  344.         PointStarVertexBuffer(unsigned int _capacity);
  345.         ~PointStarVertexBuffer();
  346.         void startPoints(const GLContext&);
  347.         void startSprites(const GLContext&);
  348.         void render();
  349.         void finish();
  350.         void addStar(const Vec3f& f, const Color&, float);
  351. void setTexture(Texture*);
  352.     private:
  353.         struct StarVertex
  354.         {
  355.             Vec3f position;
  356.             float size;
  357.             unsigned char color[4];
  358.             float pad;
  359.         };
  360.         unsigned int capacity;
  361.         unsigned int nStars;
  362.         StarVertex* vertices;
  363.         const GLContext* context;
  364.         bool useSprites;
  365. Texture* texture;
  366.     };
  367.  private:
  368.     struct SkyVertex
  369.     {
  370.         float x, y, z;
  371.         unsigned char color[4];
  372.     };
  373.     struct SkyContourPoint
  374.     {
  375.         Vec3f v;
  376.         Vec3f eyeDir;
  377.         float centerDist;
  378.         float eyeDist;
  379.         float cosSkyCapAltitude;
  380.     };
  381.     template <class OBJ> struct ObjectLabel
  382.     {
  383.         OBJ*        obj;
  384.         std::string label;
  385.         ObjectLabel() :
  386.             obj  (NULL),
  387.             label("")
  388.         {};
  389.         ObjectLabel(OBJ* _obj, const std::string& _label) :
  390.             obj  (_obj),
  391.             label(_label)
  392.         {};
  393.         ObjectLabel(const ObjectLabel& objLbl) :
  394.             obj  (objLbl.obj),
  395.             label(objLbl.label)
  396.         {};
  397.         ObjectLabel& operator = (const ObjectLabel& objLbl)
  398.         {
  399.             obj   = objLbl.obj;
  400.             label = objLbl.label;
  401.             return *this;
  402.         };
  403.     };
  404.     typedef ObjectLabel<Star>          StarLabel;
  405.     typedef ObjectLabel<DeepSkyObject> DSOLabel;    // currently not used
  406.     
  407.     struct DepthBufferPartition
  408.     {
  409.         int index;
  410.         float nearZ;
  411.         float farZ;
  412.     };
  413.  private:
  414.     void setFieldOfView(float);
  415.     void renderStars(const StarDatabase& starDB,
  416.                      float faintestVisible,
  417.                      const Observer& observer);
  418.     void renderPointStars(const StarDatabase& starDB,
  419.                           float faintestVisible,
  420.                           const Observer& observer);
  421.     void renderDeepSkyObjects(const Universe&,
  422.                               const Observer&,
  423.                               float faintestMagNight);
  424.     void renderSkyGrids(const Observer& observer);
  425.     void renderSelectionPointer(const Observer& observer,
  426.                                 double now,
  427.                                 const Frustum& viewFrustum,
  428.                                 const Selection& sel);
  429.     void buildRenderLists(const Point3d& astrocentricObserverPos,
  430.                           const Frustum& viewFrustum,
  431.                           const Vec3d& viewPlaneNormal,
  432.                           const Vec3d& frameCenter,
  433.                           const FrameTree* tree,
  434.                           const Observer& observer,
  435.                           double now);
  436.     void buildOrbitLists(const Point3d& astrocentricObserverPos,
  437.                          const Quatf& observerOrientation,
  438.                          const Frustum& viewFrustum,
  439.                          const FrameTree* tree,
  440.                          double now);
  441.     void buildLabelLists(const Frustum& viewFrustum,
  442.                          double now);
  443.     void addRenderListEntries(RenderListEntry& rle,
  444.                               Body& body,
  445.                               bool isLabeled);
  446.     void addStarOrbitToRenderList(const Star& star,
  447.                                   const Observer& observer,
  448.                                   double now);
  449.     void renderObject(Point3f pos,
  450.                       float distance,
  451.                       double now,
  452.                       Quatf cameraOrientation,
  453.                       float nearPlaneDistance,
  454.                       float farPlaneDistance,
  455.                       RenderProperties& obj,
  456.                       const LightingState&);
  457.     void renderPlanet(Body& body,
  458.                       Point3f pos,
  459.                       float distance,
  460.                       float appMag,
  461.                       const Observer& observer,
  462.                       const Quatf& cameraOrientation,
  463.                       float, float);
  464.     void renderStar(const Star& star,
  465.                     Point3f pos,
  466.                     float distance,
  467.                     float appMag,
  468.                     Quatf orientation,
  469.                     double now,
  470.                     float, float);
  471.     
  472.     void renderReferenceMark(const ReferenceMark& refMark,
  473.                              Point3f pos,
  474.                              float distance,
  475.                              double now,
  476.                              float nearPlaneDistance);
  477.     void renderCometTail(const Body& body,
  478.                          Point3f pos,
  479.                          double now,
  480.                          float discSizeInPixels);
  481.     void renderObjectAsPoint_nosprite(Point3f center,
  482.                                       float radius,
  483.                                       float appMag,
  484.                                       float _faintestMag,
  485.                                       float discSizeInPixels,
  486.                                       Color color,
  487.                                       const Quatf& cameraOrientation,
  488.                                       bool useHalos);
  489.     void renderObjectAsPoint(Point3f center,
  490.                              float radius,
  491.                              float appMag,
  492.                              float _faintestMag,
  493.                              float discSizeInPixels,
  494.                              Color color,
  495.                              const Quatf& cameraOrientation,
  496.                              bool useHalos,
  497.                              bool emissive);
  498.     void renderEllipsoidAtmosphere(const Atmosphere& atmosphere,
  499.                                    Point3f center,
  500.                                    const Quatf& orientation,
  501.                                    Vec3f semiAxes,
  502.                                    const Vec3f& sunDirection,
  503.                                    const LightingState& ls,
  504.                                    float fade,
  505.                                    bool lit);
  506.     void renderLocations(const Body& body,
  507.                          const Vec3d& bodyPosition,
  508.                          const Quatd& bodyOrientation);
  509.                    
  510.     // Render an item from the render list                   
  511.     void renderItem(const RenderListEntry& rle,
  512.                     const Observer& observer,
  513.                     const Quatf& cameraOrientation,
  514.                     float nearPlaneDistance,
  515.                     float farPlaneDistance);
  516.     bool testEclipse(const Body& receiver,
  517.                      const Body& caster,
  518.                      const DirectionalLight& light,
  519.                      double now,
  520.                      vector<EclipseShadow>& shadows);
  521.     void labelConstellations(const AsterismList& asterisms,
  522.                              const Observer& observer);
  523.     void renderParticles(const std::vector<Particle>& particles,
  524.                          Quatf orientation);
  525.     
  526.     
  527.     void addAnnotation(std::vector<Annotation>&,
  528.                        const MarkerRepresentation*,
  529.                        const std::string& labelText,
  530.                        Color color,
  531.                        const Point3f& position,
  532.                        LabelAlignment halign = AlignLeft,
  533.                        LabelVerticalAlignment = VerticalAlignBottom,
  534.                        float size = 0.0f);
  535.     void renderAnnotations(const std::vector<Annotation>&, FontStyle fs);
  536.     void renderBackgroundAnnotations(FontStyle fs);
  537.     void renderForegroundAnnotations(FontStyle fs);
  538.     std::vector<Annotation>::iterator renderSortedAnnotations(std::vector<Annotation>::iterator,
  539.                                                               float nearDist,
  540.                                                               float farDist,
  541.                                                               FontStyle fs);
  542.     std::vector<Renderer::Annotation>::iterator renderAnnotations(std::vector<Annotation>::iterator startIter,
  543.                                                                   std::vector<Annotation>::iterator endIter,
  544.                                                                   float nearDist,
  545.                                                                   float farDist,
  546.                                                                   FontStyle fs);
  547.     void renderMarkers(const MarkerList&,
  548.                        const UniversalCoord& cameraPosition,
  549.                        const Quatd& cameraOrientation,
  550.                        double jd);
  551.     void renderOrbit(const OrbitPathListEntry&,
  552.                      double now,
  553.                      const Quatf& cameraOrientation,
  554.                      const Frustum& frustum,
  555.                      float nearDist,
  556.                      float farDist);
  557. #ifdef USE_HDR
  558.  private:
  559.     int sceneTexWidth, sceneTexHeight;
  560.     GLfloat sceneTexWScale, sceneTexHScale;
  561.     GLsizei blurBaseWidth, blurBaseHeight;
  562.     GLuint sceneTexture;
  563.     Texture **blurTextures;
  564.     Texture *blurTempTexture;
  565.     GLuint gaussianLists[4];
  566.     GLint blurFormat;
  567.     bool useBlendSubtract;
  568.     bool useLuminanceAlpha;
  569.     bool bloomEnabled;
  570.     float maxBodyMag;
  571.     float exposure, exposurePrev;
  572.     float brightPlus;
  573.     void genBlurTexture(int blurLevel);
  574.     void genBlurTextures();
  575.     void genSceneTexture();
  576.     void renderToBlurTexture(int blurLevel);
  577.     void renderToTexture(const Observer& observer,
  578.                          const Universe& universe,
  579.                          float faintestMagNight,
  580.                          const Selection& sel);
  581.     void drawSceneTexture();
  582.     void drawBlur();
  583.     void drawGaussian3x3(float xdelta, float ydelta, GLsizei width, GLsizei height, float blend);
  584.     void drawGaussian5x5(float xdelta, float ydelta, GLsizei width, GLsizei height, float blend);
  585.     void drawGaussian9x9(float xdelta, float ydelta, GLsizei width, GLsizei height, float blend);
  586.     void drawBlendedVertices(float xdelta, float ydelta, float blend);
  587. #endif
  588.  private:
  589.     GLContext* context;
  590.     int windowWidth;
  591.     int windowHeight;
  592.     float fov;
  593.     double cosViewConeAngle;
  594.     int screenDpi;
  595.     float corrFac;
  596.     float pixelSize;
  597.     float faintestAutoMag45deg;
  598.     TextureFont* font[FontCount];
  599.     int renderMode;
  600.     int labelMode;
  601.     int renderFlags;
  602.     int orbitMask;
  603.     float ambientLightLevel;
  604.     bool fragmentShaderEnabled;
  605.     bool vertexShaderEnabled;
  606.     float brightnessBias;
  607.     float brightnessScale;
  608.     float faintestMag;
  609.     float faintestPlanetMag;
  610.     float saturationMagNight;
  611.     float saturationMag;
  612.     StarStyle starStyle;
  613.     Color ambientColor;
  614.     std::string displayedSurface;
  615.     Quatf m_cameraOrientation;
  616.     StarVertexBuffer* starVertexBuffer;
  617.     PointStarVertexBuffer* pointStarVertexBuffer;
  618. PointStarVertexBuffer* glareVertexBuffer;
  619.     std::vector<RenderListEntry> renderList;
  620.     std::vector<SecondaryIlluminator> secondaryIlluminators;
  621.     std::vector<DepthBufferPartition> depthPartitions;
  622.     std::vector<Particle> glareParticles;
  623.     std::vector<Annotation> backgroundAnnotations;
  624.     std::vector<Annotation> foregroundAnnotations;
  625.     std::vector<Annotation> depthSortedAnnotations;
  626.     std::vector<Annotation> objectAnnotations;
  627.     std::vector<OrbitPathListEntry> orbitPathList;
  628.     std::vector<EclipseShadow> eclipseShadows[MaxLights];
  629.     std::vector<const Star*> nearStars;
  630.     std::vector<LightSource> lightSourceList;
  631.     double modelMatrix[16];
  632.     double projMatrix[16];
  633.     bool useCompressedTextures;
  634.     bool useVertexPrograms;
  635.     bool useRescaleNormal;
  636.     bool usePointSprite;
  637.     bool useClampToBorder;
  638.     unsigned int textureResolution;
  639.     DetailOptions detailOptions;
  640.     
  641.     bool useNewStarRendering;
  642.     uint32 frameCount;
  643.     int currentIntervalIndex;
  644.  public:
  645.     struct OrbitSample 
  646.     {
  647.         double t;
  648.         Point3d pos;
  649.         
  650.         OrbitSample(const Point3d& _pos, double _t) : t(_t), pos(_pos) { }
  651.         OrbitSample() { }
  652.     };
  653.     struct OrbitSection
  654.     {
  655.         Capsuled boundingVolume;
  656.         uint32 firstSample;
  657.     };
  658.     
  659.     struct CachedOrbit
  660.     {
  661.         std::vector<OrbitSample> trajectory;
  662.         std::vector<OrbitSection> sections;
  663.         uint32 lastUsed;
  664.     };
  665.  private:
  666.     typedef std::map<const Orbit*, CachedOrbit*> OrbitCache;
  667.     OrbitCache orbitCache;
  668.     uint32 lastOrbitCacheFlush;
  669.     float minOrbitSize;
  670.     float distanceLimit;
  671.     float minFeatureSize;
  672.     uint32 locationFilter;
  673.     SkyVertex* skyVertices;
  674.     uint32* skyIndices;
  675.     SkyContourPoint* skyContour;
  676.     const ColorTemperatureTable* colorTemp;
  677.     
  678.     Selection highlightObject;
  679.     bool videoSync;
  680.     bool settingsChanged;
  681.     // True if we're in between a begin/endObjectAnnotations
  682.     bool objectAnnotationSetOpen;
  683.     double realTime;
  684.     
  685.     // Location markers
  686.  public:
  687.     MarkerRepresentation mountainRep;
  688.     MarkerRepresentation craterRep;
  689.     MarkerRepresentation observatoryRep;
  690.     MarkerRepresentation cityRep;
  691.     MarkerRepresentation genericLocationRep;
  692.     MarkerRepresentation galaxyRep;
  693.     MarkerRepresentation nebulaRep;
  694.     MarkerRepresentation openClusterRep;
  695.     MarkerRepresentation globularRep;
  696.     std::list<RendererWatcher*> watchers;
  697.  public:
  698.     // Colors for all lines and labels
  699.     static Color StarLabelColor;
  700.     static Color PlanetLabelColor;
  701.     static Color DwarfPlanetLabelColor;
  702.     static Color MoonLabelColor;
  703.     static Color MinorMoonLabelColor;
  704.     static Color AsteroidLabelColor;
  705.     static Color CometLabelColor;
  706.     static Color SpacecraftLabelColor;
  707.     static Color LocationLabelColor;
  708.     static Color GalaxyLabelColor;
  709.     static Color GlobularLabelColor;     
  710. static Color NebulaLabelColor;
  711.     static Color OpenClusterLabelColor;
  712.     static Color ConstellationLabelColor;
  713.     static Color EquatorialGridLabelColor;
  714.     static Color PlanetographicGridLabelColor;
  715.     static Color GalacticGridLabelColor;
  716.     static Color EclipticGridLabelColor;
  717.     static Color HorizonGridLabelColor;
  718.     static Color StarOrbitColor;
  719.     static Color PlanetOrbitColor;
  720.     static Color DwarfPlanetOrbitColor;
  721.     static Color MoonOrbitColor;
  722.     static Color MinorMoonOrbitColor;
  723.     static Color AsteroidOrbitColor;
  724.     static Color CometOrbitColor;
  725.     static Color SpacecraftOrbitColor;
  726.     static Color SelectionOrbitColor;
  727.     static Color ConstellationColor;
  728.     static Color BoundaryColor;
  729.     static Color EquatorialGridColor;
  730.     static Color PlanetographicGridColor;
  731.     static Color PlanetEquatorColor;
  732.     static Color GalacticGridColor;
  733.     static Color EclipticGridColor;
  734.     static Color HorizonGridColor;
  735.     static Color EclipticColor;
  736.     static Color SelectionCursorColor;
  737. };
  738. class RendererWatcher
  739. {
  740.  public:
  741.     RendererWatcher() {};
  742.     virtual ~RendererWatcher() {};
  743.     virtual void notifyRenderSettingsChanged(const Renderer*) = 0;
  744. };
  745. #endif // _CELENGINE_RENDER_H_