Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Nov 29, 2008, 12:25:22 AM (16 years ago)
Author:
rgrieder
Message:

Made return value of WorldEntity::getNode() const —> Modifying the node_ will not anymore be allowed.
That change implicates:

  • Removed Ogre::SceneNode from ParticleInterface. It gets connected now by the ParticleEmitter
  • Added functions attachOgreObject and detachOgreObject to WorldEntity
  • changed all getNode()→attachObject(…) to attachOgreObject(…)
Location:
code/branches/physics/src/orxonox
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • code/branches/physics/src/orxonox/objects/worldentities/Billboard.cc

    r2087 r2296  
    5050        {
    5151            if (this->isInitialized() && this->billboard_.getBillboardSet())
    52                 this->getNode()->detachObject(this->billboard_.getName());
     52                this->detachOgreObject(this->billboard_.getName());
    5353        }
    5454    }
     
    7575            {
    7676                this->billboard_.setBillboardSet(this->getScene()->getSceneManager(), this->material_, this->colour_, 1);
    77                 this->getNode()->attachObject(this->billboard_.getBillboardSet());
     77                this->attachOgreObject(this->billboard_.getBillboardSet());
    7878                this->billboard_.setVisible(this->isVisible());
    7979            }
     
    9090            {
    9191                this->billboard_.setBillboardSet(this->getScene()->getSceneManager(), this->material_, this->colour_, 1);
    92                 this->getNode()->attachObject(this->billboard_.getBillboardSet());
     92                this->attachOgreObject(this->billboard_.getBillboardSet());
    9393                this->billboard_.setVisible(this->isVisible());
    9494            }
  • code/branches/physics/src/orxonox/objects/worldentities/Camera.cc

    r2103 r2296  
    5555
    5656        this->camera_ = this->getScene()->getSceneManager()->createCamera(getUniqueNumberString());
    57         this->getNode()->attachObject(this->camera_);
     57        this->attachOgreObject(this->camera_);
    5858
    5959        this->bHasFocus_ = false;
  • code/branches/physics/src/orxonox/objects/worldentities/Light.cc

    r2087 r2296  
    5353        if (this->getScene() && this->getScene()->getSceneManager())
    5454        this->light_ = this->getScene()->getSceneManager()->createLight("Light" + convertToString(Light::lightCounter_s++));
    55         this->getNode()->attachObject(this->light_);
     55        this->attachOgreObject(this->light_);
    5656
    5757        this->registerVariables();
  • code/branches/physics/src/orxonox/objects/worldentities/Model.cc

    r2087 r2296  
    4848    {
    4949        if (this->isInitialized() && this->mesh_.getEntity())
    50             this->getNode()->detachObject(this->mesh_.getEntity());
     50            this->detachOgreObject(this->mesh_.getEntity());
    5151    }
    5252
     
    6868    {
    6969        if (this->mesh_.getEntity())
    70             this->getNode()->detachObject(this->mesh_.getEntity());
     70            this->detachOgreObject(this->mesh_.getEntity());
    7171
    7272        this->mesh_.setMeshSource(this->getScene()->getSceneManager(), this->meshSrc_);
     
    7474        if (this->mesh_.getEntity())
    7575        {
    76             this->getNode()->attachObject(this->mesh_.getEntity());
     76            this->attachOgreObject(this->mesh_.getEntity());
    7777            this->mesh_.getEntity()->setCastShadows(this->bCastShadows_);
    7878            this->mesh_.setVisible(this->isVisible());
  • code/branches/physics/src/orxonox/objects/worldentities/ParticleEmitter.cc

    r2087 r2296  
    6161    {
    6262        if (this->isInitialized() && this->particles_)
     63        {
     64            this->detachOgreObject(this->particles_->getParticleSystem());
    6365            delete this->particles_;
     66        }
    6467    }
    6568
     
    104107            {
    105108                this->particles_ = new ParticleInterface(this->getScene()->getSceneManager(), this->source_, this->LOD_);
    106                 this->particles_->addToSceneNode(this->getNode());
     109                this->attachOgreObject(particles_->getParticleSystem());
    107110                this->particles_->setVisible(this->isVisible());
    108111                this->particles_->setEnabled(this->isActive());
  • code/branches/physics/src/orxonox/objects/worldentities/WorldEntity.h

    r2292 r2296  
    6161            void registerVariables();
    6262
    63             inline Ogre::SceneNode* getNode() const
     63            inline const Ogre::SceneNode* getNode() const
    6464                { return this->node_; }
    6565
     
    145145                { return this->children_; }
    146146
     147            inline void attachOgreObject(Ogre::MovableObject* object)
     148                { this->node_->attachObject(object); }
     149            inline void detachOgreObject(Ogre::MovableObject* object)
     150                { this->node_->detachObject(object); }
     151            inline Ogre::MovableObject* detachOgreObject(const Ogre::String& name)
     152                { return this->node_->detachObject(name); }
     153
    147154            inline void attachToParent(WorldEntity* parent)
    148155                { parent->attach(this); }
  • code/branches/physics/src/orxonox/objects/worldentities/triggers/Trigger.cc

    r2103 r2296  
    7171    }
    7272
    73     this->getNode()->attachObject(this->debugBillboard_.getBillboardSet());
     73    this->attachOgreObject(this->debugBillboard_.getBillboardSet());
    7474    this->setObjectMode(0x0);
    7575  }
  • code/branches/physics/src/orxonox/tools/ParticleInterface.cc

    r2087 r2296  
    5656
    5757        this->scenemanager_ = scenemanager;
    58         this->sceneNode_ = 0;
    5958
    6059        this->bEnabled_ = true;
     
    7271    {
    7372        this->particleSystem_->removeAllEmitters();
    74         this->detachFromSceneNode();
    7573        this->scenemanager_->destroyParticleSystem(particleSystem_);
    76     }
    77 
    78     void ParticleInterface::addToSceneNode(Ogre::SceneNode* sceneNode)
    79     {
    80         if (this->sceneNode_)
    81             this->detachFromSceneNode();
    82 
    83         this->sceneNode_ = sceneNode;
    84         this->sceneNode_->attachObject(this->particleSystem_);
    85     }
    86 
    87     void ParticleInterface::detachFromSceneNode()
    88     {
    89         if (this->sceneNode_)
    90         {
    91             this->sceneNode_->detachObject(this->particleSystem_);
    92             this->sceneNode_ = 0;
    93         }
    9474    }
    9575
  • code/branches/physics/src/orxonox/tools/ParticleInterface.h

    r2087 r2296  
    5454                { return this->particleSystem_; }
    5555
    56             void addToSceneNode(Ogre::SceneNode* sceneNode);
    57             void detachFromSceneNode();
    58 
    5956            Ogre::ParticleEmitter* createNewEmitter();
    6057            Ogre::ParticleEmitter* getEmitter(unsigned int emitterNr) const;
     
    9693            static unsigned int       counter_s;
    9794
    98             Ogre::SceneNode*          sceneNode_;
    9995            Ogre::ParticleSystem*     particleSystem_;
    10096            bool                      bVisible_;
Note: See TracChangeset for help on using the changeset viewer.