Skip to content

Commit 36b6ee4

Browse files
committed
Added packed Vector3
1 parent 7ac8472 commit 36b6ee4

File tree

1 file changed

+21
-4
lines changed

1 file changed

+21
-4
lines changed

MLAPI/NetworkingManagerComponents/Binary/BitStream.cs

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -338,11 +338,22 @@ public void WriteDoublePacked(double value)
338338
/// Convenience method that writes three non-varint floats from the vector to the stream
339339
/// </summary>
340340
/// <param name="vec">Vector to write</param>
341-
public void WriteVector3(Vector3 vec)
341+
public void WriteVector3(Vector3 vector3)
342342
{
343-
WriteSingle(vec.x);
344-
WriteSingle(vec.y);
345-
WriteSingle(vec.z);
343+
WriteSingle(vector3.x);
344+
WriteSingle(vector3.y);
345+
WriteSingle(vector3.z);
346+
}
347+
348+
/// <summary>
349+
/// Convenience method that writes three varint floats from the vector to the stream
350+
/// </summary>
351+
/// <param name="vec">Vector to write</param>
352+
public void WriteVector3Packed(Vector3 vector3)
353+
{
354+
WriteSinglePacked(vector3.x);
355+
WriteSinglePacked(vector3.y);
356+
WriteSinglePacked(vector3.z);
346357
}
347358

348359
/// <summary>
@@ -464,6 +475,12 @@ public double ReadDoublePacked()
464475
/// <returns>The Vector3 read from the stream.</returns>
465476
public Vector3 ReadVector3() => new Vector3(ReadSingle(), ReadSingle(), ReadSingle());
466477

478+
/// <summary>
479+
/// Read a Vector3 from the stream.
480+
/// </summary>
481+
/// <returns>The Vector3 read from the stream.</returns>
482+
public Vector3 ReadVector3Packed() => new Vector3(ReadSinglePacked(), ReadSinglePacked(), ReadSinglePacked());
483+
467484
/// <summary>
468485
/// Read a single-precision floating point value from the stream. The value is between (inclusive) the minValue and maxValue.
469486
/// </summary>

0 commit comments

Comments
 (0)