Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 17, 2008, 2:10:11 AM (16 years ago)
Author:
landauf
Message:

merged weapon2 branch to presentation

Location:
code/branches/presentation
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • code/branches/presentation

  • code/branches/presentation/src/orxonox/objects/weaponSystem/projectiles/BillboardProjectile.cc

    r2099 r2493  
    3030#include "BillboardProjectile.h"
    3131
    32 #include <OgreBillboard.h>
     32#include <OgreBillboardSet.h>
    3333
    3434#include "core/CoreIncludes.h"
     35#include "objects/Scene.h"
    3536
    3637namespace orxonox
     
    3839    CreateFactory(BillboardProjectile);
    3940
    40     BillboardProjectile::BillboardProjectile(BaseObject* creator, Weapon* owner) : Projectile(creator, owner)
     41    BillboardProjectile::BillboardProjectile(BaseObject* creator) : Projectile(creator)
    4142    {
    4243        RegisterObject(BillboardProjectile);
    4344
    44         this->billboard_.setBillboardSet("Examples/Flare", ColourValue(1.0, 1.0, 0.5), 1);
    45         this->attachObject(this->billboard_.getBillboardSet());
    46         this->scale(0.5);
     45        assert(this->getScene()->getSceneManager()); // getScene() was already checked by WorldEntity
     46
     47        this->billboard_.setBillboardSet(this->getScene()->getSceneManager(), "Examples/Flare", ColourValue(0.5, 0.5, 0.7, 0.8), 1);
     48        this->attachOgreObject(this->billboard_.getBillboardSet());
     49        this->scale(0.2);
    4750    }
    4851
    4952    BillboardProjectile::~BillboardProjectile()
    5053    {
    51         if (this->isInitialized() && this->owner_)
    52             this->detachObject(this->billboard_.getBillboardSet());
     54        //if (this->isInitialized() && this->owner_)
     55            //this->detachObject(this->billboard_.getBillboardSet());
    5356    }
    5457
    5558    void BillboardProjectile::setColour(const ColourValue& colour)
    5659    {
    57         this->billboard_.getBillboardSet()->getBillboard(0)->setColour(colour);
     60        this->billboard_.setColour(colour);
    5861    }
    5962
  • code/branches/presentation/src/orxonox/objects/weaponSystem/projectiles/BillboardProjectile.h

    r2099 r2493  
    4141    {
    4242        public:
    43             BillboardProjectile(BaseObject* creator, Weapon* owner = 0);
     43            BillboardProjectile(BaseObject* creator);
    4444            virtual ~BillboardProjectile();
    4545
  • code/branches/presentation/src/orxonox/objects/weaponSystem/projectiles/ParticleProjectile.cc

    r2099 r2493  
    3030#include "ParticleProjectile.h"
    3131
    32 #include "SpaceShip.h"
     32#include <OgreParticleSystem.h>
     33#include <OgreParticleEmitter.h>
     34
     35#include "../../worldentities/pawns/SpaceShip.h"
    3336#include "core/CoreIncludes.h"
    3437#include "core/ConfigValueIncludes.h"
     38#include "objects/Scene.h"
    3539
    3640namespace orxonox
     
    3842    CreateFactory(ParticleProjectile);
    3943
    40     ParticleProjectile::ParticleProjectile(BaseObject* creator, Weapon* owner) : BillboardProjectile(creator, owner)
     44    ParticleProjectile::ParticleProjectile(BaseObject* creator) : BillboardProjectile(creator)
    4145    {
    4246        RegisterObject(ParticleProjectile);
    4347
    44         this->particles_ = new ParticleInterface("Orxonox/shot2", LODParticle::normal);
    45         this->particles_->addToSceneNode(this->getNode());
    46         this->particles_->setKeepParticlesInLocalSpace(true);
     48        this->particles_ = new ParticleInterface(this->getScene()->getSceneManager(), "Orxonox/shot3_small", LODParticle::normal);
     49        this->attachOgreObject(this->particles_->getParticleSystem());
     50        this->particles_->setKeepParticlesInLocalSpace(0);
     51
     52        this->particles_->getAllEmitters()->setDirection(-WorldEntity::FRONT);
     53        /*
    4754        if (this->owner_)
    4855        {
     
    5259//            this->particles_ = 0;
    5360//        }
     61        */
    5462
    5563        this->setConfigValues();
     
    5967    {
    6068        if (this->isInitialized() && this->particles_)
     69        {
     70            this->detachOgreObject(this->particles_->getParticleSystem());
    6171            delete this->particles_;
     72        }
    6273    }
    6374
    6475    void ParticleProjectile::setConfigValues()
    6576    {
    66         SetConfigValue(speed_, 5000.0).description("The speed of a projectile in units per second").callback((Projectile*)this, &ParticleProjectile::speedChanged);
     77        //SetConfigValue(speed_, 5000.0).description("The speed of a projectile in units per second").callback((Projectile*)this, &ParticleProjectile::speedChanged);
    6778    }
    6879
     
    7283        this->particles_->setEnabled(this->isVisible());
    7384    }
    74 
    75     bool ParticleProjectile::create(){
    76       if(!Projectile::create())
    77         return false;
    78       this->particles_->getAllEmitters()->setDirection(-this->getOrientation()*Vector3(1,0,0));
    79       return true;
    80     }
    8185}
  • code/branches/presentation/src/orxonox/objects/weaponSystem/projectiles/ParticleProjectile.h

    r2099 r2493  
    4141    {
    4242        public:
    43             ParticleProjectile(BaseObject* creator, Weapon* owner = 0);
     43            ParticleProjectile(BaseObject* creator);
    4444            virtual ~ParticleProjectile();
    4545            virtual void changedVisibility();
    4646            void setConfigValues();
    47 
    48             virtual bool create();
    4947
    5048        private:
  • code/branches/presentation/src/orxonox/objects/weaponSystem/projectiles/Projectile.cc

    r2466 r2493  
    4040#include "objects/worldentities/Model.h"
    4141#include "objects/worldentities/ParticleSpawner.h"
    42 #include "Settings.h"
     42#include "core/Core.h"
    4343
    4444namespace orxonox
    4545{
    46     float Projectile::speed_s = 5000;
    47 
    48     Projectile::Projectile(BaseObject* creator, Weapon* owner) : MovableEntity(creator), owner_(owner)
     46    Projectile::Projectile(BaseObject* creator) : MovableEntity(creator)
    4947    {
    5048        RegisterObject(Projectile);
     
    5452        this->smokeTemplateName_ = "Orxonox/smoke4";
    5553
    56         this->setStatic(false);
    57         this->translate(Vector3(55, 0, 0), Ogre::Node::TS_LOCAL);
     54        //this->setStatic(false);
     55//        this->translate(Vector3(55, 0, 0), Ogre::Node::TS_LOCAL);
    5856
    5957        // Get notification about collisions
    6058        this->enableCollisionCallback();
    6159
     60        /*
    6261        if (this->owner_)
    6362        {
     
    6665            this->setVelocity(this->owner_->getInitialDir() * this->speed_);
    6766        }
     67        */
    6868
    69         if(!orxonox::Settings::isClient()) //only if not on client
     69        if(!Core::isClient()) //only if not on client
    7070          this->destroyTimer_.setTimer(this->lifetime_, false, this, createExecutor(createFunctor(&Projectile::destroyObject)));
    7171    }
     
    7979        SetConfigValue(damage_, 15.0).description("The damage caused by the projectile");
    8080        SetConfigValue(lifetime_, 4.0).description("The time in seconds a projectile stays alive");
    81         SetConfigValue(speed_, 5000.0).description("The speed of a projectile in units per second").callback(this, &Projectile::speedChanged);
    8281    }
    8382
    84     void Projectile::speedChanged()
    85     {
    86         Projectile::speed_s = this->speed_;
    87         if (this->owner_)
    88             this->setVelocity(this->owner_->getInitialDir() * this->speed_);
    89     }
    9083
    9184    void Projectile::tick(float dt)
     
    9588        if (!this->isActive())
    9689            return;
    97 
     90/*
    9891        float radius;
    9992        for (ObjectList<Model>::iterator it = ObjectList<Model>::begin(); it; ++it)
     
    10699                {
    107100                    // hit
    108                     ParticleSpawner* explosion = new ParticleSpawner(this->explosionTemplateName_, LODParticle::low, 2.0);
     101                    ParticleSpawner* explosion = new ParticleSpawner(this);
     102                    explosion->setSource(this->explosionTemplateName_);
     103                    explosion->setLOD(LODParticle::low);
     104                    explosion->configure(2.0);
    109105                    explosion->setPosition(this->getPosition());
    110106                    explosion->create();
    111                     ParticleSpawner* smoke = new ParticleSpawner(this->smokeTemplateName_, LODParticle::normal, 2.0, 0.0);
     107                    ParticleSpawner* smoke = new ParticleSpawner(this);
     108                    smoke->setSource(this->smokeTemplateName_);
     109                    smoke->setLOD(LODParticle::normal);
     110                    smoke->configure(2.0, 0.0);
    112111                    smoke->setPosition(this->getPosition());
    113112//                    smoke->getParticleInterface()->setSpeedFactor(3.0);
     
    118117            }
    119118        }
     119*/
    120120    }
    121121
     
    124124        delete this;
    125125    }
    126 
    127     bool Projectile::create(){
    128       return WorldEntity::create();
    129     }
    130126}
  • code/branches/presentation/src/orxonox/objects/weaponSystem/projectiles/Projectile.h

    r2099 r2493  
    4242            virtual ~Projectile();
    4343            void setConfigValues();
    44             void speedChanged();
    4544            void destroyObject();
    4645            virtual void tick(float dt);
    4746
    48             virtual bool create();
    49 
    50             static float getSpeed()
    51                 { return Projectile::speed_s; }
    52 
    5347        protected:
    54             Projectile(BaseObject* creator, Weapon* owner = 0);
    55             SpaceShip* owner_;
     48            Projectile(BaseObject* creator);
    5649
    5750        private:
     
    5952            std::string smokeTemplateName_;
    6053        protected:
    61             static float speed_s;
    6254            float speed_;
    6355        private:
Note: See TracChangeset for help on using the changeset viewer.