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

NL3D::CLandscapeUser Class Reference

ULandscape Implementation. More...

#include <landscape_user.h>

Inheritance diagram for NL3D::CLandscapeUser:

NL3D::ULandscape List of all members.

Public Methods

Object
 CLandscapeUser (CScene *scene)
virtual ~CLandscapeUser ()
Load
virtual void setZonePath (const std::string &zonePath)
 Set the zonePath from where zones are loaded. More...

virtual void loadBankFiles (const std::string &tileBankFile, const std::string &farBankFile)
 Load the tile banks: the ".bank" and the ".farbank". More...

virtual void loadAllZonesAround (const CVector &pos, float radius)
 Load all Zones around a position. Call at init only!! (no zone must exist before). This is a blocking call. More...

virtual void loadAllZonesAround (const CVector &pos, float radius, std::vector< std::string > &zonesAdded)
 Load all Zones around a position. More...

virtual void refreshZonesAround (const CVector &pos, float radius)
 Delete old zones, or load new zones, around a position. new Zones are loaded async. More...

virtual void refreshZonesAround (const CVector &pos, float radius, std::string &zoneAdded, std::string &zoneRemoved)
 Delete old zones, or load new zones, around a position. More...

virtual void refreshAllZonesAround (const CVector &pos, float radius, std::vector< std::string > &zonesAdded, std::vector< std::string > &zonesRemoved)
 Delete old zones, or load new zones, around a position, until it is finished. This is a blocking call. More...

virtual void getAllZoneLoaded (std::vector< std::string > &zoneLoaded) const
 Get list of zones currently loaded in landscape. More...

Lighting
virtual void setupStaticLight (const CRGBA &diffuse, const CRGBA &ambiant, float multiply)
 Setup the light color use for static illumination. More...

virtual void setPointLightDiffuseMaterial (CRGBA diffuse)
 Setup the equivalent material diffuse component used for both Static and Dynamic PointLights. More...

virtual CRGBA getPointLightDiffuseMaterial () const
virtual void setPointLightFactor (const std::string &lightGroupName, NLMISC::CRGBA nFactor)
 set the Light factor for all pointLights in All zones with LightGroupName= "lightGroupName". More...

virtual void setUpdateLightingFrequency (float freq)
 Set the frequency of lighting update. More...

virtual void updateLightingAll ()
 update the lighting of ALL patch (slow method). More...

Parameters
virtual void setThreshold (float thre)
 Set threshold for subdivsion quality. The lower is threshold, the more the landscape is subdivided. Default: 0.001. More...

virtual float getThreshold () const
 Get threshold. More...

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

virtual float getTileNear () const
 Get tile near distance. More...

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

virtual uint getTileMaxSubdivision ()
 Get Maximum Tile subdivision. More...

Misc
virtual std::string getZoneName (const CVector &pos)
 Return the name of the zone around a particular position (in NL3D basis!). More...

virtual void show ()
 show the landscape. visible by default. More...

virtual void hide ()
 hide the landscape. It is nor refined, nor rendered (=> take 0 CPU time). More...

virtual void enableAdditive (bool enable)
 Set additive Lighting. More...

virtual bool isAdditiveEnabled () const
 Get additive Lighting. More...

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

virtual void setHeightField (const CHeightMap &hf)
 set the HeightField data. More...

virtual void enableVegetable (bool enable)
 enable the vegetable management in landscape. More...

virtual void loadVegetableTexture (const std::string &textureFileName)
 load a texture for the vegetable, lookup in CPath. More...

virtual void setupVegetableLighting (const CRGBA &ambient, const CRGBA &diffuse, const CVector &directionalLight)
 setup lighting ambient and diffuse for vegetable. More...

virtual void setVegetableWind (const CVector &windDir, float windFreq, float windPower, float windBendMin)
 set the vegetable Wind for animation. More...

virtual void setVegetableUpdateLightingFrequency (float freq)
 set the frequency of Vegetable lighting update. More...

Dynamic Lighting management
virtual void setDLMGlobalVegetableColor (CRGBA gvc)
 For Vegetable Dynamic ligthing only: this is an approximate color of all vegetables. More...

virtual CRGBA getDLMGlobalVegetableColor () const
 see setDLMGlobalVegetableColor(). More...

Accessor for CLandscapeUser.
CLandscapeModelgetLandscape ()

Private Attributes

CScene_Scene
CLandscapeModel_Landscape
CZoneManager _ZoneManager

Detailed Description

ULandscape Implementation.

Author:
Lionel Berenguier , Nevrax France
Date:
2001

Definition at line 48 of file landscape_user.h.


Constructor & Destructor Documentation

NL3D::CLandscapeUser::CLandscapeUser CScene   scene [inline]
 

Definition at line 62 of file landscape_user.h.

