mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-29 22:22:54 +02:00
added wantDelta, made want bools a bit mask
This commit is contained in:
parent
a95549da2e
commit
d59a8143d7
2 changed files with 20 additions and 4 deletions
|
@ -108,8 +108,12 @@ int AvatarData::getBroadcastData(unsigned char* destinationBuffer) {
|
||||||
destinationBuffer += _chatMessage.size() * sizeof(char);
|
destinationBuffer += _chatMessage.size() * sizeof(char);
|
||||||
|
|
||||||
// voxel sending features...
|
// voxel sending features...
|
||||||
*destinationBuffer++ = _wantResIn;
|
// voxel sending features...
|
||||||
*destinationBuffer++ = _wantColor;
|
unsigned char wantItems = 0;
|
||||||
|
if (_wantResIn) { setAtBit(wantItems,WANT_RESIN_AT_BIT); }
|
||||||
|
if (_wantColor) { setAtBit(wantItems,WANT_COLOR_AT_BIT); }
|
||||||
|
if (_wantDelta) { setAtBit(wantItems,WANT_DELTA_AT_BIT); }
|
||||||
|
*destinationBuffer++ = wantItems;
|
||||||
|
|
||||||
return destinationBuffer - bufferStart;
|
return destinationBuffer - bufferStart;
|
||||||
}
|
}
|
||||||
|
@ -184,8 +188,12 @@ int AvatarData::parseData(unsigned char* sourceBuffer, int numBytes) {
|
||||||
sourceBuffer += chatMessageSize * sizeof(char);
|
sourceBuffer += chatMessageSize * sizeof(char);
|
||||||
|
|
||||||
// voxel sending features...
|
// voxel sending features...
|
||||||
_wantResIn = (bool)*sourceBuffer++;
|
unsigned char wantItems = 0;
|
||||||
_wantColor = (bool)*sourceBuffer++;
|
wantItems = (unsigned char)*sourceBuffer++;
|
||||||
|
|
||||||
|
_wantResIn = oneAtBit(wantItems,WANT_RESIN_AT_BIT);
|
||||||
|
_wantColor = oneAtBit(wantItems,WANT_COLOR_AT_BIT);
|
||||||
|
_wantDelta = oneAtBit(wantItems,WANT_DELTA_AT_BIT);
|
||||||
|
|
||||||
return sourceBuffer - startPosition;
|
return sourceBuffer - startPosition;
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,6 +15,10 @@
|
||||||
|
|
||||||
#include <AgentData.h>
|
#include <AgentData.h>
|
||||||
|
|
||||||
|
const int WANT_RESIN_AT_BIT = 0;
|
||||||
|
const int WANT_COLOR_AT_BIT = 1;
|
||||||
|
const int WANT_DELTA_AT_BIT = 2;
|
||||||
|
|
||||||
enum KeyState
|
enum KeyState
|
||||||
{
|
{
|
||||||
NO_KEY_DOWN,
|
NO_KEY_DOWN,
|
||||||
|
@ -123,8 +127,10 @@ public:
|
||||||
// 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; }
|
||||||
void setWantResIn(bool wantResIn) { _wantResIn = wantResIn; }
|
void setWantResIn(bool wantResIn) { _wantResIn = wantResIn; }
|
||||||
void setWantColor(bool wantColor) { _wantColor = wantColor; }
|
void setWantColor(bool wantColor) { _wantColor = wantColor; }
|
||||||
|
void setWantDelta(bool wantDelta) { _wantDelta = wantDelta; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
glm::vec3 _position;
|
glm::vec3 _position;
|
||||||
|
@ -167,8 +173,10 @@ protected:
|
||||||
// chat message
|
// chat message
|
||||||
std::string _chatMessage;
|
std::string _chatMessage;
|
||||||
|
|
||||||
|
// voxel server sending items
|
||||||
bool _wantResIn;
|
bool _wantResIn;
|
||||||
bool _wantColor;
|
bool _wantColor;
|
||||||
|
bool _wantDelta;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* defined(__hifi__AvatarData__) */
|
#endif /* defined(__hifi__AvatarData__) */
|
||||||
|
|
Loading…
Reference in a new issue