Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 633 for code/branches


Ignore:
Timestamp:
Dec 19, 2007, 1:30:47 AM (17 years ago)
Author:
landauf
Message:

added blinkies :D

Location:
code/branches/FICN/src/orxonox
Files:
4 added
6 edited

Legend:

Unmodified
Added
Removed
  • code/branches/FICN/src/orxonox/CMakeLists.txt

    r612 r633  
    3434    objects/SpaceShip.cc
    3535    objects/NPC.cc
     36    objects/BillboardSet.cc
     37    objects/Light.cc
    3638  )
    3739ELSE(WIN32)
  • code/branches/FICN/src/orxonox/objects/CMakeLists.txt

    r608 r633  
    1818  SpaceShip.cc
    1919  NPC.cc
     20  BillboardSet.cc
     21  Light.cc
    2022)
    2123
  • code/branches/FICN/src/orxonox/objects/Mesh.cc

    r614 r633  
    1717        std::ostringstream name;
    1818        name << (Mesh::meshCounter_s++);
    19         this->entity_ = Orxonox::getSingleton()->getSceneManager()->createEntity("Mesh" + name.str() + "gugus", file);
     19        this->entity_ = Orxonox::getSingleton()->getSceneManager()->createEntity("Mesh" + name.str(), file);
    2020    }
    2121
  • code/branches/FICN/src/orxonox/objects/SpaceShip.cc

    r626 r633  
    4848        this->setMouseEventCallback_ = false;
    4949
    50         this->w = NULL;
    51         this->tt = NULL;
     50        this->tt_ = 0;
     51        this->redNode_ = 0;
     52        this->greenNode_ = 0;
     53        this->blinkTime_ = 0;
    5254
    5355        this->moveForward_ = 0;
     
    9193    SpaceShip::~SpaceShip()
    9294    {
    93         if (w)
    94             delete w;
    95         if (tt)
    96             delete tt;
     95        if (tt_)
     96            delete tt_;
    9797    }
    9898
     
    109109        Model::loadParams(xmlElem);
    110110
    111         w = new particle::ParticleInterface(Orxonox::getSingleton()->getSceneManager(),"schuss" + this->getName(),"Orxonox/schuss");
    112         w->getParticleSystem()->setParameter("local_space","true");
    113         w->newEmitter();
     111
     112        // START CREATING THRUSTER
     113        tt_ = new particle::ParticleInterface(Orxonox::getSingleton()->getSceneManager(),"twinthruster" + this->getName(),"Orxonox/engineglow");
     114        tt_->getParticleSystem()->setParameter("local_space","true");
     115        tt_->newEmitter();
    114116/*
    115         w->setDirection(Vector3(0,0,1));
    116         w->setPositionOfEmitter(0, Vector3(10,10,0));
    117         w->setPositionOfEmitter(1, Vector3(-10,10,0));
     117        tt_->setDirection(Vector3(0,0,1));
     118        tt_->setPositionOfEmitter(0, Vector3(20,-1,-15));
     119        tt_->setPositionOfEmitter(1, Vector3(-20,-1,-15));
    118120*/
    119         w->setDirection(Vector3(1,0,0));
    120         w->setPositionOfEmitter(0, Vector3(0,10,10));
    121         w->setPositionOfEmitter(1, Vector3(0,-10,10));
    122 
    123         emitterRate_ = w->getRate();
    124 
    125         Ogre::SceneNode* node1 = this->getNode()->createChildSceneNode(this->getName() + "particle1");
    126         node1->setInheritScale(false);
    127         w->addToSceneNode(node1);
    128 
    129 
    130 
    131         tt = new particle::ParticleInterface(Orxonox::getSingleton()->getSceneManager(),"twinthruster" + this->getName(),"Orxonox/engineglow");
    132         tt->getParticleSystem()->setParameter("local_space","true");
    133         tt->newEmitter();
    134 /*
    135         tt->setDirection(Vector3(0,0,1));
    136         tt->setPositionOfEmitter(0, Vector3(20,-1,-15));
    137         tt->setPositionOfEmitter(1, Vector3(-20,-1,-15));
    138 */
    139         tt->setDirection(Vector3(-1,0,0));
    140         tt->setPositionOfEmitter(0, Vector3(-15,20,-1));
    141         tt->setPositionOfEmitter(1, Vector3(-15,-20,-1));
    142         tt->setVelocity(50);
     121        tt_->setDirection(Vector3(-1,0,0));
     122        tt_->setPositionOfEmitter(0, Vector3(-15,20,-1));
     123        tt_->setPositionOfEmitter(1, Vector3(-15,-20,-1));
     124        tt_->setVelocity(50);
     125
     126        emitterRate_ = tt_->getRate();
    143127
    144128        Ogre::SceneNode* node2 = this->getNode()->createChildSceneNode(this->getName() + "particle2");
    145129        node2->setInheritScale(false);
    146         tt->addToSceneNode(node2);
    147 
     130        tt_->addToSceneNode(node2);
     131        // END CREATING THRUSTER
     132
     133        // START CREATING BLINKING LIGHTS
     134        this->redBillboard_.setBillboardSet("Examples/Flare", ColourValue(1.0, 0.0, 0.0), 1);
     135        this->greenBillboard_.setBillboardSet("Examples/Flare", ColourValue(0.0, 1.0, 0.0), 1);
     136
     137        this->redNode_ = this->getNode()->createChildSceneNode(this->getName() + "red", Vector3(0.1, 4.6, -0.3));
     138        this->redNode_->setInheritScale(false);
     139        this->greenNode_ = this->getNode()->createChildSceneNode(this->getName() + "green", Vector3(0.1, -4.6, -0.3));
     140        this->greenNode_->setInheritScale(false);
     141
     142        this->redNode_->attachObject(this->redBillboard_.getBillboardSet());
     143        this->redNode_->setScale(0.3, 0.3, 0.3);
     144
     145        this->greenNode_->attachObject(this->greenBillboard_.getBillboardSet());
     146        this->greenNode_->setScale(0.3, 0.3, 0.3);
     147        // END CREATING BLINKING LIGHTS
    148148
    149149
     
    214214        WorldEntity::tick(dt);
    215215
     216        if (this->redNode_ && this->greenNode_)
     217        {
     218            this->blinkTime_ += dt;
     219            float redScale = 0.15 + 0.15 * sin(this->blinkTime_ * 10.0);
     220            float greenScale = 0.15 - 0.15 * sin(this->blinkTime_ * 10.0);
     221            this->redNode_->setScale(redScale, redScale, redScale);
     222            this->greenNode_->setScale(greenScale, greenScale, greenScale);
     223        }
     224
    216225        OIS::Keyboard* mKeyboard = Orxonox::getSingleton()->getKeyboard();
    217226        OIS::Mouse* mMouse = Orxonox::getSingleton()->getMouse();
     
    385394        if (accelerationForward_ > 25.0)
    386395        {
    387           this->tt->setRate(emitterRate_);
    388         }
    389         else
    390         {
    391           this->tt->setRate(0);
     396            this->tt_->setRate(emitterRate_);
     397        }
     398        else
     399        {
     400            this->tt_->setRate(0);
    392401        }
    393402
  • code/branches/FICN/src/orxonox/objects/SpaceShip.h

    r626 r633  
    55
    66#include "Model.h"
     7#include "BillboardSet.h"
     8#include "OgreSceneNode.h"
     9
    710#include "../../tinyxml/tinyxml.h"
    811#include "../particle/ParticleInterface.h"
     
    4144            bool setMouseEventCallback_;
    4245
    43             particle::ParticleInterface *w;
    44             particle::ParticleInterface *tt;
     46            particle::ParticleInterface *tt_;
     47
     48            BillboardSet redBillboard_;
     49            BillboardSet greenBillboard_;
     50            Ogre::SceneNode* redNode_;
     51            Ogre::SceneNode* greenNode_;
     52            float blinkTime_;
    4553
    4654            float moveForward_;
  • code/branches/FICN/src/orxonox/objects/WorldEntity.cc

    r631 r633  
    5151            name << (WorldEntity::worldEntityCounter_s++);
    5252            this->setName("WorldEntity" + name.str());
    53             node_ = Orxonox::getSingleton()->getSceneManager()->getRootSceneNode()->createChildSceneNode(this->getName());
     53            this->node_ = Orxonox::getSingleton()->getSceneManager()->getRootSceneNode()->createChildSceneNode(this->getName());
     54        }
     55        else
     56        {
     57            this->node_ = 0;
    5458        }
    5559
Note: See TracChangeset for help on using the changeset viewer.