CloudyDay
 All Classes Functions Variables Enumerations
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | Protected Member Functions | Protected Attributes | Static Protected Attributes
osgCloudyDay::CloudScene Class Reference

#include <CloudScene.h>

List of all members.

Public Types

enum  CloudType {
  CT_Stratus, CT_AltStratus, CT_StratoCumulusGenerator, CT_Cumulus,
  CT_Nimbostratus, CT_Cumolonimbus, CT_AltCumulusGenerator, CT_Quantity
}
enum  WC_Uniform {
  WCU_LightPos, WCU_TimeOfDay, WCU_Fading, WCU_Density,
  WCU_AmbientLight_H0, WCU_AmbientLight_H1, WCU_AmbientLight_T0, WCU_AmbientLight_T1,
  WCU_DirectionalColor, WCU_SunLightColor, quantity
}

Public Member Functions

 CloudScene ()
 ~CloudScene (void)
osg::ref_ptr< osg::Geometry > InsertCloud (WangCloud *cloud, int layerID)
void AddCloud (WangCloud *cloud, int layerID)
void UpdateCloud (WangCloud *cloud, int at)
void AddLayer (int layerID, int layer)
int GetType (int layer)
int GetNumberOfLayers ()
void Create ()
void SetFog (Fog *fog)
void Setup ()
void SetupAttributes (osg::ref_ptr< osg::StateSet > nodess4)
void UpdateUniform (int type)
int GetNumberOfClouds ()
unsigned int GetNumberOfParticles ()
void RemoveScreenBillBoard ()
osg::Vec3 CalculatePosition (int m_type)
osg::Geometry * createSphere (osg::Vec3 middlePoint, float radius, int vpr)
osg::ref_ptr< osg::Geometry > CreateBBForCloud (int cloudID)
unsigned int GetLayer (int index)

Static Public Member Functions

static void DeleteStates ()
static void LoadingTexture ()
static void LoadingShader ()
static void SetStates (CloudLayerState *state)
static CloudLayerStateGetStates ()
static void Initialize ()
static void CreateCloudCamera ()
static osg::ref_ptr< osg::Camera > GetCloudCamera ()

Public Attributes

CloudLayerUpdatecloud_layer_update
osg::ref_ptr< osg::Uniform > project_lightuniform
osg::ref_ptr< osg::Uniform > modelViewMatrix_lightuniform
osg::ref_ptr< osg::Uniform > viewMatrix_lightuniform
osg::ref_ptr< osg::Uniform > viewMatrixInv_lightuniform
osg::ref_ptr< osg::Uniform > projectuniform
osg::ref_ptr< osg::Uniform > modelViewMatrixuniform
osg::ref_ptr< osg::Uniform > viewMatrixuniform
osg::ref_ptr< osg::Uniform > viewMatrixInvuniform
osg::ref_ptr< osg::Geode > quadBillBoard
osg::ref_ptr< osg::StateSet > nodess4
osg::ref_ptr< osg::Vec3Array > m_cloudcenter
osg::ref_ptr< osg::IntArray > m_start_indices
bool setup_attribute
osg::ref_ptr< osg::Geode > geode
osg::ref_ptr
< osgCloudyDay::CloudGeometry
geometry
int numClouds
std::vector< WangCloud * > m_clouds

Static Public Attributes

