Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 7, 2008, 4:18:11 AM (16 years ago)
Author:
landauf
Message:
  • Added support for postprocessing shaders (bloom, motion blur, …). Shaders are only visible if Plugin_CgProgramManager is included in bin/Plugins.cfg.
  • Added class GlobalShader which is visible on all clients and can be activated or deactivated by triggers or other events.
  • Added RadialBlur shader to the SpaceShip's engine. The strength of the RadialBlur depends on the SpaceShip's velocity.
Location:
code/branches/objecthierarchy2/src/orxonox/objects/items
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/branches/objecthierarchy2/src/orxonox/objects/items/Engine.cc

    r2256 r2350  
    3232#include "core/CoreIncludes.h"
    3333#include "core/XMLPort.h"
     34#include "objects/Scene.h"
    3435#include "objects/worldentities/pawns/SpaceShip.h"
     36#include "tools/Shader.h"
    3537
    3638namespace orxonox
     
    5961        this->accelerationUpDown_ = 0.0;
    6062
     63        this->boostBlur_ = 0;
     64
    6165        this->registerVariables();
    6266    }
     
    6569    {
    6670        if (this->isInitialized() && this->ship_)
     71        {
    6772            this->ship_->setEngine(0);
     73
     74            if (this->boostBlur_)
     75                delete this->boostBlur_;
     76        }
    6877    }
    6978
     
    178187        this->ship_->setBoost(false);
    179188        this->ship_->setSteeringDirection(Vector3::ZERO);
     189
     190        if (!this->boostBlur_ && this->ship_->hasLocalController() && this->ship_->hasHumanController())
     191        {
     192            this->boostBlur_ = new Shader(this->ship_->getScene()->getSceneManager());
     193            this->boostBlur_->setCompositor("Radial Blur");
     194        }
     195
     196        if (this->boostBlur_ && this->maxSpeedFront_ != 0 && this->boostFactor_ != 1)
     197            this->boostBlur_->setParameter("Ogre/Compositor/Radial_Blur", 0, 0, "sampleStrength", 5.0f * clamp((-velocity.z - this->maxSpeedFront_) / ((this->boostFactor_ - 1) * this->maxSpeedFront_), 0.0f, 1.0f));
     198    }
     199
     200    void Engine::changedActivity()
     201    {
     202        SUPER(Engine, changedActivity);
     203
     204        if (this->boostBlur_)
     205            this->boostBlur_->setVisible(this->isVisible());
    180206    }
    181207
     
    188214            if (ship->getEngine() != this)
    189215                ship->setEngine(this);
     216
     217            if (this->boostBlur_)
     218            {
     219                delete this->boostBlur_;
     220                this->boostBlur_ = 0;
     221            }
    190222        }
    191223    }
  • code/branches/objecthierarchy2/src/orxonox/objects/items/Engine.h

    r2256 r2350  
    4848
    4949            virtual void tick(float dt);
     50            virtual void changedActivity();
    5051
    5152            virtual void addToSpaceShip(SpaceShip* ship);
     
    124125            float accelerationLeftRight_;
    125126            float accelerationUpDown_;
     127
     128            Shader* boostBlur_;
    126129    };
    127130}
Note: See TracChangeset for help on using the changeset viewer.