3 * Provides a class to model a single cloud layer
6 // Written by Curtis Olson, started June 2000.
8 // Copyright (C) 2000 Curtis L. Olson - curt@flightgear.org
10 // This library is free software; you can redistribute it and/or
11 // modify it under the terms of the GNU Library General Public
12 // License as published by the Free Software Foundation; either
13 // version 2 of the License, or (at your option) any later version.
15 // This library is distributed in the hope that it will be useful,
16 // but WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 // Library General Public License for more details.
20 // You should have received a copy of the GNU Library General Public
21 // License along with this library; if not, write to the
22 // Free Software Foundation, Inc., 59 Temple Place - Suite 330,
23 // Boston, MA 02111-1307, USA.
28 #ifndef _SG_CLOUD_HXX_
29 #define _SG_CLOUD_HXX_
31 #include <simgear/compiler.h>
40 * A class layer to model a single cloud layer
46 * This is the list of available cloud coverages/textures
49 SG_CLOUD_OVERCAST = 0,
55 SG_MAX_CLOUD_COVERAGES
60 * @param tex_path the path to the set of cloud textures
62 SGCloudLayer( const string &tex_path );
67 ~SGCloudLayer( void );
69 /** get the cloud span (in meters) */
70 float getSpan_m () const;
73 * @param span_m the cloud span in meters
75 void setSpan_m (float span_m);
77 /** get the layer elevation (in meters) */
78 float getElevation_m () const;
80 * set the layer elevation. Note that this specifies the bottom
81 * of the cloud layer. The elevation of the top of the layer is
82 * elevation_m + thickness_m.
83 * @param elevation_m the layer elevation in meters
85 void setElevation_m (float elevation_m);
87 /** get the layer thickness */
88 float getThickness_m () const;
90 * set the layer thickness.
91 * @param thickness_m the layer thickness in meters.
93 void setThickness_m (float thickness_m);
96 * get the transition/boundary layer depth in meters. This
97 * allows gradual entry/exit from the cloud layer via adjusting
100 float getTransition_m () const;
103 * set the transition layer size in meters
104 * @param transition_m the transition layer size in meters
106 void setTransition_m (float transition_m);
108 /** get coverage type */
109 Coverage getCoverage () const;
113 * @param coverage the coverage type
115 void setCoverage (Coverage coverage);
118 * set the cloud movement direction
119 * @param dir the cloud movement direction
121 inline void setDirection(float dir) { direction = dir; }
123 /** get the cloud movement direction */
124 inline float getDirection() { return direction; }
127 * set the cloud movement speed
128 * @param sp the cloud movement speed
130 inline void setSpeed(float sp) { speed = sp; }
132 /** get the cloud movement speed */
133 inline float getSpeed() { return speed; }
135 /** build the cloud object */
139 * repaint the cloud colors based on the specified fog_color
140 * @param fog_color the fog color
142 bool repaint( sgVec3 fog_color );
145 * reposition the cloud layer at the specified origin and
147 * @param p position vector
148 * @param up the local up vector
149 * @param lon specifies a rotation about the Z axis
150 * @param lat specifies a rotation about the new Y axis
151 * @param spin specifies a rotation about the new Z axis
152 * (and orients the sunrise/set effects)
153 * @param dt the time elapsed since the last call
155 bool reposition( sgVec3 p, sgVec3 up, double lon, double lat, double alt,
158 /** draw the cloud layer */
164 ssgTransform *layer_transform;
167 ssgColourArray *cl[4];
168 ssgVertexArray *vl[4];
169 ssgTexCoordArray *tl[4];
171 // height above sea level (meters)
175 float layer_thickness;
176 float layer_transition;
177 Coverage layer_coverage;
182 // for handling texture coordinates to simulate cloud movement
183 // from winds, and to simulate the clouds being tied to ground
184 // position, not view position
185 // double xoff, yoff;
186 double last_lon, last_lat;
191 // make an ssgSimpleState for a cloud layer given the named texture
192 ssgSimpleState *sgCloudMakeState( const string &path );
195 #endif // _SG_CLOUD_HXX_