mirror of
https://github.com/overte-org/overte.git
synced 2025-08-06 04:30:58 +02:00
Merge branch 'master' of github.com:highfidelity/hifi into scale-wearables-with-avatar-3
This commit is contained in:
commit
7d2d8e7c05
2 changed files with 14 additions and 18 deletions
|
@ -33,11 +33,6 @@
|
||||||
#include "AvatarMixerClientData.h"
|
#include "AvatarMixerClientData.h"
|
||||||
#include "AvatarMixerSlave.h"
|
#include "AvatarMixerSlave.h"
|
||||||
|
|
||||||
namespace PrioritySortUtil {
|
|
||||||
// we declare this callback here but override it later
|
|
||||||
std::function<uint64_t(const AvatarSharedPointer&)> getAvatarAgeCallback = [] (const AvatarSharedPointer& avatar) { return 0; };
|
|
||||||
}
|
|
||||||
|
|
||||||
void AvatarMixerSlave::configure(ConstIter begin, ConstIter end) {
|
void AvatarMixerSlave::configure(ConstIter begin, ConstIter end) {
|
||||||
_begin = begin;
|
_begin = begin;
|
||||||
_end = end;
|
_end = end;
|
||||||
|
@ -191,6 +186,7 @@ void AvatarMixerSlave::broadcastAvatarDataToAgent(const SharedNodePointer& node)
|
||||||
// setup list of AvatarData as well as maps to map betweeen the AvatarData and the original nodes
|
// setup list of AvatarData as well as maps to map betweeen the AvatarData and the original nodes
|
||||||
std::vector<AvatarSharedPointer> avatarsToSort;
|
std::vector<AvatarSharedPointer> avatarsToSort;
|
||||||
std::unordered_map<AvatarSharedPointer, SharedNodePointer> avatarDataToNodes;
|
std::unordered_map<AvatarSharedPointer, SharedNodePointer> avatarDataToNodes;
|
||||||
|
std::unordered_map<QUuid, uint64_t> avatarEncodeTimes;
|
||||||
std::for_each(_begin, _end, [&](const SharedNodePointer& otherNode) {
|
std::for_each(_begin, _end, [&](const SharedNodePointer& otherNode) {
|
||||||
// make sure this is an agent that we have avatar data for before considering it for inclusion
|
// make sure this is an agent that we have avatar data for before considering it for inclusion
|
||||||
if (otherNode->getType() == NodeType::Agent
|
if (otherNode->getType() == NodeType::Agent
|
||||||
|
@ -200,34 +196,29 @@ void AvatarMixerSlave::broadcastAvatarDataToAgent(const SharedNodePointer& node)
|
||||||
AvatarSharedPointer otherAvatar = otherNodeData->getAvatarSharedPointer();
|
AvatarSharedPointer otherAvatar = otherNodeData->getAvatarSharedPointer();
|
||||||
avatarsToSort.push_back(otherAvatar);
|
avatarsToSort.push_back(otherAvatar);
|
||||||
avatarDataToNodes[otherAvatar] = otherNode;
|
avatarDataToNodes[otherAvatar] = otherNode;
|
||||||
|
QUuid id = otherAvatar->getSessionUUID();
|
||||||
|
avatarEncodeTimes[id] = nodeData->getLastOtherAvatarEncodeTime(id);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// now that we've assembled the avatarDataToNodes map we can replace PrioritySortUtil::getAvatarAgeCallback
|
|
||||||
// with the true implementation
|
|
||||||
PrioritySortUtil::getAvatarAgeCallback = [&] (const AvatarSharedPointer& avatar) {
|
|
||||||
auto avatarNode = avatarDataToNodes[avatar];
|
|
||||||
assert(avatarNode); // we can't have gotten here without the avatarData being a valid key in the map
|
|
||||||
return nodeData->getLastOtherAvatarEncodeTime(avatarNode->getUUID());
|
|
||||||
};
|
|
||||||
|
|
||||||
class SortableAvatar: public PrioritySortUtil::Sortable {
|
class SortableAvatar: public PrioritySortUtil::Sortable {
|
||||||
public:
|
public:
|
||||||
SortableAvatar() = delete;
|
SortableAvatar() = delete;
|
||||||
SortableAvatar(const AvatarSharedPointer& avatar) : _avatar(avatar) {}
|
SortableAvatar(const AvatarSharedPointer& avatar, uint64_t lastEncodeTime)
|
||||||
|
: _avatar(avatar), _lastEncodeTime(lastEncodeTime) {}
|
||||||
glm::vec3 getPosition() const override { return _avatar->getWorldPosition(); }
|
glm::vec3 getPosition() const override { return _avatar->getWorldPosition(); }
|
||||||
float getRadius() const override {
|
float getRadius() const override {
|
||||||
glm::vec3 nodeBoxHalfScale = (_avatar->getWorldPosition() - _avatar->getGlobalBoundingBoxCorner() * _avatar->getSensorToWorldScale());
|
glm::vec3 nodeBoxHalfScale = (_avatar->getWorldPosition() - _avatar->getGlobalBoundingBoxCorner() * _avatar->getSensorToWorldScale());
|
||||||
return glm::max(nodeBoxHalfScale.x, glm::max(nodeBoxHalfScale.y, nodeBoxHalfScale.z));
|
return glm::max(nodeBoxHalfScale.x, glm::max(nodeBoxHalfScale.y, nodeBoxHalfScale.z));
|
||||||
}
|
}
|
||||||
uint64_t getTimestamp() const override {
|
uint64_t getTimestamp() const override {
|
||||||
// use the callback implemented above
|
return _lastEncodeTime;
|
||||||
return PrioritySortUtil::getAvatarAgeCallback(_avatar);
|
|
||||||
}
|
}
|
||||||
const AvatarSharedPointer& getAvatar() const { return _avatar; }
|
const AvatarSharedPointer& getAvatar() const { return _avatar; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
AvatarSharedPointer _avatar;
|
AvatarSharedPointer _avatar;
|
||||||
|
uint64_t _lastEncodeTime;
|
||||||
};
|
};
|
||||||
|
|
||||||
// prepare to sort
|
// prepare to sort
|
||||||
|
@ -322,7 +313,12 @@ void AvatarMixerSlave::broadcastAvatarDataToAgent(const SharedNodePointer& node)
|
||||||
|
|
||||||
if (!shouldIgnore) {
|
if (!shouldIgnore) {
|
||||||
// sort this one for later
|
// sort this one for later
|
||||||
sortedAvatars.push(SortableAvatar(avatar));
|
uint64_t lastEncodeTime = 0;
|
||||||
|
std::unordered_map<QUuid, uint64_t>::const_iterator itr = avatarEncodeTimes.find(avatar->getSessionUUID());
|
||||||
|
if (itr != avatarEncodeTimes.end()) {
|
||||||
|
lastEncodeTime = itr->second;
|
||||||
|
}
|
||||||
|
sortedAvatars.push(SortableAvatar(avatar, lastEncodeTime));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -905,7 +905,7 @@ Rectangle {
|
||||||
}
|
}
|
||||||
buyTextContainer.color = "#FFC3CD";
|
buyTextContainer.color = "#FFC3CD";
|
||||||
buyTextContainer.border.color = "#F3808F";
|
buyTextContainer.border.color = "#F3808F";
|
||||||
buyGlyph.text = hifi.glyphs.error;
|
buyGlyph.text = hifi.glyphs.alert;
|
||||||
buyGlyph.size = 54;
|
buyGlyph.size = 54;
|
||||||
} else {
|
} else {
|
||||||
if (root.alreadyOwned) {
|
if (root.alreadyOwned) {
|
||||||
|
|
Loading…
Reference in a new issue