mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 02:37:12 +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) {
|
||||
QDataStream packetStream(dataByteArray);
|
||||
|
||||
quint8 numHands;
|
||||
packetStream >> numHands;
|
||||
const unsigned char* startPosition;
|
||||
const unsigned char* sourceBuffer = startPosition = reinterpret_cast<const unsigned char*>(dataByteArray.data());
|
||||
unsigned int numHands = *sourceBuffer++;
|
||||
|
||||
for (unsigned int handIndex = 0; handIndex < numHands; ++handIndex) {
|
||||
if (handIndex >= getNumPalms())
|
||||
|
@ -172,18 +173,9 @@ int HandData::decodeRemoteData(const QByteArray& dataByteArray) {
|
|||
|
||||
glm::vec3 handPosition;
|
||||
glm::vec3 handNormal;
|
||||
qint16 twoByteHolder;
|
||||
|
||||
packetStream >> twoByteHolder;
|
||||
unpackFloatVec3FromSignedTwoByteFixed(reinterpret_cast<const unsigned char*>(&twoByteHolder),
|
||||
handPosition, fingerVectorRadix);
|
||||
|
||||
packetStream >> twoByteHolder;
|
||||
unpackFloatVec3FromSignedTwoByteFixed(reinterpret_cast<const unsigned char*>(&twoByteHolder),
|
||||
handNormal, fingerVectorRadix);
|
||||
|
||||
quint8 numFingers;
|
||||
packetStream >> numFingers;
|
||||
sourceBuffer += unpackFloatVec3FromSignedTwoByteFixed(sourceBuffer, handPosition, fingerVectorRadix);
|
||||
sourceBuffer += unpackFloatVec3FromSignedTwoByteFixed(sourceBuffer, handNormal, fingerVectorRadix);
|
||||
unsigned int numFingers = *sourceBuffer++;
|
||||
|
||||
palm.setRawPosition(handPosition);
|
||||
palm.setRawNormal(handNormal);
|
||||
|
@ -198,14 +190,8 @@ int HandData::decodeRemoteData(const QByteArray& dataByteArray) {
|
|||
|
||||
glm::vec3 tipPosition;
|
||||
glm::vec3 rootPosition;
|
||||
|
||||
packetStream >> twoByteHolder;
|
||||
unpackFloatVec3FromSignedTwoByteFixed(reinterpret_cast<const unsigned char*>(&twoByteHolder), tipPosition,
|
||||
fingerVectorRadix);
|
||||
|
||||
packetStream >> twoByteHolder;
|
||||
unpackFloatVec3FromSignedTwoByteFixed(reinterpret_cast<const unsigned char*>(&twoByteHolder), rootPosition,
|
||||
fingerVectorRadix);
|
||||
sourceBuffer += unpackFloatVec3FromSignedTwoByteFixed(sourceBuffer, tipPosition, fingerVectorRadix);
|
||||
sourceBuffer += unpackFloatVec3FromSignedTwoByteFixed(sourceBuffer, rootPosition, fingerVectorRadix);
|
||||
|
||||
finger.setRawTipPosition(tipPosition);
|
||||
finger.setRawRootPosition(rootPosition);
|
||||
|
@ -225,14 +211,9 @@ int HandData::decodeRemoteData(const QByteArray& dataByteArray) {
|
|||
}
|
||||
|
||||
// One byte for error checking safety.
|
||||
unsigned char requiredLength = packetStream.device()->pos();
|
||||
|
||||
unsigned char checkLength;
|
||||
packetStream >> checkLength;
|
||||
|
||||
unsigned char requiredLength = (unsigned char)(sourceBuffer - startPosition);
|
||||
unsigned char checkLength = *sourceBuffer++;
|
||||
assert(checkLength == requiredLength);
|
||||
|
||||
return packetStream.device()->pos();
|
||||
}
|
||||
|
||||
void HandData::setFingerTrailLength(unsigned int length) {
|
||||
|
|
Loading…
Reference in a new issue