Advertisement
pavedaf

Untitled

Feb 11th, 2019
180
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.22 KB | None | 0 0
  1.  
  2.  
  3. template <class T>
  4. struct TArray
  5. {
  6. public:
  7. inline TArray()
  8. {
  9. Data = nullptr;
  10. };
  11.  
  12. inline T& operator[](int i)
  13. {
  14. return Data[i];
  15. };
  16.  
  17. inline int Count()
  18. {
  19. return count;
  20. }
  21.  
  22. inline const T& operator[](int i) const
  23. {
  24. return Data[i];
  25. };
  26. private:
  27. T* Data;
  28. int count;
  29. int max;
  30. };
  31.  
  32. struct FString
  33. {
  34. public:
  35.  
  36. inline wchar_t *GetWideString()
  37. {
  38. return this->str;
  39. }
  40.  
  41. inline char *GetString()
  42. {
  43. char mbs[256] = {};
  44. wcstombs(mbs, this->str, this->count);
  45. return mbs;
  46. }
  47.  
  48. private:
  49. wchar_t *str;
  50. int count;
  51. int max;
  52. };
  53.  
  54. class Vector3
  55. {
  56. public:
  57. float x;
  58. float y;
  59. float z;
  60.  
  61. Vector3()
  62. {
  63. x = y = z = 0;
  64. }
  65.  
  66. Vector3(float x, float y, float z)
  67. {
  68. this->x = x;
  69. this->y = y;
  70. this->z = z;
  71. }
  72.  
  73. float Dot(const Vector3 &vec)
  74. {
  75. return this->x * vec.x + this->y * vec.y + this->z * vec.z;
  76. }
  77.  
  78. float Length()
  79. {
  80. return (float)sqrt(this->x * this->x + this->y * this->y + this->z * this->z);
  81. }
  82.  
  83. Vector3 operator-(const Vector3 &vec)
  84. {
  85. return Vector3(this->x - vec.x, this->y - vec.y, this->z - vec.z);
  86. }
  87. Vector3 operator+(const Vector3 &vec)
  88. {
  89. return Vector3(this->x + vec.x, this->y + vec.y, this->z + vec.z);
  90. }
  91. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement