mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 02:56:50 +02:00
add some debugging
This commit is contained in:
parent
8cc0b383c4
commit
4c42e95607
3 changed files with 26 additions and 11 deletions
|
@ -217,11 +217,19 @@ void AvatarMixerSlave::broadcastAvatarData(const SharedNodePointer& node) {
|
||||||
qDebug() << "avatarDataToNodes.size:" << avatarDataToNodes.size();
|
qDebug() << "avatarDataToNodes.size:" << avatarDataToNodes.size();
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//qDebug() << "------------------------------";
|
|
||||||
AvatarSharedPointer thisAvatar = nodeData->getAvatarSharedPointer();
|
AvatarSharedPointer thisAvatar = nodeData->getAvatarSharedPointer();
|
||||||
|
|
||||||
//qDebug() << "thisAvatar:" << thisAvatar.get();
|
//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();
|
ViewFrustum cameraView = nodeData->getViewFrustom();
|
||||||
std::priority_queue<AvatarPriority> sortedAvatars = AvatarData::sortAvatars(
|
std::priority_queue<AvatarPriority> sortedAvatars = AvatarData::sortAvatars(
|
||||||
avatarList, cameraView,
|
avatarList, cameraView,
|
||||||
|
@ -236,14 +244,15 @@ void AvatarMixerSlave::broadcastAvatarData(const SharedNodePointer& node) {
|
||||||
|
|
||||||
[thisAvatar](AvatarSharedPointer avatar)->bool{
|
[thisAvatar](AvatarSharedPointer avatar)->bool{
|
||||||
return (avatar == thisAvatar); // ignore ourselves...
|
return (avatar == thisAvatar); // ignore ourselves...
|
||||||
});
|
}, printDebug);
|
||||||
//qDebug() << "------------------------------";
|
|
||||||
|
|
||||||
|
#ifdef WANT_DEBUG
|
||||||
|
if (printDebug) {
|
||||||
|
qDebug() << "------------------------------";
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
// this is an AGENT we have received head data from
|
// loop through our sorted avatars and allocate our bandwidth to them accordingly
|
||||||
// send back a packet with other active node data to this node
|
|
||||||
//std::for_each(_begin, _end, [&](const SharedNodePointer& otherNode) {
|
|
||||||
|
|
||||||
int avatarRank = 0;
|
int avatarRank = 0;
|
||||||
while (!sortedAvatars.empty()) {
|
while (!sortedAvatars.empty()) {
|
||||||
AvatarPriority sortData = sortedAvatars.top();
|
AvatarPriority sortData = sortedAvatars.top();
|
||||||
|
|
|
@ -2317,7 +2317,8 @@ std::priority_queue<AvatarPriority> AvatarData::sortAvatars(
|
||||||
QList<AvatarSharedPointer> avatarList,
|
QList<AvatarSharedPointer> avatarList,
|
||||||
const ViewFrustum& cameraView,
|
const ViewFrustum& cameraView,
|
||||||
std::function<uint64_t(AvatarSharedPointer)> lastUpdated,
|
std::function<uint64_t(AvatarSharedPointer)> lastUpdated,
|
||||||
std::function<bool(AvatarSharedPointer)> shouldIgnore) {
|
std::function<bool(AvatarSharedPointer)> shouldIgnore,
|
||||||
|
bool printDebug) {
|
||||||
|
|
||||||
uint64_t startTime = usecTimestampNow();
|
uint64_t startTime = usecTimestampNow();
|
||||||
|
|
||||||
|
@ -2359,16 +2360,20 @@ std::priority_queue<AvatarPriority> AvatarData::sortAvatars(
|
||||||
// Thus we multiply each component by a conversion "weight" that scales its units
|
// 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
|
// 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)
|
// 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
|
// decrement priority of avatars outside keyhole
|
||||||
|
bool outOfView = false;
|
||||||
if (distance > cameraView.getCenterRadius()) {
|
if (distance > cameraView.getCenterRadius()) {
|
||||||
if (!cameraView.sphereIntersectsFrustum(avatarPosition, radius)) {
|
if (!cameraView.sphereIntersectsFrustum(avatarPosition, radius)) {
|
||||||
priority += OUT_OF_VIEW_PENALTY;
|
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));
|
sortedAvatars.push(AvatarPriority(avatar, priority));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -600,7 +600,8 @@ public:
|
||||||
QList<AvatarSharedPointer> avatarList,
|
QList<AvatarSharedPointer> avatarList,
|
||||||
const ViewFrustum& cameraView,
|
const ViewFrustum& cameraView,
|
||||||
std::function<uint64_t(AvatarSharedPointer)> lastUpdated,
|
std::function<uint64_t(AvatarSharedPointer)> lastUpdated,
|
||||||
std::function<bool(AvatarSharedPointer)> shouldIgnore);
|
std::function<bool(AvatarSharedPointer)> shouldIgnore,
|
||||||
|
bool printDebug = false);
|
||||||
|
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
|
Loading…
Reference in a new issue