Small enhancements introduced from Rbx2Source migration.

This commit is contained in:
CloneTrooper1019
2020-09-21 13:29:31 -05:00
parent 7252e96c03
commit d1535c9a15
9 changed files with 78 additions and 33 deletions

View File

@ -346,19 +346,28 @@ namespace RobloxFiles.DataTypes
return new CFrame(0, 0, 0, r.X, u.X, b.X, r.Y, u.Y, b.Y, r.Z, u.Z, b.Z);
}
public static CFrame Angles(float x, float y, float z)
public static CFrame FromEulerAnglesXYZ(float x, float y, float z)
{
CFrame cfx = FromAxisAngle(Vector3.Right, x);
CFrame cfy = FromAxisAngle(Vector3.Up, y);
CFrame cfz = FromAxisAngle(Vector3.Back, z);
CFrame cfx = FromAxisAngle(Vector3.Right, x),
cfy = FromAxisAngle(Vector3.Up, y),
cfz = FromAxisAngle(Vector3.Back, z);
return cfx * cfy * cfz;
}
public static CFrame FromEulerAnglesXYZ(float x, float y, float z)
public static CFrame FromEulerAnglesXYZ(params float[] angles)
{
return Angles(x, y, z);
Contract.Requires(angles.Length == 3);
float x = angles[0],
y = angles[1],
z = angles[2];
return FromEulerAnglesXYZ(x, y, z);
}
public static CFrame Angles(float x, float y, float z) => FromEulerAnglesXYZ(x, y, z);
public static CFrame Angles(params float[] angles) => FromEulerAnglesXYZ(angles);
public CFrame Lerp(CFrame other, float t)
{

View File

@ -65,20 +65,13 @@ namespace RobloxFiles.DataTypes
switch (i)
{
case 0:
return new Color3(v, k, m);
case 1:
return new Color3(n, v, m);
case 2:
return new Color3(m, v, k);
case 3:
return new Color3(m, n, v);
case 4:
return new Color3(k, m, v);
case 5:
return new Color3(v, m, n);
default:
return new Color3();
case 0 : return new Color3(v, k, m);
case 1 : return new Color3(n, v, m);
case 2 : return new Color3(m, v, k);
case 3 : return new Color3(m, n, v);
case 4 : return new Color3(k, m, v);
case 5 : return new Color3(v, m, n);
default : return new Color3(0, 0, 0);
}
}