RigsofRods
Soft-body Physics Simulation
Data Structures | Public Types | Public Member Functions | Private Member Functions | Private Attributes
Hydrax::GodRaysManager Class Reference

Underwater god rays manager class God rays. More...

#include <GodRaysManager.h>

+ Collaboration diagram for Hydrax::GodRaysManager:

Data Structures

class  DepthMapListener
 GodRaysManager::DepthMapListener class. More...
 

Public Types

enum  MaterialType { MAT_GODRAYS = 0, MAT_DEPTH = 1 }
 God rays material enumeration. More...
 

Public Member Functions

 GodRaysManager (Hydrax *h)
 Constructor. More...
 
 ~GodRaysManager ()
 Destructor. More...
 
void create (const HydraxComponent &HC)
 Create. More...
 
void remove ()
 Remove. More...
 
void update (const Ogre::Real &timeSinceLastFrame)
 Call each frame. More...
 
const bool & isCreated () const
 Has been create() already called? More...
 
void addDepthTechnique (Ogre::Technique *Technique, const bool &AutoUpdate=true)
 Add god rays depth technique to an especified material. More...
 
void SetSimulationSpeed (const Ogre::Real &Speed)
 Set god rays simulation speed. More...
 
const Ogre::Real & getSimulationSpeed () const
 Get god rays simulation speed. More...
 
void setNumberOfRays (const int &NumberOfRays)
 Set the number of god rays. More...
 
const int & getNumberOfRays () const
 Get number of god rays. More...
 
void setRaysSize (const Ogre::Real &Size)
 Set god rays size. More...
 
const Ogre::Real & getRaysSize () const
 Get god rays size. More...
 
Noise::PerlingetPerlin ()
 Get perlin noise module. More...
 
Ogre::SceneNode * getSceneNode ()
 Get good rays scene node. More...
 
void setVisible (const bool &Visible)
 Set visible. More...
 
const bool isVisible () const
 Is visible? More...
 
void setObjectIntersectionsEnabled (const bool &Enable)
 Set objects intersections enabled. More...
 
const bool & areObjectsIntersectionsEnabled () const
 Are rays objects intersections enabled? More...
 
const Ogre::Vector4 getNoiseParameters () const
 Get noise params. More...
 
void setNoiseParameters (Ogre::Vector4 Params)
 Set noise params. More...
 

Private Member Functions

Ogre::Vector2 _calculateRayPosition (const int &RayNumber)
 Calculate the current position of a ray. More...
 
void _createGodRays ()
 Create god rays manual object. More...
 
