I implemented translation rotation and scaling in my 3D rendering software. A transformation matrix of an enttity is computed using the TRS. I get wrong results at the moment.
I use Y up system:

Here what i get when rotating around the y axis(A)
Here what i expect:
The corresponding code:
inline void updateMatrix()
{
m_matrix = Math::Mat4();
m_matrix = glm::scale(m_matrix, m_scale);
m_matrix = glm::rotate(m_matrix, m_rotation[0].getValue(), Math::Vec3(1.0f, 0.0f, 0.0f));
m_matrix = glm::rotate(m_matrix, m_rotation[1].getValue(), Math::Vec3(0.0f, 1.0f, 0.0f));
m_matrix = glm::rotate(m_matrix, m_rotation[2].getValue(), Math::Vec3(0.0f, 0.0f, 1.0f));
m_matrix[3] = Math::Vec4(m_position.x, m_position.y, m_position.z, 1.0f);
}
So this is wrong. Google assistant suggested me to do the following(B):
inline void updateMatrix()
{
glm::mat4 T = glm::translate(glm::mat4(1.0f), m_position);
glm::mat4 R = glm::eulerAngleYXZ(m_rotation[1].toRadian().getValue(), m_rotation[0].toRadian().getValue(), m_rotation[2].toRadian().getValue());
glm::mat4 S = glm::scale(glm::mat4(1.0f), m_scale);
m_matrix = T * R * S;
}
With that i get the Y-rotation right and non uniform scaling rotates properly.
But rotating around the Z axis(blue) gives the same result than rotating around the Y axis(green):
So it is not over yet. What should I do?