mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 12:17:45 +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++) {
|
for (int index = 0; index < value.size(); index++) {
|
||||||
destinationBuffer += packOrientationQuatToBytes(destinationBuffer, value[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;
|
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) {
|
int OctreePacketData::unpackDataFromBytes(const unsigned char *dataBytes, QVector<glm::quat>& result) {
|
||||||
uint16_t length;
|
uint16_t length;
|
||||||
const unsigned char *start = dataBytes;
|
|
||||||
memcpy(&length, dataBytes, sizeof(uint16_t));
|
memcpy(&length, dataBytes, sizeof(uint16_t));
|
||||||
dataBytes += sizeof(length);
|
dataBytes += sizeof(length);
|
||||||
result.resize(length);
|
result.resize(length);
|
||||||
|
|
||||||
|
const unsigned char *start = dataBytes;
|
||||||
for (int i = 0; i < length; i++) {
|
for (int i = 0; i < length; i++) {
|
||||||
dataBytes += unpackOrientationQuatFromBytes(dataBytes, result[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) {
|
int OctreePacketData::unpackDataFromBytes(const unsigned char* dataBytes, QVector<float>& result) {
|
||||||
|
|
Loading…
Reference in a new issue