References _Landscape, _Scene, NL3D::LandscapeModelId, NL3D_MEM_LANDSCAPE, and nlassert.

virtual NL3D::CLandscapeUser::~CLandscapeUser   [inline, virtual]
 

Definition at line 69 of file landscape_user.h.

References _Landscape, _Scene, and NL3D_MEM_LANDSCAPE.


Member Function Documentation

void NL3D::CLandscapeUser::enableAdditive bool    enable [virtual]
 

Set additive Lighting.

Disabled by default.

Parameters:
enable  is true to activbe additive, false to disactive it.

Implements NL3D::ULandscape.

Definition at line 394 of file landscape_user.cpp.

References _Landscape, and NL3D_HAUTO_UI_LANDSCAPE.

void NL3D::CLandscapeUser::enableVegetable bool    enable [virtual]
 

enable the vegetable management in landscape.

Valid only if Hardware support VertexShader.

Implements NL3D::ULandscape.

Definition at line 336 of file landscape_user.cpp.

References _Landscape, and NL3D_HAUTO_UI_LANDSCAPE.

void NL3D::CLandscapeUser::getAllZoneLoaded std::vector< std::string > &    zoneLoaded const [virtual]
 

Get list of zones currently loaded in landscape.

\zonesLoaded array of name of the zones added, without extension (eg: "150_EM").

Implements NL3D::ULandscape.

Definition at line 170 of file landscape_user.cpp.

References _Landscape.

CRGBA NL3D::CLandscapeUser::getDLMGlobalVegetableColor   const [virtual]
 

see setDLMGlobalVegetableColor().

Implements NL3D::ULandscape.

Definition at line 431 of file landscape_user.cpp.

References _Landscape, and NL3D_HAUTO_UI_LANDSCAPE.

CVector NL3D::CLandscapeUser::getHeightFieldDeltaZ float    x,
float    y
const [virtual]
 

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

Implements NL3D::ULandscape.

Definition at line 319 of file landscape_user.cpp.

References _Landscape, NL3D_HAUTO_UI_LANDSCAPE, x, and y.

CLandscapeModel* NL3D::CLandscapeUser::getLandscape   [inline]
 

Definition at line 185 of file landscape_user.h.

References _Landscape, and NL3D_MEM_LANDSCAPE.

CRGBA NL3D::CLandscapeUser::getPointLightDiffuseMaterial   const [virtual]
 

See also:
setPointLightDiffuseMaterial

Implements NL3D::ULandscape.

Definition at line 416 of file landscape_user.cpp.

References _Landscape, and NL3D_HAUTO_UI_LANDSCAPE.

float NL3D::CLandscapeUser::getThreshold   const [virtual]
 

Get threshold.

Implements NL3D::ULandscape.

Definition at line 273 of file landscape_user.cpp.

References _Landscape, and NL3D_HAUTO_UI_LANDSCAPE.

uint NL3D::CLandscapeUser::getTileMaxSubdivision   [virtual]
 

Get Maximum Tile subdivision.

Implements NL3D::ULandscape.

Definition at line 301 of file landscape_user.cpp.

References _Landscape, and NL3D_HAUTO_UI_LANDSCAPE.

float NL3D::CLandscapeUser::getTileNear   const [virtual]
 

Get tile near distance.

Implements NL3D::ULandscape.

Definition at line 287 of file landscape_user.cpp.

References _Landscape, and NL3D_HAUTO_UI_LANDSCAPE.

std::string NL3D::CLandscapeUser::getZoneName const CVector &    pos [virtual]
 

Return the name of the zone around a particular position (in NL3D basis!).

Implements NL3D::ULandscape.

Definition at line 310 of file landscape_user.cpp.

References _ZoneManager, and NL3D_HAUTO_UI_LANDSCAPE.

virtual void NL3D::CLandscapeUser::hide   [inline, virtual]
 

hide the landscape. It is nor refined, nor rendered (=> take 0 CPU time).

Implements NL3D::ULandscape.

Definition at line 148 of file landscape_user.h.

References _Landscape, and NL3D_MEM_LANDSCAPE.

bool NL3D::CLandscapeUser::isAdditiveEnabled   const [virtual]
 

Get additive Lighting.

Returns:
true to if additive is actived, else false.

Implements NL3D::ULandscape.

Definition at line 401 of file landscape_user.cpp.

References _Landscape, and NL3D_HAUTO_UI_LANDSCAPE.

void NL3D::CLandscapeUser::loadAllZonesAround const CVector &    pos,
float    radius,
std::vector< std::string > &    zonesAdded
[virtual]
 

Load all Zones around a position.

This is a blocking call. \zonesAdded array of name of the zones added, without extension (eg: "150_EM").

Implements NL3D::ULandscape.

Definition at line 103 of file landscape_user.cpp.

