# 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::CVegetableManager Class Reference

Manager of vegetable. More...

#include <vegetable_manager.h>

List of all members.

CVegetableBlendLayerModel mgt.

void setupRenderStateForBlendLayerModel (IDriver *driver)
 called by CVegetableBlendLayerModel. More...

void exitRenderStateForBlendLayerModel (IDriver *driver)
uint _NumZSortBlendLayers
 For Alpha Blend rdrPass, ordering into layers. More...

float _ZSortLayerDistMax
CScene_ZSortScene
std::vector< CVegetableBlendLayerModel * > _ZSortModelLayers
std::vector< CVegetableBlendLayerModel * > _ZSortModelLayersUW

UpdateLighting management

void doUpdateLighting ()
 update lighting according to _ULNVerticesToUpdate. More...

bool updateLightingIGPart ()
 update part of the RootIg, according to _ULNVerticesToUpdate (while > 0) if all Ig is updated, return true and _ULCurrentIgRdrPass and _ULCurrentIgInstance is updated. More...

uint updateInstanceLighting (CVegetableInstanceGroup *ig, uint rdrPassId, uint instanceId)
 update part of an ig. More...

double _ULPrecTime
bool _ULPrecTimeInit
double _ULTime
float _ULFrequency
 Frequency of update. More...

float _ULNVerticesToUpdate
 Current number of vertices to update. If negative, I have some advance. More...

uint _ULNTotalVertices
 Sum of all ig vertices to update. More...

CVegetableInstanceGroup_ULRootIg
 the priority list of ig to update. More...

uint _ULCurrentIgRdrPass
 Current instance to render in the first ig to update: rdrpass/instanceId. More...

uint _ULCurrentIgInstance

Public Types

enum  TVegetableWater { AboveWater = 0, UnderWater, IntersectWater, VegetInfoLast }
 Micro vegetation position against Water. Above water is the default. More...


Public Methods

 CVegetableManager (uint maxVertexVbHardUnlit, uint maxVertexVbHardLighted, uint nbBlendLayers=NL3D_VEGETABLE_DEFAULT_NUM_BLEND_LAYER, float blendLayerDistMax=NL3D_VEGETABLE_DEFAULT_DIST_MAX)
 ~CVegetableManager ()
void createVegetableBlendLayersModels (CScene *scene)
 Before any render(), you must call this method (else nlassert). More...

Shape management
CVegetableShapegetVegetableShape (const std::string &shape)
 Load a shape if necessary, and return a shapeId for this shape. More...

instance management
CVegetableClipBlockcreateClipBlock ()
 Create a clipBlock where SortBlock will be created. More...

void deleteClipBlock (CVegetableClipBlock *clipBlock)
 delete such a clipBlock. all sortBlocks and so all ig must be deleted before. More...

CVegetableSortBlockcreateSortBlock (CVegetableClipBlock *clipBlock, const CVector &center, float radius)
 Create a SortBlock in a clipBlock where instance group (ig) will be created. More...

void deleteSortBlock (CVegetableSortBlock *sortBlock)
 delete such a SortBlock. all ig must be deleted before. More...

CVegetableInstanceGroupcreateIg (CVegetableSortBlock *sortBlock)
 create an instance group in a sortBlock, where instances will be created. More...

void deleteIg (CVegetableInstanceGroup *ig)
 delete such an ig. More...

Adding Instances to an Ig.
void reserveIgAddInstances (CVegetableInstanceGroupReserve &vegetIgReserve, CVegetableShape *shape, TVegetableWater vegetWaterState, uint numInstances)
 reserve some instance space in an Ig. More...

void reserveIgCompile (CVegetableInstanceGroup *ig, const CVegetableInstanceGroupReserve &vegetIgReserve)
 reserve the space in the ig. More...

void addInstance (CVegetableInstanceGroup *ig, CVegetableShape *shape, const NLMISC::CMatrix &mat, const NLMISC::CRGBAF &ambientColor, const NLMISC::CRGBAF &diffuseColor, float bendFactor, float bendPhase, float bendFreqFactor, float blendDistMax, TVegetableWater vegetWaterState, CVegetableUV8 dlmUV)
 add an instance to an ig, enlarging the associated clipBlock bbox. More...

render
void updateDriver (IDriver *driver)
 must give a driver to the vegetableManager, before any addInstance(). More...

void loadTexture (const std::string &texName)
 load a global texture used for all vegetables (lookup into CPath). More...

void loadTexture (ITexture *itex)
 setup a global texture used for all vegetables (smartPtr-ized). More...

void setDirectionalLight (const CRGBA &ambient, const CRGBA &diffuse, const CVector &light)
 setup the directional light. More...

void lockBuffers ()
 lock any AGP vertex buffers. More...

void unlockBuffers ()
 unlock any AGP vertex buffers. More...

void render (const CVector &viewCenter, const CVector &frontVector, const std::vector< CPlane > &pyramid, ITexture *textureDLM, IDriver *driver)
 render the manager into a driver, with current viewMatrix/frustum/fog setuped Buffers should be unlocked. More...

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

void setTime (double time)
 set the current Time (in seconds). More...

UpdateLighting management
void setUpdateLightingTime (double time)
 set the vegetable manager System Time (in seconds) This time is used for lighting update, and is independent of setTime(). More...

