Merge branch 'next' of gitorious.org:fg/flightgear into next
This commit is contained in:
commit
c396fae4a7
3 changed files with 36 additions and 37 deletions
src/Environment
|
@ -52,7 +52,8 @@ FGClouds::FGClouds() :
|
|||
update_event = 0;
|
||||
}
|
||||
|
||||
FGClouds::~FGClouds() {
|
||||
FGClouds::~FGClouds()
|
||||
{
|
||||
}
|
||||
|
||||
int FGClouds::get_update_event(void) const {
|
||||
|
@ -186,7 +187,7 @@ double FGClouds::buildCloud(SGPropertyNode *cloud_def_root, SGPropertyNode *box_
|
|||
return extent;
|
||||
}
|
||||
|
||||
void FGClouds::buildLayer(int iLayer, const string& name, double alt, double coverage) {
|
||||
void FGClouds::buildLayer(int iLayer, const string& name, double coverage) {
|
||||
struct {
|
||||
string name;
|
||||
double count;
|
||||
|
@ -197,7 +198,7 @@ void FGClouds::buildLayer(int iLayer, const string& name, double alt, double cov
|
|||
SGPropertyNode *cloud_def_root = fgGetNode("/environment/cloudlayers/clouds", false);
|
||||
SGPropertyNode *box_def_root = fgGetNode("/environment/cloudlayers/boxes", false);
|
||||
SGPropertyNode *layer_def_root = fgGetNode("/environment/cloudlayers/layers", false);
|
||||
SGCloudField *layer = thesky->get_cloud_layer(iLayer)->get_layer3D();
|
||||
SGCloudField *layer = thesky->get_cloud_layer(iLayer)->get_layer3D();
|
||||
layer->clear();
|
||||
|
||||
// If we don't have the required properties, then render the cloud in 2D
|
||||
|
@ -248,10 +249,10 @@ void FGClouds::buildLayer(int iLayer, const string& name, double alt, double cov
|
|||
}
|
||||
totalCount = 1.0 / totalCount;
|
||||
|
||||
// Determine how much cloud coverage we need in m^2.
|
||||
double cov = coverage * SGCloudField::fieldSize * SGCloudField::fieldSize;
|
||||
// Determine how much cloud coverage we need in m^2.
|
||||
double cov = coverage * SGCloudField::fieldSize * SGCloudField::fieldSize;
|
||||
|
||||
while (cov > 0.0f) {
|
||||
while (cov > 0.0f) {
|
||||
double choice = sg_random();
|
||||
|
||||
for(int i = 0; i < CloudVarietyCount ; i ++) {
|
||||
|
@ -260,13 +261,13 @@ void FGClouds::buildLayer(int iLayer, const string& name, double alt, double cov
|
|||
cov -= buildCloud(cloud_def_root,
|
||||
box_def_root,
|
||||
tCloudVariety[i].name,
|
||||
grid_z_rand,
|
||||
grid_z_rand,
|
||||
layer);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// Now we've built any clouds, enable them and set the density (coverage)
|
||||
//layer->setCoverage(coverage);
|
||||
|
@ -305,6 +306,7 @@ void FGClouds::buildCloudLayers(void) {
|
|||
coverage_norm = 8.0/8.0; // 8
|
||||
|
||||
string layer_type = "nn";
|
||||
|
||||
if( coverage == "cirrus" ) {
|
||||
layer_type = "ci";
|
||||
} else if( alt_ft > 16500 ) {
|
||||
|
@ -335,19 +337,20 @@ void FGClouds::buildCloudLayers(void) {
|
|||
}
|
||||
|
||||
cloud_root->setStringValue("layer-type",layer_type);
|
||||
buildLayer(iLayer, layer_type, alt_m, coverage_norm);
|
||||
buildLayer(iLayer, layer_type, coverage_norm);
|
||||
}
|
||||
}
|
||||
|
||||
void FGClouds::set_3dClouds(bool enable)
|
||||
{
|
||||
if (enable != clouds_3d_enabled) {
|
||||
clouds_3d_enabled = enable;
|
||||
buildCloudLayers();
|
||||
}
|
||||
if (enable != clouds_3d_enabled) {
|
||||
clouds_3d_enabled = enable;
|
||||
buildCloudLayers();
|
||||
}
|
||||
}
|
||||
|
||||
bool FGClouds::get_3dClouds() const {
|
||||
return clouds_3d_enabled;
|
||||
bool FGClouds::get_3dClouds() const
|
||||
{
|
||||
return clouds_3d_enabled;
|
||||
}
|
||||
|
||||
|
|
|
@ -34,23 +34,19 @@
|
|||
|
||||
using std::string;
|
||||
|
||||
class SGSampleGroup;
|
||||
class SGCloudField;
|
||||
class SGNewCloud;
|
||||
class FGMetar;
|
||||
//class FGEnvironmentCtrl;
|
||||
|
||||
class FGClouds {
|
||||
|
||||
private:
|
||||
double buildCloud(SGPropertyNode *cloud_def_root, SGPropertyNode *box_def_root, const string& name, double grid_z_rand, SGCloudField *layer);
|
||||
void buildLayer(int iLayer, const string& name, double alt, double coverage);
|
||||
void buildLayer(int iLayer, const string& name, double coverage);
|
||||
|
||||
void buildCloudLayers(void);
|
||||
|
||||
int update_event;
|
||||
SGSoundSample *snd_lightning;
|
||||
bool clouds_3d_enabled;
|
||||
bool clouds_3d_enabled;
|
||||
|
||||
public:
|
||||
FGClouds();
|
||||
|
@ -60,8 +56,8 @@ public:
|
|||
|
||||
int get_update_event(void) const;
|
||||
void set_update_event(int count);
|
||||
bool get_3dClouds() const;
|
||||
void set_3dClouds(bool enable);
|
||||
bool get_3dClouds() const;
|
||||
void set_3dClouds(bool enable);
|
||||
};
|
||||
|
||||
#endif // _FGCLOUDS_HXX
|
||||
|
|
Loading…
Add table
Reference in a new issue