Updating the legacy file format to support the joint translation and also fix the replay problem oof the joints going to the moon

This commit is contained in:
samcake 2015-11-06 16:24:19 -08:00
parent 703a6bdb95
commit 4dbca68767
2 changed files with 25 additions and 8 deletions

View file

@ -100,13 +100,15 @@ void Recorder::record() {
const RecordingContext& context = _recording->getContext();
RecordingFrame frame;
frame.setBlendshapeCoefficients(_avatar->getHeadData()->getBlendshapeCoefficients());
frame.setJointRotations(_avatar->getJointRotations());
frame.setJointTranslations(_avatar->getJointTranslations());
// FIXME: here we need to make sure the correct joint data on the AvatarData to get correct play back.
// This should be fixed by a fix coming from Howard soon
frame.setJointRotations(_avatar->::AvatarData::getJointRotations());
frame.setJointTranslations(_avatar->::AvatarData::getJointTranslations());
frame.setTranslation(context.orientationInv * (_avatar->getPosition() - context.position));
frame.setRotation(context.orientationInv * _avatar->getOrientation());
frame.setScale(_avatar->getTargetScale() / context.scale);
const HeadData* head = _avatar->getHeadData();
if (head) {
glm::vec3 rotationDegrees = glm::vec3(head->getFinalPitch(),

View file

@ -239,12 +239,21 @@ void writeRecordingToFile(RecordingPointer recording, const QString& filename) {
if (i == 0 ||
frame._jointRotations[j] != previousFrame._jointRotations[j]) {
writeQuat(stream, frame._jointRotations[j]);
// TODO -- handle translations
mask.setBit(maskIndex);
}
maskIndex++;
}
// Joint Translations
for (quint32 j = 0; j < numJoints; ++j) {
if (i == 0 ||
frame._jointTranslations[j] != previousFrame._jointTranslations[j]) {
writeVec3(stream, frame._jointTranslations[j]);
mask.setBit(maskIndex);
}
maskIndex++;
}
// Translation
if (i == 0) {
mask.resize(mask.size() + 1);
@ -563,8 +572,14 @@ RecordingPointer readRecordingFromFile(RecordingPointer recording, const QString
}
}
// TODO -- handle translations
// Joint Translations
frame._jointTranslations.resize(numJoints);
for (quint32 j = 0; j < numJoints; ++j) {
if (!mask[maskIndex++] || !readVec3(stream, frame._jointTranslations[j])) {
frame._jointTranslations[j] = previousFrame._jointTranslations[j];
}
}
if (!mask[maskIndex++] || !readVec3(stream, frame._translation)) {
frame._translation = previousFrame._translation;
}