Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Oct 12, 2008, 7:40:47 PM (16 years ago)
Author:
scheusso
Message:

merged network branch back to trunk

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/trunk/src/orxonox/objects/Backlight.cc

    r1755 r1907  
    5353        this->traillength_ = 1;
    5454
    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);
    5663
    57         this->billboard_.setBillboardSet("Flares/backlightflare");
    58         this->attachObject(this->billboard_.getBillboardSet());
     64      this->billboard_.setBillboardSet("Flares/backlightflare");
     65      this->attachObject(this->billboard_.getBillboardSet());
    5966
    60         this->ribbonTrail_ = GraphicsEngine::getInstance().getLevelSceneManager()->createRibbonTrail(this->getName() + "RibbonTrail");
    61         this->ribbonTrailNode_ = GraphicsEngine::getInstance().getLevelSceneManager()->getRootSceneNode()->createChildSceneNode(this->getName() + "RibbonTrailNode");
    62         this->ribbonTrailNode_->attachObject(this->ribbonTrail_);
    63         this->ribbonTrail_->addNode(this->getNode());
     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());
    6471
    65         this->configure(maxspeed, brakingtime, scale);
    6672
    67         this->ribbonTrail_->setTrailLength(this->maxTraillength_);
    68         this->ribbonTrail_->setMaterialName("Trail/backlighttrail");
     73      this->ribbonTrail_->setTrailLength(this->maxTraillength_);
     74      this->ribbonTrail_->setMaterialName("Trail/backlighttrail");
    6975
    7076        //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;
    7284    }
    7385
     
    100112    {
    101113        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();
    102121    }
    103122
     
    136155        this->maxTraillength_ = this->maxLifeTime_ * maxspeed;
    137156        this->maxTrailsegments_ = (size_t)(this->maxTraillength_ / this->trailSegmentLength_);
    138         this->ribbonTrail_->setMaxChainElements(this->maxTrailsegments_);
    139         this->ribbonTrail_->setTrailLength(this->traillength_ = 2 * this->maxTrailsegments_);
    140157
    141158        this->brakefactor_ = this->maxLifeTime_ / brakingtime;
    142159
    143160        this->scale(scale);
    144         this->ribbonTrail_->setInitialWidth(0, this->width_ * scale);
    145         this->ribbonTrail_->setWidthChange(0, this->width_ * scale / this->maxLifeTime_ * Backlight::timeFactor_s);
    146161    }
    147162
Note: See TracChangeset for help on using the changeset viewer.