added exists bits to avatar data

This commit is contained in:
ZappoMan 2013-05-20 13:54:02 -07:00
parent 321d1952d6
commit e9caa40d9a
2 changed files with 15 additions and 9 deletions

View file

@ -55,7 +55,9 @@ AvatarData::AvatarData() :
_cameraFarClip(0.0f), _cameraFarClip(0.0f),
_keyState(NO_KEY_DOWN), _keyState(NO_KEY_DOWN),
_wantResIn(false), _wantResIn(false),
_wantColor(true) _wantColor(true),
_wantDelta(true),
_wantExistsBits(true)
{ {
}; };
@ -129,9 +131,9 @@ int AvatarData::getBroadcastData(unsigned char* destinationBuffer) {
// voxel sending features... // voxel sending features...
unsigned char wantItems = 0; unsigned char wantItems = 0;
if (_wantResIn) { setAtBit(wantItems,WANT_RESIN_AT_BIT); } if (_wantResIn) { setAtBit(wantItems,WANT_RESIN_AT_BIT); }
if (_wantExistsBits) { setAtBit(wantItems,WANT_EXISTS_BITS_BIT); }
if (_wantColor) { setAtBit(wantItems,WANT_COLOR_AT_BIT); } if (_wantColor) { setAtBit(wantItems,WANT_COLOR_AT_BIT); }
if (_wantDelta) { setAtBit(wantItems,WANT_DELTA_AT_BIT); } if (_wantDelta) { setAtBit(wantItems,WANT_DELTA_AT_BIT); }
if (_wantExistsBits) { setAtBit(wantItems,WANT_EXISTS_BITS_BIT); }
*destinationBuffer++ = wantItems; *destinationBuffer++ = wantItems;
return destinationBuffer - bufferStart; return destinationBuffer - bufferStart;
@ -212,9 +214,9 @@ int AvatarData::parseData(unsigned char* sourceBuffer, int numBytes) {
unsigned char wantItems = 0; unsigned char wantItems = 0;
wantItems = (unsigned char)*sourceBuffer++; wantItems = (unsigned char)*sourceBuffer++;
_wantResIn = oneAtBit(wantItems,WANT_RESIN_AT_BIT); _wantResIn = oneAtBit(wantItems,WANT_RESIN_AT_BIT);
_wantExistsBits = oneAtBit(wantItems,WANT_EXISTS_BITS_BIT);
_wantColor = oneAtBit(wantItems,WANT_COLOR_AT_BIT); _wantColor = oneAtBit(wantItems,WANT_COLOR_AT_BIT);
_wantDelta = oneAtBit(wantItems,WANT_DELTA_AT_BIT); _wantDelta = oneAtBit(wantItems,WANT_DELTA_AT_BIT);
_wantExistsBits = oneAtBit(wantItems,WANT_EXISTS_BITS_BIT);
return sourceBuffer - startPosition; return sourceBuffer - startPosition;
} }

View file

@ -18,6 +18,7 @@
const int WANT_RESIN_AT_BIT = 0; const int WANT_RESIN_AT_BIT = 0;
const int WANT_COLOR_AT_BIT = 1; const int WANT_COLOR_AT_BIT = 1;
const int WANT_DELTA_AT_BIT = 2; const int WANT_DELTA_AT_BIT = 2;
const int WANT_EXISTS_BITS_BIT = 4;
enum KeyState enum KeyState
{ {
@ -102,12 +103,14 @@ public:
const std::string& chatMessage () const { return _chatMessage; } const std::string& chatMessage () const { return _chatMessage; }
// related to Voxel Sending strategies // related to Voxel Sending strategies
bool getWantResIn() const { return _wantResIn; } bool getWantResIn() const { return _wantResIn; }
bool getWantColor() const { return _wantColor; } bool getWantColor() const { return _wantColor; }
bool getWantDelta() const { return _wantDelta; } bool getWantDelta() const { return _wantDelta; }
void setWantResIn(bool wantResIn) { _wantResIn = wantResIn; } bool getWantExistsBits() const { return _wantExistsBits; }
void setWantColor(bool wantColor) { _wantColor = wantColor; } void setWantResIn(bool wantResIn) { _wantResIn = wantResIn; }
void setWantDelta(bool wantDelta) { _wantDelta = wantDelta; } void setWantColor(bool wantColor) { _wantColor = wantColor; }
void setWantDelta(bool wantDelta) { _wantDelta = wantDelta; }
void setWantExistsBits(bool wantExistsBits) { _wantExistsBits = wantExistsBits; }
protected: protected:
// privatize the copy constructor and assignment operator so they cannot be called // privatize the copy constructor and assignment operator so they cannot be called
@ -158,6 +161,7 @@ protected:
bool _wantResIn; bool _wantResIn;
bool _wantColor; bool _wantColor;
bool _wantDelta; bool _wantDelta;
bool _wantExistsBits;
}; };
#endif /* defined(__hifi__AvatarData__) */ #endif /* defined(__hifi__AvatarData__) */