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.
Location:
code/branches/objecthierarchy/src/orxonox/objects
Files:
6 edited

Legend:

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

    r2019 r2023  
    2929#include "OrxonoxStableHeaders.h"
    3030#include "Camera.h"
    31 #include "CameraHandler.h"
    3231
    3332#include <string>
    3433#include <cassert>
    3534
     35#include <OgreCamera.h>
    3636#include <OgreSceneManager.h>
    3737#include <OgreSceneNode.h>
    38 #include <OgreRenderWindow.h>
    3938#include <OgreViewport.h>
    4039
    41 #include "tinyxml/tinyxml.h"
    42 #include "util/SubString.h"
    43 #include "util/Math.h"
    44 #include "util/String.h"
    45 #include "util/Debug.h"
    4640#include "core/CoreIncludes.h"
    4741#include "core/ConfigValueIncludes.h"
    48 #include "GraphicsEngine.h"
    4942#include "objects/Scene.h"
     43#include "objects/CameraHandler.h"
    5044
    5145namespace orxonox
  • code/branches/objecthierarchy/src/orxonox/objects/Camera.h

    r2019 r2023  
    3030#define _Camera_H__
    3131
     32#include "OrxonoxPrereqs.h"
     33
    3234#include <OgrePrerequisites.h>
    33 #include <OgreSceneNode.h>
    34 #include <OgreCamera.h>
    35 
    36 #include "OrxonoxPrereqs.h"
    3735#include "objects/worldentities/PositionableEntity.h"
    3836#include "objects/Tickable.h"
  • code/branches/objecthierarchy/src/orxonox/objects/CameraHandler.cc

    r2019 r2023  
    2929#include "CameraHandler.h"
    3030
    31 #include <OgreSceneManager.h>
    32 #include <OgreRenderWindow.h>
     31#include <OgreViewport.h>
    3332
    34 #include "core/ObjectList.h"
    3533#include "core/Core.h"
    3634#include "Camera.h"
    37 #include "GraphicsEngine.h"
    3835
    39 #include <OgreCamera.h>
    4036
    4137namespace orxonox
    4238{
    43     CameraHandler::CameraHandler()
     39    CameraHandler* CameraHandler::singletonRef_s = 0;
     40
     41    CameraHandler::CameraHandler(Ogre::Viewport* viewport)
     42        : viewport_(viewport)
    4443    {
    45 //        GraphicsEngine::getInstance().getViewport()->setCamera(this->cam_);
     44        assert(singletonRef_s == 0);
     45        singletonRef_s = this;
    4646    }
    4747
    48     CameraHandler& CameraHandler::getInstance()
     48    CameraHandler::~CameraHandler()
    4949    {
    50         static CameraHandler instance;
    51         return instance;
     50        assert(singletonRef_s != 0);
     51        singletonRef_s = 0;
    5252    }
    5353
     
    7171        // add to list
    7272        this->cameraList_.push_front(camera);
    73         camera->setFocus(GraphicsEngine::getInstance().getViewport());
     73        camera->setFocus(this->viewport_);
    7474    }
    7575
     
    8787            // set new focus if necessary
    8888            if (cameraList_.size() > 0)
    89                 cameraList_.front()->setFocus(GraphicsEngine::getInstance().getViewport());
     89                cameraList_.front()->setFocus(this->viewport_);
    9090        }
    9191        else
  • code/branches/objecthierarchy/src/orxonox/objects/CameraHandler.h

    r2019 r2023  
    3838#include "OrxonoxPrereqs.h"
    3939
     40#include <cassert>
    4041#include <list>
    41 #include <OgreCamera.h>
    42 
    43 #include "core/BaseObject.h"
     42#include <OgrePrerequisites.h>
    4443
    4544namespace orxonox
     
    4847    {
    4948        public:
    50             static CameraHandler& getInstance();
     49            CameraHandler(Ogre::Viewport* viewport);
     50            ~CameraHandler();
    5151
    5252            Camera* getActiveCamera() const;
     
    5555            void releaseFocus(Camera* camera);
    5656
     57            static CameraHandler& getInstance() { assert(singletonRef_s); return *singletonRef_s; }
     58
    5759        private:
    58             CameraHandler();
    59             ~CameraHandler() {}
     60            CameraHandler(const CameraHandler&);
    6061
    6162            std::list<Camera*> cameraList_;
     63            Ogre::Viewport* viewport_;
     64
     65            static CameraHandler* singletonRef_s;
    6266    };
    6367}
  • 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)
  • code/branches/objecthierarchy/src/orxonox/objects/worldentities/WorldEntity.cc

    r2019 r2023  
    3737#include "util/Convert.h"
    3838
    39 #include "GraphicsEngine.h"
    4039#include "objects/Scene.h"
    4140
Note: See TracChangeset for help on using the changeset viewer.