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