SimGear - Simulator Construction Tools
SGCloudLayer Class Reference

#include <cloud.hxx>

Inheritance diagram for SGCloudLayer:
SGReferenced

Public Types

enum  Coverage {
  SG_CLOUD_OVERCAST = 0, SG_CLOUD_BROKEN, SG_CLOUD_SCATTERED, SG_CLOUD_FEW,
  SG_CLOUD_CIRRUS, SG_CLOUD_CLEAR, SG_MAX_CLOUD_COVERAGES
}
 

Public Member Functions

 SGCloudLayer (const std::string &tex_path)
 
 ~SGCloudLayer (void)
 
SGCloudFieldget_layer3D (void)
 
Coverage getCoverage () const
 
const std::string & getCoverageString () const
 
float getDirection ()
 
float getElevation_m () const
 
float getMaxAlpha () const
 
osg::SwitchgetNode ()
 
float getSpan_m () const
 
float getSpeed ()
 
float getThickness_m () const
 
float getTransition_m () const
 
float getVisibility_m () const
 
void rebuild ()
 
bool repaint (const SGVec3f &fog_color)
 
bool reposition (const SGVec3f &p, const SGVec3f &up, double lon, double lat, double alt, double dt=0.0)
 
void set_enable3dClouds (bool enable)
 
void setAlpha (float alpha)
 
void setCoverage (Coverage coverage)
 
void setCoverageString (const std::string &coverage)
 
void setDirection (float dir)
 
void setElevation_m (float elevation_m, bool set_span=true)
 
void setMaxAlpha (float alpha)
 
void setSpan_m (float span_m)
 
void setSpeed (float sp)
 
void setThickness_m (float thickness_m)
 
void setTransition_m (float transition_m)
 
void setVisibility_m (float visibility_m)
 

Static Public Member Functions

static unsigned count (const SGReferenced *ref)
 
static unsigned get (const SGReferenced *ref)
 
static const std::string & getCoverageString (Coverage coverage)
 
static Coverage getCoverageType (const std::string &coverage)
 
static unsigned put (const SGReferenced *ref)
 
static bool shared (const SGReferenced *ref)
 

Static Public Attributes

static const std::string SG_CLOUD_BROKEN_STRING = "broken"
 
static const std::string SG_CLOUD_CIRRUS_STRING = "cirrus"
 
static const std::string SG_CLOUD_CLEAR_STRING = "clear"
 
static const std::string SG_CLOUD_FEW_STRING = "few"
 
static const std::string SG_CLOUD_OVERCAST_STRING = "overcast"
 
static const std::string SG_CLOUD_SCATTERED_STRING = "scattered"
 

Protected Member Functions

void setTextureOffset (const osg::Vec2 &offset)
 

Private Attributes

osg::Vec2 base
 
osg::ref_ptr< osg::Vec4Array > cl [4]
 
float cloud_alpha
 
osg::ref_ptr< osg::Switchcloud_root
 
float direction
 
osg::ref_ptr< osg::Groupgroup_bottom
 
osg::ref_ptr< osg::Groupgroup_top
 
double last_course
 
SGGeod last_pos
 
osg::ref_ptr< osg::Geodelayer [4]
 
SGCloudFieldlayer3D
 
float layer_asl
 
Coverage layer_coverage
 
osg::ref_ptr< osg::Switchlayer_root
 
float layer_span
 
float layer_thickness
 
osg::ref_ptr< osg::MatrixTransformlayer_transform
 
float layer_transition
 
float layer_visibility
 
double max_alpha
 
float scale
 
float speed
 
SGPath texture_path
 
osg::ref_ptr< osg::Vec2Array > tl [4]
 
osg::ref_ptr< osg::Vec3Array > tl2 [4]
 
osg::ref_ptr< osg::Vec3Array > vl [4]
 

Detailed Description

A class layer to model a single cloud layer

Definition at line 49 of file cloud.hxx.

Member Enumeration Documentation

This is the list of available cloud coverages/textures