References _Landscape, _ZoneManager, NL3D_HAUTO_LOAD_LANDSCAPE, nlassert, NLMISC::nlSleep, and nlwarning.

void NL3D::CLandscapeUser::loadAllZonesAround const CVector &    pos,
float    radius
[virtual]
 

Load all Zones around a position. Call at init only!! (no zone must exist before). This is a blocking call.

Implements NL3D::ULandscape.

Definition at line 187 of file landscape_user.cpp.

void NL3D::CLandscapeUser::loadBankFiles const std::string &    tileBankFile,
const std::string &    farBankFile
[virtual]
 

Load the tile banks: the ".bank" and the ".farbank".

Implements NL3D::ULandscape.

Definition at line 55 of file landscape_user.cpp.

References _Landscape, _Scene, NL3D_HAUTO_LOAD_LANDSCAPE, and nlwarning.

void NL3D::CLandscapeUser::loadVegetableTexture const std::string &    textureFileName [virtual]
 

load a texture for the vegetable, lookup in CPath.

Implements NL3D::ULandscape.

Definition at line 344 of file landscape_user.cpp.

References _Landscape, and NL3D_HAUTO_LOAD_LANDSCAPE.

void NL3D::CLandscapeUser::refreshAllZonesAround const CVector &    pos,
float    radius,
std::vector< std::string > &    zonesAdded,
std::vector< std::string > &    zonesRemoved
[virtual]
 

Delete old zones, or load new zones, around a position, until it is finished. This is a blocking call.

Implements NL3D::ULandscape.

Definition at line 145 of file landscape_user.cpp.

References _ZoneManager, NL3D_HAUTO_LOAD_LANDSCAPE, and refreshZonesAround.

void NL3D::CLandscapeUser::refreshZonesAround const CVector &    pos,
float    radius,
std::string &    zoneAdded,
std::string &    zoneRemoved
[virtual]
 

Delete old zones, or load new zones, around a position.

new Zones are loaded async. This method add or remove only one zone at a time. \zoneRemoved name of the zone removed, without extension (eg: "150_EM"). "" if none. \zoneAdded name of the zone added, without extension (eg: "150_EM"). "" if none.

Implements NL3D::ULandscape.

Definition at line 205 of file landscape_user.cpp.

References _Landscape, _ZoneManager, NL3D_HAUTO_LOAD_LANDSCAPE, and nlwarning.

void NL3D::CLandscapeUser::refreshZonesAround const CVector &    pos,
float    radius
[virtual]
 

Delete old zones, or load new zones, around a position. new Zones are loaded async.

Implements NL3D::ULandscape.

Definition at line 196 of file landscape_user.cpp.

References NL3D_HAUTO_LOAD_LANDSCAPE.

Referenced by refreshAllZonesAround.

void NL3D::CLandscapeUser::setDLMGlobalVegetableColor CRGBA    gvc [virtual]
 

For Vegetable Dynamic ligthing only: this is an approximate color of all vegetables.

Default is (180, 180, 180).

Implements NL3D::ULandscape.

Definition at line 424 of file landscape_user.cpp.

References _Landscape, and NL3D_HAUTO_UI_LANDSCAPE.

void NL3D::CLandscapeUser::setHeightField const CHeightMap   hf [virtual]
 

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

Implements NL3D::ULandscape.

Definition at line 327 of file landscape_user.cpp.

References _Landscape, and NL3D_HAUTO_UI_LANDSCAPE.

void NL3D::CLandscapeUser::setPointLightDiffuseMaterial CRGBA    diffuse [virtual]
 

Setup the equivalent material diffuse component used for both Static and Dynamic PointLights.

Default is White.

Implements NL3D::ULandscape.

Definition at line 409 of file landscape_user.cpp.

References _Landscape, and NL3D_HAUTO_UI_LANDSCAPE.

void NL3D::CLandscapeUser::setPointLightFactor const std::string &    lightGroupName,
NLMISC::CRGBA    nFactor
[virtual]
 

set the Light factor for all pointLights in All zones with LightGroupName= "lightGroupName".

Additionaly, it stores a map<lightGroupName, NLMISC::CRGBA nFactor>, so each added zone will be correclty assigned.

Implements NL3D::ULandscape.

Definition at line 377 of file landscape_user.cpp.

References _Landscape, and NL3D_HAUTO_UI_LANDSCAPE.

void NL3D::CLandscapeUser::setThreshold float    thre [virtual]
 

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

Implements NL3D::ULandscape.

Definition at line 266 of file landscape_user.cpp.

References _Landscape, and NL3D_HAUTO_UI_LANDSCAPE.

void NL3D::CLandscapeUser::setTileMaxSubdivision uint    tileDiv [virtual]
 

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

Implements NL3D::ULandscape.