static float timeOfDay = 0.75
static float fading = 0.0
static float dens = 1.0
static osg::Vec3 ambientLight_h0 = osg::Vec3(0.f, 0.f, 0.f)
static osg::Vec3 ambientLight_h1 = osg::Vec3(1.f, 1.f, 1.f)
static osg::Vec3 ambientLight_t0 = osg::Vec3(0.f, 0.f, 0.f)
static osg::Vec3 ambientLight_t1 = osg::Vec3(1.f, 1.f, 1.f)
static osg::Matrix3 directionalColors = osg::Matrix3(0.4, 0.4, 0.4, 0.8, 0.8, 0.8, 0.9, 0.9, 0.9)
static float time = 0.f
static osg::Vec3 sunLightColor = osg::Vec3(1.f, 1.f, 1.f)
static osg::ref_ptr< osg::Program > cloudShadowMapProg
static osg::ref_ptr< osg::Program > cloudBlurHoriProg
static osg::ref_ptr< osg::Program > cloudBlurVertProg
static osg::ref_ptr< osg::Program > cloudBlurLinearHoriProg
static osg::ref_ptr< osg::Program > cloudBlurLinearVertProg
static osg::ref_ptr< osg::Program > cloudProg
static osg::ref_ptr< osg::Program > cloudShadowProg
static osg::ref_ptr
< osg::Texture2D > 
tex_clouds
static osg::FrameBufferObject * fbo_viewer
static osg::FrameBufferObject * fbo_light
static bool m_backtofront = true
static bool m_backtofront_old = true
static osg::ref_ptr
< osg::Texture2D > 
fbo_light_texture
static osg::ref_ptr
< osg::Texture2D > 
fbo_cloud_texture
static osg::FrameBufferObject * fbo_cloud_viewer
static osg::FrameBufferObject * fbo_shadow
static osg::FrameBufferObject * fbo_vert_linear_blur
static osg::FrameBufferObject * fbo_hori_linear_blur
static osg::FrameBufferObject * fbo_vert_blur
static osg::FrameBufferObject * fbo_hori_blur
static osg::FrameBufferObject * fbo_hori_blur2

Protected Member Functions

void AddDrawElementsPoint (std::vector< unsigned int > index, unsigned int start, unsigned int count, int k)
void InsertScreenBillBoard ()
float frand ()
osg::Vec2 GetGaussianDistributedRandomNumber (osg::Vec2 m, float v)
void GenerateRandomSequence (int num_elements)

Protected Attributes

osg::Vec2 m_numOfClouds
std::vector< int > sequence
unsigned int m_num_indices
std::vector< unsigned int > m_layerToNumberCloud
std::vector< unsigned int > m_layerToCloudType
std::vector< unsigned int > m_layerToCloudLayerID
osg::ref_ptr< osg::IntArray > m_startLayerIndex
osg::ref_ptr< osg::Vec3Array > m_vertices
osg::ref_ptr< osg::Vec3Array > m_bb_min
osg::ref_ptr< osg::Vec3Array > m_bb_max
osg::ref_ptr< osg::Vec4Array > m_rotation
osg::ref_ptr< osg::Vec4Array > m_center
osg::ref_ptr< osg::Vec4Array > m_ids
osg::ref_ptr< osg::Vec4Array > m_box_centers
osg::ref_ptr< osg::Vec4Array > m_color
osg::ref_ptr< osg::IntArray > m_numPrimitiveArrays
std::map< int, std::string > m_uniforms
osg::ref_ptr< osg::Vec3Array > m_ambientlight_h
osg::ref_ptr< osg::Vec3Array > m_ambientlight_t
osg::ref_ptr< osg::Vec3Array > m_diffuselight
Fogm_fog

Static Protected Attributes

static osg::ref_ptr< osg::Camera > m_lightCloudCamera
static CloudLayerStatem_CloudLayerState = new osgCloudyDay::CloudLayerState()

Detailed Description

Class, which is used to manage the 3D clouds


Member Enumeration Documentation

Cloud types


Constructor & Destructor Documentation

osgCloudyDay::CloudScene::CloudScene ( )

Constructor

osgCloudyDay::CloudScene::~CloudScene ( void  )

Deconstructor


Member Function Documentation

void osgCloudyDay::CloudScene::AddCloud ( WangCloud cloud,
int  layerID 
)

Adds a clouds

Parameters:
cloudcloud object
layerIDlalyer id
void osgCloudyDay::CloudScene::AddDrawElementsPoint ( std::vector< unsigned int >  index,
unsigned int  start,
unsigned int  count,
int  k 
)
protected

Adds indices to the index array

Parameters:
indexindices to add
startofffset, where to add
countnumber of indices to add
void osgCloudyDay::CloudScene::AddLayer ( int  layerID,
int  layer 
)

Adds a layer

Parameters:
layerIDlayerID
layerlayer
osg::Vec3 osgCloudyDay::CloudScene::CalculatePosition ( int  m_type)

