Precipitation

Engine/source/T3D/fx/precipitation.h

More...

Public Types

enum
_Anonymous_ {
  DataMask = Parent::NextFreeMask << 0
  PercentageMask = Parent::NextFreeMask << 1
  StormMask = Parent::NextFreeMask << 2
  TransformMask = Parent::NextFreeMask << 3
  TurbulenceMask = Parent::NextFreeMask << 4
  NextFreeMask = Parent::NextFreeMask << 5
}

Protected Types

Parent 

Protected Attributes

Ambient sound.

bool

Animate the splashes using the frames in the texture.

How high drops will render.

How far away in the x and y directions drops will render.

bool

Whether or not to do collision.

If greater than zero, will animate the drops from the frames in the texture.

Texture handle for raindrop.

Drop linked list head.

Stores the current drop hit mask.

bool

Should drops collide with players.

bool

Should drops collide with vehicles.

The shader used for raindrops.

Droplet billboard size.

The distance at which fading of the particles begins.

The distance at which fading of the particles ends.

bool

Does the system follow the camera or stay where it's placed.

Set it to 0 to disable the glow or use it to control

Used to skip processTick when we haven't been visible.

Maximum mass of drops.

Maximum downward speed of drops.

Coefficient to sin/cos for adding turbulence.

The maximum drops allowed in one render batch.

Minimum mass of drops.

Minimum downward speed of drops.

Number of drops in the scene.

Server-side set var (NOT exposed to console) which controls how many drops are present [0,1].

bool

This enables the precipitation to be rendered during reflection passes.

bool

Rotate the drops relative to the camera velocity This is useful for "streak" type drops.

texture coordinates for splash texture

Texture handle for splash.

Splash linked list head.

How long in milliseconds a splash will last.

The shader used for splashes.

Splash billboard size.

struct Precipitation::@185

texture coords for rain texture

struct Precipitation::@186

How fast the turbulence wraps in a circle.

bool

This enables shading of the drops and splashes by the sun color.

bool

True to use true billboards, false for axis-aligned billboards.

bool

Whether to use turbulence or not (MAY EFFECT PERFORMANCE)

bool

This enables the wind from the sky SceneObject to effect the velocitiy of the drops.

Protected Functions

Adds a drop to the splash list.

Removes a drop from the splash list.

Adds/removes drops from the list to have the right # of drops.

findDropCutoff(Raindrop * drop, const Box3F & box, const VectorF & windVel)

Casts a ray to see if/when a drop will collide.

Re-inits the textures and shaders.

Re-inits the texture coord lookup tables.

Interpolates between tick events.

Deletes the entire drop list.

bool

Called when the object is added to the sim.

Called when the object is removed from the sim.

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

Processes a move event and updates object state once every 32 milliseconds.

Sets the Object -> World transform.

Fills drop info with random velocity, x/y positions, and mass.

Same as spawnDrop except also does z position.

wrapDrop(Raindrop * drop, const Box3F & box, const U32 currTime, const VectorF & windVel)

Wraps a drop within the specified box.

Public Functions

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

bool
onNewDataBlock(GameBaseData * dptr, bool reload)

Called when a new datablock is set.

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

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

setTurbulence(F32 max, F32 speed, U32 ms)

This is used to smoothly change the turbulence over a desired time period.

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

Public Static Functions

Detailed Description

Public Types

@187

Enumerator

DataMask = Parent::NextFreeMask << 0
PercentageMask = Parent::NextFreeMask << 1
StormMask = Parent::NextFreeMask << 2
TransformMask = Parent::NextFreeMask << 3
TurbulenceMask = Parent::NextFreeMask << 4
NextFreeMask = Parent::NextFreeMask << 5

Protected Types

typedef GameBase Parent 

Protected Attributes

SFXSource * mAmbientSound 

Ambient sound.

bool mAnimateSplashes 

Animate the splashes using the frames in the texture.

F32 mBoxHeight 

How high drops will render.

F32 mBoxWidth 

How far away in the x and y directions drops will render.

PrecipitationData * mDataBlock 
GFXStateBlockRef mDefaultSB 
GFXStateBlockRef mDistantSB 
bool mDoCollision 

Whether or not to do collision.

S32 mDropAnimateMS 

If greater than zero, will animate the drops from the frames in the texture.

GFXTexHandle mDropHandle 

Texture handle for raindrop.

Raindrop * mDropHead 

Drop linked list head.

U32 mDropHitMask 

Stores the current drop hit mask.

bool mDropHitPlayers 

Should drops collide with players.

bool mDropHitVehicles 

Should drops collide with vehicles.

GFXShaderRef mDropShader 

The shader used for raindrops.

GFXShaderConstHandle * mDropShaderAmbientSC 
GFXShaderConstHandle * mDropShaderCameraPosSC 
GFXShaderConstBufferRef mDropShaderConsts 
GFXShaderConstHandle * mDropShaderFadeStartEndSC 
GFXShaderConstHandle * mDropShaderModelViewSC 
F32 mDropSize 

