I want to improve upon my first person camera implementation and extend it to, so the user can toggle between third person/first person view.
My current setup: draw()::
glPushMatrix(); m_pCamera->ApplyCameraTransform(); // Render gameObjects glPopMatrix();
Camera is strongly coupled to the player, so much so, that it is a friend of player. This is what the Camera::ApplyCameraTransform looks like:
glm::mat4 l_TransformationMatrix; m_pPlayer->m_pTransformation->GetTransformation(l_TransformationMatrix, false); l_TransformationMatrix = glm::core::function::matrix::inverse(l_TransformationMatrix); glMultMatrixf(glm::value_ptr(l_TransformationMatrix));
So, I take the player's transformation matrix and invert it to yield First person camera view.
Since, Third person camera view is just a 'translated' first person view behind the player; what would be a good way to improve upon this (keeping in mind that I will be extending it to Third person camera as well.