Revision: 7514
          http://playerstage.svn.sourceforge.net/playerstage/?rev=7514&view=rev
Author:   hsujohnhsu
Date:     2009-03-17 01:28:04 +0000 (Tue, 17 Mar 2009)

Log Message:
-----------
added functions for user interface enhencement: drag model in the view plane.

Modified Paths:
--------------
    code/gazebo/branches/ogre-1.4.9/server/rendering/OgreCamera.cc
    code/gazebo/branches/ogre-1.4.9/server/rendering/OgreCamera.hh

Modified: code/gazebo/branches/ogre-1.4.9/server/rendering/OgreCamera.cc
===================================================================
--- code/gazebo/branches/ogre-1.4.9/server/rendering/OgreCamera.cc      
2009-03-17 01:26:32 UTC (rev 7513)
+++ code/gazebo/branches/ogre-1.4.9/server/rendering/OgreCamera.cc      
2009-03-17 01:28:04 UTC (rev 7514)
@@ -362,10 +362,10 @@
   if (this->renderTarget)
     return this->renderTarget->getViewport(0)->getActualWidth();
   else
-    return 0;
+    return this->camera->getViewport()->getActualWidth();
+    //return 0;
 }
 
-
 
////////////////////////////////////////////////////////////////////////////////
 /// Get the viewport height in pixels
 unsigned int OgreCamera::GetViewportHeight() const
@@ -373,7 +373,8 @@
   if (this->renderTarget)
     return this->renderTarget->getViewport(0)->getActualHeight();
   else
-    return 0;
+    return this->camera->getViewport()->getActualHeight();
+    //return 0;
 }
 
 
////////////////////////////////////////////////////////////////////////////////
@@ -384,6 +385,33 @@
 }
 
 
////////////////////////////////////////////////////////////////////////////////
+/// Get the viewport up vector
+Vector3 OgreCamera::GetUp()
+{
+  //std::cout << "ogre cam position " <<  this->camera->getRealPosition() << 
std::endl;
+  Ogre::Vector3 up = this->camera->getRealUp();
+  //std::cout << "ogre up " <<  up << std::endl;
+  return Vector3(up.x,up.y,up.z);
+}
+
+////////////////////////////////////////////////////////////////////////////////
+/// Get the viewport right vector
+Vector3 OgreCamera::GetRight()
+{
+  Ogre::Vector3 right = this->camera->getRealRight();
+  //std::cout << "ogre right " <<  right << std::endl;
+  return Vector3(right.x,right.y,right.z);
+}
+
+////////////////////////////////////////////////////////////////////////////////
+/// Get the camera position in the world
+Vector3 OgreCamera::GetCameraPosition()
+{
+  Ogre::Vector3 camPos = this->camera->getRealPosition();
+  return Vector3(camPos.x,camPos.y,camPos.z);
+}
+
+////////////////////////////////////////////////////////////////////////////////
 /// Set whether the user can move the camera via the GUI
 void OgreCamera::SetUserMovable( bool movable )
 {

Modified: code/gazebo/branches/ogre-1.4.9/server/rendering/OgreCamera.hh
===================================================================
--- code/gazebo/branches/ogre-1.4.9/server/rendering/OgreCamera.hh      
2009-03-17 01:26:32 UTC (rev 7513)
+++ code/gazebo/branches/ogre-1.4.9/server/rendering/OgreCamera.hh      
2009-03-17 01:28:04 UTC (rev 7514)
@@ -157,6 +157,15 @@
     /// \brief Get the viewport height in pixels
     public: unsigned int GetViewportHeight() const;
 
+    /// \brief Get the viewport up vector
+    public: Vector3 GetUp();
+
+    /// \brief Get the viewport right vector
+    public: Vector3 GetRight();
+
+    /// \brief Get the camera position in the world
+    public: Vector3 GetCameraPosition();
+
     /// \brief Get the average FPS
     public: virtual float GetAvgFPS() { return 0;}
 


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
_______________________________________________
Playerstage-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/playerstage-commit

Reply via email to