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/a02702.html | 11172 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 11172 insertions(+) create mode 100644 docs/doxygen/nel/a02702.html (limited to 'docs/doxygen/nel/a02702.html') diff --git a/docs/doxygen/nel/a02702.html b/docs/doxygen/nel/a02702.html new file mode 100644 index 00000000..6c79ce66 --- /dev/null +++ b/docs/doxygen/nel/a02702.html @@ -0,0 +1,11172 @@ + + +NeL: NL3D::CLandscape class Reference + + + +
+

NL3D::CLandscape Class Reference

#include <landscape.h> +

+

Inheritance diagram for NL3D::CLandscape: +

+ +NLMISC::CRefCount + +

Detailed Description

+A landscape. Use CZone to build zone, and use landscape to dynamically add/remove them, for render.

+Limits:

+

+If you use the tiles mapped on the patches, load the near bank file (.bank) and the far bank file (.farbank) by seralizing TileBank and TileFarBank with those files. Then call initTileBanks.

+

Author:
Lionel Berenguier

+Nevrax France

+
Date:
2000
+ +

+ +

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

Accessors.

const CZonegetZone (sint zoneId) const
CZonegetZone (sint zoneId)
void getZoneList (std::vector< uint16 > &zoneIds) const
void buildZoneName (sint zoneId, std::string &zoneName)
 From an Id, return the name of the zone, in the form "150_EM", without extension.


Visual Collision system.

void addPatchBlocksInBBox (const CPatchIdentEx &paIdEx, const CAABBox &bbox, std::vector< CPatchBlockIdent > &paBlockIds)
void addTrianglesInBBox (const CPatchIdentEx &paIdEx, const CAABBox &bbox, std::vector< CTrianglePatch > &triangles, uint8 tileTessLevel) const
CQuadGrid< CPatchIdentEx_PatchQuadGrid
 The QuadGrid of patch.

const float _PatchQuadGridEltSize = 16
const uint _PatchQuadGridSize = 128

Dynamic ShadowMap

void appendToShadowPolyReceiver (CTessFace *face)
void removeFromShadowPolyReceiver (CTessFace *face)
CShadowPolyReceiver _ShadowPolyReceiver

Allocators.

void deleteTessFace (CTessFace *f)
void deleteTessFarVertex (CTessFarVertex *v)
void deleteTessNearVertex (CTessNearVertex *v)
void deleteTessVertex (CTessVertex *v)
void deleteTileFace (CTileFace *tf)
void deleteTileMaterial (CTileMaterial *tm)
CTessFacenewTessFace ()
CTessFarVertexnewTessFarVertex ()
CTessNearVertexnewTessNearVertex ()
CTessVertexnewTessVertex ()
CTileFacenewTileFace ()
CTileMaterialnewTileMaterial ()
CLandscapeFaceVectorManager _FaceVectorManager
CTessBlock _TessBlockModificationRoot
CBlockMemory< CTessFaceTessFaceAllocator
CBlockMemory< CTessFarVertexTessFarVertexAllocator
CBlockMemory< CTessNearVertexTessNearVertexAllocator
CBlockMemory< CTessVertexTessVertexAllocator
CBlockMemory< CTileFaceTileFaceAllocator
CBlockMemory< CTileMaterialTileMaterialAllocator

DynamicLighting management

CPatchDLMContextListgetPatchDLMContextList () const
 for CPatch.

CTextureDLMgetTextureDLM () const
 for CPatch.

CRGBA _DLMGlobalVegetableColor
 an approximate value used to simulate diffuse material of vegetables

float _DLMMaxAttEnd
 Max AttEnd.

CPatchDLMContextList_PatchDLMContextList
 List of DLM Context.

CRGBA _PointLightDiffuseMaterial
 The diffuse material of landscape, used for StaticPointLights and DynamicPointLights.

NLMISC::CSmartPtr< ITexture_TextureDLM
 The dynamic lightmap Texture.


[NOHEADER]

const CTileVegetableDescgetTileVegetableDesc (uint16 tileId)
bool _DriverOkForVegetable
 Tells if the current dirver support vegetable.

CTessList< CLandscapeVegetableBlock_VegetableBlockList
 List of VegetableBlock, to be tested for creation each frame.

CVegetableManager_VegetableManager
 The VegetableManager. (ptr only for include speed).

bool _VegetableManagerEnabled
 Tells if the Vegetable Managemnt is enabled.


UpdateLighting management

void linkPatchToNearUL (CPatch *patch)
 Used by Patch to link/unlink from _ULRootNearPatch.

void unlinkPatchFromNearUL (CPatch *patch)
 Used by Patch to link/unlink from _ULRootNearPatch.

void updateLightingTextureFar (float ratio)
 Update All Far texture, given a ratio along total lumels.

void updateLightingTextureNear (float ratio)
 Update All Near texture, given a ratio along total lumels.

float _ULFarPixelsToUpdate
 Current number of far pixels to update. If negative, I have some advance.

float _ULFrequency
 Frequency of update.

uint _ULNearCurrentTessBlockId
 Current tessBlock id in the current patch processed.

float _ULNearPixelsToUpdate
 Current number of near pixels to update. If negative, I have some advance.

double _ULPrecTime
 Used by Patch to link/unlink from _ULRootNearPatch.

bool _ULPrecTimeInit
 Used by Patch to link/unlink from _ULRootNearPatch.

CPatch_ULRootNearPatch
 The current patch rendered.

CTextureFar_ULRootTextureFar
 The current TextureFar rendered.

double _ULTime
 Used by Patch to link/unlink from _ULRootNearPatch.

sint _ULTotalFarPixels
 Far UpdateLighting.

sint _ULTotalNearPixels
 Near UpdateLighting.


Public Member Functions

 CLandscape ()
 Constructor.

const sintgetRefCount () const
 ~CLandscape ()
 Destructor. clear().

Init/Build.
bool addZone (const CZone &newZone)
void checkBinds (uint16 zoneId) throw (EBadBind)
 Verify the binding of patchs of one zone. throw EBadBind if error. nop if zone not loaded.

void checkBinds () throw (EBadBind)
 Verify the binding of patchs of all zones. throw EBadBind if error.

void clear ()
 Disconnect, and Delete all zones.

void init ()
 init the landscape VBuffers, texture cache etc...

void initTileBank ()
 Reinit the tile bank if the bank change.

bool initTileBanks ()
bool removeZone (uint16 zoneId)
Lightmap get interface.
void appendTileLightInfluences (const CPatchIdent &patchId, const CUV &uv, std::vector< CPointLightInfluence > &pointLightList) const
 Append lights under the position to pointLightList. Do nothing if invalid patchId.

uint8 getLumel (const CPatchIdent &patchId, const CUV &uv) const
 Get the lumel under the position. return 255 if invalid patchId.

Render methods.
void averageTesselationVertices ()
void clip (const CVector &refineCenter, const std::vector< CPlane > &pyramid)
void excludePatchFromRefineAll (sint zoneId, uint patch, bool exclude)
 This is especially for Pacs. exlude a patch to be refineAll()ed.

const CVectorgetOldRefineCenter () const
void profileRender ()
void refine (const CVector &refineCenter)
void refineAll (const CVector &refineCenter)
 Refine/Geomorph ALL the tesselation of the landscape, from the view point refineCenter. Even if !RefineMode.

void render (const CVector &refineCenter, const CVector &frontVector, const CPlane pyramid[NL3D_TESSBLOCK_NUM_CLIP_PLANE], bool doTileAddPass=false)
void setDriver (IDriver *drv)
Collision methods.
void buildCollideFaces (sint zoneId, sint patch, std::vector< CTriangle > &faces)
void buildCollideFaces (const CAABBoxExt &bbox, std::vector< CTriangle > &faces, bool faceSplit)
void buildPatchBlocksInBBox (const CAABBox &bbox, std::vector< CPatchBlockIdent > &paBlockIds)
void buildTrianglesInBBox (const CAABBox &bbox, std::vector< CTrianglePatch > &triangles, uint8 tileTessLevel)
void fillPatchQuadBlock (CPatchQuadBlock &quadBlock) const
float getCameraCollision (const CVector &start, const CVector &end, float radius, bool cone)
CVector getTesselatedPos (const CPatchIdent &patchId, const CUV &uv) const
void getTessellationLeaves (std::vector< const CTessFace * > &leaves) const
Dynamic Lighting management
void computeDynamicLighting (const std::vector< CPointLight * > &pls)
CRGBA getDLMGlobalVegetableColor () const
float getDynamicLightingMaxAttEnd () const
uint getDynamicLightingMemoryLoad () const
void setDLMGlobalVegetableColor (CRGBA gvc)
void setDynamicLightingMaxAttEnd (float maxAttEnd)
void createVegetableBlendLayersModels (CScene *scene)
void enableVegetable (bool enable)
uint getNumVegetableFaceRendered () const
bool isVegetableActive () const
void loadVegetableTexture (const std::string &textureFileName)
void setupColorsFromTileFlags (const NLMISC::CRGBA colors[4])
void setupVegetableLighting (const CRGBA &ambient, const CRGBA &diffuse, const CVector &directionalLight)
void setVegetableTime (double time)
void setVegetableUpdateLightingFrequency (float freq)
void setVegetableUpdateLightingTime (double time)
void setVegetableWind (const CVector &windDir, float windFreq, float windPower, float windBendMin)
Lighting.
void enableAutomaticLighting (bool enable)
const CVectorgetAutomaticLightDir () const
 return the light direction setuped in enableAutomaticLighting().

bool getAutomaticLighting () const
 return true if AutomaticLighting is enabled.

CRGBA getPointLightDiffuseMaterial () const
const CRGBAgetStaticLight () const
void initAnimatedLightIndex (const CScene &scene)
void removeAllPointLights ()
void setPointLightDiffuseMaterial (CRGBA diffuse)
void setPointLightFactor (const CScene &scene)
 update the Light factor for all pointLights in All zones, according to scene LightGroups and AnimatedLights.

void setupAutomaticLightDir (const CVector &lightDir)
void setupStaticLight (const CRGBA &diffuse, const CRGBA &ambiant, float multiply)
Tile mgt.
void flushTiles (IDriver *drv, uint16 tileStart, uint16 nbTiles)
 Force a range of tiles to be loaded in the driver...

CTileElementgetTileElement (const CPatchIdent &patchId, const CUV &uv)
 Return the tile element for a patch at specific UV. UseFull for getting surface data. Return NULL if not found.

NLMISC::CSmartPtr< ITexturegetTileTexture (uint16 tileId, CTile::TBitmap bitmapType, CVector &uvScaleBias)
 Return the texture for a tile Id. UseFull for Tile edition.

void releaseTiles (uint16 tileStart, uint16 nbTiles)
 Force a range of tiles to be loaded in the driver...

HeightField DeltaZ.
CVector getHeightFieldDeltaZ (float x, float y) const
 return the HeightField DeltaZ for the 2D position. (0,0,dZ) is returned.

void setHeightField (const CHeightMap &hf)
Landscape Parameters.
bool getNoiseMode () const
bool getRefineMode () const
float getThreshold () const
 Get threshold.

uint getTileMaxSubdivision ()
 Get Maximum Tile subdivision.

float getTileNear () const
 Get tile near distance.

void invalidateAllTiles ()
void setNoiseMode (bool enabled)
 Enable the noise or not. NB: only new tesselation computed is modified, so you should call it only at init time.

void setRefineMode (bool enabled)
void setThreshold (float thre)
 Set threshold for subdivsion quality. The lower is threshold, the more the landscape is subdivided. Default: 0.001.

void setTileMaxSubdivision (uint tileDiv)
 Set Maximum Tile subdivision. Valid values must be in [0..4] (assert). Default is 0 (for now :) ).

void setTileNear (float tileNear)
 Set tile near distance. Default 50.f. maximized to length of Far alpha transition).

Precision ZBuffer mgt.
const CVectorgetPZBModelPosition () const
 setPZBModelPosition()

void setPZBModelPosition (const CVector &pos)
Tile added/removed callback
ULandscapeTileCallbackgetTileCallback () const
void setTileCallback (ULandscapeTileCallback *cb)
Dynamic ShadowMap
void receiveShadowMap (IDriver *drv, CShadowMap *shadowMap, const CVector &casterPos, const CMaterial &shadowMat, const CVector &pzb)
UpdateLighting management
void setUpdateLightingFrequency (float freq)
void updateLighting (double time)
void updateLightingAll ()

Data Fields

sint crefs
CLandscapeModelOwnerModel
CPtrInfo * pinfo
CTileBank TileBank
CTileFarBank TileFarBank

Static Public Attributes

CPtrInfo NullPtrInfo

Private Types

typedef std::vector< TSPRenderPass
+>::iterator 
ItSPRenderPassVector
typedef TTileRdrPassSet::iterator ItTileRdrPassSet
typedef TTileTextureMap::iterator ItTileTextureMap
typedef NLMISC::CRefPtr< ITextureRPTexture
typedef NLMISC::CSmartPtr<
+ CPatchRdrPass
TSPRenderPass
typedef std::set< CPatchRdrPassTTileRdrPassSet
typedef std::map< std::string,
+ RPTexture
TTileTextureMap

Private Member Functions

void checkZoneBinds (CZone &curZone, EBadBind &bindError)
void clearFarRenderPass (CPatchRdrPass *pass)
bool eraseTileFarIfNotGood (uint tileNumber, uint sizeOrder0, uint sizeOrder1, uint sizeOrder2)
CPatchRdrPassfindTileRdrPass (const CPatchRdrPass &pass)
ITexturefindTileTexture (const std::string &textName)
void forceMergeAtTileLevel ()
 For changing TileMaxSubdivision. force tesselation to be under tile.

void freeFarRenderPass (CPatch *pPatch, CPatchRdrPass *pass, uint farIndex)
CPatchRdrPassgetFarRenderPass (CPatch *pPatch, uint farIndex, float &far1UScale, float &far1VScale, float &far1UBias, float &far1VBias, bool &bRot)
CPatchRdrPassgetTileRenderPass (uint16 tileId, bool additiveRdrPass)
void getTileUvScaleBiasRot (uint16 tileId, CTile::TBitmap bitmapType, CVector &uvScaleBias, uint8 &rotAlpha)
void loadTile (uint16 tileId)
void lockBuffers ()
void releaseTile (uint16 tileId)
void resetRenderFarAndDeleteVBFV ()
void synchronizeATIVBHards ()
void unlockBuffers ()
void updateGlobalsAndLockBuffers (const CVector &refineCenter)
void updateTessBlocksFaceVector ()
uint getTileLightMap (CRGBA map[NL_TILE_LIGHTMAP_SIZE *NL_TILE_LIGHTMAP_SIZE], CPatchRdrPass *&lightmapRdrPass)
void getTileLightMapUvInfo (uint tileLightMapId, CVector &uvScaleBias)
void refillTileLightMap (uint tileLightMapId, CRGBA map[NL_TILE_LIGHTMAP_SIZE *NL_TILE_LIGHTMAP_SIZE])
void releaseTileLightMap (uint tileLightMapId)

Private Attributes

CVector _AutomaticLightDir
bool _AutomaticLighting
bool _FarInitialized
float _FarTransition
CHeightField _HeightField
CRGBA _LightValue [256]
uint _NFreeLightMaps
bool _RefineMode
std::vector< TSPRenderPass_TextureFars
std::vector< TSPRenderPass_TextureNears
float _Threshold
ULandscapeTileCallback_TileCallback
float _TileDistNear
uint _TileMaxSubdivision
float _VPThresholdChange
CMaterial FarMaterial
std::vector< CTileInfo * > TileInfos
CMaterial TileMaterial
TTileRdrPassSet TileRdrPassSet
TTileTextureMap TileTextureMap
TZoneMap Zones
VertexBuffer mgt.
CRefPtr< IDriver_Driver
CLandscapeVBAllocator _Far0VB
CLandscapeVBAllocator _Far1VB
bool _RenderMustRefillVB
CLandscapeVBAllocator _TileVB
bool _VertexShaderOk
CTessFacePriorityList _MergePriorityList
 The priority list of faces which may need to merge.

CVector _OldRefineCenter
 OldRefineCenter setuped in prec refine().

bool _OldRefineCenterSetuped
 The priority list of faces which may need to merge.

CTessFacePListNode _RootNewLeaves
 newTessFace() append the face to _RootNewLeaves.

CTessFacePriorityList _SplitPriorityList
 The priority list of faces which may need to split.

bool _NoiseEnabled
Precision ZBuffer mgt.
CVector _PZBModelPosition
 setPZBModelPosition()


Friends

class CPatch
struct CPtrInfo
class CTessFace
class CZone
+


Member Typedef Documentation

+

+ + + + +
+ + +
typedef std::vector<TSPRenderPass>::iterator NL3D::CLandscape::ItSPRenderPassVector [private] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 781 of file landscape.h. +

+Referenced by clear(), and render().

+

+ + + + +
+ + +
typedef TTileRdrPassSet::iterator NL3D::CLandscape::ItTileRdrPassSet [private] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 731 of file landscape.h. +

+Referenced by findTileRdrPass(), flushTiles(), releaseTiles(), and render().

+

+ + + + +
+ + +
typedef TTileTextureMap::iterator NL3D::CLandscape::ItTileTextureMap [private] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 728 of file landscape.h.

+

+ + + + +
+ + +
typedef NLMISC::CRefPtr<ITexture> NL3D::CLandscape::RPTexture [private] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 726 of file landscape.h.

+

+ + + + +
+ + +
typedef NLMISC::CSmartPtr<CPatchRdrPass> NL3D::CLandscape::TSPRenderPass [private] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 732 of file landscape.h. +

+Referenced by getFarRenderPass(), and getTileLightMap().

+

+ + + + +
+ + +
typedef std::set<CPatchRdrPass> NL3D::CLandscape::TTileRdrPassSet [private] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 730 of file landscape.h.

+

+ + + + +
+ + +
typedef std::map<std::string, RPTexture> NL3D::CLandscape::TTileTextureMap [private] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 727 of file landscape.h.

+


Constructor & Destructor Documentation

+

+ + + + +
+ + + + + + + + + +
NL3D::CLandscape::CLandscape  ) 
+
+ + + + + +
+   + + +

+Constructor. +

+ +

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

+References _AutomaticLightDir, _AutomaticLighting, _DLMGlobalVegetableColor, _DLMMaxAttEnd, _DriverOkForVegetable, _FarInitialized, _FarTransition, _MergePriorityList, _NFreeLightMaps, _NoiseEnabled, _OldRefineCenter, _OldRefineCenterSetuped, _PatchDLMContextList, _PointLightDiffuseMaterial, _PZBModelPosition, _RefineMode, _RenderMustRefillVB, _SplitPriorityList, _TextureDLM, _Threshold, _TileCallback, _TileDistNear, _TileMaxSubdivision, _ULFarPixelsToUpdate, _ULFrequency, _ULNearCurrentTessBlockId, _ULNearPixelsToUpdate, _ULPrecTimeInit, _ULRootNearPatch, _ULRootTextureFar, _ULTotalFarPixels, _ULTotalNearPixels, _VegetableManager, _VegetableManagerEnabled, _VertexShaderOk, _VPThresholdChange, NL3D::CTessFacePriorityList::init(), initTileBank(), NL3D_LANDSCAPE_DLM_HEIGHT, NL3D_LANDSCAPE_DLM_WIDTH, NL3D_LANDSCAPE_VEGETABLE_MAX_AGP_VERTEX_LIGHTED, NL3D_LANDSCAPE_VEGETABLE_MAX_AGP_VERTEX_UNLIT, NL3D_REFINE_PLIST_DIST_MAX_MOD, NL3D_REFINE_PLIST_DIST_STEP, NL3D_REFINE_PLIST_NUM_ENTRIES, NL3D_REFINE_PLIST_SPLIT_NUMQUADRANT, NL3D_TESS_ALLOC_BLOCKSIZE, NL3D_TESSRDR_ALLOC_BLOCKSIZE, OwnerModel, NLMISC::CRGBA::set(), and setupStaticLight(). +

+

00178                        : 
+00179         TessFaceAllocator(NL3D_TESS_ALLOC_BLOCKSIZE), 
+00180         TessVertexAllocator(NL3D_TESS_ALLOC_BLOCKSIZE), 
+00181         TessNearVertexAllocator(NL3D_TESSRDR_ALLOC_BLOCKSIZE), 
+00182         TessFarVertexAllocator(NL3D_TESSRDR_ALLOC_BLOCKSIZE), 
+00183         TileMaterialAllocator(NL3D_TESSRDR_ALLOC_BLOCKSIZE), 
+00184         TileFaceAllocator(NL3D_TESSRDR_ALLOC_BLOCKSIZE),
+00185         _Far0VB(CLandscapeVBAllocator::Far0, "LandscapeFar0VB"),
+00186         _Far1VB(CLandscapeVBAllocator::Far1, "LandscapeFar1VB"),
+00187         _TileVB(CLandscapeVBAllocator::Tile, "LandscapeTileVB")
+00188 {
+00189         OwnerModel = NULL;
+00190 
+00191         initTileBank();
+00192 
+00193         // Far texture not initialized till initTileBanks is not called
+00194         _FarInitialized=false;
+00195         
+00196         // Init far lighting with White/black
+00197         setupStaticLight (CRGBA(255,255,255), CRGBA(0,0,0), 1.f);
+00198         // Default material for pointLights
+00199         _PointLightDiffuseMaterial= CRGBA::White;
+00200 
+00201         _FarTransition= 10;             // 10 meters.
+00202         _TileDistNear=100.f;
+00203         _Threshold= 0.001f;
+00204         _RefineMode=true;
+00205 
+00206         _TileMaxSubdivision= 0;
+00207 
+00208         _NFreeLightMaps= 0;
+00209 
+00210         // By default Automatic light comes from up.
+00211         _AutomaticLighting = false;
+00212         _AutomaticLightDir= -CVector::K;
+00213 
+00214         // By default, noise is enabled.
+00215         _NoiseEnabled= true;
+00216 
+00217         // By default, we compute Geomorph and Alpha in software.
+00218         _VertexShaderOk= false;
+00219         _VPThresholdChange= false;
+00220 
+00221         _RenderMustRefillVB= false;
+00222 
+00223         // priority list.
+00224         _OldRefineCenterSetuped= false;
+00225         _SplitPriorityList.init(NL3D_REFINE_PLIST_DIST_STEP, NL3D_REFINE_PLIST_NUM_ENTRIES, NL3D_REFINE_PLIST_DIST_MAX_MOD, NL3D_REFINE_PLIST_SPLIT_NUMQUADRANT);
+00226         // See updateRefine* Doc in tesselation.cpp for why the merge list do not need quadrants.
+00227         _MergePriorityList.init(NL3D_REFINE_PLIST_DIST_STEP, NL3D_REFINE_PLIST_NUM_ENTRIES, NL3D_REFINE_PLIST_DIST_MAX_MOD, 0);
+00228         // just for getTesselatedPos to work properly.
+00229         _OldRefineCenter= CVector::Null;
+00230 
+00231         // create / Init the vegetable manager.
+00232         _VegetableManager= new CVegetableManager(NL3D_LANDSCAPE_VEGETABLE_MAX_AGP_VERTEX_UNLIT, NL3D_LANDSCAPE_VEGETABLE_MAX_AGP_VERTEX_LIGHTED);
+00233 
+00234         // Init vegetable  setup.
+00235         _VegetableManagerEnabled= false;
+00236         _DriverOkForVegetable= false;
+00237         // default global vegetable color, used for dynamic lighting only (arbitrary).
+00238         _DLMGlobalVegetableColor.set(180, 180, 180);
+00239 
+00240         _PZBModelPosition= CVector::Null;
+00241 
+00242 
+00243         // Default: no updateLighting.
+00244         _ULFrequency= 0;
+00245         _ULPrecTimeInit= false;
+00246         // Default: no textureFar created.
+00247         _ULTotalFarPixels= 0;
+00248         _ULFarPixelsToUpdate= 0;
+00249         _ULRootTextureFar= NULL;
+00250         // Default: no patch created
+00251         _ULTotalNearPixels= 0;
+00252         _ULNearPixelsToUpdate= 0;
+00253         _ULRootNearPatch= NULL;
+00254         _ULNearCurrentTessBlockId= 0;
+00255 
+00256 
+00257         // Dynamic Lighting.
+00258         _TextureDLM= new CTextureDLM(NL3D_LANDSCAPE_DLM_WIDTH, NL3D_LANDSCAPE_DLM_HEIGHT);
+00259         _PatchDLMContextList= new CPatchDLMContextList;
+00260         _DLMMaxAttEnd= 30.f;
+00261 
+00262 
+00263         // Alloc some global space for tri rendering.
+00264         if( CLandscapeGlobals::PassTriArray.size() < 1000 )
+00265                 CLandscapeGlobals::PassTriArray.resize( 1000 );
+00266 
+00267         _TileCallback = NULL;
+00268 
+00269 }
+
+

+ + + + +
+ + + + + + + + + +
NL3D::CLandscape::~CLandscape  ) 
+
+ + + + + +
+   + + +

+Destructor. clear(). +

+ +

+Definition at line 271 of file landscape.cpp. +

+References _PatchDLMContextList, _TextureDLM, _VegetableManager, and clear(). +

+

00272 {
+00273         clear();
+00274 
+00275         // release the VegetableManager.
+00276         delete _VegetableManager;
+00277         _VegetableManager= NULL;
+00278 
+00279         // Dynamic Lighting.
+00280         // smartPtr delete
+00281         _TextureDLM= NULL;
+00282         delete _PatchDLMContextList;
+00283         _PatchDLMContextList= NULL;
+00284 }
+
+


Member Function Documentation

+

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
void NL3D::CLandscape::addPatchBlocksInBBox const CPatchIdentEx paIdEx,
const CAABBox bbox,
std::vector< CPatchBlockIdent > &  paBlockIds
[private]
+
+ + + + + +
+   + + +

+private version of buildPatchBlocksInBBox, searching only for one patch. +

+Definition at line 2327 of file landscape.cpp. +

+References NL3D::CPatch::addPatchBlocksInBBox(), NL3D::CLandscape::CPatchIdentEx::Patch, NL3D::CPatchIdent::PatchId, and NL3D::CPatchIdent::ZoneId. +

+Referenced by buildPatchBlocksInBBox(). +

+

02328 {
+02329         // No clear here, just add blocks to the array.
+02330         const CPatch    *pa= paIdEx.Patch;
+02331 
+02332         CPatchIdent             paId;
+02333         paId.ZoneId= paIdEx.ZoneId;
+02334         paId.PatchId= paIdEx.PatchId;
+02335         pa->addPatchBlocksInBBox(paId, bbox, paBlockIds);
+02336 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
void NL3D::CLandscape::addTrianglesInBBox const CPatchIdentEx paIdEx,
const CAABBox bbox,
std::vector< CTrianglePatch > &  triangles,
uint8  tileTessLevel
const [private]
+
+ + + + + +
+   + + +

+This method search only on the given patch. NB: this method use a convex hull subdivion to search in O(logn) what part of the patch to insert.

Parameters:
+ + + + +
bbox the bbox to test against.
triangles array to be filled (no clear performed, elements added).
tileTessLevel 0,1 or 2 size of the triangles (2*2m, 1*1m or 0.5*0.5m). Level of subdivision of a tile.
+
+ +

+Definition at line 2294 of file landscape.cpp. +

+References NL3D::CPatch::addTrianglesInBBox(), NL3D::CLandscape::CPatchIdentEx::Patch, NL3D::CPatchIdent::PatchId, uint8, and NL3D::CPatchIdent::ZoneId. +

+Referenced by buildTrianglesInBBox(). +

+

02295 {
+02296         // No clear here, just add triangles to the array.
+02297         const CPatch    *pa= paIdEx.Patch;
+02298 
+02299         CPatchIdent             paId;
+02300         paId.ZoneId= paIdEx.ZoneId;
+02301         paId.PatchId= paIdEx.PatchId;
+02302         pa->addTrianglesInBBox(paId, bbox, triangles, tileTessLevel);
+02303 }
+
+

+ + + + +
+ + + + + + + + + + +
bool NL3D::CLandscape::addZone const CZone newZone  ) 
+
+ + + + + +
+   + + +

+Add a zone which should be builded (or loaded), but not compiled. CLandscape compile it. The contents of newZone are copied into the landscape.

Parameters:
+ + +
newZone the new zone.
+
+
Returns:
true if OK, false otherwise. As example, Fail if newZone is already connected.
+ +

+Definition at line 385 of file landscape.cpp. +

+References _PatchQuadGrid, NL3D::CZone::_PointLightArray, NL3D::CZone::applyHeightField(), NL3D::CZone::build(), NL3D::CPatch::buildBBox(), NL3D::CZone::compile(), NLMISC::CAABBoxExt::getAABBox(), NLMISC::CAABBox::getHalfSize(), NLMISC::CAABBox::getMax(), NLMISC::CAABBox::getMin(), NL3D::CZone::getNumPatchs(), NL3D::CTransform::getOwnerScene(), NL3D::CZone::getZoneBB(), NL3D::CZone::getZoneId(), NLMISC::CAABBox::include(), NL3D::CPointLightNamedArray::initAnimatedLightIndex(), NL3D::CQuadGrid< CPatchIdentEx >::insert(), nlassert, OwnerModel, NL3D::CLandscape::CPatchIdentEx::Patch, NL3D::CPatchIdent::PatchId, NLMISC::CAABBox::setHalfSize(), NL3D::CPointLightNamedArray::setPointLightFactor(), sint, uint16, unlockBuffers(), updateGlobalsAndLockBuffers(), updateTessBlocksFaceVector(), NL3D::CPatchIdent::ZoneId, and Zones. +

+Referenced by NL3D::CLandscapeUser::loadAllZonesAround(), and NL3D::CLandscapeUser::refreshZonesAround(). +

+

00386 {
+00387         // -1. Update globals
+00388         updateGlobalsAndLockBuffers (CVector::Null);
+00389         // NB: adding a zone may add vertices in VB in visible patchs (because of binds)=> buffers are locked.
+00390 
+00391         uint16  zoneId= newZone.getZoneId();
+00392 
+00393         if(Zones.find(zoneId)!=Zones.end())
+00394         {
+00395                 unlockBuffers();
+00396                 return false;
+00397         }
+00398         CZone   *zone= new CZone;
+00399 
+00400         // copy zone.
+00401         zone->build(newZone);
+00402 
+00403         // Affect the current lighting of pointLight to the zone.
+00404         if (OwnerModel)
+00405         {
+00406                 CScene *scene = OwnerModel->getOwnerScene();
+00407                 zone->_PointLightArray.initAnimatedLightIndex(*scene);
+00408                 zone->_PointLightArray.setPointLightFactor(*scene);
+00409         }
+00410 
+00411         // apply the landscape heightField, modifying BBoxes.
+00412         zone->applyHeightField(*this);
+00413 
+00414         // compile the zone for this landscape.
+00415         zone->compile(this, Zones);
+00416 
+00417         // For test of _PatchQuadGrid erase.
+00418         CAABBox zoneBBForErase= zone->getZoneBB().getAABBox();
+00419         // Avoid precision problems by enlarging a little bbox size of zone for erase
+00420         zoneBBForErase.setHalfSize( zoneBBForErase.getHalfSize() * 1.1f);
+00421 
+00422         // add patchs of this zone to the quadgrid.
+00423         for(sint i= 0; i<zone->getNumPatchs(); i++)
+00424         {
+00425                 const CPatch *pa= ((const CZone*)zone)->getPatch(i);
+00426                 CPatchIdentEx   paId;
+00427                 paId.ZoneId= zoneId;
+00428                 paId.PatchId= i;
+00429                 paId.Patch= pa;
+00430                 CAABBox         bb= pa->buildBBox();
+00431                 _PatchQuadGrid.insert(bb.getMin(), bb.getMax(), paId);
+00432                 // NB: the bbox of zone is used to remove patch. Hence it is VERY important that zoneBBox includes
+00433                 // all patchs bbox (else some patchs entries may not be deleted in removeZone()).
+00434                 nlassert(zoneBBForErase.include(bb));
+00435         }
+00436 
+00437         // Must realase VB Buffers
+00438         unlockBuffers();
+00439 
+00440         // Because bind may add faces in other (visible) zones because of enforced split, we must check
+00441         // and update any FaceVector.
+00442         updateTessBlocksFaceVector();
+00443 
+00444         return true;
+00445 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
void NL3D::CLandscape::appendTileLightInfluences const CPatchIdent patchId,
const CUV uv,
std::vector< CPointLightInfluence > &  pointLightList
const
+
+ + + + + +
+   + + +

+Append lights under the position to pointLightList. Do nothing if invalid patchId. +

+ +

+Definition at line 3273 of file landscape.cpp. +

+References NL3D::CPatch::appendTileLightInfluences(), nlassert, NL3D::CPatchIdent::PatchId, sint, uint16, NL3D::CPatchIdent::ZoneId, and Zones. +

+

03275 {
+03276         // \todo yoyo: TODO_ZONEID: change ZoneId in 32 bits...
+03277         std::map<uint16, CZone*>::const_iterator        it= Zones.find((uint16)patchId.ZoneId);
+03278         if(it!=Zones.end())
+03279         {
+03280                 sint    N= (*it).second->getNumPatchs();
+03281                 // patch must exist in the zone.
+03282                 nlassert(patchId.PatchId<N);
+03283                 const CPatch    *pa= const_cast<const CZone*>((*it).second)->getPatch(patchId.PatchId);
+03284 
+03285                 pa->appendTileLightInfluences(uv, pointLightList);
+03286         }
+03287 }
+
+

+ + + + +
+ + + + + + + + + + +
void NL3D::CLandscape::appendToShadowPolyReceiver CTessFace face  )  [private]
+
+ + + + + +
+   + + +

+ +

+Definition at line 3658 of file landscape.cpp. +

+References _ShadowPolyReceiver, NL3D::CShadowPolyReceiver::addTriangle(), NL3D::CTessVertex::EndPos, NL3D::CTessFace::ShadowMapTriId, NLMISC::CTriangle::V0, NLMISC::CTriangle::V1, NLMISC::CTriangle::V2, NL3D::CTessFace::VBase, NL3D::CTessFace::VLeft, and NL3D::CTessFace::VRight. +

+Referenced by NL3D::CPatch::appendFaceToTileRenderList(). +

+

03659 {
+03660         CTriangle       tri;
+03661         tri.V0= face->VBase->EndPos;
+03662         tri.V1= face->VLeft->EndPos;
+03663         tri.V2= face->VRight->EndPos;
+03664         // Add and store id for remove
+03665         face->ShadowMapTriId= _ShadowPolyReceiver.addTriangle(tri);
+03666 }
+
+

+ + + + +
+ + + + + + + + + +
void NL3D::CLandscape::averageTesselationVertices  ) 
+
+ + + + + +
+   + + +

+This is especially for Pacs. Each Vertex->EndPos which is not a corner of a patch is set to the mean of its 2 shared Patchs. NB: Works with special cases of rectangular patchs and binded patchs. +

+Definition at line 772 of file landscape.cpp. +

+References _TessBlockModificationRoot, NL3D::CTessBlock::getNextToModify(), NL3D::ItZoneMap, nlassert, unlockBuffers(), updateGlobalsAndLockBuffers(), updateTessBlocksFaceVector(), and Zones. +

+

00773 {
+00774         // -1. Update globals
+00775         updateGlobalsAndLockBuffers (CVector::Null);
+00776         // NB: averageTesselationVertices may change vertices in VB in visible patchs => buffers are locked.
+00777 
+00778         // Increment the update date.
+00779         CLandscapeGlobals::CurrentDate++;
+00780 
+00781         for(ItZoneMap it= Zones.begin();it!=Zones.end();it++)
+00782         {
+00783                 (*it).second->averageTesselationVertices();
+00784         }
+00785 
+00786         // Must realase VB Buffers
+00787         unlockBuffers();
+00788 
+00789         // averageTesselationVertices() should not cause change in faces in any patchs.
+00790         // It should not happens, but check for security.
+00791         nlassert(_TessBlockModificationRoot.getNextToModify()==NULL);
+00792         updateTessBlocksFaceVector();
+00793 
+00794 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
void NL3D::CLandscape::buildCollideFaces sint  zoneId,
sint  patch,
std::vector< CTriangle > &  faces
+
+ + + + + +
+   + + +

+Build the set of faces of landscape, from a certain patch. Usefull for collisions. Triangles are built first in S then T order. There is two triangles by tiles. So the number of triangles for a patch is 2*OrderS*OrderT. +

+Definition at line 2456 of file landscape.cpp. +

+References NL3D::CPatch::computeVertex(), NL3D::CPatch::getOrderS(), NL3D::CPatch::getOrderT(), NL3D::ItZoneMap, nlassert, sint, NLMISC::CTriangle::V0, NLMISC::CTriangle::V1, NLMISC::CTriangle::V2, x, y, and Zones. +

+

02457 {
+02458         faces.clear();
+02459 
+02460         ItZoneMap it= Zones.find(zoneId);
+02461         if(it!=Zones.end())
+02462         {
+02463                 // Then trace all patch.
+02464                 sint    N= (*it).second->getNumPatchs();
+02465                 nlassert(patch>=0);
+02466                 nlassert(patch<N);
+02467                 const CPatch    *pa= const_cast<const CZone*>((*it).second)->getPatch(patch);
+02468 
+02469                 // Build the faces.
+02470                 //=================
+02471                 sint    ordS= pa->getOrderS();
+02472                 sint    ordT= pa->getOrderT();
+02473                 sint    x,y;
+02474                 float   OOS= 1.0f/ordS;
+02475                 float   OOT= 1.0f/ordT;
+02476                 for(y=0;y<ordT;y++)
+02477                 {
+02478                         for(x=0;x<ordS;x++)
+02479                         {
+02480                                 CTriangle       f;
+02481                                 f.V0= pa->computeVertex(x*OOS, y*OOT);
+02482                                 f.V1= pa->computeVertex(x*OOS, (y+1)*OOT);
+02483                                 f.V2= pa->computeVertex((x+1)*OOS, (y+1)*OOT);
+02484                                 faces.push_back(f);
+02485                                 f.V0= pa->computeVertex(x*OOS, y*OOT);
+02486                                 f.V1= pa->computeVertex((x+1)*OOS, (y+1)*OOT);
+02487                                 f.V2= pa->computeVertex((x+1)*OOS, y*OOT);
+02488                                 faces.push_back(f);
+02489                         }
+02490                 }
+02491         }
+02492 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
void NL3D::CLandscape::buildCollideFaces const CAABBoxExt bbox,
std::vector< CTriangle > &  faces,
bool  faceSplit
+
+ + + + + +
+   + + +

+Build the set of faces of landscape, which are IN a bbox. Usefull for collisions. The faces are builded at Tile level (2m*2m).

Parameters:
+ + + + +
bbox the bbox where faces are searched.
faces the result of the build.
faceSplit if true, Only faces which are IN or partialy IN the bbox are returned. Else the clipping is done on patch level. Worst, but faster.
+
+ +

+Definition at line 2380 of file landscape.cpp. +

+References NL3D::CPatch::computeVertex(), NLMISC::CAABBoxExt::getCenter(), NL3D::CPatch::getOrderS(), NL3D::CPatch::getOrderT(), NLMISC::CAABBoxExt::getRadius(), NLMISC::CAABBoxExt::intersect(), NLMISC::CBSphere::intersect(), NL3D::ItZoneMap, sint, NLMISC::CTriangle::V0, NLMISC::CTriangle::V1, NLMISC::CTriangle::V2, x, y, and Zones. +

+

02381 {
+02382         CBSphere        bsWanted(bbox.getCenter(), bbox.getRadius());
+02383 
+02384         faces.clear();
+02385         // For all zones.
+02386         for(ItZoneMap it= Zones.begin();it!=Zones.end();it++)
+02387         {
+02388                 const CAABBoxExt        &bb= (*it).second->getZoneBB();
+02389                 CBSphere        bs(bb.getCenter(), bb.getRadius());
+02390                 // If zone intersect the wanted area.
+02391                 //===================================
+02392                 if(bs.intersect(bsWanted))
+02393                 {
+02394                         // Then trace all patch.
+02395                         sint    N= (*it).second->getNumPatchs();
+02396                         for(sint i=0;i<N;i++)
+02397                         {
+02398                                 const CPatch    *pa= const_cast<const CZone*>((*it).second)->getPatch(i);
+02399 
+02400                                 // If patch in wanted area....
+02401                                 //============================
+02402                                 if(bsWanted.intersect((*it).second->getPatchBSphere(i)))
+02403                                 {
+02404                                         // 0. Build the faces.
+02405                                         //====================
+02406                                         sint    ordS= pa->getOrderS();
+02407                                         sint    ordT= pa->getOrderT();
+02408                                         sint    x,y,j;
+02409                                         vector<CTriangle>       tmpFaces;
+02410                                         tmpFaces.reserve(ordS*ordT);
+02411                                         float   OOS= 1.0f/ordS;
+02412                                         float   OOT= 1.0f/ordT;
+02413                                         for(y=0;y<ordT;y++)
+02414                                         {
+02415                                                 for(x=0;x<ordS;x++)
+02416                                                 {
+02417                                                         CTriangle       f;
+02418                                                         f.V0= pa->computeVertex(x*OOS, y*OOT);
+02419                                                         f.V1= pa->computeVertex(x*OOS, (y+1)*OOT);
+02420                                                         f.V2= pa->computeVertex((x+1)*OOS, (y+1)*OOT);
+02421                                                         tmpFaces.push_back(f);
+02422                                                         f.V0= pa->computeVertex(x*OOS, y*OOT);
+02423                                                         f.V1= pa->computeVertex((x+1)*OOS, (y+1)*OOT);
+02424                                                         f.V2= pa->computeVertex((x+1)*OOS, y*OOT);
+02425                                                         tmpFaces.push_back(f);
+02426                                                 }
+02427                                         }
+02428 
+02429                                         // 1. Clip the faces.
+02430                                         //===================
+02431                                         if(faceClip)
+02432                                         {
+02433                                                 // Insert only faces which are In the area.
+02434                                                 for(j=0;j<(sint)tmpFaces.size();j++)
+02435                                                 {
+02436                                                         CTriangle       &f= tmpFaces[j];
+02437                                                         if(bbox.intersect(f.V0, f.V1, f.V2))
+02438                                                         {
+02439                                                                 faces.push_back(f);
+02440                                                         }
+02441                                                 }
+02442                                         }
+02443                                         else
+02444                                         {
+02445                                                 // Else insert ALL.
+02446                                                 faces.insert(faces.end(), tmpFaces.begin(), tmpFaces.end());
+02447                                         }
+02448                                 }
+02449                         }
+02450                 }
+02451         }
+02452 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
void NL3D::CLandscape::buildPatchBlocksInBBox const CAABBox bbox,
std::vector< CPatchBlockIdent > &  paBlockIds
+
+ + + + + +
+   + + +

+Same as buildTrianglesInBBox(), but fill blockId instead of raw triangles. NB: this method use first a quadgrid to locate patchs of interest, then for each patch, it uses a convex hull subdivion to search in O(logn) what part of the patch to insert.

Parameters:
+ + + +
bbox the bbox to test against. NB: you should modify your bbox according to heighfield.
paBlockIds array to be filled (no clear performed, elements added).
+
+ +

+Definition at line 2340 of file landscape.cpp. +

+References _PatchQuadGrid, addPatchBlocksInBBox(), NL3D::CQuadGrid< CPatchIdentEx >::begin(), NL3D::CQuadGrid< CPatchIdentEx >::clearSelection(), NL3D::CQuadGrid< CPatchIdentEx >::end(), NLMISC::CAABBox::getMax(), NLMISC::CAABBox::getMin(), and NL3D::CQuadGrid< CPatchIdentEx >::select(). +

+

02341 {
+02342         // clear selection.
+02343         paBlockIds.clear();
+02344 
+02345         // search path of interest.
+02346         _PatchQuadGrid.clearSelection();
+02347         _PatchQuadGrid.select(bbox.getMin(), bbox.getMax());
+02348         CQuadGrid<CPatchIdentEx>::CIterator     it;
+02349 
+02350         // for each patch, add blocks to the array.
+02351         for(it= _PatchQuadGrid.begin(); it!= _PatchQuadGrid.end(); it++)
+02352         {
+02353                 addPatchBlocksInBBox((*it), bbox, paBlockIds);
+02354         }
+02355 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
void NL3D::CLandscape::buildTrianglesInBBox const CAABBox bbox,
std::vector< CTrianglePatch > &  triangles,
uint8  tileTessLevel
+
+ + + + + +
+   + + +

+method relatively identical than buildCollideFaces(bbox....). Differences below: NB: this method use first a quadgrid to locate patchs of interest, then for each patch, it uses a convex hull subdivion to search in O(logn) what part of the patch to insert.

Parameters:
+ + + + +
bbox the bbox to test against. NB: you should modify your bbox according to heighfield.
triangles array to be filled (array first cleared, then elements added).
tileTessLevel 0,1 or 2 size of the triangles (2*2m, 1*1m or 0.5*0.5m). Level of subdivision of a tile.
+
+ +

+Definition at line 2307 of file landscape.cpp. +

+References _PatchQuadGrid, addTrianglesInBBox(), NL3D::CQuadGrid< CPatchIdentEx >::begin(), NL3D::CQuadGrid< CPatchIdentEx >::clearSelection(), NL3D::CQuadGrid< CPatchIdentEx >::end(), NLMISC::CAABBox::getMax(), NLMISC::CAABBox::getMin(), NL3D::CQuadGrid< CPatchIdentEx >::select(), and uint8. +

+

02308 {
+02309         // clear selection.
+02310         triangles.clear();
+02311 
+02312         // search path of interest.
+02313         _PatchQuadGrid.clearSelection();
+02314         _PatchQuadGrid.select(bbox.getMin(), bbox.getMax());
+02315         CQuadGrid<CPatchIdentEx>::CIterator     it;
+02316 
+02317         // for each patch, add triangles to the array.
+02318         for(it= _PatchQuadGrid.begin(); it!= _PatchQuadGrid.end(); it++)
+02319         {
+02320                 addTrianglesInBBox((*it), bbox, triangles, tileTessLevel);
+02321         }
+02322 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
void NL3D::CLandscape::buildZoneName sint  zoneId,
std::string &  zoneName
[static]
+
+ + + + + +
+   + + +

+From an Id, return the name of the zone, in the form "150_EM", without extension. +

+ +

+Definition at line 513 of file landscape.cpp. +

+References sint, x, and y. +

+

00514 {
+00515         char    tmp[256];
+00516         sint    x= zoneId & 255;
+00517         sint    y= zoneId >> 8;
+00518         sprintf(tmp, "%d_%c%c", y+1, (char)('A'+(x/26)), (char)('A'+(x%26)));
+00519         zoneName= tmp;
+00520 }
+
+

+ + + + +
+ + + + + + + + + + +
void NL3D::CLandscape::checkBinds uint16  zoneId  )  throw (EBadBind)
+
+ + + + + +
+   + + +

+Verify the binding of patchs of one zone. throw EBadBind if error. nop if zone not loaded. +

+ +

+Definition at line 2277 of file landscape.cpp. +

+References NL3D::EBadBind::BindErrors, NL3D::ItZoneMap, and uint16. +

+

02278 {
+02279         EBadBind        bindError;
+02280 
+02281         ItZoneMap it= Zones.find(zoneId);
+02282         if(it!= Zones.end())
+02283         {
+02284                 CZone   &curZone= *(*it).second;
+02285                 checkZoneBinds(curZone, bindError);
+02286                 if(!bindError.BindErrors.empty())
+02287                         throw bindError;
+02288         }
+02289 }
+
+

+ + + + +
+ + + + + + + + + +
void NL3D::CLandscape::checkBinds  )  throw (EBadBind)
+
+ + + + + +
+   + + +

+Verify the binding of patchs of all zones. throw EBadBind if error. +

+ +

+Definition at line 2261 of file landscape.cpp. +

+References NL3D::EBadBind::BindErrors, and NL3D::ItZoneMap. +

+Referenced by NL3D::CLandscapeUser::loadAllZonesAround(), and NL3D::CLandscapeUser::refreshZonesAround(). +

+

02262 {
+02263         EBadBind        bindError;
+02264 
+02265         for(ItZoneMap it= Zones.begin();it!=Zones.end();it++)
+02266         {
+02267                 CZone   &curZone= *(*it).second;
+02268                 checkZoneBinds(curZone, bindError);
+02269         }
+02270 
+02271         if(!bindError.BindErrors.empty())
+02272                 throw bindError;
+02273 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
void NL3D::CLandscape::checkZoneBinds CZone curZone,
EBadBind bindError
[private]
+
+ + + + + +
+   + + +

+ +

+Definition at line 2232 of file landscape.cpp. +

+References NL3D::CZone::CPatchConnect::BindEdges, NL3D::EBadBind::BindErrors, NL3D::CPatchInfo::CBindInfo::Edge, NL3D::CZone::getNumPatchs(), NL3D::CZone::getPatchConnect(), getZone(), NL3D::CZone::getZoneId(), NL3D::CPatchInfo::CBindInfo::Next, NL3D::CPatchInfo::CBindInfo::NPatchs, sint, and NL3D::CPatchInfo::CBindInfo::ZoneId. +

+

02233 {
+02234         for(sint i=0;i<curZone.getNumPatchs();i++)
+02235         {
+02236                 const CZone::CPatchConnect      &pa= *curZone.getPatchConnect(i);
+02237 
+02238                 // Check the bindInfos.
+02239                 for(sint j=0;j<4;j++)
+02240                 {
+02241                         const CPatchInfo::CBindInfo     &bd=pa.BindEdges[j];
+02242                         // Just 1/1 for now.
+02243                         if(bd.NPatchs==1)
+02244                         {
+02245                                 CZone   *oZone= getZone(bd.ZoneId);
+02246                                 // If loaded zone.
+02247                                 if(oZone)
+02248                                 {
+02249                                         const CZone::CPatchConnect      &po= *(oZone->getPatchConnect(bd.Next[0]));
+02250                                         const CPatchInfo::CBindInfo     &bo= po.BindEdges[bd.Edge[0]];
+02251                                         if(bo.NPatchs!=1 || bo.Next[0]!=i || bo.Edge[0]!=j)
+02252                                                 bindError.BindErrors.push_back( EBadBind::CBindError(curZone.getZoneId(), i));
+02253                                 }
+02254                         }
+02255                 }
+02256         }
+02257 }
+
+

+ + + + +
+ + + + + + + + + +
void NL3D::CLandscape::clear  ) 
+
+ + + + + +
+   + + +

+Disconnect, and Delete all zones. +

+ +

+Definition at line 522 of file landscape.cpp. +

+References _Far0VB, _Far1VB, _PatchQuadGrid, _TextureFars, _TileVB, NL3D::CLandscapeVBAllocator::clear(), NL3D::CQuadGrid< CPatchIdentEx >::clear(), clearFarRenderPass(), getZoneList(), ItSPRenderPassVector, nlverify, removeZone(), and sint. +

+Referenced by NL3D::CLandscapeUser::removeAllZones(), and ~CLandscape(). +

+

00523 {
+00524         // Build the list of zoneId.
+00525         vector<uint16>  zoneIds;
+00526         getZoneList(zoneIds);
+00527 
+00528         // Remove each zone one by one.
+00529         sint i;
+00530         for(i=0;i<(sint)zoneIds.size();i++)
+00531         {
+00532                 nlverify(removeZone(zoneIds[i]));
+00533         }
+00534 
+00535         // ensure the quadgrid is empty.
+00536         _PatchQuadGrid.clear();
+00537 
+00538 
+00539         // If not done, delete all VBhards allocated.
+00540         _Far0VB.clear();
+00541         _Far1VB.clear();
+00542         _TileVB.clear();
+00543 
+00544 
+00545         // Reset All Far Texture and unlink _ULRootTextureFar ciruclarList.
+00546         ItSPRenderPassVector    itFar= _TextureFars.begin();
+00547         // unitl set is empty
+00548         while( itFar != _TextureFars.end() )
+00549         {
+00550                 // erase with link update.
+00551                 clearFarRenderPass(*itFar);
+00552                 itFar++;
+00553         }
+00554         // delete all
+00555         _TextureFars.clear();
+00556 
+00557 
+00558         // reset driver.
+00559         _Driver= NULL;
+00560 }
+
+

+ + + + +
+ + + + + + + + + + +
void NL3D::CLandscape::clearFarRenderPass CPatchRdrPass pass  )  [private]
+
+ + + + + +
+   + + +

+ +

+Definition at line 2176 of file landscape.cpp. +

+References _ULRootTextureFar, NL3D::CTextureFar::getNextUL(), NL3D::CPatchRdrPass::TextureDiffuse, and NL3D::CTextureFar::unlinkUL(). +

+Referenced by clear(). +

+

02177 {
+02178         // Before deleting, must remove TextureFar from UpdateLighting list.
+02179 
+02180         // Get a pointer on the diffuse far texture
+02181         CTextureFar *pTextureFar=(CTextureFar*)(&*(pass->TextureDiffuse));
+02182 
+02183         // If I delete the textureFar which is the current root
+02184         if(_ULRootTextureFar==pTextureFar)
+02185         {
+02186                 // switch to next
+02187                 _ULRootTextureFar= pTextureFar->getNextUL();
+02188                 // if still the same, it means that the circular list is now empty
+02189                 if(_ULRootTextureFar==pTextureFar)
+02190                         _ULRootTextureFar= NULL;
+02191         }
+02192 
+02193         // unlink the texture from list
+02194         pTextureFar->unlinkUL();
+02195 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
void NL3D::CLandscape::clip const CVector refineCenter,
const std::vector< CPlane > &  pyramid
+
+ + + + + +
+   + + +

+Clip the landscape according to frustum. Planes must be normalized. +

+Definition at line 583 of file landscape.cpp. +

+References _TessBlockModificationRoot, NL3D::CTessBlock::getNextToModify(), NL3D::ItZoneMap, nlassert, unlockBuffers(), updateGlobalsAndLockBuffers(), updateTessBlocksFaceVector(), and Zones. +

+Referenced by NL3D::CLandscapeModel::clipAndRenderLandscape(). +

+

00584 {
+00585         // -1. Update globals
+00586         updateGlobalsAndLockBuffers (refineCenter);
+00587         // NB: clip may add/remove vertices in VB in visible patchs => buffers are locked.
+00588 
+00589 
+00590         for(ItZoneMap it= Zones.begin();it!=Zones.end();it++)
+00591         {
+00592                 (*it).second->clip(pyramid);
+00593         }
+00594 
+00595         // Must realase VB Buffers
+00596         unlockBuffers();
+00597 
+00598         // clip() should not cause change in faces in visible patchs.
+00599         // It should not happens, but check for security.
+00600         nlassert(_TessBlockModificationRoot.getNextToModify()==NULL);
+00601         updateTessBlocksFaceVector();
+00602 
+00603 }
+
+

+ + + + +
+ + + + + + + + + + +
void NL3D::CLandscape::computeDynamicLighting const std::vector< CPointLight * > &  pls  ) 
+
+ + + + + +
+   + + +

+Compute dynamic lightmaps

Parameters:
+ + +
pls list of pointLigths to influence landscape
+
+ +

+Definition at line 3489 of file landscape.cpp. +

+References _DLMMaxAttEnd, _PatchDLMContextList, _PatchQuadGrid, _PointLightDiffuseMaterial, NL3D::CPatchDLMPointLight::BBox, NL3D::CQuadGrid< CPatchIdentEx >::begin(), NL3D::CTessList< CPatchDLMContext >::begin(), NL3D::CPatch::beginDLMLighting(), NL3D::CPatchDLMPointLight::BSphere, NL3D::CQuadGrid< CPatchIdentEx >::clearSelection(), NL3D::CQuadGrid< CPatchIdentEx >::end(), NL3D::CPatch::endDLMLighting(), NLMISC::CAABBox::getMax(), NLMISC::CAABBox::getMin(), NL3D::CPatchDLMContext::getPatch(), NL3D::CZone::getPatchBSphere(), NL3D::CPatch::getPatchId(), NL3D::CPatch::getZone(), NLMISC::CBSphere::intersect(), NL3D::CTessNodeList::Next, NL3D::CQuadGrid< CPatchIdentEx >::select(), uint, unlockBuffers(), and updateGlobalsAndLockBuffers(). +

+Referenced by NL3D::CLandscapeModel::clipAndRenderLandscape(). +

+

03490 {
+03491         uint    i;
+03492 
+03493         // Update globals, and lock buffers
+03494         //====================
+03495         updateGlobalsAndLockBuffers (CVector::Null);
+03496         // NB: averageTesselationVertices may change vertices in VB in visible patchs => buffers are locked.
+03497 
+03498 
+03499         // Run all DLM Context create, to init Lighting process.
+03500         //===============
+03501         CPatchDLMContext        *ctxPtr= _PatchDLMContextList->begin();
+03502         while(ctxPtr!=NULL)
+03503         {
+03504                 // init lighting process, do differential from last computeDynamicLighting()
+03505                 ctxPtr->getPatch()->beginDLMLighting();
+03506 
+03507                 // next
+03508                 ctxPtr= (CPatchDLMContext*)ctxPtr->Next;
+03509         }
+03510 
+03511 
+03512         // compile all pointLights
+03513         //===============
+03514         static vector<CPatchDLMPointLight>      dlmPls;
+03515         dlmPls.resize(pls.size());
+03516         for(i=0;i<dlmPls.size();i++)
+03517         {
+03518                 // compile the pl.
+03519                 dlmPls[i].compile(*pls[i], _PointLightDiffuseMaterial, _DLMMaxAttEnd);
+03520         }
+03521 
+03522 
+03523         // For all pointLight, intersect patch.
+03524         //===============
+03525         for(i=0;i<dlmPls.size();i++)
+03526         {
+03527                 CPatchDLMPointLight     &pl= dlmPls[i];
+03528 
+03529                 // search patchs of interest: those which interssect the pointLight
+03530                 _PatchQuadGrid.clearSelection();
+03531                 _PatchQuadGrid.select(pl.BBox.getMin(), pl.BBox.getMax());
+03532                 CQuadGrid<CPatchIdentEx>::CIterator     it;
+03533 
+03534                 // for each patch, light it with the light.
+03535                 for(it= _PatchQuadGrid.begin(); it!= _PatchQuadGrid.end(); it++)
+03536                 {
+03537                         // get the patch
+03538                         const CPatch    *pa= (*it).Patch;
+03539 
+03540                         // More precise clipping: 
+03541                         if( pa->getZone()->getPatchBSphere(pa->getPatchId()).intersect( pl.BSphere ) )
+03542                         {
+03543                                 // Ok, light the patch with this spotLight
+03544                                 const_cast<CPatch*>(pa)->processDLMLight(pl);
+03545                         }
+03546                 }
+03547 
+03548         }
+03549 
+03550 
+03551         // Run all DLM Context create, to end Lighting process.
+03552         //===============
+03553         ctxPtr= _PatchDLMContextList->begin();
+03554         while(ctxPtr!=NULL)
+03555         {
+03556                 // get enxt now, because the DLM itself may be deleted in endDLMLighting()
+03557                 CPatchDLMContext        *next= (CPatchDLMContext*)ctxPtr->Next;
+03558 
+03559                 // delete the DLM if no more needed (near don't use nor pointLights)
+03560                 ctxPtr->getPatch()->endDLMLighting();
+03561 
+03562                 // next
+03563                 ctxPtr= next;
+03564         }
+03565 
+03566 
+03567         // Must realase VB Buffers
+03568         //====================
+03569         unlockBuffers();
+03570 
+03571 }
+
+

+ + + + +
+ + + + + + + + + + +
void NL3D::CLandscape::createVegetableBlendLayersModels CScene scene  ) 
+
+ + + + + +
+   + + +

+init the vegetable layer models in the CScene (see CVegetableManager). NB: MOT stuff (called by CLandscapeModel), don't use it. +

+Definition at line 3225 of file landscape.cpp. +

+References _VegetableManager, and NL3D::CVegetableManager::createVegetableBlendLayersModels(). +

+Referenced by NL3D::CLandscapeModel::initModel(). +

+

03226 {
+03227         _VegetableManager->createVegetableBlendLayersModels(scene);
+03228 }
+
+

+ + + + +
+ + + + + + + + + + +
void NL3D::CLandscape::deleteTessFace CTessFace f  )  [private]
+
+ + + + + +
+   + + +

+ +

+Definition at line 3052 of file landscape.cpp. +

+References NLMISC::CBlockMemory< CTessFace >::free(), TessFaceAllocator, and NL3D::CTessFacePListNode::unlinkInPList(). +

+Referenced by NL3D::CTessFace::doMerge(), and NL3D::CPatch::release(). +

+

03053 {
+03054         // for refine() mgt, must remove from refine priority list, or from the temp rootTessFaceToUpdate list.
+03055         f->unlinkInPList();
+03056 
+03057         TessFaceAllocator.free(f);
+03058 }
+
+

+ + + + +
+ + + + + + + + + + +
void NL3D::CLandscape::deleteTessFarVertex CTessFarVertex v  )  [private]
+
+ + + + + +
+   + + +

+ +

+Definition at line 3073 of file landscape.cpp. +

+References NLMISC::CBlockMemory< CTessFarVertex >::free(), TessFarVertexAllocator, and v. +

+Referenced by NL3D::CTessFace::doMerge(). +

+

03074 {
+03075         TessFarVertexAllocator.free(v);
+03076 }
+
+

+ + + + +
+ + + + + + + + + + +
void NL3D::CLandscape::deleteTessNearVertex CTessNearVertex v  )  [private]
+
+ + + + + +
+   + + +

+ +

+Definition at line 3067 of file landscape.cpp. +

+References NLMISC::CBlockMemory< CTessNearVertex >::free(), TessNearVertexAllocator, and v. +

+Referenced by NL3D::CTessFace::deleteTileUv(). +

+

03068 {
+03069         TessNearVertexAllocator.free(v);
+03070 }
+
+

+ + + + +
+ + + + + + + + + + +
void NL3D::CLandscape::deleteTessVertex CTessVertex v  )  [private]
+
+ + + + + +
+   + + +

+ +

+Definition at line 3061 of file landscape.cpp. +

+References NLMISC::CBlockMemory< CTessVertex >::free(), TessVertexAllocator, and v. +

+Referenced by NL3D::CTessFace::doMerge(), and NL3D::CTessFace::updateBindAndSplit(). +

+

03062 {
+03063         TessVertexAllocator.free(v);
+03064 }
+
+

+ + + + +
+ + + + + + + + + + +
void NL3D::CLandscape::deleteTileFace CTileFace tf  )  [private]
+
+ + + + + +
+   + + +

+ +

+Definition at line 3085 of file landscape.cpp. +

+References NLMISC::CBlockMemory< CTileFace >::free(), and TileFaceAllocator. +

+Referenced by NL3D::CTessFace::deleteTileFaces(). +

+

03086 {
+03087         TileFaceAllocator.free(tf);
+03088 }
+
+

+ + + + +
+ + + + + + + + + + +
void NL3D::CLandscape::deleteTileMaterial CTileMaterial tm  )  [private]
+
+ + + + + +
+   + + +

+ +

+Definition at line 3079 of file landscape.cpp. +

+References NLMISC::CBlockMemory< CTileMaterial >::free(), and TileMaterialAllocator. +

+Referenced by NL3D::CTessFace::releaseTileMaterial(). +

+

03080 {
+03081         TileMaterialAllocator.free(tm);
+03082 }
+
+

+ + + + +
+ + + + + + + + + + +
void NL3D::CLandscape::enableAutomaticLighting bool  enable  ) 
+
+ + + + + +
+   + + +

+Enable automatic near lightmap computing. use setupStaticLight(). Default is disabled. NB: calling this method won't flush all texture near already computed. +

+Definition at line 2684 of file landscape.cpp. +

+References _AutomaticLighting. +

+

02685 {
+02686         _AutomaticLighting= enable;
+02687 }
+
+

+ + + + +
+ + + + + + + + + + +
void NL3D::CLandscape::enableVegetable bool  enable  ) 
+
+ + + + + +
+   + + +

+enable the vegetable management in landscape. Valid only if VertexShader is OK. if true, register TileBank vegetables Shape to manager. +

+Definition at line 3120 of file landscape.cpp. +

+References _VegetableManager, _VegetableManagerEnabled, NL3D::CPatch::deleteAllVegetableIgs(), NL3D::CTileBank::initTileVegetableDescs(), NL3D::ItZoneMap, NL3D::CPatch::recreateAllVegetableIgs(), sint, TileBank, and Zones. +

+Referenced by NL3D::CLandscapeUser::enableVegetable(). +

+

03121 {
+03122         _VegetableManagerEnabled= enable;
+03123 
+03124         // if false, delete all Vegetable IGs.
+03125         if(!_VegetableManagerEnabled)
+03126         {
+03127                 // Landscape always create ClipBlokcs, but IGs/addInstances() are created only if isVegetableActive().
+03128                 // For all zones.
+03129                 for(ItZoneMap it= Zones.begin();it!=Zones.end();it++)
+03130                 {
+03131                         // for all patch.
+03132                         sint    N= (*it).second->getNumPatchs();
+03133                         for(sint i=0;i<N;i++)
+03134                         {
+03135                                 // delete vegetable Igs of this patch
+03136                                 CPatch  *pa= ((*it).second)->getPatch(i);
+03137                                 pa->deleteAllVegetableIgs();
+03138                         }
+03139 
+03140                 }
+03141         }
+03142         // if true
+03143         else
+03144         {
+03145                 //  reload all Shapes (actually load only new shapes)
+03146                 TileBank.initTileVegetableDescs(_VegetableManager);
+03147 
+03148                 // And recreate vegetable igs.
+03149                 // Landscape always create ClipBlokcs, but IGs/addInstances() are created only if isVegetableActive().
+03150                 // For all zones.
+03151                 for(ItZoneMap it= Zones.begin();it!=Zones.end();it++)
+03152                 {
+03153                         // for all patch.
+03154                         sint    N= (*it).second->getNumPatchs();
+03155                         for(sint i=0;i<N;i++)
+03156                         {
+03157                                 // recreate vegetable Igs of this patch
+03158                                 CPatch  *pa= ((*it).second)->getPatch(i);
+03159                                 pa->recreateAllVegetableIgs();
+03160                         }
+03161 
+03162                 }
+03163         }
+03164 
+03165 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
bool NL3D::CLandscape::eraseTileFarIfNotGood uint  tileNumber,
uint  sizeOrder0,
uint  sizeOrder1,
uint  sizeOrder2
[private]
+
+ + + + + +
+   + + +

+ +

+Definition at line 2552 of file landscape.cpp. +

+References NL3D::CTileFarBank::getTile(), TileFarBank, and uint. +

+Referenced by initTileBanks(). +

+

02553 {
+02554         // The same tiles ?
+02555         bool bSame=true;
+02556 
+02557         // It is the same tile ?
+02558         if (TileFarBank.getTile (tileNumber)->isFill (CTileFarBank::diffuse))
+02559         {
+02560                 // Good diffuse size ?
+02561                 if (
+02562                         (TileFarBank.getTile (tileNumber)->getSize (CTileFarBank::diffuse, CTileFarBank::order0) != sizeOrder0) ||
+02563                         (TileFarBank.getTile (tileNumber)->getSize (CTileFarBank::diffuse, CTileFarBank::order1) != sizeOrder1) ||
+02564                         (TileFarBank.getTile (tileNumber)->getSize (CTileFarBank::diffuse, CTileFarBank::order2) != sizeOrder2)
+02565                         )
+02566                 {
+02567                         TileFarBank.getTile (tileNumber)->erasePixels (CTileFarBank::diffuse);
+02568                         bSame=false;
+02569                 }
+02570         }
+02571 
+02572         // It is the same tile ?
+02573         if (TileFarBank.getTile (tileNumber)->isFill (CTileFarBank::additive))
+02574         {
+02575                 // Good additive size ?
+02576                 if (
+02577                         (TileFarBank.getTile (tileNumber)->getSize (CTileFarBank::additive, CTileFarBank::order0) != sizeOrder0) ||
+02578                         (TileFarBank.getTile (tileNumber)->getSize (CTileFarBank::additive, CTileFarBank::order1) != sizeOrder1) ||
+02579                         (TileFarBank.getTile (tileNumber)->getSize (CTileFarBank::additive, CTileFarBank::order2) != sizeOrder2)
+02580                         )
+02581                 {
+02582                         TileFarBank.getTile (tileNumber)->erasePixels (CTileFarBank::additive);
+02583                         bSame=false;
+02584                 }
+02585         }
+02586 
+02587         // Return true if the tiles seem to be the sames
+02588         return bSame;
+02589 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
void NL3D::CLandscape::excludePatchFromRefineAll sint  zoneId,
uint  patch,
bool  exclude
+
+ + + + + +
+   + + +

+This is especially for Pacs. exlude a patch to be refineAll()ed. +

+ +

+Definition at line 760 of file landscape.cpp. +

+References NL3D::ItZoneMap, sint, uint, and Zones. +

+Referenced by NL3D::CZoneLighter::buildZoneInformation(), NL3D::CZoneLighter::excludeAllPatchFromRefineAll(), and NL3D::CInstanceLighter::excludeAllPatchFromRefineAll(). +

+

00761 {
+00762         ItZoneMap it= Zones.find(zoneId);
+00763         if(it!=Zones.end())
+00764         {
+00765                 it->second->excludePatchFromRefineAll(patch, exclude);
+00766         }
+00767 
+00768 }
+
+

+ + + + +
+ + + + + + + + + + +
void NL3D::CLandscape::fillPatchQuadBlock CPatchQuadBlock quadBlock  )  const
+
+ + + + + +
+   + + +

+Fill a CPatchQuadBlock, from its required PatchId. nlassert(PatchId size is less than NL_PATCH_BLOCK_MAX_QUAD) +

+Definition at line 2359 of file landscape.cpp. +

+References NL3D::CPatch::fillPatchQuadBlock(), nlassert, NL3D::CPatchQuadBlock::PatchBlockId, NL3D::CPatchIdent::PatchId, NL3D::CPatchBlockIdent::PatchId, sint, NL3D::CPatchIdent::ZoneId, and Zones. +

+

02360 {
+02361         sint zoneId=  quadBlock.PatchBlockId.PatchId.ZoneId;
+02362         sint patchId= quadBlock.PatchBlockId.PatchId.PatchId;
+02363         std::map<uint16, CZone*>::const_iterator        it= Zones.find(zoneId);
+02364         if(it!=Zones.end())
+02365         {
+02366                 sint    N= (*it).second->getNumPatchs();
+02367                 // patch must exist in the zone.
+02368                 nlassert(patchId>=0);
+02369                 nlassert(patchId<N);
+02370 
+02371                 const CPatch    *pa= const_cast<const CZone*>((*it).second)->getPatch(patchId);
+02372                 pa->fillPatchQuadBlock(quadBlock);
+02373         }
+02374 }
+
+

+ + + + +
+ + + + + + + + + + +
CPatchRdrPass * NL3D::CLandscape::findTileRdrPass const CPatchRdrPass pass  )  [private]
+
+ + + + + +
+   + + +

+ +

+Definition at line 1659 of file landscape.cpp. +

+References ItTileRdrPassSet, and TileRdrPassSet. +

+Referenced by loadTile(). +

+

01660 {
+01661         ItTileRdrPassSet        it;
+01662         // If already here, find it, else insert.
+01663         it= (TileRdrPassSet.insert(pass)).first;
+01664 
+01665         return const_cast<CPatchRdrPass*>(&(*it));
+01666 }
+
+

+ + + + +
+ + + + + + + + + + +
ITexture * NL3D::CLandscape::findTileTexture const std::string &  textName  )  [private]
+
+ + + + + +
+   + + +

+ +

+Definition at line 1639 of file landscape.cpp. +

+References TileTextureMap. +

+Referenced by loadTile(). +

+

01640 {
+01641         ITexture        *text;
+01642         text= TileTextureMap[textName];
+01643         // If just inserted, RefPtr is NULL!!  :)
+01644         // This test too if the RefPtr is NULL... (tile released)
+01645         // The object is not owned by this map. It will be own by the multiple RdrPass via CSmartPtr.
+01646         // They will destroy it when no more points to them.
+01647         if(!text)
+01648         {
+01649                 TileTextureMap[textName]= text= new CTextureFile(textName);
+01650                 text->setWrapS(ITexture::Clamp);
+01651                 text->setWrapT(ITexture::Clamp);
+01652                 text->setUploadFormat(ITexture::DXTC5);
+01653         }
+01654         return text;
+01655 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
void NL3D::CLandscape::flushTiles IDriver drv,
uint16  tileStart,
uint16  nbTiles
+
+ + + + + +
+   + + +

+Force a range of tiles to be loaded in the driver... +

+ +

+Definition at line 1884 of file landscape.cpp. +

+References ItTileRdrPassSet, loadTile(), NL3D::IDriver::setupTexture(), sint, NL3D::CPatchRdrPass::TextureAlpha, NL3D::CPatchRdrPass::TextureDiffuse, TileInfos, TileRdrPassSet, and uint16. +

+Referenced by NL3D::CLandscapeUser::flushTiles(). +

+

01885 {
+01886         // Load tile rdrpass, force setup the texture.
+01887         for(sint tileId= tileStart; tileId<tileStart+nbTiles; tileId++)
+01888         {
+01889                 CTileInfo       *tile= TileInfos[tileId];
+01890                 if(tile==NULL)
+01891                 {
+01892                         loadTile(tileId);
+01893                 }
+01894         }
+01895 
+01896         // For all rdrpass, force setup the texture.
+01897         ItTileRdrPassSet        it;
+01898         for(it= TileRdrPassSet.begin(); it!=TileRdrPassSet.end(); it++)
+01899         {
+01900                 const CPatchRdrPass     &pass= *it;
+01901                 // If present and not already setuped...
+01902                 if(pass.TextureDiffuse && !pass.TextureDiffuse->setupedIntoDriver())
+01903                         drv->setupTexture(*pass.TextureDiffuse);
+01904                 // If present and not already setuped...
+01905                 if(pass.TextureAlpha && !pass.TextureAlpha->setupedIntoDriver())
+01906                         drv->setupTexture(*pass.TextureAlpha);
+01907         }
+01908 }
+
+

+ + + + +
+ + + + + + + + + +
void NL3D::CLandscape::forceMergeAtTileLevel  )  [private]
+
+ + + + + +
+   + + +

+For changing TileMaxSubdivision. force tesselation to be under tile. +

+ +

+Definition at line 374 of file landscape.cpp. +

+References NL3D::ItZoneMap, and Zones. +

+Referenced by setTileMaxSubdivision(). +

+

00375 {
+00376         // For all patch of all zones.
+00377         for(ItZoneMap it= Zones.begin();it!=Zones.end();it++)
+00378         {
+00379                 ((*it).second)->forceMergeAtTileLevel();
+00380         }
+00381 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
void NL3D::CLandscape::freeFarRenderPass CPatch pPatch,
CPatchRdrPass pass,
uint  farIndex
[private]
+
+ + + + + +
+   + + +

+ +

+Definition at line 2157 of file landscape.cpp. +

+References _ULTotalFarPixels, NL3D::CPatch::getOrderS(), NL3D::CPatch::getOrderT(), height, NL_NUM_PIXELS_ON_FAR_TILE_EDGE, nlassert, NL3D::CTextureFar::removePatch(), NL3D::CPatchRdrPass::TextureDiffuse, uint, and width. +

+Referenced by NL3D::CPatch::computeNewFar(), and NL3D::CPatch::resetRenderFar(). +

+

02158 {
+02159         // Get size of the far texture
+02160         uint width=(pPatch->getOrderS ()*NL_NUM_PIXELS_ON_FAR_TILE_EDGE)>>(farIndex-1);
+02161         uint height=(pPatch->getOrderT ()*NL_NUM_PIXELS_ON_FAR_TILE_EDGE)>>(farIndex-1);
+02162 
+02163         // For updateLighting: decrement total of pixels to update.
+02164         _ULTotalFarPixels-= width*height;
+02165         nlassert(_ULTotalFarPixels>=0);
+02166 
+02167         // Get a pointer on the diffuse far texture
+02168         CTextureFar *pTextureFar=(CTextureFar*)(&*(pass->TextureDiffuse));
+02169 
+02170         // Remove from the patch from the texture if empty
+02171         pTextureFar->removePatch (pPatch, farIndex);
+02172 }
+
+

+ + + + +
+ + + + + + + + + +
const CVector& NL3D::CLandscape::getAutomaticLightDir  )  const [inline]
+
+ + + + + +
+   + + +

+return the light direction setuped in enableAutomaticLighting(). +

+ +

+Definition at line 415 of file landscape.h. +

+References _AutomaticLightDir. +

+Referenced by NL3D::CPatch::computeTileLightmapPixelAutomatic(). +

+

00415 {return _AutomaticLightDir;}
+
+

+ + + + +
+ + + + + + + + + +
bool NL3D::CLandscape::getAutomaticLighting  )  const [inline]
+
+ + + + + +
+   + + +

+return true if AutomaticLighting is enabled. +

+ +

+Definition at line 413 of file landscape.h. +

+References _AutomaticLighting. +

+Referenced by NL3D::CPatch::computeTileLightmap(), NL3D::CPatch::computeTileLightmapEdge(), and NL3D::CPatch::computeTileLightmapPixel(). +

+

00413 {return _AutomaticLighting;}
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
float NL3D::CLandscape::getCameraCollision const CVector start,
const CVector end,
float  radius,
bool  cone
+
+ + + + + +
+   + + +

+Get the camera 3rd person collision against the TileFaces (ie only under approx 50 m) return a [0,1] value. 0 => collision at start. 1 => no collision.

Parameters:
+ + + +
radius is the radius of the 'cylinder'
cone if true, the object tested is a cone (radius goes to end)
+
+ +

+Definition at line 3714 of file landscape.cpp. +

+References _ShadowPolyReceiver, and NL3D::CShadowPolyReceiver::getCameraCollision(). +

+

03715 {
+03716         return _ShadowPolyReceiver.getCameraCollision(start, end, radius, cone);
+03717 }
+
+

+ + + + +
+ + + + + + + + + +
CRGBA NL3D::CLandscape::getDLMGlobalVegetableColor  )  const [inline]
+
+ + + + + +
+   + + +

+see setDLMGlobalVegetableColor() +

+Definition at line 606 of file landscape.h. +

+References _DLMGlobalVegetableColor. +

+Referenced by NL3D::CLandscapeUser::getDLMGlobalVegetableColor(). +

+

00606 {return _DLMGlobalVegetableColor;}
+
+

+ + + + +
+ + + + + + + + + +
float NL3D::CLandscape::getDynamicLightingMaxAttEnd  )  const [inline]
+
+ + + + + +
+   + + +

+see setDynamicLightingMaxAttEnd() +

+Definition at line 597 of file landscape.h. +

+References _DLMMaxAttEnd. +

+

00597 {return _DLMMaxAttEnd;}
+
+

+ + + + +
+ + + + + + + + + +
uint NL3D::CLandscape::getDynamicLightingMemoryLoad  )  const
+
+ + + + + +
+   + + +

+For bench only. return approximate ammount of memory taken by dynamic lightmap in RAM. This is sizeof(global Texture in RAM) + all patchDLMContext. NB: not so slow, but do not call in final release. +

+Definition at line 3583 of file landscape.cpp. +

+References _PatchDLMContextList, NL3D::CTessList< CPatchDLMContext >::begin(), NL3D::CPatchDLMContext::getMemorySize(), NL3D::CTessNodeList::Next, NL3D_LANDSCAPE_DLM_HEIGHT, NL3D_LANDSCAPE_DLM_WIDTH, and uint. +

+

03584 {
+03585         uint    mem= 0;
+03586         // First, set size of global texture overhead.
+03587         mem= NL3D_LANDSCAPE_DLM_WIDTH * NL3D_LANDSCAPE_DLM_HEIGHT * sizeof(CRGBA);
+03588 
+03589         // Then, for each patchContext created
+03590         CPatchDLMContext        *ctxPtr= _PatchDLMContextList->begin();
+03591         while(ctxPtr!=NULL)
+03592         {
+03593                 // add its memory load.
+03594                 mem+= ctxPtr->getMemorySize();
+03595 
+03596                 // next
+03597                 ctxPtr= (CPatchDLMContext*)ctxPtr->Next;
+03598         }
+03599 
+03600         return mem;
+03601 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
CPatchRdrPass * NL3D::CLandscape::getFarRenderPass CPatch pPatch,
uint  farIndex,
float &  far1UScale,
float &  far1VScale,
float &  far1UBias,
float &  far1VBias,
bool &  bRot
[private]
+
+ + + + + +
+   + + +

+ +

+Definition at line 2075 of file landscape.cpp. +

+References _TextureFars, _ULRootTextureFar, _ULTotalFarPixels, NL3D::CTextureFar::allocatePatch(), NL3D::CPatch::getOrderS(), NL3D::CPatch::getOrderT(), height, NL3D::CTextureFar::linkBeforeUL(), NL_NUM_PIXELS_ON_FAR_TILE_EDGE, nlassert, sint, NL3D::CPatchRdrPass::TextureDiffuse, TileFarBank, NL3D::CTextureFar::tryAllocatePatch(), TSPRenderPass, uint, and width. +

+Referenced by NL3D::CPatch::computeNewFar(). +

+

02076 {
+02077         // Check args
+02078         nlassert (farIndex>0);
+02079 
+02080         // Get size of the far texture
+02081         uint width=(pPatch->getOrderS ()*NL_NUM_PIXELS_ON_FAR_TILE_EDGE)>>(farIndex-1);
+02082         uint height=(pPatch->getOrderT ()*NL_NUM_PIXELS_ON_FAR_TILE_EDGE)>>(farIndex-1);
+02083 
+02084         // For updateLighting: increment total of pixels to update.
+02085         _ULTotalFarPixels+= width*height;
+02086 
+02087         // Try to allocate in every textures
+02088         uint    i;
+02089         sint    bestRdrPass= -1;
+02090         sint    bestSplit= INT_MAX;
+02091         for(i=0;i<_TextureFars.size();i++)
+02092         {
+02093                 CTextureFar *pTextureFar=(CTextureFar*)(&*(_TextureFars[i]->TextureDiffuse));
+02094 
+02095                 sint    splitRes= pTextureFar->tryAllocatePatch(pPatch, farIndex);
+02096                 // if found with no split, ok, stop!
+02097                 if(splitRes==0)
+02098                 {
+02099                         bestRdrPass= i;
+02100                         break;
+02101                 }
+02102                 // else if found, but with split
+02103                 else if(splitRes > 0)
+02104                 {
+02105                         // Then must take the small split possible along all the texture fars.
+02106                         if (splitRes<bestSplit)
+02107                         {
+02108                                 bestRdrPass= i;
+02109                                 bestSplit= splitRes;
+02110                         }
+02111                 }
+02112         }
+02113 
+02114         // If no one found, must allocate a new render pass.
+02115         if(bestRdrPass==-1)
+02116         {
+02117                 bestRdrPass= _TextureFars.size();
+02118 
+02119                 // add a new render pass
+02120                 CPatchRdrPass   *pass=new CPatchRdrPass;
+02121 
+02122                 // Fill the render pass
+02123                 CTextureFar *pTextureFar=new CTextureFar;
+02124 
+02125                 // Append this textureFar to the list of TextureFar to updateLighting.
+02126                 if(_ULRootTextureFar==NULL)
+02127                         _ULRootTextureFar= pTextureFar;
+02128                 else
+02129                         pTextureFar->linkBeforeUL(_ULRootTextureFar);
+02130 
+02131                 // Set the bank
+02132                 pTextureFar->_Bank=&TileFarBank;
+02133 
+02134                 // Set as diffuse texture for this renderpass
+02135                 pass->TextureDiffuse=pTextureFar;
+02136 
+02137                 // Add the render pass to the list
+02138                 _TextureFars.push_back(pass);
+02139         }
+02140 
+02141 
+02142         // Ok, add the patch to the best render pass in the _TextureFars
+02143         TSPRenderPass pass= _TextureFars[bestRdrPass];
+02144 
+02145         // Get a pointer on the diffuse far texture
+02146         CTextureFar *pTextureFar=(CTextureFar*)(&*(pass->TextureDiffuse));
+02147 
+02148         // Allocate really in it (must success since tryAllocate() has succeed)
+02149         pTextureFar->allocatePatch(pPatch, farIndex, farUScale, farVScale, farUBias, farVBias, bRot);
+02150 
+02151         // Return the renderpass
+02152         return pass;
+02153 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
CVector NL3D::CLandscape::getHeightFieldDeltaZ float  x,
float  y
const
+
+ + + + + +
+   + + +

+return the HeightField DeltaZ for the 2D position. (0,0,dZ) is returned. +

+ +

+Definition at line 2698 of file landscape.cpp. +

+References _HeightField, NL3D::CLandscape::CBezierPatchZ::eval(), NL3D::CLandscape::CHeightField::Height, NL3D::CLandscape::CHeightField::OOSizeX, NL3D::CLandscape::CHeightField::OOSizeY, NL3D::CLandscape::CHeightField::OriginX, NL3D::CLandscape::CHeightField::OriginY, sint, NL3D::CLandscape::CHeightField::Width, NLMISC::CVector::x, x, NLMISC::CVector::y, y, NLMISC::CVector::z, and NL3D::CLandscape::CHeightField::ZPatchs. +

+Referenced by NL3D::CZone::applyHeightField(), and NL3D::CLandscapeUser::getHeightFieldDeltaZ(). +

+

02699 {
+02700         if(_HeightField.ZPatchs.size()==0)
+02701                 return CVector::Null;
+02702 
+02703         // map to _HeightField coordinates.
+02704         x-= _HeightField.OriginX;
+02705         y-= _HeightField.OriginY;
+02706         x*= _HeightField.OOSizeX;
+02707         y*= _HeightField.OOSizeY;
+02708         // get patch on the grid.
+02709         sint    ix, iy;
+02710         ix= (sint)floor(x);
+02711         iy= (sint)floor(y);
+02712         // out of the grid?
+02713         if( ix<0 || ix>=(sint)_HeightField.Width || iy<0 || iy>=(sint)_HeightField.Height)
+02714                 return CVector::Null;
+02715 
+02716         // get patch.
+02717         const CBezierPatchZ     &paz= _HeightField.ZPatchs[iy*_HeightField.Width + ix];
+02718 
+02719         // compute result.
+02720         CVector ret=CVector::Null;
+02721         ret.x= 0;
+02722         ret.y= 0;
+02723         ret.z= paz.eval(x-ix, y-iy);
+02724 
+02725         return ret;
+02726 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
uint8 NL3D::CLandscape::getLumel const CPatchIdent patchId,
const CUV uv
const
+
+ + + + + +
+   + + +

+Get the lumel under the position. return 255 if invalid patchId. +

+ +

+Definition at line 3254 of file landscape.cpp. +

+References NL3D::CPatch::getLumel(), nlassert, NL3D::CPatchIdent::PatchId, sint, uint16, uint8, NL3D::CPatchIdent::ZoneId, and Zones. +

+

03255 {
+03256         // \todo yoyo: TODO_ZONEID: change ZoneId in 32 bits...
+03257         std::map<uint16, CZone*>::const_iterator        it= Zones.find((uint16)patchId.ZoneId);
+03258         if(it!=Zones.end())
+03259         {
+03260                 sint    N= (*it).second->getNumPatchs();
+03261                 // patch must exist in the zone.
+03262                 nlassert(patchId.PatchId<N);
+03263                 const CPatch    *pa= const_cast<const CZone*>((*it).second)->getPatch(patchId.PatchId);
+03264 
+03265                 return pa->getLumel(uv);
+03266         }
+03267         else
+03268                 // Return full sun contribution as default
+03269                 return 255;
+03270 }
+
+

+ + + + +
+ + + + + + + + + +
bool NL3D::CLandscape::getNoiseMode  )  const
+
+ + + + + +
+   + + +

+ +

+Definition at line 3106 of file landscape.cpp. +

+References _NoiseEnabled. +

+Referenced by NL3D::CPatch::computeVertex(). +

+

03107 {
+03108         return _NoiseEnabled;
+03109 }
+
+

+ + + + +
+ + + + + + + + + +
uint NL3D::CLandscape::getNumVegetableFaceRendered  )  const
+
+ + + + + +
+   + + +

+return the number of faces displayed in Driver with the vegetable manager. Out CPrimitiveProfile::NTriangles displayed by vegetable part is returned. +

+Definition at line 3211 of file landscape.cpp. +

+References _VegetableManager, NL3D::CVegetableManager::getNumVegetableFaceRendered(), and uint. +

+

03212 {
+03213         return _VegetableManager->getNumVegetableFaceRendered();
+03214 }
+
+

+ + + + +
+ + + + + + + + + +
const CVector& NL3D::CLandscape::getOldRefineCenter  )  const [inline]
+
+ + + + + +
+   + + +

+This is especially for Pacs. Each Vertex->EndPos which is not a corner of a patch is set to the mean of its 2 shared Patchs. NB: Works with special cases of rectangular patchs and binded patchs. +

+Definition at line 264 of file landscape.h. +

+References _OldRefineCenter. +

+Referenced by NL3D::CLandscapeModel::getReceiverBBox(). +

+

00264 {return _OldRefineCenter;}
+
+

+ + + + +
+ + + + + + + + + +
CPatchDLMContextList* NL3D::CLandscape::getPatchDLMContextList  )  const [inline, private]
+
+ + + + + +
+   + + +

+for CPatch. +

+ +

+Definition at line 983 of file landscape.h. +

+References _PatchDLMContextList. +

+

00983 {return _PatchDLMContextList;}
+
+

+ + + + +
+ + + + + + + + + +
CRGBA NL3D::CLandscape::getPointLightDiffuseMaterial  )  const [inline]
+
+ + + + + +
+   + + +

+

See also:
setPointLightDiffuseMaterial
+ +

+Definition at line 394 of file landscape.h. +

+References _PointLightDiffuseMaterial. +

+Referenced by NL3D::CLandscapeUser::getPointLightDiffuseMaterial(). +

+

00395         {
+00396                 return _PointLightDiffuseMaterial;
+00397         }
+
+

+ + + + +
+ + + + + + + + + +
const CVector& NL3D::CLandscape::getPZBModelPosition  )  const [inline]
+
+ + + + + +
+   + + +

+setPZBModelPosition() +

+ +

+Definition at line 548 of file landscape.h. +

+References _PZBModelPosition. +

+Referenced by NL3D::CLandscapeModel::clipAndRenderLandscape(), and NL3D::CLandscapeModel::receiveShadowMap(). +

+

00548 {return _PZBModelPosition;}
+
+

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

+ + + + +
+ + + + + + + + + +
bool NL3D::CLandscape::getRefineMode  )  const [inline]
+
+ + + + + +
+   + + +

+ +

+Definition at line 207 of file landscape.h. +

+References _RefineMode. +

+

00207 {return _RefineMode;}
+
+

+ + + + +
+ + + + + + + + + +
const CRGBA* NL3D::CLandscape::getStaticLight  )  const [inline]
+
+ + + + + +
+   + + +

+Get the light color by shading table.

+

Returns:
a CRGBA[256] array. It give the static light color for a shading value.
+ +

+Definition at line 380 of file landscape.h. +

+References _LightValue. +

+Referenced by NL3D::CPatch::computeTileLightmapEdgePrecomputed(), NL3D::CPatch::computeTileLightmapPixelAutomatic(), NL3D::CPatch::computeTileLightmapPixelPrecomputed(), NL3D::CPatch::computeTileLightmapPrecomputed(), and NL3D::CTextureFar::rebuildPatch(). +

+

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

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
CVector NL3D::CLandscape::getTesselatedPos const CPatchIdent patchId,
const CUV uv
const
+
+ + + + + +
+   + + +

+From the current tesselation of a patch of landscape, and a UV in this patch, return tesselated position. NB: return Null if patch not found. +

+Definition at line 2496 of file landscape.cpp. +

+References _OldRefineCenter, _Threshold, _TileDistNear, _VertexShaderOk, NL3D::CPatch::getTesselatedPos(), nlassert, NL3D::CPatchIdent::PatchId, sint, NLMISC::sqr(), uint16, NL3D::CPatchIdent::ZoneId, and Zones. +

+

02497 {
+02498         // First, must update globals, for CTessFace::computeTesselatedPos() to work properly.
+02499 
+02500         // VertexProgrma mode???
+02501         CLandscapeGlobals::VertexProgramEnabled= _VertexShaderOk;
+02502 
+02503         // If VertexProgram enabled
+02504         if( CLandscapeGlobals::VertexProgramEnabled )
+02505         {
+02506                 /* because VertexProgram enabled, CTessVertex::Pos (geomorphed Pos) are not computed each frame
+02507                    Hence, CTessFace::computeTesselatedPos() will call CTessVertex::computeGeomPos() to have correct 
+02508                    CTessVertex::Pos. ThereFore we must setup globals so CTessVertex::computeGeomPos() works properly.
+02509                 */
+02510                 
+02511                 // see copy in updateGlobalsAndLockBuffers(). NB: Just copy what needed here!!!!
+02512 
+02513                 // Tile subdivsion part.
+02514                 CLandscapeGlobals::TileDistNear = _TileDistNear;
+02515                 CLandscapeGlobals::TileDistFar = CLandscapeGlobals::TileDistNear+20;
+02516                 CLandscapeGlobals::TileDistNearSqr = sqr(CLandscapeGlobals::TileDistNear);
+02517                 CLandscapeGlobals::TileDistFarSqr = sqr(CLandscapeGlobals::TileDistFar);
+02518                 CLandscapeGlobals::OOTileDistDeltaSqr = 1.0f / (CLandscapeGlobals::TileDistFarSqr - CLandscapeGlobals::TileDistNearSqr);
+02519 
+02520                 // RefineThreshold.
+02521                 CLandscapeGlobals::RefineThreshold= _Threshold;
+02522                 CLandscapeGlobals::OORefineThreshold= 1.0f / CLandscapeGlobals::RefineThreshold;
+02523 
+02524                 // Refine Center*.
+02525                 // NB: setup the last setuped refineCenter.
+02526                 CLandscapeGlobals::RefineCenter= _OldRefineCenter;
+02527         }
+02528 
+02529 
+02530         // \todo yoyo: TODO_ZONEID: change ZoneId in 32 bits...
+02531         std::map<uint16, CZone*>::const_iterator        it= Zones.find((uint16)patchId.ZoneId);
+02532         if(it!=Zones.end())
+02533         {
+02534                 sint    N= (*it).second->getNumPatchs();
+02535                 // patch must exist in the zone.
+02536                 nlassert(patchId.PatchId<N);
+02537                 const CPatch    *pa= const_cast<const CZone*>((*it).second)->getPatch(patchId.PatchId);
+02538 
+02539                 return pa->getTesselatedPos(uv);
+02540         }
+02541         else
+02542                 return CVector::Null;
+02543 }
+
+

+ + + + +
+ + + + + + + + + + +
void NL3D::CLandscape::getTessellationLeaves std::vector< const CTessFace * > &  leaves  )  const
+
+ + + + + +
+   + + +

+From the current tesselation of landscape, build the list of leaves faces. Warning: ptrs are only valid between 2 tesselation (2 calls of Scene::render() or 2 calls of refine*() etc...) +

