@@ -334,6 +334,42 @@ public void WriteDoublePacked(double value)
334
334
}
335
335
}
336
336
337
+ /// <summary>
338
+ /// Convenience method that writes four non-varint floats from the color to the stream
339
+ /// </summary>
340
+ /// <param name="color">Color to write</param>
341
+ public void WriteColor ( Color color )
342
+ {
343
+ WriteSingle ( color . r ) ;
344
+ WriteSingle ( color . g ) ;
345
+ WriteSingle ( color . b ) ;
346
+ WriteSingle ( color . a ) ;
347
+ }
348
+
349
+ /// <summary>
350
+ /// Convenience method that writes four varint floats from the color to the stream
351
+ /// </summary>
352
+ /// <param name="color">Color to write</param>
353
+ public void WriteColorPacked ( Color color )
354
+ {
355
+ WriteSinglePacked ( color . r ) ;
356
+ WriteSinglePacked ( color . g ) ;
357
+ WriteSinglePacked ( color . b ) ;
358
+ WriteSinglePacked ( color . a ) ;
359
+ }
360
+
361
+ /// <summary>
362
+ /// Convenience method that writes four non-varint floats from the color to the stream
363
+ /// </summary>
364
+ /// <param name="color32">Color32 to write</param>
365
+ public void WriteColor32 ( Color32 color32 )
366
+ {
367
+ WriteSingle ( color32 . r ) ;
368
+ WriteSingle ( color32 . g ) ;
369
+ WriteSingle ( color32 . b ) ;
370
+ WriteSingle ( color32 . a ) ;
371
+ }
372
+
337
373
/// <summary>
338
374
/// Convenience method that writes two non-varint floats from the vector to the stream
339
375
/// </summary>
@@ -549,6 +585,24 @@ public double ReadDoublePacked()
549
585
/// <returns>The Vector4 read from the stream.</returns>
550
586
public Vector4 ReadVector4Packed ( ) => new Vector4 ( ReadSinglePacked ( ) , ReadSinglePacked ( ) , ReadSinglePacked ( ) , ReadSinglePacked ( ) ) ;
551
587
588
+ /// <summary>
589
+ /// Read a Color from the stream.
590
+ /// </summary>
591
+ /// <returns>The Color read from the stream.</returns>
592
+ public Color ReadColor ( ) => new Color ( ReadSingle ( ) , ReadSingle ( ) , ReadSingle ( ) , ReadSingle ( ) ) ;
593
+
594
+ /// <summary>
595
+ /// Read a Color from the stream.
596
+ /// </summary>
597
+ /// <returns>The Color read from the stream.</returns>
598
+ public Color ReadColorPacked ( ) => new Color ( ReadSinglePacked ( ) , ReadSinglePacked ( ) , ReadSinglePacked ( ) , ReadSinglePacked ( ) ) ;
599
+
600
+ /// <summary>
601
+ /// Read a Color32 from the stream.
602
+ /// </summary>
603
+ /// <returns>The Color32 read from the stream.</returns>
604
+ public Color32 ReadColor32 ( ) => new Color32 ( ( byte ) ReadByte ( ) , ( byte ) ReadByte ( ) , ( byte ) ReadByte ( ) , ( byte ) ReadByte ( ) ) ;
605
+
552
606
/// <summary>
553
607
/// Read a single-precision floating point value from the stream. The value is between (inclusive) the minValue and maxValue.
554
608
/// </summary>
0 commit comments