Enumerator
SG_CLOUD_OVERCAST 
SG_CLOUD_BROKEN 
SG_CLOUD_SCATTERED 
SG_CLOUD_FEW 
SG_CLOUD_CIRRUS 
SG_CLOUD_CLEAR 
SG_MAX_CLOUD_COVERAGES 

Definition at line 55 of file cloud.hxx.

Constructor & Destructor Documentation

SGCloudLayer::SGCloudLayer ( const std::string &  tex_path)

Constructor

Parameters
tex_paththe path to the set of cloud textures

Definition at line 96 of file cloud.cxx.

SGCloudLayer::~SGCloudLayer ( void  )

Destructor

Definition at line 175 of file cloud.cxx.

Member Function Documentation

static unsigned SGReferenced::count ( const SGReferenced ref)
inlinestaticinherited
SGCloudField* SGCloudLayer::get_layer3D ( void  )
inline

return the 3D layer cloud associated with this 2D layer

Definition at line 230 of file cloud.hxx.

SGCloudLayer::Coverage SGCloudLayer::getCoverage ( ) const

get coverage type

Definition at line 251 of file cloud.cxx.

Referenced by reposition().

const std::string & SGCloudLayer::getCoverageString ( ) const

get coverage as string

Definition at line 304 of file cloud.cxx.

const std::string & SGCloudLayer::getCoverageString ( Coverage  coverage)
static

get coverage as string

Definition at line 266 of file cloud.cxx.

SGCloudLayer::Coverage SGCloudLayer::getCoverageType ( const std::string &  coverage)
static

get coverage type from string

Definition at line 286 of file cloud.cxx.

Referenced by setCoverageString().

float SGCloudLayer::getDirection ( )
inline

get the cloud movement direction

Definition at line 164 of file cloud.hxx.

float SGCloudLayer::getElevation_m ( ) const

get the layer elevation (in meters)

Definition at line 196 of file cloud.cxx.

float SGCloudLayer::getMaxAlpha ( ) const
inline

Definition at line 196 of file cloud.hxx.

osg::Switch* SGCloudLayer::getNode ( )
inline

Definition at line 227 of file cloud.hxx.

Referenced by SGSky::add_cloud_layer().

float SGCloudLayer::getSpan_m ( ) const

get the cloud span (in meters)

Definition at line 181 of file cloud.cxx.

float SGCloudLayer::getSpeed ( )
inline

get the cloud movement speed

Definition at line 176 of file cloud.hxx.

float SGCloudLayer::getThickness_m ( ) const

get the layer thickness

Definition at line 215 of file cloud.cxx.

float SGCloudLayer::getTransition_m ( ) const

get the transition/boundary layer depth in meters. This allows gradual entry/exit from the cloud layer via adjusting visibility.

Definition at line 239 of file cloud.cxx.

float SGCloudLayer::getVisibility_m ( ) const

get the layer visibility

Definition at line 227 of file cloud.cxx.

static unsigned SGReferenced::put ( const SGReferenced ref)
inlinestaticinherited

Definition at line 46 of file SGReferenced.hxx.

void SGCloudLayer::rebuild ( )

build the cloud object

Definition at line 337 of file cloud.cxx.

Referenced by setCoverage(), setSpan_m(), and SGCloudLayer().

bool SGCloudLayer::repaint ( const SGVec3f fog_color)

repaint the cloud colors based on the specified fog_color

Parameters
fog_colorthe fog color

Definition at line 486 of file cloud.cxx.

bool SGCloudLayer::reposition ( const SGVec3f p,
const SGVec3f up,
double  lon,
double  lat,
double  alt,
double  dt = 0.0 
)

reposition the cloud layer at the specified origin and orientation.

Parameters
pposition vector
upthe local up vector
lonTODO
latTODO
altTODO
dtthe time elapsed since the last call

Definition at line 503 of file cloud.cxx.

void SGCloudLayer::set_enable3dClouds ( bool  enable)

Enable/disable 3D clouds in this layer

Definition at line 652 of file cloud.cxx.

Referenced by SGSky::add_cloud_layer().

void SGCloudLayer::setAlpha ( float  alpha)
inline

