undo debugging

This commit is contained in:
SamGondelman 2016-06-15 18:00:08 -07:00
parent 59b785a33b
commit f02ffa92fd
2 changed files with 17 additions and 18 deletions

View file

@ -261,7 +261,7 @@ QByteArray AvatarData::toByteArray(bool cullSmallChanges, bool sendAll) {
unsigned char validity = 0;
int validityBit = 0;
#if 1
#ifdef WANT_DEBUG
int rotationSentCount = 0;
unsigned char* beforeRotations = destinationBuffer;
#endif
@ -276,7 +276,7 @@ QByteArray AvatarData::toByteArray(bool cullSmallChanges, bool sendAll) {
fabsf(glm::dot(data.rotation, _lastSentJointData[i].rotation)) <= AVATAR_MIN_ROTATION_DOT) {
if (data.rotationSet) {
validity |= (1 << validityBit);
#if 1
#ifdef WANT_DEBUG
rotationSentCount++;
#endif
}
@ -310,7 +310,7 @@ QByteArray AvatarData::toByteArray(bool cullSmallChanges, bool sendAll) {
validity = 0;
validityBit = 0;
#if 1
#ifdef WANT_DEBUG
int translationSentCount = 0;
unsigned char* beforeTranslations = destinationBuffer;
#endif
@ -324,7 +324,7 @@ QByteArray AvatarData::toByteArray(bool cullSmallChanges, bool sendAll) {
glm::distance(data.translation, _lastSentJointData[i].translation) > AVATAR_MIN_TRANSLATION) {
if (data.translationSet) {
validity |= (1 << validityBit);
#if 1
#ifdef WANT_DEBUG
translationSentCount++;
#endif
maxTranslationDimension = glm::max(fabsf(data.translation.x), maxTranslationDimension);
@ -359,7 +359,7 @@ QByteArray AvatarData::toByteArray(bool cullSmallChanges, bool sendAll) {
}
}
#if 1
#ifdef WANT_DEBUG
if (sendAll) {
qDebug() << "AvatarData::toByteArray" << cullSmallChanges << sendAll
<< "rotations:" << rotationSentCount << "translations:" << translationSentCount
@ -575,6 +575,14 @@ 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.
const int COMPRESSED_QUATERNION_SIZE = 6;
PACKET_READ_CHECK(JointRotations, numValidJointRotations * COMPRESSED_QUATERNION_SIZE);
@ -584,9 +592,6 @@ int AvatarData::parseDataFromBuffer(const QByteArray& buffer) {
sourceBuffer += unpackOrientationQuatFromSixBytes(sourceBuffer, data.rotation);
_hasNewJointRotations = true;
data.rotationSet = true;
} else if (numValidJointRotations == numJoints) {
_hasNewJointRotations = true;
data.rotationSet = false;
}
}
@ -623,13 +628,10 @@ int AvatarData::parseDataFromBuffer(const QByteArray& buffer) {
sourceBuffer += unpackFloatVec3FromSignedTwoByteFixed(sourceBuffer, data.translation, TRANSLATION_COMPRESSION_RADIX);
_hasNewJointTranslations = true;
data.translationSet = true;
} else if (numValidJointRotations == numJoints) {
_hasNewJointTranslations = true;
data.translationSet = false;
}
}
#if 1
#ifdef WANT_DEBUG
if (numValidJointRotations > 15) {
qDebug() << "RECEIVING -- rotations:" << numValidJointRotations
<< "translations:" << numValidJointTranslations
@ -1058,20 +1060,17 @@ void AvatarData::setJointMappingsFromNetworkReply() {
_jointIndices.insert(_jointNames.at(i), i + 1);
}
//sendIdentityPacket();
//sendAvatarDataPacket(true);
qDebug() << "set joint mapping froms network reply, num joints: " << _jointIndices.size();
networkReply->deleteLater();
}
void AvatarData::sendAvatarDataPacket(bool sendFull) {
void AvatarData::sendAvatarDataPacket() {
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.
// this is to guard against a joint moving once, the packet getting lost, and the joint never moving again.
bool sendFullUpdate = sendFull || (randFloat() < AVATAR_SEND_FULL_UPDATE_RATIO);
if (sendFullUpdate) qDebug() << sendFullUpdate;
bool sendFullUpdate = randFloat() < AVATAR_SEND_FULL_UPDATE_RATIO;
QByteArray avatarByteArray = toByteArray(true, sendFullUpdate);
doneEncoding(true);

View file

@ -352,7 +352,7 @@ public:
AvatarEntityIDs getAndClearRecentlyDetachedIDs();
public slots:
void sendAvatarDataPacket(bool sendFull = false);
void sendAvatarDataPacket();
void sendIdentityPacket();
void setJointMappingsFromNetworkReply();