dtCore::Environment Class Reference

A unique environment which controls lighting and visibility. More...

#include <environment.h>

Inheritance diagram for dtCore::Environment:

dtCore::DeltaDrawable dtCore::Base

List of all members.

Public Types

enum  FogMode { LINEAR = 0, EXP, EXP2, ADV }

Public Member Functions

 Environment (const std::string &name="Environment")
virtual void AddedToScene (Scene *scene)
 Notifies this object that it has been added to a Scene.
virtual bool AddChild (DeltaDrawable *child)
 Add a DeltaDrawable to be rendered using this Environment's properties.
void RemoveChild (DeltaDrawable *child)
 Remove a DeltaDrawable added to the Environment.
void AddEffect (EnvEffect *effect)
 Add an Environmental Effect to the Environment.
void RemEffect (EnvEffect *effect)
 Remove an EnvEffect from this Environment.
EnvEffectGetEffect (int idx)
 Get an Environmental Effect by its index.
int GetNumEffects ()
 Get the number of Environmental Effects in this Environment.
void SetSkyColor (const osg::Vec3 &color)
 Set the base color of the sky.
void GetSkyColor (osg::Vec3 &color) const
void SetFogColor (const osg::Vec3 &color)
 Set the base color of the fog.
void GetFogColor (osg::Vec3 &color) const
void GetModFogColor (osg::Vec3 &color) const
 Get the modified color of the fog.
void SetFogMode (FogMode mode)
 Set the fog mode.
FogMode GetFogMode () const
void SetAdvFogCtrl (const osg::Vec3 &src)
 Supply the advanced fog control values.
