mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-10 01:06:25 +02:00
trying to debug
This commit is contained in:
parent
dc9121433d
commit
59b785a33b
4 changed files with 23 additions and 13 deletions
|
@ -163,7 +163,6 @@ void Rig::destroyAnimGraph() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Rig::initJointStates(const FBXGeometry& geometry, const glm::mat4& modelOffset) {
|
void Rig::initJointStates(const FBXGeometry& geometry, const glm::mat4& modelOffset) {
|
||||||
|
|
||||||
_geometryOffset = AnimPose(geometry.offset);
|
_geometryOffset = AnimPose(geometry.offset);
|
||||||
_invGeometryOffset = _geometryOffset.inverse();
|
_invGeometryOffset = _geometryOffset.inverse();
|
||||||
setModelOffset(modelOffset);
|
setModelOffset(modelOffset);
|
||||||
|
@ -1224,8 +1223,7 @@ void Rig::copyJointsIntoJointData(QVector<JointData>& jointDataVec) const {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Rig::copyJointsFromJointData(const QVector<JointData>& jointDataVec) {
|
void Rig::copyJointsFromJointData(const QVector<JointData>& jointDataVec) {
|
||||||
|
if (_animSkeleton && jointDataVec.size() == _internalPoseSet._overrideFlags.size()) {
|
||||||
if (_animSkeleton) {
|
|
||||||
|
|
||||||
// transform all the default poses into rig space.
|
// transform all the default poses into rig space.
|
||||||
const AnimPose geometryToRigPose(_geometryToRigTransform);
|
const AnimPose geometryToRigPose(_geometryToRigTransform);
|
||||||
|
|
|
@ -261,7 +261,7 @@ QByteArray AvatarData::toByteArray(bool cullSmallChanges, bool sendAll) {
|
||||||
unsigned char validity = 0;
|
unsigned char validity = 0;
|
||||||
int validityBit = 0;
|
int validityBit = 0;
|
||||||
|
|
||||||
#ifdef WANT_DEBUG
|
#if 1
|
||||||
int rotationSentCount = 0;
|
int rotationSentCount = 0;
|
||||||
unsigned char* beforeRotations = destinationBuffer;
|
unsigned char* beforeRotations = destinationBuffer;
|
||||||
#endif
|
#endif
|
||||||
|
@ -276,7 +276,7 @@ QByteArray AvatarData::toByteArray(bool cullSmallChanges, bool sendAll) {
|
||||||
fabsf(glm::dot(data.rotation, _lastSentJointData[i].rotation)) <= AVATAR_MIN_ROTATION_DOT) {
|
fabsf(glm::dot(data.rotation, _lastSentJointData[i].rotation)) <= AVATAR_MIN_ROTATION_DOT) {
|
||||||
if (data.rotationSet) {
|
if (data.rotationSet) {
|
||||||
validity |= (1 << validityBit);
|
validity |= (1 << validityBit);
|
||||||
#ifdef WANT_DEBUG
|
#if 1
|
||||||
rotationSentCount++;
|
rotationSentCount++;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -310,7 +310,7 @@ QByteArray AvatarData::toByteArray(bool cullSmallChanges, bool sendAll) {
|
||||||
validity = 0;
|
validity = 0;
|
||||||
validityBit = 0;
|
validityBit = 0;
|
||||||
|
|
||||||
#ifdef WANT_DEBUG
|
#if 1
|
||||||
int translationSentCount = 0;
|
int translationSentCount = 0;
|
||||||
unsigned char* beforeTranslations = destinationBuffer;
|
unsigned char* beforeTranslations = destinationBuffer;
|
||||||
#endif
|
#endif
|
||||||
|
@ -324,7 +324,7 @@ QByteArray AvatarData::toByteArray(bool cullSmallChanges, bool sendAll) {
|
||||||
glm::distance(data.translation, _lastSentJointData[i].translation) > AVATAR_MIN_TRANSLATION) {
|
glm::distance(data.translation, _lastSentJointData[i].translation) > AVATAR_MIN_TRANSLATION) {
|
||||||
if (data.translationSet) {
|
if (data.translationSet) {
|
||||||
validity |= (1 << validityBit);
|
validity |= (1 << validityBit);
|
||||||
#ifdef WANT_DEBUG
|
#if 1
|
||||||
translationSentCount++;
|
translationSentCount++;
|
||||||
#endif
|
#endif
|
||||||
maxTranslationDimension = glm::max(fabsf(data.translation.x), maxTranslationDimension);
|
maxTranslationDimension = glm::max(fabsf(data.translation.x), maxTranslationDimension);
|
||||||
|
@ -359,7 +359,7 @@ QByteArray AvatarData::toByteArray(bool cullSmallChanges, bool sendAll) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef WANT_DEBUG
|
#if 1
|
||||||
if (sendAll) {
|
if (sendAll) {
|
||||||
qDebug() << "AvatarData::toByteArray" << cullSmallChanges << sendAll
|
qDebug() << "AvatarData::toByteArray" << cullSmallChanges << sendAll
|
||||||
<< "rotations:" << rotationSentCount << "translations:" << translationSentCount
|
<< "rotations:" << rotationSentCount << "translations:" << translationSentCount
|
||||||
|
@ -584,6 +584,9 @@ int AvatarData::parseDataFromBuffer(const QByteArray& buffer) {
|
||||||
sourceBuffer += unpackOrientationQuatFromSixBytes(sourceBuffer, data.rotation);
|
sourceBuffer += unpackOrientationQuatFromSixBytes(sourceBuffer, data.rotation);
|
||||||
_hasNewJointRotations = true;
|
_hasNewJointRotations = true;
|
||||||
data.rotationSet = true;
|
data.rotationSet = true;
|
||||||
|
} else if (numValidJointRotations == numJoints) {
|
||||||
|
_hasNewJointRotations = true;
|
||||||
|
data.rotationSet = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -620,10 +623,13 @@ int AvatarData::parseDataFromBuffer(const QByteArray& buffer) {
|
||||||
sourceBuffer += unpackFloatVec3FromSignedTwoByteFixed(sourceBuffer, data.translation, TRANSLATION_COMPRESSION_RADIX);
|
sourceBuffer += unpackFloatVec3FromSignedTwoByteFixed(sourceBuffer, data.translation, TRANSLATION_COMPRESSION_RADIX);
|
||||||
_hasNewJointTranslations = true;
|
_hasNewJointTranslations = true;
|
||||||
data.translationSet = true;
|
data.translationSet = true;
|
||||||
|
} else if (numValidJointRotations == numJoints) {
|
||||||
|
_hasNewJointTranslations = true;
|
||||||
|
data.translationSet = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef WANT_DEBUG
|
#if 1
|
||||||
if (numValidJointRotations > 15) {
|
if (numValidJointRotations > 15) {
|
||||||
qDebug() << "RECEIVING -- rotations:" << numValidJointRotations
|
qDebug() << "RECEIVING -- rotations:" << numValidJointRotations
|
||||||
<< "translations:" << numValidJointTranslations
|
<< "translations:" << numValidJointTranslations
|
||||||
|
@ -1052,17 +1058,20 @@ void AvatarData::setJointMappingsFromNetworkReply() {
|
||||||
_jointIndices.insert(_jointNames.at(i), i + 1);
|
_jointIndices.insert(_jointNames.at(i), i + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
sendIdentityPacket();
|
//sendIdentityPacket();
|
||||||
|
//sendAvatarDataPacket(true);
|
||||||
|
qDebug() << "set joint mapping froms network reply, num joints: " << _jointIndices.size();
|
||||||
|
|
||||||
networkReply->deleteLater();
|
networkReply->deleteLater();
|
||||||
}
|
}
|
||||||
|
|
||||||
void AvatarData::sendAvatarDataPacket() {
|
void AvatarData::sendAvatarDataPacket(bool sendFull) {
|
||||||
auto nodeList = DependencyManager::get<NodeList>();
|
auto nodeList = DependencyManager::get<NodeList>();
|
||||||
|
|
||||||
// about 2% of the time, we send a full update (meaning, we transmit all the joint data), even if nothing has changed.
|
// about 2% of the time, we send a full update (meaning, we transmit all the joint data), even if nothing has changed.
|
||||||
// this is to guard against a joint moving once, the packet getting lost, and the joint never moving again.
|
// this is to guard against a joint moving once, the packet getting lost, and the joint never moving again.
|
||||||
bool sendFullUpdate = randFloat() < AVATAR_SEND_FULL_UPDATE_RATIO;
|
bool sendFullUpdate = sendFull || (randFloat() < AVATAR_SEND_FULL_UPDATE_RATIO);
|
||||||
|
if (sendFullUpdate) qDebug() << sendFullUpdate;
|
||||||
QByteArray avatarByteArray = toByteArray(true, sendFullUpdate);
|
QByteArray avatarByteArray = toByteArray(true, sendFullUpdate);
|
||||||
doneEncoding(true);
|
doneEncoding(true);
|
||||||
|
|
||||||
|
|
|
@ -352,7 +352,7 @@ public:
|
||||||
AvatarEntityIDs getAndClearRecentlyDetachedIDs();
|
AvatarEntityIDs getAndClearRecentlyDetachedIDs();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void sendAvatarDataPacket();
|
void sendAvatarDataPacket(bool sendFull = false);
|
||||||
void sendIdentityPacket();
|
void sendIdentityPacket();
|
||||||
|
|
||||||
void setJointMappingsFromNetworkReply();
|
void setJointMappingsFromNetworkReply();
|
||||||
|
|
|
@ -254,6 +254,7 @@ 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();
|
||||||
|
@ -817,7 +818,9 @@ 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