mirror of
https://github.com/overte-org/overte.git
synced 2025-04-20 04:44:11 +02:00
fix quat (un)packing
This commit is contained in:
parent
69839b4b16
commit
0b9f92e50f
1 changed files with 8 additions and 3 deletions
|
@ -403,7 +403,12 @@ bool OctreePacketData::appendValue(const QVector<glm::quat>& value) {
|
|||
for (int index = 0; index < value.size(); index++) {
|
||||
destinationBuffer += packOrientationQuatToBytes(destinationBuffer, value[index]);
|
||||
}
|
||||
success = append(start, destinationBuffer - start);
|
||||
int quatsSize = destinationBuffer - start;
|
||||
success = append(start, quatsSize);
|
||||
if (success) {
|
||||
_bytesOfValues += quatsSize;
|
||||
_totalBytesOfValues += quatsSize;
|
||||
}
|
||||
}
|
||||
|
||||
return success;
|
||||
|
@ -653,16 +658,16 @@ int OctreePacketData::unpackDataFromBytes(const unsigned char *dataBytes, QVecto
|
|||
|
||||
int OctreePacketData::unpackDataFromBytes(const unsigned char *dataBytes, QVector<glm::quat>& result) {
|
||||
uint16_t length;
|
||||
const unsigned char *start = dataBytes;
|
||||
memcpy(&length, dataBytes, sizeof(uint16_t));
|
||||
dataBytes += sizeof(length);
|
||||
result.resize(length);
|
||||
|
||||
const unsigned char *start = dataBytes;
|
||||
for (int i = 0; i < length; i++) {
|
||||
dataBytes += unpackOrientationQuatFromBytes(dataBytes, result[i]);
|
||||
}
|
||||
|
||||
return dataBytes - start;
|
||||
return (dataBytes - start) + sizeof(uint16_t);
|
||||
}
|
||||
|
||||
int OctreePacketData::unpackDataFromBytes(const unsigned char* dataBytes, QVector<float>& result) {
|
||||
|
|
Loading…
Reference in a new issue