Item Class Reference

#include <item.h>

Inheritance diagram for Item:

Inheritance graph
[legend]
List of all members.

Public Types

 NoLight = 0
 ConstantLight
 PulsingLight
 NumLightTypes
enum  LightType {
  NoLight = 0,
  ConstantLight,
  PulsingLight,
  NumLightTypes
}

Public Member Functions

void registerLights (LightManager *lightManager, bool lightingScene)
 Traverses mounted objects and registers light sources with the light manager.
 DECLARE_CONOBJECT (Item)
 Item ()
 ~Item ()
bool onAdd ()
 Called when the object is added to the sim.
void onRemove ()
 Called when the object is removed from the sim.
bool onNewDataBlock (GameBaseData *dptr)
 Called when a new datablock is set.
bool isStatic ()
bool isRotating ()
Point3F getVelocity () const
 Gets the velocity of the object.
void setVelocity (const VectorF &vel)
 Sets the velocity of this object.
void applyImpulse (const Point3F &pos, const VectorF &vec)
 Applies an impulse force to this object.
void setCollisionTimeout (ShapeBase *obj)
ShapeBasegetCollisionObject ()
void processTick (const Move *move)
 Processes a move event and updates object state once every 32 milliseconds.
void interpolateTick (F32 delta)
 Interpolates between tick events.
void setTransform (const MatrixF &mat)
 Sets the Object -> World transform.
U32 packUpdate (NetConnection *conn, U32 mask, BitStream *stream)
 Instructs this object to pack its state for transfer over the network.
void unpackUpdate (NetConnection *conn, BitStream *stream)
 Instructs this object to read state data previously packed with packUpdate.

Static Public Member Functions

static void initPersistFields ()
 Register dynamic fields in a subclass of ConsoleObject.
static void consoleInit ()
 Register global constant variables and do other one-time initialization tasks in a subclass of ConsoleObject.

Public Attributes

Point3F mStickyCollisionPos
Point3F mStickyCollisionNormal

Private Types

typedef ShapeBase Parent
 HiddenMask = Parent::NextFreeMask
 ThrowSrcMask = Parent::NextFreeMask << 1
 PositionMask = Parent::NextFreeMask << 2
 RotationMask = Parent::NextFreeMask << 3
 NextFreeMask = Parent::NextFreeMask << 4
enum  MaskBits {
  HiddenMask = Parent::NextFreeMask,
  ThrowSrcMask = Parent::NextFreeMask << 1,
  PositionMask = Parent::NextFreeMask << 2,
  RotationMask = Parent::NextFreeMask << 3,
  NextFreeMask = Parent::NextFreeMask << 4
}

Private Member Functions

void updateVelocity (const F32 dt)
void updatePos (const U32 mask, const F32 dt)
void updateWorkingCollisionSet (const U32 mask, const F32 dt)
bool buildPolyList (AbstractPolyList *polyList, const Box3F &box, const SphereF &sphere)
 Builds a polylist of the polygons in this object returns true if successful.
void buildConvex (const Box3F &box, Convex *convex)
 Builds a convex hull for this object.
void onDeleteNotify (SimObject *)
 Called when a SimObject is deleted.
bool prepRenderImage (SceneState *state, const U32 stateKey, const U32 startZone, const bool modifyBaseZoneState)
 Called when the SceneGraph is ready for the registration of RenderImages.
void advanceTime (F32 dt)
 Advances simulation time for animations.

Private Attributes

StateDelta delta
ItemDatamDataBlock
 Datablock.
bool mCollideable
bool mStatic
bool mRotate
bool mRotate2
VectorF mVelocity
bool mAtRest
S32 mAtRestCounter
bool mInLiquid
ShapeBasemCollisionObject
U32 mCollisionTimeout
S32 mDropTime
LightInfomLight
OrthoBoxConvex mConvex
Box3F mWorkingQueryBox

Static Private Attributes

static F32 mGravity
static const S32 csmAtRestTimer

Classes

struct  StateDelta

Member Typedef Documentation

typedef ShapeBase Item::Parent [private]

Reimplemented from ShapeBase.


Member Enumeration Documentation

enum Item::MaskBits [private]

Enumerator:
HiddenMask 
ThrowSrcMask 
PositionMask 
RotationMask 
NextFreeMask 

