Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Sep 27, 2009, 2:33:48 AM (15 years ago)
Author:
landauf
Message:
  • Enhanced SmartPtr: a) It stores now two pointers, one OrxonoxClass* (for reference counting) and one T* (for normal use). b) Incrementing the reference is now optional in the constructor for raw pointers. This is needed because Scene has a selfreference but should still be destroyable.
  • Changed BaseObject to store a SmartPtr to it's Scene instead of a normal pointer.
  • Changed setScene and getScene to deal directly with SmartPtr instead of a Scene* pointer to avoid casting-to-OrxonoxClass issues.
  • Fixed two problems with lost SceneManagers in CameraManger: a) added a SmartPtr to the Scene for the fallback camera b) added a call to GUIManager in the destructor to release the scene manager
  • Enabled unloading in GSLevel again (after years). Works if playing without bots.
Location:
code/branches/core5/src/orxonox
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • code/branches/core5/src/orxonox/CameraManager.cc

    r5738 r5805  
    5353    {
    5454        if (this->fallbackCamera_)
    55             this->fallbackCamera_->getSceneManager()->destroyCamera(this->fallbackCamera_);
     55            this->fallbackCameraScene_->getSceneManager()->destroyCamera(this->fallbackCamera_);
     56        GUIManager::getInstance().setCamera(0);
    5657    }
    5758
     
    7475        else if (this->fallbackCamera_)
    7576        {
    76             this->fallbackCamera_->getSceneManager()->destroyCamera(this->fallbackCamera_);
     77            this->fallbackCameraScene_->getSceneManager()->destroyCamera(this->fallbackCamera_);
    7778            this->fallbackCamera_ = 0;
    7879        }
     
    107108                // there are no more cameras, create a fallback
    108109                if (!this->fallbackCamera_)
    109                     this->fallbackCamera_ = camera->getScene()->getSceneManager()->createCamera(getUniqueNumberString());
     110                {
     111                    this->fallbackCameraScene_ = camera->getScene();
     112                    this->fallbackCamera_ = this->fallbackCameraScene_->getSceneManager()->createCamera(getUniqueNumberString());
     113                }
    110114                this->useCamera(this->fallbackCamera_);
    111115            }
  • code/branches/core5/src/orxonox/CameraManager.h

    r3370 r5805  
    4242#include "util/OgreForwardRefs.h"
    4343#include "util/Singleton.h"
     44#include "core/SmartPtr.h"
    4445
    4546namespace orxonox
     
    6768            Ogre::Viewport*       viewport_;
    6869            Ogre::Camera*         fallbackCamera_;
     70            SmartPtr<Scene>       fallbackCameraScene_;
    6971
    7072            static CameraManager* singletonPtr_s;
  • code/branches/core5/src/orxonox/Scene.cc

    r5738 r5805  
    5454        RegisterObject(Scene);
    5555
    56         this->setScene(this);
     56        this->setScene(SmartPtr<Scene>(this, false));
    5757        this->bShadows_ = true;
    5858
Note: See TracChangeset for help on using the changeset viewer.