+Definition at line 2899 of file landscape.cpp. +

+References NL3D::CPatch::appendTessellationLeaves(), sint, and Zones. +

+Referenced by NL3D::CZoneLighter::addTriangles(), NL3D::CInstanceLighter::addTriangles(), and NL3D::CZoneLighter::buildZoneInformation(). +

+

02900 {
+02901         leaves.clear();
+02902 
+02903         std::map<uint16, CZone*>::const_iterator        it;
+02904         for(it= Zones.begin();it!=Zones.end();it++)
+02905         {
+02906                 // Then trace all patch.
+02907                 sint    N= (*it).second->getNumPatchs();
+02908                 for(sint i=0;i<N;i++)
+02909                 {
+02910                         const CPatch    *pa= const_cast<const CZone*>((*it).second)->getPatch(i);
+02911 
+02912                         pa->appendTessellationLeaves(leaves);
+02913                 }
+02914         }
+02915 
+02916 }
+
+

+ + + + +
+ + + + + + + + + +
CTextureDLM* NL3D::CLandscape::getTextureDLM  )  const [inline, private]
+
+ + + + + +
+   + + +

+for CPatch. +

+ +

+Definition at line 979 of file landscape.h. +

+References _TextureDLM. +

+

00979 {return (CTextureDLM*)(ITexture*)_TextureDLM;}
+
+

+ + + + +
+ + + + + + + + + +
float NL3D::CLandscape::getThreshold  )  const [inline]
+
+ + + + + +
+   + + +

+Get threshold. +

+ +

+Definition at line 205 of file landscape.h. +

+References _Threshold. +

+Referenced by NL3D::CLandscapeUser::getThreshold(). +

+

00205 {return _Threshold;}
+
+

+ + + + +
+ + + + + + + + + +
ULandscapeTileCallback* NL3D::CLandscape::getTileCallback  )  const [inline]
+
+ + + + + +
+   + + +

+ +

+Definition at line 622 of file landscape.h. +

+References _TileCallback. +

+Referenced by NL3D::CPatch::appendTileMaterialToRenderList(), NL3D::CLandscapeUser::getTileCallback(), and NL3D::CPatch::removeTileMaterialFromRenderList(). +

+

00622 { return _TileCallback; }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
CTileElement * NL3D::CLandscape::getTileElement const CPatchIdent patchId,
const CUV uv
+
+ + + + + +
+   + + +

+Return the tile element for a patch at specific UV. UseFull for getting surface data. Return NULL if not found. +

+ +

+Definition at line 1865 of file landscape.cpp. +

+References NL3D::CPatch::getTileElement(), nlassert, NL3D::CPatchIdent::PatchId, sint, uint16, NL3D::CPatchIdent::ZoneId, and Zones. +

+

01866 {
+01867         // \todo yoyo: TODO_ZONEID: change ZoneId in 32 bits...
+01868         std::map<uint16, CZone*>::const_iterator        it= Zones.find((uint16)patchId.ZoneId);
+01869         if(it!=Zones.end())
+01870         {
+01871                 sint    N= (*it).second->getNumPatchs();
+01872                 // patch must exist in the zone.
+01873                 nlassert(patchId.PatchId<N);
+01874                 CPatch  *pa= const_cast<CZone*>((*it).second)->getPatch(patchId.PatchId);
+01875                 return pa->getTileElement (uv);
+01876         }
+01877         else
+01878                 // Return not found
+01879                 return NULL;
+01880 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
uint NL3D::CLandscape::getTileLightMap CRGBA  map[NL_TILE_LIGHTMAP_SIZE *NL_TILE_LIGHTMAP_SIZE],
CPatchRdrPass *&  lightmapRdrPass
[private]
+
+ + + + + +
+   + + +

+ +

+Definition at line 1945 of file landscape.cpp. +

+References _NFreeLightMaps, _TextureNears, _ULTotalNearPixels, NL3D::CTextureNear::getNbAvailableTiles(), NL3D::CTextureNear::getTileAndFillRect(), NL3D::NbTileLightMapByTexture, NL_TILE_LIGHTMAP_SIZE, nlassert, sint, NL3D::CPatchRdrPass::TextureDiffuse, NL3D::TextureNearSize, TSPRenderPass, and uint. +

+Referenced by NL3D::CPatch::getTileLightMap(). +

+

01946 {
+01947         sint    textNum;
+01948         uint    lightMapId;
+01949         /* 
+01950                 NB: TextureNear are a grow only Array... TextureNear are never deleted. Why? :
+01951                 2/ Unused near texture may be uncahced by opengl (and maybe by windows, to disk).
+01952 
+01953           (old reason, no longer valid, since lightmaps are unlinked from tiles.
+01954                 1/ There is an important issue with releasing texture nears: tiles may acces them (see getTileRenderPass())
+01955           )
+01956         */
+01957         // 0. Alloc Near Texture if necessary.
+01958         //====================================
+01959         if(_NFreeLightMaps==0)
+01960         {
+01961                 CTextureNear    *text= new CTextureNear(TextureNearSize);
+01962                 TSPRenderPass   newPass= new CPatchRdrPass;
+01963 
+01964                 newPass->TextureDiffuse= text;
+01965 
+01966                 _TextureNears.push_back(newPass);
+01967                 _NFreeLightMaps+= text->getNbAvailableTiles();
+01968         }
+01969 
+01970         // 1. Search the first texture which has a free tile.
+01971         //==================================================
+01972         CTextureNear    *nearText= NULL;
+01973         CPatchRdrPass   *nearRdrPass= NULL;
+01974         for(textNum=0;textNum<(sint)_TextureNears.size();textNum++)
+01975         {
+01976                 nearRdrPass= _TextureNears[textNum];
+01977                 nearText= (CTextureNear*)(ITexture*)nearRdrPass->TextureDiffuse;
+01978                 if(nearText->getNbAvailableTiles()!=0)
+01979                         break;
+01980         }
+01981         nlassert(textNum<(sint)_TextureNears.size());
+01982         // A empty space has been found.
+01983         _NFreeLightMaps--;
+01984 
+01985         // 2. Fill the texture with the data, and updaterect.
+01986         //===================================================
+01987         lightMapId= nearText->getTileAndFillRect(map);
+01988         // Compute the Id.
+01989         lightMapId= textNum*NbTileLightMapByTexture + lightMapId;
+01990 
+01991 
+01992         // 3. updateLighting
+01993         //===================================================
+01994         // Increment number of pixels to update for near.
+01995         _ULTotalNearPixels+= NL_TILE_LIGHTMAP_SIZE*NL_TILE_LIGHTMAP_SIZE;
+01996 
+01997 
+01998         // Result:
+01999         lightmapRdrPass= nearRdrPass;
+02000         return lightMapId;
+02001 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
void NL3D::CLandscape::getTileLightMapUvInfo uint  tileLightMapId,
CVector uvScaleBias
[private]
+
+ + + + + +
+   + + +

+ +

+Definition at line 2003 of file landscape.cpp. +

+References NL3D::NbTileLightMapByLine, NL3D::NbTileLightMapByTexture, NL_TILE_LIGHTMAP_SIZE, s, t, NL3D::TextureNearSize, uint, NLMISC::CVector::x, NLMISC::CVector::y, and NLMISC::CVector::z. +

+Referenced by NL3D::CPatch::getTileLightMapUvInfo(). +

+

02004 {
+02005         uint    id, s,t;
+02006 
+02007         // Scale.
+02008         static const float      scale10= (float)NL_TILE_LIGHTMAP_SIZE/TextureNearSize;
+02009         static const float      scale4= 4.f/TextureNearSize;
+02010         static const float      scale1= 1.f/TextureNearSize;
+02011         // The size of a minilightmap, mapped onto the polygon, is still 4 pixels.
+02012         uvScaleBias.z= scale4;
+02013 
+02014         // Get the id local in the texture.
+02015         id= tileLightMapId%NbTileLightMapByTexture;
+02016 
+02017         // Commpute UVBias.
+02018         // Get the coordinate of the tile, in tile number.
+02019         s= id%NbTileLightMapByLine;
+02020         t= id/NbTileLightMapByLine;
+02021         // But the real size of a minilightmap is 10 pixels, and we must reach the pixel 1,1.
+02022         uvScaleBias.x= s*scale10 + scale1;
+02023         uvScaleBias.y= t*scale10 + scale1;
+02024 }
+
+

+ + + + +
+ + + + + + + + + +
uint NL3D::CLandscape::getTileMaxSubdivision  ) 
+
+ + + + + +
+   + + +

+Get Maximum Tile subdivision. +

+ +

+Definition at line 356 of file landscape.cpp. +

+References _TileMaxSubdivision, and uint. +

+Referenced by NL3D::CLandscapeUser::getTileMaxSubdivision(). +

+

00357 {
+00358         return _TileMaxSubdivision;
+00359 }
+
+

+ + + + +
+ + + + + + + + + +
float NL3D::CLandscape::getTileNear  )  const [inline]
+
+ + + + + +
+   + + +

+Get tile near distance. +

+ +

+Definition at line 201 of file landscape.h. +

+References _TileDistNear. +

+Referenced by NL3D::CLandscapeModel::getReceiverBBox(), and NL3D::CLandscapeUser::getTileNear(). +

+

00201 {return _TileDistNear;}
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
CPatchRdrPass * NL3D::CLandscape::getTileRenderPass uint16  tileId,
bool  additiveRdrPass
[private]
+
+ + + + + +
+   + + +

+ +

+Definition at line 1790 of file landscape.cpp. +

+References NL3D::CLandscape::CTileInfo::AdditiveRdrPass, NL3D::CLandscape::CTileInfo::DiffuseRdrPass, loadTile(), nlassert, TileInfos, and uint16. +

+Referenced by NL3D::CPatch::getTileRenderPass(), and getTileTexture(). +

+

01791 {
+01792         CTileInfo       *tile= TileInfos[tileId];
+01793 
+01794         // If not here, create it.
+01795         //========================
+01796         if(tile==NULL)
+01797         {
+01798                 // Force loading of tile.
+01799                 loadTile(tileId);
+01800 
+01801                 tile= TileInfos[tileId];
+01802                 nlassert(tile!=NULL);
+01803         }
+01804 
+01805         // Retrieve.
+01806         //========================
+01807         if(additiveRdrPass)
+01808         {
+01809                 // NB: additive pass is not lighted by the lightmap, so there is no lighted version of this rednerpass.
+01810                 return tile->AdditiveRdrPass;
+01811         }
+01812         else
+01813         {
+01814                 return tile->DiffuseRdrPass;
+01815         }
+01816 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
NLMISC::CSmartPtr< ITexture > NL3D::CLandscape::getTileTexture uint16  tileId,
CTile::TBitmap  bitmapType,
CVector uvScaleBias
+
+ + + + + +
+   + + +

+Return the texture for a tile Id. UseFull for Tile edition. +

+ +

+Definition at line 1844 of file landscape.cpp. +

+References getTileRenderPass(), getTileUvScaleBiasRot(), NL3D::CPatchRdrPass::TextureAlpha, NL3D::CPatchRdrPass::TextureDiffuse, uint16, and uint8. +

+

01845 {
+01846         CPatchRdrPass   *pass;
+01847         if(bitmapType== CTile::additive)
+01848                 pass= getTileRenderPass(tileId, true);
+01849         else
+01850                 pass= getTileRenderPass(tileId, false);
+01851         if(!pass)
+01852                 return NULL;
+01853         uint8   dummy;
+01854         getTileUvScaleBiasRot(tileId, bitmapType, uvScaleBias, dummy);
+01855 
+01856         // return the wanted texture.
+01857         if(bitmapType==CTile::diffuse || bitmapType==CTile::additive)
+01858                 return pass->TextureDiffuse;
+01859         else
+01860                 return pass->TextureAlpha;
+01861 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
void NL3D::CLandscape::getTileUvScaleBiasRot uint16  tileId,
CTile::TBitmap  bitmapType,
CVector uvScaleBias,
uint8 rotAlpha
[private]
+
+ + + + + +
+   + + +

+ +

+Definition at line 1820 of file landscape.cpp. +

+References NL3D::CLandscape::CTileInfo::AdditiveUvScaleBias, NL3D::CLandscape::CTileInfo::AlphaUvScaleBias, NL3D::CLandscape::CTileInfo::DiffuseUvScaleBias, nlassert, NL3D::CLandscape::CTileInfo::RotAlpha, TileInfos, uint16, and uint8. +

+Referenced by getTileTexture(), and NL3D::CPatch::getTileUvInfo(). +

+

01821 {
+01822         CTileInfo       *tile= TileInfos[tileId];
+01823         // tile should not be NULL.
+01824         // Because load of tiles are always done in getTileRenderPass(), and this insertion always succeed.
+01825         nlassert(tile);
+01826 
+01827         rotAlpha= 0;
+01828         switch(bitmapType)
+01829         {
+01830                 case CTile::diffuse:
+01831                         uvScaleBias= tile->DiffuseUvScaleBias; break;
+01832                 case CTile::additive:
+01833                         uvScaleBias= tile->AdditiveUvScaleBias; break;
+01834                 case CTile::alpha:
+01835                         uvScaleBias= tile->AlphaUvScaleBias; 
+01836                         rotAlpha= tile->RotAlpha;
+01837                         break;
+01838                 default: break;
+01839         }
+01840 }
+
+

+ + + + +
+ + + + + + + + + + +
const CTileVegetableDesc & NL3D::CLandscape::getTileVegetableDesc uint16  tileId  )  [private]
+
+ + + + + +
+   + + +

+For a given tile Id, look into tileSet, and get the tile vegetable descriptor

Parameters:
+ + +
tileId the tile [0..65535] to get the list of vegetable to create.
+
+ +

+Definition at line 3218 of file landscape.cpp. +

+References NL3D::CTileBank::getTileVegetableDesc(), TileBank, and uint16. +

+Referenced by NL3D::CPatch::generateTileVegetable(). +

+

03219 {
+03220         return TileBank.getTileVegetableDesc(tileId);
+03221 }
+
+

+ + + + +
+ + + + + + + + + + +
const CZone * NL3D::CLandscape::getZone sint  zoneId  )  const
+
+ + + + + +
+   + + +

+Get a zone pointer.

+

Parameters:
+ + +
zoneId the zone of the update.
+
+
Returns:
Return a zone pointer. NULL if the zone doesn't exist or isn't loaded.
+ +

+Definition at line 2218 of file landscape.cpp. +

+References sint, and Zones. +

+

02219 {
+02220         TZoneMap::const_iterator        it;
+02221 
+02222         it= Zones.find(zoneId);
+02223         if (it!=Zones.end())
+02224                 return (*it).second;
+02225         else
+02226                 return NULL;
+02227 }
+
+

+ + + + +
+ + + + + + + + + + +
CZone * NL3D::CLandscape::getZone sint  zoneId  ) 
+
+ + + + + +
+   + + +

+Get a zone pointer.

+

Parameters:
+ + +
zoneId the zone of the update.
+
+
Returns:
Return a zone pointer. NULL if the zone doesn't exist or isn't loaded.
+ +

+Definition at line 2206 of file landscape.cpp. +

+References sint, and Zones. +

+Referenced by NL3D::CZoneLighter::buildZoneInformation(), checkZoneBinds(), NL3D::CZoneLighter::excludeAllPatchFromRefineAll(), NL3D::CInstanceLighter::excludeAllPatchFromRefineAll(), NL3D::CZoneLighter::processCalc(), and NL3D::CZoneLighter::processZonePointLightRT(). +

+

02207 {
+02208         TZoneMap::iterator      it;
+02209         it= Zones.find(zoneId);
+02210         if (it!=Zones.end())
+02211                 return (*it).second;
+02212         else
+02213                 return NULL;
+02214 }
+
+

+ + + + +
+ + + + + + + + + + +
void NL3D::CLandscape::getZoneList std::vector< uint16 > &  zoneIds  )  const
+
+ + + + + +
+   + + +

+Return list of zone loaded. +

+Definition at line 502 of file landscape.cpp. +

+References Zones. +

+Referenced by clear(), and NL3D::CLandscapeUser::getAllZoneLoaded(). +

+

00503 {
+00504         zoneIds.clear();
+00505         zoneIds.reserve(Zones.size());
+00506         std::map<uint16, CZone*>::const_iterator        it;
+00507         for(it= Zones.begin();it!=Zones.end();it++)
+00508         {
+00509                 zoneIds.push_back((*it).first);
+00510         }
+00511 }
+
+

+ + + + +
+ + + + + + + + + +
void NL3D::CLandscape::init  ) 
+
+ + + + + +
+   + + +

+init the landscape VBuffers, texture cache etc... +

+ +

+Definition at line 288 of file landscape.cpp. +

+References _PatchQuadGrid, _PatchQuadGridEltSize, _PatchQuadGridSize, NL3D::CQuadGrid< CPatchIdentEx >::create(), FarMaterial, NL3D::CMaterial::initUnlit(), NL3D::CMaterial::setDstBlend(), NL3D::CMaterial::setSrcBlend(), NL3D::CMaterial::texEnvArg0Alpha(), NL3D::CMaterial::texEnvArg0RGB(), NL3D::CMaterial::texEnvArg1RGB(), NL3D::CMaterial::texEnvOpAlpha(), NL3D::CMaterial::texEnvOpRGB(), and TileMaterial. +

+Referenced by NL3D::CLandscapeModel::CLandscapeModel(). +

+

00289 {
+00290         // Fill Far mat.
+00291         // Must init his BlendFunction here!!! becaus it switch between blend on/off during rendering.
+00292         FarMaterial.initUnlit();
+00293         FarMaterial.setSrcBlend(CMaterial::srcalpha);
+00294         FarMaterial.setDstBlend(CMaterial::invsrcalpha);
+00295 
+00296         // FarMaterial: pass trhough Alpha from diffuse.
+00297         FarMaterial.texEnvOpAlpha(0, CMaterial::Replace);
+00298         FarMaterial.texEnvArg0Alpha(0, CMaterial::Diffuse, CMaterial::SrcAlpha);
+00299         FarMaterial.texEnvOpAlpha(1, CMaterial::Replace);
+00300         FarMaterial.texEnvArg0Alpha(1, CMaterial::Diffuse, CMaterial::SrcAlpha);
+00301         // FarMaterial: Add RGB from static lightmap and dynamic lightmap
+00302         FarMaterial.texEnvOpRGB(0, CMaterial::Replace);
+00303         FarMaterial.texEnvArg0RGB(0, CMaterial::Texture, CMaterial::SrcColor);
+00304         FarMaterial.texEnvOpRGB(1, CMaterial::Add);
+00305         FarMaterial.texEnvArg0RGB(1, CMaterial::Texture, CMaterial::SrcColor);
+00306         FarMaterial.texEnvArg1RGB(1, CMaterial::Previous, CMaterial::SrcColor);
+00307 
+00308 
+00309         // Init material for tile.
+00310         TileMaterial.initUnlit();
+00311 
+00312         // init quadGrid.
+00313         _PatchQuadGrid.create(_PatchQuadGridSize, _PatchQuadGridEltSize);
+00314 }
+
+

+ + + + +
+ + + + + + + + + + +
void NL3D::CLandscape::initAnimatedLightIndex const CScene scene  ) 
+
+ + + + + +
+   + + +

+Enable automatic near lightmap computing. use setupStaticLight(). Default is disabled. NB: calling this method won't flush all texture near already computed. +

+Definition at line 3619 of file landscape.cpp. +

+References NL3D::ItZoneMap, and Zones. +

+Referenced by NL3D::CScene::createInstance(). +

+

03620 {
+03621         // Affect currently added zones.
+03622         for(ItZoneMap it= Zones.begin();it!=Zones.end();it++)
+03623         {
+03624                 (*it).second->_PointLightArray.initAnimatedLightIndex(scene);
+03625         }
+03626 }
+
+

+ + + + +
+ + + + + + + + + +
void NL3D::CLandscape::initTileBank  ) 
+
+ + + + + +
+   + + +

+Reinit the tile bank if the bank change. +

+ +

+Definition at line 3629 of file landscape.cpp. +

+References releaseTiles(), TileInfos, uint, and Zones. +

+Referenced by CLandscape(), and NL3D::CLandscapeUser::flushTiles(). +

+

03630 {
+03631         // Release the tiles
+03632         releaseTiles (0, TileInfos.size());
+03633         TileInfos.clear();
+03634         TileInfos.resize(NL3D::NbTilesMax);
+03635         fill(TileInfos.begin(), TileInfos.end(), (CTileInfo*)NULL);
+03636 
+03637         // Refresh each zone
+03638         std::map<uint16, CZone*>::iterator      it;
+03639         for(it= Zones.begin();it!=Zones.end();it++)
+03640         {
+03641                 // Refresh each patch
+03642                 uint numPatch = (uint)it->second->getNumPatchs();
+03643                 uint i;
+03644                 for (i=0; i<numPatch; i++)
+03645                         it->second->changePatchTextureAndColor (i, NULL, NULL);
+03646         }
+03647 }
+
+

+ + + + +
+ + + + + + + + + +
bool NL3D::CLandscape::initTileBanks  ) 
+
+ + + + + +
+   + + +

+Build tileBank. Call this after loading the near and far tile banks.

+

Returns:
true if ok, false else. If false, far texture will be desactived.
+ +

+Definition at line 2592 of file landscape.cpp. +

+References _FarInitialized, _VegetableManager, eraseTileFarIfNotGood(), NL3D::CTileFarBank::getNumTile(), NL3D::CTileSet::getNumTile128(), NL3D::CTileSet::getNumTile256(), NL3D::CTileSetTransition::getTile(), NL3D::CTileSet::getTile128(), NL3D::CTileSet::getTile256(), NL3D::CTileBank::getTileCount(), NL3D::CTileBank::getTileSet(), NL3D::CTileBank::getTileSetCount(), NL3D::CTileSet::getTransition(), NL3D::CTileBank::initTileVegetableDescs(), NL_TILE_FAR_SIZE_ORDER0, NL_TILE_FAR_SIZE_ORDER1, NL_TILE_FAR_SIZE_ORDER2, TileBank, TileFarBank, and uint. +

+Referenced by NL3D::CLandscapeUser::flushTiles(). +

+

02593 {
+02594         // *** Check the two banks are OK
+02595         _FarInitialized=false;
+02596 
+02597         // Compatibility check
+02598         bool bCompatibility=true;
+02599 
+02600         // Same number of tiles
+02601         if (TileBank.getTileCount()==TileFarBank.getNumTile())
+02602         {
+02603                 // Same tileSet
+02604                 for (int tileSet=0; tileSet<TileBank.getTileSetCount(); tileSet++)
+02605                 {
+02606                         // Same tile128
+02607                         int tile;
+02608                         for (tile=0; tile<TileBank.getTileSet(tileSet)->getNumTile128(); tile++)
+02609                         {
+02610                                 // tile number
+02611                                 uint tileNumber=TileBank.getTileSet(tileSet)->getTile128(tile);
+02612 
+02613                                 // erase the tiles if not good
+02614                                 bCompatibility&=eraseTileFarIfNotGood (tileNumber, NL_TILE_FAR_SIZE_ORDER0, NL_TILE_FAR_SIZE_ORDER1, NL_TILE_FAR_SIZE_ORDER2);
+02615                         }
+02616 
+02617                         // Same tile256
+02618                         for (tile=0; tile<TileBank.getTileSet(tileSet)->getNumTile256(); tile++)
+02619                         {
+02620                                 // tile number
+02621                                 uint tileNumber=TileBank.getTileSet(tileSet)->getTile256(tile);
+02622 
+02623                                 // erase the tiles if not good
+02624                                 bCompatibility&=eraseTileFarIfNotGood (tileNumber, NL_TILE_FAR_SIZE_ORDER0<<2, NL_TILE_FAR_SIZE_ORDER1<<2, NL_TILE_FAR_SIZE_ORDER2<<2);
+02625                         }
+02626 
+02627                         // Same transition
+02628                         for (tile=0; tile<CTileSet::count; tile++)
+02629                         {
+02630                                 // tile number
+02631                                 uint tileNumber=TileBank.getTileSet(tileSet)->getTransition(tile)->getTile();
+02632 
+02633                                 // erase the tiles if not good
+02634                                 bCompatibility&=eraseTileFarIfNotGood (tileNumber, NL_TILE_FAR_SIZE_ORDER0, NL_TILE_FAR_SIZE_ORDER1, NL_TILE_FAR_SIZE_ORDER2);
+02635                         }
+02636                 }
+02637                 
+02638                 // Far actived!
+02639                 _FarInitialized=true;
+02640         }
+02641 
+02642         // Register / Load the vegetables.
+02643         TileBank.initTileVegetableDescs(_VegetableManager);
+02644 
+02645         return bCompatibility;
+02646 }
+
+

+ + + + +
+ + + + + + + + + +
void NL3D::CLandscape::invalidateAllTiles  ) 
+
+ + + + + +
+   + + +

+ +

+Definition at line 3694 of file landscape.cpp. +

+References uint, unlockBuffers(), updateGlobalsAndLockBuffers(), updateTessBlocksFaceVector(), and Zones. +

+Referenced by NL3D::CLandscapeUser::invalidateAllTiles(). +

+

03695 {
+03696         
+03697         updateGlobalsAndLockBuffers(CVector::Null);                                                             
+03698         for(TZoneMap::iterator it = Zones.begin(); it != Zones.end(); ++it)
+03699         {
+03700                 if (it->second->Compiled)
+03701                 {
+03702                         for(uint k = 0; k < it->second->Patchs.size(); ++k)
+03703                         {                                                                                                                                                       
+03704                                 it->second->Patchs[k].deleteTileUvs();
+03705                                 it->second->Patchs[k].recreateTileUvs();
+03706                         }
+03707                 }
+03708         }       
+03709         unlockBuffers();
+03710         updateTessBlocksFaceVector();   
+03711 }
+
+

+ + + + +
+ + + + + + + + + +
bool NL3D::CLandscape::isVegetableActive  )  const
+
+ + + + + +
+   + + +

+return if the vegetable management is actually activated: actually return _VerexShaderOk && _VegetableEnabled. +

+Definition at line 3168 of file landscape.cpp. +

+References _DriverOkForVegetable, and _VegetableManagerEnabled. +

+Referenced by NL3D::CPatch::appendTileMaterialToRenderList(), NL3D::CPatch::recreateAllVegetableIgs(), and render(). +

+

03169 {
+03170         return _VegetableManagerEnabled && _DriverOkForVegetable;
+03171 }
+
+

+ + + + +
+ + + + + + + + + + +
void NL3D::CLandscape::linkPatchToNearUL CPatch patch  )  [private]
+
+ + + + + +
+   + + +

+Used by Patch to link/unlink from _ULRootNearPatch. +

+ +

+Definition at line 3394 of file landscape.cpp. +

+References _ULRootNearPatch, and NL3D::CPatch::linkBeforeNearUL(). +

+Referenced by NL3D::CPatch::addRefTessBlocks(). +

+

03395 {
+03396         // Append this patch to the list of patch to updateLighting.
+03397         if(_ULRootNearPatch==NULL)
+03398                 _ULRootNearPatch= patch;
+03399         else
+03400                 patch->linkBeforeNearUL(_ULRootNearPatch);
+03401 }
+
+

+ + + + +
+ + + + + + + + + + +
void NL3D::CLandscape::loadTile uint16  tileId  )  [private]
+
+ + + + + +
+   + + +

+ +

+Definition at line 1670 of file landscape.cpp. +

+References findTileRdrPass(), findTileTexture(), NL3D::CTileBank::getAbsPath(), NL3D::CTile::getRelativeFileName(), NL3D::CTile::getRotAlpha(), NL3D::CTileBank::getTile(), NL3D::CTileBank::getTileCount(), nlassert, nldebug, NL3D::CPatchRdrPass::TextureAlpha, NL3D::CPatchRdrPass::TextureDiffuse, TileBank, TileInfos, and uint16. +

+Referenced by flushTiles(), and getTileRenderPass(). +

+

01671 {
+01672         CTile           *tile;
+01673         CTileInfo       *tileInfo;
+01674         string          textName;
+01675 
+01676         // Retrieve or create texture.
+01677         // ===========================
+01678         // Tile Must exist.
+01679         // nlassert(tileId==0xFFFF || tileId<TileBank.getTileCount());
+01680         if(tileId<TileBank.getTileCount())
+01681                 tile= TileBank.getTile(tileId);
+01682         else
+01683                 tile= NULL;
+01684         // TileInfo must not exist.
+01685         nlassert(TileInfos[tileId]==NULL);
+01686         TileInfos[tileId]= tileInfo= new CTileInfo;
+01687 
+01688         // Fill additive part.
+01689         // ===================
+01690         if(tile)
+01691                 textName= tile->getRelativeFileName(CTile::additive);
+01692         else
+01693                 textName= "";
+01694         // If no additive for this tile, rdrpass is NULL.
+01695         if(textName=="")
+01696                 tileInfo->AdditiveRdrPass= NULL;
+01697         else
+01698         {
+01699                 // Fill rdrpass.
+01700                 CPatchRdrPass   pass;
+01701                 pass.TextureDiffuse= findTileTexture(TileBank.getAbsPath()+textName);
+01702 
+01703                 // We may have an alpha part for additive.
+01704                 textName= tile->getRelativeFileName (CTile::alpha);
+01705                 if(textName!="")
+01706                         pass.TextureAlpha= findTileTexture(TileBank.getAbsPath()+textName);
+01707 
+01708                 // Fill tileInfo.
+01709                 tileInfo->AdditiveRdrPass= findTileRdrPass(pass);
+01710                 // Fill UV Info.
+01711                 // NB: for now, One Tile== One Texture, so UVScaleBias is simple.
+01712                 tileInfo->AdditiveUvScaleBias.x= 0;
+01713                 tileInfo->AdditiveUvScaleBias.y= 0;
+01714                 tileInfo->AdditiveUvScaleBias.z= 1;
+01715         }
+01716 
+01717 
+01718         // Fill diffuse part.
+01719         // =======================
+01720         // Fill rdrpass.
+01721         CPatchRdrPass   pass;
+01722         // The diffuse part for a tile is inevitable.
+01723         if(tile)
+01724         {
+01725                 textName= tile->getRelativeFileName(CTile::diffuse);
+01726                 if(textName!="")
+01727                         pass.TextureDiffuse= findTileTexture(TileBank.getAbsPath()+textName);
+01728                 else
+01729                 {
+01730                         pass.TextureDiffuse= new CTextureCross;
+01731                         nldebug("Missing Tile diffuse texname: %d", tileId);
+01732                 }
+01733         }
+01734         else
+01735                 pass.TextureDiffuse= new CTextureCross;
+01736         if(tile)
+01737         {
+01738                 textName= tile->getRelativeFileName (CTile::alpha);
+01739                 if(textName!="")
+01740                         pass.TextureAlpha= findTileTexture(TileBank.getAbsPath()+textName);
+01741         }
+01742 
+01743 
+01744         // Fill tileInfo.
+01745         tileInfo->DiffuseRdrPass= findTileRdrPass(pass);
+01746         // Fill UV Info.
+01747         // NB: for now, One Tile== One Texture, so UVScaleBias is simple.
+01748         tileInfo->DiffuseUvScaleBias.x= 0;
+01749         tileInfo->DiffuseUvScaleBias.y= 0;
+01750         tileInfo->DiffuseUvScaleBias.z= 1;
+01751         tileInfo->AlphaUvScaleBias.x= 0;
+01752         tileInfo->AlphaUvScaleBias.y= 0;
+01753         tileInfo->AlphaUvScaleBias.z= 1;
+01754         // Retrieve the good rot alpha decal.
+01755         if(tile)
+01756                 tileInfo->RotAlpha= tile->getRotAlpha();
+01757         else
+01758                 tileInfo->RotAlpha= 0;
+01759 
+01760 
+01761         // Increment RefCount of RenderPart.
+01762         // =================================
+01763         if(tileInfo->AdditiveRdrPass)
+01764                 tileInfo->AdditiveRdrPass->RefCount++;
+01765         if(tileInfo->DiffuseRdrPass)
+01766                 tileInfo->DiffuseRdrPass->RefCount++;
+01767 
+01768 }
+
+

