Refactor input system and window management.

This allows the input system to operate in two ways with regards to
window management. The default and prepared way is for SDL to handle
window creation and destruction.
The alternative way, which is only used by the WebEmber approach, is for
Ogre to handle the window.
Fix for mingw compilation.
Handle issue with terrain textures.

If there's no automatic generation of the mipmaps we'll end up with
messed up terrain textures. This should handle it.