version 3.3

VRS::Sky Class Reference

Shape for painting a nice sky background. More...

#include <vrs/sky.h>

Inheritance diagram for VRS::Sky:

VRS::Shape VRS::RenderObj VRS::SharedObj VRS::Visitable

List of all members.

Public Member Functions

 Sky (bool calcRealSkyColor=false, const Color &skyColor=Color(0.3, 0.3, 0.9), const Color &fogColor=Color(1.0, 1.0, 1.0), double colorDiff=0.005, bool sunOnOff=true, const Vector &sunDirection=Vector(0.0, 1.0, 0.0), double turbitdity=3.0)
 Default constructor for a sky.
 Sky (unsigned int day, unsigned short hour, unsigned short minute, unsigned short second, double latitude, bool calcRealSkyColor=false, const Color &skyColor=Color(0.3, 0.3, 0.9), const Color &fogColor=Color(1.0, 1.0, 1.0), double colorDiff=0.005, bool sunOnOff=true, double turbitdity=3.0)
 Constructor for positioning the sun.
virtual ~Sky ()
void setSun (bool onOff)
 Toggles the sun on or off.
bool getSun () const
 Returns whether the sun is displayed.
void setSunDirection (const Vector &sunDirection)
 Sets the direction from which the sun is shining.
const VectorgetSunDirection () const
 Returns the direction from which the sun is shining.
void setCalcRealSkyColor (bool calcRealSkyColor)
 Activates/Deactivates the correct color calculation when painting the sky.
bool getCalcRealSkyColor () const
 Returns whether real sky colors are calculated or sky and fog color are taken.
void setSkyColor (const Color &skyColor)
 Sets the color of the sky.
const ColorgetSkyColor () const
 Returns the color of the sky.
void setFogColor (const Color &fogColor)
 Sets the color of the horizon.
const ColorgetFogColor () const
 Returns the color of the horizon.
void setTurbidity (double trubidity)
 Sets the trubidity.
double getTurbidity () const
 Returns the turbidity.
void calculateSunDirection (unsigned int day=173, unsigned short hour=12, unsigned short minute=0, unsigned short second=0, double latitude=52.0)
 Calculates the sun direction.
void setTessellationError (double colorDiff)
 Sets the allowed color diff when determining the tessellation.
void setTessellationForStaticSky ()
 Convinience method for setting the tessellation.
void setTessellationForDynamicSky ()
 Cenvinience method for setting the tessellation.
double getTessellationError () const
 Returns the allowed colorDiff value when determining the tessellation.
virtual void modified ()
 Overwritten so that it sets colorModified.
Bounds boundingBox () const
 Returns the bounding box of the shape.
bool getUpdateTessellation () const
 Internal use only!
void setUpdateTessellation (bool updateTessellation)
 Internal use only!
CachegetTessellation () const
 Internal use only!
void setTessellation (PolygonSet *tessellation)
 Internal use only!
 VRS_TYPEINFO (Sky, Shape)
 VRS_SERIALIZABLE (Sky)


Detailed Description

Shape for painting a nice sky background.

Constructor & Destructor Documentation

VRS::Sky::Sky ( bool  calcRealSkyColor = false,
const Color skyColor = Color(0.3, 0.3, 0.9),
const Color fogColor = Color(1.0, 1.0, 1.0),
double  colorDiff = 0.005,
bool  sunOnOff = true,
const Vector sunDirection = Vector(0.0, 1.0, 0.0),
double  turbitdity = 3.0 
)

Default constructor for a sky.

If no SunDirection is given, the constructor will call calculate the sun direction with the default parameters for the method. (see calculateSunDirection)

VRS::Sky::Sky ( unsigned int  day,
unsigned short  hour,
unsigned short  minute,
unsigned short  second,
double  latitude,
bool  calcRealSkyColor = false,
const Color skyColor = Color(0.3, 0.3, 0.9),
const Color fogColor = Color(1.0, 1.0, 1.0),
double  colorDiff = 0.005,
bool  sunOnOff = true,
double  turbitdity = 3.0 
)

Constructor for positioning the sun.

This constructor will call calculateSunDirection with the given values.

virtual VRS::Sky::~Sky (  )  [virtual]


Member Function Documentation

void VRS::Sky::setSun ( bool  onOff  ) 

Toggles the sun on or off.

