-
-
Notifications
You must be signed in to change notification settings - Fork 21
/
Copy pathVec3R.cs
35 lines (29 loc) · 805 Bytes
/
Vec3R.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
using Syroot.BinaryData;
using System.Numerics;
namespace PDTools.Files;
public struct Vec3R
{
public Vector3 Position { get; set; }
public float AngleRad { get; set; }
public const uint Size = 0x10;
public Vec3R(float x, float y, float z, float angleRadians)
{
Position = new Vector3(x, y, z);
AngleRad = angleRadians;
}
public static Vec3R FromStream(BinaryStream bs)
{
float x = bs.ReadSingle();
float y = bs.ReadSingle();
float z = bs.ReadSingle();
float r = bs.ReadSingle();
return new(x, y, z, r);
}
public void ToStream(BinaryStream bs)
{
bs.WriteSingle(Position.X);
bs.WriteSingle(Position.Y);
bs.WriteSingle(Position.Z);
bs.WriteSingle(AngleRad);
}
}