cObject Class Reference

#include <object.h>

Inheritance diagram for cObject:

Inheritance graph
[legend]
Collaboration diagram for cObject:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 cObject ()
virtual ~cObject ()
void Step (const int iCurTime, const float fPhysStepTime, const bool bIncResyncCounterLow=false)
void SaveResyncData (cFIFO &pFIFO)
 server only
void LoadResyncData (cFIFO &pFIFO)
 client only, ignored if resync considered old (or too new in case locaction change has not arrived over tcp yet
void SetController (cObjectController *pObjectController)
void SetParentLocation (cLocation *pParentLocation)
cLocationGetParentLocation ()
void _HackForgetParentLocation ()
 don't use this directly ! only to be used for efficient mass delete from location
int GetID ()
void SetID (const int iID)
 registers object in cResyncReceiver* gpResyncReceiver if available

Static Public Member Functions

static void SkipResyncData (cFIFO &pFIFO)
static void LuaRegister (lua_State *L)
 lua binding

Public Attributes

cOdeObject * mpPhysicForm
 mass,collision geometry,...
cObjectControllermpController
 autopilot,...
int miLastChangeTime
 object wich are not "changed" don't need to be resynced so often.
int miResyncCounterHigh
 changed on major events like location change, etc
uint32 miResyncCounterLow
 avoids problems with udp resync packets arriving late
float mfMaxSpeed
float mfBoundingRad
float mfDistToLocationCenter
bool mbResynced
 true by default, if this is false no resyncs for this obj will be sent at all
Vector3 mvPos
Vector3 mvVel
Vector3 mvAccel
Quaternion mqRot
Quaternion mqTurn
cGfx3DmpGfx3D
 not owned by object : destroy this yourself, position/rotation is updated in Step()

Private Attributes

cLocationmpParentLocation
 defines the parent coordinate system
std::list< cObject * >::iterator _mLocationInsertPos
int miID


Detailed Description

holds position info and manages resyncing, an "object" doesn't need to be something visible, can also be a location about miLastChangeTime : the meaning of this is defined by scripts, see cPlayer::ServerSendResyncs about miResyncCounterHigh : the client should ignore all (udp) resync messages which don't match the current value of this this should only be updated on the client via reliable network message, e.g. teleport, locationchange etc this is to avoid strange effects by udp resync packets arriving after (or even before) the coordinate system was changed

Definition at line 32 of file object.h.


Constructor & Destructor Documentation

cObject::cObject (  ) 

Definition at line 14 of file object.cpp.

cObject::~cObject (  )  [virtual]

Definition at line 33 of file object.cpp.

References mpPhysicForm, SetController(), SetID(), and SetParentLocation().


Member Function Documentation

void cObject::Step ( const int  iCurTime,
const float  fPhysStepTime,
const bool  bIncResyncCounterLow = false 
)

fPhysStepTime is used for simple physics iCurTime is intended to be used for setting miLastChangeTime on collision/physical interaction

< for 2d Tracking

Definition at line 63 of file object.cpp.

References assert, cLocation::mfBoundingRad, mfBoundingRad, Lugre::cGfx3D::mfCustomBoundingRadius, mfDistToLocationCenter, mfMaxSpeed, miLastChangeTime, miResyncCounterLow, mpController, mpGfx3D, mpParentLocation, mpPhysicForm, mqRot, mqTurn, mvAccel, mvPos, mvVel, Lugre::cGfx3D::SetOrientation(), Lugre::cGfx3D::SetPosition(), and cObjectController::Step().

void cObject::SaveResyncData ( cFIFO pFIFO  ) 

void cObject::LoadResyncData ( cFIFO pFIFO  ) 

client only, ignored if resync considered old (or too new in case locaction change has not arrived over tcp yet

Definition at line 153 of file object.cpp.

References kResyncMessageLen, miResyncCounterHigh, miResyncCounterLow, mqRot, mqTurn, mvAccel, mvPos, mvVel, Lugre::cFIFO::Pop(), Lugre::cFIFO::PopUint16(), Lugre::cFIFO::PopUint32(), and Lugre::cFIFO::Skip().

Referenced by cResyncReceiver::ReceiveResyncs(), and cResyncReceiver::ReceiveResyncsFromFIFO().

void cObject::SkipResyncData ( cFIFO pFIFO  )  [static]

void cObject::SetController ( cObjectController pObjectController  ) 

void cObject::SetParentLocation ( cLocation pParentLocation  ) 

executed in constant time (thanks to keeping insert position) server should increase miResyncCounterHigh and inform client using reliable (tcp) connection

Definition at line 126 of file object.cpp.

References _mLocationInsertPos, cLocation::mlObjects, and mpParentLocation.

Referenced by cObject_L::SetParentLocation(), and ~cObject().

cLocation* cObject::GetParentLocation (  )  [inline]

Definition at line 58 of file object.h.

References mpParentLocation.

void cObject::_HackForgetParentLocation (  )  [inline]

don't use this directly ! only to be used for efficient mass delete from location

Definition at line 61 of file object.h.

References mpParentLocation.

Referenced by cLocation::DeleteAllObjects().

int cObject::GetID (  )  [inline]

Definition at line 63 of file object.h.

References miID.

Referenced by cLocation_L::Intersect2DRect(), and cLocation_L::IntersectSphere().

void cObject::SetID ( const int  iID  ) 

registers object in cResyncReceiver* gpResyncReceiver if available

Definition at line 134 of file object.cpp.

References cResyncReceiver::AddObject(), gpResyncReceiver, miID, and cResyncReceiver::RemoveObject().

Referenced by cObject_L::SetID(), and ~cObject().

void cObject::LuaRegister ( lua_State *  L  )  [static]

lua binding

Definition at line 115 of file object_L.cpp.

References PROFILE.

Referenced by SFZ_RegisterLuaPlugin().


Member Data Documentation

cOdeObject* cObject::mpPhysicForm

mass,collision geometry,...

Definition at line 33 of file object.h.

Referenced by cObject_L::SetPhysicForm(), Step(), and ~cObject().

autopilot,...

Definition at line 34 of file object.h.

Referenced by SetController(), and Step().

object wich are not "changed" don't need to be resynced so often.

Definition at line 35 of file object.h.

Referenced by cLocation::SendResyncs(), Step(), and cLocation::StoreResyncs().

changed on major events like location change, etc

Definition at line 36 of file object.h.

Referenced by LoadResyncData(), and SaveResyncData().

avoids problems with udp resync packets arriving late

Definition at line 37 of file object.h.

Referenced by LoadResyncData(), cObject_L::ResetResyncCounterLow(), SaveResyncData(), and Step().

Definition at line 38 of file object.h.

Referenced by Step().

Definition at line 39 of file object.h.

Referenced by cLocation_L::Intersect2DRect(), cLocation_L::IntersectSphere(), and Step().

Definition at line 40 of file object.h.

Referenced by Step().

true by default, if this is false no resyncs for this obj will be sent at all

Definition at line 41 of file object.h.

Referenced by cLocation::SendResyncs(), and cLocation::StoreResyncs().

Vector3 cObject::mvPos

Vector3 cObject::mvVel

Definition at line 42 of file object.h.

Referenced by LoadResyncData(), SaveResyncData(), cObjectController::Step(), and Step().

Definition at line 42 of file object.h.

Referenced by LoadResyncData(), SaveResyncData(), cObjectController::Step(), and Step().

Quaternion cObject::mqRot

Definition at line 43 of file object.h.

Referenced by LoadResyncData(), SaveResyncData(), and Step().

Quaternion cObject::mqTurn

Definition at line 43 of file object.h.

Referenced by LoadResyncData(), SaveResyncData(), and Step().

not owned by object : destroy this yourself, position/rotation is updated in Step()

Definition at line 44 of file object.h.

Referenced by cObject_L::SetGfx(), and Step().

defines the parent coordinate system

Definition at line 71 of file object.h.

Referenced by _HackForgetParentLocation(), GetParentLocation(), SetParentLocation(), and Step().

std::list<cObject*>::iterator cObject::_mLocationInsertPos [private]

Definition at line 72 of file object.h.

Referenced by SetParentLocation().

int cObject::miID [private]

Definition at line 73 of file object.h.

Referenced by GetID(), SaveResyncData(), and SetID().


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

Generated on Tue Feb 7 06:00:15 2012 for cpp by  doxygen 1.5.6