bool VRS::Sky::getSun (  )  const [inline]

Returns whether the sun is displayed.

void VRS::Sky::setSunDirection ( const Vector sunDirection  ) 

Sets the direction from which the sun is shining.

The length of sunDirection must not be 0.

const Vector & VRS::Sky::getSunDirection (  )  const [inline]

Returns the direction from which the sun is shining.

void VRS::Sky::setCalcRealSkyColor ( bool  calcRealSkyColor  ) 

Activates/Deactivates the correct color calculation when painting the sky.

The current sky and fog colors are irrelevant if this is set to true. When painted, sky and fog color will be set to its calculated values. The sky will automatically adapt its tessellation to display the non-linear color cistribution. However, in debug mode is chosen a more rough tessellation is chosen to achieve a better framerate when the sky is animated

bool VRS::Sky::getCalcRealSkyColor (  )  const [inline]

Returns whether real sky colors are calculated or sky and fog color are taken.

void VRS::Sky::setSkyColor ( const Color skyColor  ) 

Sets the color of the sky.

const Color & VRS::Sky::getSkyColor (  )  const [inline]

Returns the color of the sky.

void VRS::Sky::setFogColor ( const Color fogColor  ) 

Sets the color of the horizon.

const Color & VRS::Sky::getFogColor (  )  const [inline]

Returns the color of the horizon.

void VRS::Sky::setTurbidity ( double  trubidity  ) 

Sets the trubidity.

The turbidity is the "thickness" of the air. It represents the ratio between haze (making the horizon white, big for cloudy air) and scattering (making the sky blue, big for clear air). A value of 2.0 means exceptionally clear air, 30.0 means light fog. (Turbidity is only taken into account, if calcRealSkyColor is set to true.)

double VRS::Sky::getTurbidity (  )  const [inline]

Returns the turbidity.

void VRS::Sky::calculateSunDirection ( unsigned int  day = 173,
unsigned short  hour = 12,
unsigned short  minute = 0,
unsigned short  second = 0,
double  latitude = 52.0 
)

Calculates the sun direction.

Day means the day of the year (between 1 and 365). Time is assumed to be the sun time. If the given values are all valid (valid date and time, -90° <= degree <= 90°), the method stores the sun direction and angles in the sky shape.

void VRS::Sky::setTessellationError ( double  colorDiff  ) 

Sets the allowed color diff when determining the tessellation.

The sky, when painted, calculates a tessellation. colorDiff determines, how fine this tessellation will be. colorDiff is the maximum difference between the real color and the linear interpolated color (as most rendering systems will interpolate the color between two vertices by linear interpolation) (colorDiff will be taken into account only if calcRealColors is set, because if it is not, the colors are linear interpolated anyway)

void VRS::Sky::setTessellationForStaticSky (  ) 

Convinience method for setting the tessellation.

This method will set the colorDiff value to a good value for skies not animated. That means a small value compared to that for animated skies, because the tessellation is compared rarely, likely only once.

void VRS::Sky::setTessellationForDynamicSky (  ) 

Cenvinience method for setting the tessellation.

This method will set the colorDiff value to a good value for animated skies. That means a bigger value than for skies not animated, because the tessellation may be calculated every frame and therefor must be fast.

double VRS::Sky::getTessellationError (  )  const [inline]

Returns the allowed colorDiff value when determining the tessellation.

virtual void VRS::Sky::modified (  )  [virtual]

Overwritten so that it sets colorModified.

Reimplemented from VRS::SharedObj.

Bounds VRS::Sky::boundingBox (  )  const [inline, virtual]

Returns the bounding box of the shape.

Implements VRS::Shape.

bool VRS::Sky::getUpdateTessellation (  )  const

Internal use only!

void VRS::Sky::setUpdateTessellation ( bool  updateTessellation  ) 

Internal use only!

Cache* VRS::Sky::getTessellation (  )  const

Internal use only!

void VRS::Sky::setTessellation ( PolygonSet tessellation  ) 

Internal use only!

VRS::Sky::VRS_TYPEINFO ( Sky  ,
Shape   
)

VRS::Sky::VRS_SERIALIZABLE ( Sky   ) 


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

Generated on Tue May 22 06:00:32 2012 by Doxygen 1.5.6
© 2001-2010 Hasso-Plattner-Institut | Impressum | Contact