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:
@@ -68,7 +68,6 @@ using namespace simgear;
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
float SGCloudField::fieldSize = 50000.0f;
|
float SGCloudField::fieldSize = 50000.0f;
|
||||||
float SGCloudField::coverage = 1.0f;
|
|
||||||
double SGCloudField::timer_dt = 0.0;
|
double SGCloudField::timer_dt = 0.0;
|
||||||
float SGCloudField::view_distance = 20000.0f;
|
float SGCloudField::view_distance = 20000.0f;
|
||||||
sgVec3 SGCloudField::view_vec, SGCloudField::view_X, SGCloudField::view_Y;
|
sgVec3 SGCloudField::view_vec, SGCloudField::view_X, SGCloudField::view_Y;
|
||||||
@@ -151,6 +150,7 @@ SGCloudField::SGCloudField() :
|
|||||||
deltay(0.0),
|
deltay(0.0),
|
||||||
last_course(0.0),
|
last_course(0.0),
|
||||||
last_coverage(0.0),
|
last_coverage(0.0),
|
||||||
|
coverage(0.0),
|
||||||
defined3D(false),
|
defined3D(false),
|
||||||
reposition_count(0)
|
reposition_count(0)
|
||||||
{
|
{
|
||||||
@@ -211,10 +211,7 @@ void SGCloudField::clear(void) {
|
|||||||
for (int x = 0; x < QUADTREE_SIZE; x++) {
|
for (int x = 0; x < QUADTREE_SIZE; x++) {
|
||||||
for (int y = 0; y < QUADTREE_SIZE; y++) {
|
for (int y = 0; y < QUADTREE_SIZE; y++) {
|
||||||
int num_children = field_group[x][y]->getNumChildren();
|
int num_children = field_group[x][y]->getNumChildren();
|
||||||
|
field_group[x][y]->removeChildren(0, num_children);
|
||||||
for (int i = 0; i < num_children; i++) {
|
|
||||||
field_group[x][y]->removeChild(i);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -239,7 +236,7 @@ static int densTable[][10] = {
|
|||||||
void SGCloudField::applyCoverage(void) {
|
void SGCloudField::applyCoverage(void) {
|
||||||
|
|
||||||
int row = (int) (coverage * 10.0);
|
int row = (int) (coverage * 10.0);
|
||||||
if (row > 10) row = 9;
|
if (row > 9) row = 9;
|
||||||
int col = 0;
|
int col = 0;
|
||||||
|
|
||||||
if (coverage != last_coverage) {
|
if (coverage != last_coverage) {
|
||||||
|
|||||||
@@ -83,7 +83,8 @@ private:
|
|||||||
double deltax, deltay, alt;
|
double deltax, deltay, alt;
|
||||||
double last_course;
|
double last_course;
|
||||||
sgSphere field_sphere;
|
sgSphere field_sphere;
|
||||||
float last_coverage;
|
float last_coverage;
|
||||||
|
float coverage;
|
||||||
SGGeoc cld_pos;
|
SGGeoc cld_pos;
|
||||||
int reposition_count;
|
int reposition_count;
|
||||||
struct CloudFog : public simgear::Singleton<CloudFog>
|
struct CloudFog : public simgear::Singleton<CloudFog>
|
||||||
@@ -121,15 +122,14 @@ public:
|
|||||||
|
|
||||||
static sgVec3 view_vec, view_X, view_Y;
|
static sgVec3 view_vec, view_X, view_Y;
|
||||||
|
|
||||||
static float coverage;
|
|
||||||
static float view_distance;
|
static float view_distance;
|
||||||
static double timer_dt;
|
static double timer_dt;
|
||||||
static float fieldSize;
|
static float fieldSize;
|
||||||
|
|
||||||
bool defined3D;
|
bool defined3D;
|
||||||
|
|
||||||
static float getCoverage(void) { return coverage; }
|
float getCoverage(void) { return coverage; }
|
||||||
static void setCoverage(float coverage) { coverage = coverage; }
|
void setCoverage(float c) { coverage = c; }
|
||||||
|
|
||||||
static float getVisRange(void) { return view_distance; }
|
static float getVisRange(void) { return view_distance; }
|
||||||
static void setVisRange(float d) { view_distance = d; }
|
static void setVisRange(float d) { view_distance = d; }
|
||||||
|
|||||||
Reference in New Issue
Block a user