Tools.cs 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. using SharpDX;
  2. using Vertice.Core;
  3. namespace BabylonExport.Core
  4. {
  5. public static class Tools
  6. {
  7. public static Color3 ToColor3(this Microsoft.Xna.Framework.Vector3 value)
  8. {
  9. return new Color3(value.X, value.Y, value.Z);
  10. }
  11. public static float[] ToArray(this RGBAColor color)
  12. {
  13. return new []{color.Red, color.Green, color.Blue, color.Alpha};
  14. }
  15. public static float[] ToArray(this Vertice.Core.Vector3 vector3)
  16. {
  17. return new[] { vector3.X, vector3.Y, vector3.Z };
  18. }
  19. public static float[] ToArray(this Vertice.Core.Matrix matrix)
  20. {
  21. return new[]
  22. {
  23. matrix.M11, matrix.M12, matrix.M13, matrix.M14,
  24. matrix.M21, matrix.M22, matrix.M23, matrix.M24,
  25. matrix.M31, matrix.M32, matrix.M33, matrix.M34,
  26. matrix.M41, matrix.M42, matrix.M43, matrix.M44,
  27. };
  28. }
  29. public static float[] ToArray(this Vertice.Core.Vector4 vector4)
  30. {
  31. return new[] { vector4.X, vector4.Y, vector4.Z, vector4.W };
  32. }
  33. public static float[] ToArray(this Vertice.Core.Quaternion quaternion)
  34. {
  35. return new[] { quaternion.X, quaternion.Y, quaternion.Z, quaternion.W };
  36. }
  37. public static SharpDX.Matrix ToMatrix(this Microsoft.Xna.Framework.Matrix value)
  38. {
  39. return new SharpDX.Matrix(
  40. value.M11, value.M12, value.M13, value.M14,
  41. value.M21, value.M22, value.M23, value.M24,
  42. value.M31, value.M32, value.M33, value.M34,
  43. value.M41, value.M42, value.M43, value.M44
  44. );
  45. }
  46. }
  47. }