mirror of
https://github.com/overte-org/overte.git
synced 2025-08-06 19:59:28 +02:00
Removed jointIndices transmission experiment
This commit is contained in:
parent
de1204c42d
commit
13a057513a
2 changed files with 6 additions and 60 deletions
|
@ -592,16 +592,6 @@ int AvatarData::parseDataFromBuffer(const QByteArray& buffer) {
|
||||||
// joint rotations
|
// joint rotations
|
||||||
int numJoints = *sourceBuffer++;
|
int numJoints = *sourceBuffer++;
|
||||||
|
|
||||||
// do not process any jointData until we've received a valid jointIndices hash from
|
|
||||||
// an earlier AvatarIdentity packet. Because if we do, we risk applying the joint data
|
|
||||||
// the wrong bones, resulting in a twisted avatar, An un-animated avatar is preferable to this.
|
|
||||||
bool skipJoints = false;
|
|
||||||
#ifdef TRANSMIT_JOINT_INDICES_IN_IDENTITY_PACKET
|
|
||||||
if (_networkJointIndexMap.empty()) {
|
|
||||||
skipJoints = true;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
int bytesOfValidity = (int)ceil((float)numJoints / (float)BITS_IN_BYTE);
|
int bytesOfValidity = (int)ceil((float)numJoints / (float)BITS_IN_BYTE);
|
||||||
minPossibleSize += bytesOfValidity;
|
minPossibleSize += bytesOfValidity;
|
||||||
if (minPossibleSize > maxAvailableSize) {
|
if (minPossibleSize > maxAvailableSize) {
|
||||||
|
@ -653,13 +643,9 @@ int AvatarData::parseDataFromBuffer(const QByteArray& buffer) {
|
||||||
for (int i = 0; i < numJoints; i++) {
|
for (int i = 0; i < numJoints; i++) {
|
||||||
JointData& data = _jointData[i];
|
JointData& data = _jointData[i];
|
||||||
if (validRotations[i]) {
|
if (validRotations[i]) {
|
||||||
if (skipJoints) {
|
sourceBuffer += unpackOrientationQuatFromSixBytes(sourceBuffer, data.rotation);
|
||||||
sourceBuffer += COMPRESSED_QUATERNION_SIZE;
|
_hasNewJointRotations = true;
|
||||||
} else {
|
data.rotationSet = true;
|
||||||
sourceBuffer += unpackOrientationQuatFromSixBytes(sourceBuffer, data.rotation);
|
|
||||||
_hasNewJointRotations = true;
|
|
||||||
data.rotationSet = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} // numJoints * 6 bytes
|
} // numJoints * 6 bytes
|
||||||
|
@ -705,13 +691,9 @@ int AvatarData::parseDataFromBuffer(const QByteArray& buffer) {
|
||||||
for (int i = 0; i < numJoints; i++) {
|
for (int i = 0; i < numJoints; i++) {
|
||||||
JointData& data = _jointData[i];
|
JointData& data = _jointData[i];
|
||||||
if (validTranslations[i]) {
|
if (validTranslations[i]) {
|
||||||
if (skipJoints) {
|
sourceBuffer += unpackFloatVec3FromSignedTwoByteFixed(sourceBuffer, data.translation, TRANSLATION_COMPRESSION_RADIX);
|
||||||
sourceBuffer += COMPRESSED_TRANSLATION_SIZE;
|
_hasNewJointTranslations = true;
|
||||||
} else {
|
data.translationSet = true;
|
||||||
sourceBuffer += unpackFloatVec3FromSignedTwoByteFixed(sourceBuffer, data.translation, TRANSLATION_COMPRESSION_RADIX);
|
|
||||||
_hasNewJointTranslations = true;
|
|
||||||
data.translationSet = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} // numJoints * 6 bytes
|
} // numJoints * 6 bytes
|
||||||
|
@ -971,32 +953,13 @@ void AvatarData::clearJointsData() {
|
||||||
void AvatarData::parseAvatarIdentityPacket(const QByteArray& data, Identity& identityOut) {
|
void AvatarData::parseAvatarIdentityPacket(const QByteArray& data, Identity& identityOut) {
|
||||||
QDataStream packetStream(data);
|
QDataStream packetStream(data);
|
||||||
|
|
||||||
#ifdef TRANSMIT_JOINT_INDICES_IN_IDENTITY_PACKET
|
|
||||||
packetStream >> identityOut.uuid >> identityOut.skeletonModelURL >> identityOut.attachmentData >> identityOut.displayName >> identityOut.jointIndices;
|
|
||||||
#else
|
|
||||||
packetStream >> identityOut.uuid >> identityOut.skeletonModelURL >> identityOut.attachmentData >> identityOut.displayName;
|
packetStream >> identityOut.uuid >> identityOut.skeletonModelURL >> identityOut.attachmentData >> identityOut.displayName;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AvatarData::processAvatarIdentity(const Identity& identity) {
|
bool AvatarData::processAvatarIdentity(const Identity& identity) {
|
||||||
|
|
||||||
bool hasIdentityChanged = false;
|
bool hasIdentityChanged = false;
|
||||||
|
|
||||||
#ifdef TRANSMIT_JOINT_INDICES_IN_IDENTITY_PACKET
|
|
||||||
if (!_jointIndices.empty() && _networkJointIndexMap.empty() && !identity.jointIndices.empty()) {
|
|
||||||
|
|
||||||
// build networkJointIndexMap from _jointIndices and networkJointIndices.
|
|
||||||
_networkJointIndexMap.fill(-1, identity.jointIndices.size());
|
|
||||||
for (auto iter = identity.jointIndices.cbegin(); iter != identity.jointIndices.end(); ++iter) {
|
|
||||||
int jointIndex = getJointIndex(iter.key());
|
|
||||||
int networkJointIndex = iter.value();
|
|
||||||
if (networkJointIndex >= 0 && networkJointIndex < identity.jointIndices.size()) {
|
|
||||||
_networkJointIndexMap[networkJointIndex - 1] = jointIndex;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (_firstSkeletonCheck || (identity.skeletonModelURL != _skeletonModelURL)) {
|
if (_firstSkeletonCheck || (identity.skeletonModelURL != _skeletonModelURL)) {
|
||||||
setSkeletonModelURL(identity.skeletonModelURL);
|
setSkeletonModelURL(identity.skeletonModelURL);
|
||||||
hasIdentityChanged = true;
|
hasIdentityChanged = true;
|
||||||
|
@ -1021,12 +984,7 @@ QByteArray AvatarData::identityByteArray() {
|
||||||
QDataStream identityStream(&identityData, QIODevice::Append);
|
QDataStream identityStream(&identityData, QIODevice::Append);
|
||||||
QUrl emptyURL("");
|
QUrl emptyURL("");
|
||||||
const QUrl& urlToSend = _skeletonModelURL.scheme() == "file" ? emptyURL : _skeletonModelURL;
|
const QUrl& urlToSend = _skeletonModelURL.scheme() == "file" ? emptyURL : _skeletonModelURL;
|
||||||
|
|
||||||
#ifdef TRANSMIT_JOINT_INDICES_IN_IDENTITY_PACKET
|
|
||||||
identityStream << getSessionUUID() << urlToSend << _attachmentData << _displayName << _jointIndices;
|
|
||||||
#else
|
|
||||||
identityStream << getSessionUUID() << urlToSend << _attachmentData << _displayName;
|
identityStream << getSessionUUID() << urlToSend << _attachmentData << _displayName;
|
||||||
#endif
|
|
||||||
|
|
||||||
return identityData;
|
return identityData;
|
||||||
}
|
}
|
||||||
|
@ -1205,10 +1163,6 @@ void AvatarData::updateJointMappings() {
|
||||||
_jointIndices.clear();
|
_jointIndices.clear();
|
||||||
_jointNames.clear();
|
_jointNames.clear();
|
||||||
|
|
||||||
#ifdef TRANSMIT_JOINT_INDICES_IN_IDENTITY_PACKET
|
|
||||||
_networkJointIndexMap.clear();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (_skeletonModelURL.fileName().toLower().endsWith(".fst")) {
|
if (_skeletonModelURL.fileName().toLower().endsWith(".fst")) {
|
||||||
QNetworkAccessManager& networkAccessManager = NetworkAccessManager::getInstance();
|
QNetworkAccessManager& networkAccessManager = NetworkAccessManager::getInstance();
|
||||||
QNetworkRequest networkRequest = QNetworkRequest(_skeletonModelURL);
|
QNetworkRequest networkRequest = QNetworkRequest(_skeletonModelURL);
|
||||||
|
|
|
@ -128,8 +128,6 @@ enum KeyState {
|
||||||
DELETE_KEY_DOWN
|
DELETE_KEY_DOWN
|
||||||
};
|
};
|
||||||
|
|
||||||
#define TRANSMIT_JOINT_INDICES_IN_IDENTITY_PACKET
|
|
||||||
|
|
||||||
class QDataStream;
|
class QDataStream;
|
||||||
|
|
||||||
class AttachmentData;
|
class AttachmentData;
|
||||||
|
@ -287,9 +285,6 @@ public:
|
||||||
QUrl skeletonModelURL;
|
QUrl skeletonModelURL;
|
||||||
QVector<AttachmentData> attachmentData;
|
QVector<AttachmentData> attachmentData;
|
||||||
QString displayName;
|
QString displayName;
|
||||||
#ifdef TRANSMIT_JOINT_INDICES_IN_IDENTITY_PACKET
|
|
||||||
QHash<QString, int> jointIndices;
|
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static void parseAvatarIdentityPacket(const QByteArray& data, Identity& identityOut);
|
static void parseAvatarIdentityPacket(const QByteArray& data, Identity& identityOut);
|
||||||
|
@ -382,9 +377,6 @@ protected:
|
||||||
float _displayNameAlpha;
|
float _displayNameAlpha;
|
||||||
|
|
||||||
QHash<QString, int> _jointIndices; ///< 1-based, since zero is returned for missing keys
|
QHash<QString, int> _jointIndices; ///< 1-based, since zero is returned for missing keys
|
||||||
#ifdef TRANSMIT_JOINT_INDICES_IN_IDENTITY_PACKET
|
|
||||||
QVector<int> _networkJointIndexMap; // maps network joint indices to local model joint indices.
|
|
||||||
#endif
|
|
||||||
QStringList _jointNames; ///< in order of depth-first traversal
|
QStringList _jointNames; ///< in order of depth-first traversal
|
||||||
|
|
||||||
quint64 _errorLogExpiry; ///< time in future when to log an error
|
quint64 _errorLogExpiry; ///< time in future when to log an error
|
||||||
|
|
Loading…
Reference in a new issue