Matrix.hpp 1.0 KB

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