void updateLighting ()
 update the lighting of Igs, within a certain amount of time. More...

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

void updateLightingAll ()
 like updateLighting(), but update ALL vegetable You MUST enclose calls to updateLighting() with lockBuffers() / unlockBuffers(). More...

Profile
void resetNumVegetableFaceRendered ()
 set to 0 the number of faces rendered. More...

uint getNumVegetableFaceRendered () const
 get the number of faces rendered by the vegetable manager. More...


Private Types

typedef std::map< std::string,
CVegetableShape
TShapeMap
typedef TShapeMap::iterator ItShapeMap

Private Methods

uint getRdrPassInfoForShape (CVegetableShape *shape, TVegetableWater vegetWaterState, bool &instanceLighted, bool &instanceDoubleSided, bool &instanceZSort, bool &destLighted, bool &precomputeLighting)
 get the rdrPass and other info for a given shape. More...

CVegetableVBAllocatorgetVBAllocatorForRdrPassAndVBHardMode (uint rdrPass, uint vbHardMode)
 Get the good allocator for the appropriate rdr pass. More...

void initVertexProgram (uint vpType)
 init the ith vertexProgram. More...

void setupVertexProgramConstants (IDriver *driver)
 setup the vertexProgram constants. More...

void swapIgRdrPassHardMode (CVegetableInstanceGroup *, uint rdrPass)
 swap the RdrPass type (hard or soft) of the rdrPass of an instance group. More...


Static Private Methods

bool doubleSidedRdrPass (uint rdrPass)

Private Attributes

NLMISC::CBlockMemory< CVegetableClipBlock_ClipBlockMemory
NLMISC::CBlockMemory< CVegetableSortBlock_SortBlockMemory
NLMISC::CBlockMemory< CVegetableInstanceGroup_InstanceGroupMemory
CTessList< CVegetableClipBlock_ClipBlockList
CTessList< CVegetableClipBlock_EmptyClipBlockList
TShapeMap _ShapeMap
CVegetableVBAllocator _VBHardAllocator [CVegetableVBAllocator::VBTypeCount]
CVegetableVBAllocator _VBSoftAllocator [CVegetableVBAllocator::VBTypeCount]
CVertexProgram_VertexProgram [NL3D_VEGETABLE_NRDRPASS]
CMaterial _VegetableMaterial
CVector _DirectionalLight
NLMISC::CRGBA _GlobalAmbient
NLMISC::CRGBA _GlobalDiffuse
uint _NumVegetableFaceRendered
 profile. More...

NLMISC::CRefPtr< IDriver_LastDriver
Wind animation
CVector _WindDirection
float _WindFrequency
float _WindPower
float _WindBendMin
double _Time
double _WindPrecRenderTime
double _WindAnimTime
float _CosTable [NL3D_VEGETABLE_VP_LUT_SIZE]
NLMISC::CVector2f _WindTable [NL3D_VEGETABLE_VP_LUT_SIZE]
NLMISC::CVector2f _WindDeltaTable [NL3D_VEGETABLE_VP_LUT_SIZE]
Misc data to setup renderState (computed at each render())
CVector _AngleAxis
CVector _ViewCenter
bool _BkupFog
NLMISC::CMatrix _ManagerMatrix

Friends

class CVegetableBlendLayerModel


Detailed Description

Manager of vegetable.

Instance Factory and rendering. A VegetableManager should be put into a CScene model which is Opaque (ie rendered in Opaque pass), and call vegetableManager::render() at this time. a good example is CLandscape.

Because during render(), it uses and setup special "Vegetable Blend Layer models" to render transparents alpha blended vegetables. Toses models are transparent so they are drawn during the transparent pass of the renderTrav's CScene (so after the Opaque pass).

Author:
Lionel Berenguier , Nevrax France
Date:
2001

Definition at line 75 of file vegetable_manager.h.


Member Typedef Documentation

typedef TShapeMap::iterator NL3D::CVegetableManager::ItShapeMap [private]
 

Definition at line 301 of file vegetable_manager.h.

Referenced by getVegetableShape.

typedef std::map<std::string, CVegetableShape> NL3D::CVegetableManager::TShapeMap [private]
 

Definition at line 300 of file vegetable_manager.h.


Member Enumeration Documentation

enum NL3D::CVegetableManager::TVegetableWater
 

Micro vegetation position against Water. Above water is the default.

Enumeration values:
AboveWater 
UnderWater 
IntersectWater 
VegetInfoLast 

Definition at line 79 of file vegetable_manager.h.


Constructor & Destructor Documentation

NL3D::CVegetableManager::CVegetableManager uint    maxVertexVbHardUnlit,
uint    maxVertexVbHardLighted,
uint    nbBlendLayers = NL3D_VEGETABLE_DEFAULT_NUM_BLEND_LAYER,
float    blendLayerDistMax = NL3D_VEGETABLE_DEFAULT_DIST_MAX
 

Parameters:
maxVertexVbHardUnlit  maximum VertexCount in VBHard for Unlit (or precomputed lighted) vegetables
maxVertexVbHardLighted  maximum VertexCount in VBHard for Lighted vegetables
nbBlendLayers  for ZSort/AlphaBlend rdrPass: number of layers of vegetables rendered independently.
blendLayerDistMax  for ZSort/AlphaBlend rdrPass: distance of the farest layer.