Method calculates the position

Parameters:
m_typecloud type
Returns:
positon
void osgCloudyDay::CloudScene::Create ( )

Creates the clouds

osg::ref_ptr< osg::Geometry > osgCloudyDay::CloudScene::CreateBBForCloud ( int  cloudID)

Calcualtes the bounding boxes of the cloud

Parameters:
cloudIDcloud id
Returns:
geometry with the calculates bounding boxes
void osgCloudyDay::CloudScene::CreateCloudCamera ( )
static

Method to create a cloud camera

osg::Geometry * osgCloudyDay::CloudScene::createSphere ( osg::Vec3  middlePoint,
float  radius,
int  vpr 
)

Calcualtes the bounding boxes of the cloud

Parameters:
middlePointlocation of the sphere
radiusradius of the sphere
vprvpr
Returns:
geometry with the bounding spheres
void osgCloudyDay::CloudScene::DeleteStates ( )
static

Method to delete the states

void osgCloudyDay::CloudScene::GenerateRandomSequence ( int  num_elements)
protected

Method to generate a random sequence

Parameters:
num_elementsnumber of random values
osg::ref_ptr< osg::Camera > osgCloudyDay::CloudScene::GetCloudCamera ( )
static

Method, which returns a cloud camera

Returns:
cloud camera
osg::Vec2 osgCloudyDay::CloudScene::GetGaussianDistributedRandomNumber ( osg::Vec2  m,
float  v 
)
protected

Get a random number, which follows a Gaussian function

Parameters:
mmean value of the gaussian function
vvariance value of the gaussian function
Returns:
random number, distributed after a Gaussian function
unsigned int osgCloudyDay::CloudScene::GetLayer ( int  index)

Returns a layer

Returns:
layer
int osgCloudyDay::CloudScene::GetNumberOfClouds ( )

Returns the number of clouds

Returns:
number of clousd
int osgCloudyDay::CloudScene::GetNumberOfLayers ( )

Returns the number of layers

Returns:
number of layers
unsigned int osgCloudyDay::CloudScene::GetNumberOfParticles ( )

Returns the nubmer of particles

Returns:
number of particles
osgCloudyDay::CloudLayerState * osgCloudyDay::CloudScene::GetStates ( )
static

Method, which returns the states of the cloud layer

Returns:
cloud layer states
int osgCloudyDay::CloudScene::GetType ( int  layer)

Returns the type of a layer

Parameters:
layerid of a layer
Returns:
type of a layer
void osgCloudyDay::CloudScene::Initialize ( )
static

Initialize Method

osg::ref_ptr< osg::Geometry > osgCloudyDay::CloudScene::InsertCloud ( WangCloud cloud,
int  layerID 
)

Inserts a cloud

Parameters:
cloudcloud object
layerIDlalyer id
void osgCloudyDay::CloudScene::InsertScreenBillBoard ( )
protected

Insert a billboard at the end of the object

void osgCloudyDay::CloudScene::LoadingShader ( )
static

Loads the shader

void osgCloudyDay::CloudScene::LoadingTexture ( )
static

LoadingTexture loads the cloud texture

void osgCloudyDay::CloudScene::RemoveScreenBillBoard ( )

Method to reomove the screen billboard

void osgCloudyDay::CloudScene::SetFog ( osgCloudyDay::Fog fog)

Adds a fog

Parameters:
fogfog object
void osgCloudyDay::CloudScene::SetStates ( CloudLayerState state)
static

Method to set the states

Parameters:
statestates of the cloud layer
void osgCloudyDay::CloudScene::Setup ( )

Sets the OpenGL states

void osgCloudyDay::CloudScene::SetupAttributes ( osg::ref_ptr< osg::StateSet >  nodess4)

Sets OpenGL States

void osgCloudyDay::CloudScene::UpdateCloud ( WangCloud cloud,
int  at 
)

Updates the clouds at runtime

Parameters:
cloudcloud object
atlalyer id
void osgCloudyDay::CloudScene::UpdateUniform ( int  type)

This method updates the uniforms of the shader

Parameters:
typeuniform, which should updated

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