Changeset 3082
- Timestamp:
- May 26, 2009, 7:29:40 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/map/src/orxonox/overlays/map/Map.cc
r2977 r3082 66 66 SetConsoleCommand(Map, Zoom, true).setAsInputCommand(); 67 67 68 68 69 Map* Map::singletonMap_s = 0; 69 70 Ogre::SceneManager* Map::mapSceneM_s = 0; … … 158 159 pOverlay->show(); 159 160 */ 160 overlay_ = Ogre::OverlayManager::getSingleton().create("MapOverlay");161 this->overlay_ = Ogre::OverlayManager::getSingletonPtr()->create("MapOverlay"); 161 162 Ogre::OverlayContainer* m_pOverlayPanel = static_cast<Ogre::OverlayContainer*>(Ogre::OverlayManager::getSingleton().createOverlayElement("Panel","OverlayPanelName%d")); 162 163 m_pOverlayPanel->setMetricsMode(Ogre::GMM_PIXELS); 163 164 m_pOverlayPanel->setPosition(10, 10); 164 m_pOverlayPanel->setDimensions( 500, 300);165 m_pOverlayPanel->setDimensions(600, 400); 165 166 // Give overlay a texture 166 167 m_pOverlayPanel->setMaterialName(camMat_id); 167 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 */ 186 168 187 //Not Showing the map as default 169 188 this->isVisible_=false; … … 184 203 185 204 planeNode_->scale(10,1,10); 186 planeNode_->attachObject(movablePlane_);205 // planeNode_->attachObject(movablePlane_); 187 206 //Ogre::Material plane_mat = Ogre::MaterialManager::getSingletonPtr()->getByName("rock"); 188 207 … … 261 280 it->addMapEntity(); 262 281 } 263 282 if(it->isHumanShip_) 283 { 284 this->movablePlane_->redefine(it->MapNode_->getLocalAxes().GetColumn(1) , it->MapNode_->getPosition()); 285 if(it->isHumanShip_ && it->MapNode_ != this->playerShipNode_) 286 { 287 this->playerShipNode_ = it->MapNode_; 288 this->planeNode_->getParent()->removeChild(this->planeNode_); 289 this->playerShipNode_->addChild(this->planeNode_); 290 //Movable Plane needs to be attached direcly for calculations 291 //this->movablePlane_->detatchFromParent(); 292 //this->movablePlane_->getParentSceneNode()->detachObject(this->movablePlane_); 293 //this->movablePlane_->redefine(it->MapNode_->getLocalAxes().GetColumn(1) , it->MapNode_->getPosition()); 294 //it->MapNode_->attachObject(this->movablePlane_); 295 296 this->CamNode_->getParent()->removeChild(this->CamNode_); 297 this->playerShipNode_->addChild(this->CamNode_); 298 this->CamNode_->attachObject(this->Cam_); 299 //this->CamNodeHelper_ = this->CamNode_->createChildSceneNode(); 300 //this->CamNodeHelper_->attachObject(this->Cam_); 301 this->Cam_->setPosition(0, 0, DISTANCE); 302 this->Cam_->pitch( (Degree)PITCH ); 303 this->Cam_->lookAt(Vector3(0,0,0)); 304 //this->Cam_->setAutoTracking(true, this->playerShipNode_); 305 } 306 } 264 307 it->updateMapPosition(); 265 308 266 309 267 310 268 if(it->isHumanShip_ && it->MapNode_ != this->playerShipNode_) 269 { 270 this->playerShipNode_ = it->MapNode_; 271 this->planeNode_->getParent()->removeChild(this->planeNode_); 272 this->playerShipNode_->addChild(this->planeNode_); 273 this->CamNode_->getParent()->removeChild(this->CamNode_); 274 this->playerShipNode_->addChild(this->CamNode_); 275 this->CamNode_->attachObject(this->Cam_); 276 //this->CamNodeHelper_ = this->CamNode_->createChildSceneNode(); 277 //this->CamNodeHelper_->attachObject(this->Cam_); 278 this->Cam_->setPosition(0, 0, DISTANCE); 279 this->Cam_->pitch( (Degree)PITCH ); 280 this->Cam_->lookAt(Vector3(0,0,0)); 281 //this->Cam_->setAutoTracking(true, this->playerShipNode_); 282 } 311 283 312 284 313 … … 339 368 void Map::tick(float dt) 340 369 { 341 //sNode_->lookAt(Vector3::NEGATIVE_UNIT_Z, Ogre::Node::TS_WORLD, Vector3::NEGATIVE_UNIT_Z); 370 //Debug 371 //COUT(0) << "MovablePlane Position: " << this->movablePlane_->getParentSceneNode()->getName() << this->movablePlane_->getParentSceneNode()->getPosition() << std::endl; 372 //COUT(0) << "planeNode_ Position: " << this->planeNode_ ->getName() << this->planeNode_->getPosition() << std::endl; 373 //COUT(0) << "planeNode_ Parrent Position" << this->planeNode_->getParent()->getName() << this->planeNode_->getParent()->getPosition() << std::endl; 342 374 if( this->isVisible_ ) 343 375 updatePositions();
Note: See TracChangeset
for help on using the changeset viewer.