]> git.mxchange.org Git - simgear.git/blob - simgear/sky/cloud.hxx
Cloud texcoord fixes to tie apparent cloud position to earth even though
[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     ssgTransform *layer_transform;
36     ssgSimpleState *layer_state;
37
38     ssgColourArray *cl; 
39     ssgVertexArray *vl;
40     ssgTexCoordArray *tl;
41
42     // height above sea level (meters)
43     float layer_asl;
44     float size;
45
46     // for handling texture coordinates to simulate cloud movement
47     // from winds, and to simulate the clouds being tied to ground
48     // position, not view position
49     // double xoff, yoff;
50     double last_lon, last_lat;
51
52 public:
53
54     // Constructor
55     SGCloudLayer( void );
56
57     // Destructor
58     ~SGCloudLayer( void );
59
60     // build the cloud object
61     ssgBranch *build( FGPath path, double size, double asl );
62
63     // repaint the cloud colors based on current value of sun_angle,
64     // sky, and fog colors.  This updates the color arrays for
65     // ssgVtxTable.
66     // sun angle in degrees relative to verticle
67     // 0 degrees = high noon
68     // 90 degrees = sun rise/set
69     // 180 degrees = darkest midnight
70     bool repaint( sgVec3 fog_color );
71
72     // reposition the cloud layer at the specified origin and
73     // orientation
74     // lon specifies a rotation about the Z axis
75     // lat specifies a rotation about the new Y axis
76     // spin specifies a rotation about the new Z axis (and orients the
77     // sunrise/set effects
78     bool reposition( sgVec3 p, sgVec3 up, double lon, double lat );
79 };
80
81
82 #endif // _SG_CLOUD_HXX_