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

View file

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