From 0ea5fc66924303d1bf73ba283a383e2aadee02f2 Mon Sep 17 00:00:00 2001 From: neodarz Date: Sat, 11 Aug 2018 20:21:34 +0200 Subject: Initial commit --- docs/doxygen/nel/a02917.html | 1847 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 1847 insertions(+) create mode 100644 docs/doxygen/nel/a02917.html (limited to 'docs/doxygen/nel/a02917.html') diff --git a/docs/doxygen/nel/a02917.html b/docs/doxygen/nel/a02917.html new file mode 100644 index 00000000..3dcac447 --- /dev/null +++ b/docs/doxygen/nel/a02917.html @@ -0,0 +1,1847 @@ + + +NeL: NL3D::CMeshVPWindTree class Reference + + + +
+

NL3D::CMeshVPWindTree Class Reference

#include <meshvp_wind_tree.h> +

+

Inheritance diagram for NL3D::CMeshVPWindTree: +

+ +NL3D::IMeshVertexProgram +NLMISC::IStreamable +NLMISC::CRefCount +NLMISC::IClassable + +

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. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Public Types

enum  { HrcDepth = 3 + }

Public Member Functions

 CMeshVPWindTree ()
 Constructor.

virtual std::string getClassName ()=0
virtual float getMaxVertexMove ()
const sintgetRefCount () const
virtual bool needTangentSpace () const
 NLMISC_DECLARE_CLASS (CMeshVPWindTree)
virtual void serial (NLMISC::IStream &f) throw (NLMISC::EStream)
virtual ~CMeshVPWindTree ()
IMeshVertexProgram implementation
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.

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

virtual void initInstance (CMeshBaseInstance *mbi)
 Setup a rand phase for wind in mbi.

virtual void setupForMaterial (const CMaterial &mat, IDriver *drv, CScene *scene, IVertexBufferHard *vb)
 Setup Wind constants, Light constants, and activate the VP.

virtual void setupForMaterial (const CMaterial &mat, IDriver *drv, CScene *scene, CVertexBuffer *vb)
 Setup Wind constants, Light constants, and activate the VP.

MBR support For WindTree
virtual void beginMBRInstance (IDriver *drv, CScene *scene, CMeshBaseInstance *mbi, const NLMISC::CMatrix &invertedModelMat)
virtual void beginMBRMesh (IDriver *drv, CScene *scene)
virtual void endMBRMesh (IDriver *drv)
virtual bool isMBRVpOk (IDriver *drv) const
virtual bool supportMeshBlockRendering () const

Data Fields

sint crefs
CPtrInfo * pinfo
WindTree Parameters;
float Bias [HrcDepth]
 Bias result of the cosinus: f= cos(time)+bias.

float Frequency [HrcDepth]
 Frequency of the wind for 3 Hierachy levels.

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

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

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

bool SpecularLighting
 true if want Specular Lighting.


Static Public Attributes

CPtrInfo NullPtrInfo

Private Types

enum  { NumVp = 16 + }

Private Member Functions

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

Static Private Member Functions

float speedCos (float angle)

Private Attributes

float _CurrentTime [HrcDepth]
uint _LastMBRIdVP
double _LastSceneTime
CVector _MaxDeltaPos [HrcDepth]
float _MaxVertexMove

Static Private Attributes

std::auto_ptr< CVertexProgram_VertexProgram [NumVp]

Friends

struct CPtrInfo
+


Member Enumeration Documentation

+

+ + + + +
+ + +
anonymous enum +
+
+ + + + + +
+   + + +

+

Enumeration values:
+ + +
HrcDepth  +
+
+ +

+Definition at line 49 of file meshvp_wind_tree.h. +

+

00049 {HrcDepth= 3};
+
+

+ + + + +
+ + +
anonymous enum [private] +
+
+ + + + + +
+   + + +

+

Enumeration values:
+ + +
NumVp  +
+
+ +

+Definition at line 125 of file meshvp_wind_tree.h. +

+

00125 { NumVp = 16};  
+
+


Constructor & Destructor Documentation

+

+ + + + +
+ + + + + + + + + +
NL3D::CMeshVPWindTree::CMeshVPWindTree  ) 
+
+ + + + + +
+   + + +

