torque Torque Game Engine Documentation
TGE Version 1.5.2

Precipitation Class Reference

#include <precipitation.h>

Inheritance diagram for Precipitation:

Inheritance graph
[legend]

Public Types

enum  {
  DataMask = Parent::NextFreeMask << 0,
  PercentageMask = Parent::NextFreeMask << 1,
  StormMask = Parent::NextFreeMask << 2,
  NextFreeMask = Parent::NextFreeMask << 3
}

Public Member Functions

 Precipitation ()
 ~Precipitation ()
void inspectPostApply ()
 Called after any property of the object is changed in the world editor.
bool onNewDataBlock (GameBaseData *dptr)
 Called when a new datablock is set.
 DECLARE_CONOBJECT (Precipitation)
U32 packUpdate (NetConnection *, U32 mask, BitStream *stream)
 Instructs this object to pack its state for transfer over the network.
void unpackUpdate (NetConnection *, BitStream *stream)
 Instructs this object to read state data previously packed with packUpdate.
void setPercentage (F32 pct)
void modifyStorm (F32 pct, U32 ms)

Static Public Member Functions

static void initPersistFields ()
 Register dynamic fields in a subclass of ConsoleObject.

Protected Member Functions

bool onAdd ()
 Called when the object is added to the sim.
void onRemove ()
 Called when the object is removed from the sim.
bool prepRenderImage (SceneState *, const U32, const U32, const bool)
 Called when the SceneGraph is ready for the registration of RenderImages.
void renderObject (SceneState *, SceneRenderImage *)
 Called when the object is supposed to render itself.
void renderPrecip (SceneState *state)
void renderSplashes (SceneState *state)

Private Types

typedef GameBase Parent

Private Member Functions

void processTick (const Move *)
 Processes a move event and updates object state once every 32 milliseconds.
void interpolateTick (F32 delta)
 Interpolates between tick events.
VectorF getWindVelocity ()
void fillDropList ()
 Adds/removes drops from the list to have the right # of drops.
void killDropList ()
 Deletes the entire drop list.
void spawnDrop (Raindrop *drop)
 Fills drop info with random velocity, x/y positions, and mass.
void spawnNewDrop (Raindrop *drop)
 Same as spawnDrop except also does z position.
void findDropCutoff (Raindrop *drop)
 Casts a ray to see if/when a drop will collide.
void wrapDrop (Raindrop *drop, Box3F &box)
 Wraps a drop within the specified box.
void createSplash (Raindrop *drop)
 Adds a drop to the splash list.
void destroySplash (Raindrop *drop)
 Removes a drop from the splash list.

Private Attributes

PrecipitationDatamDataBlock
RaindropmDropHead
 Drop linked list head.
RaindropmSplashHead
 Splash linked list head.
Point2FtexCoords
 texture coords for rain texture
Point2FsplashCoords
 texture coordinates for splash texture
AUDIOHANDLE mAudioHandle
 Ambient sound handle.
TextureHandle mDropHandle
 Texture handle for raindrop.
TextureHandle mSplashHandle
 Texture handle for splash.
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].
F32 mMinSpeed
 Minimum downward speed of drops.
F32 mMaxSpeed
 Maximum downward speed of drops.
F32 mMinMass
 Minimum mass of drops.
F32 mMaxMass
 Maximum mass of drops.
F32 mBoxWidth
 How far away in the x and y directions drops will render.
F32 mBoxHeight
 How high drops will render.
F32 mMaxTurbulence
 Coefficient to sin/cos for adding turbulence.
F32 mTurbulenceSpeed
 How fast the turbulence wraps in a circle.
bool mUseTurbulence
 Whether to use turbulence or not (MAY EFFECT PERFORMANCE).
bool mRotateWithCamVel
 Rotate the drops relative to the camera velocity This is useful for "streak" type drops.
bool mDoCollision
 Whether or not to do collision.
