Skip to content

Commit

Permalink
Merge pull request #3804 from pleroy/3230b
Browse files Browse the repository at this point in the history
A bunch of micro-optimizations in the adapter
  • Loading branch information
pleroy authored Nov 21, 2023
2 parents be6820c + 98bd3a6 commit bedc0ef
Show file tree
Hide file tree
Showing 4 changed files with 101 additions and 80 deletions.
14 changes: 13 additions & 1 deletion ksp_plugin_adapter/interface.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,16 +45,28 @@ public void Update(Status s) {
}

public partial struct XYZ {
public static explicit operator XYZ(Vector3d v) {
public static explicit operator XYZ(UnityEngine.Vector3 v) {
return new XYZ{ x = v.x, y = v.y, z = v.z };
}

public static explicit operator XYZ(Vector3d v) {
return new XYZ { x = v.x, y = v.y, z = v.z };
}

public static explicit operator UnityEngine.Vector3(XYZ v) {
return new UnityEngine.Vector3((float)v.x, (float)v.y, (float)v.z);
}

public static explicit operator Vector3d(XYZ v) {
return new Vector3d{ x = v.x, y = v.y, z = v.z };
}
}

internal partial struct WXYZ {
public static explicit operator WXYZ(UnityEngine.Quaternion q) {
return new WXYZ{ w = q.w, x = q.x, y = q.y, z = q.z };
}

public static explicit operator WXYZ(UnityEngine.QuaternionD q) {
return new WXYZ{ w = q.w, x = q.x, y = q.y, z = q.z };
}
Expand Down
Loading

0 comments on commit bedc0ef

Please sign in to comment.