[Orxonox-commit 376] r2977 - in branches/map/src: orxonox/objects orxonox/overlays/map util

Naaduun at orxonox.net Naaduun at orxonox.net
Thu May 14 14:35:54 CEST 2009


Author: Naaduun
Date: 2009-05-14 14:35:54 +0200 (Thu, 14 May 2009)
New Revision: 2977

Modified:
   branches/map/src/orxonox/objects/RadarViewable.cc
   branches/map/src/orxonox/overlays/map/Map.cc
   branches/map/src/orxonox/overlays/map/Map.h
   branches/map/src/util/SubString.cc
Log:
=movable plane

Modified: branches/map/src/orxonox/objects/RadarViewable.cc
===================================================================
--- branches/map/src/orxonox/objects/RadarViewable.cc	2009-05-13 13:14:08 UTC (rev 2976)
+++ branches/map/src/orxonox/objects/RadarViewable.cc	2009-05-14 12:35:54 UTC (rev 2977)
@@ -116,9 +116,10 @@
             this->MapNode_->setOrientation( this->getWorldEntity()->getOrientation() );
 //Vector3 v = this->getRVWorldPosition();
             //this->line_->setPoint(1, Vector3(0,v.y,0) );
-            this->line_->setPoint(1, Vector3(0, -this->getRVWorldPosition().y ,0) );
+            this->line_->setPoint(1, Vector3( 0, (int) -Map::getSingletonPtr()->movablePlane_->getDistance( this->getRVWorldPosition() ) ,0 ));
             this->line_->update();
-            this->LineNode_->setDirection(Vector3::UNIT_Y,Ogre::Node::TS_WORLD,Vector3::UNIT_Y);
+            if( Map::getSingletonPtr()->playerShipNode_ )
+                this->LineNode_->setDirection( Map::getSingletonPtr()->playerShipNode_->getLocalAxes().GetColumn(1) ,Ogre::Node::TS_WORLD,Vector3::UNIT_Y);
         }
     }
 

Modified: branches/map/src/orxonox/overlays/map/Map.cc
===================================================================
--- branches/map/src/orxonox/overlays/map/Map.cc	2009-05-13 13:14:08 UTC (rev 2976)
+++ branches/map/src/orxonox/overlays/map/Map.cc	2009-05-14 12:35:54 UTC (rev 2977)
@@ -46,6 +46,7 @@
 #include "objects/worldentities/CameraPosition.h"
 
 #include <OgreOverlay.h>
+#include <OgreMovablePlane.h>
 #include <OgreOverlayElement.h>
 #include <OgreOverlayManager.h>
 #include <OgreOverlayContainer.h>
@@ -168,16 +169,21 @@
         this->isVisible_=false;
         overlay_->hide();
 
-        //Create plane in map
+        //Create plane to show grid
         Ogre::Entity* plane_ent = Map::getMapSceneManager()->createEntity( "MapPlane", "plane.mesh");
         planeNode_ = Map::getMapSceneManager()->getRootSceneNode()->createChildSceneNode();
-        
+        //Create plane for calculations
+        movablePlane_ = new Ogre::MovablePlane( Vector3::UNIT_Y, 0 );
+        movablePlane_->normalise();
+
         //Ogre::MaterialPtr plane_mat = Ogre::MaterialManager::getSingleton().create("mapgrid", "General");
         //plane_mat->getTechnique(0)->getPass(0)->createTextureUnitState("mapgrid.tga");
         //plane_ent->setMaterialName("mapgrid");
         plane_ent->setMaterialName("Map/Grid");
         planeNode_->attachObject(plane_ent);
+        
         planeNode_->scale(10,1,10);
+        planeNode_->attachObject(movablePlane_);
         //Ogre::Material plane_mat = Ogre::MaterialManager::getSingletonPtr()->getByName("rock");
         
 
@@ -271,8 +277,8 @@
                 //this->CamNodeHelper_->attachObject(this->Cam_);
                 this->Cam_->setPosition(0, 0, DISTANCE);
                 this->Cam_->pitch( (Degree)PITCH );
-                //this->CamNodeHelper_->lookAt(Vector3(0,0,0), Ogre::Node::TS_PARENT);
-                this->Cam_->setAutoTracking(true, this->playerShipNode_);
+                this->Cam_->lookAt(Vector3(0,0,0));
+                //this->Cam_->setAutoTracking(true, this->playerShipNode_);
             }
             
             
@@ -363,7 +369,7 @@
         Map::singletonMap_s->CamNodeHelper_->setDirection(Vector3::UNIT_Y, Ogre::Node::TS_PARENT, Vector3::UNIT_Y);
         Map::singletonMap_s->CamNodeHelper_->lookAt(Vector3(0,0,0), Ogre::Node::TS_PARENT);
 */
-        singletonMap_s->CamNode_->pitch( (Degree)(value.y * singletonMap_s->mouseLookSpeed_), Ogre::Node::TS_PARENT);
+        singletonMap_s->CamNode_->pitch( (Degree)(value.y * singletonMap_s->mouseLookSpeed_), Ogre::Node::TS_LOCAL);
         
     }
     

Modified: branches/map/src/orxonox/overlays/map/Map.h
===================================================================
--- branches/map/src/orxonox/overlays/map/Map.h	2009-05-13 13:14:08 UTC (rev 2976)
+++ branches/map/src/orxonox/overlays/map/Map.h	2009-05-14 12:35:54 UTC (rev 2977)
@@ -37,6 +37,7 @@
 #include <OgreOverlayElement.h>
 #include <OgreOverlayManager.h>
 #include <OgreOverlayContainer.h>
+#include <OgreMovablePlane.h>
 
 #include <OgreBorderPanelOverlayElement.h>
 #include <OgreTextAreaOverlayElement.h>
@@ -113,9 +114,11 @@
         //Ogre::SceneNode* CamNodeHelper_;
         Ogre::SceneNode* playerShipNode_;
         Ogre::SceneNode* planeNode_;
-        
+        Ogre::MovablePlane* movablePlane_;
         int mouseLookSpeed_;
         bool isVisible_;
+     
+    friend class RadarViewable;
     };
 }
 

Modified: branches/map/src/util/SubString.cc
===================================================================
--- branches/map/src/util/SubString.cc	2009-05-13 13:14:08 UTC (rev 2976)
+++ branches/map/src/util/SubString.cc	2009-05-14 12:35:54 UTC (rev 2977)
@@ -38,6 +38,7 @@
  */
 
 #include "SubString.h"
+#include <stdio.h>
 
 namespace orxonox
 {




More information about the Orxonox-commit mailing list