Math.cs 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. using System;
  2. using System.Runtime.InteropServices;
  3. namespace AtomicEngine
  4. {
  5. [StructLayout (LayoutKind.Sequential, CharSet = CharSet.Ansi)]
  6. public struct Vector3
  7. {
  8. public Vector3 (float x, float y, float z)
  9. {
  10. this.x = x;
  11. this.y = y;
  12. this.z = z;
  13. }
  14. public override string ToString()
  15. {
  16. return x + ", " + y + ", " + z;
  17. }
  18. public float x;
  19. public float y;
  20. public float z;
  21. /// Zero vector.
  22. static public readonly Vector3 Zero = new Vector3(0, 0, 0);
  23. /// (-1,0,0) vector.
  24. static public readonly Vector3 Left = new Vector3(-1, 0, 0);
  25. /// (1,0,0) vector.
  26. static public readonly Vector3 Right = new Vector3(1, 0, 0);
  27. /// (0,1,0) vector.
  28. static public readonly Vector3 Up = new Vector3(0, 1, 0);
  29. /// (0,-1,0) vector.
  30. static public readonly Vector3 Down = new Vector3(0, -1, 0);
  31. /// (0,0,1) vector.
  32. static public readonly Vector3 Forward = new Vector3(0, 0, 1);
  33. /// (0,0,-1) vector.
  34. static public readonly Vector3 Back = new Vector3(0, 0, -1);
  35. /// (1,1,1) vector.
  36. static public readonly Vector3 One = new Vector3(1, 1, 1);
  37. }
  38. [StructLayout (LayoutKind.Sequential, CharSet = CharSet.Ansi)]
  39. public struct Vector4
  40. {
  41. }
  42. [StructLayout (LayoutKind.Sequential, CharSet = CharSet.Ansi)]
  43. public struct Vector2
  44. {
  45. }
  46. [StructLayout (LayoutKind.Sequential, CharSet = CharSet.Ansi)]
  47. public struct Quaternion
  48. {
  49. }
  50. [StructLayout (LayoutKind.Sequential, CharSet = CharSet.Ansi)]
  51. public struct Color
  52. {
  53. public Color (float r, float g, float b, float a = 1.0f)
  54. {
  55. this.r = r;
  56. this.g = g;
  57. this.b = b;
  58. this.a = a;
  59. }
  60. public float r;
  61. public float g;
  62. public float b;
  63. public float a;
  64. }
  65. [StructLayout (LayoutKind.Sequential, CharSet = CharSet.Ansi)]
  66. public struct IntRect
  67. {
  68. }
  69. [StructLayout (LayoutKind.Sequential, CharSet = CharSet.Ansi)]
  70. public struct IntVector2
  71. {
  72. public int x;
  73. public int y;
  74. public IntVector2 (int x, int y)
  75. {
  76. this.x = x;
  77. this.y = y;
  78. }
  79. static public readonly IntVector2 Zero = new IntVector2(0, 0);
  80. }
  81. [StructLayout (LayoutKind.Sequential, CharSet = CharSet.Ansi)]
  82. public struct BoundingBox
  83. {
  84. }
  85. [StructLayout (LayoutKind.Sequential, CharSet = CharSet.Ansi)]
  86. public struct Rect
  87. {
  88. }}