title: Rotate and translate object in local and global orientation using glm
body: <p>i am trying to implement functions, where i can rotate/ translate an object in local or global orientation, like in 3D modeling software, using glm. Something like this:</p>
  
  <pre><code>void Rotate(float x, float y, float z, bool localOrientation);
  </code></pre>
  
  <p>but I dont know how to get it working. Local rotation rotation should just be something like this(?):</p>
  
  <pre><code>m_Orientation *= glm::rotate(x, glm::vec3(1,0,0);
  m_Orientation *= glm::rotate(y, glm::vec3(0,1,0);
  m_Orientation *= glm::rotate(z, glm::vec3(0,0,1);
  
  // (m_Orientation is glm::mat4)
  </code></pre>
  
  <p>But how to combine this with local orientation? Actually i need to rotate the rotation matrix in world orientation, right?
  I hope you know what i mean with local and global oriented rotation/translation, like it is in 3D modeling programs. In most of them you have a button to switch between local and global.</p>
  
  <p>And how would i calculating the forward/right/up vector then?
  normally it should be something like this, right?:</p>
  
  <pre><code>forward = m_Orientation * glm::vec4(0,0,-1,0);
  </code></pre>
  
  <p>I tried global rotation with this:</p>
  
  <pre><code>m_GlobalOrientation = glm::rotate(m_GlobalRotation.x, glm::vec(1,0,0);
  m_GlobalOrientation *= glm::rotate(m_GlobalRotation.y, glm::vec(0,1,0);
  m_GlobalOrientation *= glm::rotate(m_GlobalRotation.z, glm::vec(0,0,1);
  </code></pre>
  
  <p>but then only x rotation is in global orientation, y and z rotation is in local orientation, since it is already rotated around x axis. So I need to rotate all 3 angles at once(?)</p>
  
  <p>Translating local should just be adding translation values to current translation, and local translation should be glm::inverse(m_Orientation) * translationVector right?</p>