#include <landscape_vegetable_block.h>
Nevrax France
Definition at line 127 of file landscape_vegetable_block.h.
Public Member Functions | |
| CLandscapeVegetableBlockCreateContext () | |
| void | eval (uint ts, uint tt, float x, float y, CVector &pos) |
| void | init (CPatch *patch, uint ts, uint tt) |
Private Attributes | |
| bool | _Empty |
| CPatch * | _Patch |
| CVector | _Pos [9] |
| uint | _Ts |
| Coordinate of the lower-left tile. 2x2 tile vegetables are generated. | |
| uint | _Tt |
| Coordinate of the lower-left tile. 2x2 tile vegetables are generated. | |
|
|
Definition at line 277 of file landscape_vegetable_block.cpp.
00278 {
00279 _Patch= NULL;
00280 }
|
|
||||||||||||||||||||||||
|
If Empty, create all the necessary information from patch. Then compute requested Pos, from the tile ts,tt, and pos in this tile.
Definition at line 295 of file landscape_vegetable_block.cpp. References _Empty, NL3D::CPatch::computeVertex(), NL3D::CPatch::getOrderS(), NL3D::CPatch::getOrderT(), NL3D_TESSBLOCK_TILESIZE, nlassert, s, t, uint, x, and y. Referenced by NL3D::CPatch::generateTileVegetable().
00296 {
00297 nlassert(NL3D_TESSBLOCK_TILESIZE==4);
00298
00299 // If never created, do it now
00300 // ==================
00301 if(_Empty)
00302 {
00303 // Eval Position and normals for the 9 vertices (around the 2x2 tiles)
00304 for(uint j=0; j<3;j++)
00305 {
00306 float t= (float)(_Tt+j)/_Patch->getOrderT();
00307 for(uint i=0; i<3;i++)
00308 {
00309 float s= (float)(_Ts+i)/_Patch->getOrderS();
00310 // eval position.
00311 // use computeVertex() and not bpatch->eval() because vegetables must follow the
00312 // noise (at least at tile precision...). It is slower but necessary.
00313 _Pos[j*3+i]= _Patch->computeVertex(s, t);
00314 }
00315 }
00316
00317 // Ok, it's done
00318 _Empty= false;
00319 }
00320
00321
00322 // Eval, with simple bilinear
00323 // ==================
00324 nlassert(ts==_Ts || ts==_Ts+1);
00325 nlassert(tt==_Tt || tt==_Tt+1);
00326 uint ds= ts-_Ts;
00327 uint dt= tt-_Tt;
00328 // Indices.
00329 uint v00= dt*3 + ds;
00330 uint v10= v00 + 1;
00331 uint v01= v00 + 3;
00332 uint v11= v00 + 4;
00333 // BiLinearFactor.
00334 float dxdy= (1-x)*(1-y);
00335 float dx2dy= x*(1-y);
00336 float dxdy2= (1-x)*y;
00337 float dx2dy2= x*y;
00338
00339 // Compute Pos.
00340 pos = _Pos[v00] * dxdy;
00341 pos+= _Pos[v10] * dx2dy;
00342 pos+= _Pos[v01] * dxdy2;
00343 pos+= _Pos[v11] * dx2dy2;
00344 }
|
|
||||||||||||||||
|
Definition at line 284 of file landscape_vegetable_block.cpp. References _Empty, nlassert, and uint. Referenced by NL3D::CLandscapeVegetableBlock::update().
|
|
|
Definition at line 144 of file landscape_vegetable_block.h. |
|
|
Definition at line 145 of file landscape_vegetable_block.h. |
|
|
Definition at line 149 of file landscape_vegetable_block.h. |
|
|
Coordinate of the lower-left tile. 2x2 tile vegetables are generated.
Definition at line 147 of file landscape_vegetable_block.h. |
|
|
Coordinate of the lower-left tile. 2x2 tile vegetables are generated.
Definition at line 147 of file landscape_vegetable_block.h. |
1.3.6