]> git.mxchange.org Git - simgear.git/blob - simgear/sky/skydome.hxx
Working on ssg-ifying sky.
[simgear.git] / simgear / sky / skydome.hxx
1 // skydome.hxx -- model sky with an upside down "bowl"
2 //
3 // Written by Curtis Olson, started December 1997.
4 // SSG-ified by Curtis Olson, February 2000.
5 //
6 // Copyright (C) 1997-2000  Curtis L. Olson  - curt@flightgear.org
7 //
8 // This program is free software; you can redistribute it and/or
9 // modify it under the terms of the GNU General Public License as
10 // published by the Free Software Foundation; either version 2 of the
11 // License, or (at your option) any later version.
12 //
13 // This program is distributed in the hope that it will be useful, but
14 // WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16 // General Public License for more details.
17 //
18 // You should have received a copy of the GNU General Public License
19 // along with this program; if not, write to the Free Software
20 // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 //
22 // $Id$
23
24
25 #ifndef _SKYDOME_HXX
26 #define _SKYDOME_HXX
27
28
29 #ifndef __cplusplus                                                          
30 # error This library requires C++
31 #endif                                   
32
33
34 #include <plib/ssg.h>           // plib include
35
36
37 class FGSkyDome {
38     // scene graph root for the skydome
39     ssgRoot *dome;
40
41     ssgSelector *dome_selector;
42     ssgTransform *dome_transform;
43     ssgSimpleState *dome_state;
44
45     ssgVertexArray *center_disk_vl;
46     ssgColourArray *center_disk_cl;
47
48     ssgVertexArray *upper_ring_vl;
49     ssgColourArray *upper_ring_cl;
50
51     ssgVertexArray *middle_ring_vl;
52     ssgColourArray *middle_ring_cl;
53
54     ssgVertexArray *lower_ring_vl;
55     ssgColourArray *lower_ring_cl;
56
57 public:
58
59     // Constructor
60     FGSkyDome( void );
61
62     // Destructor
63     ~FGSkyDome( void );
64
65     // initialize the sky object and connect it into our scene graph
66     // root
67     bool initialize();
68
69     // repaint the sky colors based on current value of sun_angle,
70     // sky, and fog colors.  This updates the color arrays for
71     // ssgVtxTable.
72     // sun angle in degrees relative to verticle
73     // 0 degrees = high noon
74     // 90 degrees = sun rise/set
75     // 180 degrees = darkest midnight
76     bool repaint( sgVec3 sky_color, sgVec3 fog_color, double sun_angle );
77
78     // reposition the sky at the specified origin and 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, double lon, double lat, double spin );
84
85     // Draw the skydome
86     bool draw();
87
88     // enable the sky in the scene graph (default)
89     void enable() { dome_selector->select( 1 ); }
90
91     // disable the sky in the scene graph.  The leaf node is still
92     // there, how ever it won't be traversed on the cullandrender
93     // phase.
94     void disable() { dome_selector->select( 0 ); }
95
96 };
97
98
99 // (Re)generate the display list
100 // void fgSkyInit();
101
102 // (Re)calculate the sky colors at each vertex
103 // void fgSkyColorsInit();
104
105 // Draw the Sky
106 // void fgSkyRender();
107
108
109 #endif // _SKYDOM_HXX
110
111