+ + + + +
+ + + + + + + + + + +
void NL3D::CLandscape::loadVegetableTexture const std::string &  textureFileName  ) 
+
+ + + + + +
+   + + +

+load a texture for the vegetable, lookup in CPath +

+Definition at line 3174 of file landscape.cpp. +

+References _VegetableManager, and NL3D::CVegetableManager::loadTexture(). +

+Referenced by NL3D::CLandscapeUser::loadVegetableTexture(). +

+

03175 {
+03176         // load the texture in the manager
+03177         _VegetableManager->loadTexture(textureFileName);
+03178 }
+
+

+ + + + +
+ + + + + + + + + +
void NL3D::CLandscape::lockBuffers  )  [private]
+
+ + + + + +
+   + + +

+ +

+Definition at line 862 of file landscape.cpp. +

+References _Far0VB, _Far1VB, _TileVB, _VegetableManager, _VertexShaderOk, NL3D::CLandscapeVBAllocator::lockBuffer(), and NL3D::CVegetableManager::lockBuffers(). +

+Referenced by render(), and updateGlobalsAndLockBuffers(). +

+

00863 {
+00864         _Far0VB.lockBuffer(CLandscapeGlobals::CurrentFar0VBInfo);
+00865         _Far1VB.lockBuffer(CLandscapeGlobals::CurrentFar1VBInfo);
+00866         _TileVB.lockBuffer(CLandscapeGlobals::CurrentTileVBInfo);
+00867 
+00868         // lock buffer of the vegetable manager.
+00869         _VegetableManager->lockBuffers();
+00870 
+00871         // VertexProgrma mode???
+00872         CLandscapeGlobals::VertexProgramEnabled= _VertexShaderOk;
+00873 }
+
+

+ + + + +
+ + + + + + + + + +
CTessFace * NL3D::CLandscape::newTessFace  )  [private]
+
+ + + + + +
+   + + +

+ +

+Definition at line 3010 of file landscape.cpp. +

+References _RootNewLeaves, NLMISC::CBlockMemory< CTessFace >::allocate(), NL3D::CTessFacePListNode::linkInPList(), and TessFaceAllocator. +

+Referenced by NL3D::CPatch::makeRoots(), NL3D::CTessFace::split(), and NL3D::CTessFace::splitRectangular(). +

+

03011 {
+03012         // allcoate the face.
+03013         CTessFace               *face= TessFaceAllocator.allocate();
+03014 
+03015         // for refine() mgt, append the face to the list of newLeaves, so they will be tested in refine()
+03016         face->linkInPList(_RootNewLeaves);
+03017 
+03018         return face;
+03019 }
+
+

+ + + + +
+ + + + + + + + + +
CTessFarVertex * NL3D::CLandscape::newTessFarVertex  )  [private]
+
+ + + + + +
+   + + +

+ +

+Definition at line 3034 of file landscape.cpp. +

+References NLMISC::CBlockMemory< CTessFarVertex >::allocate(), and TessFarVertexAllocator. +

+Referenced by NL3D::CTessFace::split(), and NL3D::CTessFace::splitRectangular(). +

+

03035 {
+03036         return TessFarVertexAllocator.allocate();
+03037 }
+
+

+ + + + +
+ + + + + + + + + +
CTessNearVertex * NL3D::CLandscape::newTessNearVertex  )  [private]
+
+ + + + + +
+   + + +

+ +

+Definition at line 3028 of file landscape.cpp. +

+References NLMISC::CBlockMemory< CTessNearVertex >::allocate(), and TessNearVertexAllocator. +

+Referenced by NL3D::CTessFace::allocTileUv(). +

+

03029 {
+03030         return TessNearVertexAllocator.allocate();
+03031 }
+
+

+ + + + +
+ + + + + + + + + +
CTessVertex * NL3D::CLandscape::newTessVertex  )  [private]
+
+ + + + + +
+   + + +

+ +

+Definition at line 3022 of file landscape.cpp. +

+References NLMISC::CBlockMemory< CTessVertex >::allocate(), and TessVertexAllocator. +

+Referenced by NL3D::CTessFace::split(), NL3D::CTessFace::splitRectangular(), and NL3D::CTessFace::unbind(). +

+

03023 {
+03024         return TessVertexAllocator.allocate();
+03025 }
+
+

+ + + + +
+ + + + + + + + + +
CTileFace * NL3D::CLandscape::newTileFace  )  [private]
+
+ + + + + +
+   + + +

+ +

+Definition at line 3046 of file landscape.cpp. +

+References NLMISC::CBlockMemory< CTileFace >::allocate(), and TileFaceAllocator. +

+Referenced by NL3D::CTessFace::buildTileFaces(). +

+

03047 {
+03048         return TileFaceAllocator.allocate();
+03049 }
+
+

+ + + + +
+ + + + + + + + + +
CTileMaterial * NL3D::CLandscape::newTileMaterial  )  [private]
+
+ + + + + +
+   + + +

+ +

+Definition at line 3040 of file landscape.cpp. +

+References NLMISC::CBlockMemory< CTileMaterial >::allocate(), and TileMaterialAllocator. +

+

03041 {
+03042         return TileMaterialAllocator.allocate();
+03043 }
+
+

+ + + + +
+ + + + + + + + + +
void NL3D::CLandscape::profileRender  ) 
+
+ + + + + +
+   + + +

+This is especially for Pacs. Each Vertex->EndPos which is not a corner of a patch is set to the mean of its 2 shared Patchs. NB: Works with special cases of rectangular patchs and binded patchs. +

+Definition at line 2939 of file landscape.cpp. +

+Referenced by NL3D::CLandscapeModel::profileRender(). +

+

02940 {
+02941         // TODO yoyo: new Far mgt profile
+02942         /*
+02943         std::map<CVector2f, CTextureFarLevelInfo >      levelFarMap;
+02944 
+02945         nlinfo("***** Landscape TextureFar Profile. NumTextureFar= %d", _TextureFars.size());
+02946         // Profile Texture Allocate
+02947         ItSPRenderPassVector    itFar;
+02948         uint    totalMemUsage= 0;
+02949         for(itFar= _TextureFars.begin(); itFar!= _TextureFars.end(); itFar++)
+02950         {
+02951                 CPatchRdrPass   &pass= **itFar;
+02952                 CTextureFar *textureFar= safe_cast<CTextureFar*>((ITexture*)pass.TextureDiffuse);
+02953 
+02954                 // Info
+02955                 uint    memUsage= textureFar->getPatchWidth()*textureFar->getPatchHeight()*NL_NUM_FAR_PATCHES_BY_TEXTURE*2;
+02956                 nlinfo("  * Patch Texture Size: (%d,%d) => :%d bytes for %d patchs", 
+02957                         textureFar->getPatchWidth(), textureFar->getPatchHeight(), 
+02958                         memUsage, NL_NUM_FAR_PATCHES_BY_TEXTURE);
+02959                 totalMemUsage+= memUsage;
+02960 
+02961                 // Profile Texture Far Allocated
+02962                 nlinfo("  * NumberOf Patch in the texture:%d", textureFar->getPatchCount());
+02963 
+02964                 // Profile currently used Patchs
+02965                 uint    numRdrPatch= 0;
+02966                 CPatch  *pa= pass.getRdrPatchFar0();
+02967                 while(pa)
+02968                 {
+02969                         numRdrPatch++;
+02970                         pa= pa->getNextFar0ToRdr();
+02971                 }
+02972                 pa= pass.getRdrPatchFar1();
+02973                 while(pa)
+02974                 {
+02975                         numRdrPatch++;
+02976                         pa= pa->getNextFar1ToRdr();
+02977                 }
+02978                 nlinfo("  * NumberOf Patch in frustum for this texture (Far0+Far1):%d", numRdrPatch);
+02979 
+02980                 // regroup by level
+02981                 CVector2f       sizeLevel;
+02982                 sizeLevel.x= (float)textureFar->getPatchWidth();
+02983                 sizeLevel.y= (float)textureFar->getPatchHeight();
+02984                 levelFarMap[sizeLevel].NumUsedPatchs+= textureFar->getPatchCount();
+02985                 levelFarMap[sizeLevel].NumTextures++;
+02986         }
+02987 
+02988         nlinfo("***** Landscape TextureFar Level Profile. TotalVideoMemory= %d", totalMemUsage);
+02989         std::map<CVector2f, CTextureFarLevelInfo >::iterator    itLevelFar= levelFarMap.begin();
+02990         while(itLevelFar!=levelFarMap.end())
+02991         {
+02992                 nlinfo("  * Level PatchSize: (%d, %d). Total NumberOf Patch: %d. Use Percentage: %d %%", 
+02993                         (uint)itLevelFar->first.x, (uint)itLevelFar->first.y, itLevelFar->second.NumUsedPatchs, 
+02994                         100*itLevelFar->second.NumUsedPatchs/(itLevelFar->second.NumTextures*NL_NUM_FAR_PATCHES_BY_TEXTURE) );
+02995                 
+02996                 itLevelFar++;
+02997         }
+02998         */
+02999 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
void NL3D::CLandscape::receiveShadowMap IDriver drv,
CShadowMap shadowMap,
const CVector casterPos,
const CMaterial shadowMat,
const CVector pzb
+
+ + + + + +
+   + + +

+ +

+Definition at line 3681 of file landscape.cpp. +

+References _ShadowPolyReceiver, and NL3D::CShadowPolyReceiver::render(). +

+Referenced by NL3D::CLandscapeModel::receiveShadowMap(). +

+

03682 {
+03683         /*  substract the PZB from all coordinates. Must add a small Height value because 
+03684                 The rendered Triangles may be computed with VertexProgram, but _ShadowPolyReceiver 
+03685                 does not. => there is a small float difference at the end
+03686                 Even if same vertex is produced in theory, VertexProgram may cause 2 precision problems:
+03687                 1/ On NVidia, even with a simple matrix mul VP, the precision result is not the same
+03688                 2/ Our Landscape VP is not a simple matrix mul. Lot of vertex mul/add are done fpr geomorphs
+03689         */
+03690         _ShadowPolyReceiver.render(drv, const_cast<CMaterial&>(shadowMat), shadowMap, casterPos, CVector(0,0,0.02f)-pzb);
+03691 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
void NL3D::CLandscape::refillTileLightMap uint  tileLightMapId,
CRGBA  map[NL_TILE_LIGHTMAP_SIZE *NL_TILE_LIGHTMAP_SIZE]
[private]
+
+ + + + + +
+   + + +

+ +

+Definition at line 2048 of file landscape.cpp. +

+References _TextureNears, NL3D::NbTileLightMapByTexture, nlassert, NL3D::CTextureNear::refillRect(), NL3D::CPatchRdrPass::TextureDiffuse, and uint. +

+Referenced by NL3D::CPatch::updateTessBlockLighting(). +

+

02049 {
+02050         uint    id, textNum;
+02051 
+02052         // Get the id local in the texture.
+02053         textNum= tileLightMapId / NbTileLightMapByTexture;
+02054         id= tileLightMapId % NbTileLightMapByTexture;
+02055         nlassert(textNum>=0 && textNum<_TextureNears.size());
+02056 
+02057         // get a ptr on the texture.
+02058         CPatchRdrPass   *nearRdrPass= _TextureNears[textNum];
+02059         CTextureNear    *nearText= (CTextureNear*)(ITexture*)nearRdrPass->TextureDiffuse;
+02060 
+02061         // refill this tile
+02062         nearText->refillRect(id, map);
+02063 }
+
+

+ + + + +
+ + + + + + + + + + +
void NL3D::CLandscape::refine const CVector refineCenter  ) 
+
+ + + + + +
+   + + +

+Refine/Geomorph the tesselation of the landscape. +

+Definition at line 605 of file landscape.cpp. +

+References _MergePriorityList, _OldRefineCenter, _OldRefineCenterSetuped, _RefineMode, _RootNewLeaves, _SplitPriorityList, _VegetableBlockList, _VegetableManager, NL3D::CTessFacePListNode::appendPList(), NL3D::CTessList< CLandscapeVegetableBlock >::begin(), H_AUTO, NL3D::CTessNodeList::Next, NL3D::CTessFacePListNode::nextInPList(), NL3D_PROFILE_LAND_ADD, NL3D_PROFILE_LAND_SET, NLMISC::OptFastFloorBegin(), NLMISC::OptFastFloorEnd(), NL3D::ProfNMerges, NL3D::ProfNRefineComputeFaces, NL3D::ProfNRefineFaces, NL3D::ProfNRefineInTileTransition, NL3D::ProfNRefineLeaves, NL3D::ProfNRefineWithLowDistance, NL3D::ProfNSplits, NL3D::ProfNSplitsPass, NL3D::CTessFacePriorityList::shift(), NL3D::CTessFacePriorityList::shiftAll(), unlockBuffers(), NL3D::CLandscapeVegetableBlock::update(), updateGlobalsAndLockBuffers(), NL3D::CVegetableManager::updateLighting(), NL3D::CTessFace::updateRefineMerge(), NL3D::CTessFace::updateRefineSplit(), and updateTessBlocksFaceVector(). +

+Referenced by NL3D::CLandscapeModel::clipAndRenderLandscape(). +

+

00606 {
+00607         NL3D_PROFILE_LAND_SET(ProfNRefineFaces, 0);
+00608         NL3D_PROFILE_LAND_SET(ProfNRefineComputeFaces, 0);
+00609         NL3D_PROFILE_LAND_SET(ProfNRefineLeaves, 0);
+00610         NL3D_PROFILE_LAND_SET(ProfNSplits, 0);
+00611         NL3D_PROFILE_LAND_SET(ProfNMerges, 0);
+00612         NL3D_PROFILE_LAND_SET(ProfNRefineInTileTransition, 0);
+00613         NL3D_PROFILE_LAND_SET(ProfNRefineWithLowDistance, 0);
+00614         NL3D_PROFILE_LAND_SET(ProfNSplitsPass, 0);
+00615 
+00616         if(!_RefineMode)
+00617                 return;
+00618 
+00619         // Update the priority list.
+00620         // ==========================
+00621         CTessFacePListNode              rootSplitTessFaceToUpdate;
+00622         CTessFacePListNode              rootMergeTessFaceToUpdate;
+00623         if( !_OldRefineCenterSetuped )
+00624         {
+00625                 // If never refine, and setup OldRefineCetner
+00626                 _OldRefineCenterSetuped= true;
+00627                 _OldRefineCenter= refineCenter;
+00628 
+00629                 // then shift all faces
+00630                 _SplitPriorityList.shiftAll(rootSplitTessFaceToUpdate);
+00631                 _MergePriorityList.shiftAll(rootMergeTessFaceToUpdate);
+00632         }
+00633         else
+00634         {
+00635                 // else, compute delta between positions
+00636                 CVector         diff= refineCenter - _OldRefineCenter;
+00637                 _OldRefineCenter= refineCenter;
+00638 
+00639                 // and shift according to distance of deplacement.
+00640                 _SplitPriorityList.shift(diff, rootSplitTessFaceToUpdate);
+00641                 _MergePriorityList.shift(diff, rootMergeTessFaceToUpdate);
+00642         }
+00643 
+00644 
+00645         // Refine Faces which may need it.
+00646         // ==========================
+00647         // Update globals
+00648         updateGlobalsAndLockBuffers (refineCenter);
+00649         // NB: refine may change vertices in VB in visible patchs => buffers are locked.
+00650 
+00651         // Increment the update date.
+00652         CLandscapeGlobals::CurrentDate++;
+00653 
+00654         // Because CTessFacePriorityList::insert use it.
+00655         NLMISC::OptFastFloorBegin();
+00656 
+00657         /* While there is still face in list, update them
+00658                 NB: updateRefine() always insert the face in _***PriorityList, so face is removed from 
+00659                 root***TessFaceToUpdate list.
+00660                 NB: it is possible ( with enforced merge() ) that faces dissapears from root***TessFaceToUpdate list 
+00661                 before they are traversed here. It is why we must use a Circular list system, and not an array of elements.
+00662                 Basically. TessFaces are ALWAYS in a list, either in one of the entry list in _***PriorityList, or in
+00663                 root***TessFaceToUpdate list.
+00664 
+00665                 It is newTessFace() and deleteTessFace() which insert/remove the nodes in the list.
+00666         */
+00667         // Update the Merge priority list.
+00668         while( rootMergeTessFaceToUpdate.nextInPList() != &rootMergeTessFaceToUpdate )
+00669         {
+00670                 // Get the face.
+00671                 CTessFace       *face= static_cast<CTessFace*>(rootMergeTessFaceToUpdate.nextInPList());
+00672 
+00673                 // update the refine of this face. This may lead in deletion (merge) of other faces which are still in 
+00674                 // root***TessFaceToUpdate, but it's work.
+00675                 face->updateRefineMerge();
+00676         }
+00677 
+00678 
+00679         // Update the Split priority list.
+00680         do
+00681         {
+00682                 NL3D_PROFILE_LAND_ADD(ProfNSplitsPass, 1);
+00683 
+00684                 // Append the new leaves, to the list of triangles to update
+00685                 rootSplitTessFaceToUpdate.appendPList(_RootNewLeaves);
+00686 
+00687                 // While triangle to test for split exists
+00688                 while( rootSplitTessFaceToUpdate.nextInPList() != &rootSplitTessFaceToUpdate )
+00689                 {
+00690                         // Get the face.
+00691                         CTessFace       *face= static_cast<CTessFace*>(rootSplitTessFaceToUpdate.nextInPList());
+00692 
+00693                         // update the refine of this face.
+00694                         face->updateRefineSplit();
+00695                 }
+00696 
+00697         }
+00698         // do it until we are sure no more split is needed, ie no more faces are created
+00699         while( _RootNewLeaves.nextInPList() != &_RootNewLeaves );
+00700 
+00701         // Because CTessFacePriorityList::insert use it.
+00702         NLMISC::OptFastFloorEnd();
+00703 
+00704 
+00705         // Before unlockBuffers, test for vegetable IG creation.
+00706         {
+00707                 H_AUTO( NL3D_Vegetable_Update );
+00708 
+00709                 // Because CLandscapeVegetableBlock::update() use OptFastFloor..
+00710                 NLMISC::OptFastFloorBegin();
+00711 
+00712                 // For each vegetableBlock, test IG creation
+00713                 CLandscapeVegetableBlock        *vegetBlock= _VegetableBlockList.begin();
+00714                 for(;vegetBlock!=NULL; vegetBlock= (CLandscapeVegetableBlock*)vegetBlock->Next)
+00715                 {
+00716                         vegetBlock->update(refineCenter, _VegetableManager);
+00717                 }
+00718 
+00719                 // update lighting for vegetables
+00720                 _VegetableManager->updateLighting();
+00721 
+00722                 // Stop fastFloor optim.
+00723                 NLMISC::OptFastFloorEnd();
+00724         }
+00725 
+00726 
+00727         // Must realase VB Buffers
+00728         unlockBuffers();
+00729 
+00730         // refine() may cause change in faces in visible patchs.
+00731         updateTessBlocksFaceVector();
+00732 
+00733 }
+
+

+ + + + +
+ + + + + + + + + + +
void NL3D::CLandscape::refineAll const CVector refineCenter  ) 
+
+ + + + + +
+   + + +

+Refine/Geomorph ALL the tesselation of the landscape, from the view point refineCenter. Even if !RefineMode. +

+ +

+Definition at line 737 of file landscape.cpp. +

+References NL3D::ItZoneMap, unlockBuffers(), updateGlobalsAndLockBuffers(), updateTessBlocksFaceVector(), and Zones. +

+Referenced by NL3D::CZoneLighter::addTriangles(), NL3D::CInstanceLighter::addTriangles(), and NL3D::CZoneLighter::buildZoneInformation(). +

+

00738 {
+00739         // -1. Update globals
+00740         updateGlobalsAndLockBuffers (refineCenter);
+00741         // NB: refineAll may change vertices in VB in visible patchs => buffers are locked.
+00742 
+00743         // Increment the update date.
+00744         CLandscapeGlobals::CurrentDate++;
+00745 
+00746         for(ItZoneMap it= Zones.begin();it!=Zones.end();it++)
+00747         {
+00748                 (*it).second->refineAll();
+00749         }
+00750 
+00751         // Must realase VB Buffers
+00752         unlockBuffers();
+00753 
+00754         // refineAll() may cause change in faces in visible patchs.
+00755         updateTessBlocksFaceVector();
+00756 }
+
+

+ + + + +
+ + + + + + + + + + +
void NL3D::CLandscape::releaseTile uint16  tileId  )  [private]
+
+ + + + + +
+   + + +

+ +

+Definition at line 1772 of file landscape.cpp. +

+References NL3D::CLandscape::CTileInfo::AdditiveRdrPass, NL3D::CLandscape::CTileInfo::DiffuseRdrPass, nlassert, NL3D::CPatchRdrPass::RefCount, TileInfos, and uint16. +

+Referenced by releaseTiles(). +

+

01773 {
+01774         CTileInfo       *tileInfo;
+01775         tileInfo= TileInfos[tileId];
+01776         nlassert(tileInfo!=NULL);
+01777 
+01778         // "Release" the rdr pass.
+01779         if(tileInfo->AdditiveRdrPass)
+01780                 tileInfo->AdditiveRdrPass->RefCount--;
+01781         if(tileInfo->DiffuseRdrPass)
+01782                 tileInfo->DiffuseRdrPass->RefCount--;
+01783 
+01784         delete tileInfo;
+01785         TileInfos[tileId]= NULL;
+01786 }
+
+

+ + + + +
+ + + + + + + + + + +
void NL3D::CLandscape::releaseTileLightMap uint  tileLightMapId  )  [private]
+
+ + + + + +
+   + + +

+ +

+Definition at line 2026 of file landscape.cpp. +

+References _NFreeLightMaps, _TextureNears, _ULTotalNearPixels, NL3D::NbTileLightMapByTexture, NL_TILE_LIGHTMAP_SIZE, nlassert, NL3D::CTextureNear::releaseTile(), NL3D::CPatchRdrPass::TextureDiffuse, and uint. +

+Referenced by NL3D::CPatch::releaseTileLightMap(). +

+

02027 {
+02028         uint    id, textNum;
+02029 
+02030         // Get the id local in the texture.
+02031         textNum= tileLightMapId / NbTileLightMapByTexture;
+02032         id= tileLightMapId % NbTileLightMapByTexture;
+02033         nlassert(textNum>=0 && textNum<_TextureNears.size());
+02034 
+02035         // Release the tile in this texture.
+02036         CPatchRdrPass   *nearRdrPass= _TextureNears[textNum];
+02037         CTextureNear    *nearText= (CTextureNear*)(ITexture*)nearRdrPass->TextureDiffuse;
+02038         nearText->releaseTile(id);
+02039         _NFreeLightMaps++;
+02040 
+02041         // updateLighting
+02042         // Decrement number of pixels to update for near.
+02043         _ULTotalNearPixels-= NL_TILE_LIGHTMAP_SIZE*NL_TILE_LIGHTMAP_SIZE;
+02044 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
void NL3D::CLandscape::releaseTiles uint16  tileStart,
uint16  nbTiles
+
+ + + + + +
+   + + +

+Force a range of tiles to be loaded in the driver... +

+ +

+Definition at line 1912 of file landscape.cpp. +

+References ItTileRdrPassSet, releaseTile(), sint, TileInfos, TileRdrPassSet, and uint16. +

+Referenced by initTileBank(). +

+

01913 {
+01914         // release tiles.
+01915         for(sint tileId= tileStart; tileId<tileStart+nbTiles; tileId++)
+01916         {
+01917                 CTileInfo       *tile= TileInfos[tileId];
+01918                 if(tile!=NULL)
+01919                 {
+01920                         releaseTile(tileId);
+01921                 }
+01922         }
+01923 
+01924         // For all rdrpass, release one that are no more referenced.
+01925         ItTileRdrPassSet        it;
+01926         for(it= TileRdrPassSet.begin(); it!=TileRdrPassSet.end();)
+01927         {
+01928                 // If no more tile access the rdrpass, delete it.
+01929                 if((*it).RefCount==0)
+01930                 {
+01931                         ItTileRdrPassSet itDel=it++;
+01932                         TileRdrPassSet.erase(itDel);
+01933                 }
+01934                 else
+01935                         it++;
+01936         }
+01937 
+01938         // Textures are automaticly deleted by smartptr, but not their entry int the map (TileTextureMap). 
+01939         // => doesn't matter since findTileTexture() manages this case.
+01940         // And the memory overhead is not a problem (we talk about pointers).
+01941 }
+
+

+ + + + +
+ + + + + + + + + +
void NL3D::CLandscape::removeAllPointLights  ) 
+
+ + + + + +
+   + + +

+This method remove all PointLights in all Zones, and hence reset TileLightInfluences. +

+Definition at line 3298 of file landscape.cpp. +

+References NL3D::ItZoneMap, NL3D::CPatch::resetTileLightInfluences(), sint, and Zones. +

+

03299 {
+03300         for(ItZoneMap it= Zones.begin();it!=Zones.end();it++)
+03301         {
+03302                 // for all patch.
+03303                 sint    N= (*it).second->getNumPatchs();
+03304                 for(sint i=0;i<N;i++)
+03305                 {
+03306                         // Clear TileLightInfluences
+03307                         CPatch  *pa= ((*it).second)->getPatch(i);
+03308                         pa->resetTileLightInfluences();
+03309                 }
+03310 
+03311                 // Remove all PointLights.
+03312                 (*it).second->_PointLightArray.clear();
+03313         }
+03314 
+03315 }
+
+

+ + + + +
+ + + + + + + + + + +
void NL3D::CLandscape::removeFromShadowPolyReceiver CTessFace face  )  [private]
+
+ + + + + +
+   + + +

+ +

+Definition at line 3669 of file landscape.cpp. +

+References _ShadowPolyReceiver, NL3D::CShadowPolyReceiver::removeTriangle(), and NL3D::CTessFace::ShadowMapTriId. +

+Referenced by NL3D::CPatch::removeFaceFromTileRenderList(). +

+

03670 {
+03671         if(face->ShadowMapTriId!=-1)
+03672         {
+03673                 _ShadowPolyReceiver.removeTriangle(face->ShadowMapTriId);
+03674                 // set NULL Id.
+03675                 face->ShadowMapTriId=-1;
+03676         }
+03677 }
+
+

+ + + + +
+ + + + + + + + + + +
bool NL3D::CLandscape::removeZone uint16  zoneId  ) 
+
+ + + + + +
+   + + +

+remove a zone by its unique Id. The zone is release()-ed (disconnected), then deleted.

Parameters:
+ + +
zoneId the zone to be removed.
+
+
Returns:
true if OK, false otherwise. As example, Fail if zone is not connected.
+ +

+Definition at line 447 of file landscape.cpp. +

+References _PatchQuadGrid, NL3D::CQuadGrid< CPatchIdentEx >::begin(), NL3D::CQuadGrid< CPatchIdentEx >::clearSelection(), NL3D::CQuadGrid< CPatchIdentEx >::end(), NL3D::CQuadGrid< CPatchIdentEx >::erase(), NLMISC::CAABBoxExt::getAABBox(), NLMISC::CAABBox::getHalfSize(), NLMISC::CAABBox::getMax(), NLMISC::CAABBox::getMin(), NL3D::CZone::getNumPatchs(), NL3D::CZone::getZoneBB(), NL3D::CZone::getZoneId(), nlassert, NL3D::CZone::release(), NL3D::CQuadGrid< CPatchIdentEx >::select(), NLMISC::CAABBox::setHalfSize(), sint, uint16, unlockBuffers(), updateGlobalsAndLockBuffers(), updateTessBlocksFaceVector(), and Zones. +

+Referenced by clear(), NL3D::CLandscapeUser::refreshZonesAround(), and NL3D::CLandscapeUser::removeAllZones(). +

+

