]> git.mxchange.org Git - simgear.git/blob - simgear/scene/sky/newcloud.hxx
Merge branch 'ehofman/sound'
[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 #include <simgear/scene/material/Effect.hxx>
35 #include <simgear/scene/material/EffectGeode.hxx>
36
37 using std::string;
38 using std::vector;
39
40 /**
41  * 3D cloud class.
42  */
43 class SGNewCloud {
44
45 public:
46         SGNewCloud(string type,
47                    const SGPath &tex_path, 
48                     string tex,
49                     double min_w,
50                     double max_w,
51                     double min_h,
52                     double max_h,
53                     double min_sprite_w,
54                     double max_sprite_w,
55                     double min_sprite_h,
56                     double max_sprite_h,
57                     double b,
58                     int n,
59                     int nt_x,
60                     int nt_y);
61
62         ~SGNewCloud();
63
64         // Generate a Cloud
65         osg::ref_ptr<simgear::EffectGeode> genCloud ();
66
67         static double getDensity(void)
68         {
69             return sprite_density;
70         }
71     
72         // Set the sprite density
73         static void setDensity(double d)
74         {
75             sprite_density = d;
76         }
77         
78
79 private:
80
81         double min_width;
82         double max_width;
83         double min_height;
84         double max_height;
85         double min_sprite_width;
86         double max_sprite_width;
87         double min_sprite_height;
88         double max_sprite_height;
89         double bottom_shade;
90         int num_sprites;
91         int num_textures_x;
92         int num_textures_y;
93         const string texture;
94         const string name;
95         osg::Geometry* quad;
96         osg::ref_ptr<simgear::Effect> effect;
97         static double sprite_density;
98
99         osg::Geometry* createOrthQuad(float w, float h, int varieties_x, int varieties_y);
100
101 };
102
103
104
105 #endif // _NEWCLOUD_HXX