ToVector(), ToLVector(), ToQuaternion() and ToLQuaternion() added

This commit is contained in:
EntenKoeniq
2021-12-24 05:05:35 +01:00
parent b9703dd612
commit d6ef443b92
2 changed files with 52 additions and 5 deletions

View File

@ -11,8 +11,11 @@ using GTA.Math;
namespace CoopClient namespace CoopClient
{ {
#region CLIENT-ONLY #region CLIENT-ONLY
static class VectorExtensions public static class VectorExtensions
{ {
/// <summary>
///
/// </summary>
public static Vector3 ToVector(this Quaternion vec) public static Vector3 ToVector(this Quaternion vec)
{ {
return new Vector3() return new Vector3()
@ -23,6 +26,9 @@ namespace CoopClient
}; };
} }
/// <summary>
///
/// </summary>
public static Quaternion ToQuaternion(this Vector3 vec, float vW = 0.0f) public static Quaternion ToQuaternion(this Vector3 vec, float vW = 0.0f)
{ {
return new Quaternion() return new Quaternion()
@ -34,6 +40,9 @@ namespace CoopClient
}; };
} }
/// <summary>
///
/// </summary>
public static LVector3 ToLVector(this Vector3 vec) public static LVector3 ToLVector(this Vector3 vec)
{ {
return new LVector3() return new LVector3()
@ -44,6 +53,9 @@ namespace CoopClient
}; };
} }
/// <summary>
///
/// </summary>
public static LQuaternion ToLQuaternion(this Quaternion vec) public static LQuaternion ToLQuaternion(this Quaternion vec)
{ {
return new LQuaternion() return new LQuaternion()
@ -57,15 +69,24 @@ namespace CoopClient
} }
#endregion #endregion
struct LVector3 /// <summary>
///
/// </summary>
public struct LVector3
{ {
#region CLIENT-ONLY #region CLIENT-ONLY
/// <summary>
///
/// </summary>
public Vector3 ToVector() public Vector3 ToVector()
{ {
return new Vector3(X, Y, Z); return new Vector3(X, Y, Z);
} }
#endregion #endregion
/// <summary>
///
/// </summary>
public LVector3(float X, float Y, float Z) public LVector3(float X, float Y, float Z)
{ {
this.X = X; this.X = X;
@ -73,22 +94,37 @@ namespace CoopClient
this.Z = Z; this.Z = Z;
} }
/// <summary>
///
/// </summary>
public float X { get; set; } public float X { get; set; }
/// <summary>
///
/// </summary>
public float Y { get; set; } public float Y { get; set; }
/// <summary>
///
/// </summary>
public float Z { get; set; } public float Z { get; set; }
} }
struct LQuaternion public struct LQuaternion
{ {
#region CLIENT-ONLY #region CLIENT-ONLY
/// <summary>
///
/// </summary>
public Quaternion ToQuaternion() public Quaternion ToQuaternion()
{ {
return new Quaternion(X, Y, Z, W); return new Quaternion(X, Y, Z, W);
} }
#endregion #endregion
/// <summary>
///
/// </summary>
public LQuaternion(float X, float Y, float Z, float W) public LQuaternion(float X, float Y, float Z, float W)
{ {
this.X = X; this.X = X;
@ -97,12 +133,24 @@ namespace CoopClient
this.W = W; this.W = W;
} }
/// <summary>
///
/// </summary>
public float X { get; set; } public float X { get; set; }
/// <summary>
///
/// </summary>
public float Y { get; set; } public float Y { get; set; }
/// <summary>
///
/// </summary>
public float Z { get; set; } public float Z { get; set; }
/// <summary>
///
/// </summary>
public float W { get; set; } public float W { get; set; }
} }

View File

@ -47,10 +47,9 @@ namespace CoopClient
} }
#endregion #endregion
// Dirty & dangerous
public static dynamic Lerp(dynamic from, dynamic to, float fAlpha) public static dynamic Lerp(dynamic from, dynamic to, float fAlpha)
{ {
return ((to - from) * fAlpha + from); return (to - from) * fAlpha + from;
} }
public static T GetGameMs<T>() where T : IConvertible public static T GetGameMs<T>() where T : IConvertible