mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 14:08:51 +02:00
reinstate old HandData parsing
This commit is contained in:
parent
4ed748752f
commit
4bf8f3a465
1 changed files with 12 additions and 31 deletions
|
@ -162,8 +162,9 @@ int HandData::encodeRemoteData(unsigned char* destinationBuffer) {
|
||||||
int HandData::decodeRemoteData(const QByteArray& dataByteArray) {
|
int HandData::decodeRemoteData(const QByteArray& dataByteArray) {
|
||||||
QDataStream packetStream(dataByteArray);
|
QDataStream packetStream(dataByteArray);
|
||||||
|
|
||||||
quint8 numHands;
|
const unsigned char* startPosition;
|
||||||
packetStream >> numHands;
|
const unsigned char* sourceBuffer = startPosition = reinterpret_cast<const unsigned char*>(dataByteArray.data());
|
||||||
|
unsigned int numHands = *sourceBuffer++;
|
||||||
|
|
||||||
for (unsigned int handIndex = 0; handIndex < numHands; ++handIndex) {
|
for (unsigned int handIndex = 0; handIndex < numHands; ++handIndex) {
|
||||||
if (handIndex >= getNumPalms())
|
if (handIndex >= getNumPalms())
|
||||||
|
@ -172,18 +173,9 @@ int HandData::decodeRemoteData(const QByteArray& dataByteArray) {
|
||||||
|
|
||||||
glm::vec3 handPosition;
|
glm::vec3 handPosition;
|
||||||
glm::vec3 handNormal;
|
glm::vec3 handNormal;
|
||||||
qint16 twoByteHolder;
|
sourceBuffer += unpackFloatVec3FromSignedTwoByteFixed(sourceBuffer, handPosition, fingerVectorRadix);
|
||||||
|
sourceBuffer += unpackFloatVec3FromSignedTwoByteFixed(sourceBuffer, handNormal, fingerVectorRadix);
|
||||||
packetStream >> twoByteHolder;
|
unsigned int numFingers = *sourceBuffer++;
|
||||||
unpackFloatVec3FromSignedTwoByteFixed(reinterpret_cast<const unsigned char*>(&twoByteHolder),
|
|
||||||
handPosition, fingerVectorRadix);
|
|
||||||
|
|
||||||
packetStream >> twoByteHolder;
|
|
||||||
unpackFloatVec3FromSignedTwoByteFixed(reinterpret_cast<const unsigned char*>(&twoByteHolder),
|
|
||||||
handNormal, fingerVectorRadix);
|
|
||||||
|
|
||||||
quint8 numFingers;
|
|
||||||
packetStream >> numFingers;
|
|
||||||
|
|
||||||
palm.setRawPosition(handPosition);
|
palm.setRawPosition(handPosition);
|
||||||
palm.setRawNormal(handNormal);
|
palm.setRawNormal(handNormal);
|
||||||
|
@ -198,14 +190,8 @@ int HandData::decodeRemoteData(const QByteArray& dataByteArray) {
|
||||||
|
|
||||||
glm::vec3 tipPosition;
|
glm::vec3 tipPosition;
|
||||||
glm::vec3 rootPosition;
|
glm::vec3 rootPosition;
|
||||||
|
sourceBuffer += unpackFloatVec3FromSignedTwoByteFixed(sourceBuffer, tipPosition, fingerVectorRadix);
|
||||||
packetStream >> twoByteHolder;
|
sourceBuffer += unpackFloatVec3FromSignedTwoByteFixed(sourceBuffer, rootPosition, fingerVectorRadix);
|
||||||
unpackFloatVec3FromSignedTwoByteFixed(reinterpret_cast<const unsigned char*>(&twoByteHolder), tipPosition,
|
|
||||||
fingerVectorRadix);
|
|
||||||
|
|
||||||
packetStream >> twoByteHolder;
|
|
||||||
unpackFloatVec3FromSignedTwoByteFixed(reinterpret_cast<const unsigned char*>(&twoByteHolder), rootPosition,
|
|
||||||
fingerVectorRadix);
|
|
||||||
|
|
||||||
finger.setRawTipPosition(tipPosition);
|
finger.setRawTipPosition(tipPosition);
|
||||||
finger.setRawRootPosition(rootPosition);
|
finger.setRawRootPosition(rootPosition);
|
||||||
|
@ -225,14 +211,9 @@ int HandData::decodeRemoteData(const QByteArray& dataByteArray) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// One byte for error checking safety.
|
// One byte for error checking safety.
|
||||||
unsigned char requiredLength = packetStream.device()->pos();
|
unsigned char requiredLength = (unsigned char)(sourceBuffer - startPosition);
|
||||||
|
unsigned char checkLength = *sourceBuffer++;
|
||||||
unsigned char checkLength;
|
|
||||||
packetStream >> checkLength;
|
|
||||||
|
|
||||||
assert(checkLength == requiredLength);
|
assert(checkLength == requiredLength);
|
||||||
|
|
||||||
return packetStream.device()->pos();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void HandData::setFingerTrailLength(unsigned int length) {
|
void HandData::setFingerTrailLength(unsigned int length) {
|
||||||
|
|
Loading…
Reference in a new issue