set the alpha component of the cloud base color. Normally this should be 1.0, but you can set it anywhere in the range of 0.0 to 1.0 to fade a cloud layer in or out.

Parameters
alphacloud alpha value (0.0 to 1.0)

Definition at line 184 of file cloud.hxx.

void SGCloudLayer::setCoverage ( Coverage  coverage)

set coverage type

Parameters
coveragethe coverage type

Definition at line 257 of file cloud.cxx.

Referenced by setCoverageString().

void SGCloudLayer::setCoverageString ( const std::string &  coverage)

set coverage as string

Definition at line 310 of file cloud.cxx.

void SGCloudLayer::setDirection ( float  dir)
inline

set the cloud movement direction

Parameters
dirthe cloud movement direction

Definition at line 158 of file cloud.hxx.

void SGCloudLayer::setElevation_m ( float  elevation_m,
bool  set_span = true 
)

set the layer elevation. Note that this specifies the bottom of the cloud layer. The elevation of the top of the layer is elevation_m + thickness_m.

Parameters
elevation_mthe layer elevation in meters
set_spandefines whether it is allowed to adjust the span

Definition at line 202 of file cloud.cxx.

void SGCloudLayer::setMaxAlpha ( float  alpha)
inline

Definition at line 190 of file cloud.hxx.

void SGCloudLayer::setSpan_m ( float  span_m)

set the cloud span

Parameters
span_mthe cloud span in meters

Definition at line 187 of file cloud.cxx.

Referenced by setElevation_m().

void SGCloudLayer::setSpeed ( float  sp)
inline

set the cloud movement speed

Parameters
spthe cloud movement speed

Definition at line 170 of file cloud.hxx.

void SGCloudLayer::setTextureOffset ( const osg::Vec2 &  offset)
protected

Definition at line 316 of file cloud.cxx.

Referenced by rebuild(), and reposition().

void SGCloudLayer::setThickness_m ( float  thickness_m)

set the layer thickness.

Parameters
thickness_mthe layer thickness in meters.

Definition at line 221 of file cloud.cxx.

void SGCloudLayer::setTransition_m ( float  transition_m)

set the transition layer size in meters

Parameters
transition_mthe transition layer size in meters

Definition at line 245 of file cloud.cxx.

void SGCloudLayer::setVisibility_m ( float  visibility_m)

set the layer visibility

Parameters
visibility_mthe layer minimum visibility in meters.

Definition at line 233 of file cloud.cxx.

static bool SGReferenced::shared ( const SGReferenced ref)
inlinestaticinherited

Definition at line 50 of file SGReferenced.hxx.

Member Data Documentation

osg::Vec2 SGCloudLayer::base
private

Definition at line 269 of file cloud.hxx.

Referenced by rebuild(), reposition(), and SGCloudLayer().

osg::ref_ptr<osg::Vec4Array> SGCloudLayer::cl[4]
private

Definition at line 244 of file cloud.hxx.

Referenced by rebuild().

float SGCloudLayer::cloud_alpha
private

Definition at line 242 of file cloud.hxx.

Referenced by repaint(), and setAlpha().

osg::ref_ptr<osg::Switch> SGCloudLayer::cloud_root
private

Definition at line 236 of file cloud.hxx.

Referenced by getNode(), set_enable3dClouds(), and SGCloudLayer().

float SGCloudLayer::direction
private

Definition at line 259 of file cloud.hxx.

Referenced by getDirection(), reposition(), and setDirection().

osg::ref_ptr<osg::Group> SGCloudLayer::group_bottom
private

Definition at line 238 of file cloud.hxx.

Referenced by rebuild(), reposition(), and SGCloudLayer().

osg::ref_ptr<osg::Group> SGCloudLayer::group_top
private

Definition at line 238 of file cloud.hxx.

Referenced by rebuild(), reposition(), and SGCloudLayer().

double SGCloudLayer::last_course
private

Definition at line 266 of file cloud.hxx.

Referenced by reposition().

SGGeod SGCloudLayer::last_pos
private

Definition at line 265 of file cloud.hxx.

Referenced by reposition().

osg::ref_ptr<osg::Geode> SGCloudLayer::layer[4]
private

