- Timestamp:
- Dec 10, 2008, 3:37:48 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/objecthierarchy2/src/orxonox/overlays/hud/HUDBar.cc
r2087 r2369 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->setValue(0.0f); 87 this->setRightToLeft(false); 88 this->setAutoColour(true); 89 this->currentColour_ = ColourValue::White; 89 90 90 91 this->background_->addChild(bar_); … … 101 102 SUPER(HUDBar, XMLPort, xmlElement, mode); 102 103 103 XMLPortParam(HUDBar, "initialValue", setValue, getValue, xmlElement, mode); 104 XMLPortParam(HUDBar, "rightToLeft", setRightToLeft, getRightToLeft, xmlElement, mode); 105 XMLPortParam(HUDBar, "autoColour", setAutoColour, getAutoColour, xmlElement, mode); 104 XMLPortParam(HUDBar, "initialvalue", setValue, getValue, xmlElement, mode); 105 XMLPortParam(HUDBar, "righttoleft", setRightToLeft, getRightToLeft, xmlElement, mode); 106 XMLPortParam(HUDBar, "autocolour", setAutoColour, getAutoColour, xmlElement, mode); 107 XMLPortParam(HUDBar, "bartexture", setBarTexture, getBarTexture, xmlElement, mode); 106 108 XMLPortObject(HUDBar, BarColour, "", addColour, getColour, xmlElement, mode); 107 109 } … … 130 132 { 131 133 this->textureUnitState_->setColourOperationEx(Ogre::LBX_MODULATE, Ogre::LBS_MANUAL, Ogre::LBS_CURRENT, colour2); 134 this->currentColour_ = colour2; 132 135 } 133 136 else if (value1 < this->value_) 134 137 { 135 138 this->textureUnitState_->setColourOperationEx(Ogre::LBX_MODULATE, Ogre::LBS_MANUAL, Ogre::LBS_CURRENT, colour1); 139 this->currentColour_ = colour1; 136 140 } 137 141 else … … 139 143 //float interpolationfactor = (this->value_ - value2) / (value1 - value2); 140 144 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)); 145 this->currentColour_ = colour1 * interpolationfactor + colour2 * (1 - interpolationfactor); 146 this->textureUnitState_->setColourOperationEx(Ogre::LBX_MODULATE, Ogre::LBS_MANUAL, Ogre::LBS_CURRENT, this->currentColour_); 147 142 148 } 143 149 } … … 181 187 this->colours_.clear(); 182 188 } 189 190 void HUDBar::setBarTexture(const std::string& texture) 191 { 192 this->textureUnitState_->setTextureName(texture); 193 } 194 195 const std::string& HUDBar::getBarTexture() const 196 { 197 return this->textureUnitState_->getTextureName(); 198 } 183 199 }
Note: See TracChangeset
for help on using the changeset viewer.