/usr/include/simgear/scene/sky/cloudfield.hxx is in libsimgear-dev 3.4.0-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 | // a layer of 3d clouds
//
// Written by Harald JOHNSEN, started April 2005.
//
// Copyright (C) 2005 Harald JOHNSEN - hjohnsen@evc.net
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License as
// published by the Free Software Foundation; either version 2 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
//
//
#ifndef _CLOUDFIELD_HXX
#define _CLOUDFIELD_HXX
#include <simgear/compiler.h>
#include <vector>
#include <map>
#include <osgDB/ReaderWriter>
#include <osg/ref_ptr>
#include <osg/Array>
#include <osg/Geometry>
#include <osg/Group>
#include <osg/Switch>
namespace osg
{
class Fog;
class StateSet;
class Vec4f;
}
#include <simgear/misc/sg_path.hxx>
#include <simgear/structure/Singleton.hxx>
#include <simgear/math/SGMath.hxx>
using std::vector;
class SGNewCloud;
namespace simgear
{
class EffectGeode;
}
typedef std::map<int, osg::ref_ptr<osg::PositionAttitudeTransform> > CloudHash;
/**
* A layer of 3D clouds, defined by lat/long/alt.
*/
class SGCloudField {
private:
class Cloud {
public:
SGNewCloud *aCloud;
SGVec3f pos;
bool visible;
};
float Rnd(float);
// Theoretical maximum cloud depth, used for fudging the LoD
// ranges to ensure that clouds become visible at maximum range
static float MAX_CLOUD_DEPTH;
// this is a relative position only, with that we can move all clouds at once
SGVec3f relative_position;
osg::ref_ptr<osg::Group> field_root;
osg::ref_ptr<osg::Group> placed_root;
osg::ref_ptr<osg::PositionAttitudeTransform> field_transform;
osg::ref_ptr<osg::PositionAttitudeTransform> altitude_transform;
osg::ref_ptr<osg::LOD> field_lod;
osg::Vec3f old_pos;
CloudHash cloud_hash;
struct CloudFog : public simgear::Singleton<CloudFog>
{
CloudFog();
osg::ref_ptr<osg::Fog> fog;
};
void removeCloudFromTree(osg::ref_ptr<osg::PositionAttitudeTransform> transform);
void addCloudToTree(osg::ref_ptr<osg::PositionAttitudeTransform> transform, float lon, float lat, float alt, float x, float y);
void addCloudToTree(osg::ref_ptr<osg::PositionAttitudeTransform> transform, SGGeod loc, float x, float y);
void addCloudToTree(osg::ref_ptr<osg::PositionAttitudeTransform> transform, SGGeod loc);
void applyVisRangeAndCoverage(void);
public:
SGCloudField();
~SGCloudField();
void clear(void);
bool isDefined3D(void);
// add one cloud, data is not copied, ownership given
void addCloud( SGVec3f& pos, osg::ref_ptr<simgear::EffectGeode> cloud);
/**
* Add a new cloud with a given index at a specific point defined by lon/lat and an x/y offset
*/
bool addCloud(float lon, float lat, float alt, int index, osg::ref_ptr<simgear::EffectGeode> geode);
bool addCloud(float lon, float lat, float alt, float x, float y, int index, osg::ref_ptr<simgear::EffectGeode> geode);
// Cloud handling functions.
bool deleteCloud(int identifier);
bool repositionCloud(int identifier, float lon, float lat, float alt);
bool repositionCloud(int identifier, float lon, float lat, float alt, float x, float y);
/**
* reposition the cloud layer at the specified origin and
* orientation.
* @param p position vector
* @param up the local up vector
* @param lon specifies a rotation about the Z axis
* @param lat specifies a rotation about the new Y axis
* @param dt the time elapsed since the last call
* @param asl altitude of the layer
* @param speed of cloud layer movement (due to wind)
* @param direction of cloud layer movement (due to wind)
*/
bool reposition( const SGVec3f& p, const SGVec3f& up,
double lon, double lat, double dt, int asl, float speed, float direction);
osg::Group* getNode() { return field_root.get(); }
// visibility distance for clouds in meters
static float CloudVis;
static SGVec3f view_vec, view_X, view_Y;
static float view_distance;
static float impostor_distance;
static float lod1_range;
static float lod2_range;
static bool use_impostors;
static double timer_dt;
static float fieldSize;
static bool wrap;
static bool getWrap(void) { return wrap; }
static void setWrap(bool w) { wrap = w; }
static float getImpostorDistance(void) { return impostor_distance; }
static void setImpostorDistance(float d) { impostor_distance = d; }
static float getLoD1Range(void) { return lod1_range; }
static void setLoD1Range(int d) { lod1_range = d; }
static float getLoD2Range(void) { return lod2_range; }
static void setLoD2Range(int d) { lod2_range = d; }
static void setUseImpostors(bool b) { use_impostors = b; }
static bool getUseImpostors(void) { return use_impostors; }
static float getVisRange(void) { return view_distance; }
static void setVisRange(float d) { view_distance = d; }
void applyVisAndLoDRange(void);
static osg::Fog* getFog()
{
return CloudFog::instance()->fog.get();
}
static void updateFog(double visibility, const osg::Vec4f& color);
};
#endif // _CLOUDFIELD_HXX
|