Changeset 2942 for code/branches/map/src/orxonox/objects
- Timestamp:
- Apr 30, 2009, 2:12:57 PM (16 years ago)
- Location:
- code/branches/map/src/orxonox/objects
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/map/src/orxonox/objects/RadarViewable.cc
r2913 r2942 35 35 #include "objects/worldentities/WorldEntity.h" 36 36 #include "objects/Radar.h" 37 #include "util/String.h" 38 #include <OgreManualObject.h> 39 #include "overlays/map/Map.h" 40 #include "orxonox/tools/DynamicLines.h" 37 41 38 42 namespace orxonox … … 47 51 , MapNode_(NULL) 48 52 , MapEntity_(NULL) 53 , line_(NULL) 49 54 { 50 55 RegisterRootObject(RadarViewable); 56 57 this->uniqueId_=getUniqueNumberString(); 58 /* 59 if(Map::getSingletonPtr() && Map::getSingletonPtr()->getMapSceneManagerPtr()) 60 { 61 this->addEntity(); 62 } 63 64 */ 65 } 66 67 68 RadarViewable::~RadarViewable() 69 { 70 delete MapNode_; 71 delete MapEntity_; 72 } 73 74 void RadarViewable::addMapEntity() 75 { //TODO Check shape and add accordantly 76 if( this->MapNode_ && !this->MapEntity_ && Map::getSingletonPtr() && Map::getSingletonPtr()->getMapSceneManagerPtr() ) 77 { 78 COUT(0) << "Adding " << this->uniqueId_ << " to Map.\n"; 79 this->MapEntity_ = Map::getSingletonPtr()->getMapSceneManagerPtr()->createEntity( this->uniqueId_, "drone.mesh"); 80 /*this->line_ = Map::getSingletonPtr()->getMapSceneManagerPtr()->createManualObject(this->uniqueId_ + "_l"); 81 this->line_->begin("Map/line_", Ogre::RenderOperation::OT_LINE_STRIP); 82 //line_->position(0, -it->getRVWorldPosition().y, 0); 83 //this->line_->position(0, -20, 0); 84 this->line_->position(0, 0, -10); //Front Arrow 85 this->line_->position(0, 0, 0); 86 87 this->line_->end(); */ 88 this->line_ = new DynamicLines(Ogre::RenderOperation::OT_LINE_LIST); 89 this->line_->addPoint( Vector3(0,0,0) ); 90 this->line_->addPoint( Vector3(0,0,0) ); 91 92 this->MapNode_->attachObject( this->MapEntity_ ); 93 this->MapNode_->attachObject( this->line_ ); 94 } 95 else 96 { 97 COUT(0) << "Unable to load " << this->uniqueId_ << " to Map.\n"; 98 } 99 } 100 101 void RadarViewable::updateMapPosition() 102 { 103 if( this->MapNode_ ) 104 { 105 this->MapNode_->setPosition( this->getRVWorldPosition() ); 106 this->MapNode_->translate( this->getRVOrientedVelocity(), (Ogre::Node::TransformSpace)3 ); 107 this->MapNode_->setOrientation( this->getWorldEntity()->getOrientation() ); 108 Vector3 v = this->getRVWorldPosition(); 109 this->line_->setPoint(1, Vector3(0,v.y,0) ); 110 } 51 111 } 52 112 -
code/branches/map/src/orxonox/objects/RadarViewable.h
r2913 r2942 37 37 #include "core/OrxonoxClass.h" 38 38 39 #include <string> 39 40 #include <OgreSceneNode.h> 40 41 #include <OgreEntity.h> 42 #include <OgreManualObject.h> 43 #include "orxonox/tools/DynamicLines.h" 41 44 42 45 namespace orxonox … … 55 58 }; 56 59 60 57 61 public: 58 62 RadarViewable(); 59 virtual ~RadarViewable() { }63 virtual ~RadarViewable(); 60 64 61 65 inline void setRadarObjectCamouflage(float camouflage) … … 96 100 Ogre::SceneNode * MapNode_; 97 101 Ogre::Entity * MapEntity_; 98 102 DynamicLines* line_; 103 void addMapEntity(); 104 void updateMapPosition(); 99 105 private: 100 106 void validate(const WorldEntity* object) const … … 107 113 } 108 114 115 116 std::string uniqueId_; 117 109 118 float radarObjectCamouflage_; 110 119 Shape radarObjectShape_; -
code/branches/map/src/orxonox/objects/controllers/HumanController.cc
r2662 r2942 35 35 #include "objects/worldentities/pawns/Pawn.h" 36 36 #include "objects/gametypes/Gametype.h" 37 #include "overlays/map/Map.h" 37 38 38 39 namespace orxonox … … 92 93 void HumanController::rotateYaw(const Vector2& value) 93 94 { 95 //Hack to enable mouselook in map 96 if ( Map::getSingletonPtr() && Map::getSingletonPtr()->getVisibility() && HumanController::localController_s->controllableEntity_->isInMouseLook() ) 97 { 98 Map::getSingletonPtr()->rotateYaw(value); 99 return; 100 } 94 101 if (HumanController::localController_s && HumanController::localController_s->controllableEntity_) 95 102 HumanController::localController_s->controllableEntity_->rotateYaw(value); … … 98 105 void HumanController::rotatePitch(const Vector2& value) 99 106 { 107 //Hack to enable mouselook in map 108 if ( Map::getSingletonPtr() && Map::getSingletonPtr()->getVisibility() && HumanController::localController_s->controllableEntity_->isInMouseLook() ) 109 { 110 Map::getSingletonPtr()->rotatePitch(value); 111 return; 112 } 100 113 if (HumanController::localController_s && HumanController::localController_s->controllableEntity_) 101 114 HumanController::localController_s->controllableEntity_->rotatePitch(value); -
code/branches/map/src/orxonox/objects/controllers/HumanController.h
r2662 r2942 66 66 static void killBots(unsigned int amount = 0); 67 67 68 //friend class, for mouselook 69 friend class Map; 70 68 71 private: 69 72 static HumanController* localController_s;
Note: See TracChangeset
for help on using the changeset viewer.