+Constructor. +

+ +

+Definition at line 100 of file meshvp_wind_tree.cpp. +

+References _CurrentTime, _LastSceneTime, _MaxVertexMove, FrequencyWindFactor, HrcDepth, PowerXY, PowerZ, and uint. +

+

00101 {
+00102         for(uint i=0; i<HrcDepth; i++)
+00103         {
+00104                 Frequency[i]= 1;
+00105                 FrequencyWindFactor[i]= 0;
+00106                 PowerXY[i]= 0;
+00107                 PowerZ[i]= 0;
+00108                 Bias[i]= 0;
+00109                 // Init currentTime.
+00110                 _CurrentTime[i]= 0;
+00111         }
+00112         SpecularLighting= false;
+00113 
+00114         _LastSceneTime= 0;
+00115         _MaxVertexMove= 0;
+00116 }
+
+

+ + + + +
+ + + + + + + + + +
NL3D::CMeshVPWindTree::~CMeshVPWindTree  )  [virtual]
+
+ + + + + +
+   + + +

+ +

+Definition at line 120 of file meshvp_wind_tree.cpp. +

+

00121 {
+00122 }
+
+


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 297 of file meshvp_wind_tree.cpp. +

+References NL3D::IDriver::activeVertexProgram(), NLMISC::clamp(), NL3D::CRenderTrav::getNumVPLights(), NL3D::CScene::getRenderTrav(), NL3D::IDriver::isForceNormalize(), NL3D::IDriver::isVertexProgramEmulated(), NL3D::IDriver::isVertexProgramSupported(), nlassert, setupPerInstanceConstants(), setupPerMesh(), sint, and uint. +

+

