1 // a layer of 3d clouds
3 // Written by Harald JOHNSEN, started April 2005.
5 // Copyright (C) 2005 Harald JOHNSEN - hjohnsen@evc.net
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.
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.
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
23 #ifndef _CLOUDFIELD_HXX
24 #define _CLOUDFIELD_HXX
27 #include <simgear/compiler.h>
42 bool operator<(const culledCloud &b) const {
43 return (this->dist < b.dist);
46 typedef vector<culledCloud> list_of_culledCloud;
49 * A layer of 3D clouds.
62 typedef vector<Cloud> list_of_Cloud;
64 // cull all clouds of a tiled field
65 void cullClouds(sgVec3 eyePos, sgMat4 mat);
67 void applyDensity(void);
69 list_of_Cloud theField;
70 // this is a relative position only, with that we can move all clouds at once
71 sgVec3 relative_position;
77 double deltax, deltay, alt;
78 double last_lon, last_lat, last_course;
79 sgSphere field_sphere;
90 // add one cloud, data is not copied, ownership given
91 void addCloud( sgVec3 pos, SGNewCloud *cloud);
94 void buildTestLayer(void);
96 // Render a cloud field
99 // reposition the cloud layer at the specified origin and orientation
100 void reposition( sgVec3 p, sgVec3 up, double lon, double lat, double alt, double dt, float direction, float speed);
102 bool is3D(void) { return draw_in_3d; }
104 // visibility distance for clouds in meters
105 static float CloudVis;
107 static sgVec3 view_vec, view_X, view_Y;
109 static float density;
110 static double timer_dt;
111 static double fieldSize;
112 static bool enable3D;
114 // return the size of the memory pool used by texture impostors
115 static int get_CacheSize(void);
116 static int get_CacheResolution(void);
117 static float get_CloudVis(void) { return CloudVis; }
118 static float get_density(void) { return density; }
119 static bool get_enable3dClouds(void) { return enable3D; }
121 static void set_CacheSize(int sizeKb);
122 static void set_CacheResolution(int resolutionPixels);
123 static void set_CloudVis(float distance);
124 static void set_density(float density);
125 static void set_enable3dClouds(bool enable);
128 #endif // _CLOUDFIELD_HXX