Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Oct 27, 2008, 10:56:51 PM (16 years ago)
Author:
rgrieder
Message:
  • Added support for dedicated server. Could not network test it yet, client still segfaults me.
  • Also kicked GraphicsEngine::levelSceneManager_, there are only the statistic methods left.
  • GSDedicated also derives from GSLevel, but GSLevel is not anymore a real GameState.
  • CameraHandler and LevelManager get created in GSLevel now.
File:
1 edited

Legend:

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

    r2019 r2023  
    3131
    3232#include <OgreRoot.h>
    33 #include <OgreSceneManager.h>
     33#include <OgreSceneManagerEnumerator.h>
    3434#include <OgreSceneNode.h>
    3535#include <OgreLight.h>
    3636
    3737#include "core/CoreIncludes.h"
     38#include "core/Core.h"
    3839#include "core/XMLPort.h"
    3940
     
    4950        this->bShadows_ = false;
    5051
    51         if (Ogre::Root::getSingletonPtr())
     52        if (Core::showsGraphics())
    5253        {
    53             this->sceneManager_ = Ogre::Root::getSingleton().createSceneManager(Ogre::ST_GENERIC);
    54             this->rootSceneNode_ = this->sceneManager_->getRootSceneNode();
     54            if (Ogre::Root::getSingletonPtr())
     55            {
     56                this->sceneManager_ = Ogre::Root::getSingleton().createSceneManager(Ogre::ST_GENERIC);
     57                this->rootSceneNode_ = this->sceneManager_->getRootSceneNode();
     58            }
     59            else
     60            {
     61                this->sceneManager_ = 0;
     62                this->rootSceneNode_ = 0;
     63            }
    5564        }
    5665        else
    5766        {
    58             this->sceneManager_ = 0;
    59             this->rootSceneNode_ = 0;
     67            // create a dummy SceneManager of our own since we don't have Ogre::Root.
     68            this->sceneManager_ = new Ogre::DefaultSceneManager("");
     69            this->rootSceneNode_ = this->sceneManager_->getRootSceneNode();
    6070        }
    6171
    6272        // test test test
    63         if (this->sceneManager_)
     73        if (Core::showsGraphics() && this->sceneManager_)
    6474        {
    6575            Ogre::Light* light;
     
    8090            Ogre::Root::getSingleton().destroySceneManager(this->sceneManager_);
    8191        }
    82         else
     92        else if (!Core::showsGraphics())
    8393        {
     94            delete this->sceneManager_;
    8495        }
    8596    }
     
    104115    void Scene::setSkybox(const std::string& skybox)
    105116    {
    106         if (this->sceneManager_)
     117        if (Core::showsGraphics() && this->sceneManager_)
    107118            this->sceneManager_->setSkyBox(true, skybox);
    108119
     
    112123    void Scene::setAmbientLight(const ColourValue& colour)
    113124    {
    114         if (this->sceneManager_)
     125        if (Core::showsGraphics() && this->sceneManager_)
    115126            this->sceneManager_->setAmbientLight(colour);
    116127
     
    120131    void Scene::setShadow(bool bShadow)
    121132    {
    122         if (this->sceneManager_)
     133        if (Core::showsGraphics() && this->sceneManager_)
    123134        {
    124135            if (bShadow)
Note: See TracChangeset for help on using the changeset viewer.