]> git.mxchange.org Git - simgear.git/blob - simgear/scene/sky/newcloud.hxx
Stuart Buchanan :
[simgear.git] / simgear / scene / sky / newcloud.hxx
1 // 3D cloud class
2 //
3 // Written by Harald JOHNSEN, started April 2005.
4 //
5 // Copyright (C) 2005  Harald JOHNSEN - hjohnsen@evc.net
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., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
20 //
21 //
22
23 #ifndef _NEWCLOUD_HXX
24 #define _NEWCLOUD_HXX
25
26 #include <plib/sg.h>
27 #include <simgear/compiler.h>
28 #include <string>
29 #include <vector>
30 #include <osg/Fog>
31
32 #include "bbcache.hxx"
33
34 using std::string;
35 using std::vector;
36
37 /**
38  * 3D cloud class.
39  */
40 class SGNewCloud {
41
42 public:
43         SGNewCloud(string type,
44                    const SGPath &tex_path, 
45                     string tex,
46                     double min_w,
47                     double max_w,
48                     double min_h,
49                     double max_h,
50                     double min_sprite_w,
51                     double max_sprite_w,
52                     double min_sprite_h,
53                     double max_sprite_h,
54                     double b,
55                     int n,
56                     int nt_x,
57                     int nt_y);
58
59         ~SGNewCloud();
60
61         // Generate a Cloud
62         osg::ref_ptr<osg::Geode> genCloud ();
63
64         static double getDensity(void)
65         {
66             return sprite_density;
67         }
68     
69         // Set the sprite density
70         static void setDensity(double d)
71         {
72             sprite_density = d;
73         }
74         
75         static int getNumFlavours(void)
76         {
77             return num_flavours;
78         }
79     
80         // Set the number of flavours of this cloud.
81         // This is the number of different instances
82         // to generate.
83         static void setNumFlavours(int d)
84         {
85             num_flavours = d;
86         }
87         
88
89 private:
90
91         double min_width;
92         double max_width;
93         double min_height;
94         double max_height;
95         double min_sprite_width;
96         double max_sprite_width;
97         double min_sprite_height;
98         double max_sprite_height;
99         double bottom_shade;
100         int num_sprites;
101         int num_textures_x;
102         int num_textures_y;
103         const string texture;
104         const string name;
105         osg::Geometry* quad;
106         osg::ref_ptr<osg::StateSet> stateSet;
107         static double sprite_density;
108         static unsigned int num_flavours; 
109
110         osg::Geometry* createOrthQuad(float w, float h, int varieties_x, int varieties_y);
111
112 };
113
114
115
116 #endif // _NEWCLOUD_HXX