more cleanup

This commit is contained in:
Brad Hefta-Gaub 2017-02-22 22:06:28 -08:00
parent 4c4506b1f7
commit edf7c016a1
4 changed files with 6 additions and 25 deletions

View file

@ -309,7 +309,6 @@ void AvatarMixer::nodeKilled(SharedNodePointer killedNode) {
},
[&](const SharedNodePointer& node) {
QMetaObject::invokeMethod(node->getLinkedData(),
//"removeLastBroadcastSequenceNumber",
"cleanupKilledNode",
Qt::AutoConnection,
Q_ARG(const QUuid&, QUuid(killedNode->getUUID())));

View file

@ -187,7 +187,8 @@ void AvatarMixerSlave::broadcastAvatarData(const SharedNodePointer& node) {
// setup a PacketList for the avatarPackets
auto avatarPacketList = NLPacketList::create(PacketType::BulkAvatarData);
// setup list of AvatarData as well as maps to map betweeen the AvatarData and the original nodes
// for calling the AvatarData::sortAvatars() function and getting our sorted list of client nodes
QList<AvatarSharedPointer> avatarList;
std::unordered_map<AvatarSharedPointer, SharedNodePointer> avatarDataToNodes;
@ -204,9 +205,6 @@ void AvatarMixerSlave::broadcastAvatarData(const SharedNodePointer& node) {
});
AvatarSharedPointer thisAvatar = nodeData->getAvatarSharedPointer();
//qDebug() << "thisAvatar:" << thisAvatar.get();
ViewFrustum cameraView = nodeData->getViewFrustom();
std::priority_queue<AvatarPriority> sortedAvatars = AvatarData::sortAvatars(
avatarList, cameraView,

View file

@ -69,8 +69,7 @@ AvatarData::AvatarData() :
_displayNameAlpha(1.0f),
_errorLogExpiry(0),
_owningAvatarMixer(),
_targetVelocity(0.0f),
_localAABox(DEFAULT_LOCAL_AABOX_CORNER, DEFAULT_LOCAL_AABOX_SCALE)
_targetVelocity(0.0f)
{
setBodyPitch(0.0f);
setBodyYaw(-90.0f);
@ -2321,8 +2320,7 @@ std::priority_queue<AvatarPriority> AvatarData::sortAvatars(
QList<AvatarSharedPointer> avatarList,
const ViewFrustum& cameraView,
std::function<uint64_t(AvatarSharedPointer)> lastUpdated,
std::function<bool(AvatarSharedPointer)> shouldIgnore,
bool printDebug) {
std::function<bool(AvatarSharedPointer)> shouldIgnore) {
uint64_t startTime = usecTimestampNow();
@ -2335,8 +2333,6 @@ std::priority_queue<AvatarPriority> AvatarData::sortAvatars(
const auto& avatar = avatarList.at(i);
bool outOfView = false;
// FIXME - probably some lambda that allows the caller to reject some avatars
if (shouldIgnore(avatar)) {
continue;
}
@ -2352,13 +2348,10 @@ std::priority_queue<AvatarPriority> AvatarData::sortAvatars(
// FIXME - AvatarData has something equivolent to this
float radius = 1.0f; // avatar->getBoundingRadius();
const glm::vec3& forward = cameraView.getDirection();
float apparentSize = 2.0f * radius / distance;
float cosineAngle = glm::length(glm::dot(offset, forward) * forward) / distance;
uint64_t lastUpdatedTime = lastUpdated(avatar); // avatar->getLastRenderUpdateTime()
float age = (float)(startTime - lastUpdatedTime) / (float)(USECS_PER_SECOND);
float age = (float)(startTime - lastUpdated(avatar)) / (float)(USECS_PER_SECOND);
// NOTE: we are adding values of different units to get a single measure of "priority".
// Thus we multiply each component by a conversion "weight" that scales its units relative to the others.
@ -2375,10 +2368,6 @@ std::priority_queue<AvatarPriority> AvatarData::sortAvatars(
outOfView = true;
}
}
if (printDebug) {
qDebug() << "avatar:" << avatar.get() << "priority:" << priority << "apparentSize:" << apparentSize << "cosineAngle:" << cosineAngle << "age:" << age << "outOfView:" << outOfView;
}
sortedAvatars.push(AvatarPriority(avatar, priority));
}
}

View file

@ -550,8 +550,6 @@ public:
void setOwningAvatarMixer(const QWeakPointer<Node>& owningAvatarMixer) { _owningAvatarMixer = owningAvatarMixer; }
//const AABox& getLocalAABox() const { return _localAABox; }
int getUsecsSinceLastUpdate() const { return _averageBytesReceived.getUsecsSinceLastEvent(); }
int getAverageBytesReceivedPerSecond() const;
int getReceiveRate() const;
@ -600,8 +598,7 @@ public:
QList<AvatarSharedPointer> avatarList,
const ViewFrustum& cameraView,
std::function<uint64_t(AvatarSharedPointer)> lastUpdated,
std::function<bool(AvatarSharedPointer)> shouldIgnore,
bool printDebug = false);
std::function<bool(AvatarSharedPointer)> shouldIgnore);
// TODO: remove this HACK once we settle on optimal sort coefficients
// These coefficients exposed for fine tuning the sort priority for transfering new _jointData to the render pipeline.
@ -692,8 +689,6 @@ protected:
glm::vec3 _targetVelocity;
AABox _localAABox;
SimpleMovingAverage _averageBytesReceived;
// During recording, this holds the starting position, orientation & scale of the recorded avatar