Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Oct 27, 2008, 4:08:51 AM (16 years ago)
Author:
landauf
Message:

many changes, most important: BaseObject takes now a pointer to it's creator which is needed to build a level hierarchy (with different scenes)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/objecthierarchy/src/orxonox/objects/worldentities/WorldEntity.cc

    r2006 r2019  
    3030#include "WorldEntity.h"
    3131
     32#include <cassert>
    3233#include <OgreSceneManager.h>
    3334
     
    3738
    3839#include "GraphicsEngine.h"
     40#include "objects/Scene.h"
    3941
    4042namespace orxonox
     
    4749    const Vector3 WorldEntity::UP    = Vector3::UNIT_Y;
    4850
    49     WorldEntity::WorldEntity()
     51    WorldEntity::WorldEntity(BaseObject* creator) : BaseObject(creator)
    5052    {
    5153        RegisterObject(WorldEntity);
    5254
    53         this->node_ = GraphicsEngine::getInstance().getLevelSceneManager()->getRootSceneNode()->createChildSceneNode();
     55        assert(this->getScene());
     56        assert(this->getScene()->getRootSceneNode());
     57
     58        this->node_ = this->getScene()->getRootSceneNode()->createChildSceneNode();
     59
    5460        this->parent_ = 0;
    5561        this->parentID_ = (unsigned int)-1;
     
    6672        {
    6773            this->node_->detachAllObjects();
    68             GraphicsEngine::getInstance().getLevelSceneManager()->destroySceneNode(this->node_->getName());
     74            if (this->getScene()->getSceneManager())
     75                this->getScene()->getSceneManager()->destroySceneNode(this->node_->getName());
    6976        }
    7077    }
    71 
    7278
    7379    void WorldEntity::XMLPort(Element& xmlelement, XMLPort::Mode mode)
     
    131137        object->parentID_ = (unsigned int)-1;
    132138
    133         GraphicsEngine::getInstance().getLevelSceneManager()->getRootSceneNode()->addChild(object->node_);
     139        this->getScene()->getRootSceneNode()->addChild(object->node_);
    134140    }
    135141
Note: See TracChangeset for help on using the changeset viewer.