Definition at line 58 of file vegetable_manager.cpp.

References _CosTable, _DirectionalLight, _GlobalAmbient, _GlobalDiffuse, _NumVegetableFaceRendered, _NumZSortBlendLayers, _Time, _ULCurrentIgInstance, _ULCurrentIgRdrPass, _ULFrequency, _ULNTotalVertices, _ULNVerticesToUpdate, _ULPrecTime, _ULPrecTimeInit, _ULRootIg, _ULTime, _VBHardAllocator, _VBSoftAllocator, _VegetableMaterial, _VertexProgram, _WindAnimTime, _WindBendMin, _WindDirection, _WindFrequency, _WindPower, _WindPrecRenderTime, _ZSortModelLayers, _ZSortModelLayersUW, NL3D_VEGETABLE_CLIP_BLOCK_BLOCKSIZE, NL3D_VEGETABLE_INSTANCE_GROUP_BLOCKSIZE, NL3D_VEGETABLE_NRDRPASS, NL3D_VEGETABLE_SORT_BLOCK_BLOCKSIZE, NL3D_VEGETABLE_VP_LUT_SIZE, nlassert, NLMISC::Pi, and NLMISC::CRGBA::set.

NL3D::CVegetableManager::~CVegetableManager  
 

Definition at line 129 of file vegetable_manager.cpp.

References _NumZSortBlendLayers, _VertexProgram, _ZSortModelLayers, _ZSortModelLayersUW, _ZSortScene, and NL3D_VEGETABLE_NRDRPASS.


Member Function Documentation

void NL3D::CVegetableManager::addInstance CVegetableInstanceGroup   ig,
CVegetableShape   shape,
const NLMISC::CMatrix   mat,
const NLMISC::CRGBAF   ambientColor,
const NLMISC::CRGBAF   diffuseColor,
float    bendFactor,
float    bendPhase,
float    bendFreqFactor,
float    blendDistMax,
TVegetableWater    vegetWaterState,
CVegetableUV8    dlmUV
 

add an instance to an ig, enlarging the associated clipBlock bbox.

If the shape is not lighted, then only diffuseColor is used, to setup color per vertex. Warning! Use OptFastFloor()! So call must be enclosed with a OptFastFloorBegin()/OptFastFloorEnd().

Also, buffer must be locked.

ambientColor and diffuseColor should be in [0..1] (no clamp), else uint8 will wrap...

nlassert() if no sufficient space reserved in reserveIgCompile().

Parameters:
dlmUV  is the dynamic lightmap UV for this vegetable.
See also:
reserveIgAddInstances() reserveIgCompile()

Definition at line 1148 of file vegetable_manager.cpp.

References _DirectionalLight, _GlobalAmbient, _GlobalDiffuse, _ULNTotalVertices, _ULRootIg, AboveWater, NLMISC::CRGBAF::B, NL3D::computeVegetVertexLighting, NL3D::computeVegetVertexLightingForceBestSided, NLMISC::CRGBAF::G, NLMISC::CMatrix::getPos, getRdrPassInfoForShape, getVBAllocatorForRdrPassAndVBHardMode, min, NLMISC::CMatrix::mulVector, NL3D_VEGETABLE_BLOCK_BLEND_TRANSITION_DIST, NL3D_VEGETABLE_FREQUENCY_FACTOR_PREC, NL3D_VEGETABLE_NUM_QUADRANT, NL3D_VEGETABLE_RDRPASS_UNLIT_2SIDED_ZSORT, NL3D_VEGETABLE_VPPOS_BENDINFO, NL3D_VEGETABLE_VPPOS_CENTER, NL3D_VEGETABLE_VPPOS_COLOR0, NL3D_VEGETABLE_VPPOS_COLOR1, NL3D_VEGETABLE_VPPOS_NORMAL, NL3D_VEGETABLE_VPPOS_TEX0, nlassert, NL3D::OptFastFloor, NLMISC::CRGBAF::R, swapIgRdrPassHardMode, UnderWater, and v.

CVegetableClipBlock * NL3D::CVegetableManager::createClipBlock  
 

Create a clipBlock where SortBlock will be created.

Definition at line 672 of file vegetable_manager.cpp.

References _ClipBlockMemory, _EmptyClipBlockList, and NLMISC::CBlockMemory< CVegetableClipBlock >::allocate.

CVegetableInstanceGroup * NL3D::CVegetableManager::createIg CVegetableSortBlock   sortBlock
 

create an instance group in a sortBlock, where instances will be created.

Instances will be frustum-clipped by the clipBlock, and sorted (for the ZSort rdrPass only) by sortBlock.

Definition at line 737 of file vegetable_manager.cpp.

References _ClipBlockList, _EmptyClipBlockList, _InstanceGroupMemory, NLMISC::CBlockMemory< CVegetableInstanceGroup >::allocate, NL3D_VEGETABLE_RDRPASS_UNLIT_2SIDED_ZSORT, and nlassert.

CVegetableSortBlock * NL3D::CVegetableManager::createSortBlock CVegetableClipBlock   clipBlock,
const CVector &    center,
float    radius
 

Create a SortBlock in a clipBlock where instance group (ig) will be created.

All AlphaBlend instances created in a SortBlock should have the same vegetWaterState: AboveWater or UnderWater. Each time an instance is added to the sortBlock it changes the _UnderWater state of the sortBlock.

Parameters:
center  you must give an approximate center for the sortBlock (for sorting)
radius  you must give an approximate radius for the sortBlock (for the system to know when you are IN the sortBlock, and then to sort in a better way)

Definition at line 702 of file vegetable_manager.cpp.

References _SortBlockMemory, NLMISC::CBlockMemory< CVegetableSortBlock >::allocate, and nlassert.

void NL3D::CVegetableManager::createVegetableBlendLayersModels CScene   scene
 

Before any render(), you must call this method (else nlassert).

It creates the necessary models in the scene, to manage AlphaBlending correctly. Those models are deleted in the object dtor.

Definition at line 156 of file vegetable_manager.cpp.

References _NumZSortBlendLayers, _ZSortModelLayers, _ZSortModelLayersUW, _ZSortScene, CVegetableBlendLayerModel, nlassert, and NL3D::VegetableBlendLayerModelId.

void NL3D::CVegetableManager::deleteClipBlock CVegetableClipBlock   clipBlock
 

delete such a clipBlock. all sortBlocks and so all ig must be deleted before.

Definition at line 685 of file vegetable_manager.cpp.

References _ClipBlockMemory, _EmptyClipBlockList, NLMISC::CBlockMemory< CVegetableClipBlock >::free, and nlassert.

void NL3D::CVegetableManager::deleteIg CVegetableInstanceGroup   ig
 

delete such an ig.

After doing this, you must call igSortBlockOwner->updateSortBlock() If the sortBlock has many Igs, you can do it after deleting all your igs.

Definition at line 771 of file vegetable_manager.cpp.

References _ClipBlockList, _EmptyClipBlockList, _InstanceGroupMemory, _ULCurrentIgInstance, _ULCurrentIgRdrPass, _ULNTotalVertices, _ULRootIg, NLMISC::CBlockMemory< CVegetableInstanceGroup >::free, getVBAllocatorForRdrPassAndVBHardMode, NL3D_VEGETABLE_NRDRPASS, and nlassert.

void NL3D::CVegetableManager::deleteSortBlock CVegetableSortBlock   sortBlock
 

delete such a SortBlock. all ig must be deleted before.

Definition at line 720 of file vegetable_manager.cpp.

References _SortBlockMemory, NLMISC::CBlockMemory< CVegetableSortBlock >::free, and nlassert.

bool NL3D::CVegetableManager::doubleSidedRdrPass uint    rdrPass [static, private]
 

Definition at line 1669 of file vegetable_manager.cpp.

References NL3D_VEGETABLE_NRDRPASS, NL3D_VEGETABLE_RDRPASS_LIGHTED_2SIDED, NL3D_VEGETABLE_RDRPASS_UNLIT_2SIDED, NL3D_VEGETABLE_RDRPASS_UNLIT_2SIDED_ZSORT, and nlassert.

Referenced by render, and setupRenderStateForBlendLayerModel.

void NL3D::CVegetableManager::doUpdateLighting   [private]
 

update lighting according to _ULNVerticesToUpdate.

Definition at line 2381 of file vegetable_manager.cpp.

References _ULNVerticesToUpdate, _ULRootIg, and updateLightingIGPart.

Referenced by updateLighting, and updateLightingAll.

void NL3D::CVegetableManager::exitRenderStateForBlendLayerModel IDriver   driver [private]
 

Definition at line 2296 of file vegetable_manager.cpp.

References _BkupFog.

uint NL3D::CVegetableManager::getNumVegetableFaceRendered   const
 

get the number of faces rendered by the vegetable manager.

Definition at line 2289 of file vegetable_manager.cpp.

References _NumVegetableFaceRendered.

uint NL3D::CVegetableManager::getRdrPassInfoForShape CVegetableShape   shape,
TVegetableWater    vegetWaterState,
bool &    instanceLighted,
bool &    instanceDoubleSided,
bool &    instanceZSort,
bool &    destLighted,
bool &    precomputeLighting
[private]
 

get the rdrPass and other info for a given shape.

Definition at line 882 of file vegetable_manager.cpp.

References IntersectWater, NL3D_VEGETABLE_RDRPASS_LIGHTED, NL3D_VEGETABLE_RDRPASS_LIGHTED_2SIDED, NL3D_VEGETABLE_RDRPASS_UNLIT, NL3D_VEGETABLE_RDRPASS_UNLIT_2SIDED, and NL3D_VEGETABLE_RDRPASS_UNLIT_2SIDED_ZSORT.

Referenced by addInstance, and reserveIgAddInstances.

CVegetableVBAllocator & NL3D::CVegetableManager::getVBAllocatorForRdrPassAndVBHardMode uint    rdrPass,
uint    vbHardMode
[private]
 

Get the good allocator for the appropriate rdr pass.

Definition at line 182 of file vegetable_manager.cpp.

References _VBHardAllocator, _VBSoftAllocator, NL3D_VEGETABLE_RDRPASS_LIGHTED, NL3D_VEGETABLE_RDRPASS_LIGHTED_2SIDED, NL3D_VEGETABLE_RDRPASS_UNLIT, NL3D_VEGETABLE_RDRPASS_UNLIT_2SIDED, NL3D_VEGETABLE_RDRPASS_UNLIT_2SIDED_ZSORT, and nlstop.

