]> git.mxchange.org Git - simgear.git/blob - simgear/scene/sky/dome.hxx
Downgrade "Please decompress this texture for increased portability"
[simgear.git] / simgear / scene / sky / dome.hxx
1 // dome.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  - http://www.flightgear.org/~curt
7 //
8 // This library is free software; you can redistribute it and/or
9 // modify it under the terms of the GNU Library General Public
10 // License as published by the Free Software Foundation; either
11 // version 2 of the License, or (at your option) any later version.
12 //
13 // This library is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16 // Library 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., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
21
22 #ifndef _SKYDOME_HXX
23 #define _SKYDOME_HXX
24
25
26 #ifndef __cplusplus
27 # error This library requires C++
28 #endif
29
30 #include <osg/ref_ptr>
31 #include <osg/Array>
32 #include <osg/MatrixTransform>
33
34 #include <simgear/structure/SGReferenced.hxx>
35 #include <simgear/math/SGMath.hxx>
36
37 namespace osg
38 {
39 class DrawElementsUShort;
40 }
41
42 namespace simgear {
43 class SGReaderWriterOptions;
44 }
45
46 class SGSkyDome : public SGReferenced {
47     osg::ref_ptr<osg::MatrixTransform> dome_transform;
48     double asl;
49
50     osg::ref_ptr<osg::Vec3Array> dome_vl;
51     osg::ref_ptr<osg::Vec3Array> dome_cl;
52 public:
53
54     // Constructor
55     SGSkyDome( void );
56
57     // Destructor
58     ~SGSkyDome( void );
59
60     // initialize the sky object and connect it into our scene graph
61     // root
62     osg::Node *build( double hscale = 80000.0, double vscale = 80000.0, simgear::SGReaderWriterOptions *options = 0 );
63
64     // repaint the sky colors based on current value of sun_angle,
65     // sky, and fog colors.  This updates the color arrays for
66     // ssgVtxTable.
67     // sun angle in degrees relative to verticle
68     // 0 degrees = high noon
69     // 90 degrees = sun rise/set
70     // 180 degrees = darkest midnight
71     bool repaint( const SGVec3f& sun_color, const SGVec3f& sky_color,
72                   const SGVec3f& fog_color, double sun_angle, double vis );
73
74     // reposition the sky at the specified origin and orientation
75     // lon specifies a rotation about the Z axis
76     // lat specifies a rotation about the new Y axis
77     // spin specifies a rotation about the new Z axis (and orients the
78     // sunrise/set effects
79     bool reposition( const SGVec3f& p, double asl,
80                      double lon, double lat, double spin );
81 private:
82     void makeDome(int rings, int bands, osg::DrawElementsUShort& elements);
83 };
84
85
86 #endif // _SKYDOME_HXX