Rotate a matrix around the x-axis
| 45 | |
| 46 | // Rotate a matrix around the x-axis |
| 47 | void matrixRotateX(Matrix& result, sf::Angle angle) |
| 48 | { |
| 49 | const float rad = angle.asRadians(); |
| 50 | |
| 51 | // clang-format off |
| 52 | const Matrix matrix = {{ |
| 53 | {1.f, 0.f, 0.f, 0.f}, |
| 54 | {0.f, std::cos(rad), std::sin(rad), 0.f}, |
| 55 | {0.f, -std::sin(rad), std::cos(rad), 0.f}, |
| 56 | {0.f, 0.f, 0.f, 1.f} |
| 57 | }}; |
| 58 | // clang-format on |
| 59 | |
| 60 | matrixMultiply(result, result, matrix); |
| 61 | } |
| 62 | |
| 63 | // Rotate a matrix around the y-axis |
| 64 | void matrixRotateY(Matrix& result, sf::Angle angle) |
no test coverage detected