Referenced by addInstance, deleteIg, render, swapIgRdrPassHardMode, and updateInstanceLighting.

CVegetableShape * NL3D::CVegetableManager::getVegetableShape const std::string &    shape
 

Load a shape if necessary, and return a shapeId for this shape.

Definition at line 846 of file vegetable_manager.cpp.

References _ShapeMap, ItShapeMap, and nlwarning.

void NL3D::CVegetableManager::initVertexProgram uint    vpType [private]
 

init the ith vertexProgram.

Definition at line 611 of file vegetable_manager.cpp.

References _LastDriver, _VertexProgram, NL3D::NL3D_BendProgram, NL3D::NL3D_CommonEndVegetableProgram, NL3D::NL3D_FastBendProgram, NL3D::NL3D_LightedMiddle1SidedVegetableProgram, NL3D::NL3D_LightedMiddle2SidedVegetableProgram, NL3D::NL3D_LightedStartVegetableProgram, NL3D::NL3D_UnlitMiddle1SidedAlphaBlendVegetableProgram, NL3D::NL3D_UnlitMiddle1SidedVegetableProgram, NL3D::NL3D_UnlitMiddle2SidedAlphaBlendVegetableProgram, NL3D::NL3D_UnlitMiddle2SidedVegetableProgram, NL3D::NL3D_UnlitStartVegetableProgram, NL3D_VEGETABLE_RDRPASS_LIGHTED, NL3D_VEGETABLE_RDRPASS_LIGHTED_2SIDED, NL3D_VEGETABLE_RDRPASS_UNLIT, NL3D_VEGETABLE_RDRPASS_UNLIT_2SIDED, NL3D_VEGETABLE_RDRPASS_UNLIT_2SIDED_ZSORT, and nlassert.

Referenced by updateDriver.

void NL3D::CVegetableManager::loadTexture ITexture   itex
 

setup a global texture used for all vegetables (smartPtr-ized).

Definition at line 1713 of file vegetable_manager.cpp.

References _VegetableMaterial.

void NL3D::CVegetableManager::loadTexture const std::string &    texName
 

load a global texture used for all vegetables (lookup into CPath).

void NL3D::CVegetableManager::lockBuffers  
 

lock any AGP vertex buffers.

Do it wisely (just one time before refine as example). You MUST enclose calls to addInstance() (and so CVegetable::generateInstance()) with lockBuffers() / unlockBuffers().

Definition at line 1731 of file vegetable_manager.cpp.

References _VBHardAllocator, and _VBSoftAllocator.

void NL3D::CVegetableManager::render const CVector &    viewCenter,
const CVector &    frontVector,
const std::vector< CPlane > &    pyramid,
ITexture   textureDLM,
IDriver   driver
 

render the manager into a driver, with current viewMatrix/frustum/fog setuped Buffers should be unlocked.

Parameters:
textureDLM  is the dynamic lightmap to use. can be NULL if don't want DLM

Definition at line 1822 of file vegetable_manager.cpp.

References _AngleAxis, _ClipBlockList, _CosTable, _ManagerMatrix, _NumVegetableFaceRendered, _NumZSortBlendLayers, _Time, _VegetableMaterial, _VertexProgram, _ViewCenter, _WindAnimTime, _WindBendMin, _WindDeltaTable, _WindDirection, _WindFrequency, _WindPower, _WindPrecRenderTime, _WindTable, _ZSortLayerDistMax, _ZSortModelLayers, _ZSortModelLayersUW, NLMISC::clamp, doubleSidedRdrPass, getVBAllocatorForRdrPassAndVBHardMode, H_AUTO, NLMISC::CMatrix::identity, NL3D_VEGETABLE_FREQUENCY_FACTOR_PREC, NL3D_VEGETABLE_NRDRPASS, NL3D_VEGETABLE_NUM_QUADRANT, NL3D_VEGETABLE_RDRPASS_UNLIT_2SIDED_ZSORT, NL3D_VEGETABLE_VP_LUT_SIZE, nlassert, nlverify, NL3D::OptFastFloor, NLMISC::CMatrix::setPos, setupVertexProgramConstants, updateDriver, and z.

void NL3D::CVegetableManager::reserveIgAddInstances CVegetableInstanceGroupReserve   vegetIgReserve,
CVegetableShape   shape,
TVegetableWater    vegetWaterState,
uint    numInstances
 

reserve some instance space in an Ig.

nothing is really done here, after doing this for all shapes of your ig, you must call reserveIgCompile()

Parameters:
vegetIgReserve  the object where space required for the ig is added

Definition at line 921 of file vegetable_manager.cpp.

References getRdrPassInfoForShape.

void NL3D::CVegetableManager::reserveIgCompile CVegetableInstanceGroup   ig,
const CVegetableInstanceGroupReserve   vegetIgReserve
 

reserve the space in the ig.

nlassert() if the ig is not empty.

See also:
reserveIgAddInstances()

Definition at line 947 of file vegetable_manager.cpp.

References NL3D_VEGETABLE_NRDRPASS, NL3D_VEGETABLE_NUM_QUADRANT, NL3D_VEGETABLE_RDRPASS_UNLIT_2SIDED_ZSORT, and nlassert.

void NL3D::CVegetableManager::resetNumVegetableFaceRendered  
 

