Matrix.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334
  1. #ifndef CORE_MATRIX_H
  2. #define CORE_MATRIX_H
  3. // #include "core/Quaternion.h"
  4. #include "core/Vector.h"
  5. typedef struct {
  6. CoreVector4 data[4];
  7. } CoreMatrix;
  8. #define CORE_ZERO_MATRIX ((CoreMatrix){0})
  9. #define CORE_UNIT_MATRIX \
  10. ((CoreMatrix){{{1, 0, 0, 0}, {0, 1, 0, 0}, {0, 0, 1, 0}, {0, 0, 0, 1}}})
  11. CoreMatrix* coreTransposeMatrix(CoreMatrix* m);
  12. CoreMatrix* coreMulSetMatrix(CoreMatrix* m, const CoreMatrix* a);
  13. CoreMatrix* coreMulMatrix(CoreMatrix* m, const CoreMatrix* a,
  14. const CoreMatrix* b);
  15. CoreVector3* coreMulMatrixV3(CoreVector3* v, const CoreMatrix* m,
  16. const CoreVector3* a);
  17. CoreMatrix* coreScaleMatrix(CoreMatrix* m, const CoreVector3* v);
  18. CoreMatrix* coreScaleMatrixF(CoreMatrix* m, float f);
  19. CoreMatrix* coreTranslateMatrix(CoreMatrix* m, const CoreVector3* v);
  20. CoreMatrix* coreTranslateMatrixX(CoreMatrix* m, float tx);
  21. CoreMatrix* coreTranslateMatrixY(CoreMatrix* m, float ty);
  22. CoreMatrix* coreTranslateMatrixZ(CoreMatrix* m, float tz);
  23. CoreMatrix* coreTranslateMatrixTo(CoreMatrix* m, const CoreVector3* v);
  24. CoreMatrix* coreRotateMatrixX(CoreMatrix* m, float degrees);
  25. CoreMatrix* coreRotateMatrixY(CoreMatrix* m, float degrees);
  26. CoreMatrix* coreRotateMatrixZ(CoreMatrix* m, float degrees);
  27. // CoreMatrix* coreRotateMatrix(const Quaternion& q);
  28. size_t coreToStringMatrix(const CoreMatrix* m, char* buffer, size_t n);
  29. #endif