Changeset 3090
- Timestamp:
- May 27, 2009, 5:23:51 PM (16 years ago)
- Location:
- code/branches/map/src/orxonox
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/map/src/orxonox/objects/RadarViewable.cc
r2977 r3090 69 69 RadarViewable::~RadarViewable() 70 70 { 71 if(this->isHumanShip_) 72 MapNode_->removeAllChildren(); 71 73 delete MapNode_; 72 MapNode_=0;73 74 delete MapEntity_; 74 MapEntity_=0;75 75 delete line_; 76 line_=0;77 76 delete LineNode_; 78 LineNode_=0;79 77 } 80 78 -
code/branches/map/src/orxonox/objects/RadarViewable.h
r2956 r3090 109 109 return this->uniqueId_; 110 110 } 111 //friend class Map; 111 112 112 113 private: -
code/branches/map/src/orxonox/overlays/map/Map.cc
r3082 r3090 69 69 Map* Map::singletonMap_s = 0; 70 70 Ogre::SceneManager* Map::mapSceneM_s = 0; 71 Ogre::Camera* Map::Cam_ = 0; 72 Ogre::SceneNode* Map::CamNode_ = 0; 73 Ogre::MaterialPtr Map::OverlayMaterial_;// = init(); 74 Ogre::Overlay* Map::overlay_ = 0; 75 /* 76 Ogre::MaterialPtr Map::init() 77 { 78 Ogre::MaterialPtr tmp; 79 tmp.setNull(); 80 return tmp; 81 } 82 */ 83 71 84 //int Map::mouseLookSpeed_ = 200; 72 85 //Ogre::SceneNode* Map::playerShipNode_ = 0; … … 116 129 // Alter the camera aspect ratio to match the viewport 117 130 //mCamera->setAspectRatio(Real(vp->getActualWidth()) / Real(vp->getActualHeight())); 118 Cam_ = Map::getMapSceneManager()->createCamera("ReflectCam"); 131 if(!Map::Cam_) 132 Cam_ = Map::getMapSceneManager()->createCamera("ReflectCam"); 119 133 //Cam_->setPosition(200,170, -160); 120 134 //Cam_->lookAt(0,0,0); 121 135 Cam_->setAspectRatio(1); 122 136 //Cam_->setRenderingDistance(0); 123 CamNode_ = Map::getMapSceneManager()->getRootSceneNode()->createChildSceneNode(); 137 if(!Map::CamNode_) 138 CamNode_ = Map::getMapSceneManager()->getRootSceneNode()->createChildSceneNode(); 124 139 125 140 126 141 //Create overlay material 127 std::string camMat_id = "RttMat";128 Ogre::MaterialPtr material = this->createRenderCamera(Cam_, camMat_id);142 if(Map::OverlayMaterial_.isNull()) 143 Map::OverlayMaterial_ = this->createRenderCamera(Cam_, "RttMat"); 129 144 /* 130 145 Ogre::TexturePtr rttTex = Ogre::TextureManager::getSingleton().createManual("RttTex", Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, Ogre::TEX_TYPE_2D, 512, 512, 0, Ogre::PF_R8G8B8, Ogre::TU_RENDERTARGET); … … 159 174 pOverlay->show(); 160 175 */ 161 this->overlay_ = Ogre::OverlayManager::getSingletonPtr()->create("MapOverlay"); 162 Ogre::OverlayContainer* m_pOverlayPanel = static_cast<Ogre::OverlayContainer*>(Ogre::OverlayManager::getSingleton().createOverlayElement("Panel","OverlayPanelName%d")); 163 m_pOverlayPanel->setMetricsMode(Ogre::GMM_PIXELS); 164 m_pOverlayPanel->setPosition(10, 10); 165 m_pOverlayPanel->setDimensions(600, 400); 166 // Give overlay a texture 167 m_pOverlayPanel->setMaterialName(camMat_id); 168 overlay_->add2D(m_pOverlayPanel); 169 170 //Add Borders 171 Ogre::BorderPanelOverlayElement* oBorder = static_cast<Ogre::BorderPanelOverlayElement*>(Ogre::OverlayManager::getSingletonPtr()->createOverlayElement("BorderPanel", "MapBorderPanel" + getUniqueNumberString())); 172 /* 173 //TODO border size 174 oBorder->setBorderSize( 0.003, 16 * 0.003 ); 175 oBorder->setBorderMaterialName("StatsBorder"); 176 oBorder->setTopBorderUV(0.49, 0.0, 0.51, 0.5); 177 oBorder->setTopLeftBorderUV(0.0, 0.0, 0.5, 0.5); 178 oBorder->setTopRightBorderUV(0.5, 0.0, 1.0, 0.5); 179 oBorder->setLeftBorderUV(0.0, 0.49, 0.5, 0.51); 180 oBorder->setRightBorderUV(0.5, 0.49, 1.0, 0.5); 181 oBorder->setBottomBorderUV(0.49, 0.5, 0.51, 1.0); 182 oBorder->setBottomLeftBorderUV(0.0, 0.5, 0.5, 1.0); 183 oBorder->setBottomRightBorderUV(0.5, 0.5, 1.0, 1.0); 184 overlay_->add2D(oBorder); 185 */ 176 if(!this->overlay_) 177 { 178 this->overlay_ = Ogre::OverlayManager::getSingletonPtr()->create("MapOverlay"); 179 Ogre::OverlayContainer* m_pOverlayPanel = static_cast<Ogre::OverlayContainer*>(Ogre::OverlayManager::getSingleton().createOverlayElement("Panel","OverlayPanelName%d")); 180 //m_pOverlayPanel->setMetricsMode(Ogre::GMM_PIXELS); 181 //m_pOverlayPanel->setPosition(10, 10); 182 //m_pOverlayPanel->setDimensions(600, 400); 183 m_pOverlayPanel->setPosition(0.01, 0.003); 184 m_pOverlayPanel->setDimensions(0.5, 0.4); 185 // Give overlay a texture 186 m_pOverlayPanel->setMaterialName("RttMat"); 187 overlay_->add2D(m_pOverlayPanel); 188 189 //Add Borders 190 Ogre::BorderPanelOverlayElement* oBorder = static_cast<Ogre::BorderPanelOverlayElement*>(Ogre::OverlayManager::getSingletonPtr()->createOverlayElement("BorderPanel", "MapBorderPanel" + getUniqueNumberString())); 191 oBorder->setBorderSize( 0.003, 0.003 ); 192 oBorder->setDimensions(0.5, 0.4); 193 oBorder->setBorderMaterialName("StatsBorder"); 194 oBorder->setTopBorderUV(0.49, 0.0, 0.51, 0.5); 195 oBorder->setTopLeftBorderUV(0.0, 0.0, 0.5, 0.5); 196 oBorder->setTopRightBorderUV(0.5, 0.0, 1.0, 0.5); 197 oBorder->setLeftBorderUV(0.0, 0.49, 0.5, 0.51); 198 oBorder->setRightBorderUV(0.5, 0.49, 1.0, 0.5); 199 oBorder->setBottomBorderUV(0.49, 0.5, 0.51, 1.0); 200 oBorder->setBottomLeftBorderUV(0.0, 0.5, 0.5, 1.0); 201 oBorder->setBottomRightBorderUV(0.5, 0.5, 1.0, 1.0); 202 //overlay_->add2D(oBorder); 203 m_pOverlayPanel->addChild(oBorder); 204 } 205 186 206 187 207 //Not Showing the map as default … … 189 209 overlay_->hide(); 190 210 191 //Create plane to show grid 192 Ogre::Entity* plane_ent = Map::getMapSceneManager()->createEntity( "MapPlane", "plane.mesh"); 193 planeNode_ = Map::getMapSceneManager()->getRootSceneNode()->createChildSceneNode(); 211 //Create plane to show gridTypeError: blimport() takes no keyword arguments 212 /* Ogre::Entity* plane_ent; 213 if(Map::getMapSceneManager()->hasEntity("MapPlane")) 214 plane_ent = Map::getMapSceneManager()->getEntity("MapPlane"); 215 else 216 plane_ent = Map::getMapSceneManager()->createEntity( "MapPlane", "plane.mesh"); 217 */ 218 this->movablePlane_ = new Ogre::MovablePlane( Vector3::UNIT_Y, 0 ); 219 this->movablePlane_->normalise(); 220 221 if(!Map::getMapSceneManager()->hasEntity("MapPlane")) 222 { 223 Ogre::Entity* plane_ent = Map::getMapSceneManager()->createEntity( "MapPlane", "plane.mesh"); 224 planeNode_ = Map::getMapSceneManager()->createSceneNode(); 194 225 //Create plane for calculations 195 movablePlane_ = new Ogre::MovablePlane( Vector3::UNIT_Y, 0 ); 196 movablePlane_->normalise(); 226 197 227 198 228 //Ogre::MaterialPtr plane_mat = Ogre::MaterialManager::getSingleton().create("mapgrid", "General"); 199 229 //plane_mat->getTechnique(0)->getPass(0)->createTextureUnitState("mapgrid.tga"); 200 230 //plane_ent->setMaterialName("mapgrid"); 201 plane_ent->setMaterialName("Map/Grid");202 planeNode_->attachObject(plane_ent);203 204 planeNode_->scale(10,1,10);231 plane_ent->setMaterialName("Map/Grid"); 232 planeNode_->attachObject(plane_ent); 233 234 planeNode_->scale(160,1,160); 205 235 // planeNode_->attachObject(movablePlane_); 206 236 //Ogre::Material plane_mat = Ogre::MaterialManager::getSingletonPtr()->getByName("rock"); … … 208 238 209 239 //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);215 myManualObjectMaterial->getTechnique(0)->getPass(0)->setSelfIllumination(1,1,0);216 240 Ogre::MaterialPtr myManualObjectMaterial = Ogre::MaterialManager::getSingleton().create("Map/Line","General"); 241 myManualObjectMaterial->setReceiveShadows(false); 242 myManualObjectMaterial->getTechnique(0)->setLightingEnabled(true); 243 myManualObjectMaterial->getTechnique(0)->getPass(0)->setDiffuse(1,1,0,0); 244 myManualObjectMaterial->getTechnique(0)->getPass(0)->setAmbient(1,1,0); 245 myManualObjectMaterial->getTechnique(0)->getPass(0)->setSelfIllumination(1,1,0); 246 } 217 247 } 218 248 … … 220 250 { 221 251 this->singletonMap_s = 0; 252 //delete this->overlay_; 222 253 /*if (this->isInitialized()) 223 254 { … … 286 317 { 287 318 this->playerShipNode_ = it->MapNode_; 288 this->planeNode_->getParent()->removeChild(this->planeNode_); 319 if(planeNode_ && this->planeNode_->getParent()) 320 this->planeNode_->getParent()->removeChild(this->planeNode_); 289 321 this->playerShipNode_->addChild(this->planeNode_); 290 322 //Movable Plane needs to be attached direcly for calculations … … 293 325 //this->movablePlane_->redefine(it->MapNode_->getLocalAxes().GetColumn(1) , it->MapNode_->getPosition()); 294 326 //it->MapNode_->attachObject(this->movablePlane_); 295 296 this->CamNode_->getParent()->removeChild(this->CamNode_);327 if(planeNode_ && this->CamNode_->getParent()) 328 this->CamNode_->getParent()->removeChild(this->CamNode_); 297 329 this->playerShipNode_->addChild(this->CamNode_); 298 330 this->CamNode_->attachObject(this->Cam_); -
code/branches/map/src/orxonox/overlays/map/Map.h
r2977 r3090 102 102 Map::mapSceneM_s = sm; 103 103 } 104 //static Ogre::MaterialPtr init(); 104 105 105 106 private: // variables … … 110 111 111 112 static Ogre::SceneManager* mapSceneM_s; 112 Ogre::SceneNode* CamNode_; 113 Ogre::Camera* Cam_; 113 static Ogre::SceneNode* CamNode_; 114 static Ogre::Camera* Cam_; 115 static Ogre::MaterialPtr OverlayMaterial_; 116 static Ogre::Overlay* overlay_; 114 117 //Ogre::SceneNode* CamNodeHelper_; 115 118 Ogre::SceneNode* playerShipNode_;
Note: See TracChangeset
for help on using the changeset viewer.