void GetAdvFogCtrl (osg::Vec3 &dst) const
void SetFogNear (float val)
 Set the fog near value (only used for FogMode::LINEAR.
float GetFogNear () const
void SetFogEnable (bool enable)
 Turns the fog effect on or off.
bool GetFogEnable () const
void SetFogDensity (float density)
float GetFogDensity ()
void SetVisibility (float distance)
 Set the visibility distance in meters.
float GetVisibility () const
void GetSunColor (osg::Vec3 &color)
 Get the current color of the sun.
void GetSunAzEl (float &az, float &el) const
osg::Vec2 GetSunAzEl () const
void Repaint ()
void Update (const double deltaFrameTime)
void SetDateTime (int yr, int mo, int da, int hr, int mi, int sc)
 Set the environment's date and time.
void SetDateTime (const DateTime &dateTime)
void GetDateTime (int &yr, int &mo, int &da, int &hr, int &mi, int &sc) const
 Get the current Date and Time of this Environment within a second.
DateTime GetDateTime () const
void SetRefLatLong (const osg::Vec2 &latLong)
 Set the ephemeris reference lat/long.
void GetRefLatLong (osg::Vec2 &latLong) const
osg::Node * GetOSGNode ()
 required by DeltaDrawable
const osg::Node * GetOSGNode () const
void SetOSGNode (osg::Node *pNode)

Protected Member Functions

virtual ~Environment ()

Classes

struct  DateTime
class  InterpTable


Detailed Description

A unique environment which controls lighting and visibility.

Member Enumeration Documentation

enum dtCore::Environment::FogMode

Enumerator:
LINEAR  Linear fog.
EXP  Exponential fog.
EXP2  Exponential squared fog.
ADV  Advanced light scattering "fog".


Constructor & Destructor Documentation

Environment::Environment ( const std::string &  name = "Environment"  ) 

Environment::~Environment (  )  [protected, virtual]


Member Function Documentation

void Environment::AddedToScene ( Scene scene  )  [virtual]

Notifies this object that it has been added to a Scene.

Reimplemented from dtCore::DeltaDrawable.

bool Environment::AddChild ( DeltaDrawable child  )  [virtual]

Add a DeltaDrawable to be rendered using this Environment's properties.

Add a DeltaDrawable to the Scene to be viewed.

Reimplemented from dtCore::DeltaDrawable.

void Environment::RemoveChild ( DeltaDrawable child  )  [virtual]

Remove a DeltaDrawable added to the Environment.

Remove a DeltaDrawable from the Environment Node.

Reimplemented from dtCore::DeltaDrawable.

void Environment::AddEffect ( EnvEffect effect  ) 

Add an Environmental Effect to the Environment.

void Environment::RemEffect ( EnvEffect effect  ) 

Remove an EnvEffect from this Environment.

This method checks to see if has previously been added, then puts the effect into a holding bin for removal at a later time.

EnvEffect* dtCore::Environment::GetEffect ( int  idx  )  [inline]

Get an Environmental Effect by its index.

int dtCore::Environment::GetNumEffects (  )  [inline]

Get the number of Environmental Effects in this Environment.

void dtCore::Environment::SetSkyColor ( const osg::Vec3 &  color  ) 

Set the base color of the sky.

void dtCore::Environment::GetSkyColor ( osg::Vec3 &  color  )  const [inline]

void dtCore::Environment::SetFogColor ( const osg::Vec3 &  color  ) 

Set the base color of the fog.

This color is then adjusted internally using the time of day. NOTE: This value is not used for the fog when the FogMode is ADV, but it still can be used by the EnvEffects.

void dtCore::Environment::GetFogColor ( osg::Vec3 &  color  )  const [inline]

void dtCore::Environment::GetModFogColor ( osg::Vec3 &  color  )  const [inline]

Get the modified color of the fog.

void dtCore::Environment::SetFogMode ( FogMode  mode  ) 

Set the fog mode.

Any Drawables added to the Environment will be fogged based on the FogMode. The ADV FogMode uses a pixel shader to calculate a somewhat physically correct fog/haze. LINEAR, EXP, and EXP2 use standard OpenGL Fog.

FogMode dtCore::Environment::GetFogMode (  )  const [inline]

void dtCore::Environment::SetAdvFogCtrl ( const osg::Vec3 &  src  )  [inline]

Supply the advanced fog control values.

void dtCore::Environment::GetAdvFogCtrl ( osg::Vec3 &  dst  )  const [inline]

void dtCore::Environment::SetFogNear ( float  val  ) 

Set the fog near value (only used for FogMode::LINEAR.

Set the fog's near value.

This is only used when the SetFogMode() is LINEAR.

Parameters:
val : the near value (meters)

float dtCore::Environment::GetFogNear (  )  const [inline]

void dtCore::Environment::SetFogEnable ( bool  enable  ) 

Turns the fog effect on or off.

bool dtCore::Environment::GetFogEnable (  )  const [inline]

void dtCore::Environment::SetFogDensity ( float  density  ) 

float dtCore::Environment::GetFogDensity (  ) 

void dtCore::Environment::SetVisibility ( float  distance  ) 

Set the visibility distance in meters.

Set's the distance at which the scene becomes fully "fogged".

Parameters:
distance : the distance of "full" fog (meters)

float dtCore::Environment::GetVisibility (  )  const [inline]

void dtCore::Environment::GetSunColor ( osg::Vec3 &  color  )  [inline]

Get the current color of the sun.

void dtCore::Environment::GetSunAzEl ( float &  az,
float &  el 
) const [inline]

osg::Vec2 dtCore::Environment::GetSunAzEl (  )  const [inline]

void dtCore::Environment::Repaint (  ) 

void dtCore::Environment::Update ( const double  deltaFrameTime  ) 

void dtCore::Environment::SetDateTime ( int  yr,
int  mo,
int  da,
int  hr,
int  mi,
int  sc 
)

Set the environment's date and time.

Set the starting date and time.

Any value of -1 resets the date/time to be the system time.

Parameters:
yr Year (1900-xxxx)
mo Month of the year (1-12)
da Day of the Month (1-31)
hr Hour since midnight (0-23)
mi Minutes after the hour (0-59)
sc Seconds pass the minute (0-59)

void dtCore::Environment::SetDateTime ( const DateTime dateTime  ) 

void dtCore::Environment::GetDateTime ( int &  yr,
int &  mo,
int &  da,
int &  hr,
int &  mi,
int &  sc 
) const

Get the current Date and Time of this Environment within a second.

Parameters:
yr year
mo month
da day
hr hour
mi minute
sc second

dtCore::Environment::DateTime dtCore::Environment::GetDateTime (  )  const

void dtCore::Environment::SetRefLatLong ( const osg::Vec2 &  latLong  ) 

Set the ephemeris reference lat/long.

void dtCore::Environment::GetRefLatLong ( osg::Vec2 &  latLong  )  const [inline]

osg::Node* dtCore::Environment::GetOSGNode (  )  [inline, virtual]

required by DeltaDrawable

Implements dtCore::DeltaDrawable.

const osg::Node* dtCore::Environment::GetOSGNode (  )  const [inline, virtual]

Implements dtCore::DeltaDrawable.

void dtCore::Environment::SetOSGNode ( osg::Node *  pNode  ) 


http://www.delta3d.org
2.0.0 generated 14 Feb 2008