Changeset 2662 for code/trunk/src/orxonox/overlays/hud/HUDBar.cc
- Timestamp:
- Feb 14, 2009, 10:17:35 PM (15 years ago)
- Location:
- code/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk
- Property svn:mergeinfo changed
-
code/trunk/src/orxonox/overlays/hud/HUDBar.cc
r2087 r2662 51 51 RegisterObject(BarColour); 52 52 53 setColour(ColourValue(1.0, 1.0, 1.0, 1.0));54 setPosition(0.0);53 this->setColour(ColourValue(1.0, 1.0, 1.0, 1.0)); 54 this->setPosition(0.0); 55 55 } 56 56 … … 84 84 this->bar_->setMaterialName(materialname); 85 85 86 setValue(0.4567654f); 87 setRightToLeft(false); 88 setAutoColour(true); 86 this->value_ = 1.0f; // initielize with 1.0f to trigger a change when calling setValue(0.0f) on the line below 87 this->setValue(0.0f); // <-- 88 this->setRightToLeft(false); 89 this->setAutoColour(true); 90 this->currentColour_ = ColourValue::White; 89 91 90 92 this->background_->addChild(bar_); … … 101 103 SUPER(HUDBar, XMLPort, xmlElement, mode); 102 104 103 XMLPortParam(HUDBar, "initialValue", setValue, getValue, xmlElement, mode); 104 XMLPortParam(HUDBar, "rightToLeft", setRightToLeft, getRightToLeft, xmlElement, mode); 105 XMLPortParam(HUDBar, "autoColour", setAutoColour, getAutoColour, xmlElement, mode); 105 XMLPortParam(HUDBar, "initialvalue", setValue, getValue, xmlElement, mode); 106 XMLPortParam(HUDBar, "righttoleft", setRightToLeft, getRightToLeft, xmlElement, mode); 107 XMLPortParam(HUDBar, "autocolour", setAutoColour, getAutoColour, xmlElement, mode); 108 XMLPortParam(HUDBar, "bartexture", setBarTexture, getBarTexture, xmlElement, mode); 106 109 XMLPortObject(HUDBar, BarColour, "", addColour, getColour, xmlElement, mode); 107 110 } … … 130 133 { 131 134 this->textureUnitState_->setColourOperationEx(Ogre::LBX_MODULATE, Ogre::LBS_MANUAL, Ogre::LBS_CURRENT, colour2); 135 this->currentColour_ = colour2; 132 136 } 133 137 else if (value1 < this->value_) 134 138 { 135 139 this->textureUnitState_->setColourOperationEx(Ogre::LBX_MODULATE, Ogre::LBS_MANUAL, Ogre::LBS_CURRENT, colour1); 140 this->currentColour_ = colour1; 136 141 } 137 142 else … … 139 144 //float interpolationfactor = (this->value_ - value2) / (value1 - value2); 140 145 float interpolationfactor = interpolateSmooth((this->value_ - value2) / (value1 - value2), 0.0f, 1.0f); 141 this->textureUnitState_->setColourOperationEx(Ogre::LBX_MODULATE, Ogre::LBS_MANUAL, Ogre::LBS_CURRENT, colour1 * interpolationfactor + colour2 * (1 - interpolationfactor)); 146 this->currentColour_ = colour1 * interpolationfactor + colour2 * (1 - interpolationfactor); 147 this->textureUnitState_->setColourOperationEx(Ogre::LBX_MODULATE, Ogre::LBS_MANUAL, Ogre::LBS_CURRENT, this->currentColour_); 148 142 149 } 143 150 } … … 181 188 this->colours_.clear(); 182 189 } 190 191 void HUDBar::setBarTexture(const std::string& texture) 192 { 193 this->textureUnitState_->setTextureName(texture); 194 } 195 196 const std::string& HUDBar::getBarTexture() const 197 { 198 return this->textureUnitState_->getTextureName(); 199 } 183 200 }
Note: See TracChangeset
for help on using the changeset viewer.