Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8336 for code


Ignore:
Timestamp:
Apr 26, 2011, 6:49:49 AM (14 years ago)
Author:
rgrieder
Message:

Added solution to the rendering order problem proposed by Crazy Eddie. However the GUI is still drawn on top of the overlays.
However if you click on "Singleplayer", then get back to the main menu and now open the console, you will see part of it inside the Singleplayer button :D

Location:
code/branches/kicklib2/src/libraries/core
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/branches/kicklib2/src/libraries/core/GUIManager.cc

    r8304 r8336  
    5757#  include <RendererModules/Ogre/CEGUIOgreRenderer.h>
    5858#  include <RendererModules/Ogre/CEGUIOgreResourceProvider.h>
     59#  include <OgreCamera.h>
     60#  include <OgreRenderQueueListener.h>
     61#  include <OgreSceneManager.h>
    5962#endif
    6063
     
    109112        We need this to fix a problem with an uninitialised member variable
    110113        in CEGUI < 0.7 <br>
    111         Notice that "public" modifier for the otherwise private variables.
    112     */
    113     class CEGUILUA_API LuaScriptModuleWorkaround : public CEGUI::ScriptModule
     114        Notice the "public" modifier for the otherwise private variables.
     115    */
     116    class LuaScriptModuleWorkaround : public CEGUI::ScriptModule
    114117    {
    115118    public:
     
    125128        int d_activeErrFuncIndex;
    126129    };
     130#else
     131    /// RenderQueueListener based class used to hook into the ogre rendering system
     132    class RQListener : public Ogre::RenderQueueListener
     133    {
     134    public:
     135        /// Callback from Ogre invoked before other stuff in our target queue is rendered
     136        void renderQueueEnded(Ogre::uint8 id, const Ogre::String& invocation, bool& skipThisQueue)
     137        {
     138            if (id == Ogre::RENDER_QUEUE_SKIES_LATE)//Ogre::RENDER_QUEUE_OVERLAY)
     139                CEGUI::System::getSingleton().renderGUI();
     140        }
     141    };
    127142#endif
    128143
     
    171186#else
    172187        guiRenderer_ = &OgreRenderer::create(*GraphicsManager::getInstance().getRenderWindow());
     188        // We use our own RenderQueueListener so we can draw UNDER overlays
     189        guiRenderer_->setFrameControlExecutionEnabled(false);
     190        rqListener_ = new RQListener();
    173191        resourceProvider_ = &OgreRenderer::createOgreResourceProvider();
    174192        imageCodec_ = &OgreRenderer::createOgreImageCodec();
     
    245263#else
    246264        System::destroy();
    247         delete ceguiLogger_;
    248265        OgreRenderer::destroyOgreResourceProvider(*resourceProvider_);
    249266        OgreRenderer::destroyOgreImageCodec(*imageCodec_);
    250267        OgreRenderer::destroy(*guiRenderer_);
    251268        LuaScriptModule::destroy(*scriptModule_);
     269        delete ceguiLogger_;
     270        delete rqListener_;
    252271#endif
    253272        delete luaState_;
     
    292311    void GUIManager::setCamera(Ogre::Camera* camera)
    293312    {
    294         this->camera_ = camera;
    295313#ifdef ORXONOX_OLD_CEGUI
    296314        if (camera == NULL)
     
    298316        else
    299317            this->guiRenderer_->setTargetSceneManager(camera->getSceneManager());
    300 #endif
     318#else
     319        if (camera_ != NULL && camera_->getSceneManager() != NULL)
     320            camera_->getSceneManager()->removeRenderQueueListener(rqListener_);
     321        if (camera != NULL && camera->getSceneManager() != NULL)
     322            camera->getSceneManager()->addRenderQueueListener(rqListener_);
     323#endif
     324        this->camera_ = camera;
    301325    }
    302326
  • code/branches/kicklib2/src/libraries/core/GUIManager.h

    r8283 r8336  
    165165#else
    166166        CEGUI::OgreRenderer*                 guiRenderer_;      //!< CEGUI's interface to the Ogre Engine
     167        Ogre::RenderQueueListener*           rqListener_;       //!< RQ listener so we can draw UNDER Ogre overlays
    167168        CEGUI::OgreResourceProvider*         resourceProvider_; //!< CEGUI's resource provider
    168169        CEGUI::OgreImageCodec*               imageCodec_;
Note: See TracChangeset for help on using the changeset viewer.