mirror of
https://github.com/overte-org/overte.git
synced 2025-08-11 00:53:17 +02:00
Removed pupilData and translationRadix from AvatarData packet.
This commit is contained in:
parent
eb80990c10
commit
0294066668
5 changed files with 18 additions and 47 deletions
|
@ -670,8 +670,6 @@ void MyAvatar::saveData() {
|
||||||
|
|
||||||
settings.setValue("headPitch", getHead()->getBasePitch());
|
settings.setValue("headPitch", getHead()->getBasePitch());
|
||||||
|
|
||||||
settings.setValue("pupilDilation", getHead()->getPupilDilation());
|
|
||||||
|
|
||||||
settings.setValue("leanScale", _leanScale);
|
settings.setValue("leanScale", _leanScale);
|
||||||
settings.setValue("scale", _targetScale);
|
settings.setValue("scale", _targetScale);
|
||||||
|
|
||||||
|
@ -778,8 +776,6 @@ void MyAvatar::loadData() {
|
||||||
|
|
||||||
getHead()->setBasePitch(loadSetting(settings, "headPitch", 0.0f));
|
getHead()->setBasePitch(loadSetting(settings, "headPitch", 0.0f));
|
||||||
|
|
||||||
getHead()->setPupilDilation(loadSetting(settings, "pupilDilation", 0.0f));
|
|
||||||
|
|
||||||
_leanScale = loadSetting(settings, "leanScale", 0.05f);
|
_leanScale = loadSetting(settings, "leanScale", 0.05f);
|
||||||
_targetScale = loadSetting(settings, "scale", 1.0f);
|
_targetScale = loadSetting(settings, "scale", 1.0f);
|
||||||
setScale(glm::vec3(_targetScale));
|
setScale(glm::vec3(_targetScale));
|
||||||
|
|
|
@ -144,11 +144,6 @@ void setupPreferences() {
|
||||||
preference->setStep(1);
|
preference->setStep(1);
|
||||||
preferences->addPreference(preference);
|
preferences->addPreference(preference);
|
||||||
}
|
}
|
||||||
{
|
|
||||||
auto getter = [=]()->float { return myAvatar->getHead()->getPupilDilation(); };
|
|
||||||
auto setter = [=](float value) { myAvatar->getHead()->setPupilDilation(value); };
|
|
||||||
preferences->addPreference(new SliderPreference(AVATAR_TUNING, "Pupil dilation", getter, setter));
|
|
||||||
}
|
|
||||||
{
|
{
|
||||||
auto getter = []()->float { return DependencyManager::get<DdeFaceTracker>()->getEyeClosingThreshold(); };
|
auto getter = []()->float { return DependencyManager::get<DdeFaceTracker>()->getEyeClosingThreshold(); };
|
||||||
auto setter = [](float value) { DependencyManager::get<DdeFaceTracker>()->setEyeClosingThreshold(value); };
|
auto setter = [](float value) { DependencyManager::get<DdeFaceTracker>()->setEyeClosingThreshold(value); };
|
||||||
|
|
|
@ -219,9 +219,6 @@ QByteArray AvatarData::toByteArray(bool cullSmallChanges, bool sendAll) {
|
||||||
destinationBuffer += _headData->_blendshapeCoefficients.size() * sizeof(float);
|
destinationBuffer += _headData->_blendshapeCoefficients.size() * sizeof(float);
|
||||||
}
|
}
|
||||||
|
|
||||||
// pupil dilation
|
|
||||||
destinationBuffer += packFloatToByte(destinationBuffer, _headData->_pupilDilation, 1.0f);
|
|
||||||
|
|
||||||
// joint rotation data
|
// joint rotation data
|
||||||
*destinationBuffer++ = _jointData.size();
|
*destinationBuffer++ = _jointData.size();
|
||||||
unsigned char* validityPosition = destinationBuffer;
|
unsigned char* validityPosition = destinationBuffer;
|
||||||
|
@ -306,15 +303,11 @@ QByteArray AvatarData::toByteArray(bool cullSmallChanges, bool sendAll) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (validityBit != 0) {
|
if (validityBit != 0) {
|
||||||
*destinationBuffer++ = validity;
|
*destinationBuffer++ = validity;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO -- automatically pick translationCompressionRadix
|
const int TRANSLATION_COMPRESSION_RADIX = 12;
|
||||||
int translationCompressionRadix = 12;
|
|
||||||
|
|
||||||
*destinationBuffer++ = translationCompressionRadix;
|
|
||||||
|
|
||||||
validityBit = 0;
|
validityBit = 0;
|
||||||
validity = *validityPosition++;
|
validity = *validityPosition++;
|
||||||
|
@ -322,7 +315,7 @@ QByteArray AvatarData::toByteArray(bool cullSmallChanges, bool sendAll) {
|
||||||
const JointData& data = _jointData[ i ];
|
const JointData& data = _jointData[ i ];
|
||||||
if (validity & (1 << validityBit)) {
|
if (validity & (1 << validityBit)) {
|
||||||
destinationBuffer +=
|
destinationBuffer +=
|
||||||
packFloatVec3ToSignedTwoByteFixed(destinationBuffer, data.translation, translationCompressionRadix);
|
packFloatVec3ToSignedTwoByteFixed(destinationBuffer, data.translation, TRANSLATION_COMPRESSION_RADIX);
|
||||||
}
|
}
|
||||||
if (++validityBit == BITS_IN_BYTE) {
|
if (++validityBit == BITS_IN_BYTE) {
|
||||||
validityBit = 0;
|
validityBit = 0;
|
||||||
|
@ -335,7 +328,6 @@ QByteArray AvatarData::toByteArray(bool cullSmallChanges, bool sendAll) {
|
||||||
qDebug() << "AvatarData::toByteArray" << cullSmallChanges << sendAll
|
qDebug() << "AvatarData::toByteArray" << cullSmallChanges << sendAll
|
||||||
<< "rotations:" << rotationSentCount << "translations:" << translationSentCount
|
<< "rotations:" << rotationSentCount << "translations:" << translationSentCount
|
||||||
<< "largest:" << maxTranslationDimension
|
<< "largest:" << maxTranslationDimension
|
||||||
<< "radix:" << translationCompressionRadix
|
|
||||||
<< "size:"
|
<< "size:"
|
||||||
<< (beforeRotations - startPosition) << "+"
|
<< (beforeRotations - startPosition) << "+"
|
||||||
<< (beforeTranslations - beforeRotations) << "+"
|
<< (beforeTranslations - beforeRotations) << "+"
|
||||||
|
@ -408,7 +400,6 @@ int AvatarData::parseDataFromBuffer(const QByteArray& buffer) {
|
||||||
// audioLoudness = 4
|
// audioLoudness = 4
|
||||||
// }
|
// }
|
||||||
// + 1 byte for varying data
|
// + 1 byte for varying data
|
||||||
// + 1 byte for pupilSize
|
|
||||||
// + 1 byte for numJoints (0)
|
// + 1 byte for numJoints (0)
|
||||||
// = 39 bytes
|
// = 39 bytes
|
||||||
int minPossibleSize = 39;
|
int minPossibleSize = 39;
|
||||||
|
@ -598,11 +589,6 @@ int AvatarData::parseDataFromBuffer(const QByteArray& buffer) {
|
||||||
}
|
}
|
||||||
} // 1 + bitItemsDataSize bytes
|
} // 1 + bitItemsDataSize bytes
|
||||||
|
|
||||||
{ // pupil dilation
|
|
||||||
sourceBuffer += unpackFloatFromByte(sourceBuffer, _headData->_pupilDilation, 1.0f);
|
|
||||||
} // 1 byte
|
|
||||||
|
|
||||||
|
|
||||||
// joint rotations
|
// joint rotations
|
||||||
int numJoints = *sourceBuffer++;
|
int numJoints = *sourceBuffer++;
|
||||||
|
|
||||||
|
@ -650,6 +636,7 @@ int AvatarData::parseDataFromBuffer(const QByteArray& buffer) {
|
||||||
} // 1 + bytesOfValidity bytes
|
} // 1 + bytesOfValidity bytes
|
||||||
|
|
||||||
// each joint rotation is stored in 6 bytes.
|
// each joint rotation is stored in 6 bytes.
|
||||||
|
|
||||||
const size_t COMPRESSED_QUATERNION_SIZE = 6;
|
const size_t COMPRESSED_QUATERNION_SIZE = 6;
|
||||||
minPossibleSize += numValidJointRotations * COMPRESSED_QUATERNION_SIZE;
|
minPossibleSize += numValidJointRotations * COMPRESSED_QUATERNION_SIZE;
|
||||||
if (minPossibleSize > maxAvailableSize) {
|
if (minPossibleSize > maxAvailableSize) {
|
||||||
|
@ -699,9 +686,9 @@ int AvatarData::parseDataFromBuffer(const QByteArray& buffer) {
|
||||||
}
|
}
|
||||||
} // 1 + bytesOfValidity bytes
|
} // 1 + bytesOfValidity bytes
|
||||||
|
|
||||||
// each joint translation component is stored in 6 bytes. 1 byte for translationCompressionRadix
|
// each joint translation component is stored in 6 bytes.
|
||||||
const size_t COMPRESSED_TRANSLATION_SIZE = 6;
|
const size_t COMPRESSED_TRANSLATION_SIZE = 6;
|
||||||
minPossibleSize += numValidJointTranslations * COMPRESSED_TRANSLATION_SIZE + 1;
|
minPossibleSize += numValidJointTranslations * COMPRESSED_TRANSLATION_SIZE;
|
||||||
if (minPossibleSize > maxAvailableSize) {
|
if (minPossibleSize > maxAvailableSize) {
|
||||||
if (shouldLogError(now)) {
|
if (shouldLogError(now)) {
|
||||||
qCDebug(avatars) << "Malformed AvatarData packet after JointData translation validity;"
|
qCDebug(avatars) << "Malformed AvatarData packet after JointData translation validity;"
|
||||||
|
@ -712,7 +699,7 @@ int AvatarData::parseDataFromBuffer(const QByteArray& buffer) {
|
||||||
return maxAvailableSize;
|
return maxAvailableSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
int translationCompressionRadix = *sourceBuffer++;
|
const int TRANSLATION_COMPRESSION_RADIX = 12;
|
||||||
|
|
||||||
{ // joint data
|
{ // joint data
|
||||||
for (int i = 0; i < numJoints; i++) {
|
for (int i = 0; i < numJoints; i++) {
|
||||||
|
@ -721,7 +708,7 @@ int AvatarData::parseDataFromBuffer(const QByteArray& buffer) {
|
||||||
if (skipJoints) {
|
if (skipJoints) {
|
||||||
sourceBuffer += COMPRESSED_TRANSLATION_SIZE;
|
sourceBuffer += COMPRESSED_TRANSLATION_SIZE;
|
||||||
} else {
|
} else {
|
||||||
sourceBuffer += unpackFloatVec3FromSignedTwoByteFixed(sourceBuffer, data.translation, translationCompressionRadix);
|
sourceBuffer += unpackFloatVec3FromSignedTwoByteFixed(sourceBuffer, data.translation, TRANSLATION_COMPRESSION_RADIX);
|
||||||
_hasNewJointTranslations = true;
|
_hasNewJointTranslations = true;
|
||||||
data.translationSet = true;
|
data.translationSet = true;
|
||||||
}
|
}
|
||||||
|
@ -733,7 +720,6 @@ int AvatarData::parseDataFromBuffer(const QByteArray& buffer) {
|
||||||
if (numValidJointRotations > 15) {
|
if (numValidJointRotations > 15) {
|
||||||
qDebug() << "RECEIVING -- rotations:" << numValidJointRotations
|
qDebug() << "RECEIVING -- rotations:" << numValidJointRotations
|
||||||
<< "translations:" << numValidJointTranslations
|
<< "translations:" << numValidJointTranslations
|
||||||
<< "radix:" << translationCompressionRadix
|
|
||||||
<< "size:" << (int)(sourceBuffer - startPosition);
|
<< "size:" << (int)(sourceBuffer - startPosition);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -43,10 +43,9 @@ HeadData::HeadData(AvatarData* owningAvatar) :
|
||||||
_averageLoudness(0.0f),
|
_averageLoudness(0.0f),
|
||||||
_browAudioLift(0.0f),
|
_browAudioLift(0.0f),
|
||||||
_audioAverageLoudness(0.0f),
|
_audioAverageLoudness(0.0f),
|
||||||
_pupilDilation(0.0f),
|
|
||||||
_owningAvatar(owningAvatar)
|
_owningAvatar(owningAvatar)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
glm::quat HeadData::getRawOrientation() const {
|
glm::quat HeadData::getRawOrientation() const {
|
||||||
|
@ -72,7 +71,7 @@ void HeadData::setOrientation(const glm::quat& orientation) {
|
||||||
glm::vec3 newFront = glm::inverse(bodyOrientation) * (orientation * IDENTITY_FRONT);
|
glm::vec3 newFront = glm::inverse(bodyOrientation) * (orientation * IDENTITY_FRONT);
|
||||||
bodyOrientation = bodyOrientation * glm::angleAxis(atan2f(-newFront.x, -newFront.z), glm::vec3(0.0f, 1.0f, 0.0f));
|
bodyOrientation = bodyOrientation * glm::angleAxis(atan2f(-newFront.x, -newFront.z), glm::vec3(0.0f, 1.0f, 0.0f));
|
||||||
_owningAvatar->setOrientation(bodyOrientation);
|
_owningAvatar->setOrientation(bodyOrientation);
|
||||||
|
|
||||||
// the rest goes to the head
|
// the rest goes to the head
|
||||||
glm::vec3 eulers = glm::degrees(safeEulerAngles(glm::inverse(bodyOrientation) * orientation));
|
glm::vec3 eulers = glm::degrees(safeEulerAngles(glm::inverse(bodyOrientation) * orientation));
|
||||||
_basePitch = eulers.x;
|
_basePitch = eulers.x;
|
||||||
|
@ -186,4 +185,3 @@ void HeadData::fromJson(const QJsonObject& json) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,7 @@ class HeadData {
|
||||||
public:
|
public:
|
||||||
explicit HeadData(AvatarData* owningAvatar);
|
explicit HeadData(AvatarData* owningAvatar);
|
||||||
virtual ~HeadData() { };
|
virtual ~HeadData() { };
|
||||||
|
|
||||||
// degrees
|
// degrees
|
||||||
float getBaseYaw() const { return _baseYaw; }
|
float getBaseYaw() const { return _baseYaw; }
|
||||||
void setBaseYaw(float yaw) { _baseYaw = glm::clamp(yaw, MIN_HEAD_YAW, MAX_HEAD_YAW); }
|
void setBaseYaw(float yaw) { _baseYaw = glm::clamp(yaw, MIN_HEAD_YAW, MAX_HEAD_YAW); }
|
||||||
|
@ -42,7 +42,7 @@ public:
|
||||||
void setBasePitch(float pitch) { _basePitch = glm::clamp(pitch, MIN_HEAD_PITCH, MAX_HEAD_PITCH); }
|
void setBasePitch(float pitch) { _basePitch = glm::clamp(pitch, MIN_HEAD_PITCH, MAX_HEAD_PITCH); }
|
||||||
float getBaseRoll() const { return _baseRoll; }
|
float getBaseRoll() const { return _baseRoll; }
|
||||||
void setBaseRoll(float roll) { _baseRoll = glm::clamp(roll, MIN_HEAD_ROLL, MAX_HEAD_ROLL); }
|
void setBaseRoll(float roll) { _baseRoll = glm::clamp(roll, MIN_HEAD_ROLL, MAX_HEAD_ROLL); }
|
||||||
|
|
||||||
virtual void setFinalYaw(float finalYaw) { _baseYaw = finalYaw; }
|
virtual void setFinalYaw(float finalYaw) { _baseYaw = finalYaw; }
|
||||||
virtual void setFinalPitch(float finalPitch) { _basePitch = finalPitch; }
|
virtual void setFinalPitch(float finalPitch) { _basePitch = finalPitch; }
|
||||||
virtual void setFinalRoll(float finalRoll) { _baseRoll = finalRoll; }
|
virtual void setFinalRoll(float finalRoll) { _baseRoll = finalRoll; }
|
||||||
|
@ -64,26 +64,23 @@ public:
|
||||||
void setBlendshape(QString name, float val);
|
void setBlendshape(QString name, float val);
|
||||||
const QVector<float>& getBlendshapeCoefficients() const { return _blendshapeCoefficients; }
|
const QVector<float>& getBlendshapeCoefficients() const { return _blendshapeCoefficients; }
|
||||||
void setBlendshapeCoefficients(const QVector<float>& blendshapeCoefficients) { _blendshapeCoefficients = blendshapeCoefficients; }
|
void setBlendshapeCoefficients(const QVector<float>& blendshapeCoefficients) { _blendshapeCoefficients = blendshapeCoefficients; }
|
||||||
|
|
||||||
float getPupilDilation() const { return _pupilDilation; }
|
|
||||||
void setPupilDilation(float pupilDilation) { _pupilDilation = pupilDilation; }
|
|
||||||
|
|
||||||
const glm::vec3& getLookAtPosition() const { return _lookAtPosition; }
|
const glm::vec3& getLookAtPosition() const { return _lookAtPosition; }
|
||||||
void setLookAtPosition(const glm::vec3& lookAtPosition) { _lookAtPosition = lookAtPosition; }
|
void setLookAtPosition(const glm::vec3& lookAtPosition) { _lookAtPosition = lookAtPosition; }
|
||||||
|
|
||||||
|
|
||||||
float getLeanSideways() const { return _leanSideways; }
|
float getLeanSideways() const { return _leanSideways; }
|
||||||
float getLeanForward() const { return _leanForward; }
|
float getLeanForward() const { return _leanForward; }
|
||||||
float getTorsoTwist() const { return _torsoTwist; }
|
float getTorsoTwist() const { return _torsoTwist; }
|
||||||
virtual float getFinalLeanSideways() const { return _leanSideways; }
|
virtual float getFinalLeanSideways() const { return _leanSideways; }
|
||||||
virtual float getFinalLeanForward() const { return _leanForward; }
|
virtual float getFinalLeanForward() const { return _leanForward; }
|
||||||
|
|
||||||
void setLeanSideways(float leanSideways) { _leanSideways = leanSideways; }
|
void setLeanSideways(float leanSideways) { _leanSideways = leanSideways; }
|
||||||
void setLeanForward(float leanForward) { _leanForward = leanForward; }
|
void setLeanForward(float leanForward) { _leanForward = leanForward; }
|
||||||
void setTorsoTwist(float torsoTwist) { _torsoTwist = torsoTwist; }
|
void setTorsoTwist(float torsoTwist) { _torsoTwist = torsoTwist; }
|
||||||
|
|
||||||
friend class AvatarData;
|
friend class AvatarData;
|
||||||
|
|
||||||
QJsonObject toJson() const;
|
QJsonObject toJson() const;
|
||||||
void fromJson(const QJsonObject& json);
|
void fromJson(const QJsonObject& json);
|
||||||
|
|
||||||
|
@ -106,9 +103,8 @@ protected:
|
||||||
float _browAudioLift;
|
float _browAudioLift;
|
||||||
float _audioAverageLoudness;
|
float _audioAverageLoudness;
|
||||||
QVector<float> _blendshapeCoefficients;
|
QVector<float> _blendshapeCoefficients;
|
||||||
float _pupilDilation;
|
|
||||||
AvatarData* _owningAvatar;
|
AvatarData* _owningAvatar;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// privatize copy ctor and assignment operator so copies of this object cannot be made
|
// privatize copy ctor and assignment operator so copies of this object cannot be made
|
||||||
HeadData(const HeadData&);
|
HeadData(const HeadData&);
|
||||||
|
|
Loading…
Reference in a new issue