set to 0 the number of faces rendered.

Definition at line 2282 of file vegetable_manager.cpp.

References _NumVegetableFaceRendered.

void NL3D::CVegetableManager::setDirectionalLight const CRGBA &    ambient,
const CRGBA &    diffuse,
const CVector &    light
 

setup the directional light.

Definition at line 1721 of file vegetable_manager.cpp.

References _DirectionalLight, _GlobalAmbient, and _GlobalDiffuse.

void NL3D::CVegetableManager::setTime double    time
 

set the current Time (in seconds).

For Wind animation

Definition at line 2325 of file vegetable_manager.cpp.

References _Time.

void NL3D::CVegetableManager::setUpdateLightingFrequency float    freq
 

set the frequency of 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 2399 of file vegetable_manager.cpp.

References _ULFrequency.

void NL3D::CVegetableManager::setUpdateLightingTime double    time
 

set the vegetable manager System Time (in seconds) This time is used for lighting update, and is independent of setTime().

Definition at line 2340 of file vegetable_manager.cpp.

References _ULTime.

void NL3D::CVegetableManager::setupRenderStateForBlendLayerModel IDriver   driver [private]
 

called by CVegetableBlendLayerModel.

Definition at line 2248 of file vegetable_manager.cpp.

References _BkupFog, _ManagerMatrix, _VegetableMaterial, _VertexProgram, doubleSidedRdrPass, NL3D_VEGETABLE_RDRPASS_UNLIT_2SIDED_ZSORT, nlverify, and setupVertexProgramConstants.

void NL3D::CVegetableManager::setupVertexProgramConstants IDriver   driver [private]
 

setup the vertexProgram constants.

Definition at line 1773 of file vegetable_manager.cpp.

References _AngleAxis, _DirectionalLight, _ViewCenter, _WindAnimTime, _WindBendMin, _WindDeltaTable, _WindPower, _WindTable, NL3D_VEGETABLE_BLOCK_BLEND_TRANSITION_DIST, NL3D_VEGETABLE_VP_LUT_SIZE, and NLMISC::Pi.

Referenced by render, and setupRenderStateForBlendLayerModel.

void NL3D::CVegetableManager::setWind const CVector &    windDir,
float    windFreq,
float    windPower,
float    windBendMin
 

set the 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 2311 of file vegetable_manager.cpp.

References _WindBendMin, _WindDirection, _WindFrequency, _WindPower, and NLMISC::clamp.

void NL3D::CVegetableManager::swapIgRdrPassHardMode CVegetableInstanceGroup  ,
uint    rdrPass
[private]
 

swap the RdrPass type (hard or soft) of the rdrPass of an instance group.

vertices are allocated in other VBallocator, copied and freed in the old VBallocator.

Definition at line 1605 of file vegetable_manager.cpp.

References getVBAllocatorForRdrPassAndVBHardMode, and nlassert.

Referenced by addInstance.

void NL3D::CVegetableManager::unlockBuffers  
 

unlock any AGP vertex buffers.

Definition at line 1742 of file vegetable_manager.cpp.

References _VBHardAllocator, and _VBSoftAllocator.

void NL3D::CVegetableManager::updateDriver IDriver   driver
 

must give a driver to the vegetableManager, before any addInstance().

Definition at line 1678 of file vegetable_manager.cpp.

References _LastDriver, _VBHardAllocator, _VBSoftAllocator, initVertexProgram, and NL3D_VEGETABLE_NRDRPASS.

Referenced by render.

uint NL3D::CVegetableManager::updateInstanceLighting CVegetableInstanceGroup   ig,
uint    rdrPassId,
uint    instanceId
[private]
 

update part of an ig.

Do not use/modify _UL* return number of vertices processed (nb vertices of the shape)

Definition at line 2473 of file vegetable_manager.cpp.

References _DirectionalLight, _GlobalAmbient, _GlobalDiffuse, NL3D::computeVegetVertexLighting, NL3D::computeVegetVertexLightingForceBestSided, getVBAllocatorForRdrPassAndVBHardMode, NL3D_VEGETABLE_NRDRPASS, NL3D_VEGETABLE_VPPOS_COLOR0, NL3D_VEGETABLE_VPPOS_COLOR1, and nlassert.

Referenced by updateLightingIGPart.

void NL3D::CVegetableManager::updateLighting  
 

update the lighting of Igs, within a certain amount of time.

You MUST enclose calls to updateLighting() with lockBuffers() / unlockBuffers().

Definition at line 2347 of file vegetable_manager.cpp.

References _ULFrequency, _ULNTotalVertices, _ULNVerticesToUpdate, _ULPrecTime, _ULPrecTimeInit, _ULTime, doUpdateLighting, and min.

void NL3D::CVegetableManager::updateLightingAll  
 

like updateLighting(), but update ALL vegetable You MUST enclose calls to updateLighting() with lockBuffers() / unlockBuffers().

Definition at line 2370 of file vegetable_manager.cpp.

References _ULNTotalVertices, _ULNVerticesToUpdate, and doUpdateLighting.

bool NL3D::CVegetableManager::updateLightingIGPart   [private]
 

update part of the RootIg, according to _ULNVerticesToUpdate (while > 0) if all Ig is updated, return true and _ULCurrentIgRdrPass and _ULCurrentIgInstance is updated.

