mirror of
https://github.com/overte-org/overte.git
synced 2025-04-22 22:33:34 +02:00
more cleanup
This commit is contained in:
parent
aa955ee360
commit
382645ddd0
7 changed files with 14 additions and 21 deletions
assignment-client/src
interface/src/avatar
libraries/avatars/src
|
@ -537,7 +537,7 @@ void Agent::setIsAvatar(bool isAvatar) {
|
|||
connect(_avatarIdentityTimer, &QTimer::timeout, this, &Agent::sendAvatarIdentityPacket);
|
||||
|
||||
// start the timers
|
||||
_avatarIdentityTimer->start(AVATAR_IDENTITY_PACKET_SEND_INTERVAL_MSECS);
|
||||
_avatarIdentityTimer->start(AVATAR_IDENTITY_PACKET_SEND_INTERVAL_MSECS); // FIXME - we shouldn't really need to constantly send identity packets
|
||||
|
||||
// tell the avatarAudioTimer to start ticking
|
||||
emit startAvatarAudioTimer();
|
||||
|
|
|
@ -405,7 +405,7 @@ void AvatarMixer::handleAvatarIdentityPacket(QSharedPointer<ReceivedMessage> mes
|
|||
|
||||
// parse the identity packet and update the change timestamp if appropriate
|
||||
AvatarData::Identity identity;
|
||||
AvatarData::parseAvatarIdentityPacket(message, identity);
|
||||
AvatarData::parseAvatarIdentityPacket(message->getMessage(), identity);
|
||||
bool identityChanged = false;
|
||||
bool displayNameChanged = false;
|
||||
avatar.processAvatarIdentity(identity, identityChanged, displayNameChanged);
|
||||
|
|
|
@ -412,13 +412,9 @@ void MyAvatar::update(float deltaTime) {
|
|||
Q_ARG(glm::vec3, (getPosition() - halfBoundingBoxDimensions)),
|
||||
Q_ARG(glm::vec3, (halfBoundingBoxDimensions*2.0f)));
|
||||
|
||||
uint64_t now = usecTimestampNow();
|
||||
if (now > _identityPacketExpiry || _avatarEntityDataLocallyEdited) {
|
||||
_identityPacketExpiry = now + AVATAR_IDENTITY_PACKET_SEND_INTERVAL_USECS;
|
||||
if (getIdentityDataChanged()) {
|
||||
qDebug() << __FUNCTION__ << "about to call... sendIdentityPacket(); --- _identityPacketExpiry:" << _identityPacketExpiry << "_avatarEntityDataLocallyEdited:" << _avatarEntityDataLocallyEdited;
|
||||
sendIdentityPacket();
|
||||
}
|
||||
if (getIdentityDataChanged()) {
|
||||
qDebug() << __FUNCTION__ << "about to call... sendIdentityPacket();";
|
||||
sendIdentityPacket();
|
||||
}
|
||||
|
||||
simulate(deltaTime);
|
||||
|
@ -1261,7 +1257,7 @@ void MyAvatar::useFullAvatarURL(const QUrl& fullAvatarURL, const QString& modelN
|
|||
setSkeletonModelURL(fullAvatarURL);
|
||||
UserActivityLogger::getInstance().changedModel("skeleton", urlString);
|
||||
}
|
||||
_identityPacketExpiry = 0; // triggers an identity packet next update()
|
||||
markIdentityDataChanged();
|
||||
}
|
||||
|
||||
void MyAvatar::setAttachmentData(const QVector<AttachmentData>& attachmentData) {
|
||||
|
|
|
@ -701,8 +701,6 @@ private:
|
|||
std::mutex _holdActionsMutex;
|
||||
std::vector<AvatarActionHold*> _holdActions;
|
||||
|
||||
uint64_t _identityPacketExpiry { 0 };
|
||||
|
||||
float AVATAR_MOVEMENT_ENERGY_CONSTANT { 0.001f };
|
||||
float AUDIO_ENERGY_CONSTANT { 0.000001f };
|
||||
float MAX_AVATAR_MOVEMENT_PER_FRAME { 30.0f };
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
|
||||
#include <cstdio>
|
||||
#include <cstring>
|
||||
#include <limits>
|
||||
#include <stdint.h>
|
||||
|
||||
#include <QtCore/QDataStream>
|
||||
|
@ -1455,8 +1454,7 @@ QStringList AvatarData::getJointNames() const {
|
|||
return _jointNames;
|
||||
}
|
||||
|
||||
void AvatarData::parseAvatarIdentityPacket(const QSharedPointer<ReceivedMessage>& message, Identity& identityOut) {
|
||||
const QByteArray& data = message->getMessage();
|
||||
void AvatarData::parseAvatarIdentityPacket(const QByteArray& data, Identity& identityOut) {
|
||||
QDataStream packetStream(data);
|
||||
|
||||
packetStream >> identityOut.uuid
|
||||
|
@ -1491,9 +1489,6 @@ void AvatarData::processAvatarIdentity(const Identity& identity, bool& identityC
|
|||
return;
|
||||
}
|
||||
|
||||
_identityUpdatedAt = identity.updatedAt;
|
||||
qDebug() << __FUNCTION__ << "_identityUpdatedAt:" << _identityUpdatedAt;
|
||||
|
||||
if (_firstSkeletonCheck || (identity.skeletonModelURL != cannonicalSkeletonModelURL(emptyURL))) {
|
||||
setSkeletonModelURL(identity.skeletonModelURL);
|
||||
identityChanged = true;
|
||||
|
@ -1526,6 +1521,11 @@ void AvatarData::processAvatarIdentity(const Identity& identity, bool& identityC
|
|||
// flag this avatar as non-stale by updating _averageBytesReceived
|
||||
const int BOGUS_NUM_BYTES = 1;
|
||||
_averageBytesReceived.updateAverage(BOGUS_NUM_BYTES);
|
||||
|
||||
// use the timestamp from this identity, since we want to honor the updated times in "server clock"
|
||||
// this will overwrite any changes we made locally to this AvatarData's _identityUpdatedAt
|
||||
_identityUpdatedAt = identity.updatedAt;
|
||||
qDebug() << __FUNCTION__ << "_identityUpdatedAt:" << _identityUpdatedAt;
|
||||
}
|
||||
|
||||
QByteArray AvatarData::identityByteArray() const {
|
||||
|
|
|
@ -249,7 +249,6 @@ static const float MIN_AVATAR_SCALE = .005f;
|
|||
const float MAX_AUDIO_LOUDNESS = 1000.0f; // close enough for mouth animation
|
||||
|
||||
const int AVATAR_IDENTITY_PACKET_SEND_INTERVAL_MSECS = 1000;
|
||||
const int AVATAR_IDENTITY_PACKET_SEND_INTERVAL_USECS = AVATAR_IDENTITY_PACKET_SEND_INTERVAL_MSECS * USECS_PER_MSEC;
|
||||
|
||||
// See also static AvatarData::defaultFullAvatarModelUrl().
|
||||
const QString DEFAULT_FULL_AVATAR_MODEL_NAME = QString("Default");
|
||||
|
@ -534,7 +533,7 @@ public:
|
|||
quint64 updatedAt;
|
||||
};
|
||||
|
||||
static void parseAvatarIdentityPacket(const QSharedPointer<ReceivedMessage>& message, Identity& identityOut);
|
||||
static void parseAvatarIdentityPacket(const QByteArray& data, Identity& identityOut);
|
||||
|
||||
// identityChanged returns true if identity has changed, false otherwise.
|
||||
// displayNameChanged returns true if displayName has changed, false otherwise.
|
||||
|
|
|
@ -127,7 +127,7 @@ AvatarSharedPointer AvatarHashMap::parseAvatarData(QSharedPointer<ReceivedMessag
|
|||
|
||||
void AvatarHashMap::processAvatarIdentityPacket(QSharedPointer<ReceivedMessage> message, SharedNodePointer sendingNode) {
|
||||
AvatarData::Identity identity;
|
||||
AvatarData::parseAvatarIdentityPacket(message, identity);
|
||||
AvatarData::parseAvatarIdentityPacket(message->getMessage(), identity);
|
||||
|
||||
// make sure this isn't for an ignored avatar
|
||||
auto nodeList = DependencyManager::get<NodeList>();
|
||||
|
|
Loading…
Reference in a new issue