Math.cs 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  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. }
  73. [StructLayout (LayoutKind.Sequential, CharSet = CharSet.Ansi)]
  74. public struct BoundingBox
  75. {
  76. }
  77. [StructLayout (LayoutKind.Sequential, CharSet = CharSet.Ansi)]
  78. public struct Rect
  79. {
  80. }}