Definition at line 2407 of file vegetable_manager.cpp.

References _ULCurrentIgInstance, _ULCurrentIgRdrPass, _ULNVerticesToUpdate, _ULRootIg, NL3D_VEGETABLE_NRDRPASS, nlassert, and updateInstanceLighting.

Referenced by doUpdateLighting.


Friends And Related Function Documentation

friend class CVegetableBlendLayerModel [friend]
 

Definition at line 287 of file vegetable_manager.h.

Referenced by createVegetableBlendLayersModels.


Member Data Documentation

CVector NL3D::CVegetableManager::_AngleAxis [private]
 

Definition at line 378 of file vegetable_manager.h.

Referenced by render, and setupVertexProgramConstants.

bool NL3D::CVegetableManager::_BkupFog [private]
 

Definition at line 380 of file vegetable_manager.h.

Referenced by exitRenderStateForBlendLayerModel, and setupRenderStateForBlendLayerModel.

CTessList<CVegetableClipBlock> NL3D::CVegetableManager::_ClipBlockList [private]
 

Definition at line 294 of file vegetable_manager.h.

Referenced by createIg, deleteIg, and render.

NLMISC::CBlockMemory<CVegetableClipBlock> NL3D::CVegetableManager::_ClipBlockMemory [private]
 

Definition at line 289 of file vegetable_manager.h.

Referenced by createClipBlock, and deleteClipBlock.

float NL3D::CVegetableManager::_CosTable[NL3D_VEGETABLE_VP_LUT_SIZE] [private]
 

Definition at line 366 of file vegetable_manager.h.

Referenced by CVegetableManager, and render.

CVector NL3D::CVegetableManager::_DirectionalLight [private]
 

Definition at line 316 of file vegetable_manager.h.

Referenced by addInstance, CVegetableManager, setDirectionalLight, setupVertexProgramConstants, and updateInstanceLighting.

CTessList<CVegetableClipBlock> NL3D::CVegetableManager::_EmptyClipBlockList [private]
 

Definition at line 296 of file vegetable_manager.h.

Referenced by createClipBlock, createIg, deleteClipBlock, and deleteIg.

NLMISC::CRGBA NL3D::CVegetableManager::_GlobalAmbient [private]
 

Definition at line 317 of file vegetable_manager.h.

Referenced by addInstance, CVegetableManager, setDirectionalLight, and updateInstanceLighting.

NLMISC::CRGBA NL3D::CVegetableManager::_GlobalDiffuse [private]
 

Definition at line 318 of file vegetable_manager.h.

Referenced by addInstance, CVegetableManager, setDirectionalLight, and updateInstanceLighting.

NLMISC::CBlockMemory<CVegetableInstanceGroup> NL3D::CVegetableManager::_InstanceGroupMemory [private]
 

Definition at line 291 of file vegetable_manager.h.

Referenced by createIg, and deleteIg.

NLMISC::CRefPtr<IDriver> NL3D::CVegetableManager::_LastDriver [private]
 

Definition at line 448 of file vegetable_manager.h.

Referenced by initVertexProgram, and updateDriver.

NLMISC::CMatrix NL3D::CVegetableManager::_ManagerMatrix [private]
 

Definition at line 382 of file vegetable_manager.h.

Referenced by render, and setupRenderStateForBlendLayerModel.

uint NL3D::CVegetableManager::_NumVegetableFaceRendered [private]
 

profile.

Definition at line 322 of file vegetable_manager.h.

Referenced by CVegetableManager, getNumVegetableFaceRendered, render, and resetNumVegetableFaceRendered.

uint NL3D::CVegetableManager::_NumZSortBlendLayers [private]
 

For Alpha Blend rdrPass, ordering into layers.

Definition at line 392 of file vegetable_manager.h.

Referenced by createVegetableBlendLayersModels, CVegetableManager, render, and ~CVegetableManager.

TShapeMap NL3D::CVegetableManager::_ShapeMap [private]
 

Definition at line 302 of file vegetable_manager.h.

Referenced by getVegetableShape.

NLMISC::CBlockMemory<CVegetableSortBlock> NL3D::CVegetableManager::_SortBlockMemory [private]
 

Definition at line 290 of file vegetable_manager.h.

Referenced by createSortBlock, and deleteSortBlock.

double NL3D::CVegetableManager::_Time [private]
 

Definition at line 360 of file vegetable_manager.h.

Referenced by CVegetableManager, render, and setTime.

uint NL3D::CVegetableManager::_ULCurrentIgInstance [private]
 

Definition at line 428 of file vegetable_manager.h.

Referenced by CVegetableManager, deleteIg, and updateLightingIGPart.

uint NL3D::CVegetableManager::_ULCurrentIgRdrPass [private]
 

Current instance to render in the first ig to update: rdrpass/instanceId.

Definition at line 427 of file vegetable_manager.h.

Referenced by CVegetableManager, deleteIg, and updateLightingIGPart.

float NL3D::CVegetableManager::_ULFrequency [private]
 

Frequency of update.

Definition at line 419 of file vegetable_manager.h.

Referenced by CVegetableManager, setUpdateLightingFrequency, and updateLighting.

uint NL3D::CVegetableManager::_ULNTotalVertices [private]
 

Sum of all ig vertices to update.

