diff --git a/assignment-client/src/avatars/AvatarMixerSlave.cpp b/assignment-client/src/avatars/AvatarMixerSlave.cpp index 5c71b88af9..360c6e26fd 100644 --- a/assignment-client/src/avatars/AvatarMixerSlave.cpp +++ b/assignment-client/src/avatars/AvatarMixerSlave.cpp @@ -217,11 +217,19 @@ void AvatarMixerSlave::broadcastAvatarData(const SharedNodePointer& node) { qDebug() << "avatarDataToNodes.size:" << avatarDataToNodes.size(); */ - //qDebug() << "------------------------------"; AvatarSharedPointer thisAvatar = nodeData->getAvatarSharedPointer(); //qDebug() << "thisAvatar:" << thisAvatar.get(); +#ifdef WANT_DEBUG + bool printDebug = nodeData->getAvatarSharedPointer()->getDisplayName() == "ZappoMan"; + + if (printDebug) { + qDebug() << "------------------------------"; + } +#else + bool printDebug = false; +#endif ViewFrustum cameraView = nodeData->getViewFrustom(); std::priority_queue sortedAvatars = AvatarData::sortAvatars( avatarList, cameraView, @@ -236,14 +244,15 @@ void AvatarMixerSlave::broadcastAvatarData(const SharedNodePointer& node) { [thisAvatar](AvatarSharedPointer avatar)->bool{ return (avatar == thisAvatar); // ignore ourselves... - }); - //qDebug() << "------------------------------"; + }, printDebug); +#ifdef WANT_DEBUG + if (printDebug) { + qDebug() << "------------------------------"; + } +#endif - // this is an AGENT we have received head data from - // send back a packet with other active node data to this node - //std::for_each(_begin, _end, [&](const SharedNodePointer& otherNode) { - + // loop through our sorted avatars and allocate our bandwidth to them accordingly int avatarRank = 0; while (!sortedAvatars.empty()) { AvatarPriority sortData = sortedAvatars.top(); diff --git a/libraries/avatars/src/AvatarData.cpp b/libraries/avatars/src/AvatarData.cpp index 9416216c5a..fd21670853 100644 --- a/libraries/avatars/src/AvatarData.cpp +++ b/libraries/avatars/src/AvatarData.cpp @@ -2317,7 +2317,8 @@ std::priority_queue AvatarData::sortAvatars( QList avatarList, const ViewFrustum& cameraView, std::function lastUpdated, - std::function shouldIgnore) { + std::function shouldIgnore, + bool printDebug) { uint64_t startTime = usecTimestampNow(); @@ -2359,16 +2360,20 @@ std::priority_queue AvatarData::sortAvatars( // Thus we multiply each component by a conversion "weight" that scales its units // relative to the others. These weights are pure magic tuning and are hard coded in the // relation below: (hint: unitary weights are not explicityly shown) - float priority = apparentSize + 0.25f * cosineAngle + age; + float priority = apparentSize + 10.0f * (0.25f * cosineAngle) + age; // decrement priority of avatars outside keyhole + bool outOfView = false; if (distance > cameraView.getCenterRadius()) { if (!cameraView.sphereIntersectsFrustum(avatarPosition, radius)) { priority += OUT_OF_VIEW_PENALTY; + outOfView = true; } } - //qDebug() << "avatar:" << avatar.get() << "priority:" << priority << "apparentSize:" << apparentSize << "cosineAngle:" << cosineAngle << "age:" << age; + if (printDebug) { + qDebug() << "avatar:" << avatar.get() << "priority:" << priority << "apparentSize:" << apparentSize << "cosineAngle:" << cosineAngle << "age:" << age << "outOfView:" << outOfView; + } sortedAvatars.push(AvatarPriority(avatar, priority)); } } diff --git a/libraries/avatars/src/AvatarData.h b/libraries/avatars/src/AvatarData.h index 71ade436ff..a75e81ed3d 100644 --- a/libraries/avatars/src/AvatarData.h +++ b/libraries/avatars/src/AvatarData.h @@ -600,7 +600,8 @@ public: QList avatarList, const ViewFrustum& cameraView, std::function lastUpdated, - std::function shouldIgnore); + std::function shouldIgnore, + bool printDebug = false); public slots: