Use "coverage" instead of "type".

Rename "mostly-cloudy" to "broken" and "mostly-sunny" to "scattered",
to follow standard weather terminology.

Add "few".
This commit is contained in:
david
2003-04-05 03:32:18 +00:00
parent e2bca737f0
commit f922e84eb6
2 changed files with 33 additions and 26 deletions
+23 -17
View File
@@ -33,7 +33,7 @@
#include "cloud.hxx" #include "cloud.hxx"
ssgSimpleState * ssgSimpleState *
SGCloudLayer::layer_states[SGCloudLayer::SG_MAX_CLOUD_TYPES]; SGCloudLayer::layer_states[SGCloudLayer::SG_MAX_CLOUD_COVERAGES];
// Constructor // Constructor
@@ -49,12 +49,12 @@ SGCloudLayer::SGCloudLayer( const string &tex_path ) :
layer_asl(0.0), layer_asl(0.0),
layer_thickness(0.0), layer_thickness(0.0),
layer_transition(0.0), layer_transition(0.0),
layer_type(SG_CLOUD_CLEAR), layer_coverage(SG_CLOUD_CLEAR),
scale(4000.0), scale(4000.0),
last_lon(0.0), last_lon(0.0),
last_lat(0.0) last_lat(0.0)
{ {
for ( int i = 0; i < SG_MAX_CLOUD_TYPES; ++i ) { for ( int i = 0; i < SG_MAX_CLOUD_COVERAGES; ++i ) {
layer_states[i] = NULL; layer_states[i] = NULL;
} }
layer_root->addKid(layer_transform); layer_root->addKid(layer_transform);
@@ -118,17 +118,17 @@ SGCloudLayer::setTransition_m (float transition_m)
layer_transition = transition_m; layer_transition = transition_m;
} }
SGCloudLayer::Type SGCloudLayer::Coverage
SGCloudLayer::getType () const SGCloudLayer::getCoverage () const
{ {
return layer_type; return layer_coverage;
} }
void void
SGCloudLayer::setType (Type type) SGCloudLayer::setCoverage (Coverage coverage)
{ {
if (type != layer_type) { if (coverage != layer_coverage) {
layer_type = type; layer_coverage = coverage;
rebuild(); rebuild();
} }
} }
@@ -147,18 +147,24 @@ SGCloudLayer::rebuild()
layer_states[SG_CLOUD_OVERCAST] = SGCloudMakeState(cloud_path.str()); layer_states[SG_CLOUD_OVERCAST] = SGCloudMakeState(cloud_path.str());
cloud_path.set(texture_path.str()); cloud_path.set(texture_path.str());
cloud_path.append("mostlycloudy.rgba"); cloud_path.append("broken.rgba");
layer_states[SG_CLOUD_MOSTLY_CLOUDY] layer_states[SG_CLOUD_BROKEN]
= SGCloudMakeState(cloud_path.str()); = SGCloudMakeState(cloud_path.str());
cloud_path.set(texture_path.str()); cloud_path.set(texture_path.str());
cloud_path.append("mostlysunny.rgba"); cloud_path.append("scattered.rgba");
layer_states[SG_CLOUD_MOSTLY_SUNNY] layer_states[SG_CLOUD_SCATTERED]
= SGCloudMakeState(cloud_path.str());
cloud_path.set(texture_path.str());
cloud_path.append("few.rgba");
layer_states[SG_CLOUD_FEW]
= SGCloudMakeState(cloud_path.str()); = SGCloudMakeState(cloud_path.str());
cloud_path.set(texture_path.str()); cloud_path.set(texture_path.str());
cloud_path.append("cirrus.rgba"); cloud_path.append("cirrus.rgba");
layer_states[SG_CLOUD_CIRRUS] = SGCloudMakeState(cloud_path.str()); layer_states[SG_CLOUD_CIRRUS]
= SGCloudMakeState(cloud_path.str());
layer_states[SG_CLOUD_CLEAR] = 0; layer_states[SG_CLOUD_CLEAR] = 0;
} }
@@ -209,8 +215,8 @@ SGCloudLayer::rebuild()
layer = new ssgVtxTable ( GL_TRIANGLE_STRIP, vl, NULL, tl, cl ); layer = new ssgVtxTable ( GL_TRIANGLE_STRIP, vl, NULL, tl, cl );
layer_transform->addKid( layer ); layer_transform->addKid( layer );
if ( layer_states[layer_type] != NULL ) { if ( layer_states[layer_coverage] != NULL ) {
layer->setState( layer_states[layer_type] ); layer->setState( layer_states[layer_coverage] );
} }
// force a repaint of the sky colors with arbitrary defaults // force a repaint of the sky colors with arbitrary defaults
@@ -358,7 +364,7 @@ bool SGCloudLayer::reposition( sgVec3 p, sgVec3 up, double lon, double lat,
void SGCloudLayer::draw() { void SGCloudLayer::draw() {
if ( layer_type != SG_CLOUD_CLEAR ) { if ( layer_coverage != SG_CLOUD_CLEAR ) {
ssgCullAndDraw( layer_root ); ssgCullAndDraw( layer_root );
} }
} }
+10 -9
View File
@@ -37,13 +37,14 @@ class SGCloudLayer {
public: public:
enum Type { enum Coverage {
SG_CLOUD_OVERCAST = 0, SG_CLOUD_OVERCAST = 0,
SG_CLOUD_MOSTLY_CLOUDY, SG_CLOUD_BROKEN,
SG_CLOUD_MOSTLY_SUNNY, SG_CLOUD_SCATTERED,
SG_CLOUD_FEW,
SG_CLOUD_CIRRUS, SG_CLOUD_CIRRUS,
SG_CLOUD_CLEAR, SG_CLOUD_CLEAR,
SG_MAX_CLOUD_TYPES SG_MAX_CLOUD_COVERAGES
}; };
// Constructors // Constructors
@@ -64,8 +65,8 @@ public:
float getTransition_m () const; float getTransition_m () const;
void setTransition_m (float transition_m); void setTransition_m (float transition_m);
Type getType () const; Coverage getCoverage () const;
void setType (Type type); void setCoverage (Coverage coverage);
// build the cloud object // build the cloud object
void rebuild(); void rebuild();
@@ -92,8 +93,8 @@ public:
private: private:
static ssgSimpleState *layer_states[SG_MAX_CLOUD_TYPES]; static ssgSimpleState *layer_states[SG_MAX_CLOUD_COVERAGES];
static int layer_sizes[SG_MAX_CLOUD_TYPES]; static int layer_sizes[SG_MAX_CLOUD_COVERAGES];
ssgRoot *layer_root; ssgRoot *layer_root;
ssgTransform *layer_transform; ssgTransform *layer_transform;
@@ -109,7 +110,7 @@ private:
float layer_asl; float layer_asl;
float layer_thickness; float layer_thickness;
float layer_transition; float layer_transition;
Type layer_type; Coverage layer_coverage;
float scale; float scale;
// for handling texture coordinates to simulate cloud movement // for handling texture coordinates to simulate cloud movement