Definition at line 240 of file cloud.hxx.

Referenced by rebuild().

SGCloudField* SGCloudLayer::layer3D
private

Definition at line 271 of file cloud.hxx.

Referenced by get_layer3D(), reposition(), set_enable3dClouds(), SGCloudLayer(), and ~SGCloudLayer().

float SGCloudLayer::layer_asl
private

Definition at line 252 of file cloud.hxx.

Referenced by getElevation_m(), rebuild(), reposition(), and setElevation_m().

Coverage SGCloudLayer::layer_coverage
private

Definition at line 256 of file cloud.hxx.

Referenced by getCoverage(), getCoverageString(), rebuild(), and setCoverage().

osg::ref_ptr<osg::Switch> SGCloudLayer::layer_root
private

Definition at line 237 of file cloud.hxx.

Referenced by repaint(), reposition(), set_enable3dClouds(), setTextureOffset(), and SGCloudLayer().

float SGCloudLayer::layer_span
private

Definition at line 251 of file cloud.hxx.

Referenced by getSpan_m(), rebuild(), and setSpan_m().

float SGCloudLayer::layer_thickness
private

Definition at line 253 of file cloud.hxx.

Referenced by getThickness_m(), reposition(), and setThickness_m().

osg::ref_ptr<osg::MatrixTransform> SGCloudLayer::layer_transform
private

Definition at line 239 of file cloud.hxx.

Referenced by rebuild(), reposition(), and SGCloudLayer().

float SGCloudLayer::layer_transition
private

Definition at line 254 of file cloud.hxx.

Referenced by getTransition_m(), and setTransition_m().

float SGCloudLayer::layer_visibility
private

Definition at line 255 of file cloud.hxx.

Referenced by getVisibility_m(), and setVisibility_m().

double SGCloudLayer::max_alpha
private

Definition at line 267 of file cloud.hxx.

Referenced by getMaxAlpha(), setAlpha(), and setMaxAlpha().

float SGCloudLayer::scale
private

Definition at line 257 of file cloud.hxx.

Referenced by rebuild(), and reposition().

const std::string SGCloudLayer::SG_CLOUD_BROKEN_STRING = "broken"
static

Definition at line 66 of file cloud.hxx.

Referenced by getCoverageString(), and getCoverageType().

const std::string SGCloudLayer::SG_CLOUD_CIRRUS_STRING = "cirrus"
static

Definition at line 69 of file cloud.hxx.

Referenced by getCoverageString(), and getCoverageType().

const std::string SGCloudLayer::SG_CLOUD_CLEAR_STRING = "clear"
static

Definition at line 70 of file cloud.hxx.

Referenced by getCoverageString().

const std::string SGCloudLayer::SG_CLOUD_FEW_STRING = "few"
static

Definition at line 68 of file cloud.hxx.

Referenced by getCoverageString(), and getCoverageType().

const std::string SGCloudLayer::SG_CLOUD_OVERCAST_STRING = "overcast"
static

Definition at line 65 of file cloud.hxx.

Referenced by getCoverageString(), and getCoverageType().

const std::string SGCloudLayer::SG_CLOUD_SCATTERED_STRING = "scattered"
static

Definition at line 67 of file cloud.hxx.

Referenced by getCoverageString(), and getCoverageType().

float SGCloudLayer::speed
private

Definition at line 258 of file cloud.hxx.

Referenced by getSpeed(), reposition(), and setSpeed().

SGPath SGCloudLayer::texture_path
private

Definition at line 250 of file cloud.hxx.

Referenced by rebuild().

osg::ref_ptr<osg::Vec2Array> SGCloudLayer::tl[4]
private

Definition at line 246 of file cloud.hxx.

Referenced by rebuild().

osg::ref_ptr<osg::Vec3Array> SGCloudLayer::tl2[4]
private

Definition at line 247 of file cloud.hxx.

osg::ref_ptr<osg::Vec3Array> SGCloudLayer::vl[4]
private

Definition at line 245 of file cloud.hxx.

Referenced by rebuild().


The documentation for this class was generated from the following files: