]> git.mxchange.org Git - simgear.git/blob - simgear/scene/sky/newcloud.hxx
Downgrade "Please decompress this texture for increased portability"
[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/math/sg_random.h>
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(const SGPath &texture_root, const SGPropertyNode *cld_def, mt* s);
45
46         ~SGNewCloud();
47
48         // Generate a Cloud
49         osg::ref_ptr<simgear::EffectGeode> genCloud ();
50
51         static float getDensity(void)
52         {
53             return sprite_density;
54         }
55     
56         // Set the sprite density
57         static void setDensity(double d)
58         {
59             sprite_density = d;
60         }
61         
62
63 private:
64
65         float min_width;
66         float max_width;
67         float min_height;
68         float max_height;
69         float min_sprite_width;
70         float max_sprite_width;
71         float min_sprite_height;
72         float max_sprite_height;
73         
74         // Minimum and maximum bottom, middle, top, sunny, shade lighting
75         // factors. For individual clouds we choose a bottom/middle/top
76         // shade from between each min/max value
77         float min_bottom_lighting_factor;
78         float max_bottom_lighting_factor;
79         float min_middle_lighting_factor;
80         float max_middle_lighting_factor;
81         float min_top_lighting_factor;
82         float max_top_lighting_factor;
83         float min_shade_lighting_factor;
84         float max_shade_lighting_factor;
85         
86         // The density of the cloud is the shading applied
87         // to cloud sprites on the opposite side of the cloud
88         // from the sun. For an individual cloud instance a value
89         // between min_density and max_density is chosen.
90         float min_density;
91         float max_density;
92         
93         // zscale indicates how sprites should be scaled vertically
94         // after billboarding. 
95         float zscale;
96         bool height_map_texture;
97         int num_sprites;
98         int num_textures_x;
99         int num_textures_y;
100         string texture;
101         osg::Geometry* quad;
102         osg::ref_ptr<simgear::Effect> effect;
103         static float sprite_density;
104         
105         // RNG seed for this cloud
106         mt* seed;
107
108         osg::Geometry* createOrthQuad(float w, float h, int varieties_x, int varieties_y);
109 };
110
111
112
113 #endif // _NEWCLOUD_HXX