GroundCover

Engine/source/T3D/fx/groundCover.h

More...

Protected Types

enum
MaskBits {
  TerrainBlockMask = Parent::NextFreeMask << 0
  NextFreeMask = Parent::NextFreeMask << 1
}
CellVector 

Private Types

Parent 

Protected Attributes

This is the allocator for GridCell chunks.

mBillboardAspectScales [MAX_COVERTYPES]

This is a cached array of billboard aspect scales used to avoid some calculations when generating cells.

mBillboardRects [MAX_COVERTYPES]

This is the grid of active cells.

mClumpCountExponent [MAX_COVERTYPES]

An exponent used to bias between the minimum and maximum clump counts for a particular clump.

mClumpRadius [MAX_COVERTYPES]

The maximum clump radius.

bool
mConformToNormal [MAX_COVERTYPES]

conform the x/y rotations to gorund normal

Used for culling cells to update and render.

bool

Debug parameter for locking the culling frustum which will freeze the cover generation.

bool

Debug parameter for turning off billboard rendering.

bool

Debug parameter for turning off shape rendering.

bool

Debug parameter for displaying the grid cells.

This is less than or equal to mRadius and defines when fading of cover elements begins.

This is the index to the first grid cell.

This is the number of cells per axis in the grid.

bool
mInvertLayer [MAX_COVERTYPES]

Inverts the data layer test making the layer an exclusion mask.

Used to detect changes in cell placement count from the global quality scale so we can regen the cells.

mLayer [MAX_COVERTYPES]

Terrain material name to limit coverage to, or left empty to cover entire terrain.

This is the maximum amout of degrees the billboard will tilt down to match the camera.

mMaxClumpCount [MAX_COVERTYPES]

The maximum amount of elements in a clump.

mMaxElevation [MAX_COVERTYPES]

The maximum world space elevation for placement.

The maximum amount of cover elements to include in the grid at any one time.

mMaxRotX [MAX_COVERTYPES]
mMaxRotY [MAX_COVERTYPES]
mMaxSlope [MAX_COVERTYPES]

The maximum slope angle in degrees for placement.

mMinClumpCount [MAX_COVERTYPES]

The minimum amount of elements in a clump.

mMinElevation [MAX_COVERTYPES]

The minimum world space elevation for placement.

mMinRotX [MAX_COVERTYPES]
mMinRotY [MAX_COVERTYPES]
mMinSlope [MAX_COVERTYPES]

The maximum slope angle in degrees for placement.

mNormalizedProbability [MAX_COVERTYPES]

This is the same as mProbability, but normalized for use during the cover placement process.

A shared primitive buffer setup for drawing the maximum amount of billboards you could possibly have in a single cell.

mProbability [MAX_COVERTYPES]

The probability of one cover type verses another.

This is the outer generation radius from the current camera position.

This RNG seed is saved and sent to clients for generating the same cover.

This is used to scale the various culling radii when rendering a reflection...

This is a scratch grid used while updating the cell grid.

This is the distance at which DTS elements are completely culled out.

mShapeFilenames [MAX_COVERTYPES]

The cover shape filenames.

mShapeInstances [MAX_COVERTYPES]

The cover shape instances.

bool

Whether shapes rendered by the GroundCover should cast shadows.

mSizeExponent [MAX_COVERTYPES]

An exponent used to bias between the minimum and maximum random sizes.

mSizeMax [MAX_COVERTYPES]

The maximum random size of this cover type.

mSizeMin [MAX_COVERTYPES]

The minimum random size for each cover type.

The direction of the wind.

Controls how often the wind gust peaks per second.

The length in meters between peaks in the wind gust.

The maximum distance in meters that the peak wind gust will displace an element.

mWindScale [MAX_COVERTYPES]

The wind effect scale.

Controls the overall rapidity of the wind turbulence.

The maximum distance in meters that the turbulence can displace a ground cover element.

Protected Static Attributes

The global ground cover LOD scalar which controls the percentage of the maximum amount of cover to put down.

Stat for number of rendered billboard batches.

Stat for number of rendered billboards.

Stat for number of rendered cells.

Stat for number of rendered shapes.

Public Functions

Called after any property of the object is changed in the world editor.

bool

Called when the object is added to the sim.

Called when the object is removed from the sim.

packUpdate(NetConnection * conn, U32 mask, BitStream * stream)

Instructs this object to pack its state for transfer over the network.

Called when the SceneManager is ready for the registration of render instances.

Instructs this object to read state data previously packed with packUpdate.

Public Static Functions

Returns the current fade scale... see above.

