Changeset 1907 for code/trunk/src/orxonox/objects/Backlight.cc
- Timestamp:
- Oct 12, 2008, 7:40:47 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk/src/orxonox/objects/Backlight.cc
r1755 r1907 53 53 this->traillength_ = 1; 54 54 55 this->getNode()->setInheritScale(false); 55 this->configure(maxspeed, brakingtime, scale); 56 } 57 58 bool Backlight::create(){ 59 if(!WorldEntity::create()) 60 return false; 61 62 this->getNode()->setInheritScale(false); 56 63 57 58 64 this->billboard_.setBillboardSet("Flares/backlightflare"); 65 this->attachObject(this->billboard_.getBillboardSet()); 59 66 60 61 62 63 67 this->ribbonTrail_ = GraphicsEngine::getInstance().getLevelSceneManager()->createRibbonTrail(this->getName() + "RibbonTrail"); 68 this->ribbonTrailNode_ = GraphicsEngine::getInstance().getLevelSceneManager()->getRootSceneNode()->createChildSceneNode(this->getName() + "RibbonTrailNode"); 69 this->ribbonTrailNode_->attachObject(this->ribbonTrail_); 70 this->ribbonTrail_->addNode(this->getNode()); 64 71 65 this->configure(maxspeed, brakingtime, scale);66 72 67 68 73 this->ribbonTrail_->setTrailLength(this->maxTraillength_); 74 this->ribbonTrail_->setMaterialName("Trail/backlighttrail"); 69 75 70 76 //this->setTimeFactor(Orxonox::getInstance().getTimeFactor()); 71 this->setTimeFactor(1.0f); 77 this->setTimeFactor(1.0f); 78 79 this->ribbonTrail_->setMaxChainElements(this->maxTrailsegments_); 80 this->ribbonTrail_->setTrailLength(this->traillength_ = 2 * this->maxTrailsegments_); 81 this->ribbonTrail_->setInitialWidth(0, this->width_ * this->getScale()); 82 this->ribbonTrail_->setWidthChange(0, this->width_ * this->getScale() / this->maxLifeTime_ * Backlight::timeFactor_s); 83 return true; 72 84 } 73 85 … … 100 112 { 101 113 this->ribbonTrail_->setColourChange(0, ColourValue(0, 0, 0, this->maxTraillength_ / this->traillength_ / this->maxLifeTime_ * Backlight::timeFactor_s)); 114 } 115 116 117 void Backlight::XMLPort(Element& xmlelement, XMLPort::Mode mode){ 118 SUPER(Backlight, XMLPort, xmlelement, mode); 119 120 Backlight::create(); 102 121 } 103 122 … … 136 155 this->maxTraillength_ = this->maxLifeTime_ * maxspeed; 137 156 this->maxTrailsegments_ = (size_t)(this->maxTraillength_ / this->trailSegmentLength_); 138 this->ribbonTrail_->setMaxChainElements(this->maxTrailsegments_);139 this->ribbonTrail_->setTrailLength(this->traillength_ = 2 * this->maxTrailsegments_);140 157 141 158 this->brakefactor_ = this->maxLifeTime_ / brakingtime; 142 159 143 160 this->scale(scale); 144 this->ribbonTrail_->setInitialWidth(0, this->width_ * scale);145 this->ribbonTrail_->setWidthChange(0, this->width_ * scale / this->maxLifeTime_ * Backlight::timeFactor_s);146 161 } 147 162
Note: See TracChangeset
for help on using the changeset viewer.