Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Nov 24, 2008, 1:50:47 AM (17 years ago)
Author:
landauf
Message:

Update your media repository and delete keybindings.ini if you want to use boost (space).

  • Added new class "Engine" to control the speed of a SpaceShip (Engine is an Item, MultiStateEngine is a specialized version of Engine)
  • Added FadingBillboard, a billboard with the ability to fade in and out smoothly when activated/deactivated.
  • Several changes in Backlight, it's now a child of FadingBillboard
  • Some changes concerning local control in ControllableEntity
  • Fixed a bug in WorldEntity caused by different destruction order of attached objects on server and client
  • Added a "MainState" to BaseObject. An object has several states (activity, visibility, …) and one of it can be defined as "MainState" in the XML file. Other objects can change this state without knowing which state it really is (used by MultiStateEngine).
File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/objecthierarchy2/src/orxonox/objects/worldentities/Backlight.cc

    r2212 r2254  
    4343    CreateFactory(Backlight);
    4444
    45     Backlight::Backlight(BaseObject* creator) : Billboard(creator)
     45    Backlight::Backlight(BaseObject* creator) : FadingBillboard(creator)
    4646    {
    4747        RegisterObject(Backlight);
     
    5353        this->length_ = 1.0f;
    5454        this->lifetime_ = 0.001f;
    55         this->turnofftime_ = 0.5f;
    56         this->bTurningOff_ = false;
    5755        this->maxelements_ = 1;
    5856
     
    102100        XMLPortParam(Backlight, "elements",      setMaxElements,   getMaxElements,   xmlelement, mode).defaultValues(10);
    103101        XMLPortParam(Backlight, "lifetime",      setLifetime,      getLifetime,      xmlelement, mode).defaultValues(1.0f);
    104         XMLPortParam(Backlight, "turnofftime",   setTurnOffTime,   getTurnOffTime,   xmlelement, mode).defaultValues(0.5f);
    105102        XMLPortParam(Backlight, "trailmaterial", setTrailMaterial, getTrailMaterial, xmlelement, mode);
    106103    }
     
    117114    void Backlight::changedColour()
    118115    {
    119         Billboard::changedColour();
    120 
    121         if (this->ribbonTrail_ && this->isActive() && this->tickcount_ >= 2)
    122             this->ribbonTrail_->setInitialColour(0, this->getColour());
     116        FadingBillboard::changedColour();
     117
     118        if (this->ribbonTrail_ && this->tickcount_ >= 2)
     119            this->ribbonTrail_->setInitialColour(0, this->getFadedColour());
    123120    }
    124121
     
    165162    }
    166163
    167     void Backlight::changedActivity()
    168     {
    169         SUPER(Backlight, changedActivity);
     164    void Backlight::startturnonoff()
     165    {
     166        FadingBillboard::startturnonoff();
     167
     168        if (this->ribbonTrail_ && this->isActive() && this->isVisible())
     169            this->ribbonTrail_->setVisible(true);
     170    }
     171
     172    void Backlight::stopturnonoff()
     173    {
     174        this->postprocessingtime_ = max(0.0f, this->lifetime_ - this->turnofftime_);
     175
     176        FadingBillboard::stopturnonoff();
    170177
    171178        if (this->ribbonTrail_)
    172         {
    173             if (this->isActive())
    174                 this->ribbonTrail_->setInitialColour(0, this->getColour());
    175             else
    176             {
    177                 this->bTurningOff_ = true;
    178                 this->turnofftimer_.setTimer(this->turnofftime_, false, this, createExecutor(createFunctor(&Backlight::stopturnoff)));
    179             }
    180         }
     179            this->ribbonTrail_->setInitialColour(0, this->getFadedColour());
     180    }
     181
     182    void Backlight::poststopturnonoff()
     183    {
     184        FadingBillboard::poststopturnonoff();
     185
     186        if (this->ribbonTrail_)
     187            this->ribbonTrail_->setVisible(false);
    181188    }
    182189
     
    187194        this->update_width();
    188195        this->update_length();
    189     }
    190 
    191     void Backlight::stopturnoff()
    192     {
    193         this->bTurningOff_ = false;
    194196    }
    195197
     
    212214        }
    213215
    214         if (this->bTurningOff_ && this->ribbonTrail_)
    215         {
    216             this->ribbonTrail_->setInitialColour(0, this->ribbonTrail_->getInitialColour(0) - this->getColour() / this->turnofftime_ * dt);
     216        SUPER(Backlight, tick, dt);
     217
     218        if (this->ribbonTrail_ && this->changedirection_ != 0)
     219        {
     220            // we use alpha_blend, only adjust alpha
     221            const ColourValue& colour = this->getColour();
     222            this->ribbonTrail_->setInitialColour(0, colour.r, colour.g, colour.b, this->getFadedColour().a);
    217223        }
    218224    }
Note: See TracChangeset for help on using the changeset viewer.