Changeset 3089
- Timestamp:
- May 27, 2009, 4:11:31 PM (16 years ago)
- Location:
- code/trunk
- Files:
-
- 16 edited
- 10 copied
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/archlinux/PKGBUILD
- Property svn:eol-style set to native
-
code/trunk/src/orxonox/OrxonoxPrereqs.h
r3087 r3089 247 247 template <class T> 248 248 class Timer; 249 class DynamicLines; 250 class DynamicRenderable; 249 251 250 252 // overlays … … 269 271 class CreateLines; 270 272 class Scoreboard; 273 class Map; 271 274 272 275 //gui -
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: -
code/trunk/src/orxonox/overlays/CMakeLists.txt
r2957 r3089 9 9 ADD_SUBDIRECTORY(debug) 10 10 ADD_SUBDIRECTORY(hud) 11 ADD_SUBDIRECTORY(map) 11 12 ADD_SUBDIRECTORY(notifications) 12 13 ADD_SUBDIRECTORY(stats) -
code/trunk/src/orxonox/overlays/map/CMakeLists.txt
- Property svn:eol-style set to native
-
code/trunk/src/orxonox/overlays/map/Map.cc
- Property svn:eol-style set to native
r3087 r3089 26 26 #include "OrxonoxStableHeaders.h" 27 27 #include "Map.h" 28 28 29 29 #include <string> 30 30 #include "util/String.h" … … 57 57 #include "objects/RadarViewable.h" 58 58 #include "objects/controllers/HumanController.h" 59 59 60 60 namespace orxonox 61 61 { … … 79 79 RegisterObject(Map); 80 80 Map::singletonMap_s=this; 81 81 82 82 //Getting Scene Manager (Hack) 83 83 if( !sManager_ ) … … 90 90 Map::setMapSceneManager( Ogre::Root::getSingletonPtr()->createSceneManager( Ogre::ST_GENERIC,"MapScene" ) ); 91 91 } 92 92 93 93 this->playerShipNode_ = 0; 94 94 //this->sNode_ = new Ogre::SceneNode(sManager_); … … 96 96 //overlay_ = oManager_->create("Map"); 97 97 //overlay_ is member of OrxonoxOverlay 98 98 99 99 //Not Showing the map as default 100 100 //this->isVisible_=false; … … 104 104 //TestEntity 105 105 //Ogre::Entity * ent = mapSceneM_s->createEntity("ent", "drone.mesh"); 106 106 107 107 //Map::getMapSceneManager()->getRootSceneNode()->attachObject( ent ); 108 108 /*sNode_->setPosition(0,0,-50); 109 109 overlay_->add3D(sNode_); 110 110 */ 111 112 113 114 115 111 112 113 114 115 116 116 // Alter the camera aspect ratio to match the viewport 117 117 //mCamera->setAspectRatio(Real(vp->getActualWidth()) / Real(vp->getActualHeight())); … … 122 122 //Cam_->setRenderingDistance(0); 123 123 CamNode_ = Map::getMapSceneManager()->getRootSceneNode()->createChildSceneNode(); 124 124 125 125 126 126 //Create overlay material … … 148 148 /* 149 149 Ogre::Overlay* pOverlay = Ogre::OverlayManager::getSingleton().create("Overlay1"); 150 150 151 151 // Create a panel with RenderToTexture texture 152 152 Ogre::OverlayContainer* m_pOverlayPanel = static_cast<Ogre::OverlayContainer*>(Ogre::OverlayManager::getSingleton().createOverlayElement("Panel","OverlayPanelName%d")); … … 155 155 m_pOverlayPanel->setDimensions(500, 300); 156 156 // Give overlay a texture 157 m_pOverlayPanel->setMaterialName(camMat_id); 157 m_pOverlayPanel->setMaterialName(camMat_id); 158 158 pOverlay->add2D(m_pOverlayPanel); 159 159 pOverlay->show(); … … 165 165 m_pOverlayPanel->setDimensions(600, 400); 166 166 // Give overlay a texture 167 m_pOverlayPanel->setMaterialName(camMat_id); 167 m_pOverlayPanel->setMaterialName(camMat_id); 168 168 overlay_->add2D(m_pOverlayPanel); 169 169 170 170 //Add Borders 171 Ogre::BorderPanelOverlayElement* oBorder = static_cast<Ogre::BorderPanelOverlayElement*>(Ogre::OverlayManager::getSingletonPtr()->createOverlayElement("BorderPanel", "MapBorderPanel" + getUniqueNumberString()));171 // Ogre::BorderPanelOverlayElement* oBorder = static_cast<Ogre::BorderPanelOverlayElement*>(Ogre::OverlayManager::getSingletonPtr()->createOverlayElement("BorderPanel", "MapBorderPanel" + getUniqueNumberString())); 172 172 /* 173 173 //TODO border size … … 201 201 plane_ent->setMaterialName("Map/Grid"); 202 202 planeNode_->attachObject(plane_ent); 203 203 204 204 planeNode_->scale(10,1,10); 205 205 // planeNode_->attachObject(movablePlane_); 206 206 //Ogre::Material plane_mat = Ogre::MaterialManager::getSingletonPtr()->getByName("rock"); 207 207 208 208 209 209 //ToDo create material script 210 Ogre::MaterialPtr myManualObjectMaterial = Ogre::MaterialManager::getSingleton().create("Map/Line","General"); 211 myManualObjectMaterial->setReceiveShadows(false); 212 myManualObjectMaterial->getTechnique(0)->setLightingEnabled(true); 213 myManualObjectMaterial->getTechnique(0)->getPass(0)->setDiffuse(1,1,0,0); 214 myManualObjectMaterial->getTechnique(0)->getPass(0)->setAmbient(1,1,0); 210 Ogre::MaterialPtr myManualObjectMaterial = Ogre::MaterialManager::getSingleton().create("Map/Line","General"); 211 myManualObjectMaterial->setReceiveShadows(false); 212 myManualObjectMaterial->getTechnique(0)->setLightingEnabled(true); 213 myManualObjectMaterial->getTechnique(0)->getPass(0)->setDiffuse(1,1,0,0); 214 myManualObjectMaterial->getTechnique(0)->getPass(0)->setAmbient(1,1,0); 215 215 myManualObjectMaterial->getTechnique(0)->getPass(0)->setSelfIllumination(1,1,0); 216 216 … … 306 306 } 307 307 it->updateMapPosition(); 308 309 310 311 312 313 314 } 315 } 316 317 318 308 309 310 311 312 313 314 } 315 } 316 317 318 319 319 void Map::XMLPort(Element& xmlElement, XMLPort::Mode mode) 320 320 { 321 321 SUPER(Map, XMLPort, xmlElement, mode); 322 } 322 } 323 323 324 324 void Map::changedOwner() 325 325 { 326 SUPER(Map, changedOwner); 326 327 //COUT(0) << "shipptr" << this->getOwner()->getReverseCamera() << std::endl; 327 if(this->getOwner()->getReverseCamera()) 328 329 ControllableEntity* entity = dynamic_cast<ControllableEntity*>(this->getOwner()); 330 if(entity && entity->getReverseCamera()) 328 331 { 329 332 //COUT(0) << "foo"; 330 this->getOwner()->getReverseCamera()->attachCamera(this->Cam_);333 entity->getReverseCamera()->attachCamera(this->Cam_); 331 334 } 332 335 } … … 351 354 } 352 355 } 353 356 354 357 //Static function to toggle visibility of the map 355 358 void Map::openMap() … … 365 368 } 366 369 } 367 370 368 371 void Map::tick(float dt) 369 372 { … … 375 378 updatePositions(); 376 379 //Cam_->roll(Degree(1)); 377 380 378 381 } 379 382 … … 403 406 */ 404 407 singletonMap_s->CamNode_->pitch( (Degree)(value.y * singletonMap_s->mouseLookSpeed_), Ogre::Node::TS_LOCAL); 405 406 } 407 408 409 } 410 408 411 void Map::Zoom(const Vector2& value) 409 412 { -
code/trunk/src/orxonox/overlays/map/Map.h
- Property svn:eol-style set to native
r3087 r3089 62 62 63 63 static Ogre::MaterialPtr createRenderCamera(Ogre::Camera * cam, std::string matName); 64 64 65 65 static void openMap(); 66 66 … … 92 92 93 93 94 94 95 95 private: // functions 96 96 … … 118 118 int mouseLookSpeed_; 119 119 bool isVisible_; 120 120 121 121 friend class RadarViewable; 122 122 }; -
code/trunk/src/orxonox/tools/CMakeLists.txt
r2896 r3089 8 8 Timer.cc 9 9 WindowEventListener.cc 10 DynamicLines.cpp 11 DynamicRenderable.cpp 10 12 ) -
code/trunk/src/orxonox/tools/DynamicLines.cpp
- Property svn:eol-style set to native
r3087 r3089 6 6 using namespace Ogre; 7 7 8 namespace orxonox 9 { 8 10 enum { 9 11 POSITION_BINDING, … … 81 83 prepareHardwareBuffers(size,0); 82 84 83 if (!size) { 85 if (!size) { 84 86 mBox.setExtents(Vector3::ZERO,Vector3::ZERO); 85 87 mDirty=false; 86 88 return; 87 89 } 88 90 89 91 Vector3 vaabMin = mPoints[0]; 90 92 Vector3 vaabMax = mPoints[0]; … … 141 143 } 142 144 */ 145 } -
code/trunk/src/orxonox/tools/DynamicLines.h
- Property svn:eol-style set to native
r3087 r3089 5 5 #include <vector> 6 6 7 7 namespace orxonox 8 { 8 9 class DynamicLines : public DynamicRenderable 9 10 { … … 36 37 void clear(); 37 38 38 /// Call this to update the hardware buffer after making changes. 39 /// Call this to update the hardware buffer after making changes. 39 40 void update(); 40 41 41 42 /** Set the type of operation to draw with. 42 * @param opType Can be one of 43 * @param opType Can be one of 43 44 * - RenderOperation::OT_LINE_STRIP 44 45 * - RenderOperation::OT_LINE_LIST … … 62 63 bool mDirty; 63 64 }; 64 65 } 65 66 66 67 #endif -
code/trunk/src/orxonox/tools/DynamicRenderable.cpp
- Property svn:eol-style set to native
r3087 r3089 5 5 using namespace Ogre; 6 6 7 namespace orxonox 8 { 7 9 DynamicRenderable::DynamicRenderable() 8 10 { … … 33 35 } 34 36 35 void DynamicRenderable::prepareHardwareBuffers(size_t vertexCount, 37 void DynamicRenderable::prepareHardwareBuffers(size_t vertexCount, 36 38 size_t indexCount) 37 39 { … … 57 59 newVertCapacity >>= 1; 58 60 } 59 if (newVertCapacity != mVertexBufferCapacity) 61 if (newVertCapacity != mVertexBufferCapacity) 60 62 { 61 63 mVertexBufferCapacity = newVertCapacity; … … 94 96 95 97 } 96 else if (indexCount < newIndexCapacity>>1) 98 else if (indexCount < newIndexCapacity>>1) 97 99 { 98 100 // Make capacity the previous power of two … … 132 134 return vDist.squaredLength(); 133 135 } 136 } -
code/trunk/src/orxonox/tools/DynamicRenderable.h
- Property svn:eol-style set to native
r3087 r3089 4 4 #include <OgreSimpleRenderable.h> 5 5 6 namespace orxonox 7 { 6 8 /// Abstract base class providing mechanisms for dynamically growing hardware buffers. 7 9 class DynamicRenderable : public Ogre::SimpleRenderable … … 66 68 virtual void fillHardwareBuffers() = 0; 67 69 }; 70 } 68 71 69 72 #endif // DYNAMIC_RENDERABLE_H -
code/trunk/src/util/CMakeLists.txt
r2855 r3089 38 38 UtilPrereqs.h 39 39 mbool.h 40 40 41 41 Clipboard.cc 42 42 CRC32.cc -
code/trunk/src/util/SubString.cc
r2171 r3089 39 39 40 40 #include "SubString.h" 41 #include <stdio.h> 41 42 42 43 namespace orxonox
Note: See TracChangeset
for help on using the changeset viewer.