]> git.mxchange.org Git - simgear.git/blobdiff - simgear/scene/sky/sky.hxx
Work around apparent OSG 3.2.0 normal binding bug.
[simgear.git] / simgear / scene / sky / sky.hxx
index 9e6a1b1bf14deeaf47c44855a53b69fd76f3c1b5..df325884f7dd003cfbebfd6bdb7f682ce4658ec9 100644 (file)
@@ -34,6 +34,7 @@
 #endif
 
 #include <simgear/compiler.h>
+#include <simgear/math/sg_random.h>
 #include <simgear/misc/sg_path.hxx>
 #include <simgear/props/props.hxx>
 
 #include <osg/Node>
 #include <osg/Switch>
 
+#include <simgear/ephemeris/ephemeris.hxx>
+#include <simgear/math/SGMath.hxx>
+
 #include <simgear/scene/sky/cloud.hxx>
 #include <simgear/scene/sky/dome.hxx>
 #include <simgear/scene/sky/moon.hxx>
 #include <simgear/scene/sky/oursun.hxx>
 #include <simgear/scene/sky/stars.hxx>
 
-using std::vector;
-
+namespace simgear {
+class SGReaderWriterOptions;
+}
 
 typedef struct {
-       SGVec3f view_pos, zero_elev, view_up;
-       double lon, lat, alt, spin;
+    SGVec3d pos;
+    SGGeod pos_geod;
+    SGQuatd ori;
+    double spin;
        double gst;
-       double sun_ra, sun_dec, sun_dist;
-       double moon_ra, moon_dec, moon_dist;
+       double sun_dist;
+       double moon_dist;
        double sun_angle;
 } SGSkyState;
 
 typedef struct {
-       SGVec3f sky_color, fog_color;
+       SGVec3f sky_color;
+    SGVec3f adj_sky_color;
+    SGVec3f fog_color;
        SGVec3f cloud_color;
        double sun_angle, moon_angle;
-       int nplanets, nstars;
-        SGVec3d *planet_data;
-        SGVec3d *star_data;
 } SGSkyColor;
 
 /**
@@ -219,16 +225,18 @@ private:
 
     osg::ref_ptr<osg::Group> pre_root, cloud_root;
     osg::ref_ptr<osg::Switch> pre_selector;
-    osg::ref_ptr<osg::MatrixTransform> pre_transform;
+    osg::ref_ptr<osg::Group> pre_transform;
+
+    osg::ref_ptr<osg::MatrixTransform> _ephTransform;
 
     SGPath tex_path;
 
     // visibility
     float visibility;
     float effective_visibility;
+    float minimum_sky_visibility;
 
     int in_cloud;
-    int cur_layer_pos;
 
     // near cloud visibility state variables
     bool in_puff;
@@ -242,6 +250,9 @@ private:
 
     // 3D cloud density
     double clouds_3d_density;
+    
+    // RNG seed
+    mt seed;
 
 public:
 
@@ -268,8 +279,8 @@ public:
      */
     void build( double h_radius_m, double v_radius_m,
                 double sun_size, double moon_size,
-                int nplanets, SGVec3d planet_data[7],
-                int nstars, SGVec3d star_data[], SGPropertyNode *property_tree_node );
+                const SGEphemeris& eph, SGPropertyNode *property_tree_node,
+                simgear::SGReaderWriterOptions* options);
 
     /**
      * Repaint the sky components based on current value of sun_angle,
@@ -295,7 +306,7 @@ public:
      * @param star_data an array of star right ascensions, declinations,
      *        and magnitudes
      */
-    bool repaint( const SGSkyColor &sc );
+    bool repaint( const SGSkyColor &sc, const SGEphemeris& eph );
 
     /**
      * Reposition the sky at the specified origin and orientation
@@ -325,7 +336,7 @@ public:
      * @param moon_dec the moon's current declination
      * @param moon_dist the moon's distance from the current view point. 
      */
-    bool reposition( SGSkyState &st, double dt = 0.0 );
+    bool reposition( const SGSkyState &st, const SGEphemeris& eph, double dt = 0.0 );
 
     /**
      * Modify the given visibility based on cloud layers, thickness,
@@ -364,6 +375,11 @@ public:
      */
     inline SGVec4f get_sun_color() { return oursun->get_color(); }
 
+    /**
+     * Get the current scene color
+     */
+    inline SGVec4f get_scene_color() { return oursun->get_scene_color(); }
+
     /**
      * Add a cloud layer.
      *
@@ -415,30 +431,66 @@ public:
     }
 
     /** Get 3D cloud density */
-    virtual double get_3dCloudDensity() const;
+    double get_3dCloudDensity() const;
 
     /** Set 3D cloud density 
      * @param density 3D cloud density
      */
-    virtual void set_3dCloudDensity(double density);
+    void set_3dCloudDensity(double density);
 
     /** Get 3D cloud visibility range*/
-    virtual float get_3dCloudVisRange() const;
+    float get_3dCloudVisRange() const;
 
     /** Set 3D cloud visibility range
      * @param density 3D cloud visibility range
      */
-    virtual void set_3dCloudVisRange(float vis);
+    void set_3dCloudVisRange(float vis);
 
-    /** Get 3D cloud number of flavours*/
-    virtual float get_3dCloudNumFlavours() const;
+    /** Get 3D cloud impostor distance*/
+    float get_3dCloudImpostorDistance() const;
 
-    /** Set 3D cloud number of flavours
-     * @param density 3D cloud number of flavours
+    /** Set 3D cloud impostor distance
+     * @param density 3D cloud impostor distance
      */
-    virtual void set_3dCloudNumFlavours(float n);
-    
-};
+    void set_3dCloudImpostorDistance(float vis);
+
+    /** Get 3D cloud LoD1 Range*/
+    float get_3dCloudLoD1Range() const;
+
+    /** Set 3D cloud LoD1 Range
+     * @param vis LoD1 Range
+     */
+    void set_3dCloudLoD1Range(float vis);
 
+    /** Get 3D cloud LoD2 Range*/
+    float get_3dCloudLoD2Range() const;
 
+    /** Set 3D cloud LoD2 Range
+     * @param vis LoD2 Range
+     */
+    void set_3dCloudLoD2Range(float vis);
+
+    /** Get 3D cloud impostor usage */
+    bool get_3dCloudUseImpostors() const;
+
+    /** Set 3D cloud impostor usage
+     * @param wrap whether use impostors for 3D clouds
+     */
+    void set_3dCloudUseImpostors(bool imp);
+
+    /** Get 3D cloud wrapping */
+    bool get_3dCloudWrap() const;
+
+    /** Set 3D cloud wrapping
+     * @param wrap whether to wrap 3D clouds
+     */
+    void set_3dCloudWrap(bool wrap);
+
+
+    /** Get minimum sky visibility */
+    float get_minimum_sky_visibility() const;
+
+    /** Set minimum sky visibility */
+    void set_minimum_sky_visibility( float value );
+};
 #endif // _SG_SKY_HXX