Enumerator:
NoLight 
ConstantLight 
PulsingLight 
NumLightTypes 


Constructor & Destructor Documentation

Item::Item (  ) 

Item::~Item (  ) 


Member Function Documentation

void Item::registerLights ( LightManager lightManager,
bool  lightingScene 
) [virtual]

Traverses mounted objects and registers light sources with the light manager.

Parameters:
lightManager Light manager to register with
lightingScene Set to true if the scene is being lit, in which case these lights will not be used

Reimplemented from ShapeBase.

void Item::updateVelocity ( const F32  dt  )  [private]

void Item::updatePos ( const U32  mask,
const F32  dt 
) [private]

void Item::updateWorkingCollisionSet ( const U32  mask,
const F32  dt 
) [private]

bool Item::buildPolyList ( AbstractPolyList polyList,
const Box3F box,
const SphereF sphere 
) [private, virtual]

Builds a polylist of the polygons in this object returns true if successful.

Parameters:
polyList Returned polylist (out)
box Not used
sphere Not used

Reimplemented from ShapeBase.

void Item::buildConvex ( const Box3F box,
Convex convex 
) [private, virtual]

Builds a convex hull for this object.

See also:
Convex
Parameters:
box Bounding box
convex New convex hull (out)

Reimplemented from ShapeBase.

void Item::onDeleteNotify ( SimObject  )  [private, virtual]

Called when a SimObject is deleted.

When you are on the notification list for another object and it is deleted, this method is called.

Reimplemented from ShapeBase.

bool Item::prepRenderImage ( SceneState state,
const U32  stateKey,
const U32  startZone,
const bool  modifyBaseZoneState 
) [private, 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 ShapeBase.

void Item::advanceTime ( F32  dt  )  [private, virtual]

Advances simulation time for animations.

This is called every frame.

Parameters:
dt Time since last advance call

Reimplemented from ShapeBase.

Item::DECLARE_CONOBJECT ( Item   ) 

static void Item::initPersistFields (  )  [static]

Register dynamic fields in a subclass of ConsoleObject.

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

Reimplemented from GameBase.

static void Item::consoleInit (  )  [static]

Register global constant variables and do other one-time initialization tasks in a subclass of ConsoleObject.

See also:
console

Reimplemented from ShapeBase.

bool Item::onAdd (  )  [virtual]

Called when the object is added to the sim.

Reimplemented from ShapeBase.

void Item::onRemove (  )  [virtual]

Called when the object is removed from the sim.

Reimplemented from ShapeBase.

bool Item::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 ShapeBase.

bool Item::isStatic (  )  [inline]

bool Item::isRotating (  )  [inline]

Point3F Item::getVelocity (  )  const [virtual]

Gets the velocity of the object.

Reimplemented from SceneObject.

void Item::setVelocity ( const VectorF vel  )  [virtual]

Sets the velocity of this object.

Parameters:
vel Velocity vector

Reimplemented from ShapeBase.

void Item::applyImpulse ( const Point3F pos,
const VectorF vec 
) [virtual]

Applies an impulse force to this object.

Parameters:
pos Position where impulse came from in world space
vec Velocity vector (Impulse force F = m * v)

Reimplemented from ShapeBase.

void Item::setCollisionTimeout ( ShapeBase obj  ) 

ShapeBase* Item::getCollisionObject (  )  [inline]

void Item::processTick ( const Move move  )  [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 ShapeBase.

void Item::interpolateTick ( F32  delta  )  [virtual]

Interpolates between tick events.

This takes place on the CLIENT ONLY.

Parameters:
delta Time since last call to interpolate

Reimplemented from GameBase.

void Item::setTransform ( const MatrixF mat  )  [virtual]

Sets the Object -> World transform.

Parameters:
mat New transform matrix

Reimplemented from SceneObject.

U32 Item::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 ShapeBase.

void Item::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 ShapeBase.


Member Data Documentation

Datablock.

Reimplemented from ShapeBase.

F32 Item::mGravity [static, private]

bool Item::mStatic [private]

bool Item::mRotate [private]

bool Item::mRotate2 [private]

bool Item::mAtRest [private]

const S32 Item::csmAtRestTimer [static, private]

bool Item::mInLiquid [private]

S32 Item::mDropTime [private]

LightInfo* Item::mLight [private]