00448 {
+00449         // -1. Update globals
+00450         updateGlobalsAndLockBuffers (CVector::Null);
+00451         // NB: remove a zone may change vertices in VB in visible patchs => buffers are locked.
+00452 
+00453         // find the zone.
+00454         if(Zones.find(zoneId)==Zones.end())
+00455         {
+00456                 unlockBuffers();
+00457                 return false;
+00458         }
+00459         CZone   *zone= Zones[zoneId];
+00460 
+00461 
+00462         // delete patchs from this zone to the quadgrid.
+00463         // use the quadgrid itself to find where patch are. do this using bbox of zone.
+00464         CAABBox zoneBBForErase= zone->getZoneBB().getAABBox();
+00465         // Avoid precision problems by enlarging a little bbox size of zone for erase
+00466         zoneBBForErase.setHalfSize( zoneBBForErase.getHalfSize() * 1.1f);
+00467         // select iterators in the area of this zone.
+00468         _PatchQuadGrid.clearSelection();
+00469         _PatchQuadGrid.select(zoneBBForErase.getMin(), zoneBBForErase.getMax());
+00470         // for each patch, remove it if from deleted zone.
+00471         CQuadGrid<CPatchIdentEx>::CIterator     it;
+00472         sint    nPatchRemoved= 0;
+00473         for(it= _PatchQuadGrid.begin(); it!= _PatchQuadGrid.end();)
+00474         {
+00475                 // if the patch belong to the zone to remove
+00476                 if( (*it).ZoneId== zone->getZoneId() )
+00477                 {
+00478                         // remove from the quadgrid.
+00479                         it= _PatchQuadGrid.erase(it);
+00480                         nPatchRemoved++;
+00481                 }
+00482                 else
+00483                         it++;
+00484         }
+00485         // verify we have removed all patch in the quadGrid for this zone
+00486         nlassert(nPatchRemoved==zone->getNumPatchs());
+00487 
+00488 
+00489         // remove the zone.
+00490         zone->release(Zones);
+00491         delete zone;
+00492 
+00493         // Must realase VB Buffers
+00494         unlockBuffers();
+00495 
+00496         // because of forceMerge() at unbind, removeZone() can cause change in faces in other (visible) zones.
+00497         updateTessBlocksFaceVector();
+00498 
+00499         return true;
+00500 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
void NL3D::CLandscape::render const CVector refineCenter,
const CVector frontVector,
const CPlane  pyramid[NL3D_TESSBLOCK_NUM_CLIP_PLANE],
bool  doTileAddPass = false
+
+ + + + + +
+   + + +

+Render the landscape. A more precise clip is made on TessBlocks. pyramid should be the same as one passed to clip(). For optimisation, this pyramid should contains only the Left/Right and Top/Bottom clip planes, in this order.

Parameters:
+ + + +
refineCenter should be the position of the camera
frontVector should be the J vector of the camera
+
+ +

+Definition at line 939 of file landscape.cpp. +

+References _DLMGlobalVegetableColor, _Far0VB, _Far1VB, _PatchDLMContextList, _PointLightDiffuseMaterial, _PZBModelPosition, _RenderMustRefillVB, _TextureDLM, _TextureFars, _TextureNears, _TileVB, _VegetableManager, _VertexShaderOk, _VPThresholdChange, NL3D::CLandscapeVBAllocator::activate(), NLMISC::CRGBA::B, NL3D::CTessList< CPatchDLMContext >::begin(), NL3D::CPatchRdrPass::clearAllRenderList(), NL3D::CPatchDLMContext::compileLighting(), NL3D::CPatch::computeSoftwareGeomorphAndAlpha(), NL3D::drawPassTriArray(), FarMaterial, NL3D::CPatch::fillVBIfVisible(), NLMISC::CRGBA::G, NL3D::CPatch::getFar0(), NL3D::CPatch::getFar1(), NL3D::CRdrTileId::getNext(), NL3D::CPatch::getNextFar0ToRdr(), NL3D::CPatch::getNextFar1ToRdr(), NL3D::CPatchDLMContext::getPatch(), NL3D::CPatchRdrPass::getRdrPatchFar0(), NL3D::CPatchRdrPass::getRdrPatchFar1(), NL3D::CPatchRdrPass::getRdrTileRoot(), NL3D::CMaterial::getTexEnvMode(), NL3D::CPatch::getTileMaterialRefCount(), H_AFTER, H_BEFORE, NL3D::initPassTriArray(), NL3D::CPatch::isRenderClipped(), isVegetableActive(), ItSPRenderPassVector, ItTileRdrPassSet, NL3D::ItZoneMap, lockBuffers(), min, NL3D::CTessNodeList::Next, NL3D::NL3D_LandscapeGlobals_PassNTri, NL3D_MAX_TILE_PASS, NL3D_PROFILE_LAND_SET, NL3D_TESSBLOCK_NUM_CLIP_PLANE, NL3D_TILE_PASS_ADD, NL3D_TILE_PASS_LIGHTMAP, NL3D_TILE_PASS_RGB0, NL3D_TILE_PASS_RGB1, NL3D_TILE_PASS_RGB2, nlassert, nlstop, NL3D::IDriver::profileSetupedMaterials(), NL3D::ProfNFar0SetupMaterial, NL3D::ProfNFar1SetupMaterial, NL3D::ProfNPatchRdrFar0, NL3D::ProfNPatchRdrFar1, NL3D::ProfNRdrFar0, NL3D::ProfNRdrFar1, NL3D::ProfNRdrTile, NL3D::ProfNTileSetupMaterial, NLMISC::CRGBA::R, NL3D::CLandscapeVBAllocator::reallocationOccurs(), NL3D::CVegetableManager::render(), NL3D::CPatch::renderFar0(), NL3D::CPatch::renderFar1(), NL3D::CTileMaterial::renderTile(), NL3D::CTileMaterial::renderTilePassLightmap(), NL3D::CTileMaterial::renderTilePassRGB0(), NL3D::CVegetableManager::resetNumVegetableFaceRendered(), NL3D::CLandscapeVBAllocator::resetReallocation(), NL3D::CMaterial::setBlend(), NL3D::CMaterial::setBlendFunc(), NL3D::IDriver::setConstant(), NL3D::IDriver::setConstantMatrix(), NL3D::CMaterial::setTexEnvMode(), NL3D::CMaterial::setTexture(), sint, synchronizeATIVBHards(), NL3D::CMaterial::texConstantColor(), NL3D::CMaterial::texEnvArg0Alpha(), NL3D::CMaterial::texEnvArg0RGB(), NL3D::CMaterial::texEnvArg1Alpha(), NL3D::CMaterial::texEnvArg1RGB(), NL3D::CMaterial::texEnvOpAlpha(), NL3D::CMaterial::texEnvOpRGB(), NL3D::CPatchRdrPass::TextureAlpha, NL3D::CPatchRdrPass::TextureDiffuse, NL3D::CRdrTileId::TileMaterial, TileMaterial, TileRdrPassSet, uint, uint8, unlockBuffers(), updateGlobalsAndLockBuffers(), v, and Zones. +

+Referenced by NL3D::CLandscapeModel::clipAndRenderLandscape(). +

+

00940 {
+00941         IDriver *driver= _Driver;
+00942         nlassert(driver);
+00943 
+00944         // Increment the update date for preRender.
+00945         CLandscapeGlobals::CurrentRenderDate++;
+00946 
+00947 
+00948         ItZoneMap       it;
+00949         sint            i;
+00950         ItTileRdrPassSet                itTile;
+00951         ItSPRenderPassVector    itFar;
+00952 
+00953         // Yoyo: profile.
+00954         NL3D_PROFILE_LAND_SET(ProfNRdrFar0, 0);
+00955         NL3D_PROFILE_LAND_SET(ProfNRdrFar1, 0);
+00956         NL3D_PROFILE_LAND_SET(ProfNPatchRdrFar0, 0);
+00957         NL3D_PROFILE_LAND_SET(ProfNPatchRdrFar1, 0);
+00958         for(i=0;i<NL3D_MAX_TILE_PASS;i++)
+00959         {
+00960                 NL3D_PROFILE_LAND_SET(ProfNRdrTile[i], 0);
+00961         }
+00962 
+00963 
+00964         // -2. Update globals
+00965         //====================
+00966         updateGlobalsAndLockBuffers (refineCenter);
+00967         // NB: render may change vertices in VB in visible patchs => buffers are locked.
+00968 
+00969 
+00970         // -1. clear all PatchRenderPass renderList
+00971         //===================
+00972 
+00973         H_BEFORE( NL3D_Landscape_Render_Clear );
+00974 
+00975         // Fars.
+00976         for(itFar= _TextureFars.begin(); itFar!= _TextureFars.end(); itFar++)
+00977         {
+00978                 CPatchRdrPass   &pass= **itFar;
+00979                 // clear list.
+00980                 pass.clearAllRenderList();
+00981         }
+00982 
+00983         // Tiles.
+00984         for(itTile= TileRdrPassSet.begin(); itTile!= TileRdrPassSet.end(); itTile++)
+00985         {
+00986                 CPatchRdrPass   &pass= const_cast<CPatchRdrPass&>(*itTile);
+00987                 // clear list.
+00988                 pass.clearAllRenderList();
+00989         }
+00990 
+00991         // Lightmaps.
+00992         for(sint lightRdrPass=0; lightRdrPass<(sint)_TextureNears.size(); lightRdrPass++)
+00993         {
+00994                 CPatchRdrPass   &pass= *_TextureNears[lightRdrPass];
+00995                 // clear list.
+00996                 pass.clearAllRenderList();
+00997         }
+00998 
+00999         H_AFTER( NL3D_Landscape_Render_Clear );
+01000 
+01001         // 0. preRender pass.
+01002         //===================
+01003 
+01004         H_BEFORE( NL3D_Landscape_Render_PreRender );
+01005 
+01006         // change Far0 / Far1.
+01007         // Clip TessBlocks against pyramid and Far Limit.
+01008         for(i=0; i<NL3D_TESSBLOCK_NUM_CLIP_PLANE; i++)
+01009         {
+01010                 CTessBlock::CurrentPyramid[i]= pyramid[i];
+01011         }
+01012         // Update VB with change of Far0 / Far1.
+01013         for(it= Zones.begin();it!=Zones.end();it++)
+01014         {
+01015                 (*it).second->preRender();
+01016         }
+01017 
+01018         H_AFTER( NL3D_Landscape_Render_PreRender );
+01019         H_BEFORE( NL3D_Landscape_Render_Refill );
+01020 
+01021         // Reallocation Mgt. If any of the VB is reallocated, we must refill it entirely.
+01022         // NB: all VBs are refilled entirely. It is not optimal (maybe 3* too slow), but reallocation are supposed
+01023         // to be very rare.
+01024         if( _Far0VB.reallocationOccurs() || _Far1VB.reallocationOccurs() || _TileVB.reallocationOccurs() )
+01025                 _RenderMustRefillVB= true;
+01026 
+01027         // VertexProgram dependency on RefineThreshold Management. If VertexShader, and if the refineThreshold has
+01028         // changed since the last time, we must refill All the VB, because data are out of date.
+01029         if( _VertexShaderOk && _VPThresholdChange )
+01030         {
+01031                 _VPThresholdChange= false;
+01032                 _RenderMustRefillVB= true;
+01033         }
+01034 
+01035         // If we must refill the VB (for any reason).
+01036         if(_RenderMustRefillVB )
+01037         {
+01038                 // Ok, ok, we refill All the VB with good data.
+01039                 _RenderMustRefillVB= false;
+01040 
+01041                 // First reset the flag, so fillVB() will effectively fill the VB.
+01042                 _Far0VB.resetReallocation();
+01043                 _Far1VB.resetReallocation();
+01044                 _TileVB.resetReallocation();
+01045 
+01046                 // Then recompute good VBInfo (those in CurrentVBInfo are false!!).
+01047                 // Do it by unlocking then re-locking Buffers.
+01048                 unlockBuffers();
+01049                 lockBuffers();
+01050 
+01051                 // Finally, fill the VB for all patchs visible.
+01052                 for(it= Zones.begin();it!=Zones.end();it++)
+01053                 {
+01054                         if((*it).second->ClipResult==CZone::ClipOut)
+01055                                 continue;
+01056                         for(sint i=0;i<(*it).second->getNumPatchs(); i++)
+01057                         {
+01058                                 CPatch  *patch= (*it).second->getPatch(i);
+01059                                 patch->fillVBIfVisible();
+01060                         }
+01061                 }
+01062         }
+01063 
+01064         H_AFTER( NL3D_Landscape_Render_Refill );
+01065         H_BEFORE( NL3D_Landscape_Render_SoftGeomorph );
+01066 
+01067         // If software GeoMorph / Alpha Transition (no VertexShader), do it now.
+01068         if(!_VertexShaderOk)
+01069         {
+01070                 // For all patch visible, compute geomoprh and alpha in software.
+01071                 for(it= Zones.begin();it!=Zones.end();it++)
+01072                 {
+01073                         if((*it).second->ClipResult==CZone::ClipOut)
+01074                                 continue;
+01075                         for(sint i=0;i<(*it).second->getNumPatchs(); i++)
+01076                         {
+01077                                 CPatch  *patch= (*it).second->getPatch(i);
+01078                                 // If visible, compute Geomorph And Alpha
+01079                                 patch->computeSoftwareGeomorphAndAlpha();
+01080                         }
+01081                 }
+01082 
+01083                 /*
+01084                         Optim note: here, lot of vertices are 
+01085                                 1/ geomorphed twice (vertices on edges of patchs)
+01086                                 2/ vertices are geomorphed, but not used (because o the Tessblock clip), 
+01087                                         because lot of vertices used by faces in small TessBlocks are still in MasterBlock.
+01088 
+01089                         Some tries have been made to solve this, but result are even worse (2 times or more), because:
+01090                                 1/
+01091                                         - does not really matter edges of patchs (and corner) because the majority is in interior of patch.
+01092                                         - in this case, we need to reset all the flags which is very costly (reparse all zones...) .
+01093                                 2/ Except for the old CTessBlockEdge management which not solve all the thing, the other solution is
+01094                                         to test all faces not clipped (on a per TessBlock basis), to compute only vertices needed.
+01095                                         But in this cases, result are worse, maybe because there is 6 times more tests, and with bad BTB cache.
+01096                 */
+01097         }
+01098 
+01099         H_AFTER( NL3D_Landscape_Render_SoftGeomorph );
+01100 
+01101         // Must realase VB Buffers Now!! The VBuffers are now OK!
+01102         // NB: no parallelism is made between 3dCard and Fill of vertices.
+01103         // We Suppose Fill of vertices is rare, and so do not need to be parallelized.
+01104         unlockBuffers();
+01105 
+01106 
+01107         // Special for ATI: only copy all VBs to VBHard one time per frame
+01108         synchronizeATIVBHards();
+01109 
+01110 
+01111         // If VertexShader enabled, setup VertexProgram Constants.
+01112         if(_VertexShaderOk)
+01113         {
+01114                 // c[0..3] take the ModelViewProjection Matrix.
+01115                 driver->setConstantMatrix(0, IDriver::ModelViewProjection, IDriver::Identity);
+01116                 // c[4] take usefull constants.
+01117                 driver->setConstant(4, 0, 1, 0.5f, 0);
+01118                 // c[5] take RefineCenter
+01119                 driver->setConstant(5, refineCenter);
+01120                 // c[6] take info for Geomorph trnasition to TileNear.
+01121                 driver->setConstant(6, CLandscapeGlobals::TileDistFarSqr, CLandscapeGlobals::OOTileDistDeltaSqr, 0, 0);
+01122                 // c[8..11] take the ModelView Matrix.
+01123                 driver->setConstantMatrix(8, IDriver::ModelView, IDriver::Identity);
+01124                 // c[12] take the current landscape Center / delta Pos to apply
+01125                 driver->setConstant(12, _PZBModelPosition);
+01126         }
+01127 
+01128 
+01129         // 1. TileRender pass.
+01130         //====================
+01131 
+01132         // Yoyo: profile
+01133         NL3D_PROFILE_LAND_SET(ProfNTileSetupMaterial, driver->profileSetupedMaterials() );
+01134         H_BEFORE( NL3D_Landscape_Render_Tile );
+01135 
+01136         // First, update Dynamic Lighting for Near, ie multiply Dynamic Lightmap with UserColor, and upload to texture.
+01137         // ==================
+01138         CPatchDLMContext        *dlmCtxPtr= _PatchDLMContextList->begin();
+01139         while(dlmCtxPtr!=NULL)
+01140         {
+01141                 // do it only if the patch has some Near stuff to render, and if it is visible
+01142                 if(dlmCtxPtr->getPatch()->getFar0() == 0
+01143                          && !dlmCtxPtr->getPatch()->isRenderClipped() )
+01144                 {
+01145                         // upload lightmap into textureDLM, modulating before with patch TileColor.
+01146                         // NB: no-op if both src and dst are already full black.
+01147                         dlmCtxPtr->compileLighting(CPatchDLMContext::ModulateTileColor);
+01148                 }
+01149 
+01150                 // next
+01151                 dlmCtxPtr= (CPatchDLMContext*)dlmCtxPtr->Next;
+01152         }
+01153 
+01154 
+01155         // Active VB.
+01156         // ==================
+01157 
+01158         // Active the good VB, and maybe activate the VertexProgram Nb 0.
+01159         _TileVB.activate(0);
+01160 
+01161 
+01162         // Render.
+01163         // ==================
+01164         // Before any render call. Set the global driver used to render.
+01165         CLandscapeGlobals::PatchCurrentDriver= driver;
+01166 
+01167         // Render Order. Must "invert", since initial order is NOT the render order. This is done because the lightmap pass
+01168         // DO NOT have to do any renderTile(), since it is computed in RGB0 pass.
+01169         nlassert(NL3D_MAX_TILE_PASS==5);
+01170         static  sint    RenderOrder[NL3D_MAX_TILE_PASS]= {NL3D_TILE_PASS_RGB0, NL3D_TILE_PASS_RGB1, NL3D_TILE_PASS_RGB2,
+01171                 NL3D_TILE_PASS_LIGHTMAP, NL3D_TILE_PASS_ADD};
+01172         // For ALL pass..
+01173         for(i=0; i<NL3D_MAX_TILE_PASS; i++)
+01174         {
+01175                 sint    passOrder= RenderOrder[i];
+01176 
+01177 
+01178                 // If VertexShader enabled, and if lightmap or post Add pass, must setup good VertexProgram
+01179                 if(_VertexShaderOk)
+01180                 {
+01181                         if(passOrder == NL3D_TILE_PASS_LIGHTMAP)
+01182                         {
+01183                                 // Must activate the vertexProgram to take TexCoord2 to stage0
+01184                                 _TileVB.activate(1);
+01185                         }
+01186                         else if(passOrder == NL3D_TILE_PASS_ADD)
+01187                         {
+01188                                 // Must re-activate the standard VertexProgram
+01189                                 _TileVB.activate(0);
+01190                         }
+01191                 }
+01192 
+01193 
+01194                 // Do add pass???
+01195                 if((passOrder==NL3D_TILE_PASS_ADD) && !doTileAddPass)
+01196                         continue;
+01197 
+01198 
+01199                 // Setup common material for this pass.
+01200                 //=============================
+01201                 // Default: Replace envmode.
+01202                 TileMaterial.texEnvOpRGB(0, CMaterial::Replace);
+01203                 TileMaterial.texEnvArg0RGB(0, CMaterial::Texture, CMaterial::SrcColor);
+01204                 TileMaterial.texEnvOpAlpha(0, CMaterial::Replace);
+01205                 TileMaterial.texEnvArg0Alpha(0, CMaterial::Texture, CMaterial::SrcAlpha);
+01206                 // NB: important to set Replace and not modulate, because in case of VerexProgram enabled, 
+01207                 // Diffuse o[COL0] is undefined.
+01208 
+01209                 // Copy from stage 0 to stage 1.
+01210                 TileMaterial.setTexEnvMode(1, TileMaterial.getTexEnvMode(0));
+01211 
+01212                 // setup multitex / blending.
+01213                 if(passOrder==NL3D_TILE_PASS_RGB0)
+01214                 {
+01215                         // first pass, no blend.
+01216                         TileMaterial.setBlend(false);
+01217                 }
+01218                 else
+01219                 {
+01220                         TileMaterial.setBlend(true);
+01221                         switch(passOrder)
+01222                         {
+01223                                 case NL3D_TILE_PASS_RGB1: 
+01224                                 case NL3D_TILE_PASS_RGB2: 
+01225                                         // alpha blending.
+01226                                         TileMaterial.setBlendFunc(CMaterial::srcalpha, CMaterial::invsrcalpha);
+01227 
+01228                                         // Must use a special envmode for stage1: "separateAlpha"!!.
+01229                                         // keep the color from previous stage.
+01230                                         TileMaterial.texEnvOpRGB(1, CMaterial::Replace);
+01231                                         TileMaterial.texEnvArg0RGB(1, CMaterial::Previous, CMaterial::SrcColor);
+01232                                         // take the alpha from current stage.
+01233                                         TileMaterial.texEnvOpAlpha(1, CMaterial::Replace);
+01234                                         TileMaterial.texEnvArg0Alpha(1, CMaterial::Texture, CMaterial::SrcAlpha);
+01235                                         break;
+01236                                 case NL3D_TILE_PASS_LIGHTMAP: 
+01237                                         // modulate alpha blending.
+01238                                         TileMaterial.setBlendFunc(CMaterial::zero, CMaterial::srccolor);
+01239 
+01240                                         // Setup the material envCombine so DynamicLightmap (stage 0) is added to static lightmap.
+01241                                         TileMaterial.texEnvOpRGB(1, CMaterial::Add);
+01242                                         TileMaterial.texEnvArg0RGB(1, CMaterial::Texture, CMaterial::SrcColor);
+01243                                         TileMaterial.texEnvArg1RGB(1, CMaterial::Previous, CMaterial::SrcColor);
+01244 
+01245                                         break;
+01246                                 case NL3D_TILE_PASS_ADD: 
+01247                                         // Use srcalpha for src (and not ONE), since additive are blended with alpha Cte/AlphaTexture
+01248                                         TileMaterial.setBlendFunc(CMaterial::srcalpha, CMaterial::one);
+01249 
+01250                                         // for MAYBE LATER smooth night transition, setup Alpha cte of stage0, and setup alpha stage.
+01251                                         TileMaterial.texEnvOpAlpha(0, CMaterial::Replace);
+01252                                         TileMaterial.texEnvArg0Alpha(0, CMaterial::Constant, CMaterial::SrcAlpha);
+01253                                         // Temp, just setup alpha to 1.
+01254                                         TileMaterial.texConstantColor(0, CRGBA(255, 255, 255, 255));
+01255 
+01256                                         // Must use a special envmode for stage1: "separateAlpha"!!.
+01257                                         // NB: it still works if The RdrPass has no texture.
+01258                                         // keep the color from previous stage.
+01259                                         TileMaterial.texEnvOpRGB(1, CMaterial::Replace);
+01260                                         TileMaterial.texEnvArg0RGB(1, CMaterial::Previous, CMaterial::SrcColor);
+01261                                         // modulate the alpha of current stage with previous
+01262                                         TileMaterial.texEnvOpAlpha(1, CMaterial::Modulate);
+01263                                         TileMaterial.texEnvArg0Alpha(1, CMaterial::Texture, CMaterial::SrcAlpha);
+01264                                         TileMaterial.texEnvArg1Alpha(1, CMaterial::Previous, CMaterial::SrcAlpha);
+01265 
+01266                                         break;
+01267                                 default: 
+01268                                         nlstop;
+01269                         };
+01270                 }
+01271                 // Reset the textures (so there is none in Addtive pass or in Lightmap).
+01272                 TileMaterial.setTexture(0, NULL);
+01273                 TileMaterial.setTexture(1, NULL);
+01274                 TileMaterial.setTexture(2, NULL);
+01275 
+01276 
+01277                 // Render All material RdrPass.
+01278                 //=============================
+01279                 // Special code for Lightmap and RGB0, for faster render.
+01280                 if(passOrder==NL3D_TILE_PASS_RGB0)
+01281                 {
+01282                         // RGB0 pass.
+01283                         ItTileRdrPassSet        itTile;
+01284                         for(itTile= TileRdrPassSet.begin(); itTile!= TileRdrPassSet.end(); itTile++)
+01285                         {
+01286                                 // Get a ref on the render pass. Const cast work because we only modify attribut from CPatchRdrPass 
+01287                                 // that don't affect the operator< of this class
+01288                                 CPatchRdrPass   &pass= const_cast<CPatchRdrPass&>(*itTile);
+01289 
+01290                                 // Enlarge PassTriArray as needed
+01291                                 initPassTriArray(pass);
+01292 
+01293                                 // Setup Diffuse texture of the tile.
+01294                                 TileMaterial.setTexture(0, pass.TextureDiffuse);
+01295 
+01296                                 // Add triangles to array
+01297                                 CRdrTileId              *tileToRdr= pass.getRdrTileRoot(passOrder);
+01298                                 while(tileToRdr)
+01299                                 {
+01300                                         // renderSimpleTriangles() with the material setuped.
+01301                                         tileToRdr->TileMaterial->renderTilePassRGB0();
+01302                                         tileToRdr= (CRdrTileId*)tileToRdr->getNext();
+01303                                 }
+01304                                 // Render triangles.
+01305                                 drawPassTriArray(TileMaterial);
+01306                         }
+01307                 }
+01308                 else if(passOrder==NL3D_TILE_PASS_LIGHTMAP)
+01309                 {
+01310                         // Lightmap Pass.
+01311                         /* \todo yoyo: TODO_CLOUD: setup stage2, and setup texcoord generation. COMPLEX because of interaction
+01312                          with Dynamic LightMap
+01313                         */
+01314 
+01315                         // Setup the Dynamic Lightmap into stage 0.
+01316                         TileMaterial.setTexture(0, _TextureDLM);
+01317 
+01318                         // if vertex shader not used.
+01319                         if(!_VertexShaderOk)
+01320                         {
+01321                                 // special setup  such that stage0 takes Uv2.
+01322                                 driver->mapTextureStageToUV(0, 2);
+01323                         }
+01324                         // else VertexProgram map itself the good vertex Attribute to UV0.
+01325 
+01326 
+01327                         // Render All the lightmaps.
+01328                         for(sint lightRdrPass=0; lightRdrPass<(sint)_TextureNears.size(); lightRdrPass++)
+01329                         {
+01330                                 CPatchRdrPass   &pass= *_TextureNears[lightRdrPass];
+01331 
+01332                                 // Enlarge PassTriArray as needed
+01333                                 initPassTriArray(pass);
+01334 
+01335                                 // Setup Lightmap into stage1. Because we share UV with pass RGB0. So we use UV1.
+01336                                 // Also, now stage0 is used for DynamicLightmap
+01337                                 TileMaterial.setTexture(1, pass.TextureDiffuse);
+01338 
+01339                                 // Add triangles to array
+01340                                 CRdrTileId              *tileToRdr= pass.getRdrTileRoot(passOrder);
+01341                                 while(tileToRdr)
+01342                                 {
+01343                                         // renderSimpleTriangles() with the material setuped.
+01344                                         tileToRdr->TileMaterial->renderTilePassLightmap();
+01345                                         tileToRdr= (CRdrTileId*)tileToRdr->getNext();
+01346                                 }
+01347                                 // Render triangles.
+01348                                 drawPassTriArray(TileMaterial);
+01349                         }
+01350 
+01351                         // if vertex shader not used.
+01352                         if(!_VertexShaderOk)
+01353                         {
+01354                                 // Reset special stage/UV setup to normal behavior
+01355                                 driver->mapTextureStageToUV(0, 0);
+01356                         }
+01357                 }
+01358                 else
+01359                 {
+01360                         // RGB1, RGB2, and ADD pass.
+01361 
+01362                         // Render Base, Transitions or Additives.
+01363 
+01364                         ItTileRdrPassSet        itTile;
+01365                         for(itTile= TileRdrPassSet.begin(); itTile!= TileRdrPassSet.end(); itTile++)
+01366                         {
+01367                                 // Get a ref on the render pass. Const cast work because we only modify attribut from CPatchRdrPass 
+01368                                 // that don't affect the operator< of this class
+01369                                 CPatchRdrPass   &pass= const_cast<CPatchRdrPass&>(*itTile);
+01370 
+01371                                 // Enlarge PassTriArray as needed
+01372                                 initPassTriArray(pass);
+01373 
+01374                                 // Add triangles to array
+01375                                 CRdrTileId              *tileToRdr= pass.getRdrTileRoot(passOrder);
+01376                                 while(tileToRdr)
+01377                                 {
+01378                                         // renderSimpleTriangles() with the material setuped.
+01379                                         tileToRdr->TileMaterial->renderTile(passOrder);
+01380                                         tileToRdr= (CRdrTileId*)tileToRdr->getNext();
+01381                                 }
+01382 
+01383                                 // Pass not empty ?
+01384                                 if(NL3D_LandscapeGlobals_PassNTri>0)
+01385                                 {
+01386                                         // Setup material.
+01387                                         // Setup Diffuse texture of the tile.
+01388                                         TileMaterial.setTexture(0, pass.TextureDiffuse);
+01389                                         
+01390                                         // If transition tile, must enable the alpha for this pass.
+01391                                         // NB: Additive pass may have pass.TextureAlpha==NULL
+01392                                         TileMaterial.setTexture(1, pass.TextureAlpha);
+01393                                 }
+01394 
+01395                                 // Render triangles.
+01396                                 drawPassTriArray(TileMaterial);
+01397                         }
+01398                 }
+01399         }
+01400 
+01401         // Yoyo: profile
+01402         NL3D_PROFILE_LAND_SET(ProfNTileSetupMaterial, driver->profileSetupedMaterials()-ProfNTileSetupMaterial );
+01403         H_AFTER( NL3D_Landscape_Render_Tile );
+01404 
+01405         // 2. Far0Render pass.
+01406         //====================
+01407 
+01408         // Yoyo: profile
+01409         NL3D_PROFILE_LAND_SET(ProfNFar0SetupMaterial, driver->profileSetupedMaterials() );
+01410         H_BEFORE( NL3D_Landscape_Render_DLM );
+01411 
+01412         // First, update Dynamic Lighting for Far, ie multiply Dynamic Lightmap with TextureFar, and upload to texture.
+01413         // ==================
+01414         dlmCtxPtr= _PatchDLMContextList->begin();
+01415         while(dlmCtxPtr!=NULL)
+01416         {
+01417                 // do it only if the patch has some Far stuff to render, and if it is visible
+01418                 if( (dlmCtxPtr->getPatch()->getFar0()>0 || dlmCtxPtr->getPatch()->getFar1()>0)
+01419                          && !dlmCtxPtr->getPatch()->isRenderClipped() )
+01420                 {
+01421                         // upload lightmap into textureDLM, modulating before with patch TextureFar.
+01422                         // NB: no-op if both src and dst are already full black.
+01423                         dlmCtxPtr->compileLighting(CPatchDLMContext::ModulateTextureFar);
+01424                 }
+01425 
+01426                 // next
+01427                 dlmCtxPtr= (CPatchDLMContext*)dlmCtxPtr->Next;
+01428         }
+01429 
+01430         H_AFTER( NL3D_Landscape_Render_DLM );
+01431         H_BEFORE( NL3D_Landscape_Render_Far0 );
+01432 
+01433         // Active VB.
+01434         // ==================
+01435 
+01436         // Active the good VB, and maybe activate the std VertexProgram.
+01437         _Far0VB.activate(0);
+01438 
+01439 
+01440         // Render.
+01441         // ==================
+01442 
+01443         // Setup common material.
+01444         FarMaterial.setBlend(false);
+01445         // set the DLM texture.
+01446         FarMaterial.setTexture(1, _TextureDLM);
+01447 
+01448         // Render All material RdrPass0.
+01449         itFar=_TextureFars.begin();
+01450         while (itFar!=_TextureFars.end())
+01451         {
+01452                 CPatchRdrPass   &pass= **itFar;
+01453 
+01454                 // Enlarge PassTriArray as needed
+01455                 initPassTriArray(pass);
+01456 
+01457                 // Setup the material.
+01458                 FarMaterial.setTexture(0, pass.TextureDiffuse);
+01459                 // If the texture need to be updated, do it now.
+01460                 if(pass.TextureDiffuse && pass.TextureDiffuse->touched())
+01461                         driver->setupTexture(*pass.TextureDiffuse);
+01462 
+01463                 // Add triangles to array
+01464                 CPatch          *patchToRdr= pass.getRdrPatchFar0();
+01465                 while(patchToRdr)
+01466                 {
+01467                         // renderSimpleTriangles() with the material setuped.
+01468                         patchToRdr->renderFar0();
+01469                         patchToRdr= patchToRdr->getNextFar0ToRdr();
+01470                 }
+01471                 // Render triangles.
+01472                 drawPassTriArray(FarMaterial);
+01473 
+01474                 // Next render pass
+01475                 itFar++;
+01476         }
+01477 
+01478         // Yoyo: profile
+01479         NL3D_PROFILE_LAND_SET(ProfNFar0SetupMaterial, driver->profileSetupedMaterials()-ProfNFar0SetupMaterial );
+01480         H_AFTER( NL3D_Landscape_Render_Far0 );
+01481 
+01482 
+01483         // 3. Far1Render pass.
+01484         //====================
+01485 
+01486         // Yoyo: profile
+01487         NL3D_PROFILE_LAND_SET(ProfNFar1SetupMaterial, driver->profileSetupedMaterials() );
+01488         H_BEFORE( NL3D_Landscape_Render_Far1 );
+01489 
+01490         // Active VB.
+01491         // ==================
+01492 
+01493         // Active the good VB, and maybe activate the std VertexProgram.
+01494         _Far1VB.activate(0);
+01495 
+01496 
+01497         // Render
+01498         // ==================
+01499 
+01500         // Setup common material.
+01501         FarMaterial.setBlend(true);
+01502         // set the DLM texture.
+01503         FarMaterial.setTexture(1, _TextureDLM);
+01504 
+01505 
+01506         // Render All material RdrPass1.
+01507         itFar=_TextureFars.begin();
+01508         while (itFar!=_TextureFars.end())
+01509         {
+01510                 CPatchRdrPass   &pass= **itFar;
+01511 
+01512                 // Enlarge PassTriArray as needed
+01513                 initPassTriArray(pass);
+01514 
+01515                 // Setup the material.
+01516                 FarMaterial.setTexture(0, pass.TextureDiffuse);
+01517                 // If the texture need to be updated, do it now.
+01518                 if(pass.TextureDiffuse && pass.TextureDiffuse->touched())
+01519                         driver->setupTexture(*pass.TextureDiffuse);
+01520 
+01521                 // Add triangles to array
+01522                 CPatch          *patchToRdr= pass.getRdrPatchFar1();
+01523                 while(patchToRdr)
+01524                 {
+01525                         // renderSimpleTriangles() with the material setuped.
+01526                         patchToRdr->renderFar1();
+01527                         patchToRdr= patchToRdr->getNextFar1ToRdr();
+01528                 }
+01529                 // Render triangles.
+01530                 drawPassTriArray(FarMaterial);
+01531 
+01532                 // Next render pass
+01533                 itFar++;
+01534         }
+01535 
+01536         // Yoyo: profile
+01537         NL3D_PROFILE_LAND_SET(ProfNFar1SetupMaterial, driver->profileSetupedMaterials()-ProfNFar1SetupMaterial );
+01538         H_AFTER( NL3D_Landscape_Render_Far1 );
+01539 
+01540 
+01541         // 4. "Release" texture materials.
+01542         //================================
+01543         FarMaterial.setTexture(0, NULL);
+01544         FarMaterial.setTexture(1, NULL);
+01545         FarMaterial.setTexture(2, NULL);
+01546         FarMaterial.setTexture(3, NULL);
+01547         TileMaterial.setTexture(0, NULL);
+01548         TileMaterial.setTexture(1, NULL);
+01549         TileMaterial.setTexture(2, NULL);
+01550         TileMaterial.setTexture(3, NULL);
+01551 
+01552         // To ensure no use but in render()..
+01553         CLandscapeGlobals::PatchCurrentDriver= NULL;
+01554 
+01555         // Desactive the vertex program (if anyone)
+01556         if(_VertexShaderOk)
+01557                 driver->activeVertexProgram (NULL);
+01558 
+01559 
+01560         // 5. Vegetable Management.
+01561         //================================
+01562 
+01563         // First, update Dynamic Lighting for Vegetable, ie just copy.
+01564         // ==================
+01565         if(isVegetableActive())
+01566         {
+01567                 /* Actually we modulate the DLM with an arbitrary constant for this reason:
+01568                         Color of vegetable (ie their material) are NOT modulated with DLM.
+01569                         Doing this without using PixelShader / additional UVs seems to be impossible.
+01570                         And add new UVs (+700K in AGP) just for this is not worth the effort.
+01571 
+01572                         We prefer using a constant to simulate the "global vegetable color", which is a big trick.
+01573 
+01574                         Additionally, the vegetable take the diffuse lighting of landscape, which is
+01575                         false because it replaces the diffuse lighting it should have (ie with his own Normal and 
+01576                         his own "global vegetable color")
+01577 
+01578                         We can't do anything for "correct normal vegetable", but it is possible to replace landscape
+01579                         material with vegetable material, by dividing _DLMGlobalVegetableColor by LandscapeDiffuseMaterial.
+01580                         This is a very approximate result because of CRGBA clamp, but it is acceptable.
+01581                 */
+01582                 CRGBA   vegetDLMCte;
+01583                 // the constant is _DLMGlobalVegetableColor / PointLightDiffuseMaterial
+01584                 uint    v;
+01585                 v= (_DLMGlobalVegetableColor.R*256) / (_PointLightDiffuseMaterial.R+1);
+01586                 vegetDLMCte.R= (uint8)min(v, 255U);
+01587                 v= (_DLMGlobalVegetableColor.G*256) / (_PointLightDiffuseMaterial.G+1);
+01588                 vegetDLMCte.G= (uint8)min(v, 255U);
+01589                 v= (_DLMGlobalVegetableColor.B*256) / (_PointLightDiffuseMaterial.B+1);
+01590                 vegetDLMCte.B= (uint8)min(v, 255U);
+01591 
+01592                 // Parse all patch which have some vegetables
+01593                 dlmCtxPtr= _PatchDLMContextList->begin();
+01594                 while(dlmCtxPtr!=NULL)
+01595                 {
+01596                         // do it only if the patch has some vegetable stuff to render, and if it is visible
+01597                         // NB: we may have some vegetable stuff to render if the patch has some TileMaterial created.
+01598                         if(dlmCtxPtr->getPatch()->getTileMaterialRefCount()>0
+01599                                  && !dlmCtxPtr->getPatch()->isRenderClipped() )
+01600                         {
+01601                                 // NB: no-op if both src and dst are already full black.
+01602                                 dlmCtxPtr->compileLighting(CPatchDLMContext::ModulateConstant, vegetDLMCte);
+01603                         }
+01604 
+01605                         // next
+01606                         dlmCtxPtr= (CPatchDLMContext*)dlmCtxPtr->Next;
+01607                 }
+01608         }
+01609 
+01610 
+01611         // profile.
+01612         _VegetableManager->resetNumVegetableFaceRendered();
+01613 
+01614         // render all vegetables, only if driver support VertexProgram.
+01615         // ==================
+01616         if(isVegetableActive())
+01617         {
+01618                 // Use same plane as TessBlock for faster clipping.
+01619                 vector<CPlane>          vegetablePyramid;
+01620                 vegetablePyramid.resize(NL3D_TESSBLOCK_NUM_CLIP_PLANE);
+01621                 for(i=0;i<NL3D_TESSBLOCK_NUM_CLIP_PLANE;i++)
+01622                 {
+01623                         vegetablePyramid[i]= pyramid[i];
+01624                 }
+01625                 _VegetableManager->render(refineCenter, frontVector, vegetablePyramid, _TextureDLM, driver);
+01626         }
+01627 
+01628 }
+
+

+ + + + +
+ + + + + + + + + +
void NL3D::CLandscape::resetRenderFarAndDeleteVBFV  )  [private]
+
+ + + + + +
+   + + +

