]> git.mxchange.org Git - simgear.git/blob - simgear/scene/sky/cloudfield.hxx
Don't refference GLUT but GLU instead.
[simgear.git] / simgear / scene / sky / cloudfield.hxx
1 // a layer of 3d clouds
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, 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
20 //
21 //
22
23 #ifndef _CLOUDFIELD_HXX
24 #define _CLOUDFIELD_HXX
25
26 #include <plib/sg.h>
27 #include <simgear/compiler.h>
28 #include <vector>
29
30
31 SG_USING_STD(vector);
32
33 class SGNewCloud;
34
35 class culledCloud {
36 public:
37         SGNewCloud      *aCloud;
38         sgVec3          eyePos;
39         float           dist;
40         bool operator<(const culledCloud &b) const {
41                 return (this->dist < b.dist);
42         }
43 };
44 typedef vector<culledCloud> list_of_culledCloud;
45
46 class SGCloudField {
47
48 private:
49         class Cloud  {
50         public:
51                 SGNewCloud      *aCloud;
52                 sgVec3          pos;
53 //              float           dist;
54 //              bool            culled;
55
56 //              bool operator<(const Cloud &b) {
57 //                      return this->dist < b.dist;
58 //              }
59         };
60
61
62         typedef vector<Cloud> list_of_Cloud;
63
64         // cull all clouds of a tiled field
65         void cullClouds(sgVec3 eyePos, sgMat4 mat);
66
67         list_of_Cloud theField;
68         // this is a relative position only, with that we can move all clouds at once
69         sgVec3 relative_position;
70 //      double lon, lat;
71
72         sgFrustum frustum;
73
74         sgMat4 transform;
75         double deltax, deltay, alt;
76
77 public:
78
79         SGCloudField();
80         ~SGCloudField();
81
82         // add one cloud, data is not copied, ownership given
83         void addCloud( sgVec3 pos, SGNewCloud *cloud);
84
85         // for debug only
86         void buildTestLayer(void);
87
88         // Render a cloud field
89         void Render(void);
90
91         // reposition the cloud layer at the specified origin and orientation
92         void reposition( sgVec3 p, sgVec3 up, double lon, double lat, double alt, double dt);
93
94         // visibility distance for clouds in meters
95         static float CloudVis;
96
97         static float density;
98
99         static double fieldSize;
100         static bool enable3D;
101
102         // return the size of the memory pool used by texture impostors
103         static int get_CacheSize(void);
104         static float get_CloudVis(void) { return CloudVis; }
105         static float get_density(void) { return density; }
106         static bool get_enable3dClouds(void) { return enable3D; }
107
108         static void set_CacheSize(int sizeKb);
109         static void set_CloudVis(float distance);
110         static void set_density(float density);
111         static void set_enable3dClouds(bool enable);
112 };
113
114 #endif // _CLOUDFIELD_HXX