@@ -334,10 +334,30 @@ public void WriteDoublePacked(double value)
334
334
}
335
335
}
336
336
337
+ /// <summary>
338
+ /// Convenience method that writes two non-varint floats from the vector to the stream
339
+ /// </summary>
340
+ /// <param name="vector2">Vector to write</param>
341
+ public void WriteVector2 ( Vector2 vector2 )
342
+ {
343
+ WriteSingle ( vector2 . x ) ;
344
+ WriteSingle ( vector2 . y ) ;
345
+ }
346
+
347
+ /// <summary>
348
+ /// Convenience method that writes two varint floats from the vector to the stream
349
+ /// </summary>
350
+ /// <param name="vector2">Vector to write</param>
351
+ public void WriteVector2Packed ( Vector2 vector2 )
352
+ {
353
+ WriteSinglePacked ( vector2 . x ) ;
354
+ WriteSinglePacked ( vector2 . y ) ;
355
+ }
356
+
337
357
/// <summary>
338
358
/// Convenience method that writes three non-varint floats from the vector to the stream
339
359
/// </summary>
340
- /// <param name="vec ">Vector to write</param>
360
+ /// <param name="vector3 ">Vector to write</param>
341
361
public void WriteVector3 ( Vector3 vector3 )
342
362
{
343
363
WriteSingle ( vector3 . x ) ;
@@ -348,14 +368,38 @@ public void WriteVector3(Vector3 vector3)
348
368
/// <summary>
349
369
/// Convenience method that writes three varint floats from the vector to the stream
350
370
/// </summary>
351
- /// <param name="vec ">Vector to write</param>
371
+ /// <param name="vector3 ">Vector to write</param>
352
372
public void WriteVector3Packed ( Vector3 vector3 )
353
373
{
354
374
WriteSinglePacked ( vector3 . x ) ;
355
375
WriteSinglePacked ( vector3 . y ) ;
356
376
WriteSinglePacked ( vector3 . z ) ;
357
377
}
358
378
379
+ /// <summary>
380
+ /// Convenience method that writes four non-varint floats from the vector to the stream
381
+ /// </summary>
382
+ /// <param name="vector4">Vector to write</param>
383
+ public void WriteVector4 ( Vector4 vector4 )
384
+ {
385
+ WriteSingle ( vector4 . x ) ;
386
+ WriteSingle ( vector4 . y ) ;
387
+ WriteSingle ( vector4 . z ) ;
388
+ WriteSingle ( vector4 . w ) ;
389
+ }
390
+
391
+ /// <summary>
392
+ /// Convenience method that writes four varint floats from the vector to the stream
393
+ /// </summary>
394
+ /// <param name="vector4">Vector to write</param>
395
+ public void WriteVector4Packed ( Vector4 vector4 )
396
+ {
397
+ WriteSinglePacked ( vector4 . x ) ;
398
+ WriteSinglePacked ( vector4 . y ) ;
399
+ WriteSinglePacked ( vector4 . z ) ;
400
+ WriteSinglePacked ( vector4 . w ) ;
401
+ }
402
+
359
403
/// <summary>
360
404
/// Write a single-precision floating point value to the stream. The value is between (inclusive) the minValue and maxValue.
361
405
/// </summary>
@@ -469,6 +513,18 @@ public double ReadDoublePacked()
469
513
}
470
514
}
471
515
516
+ /// <summary>
517
+ /// Read a Vector2 from the stream.
518
+ /// </summary>
519
+ /// <returns>The Vector2 read from the stream.</returns>
520
+ public Vector2 ReadVector2 ( ) => new Vector2 ( ReadSingle ( ) , ReadSingle ( ) ) ;
521
+
522
+ /// <summary>
523
+ /// Read a Vector2 from the stream.
524
+ /// </summary>
525
+ /// <returns>The Vector2 read from the stream.</returns>
526
+ public Vector2 ReadVector2Packed ( ) => new Vector2 ( ReadSinglePacked ( ) , ReadSinglePacked ( ) ) ;
527
+
472
528
/// <summary>
473
529
/// Read a Vector3 from the stream.
474
530
/// </summary>
@@ -481,6 +537,18 @@ public double ReadDoublePacked()
481
537
/// <returns>The Vector3 read from the stream.</returns>
482
538
public Vector3 ReadVector3Packed ( ) => new Vector3 ( ReadSinglePacked ( ) , ReadSinglePacked ( ) , ReadSinglePacked ( ) ) ;
483
539
540
+ /// <summary>
541
+ /// Read a Vector4 from the stream.
542
+ /// </summary>
543
+ /// <returns>The Vector4 read from the stream.</returns>
544
+ public Vector4 ReadVector4 ( ) => new Vector4 ( ReadSingle ( ) , ReadSingle ( ) , ReadSingle ( ) , ReadSingle ( ) ) ;
545
+
546
+ /// <summary>
547
+ /// Read a Vector4 from the stream.
548
+ /// </summary>
549
+ /// <returns>The Vector4 read from the stream.</returns>
550
+ public Vector4 ReadVector4Packed ( ) => new Vector4 ( ReadSinglePacked ( ) , ReadSinglePacked ( ) , ReadSinglePacked ( ) , ReadSinglePacked ( ) ) ;
551
+
484
552
/// <summary>
485
553
/// Read a single-precision floating point value from the stream. The value is between (inclusive) the minValue and maxValue.
486
554
/// </summary>
0 commit comments