+ +

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

+References NL3D::ItZoneMap, and Zones. +

+Referenced by setTileNear(). +

+

00364 {
+00365         // For all patch of all zones.
+00366         for(ItZoneMap it= Zones.begin();it!=Zones.end();it++)
+00367         {
+00368                 ((*it).second)->resetRenderFarAndDeleteVBFV();
+00369         }
+00370 }
+
+

+ + + + +
+ + + + + + + + + + +
void NL3D::CLandscape::setDLMGlobalVegetableColor CRGBA  gvc  ) 
+
+ + + + + +
+   + + +

+For Vegetable Dynamic ligthing only: this is an approximate color of all vegetables. Default is (180, 180, 180). +

+Definition at line 3605 of file landscape.cpp. +

+References _DLMGlobalVegetableColor. +

+Referenced by NL3D::CLandscapeUser::setDLMGlobalVegetableColor(). +

+

03606 {
+03607         _DLMGlobalVegetableColor= gvc;
+03608 }
+
+

+ + + + +
+ + + + + + + + + + +
void NL3D::CLandscape::setDriver IDriver drv  ) 
+
+ + + + + +
+   + + +

+A driver is needed for VB allocation. The VB will be allocated only the first time the landscape is clipped. Because no VB are created for invisible patchs. call setDriver() before any clip(). +

+Definition at line 563 of file landscape.cpp. +

+References _DriverOkForVegetable, _VertexShaderOk, NL3D_LANDSCAPE_VEGETABLE_MAX_AGP_VERTEX_MAX, nlassert, and uint. +

+Referenced by NL3D::CLandscapeModel::clipAndRenderLandscape(). +

+

00564 {
+00565         nlassert(drv);
+00566         if(_Driver != drv)
+00567         {
+00568                 _Driver= drv;
+00569 
+00570                 // Does the driver support VertexShader???
+00571                 // only if VP supported by GPU.
+00572                 _VertexShaderOk= (_Driver->isVertexProgramSupported() && !_Driver->isVertexProgramEmulated());
+00573 
+00574 
+00575                 // Does the driver has sufficient requirements for Vegetable???
+00576                 // only if VP supported by GPU, and Only if max vertices allowed.
+00577                 _DriverOkForVegetable= _VertexShaderOk && (_Driver->getMaxVerticesByVertexBufferHard()>=(uint)NL3D_LANDSCAPE_VEGETABLE_MAX_AGP_VERTEX_MAX);
+00578 
+00579         }
+00580 }
+
+

+ + + + +
+ + + + + + + + + + +
void NL3D::CLandscape::setDynamicLightingMaxAttEnd float  maxAttEnd  ) 
+
+ + + + + +
+   + + +

+Set PointLight Max Attenuation End landscape support. Every pointLight AttEnd is clamped to this value. Default is 30.f. +

+Definition at line 3575 of file landscape.cpp. +

+References _DLMMaxAttEnd. +

+

03576 {
+03577         maxAttEnd= max(maxAttEnd, 1.f);
+03578         _DLMMaxAttEnd= maxAttEnd;
+03579 }
+
+

+ + + + +
+ + + + + + + + + + +
void NL3D::CLandscape::setHeightField const CHeightMap hf  ) 
+
+ + + + + +
+   + + +

+set the HeightField data. NB: take lot of place in memory. only one is possible. You should setup this heightfield around the zones which will be loaded. It is applied only when a zone is loaded, so you should setup it 2km around the user, each time you move too far from a previous place (eg 160m from last setup). +

+Definition at line 2784 of file landscape.cpp. +

+References _HeightField, NL3D::CHeightMap::getHeight(), NL3D::CHeightMap::getWidth(), NL3D::CHeightMap::getZ(), NL3D::CLandscape::CHeightField::Height, NL3D::CLandscape::CBezierPatchZ::makeInteriors(), NL3D::CLandscape::CHeightField::OOSizeX, NL3D::CLandscape::CHeightField::OOSizeY, NL3D::CHeightMap::OriginX, NL3D::CLandscape::CHeightField::OriginX, NL3D::CHeightMap::OriginY, NL3D::CLandscape::CHeightField::OriginY, sint, NL3D::CHeightMap::SizeX, NL3D::CLandscape::CHeightField::SizeX, NL3D::CHeightMap::SizeY, NL3D::CLandscape::CHeightField::SizeY, NL3D::CLandscape::CBezierPatchZ::Tangents, uint, v, NL3D::CLandscape::CBezierPatchZ::Vertices, w, NL3D::CLandscape::CHeightField::Width, x, y, and NL3D::CLandscape::CHeightField::ZPatchs. +

+Referenced by NL3D::CLandscapeUser::setHeightField(). +

+

02785 {
+02786         if(hf.getWidth()<2)
+02787                 return;
+02788         if(hf.getHeight()<2)
+02789                 return;
+02790 
+02791         // Fill basics.
+02792         _HeightField.OriginX= hf.OriginX;
+02793         _HeightField.OriginY= hf.OriginY;
+02794         _HeightField.SizeX= hf.SizeX;
+02795         _HeightField.SizeY= hf.SizeY;
+02796         _HeightField.OOSizeX= 1/hf.SizeX;
+02797         _HeightField.OOSizeY= 1/hf.SizeY;
+02798         uint    w= hf.getWidth()-1;
+02799         uint    h= hf.getHeight()-1;
+02800         _HeightField.Width= w;
+02801         _HeightField.Height= h;
+02802         _HeightField.ZPatchs.resize(w * h);
+02803 
+02804         // compute  patchs
+02805         sint    x,y;
+02806 
+02807         // compute vertices / tangents on each patch
+02808         for(y=0;y<(sint)h;y++)
+02809         {
+02810                 for(x=0;x<(sint)w;x++)
+02811                 {
+02812                         CBezierPatchZ   &paz= _HeightField.ZPatchs[y*w+x];
+02813                         // vertices.
+02814                         paz.Vertices[0]= hf.getZ(x, y);
+02815                         paz.Vertices[1]= hf.getZ(x, y+1);
+02816                         paz.Vertices[2]= hf.getZ(x+1, y+1);
+02817                         paz.Vertices[3]= hf.getZ(x+1, y);
+02818                 }
+02819         }
+02820 
+02821         // compute tangents
+02822         for(y=0;y<(sint)h;y++)
+02823         {
+02824                 for(x=0;x<(sint)w;x++)
+02825                 {
+02826                         CBezierPatchZ   &paz= _HeightField.ZPatchs[y*w+x];
+02827                         sint    tg;
+02828                         // For each tangent, what vertex (relative to x,y) we must take.
+02829                         struct  CDeltaPos
+02830                         {
+02831                                 sint    ox,oy;
+02832                                 sint    dx1,dy1;
+02833                                 sint    dx2,dy2;
+02834                         };
+02835                         static CDeltaPos        deltas[8]= {
+02836                                 {0,0, 0,1, 0,-1} ,
+02837                                 {0,1, 0,0, 0,2} ,
+02838                                 {0,1, 1,1, -1,1} ,
+02839                                 {1,1, 0,1, 2,1} ,
+02840                                 {1,1, 1,0, 1,2} ,
+02841                                 {1,0, 1,1, 1,-1} ,
+02842                                 {1,0, 0,0, 2,0} ,
+02843                                 {0,0, 1,0, -1,0} ,
+02844                                 };
+02845 
+02846                         // compute each tangent of this patch.
+02847                         for(tg=0; tg<8;tg++)
+02848                         {
+02849                                 sint    x0,y0;
+02850                                 sint    x1,y1;
+02851                                 sint    x2,y2;
+02852                                 x0= x+deltas[tg].ox; y0= y+deltas[tg].oy;
+02853                                 x1= x+deltas[tg].dx1; y1= y+deltas[tg].dy1;
+02854                                 x2= x+deltas[tg].dx2; y2= y+deltas[tg].dy2;
+02855 
+02856                                 // borders case.
+02857                                 if(x2<0 || x2>=(sint)hf.getWidth() || y2<0 || y2>=(sint)hf.getHeight())
+02858                                 {
+02859                                         float           v,dv;
+02860                                         // base of tangents.
+02861                                         v= hf.getZ(x0,y0);
+02862                                         // target tangents.
+02863                                         dv= hf.getZ(x1,y1) - v;
+02864                                         // result of tangent.
+02865                                         paz.Tangents[tg]= v+dv/3;
+02866                                 }
+02867                                 // middle case.
+02868                                 else
+02869                                 {
+02870                                         float           v,dv;
+02871                                         // base of tangents.
+02872                                         v= hf.getZ(x0,y0);
+02873                                         // target tangents.
+02874                                         dv= hf.getZ(x1,y1) - v;
+02875                                         // add mirror target tangent.
+02876                                         dv+= -(hf.getZ(x2,y2) - v);
+02877                                         dv/=2;
+02878                                         // result of tangent.
+02879                                         paz.Tangents[tg]= v+dv/3;
+02880                                 }
+02881                         }
+02882                 }
+02883         }
+02884 
+02885         // compute interiors.
+02886         for(y=0;y<(sint)h;y++)
+02887         {
+02888                 for(x=0;x<(sint)w;x++)
+02889                 {
+02890                         CBezierPatchZ   &paz= _HeightField.ZPatchs[y*w+x];
+02891                         paz.makeInteriors();
+02892                 }
+02893         }
+02894 
+02895 }
+
+

+ + + + +
+ + + + + + + + + + +
void NL3D::CLandscape::setNoiseMode bool  enabled  ) 
+
+ + + + + +
+   + + +

+Enable the noise or not. NB: only new tesselation computed is modified, so you should call it only at init time. +

+ +

+Definition at line 3100 of file landscape.cpp. +

+References _NoiseEnabled. +

+

03101 {
+03102         _NoiseEnabled= enable;
+03103 }
+
+

+ + + + +
+ + + + + + + + + + +
void NL3D::CLandscape::setPointLightDiffuseMaterial CRGBA  diffuse  ) 
+
+ + + + + +
+   + + +

+Setup the equivalent material diffuse component used for both Static and Dynamic PointLights. Default is White. +

+Definition at line 3612 of file landscape.cpp. +

+References _PointLightDiffuseMaterial. +

+Referenced by NL3D::CLandscapeUser::setPointLightDiffuseMaterial(). +

+

03613 {
+03614         _PointLightDiffuseMaterial= diffuse;
+03615 }
+
+

+ + + + +
+ + + + + + + + + + +
void NL3D::CLandscape::setPointLightFactor const CScene scene  ) 
+
+ + + + + +
+   + + +

+update the Light factor for all pointLights in All zones, according to scene LightGroups and AnimatedLights. +

+ +

+Definition at line 3319 of file landscape.cpp. +

+References NL3D::ItZoneMap, and Zones. +

+Referenced by NL3D::CLandscapeModel::traverseHrc(). +

+

03320 {
+03321         // Affect currently added zones.
+03322         for(ItZoneMap it= Zones.begin();it!=Zones.end();it++)
+03323         {
+03324                 (*it).second->_PointLightArray.setPointLightFactor(scene);
+03325         }
+03326 }
+
+

+ + + + +
+ + + + + + + + + + +
void NL3D::CLandscape::setPZBModelPosition const CVector pos  ) 
+
+ + + + + +
+   + + +

+Set the ModelPosition (for Precision ZBuffer purpose). NB: the model Pos may be floor-ed (for greater float precision). Should be setup to the camera position each frame.

+NB: if vertexProgram is used, it is as faster as before (because of geomorph done each frame, and because of VP MAD instruction). NB: if vertexProgram is not used, it is a little slower, because of the substraction. +

+Definition at line 2920 of file landscape.cpp. +

+References _PZBModelPosition. +

+Referenced by NL3D::CLandscapeModel::clipAndRenderLandscape(). +

+

02921 {
+02922         _PZBModelPosition= pos;
+02923 }
+
+

+ + + + +
+ + + + + + + + + + +
void NL3D::CLandscape::setRefineMode bool  enabled  )  [inline]
+
+ + + + + +
+   + + +

+ +

+Definition at line 206 of file landscape.h. +

+References _RefineMode. +

+

00206 {_RefineMode= enabled;}
+
+

+ + + + +
+ + + + + + + + + + +
void NL3D::CLandscape::setThreshold float  thre  ) 
+
+ + + + + +
+   + + +

+Set threshold for subdivsion quality. The lower is threshold, the more the landscape is subdivided. Default: 0.001. +

+ +

+Definition at line 318 of file landscape.cpp. +

+References _Threshold, and _VPThresholdChange. +

+Referenced by NL3D::CZoneLighter::addTriangles(), NL3D::CInstanceLighter::addTriangles(), NL3D::CZoneLighter::buildZoneInformation(), and NL3D::CLandscapeUser::setThreshold(). +

+

00319 {
+00320         thre= max(thre, 0.f);
+00321         if(thre != _Threshold)
+00322         {
+00323                 _Threshold= thre;
+00324                 _VPThresholdChange= true;
+00325         }
+00326 }
+
+

+ + + + +
+ + + + + + + + + + +
void NL3D::CLandscape::setTileCallback ULandscapeTileCallback cb  )  [inline]
+
+ + + + + +
+   + + +

+ +

+Definition at line 620 of file landscape.h. +

+References _TileCallback. +

+Referenced by NL3D::CLandscapeUser::setTileCallback(). +

+

00620 { _TileCallback = cb; } 
+
+

+ + + + +
+ + + + + + + + + + +
void NL3D::CLandscape::setTileMaxSubdivision uint  tileDiv  ) 
+
+ + + + + +
+   + + +

+Set Maximum Tile subdivision. Valid values must be in [0..4] (assert). Default is 0 (for now :) ). +

+ +

+Definition at line 344 of file landscape.cpp. +

+References _TileMaxSubdivision, forceMergeAtTileLevel(), nlassert, and uint. +

+Referenced by NL3D::CZoneLighter::addTriangles(), NL3D::CInstanceLighter::addTriangles(), NL3D::CZoneLighter::buildZoneInformation(), and NL3D::CLandscapeUser::setTileMaxSubdivision(). +

+

00345 {
+00346         nlassert(tileDiv>=0 && tileDiv<=4);
+00347 
+00348         if(tileDiv!=_TileMaxSubdivision)
+00349         {
+00350                 _TileMaxSubdivision= tileDiv;
+00351                 // Force at Tile==0. Nex refine will split correctly.
+00352                 forceMergeAtTileLevel();
+00353         }
+00354 }
+
+

+ + + + +
+ + + + + + + + + + +
void NL3D::CLandscape::setTileNear float  tileNear  ) 
+
+ + + + + +
+   + + +

+Set tile near distance. Default 50.f. maximized to length of Far alpha transition). +

+ +

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

+References _FarTransition, _TileDistNear, and resetRenderFarAndDeleteVBFV(). +

+Referenced by NL3D::CLandscapeUser::setTileNear(). +

+

00331 {
+00332         tileNear= max(tileNear, _FarTransition);
+00333 
+00334         if(tileNear!=_TileDistNear)
+00335         {
+00336                 _TileDistNear= tileNear;
+00337                 resetRenderFarAndDeleteVBFV();
+00338         }
+00339 
+00340 }
+
+

+ + + + +
+ + + + + + + + + + +
void NL3D::CLandscape::setupAutomaticLightDir const CVector lightDir  ) 
+
+ + + + + +
+   + + +

+For automatic near lightmap computing (if enabled): setup the lightdir

+

Parameters:
+ + +
lightDir is the direction of the light vector used for the lighting. NB: the vector is normalized.
+
+ +

+Definition at line 2690 of file landscape.cpp. +

+References _AutomaticLightDir, and NLMISC::CVector::normalize(). +

+

02691 {
+02692         _AutomaticLightDir= lightDir;
+02693         _AutomaticLightDir.normalize();
+02694 }
+
+

+ + + + +
+ + + + + + + + + + +
void NL3D::CLandscape::setupColorsFromTileFlags const NLMISC::CRGBA  colors[4]  ) 
+
+ + + + + +
+   + + +

+Debug purpose only : setup the colors of the patch of all the currently loaded zones so that it shows which tiles have vegetable disabled, or are above, below water. User provides a table with 4 colors for each state : color 0 = above water color 1 = underwater color 2 = intersect water color 3 = vegetable disabled +

+Definition at line 3238 of file landscape.cpp. +

+References Zones. +

+

03239 {
+03240         for (TZoneMap::iterator it = Zones.begin(); it != Zones.end(); ++it)
+03241         {
+03242                 it->second->setupColorsFromTileFlags(colors);
+03243         }
+03244 }
+
+

+ + + + +
+ + + + + + + + + + +
void NL3D::CLandscape::setUpdateLightingFrequency float  freq  ) 
+
+ + + + + +
+   + + +

+set the frequency of lighting update. If freq==1, ALL patchs are updated each second. e.g: if 1/20, then every 20 seconds, all patchs are updated. If you set 0, no update will be done at all (this is the default setup!!). +

+Definition at line 3386 of file landscape.cpp. +

+References _ULFrequency. +

+Referenced by NL3D::CLandscapeUser::setUpdateLightingFrequency(). +

+

03387 {
+03388         freq= max(freq, 0.f);
+03389         _ULFrequency= freq;
+03390 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
void NL3D::CLandscape::setupStaticLight const CRGBA diffuse,
const CRGBA ambiant,
float  multiply
+
+ + + + + +
+   + + +

+Setup the light color use for static illumination.

+

Parameters:
+ + + + +
diffuse is the color of the diffuse componante of the lighting.
ambiant is the color of the ambiante componante of the lighting.
multiply is the multiply factor. Final color is (diffuse*multiply*shading+ambiant*(1.0-shading))
+
+ +

+Definition at line 2650 of file landscape.cpp. +

+References _LightValue, NLMISC::CRGBA::A, NLMISC::CRGBA::B, NLMISC::clamp(), NLMISC::CRGBA::G, NLMISC::CRGBA::R, r, and sint. +

+Referenced by CLandscape(), and NL3D::CLandscapeUser::setupStaticLight(). +

+

02651 {
+02652         sint nMultiply=(sint)(256.f*multiply);
+02653         for (int i=0; i<256; i++)
+02654         {
+02655                 sint max=0;
+02656                 sint r=(((nMultiply*diffuse.R*i)>>8)+ambiant.R*(256-i))>>8; 
+02657                 if (r>max)
+02658                         max=r;
+02659                 sint g=(((nMultiply*diffuse.G*i)>>8)+ambiant.G*(256-i))>>8;
+02660                 if (g>max)
+02661                         max=g;
+02662                 sint b=(((nMultiply*diffuse.B*i)>>8)+ambiant.B*(256-i))>>8;
+02663                 if (b>max)
+02664                         max=b;
+02665                 // Not << 8 but << 7 because the _LightValue color table represent a ramp from 0 to 512
+02666                 r <<= 7;
+02667                 g <<= 7;
+02668                 b <<= 7;
+02669                 max=std::max(max, 256);
+02670                 r/=max;
+02671                 g/=max;
+02672                 b/=max;
+02673                 clamp (r, 0, 255);
+02674                 clamp (g, 0, 255);
+02675                 clamp (b, 0, 255);
+02676                 _LightValue[i].R=r;
+02677                 _LightValue[i].G=g;
+02678                 _LightValue[i].B=b;
+02679                 _LightValue[i].A=255;
+02680         }
+02681 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
void NL3D::CLandscape::setupVegetableLighting const CRGBA ambient,
const CRGBA diffuse,
const CVector directionalLight
+
+ + + + + +
+   + + +

+setup lighting ambient and diffuse for vegetable. +

+Definition at line 3181 of file landscape.cpp. +

+References _VegetableManager, and NL3D::CVegetableManager::setDirectionalLight(). +

+Referenced by NL3D::CLandscapeModel::clipAndRenderLandscape(), and NL3D::CLandscapeUser::setupVegetableLighting(). +

+

03182 {
+03183         // set the directional light to the manager
+03184         _VegetableManager->setDirectionalLight(ambient, diffuse, directionalLight);
+03185 }
+
+

+ + + + +
+ + + + + + + + + + +
void NL3D::CLandscape::setVegetableTime double  time  ) 
+
+ + + + + +
+   + + +

+set the vegetable manager Time (in seconds) NB: MOT stuff (called by CLandscapeModel), don't use it. +

+Definition at line 3196 of file landscape.cpp. +

+References _VegetableManager, and NL3D::CVegetableManager::setTime(). +

+Referenced by NL3D::CLandscapeModel::clipAndRenderLandscape(). +

+

03197 {
+03198         // setup vegetable manager
+03199         _VegetableManager->setTime(time);
+03200 }
+
+

+ + + + +
+ + + + + + + + + + +
void NL3D::CLandscape::setVegetableUpdateLightingFrequency float  freq  ) 
+
+ + + + + +
+   + + +

+set the frequency of Vegetable lighting update. If freq==1, ALL lighted igs are updated each second. e.g: if 1/20, then every 20 seconds, all Igs are updated. If you set 0, no update will be done at all (this is the default setup!!). +

+Definition at line 3232 of file landscape.cpp. +

+References _VegetableManager, and NL3D::CVegetableManager::setUpdateLightingFrequency(). +

+Referenced by NL3D::CLandscapeUser::setVegetableUpdateLightingFrequency(). +

+

03233 {
+03234         _VegetableManager->setUpdateLightingFrequency(freq);
+03235 }
+
+

+ + + + +
+ + + + + + + + + + +
void NL3D::CLandscape::setVegetableUpdateLightingTime double  time  ) 
+
+ + + + + +
+   + + +

+set the vegetable manager System Time (in seconds) for update lighting NB: MOT stuff (called by CLandscapeModel), don't use it. +

+Definition at line 3203 of file landscape.cpp. +

+References _VegetableManager, and NL3D::CVegetableManager::setUpdateLightingTime(). +

+Referenced by NL3D::CLandscapeModel::clipAndRenderLandscape(). +

+

03204 {
+03205         // setup vegetable manager
+03206         _VegetableManager->setUpdateLightingTime(time);
+03207 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
void NL3D::CLandscape::setVegetableWind const CVector windDir,
float  windFreq,
float  windPower,
float  windBendMin
+
+ + + + + +
+   + + +

+set the vegetable Wind for animation. All thoses variables may be modified each frame without penalty.

+

Parameters:
+ + + + + +
windDir is the direction of the wind. NB: only XY direction is kept.
windFreq is the frequency for the animation (speed)
windPower is the power of the wind, and is a factor (0..1) of Bend
windBendMin is a value in (0..1) which indicate how much the vegetables are bended at minimum (for very powerfull wind)
+
+ +

+Definition at line 3188 of file landscape.cpp. +

+References _VegetableManager, and NL3D::CVegetableManager::setWind(). +

+Referenced by NL3D::CLandscapeUser::setVegetableWind(). +

+

03189 {
+03190         // setup vegetable manager
+03191         _VegetableManager->setWind(windDir, windFreq, windPower, windBendMin);
+03192 }
+
+

+ + + + +
+ + + + + + + + + +
void NL3D::CLandscape::synchronizeATIVBHards  )  [private]
+
+ + + + + +
+   + + +

+ +

+Definition at line 888 of file landscape.cpp. +

+References _Far0VB, _Far1VB, _TileVB, and NL3D::CLandscapeVBAllocator::synchronizeATIVBHard(). +

+Referenced by render(). +

+

00889 {
+00890         _Far0VB.synchronizeATIVBHard();
+00891         _Far1VB.synchronizeATIVBHard();
+00892         _TileVB.synchronizeATIVBHard();
+00893 }
+
+

+ + + + +
+ + + + + + + + + + +
void NL3D::CLandscape::unlinkPatchFromNearUL CPatch patch  )  [private]
+
+ + + + + +
+   + + +

+Used by Patch to link/unlink from _ULRootNearPatch. +

+ +

+Definition at line 3404 of file landscape.cpp. +

+References _ULNearCurrentTessBlockId, _ULRootNearPatch, NL3D::CPatch::getNextNearUL(), and NL3D::CPatch::unlinkNearUL(). +

+Referenced by NL3D::CPatch::clearTessBlocks(). +

+

03405 {
+03406         // If I unlink the patch which is the current root
+03407         if(_ULRootNearPatch==patch)
+03408         {
+03409                 // switch to next
+03410                 _ULRootNearPatch= patch->getNextNearUL();
+03411                 // if still the same, it means that the circular list is now empty
+03412                 if(_ULRootNearPatch==patch)
+03413                         _ULRootNearPatch= NULL;
+03414                 // reset tessBlock counter.
+03415                 _ULNearCurrentTessBlockId= 0;
+03416         }
+03417 
+03418         // unlink the patch from list
+03419         patch->unlinkNearUL();
+03420 }
+
+

+ + + + +
+ + + + + + + + + +
void NL3D::CLandscape::unlockBuffers  )  [private]
+
+ + + + + +
+   + + +

+ +

+Definition at line 877 of file landscape.cpp. +

+References _Far0VB, _Far1VB, _TileVB, _VegetableManager, NL3D::CLandscapeVBAllocator::unlockBuffer(), and NL3D::CVegetableManager::unlockBuffers(). +

+Referenced by addZone(), averageTesselationVertices(), NL3D::CZone::changePatchTextureAndColor(), clip(), computeDynamicLighting(), invalidateAllTiles(), refine(), refineAll(), removeZone(), render(), and updateLightingAll(). +

+

00878 {
+00879         _Far0VB.unlockBuffer();
+00880         _Far1VB.unlockBuffer();
+00881         _TileVB.unlockBuffer();
+00882 
+00883         // unlock buffer of the vegetable manager.
+00884         _VegetableManager->unlockBuffers();
+00885 }
+
+

+ + + + +
+ + + + + + + + + + +
void NL3D::CLandscape::updateGlobalsAndLockBuffers const CVector refineCenter  )  [private]
+
+ + + + + +
+   + + +

+ +

+Definition at line 799 of file landscape.cpp. +

+References _DriverOkForVegetable, _Far0VB, _Far1VB, _FarTransition, _PZBModelPosition, _Threshold, _TileDistNear, _TileMaxSubdivision, _TileVB, _VegetableManager, lockBuffers(), NLMISC::sqr(), NL3D::CVegetableManager::updateDriver(), and NL3D::CLandscapeVBAllocator::updateDriver(). +

+Referenced by addZone(), averageTesselationVertices(), NL3D::CZone::changePatchTextureAndColor(), clip(), computeDynamicLighting(), invalidateAllTiles(), refine(), refineAll(), removeZone(), render(), and updateLightingAll(). +

+

