# Home    # nevrax.com   
Nevrax
Nevrax.org
#News
#Mailing-list
#Documentation
#CVS
#Bugs
#License
Docs
 
Documentation  
Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages   Search  

NL3D::CMeshVPWindTree Class Reference

VertexProgram for an effect of Wind on Tree meshes. More...

#include <meshvp_wind_tree.h>

Inheritance diagram for NL3D::CMeshVPWindTree:

NL3D::IMeshVertexProgram NLMISC::IStreamable NLMISC::CRefCount NLMISC::IClassable List of all members.

Public Types

enum  { HrcDepth = 3 }

Public Methods

 CMeshVPWindTree ()
 Constructor. More...

virtual ~CMeshVPWindTree ()
IMeshVertexProgram implementation
virtual void initInstance (CMeshBaseInstance *mbi)
 Setup a rand phase for wind in mbi. More...

virtual bool begin (IDriver *drv, CScene *scene, CMeshBaseInstance *mbi, const NLMISC::CMatrix &invertedModelMat, const NLMISC::CVector &)
 Setup Wind constants, Light constants, and activate the VP. More...

virtual void end (IDriver *drv)
 disable the VertexProgram. More...

virtual void setupForMaterial (const CMaterial &mat, IDriver *drv, CScene *scene, CVertexBuffer *vb)
 Setup this shader for the given material. More...

virtual void setupForMaterial (const CMaterial &mat, IDriver *drv, CScene *scene, IVertexBufferHard *vb)
 The same as setupForMaterial, but with a hard vb. More...

virtual void serial (NLMISC::IStream &f) throw (NLMISC::EStream)
 NLMISC_DECLARE_CLASS (CMeshVPWindTree)

Public Attributes

WindTree Parameters;
float Frequency [HrcDepth]
 Frequency of the wind for 3 Hierachy levels. More...

float FrequencyWindFactor [HrcDepth]
 Additional frequency, multiplied by the globalWindPower. More...

float PowerXY [HrcDepth]
 Power of the wind on XY. Mul by globalWindPower. More...

float PowerZ [HrcDepth]
 Power of the wind on Z. Mul by globalWindPower. More...

float Bias [HrcDepth]
 Bias result of the cosinus: f= cos(time)+bias. More...

bool SpecularLighting
 true if want Specular Lighting. More...


Private Types

enum  { NumVp = 16 }

Private Methods

void setupLighting (CScene *scene, CMeshBaseInstance *mbi, const NLMISC::CMatrix &invertedModelMat)

Static Private Methods

float speedCos (float angle)

Private Attributes

float _CurrentTime [HrcDepth]
double _LastSceneTime
CVector _MaxDeltaPos [HrcDepth]

Static Private Attributes

std::auto_ptr< CVertexProgram_VertexProgram [NumVp]
 The 16 versions: Specular or not (0 or 2), + normalize normal or not (0 or 1). More...


Detailed Description

VertexProgram for an effect of Wind on Tree meshes.

Author:
Lionel Berenguier , Nevrax France
Date:
2002

Definition at line 44 of file meshvp_wind_tree.h.


Member Enumeration Documentation

anonymous enum
 

Enumeration values:
HrcDepth 

Definition at line 49 of file meshvp_wind_tree.h.

anonymous enum [private]
 

Enumeration values:
NumVp 

Definition at line 114 of file meshvp_wind_tree.h.


Constructor & Destructor Documentation

NL3D::CMeshVPWindTree::CMeshVPWindTree  
 

Constructor.

Definition at line 100 of file meshvp_wind_tree.cpp.

References _CurrentTime, _LastSceneTime, Bias, Frequency, FrequencyWindFactor, HrcDepth, PowerXY, PowerZ, and SpecularLighting.

NL3D::CMeshVPWindTree::~CMeshVPWindTree   [virtual]
 

Definition at line 119 of file meshvp_wind_tree.cpp.


Member Function Documentation

bool NL3D::CMeshVPWindTree::begin IDriver   drv,
CScene   scene,
CMeshBaseInstance   mbi,
const NLMISC::CMatrix   invertedModelMat,
const NLMISC::CVector  
[virtual]
 

Setup Wind constants, Light constants, and activate the VP.

Implements NL3D::IMeshVertexProgram.

Definition at line 176 of file meshvp_wind_tree.cpp.

References _CurrentTime, _LastSceneTime, _MaxDeltaPos, _VertexProgram, Bias, NLMISC::clamp, Frequency, FrequencyWindFactor, HrcDepth, nlassert, PowerXY, PowerZ, setupLighting, SpecularLighting, and speedCos.

void NL3D::CMeshVPWindTree::end IDriver   drv [virtual]
 

disable the VertexProgram.

Implements NL3D::IMeshVertexProgram.

Definition at line 309 of file meshvp_wind_tree.cpp.

