Stuart Buchanan :

Attached is yet another 3D clouds patch, to fix the following:
1) The 3D clouds were not modified by the cloud coverage, due to some problems with osg::Switch
2) METAR changes to cloud coverage were not obeyed.
3) Making changes via the Cloud dialog had no effect unless 3D clouds were toggled.
4) Cloud cover was too sparse.
5) 3D Stratus clouds caused performance issues on some hardware (fixed by removing 3D stratus from cloudlayers.xml - it will now be a 2D layer).
This commit is contained in:
fredb 2008-12-19 07:39:09 +00:00
parent f4ec02a592
commit 69871b15ff
2 changed files with 7 additions and 10 deletions

View File

@ -68,7 +68,6 @@ using namespace simgear;
#endif
float SGCloudField::fieldSize = 50000.0f;
float SGCloudField::coverage = 1.0f;
double SGCloudField::timer_dt = 0.0;
float SGCloudField::view_distance = 20000.0f;
sgVec3 SGCloudField::view_vec, SGCloudField::view_X, SGCloudField::view_Y;
@ -151,6 +150,7 @@ SGCloudField::SGCloudField() :
deltay(0.0),
last_course(0.0),
last_coverage(0.0),
coverage(0.0),
defined3D(false),
reposition_count(0)
{
@ -211,10 +211,7 @@ void SGCloudField::clear(void) {
for (int x = 0; x < QUADTREE_SIZE; x++) {
for (int y = 0; y < QUADTREE_SIZE; y++) {
int num_children = field_group[x][y]->getNumChildren();
for (int i = 0; i < num_children; i++) {
field_group[x][y]->removeChild(i);
}
field_group[x][y]->removeChildren(0, num_children);
}
}
@ -239,7 +236,7 @@ static int densTable[][10] = {
void SGCloudField::applyCoverage(void) {
int row = (int) (coverage * 10.0);
if (row > 10) row = 9;
if (row > 9) row = 9;
int col = 0;
if (coverage != last_coverage) {

View File

@ -84,6 +84,7 @@ private:
double last_course;
sgSphere field_sphere;
float last_coverage;
float coverage;
SGGeoc cld_pos;
int reposition_count;
struct CloudFog : public simgear::Singleton<CloudFog>
@ -121,15 +122,14 @@ public:
static sgVec3 view_vec, view_X, view_Y;
static float coverage;
static float view_distance;
static double timer_dt;
static float fieldSize;
bool defined3D;
static float getCoverage(void) { return coverage; }
static void setCoverage(float coverage) { coverage = coverage; }
float getCoverage(void) { return coverage; }
void setCoverage(float c) { coverage = c; }
static float getVisRange(void) { return view_distance; }
static void setVisRange(float d) { view_distance = d; }