mirror of
https://github.com/AleziaKurdis/overte.git
synced 2025-08-10 10:33:25 +02:00
make methods private: avoid sanity check logic
This commit is contained in:
parent
542a668723
commit
0e504e9ec6
4 changed files with 17 additions and 31 deletions
|
@ -63,7 +63,6 @@ AvatarData::AvatarData() :
|
||||||
_handState(0),
|
_handState(0),
|
||||||
_keyState(NO_KEY_DOWN),
|
_keyState(NO_KEY_DOWN),
|
||||||
_forceFaceTrackerConnected(false),
|
_forceFaceTrackerConnected(false),
|
||||||
_hasNewJointData(true),
|
|
||||||
_headData(NULL),
|
_headData(NULL),
|
||||||
_displayNameTargetAlpha(1.0f),
|
_displayNameTargetAlpha(1.0f),
|
||||||
_displayNameAlpha(1.0f),
|
_displayNameAlpha(1.0f),
|
||||||
|
@ -703,7 +702,6 @@ int AvatarData::parseDataFromBuffer(const QByteArray& buffer) {
|
||||||
bool hasFaceTrackerInfo = HAS_FLAG(packetStateFlags, AvatarDataPacket::PACKET_HAS_FACE_TRACKER_INFO);
|
bool hasFaceTrackerInfo = HAS_FLAG(packetStateFlags, AvatarDataPacket::PACKET_HAS_FACE_TRACKER_INFO);
|
||||||
bool hasJointData = HAS_FLAG(packetStateFlags, AvatarDataPacket::PACKET_HAS_JOINT_DATA);
|
bool hasJointData = HAS_FLAG(packetStateFlags, AvatarDataPacket::PACKET_HAS_JOINT_DATA);
|
||||||
|
|
||||||
|
|
||||||
quint64 now = usecTimestampNow();
|
quint64 now = usecTimestampNow();
|
||||||
|
|
||||||
if (hasAvatarGlobalPosition) {
|
if (hasAvatarGlobalPosition) {
|
||||||
|
@ -2245,17 +2243,15 @@ void AvatarData::setAvatarEntityData(const AvatarEntityMap& avatarEntityData) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
_avatarEntitiesLock.withWriteLock([&] {
|
_avatarEntitiesLock.withWriteLock([&] {
|
||||||
if (_avatarEntityData != avatarEntityData) {
|
// keep track of entities that were attached to this avatar but no longer are
|
||||||
// keep track of entities that were attached to this avatar but no longer are
|
AvatarEntityIDs previousAvatarEntityIDs = QSet<QUuid>::fromList(_avatarEntityData.keys());
|
||||||
AvatarEntityIDs previousAvatarEntityIDs = QSet<QUuid>::fromList(_avatarEntityData.keys());
|
|
||||||
|
|
||||||
_avatarEntityData = avatarEntityData;
|
_avatarEntityData = avatarEntityData;
|
||||||
setAvatarEntityDataChanged(true);
|
setAvatarEntityDataChanged(true);
|
||||||
|
|
||||||
foreach (auto entityID, previousAvatarEntityIDs) {
|
foreach (auto entityID, previousAvatarEntityIDs) {
|
||||||
if (!_avatarEntityData.contains(entityID)) {
|
if (!_avatarEntityData.contains(entityID)) {
|
||||||
_avatarEntityDetached.insert(entityID);
|
_avatarEntityDetached.insert(entityID);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -538,7 +538,6 @@ public:
|
||||||
glm::vec3 getGlobalBoundingBoxCorner() { return _globalPosition + _globalBoundingBoxOffset - _globalBoundingBoxDimensions; }
|
glm::vec3 getGlobalBoundingBoxCorner() { return _globalPosition + _globalBoundingBoxOffset - _globalBoundingBoxDimensions; }
|
||||||
|
|
||||||
Q_INVOKABLE AvatarEntityMap getAvatarEntityData() const;
|
Q_INVOKABLE AvatarEntityMap getAvatarEntityData() const;
|
||||||
Q_INVOKABLE void setAvatarEntityData(const AvatarEntityMap& avatarEntityData);
|
|
||||||
void setAvatarEntityDataChanged(bool value) { _avatarEntityDataChanged = value; }
|
void setAvatarEntityDataChanged(bool value) { _avatarEntityDataChanged = value; }
|
||||||
AvatarEntityIDs getAndClearRecentlyDetachedIDs();
|
AvatarEntityIDs getAndClearRecentlyDetachedIDs();
|
||||||
|
|
||||||
|
@ -552,7 +551,7 @@ public:
|
||||||
|
|
||||||
int getJointCount() { return _jointData.size(); }
|
int getJointCount() { return _jointData.size(); }
|
||||||
|
|
||||||
QVector<JointData> getLastSentJointData() {
|
QVector<JointData> getLastSentJointData() {
|
||||||
QReadLocker readLock(&_jointDataLock);
|
QReadLocker readLock(&_jointDataLock);
|
||||||
_lastSentJointData.resize(_jointData.size());
|
_lastSentJointData.resize(_jointData.size());
|
||||||
return _lastSentJointData;
|
return _lastSentJointData;
|
||||||
|
@ -576,6 +575,8 @@ public slots:
|
||||||
void resetLastSent() { _lastToByteArray = 0; }
|
void resetLastSent() { _lastToByteArray = 0; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
Q_INVOKABLE void setAvatarEntityData(const AvatarEntityMap& avatarEntityData);
|
||||||
|
|
||||||
void lazyInitHeadData();
|
void lazyInitHeadData();
|
||||||
|
|
||||||
float getDistanceBasedMinRotationDOT(glm::vec3 viewerPosition);
|
float getDistanceBasedMinRotationDOT(glm::vec3 viewerPosition);
|
||||||
|
@ -614,7 +615,7 @@ protected:
|
||||||
KeyState _keyState;
|
KeyState _keyState;
|
||||||
|
|
||||||
bool _forceFaceTrackerConnected;
|
bool _forceFaceTrackerConnected;
|
||||||
bool _hasNewJointData; // set in AvatarData, cleared in Avatar
|
bool _hasNewJointData { true }; // set in AvatarData, cleared in Avatar
|
||||||
|
|
||||||
HeadData* _headData { nullptr };
|
HeadData* _headData { nullptr };
|
||||||
|
|
||||||
|
|
|
@ -38,19 +38,7 @@ void EntityEditPacketSender::queueEditAvatarEntityMessage(PacketType type,
|
||||||
EntityTreePointer entityTree,
|
EntityTreePointer entityTree,
|
||||||
EntityItemID entityItemID,
|
EntityItemID entityItemID,
|
||||||
const EntityItemProperties& properties) {
|
const EntityItemProperties& properties) {
|
||||||
if (!_shouldSend) {
|
|
||||||
return; // bail early
|
|
||||||
}
|
|
||||||
|
|
||||||
if (properties.getOwningAvatarID() != _myAvatar->getID()) {
|
|
||||||
return; // don't send updates for someone else's avatarEntity
|
|
||||||
}
|
|
||||||
|
|
||||||
assert(properties.getClientOnly());
|
|
||||||
|
|
||||||
// this is an avatar-based entity. update our avatar-data rather than sending to the entity-server
|
|
||||||
assert(_myAvatar);
|
assert(_myAvatar);
|
||||||
|
|
||||||
if (!entityTree) {
|
if (!entityTree) {
|
||||||
qCDebug(entities) << "EntityEditPacketSender::queueEditEntityMessage null entityTree.";
|
qCDebug(entities) << "EntityEditPacketSender::queueEditEntityMessage null entityTree.";
|
||||||
return;
|
return;
|
||||||
|
@ -93,7 +81,8 @@ void EntityEditPacketSender::queueEditEntityMessage(PacketType type,
|
||||||
return; // bail early
|
return; // bail early
|
||||||
}
|
}
|
||||||
|
|
||||||
if (properties.getClientOnly()) {
|
if (properties.getClientOnly() && properties.getOwningAvatarID() == _myAvatar->getID()) {
|
||||||
|
// this is an avatar-based entity --> update our avatar-data rather than sending to the entity-server
|
||||||
queueEditAvatarEntityMessage(type, entityTree, entityItemID, properties);
|
queueEditAvatarEntityMessage(type, entityTree, entityItemID, properties);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,10 +27,6 @@ public:
|
||||||
AvatarData* getMyAvatar() { return _myAvatar; }
|
AvatarData* getMyAvatar() { return _myAvatar; }
|
||||||
void clearAvatarEntity(QUuid entityID) { assert(_myAvatar); _myAvatar->clearAvatarEntity(entityID); }
|
void clearAvatarEntity(QUuid entityID) { assert(_myAvatar); _myAvatar->clearAvatarEntity(entityID); }
|
||||||
|
|
||||||
void queueEditAvatarEntityMessage(PacketType type, EntityTreePointer entityTree,
|
|
||||||
EntityItemID entityItemID, const EntityItemProperties& properties);
|
|
||||||
|
|
||||||
|
|
||||||
/// Queues an array of several voxel edit messages. Will potentially send a pending multi-command packet. Determines
|
/// Queues an array of several voxel edit messages. Will potentially send a pending multi-command packet. Determines
|
||||||
/// which voxel-server node or nodes the packet should be sent to. Can be called even before voxel servers are known, in
|
/// which voxel-server node or nodes the packet should be sent to. Can be called even before voxel servers are known, in
|
||||||
/// which case up to MaxPendingMessages will be buffered and processed when voxel servers are known.
|
/// which case up to MaxPendingMessages will be buffered and processed when voxel servers are known.
|
||||||
|
@ -48,6 +44,10 @@ public:
|
||||||
public slots:
|
public slots:
|
||||||
void processEntityEditNackPacket(QSharedPointer<ReceivedMessage> message, SharedNodePointer sendingNode);
|
void processEntityEditNackPacket(QSharedPointer<ReceivedMessage> message, SharedNodePointer sendingNode);
|
||||||
|
|
||||||
|
private:
|
||||||
|
void queueEditAvatarEntityMessage(PacketType type, EntityTreePointer entityTree,
|
||||||
|
EntityItemID entityItemID, const EntityItemProperties& properties);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
AvatarData* _myAvatar { nullptr };
|
AvatarData* _myAvatar { nullptr };
|
||||||
QScriptEngine _scriptEngine;
|
QScriptEngine _scriptEngine;
|
||||||
|
|
Loading…
Reference in a new issue