Changeset 3089 for code/trunk/src/orxonox/objects
- Timestamp:
- May 27, 2009, 4:11:31 PM (16 years ago)
- Location:
- code/trunk
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk
- Property svn:mergeinfo changed
/code/branches/map (added) merged: 2802,2812,2837-2838,2856,2913,2942,2956,2977,3082
- Property svn:mergeinfo changed
-
code/trunk/src/orxonox/objects/RadarViewable.cc
r3064 r3089 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 … … 42 46 */ 43 47 RadarViewable::RadarViewable() 44 : radarObjectCamouflage_(0.0f) 48 : MapNode_(NULL) 49 , MapEntity_(NULL) 50 , line_(NULL) 51 , LineNode_(NULL) 52 , radarObjectCamouflage_(0.0f) 45 53 , radarObjectShape_(Dot) 46 54 , radarObjectDescription_("staticObject") … … 49 57 50 58 this->bVisibility_ = true; 59 this->isHumanShip_ = false; 60 61 this->uniqueId_=getUniqueNumberString(); 62 /* 63 if(Map::getSingletonPtr() && Map::getSingletonPtr()->getMapSceneManagerPtr()) 64 { 65 this->addEntity(); 66 } 67 68 */ 69 } 70 71 72 RadarViewable::~RadarViewable() 73 { 74 if (MapNode_) 75 delete MapNode_; 76 MapNode_=0; 77 78 if (MapEntity_) 79 delete MapEntity_; 80 MapEntity_=0; 81 82 if (line_) 83 delete line_; 84 line_=0; 85 86 if (LineNode_) 87 delete LineNode_; 88 LineNode_=0; 89 } 90 91 void RadarViewable::addMapEntity() 92 { //TODO Check shape and add accordantly 93 if( this->MapNode_ && !this->MapEntity_ && Map::getSingletonPtr() && Map::getSingletonPtr()->getMapSceneManagerPtr() ) 94 { 95 COUT(0) << "Adding " << this->uniqueId_ << " to Map.\n"; 96 this->MapEntity_ = Map::getSingletonPtr()->getMapSceneManagerPtr()->createEntity( this->uniqueId_, "drone.mesh"); 97 /*this->line_ = Map::getSingletonPtr()->getMapSceneManagerPtr()->createManualObject(this->uniqueId_ + "_l"); 98 this->line_->begin("Map/line_", Ogre::RenderOperation::OT_LINE_STRIP); 99 //line_->position(0, -it->getRVWorldPosition().y, 0); 100 //this->line_->position(0, -20, 0); 101 this->line_->position(0, 0, -10); //Front Arrow 102 this->line_->position(0, 0, 0); 103 104 this->line_->end(); */ 105 this->line_ = new DynamicLines(Ogre::RenderOperation::OT_LINE_LIST); 106 this->line_->addPoint( Vector3(0,0,0) ); 107 this->line_->addPoint( Vector3(0,0,0) ); 108 109 this->MapNode_->attachObject( this->MapEntity_ ); 110 111 this->LineNode_ = this->MapNode_->createChildSceneNode(); 112 this->LineNode_->attachObject( this->line_ ); 113 } 114 else 115 { 116 COUT(0) << "Unable to load " << this->uniqueId_ << " to Map.\n"; 117 } 118 } 119 120 void RadarViewable::updateMapPosition() 121 { 122 if( this->MapNode_ ) 123 { 124 this->MapNode_->setPosition( this->getRVWorldPosition() ); 125 this->MapNode_->translate( this->getRVOrientedVelocity(), (Ogre::Node::TransformSpace)3 ); 126 this->MapNode_->setOrientation( this->getWorldEntity()->getOrientation() ); 127 //Vector3 v = this->getRVWorldPosition(); 128 //this->line_->setPoint(1, Vector3(0,v.y,0) ); 129 this->line_->setPoint(1, Vector3( 0, (int) -Map::getSingletonPtr()->movablePlane_->getDistance( this->getRVWorldPosition() ) ,0 )); 130 this->line_->update(); 131 if( Map::getSingletonPtr()->playerShipNode_ ) 132 this->LineNode_->setDirection( Map::getSingletonPtr()->playerShipNode_->getLocalAxes().GetColumn(1) ,Ogre::Node::TS_WORLD,Vector3::UNIT_Y); 133 } 51 134 } 52 135 -
code/trunk/src/orxonox/objects/RadarViewable.h
r3064 r3089 37 37 #include "core/OrxonoxClass.h" 38 38 39 #include <string> 40 #include <OgreSceneNode.h> 41 #include <OgreEntity.h> 42 #include <OgreManualObject.h> 43 #include "orxonox/tools/DynamicLines.h" 44 39 45 namespace orxonox 40 46 { … … 52 58 }; 53 59 60 54 61 public: 55 62 RadarViewable(); 56 virtual ~RadarViewable() { }63 virtual ~RadarViewable(); 57 64 58 65 inline void setRadarObjectCamouflage(float camouflage) … … 85 92 { return this->radarObjectShape_; } 86 93 94 /* 95 inline void setMapNode(Ogre::SceneNode * node) 96 { this->MapNode_ = node; } 97 inline Ogre::SceneNode * getMapNode() const 98 { return this->MapNode_; } 99 inline void setMapEntity(Ogre::Entity * ent) 100 { this->MapEntity_ = ent; } 101 inline Ogre::Entity * getMapEntity() const 102 { return this->MapEntity_; } 103 */ 104 //Used for Map 105 Ogre::SceneNode * MapNode_; 106 Ogre::Entity * MapEntity_; 107 DynamicLines* line_; 108 Ogre::SceneNode * LineNode_; 109 void addMapEntity(); 110 void updateMapPosition(); 111 bool isHumanShip_; 112 inline std::string getUniqueId() 113 { 114 return this->uniqueId_; 115 } 116 87 117 private: 88 118 void validate(const WorldEntity* object) const … … 94 124 } 95 125 } 96 126 97 127 bool bVisibility_; 128 //Map 129 std::string uniqueId_; 130 131 132 //Radar 98 133 float radarObjectCamouflage_; 99 134 Shape radarObjectShape_; 100 135 std::string radarObjectDescription_; 101 136 ColourValue radarObjectColour_; 137 102 138 }; 103 139 } -
code/trunk/src/orxonox/objects/controllers/HumanController.cc
r3073 r3089 36 36 #include "objects/gametypes/Gametype.h" 37 37 #include "objects/infos/PlayerInfo.h" 38 #include "overlays/map/Map.h" 38 39 39 40 namespace orxonox … … 93 94 void HumanController::rotateYaw(const Vector2& value) 94 95 { 96 //Hack to enable mouselook in map 97 if ( Map::getSingletonPtr() && Map::getSingletonPtr()->getVisibility() && HumanController::localController_s->controllableEntity_->isInMouseLook() ) 98 { 99 Map::getSingletonPtr()->rotateYaw(value); 100 return; 101 } 95 102 if (HumanController::localController_s && HumanController::localController_s->controllableEntity_) 96 103 HumanController::localController_s->controllableEntity_->rotateYaw(value); … … 99 106 void HumanController::rotatePitch(const Vector2& value) 100 107 { 108 //Hack to enable mouselook in map 109 if ( Map::getSingletonPtr() && Map::getSingletonPtr()->getVisibility() && HumanController::localController_s->controllableEntity_->isInMouseLook() ) 110 { 111 Map::getSingletonPtr()->rotatePitch(value); 112 return; 113 } 101 114 if (HumanController::localController_s && HumanController::localController_s->controllableEntity_) 102 115 HumanController::localController_s->controllableEntity_->rotatePitch(value); -
code/trunk/src/orxonox/objects/controllers/HumanController.h
r3073 r3089 78 78 } 79 79 80 //friend class, for mouselook 81 friend class Map; 82 80 83 private: 81 84 static HumanController* localController_s; -
code/trunk/src/orxonox/objects/worldentities/CameraPosition.cc
r2826 r3089 30 30 #include "CameraPosition.h" 31 31 32 #include <OgreCamera.h> 33 32 34 #include "core/CoreIncludes.h" 33 35 #include "core/XMLPort.h" … … 45 47 this->bAllowMouseLook_ = false; 46 48 this->bAbsolute_ = false; 49 this->bRenderCamera_ = false; 47 50 48 51 this->setObjectMode(0x0); … … 60 63 XMLPortParam(CameraPosition, "mouselook", setAllowMouseLook, getAllowMouseLook, xmlelement, mode).defaultValues(false); 61 64 XMLPortParam(CameraPosition, "absolute", setIsAbsolute, getIsAbsolute, xmlelement, mode).defaultValues(false); 65 XMLPortParam(CameraPosition, "rendercamera", setRenderCamera, getRenderCamera, xmlelement, mode).defaultValues(false); 62 66 } 63 67 … … 72 76 camera->setDrag(true); 73 77 } 78 79 void CameraPosition::attachCamera(Ogre::Camera* camera) 80 { 81 this->attachOgreObject(camera); 82 } 74 83 } -
code/trunk/src/orxonox/objects/worldentities/CameraPosition.h
r2826 r3089 59 59 { return this->bAbsolute_; } 60 60 61 inline void setRenderCamera(bool bRenderCamera) 62 { this->bRenderCamera_ = bRenderCamera; } 63 inline bool getRenderCamera() const 64 { return this->bRenderCamera_; } 65 61 66 void attachCamera(Camera* camera); 67 void attachCamera(Ogre::Camera* camera); 62 68 63 69 private: … … 65 71 bool bAllowMouseLook_; 66 72 bool bAbsolute_; 73 bool bRenderCamera_; 67 74 }; 68 75 } -
code/trunk/src/orxonox/objects/worldentities/ControllableEntity.cc
r3084 r3089 63 63 this->camera_ = 0; 64 64 this->xmlcontroller_ = 0; 65 this->reverseCamera_ = 0; 65 66 this->bDestroyWhenPlayerLeft_ = false; 66 67 this->cameraPositionRootNode_ = this->node_->createChildSceneNode(); … … 143 144 parent->attach(position); 144 145 } 145 this->cameraPositions_.push_back(position); 146 147 if (!position->getRenderCamera()) 148 this->cameraPositions_.push_back(position); 149 else 150 this->setReverseCamera(position); 146 151 } 147 152 -
code/trunk/src/orxonox/objects/worldentities/ControllableEntity.h
r3073 r3089 107 107 inline const std::string& getCameraPositionTemkplate() const 108 108 { return this->cameraPositionTemplate_; } 109 110 inline void setReverseCamera(CameraPosition* camera) 111 { this->reverseCamera_ = camera; } 112 inline CameraPosition* getReverseCamera() const 113 { return this->reverseCamera_; } 109 114 110 115 using WorldEntity::setPosition; … … 192 197 std::string cameraPositionTemplate_; 193 198 Controller* xmlcontroller_; 199 CameraPosition* reverseCamera_; 194 200 }; 195 201 } -
code/trunk/src/orxonox/objects/worldentities/pawns/Pawn.cc
r3087 r3089 86 86 87 87 this->registerVariables(); 88 89 this->isHumanShip_ = this->hasLocalController(); 88 90 } 89 91 … … 365 367 } 366 368 369 //Tell the Map (RadarViewable), if this is a playership 370 void Pawn::startLocalHumanControl() 371 { 372 // SUPER(ControllableEntity, changedPlayer()); 373 ControllableEntity::startLocalHumanControl(); 374 this->isHumanShip_ = true; 375 } 376 367 377 368 378 /////////////////// -
code/trunk/src/orxonox/objects/worldentities/pawns/Pawn.h
r3087 r3089 112 112 virtual void useItem() 113 113 { this->pickups_.useItem(); } 114 115 virtual void startLocalHumanControl(); 114 116 115 117 protected:
Note: See TracChangeset
for help on using the changeset viewer.