#ifndef _CLOUDFIELD_HXX
#define _CLOUDFIELD_HXX
-#include <plib/sg.h>
#include <simgear/compiler.h>
#include <vector>
-#include <osgSim/Impostor>
+
#include <osgDB/ReaderWriter>
#include <osg/ref_ptr>
#include <osg/Geometry>
#include <osg/Group>
#include <osg/Switch>
-#include <osg/Billboard>
+
+namespace osg
+{
+ class Fog;
+ class StateSet;
+ class Vec4f;
+}
#include <simgear/misc/sg_path.hxx>
+#include <simgear/structure/Singleton.hxx>
+#include <simgear/math/SGMath.hxx>
using std::vector;
class Cloud {
public:
SGNewCloud *aCloud;
- sgVec3 pos;
+ SGVec3f pos;
bool visible;
};
static const int QUADTREE_SIZE = 32;
// this is a relative position only, with that we can move all clouds at once
- sgVec3 relative_position;
+ SGVec3f relative_position;
// double lon, lat;
osg::ref_ptr<osg::Group> field_root;
osg::ref_ptr<osg::MatrixTransform> field_transform;
+ osg::ref_ptr<osg::PositionAttitudeTransform> altitude_transform;
osg::ref_ptr<osg::Switch> field_group[QUADTREE_SIZE][QUADTREE_SIZE];
+ osg::ref_ptr<osg::LOD> quad[BRANCH_SIZE][BRANCH_SIZE];
+
osg::ref_ptr<osg::LOD> field_lod;
double deltax, deltay, alt;
double last_course;
- sgSphere field_sphere;
- float last_density;
+ float last_coverage;
+ float coverage;
SGGeoc cld_pos;
-
+ int reposition_count;
+ struct CloudFog : public simgear::Singleton<CloudFog>
+ {
+ CloudFog();
+ osg::ref_ptr<osg::Fog> fog;
+ };
public:
SGCloudField();
* @param up the local up vector
* @param lon specifies a rotation about the Z axis
* @param lat specifies a rotation about the new Y axis
- * @param spin specifies a rotation about the new Z axis
- * (and orients the sunrise/set effects)
* @param dt the time elapsed since the last call
+ * @param asl altitude of the layer
*/
bool reposition( const SGVec3f& p, const SGVec3f& up,
- double lon, double lat, double dt = 0.0 );
+ double lon, double lat, double dt, int asl);
osg::Group* getNode() { return field_root.get(); }
// visibility distance for clouds in meters
static float CloudVis;
- static sgVec3 view_vec, view_X, view_Y;
+ static SGVec3f view_vec, view_X, view_Y;
- static float density;
- static double timer_dt;
+ static float view_distance;
+ static double timer_dt;
static float fieldSize;
bool defined3D;
- static float get_density(void) { return density; }
+ float getCoverage(void) { return coverage; }
+ void setCoverage(float c) { coverage = c; }
- static void set_density(float density);
-
- void applyDensity(void);
+ static float getVisRange(void) { return view_distance; }
+ static void setVisRange(float d) { view_distance = d; }
+
+ void applyCoverage(void);
+ void applyVisRange(void);
+
+ static osg::Fog* getFog()
+ {
+ return CloudFog::instance()->fog.get();
+ }
+ static void updateFog(double visibility, const osg::Vec4f& color);
};
#endif // _CLOUDFIELD_HXX