Jump to content

  • Log In with Google      Sign In   
  • Create Account


mynameisnafe

Member Since 04 Sep 2012
Offline Last Active Aug 17 2014 09:15 AM

#5171143 glm/opengl orbital camera C++

Posted by mynameisnafe on 02 August 2014 - 11:46 AM

Hi there,

 

I have a gl project with a first person camera that uses glm to do it's math.

My question is thus and I'm sorry for it's quite poor construction: 

Do I need to use/do glm::quat things or do I need rotX, rotY, rotZ, for some code where the camera spins around on a sphere centred on the model?

So, the end goal is that moving the mouse makes it look like the model is spinning, when actually the camera is spinning?

And how would I do that?

For example, how different would this class declaration be?

I'd like to throw a 'orbit-cam' in there, then extract a base class, etc.

class GLCamera
{
protected:


float   _mx, _my;
float   m_frameTime, // how much time has passed
m_moveSpeed, // how many units to move per second
m_mouseSpeed; // how many degrees to rotate per second of


glm::vec3 m_real_up;
glm::vec3 m_origin;


float m_horizontalAngle, m_verticalAngle, m_initFoV;


glm::vec3 position;


glm::vec3 m_direction;
glm::vec3 m_right;
glm::vec3 m_up;


glm::mat4 m_viewMatrix;



#5034659 Check My Normal Calculations functions? Please?

Posted by mynameisnafe on 20 February 2013 - 12:46 PM

Brother Bob seems to have covered your immediate query, but I wanted to mention that your use of a class containing only static functions is a little odd.

 

Usually one would use a namespace for this purpose, instead.

I know it's stupid.. not used namespaces in C++ before.. off I go searching.. all procrastination from my actual problems with .3ds..

It's been one of those weeks!

 

Thanks :)




PARTNERS