00298 {
+00299         if (!(driver->isVertexProgramSupported() && !driver->isVertexProgramEmulated())) return false;
+00300 
+00301 
+00302         // precompute mesh
+00303         setupPerMesh(driver, scene);
+00304 
+00305         // Setup instance constants
+00306         setupPerInstanceConstants(driver, scene, mbi, invertedModelMat);
+00307 
+00308         // Activate the good VertexProgram
+00309         //===============
+00310 
+00311         // Get how many pointLights are setuped now.
+00312         nlassert(scene != NULL);
+00313         CRenderTrav             *renderTrav= &scene->getRenderTrav();
+00314         sint    numPls= renderTrav->getNumVPLights()-1;
+00315         clamp(numPls, 0, CRenderTrav::MaxVPLight-1);
+00316 
+00317         // Enable normalize only if requested by user. Because lighting don't manage correct "scale lighting"
+00318         uint    idVP= (SpecularLighting?2:0) + (driver->isForceNormalize()?1:0) ;
+00319         // correct VP id for correct unmber of pls.
+00320         idVP= numPls*4 + idVP;
+00321 
+00322         // activate VP.
+00323         driver->activeVertexProgram(_VertexProgram[idVP].get());
+00324 
+00325 
+00326         return true;
+00327 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
void NL3D::CMeshVPWindTree::beginMBRInstance IDriver drv,
CScene scene,
CMeshBaseInstance mbi,
const NLMISC::CMatrix invertedModelMat
[virtual]
+
+ + + + + +
+   + + +

+ +

+Reimplemented from NL3D::IMeshVertexProgram. +

+Definition at line 407 of file meshvp_wind_tree.cpp. +

+References _LastMBRIdVP, NL3D::IDriver::activeVertexProgram(), NLMISC::clamp(), NL3D::CRenderTrav::getNumVPLights(), NL3D::CScene::getRenderTrav(), NL3D::IDriver::isForceNormalize(), nlassert, setupPerInstanceConstants(), sint, and uint. +

+

00408 {
+00409         // setup first constants for this instance
+00410         setupPerInstanceConstants(driver, scene, mbi, invertedModelMat);
+00411 
+00412         // Get how many pointLights are setuped now.
+00413         nlassert(scene != NULL);
+00414         CRenderTrav             *renderTrav= &scene->getRenderTrav();
+00415         sint    numPls= renderTrav->getNumVPLights()-1;
+00416         clamp(numPls, 0, CRenderTrav::MaxVPLight-1);
+00417 
+00418         // Enable normalize only if requested by user. Because lighting don't manage correct "scale lighting"
+00419         uint    idVP= (SpecularLighting?2:0) + (driver->isForceNormalize()?1:0) ;
+00420         // correct VP id for correct number of pls.
+00421         idVP= numPls*4 + idVP;
+00422 
+00423         // re-activate VP if idVP different from last setup
+00424         if( idVP!=_LastMBRIdVP )
+00425         {
+00426                 _LastMBRIdVP= idVP;
+00427                 driver->activeVertexProgram(_VertexProgram[_LastMBRIdVP].get());
+00428         }
+00429 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
void NL3D::CMeshVPWindTree::beginMBRMesh IDriver drv,
CScene scene
[virtual]
+
+ + + + + +
+   + + +

+ +

+Reimplemented from NL3D::IMeshVertexProgram. +

+Definition at line 392 of file meshvp_wind_tree.cpp. +

+References _LastMBRIdVP, NL3D::IDriver::activeVertexProgram(), and setupPerMesh(). +

+

00393 {
+00394         // precompute mesh
+00395         setupPerMesh(driver, scene);
+00396 
+00397         /* Since need a VertexProgram Activation before activeVBHard, activate a default one
+00398                 bet the common one will be "NoPointLight, NoSpecular, No ForceNormalize" => 0.
+00399         */
+00400         _LastMBRIdVP= 0;
+00401 
+00402         // activate VP.
+00403         driver->activeVertexProgram(_VertexProgram[_LastMBRIdVP].get());
+00404 }
+
+

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

+disable the VertexProgram. +

+ +

+Implements NL3D::IMeshVertexProgram. +

+Definition at line 330 of file meshvp_wind_tree.cpp. +

+References NL3D::IDriver::activeVertexProgram(). +

+

00331 {
+00332         // Disable the VertexProgram
+00333         driver->activeVertexProgram(NULL);
+00334 }
+
+

+ + + + +
+ + + + + + + + + + +
void NL3D::CMeshVPWindTree::endMBRMesh IDriver drv  )  [virtual]
+
+ + + + + +
+   + + +

+ +

+Reimplemented from NL3D::IMeshVertexProgram. +

+Definition at line 432 of file meshvp_wind_tree.cpp. +

+References NL3D::IDriver::activeVertexProgram(). +

+

00433 {
+00434         // Disable the VertexProgram
+00435         driver->activeVertexProgram(NULL);
+00436 }
+
+

+ + + + +
+ + + + + + + + + +
virtual std::string NLMISC::IClassable::getClassName  )  [pure virtual, inherited]
+
+ + + + + +
+   + + +

+ +

+Implemented in NLAIAGENT::CNumericIndex, NLAIC::IPointerGestion, NLAIC::CIdentType, and CAutomataDesc. +

+Referenced by NLMISC::CClassRegistry::checkObject(), and NL3D::GetTextureSize().

+

+ + + + +
+ + + + + + + + + +
float NL3D::CMeshVPWindTree::getMaxVertexMove  )  [virtual]
+
+ + + + + +
+   + + +

+This return the (over-evaluated) max delta the VertexProgram apply to vertex (in world basis) NB: This method call is relevant only after begin() or beginMBRInstance() +

+Reimplemented from NL3D::IMeshVertexProgram. +

+Definition at line 439 of file meshvp_wind_tree.cpp. +

+References _MaxVertexMove. +

+

00440 {
+00441         return _MaxVertexMove;
+00442 }
+
+

+ + + + +
+ + + + + + + + + +
const sint& NLMISC::CRefCount::getRefCount  )  const [inline, inherited]
+
+ + + + + +
+   + + +

+ +

+Definition at line 70 of file smart_ptr.h. +

+References NLMISC::CRefCount::crefs, and sint. +

+

00071         {
+00072                 return  crefs;
+00073         }
+
+

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

+Setup a rand phase for wind in mbi. +

+ +

+Implements NL3D::IMeshVertexProgram. +

+Definition at line 144 of file meshvp_wind_tree.cpp. +

+References NL3D::CMeshBaseInstance::_VPWindTreePhase, NLMISC::frand(), HrcDepth, nlassert, uint, NL3D::VPLightConstantStart, NL3D::WindTreeVPCodeEnd, and NL3D::WindTreeVPCodeWave. +

+

00145 {
+00146         // init the vertexProgram code.
+00147         static  bool    vpCreated= false;
+00148         if(!vpCreated)
+00149         {
+00150                 vpCreated= true;
+00151                 // All vpcode and begin() written for HrcDepth==3
+00152                 nlassert(HrcDepth==3);
+00153 
+00154                 // combine fragments.
+00155                 string  vpCode;
+00156 
+00157                 // For all possible VP.
+00158                 for(uint i=0;i<NumVp;i++)
+00159                 {
+00160                         // setup of the VPLight fragment
+00161                         uint    numPls= i/4;
+00162                         bool    normalize= (i&1)!=0;
+00163                         bool    specular= (i&2)!=0;
+00164 
+00165                         // combine fragments
+00166                         vpCode= string(WindTreeVPCodeWave) 
+00167                                         + CRenderTrav::getLightVPFragment(numPls, VPLightConstantStart, specular, normalize) 
+00168                                         + WindTreeVPCodeEnd;
+00169                         _VertexProgram[i]= std::auto_ptr<CVertexProgram>(new CVertexProgram(vpCode.c_str()));
+00170                 }
+00171         }
+00172 
+00173         // init a random phase.
+00174         mbi->_VPWindTreePhase= frand(1);
+00175 }
+
+

+ + + + +
+ + + + + + + + + + +
bool NL3D::CMeshVPWindTree::isMBRVpOk IDriver drv  )  const [virtual]
+
+ + + + + +
+   + + +

+ +

+Reimplemented from NL3D::IMeshVertexProgram. +

+Definition at line 386 of file meshvp_wind_tree.cpp. +

+References NL3D::IDriver::isVertexProgramEmulated(), and NL3D::IDriver::isVertexProgramSupported(). +

+

00387 {
+00388         return driver->isVertexProgramSupported() && !driver->isVertexProgramEmulated();
+00389 }
+
+

+ + + + +
+ + + + + + + + + +
virtual bool NL3D::IMeshVertexProgram::needTangentSpace  )  const [inline, virtual, inherited]
+
+ + + + + +
+   + + +

+ +

+Reimplemented in NL3D::CMeshVPPerPixelLight. +

+Definition at line 106 of file mesh_vertex_program.h. +

+

00106 { return false; }
+
+

+ + + + +
+ + + + + + + + + + +
NL3D::CMeshVPWindTree::NLMISC_DECLARE_CLASS CMeshVPWindTree   ) 
+
+ + + + + +
+   + + +

+

+

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

+ +

+Implements NLMISC::IStreamable. +

+Definition at line 126 of file meshvp_wind_tree.cpp. +

+References nlassert, and uint. +

+

00127 {
+00128         (void)f.serialVersion(0);
+00129 
+00130         nlassert(HrcDepth==3);
+00131         for(uint i=0; i<HrcDepth; i++)
+00132         {
+00133                 f.serial(Frequency[i]);
+00134                 f.serial(FrequencyWindFactor[i]);
+00135                 f.serial(PowerXY[i]);
+00136                 f.serial(PowerZ[i]);
+00137                 f.serial(Bias[i]);
+00138         }
+00139         f.serial(SpecularLighting);
+00140 }
+
+

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

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

+ +

+Implements NL3D::IMeshVertexProgram. +

+Definition at line 354 of file meshvp_wind_tree.cpp. +

+References NL3D::SetupForMaterial(). +

+

00358 {
+00359         SetupForMaterial(mat, scene);
+00360 }
+
+

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

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

+ +

+Implements NL3D::IMeshVertexProgram. +

+Definition at line 345 of file meshvp_wind_tree.cpp. +

+References NL3D::SetupForMaterial(). +

+

00349 {       
+00350         SetupForMaterial(mat, scene);   
+00351 }
+
+

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

+ +

