Changeset 1590 for code/branches/hud/src/orxonox/hud/HUDBar.cc
- Timestamp:
- Jun 12, 2008, 12:57:45 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/hud/src/orxonox/hud/HUDBar.cc
r1588 r1590 75 75 HUDOverlay::XMLPort(xmlElement, mode); 76 76 77 // create background 78 this->background_ = static_cast<PanelOverlayElement*>( 79 OverlayManager::getSingleton().createOverlayElement("Panel", getName() + "_Background")); 80 this->background_->setMaterialName("Orxonox/BarBackground"); 81 this->background_->setMetricsMode(GMM_RELATIVE); 82 this->background_->setDimensions(1.0f, 0.3f); 83 this->background_->setPosition(0.0f, 0.0f); 84 this->overlay_->add2D(this->background_); 77 if (mode == XMLPort::LoadObject) 78 { 79 // create background 80 this->background_ = static_cast<PanelOverlayElement*>( 81 OverlayManager::getSingleton().createOverlayElement("Panel", getName() + "_Background")); 82 this->background_->setMaterialName("Orxonox/BarBackground"); 83 this->background_->setMetricsMode(GMM_RELATIVE); 84 this->background_->setDimensions(1.0f, 0.3f); 85 this->background_->setPosition(0.0f, 0.0f); 86 this->overlay_->add2D(this->background_); 85 87 86 // create new material87 std::string materialname = "barmaterial" + getConvertedValue<unsigned int, std::string>(materialcount_s++);88 Ogre::MaterialPtr material = (Ogre::MaterialPtr)Ogre::MaterialManager::getSingleton().create(materialname, "General");89 material->getTechnique(0)->getPass(0)->setSceneBlending(Ogre::SBT_TRANSPARENT_ALPHA);90 this->textureUnitState_ = material->getTechnique(0)->getPass(0)->createTextureUnitState();91 this->textureUnitState_->setTextureName("bar2.tga");92 // use the default colour93 this->textureUnitState_->setColourOperationEx(Ogre::LBX_MODULATE, Ogre::LBS_MANUAL, Ogre::LBS_CURRENT, ColourValue(0.2, 0.7, 0.2));88 // create new material 89 std::string materialname = "barmaterial" + getConvertedValue<unsigned int, std::string>(materialcount_s++); 90 Ogre::MaterialPtr material = (Ogre::MaterialPtr)Ogre::MaterialManager::getSingleton().create(materialname, "General"); 91 material->getTechnique(0)->getPass(0)->setSceneBlending(Ogre::SBT_TRANSPARENT_ALPHA); 92 this->textureUnitState_ = material->getTechnique(0)->getPass(0)->createTextureUnitState(); 93 this->textureUnitState_->setTextureName("bar2.tga"); 94 // use the default colour 95 this->textureUnitState_->setColourOperationEx(Ogre::LBX_MODULATE, Ogre::LBS_MANUAL, Ogre::LBS_CURRENT, ColourValue(0.2, 0.7, 0.2)); 94 96 95 // create bar 96 this->bar_ = static_cast<PanelOverlayElement*>(OverlayManager::getSingleton().createOverlayElement("Panel", getName() + "Bar")); 97 this->bar_->setMaterialName(materialname); 98 this->bar_->setMetricsMode(GMM_RELATIVE); 99 this->background_->addChild(bar_); 97 // create bar 98 this->bar_ = static_cast<PanelOverlayElement*>(OverlayManager::getSingleton().createOverlayElement("Panel", getName() + "Bar")); 99 this->bar_->setMaterialName(materialname); 100 this->bar_->setMetricsMode(GMM_RELATIVE); 101 this->background_->addChild(bar_); 102 } 100 103 101 104 XMLPortParamLoadOnly(HUDBar, "value", setValue, xmlElement, mode); 102 105 103 this->addColour(0.7, ColourValue(0.2, 0.7, 0.2)); 104 this->addColour(0.4, ColourValue(0.7, 0.5, 0.2)); 105 this->addColour(0.1, ColourValue(0.7, 0.2, 0.2)); 106 if (mode == XMLPort::LoadObject) 107 { 108 this->addColour(0.7, ColourValue(0.2, 0.7, 0.2)); 109 this->addColour(0.4, ColourValue(0.7, 0.5, 0.2)); 110 this->addColour(0.1, ColourValue(0.7, 0.2, 0.2)); 111 } 106 112 } 107 113
Note: See TracChangeset
for help on using the changeset viewer.