@@ -334,6 +334,26 @@ public void WriteDoublePacked(double value)
334
334
}
335
335
}
336
336
337
+ /// <summary>
338
+ /// Convenience method that writes two non-packed Vector3 from the ray to the stream
339
+ /// </summary>
340
+ /// <param name="ray">Ray to write</param>
341
+ public void WriteRay ( Ray ray )
342
+ {
343
+ WriteVector3 ( ray . origin ) ;
344
+ WriteVector3 ( ray . direction ) ;
345
+ }
346
+
347
+ /// <summary>
348
+ /// Convenience method that writes two packed Vector3 from the ray to the stream
349
+ /// </summary>
350
+ /// <param name="ray">Ray to write</param>
351
+ public void WriteRayPacked ( Ray ray )
352
+ {
353
+ WriteVector3Packed ( ray . origin ) ;
354
+ WriteVector3Packed ( ray . direction ) ;
355
+ }
356
+
337
357
/// <summary>
338
358
/// Convenience method that writes four non-varint floats from the color to the stream
339
359
/// </summary>
@@ -603,6 +623,18 @@ public double ReadDoublePacked()
603
623
/// <returns>The Color32 read from the stream.</returns>
604
624
public Color32 ReadColor32 ( ) => new Color32 ( ( byte ) ReadByte ( ) , ( byte ) ReadByte ( ) , ( byte ) ReadByte ( ) , ( byte ) ReadByte ( ) ) ;
605
625
626
+ /// <summary>
627
+ /// Read a Ray from the stream.
628
+ /// </summary>
629
+ /// <returns>The Ray read from the stream.</returns>
630
+ public Ray ReadRay ( ) => new Ray ( ReadVector3 ( ) , ReadVector3 ( ) ) ;
631
+
632
+ /// <summary>
633
+ /// Read a Ray from the stream.
634
+ /// </summary>
635
+ /// <returns>The Ray read from the stream.</returns>
636
+ public Ray ReadRayPacked ( ) => new Ray ( ReadVector3Packed ( ) , ReadVector3Packed ( ) ) ;
637
+
606
638
/// <summary>
607
639
/// Read a single-precision floating point value from the stream. The value is between (inclusive) the minValue and maxValue.
608
640
/// </summary>
0 commit comments