Definition at line 294 of file landscape_user.cpp.

References _Landscape, and NL3D_HAUTO_UI_LANDSCAPE.

void NL3D::CLandscapeUser::setTileNear float    tileNear [virtual]
 

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

Implements NL3D::ULandscape.

Definition at line 280 of file landscape_user.cpp.

References _Landscape, and NL3D_HAUTO_UI_LANDSCAPE.

void NL3D::CLandscapeUser::setUpdateLightingFrequency float    freq [virtual]
 

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!!).

Implements NL3D::ULandscape.

Definition at line 385 of file landscape_user.cpp.

References _Landscape, and NL3D_HAUTO_UI_LANDSCAPE.

void NL3D::CLandscapeUser::setupStaticLight const CRGBA &    diffuse,
const CRGBA &    ambiant,
float    multiply
[virtual]
 

Setup the light color use for static illumination.

NB: This setup will be visible only for new texture far/near computed (when player move or see dynamic lighting).

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))

Implements NL3D::ULandscape.

Definition at line 256 of file landscape_user.cpp.

References _Landscape, and NL3D_HAUTO_UI_LANDSCAPE.

void NL3D::CLandscapeUser::setupVegetableLighting const CRGBA &    ambient,
const CRGBA &    diffuse,
const CVector &    directionalLight
[virtual]
 

setup lighting ambient and diffuse for vegetable.

Implements NL3D::ULandscape.

Definition at line 352 of file landscape_user.cpp.

References _Landscape, and NL3D_HAUTO_UI_LANDSCAPE.

void NL3D::CLandscapeUser::setVegetableUpdateLightingFrequency float    freq [virtual]
 

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!!).

Implements NL3D::ULandscape.

Definition at line 368 of file landscape_user.cpp.

References _Landscape, and NL3D_HAUTO_UI_LANDSCAPE.

void NL3D::CLandscapeUser::setVegetableWind const CVector &    windDir,
float    windFreq,
float    windPower,
float    windBendMin
[virtual]
 

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)

Implements NL3D::ULandscape.

Definition at line 360 of file landscape_user.cpp.

References _Landscape, and NL3D_HAUTO_UI_LANDSCAPE.

void NL3D::CLandscapeUser::setZonePath const std::string &    zonePath [virtual]
 

Set the zonePath from where zones are loaded.

Implements NL3D::ULandscape.

Definition at line 48 of file landscape_user.cpp.

References _ZoneManager, and NL3D_HAUTO_UI_LANDSCAPE.

virtual void NL3D::CLandscapeUser::show   [inline, virtual]
 

show the landscape. visible by default.

Implements NL3D::ULandscape.

Definition at line 143 of file landscape_user.h.

References _Landscape, and NL3D_MEM_LANDSCAPE.

void NL3D::CLandscapeUser::updateLightingAll   [virtual]
 

update the lighting of ALL patch (slow method).

NB: work even if UpdateLightingFrequency==0 Additionaly, vegetables are also ALL updated. WARNING!! If Scene Lighting is enabled (usual case), vegetable lighting setup take last Sun setup at UScene::render(). Hence, you should force the new lighting setup with ULandscape::setupVegetableLighting(), before calling updateLightingAll().

Implements NL3D::ULandscape.

Definition at line 438 of file landscape_user.cpp.

References _Landscape, and NL3D_HAUTO_LANDSCAPE_UPDATE_LIGHTING_ALL.


Member Data Documentation

CLandscapeModel* NL3D::CLandscapeUser::_Landscape [private]
 

Definition at line 54 of file landscape_user.h.

Referenced by CLandscapeUser, enableAdditive, enableVegetable, getAllZoneLoaded, getDLMGlobalVegetableColor, getHeightFieldDeltaZ, getLandscape, getPointLightDiffuseMaterial, getThreshold, getTileMaxSubdivision, getTileNear, hide, isAdditiveEnabled, loadAllZonesAround, loadBankFiles, loadVegetableTexture, refreshZonesAround, setDLMGlobalVegetableColor, setHeightField, setPointLightDiffuseMaterial, setPointLightFactor, setThreshold, setTileMaxSubdivision, setTileNear, setUpdateLightingFrequency, setupStaticLight, setupVegetableLighting, setVegetableUpdateLightingFrequency, setVegetableWind, show, updateLightingAll, and ~CLandscapeUser.

CScene* NL3D::CLandscapeUser::_Scene [private]
 

Definition at line 52 of file landscape_user.h.

Referenced by CLandscapeUser, loadBankFiles, and ~CLandscapeUser.

CZoneManager NL3D::CLandscapeUser::_ZoneManager [private]
 

Definition at line 56 of file landscape_user.h.

Referenced by getZoneName, loadAllZonesAround, refreshAllZonesAround, refreshZonesAround, and setZonePath.


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