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,
47 SG_MAX_CLOUD_COVERAGES
51 SGCloudLayer( const string &tex_path );
54 ~SGCloudLayer( void );
56 float getSpan_m () const;
57 void setSpan_m (float span_m);
59 float getElevation_m () const;
60 void setElevation_m (float elevation_m);
62 float getThickness_m () const;
63 void setThickness_m (float thickness_m);
65 float getTransition_m () const;
66 void setTransition_m (float transition_m);
68 Coverage getCoverage () const;
69 void setCoverage (Coverage coverage);
71 // build the cloud object
74 // repaint the cloud colors based on current value of sun_angle,
75 // sky, and fog colors. This updates the color arrays for
77 // sun angle in degrees relative to verticle
78 // 0 degrees = high noon
79 // 90 degrees = sun rise/set
80 // 180 degrees = darkest midnight
81 bool repaint( sgVec3 fog_color );
83 // reposition the cloud layer at the specified origin and
85 // lon specifies a rotation about the Z axis
86 // lat specifies a rotation about the new Y axis
87 // spin specifies a rotation about the new Z axis (and orients the
88 // sunrise/set effects
89 bool reposition( sgVec3 p, sgVec3 up, double lon, double lat, double alt );
91 // draw the cloud layer
96 static ssgSimpleState *layer_states[SG_MAX_CLOUD_COVERAGES];
97 static int layer_sizes[SG_MAX_CLOUD_COVERAGES];
100 ssgTransform *layer_transform;
103 ssgColourArray *cl[4];
104 ssgVertexArray *vl[4];
105 ssgTexCoordArray *tl[4];
107 // height above sea level (meters)
111 float layer_thickness;
112 float layer_transition;
113 Coverage layer_coverage;
116 // for handling texture coordinates to simulate cloud movement
117 // from winds, and to simulate the clouds being tied to ground
118 // position, not view position
119 // double xoff, yoff;
120 double last_lon, last_lat;
125 // make an ssgSimpleState for a cloud layer given the named texture
126 ssgSimpleState *SGCloudMakeState( const string &path );
129 #endif // _SG_CLOUD_HXX_