+Definition at line 363 of file meshvp_wind_tree.cpp. +

+References NL3D::CRenderTrav::beginVPLightSetup(), NL3D::CScene::getRenderTrav(), nlassert, and NL3D::VPLightConstantStart. +

+Referenced by setupPerInstanceConstants(). +

+

00364 {
+00365         nlassert(scene != NULL);
+00366         CRenderTrav             *renderTrav= &scene->getRenderTrav();
+00367         // setup cte for lighting
+00368         renderTrav->beginVPLightSetup(VPLightConstantStart, SpecularLighting, invertedModelMat);
+00369 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
void NL3D::CMeshVPWindTree::setupPerInstanceConstants IDriver driver,
CScene scene,
CMeshBaseInstance mbi,
const NLMISC::CMatrix invertedModelMat
[inline, private]
+
+ + + + + +
+   + + +

+ +

+Definition at line 228 of file meshvp_wind_tree.cpp. +

+References _CurrentTime, _MaxDeltaPos, NL3D::CMeshBaseInstance::_VPWindTreePhase, NL3D::CTransform::getWorldMatrix(), HrcDepth, NLMISC::CMatrix::invert(), NLMISC::CMatrix::mulVector(), NL3D::IDriver::setConstant(), NL3D::IDriver::setConstantMatrix(), NLMISC::CMatrix::setRot(), setupLighting(), speedCos(), and uint. +

+Referenced by begin(), and beginMBRInstance(). +

+

00229 {
+00230         // get instance info
+00231         float   instancePhase= mbi->_VPWindTreePhase;
+00232 
+00233 
+00234         // maxDeltaPos in ObjectSpace. So same world Wind direction is applied to all objects
+00235         static  CMatrix         invWorldMatrix;
+00236         // Keep only rotation part. (just need it and faster invert)
+00237         invWorldMatrix.setRot(mbi->getWorldMatrix());
+00238         invWorldMatrix.invert();
+00239         static  CVector         maxDeltaPosOS[HrcDepth];
+00240         for(uint i=0; i<HrcDepth; i++)
+00241         {
+00242                 maxDeltaPosOS[i]= invWorldMatrix.mulVector(_MaxDeltaPos[i]);
+00243         }
+00244 
+00245 
+00246         // Setup lighting and lighting constants
+00247         setupLighting(scene, mbi, invertedModelMat);
+00248 
+00249         // c[0..3] take the ModelViewProjection Matrix. After setupModelMatrix();
+00250         driver->setConstantMatrix(0, IDriver::ModelViewProjection, IDriver::Identity);
+00251         // c[4..7] take the ModelView Matrix. After setupModelMatrix();
+00252         driver->setConstantMatrix(4, IDriver::ModelView, IDriver::Identity);
+00253 
+00254 
+00255         // c[15] take Wind of level 0.
+00256         float   f;
+00257         f= _CurrentTime[0] + instancePhase;
+00258         f= speedCos(f) + Bias[0];
+00259         driver->setConstant(15, maxDeltaPosOS[0]*f );
+00260 
+00261 
+00262         // c[16-19] take Wind of level 1.
+00263         // Unrolled. 
+00264         float   instTime1= _CurrentTime[1] + instancePhase;
+00265         // phase 0.
+00266         f= speedCos( instTime1+0 ) + Bias[1];
+00267         driver->setConstant(16+0, maxDeltaPosOS[1]*f);
+00268         // phase 1.
+00269         f= speedCos( instTime1+0.25f ) + Bias[1];
+00270         driver->setConstant(16+1, maxDeltaPosOS[1]*f);
+00271         // phase 2.
+00272         f= speedCos( instTime1+0.50f ) + Bias[1];
+00273         driver->setConstant(16+2, maxDeltaPosOS[1]*f);
+00274         // phase 3.
+00275         f= speedCos( instTime1+0.75f ) + Bias[1];
+00276         driver->setConstant(16+3, maxDeltaPosOS[1]*f);
+00277 
+00278 
+00279         // c[20, 23] take Wind of level 2.
+00280         // Unrolled. 
+00281         float   instTime2= _CurrentTime[2] + instancePhase;
+00282         // phase 0.
+00283         f= speedCos( instTime2+0 ) + Bias[2];
+00284         driver->setConstant(20+0, maxDeltaPosOS[2]*f);
+00285         // phase 1.
+00286         f= speedCos( instTime2+0.25f ) + Bias[2];
+00287         driver->setConstant(20+1, maxDeltaPosOS[2]*f);
+00288         // phase 2.
+00289         f= speedCos( instTime2+0.50f ) + Bias[2];
+00290         driver->setConstant(20+2, maxDeltaPosOS[2]*f);
+00291         // phase 3.
+00292         f= speedCos( instTime2+0.75f ) + Bias[2];
+00293         driver->setConstant(20+3, maxDeltaPosOS[2]*f);
+00294 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
void NL3D::CMeshVPWindTree::setupPerMesh IDriver driver,
CScene scene
[inline, private]
+
+ + + + + +
+   + + +

+ +

+Definition at line 178 of file meshvp_wind_tree.cpp. +

+References _CurrentTime, _LastSceneTime, _MaxDeltaPos, _MaxVertexMove, FrequencyWindFactor, NL3D::CScene::getCurrentTime(), NL3D::CScene::getGlobalWindDirection(), NL3D::CScene::getGlobalWindPower(), HrcDepth, NLMISC::CVector::norm(), PowerXY, PowerZ, NL3D::IDriver::setConstant(), uint, and NLMISC::CVector::z. +

+Referenced by begin(), and beginMBRMesh(). +

+

00179 {
+00180         // process current times and current power. Only one time per render() and per CMeshVPWindTree.
+00181         if(scene->getCurrentTime() != _LastSceneTime)
+00182         {
+00183                 // Get info from scene
+00184                 float   windPower= scene->getGlobalWindPower();
+00185 
+00186                 float   dt= (float)(scene->getCurrentTime() - _LastSceneTime);
+00187                 _LastSceneTime= scene->getCurrentTime();
+00188 
+00189                 // Update each boneLevel time according to frequency.
+00190                 uint i;
+00191                 for(i=0; i<HrcDepth; i++)
+00192                 {
+00193                         _CurrentTime[i]+= dt*(Frequency[i] + FrequencyWindFactor[i]*windPower);
+00194                         // get it between 0 and 1. Important for float precision problems.
+00195                         _CurrentTime[i]= (float)fmod(_CurrentTime[i], 1);
+00196                 }
+00197 
+00198                 // Update each boneLevel maximum amplitude vector.
+00199                 for(i=0; i<HrcDepth; i++)
+00200                 {
+00201                         _MaxDeltaPos[i]= scene->getGlobalWindDirection() * PowerXY[i] * windPower;
+00202                         _MaxDeltaPos[i].z= PowerZ[i] * windPower;
+00203                 }
+00204 
+00205                 /* Update the Max amplitude distance 
+00206                         in world space, since maxdeltaPos are applied in world space, see setupPerInstanceConstants()
+00207                 */
+00208                 _MaxVertexMove= 0;
+00209                 for(i=0; i<HrcDepth; i++)
+00210                 {
+00211                         _MaxVertexMove+= _MaxDeltaPos[i].norm();
+00212                 }
+00213         }
+00214 
+00215         // Setup common constants for each instances.
+00216         // c[8] take usefull constants.
+00217         static  float   ct8[4]= {0, 1, 0.5f, 2};
+00218         driver->setConstant(8, 1, ct8);
+00219         // c[9] take other usefull constants.
+00220         static  float   ct9[4]= {3.f, 0.f, -1.f, -2.f};
+00221         driver->setConstant(9, 1, ct9);
+00222         // c[10] take Number of phase (4) for level2 and 3. -0.01 to avoid int value == 4.
+00223         static  float   ct10[4]= {4-0.01f, 0, 0, 0};
+00224         driver->setConstant(10, 1, ct10);
+00225 }
+
+

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

+ +

+Definition at line 92 of file meshvp_wind_tree.cpp. +

+References NLMISC::Pi. +

+Referenced by setupPerInstanceConstants(). +

+

00093 {
+00094         // \todo yoyo TODO_OPTIM
+00095         return cosf(angle * 2*(float)Pi);
+00096 }
+
+

+ + + + +
+ + + + + + + + + +
bool NL3D::CMeshVPWindTree::supportMeshBlockRendering  )  const [virtual]
+
+ + + + + +
+   + + +

+ +

+Reimplemented from NL3D::IMeshVertexProgram. +

+Definition at line 380 of file meshvp_wind_tree.cpp. +

+

00381 {
+00382         return true;
+00383 }
+
+


Friends And Related Function Documentation

+

+ + + + +
+ + +
friend struct CPtrInfo [friend, inherited] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 67 of file smart_ptr.h.

+


Field Documentation

+

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

+ +

+Definition at line 133 of file meshvp_wind_tree.h. +

+Referenced by CMeshVPWindTree(), setupPerInstanceConstants(), and setupPerMesh().

+

+ + + + +
+ + +
uint NL3D::CMeshVPWindTree::_LastMBRIdVP [private] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 141 of file meshvp_wind_tree.h. +

+Referenced by beginMBRInstance(), and beginMBRMesh().

+

+ + + + +
+ + +
double NL3D::CMeshVPWindTree::_LastSceneTime [private] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 134 of file meshvp_wind_tree.h. +

+Referenced by CMeshVPWindTree(), and setupPerMesh().

+

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

+ +

+Definition at line 137 of file meshvp_wind_tree.h. +

+Referenced by setupPerInstanceConstants(), and setupPerMesh().

+

+ + + + +
+ + +
float NL3D::CMeshVPWindTree::_MaxVertexMove [private] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 138 of file meshvp_wind_tree.h. +

+Referenced by CMeshVPWindTree(), getMaxVertexMove(), and setupPerMesh().

+

+ + + + +
+ + +
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.

+

+ + + + +
+ + +
float NL3D::CMeshVPWindTree::Bias[HrcDepth] +
+
+ + + + + +
+   + + +

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

+ +

+Definition at line 63 of file meshvp_wind_tree.h.

+

+ + + + +
+ + +
sint NLMISC::CRefCount::crefs [mutable, inherited] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 79 of file smart_ptr.h. +

+Referenced by NLMISC::CRefCount::CRefCount(), NLMISC::CRefCount::getRefCount(), and NLMISC::CRefCount::~CRefCount().

+

+ + + + +
+ + +
float NL3D::CMeshVPWindTree::Frequency[HrcDepth] +
+
+ + + + + +
+   + + +

+Frequency of the wind for 3 Hierachy levels. +

+ +

+Definition at line 55 of file meshvp_wind_tree.h.

+

+ + + + +
+ + +
float NL3D::CMeshVPWindTree::FrequencyWindFactor[HrcDepth] +
+
+ + + + + +
+   + + +

+Additional frequency, multiplied by the globalWindPower. +

+ +

+Definition at line 57 of file meshvp_wind_tree.h. +

+Referenced by CMeshVPWindTree(), and setupPerMesh().

+

+ + + + +
+ + +
CRefCount::CPtrInfo NLMISC::CRefCount::NullPtrInfo [static, inherited] +
+
+ + + + + +
+   + + +

+ +

+Referenced by NLMISC::CRefCount::CRefCount().

+

+ + + + +
+ + +
CPtrInfo* NLMISC::CRefCount::pinfo [mutable, inherited] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 80 of file smart_ptr.h. +

+Referenced by NLMISC::CRefCount::CRefCount(), and NLMISC::CRefCount::~CRefCount().

+

+ + + + +
+ + +
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 CMeshVPWindTree(), and setupPerMesh().

+

+ + + + +
+ + +
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 CMeshVPWindTree(), and setupPerMesh().

+

+ + + + +
+ + +
bool NL3D::CMeshVPWindTree::SpecularLighting +
+
+ + + + + +
+   + + +

+true if want Specular Lighting. +

+ +

+Definition at line 66 of file meshvp_wind_tree.h.

+


The documentation for this class was generated from the following files: +
Generated on Tue Mar 16 06:56:19 2004 for NeL by + +doxygen +1.3.6
+ + -- cgit v1.2.1