Thread: [Opentnl-cvs] tnl/tnl eventConnection.cpp,1.7,1.8 tnlBitStream.h,1.8,1.9 tnlEventConnection.h,1.4,1.
Brought to you by:
mark_frohnmayer,
s_alanet
From: Mark F. <mar...@us...> - 2005-04-28 18:01:50
|
Update of /cvsroot/opentnl/tnl/tnl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15416/tnl Modified Files: eventConnection.cpp tnlBitStream.h tnlEventConnection.h Log Message: Added a packet fill fraction for EventConnection -- so that events can be set to only take up some fixed fraction of each packet, so as to not starve the ghosting Index: eventConnection.cpp =================================================================== RCS file: /cvsroot/opentnl/tnl/tnl/eventConnection.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** eventConnection.cpp 21 Feb 2005 07:48:13 -0000 1.7 --- eventConnection.cpp 28 Apr 2005 18:01:37 -0000 1.8 *************** *** 51,54 **** --- 51,55 ---- mEventClassCount = 0; mEventClassBitSize = 0; + mPacketFillFraction = 1.0f; } *************** *** 240,246 **** EventNote *packQueueHead = NULL, *packQueueTail = NULL; while(mUnorderedSendEventQueueHead) { ! if(bstream->isFull()) break; // get the first event --- 241,248 ---- EventNote *packQueueHead = NULL, *packQueueTail = NULL; + F32 totalPacketSpaceFraction = 1.0f / bstream->getMaxWriteBitPosition(); while(mUnorderedSendEventQueueHead) { ! if(bstream->isFull() || bstream->getBitPosition() * totalPacketSpaceFraction > mPacketFillFraction) break; // get the first event Index: tnlBitStream.h =================================================================== RCS file: /cvsroot/opentnl/tnl/tnl/tnlBitStream.h,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** tnlBitStream.h 28 Apr 2005 17:30:30 -0000 1.8 --- tnlBitStream.h 28 Apr 2005 18:01:38 -0000 1.9 *************** *** 133,136 **** --- 133,139 ---- U32 getMaxReadBitPosition() const { return maxReadBitNum; } + /// Returns the maximum writable bit position + U32 getMaxWriteBitPosition() const { return maxWriteBitNum; } + /// Returns the number of bits that can be written into the BitStream without resizing U32 getBitSpaceAvailable() const { return maxWriteBitNum - bitNum; } Index: tnlEventConnection.h =================================================================== RCS file: /cvsroot/opentnl/tnl/tnl/tnlEventConnection.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** tnlEventConnection.h 21 Feb 2005 07:48:14 -0000 1.4 --- tnlEventConnection.h 28 Apr 2005 18:01:38 -0000 1.5 *************** *** 127,130 **** --- 127,131 ---- protected: + F32 mPacketFillFraction; ///< Percentage of each packet to fill with NetEvents. Defaults to 1.0 U32 mEventClassCount; ///< Number of NetEvent classes supported by this connection U32 mEventClassBitSize; ///< Bit field width of NetEvent class count. *************** *** 147,150 **** --- 148,157 ---- bool readConnectAccept(BitStream *stream, const char **errorString); public: + /// Sets the amount of each packet that should be filled with NetEvents (if there are any). + /// Defaults to 1.0 meaning that if there are enough events, it will fill the entire packet with + /// event data. This can be lowered during normal simulation to allow the GhostConnection to have + /// some space to send ghost updates. + inline void setPacketFillFraction(F32 fraction) { mPacketFillFraction = fraction; } + /// returns the highest event version number supported on this connection. U32 getEventClassVersion() { return mEventClassVersion; } |