Pyrogenesis  13997
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Public Attributes | Private Member Functions | Private Attributes | Friends | List of all members
CLightEnv Class Reference

Class CLightEnv: description of a lighting environment - contains all the necessary parameters for representation of the lighting within a scenario. More...

#include <LightEnv.h>

Public Member Functions

 CLightEnv ()
 
float GetElevation () const
 
float GetRotation () const
 
const CVector3DGetSunDir () const
 
const std::string & GetLightingModel () const
 
void SetElevation (float f)
 
void SetRotation (float f)
 
void SetLightingModel (const std::string &model)
 
RGBColor EvaluateUnitScaled (const CVector3D &normal) const
 Calculate brightness of a point of a unit with the given normal vector, for rendering with CPU lighting. More...
 
SColor4ub EvaluateTerrainDiffuseScaled (const CVector3D &normal) const
 Compute the diffuse sun lighting color on terrain, for rendering with CPU lighting. More...
 
SColor4ub EvaluateTerrainDiffuseFactor (const CVector3D &normal) const
 Compute the diffuse sun lighting factor on terrain, for rendering with shader lighting. More...
 
bool operator== (const CLightEnv &o) const
 
bool operator!= (const CLightEnv &o) const
 

Public Attributes

RGBColor m_SunColor
 
RGBColor m_TerrainAmbientColor
 
RGBColor m_UnitsAmbientColor
 
RGBColor m_FogColor
 
float m_FogFactor
 
float m_FogMax
 
float m_Brightness
 
float m_Contrast
 
float m_Saturation
 
float m_Bloom
 

Private Member Functions

void CalculateSunDirection ()
 

Private Attributes

float m_Elevation
 Height of sun above the horizon, in radians. More...
 
float m_Rotation
 Direction of sun on the compass, in radians. More...
 
CVector3D m_SunDir
 Vector corresponding to m_Elevation and m_Rotation. More...
 
std::string m_LightingModel
 A string that shaders use to determine what lighting model to implement. More...
 

Friends

class CMapWriter
 
class CMapReader
 
class CXMLReader
 

Detailed Description

Class CLightEnv: description of a lighting environment - contains all the necessary parameters for representation of the lighting within a scenario.

Definition at line 36 of file LightEnv.h.

Constructor & Destructor Documentation

CLightEnv::CLightEnv ( )

Definition at line 29 of file LightEnv.cpp.

Member Function Documentation

void CLightEnv::CalculateSunDirection ( )
private

Definition at line 56 of file LightEnv.cpp.

SColor4ub CLightEnv::EvaluateTerrainDiffuseFactor ( const CVector3D normal) const
inline

Compute the diffuse sun lighting factor on terrain, for rendering with shader lighting.

Parameters
normalnormal vector (must have length 1)

Definition at line 128 of file LightEnv.h.

SColor4ub CLightEnv::EvaluateTerrainDiffuseScaled ( const CVector3D normal) const
inline

Compute the diffuse sun lighting color on terrain, for rendering with CPU lighting.

To cope with sun overbrightness, the color is scaled by 0.5.

Parameters
normalnormal vector (must have length 1)

Definition at line 117 of file LightEnv.h.

RGBColor CLightEnv::EvaluateUnitScaled ( const CVector3D normal) const
inline

Calculate brightness of a point of a unit with the given normal vector, for rendering with CPU lighting.

The resulting color contains both ambient and diffuse light. To cope with sun overbrightness, the color is scaled by 0.5.

Parameters
normalnormal vector (must have length 1)

Definition at line 100 of file LightEnv.h.

float CLightEnv::GetElevation ( ) const
inline

Definition at line 82 of file LightEnv.h.

const std::string& CLightEnv::GetLightingModel ( ) const
inline

Definition at line 85 of file LightEnv.h.

float CLightEnv::GetRotation ( ) const
inline

Definition at line 83 of file LightEnv.h.

const CVector3D& CLightEnv::GetSunDir ( ) const
inline

Definition at line 84 of file LightEnv.h.

bool CLightEnv::operator!= ( const CLightEnv o) const
inline

Definition at line 153 of file LightEnv.h.

bool CLightEnv::operator== ( const CLightEnv o) const
inline

Definition at line 136 of file LightEnv.h.

void CLightEnv::SetElevation ( float  f)

Definition at line 44 of file LightEnv.cpp.

void CLightEnv::SetLightingModel ( const std::string &  model)
inline

Definition at line 90 of file LightEnv.h.

void CLightEnv::SetRotation ( float  f)

Definition at line 50 of file LightEnv.cpp.

Friends And Related Function Documentation

friend class CMapReader
friend

Definition at line 39 of file LightEnv.h.

friend class CMapWriter
friend

Definition at line 38 of file LightEnv.h.

friend class CXMLReader
friend

Definition at line 40 of file LightEnv.h.

Member Data Documentation

float CLightEnv::m_Bloom

Definition at line 77 of file LightEnv.h.

float CLightEnv::m_Brightness

Definition at line 77 of file LightEnv.h.

float CLightEnv::m_Contrast

Definition at line 77 of file LightEnv.h.

float CLightEnv::m_Elevation
private

Height of sun above the horizon, in radians.

For example, an elevation of M_PI/2 means the sun is straight up.

Definition at line 46 of file LightEnv.h.

RGBColor CLightEnv::m_FogColor

Definition at line 72 of file LightEnv.h.

float CLightEnv::m_FogFactor

Definition at line 74 of file LightEnv.h.

float CLightEnv::m_FogMax

Definition at line 75 of file LightEnv.h.

std::string CLightEnv::m_LightingModel
private

A string that shaders use to determine what lighting model to implement.

Current recognised values are "old" and "standard".

Definition at line 66 of file LightEnv.h.

float CLightEnv::m_Rotation
private

Direction of sun on the compass, in radians.

For example, a rotation of zero means the sun is in the direction (0,0,-1) and a rotation of M_PI/2 means the sun is in the direction (1,0,0) (not taking elevation into account).

Definition at line 54 of file LightEnv.h.

float CLightEnv::m_Saturation

Definition at line 77 of file LightEnv.h.

RGBColor CLightEnv::m_SunColor

Definition at line 69 of file LightEnv.h.

CVector3D CLightEnv::m_SunDir
private

Vector corresponding to m_Elevation and m_Rotation.

Updated by CalculateSunDirection.

Definition at line 60 of file LightEnv.h.

RGBColor CLightEnv::m_TerrainAmbientColor

Definition at line 70 of file LightEnv.h.

RGBColor CLightEnv::m_UnitsAmbientColor

Definition at line 71 of file LightEnv.h.


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