1 // cloud.hxx -- model a single cloud layer
3 // Written by Curtis Olson, started June 2000.
5 // Copyright (C) 2000 Curtis L. Olson - curt@flightgear.org
7 // This library is free software; you can redistribute it and/or
8 // modify it under the terms of the GNU Library General Public
9 // License as published by the Free Software Foundation; either
10 // version 2 of the License, or (at your option) any later version.
12 // This library is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 // Library General Public License for more details.
17 // You should have received a copy of the GNU Library General Public
18 // License along with this library; if not, write to the
19 // Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20 // Boston, MA 02111-1307, USA.
25 #ifndef _SG_CLOUD_HXX_
26 #define _SG_CLOUD_HXX_
28 #include <simgear/compiler.h>
41 SG_CLOUD_OVERCAST = 0,
42 SG_CLOUD_MOSTLY_CLOUDY,
43 SG_CLOUD_MOSTLY_SUNNY,
50 SGCloudLayer( const string &tex_path );
53 ~SGCloudLayer( void );
55 float getSpan_m () const;
56 void setSpan_m (float span_m);
58 float getElevation_m () const;
59 void setElevation_m (float elevation_m);
61 float getThickness_m () const;
62 void setThickness_m (float thickness_m);
64 float getTransition_m () const;
65 void setTransition_m (float transition_m);
67 Type getType () const;
68 void setType (Type type);
70 // build the cloud object
73 // repaint the cloud colors based on current value of sun_angle,
74 // sky, and fog colors. This updates the color arrays for
76 // sun angle in degrees relative to verticle
77 // 0 degrees = high noon
78 // 90 degrees = sun rise/set
79 // 180 degrees = darkest midnight
80 bool repaint( sgVec3 fog_color );
82 // reposition the cloud layer at the specified origin and
84 // lon specifies a rotation about the Z axis
85 // lat specifies a rotation about the new Y axis
86 // spin specifies a rotation about the new Z axis (and orients the
87 // sunrise/set effects
88 bool reposition( sgVec3 p, sgVec3 up, double lon, double lat, double alt );
90 // draw the cloud layer
95 static ssgSimpleState *layer_states[SG_MAX_CLOUD_TYPES];
96 static int layer_sizes[SG_MAX_CLOUD_TYPES];
99 ssgTransform *layer_transform;
104 ssgTexCoordArray *tl;
106 // height above sea level (meters)
110 float layer_thickness;
111 float layer_transition;
115 // for handling texture coordinates to simulate cloud movement
116 // from winds, and to simulate the clouds being tied to ground
117 // position, not view position
118 // double xoff, yoff;
119 double last_lon, last_lat;
124 // make an ssgSimpleState for a cloud layer given the named texture
125 ssgSimpleState *SGCloudMakeState( const string &path );
128 #endif // _SG_CLOUD_HXX_