Changeset 2856 for code/branches/map/src
- Timestamp:
- Mar 26, 2009, 5:06:25 PM (16 years ago)
- Location:
- code/branches/map/src/orxonox/overlays/map
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/map/src/orxonox/overlays/map/Map.cc
r2837 r2856 28 28 29 29 #include <string> 30 #include <OgreSceneManager.h> 31 #include <OgreSceneNode.h> 32 #include <OgreEntity.h> 30 33 #include <OgreOverlay.h> 31 34 #include <OgreOverlayElement.h> … … 46 49 RegisterObject(Map); 47 50 48 //COUT(0) << "Map loaded\n" << this->getScene(); 49 Ogre::SceneManager* sm = this->getScene()->getSceneManager(); 50 Ogre::SceneNode* sn = new Ogre::SceneNode(sm); 51 COUT(0) << "Map loaded\n" << sm << " / " << sn << std::endl; 51 //Getting Scene Manager (Hack) 52 ObjectList<Scene>::iterator it = ObjectList<Scene>::begin(); 53 this->sManager_ = it->getSceneManager(); 54 55 this->sNode_ = new Ogre::SceneNode(sManager_); 56 oManager_ = Ogre::OverlayManager::getSingletonPtr(); 57 overlay_ = oManager_->create("Map"); 58 //overlay_ is member of OrxonoxOverlay 59 60 //Not Showing the map as default 61 this->isVisible_=false; 62 overlay_->hide(); 63 64 //TestEntity 65 Ogre::Entity * ent = sManager_->createEntity("ent", "drone.mesh"); 66 sNode_->attachObject( ent ); 67 sNode_->setPosition(0,0,-50); 68 overlay_->add3D(sNode_); 52 69 } 53 70 … … 56 73 SUPER(Map, XMLPort, xmlElement, mode); 57 74 } 75 76 void Map::toggleVisibility() 77 { 78 if (!(this->isVisible_)) 79 { 80 this->overlay_->show(); 81 this->isVisible_=1; 82 } 83 else 84 { 85 this->overlay_->hide(); 86 this->isVisible_=0; 87 } 88 } 58 89 59 void Map::changedVisibility() 90 //Static function to toggle visibility of the map 91 void Map::openMap() 60 92 { 61 SUPER(Map, changedVisibility); 62 93 for(ObjectList<orxonox::Map>::iterator it = ObjectList<orxonox::Map>::begin(); 94 it!=ObjectList<orxonox::Map>::end(); 95 it++) 96 { 97 //Map * m = it->getMap(); 98 COUT(0) << it->isVisible_ << std::endl; 99 it->toggleVisibility(); 100 } 63 101 } 64 102 65 103 void Map::tick(float dt) 66 104 { 105 sNode_->lookAt(Vector3::NEGATIVE_UNIT_Z, Ogre::Node::TS_WORLD, Vector3::NEGATIVE_UNIT_Z); 106 67 107 } 68 108 -
code/branches/map/src/orxonox/overlays/map/Map.h
r2837 r2856 31 31 #include "OrxonoxPrereqs.h" 32 32 #include <OgrePrerequisites.h> 33 #include <OgreSceneManager.h> 34 #include <OgreSceneNode.h> 35 #include <OgreEntity.h> 36 #include <OgreOverlay.h> 37 #include <OgreOverlayElement.h> 38 #include <OgreOverlayManager.h> 39 #include <OgreOverlayContainer.h> 33 40 34 41 #include <OgreBorderPanelOverlayElement.h> … … 51 58 virtual void tick(float dt); 52 59 53 virtual void changedVisibility();54 60 55 inline static void openMap() 56 { 57 COUT(0) << "Opening Map"; 58 } 61 62 static void openMap(); 59 63 60 64 private: // functions 65 void toggleVisibility(); 61 66 62 67 63 68 private: // variables 64 65 69 Ogre::SceneManager* sManager_; 70 Ogre::SceneNode* sNode_; 71 Ogre::OverlayManager * oManager_; 72 73 bool isVisible_; 66 74 }; 67 75 }
Note: See TracChangeset
for help on using the changeset viewer.