]> git.mxchange.org Git - simgear.git/blob - simgear/scene/sky/newcloud.hxx
Improved tile cache priority scheme.
[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 <simgear/compiler.h>
27 #include <string>
28 #include <vector>
29 #include <osg/Fog>
30
31 #include <simgear/scene/material/Effect.hxx>
32 #include <simgear/scene/material/EffectGeode.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<simgear::EffectGeode> 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
76 private:
77
78         double min_width;
79         double max_width;
80         double min_height;
81         double max_height;
82         double min_sprite_width;
83         double max_sprite_width;
84         double min_sprite_height;
85         double max_sprite_height;
86         double bottom_shade;
87         int num_sprites;
88         int num_textures_x;
89         int num_textures_y;
90         const string texture;
91         const string name;
92         osg::Geometry* quad;
93         osg::ref_ptr<simgear::Effect> effect;
94         static double sprite_density;
95
96         osg::Geometry* createOrthQuad(float w, float h, int varieties_x, int varieties_y);
97
98 };
99
100
101
102 #endif // _NEWCLOUD_HXX