00800 {
+00801         // Setup CLandscapeGlobals static members...
+00802 
+00803         // Far limits.
+00804         CLandscapeGlobals::FarTransition= _FarTransition;
+00805 
+00806         // Tile subdivsion part.
+00807         CLandscapeGlobals::TileMaxSubdivision= _TileMaxSubdivision;
+00808         CLandscapeGlobals::TileDistNear = _TileDistNear;
+00809         CLandscapeGlobals::TileDistFar = CLandscapeGlobals::TileDistNear+20;
+00810         CLandscapeGlobals::TileDistNearSqr = sqr(CLandscapeGlobals::TileDistNear);
+00811         CLandscapeGlobals::TileDistFarSqr = sqr(CLandscapeGlobals::TileDistFar);
+00812         CLandscapeGlobals::OOTileDistDeltaSqr = 1.0f / (CLandscapeGlobals::TileDistFarSqr - CLandscapeGlobals::TileDistNearSqr);
+00813 
+00814         // Tile Pixel size part.
+00815         // \todo yoyo: choose according to wanted tile pixel size.
+00816         CLandscapeGlobals::TilePixelSize= 128.0f;
+00817         CLandscapeGlobals::TilePixelBias128= 0.5f/CLandscapeGlobals::TilePixelSize;
+00818         CLandscapeGlobals::TilePixelScale128= 1-1/CLandscapeGlobals::TilePixelSize;
+00819         CLandscapeGlobals::TilePixelBias256= 0.5f/(CLandscapeGlobals::TilePixelSize*2);
+00820         CLandscapeGlobals::TilePixelScale256= 1-1/(CLandscapeGlobals::TilePixelSize*2);
+00821 
+00822         // RefineThreshold.
+00823         CLandscapeGlobals::RefineThreshold= _Threshold;
+00824 
+00825         if (_Threshold == 0.0f)
+00826                 CLandscapeGlobals::OORefineThreshold = FLT_MAX;
+00827         else
+00828                 CLandscapeGlobals::OORefineThreshold = 1.0f / CLandscapeGlobals::RefineThreshold;
+00829 
+00830         // Refine Center*.
+00831         CLandscapeGlobals::RefineCenter= refineCenter;
+00832         CLandscapeGlobals::TileFarSphere.Center= CLandscapeGlobals::RefineCenter;
+00833         CLandscapeGlobals::TileFarSphere.Radius= CLandscapeGlobals::TileDistFar;
+00834         CLandscapeGlobals::TileNearSphere.Center= CLandscapeGlobals::RefineCenter;
+00835         CLandscapeGlobals::TileNearSphere.Radius= CLandscapeGlobals::TileDistNear;
+00836 
+00837         // PZBModelPosition
+00838         CLandscapeGlobals::PZBModelPosition= _PZBModelPosition;
+00839 
+00840         // VB Allocators.
+00841         CLandscapeGlobals::CurrentFar0VBAllocator= &_Far0VB;
+00842         CLandscapeGlobals::CurrentFar1VBAllocator= &_Far1VB;
+00843         CLandscapeGlobals::CurrentTileVBAllocator= &_TileVB;
+00844 
+00845         // Must check driver, and create VB infos,locking buffers.
+00846         if(_Driver)
+00847         {
+00848                 _Far0VB.updateDriver(_Driver);
+00849                 _Far1VB.updateDriver(_Driver);
+00850                 _TileVB.updateDriver(_Driver);
+00851 
+00852                 // must do the same for _VegetableManager.
+00853                 if(_DriverOkForVegetable)
+00854                         _VegetableManager->updateDriver(_Driver);
+00855 
+00856                 lockBuffers ();
+00857         }
+00858 }
+
+

+ + + + +
+ + + + + + + + + + +
void NL3D::CLandscape::updateLighting double  time  ) 
+
+ + + + + +
+   + + +

+update the lighting of patch, within a certain amount of time. called by CLandscapeModel +

+Definition at line 3330 of file landscape.cpp. +

+References _ULFrequency, _ULPrecTime, _ULPrecTimeInit, _ULTime, updateLightingTextureFar(), and updateLightingTextureNear(). +

+Referenced by NL3D::CLandscapeModel::clipAndRenderLandscape(). +

+

03331 {
+03332         _ULTime= time;
+03333 
+03334         // first time in this method??
+03335         if(!_ULPrecTimeInit)
+03336         {
+03337                 _ULPrecTimeInit= true;
+03338                 _ULPrecTime= _ULTime;
+03339         }
+03340         // compute delta time from last update.
+03341         float dt= float(_ULTime - _ULPrecTime);
+03342         _ULPrecTime= _ULTime;
+03343 
+03344 
+03345         // If not disabled
+03346         if(_ULFrequency)
+03347         {
+03348                 // Do it for near and far in 2 distinct ways.
+03349                 updateLightingTextureFar(dt * _ULFrequency);
+03350                 updateLightingTextureNear(dt * _ULFrequency);
+03351         }
+03352 
+03353 }
+
+

+ + + + +
+ + + + + + + + + +
void NL3D::CLandscape::updateLightingAll  ) 
+
+ + + + + +
+   + + +

+update the lighting of ALL patch (slow method). NB: work even if UpdateLightingFrequency==0 Additionaly, vegetables are also ALL updated. +

+Definition at line 3357 of file landscape.cpp. +

+References _VegetableManager, NLMISC::OptFastFloorBegin(), NLMISC::OptFastFloorEnd(), unlockBuffers(), updateGlobalsAndLockBuffers(), NL3D::CVegetableManager::updateLightingAll(), updateLightingTextureFar(), and updateLightingTextureNear(). +

+Referenced by NL3D::CLandscapeUser::updateLightingAll(). +

+

03358 {
+03359         // Do it for near and far in 2 distinct ways.
+03360         //================
+03361         updateLightingTextureFar(1);
+03362         updateLightingTextureNear(1);
+03363 
+03364 
+03365         // update lighting for vegetables
+03366         //================
+03367 
+03368         // Must lock buffers for update Lighting of vegetables.
+03369         updateGlobalsAndLockBuffers (CVector::Null);
+03370 
+03371         // Because updateLighting() may use OptFastFloor..
+03372         NLMISC::OptFastFloorBegin();
+03373 
+03374         // update ALL lighting for vegetables
+03375         _VegetableManager->updateLightingAll();
+03376 
+03377         // Stop fastFloor optim.
+03378         NLMISC::OptFastFloorEnd();
+03379 
+03380         // Must realase VB Buffers
+03381         unlockBuffers();
+03382 }
+
+

+ + + + +
+ + + + + + + + + + +
void NL3D::CLandscape::updateLightingTextureFar float  ratio  )  [private]
+
+ + + + + +
+   + + +

+Update All Far texture, given a ratio along total lumels. +

+ +

+Definition at line 3424 of file landscape.cpp. +

+References _ULFarPixelsToUpdate, _ULRootTextureFar, _ULTotalFarPixels, NL3D::CTextureFar::endPatchULTouch(), NL3D::CTextureFar::getNextUL(), min, NL3D::CTextureFar::startPatchULTouch(), and NL3D::CTextureFar::touchPatchULAndNext(). +

+Referenced by updateLighting(), and updateLightingAll(). +

+

03425 {
+03426         // compute number of pixels to update.
+03427         _ULFarPixelsToUpdate+= ratio * _ULTotalFarPixels;
+03428         // maximize, so at max, it computes all patchs, just one time.
+03429         _ULFarPixelsToUpdate= min(_ULFarPixelsToUpdate, (float)_ULTotalFarPixels);
+03430 
+03431         // Test Profile Yoyo
+03432         /*extern bool YOYO_LandULTest;
+03433         if(YOYO_LandULTest)
+03434         {
+03435                 nlinfo("YOYO_UL Far: %dK, %dK", (sint)_ULFarPixelsToUpdate/1024, (sint)_ULTotalFarPixels/1024);
+03436         }*/
+03437 
+03438         // while there is still some pixels to update.
+03439         while(_ULFarPixelsToUpdate > 0 && _ULRootTextureFar)
+03440         {
+03441                 // update patch (if not null) in the textureFar.
+03442                 _ULFarPixelsToUpdate-= _ULRootTextureFar->touchPatchULAndNext();
+03443 
+03444                 // last patch in the texture??
+03445                 if( _ULRootTextureFar->endPatchULTouch() )
+03446                 {
+03447                         // yes, go to next texture.
+03448                         _ULRootTextureFar= _ULRootTextureFar->getNextUL();
+03449                         // reset to 0th patch.
+03450                         _ULRootTextureFar->startPatchULTouch();
+03451                 }
+03452         }
+03453 
+03454         // Now, _ULFarPixelsToUpdate should be <=0. (most of the time < 0)
+03455 }
+
+

+ + + + +
+ + + + + + + + + + +
void NL3D::CLandscape::updateLightingTextureNear float  ratio  )  [private]
+
+ + + + + +
+   + + +

+Update All Near texture, given a ratio along total lumels. +

+ +

+Definition at line 3459 of file landscape.cpp. +

+References _ULNearCurrentTessBlockId, _ULNearPixelsToUpdate, _ULRootNearPatch, _ULTotalNearPixels, NL3D::CPatch::getNextNearUL(), NL3D::CPatch::getNumNearTessBlocks(), min, and NL3D::CPatch::updateTessBlockLighting(). +

+Referenced by updateLighting(), and updateLightingAll(). +

+

03460 {
+03461         // compute number of pixels to update.
+03462         _ULNearPixelsToUpdate+= ratio * _ULTotalNearPixels;
+03463         // maximize, so at max, it computes all patchs, just one time.
+03464         _ULNearPixelsToUpdate= min(_ULNearPixelsToUpdate, (float)_ULTotalNearPixels);
+03465 
+03466 
+03467         // while there is still some pixels to update.
+03468         while(_ULNearPixelsToUpdate > 0 && _ULRootNearPatch)
+03469         {
+03470                 // update tessBlock (if lightmap exist for this tessBlock) in the patch.
+03471                 _ULNearPixelsToUpdate-= _ULRootNearPatch->updateTessBlockLighting(_ULNearCurrentTessBlockId);
+03472                 // Next tessBlock to process.
+03473                 _ULNearCurrentTessBlockId++;
+03474 
+03475                 // last tessBlock in the patch??
+03476                 if(_ULNearCurrentTessBlockId>=_ULRootNearPatch->getNumNearTessBlocks())
+03477                 {
+03478                         // yes, go to next patch.
+03479                         _ULRootNearPatch= _ULRootNearPatch->getNextNearUL();
+03480                         // reset to 0th tessBlock.
+03481                         _ULNearCurrentTessBlockId=0;
+03482                 }
+03483         }
+03484 
+03485 }
+
+

+ + + + +
+ + + + + + + + + +
void NL3D::CLandscape::updateTessBlocksFaceVector  )  [private]
+
+ + + + + +
+   + + +

+ +

+Definition at line 896 of file landscape.cpp. +

+References _TessBlockModificationRoot, NL3D::CTessBlock::getNextToModify(), NL3D::CTessBlock::getPatch(), NL3D::CPatch::recreateTessBlockFaceVector(), and NL3D::CTessBlock::removeFromModifyList(). +

+Referenced by addZone(), averageTesselationVertices(), NL3D::CZone::changePatchTextureAndColor(), clip(), invalidateAllTiles(), refine(), refineAll(), and removeZone(). +

+

00897 {
+00898         // while some tessBlock to update remains.
+00899         CTessBlock      *tb;
+00900         while( (tb=_TessBlockModificationRoot.getNextToModify()) !=NULL )
+00901         {
+00902                 // Get the patch which owns this TessBlock.
+00903                 CPatch  *patch= tb->getPatch();
+00904 
+00905                 // If this patch is visible, recreate faceVector for his tessBlock.
+00906                 patch->recreateTessBlockFaceVector(*tb);
+00907 
+00908                 // remove from list.
+00909                 tb->removeFromModifyList();
+00910         }
+00911 }
+
+


Friends And Related Function Documentation

+

+ + + + +
+ + +
friend class CPatch [friend] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 629 of file landscape.h.

+

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

+ +

+Definition at line 67 of file smart_ptr.h.

+

+ + + + +
+ + +
friend class CTessFace [friend] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 628 of file landscape.h.

+

+ + + + +
+ + +
friend class CZone [friend] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 630 of file landscape.h.

+


Field Documentation

+

+ + + + +
+ + +
CVector NL3D::CLandscape::_AutomaticLightDir [private] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 792 of file landscape.h. +

+Referenced by CLandscape(), getAutomaticLightDir(), and setupAutomaticLightDir().

+

+ + + + +
+ + +
bool NL3D::CLandscape::_AutomaticLighting [private] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 791 of file landscape.h. +

+Referenced by CLandscape(), enableAutomaticLighting(), and getAutomaticLighting().

+

+ + + + +
+ + +
CRGBA NL3D::CLandscape::_DLMGlobalVegetableColor [private] +
+
+ + + + + +
+   + + +

+an approximate value used to simulate diffuse material of vegetables +

+ +

+Definition at line 988 of file landscape.h. +

+Referenced by CLandscape(), getDLMGlobalVegetableColor(), render(), and setDLMGlobalVegetableColor().

+

+ + + + +
+ + +
float NL3D::CLandscape::_DLMMaxAttEnd [private] +
+
+ + + + + +
+   + + +

+Max AttEnd. +

+ +

+Definition at line 985 of file landscape.h. +

+Referenced by CLandscape(), computeDynamicLighting(), getDynamicLightingMaxAttEnd(), and setDynamicLightingMaxAttEnd().

+

+ + + + +
+ + +
CRefPtr<IDriver> NL3D::CLandscape::_Driver [private] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 712 of file landscape.h.

+

+ + + + +
+ + +
bool NL3D::CLandscape::_DriverOkForVegetable [private] +
+
+ + + + + +
+   + + +

+Tells if the current dirver support vegetable. +

+ +

+Definition at line 913 of file landscape.h. +

+Referenced by CLandscape(), isVegetableActive(), setDriver(), and updateGlobalsAndLockBuffers().

+

+ + + + +
+ + +
CLandscapeFaceVectorManager NL3D::CLandscape::_FaceVectorManager [private] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 660 of file landscape.h.

+

+ + + + +
+ + +
CLandscapeVBAllocator NL3D::CLandscape::_Far0VB [private] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 713 of file landscape.h. +

+Referenced by clear(), lockBuffers(), render(), synchronizeATIVBHards(), unlockBuffers(), and updateGlobalsAndLockBuffers().

+

+ + + + +
+ + +
CLandscapeVBAllocator NL3D::CLandscape::_Far1VB [private] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 714 of file landscape.h. +

+Referenced by clear(), lockBuffers(), render(), synchronizeATIVBHards(), unlockBuffers(), and updateGlobalsAndLockBuffers().

+

+ + + + +
+ + +
bool NL3D::CLandscape::_FarInitialized [private] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 783 of file landscape.h. +

+Referenced by CLandscape(), and initTileBanks().

+

+ + + + +
+ + +
float NL3D::CLandscape::_FarTransition [private] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 705 of file landscape.h. +

+Referenced by CLandscape(), setTileNear(), and updateGlobalsAndLockBuffers().

+

+ + + + +
+ + +
CHeightField NL3D::CLandscape::_HeightField [private] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 853 of file landscape.h. +

+Referenced by getHeightFieldDeltaZ(), and setHeightField().

+

+ + + + +
+ + +
CRGBA NL3D::CLandscape::_LightValue[256] [private] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 789 of file landscape.h. +

+Referenced by getStaticLight(), and setupStaticLight().

+

+ + + + +
+ + +
CTessFacePriorityList NL3D::CLandscape::_MergePriorityList [private] +
+
+ + + + + +
+   + + +

+The priority list of faces which may need to merge. +

+ +

+Definition at line 896 of file landscape.h. +

+Referenced by CLandscape(), NL3D::CTessFace::doMerge(), refine(), NL3D::CTessFace::split(), NL3D::CTessFace::splitRectangular(), and NL3D::CTessFace::updateRefineMerge().

+

+ + + + +
+ + +
uint NL3D::CLandscape::_NFreeLightMaps [private] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 765 of file landscape.h. +

+Referenced by CLandscape(), getTileLightMap(), and releaseTileLightMap().

+

+ + + + +
+ + +
bool NL3D::CLandscape::_NoiseEnabled [private] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 887 of file landscape.h. +

+Referenced by CLandscape(), getNoiseMode(), and setNoiseMode().

+

+ + + + +
+ + +
CVector NL3D::CLandscape::_OldRefineCenter [private] +
+
+ + + + + +
+   + + +

+OldRefineCenter setuped in prec refine(). +

+ +

+Definition at line 898 of file landscape.h. +

+Referenced by CLandscape(), getOldRefineCenter(), getTesselatedPos(), and refine().

+

+ + + + +
+ + +
bool NL3D::CLandscape::_OldRefineCenterSetuped [private] +
+
+ + + + + +
+   + + +

+The priority list of faces which may need to merge. +

+ +

+Definition at line 899 of file landscape.h. +

+Referenced by CLandscape(), and refine().

+

+ + + + +
+ + +
CPatchDLMContextList* NL3D::CLandscape::_PatchDLMContextList [private] +
+
+ + + + + +
+   + + +

+List of DLM Context. +

+ +

+Definition at line 981 of file landscape.h. +

+Referenced by CLandscape(), computeDynamicLighting(), getDynamicLightingMemoryLoad(), getPatchDLMContextList(), render(), and ~CLandscape().

+

+ + + + +
+ + +
CQuadGrid<CPatchIdentEx> NL3D::CLandscape::_PatchQuadGrid [private] +
+
+ + + + + +
+   + + +

+The QuadGrid of patch. +

+ +

+Definition at line 866 of file landscape.h. +

+Referenced by addZone(), buildPatchBlocksInBBox(), buildTrianglesInBBox(), clear(), computeDynamicLighting(), init(), and removeZone().

+

+ + + + +
+ + +
const float NL3D::CLandscape::_PatchQuadGridEltSize = 16 [static, private] +
+
+ + + + + +
+   + + +

+private version of buildPatchBlocksInBBox, searching only for one patch. +

+Definition at line 101 of file landscape.cpp. +

+Referenced by init().

+

+ + + + +
+ + +
const uint NL3D::CLandscape::_PatchQuadGridSize = 128 [static, private] +
+
+ + + + + +
+   + + +

+private version of buildPatchBlocksInBBox, searching only for one patch. +

+Definition at line 99 of file landscape.cpp. +

+Referenced by init().

+

+ + + + +
+ + +
CRGBA NL3D::CLandscape::_PointLightDiffuseMaterial [private] +
+
+ + + + + +
+   + + +

+The diffuse material of landscape, used for StaticPointLights and DynamicPointLights. +

+ +

+Definition at line 991 of file landscape.h. +

+Referenced by CLandscape(), computeDynamicLighting(), getPointLightDiffuseMaterial(), render(), and setPointLightDiffuseMaterial().

+

+ + + + +
+ + +
CVector NL3D::CLandscape::_PZBModelPosition [private] +
+
+ + + + + +
+   + + +

+setPZBModelPosition() +

+ +

+Definition at line 929 of file landscape.h. +

+Referenced by CLandscape(), getPZBModelPosition(), render(), setPZBModelPosition(), and updateGlobalsAndLockBuffers().

+

+ + + + +
+ + +
bool NL3D::CLandscape::_RefineMode [private] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 704 of file landscape.h. +

+Referenced by CLandscape(), getRefineMode(), refine(), and setRefineMode().

+

+ + + + +
+ + +
bool NL3D::CLandscape::_RenderMustRefillVB [private] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 719 of file landscape.h. +

+Referenced by CLandscape(), NL3D::CZone::refreshTesselationGeometry(), and render().

+

+ + + + +
+ + +
CTessFacePListNode NL3D::CLandscape::_RootNewLeaves [private] +
+
+ + + + + +
+   + + +

+newTessFace() append the face to _RootNewLeaves. +

+ +

+Definition at line 901 of file landscape.h. +

+Referenced by newTessFace(), and refine().

+

+ + + + +
+ + +
CShadowPolyReceiver NL3D::CLandscape::_ShadowPolyReceiver [private] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 998 of file landscape.h. +

+Referenced by appendToShadowPolyReceiver(), getCameraCollision(), receiveShadowMap(), and removeFromShadowPolyReceiver().

+

+ + + + +
+ + +
CTessFacePriorityList NL3D::CLandscape::_SplitPriorityList [private] +
+
+ + + + + +
+   + + +

+The priority list of faces which may need to split. +

+ +

+Definition at line 894 of file landscape.h. +

+Referenced by CLandscape(), NL3D::CTessFace::doMerge(), refine(), and NL3D::CTessFace::updateRefineSplit().

+

+ + + + +
+ + +
CTessBlock NL3D::CLandscape::_TessBlockModificationRoot [private] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 663 of file landscape.h. +

+Referenced by averageTesselationVertices(), clip(), and updateTessBlocksFaceVector().

+

+ + + + +
+ + +
NLMISC::CSmartPtr<ITexture> NL3D::CLandscape::_TextureDLM [private] +
+
+ + + + + +
+   + + +

+The dynamic lightmap Texture. +

+ +

+Definition at line 977 of file landscape.h. +

+Referenced by CLandscape(), getTextureDLM(), render(), and ~CLandscape().

+

+ + + + +
+ + +
std::vector<TSPRenderPass> NL3D::CLandscape::_TextureFars [private] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 782 of file landscape.h. +

+Referenced by clear(), getFarRenderPass(), and render().

+

+ + + + +
+ + +
std::vector<TSPRenderPass> NL3D::CLandscape::_TextureNears [private] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 764 of file landscape.h. +

+Referenced by getTileLightMap(), refillTileLightMap(), releaseTileLightMap(), and render().

+

+ + + + +
+ + +
float NL3D::CLandscape::_Threshold [private] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 703 of file landscape.h. +

+Referenced by CLandscape(), getTesselatedPos(), getThreshold(), setThreshold(), and updateGlobalsAndLockBuffers().

+

+ + + + +
+ + +
ULandscapeTileCallback* NL3D::CLandscape::_TileCallback [private] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 633 of file landscape.h. +

+Referenced by CLandscape(), getTileCallback(), and setTileCallback().

+

+ + + + +
+ + +
float NL3D::CLandscape::_TileDistNear [private] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 702 of file landscape.h. +

+Referenced by CLandscape(), getTesselatedPos(), getTileNear(), setTileNear(), and updateGlobalsAndLockBuffers().

+

+ + + + +
+ + +
uint NL3D::CLandscape::_TileMaxSubdivision [private] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 706 of file landscape.h. +

+Referenced by CLandscape(), getTileMaxSubdivision(), setTileMaxSubdivision(), and updateGlobalsAndLockBuffers().

+

+ + + + +
+ + +
CLandscapeVBAllocator NL3D::CLandscape::_TileVB [private] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 715 of file landscape.h. +

+Referenced by clear(), lockBuffers(), render(), synchronizeATIVBHards(), unlockBuffers(), and updateGlobalsAndLockBuffers().

+

+ + + + +
+ + +
float NL3D::CLandscape::_ULFarPixelsToUpdate [private] +
+
+ + + + + +
+   + + +

+Current number of far pixels to update. If negative, I have some advance. +

+ +

+Definition at line 946 of file landscape.h. +

+Referenced by CLandscape(), and updateLightingTextureFar().

+

+ + + + +
+ + +
float NL3D::CLandscape::_ULFrequency [private] +
+
+ + + + + +
+   + + +

+Frequency of update. +

+ +

+Definition at line 940 of file landscape.h. +

+Referenced by CLandscape(), setUpdateLightingFrequency(), and updateLighting().

+

+ + + + +
+ + +
uint NL3D::CLandscape::_ULNearCurrentTessBlockId [private] +
+
+ + + + + +
+   + + +

+Current tessBlock id in the current patch processed. +

+ +

+Definition at line 958 of file landscape.h. +

+Referenced by CLandscape(), unlinkPatchFromNearUL(), and updateLightingTextureNear().

+

+ + + + +
+ + +
float NL3D::CLandscape::_ULNearPixelsToUpdate [private] +
+
+ + + + + +
+   + + +

+Current number of near pixels to update. If negative, I have some advance. +

+ +

+Definition at line 954 of file landscape.h. +

+Referenced by CLandscape(), and updateLightingTextureNear().

+

+ + + + +
+ + +
double NL3D::CLandscape::_ULPrecTime [private] +
+
+ + + + + +
+   + + +

+Used by Patch to link/unlink from _ULRootNearPatch. +

+ +

+Definition at line 936 of file landscape.h. +

+Referenced by updateLighting().

+

+ + + + +
+ + +
bool NL3D::CLandscape::_ULPrecTimeInit [private] +
+
+ + + + + +
+   + + +

+Used by Patch to link/unlink from _ULRootNearPatch. +

+ +

+Definition at line 937 of file landscape.h. +

+Referenced by CLandscape(), and updateLighting().

+

+ + + + +
+ + +
CPatch* NL3D::CLandscape::_ULRootNearPatch [private] +
+
+ + + + + +
+   + + +

+The current patch rendered. +

+ +

+Definition at line 956 of file landscape.h. +

+Referenced by CLandscape(), linkPatchToNearUL(), unlinkPatchFromNearUL(), and updateLightingTextureNear().

+

+ + + + +
+ + +
CTextureFar* NL3D::CLandscape::_ULRootTextureFar [private] +
+
+ + + + + +
+   + + +

+The current TextureFar rendered. +

+ +

+Definition at line 948 of file landscape.h. +

+Referenced by CLandscape(), clearFarRenderPass(), getFarRenderPass(), and updateLightingTextureFar().

+

+ + + + +
+ + +
double NL3D::CLandscape::_ULTime [private] +
+
+ + + + + +
+   + + +

+Used by Patch to link/unlink from _ULRootNearPatch. +

+ +

+Definition at line 938 of file landscape.h. +

+Referenced by updateLighting().

+

+ + + + +
+ + +
sint NL3D::CLandscape::_ULTotalFarPixels [private] +
+
+ + + + + +
+   + + +

+Far UpdateLighting. +

+ +

+Definition at line 944 of file landscape.h. +

+Referenced by CLandscape(), freeFarRenderPass(), getFarRenderPass(), and updateLightingTextureFar().

+

+ + + + +
+ + +
sint NL3D::CLandscape::_ULTotalNearPixels [private] +
+
+ + + + + +
+   + + +

+Near UpdateLighting. +

+ +

+Definition at line 952 of file landscape.h. +

+Referenced by CLandscape(), getTileLightMap(), releaseTileLightMap(), and updateLightingTextureNear().

+

+ + + + +
+ + +
CTessList<CLandscapeVegetableBlock> NL3D::CLandscape::_VegetableBlockList [private] +
+
+ + + + + +
+   + + +

+List of VegetableBlock, to be tested for creation each frame. +

+ +

+Definition at line 916 of file landscape.h. +

+Referenced by refine().

+

+ + + + +
+ + +
CVegetableManager* NL3D::CLandscape::_VegetableManager [private] +
+
+ + + + + +
+   + + +

+The VegetableManager. (ptr only for include speed). +

+ +

+Definition at line 908 of file landscape.h. +

+Referenced by NL3D::CPatch::addRefTessBlocks(), CLandscape(), NL3D::CPatch::clearTessBlocks(), createVegetableBlendLayersModels(), enableVegetable(), NL3D::CPatch::generateTileVegetable(), getNumVegetableFaceRendered(), initTileBanks(), loadVegetableTexture(), lockBuffers(), refine(), render(), setupVegetableLighting(), setVegetableTime(), setVegetableUpdateLightingFrequency(), setVegetableUpdateLightingTime(), setVegetableWind(), unlockBuffers(), updateGlobalsAndLockBuffers(), updateLightingAll(), and ~CLandscape().

+

+ + + + +
+ + +
bool NL3D::CLandscape::_VegetableManagerEnabled [private] +
+
+ + + + + +
+   + + +

+Tells if the Vegetable Managemnt is enabled. +

+ +

+Definition at line 911 of file landscape.h. +

+Referenced by CLandscape(), enableVegetable(), and isVegetableActive().

+

+ + + + +
+ + +
bool NL3D::CLandscape::_VertexShaderOk [private] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 717 of file landscape.h. +

+Referenced by CLandscape(), getTesselatedPos(), lockBuffers(), render(), and setDriver().

+

+ + + + +
+ + +
float NL3D::CLandscape::_VPThresholdChange [private] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 708 of file landscape.h. +

+Referenced by CLandscape(), render(), and setThreshold().

+

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

+

+ + + + +
+ + +
CMaterial NL3D::CLandscape::FarMaterial [private] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 772 of file landscape.h. +

+Referenced by init(), and render().

+

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

+ +

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

+

+ + + + +
+ + +
class CLandscapeModel* NL3D::CLandscape::OwnerModel +
+
+ + + + + +
+   + + +

+ +

+Definition at line 147 of file landscape.h. +

+Referenced by addZone(), CLandscape(), and NL3D::CLandscapeModel::CLandscapeModel().

+

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

+ +

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

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

+

+ + + + +
+ + +
CBlockMemory<CTessFace> NL3D::CLandscape::TessFaceAllocator [private] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 638 of file landscape.h. +

+Referenced by deleteTessFace(), and newTessFace().

+

+ + + + +
+ + +
CBlockMemory<CTessFarVertex> NL3D::CLandscape::TessFarVertexAllocator [private] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 641 of file landscape.h. +

+Referenced by deleteTessFarVertex(), and newTessFarVertex().

+

+ + + + +
+ + +
CBlockMemory<CTessNearVertex> NL3D::CLandscape::TessNearVertexAllocator [private] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 640 of file landscape.h. +

+Referenced by deleteTessNearVertex(), and newTessNearVertex().

+

+ + + + +
+ + +
CBlockMemory<CTessVertex> NL3D::CLandscape::TessVertexAllocator [private] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 639 of file landscape.h. +

+Referenced by deleteTessVertex(), and newTessVertex().

+

+ + + + +
+ + +
CTileBank NL3D::CLandscape::TileBank +
+
+ + + + + +
+   + + +

+ +

+Definition at line 145 of file landscape.h. +

+Referenced by NL3D::CPatch::computeDisplaceRawInteger(), enableVegetable(), NL3D::CLandscapeUser::flushTiles(), getTileVegetableDesc(), initTileBanks(), NL3D::CLandscapeUser::loadBankFiles(), loadTile(), NL3D::CLandscapeUser::postfixTileFilename(), and NL3D::CLandscapeUser::postfixTileVegetableDesc().

+

+ + + + +
+ + +
CBlockMemory<CTileFace> NL3D::CLandscape::TileFaceAllocator [private] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 643 of file landscape.h. +

+Referenced by deleteTileFace(), and newTileFace().

+

+ + + + +
+ + +
CTileFarBank NL3D::CLandscape::TileFarBank +
+
+ + + + + +
+   + + +

+ +

+Definition at line 146 of file landscape.h. +

+Referenced by NL3D::CPatchDLMContext::computeTextureFar(), eraseTileFarIfNotGood(), getFarRenderPass(), initTileBanks(), and NL3D::CLandscapeUser::loadBankFiles().

+

+ + + + +
+ + +
std::vector<CTileInfo*> NL3D::CLandscape::TileInfos [private] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 761 of file landscape.h. +

+Referenced by flushTiles(), getTileRenderPass(), getTileUvScaleBiasRot(), initTileBank(), loadTile(), releaseTile(), and releaseTiles().

+

+ + + + +
+ + +
CMaterial NL3D::CLandscape::TileMaterial [private] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 769 of file landscape.h. +

+Referenced by init(), and render().

+

+ + + + +
+ + +
CBlockMemory<CTileMaterial> NL3D::CLandscape::TileMaterialAllocator [private] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 642 of file landscape.h. +

+Referenced by deleteTileMaterial(), and newTileMaterial().

+

+ + + + +
+ + +
TTileRdrPassSet NL3D::CLandscape::TileRdrPassSet [private] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 759 of file landscape.h. +

+Referenced by findTileRdrPass(), flushTiles(), releaseTiles(), and render().

+

+ + + + +
+ + +
TTileTextureMap NL3D::CLandscape::TileTextureMap [private] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 757 of file landscape.h. +

+Referenced by findTileTexture().

+

+ + + + +
+ + +
TZoneMap NL3D::CLandscape::Zones [private] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 699 of file landscape.h. +

+Referenced by addZone(), appendTileLightInfluences(), averageTesselationVertices(), buildCollideFaces(), clip(), enableVegetable(), excludePatchFromRefineAll(), fillPatchQuadBlock(), forceMergeAtTileLevel(), getLumel(), getTesselatedPos(), getTessellationLeaves(), getTileElement(), getZone(), getZoneList(), initAnimatedLightIndex(), initTileBank(), invalidateAllTiles(), refineAll(), removeAllPointLights(), removeZone(), render(), resetRenderFarAndDeleteVBFV(), setPointLightFactor(), and setupColorsFromTileFlags().

+


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