Matrix.hpp 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. #ifndef CORE_MATRIX_HPP
  2. #define CORE_MATRIX_HPP
  3. #include "core/math/Quaternion.hpp"
  4. #include "core/utils/ArrayString.hpp"
  5. namespace Core {
  6. class Matrix final {
  7. Vector4 data[4];
  8. public:
  9. Matrix();
  10. Matrix& unit();
  11. Matrix& set(size_t index, const Vector4& v);
  12. Matrix transpose();
  13. const float* getValues() const;
  14. Matrix& operator*=(const Matrix& other);
  15. Matrix operator*(const Matrix& other) const;
  16. Vector3 operator*(const Vector3& v) const;
  17. Matrix& scale(const Vector3& v);
  18. Matrix& scale(float f);
  19. Matrix& translate(const Vector3& v);
  20. Matrix& translateX(float tx);
  21. Matrix& translateY(float ty);
  22. Matrix& translateZ(float tz);
  23. Matrix& translateTo(const Vector3& v);
  24. Matrix& rotateX(float degrees);
  25. Matrix& rotateY(float degrees);
  26. Matrix& rotateZ(float degrees);
  27. Matrix& rotate(const Quaternion& q);
  28. void toString(BufferString& s) const;
  29. private:
  30. Matrix& rotate(float degrees, int a, int b);
  31. };
  32. }
  33. #endif