void _createMaterials (const HydraxComponent &HC)
 Create materials that we need(God rays depth too if it's needed) More...
 
void _updateRays ()
 Update god rays. More...
 
void _updateMaterialsParameters ()
 Update materials parameters. More...
 
void _updateProjector ()
 Update projector. More...
 
void _createDepthRTT ()
 Create depth RTT. More...
 
bool _isComponent (const HydraxComponent &List, const HydraxComponent &ToCheck) const
 Is component in the given list? More...
 

Private Attributes

bool mCreated
 Has been create() already called? More...
 
Ogre::ManualObject * mManualGodRays
 Manual object to create god rays. More...
 
Ogre::Camera * mProjectorCamera
 Camera used to project rays. More...
 
Ogre::SceneNode * mProjectorSN
 Projector scene node. More...
 
Noise::PerlinmPerlin
 Our Perlin noise module. More...
 
Ogre::Real mNoiseDerivation
 Noise parameters (Used in _calculateRayPosition(...)) More...
 
Ogre::Real mNoisePositionMultiplier
 PositionMultiplier value. More...
 
Ogre::Real mNoiseYNormalMultiplier
 Y normal component multiplier. More...
 
Ogre::Real mNoiseNormalMultiplier
 Normal multiplier. More...
 
Ogre::MaterialPtr mMaterials [2]
 God rays materials 0-God rays, 1-Depth. More...
 
std::vector< Ogre::Technique * > mDepthTechniques
 Technique vector for addDepthTechnique(...) More...
 
Ogre::Real mSimulationSpeed
 God rays simulation speed. More...
 
int mNumberOfRays
 Number of rays. More...
 
Ogre::Real mRaysSize
 God rays size. More...
 
bool mObjectsIntersections
 Are god rays objects intersections active? More...
 
Ogre::TexturePtr mProjectorRTT
 For rays intersection with objects we use a depth map based technique Depth RTT texture. More...
 
DepthMapListener mDepthMapListener
 Depth RTT listener. More...
 
HydraxmHydrax
 Hydrax parent pointer. More...
 

Detailed Description

Underwater god rays manager class God rays.

Definition at line 46 of file GodRaysManager.h.

Member Enumeration Documentation

◆ MaterialType

God rays material enumeration.

Enumerator
MAT_GODRAYS 
MAT_DEPTH 

Definition at line 51 of file GodRaysManager.h.

Constructor & Destructor Documentation

◆ GodRaysManager()

Hydrax::GodRaysManager::GodRaysManager ( Hydrax h)

Constructor.

Parameters
hHydrax parent pointer

Definition at line 50 of file GodRaysManager.cpp.

◆ ~GodRaysManager()

Hydrax::GodRaysManager::~GodRaysManager ( )

Destructor.

Definition at line 72 of file GodRaysManager.cpp.

+ Here is the call graph for this function:

Member Function Documentation

◆ _calculateRayPosition()

Ogre::Vector2 Hydrax::GodRaysManager::_calculateRayPosition ( const int &  RayNumber)
private

Calculate the current position of a ray.

Parameters
RayNumberNumber of the ray range[0,NumerOfRays]
Returns
Ray position range[-1,1]x[-1,1]

Definition at line 295 of file GodRaysManager.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _createDepthRTT()

void Hydrax::GodRaysManager::_createDepthRTT ( )
private

Create depth RTT.

Definition at line 841 of file GodRaysManager.cpp.

+ Here is the caller graph for this function:

◆ _createGodRays()

void Hydrax::GodRaysManager::_createGodRays ( )
private

Create god rays manual object.

Definition at line 128 of file GodRaysManager.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _createMaterials()

void Hydrax::GodRaysManager::_createMaterials ( const HydraxComponent HC)
private

Create materials that we need(God rays depth too if it's needed)

Parameters
HCCurrent Hydrax components

Definition at line 419 of file GodRaysManager.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _isComponent()

bool Hydrax::GodRaysManager::_isComponent ( const HydraxComponent List,
const HydraxComponent ToCheck 
) const
private

Is component in the given list?

Parameters
ListComponents list
ToCheckComponent to check
Returns
true if the component is in the given list.

Definition at line 821 of file GodRaysManager.cpp.

+ Here is the caller graph for this function:

◆ _updateMaterialsParameters()

void Hydrax::GodRaysManager::_updateMaterialsParameters ( )
private

Update materials parameters.

Definition at line 359 of file GodRaysManager.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _updateProjector()

void Hydrax::GodRaysManager::_updateProjector ( )
private

Update projector.

Definition at line 404 of file GodRaysManager.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _updateRays()

void Hydrax::GodRaysManager::_updateRays ( )
private

Update god rays.

Definition at line 228 of file GodRaysManager.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addDepthTechnique()

void Hydrax::GodRaysManager::addDepthTechnique ( Ogre::Technique *  Technique,
const bool &  AutoUpdate = true 
)

Add god rays depth technique to an especified material.

Parameters
TechniqueTechnique where depth technique will be added
AutoUpdateThe technique will be automatically updated when god rays parameters change
Remarks
Call it after Hydrax::create()/Hydrax::setComponents(...)
     The technique will be automatically updated when god rays parameters change if parameter AutoUpdate == true
     Add depth technique when a material is not an Ogre::Entity, such terrains, PLSM2 materials, etc.
     This depth technique will be added with "HydraxGodRaysDepth" scheme in ordeto can use it in the G.R. depth RTT.

Definition at line 785 of file GodRaysManager.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ areObjectsIntersectionsEnabled()

const bool& Hydrax::GodRaysManager::areObjectsIntersectionsEnabled ( ) const
inline

Are rays objects intersections enabled?

Returns
true if yes, false if not

Definition at line 194 of file GodRaysManager.h.

+ Here is the caller graph for this function:

◆ create()

void Hydrax::GodRaysManager::create ( const HydraxComponent HC)

Create.

Parameters
HCCurrent Hydrax components

Definition at line 77 of file GodRaysManager.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getNoiseParameters()

const Ogre::Vector4 Hydrax::GodRaysManager::getNoiseParameters ( ) const
inline

Get noise params.

Returns
Ogre::Vector4 that stores 4 parameters: x-> Noise derivation y-> Position multiplier z-> Y normal component multiplier w-> Normal multiplier

Definition at line 206 of file GodRaysManager.h.

◆ getNumberOfRays()

const int& Hydrax::GodRaysManager::getNumberOfRays ( ) const
inline

Get number of god rays.

Returns
Number of god rays

Definition at line 125 of file GodRaysManager.h.

+ Here is the caller graph for this function:

◆ getPerlin()

Noise::Perlin* Hydrax::GodRaysManager::getPerlin ( )
inline

Get perlin noise module.

Returns
Perlin noise module

Definition at line 149 of file GodRaysManager.h.

◆ getRaysSize()

const Ogre::Real& Hydrax::GodRaysManager::getRaysSize ( ) const
inline

Get god rays size.

Returns
Rays size

Definition at line 141 of file GodRaysManager.h.

+ Here is the caller graph for this function:

◆ getSceneNode()

Ogre::SceneNode* Hydrax::GodRaysManager::getSceneNode ( )
inline

Get good rays scene node.

Returns
God rays scene node

Definition at line 157 of file GodRaysManager.h.

◆ getSimulationSpeed()

const Ogre::Real& Hydrax::GodRaysManager::getSimulationSpeed ( ) const
inline

Get god rays simulation speed.

Returns
Simlation speed

Definition at line 112 of file GodRaysManager.h.

+ Here is the caller graph for this function:

◆ isCreated()

const bool& Hydrax::GodRaysManager::isCreated ( ) const
inline

Has been create() already called?

Returns
true If yes

Definition at line 85 of file GodRaysManager.h.

◆ isVisible()

const bool Hydrax::GodRaysManager::isVisible ( ) const
inline

Is visible?

Returns
true if it's visible, false if not

Definition at line 176 of file GodRaysManager.h.

◆ remove()

void Hydrax::GodRaysManager::remove ( )

Remove.

Definition at line 151 of file GodRaysManager.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setNoiseParameters()

void Hydrax::GodRaysManager::setNoiseParameters ( Ogre::Vector4  Params)
inline

Set noise params.

Parameters
Paramsx-> Noise derivation y-> Position multiplier z-> Y normal component multiplier w-> Normal multiplier

Definition at line 220 of file GodRaysManager.h.

◆ setNumberOfRays()

void Hydrax::GodRaysManager::setNumberOfRays ( const int &  NumberOfRays)

Set the number of god rays.

Parameters
NumberOfRaysNumber of god rays

Definition at line 333 of file GodRaysManager.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setObjectIntersectionsEnabled()

void Hydrax::GodRaysManager::setObjectIntersectionsEnabled ( const bool &  Enable)

Set objects intersections enabled.

Parameters
Enabletrue for yes, false for not

Definition at line 350 of file GodRaysManager.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setRaysSize()

void Hydrax::GodRaysManager::setRaysSize ( const Ogre::Real &  Size)
inline

Set god rays size.

Parameters
SizeGod rays size

Definition at line 133 of file GodRaysManager.h.

+ Here is the caller graph for this function:

◆ SetSimulationSpeed()

void Hydrax::GodRaysManager::SetSimulationSpeed ( const Ogre::Real &  Speed)
inline

Set god rays simulation speed.

Parameters
SpeedSimulation speed

Definition at line 104 of file GodRaysManager.h.

+ Here is the caller graph for this function:

◆ setVisible()

void Hydrax::GodRaysManager::setVisible ( const bool &  Visible)
inline

Set visible.

Parameters
Visibletrue = yes; false = no

Definition at line 165 of file GodRaysManager.h.

+ Here is the caller graph for this function:

◆ update()

void Hydrax::GodRaysManager::update ( const Ogre::Real &  timeSinceLastFrame)

Call each frame.

Parameters
timeSinceLastFrameTime since last frame

Definition at line 209 of file GodRaysManager.cpp.

+ Here is the call graph for this function:

Field Documentation

◆ mCreated

bool Hydrax::GodRaysManager::mCreated
private

Has been create() already called?

Definition at line 292 of file GodRaysManager.h.

◆ mDepthMapListener

DepthMapListener Hydrax::GodRaysManager::mDepthMapListener
private

Depth RTT listener.

Definition at line 334 of file GodRaysManager.h.

◆ mDepthTechniques

std::vector<Ogre::Technique*> Hydrax::GodRaysManager::mDepthTechniques
private

Technique vector for addDepthTechnique(...)

Definition at line 319 of file GodRaysManager.h.

◆ mHydrax

Hydrax* Hydrax::GodRaysManager::mHydrax
private

Hydrax parent pointer.

Definition at line 337 of file GodRaysManager.h.

◆ mManualGodRays

Ogre::ManualObject* Hydrax::GodRaysManager::mManualGodRays
private

Manual object to create god rays.

Definition at line 295 of file GodRaysManager.h.

◆ mMaterials

Ogre::MaterialPtr Hydrax::GodRaysManager::mMaterials[2]
private

God rays materials 0-God rays, 1-Depth.

Definition at line 317 of file GodRaysManager.h.

◆ mNoiseDerivation

Ogre::Real Hydrax::GodRaysManager::mNoiseDerivation
private

Noise parameters (Used in _calculateRayPosition(...))

Normal derivation value

Definition at line 307 of file GodRaysManager.h.

◆ mNoiseNormalMultiplier

Ogre::Real Hydrax::GodRaysManager::mNoiseNormalMultiplier
private

Normal multiplier.

Definition at line 313 of file GodRaysManager.h.

◆ mNoisePositionMultiplier

Ogre::Real Hydrax::GodRaysManager::mNoisePositionMultiplier
private

PositionMultiplier value.

Definition at line 309 of file GodRaysManager.h.

◆ mNoiseYNormalMultiplier

Ogre::Real Hydrax::GodRaysManager::mNoiseYNormalMultiplier
private

Y normal component multiplier.

Definition at line 311 of file GodRaysManager.h.

◆ mNumberOfRays

int Hydrax::GodRaysManager::mNumberOfRays
private

Number of rays.

Definition at line 324 of file GodRaysManager.h.

◆ mObjectsIntersections

bool Hydrax::GodRaysManager::mObjectsIntersections
private

Are god rays objects intersections active?

Definition at line 328 of file GodRaysManager.h.

◆ mPerlin

Noise::Perlin* Hydrax::GodRaysManager::mPerlin
private

Our Perlin noise module.

Definition at line 302 of file GodRaysManager.h.

◆ mProjectorCamera

Ogre::Camera* Hydrax::GodRaysManager::mProjectorCamera
private

Camera used to project rays.

Definition at line 297 of file GodRaysManager.h.

◆ mProjectorRTT

Ogre::TexturePtr Hydrax::GodRaysManager::mProjectorRTT
private

For rays intersection with objects we use a depth map based technique Depth RTT texture.

Definition at line 332 of file GodRaysManager.h.

◆ mProjectorSN

Ogre::SceneNode* Hydrax::GodRaysManager::mProjectorSN
private

Projector scene node.

Definition at line 299 of file GodRaysManager.h.

◆ mRaysSize

Ogre::Real Hydrax::GodRaysManager::mRaysSize
private

God rays size.

Definition at line 326 of file GodRaysManager.h.

◆ mSimulationSpeed

Ogre::Real Hydrax::GodRaysManager::mSimulationSpeed
private

God rays simulation speed.

Definition at line 322 of file GodRaysManager.h.


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