Advertise to others whether we have chat circling enabled, only include people

with it enabled when doing the computations.
This commit is contained in:
Andrzej Kapolka 2013-11-27 11:47:23 -08:00
parent cd1fa380d5
commit cabd6ccbad
3 changed files with 15 additions and 2 deletions

View file

@ -1161,17 +1161,20 @@ bool operator<(const SortedAvatar& s1, const SortedAvatar& s2) {
}
void MyAvatar::updateChatCircle(float deltaTime) {
if (!Menu::getInstance()->isOptionChecked(MenuOption::ChatCircling)) {
if (!(_isChatCirclingEnabled = Menu::getInstance()->isOptionChecked(MenuOption::ChatCircling))) {
return;
}
// find all members and sort by distance
// find all circle-enabled members and sort by distance
QVector<SortedAvatar> sortedAvatars;
NodeList* nodeList = NodeList::getInstance();
for (NodeList::iterator node = nodeList->begin(); node != nodeList->end(); node++) {
if (node->getLinkedData() && node->getType() == NODE_TYPE_AGENT) {
SortedAvatar sortedAvatar;
sortedAvatar.avatar = (Avatar*)node->getLinkedData();
if (!sortedAvatar.avatar->isChatCirclingEnabled()) {
continue;
}
sortedAvatar.distance = glm::distance(_position, sortedAvatar.avatar->getPosition());
sortedAvatars.append(sortedAvatar);
}

View file

@ -120,6 +120,9 @@ int AvatarData::getBroadcastData(unsigned char* destinationBuffer) {
setSemiNibbleAt(bitItems,HAND_STATE_START_BIT,_handState);
// faceshift state
if (_headData->_isFaceshiftConnected) { setAtBit(bitItems, IS_FACESHIFT_CONNECTED); }
if (_isChatCirclingEnabled) {
setAtBit(bitItems, IS_CHAT_CIRCLING_ENABLED);
}
*destinationBuffer++ = bitItems;
// If it is connected, pack up the data
@ -248,6 +251,8 @@ int AvatarData::parseData(unsigned char* sourceBuffer, int numBytes) {
_headData->_isFaceshiftConnected = oneAtBit(bitItems, IS_FACESHIFT_CONNECTED);
_isChatCirclingEnabled = oneAtBit(bitItems, IS_CHAT_CIRCLING_ENABLED);
// If it is connected, pack up the data
if (_headData->_isFaceshiftConnected) {
memcpy(&_headData->_leftEyeBlink, sourceBuffer, sizeof(float));

View file

@ -30,6 +30,7 @@
const int KEY_STATE_START_BIT = 0; // 1st and 2nd bits
const int HAND_STATE_START_BIT = 2; // 3rd and 4th bits
const int IS_FACESHIFT_CONNECTED = 4; // 5th bit
const int IS_CHAT_CIRCLING_ENABLED = 5;
const float MAX_AUDIO_LOUDNESS = 1000.0; // close enough for mouth animation
@ -93,6 +94,8 @@ public:
const std::string& setChatMessage() const { return _chatMessage; }
QString getQStringChatMessage() { return QString(_chatMessage.data()); }
bool isChatCirclingEnabled() const { return _isChatCirclingEnabled; }
const QUuid& getLeaderUUID() const { return _leaderUUID; }
void setHeadData(HeadData* headData) { _headData = headData; }
@ -124,6 +127,8 @@ protected:
// chat message
std::string _chatMessage;
bool _isChatCirclingEnabled;
std::vector<JointData> _joints;
HeadData* _headData;