From: <axl...@us...> - 2009-05-31 04:28:57
|
Revision: 291 http://hgengine.svn.sourceforge.net/hgengine/?rev=291&view=rev Author: axlecrusher Date: 2009-05-31 04:28:19 +0000 (Sun, 31 May 2009) Log Message: ----------- still working on the camera Modified Paths: -------------- Mercury2/src/Camera.cpp Mercury2/src/Camera.h Modified: Mercury2/src/Camera.cpp =================================================================== --- Mercury2/src/Camera.cpp 2009-05-31 04:27:34 UTC (rev 290) +++ Mercury2/src/Camera.cpp 2009-05-31 04:28:19 UTC (rev 291) @@ -18,10 +18,10 @@ MercuryMatrix local; - m_lookAt = GetRotation() * MQuaternion(1, MercuryVector(0,0,1) ) * GetRotation().reciprocal(); - m_lookAt.Print(); +// m_lookAt = GetRotation() * MercuryVector(0,0,1); +// m_lookAt.Print(); - AngleMatrix( GetRotation().ToVertex()*-1, local); + AngleMatrix( GetRotation().ToVector()*-1, local); local.Translate( GetPosition()*-1 ); m_globalMatrix = GetParentMatrix() * local; @@ -36,9 +36,19 @@ // MercuryVertex r; // MQuaternion rot, d(0,0,1,0); - MQuaternion r = GetRotation(); - r[MQuaternion::X] += m->dy/30.0f; - r[MQuaternion::Y] += m->dx/30.0f; + MQuaternion qx = MQuaternion::CreateFromAxisAngle(MercuryVector(1,0,0), m->dy/10.0f); + MQuaternion qy = MQuaternion::CreateFromAxisAngle(MercuryVector(0,1,0), m->dx/10.0f); + + MQuaternion rot = GetRotation(); + rot *= (qx * qy).normalize(); +// rot[MQuaternion::W]=0; +// rot.CreateFromAxisAngle(r,1); +// rot = GetRotation() * rot; +// rot = rot.normalize(); + rot.Print(); +// MQuaternion r = GetRotation(); +// r[MQuaternion::X] += m->dy/30.0f; +// r[MQuaternion::Y] += m->dx/30.0f; // r = r.normalize(); // r = r * m_lookAt * r.reciprocal(); @@ -49,7 +59,7 @@ // r += m_rotation; // r[3] = 1; // rot.SetEuler( r ); - SetRotation(r); + SetRotation(rot); } if (message == INPUTEVENT_KEYBOARD) { Modified: Mercury2/src/Camera.h =================================================================== --- Mercury2/src/Camera.h 2009-05-31 04:27:34 UTC (rev 290) +++ Mercury2/src/Camera.h 2009-05-31 04:28:19 UTC (rev 291) @@ -14,7 +14,7 @@ GENRTTI(CameraNode); private: - MQuaternion m_lookAt; + MercuryVector m_lookAt; }; #endif This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |