Matrix.h 942 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. #ifndef MATRIX_H
  2. #define MATRIX_H
  3. #include <iostream>
  4. #include "common/math/Vector.h"
  5. class Matrix final {
  6. public:
  7. Matrix();
  8. Matrix& set(const Matrix& other);
  9. Matrix& setToIdentity();
  10. Matrix& set(uint index, float f);
  11. const float* getValues() const;
  12. Matrix& mul(const Matrix& m);
  13. Matrix& scale(float sx, float sy, float sz);
  14. Matrix& scale(float s);
  15. Matrix& translate(float tx, float ty, float tz);
  16. Matrix& translateX(float tx);
  17. Matrix& translateY(float ty);
  18. Matrix& translateZ(float tz);
  19. Matrix& translateTo(float tx, float ty, float tz);
  20. Matrix& rotateX(float degrees);
  21. Matrix& rotateY(float degrees);
  22. Matrix& rotateZ(float degrees);
  23. private:
  24. Matrix& rotate(float degrees, uint indexA, uint indexB);
  25. alignas(16) float data[16];
  26. };
  27. std::ostream& operator<<(std::ostream& os, const Matrix& m);
  28. Vector<3> operator*(const Matrix& m, const Vector<3>& v);
  29. #endif