diff --git a/NetworkSync.cpp b/NetworkSync.cpp index 68c5ee0..45eb409 100644 --- a/NetworkSync.cpp +++ b/NetworkSync.cpp @@ -83,11 +83,12 @@ void NetworkSync::SendPolar(unsigned char *data, unsigned char *startIndex, 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) { - SendAngle8(data, startIndex++, s.horizontalAngle); - SendAngle8(data, startIndex++, s.verticalAngle); - SendAngle8(data, startIndex++, s.distance); + SendAngle8(data, (*startIndex)++, s.horizontalAngle); + SendAngle8(data, (*startIndex)++, s.verticalAngle); + // SendAngle8(data, startIndex++, s.distance); + SendFloat16(data, startIndex, s.distance); } // 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); short binary = value16.getBinary(); - data[(*startIndex)++] = (binary >> 8) & 0x0F; - data[(*startIndex)++] = binary & 0x0F; + data[(*startIndex)++] = (binary >> 8) & 0xFF; + data[(*startIndex)++] = binary & 0xFF; } void NetworkSync::SendInt32(unsigned char *data, unsigned int startIndex, @@ -245,8 +246,8 @@ void NetworkSync::PublishRelativeObject(Buffer sendBuffer, UInt8 parentId, (UInt8)object->id, Pose_Position, }; - unsigned int ix = 4; - SendSpherical(buffer, ix, object->position); + unsigned char ix = 4; + SendSpherical(buffer, &ix, object->position); // SendVector3(buffer, ix, worldPosition3); sendBuffer(buffer, bufferSize); } diff --git a/NetworkSync.h b/NetworkSync.h index 1fe9e69..ae91458 100644 --- a/NetworkSync.h +++ b/NetworkSync.h @@ -91,7 +91,8 @@ protected: const Quaternion q); 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 SendSpherical32(unsigned char *data, int startIndex, Spherical s); void SendQuat32(unsigned char *data, unsigned char *startIndex, diff --git a/float16 b/float16 index 51cffc3..7fce85b 160000 --- a/float16 +++ b/float16 @@ -1 +1 @@ -Subproject commit 51cffc3ae3da69212ef290a7ad6ed1c747ffa6ab +Subproject commit 7fce85b7b021693d531fd59d122d90e4500a9371