Droplet billboard size.

F32 mFadeDistance 

The distance at which fading of the particles begins.

F32 mFadeDistanceEnd 

The distance at which fading of the particles ends.

bool mFollowCam 

Does the system follow the camera or stay where it's placed.

LinearColorF mGlowIntensity 

Set it to 0 to disable the glow or use it to control

the intensity of each channel.

U32 mLastRenderFrame 

Used to skip processTick when we haven't been visible.

F32 mMaxMass 

Maximum mass of drops.

F32 mMaxSpeed 

Maximum downward speed of drops.

F32 mMaxTurbulence 

Coefficient to sin/cos for adding turbulence.

U32 mMaxVBDrops 

The maximum drops allowed in one render batch.

F32 mMinMass 

Minimum mass of drops.

F32 mMinSpeed 

Minimum downward speed of drops.

S32 mNumDrops 

Number of drops in the scene.

F32 mPercentage 

Server-side set var (NOT exposed to console) which controls how many drops are present [0,1].

GFXPrimitiveBufferHandle mRainIB 
GFXVertexBufferHandle< GFXVertexPCT > mRainVB 
bool mReflect 

This enables the precipitation to be rendered during reflection passes.

This is expensive.

bool mRotateWithCamVel 

Rotate the drops relative to the camera velocity This is useful for "streak" type drops.

Point2F * mSplashCoords 

texture coordinates for splash texture

GFXTexHandle mSplashHandle 

Texture handle for splash.

Raindrop * mSplashHead 

Splash linked list head.

S32 mSplashMS 

How long in milliseconds a splash will last.

GFXShaderRef mSplashShader 

The shader used for splashes.

GFXShaderConstHandle * mSplashShaderAmbientSC 
GFXShaderConstHandle * mSplashShaderCameraPosSC 
GFXShaderConstBufferRef mSplashShaderConsts 
GFXShaderConstHandle * mSplashShaderFadeStartEndSC 
GFXShaderConstHandle * mSplashShaderModelViewSC 
F32 mSplashSize 

Splash billboard size.

struct Precipitation::@185 mStormData 
Point2F * mTexCoords 

texture coords for rain texture

struct Precipitation::@186 mTurbulenceData 
F32 mTurbulenceSpeed 

How fast the turbulence wraps in a circle.

bool mUseLighting 

This enables shading of the drops and splashes by the sun color.

bool mUseTrueBillboards 

True to use true billboards, false for axis-aligned billboards.

bool mUseTurbulence 

Whether to use turbulence or not (MAY EFFECT PERFORMANCE)

bool mUseWind 

This enables the wind from the sky SceneObject to effect the velocitiy of the drops.

Public Attributes

F32 endMax 
F32 endPct 
F32 endSpeed 
F32 startMax 
F32 startPct 
F32 startSpeed 
U32 startTime 
U32 totalTime 
bool valid 

Protected Functions

createSplash(Raindrop * drop)

Adds a drop to the splash list.

destroySplash(Raindrop * drop)

Removes a drop from the splash list.

fillDropList()

Adds/removes drops from the list to have the right # of drops.

findDropCutoff(Raindrop * drop, const Box3F & box, const VectorF & windVel)

Casts a ray to see if/when a drop will collide.

getWindVelocity()

initMaterials()

Re-inits the textures and shaders.

initRenderObjects()

Re-inits the texture coord lookup tables.

interpolateTick(F32 delta)

Reimplemented from: ProcessObject

killDropList()

Deletes the entire drop list.

onAdd()

Reimplemented from: SceneObject

onRemove()

Reimplemented from: SceneObject

prepRenderImage(SceneRenderState * state)

Reimplemented from: SceneObject

processTick(const Move * move)

Reimplemented from: ProcessObject

renderObject(ObjectRenderInst * ri, SceneRenderState * state, BaseMatInstance * )

setTransform(const MatrixF & mat)

Reimplemented from: SceneObject

spawnDrop(Raindrop * drop)

Fills drop info with random velocity, x/y positions, and mass.

spawnNewDrop(Raindrop * drop)

Same as spawnDrop except also does z position.

wrapDrop(Raindrop * drop, const Box3F & box, const U32 currTime, const VectorF & windVel)

Wraps a drop within the specified box.

Public Functions

Precipitation()

~Precipitation()

DECLARE_CONOBJECT(Precipitation )

inspectPostApply()

Reimplemented from: SceneObject

modifyStorm(F32 pct, U32 ms)

onNewDataBlock(GameBaseData * dptr, bool reload)

Reimplemented from: GameBase

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

Reimplemented from: SceneObject

setPercentage(F32 pct)

setTurbulence(F32 max, F32 speed, U32 ms)

This is used to smoothly change the turbulence over a desired time period.

Setting ms to zero will cause the change to be instantaneous. Setting max zero will disable turbulence.

unpackUpdate(NetConnection * conn, BitStream * stream)

Reimplemented from: SceneObject

Public Static Functions

initPersistFields()