]> git.mxchange.org Git - simgear.git/blob - simgear/sky/cloud.hxx
Updating cloud code.
[simgear.git] / simgear / sky / cloud.hxx
1 // cloud.hxx -- model a single cloud layer
2 //
3 // Written by Curtis Olson, started June 2000.
4 //
5 // Copyright (C) 2000  Curtis L. Olson  - curt@flightgear.org
6 //
7 // This program is free software; you can redistribute it and/or
8 // modify it under the terms of the GNU General Public License as
9 // published by the Free Software Foundation; either version 2 of the
10 // License, or (at your option) any later version.
11 //
12 // This program is distributed in the hope that it will be useful, but
13 // WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15 // General Public License for more details.
16 //
17 // You should have received a copy of the GNU General Public License
18 // along with this program; if not, write to the Free Software
19 // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 //
21 // $Id$
22
23
24 #ifndef _SG_CLOUD_HXX_
25 #define _SG_CLOUD_HXX_
26
27
28 #include <plib/ssg.h>
29
30 #include <simgear/misc/fgpath.hxx>
31
32
33 class SGCloudLayer {
34
35     ssgRoot *layer_root;
36     ssgTransform *layer_transform;
37     ssgSimpleState *layer_state;
38
39     ssgColourArray *cl; 
40     ssgVertexArray *vl;
41     ssgTexCoordArray *tl;
42
43     // height above sea level (meters)
44     float layer_asl;
45     float layer_thickness;
46     float layer_transition;
47     float size;
48     float scale;
49
50     // for handling texture coordinates to simulate cloud movement
51     // from winds, and to simulate the clouds being tied to ground
52     // position, not view position
53     // double xoff, yoff;
54     double last_lon, last_lat;
55
56 public:
57
58     // Constructor
59     SGCloudLayer( void );
60
61     // Destructor
62     ~SGCloudLayer( void );
63
64     // build the cloud object
65     void build( FGPath path, double size, double asl, double thickness,
66                 double transition );
67
68     // repaint the cloud colors based on current value of sun_angle,
69     // sky, and fog colors.  This updates the color arrays for
70     // ssgVtxTable.
71     // sun angle in degrees relative to verticle
72     // 0 degrees = high noon
73     // 90 degrees = sun rise/set
74     // 180 degrees = darkest midnight
75     bool repaint( sgVec3 fog_color );
76
77     // reposition the cloud layer at the specified origin and
78     // orientation
79     // lon specifies a rotation about the Z axis
80     // lat specifies a rotation about the new Y axis
81     // spin specifies a rotation about the new Z axis (and orients the
82     // sunrise/set effects
83     bool reposition( sgVec3 p, sgVec3 up, double lon, double lat, double alt );
84
85     // draw the cloud layer
86     void draw();
87
88     inline float get_asl() const { return layer_asl; }
89     inline float get_thickness() const { return layer_thickness; }
90     inline float get_transition() const { return layer_transition; }
91 };
92
93
94 #endif // _SG_CLOUD_HXX_