Advertisement
fusion44

Untitled

Jul 17th, 2011
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 3.11 KB | None | 0 0
  1. Stacktrace
  2. ------------------
  3.  
  4.     00000000() 
  5.     OgreMain.dll!77871273()    
  6.     [Unten angegebene Rahmen sind möglicherweise nicht korrekt und/oder fehlen, keine Symbole geladen für OgreMain.dll]  
  7.     OgreMain.dll!777f4584()    
  8.     OgreMain.dll!77872f2a()    
  9.     OgreMain.dll!77872767()    
  10. >   sumwars.exe!DebugCameraTab::update(OIS::Keyboard * keyboard, OIS::Mouse * mouse)  Zeile 183 C++
  11.     sumwars.exe!DebugPanel::update(OIS::Keyboard * keyboard, OIS::Mouse * mouse)  Zeile 113 + 0x8 Bytes C++
  12.     sumwars.exe!MainWindow::update(float time)  Zeile 672 + 0x39 Bytes  C++
  13.     sumwars.exe!Application::run()  Zeile 342   C++
  14.     sumwars.exe!main(int argc, char * * argv)  Zeile 71 C++
  15.     sumwars.exe!__tmainCRTStartup()  Zeile 555 + 0x17 Bytes C
  16.     kernel32.dll!7578d309()    
  17.     ntdll.dll!76f016c3()    
  18.     ntdll.dll!76f01696()    
  19.  
  20.  
  21. Code
  22. ----------------
  23.     Ogre::Radian rotX = Ogre::Radian();
  24.     Ogre::Radian rotY = Ogre::Radian();
  25.     Ogre::Vector3 vec = Ogre::Vector3();
  26.  
  27.     if ( m_leftMouseDown )
  28.     {
  29.         rotX = Ogre::Radian ( mouse->getMouseState().X.rel * 0.05f );
  30.         rotY = Ogre::Radian ( mouse->getMouseState().Y.rel * 0.05f );
  31.     }
  32.     else if ( m_rightMouseDown )
  33.         vec = Ogre::Vector3 ( 0.0f, 0.0f, mouse->getMouseState().Y.rel * 5 );
  34.  
  35.     if ( m_leftMouseDown || m_rightMouseDown )
  36.     {
  37.         Ogre::Real pitchAngle;
  38.         Ogre::Real pitchAngleSign;
  39.         // Yaws the camera according to the mouse relative movement.
  40.         this->cameraYawNode->yaw ( rotX );
  41.         // Pitches the camera according to the mouse relative movement.
  42.         this->cameraPitchNode->pitch ( rotY );
  43.         // Translates the camera according to the translate vector which is
  44.         // controlled by the keyboard arrows.
  45.         //
  46.         // NOTE: We multiply the mTranslateVector by the cameraPitchNode's
  47.         // orientation quaternion and the cameraYawNode's orientation
  48.         // quaternion to translate the camera accoding to the camera's
  49.         // orientation around the Y-axis and the X-axis.
  50.         Ogre::Quaternion q1 = this->cameraYawNode->getOrientation();
  51.         Ogre::Quaternion q2 = this->cameraPitchNode->getOrientation();
  52.         //Ogre::Vector3 trvec = this->cameraYawNode->getOrientation() * this->cameraPitchNode->getOrientation() * vec;
  53.         Ogre::Quaternion q3 = q1 * q2;
  54.         Ogre::Vector3 trvec = q3 * vec;
  55.         this->cameraNode->translate ( trvec, Ogre::SceneNode::TS_LOCAL );
  56.         // Angle of rotation around the X-axis.
  57.         pitchAngle = ( 2 * Ogre::Degree ( Ogre::Math::ACos ( q2.w ) ).valueDegrees() );
  58.         // Just to determine the sign of the angle we pick up above, the
  59.         // value itself does not interest us.
  60.         pitchAngleSign = q2.x;
  61.         // Limit the pitch between -90 degress and +90 degrees, Quake3-style.
  62.         if ( pitchAngle > 90.0f )
  63.         {
  64.             if ( pitchAngleSign > 0 )
  65.                 // Set orientation to 90 degrees on X-axis.
  66.                 this->cameraPitchNode->setOrientation ( Ogre::Quaternion ( Ogre::Math::Sqrt ( 0.5f ),
  67.                                                         Ogre::Math::Sqrt ( 0.5f ), 0, 0 ) );
  68.             else if ( pitchAngleSign < 0 )
  69.                 // Sets orientation to -90 degrees on X-axis.
  70.                 this->cameraPitchNode->setOrientation ( Ogre::Quaternion ( Ogre::Math::Sqrt ( 0.5f ),
  71.                                                         -Ogre::Math::Sqrt ( 0.5f ), 0, 0 ) );
  72.         }
  73.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement