mirror of
https://github.com/overte-org/overte.git
synced 2025-08-06 19:59:28 +02:00
more cleanup
This commit is contained in:
parent
4c4506b1f7
commit
edf7c016a1
4 changed files with 6 additions and 25 deletions
|
@ -309,7 +309,6 @@ void AvatarMixer::nodeKilled(SharedNodePointer killedNode) {
|
||||||
},
|
},
|
||||||
[&](const SharedNodePointer& node) {
|
[&](const SharedNodePointer& node) {
|
||||||
QMetaObject::invokeMethod(node->getLinkedData(),
|
QMetaObject::invokeMethod(node->getLinkedData(),
|
||||||
//"removeLastBroadcastSequenceNumber",
|
|
||||||
"cleanupKilledNode",
|
"cleanupKilledNode",
|
||||||
Qt::AutoConnection,
|
Qt::AutoConnection,
|
||||||
Q_ARG(const QUuid&, QUuid(killedNode->getUUID())));
|
Q_ARG(const QUuid&, QUuid(killedNode->getUUID())));
|
||||||
|
|
|
@ -187,7 +187,8 @@ void AvatarMixerSlave::broadcastAvatarData(const SharedNodePointer& node) {
|
||||||
// setup a PacketList for the avatarPackets
|
// setup a PacketList for the avatarPackets
|
||||||
auto avatarPacketList = NLPacketList::create(PacketType::BulkAvatarData);
|
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;
|
QList<AvatarSharedPointer> avatarList;
|
||||||
std::unordered_map<AvatarSharedPointer, SharedNodePointer> avatarDataToNodes;
|
std::unordered_map<AvatarSharedPointer, SharedNodePointer> avatarDataToNodes;
|
||||||
|
|
||||||
|
@ -204,9 +205,6 @@ void AvatarMixerSlave::broadcastAvatarData(const SharedNodePointer& node) {
|
||||||
});
|
});
|
||||||
|
|
||||||
AvatarSharedPointer thisAvatar = nodeData->getAvatarSharedPointer();
|
AvatarSharedPointer thisAvatar = nodeData->getAvatarSharedPointer();
|
||||||
|
|
||||||
//qDebug() << "thisAvatar:" << thisAvatar.get();
|
|
||||||
|
|
||||||
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,
|
||||||
|
|
|
@ -69,8 +69,7 @@ AvatarData::AvatarData() :
|
||||||
_displayNameAlpha(1.0f),
|
_displayNameAlpha(1.0f),
|
||||||
_errorLogExpiry(0),
|
_errorLogExpiry(0),
|
||||||
_owningAvatarMixer(),
|
_owningAvatarMixer(),
|
||||||
_targetVelocity(0.0f),
|
_targetVelocity(0.0f)
|
||||||
_localAABox(DEFAULT_LOCAL_AABOX_CORNER, DEFAULT_LOCAL_AABOX_SCALE)
|
|
||||||
{
|
{
|
||||||
setBodyPitch(0.0f);
|
setBodyPitch(0.0f);
|
||||||
setBodyYaw(-90.0f);
|
setBodyYaw(-90.0f);
|
||||||
|
@ -2321,8 +2320,7 @@ 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();
|
||||||
|
|
||||||
|
@ -2335,8 +2333,6 @@ std::priority_queue<AvatarPriority> AvatarData::sortAvatars(
|
||||||
const auto& avatar = avatarList.at(i);
|
const auto& avatar = avatarList.at(i);
|
||||||
bool outOfView = false;
|
bool outOfView = false;
|
||||||
|
|
||||||
// FIXME - probably some lambda that allows the caller to reject some avatars
|
|
||||||
|
|
||||||
if (shouldIgnore(avatar)) {
|
if (shouldIgnore(avatar)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -2352,13 +2348,10 @@ std::priority_queue<AvatarPriority> AvatarData::sortAvatars(
|
||||||
// FIXME - AvatarData has something equivolent to this
|
// FIXME - AvatarData has something equivolent to this
|
||||||
float radius = 1.0f; // avatar->getBoundingRadius();
|
float radius = 1.0f; // avatar->getBoundingRadius();
|
||||||
|
|
||||||
|
|
||||||
const glm::vec3& forward = cameraView.getDirection();
|
const glm::vec3& forward = cameraView.getDirection();
|
||||||
float apparentSize = 2.0f * radius / distance;
|
float apparentSize = 2.0f * radius / distance;
|
||||||
float cosineAngle = glm::length(glm::dot(offset, forward) * forward) / distance;
|
float cosineAngle = glm::length(glm::dot(offset, forward) * forward) / distance;
|
||||||
|
float age = (float)(startTime - lastUpdated(avatar)) / (float)(USECS_PER_SECOND);
|
||||||
uint64_t lastUpdatedTime = lastUpdated(avatar); // avatar->getLastRenderUpdateTime()
|
|
||||||
float age = (float)(startTime - lastUpdatedTime) / (float)(USECS_PER_SECOND);
|
|
||||||
|
|
||||||
// NOTE: we are adding values of different units to get a single measure of "priority".
|
// 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.
|
// 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;
|
outOfView = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -550,8 +550,6 @@ public:
|
||||||
|
|
||||||
void setOwningAvatarMixer(const QWeakPointer<Node>& owningAvatarMixer) { _owningAvatarMixer = owningAvatarMixer; }
|
void setOwningAvatarMixer(const QWeakPointer<Node>& owningAvatarMixer) { _owningAvatarMixer = owningAvatarMixer; }
|
||||||
|
|
||||||
//const AABox& getLocalAABox() const { return _localAABox; }
|
|
||||||
|
|
||||||
int getUsecsSinceLastUpdate() const { return _averageBytesReceived.getUsecsSinceLastEvent(); }
|
int getUsecsSinceLastUpdate() const { return _averageBytesReceived.getUsecsSinceLastEvent(); }
|
||||||
int getAverageBytesReceivedPerSecond() const;
|
int getAverageBytesReceivedPerSecond() const;
|
||||||
int getReceiveRate() const;
|
int getReceiveRate() const;
|
||||||
|
@ -600,8 +598,7 @@ 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);
|
|
||||||
|
|
||||||
// TODO: remove this HACK once we settle on optimal sort coefficients
|
// 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.
|
// 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;
|
glm::vec3 _targetVelocity;
|
||||||
|
|
||||||
AABox _localAABox;
|
|
||||||
|
|
||||||
SimpleMovingAverage _averageBytesReceived;
|
SimpleMovingAverage _averageBytesReceived;
|
||||||
|
|
||||||
// During recording, this holds the starting position, orientation & scale of the recorded avatar
|
// During recording, this holds the starting position, orientation & scale of the recorded avatar
|
||||||
|
|
Loading…
Reference in a new issue