Returns the current quality scale... see above.

Sets the global ground cover fade scalar which controls the percentage of the maximum designed distance to display cover.

Sets the global ground cover LOD scalar which controls the percentage of the maximum designed cover to put down.

Protected Functions

Clears the cell grid and deletes all the free cells.

Clears the cell grid, moves all the allocated cells to the free list, and deletes excess free cells.

_generateCell(const Point2I & index, const Box3F & bounds, U32 placementCount, S32 randSeed)

Generates a new cell using the recycle list when possible.

_initialize(U32 cellCount, U32 cellPlacementCount)

Called when GroundCover parameters are changed and things need to be reinitialized to continue.

bool

Returns a cell to the free list.

Updates the cover grid by removing cells that have fallen outside of mRadius and adding new ones that have come into view.

Detailed Description

Protected Types

MaskBits

Enumerator

TerrainBlockMask = Parent::NextFreeMask << 0
NextFreeMask = Parent::NextFreeMask << 1
typedef Vector< GroundCoverCell * > CellVector 

Private Types

typedef SceneObject Parent 

Public Friends

Protected Attributes

CellVector mAllocCellList 

This is the allocator for GridCell chunks.

F32 mBillboardAspectScales [MAX_COVERTYPES]

This is a cached array of billboard aspect scales used to avoid some calculations when generating cells.

RectF mBillboardRects [MAX_COVERTYPES]
MaterialParameterHandle * mCamRightParam 
MaterialParameterHandle * mCamUpParam 
CellVector mCellGrid 

This is the grid of active cells.

F32 mClumpCountExponent [MAX_COVERTYPES]

An exponent used to bias between the minimum and maximum clump counts for a particular clump.

F32 mClumpRadius [MAX_COVERTYPES]

The maximum clump radius.

bool mConformToNormal [MAX_COVERTYPES]

conform the x/y rotations to gorund normal

Frustum mCuller 

Used for culling cells to update and render.

bool mDebugLockFrustum 

Debug parameter for locking the culling frustum which will freeze the cover generation.

bool mDebugNoBillboards 

Debug parameter for turning off billboard rendering.

bool mDebugNoShapes 

Debug parameter for turning off shape rendering.

bool mDebugRenderCells 

Debug parameter for displaying the grid cells.

MaterialParameterHandle * mFadeParams 
F32 mFadeRadius 

This is less than or equal to mRadius and defines when fading of cover elements begins.

CellVector mFreeCellList 
Point2I mGridIndex 

This is the index to the first grid cell.

U32 mGridSize 

This is the number of cells per axis in the grid.

MaterialParameterHandle * mGustInfoParam 
bool mInvertLayer [MAX_COVERTYPES]

Inverts the data layer test making the layer an exclusion mask.

S32 mLastPlacementCount 

Used to detect changes in cell placement count from the global quality scale so we can regen the cells.

StringTableEntry mLayer [MAX_COVERTYPES]

Terrain material name to limit coverage to, or left empty to cover entire terrain.

Material * mMaterial 
BaseMatInstance * mMatInst 
MaterialParameters * mMatParams 
F32 mMaxBillboardTiltAngle 

This is the maximum amout of degrees the billboard will tilt down to match the camera.

S32 mMaxClumpCount [MAX_COVERTYPES]

The maximum amount of elements in a clump.

F32 mMaxElevation [MAX_COVERTYPES]

The maximum world space elevation for placement.

S32 mMaxPlacement 

The maximum amount of cover elements to include in the grid at any one time.

The actual amount may be less than this based on randomization.

F32 mMaxRotX [MAX_COVERTYPES]
F32 mMaxRotY [MAX_COVERTYPES]
F32 mMaxSlope [MAX_COVERTYPES]

The maximum slope angle in degrees for placement.

S32 mMinClumpCount [MAX_COVERTYPES]

The minimum amount of elements in a clump.

F32 mMinElevation [MAX_COVERTYPES]

The minimum world space elevation for placement.

F32 mMinRotX [MAX_COVERTYPES]
F32 mMinRotY [MAX_COVERTYPES]
F32 mMinSlope [MAX_COVERTYPES]

The maximum slope angle in degrees for placement.

F32 mNormalizedProbability [MAX_COVERTYPES]

This is the same as mProbability, but normalized for use during the cover placement process.


GFXPrimitiveBufferHandle mPrimBuffer 

A shared primitive buffer setup for drawing the maximum amount of billboards you could possibly have in a single cell.

F32 mProbability [MAX_COVERTYPES]

The probability of one cover type verses another.

F32 mRadius 

This is the outer generation radius from the current camera position.

S32 mRandomSeed 

This RNG seed is saved and sent to clients for generating the same cover.

F32 mReflectRadiusScale 

This is used to scale the various culling radii when rendering a reflection...

typically for water.

CellVector mScratchGrid 

This is a scratch grid used while updating the cell grid.

GroundCoverShaderConstData mShaderConstData 
F32 mShapeCullRadius 

This is the distance at which DTS elements are completely culled out.

StringTableEntry mShapeFilenames [MAX_COVERTYPES]

The cover shape filenames.

TSShapeInstance * mShapeInstances [MAX_COVERTYPES]

The cover shape instances.

bool mShapesCastShadows 

Whether shapes rendered by the GroundCover should cast shadows.

F32 mSizeExponent [MAX_COVERTYPES]

An exponent used to bias between the minimum and maximum random sizes.

F32 mSizeMax [MAX_COVERTYPES]

The maximum random size of this cover type.

F32 mSizeMin [MAX_COVERTYPES]

The minimum random size for each cover type.

MaterialParameterHandle * mTurbInfoParam 
MaterialParameterHandle * mTypeRectsParam 
Point2F mWindDirection 

The direction of the wind.

MaterialParameterHandle * mWindDirParam 
F32 mWindGustFrequency 

Controls how often the wind gust peaks per second.

F32 mWindGustLength 

The length in meters between peaks in the wind gust.

F32 mWindGustStrength 

The maximum distance in meters that the peak wind gust will displace an element.

F32 mWindScale [MAX_COVERTYPES]

The wind effect scale.

F32 mWindTurbulenceFrequency 

Controls the overall rapidity of the wind turbulence.

F32 mWindTurbulenceStrength 

The maximum distance in meters that the turbulence can displace a ground cover element.

F32 mZOffset 

Protected Static Attributes

F32 smDensityScale 

The global ground cover LOD scalar which controls the percentage of the maximum amount of cover to put down.

It scales both rendering cost and placement CPU performance.

F32 smFadeScale 
U32 smStatRenderedBatches 

Stat for number of rendered billboard batches.

U32 smStatRenderedBillboards 

Stat for number of rendered billboards.

U32 smStatRenderedCells 

Stat for number of rendered cells.

U32 smStatRenderedShapes 

Stat for number of rendered shapes.

Public Functions

GroundCover()

~GroundCover()

DECLARE_CONOBJECT(GroundCover )

getShaderConstData()

inspectPostApply()

Reimplemented from: SceneObject

onAdd()

Reimplemented from: SceneObject

onRemove()

Reimplemented from: SceneObject

onTerrainUpdated(U32 flags, TerrainBlock * tblock, const Point2I & min, const Point2I & max)

packUpdate(NetConnection * conn, U32 mask, BitStream * stream)

Reimplemented from: SceneObject

prepRenderImage(SceneRenderState * state)

Reimplemented from: SceneObject

unpackUpdate(NetConnection * conn, BitStream * stream)

Reimplemented from: SceneObject

Public Static Functions

consoleInit()

getFadeScale()

Returns the current fade scale... see above.

getQualityScale()

Returns the current quality scale... see above.

initPersistFields()

setFadeScale(F32 scale)

Sets the global ground cover fade scalar which controls the percentage of the maximum designed distance to display cover.

Returns the actual value set.

setQualityScale(F32 scale)

Sets the global ground cover LOD scalar which controls the percentage of the maximum designed cover to put down.

It scales both rendering cost and placement CPU performance. Returns the actual value set.

Protected Functions

_debugRender(ObjectRenderInst * ri, SceneRenderState * state, BaseMatInstance * overrideMat)

_deleteCells()

Clears the cell grid and deletes all the free cells.

_deleteShapes()

_freeCells()

Clears the cell grid, moves all the allocated cells to the free list, and deletes excess free cells.

_generateCell(const Point2I & index, const Box3F & bounds, U32 placementCount, S32 randSeed)

Generates a new cell using the recycle list when possible.

_initialize(U32 cellCount, U32 cellPlacementCount)

Called when GroundCover parameters are changed and things need to be reinitialized to continue.

_initMaterial()

_initShader()

_initShapes()

_recycleCell(GroundCoverCell * cell)

Returns a cell to the free list.

_updateCoverGrid(const Frustum & culler)

Updates the cover grid by removing cells that have fallen outside of mRadius and adding new ones that have come into view.

DECLARE_NET_MATERIALASSET(GroundCover , Material , InitialUpdateMask )