mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 22:51:20 +02:00
possible fix, needs testing
This commit is contained in:
parent
f02ffa92fd
commit
5f7e49b087
2 changed files with 8 additions and 20 deletions
|
@ -269,7 +269,7 @@ QByteArray AvatarData::toByteArray(bool cullSmallChanges, bool sendAll) {
|
||||||
_lastSentJointData.resize(_jointData.size());
|
_lastSentJointData.resize(_jointData.size());
|
||||||
|
|
||||||
for (int i=0; i < _jointData.size(); i++) {
|
for (int i=0; i < _jointData.size(); i++) {
|
||||||
const JointData& data = _jointData.at(i);
|
const JointData& data = _jointData[i];
|
||||||
if (sendAll || _lastSentJointData[i].rotation != data.rotation) {
|
if (sendAll || _lastSentJointData[i].rotation != data.rotation) {
|
||||||
if (sendAll ||
|
if (sendAll ||
|
||||||
!cullSmallChanges ||
|
!cullSmallChanges ||
|
||||||
|
@ -294,7 +294,7 @@ QByteArray AvatarData::toByteArray(bool cullSmallChanges, bool sendAll) {
|
||||||
validityBit = 0;
|
validityBit = 0;
|
||||||
validity = *validityPosition++;
|
validity = *validityPosition++;
|
||||||
for (int i = 0; i < _jointData.size(); i ++) {
|
for (int i = 0; i < _jointData.size(); i ++) {
|
||||||
const JointData& data = _jointData[ i ];
|
const JointData& data = _jointData[i];
|
||||||
if (validity & (1 << validityBit)) {
|
if (validity & (1 << validityBit)) {
|
||||||
destinationBuffer += packOrientationQuatToSixBytes(destinationBuffer, data.rotation);
|
destinationBuffer += packOrientationQuatToSixBytes(destinationBuffer, data.rotation);
|
||||||
}
|
}
|
||||||
|
@ -317,7 +317,7 @@ QByteArray AvatarData::toByteArray(bool cullSmallChanges, bool sendAll) {
|
||||||
|
|
||||||
float maxTranslationDimension = 0.0;
|
float maxTranslationDimension = 0.0;
|
||||||
for (int i=0; i < _jointData.size(); i++) {
|
for (int i=0; i < _jointData.size(); i++) {
|
||||||
const JointData& data = _jointData.at(i);
|
const JointData& data = _jointData[i];
|
||||||
if (sendAll || _lastSentJointData[i].translation != data.translation) {
|
if (sendAll || _lastSentJointData[i].translation != data.translation) {
|
||||||
if (sendAll ||
|
if (sendAll ||
|
||||||
!cullSmallChanges ||
|
!cullSmallChanges ||
|
||||||
|
@ -348,7 +348,7 @@ QByteArray AvatarData::toByteArray(bool cullSmallChanges, bool sendAll) {
|
||||||
validityBit = 0;
|
validityBit = 0;
|
||||||
validity = *validityPosition++;
|
validity = *validityPosition++;
|
||||||
for (int i = 0; i < _jointData.size(); i ++) {
|
for (int i = 0; i < _jointData.size(); i ++) {
|
||||||
const JointData& data = _jointData[ i ];
|
const JointData& data = _jointData[i];
|
||||||
if (validity & (1 << validityBit)) {
|
if (validity & (1 << validityBit)) {
|
||||||
destinationBuffer +=
|
destinationBuffer +=
|
||||||
packFloatVec3ToSignedTwoByteFixed(destinationBuffer, data.translation, TRANSLATION_COMPRESSION_RADIX);
|
packFloatVec3ToSignedTwoByteFixed(destinationBuffer, data.translation, TRANSLATION_COMPRESSION_RADIX);
|
||||||
|
@ -425,7 +425,6 @@ bool AvatarData::shouldLogError(const quint64& now) {
|
||||||
|
|
||||||
// read data in packet starting at byte offset and return number of bytes parsed
|
// read data in packet starting at byte offset and return number of bytes parsed
|
||||||
int AvatarData::parseDataFromBuffer(const QByteArray& buffer) {
|
int AvatarData::parseDataFromBuffer(const QByteArray& buffer) {
|
||||||
|
|
||||||
// lazily allocate memory for HeadData in case we're not an Avatar instance
|
// lazily allocate memory for HeadData in case we're not an Avatar instance
|
||||||
if (!_headData) {
|
if (!_headData) {
|
||||||
_headData = new HeadData(this);
|
_headData = new HeadData(this);
|
||||||
|
@ -575,14 +574,6 @@ int AvatarData::parseDataFromBuffer(const QByteArray& buffer) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// If all the rotations were sent, this is a full packet
|
|
||||||
bool fullPacket = numValidJointRotations == numJoints;
|
|
||||||
|
|
||||||
if (fullPacket) {
|
|
||||||
_hasNewJointRotations = true;
|
|
||||||
_hasNewJointTranslations = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// each joint rotation is stored in 6 bytes.
|
// each joint rotation is stored in 6 bytes.
|
||||||
const int COMPRESSED_QUATERNION_SIZE = 6;
|
const int COMPRESSED_QUATERNION_SIZE = 6;
|
||||||
PACKET_READ_CHECK(JointRotations, numValidJointRotations * COMPRESSED_QUATERNION_SIZE);
|
PACKET_READ_CHECK(JointRotations, numValidJointRotations * COMPRESSED_QUATERNION_SIZE);
|
||||||
|
@ -677,7 +668,9 @@ void AvatarData::setJointData(int index, const glm::quat& rotation, const glm::v
|
||||||
}
|
}
|
||||||
JointData& data = _jointData[index];
|
JointData& data = _jointData[index];
|
||||||
data.rotation = rotation;
|
data.rotation = rotation;
|
||||||
|
data.rotationSet = true;
|
||||||
data.translation = translation;
|
data.translation = translation;
|
||||||
|
data.translationSet = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AvatarData::clearJointData(int index) {
|
void AvatarData::clearJointData(int index) {
|
||||||
|
@ -782,6 +775,7 @@ void AvatarData::setJointRotation(int index, const glm::quat& rotation) {
|
||||||
}
|
}
|
||||||
JointData& data = _jointData[index];
|
JointData& data = _jointData[index];
|
||||||
data.rotation = rotation;
|
data.rotation = rotation;
|
||||||
|
data.rotationSet = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AvatarData::setJointTranslation(int index, const glm::vec3& translation) {
|
void AvatarData::setJointTranslation(int index, const glm::vec3& translation) {
|
||||||
|
@ -797,6 +791,7 @@ void AvatarData::setJointTranslation(int index, const glm::vec3& translation) {
|
||||||
}
|
}
|
||||||
JointData& data = _jointData[index];
|
JointData& data = _jointData[index];
|
||||||
data.translation = translation;
|
data.translation = translation;
|
||||||
|
data.translationSet = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AvatarData::clearJointData(const QString& name) {
|
void AvatarData::clearJointData(const QString& name) {
|
||||||
|
@ -866,7 +861,6 @@ void AvatarData::setJointTranslations(QVector<glm::vec3> jointTranslations) {
|
||||||
"setJointTranslations", Qt::BlockingQueuedConnection,
|
"setJointTranslations", Qt::BlockingQueuedConnection,
|
||||||
Q_ARG(QVector<glm::vec3>, jointTranslations));
|
Q_ARG(QVector<glm::vec3>, jointTranslations));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_jointData.size() < jointTranslations.size()) {
|
if (_jointData.size() < jointTranslations.size()) {
|
||||||
_jointData.resize(jointTranslations.size());
|
_jointData.resize(jointTranslations.size());
|
||||||
}
|
}
|
||||||
|
@ -1060,8 +1054,6 @@ void AvatarData::setJointMappingsFromNetworkReply() {
|
||||||
_jointIndices.insert(_jointNames.at(i), i + 1);
|
_jointIndices.insert(_jointNames.at(i), i + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
qDebug() << "set joint mapping froms network reply, num joints: " << _jointIndices.size();
|
|
||||||
|
|
||||||
networkReply->deleteLater();
|
networkReply->deleteLater();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1460,7 +1452,6 @@ void AvatarData::fromJson(const QJsonObject& json) {
|
||||||
auto joint = jointDataFromJsonValue(jointJson);
|
auto joint = jointDataFromJsonValue(jointJson);
|
||||||
jointArray.push_back(joint);
|
jointArray.push_back(joint);
|
||||||
setJointData(i, joint.rotation, joint.translation);
|
setJointData(i, joint.rotation, joint.translation);
|
||||||
_jointData[i].rotationSet = true; // Have to do that to broadcast the avatar new pose
|
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
setRawJointData(jointArray);
|
setRawJointData(jointArray);
|
||||||
|
|
|
@ -254,7 +254,6 @@ bool Model::updateGeometry() {
|
||||||
_needsReload = false;
|
_needsReload = false;
|
||||||
|
|
||||||
if (_rig->jointStatesEmpty() && getFBXGeometry().joints.size() > 0) {
|
if (_rig->jointStatesEmpty() && getFBXGeometry().joints.size() > 0) {
|
||||||
qDebug() << "initJointStates, num joints: " << getFBXGeometry().joints.size();
|
|
||||||
initJointStates();
|
initJointStates();
|
||||||
|
|
||||||
const FBXGeometry& fbxGeometry = getFBXGeometry();
|
const FBXGeometry& fbxGeometry = getFBXGeometry();
|
||||||
|
@ -818,9 +817,7 @@ void Model::setURL(const QUrl& url) {
|
||||||
invalidCalculatedMeshBoxes();
|
invalidCalculatedMeshBoxes();
|
||||||
deleteGeometry();
|
deleteGeometry();
|
||||||
|
|
||||||
if (_geometry && _geometry->getGeometry()) qDebug() << "geometry1: " << _geometry->getGeometry()->getGeometry().joints.size();
|
|
||||||
_geometry = DependencyManager::get<ModelCache>()->getGeometry(url);
|
_geometry = DependencyManager::get<ModelCache>()->getGeometry(url);
|
||||||
if (_geometry && _geometry->getGeometry()) qDebug() << "geometry2: " << _geometry->getGeometry()->getGeometry().joints.size();
|
|
||||||
onInvalidate();
|
onInvalidate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue