Send Spherical using Angl8 and Float16

This commit is contained in:
Pascal Serrarens 2024-05-27 17:32:37 +02:00
parent dc1abb2997
commit 57f7f56d26
3 changed files with 12 additions and 10 deletions

View File

@ -83,11 +83,12 @@ void NetworkSync::SendPolar(unsigned char *data, unsigned char *startIndex,
SendSingle100(data, (*startIndex) + 1, p.distance); SendSingle100(data, (*startIndex) + 1, p.distance);
} }
void NetworkSync::SendSpherical(unsigned char *data, int startIndex, void NetworkSync::SendSpherical(unsigned char *data, unsigned char *startIndex,
Spherical s) { Spherical s) {
SendAngle8(data, startIndex++, s.horizontalAngle); SendAngle8(data, (*startIndex)++, s.horizontalAngle);
SendAngle8(data, startIndex++, s.verticalAngle); SendAngle8(data, (*startIndex)++, s.verticalAngle);
SendAngle8(data, startIndex++, s.distance); // SendAngle8(data, startIndex++, s.distance);
SendFloat16(data, startIndex, s.distance);
} }
// void NetworkSync::SendSpherical16(unsigned char *data, int startIndex, // void NetworkSync::SendSpherical16(unsigned char *data, int startIndex,
@ -164,8 +165,8 @@ void NetworkSync::SendFloat16(unsigned char *data, unsigned char *startIndex,
float16 value16 = float16(value); float16 value16 = float16(value);
short binary = value16.getBinary(); short binary = value16.getBinary();
data[(*startIndex)++] = (binary >> 8) & 0x0F; data[(*startIndex)++] = (binary >> 8) & 0xFF;
data[(*startIndex)++] = binary & 0x0F; data[(*startIndex)++] = binary & 0xFF;
} }
void NetworkSync::SendInt32(unsigned char *data, unsigned int startIndex, void NetworkSync::SendInt32(unsigned char *data, unsigned int startIndex,
@ -245,8 +246,8 @@ void NetworkSync::PublishRelativeObject(Buffer sendBuffer, UInt8 parentId,
(UInt8)object->id, (UInt8)object->id,
Pose_Position, Pose_Position,
}; };
unsigned int ix = 4; unsigned char ix = 4;
SendSpherical(buffer, ix, object->position); SendSpherical(buffer, &ix, object->position);
// SendVector3(buffer, ix, worldPosition3); // SendVector3(buffer, ix, worldPosition3);
sendBuffer(buffer, bufferSize); sendBuffer(buffer, bufferSize);
} }

View File

@ -91,7 +91,8 @@ protected:
const Quaternion q); const Quaternion q);
void SendPolar(unsigned char *data, unsigned char *startIndex, Polar p); void SendPolar(unsigned char *data, unsigned char *startIndex, Polar p);
void SendSpherical(unsigned char *data, int startIndex, Spherical s); void SendSpherical(unsigned char *data, unsigned char *startIndex,
Spherical s);
// void SendSpherical16(unsigned char *data, int startIndex, Spherical s); // void SendSpherical16(unsigned char *data, int startIndex, Spherical s);
// void SendSpherical32(unsigned char *data, int startIndex, Spherical s); // void SendSpherical32(unsigned char *data, int startIndex, Spherical s);
void SendQuat32(unsigned char *data, unsigned char *startIndex, void SendQuat32(unsigned char *data, unsigned char *startIndex,

@ -1 +1 @@
Subproject commit 51cffc3ae3da69212ef290a7ad6ed1c747ffa6ab Subproject commit 7fce85b7b021693d531fd59d122d90e4500a9371