Changeset 6417 for code/trunk/src/orxonox/overlays/OrxonoxOverlay.cc
- Timestamp:
- Dec 25, 2009, 10:23:58 PM (14 years ago)
- Location:
- code/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk
- Property svn:mergeinfo changed
-
code/trunk/src/orxonox/overlays/OrxonoxOverlay.cc
r6057 r6417 39 39 #include <OgrePanelOverlayElement.h> 40 40 #include <OgreRenderWindow.h> 41 #include <OgreMaterialManager.h> 42 #include <OgreTechnique.h> 43 #include <OgrePass.h> 41 44 42 45 #include "util/Convert.h" 43 46 #include "util/Exception.h" 44 #include "util/StringUtils.h"45 47 #include "core/GameMode.h" 46 48 #include "core/CoreIncludes.h" … … 83 85 // Get aspect ratio from the render window. Later on, we get informed automatically 84 86 this->windowAspectRatio_ = static_cast<float>(this->getWindowWidth()) / this->getWindowHeight(); 85 this->sizeCorrectionChanged(); 86 87 this-> changedVisibility();88 89 setSize(Vector2(1.0f, 1.0f));90 setPickPoint(Vector2(0.0f, 0.0f));91 setPosition(Vector2(0.0f, 0.0f));92 setRotation(Degree(0.0));93 setAspectCorrection(false); 87 88 this->size_ = Vector2(1.0f, 1.0f); 89 this->pickPoint_= Vector2(0.0f, 0.0f); 90 this->position_ = Vector2(0.0f, 0.0f); 91 this->angle_ = Degree(0.0); 92 this->bCorrectAspect_ = false; 93 this->rotState_ = Horizontal; 94 this->angleChanged(); // updates all other values as well 95 94 96 setBackgroundMaterial(""); 95 97 } … … 143 145 144 146 if (OrxonoxOverlay::overlays_s.find(this->getName()) != OrxonoxOverlay::overlays_s.end()) 145 COUT(1) << "Overlay names should be unique or you cannnot access them via console. Name: \"" << this->getName() << "\""<< std::endl;147 COUT(1) << "Overlay names should be unique or you cannnot access them via console. Name: \"" << this->getName() << '"' << std::endl; 146 148 147 149 OrxonoxOverlay::overlays_s[this->getName()] = this; … … 151 153 void OrxonoxOverlay::setBackgroundMaterial(const std::string& material) 152 154 { 153 if (this->background_ && material != "")155 if (this->background_ && !material.empty()) 154 156 this->background_->setMaterialName(material); 155 157 } … … 168 170 { 169 171 SUPER( OrxonoxOverlay, changedVisibility ); 170 172 171 173 if (!this->overlay_) 172 174 return; … … 309 311 std::map<std::string, OrxonoxOverlay*>::const_iterator it = overlays_s.find(name); 310 312 if (it != overlays_s.end()) 311 (*it).second->scale(Vector2(scale, scale));313 it->second->scale(Vector2(scale, scale)); 312 314 } 313 315 … … 324 326 if (it != overlays_s.end()) 325 327 { 326 OrxonoxOverlay* overlay= (*it).second;328 OrxonoxOverlay* overlay= it->second; 327 329 if(overlay->isVisible()) 328 330 overlay->hide(); … … 343 345 std::map<std::string, OrxonoxOverlay*>::const_iterator it = overlays_s.find(name); 344 346 if (it != overlays_s.end()) 345 (*it).second->scroll(scroll);347 it->second->scroll(scroll); 346 348 } 347 349 … … 357 359 std::map<std::string, OrxonoxOverlay*>::const_iterator it = overlays_s.find(name); 358 360 if (it != overlays_s.end()) 359 (*it).second->rotate(angle);361 it->second->rotate(angle); 360 362 } 361 363 … … 370 372 } 371 373 } 374 375 void OrxonoxOverlay::setBackgroundAlpha(float alpha) { 376 Ogre::MaterialPtr ptr = this->background_->getMaterial(); 377 Ogre::TextureUnitState* tempTx = ptr->getTechnique(0)->getPass(0)->getTextureUnitState(0); 378 tempTx->setAlphaOperation(Ogre::LBX_MODULATE, Ogre::LBS_MANUAL, Ogre::LBS_CURRENT, alpha); 379 } 372 380 }
Note: See TracChangeset
for help on using the changeset viewer.