struct {
   bool   valid
   U32   startTime
   U32   totalTime
   F32   startPct
   F32   endPct
mStormData

Static Private Attributes

static const U32 csmDropsPerSide
 How many drops are on a side of the material texture.
static const F32 csmDropsPerSideF
 How many drops are on a side of the material texture.
static const U32 csmFramesPerSide
 How many frames are on a side of a splash animation.
static const F32 csmFramesPerSideF
 How many frames are on a side of a splash animation.

Member Typedef Documentation

typedef GameBase Precipitation::Parent [private]

Reimplemented from GameBase.


Member Enumeration Documentation

anonymous enum

Enumerator:
DataMask 
PercentageMask 
StormMask 
NextFreeMask 


Constructor & Destructor Documentation

Precipitation::Precipitation (  ) 

Precipitation::~Precipitation (  ) 


Member Function Documentation

void Precipitation::processTick ( const Move move  )  [private, virtual]

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

This takes place both on the client and server, every 32 milliseconds (1 tick).

See also:
ProcessList
Parameters:
move Move event corresponding to this tick, or NULL.

Reimplemented from GameBase.

void Precipitation::interpolateTick ( F32  delta  )  [private, virtual]

Interpolates between tick events.

This takes place on the CLIENT ONLY.

Parameters:
delta Time since last call to interpolate

Reimplemented from GameBase.

VectorF Precipitation::getWindVelocity (  )  [private]

void Precipitation::fillDropList (  )  [private]

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

void Precipitation::killDropList (  )  [private]

Deletes the entire drop list.

void Precipitation::spawnDrop ( Raindrop drop  )  [private]

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

void Precipitation::spawnNewDrop ( Raindrop drop  )  [private]

Same as spawnDrop except also does z position.

void Precipitation::findDropCutoff ( Raindrop drop  )  [private]

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

void Precipitation::wrapDrop ( Raindrop drop,
Box3F box 
) [inline, private]

Wraps a drop within the specified box.

void Precipitation::createSplash ( Raindrop drop  )  [private]

Adds a drop to the splash list.

void Precipitation::destroySplash ( Raindrop drop  )  [private]

Removes a drop from the splash list.

bool Precipitation::onAdd (  )  [protected, virtual]

Called when the object is added to the sim.

Reimplemented from GameBase.

void Precipitation::onRemove (  )  [protected, virtual]

Called when the object is removed from the sim.

Reimplemented from GameBase.

bool Precipitation::prepRenderImage ( SceneState state,
const   stateKey,
const   startZone,
const   modifyBaseZoneState 
) [protected, virtual]

Called when the SceneGraph is ready for the registration of RenderImages.

See also:
SceneState
Parameters:
state SceneState
stateKey State key of the current SceneState
startZone Base zone index
modifyBaseZoneState If true, the object needs to modify the zone state.

Reimplemented from SceneObject.

void Precipitation::renderObject ( SceneState state,
SceneRenderImage image 
) [protected, virtual]

Called when the object is supposed to render itself.

Parameters:
state Current rendering state.
See also:
SceneState
Parameters:
image Image associated with this object to render.
See also:
SceneRenderImage

Reimplemented from SceneObject.

void Precipitation::renderPrecip ( SceneState state  )  [protected]

void Precipitation::renderSplashes ( SceneState state  )  [protected]

void Precipitation::inspectPostApply (  )  [virtual]

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

See also:
inspectPreApply

Reimplemented from GameBase.

bool Precipitation::onNewDataBlock ( GameBaseData dptr  )  [virtual]

Called when a new datablock is set.

This allows subclasses to appropriately handle new datablocks.

See also:
setDataBlock()
Parameters:
dptr New datablock

Reimplemented from GameBase.

Precipitation::DECLARE_CONOBJECT ( Precipitation   ) 

static void Precipitation::initPersistFields (  )  [static]

Register dynamic fields in a subclass of ConsoleObject.

See also:
addField(), addFieldV(), addDepricatedField(), addGroup(), endGroup()

Reimplemented from GameBase.

U32 Precipitation::packUpdate ( NetConnection conn,
U32  mask,
BitStream stream 
) [virtual]

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

Parameters:
conn Net connection being used
mask Mask indicating fields to transmit.
stream Bitstream to pack data to
Returns:
Any bits which were not dealt with. The value is stored by the networking system. Don't set bits you weren't passed.

Reimplemented from GameBase.

void Precipitation::unpackUpdate ( NetConnection conn,
BitStream stream 
) [virtual]

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

Parameters:
conn Net connection being used
stream stream to read from

Reimplemented from GameBase.

void Precipitation::setPercentage ( F32  pct  ) 

void Precipitation::modifyStorm ( F32  pct,
U32  ms 
)


Field Documentation

Reimplemented from GameBase.

const U32 Precipitation::csmDropsPerSide [static, private]

How many drops are on a side of the material texture.

const F32 Precipitation::csmDropsPerSideF [static, private]

How many drops are on a side of the material texture.

const U32 Precipitation::csmFramesPerSide [static, private]

How many frames are on a side of a splash animation.

const F32 Precipitation::csmFramesPerSideF [static, private]

How many frames are on a side of a splash animation.

Drop linked list head.

Splash linked list head.

texture coords for rain texture

texture coordinates for splash texture

Ambient sound handle.

TextureHandle Precipitation::mDropHandle [private]

Texture handle for raindrop.

TextureHandle Precipitation::mSplashHandle [private]

Texture handle for splash.

Number of drops in the scene.

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

Minimum downward speed of drops.

Maximum downward speed of drops.

Minimum mass of drops.

Maximum mass of drops.

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

How high drops will render.

Coefficient to sin/cos for adding turbulence.

How fast the turbulence wraps in a circle.

Whether to use turbulence or not (MAY EFFECT PERFORMANCE).

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

Whether or not to do collision.

struct { ... } Precipitation::mStormData [private]




All Rights Reserved GarageGames.com, Inc. 1999-2005
Auto-magically Generated with Doxygen