Definition at line 423 of file vegetable_manager.h.

Referenced by addInstance, CVegetableManager, deleteIg, updateLighting, and updateLightingAll.

float NL3D::CVegetableManager::_ULNVerticesToUpdate [private]
 

Current number of vertices to update. If negative, I have some advance.

Definition at line 421 of file vegetable_manager.h.

Referenced by CVegetableManager, doUpdateLighting, updateLighting, updateLightingAll, and updateLightingIGPart.

double NL3D::CVegetableManager::_ULPrecTime [private]
 

Definition at line 414 of file vegetable_manager.h.

Referenced by CVegetableManager, and updateLighting.

bool NL3D::CVegetableManager::_ULPrecTimeInit [private]
 

Definition at line 415 of file vegetable_manager.h.

Referenced by CVegetableManager, and updateLighting.

CVegetableInstanceGroup* NL3D::CVegetableManager::_ULRootIg [private]
 

the priority list of ig to update.

Definition at line 425 of file vegetable_manager.h.

Referenced by addInstance, CVegetableManager, deleteIg, doUpdateLighting, and updateLightingIGPart.

double NL3D::CVegetableManager::_ULTime [private]
 

Definition at line 416 of file vegetable_manager.h.

Referenced by CVegetableManager, setUpdateLightingTime, and updateLighting.

CVegetableVBAllocator NL3D::CVegetableManager::_VBHardAllocator[CVegetableVBAllocator::VBTypeCount] [private]
 

Definition at line 306 of file vegetable_manager.h.

Referenced by CVegetableManager, getVBAllocatorForRdrPassAndVBHardMode, lockBuffers, unlockBuffers, and updateDriver.

CVegetableVBAllocator NL3D::CVegetableManager::_VBSoftAllocator[CVegetableVBAllocator::VBTypeCount] [private]
 

Definition at line 308 of file vegetable_manager.h.

Referenced by CVegetableManager, getVBAllocatorForRdrPassAndVBHardMode, lockBuffers, unlockBuffers, and updateDriver.

CMaterial NL3D::CVegetableManager::_VegetableMaterial [private]
 

Definition at line 314 of file vegetable_manager.h.

Referenced by CVegetableManager, loadTexture, render, and setupRenderStateForBlendLayerModel.

CVertexProgram* NL3D::CVegetableManager::_VertexProgram[NL3D_VEGETABLE_NRDRPASS] [private]
 

Definition at line 310 of file vegetable_manager.h.

Referenced by CVegetableManager, initVertexProgram, render, setupRenderStateForBlendLayerModel, and ~CVegetableManager.

CVector NL3D::CVegetableManager::_ViewCenter [private]
 

Definition at line 379 of file vegetable_manager.h.

Referenced by render, and setupVertexProgramConstants.

double NL3D::CVegetableManager::_WindAnimTime [private]
 

Definition at line 363 of file vegetable_manager.h.

Referenced by CVegetableManager, render, and setupVertexProgramConstants.

float NL3D::CVegetableManager::_WindBendMin [private]
 

Definition at line 358 of file vegetable_manager.h.

Referenced by CVegetableManager, render, setupVertexProgramConstants, and setWind.

NLMISC::CVector2f NL3D::CVegetableManager::_WindDeltaTable[NL3D_VEGETABLE_VP_LUT_SIZE] [private]
 

Definition at line 369 of file vegetable_manager.h.

Referenced by render, and setupVertexProgramConstants.

CVector NL3D::CVegetableManager::_WindDirection [private]
 

Definition at line 355 of file vegetable_manager.h.

Referenced by CVegetableManager, render, and setWind.

float NL3D::CVegetableManager::_WindFrequency [private]
 

Definition at line 356 of file vegetable_manager.h.

Referenced by CVegetableManager, render, and setWind.

float NL3D::CVegetableManager::_WindPower [private]
 

Definition at line 357 of file vegetable_manager.h.

Referenced by CVegetableManager, render, setupVertexProgramConstants, and setWind.

double NL3D::CVegetableManager::_WindPrecRenderTime [private]
 

Definition at line 361 of file vegetable_manager.h.

Referenced by CVegetableManager, and render.

NLMISC::CVector2f NL3D::CVegetableManager::_WindTable[NL3D_VEGETABLE_VP_LUT_SIZE] [private]
 

Definition at line 368 of file vegetable_manager.h.

Referenced by render, and setupVertexProgramConstants.

float NL3D::CVegetableManager::_ZSortLayerDistMax [private]
 

Definition at line 393 of file vegetable_manager.h.

Referenced by render.

std::vector<CVegetableBlendLayerModel*> NL3D::CVegetableManager::_ZSortModelLayers [private]
 

Definition at line 395 of file vegetable_manager.h.

Referenced by createVegetableBlendLayersModels, CVegetableManager, render, and ~CVegetableManager.

std::vector<CVegetableBlendLayerModel*> NL3D::CVegetableManager::_ZSortModelLayersUW [private]
 

Definition at line 397 of file vegetable_manager.h.

Referenced by createVegetableBlendLayersModels, CVegetableManager, render, and ~CVegetableManager.

CScene* NL3D::CVegetableManager::_ZSortScene [private]
 

Definition at line 394 of file vegetable_manager.h.

Referenced by createVegetableBlendLayersModels, and ~CVegetableManager.


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