void NL3D::CMeshVPWindTree::initInstance CMeshBaseInstance   mbi [virtual]
 

Setup a rand phase for wind in mbi.

Implements NL3D::IMeshVertexProgram.

Definition at line 143 of file meshvp_wind_tree.cpp.

References _VertexProgram, NLMISC::frand, HrcDepth, nlassert, NumVp, NL3D::VPLightConstantStart, NL3D::WindTreeVPCodeEnd, and NL3D::WindTreeVPCodeWave.

NL3D::CMeshVPWindTree::NLMISC_DECLARE_CLASS CMeshVPWindTree   
 

void NL3D::CMeshVPWindTree::serial NLMISC::IStream   f throw (NLMISC::EStream) [virtual]
 

Implements NLMISC::IStreamable.

Definition at line 125 of file meshvp_wind_tree.cpp.

References nlassert.

void NL3D::CMeshVPWindTree::setupForMaterial const CMaterial   mat,
IDriver   drv,
CScene   scene,
IVertexBufferHard   vb
[virtual]
 

The same as setupForMaterial, but with a hard vb.

Implements NL3D::IMeshVertexProgram.

Definition at line 333 of file meshvp_wind_tree.cpp.

References NL3D::SetupForMaterial.

void NL3D::CMeshVPWindTree::setupForMaterial const CMaterial   mat,
IDriver   drv,
CScene   scene,
CVertexBuffer   vb
[virtual]
 

Setup this shader for the given material.

This may disable the shader if necessary. This is why the vertex buffer is needed : when disabling the v.p we may need to reactivate it

Implements NL3D::IMeshVertexProgram.

Definition at line 324 of file meshvp_wind_tree.cpp.

References NL3D::SetupForMaterial.

void NL3D::CMeshVPWindTree::setupLighting CScene   scene,
CMeshBaseInstance   mbi,
const NLMISC::CMatrix   invertedModelMat
[private]
 

Definition at line 342 of file meshvp_wind_tree.cpp.

References nlassert, SpecularLighting, and NL3D::VPLightConstantStart.

Referenced by begin.

float NL3D::CMeshVPWindTree::speedCos float    angle [static, private]
 

Definition at line 92 of file meshvp_wind_tree.cpp.

References NLMISC::Pi.

Referenced by begin.


Member Data Documentation

float NL3D::CMeshVPWindTree::_CurrentTime[HrcDepth] [private]
 

Definition at line 122 of file meshvp_wind_tree.h.

Referenced by begin, and CMeshVPWindTree.

double NL3D::CMeshVPWindTree::_LastSceneTime [private]
 

Definition at line 123 of file meshvp_wind_tree.h.

Referenced by begin, and CMeshVPWindTree.

CVector NL3D::CMeshVPWindTree::_MaxDeltaPos[HrcDepth] [private]
 

Definition at line 126 of file meshvp_wind_tree.h.

Referenced by begin.

std::auto_ptr< CVertexProgram > NL3D::CMeshVPWindTree::_VertexProgram [static, private]
 

The 16 versions: Specular or not (0 or 2), + normalize normal or not (0 or 1).

All multiplied by 4, because support from 0 to 3 pointLights activated. (0.., 4.., 8.., 12..)

Definition at line 51 of file meshvp_wind_tree.cpp.

Referenced by begin, and initInstance.

float NL3D::CMeshVPWindTree::Bias[HrcDepth]
 

Bias result of the cosinus: f= cos(time)+bias.

Definition at line 63 of file meshvp_wind_tree.h.

Referenced by begin, and CMeshVPWindTree.

float NL3D::CMeshVPWindTree::Frequency[HrcDepth]
 

Frequency of the wind for 3 Hierachy levels.

Definition at line 55 of file meshvp_wind_tree.h.

Referenced by begin, and CMeshVPWindTree.

float NL3D::CMeshVPWindTree::FrequencyWindFactor[HrcDepth]
 

Additional frequency, multiplied by the globalWindPower.

Definition at line 57 of file meshvp_wind_tree.h.

Referenced by begin, and CMeshVPWindTree.

float NL3D::CMeshVPWindTree::PowerXY[HrcDepth]
 

Power of the wind on XY. Mul by globalWindPower.

Definition at line 59 of file meshvp_wind_tree.h.

Referenced by begin, and CMeshVPWindTree.

float NL3D::CMeshVPWindTree::PowerZ[HrcDepth]
 

Power of the wind on Z. Mul by globalWindPower.

Definition at line 61 of file meshvp_wind_tree.h.

Referenced by begin, and CMeshVPWindTree.

bool NL3D::CMeshVPWindTree::SpecularLighting
 

true if want Specular Lighting.

Definition at line 66 of file meshvp_wind_tree.h.

Referenced by begin, CMeshVPWindTree, and setupLighting.


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