Ignore:
Timestamp:
05/04/06 18:26:23 (19 years ago)
Author:
mattausch
Message:

updated to ogre 1.2

Location:
GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE
Files:
17 edited

Legend:

Unmodified
Added
Removed
  • GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/include/OgreOcclusionCullingSceneManager.h

    r868 r897  
    77#include <OgreOctreeCamera.h> 
    88#include <OgrePrerequisites.h> 
    9  
     9#include <OgreMovableObject.h> 
    1010#include "OgreOctreeHierarchyInterface.h" 
    1111#include "OgrePlatformQueryManager.h" 
    1212#include "VisibilityManager.h" 
     13#include "Containers.h" 
    1314#include "ViewCellsManager.h" 
    14  
    15 //class GtpVisibilityPreprocessor::ViewCellsManager; 
    16  
    1715 
    1816namespace Ogre { 
     
    2523{ 
    2624public: 
    27         OcclusionCullingSceneManager(GtpVisibility::VisibilityManager *visManager); 
     25        OcclusionCullingSceneManager(const String& name, GtpVisibility::VisibilityManager *visManager); 
    2826        ~OcclusionCullingSceneManager(); 
    2927 
     
    5755                Override so we can handle delayed rendering of transparent objects 
    5856        */ 
    59         virtual void renderObjects(const RenderPriorityGroup::TransparentRenderablePassList& objs,  
     57        virtual void renderObjects(const QueuedRenderableCollection& objs,  
     58                        QueuedRenderableCollection::OrganisationMode om,  
    6059            bool doLightIteration, const LightList* manualLightList = 0); 
    6160 
     
    6665        /** Override pass so we can do the z-fail pass.  
    6766        */ 
    68         Pass* setPass(Pass* pass); 
     67        const Pass* _setPass(Pass* pass); 
    6968 
    7069        /** Override from SceneManager so we can skip all but first pass for depth pass.  
    7170        */ 
    7271        bool validatePassForRendering(Pass* pass); 
    73         /** This function renders renderables using false color ids. 
    74         */ 
     72#ifdef ITEM_BUFFER 
    7573        void RenderItemBuffer(RenderPriorityGroup* pGroup); 
    76         /** Renders a single object using false color id. 
    77         */ 
    7874        void RenderSingleObjectForItemBuffer(Renderable *rend, Pass *pass); 
    79         /** Overritten from scene manager to include the false color id rendering of the 
    80                 scene objects. 
    81         */ 
    82         void renderQueueGroupObjects(RenderQueueGroup* pGroup); 
     75#endif // ITEM_BUFFER 
     76        void _renderQueueGroupObjects(RenderQueueGroup* pGroup, 
     77                QueuedRenderableCollection::OrganisationMode om); 
    8378 
    8479        /** Override from SceneManager so that sub entities can be assigned an id for item buffer. 
     
    9489        OctreeHierarchyInterface *GetHierarchyInterface(); 
    9590 
    96         /** Override this because we must handle shadows differently. 
     91        /** Inherited from scene manager. Neccesary to draw terrain properly. 
    9792        */ 
    9893        void endFrame(); 
    9994 
    100         void renderAdditiveStencilShadowedQueueGroupObjects(RenderQueueGroup* pGroup); 
    101         void renderModulativeStencilShadowedQueueGroupObjects(RenderQueueGroup* pGroup); 
     95        void renderAdditiveStencilShadowedQueueGroupObjects(RenderQueueGroup* pGroup, 
     96                QueuedRenderableCollection::OrganisationMode om); 
     97        void renderModulativeStencilShadowedQueueGroupObjects(RenderQueueGroup* pGroup, 
     98                QueuedRenderableCollection::OrganisationMode om); 
    10299 
    103100        /** Override standard function so octree boxes are always of equal side length. 
    104101                This has advantages for CHC, because terrain tiles are in different octree nodes 
    105102                and can be culled. 
     103                msz: Modified to reflect changes in Ogre::TerrainSceneManager 
    106104        */ 
    107         void setWorldGeometry( const String& filename ); 
     105        virtual void setWorldGeometry( DataStreamPtr& stream, const String& typeName ); 
    108106 
     107         
    109108        /** Loads view cells for this particular scene. 
    110109        */ 
  • GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/include/OgrePlatformHierarchyInterface.h

    r726 r897  
    110110        /** Deletes all occlusion queries. 
    111111        */ 
    112         void DeleteQueries(); 
     112        void ResetQueries(); 
    113113 
    114114protected: 
  • GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/include/OgrePlatformQueryManager.h

    r316 r897  
    4343 
    4444protected: 
    45  
     45#ifdef ITEM_BUFFER 
    4646        void CollectItemBufferResults( 
    4747                                GtpVisibility::MeshInfoContainer *visibleGeometry, 
     
    5050        void InitItemBuffer(GtpVisibility::MeshInfoContainer *visibleGeometry, 
    5151                                                GtpVisibility::PatchInfoContainer *visiblePatches); 
     52#endif // ITEM_BUFFER 
    5253 
    5354        Viewport *mViewport; 
  • GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/include/OgreVisibilityOctreeSceneManager.h

    r880 r897  
    77#include <OgreOctreeCamera.h> 
    88#include <OgrePrerequisites.h> 
    9  
     9#include <OgreMovableObject.h> 
    1010#include "OgreOctreeHierarchyInterface.h" 
    1111#include "OgrePlatformQueryManager.h" 
     
    2525{ 
    2626public: 
    27         VisibilityOctreeSceneManager(GtpVisibility::VisibilityManager *visManager); 
     27        VisibilityOctreeSceneManager(const String& name, GtpVisibility::VisibilityManager *visManager); 
    2828        ~VisibilityOctreeSceneManager(); 
    2929 
     
    5757                Override so we can handle delayed rendering of transparent objects 
    5858        */ 
    59         virtual void renderObjects(const RenderPriorityGroup::TransparentRenderablePassList& objs,  
     59        virtual void renderObjects(const QueuedRenderableCollection& objs,  
     60                        QueuedRenderableCollection::OrganisationMode om,  
    6061            bool doLightIteration, const LightList* manualLightList = 0); 
    6162 
     
    6667        /** Override pass so we can do the z-fail pass.  
    6768        */ 
    68         Pass* setPass(Pass* pass); 
     69        const Pass* _setPass(Pass* pass); 
    6970 
    7071        /** Override from SceneManager so we can skip all but first pass for depth pass.  
    7172        */ 
    7273        bool validatePassForRendering(Pass* pass); 
    73         /** This function renders renderables using false color ids. 
    74         */ 
     74#ifdef ITEM_BUFFER 
    7575        void RenderItemBuffer(RenderPriorityGroup* pGroup); 
    76         /** Renders a single object using false color id. 
    77         */ 
    7876        void RenderSingleObjectForItemBuffer(Renderable *rend, Pass *pass); 
    79         /** Overritten from scene manager to include the false color id rendering of the 
    80                 scene objects. 
    81         */ 
    82         void renderQueueGroupObjects(RenderQueueGroup* pGroup); 
     77#endif // ITEM_BUFFER 
     78        void _renderQueueGroupObjects(RenderQueueGroup* pGroup, QueuedRenderableCollection::OrganisationMode om); 
    8379 
    8480        /** Override from SceneManager so that sub entities can be assigned an id for item buffer. 
     
    9490        OctreeHierarchyInterface *GetHierarchyInterface(); 
    9591 
    96         void renderAdditiveStencilShadowedQueueGroupObjects(RenderQueueGroup* pGroup); 
    97         /** Override this because we must handle shadows differently. 
    98         */ 
    99         void renderModulativeStencilShadowedQueueGroupObjects(RenderQueueGroup* pGroup); 
     92        void renderAdditiveStencilShadowedQueueGroupObjects(RenderQueueGroup* pGroup,  
     93                QueuedRenderableCollection::OrganisationMode om); 
     94        void renderModulativeStencilShadowedQueueGroupObjects(RenderQueueGroup* pGroup, 
     95                QueuedRenderableCollection::OrganisationMode om); 
    10096 
    10197        void loadVisibilityConfig(const String& filename); 
     
    158154        bool mRenderNodesContentForViz; 
    159155 
    160         /// if we render transparents after the hierarchical traversal 
     156        /// render transparents after the hierarchical traversal 
    161157        bool mDelayRenderTransparents; 
    162158 
    163         /// if we use a depth pass (i.e., fill only the depth buffer in the first pass) 
     159        /// use a depth pass (i.e., fill only the depth buffer in the first pass) 
    164160        bool mUseDepthPass; 
    165         /// if we currently rendering the depth pass 
     161        /// flag indicating if we currently render the depth pass 
    166162        bool mIsDepthPassPhase; 
    167163 
     
    209205}; 
    210206 
     207/// Factory for VisibilityOctreeSceneManager 
     208class VisibilityOctreeSceneManagerFactory : public SceneManagerFactory 
     209{ 
     210protected: 
     211        void initMetaData(void) const; 
     212        GtpVisibility::VisibilityManager *visManager; 
     213public: 
     214        VisibilityOctreeSceneManagerFactory(GtpVisibility::VisibilityManager *vm) 
     215        { 
     216                visManager = vm; 
     217        } 
     218        ~VisibilityOctreeSceneManagerFactory() {} 
     219        /// Factory type name 
     220        static const String FACTORY_TYPE_NAME; 
     221        SceneManager* createInstance(const String& instanceName); 
     222        void destroyInstance(SceneManager* instance); 
     223}; 
     224 
    211225} // namespace Ogre 
    212226 
  • GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/include/OgreVisibilitySceneManager.h

    r115 r897  
    1818{ 
    1919public: 
    20         VisibilitySceneManager(GtpVisibility::VisibilityManager *visManager); 
     20        VisibilitySceneManager(const String& name, GtpVisibility::VisibilityManager *visManager); 
    2121        ~VisibilitySceneManager(); 
    2222 
  • GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/include/OgreVisibilityTerrainSceneManager.h

    r868 r897  
    2222{ 
    2323public: 
    24         VisibilityTerrainSceneManager(GtpVisibility::VisibilityManager *visManager); 
     24        VisibilityTerrainSceneManager(const String& name, GtpVisibility::VisibilityManager *visManager); 
    2525        ~VisibilityTerrainSceneManager(); 
    2626 
     
    5454                Override so we can handle delayed rendering of transparent objects 
    5555        */ 
    56         virtual void renderObjects(const RenderPriorityGroup::TransparentRenderablePassList& objs,  
     56        virtual void renderObjects(const QueuedRenderableCollection& objs,  
     57                        QueuedRenderableCollection::OrganisationMode om,  
    5758            bool doLightIteration, const LightList* manualLightList = 0); 
    5859 
     
    6162        void WriteLog(); 
    6263 
    63         /** Override pass so we can do the z-fail pass.  
    64         */ 
    65         Pass* setPass(Pass* pass); 
    66  
     64        /** We override this because we want to include the z-fail pass.  
     65        */ 
     66        const Pass* _setPass(Pass* pass); 
    6767        /** Override from SceneManager so we can skip all but first pass for depth pass.  
    6868        */ 
     
    7070        /** This function renders renderables using false color ids. 
    7171        */ 
     72#ifdef ITEM_BUFFER 
    7273        void RenderItemBuffer(RenderPriorityGroup* pGroup); 
    7374        /** Renders a single object using false color id. 
     
    7778                scene objects. 
    7879        */ 
    79         void renderQueueGroupObjects(RenderQueueGroup* pGroup); 
     80#endif // ITEM_BUFFER 
     81        void _renderQueueGroupObjects(RenderQueueGroup* pGroup, QueuedRenderableCollection::OrganisationMode om); 
    8082 
    8183        /** Override from SceneManager so that sub entities can be assigned an id for item buffer. 
     
    9799        /** Override this because we must handle shadows differently. 
    98100        */ 
    99         void renderAdditiveStencilShadowedQueueGroupObjects(RenderQueueGroup* pGroup); 
     101        void renderAdditiveStencilShadowedQueueGroupObjects(RenderQueueGroup* pGroup, 
     102                QueuedRenderableCollection::OrganisationMode om); 
    100103        /** Override this because we must handle shadows differently. 
    101104        */ 
    102         void renderModulativeStencilShadowedQueueGroupObjects(RenderQueueGroup* pGroup); 
    103  
    104         /** Override standard function so octree boxes are always of equal side length. 
    105                 This has advantages for CHC, because terrain tiles are in different octree nodes 
    106                 and can be culled. 
    107         */ 
    108         void setWorldGeometry(const String& filename); 
     105        void renderModulativeStencilShadowedQueueGroupObjects(RenderQueueGroup* pGroup,  
     106                QueuedRenderableCollection::OrganisationMode om); 
     107/// @copydoc SceneManager::getTypeName 
     108        const String& getTypeName(void) const; 
     109        static const String FACTORY_TYPE_NAME; 
     110 
     111        void setWorldGeometry( DataStreamPtr& stream, const String& typeName ); 
    109112 
    110113protected: 
     
    178181}; 
    179182 
     183/// Factory for VisibilityTerrainSceneManager 
     184class VisibilityTerrainSceneManagerFactory : public SceneManagerFactory 
     185{ 
     186protected: 
     187        typedef std::vector<TerrainPageSource*> TerrainPageSources; 
     188        TerrainPageSources mTerrainPageSources; 
     189        void initMetaData(void) const; 
     190        GtpVisibility::VisibilityManager *visManager; 
     191public: 
     192        VisibilityTerrainSceneManagerFactory(GtpVisibility::VisibilityManager *vm); 
     193        ~VisibilityTerrainSceneManagerFactory(); 
     194        /// Factory type name 
     195        static const String FACTORY_TYPE_NAME; 
     196        SceneManager* createInstance(const String& instanceName); 
     197        void destroyInstance(SceneManager* instance); 
     198}; 
     199 
    180200} // namespace Ogre 
    181201 
  • GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/scripts/Plugin_VisibilitySceneManager.vcproj

    r863 r897  
    104104                                Name="VCLinkerTool" 
    105105                                IgnoreImportLibrary="TRUE" 
    106                                 AdditionalDependencies="OgreMain.lib CEGUIBase.lib OgreGUIRenderer.lib Plugin_OctreeSceneManager.lib GtpVisibility.lib Preprocessor.lib xerces-c_2.lib zdll.lib zziplibd.lib devil.lib qtmain.lib QtOpenGL4.lib QtCored4.lib QtGuid4.lib Qt3Support4.lib QAxContainer.lib glut32.lib OpenGL32.Lib glu32.lib cg.lib cgGL.lib" 
     106                                AdditionalDependencies="OgreMain.lib CEGUIBase.lib OgreGUIRenderer.lib Plugin_OctreeSceneManager.lib GtpVisibility.lib zdll.lib zziplibd.lib Preprocessor.lib xerces-c_2.lib devil.lib qtmain.lib QtOpenGL4.lib QtCored4.lib QtGuid4.lib Qt3Support4.lib QAxContainer.lib glut32.lib OpenGL32.Lib glu32.lib cg.lib cgGL.lib" 
    107107                                OutputFile="$(OutDir)/Plugin_VisibilitySceneManager.dll" 
    108108                                Version="0.99" 
    109109                                LinkIncremental="1" 
    110110                                SuppressStartupBanner="TRUE" 
    111                                 AdditionalLibraryDirectories="&quot;$(OGRE_PATH)\PlugIns\OctreeSceneManager\bin\$(ConfigurationName)&quot;;&quot;$(OGRE_PATH)\OgreMain\lib\$(ConfigurationName)&quot;;&quot;$(OGRE_PATH)\Samples\Common\CEGUIRenderer\lib&quot;;&quot;..\..\GtpVisibility\lib\$(ConfigurationName)&quot;;&quot;..\..\lib\$(ConfigurationName)&quot;;&quot;..\lib\$(ConfigurationName)&quot;;&quot;$(OGRE_PATH)\Dependencies\lib\$(ConfigurationName)&quot;;&quot;..\..\..\Preprocessing\lib\$(ConfigurationName)&quot;;..\support\xercesc\lib\;..\..\..\..\..\..\..\NonGTP\Xerces;..\..\..\..\..\..\..\NonGTP\Xerces\xercesc\lib;..\..\..\..\..\..\..\NonGTP\zlib\lib;..\..\..\..\..\..\..\NonGTP\Devil\lib;&quot;$(QTDIR)\lib&quot;;&quot;$(CG_LIB_PATH)&quot;;..\..\..\Preprocessing\src\GL" 
     111                                AdditionalLibraryDirectories="&quot;$(OGRE_PATH)\PlugIns\OctreeSceneManager\bin\$(ConfigurationName)&quot;;&quot;$(OGRE_PATH)\OgreMain\lib\$(ConfigurationName)&quot;;&quot;$(OGRE_PATH)\Samples\Common\CEGUIRenderer\lib&quot;;&quot;..\..\GtpVisibility\lib\$(ConfigurationName)&quot;;&quot;..\..\lib\$(ConfigurationName)&quot;;&quot;..\lib\$(ConfigurationName)&quot;;&quot;$(OGRE_PATH)\Dependencies\lib\$(ConfigurationName)&quot;;..\..\..\..\..\..\..\NonGTP\Zlib\lib;&quot;..\..\..\Preprocessing\lib\$(ConfigurationName)&quot;;..\..\..\..\..\..\..\NonGTP\Xerces\xercesc\lib;&quot;$(QTDIR)\lib&quot;;..\..\..\Preprocessing\src\GL;&quot;$(CG_LIB_PATH)&quot;" 
    112112                                ModuleDefinitionFile="..\misc\OgreVisibilitySceneManager.def" 
    113113                                GenerateDebugInformation="TRUE" 
  • GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreOcclusionCullingSceneManager.cpp

    r868 r897  
    1010#include <OgreEntity.h> 
    1111#include <OgreSubEntity.h> 
     12#include <OgreMaterialManager.h> 
    1213#include <OgreIteratorWrappers.h> 
    1314#include "VspBspTree.h" 
     
    2223 
    2324//----------------------------------------------------------------------- 
    24 OcclusionCullingSceneManager::OcclusionCullingSceneManager( 
    25                                                         GtpVisibility::VisibilityManager *visManager):  
    26 TerrainSceneManager(), 
     25OcclusionCullingSceneManager::OcclusionCullingSceneManager(const String& name,  
     26                                                        GtpVisibility::VisibilityManager *visManager): 
     27TerrainSceneManager(name), 
    2728mVisibilityManager(visManager),  
    2829mShowVisualization(false), 
     
    3536mIsDepthPassPhase(false), 
    3637mUseItemBuffer(false), 
     38//mUseItemBuffer(true), 
    3739mIsItemBufferPhase(false), 
    3840mCurrentEntityId(1), 
     
    105107        //mItemBufferPass->setAmbient(1, 1, 0); 
    106108} 
     109//------------------------------------------------------------------------- 
     110void OcclusionCullingSceneManager::setWorldGeometry( DataStreamPtr& stream, const String& typeName ) 
     111{ 
     112    // Clear out any existing world resources (if not default) 
     113    if (ResourceGroupManager::getSingleton().getWorldResourceGroupName() !=  
     114        ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME) 
     115    { 
     116        ResourceGroupManager::getSingleton().clearResourceGroup( 
     117            ResourceGroupManager::getSingleton().getWorldResourceGroupName()); 
     118    } 
     119        destroyLevelIndexes(); 
     120    mTerrainPages.clear(); 
     121    // Load the configuration 
     122    loadConfig( stream ); 
     123        initLevelIndexes(); 
     124 
     125    // Resize the octree, allow for 1 page for now 
     126    float max_x = mOptions.scale.x * mOptions.pageSize; 
     127    float max_y = mOptions.scale.y; 
     128    float max_z = mOptions.scale.z * mOptions.pageSize; 
     129 
     130        float maxAxis = std::max(max_x, max_y); 
     131        maxAxis = std::max(maxAxis, max_z); 
     132        resize( AxisAlignedBox( 0, 0, 0, maxAxis, maxAxis, maxAxis ) ); 
     133     
     134    setupTerrainMaterial(); 
     135 
     136    setupTerrainPages(); 
     137 
     138 } 
     139 
    107140//----------------------------------------------------------------------- 
    108141void OcclusionCullingSceneManager::PrepareVisualization(Camera *cam) 
     
    157190} 
    158191//----------------------------------------------------------------------- 
    159 Pass *OcclusionCullingSceneManager::setPass(Pass* pass) 
     192const Pass *OcclusionCullingSceneManager::_setPass(Pass* pass) 
    160193{ 
    161194        if (NORMAL_RENDER_HACK) 
    162195        { 
    163                 return SceneManager::setPass(pass); 
     196                return SceneManager::_setPass(pass); 
    164197        } 
    165198 
     
    217250 
    218251        //-- set actual pass here 
    219         Pass *result = SceneManager::setPass(usedPass); 
     252        const Pass *result = SceneManager::_setPass(usedPass); 
    220253 
    221254 
     
    232265} 
    233266//----------------------------------------------------------------------- 
    234 void OcclusionCullingSceneManager::_findVisibleObjects(Camera* cam, bool onlyShadowCasters) 
     267void OcclusionCullingSceneManager::_findVisibleObjects(Camera* cam, 
     268                                                                                                                bool onlyShadowCasters) 
    235269{ 
    236270        if (NORMAL_RENDER_HACK) 
     
    335369                addSpecialCaseRenderQueue(RENDER_QUEUE_SKIES_LATE); 
    336370                addSpecialCaseRenderQueue(RENDER_QUEUE_OVERLAY); 
    337                          
     371         
    338372                // exclude this queues from hierarchical rendering 
    339373                setSpecialCaseRenderQueueMode(SceneManager::SCRQM_EXCLUDE); 
     
    343377                InitVisibilityCulling(mCameraInProgress); 
    344378 
    345          
     379 
    346380                /**  
    347381                * the hierarchical culling algorithm 
     
    366400                 
    367401                mLeavePassesInQueue = 0; 
    368  
     402                 
    369403#if 1    
    370404                // add visible nodes found by the visibility culling algorithm 
     
    495529                if (useArbQueries) 
    496530                { 
    497                         mHierarchyInterface->DeleteQueries(); 
     531                        mHierarchyInterface->ResetQueries(); 
    498532                        mDestRenderSystem->setConfigOption("ArbQueries", "Yes"); 
    499533                } 
    500534                else 
    501535                { 
    502                         mHierarchyInterface->DeleteQueries(); 
     536                        mHierarchyInterface->ResetQueries(); 
    503537                        mDestRenderSystem->setConfigOption("ArbQueries", "No"); 
    504538                } 
    505539        } 
    506  
    507540        return VisibilityOptionsManager(mVisibilityManager, mHierarchyInterface). 
    508541                setOption(key, val) || TerrainSceneManager::setOption(key, val); 
     
    564597//----------------------------------------------------------------------- 
    565598void OcclusionCullingSceneManager::renderObjects( 
    566         const RenderPriorityGroup::TransparentRenderablePassList& objs,  
     599        const QueuedRenderableCollection& objs, 
     600        QueuedRenderableCollection::OrganisationMode om, 
    567601    bool doLightIteration, const LightList* manualLightList) 
    568602{ 
     
    571605        if (NORMAL_RENDER_HACK || !mSkipTransparents) 
    572606        { 
    573                 OctreeSceneManager::renderObjects(objs, doLightIteration, manualLightList); 
     607                OctreeSceneManager::renderObjects(objs, om, doLightIteration, manualLightList); 
    574608        } 
    575609} 
     
    596630} 
    597631//----------------------------------------------------------------------- 
    598 void OcclusionCullingSceneManager::renderQueueGroupObjects(RenderQueueGroup* pGroup) 
     632void OcclusionCullingSceneManager::_renderQueueGroupObjects(RenderQueueGroup* pGroup, 
     633                                                                                                                        QueuedRenderableCollection::OrganisationMode om) 
    599634{ 
    600635        if (NORMAL_RENDER_HACK || !mIsItemBufferPhase) 
    601636        { 
    602                 TerrainSceneManager::renderQueueGroupObjects(pGroup); 
     637                TerrainSceneManager::_renderQueueGroupObjects(pGroup, om); 
    603638                return; 
    604639        } 
    605  
     640#ifdef  ITEM_BUFFER 
     641        //-- item buffer 
    606642        //-- item buffer: render objects using false colors 
    607643 
     
    613649                RenderItemBuffer(groupIt.getNext()); 
    614650        } 
    615 } 
     651#endif // ITEM_BUFFER 
     652} 
     653#ifdef ITEM_BUFFER 
    616654//----------------------------------------------------------------------- 
    617655void OcclusionCullingSceneManager::RenderItemBuffer(RenderPriorityGroup* pGroup) 
    618656{ 
    619657        // Do solids 
    620         RenderPriorityGroup::SolidRenderablePassMap solidObjs = pGroup->_getSolidPasses(); 
     658        QueuedRenderableCollection solidObjs = pGroup->getSolidsBasic();//msz 
    621659 
    622660        // ----- SOLIDS LOOP ----- 
     
    658696        if (mRenderTransparentsForItemBuffer) 
    659697        { 
    660                 RenderPriorityGroup::TransparentRenderablePassList transpObjs =  
    661                         pGroup->_getTransparentPasses(); 
     698                QueuedRenderableCollection transpObjs = pGroup->getTransparents(); //msz 
    662699                RenderPriorityGroup::TransparentRenderablePassList::const_iterator  
    663700                        itrans, itransend; 
     
    713750        } 
    714751 
    715         Pass *usedPass = setPass(mItemBufferPass);  
     752        const Pass *usedPass = _setPass(mItemBufferPass);  
    716753 
    717754 
     
    719756        renderSingleObject(rend, usedPass, false, &nullLightList); 
    720757} 
     758#endif // ITEM_BUFFER 
    721759//----------------------------------------------------------------------- 
    722760GtpVisibility::VisibilityManager *OcclusionCullingSceneManager::GetVisibilityManager() 
     
    749787        mLeavePassesInQueue = 0; 
    750788 
    751         if (!mUseDepthPass && !mUseItemBuffer) 
     789        // if we have the depth pass or use an item buffer, no passes are left in the queue 
     790        if (1 && !mUseDepthPass && !mUseItemBuffer) 
    752791        { 
    753792                if (mShadowTechnique == SHADOWTYPE_STENCIL_ADDITIVE) 
     
    761800 
    762801                        // just render ambient stuff 
    763                         mIlluminationStage = IRS_AMBIENT; 
    764                         getRenderQueue()->setSplitPassesByLightingType(true); 
     802                        /*** msz: no more IRS_AMBIENT, see OgreSceneManager.h ***/ 
     803                        // mIlluminationStage = IRS_AMBIENT;  
    765804                } 
    766805         
     
    820859} 
    821860//----------------------------------------------------------------------- 
    822 void OcclusionCullingSceneManager::renderAdditiveStencilShadowedQueueGroupObjects(RenderQueueGroup* pGroup) 
     861void OcclusionCullingSceneManager::renderAdditiveStencilShadowedQueueGroupObjects( 
     862        RenderQueueGroup* pGroup, QueuedRenderableCollection::OrganisationMode om) 
    823863{ 
    824864        // only render solid passes during hierarchical culling 
     
    839879 
    840880                        // Render all the ambient passes first, no light iteration, no lights 
    841                         mIlluminationStage = IRS_AMBIENT; 
    842  
    843                         OctreeSceneManager::renderObjects(pPriorityGrp->_getSolidPasses(), false, &lightList); 
     881                        /*** msz: no more IRS_AMBIENT, see OgreSceneManager.h ***/ 
     882                        // mIlluminationStage = IRS_AMBIENT; 
     883 
     884                        OctreeSceneManager::renderObjects(pPriorityGrp->getSolidsBasic(), om, false, &lightList); 
    844885                        // Also render any objects which have receive shadows disabled 
    845                         OctreeSceneManager::renderObjects(pPriorityGrp->_getSolidPassesNoShadow(), true); 
     886                        OctreeSceneManager::renderObjects(pPriorityGrp->getSolidsNoShadowReceive(), om, true); 
    846887                } 
    847888        } 
    848889        else 
    849890        { 
    850                 OctreeSceneManager::renderAdditiveStencilShadowedQueueGroupObjects(pGroup); 
    851         } 
    852 } 
    853 //----------------------------------------------------------------------- 
    854 void OcclusionCullingSceneManager::renderModulativeStencilShadowedQueueGroupObjects(RenderQueueGroup* pGroup) 
     891                OctreeSceneManager::renderAdditiveStencilShadowedQueueGroupObjects(pGroup, om); 
     892        } 
     893} 
     894//----------------------------------------------------------------------- 
     895void OcclusionCullingSceneManager::renderModulativeStencilShadowedQueueGroupObjects( 
     896        RenderQueueGroup* pGroup, QueuedRenderableCollection::OrganisationMode om) 
    855897{ 
    856898   if (mIsHierarchicalCulling) 
     
    867909 
    868910                   // Do (shadowable) solids 
    869                    OctreeSceneManager::renderObjects(pPriorityGrp->_getSolidPasses(), true); 
     911                   OctreeSceneManager::renderObjects(pPriorityGrp->getSolidsBasic(), om, true); 
    870912           } 
    871913   } 
    872914   else 
    873915   { 
    874            SceneManager::renderModulativeStencilShadowedQueueGroupObjects(pGroup); 
     916           SceneManager::renderModulativeStencilShadowedQueueGroupObjects(pGroup, om); 
    875917   } 
    876 } 
    877 //------------------------------------------------------------------------- 
    878 void OcclusionCullingSceneManager::setWorldGeometry( const String& filename ) 
    879 { 
    880     // Clear out any existing world resources (if not default) 
    881     if (ResourceGroupManager::getSingleton().getWorldResourceGroupName() !=  
    882         ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME) 
    883     { 
    884         ResourceGroupManager::getSingleton().clearResourceGroup( 
    885             ResourceGroupManager::getSingleton().getWorldResourceGroupName()); 
    886     } 
    887     mTerrainPages.clear(); 
    888     // Load the configuration 
    889     loadConfig(filename); 
    890  
    891     // Resize the octree, allow for 1 page for now 
    892     float max_x = mOptions.scale.x * mOptions.pageSize; 
    893     float max_y = mOptions.scale.y; 
    894     float max_z = mOptions.scale.z * mOptions.pageSize; 
    895  
    896         float maxAxis = std::max(max_x, max_y); 
    897         maxAxis = std::max(maxAxis, max_z); 
    898         resize( AxisAlignedBox( 0, 0, 0, maxAxis, maxAxis, maxAxis ) ); 
    899      
    900     setupTerrainMaterial(); 
    901     setupTerrainPages(); 
    902918} 
    903919 
  • GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgrePlatformHierarchyInterface.cpp

    r726 r897  
    44#include <OgreEntity.h> 
    55#include <OgreMovableObject.h> 
     6#include <OgreMaterialManager.h> 
    67#include "OgreSolidBoundingBox.h" 
    78#include "OgrePlatformHierarchyInterface.h" 
     
    7374PlatformHierarchyInterface::~PlatformHierarchyInterface() 
    7475{ 
    75         DeleteQueries(); 
     76        ResetQueries(); 
    7677 
    7778        OGRE_DELETE(mSolidBoundingBox); 
    7879} 
    7980//----------------------------------------------------------------------- 
    80 void PlatformHierarchyInterface::DeleteQueries() 
    81 { 
    82         for (int i = 0; i < (int)mOcclusionQueries.size(); ++ i) 
    83                 OGRE_DELETE(mOcclusionQueries[i]); 
     81void PlatformHierarchyInterface::ResetQueries() 
     82{ 
     83//      for (int i = 0; i < (int)mOcclusionQueries.size(); ++ i) OGRE_DELETE(mOcclusionQueries[i]); 
    8484 
    8585        mCurrentTestIdx = 0; 
    86     mOcclusionQueries.clear(); 
     86    //mOcclusionQueries.clear(); 
    8787} 
    8888//----------------------------------------------------------------------- 
     
    9797         
    9898        // set no depth write, no color, no lighting material 
    99         mSceneManager->setPassWrapper(solidBox->getTechnique()->getPass(0)); // HACK! (mySetPass should be setPass) 
     99        //mSceneManager->setPassWrapper(solidBox->getTechnique()->getPass(0)); // HACK! (mySetPass should be setPass) 
     100        mSceneManager->_setPass(solidBox->getTechnique()->getPass(0)); // HACK! (mySetPass should be setPass) 
    100101        //SetOcclusionPass(); 
    101102 
     
    119120GtpVisibility::OcclusionQuery *PlatformHierarchyInterface::GetNextOcclusionQuery() 
    120121{ 
    121         if (mCurrentTestIdx == mOcclusionQueries.size()) 
     122        // create new query if there is no query left 
     123        if (mCurrentTestIdx == (int)mOcclusionQueries.size()) 
    122124        { 
    123125                mOcclusionQueries.push_back(new PlatformOcclusionQuery(mRenderSystem)); 
  • GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgrePlatformOcclusionQuery.cpp

    r115 r897  
    2828                                                                                        const bool waitForResult) const 
    2929{ 
    30         return mHardwareOcclusionQuery->pullOcclusionQuery(&visiblePixels, waitForResult); 
     30        // return mHardwareOcclusionQuery->pullOcclusionQuery(&visiblePixels, waitForResult); 
     31 
     32        bool isAvailable = true; 
     33 
     34        if (!waitForResult) 
     35                isAvailable = !mHardwareOcclusionQuery->isStillOutstanding(); 
     36 
     37        if (isAvailable) 
     38                return mHardwareOcclusionQuery->pullOcclusionQuery(&visiblePixels); 
     39 
     40        return isAvailable; 
    3141} 
    3242 
  • GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgrePlatformQueryManager.cpp

    r726 r897  
    111111        mViewport->setBackgroundColour(ColourValue(0, 0, 0, 0)); 
    112112        //pfHierarchyInterface->GetRenderSystem()->clearFrameBuffer(FBT_COLOUR | FBT_DEPTH); 
    113  
     113#ifdef ITEM_BUFFER 
    114114        // initialise item buffer (if not already initialised) 
    115115        InitItemBuffer(visibleGeometry, visiblePatches); 
     
    120120        bool useItemBuffer = true; 
    121121        sm->setOption("UseItemBuffer", &useItemBuffer); 
    122  
     122#endif // ITEM_BUFFER 
    123123 
    124124        sm->_renderScene(pCam, mViewport, false); // render item buffer 
    125125    
    126  
     126#ifdef ITEM_BUFFER 
    127127        //-- collect results 
    128128        CollectItemBufferResults(visibleGeometry, visiblePatches); 
     
    132132        useItemBuffer = false; // don't need item buffer anymore 
    133133        sm->setOption("UseItemBuffer", &useItemBuffer); 
     134#endif // ITEM_BUFFER 
    134135 
    135136        mWasInitialised = false; // reset initialised - flag 
     
    137138        mViewport->setBackgroundColour(bg); // reset background color 
    138139} 
     140#ifdef ITEM_BUFFER 
    139141//----------------------------------------------------------------------- 
    140142void PlatformQueryManager::CollectItemBufferResults( 
     
    232234        } 
    233235} 
     236#endif // ITEM_BUFFER 
    234237//----------------------------------------------------------------------- 
    235238void PlatformQueryManager::SetViewport(Viewport *vp) 
  • GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreSceneContentGenerator.cpp

    r415 r897  
    207207                mEntities.pop_back(); 
    208208                 
    209                 mSceneMgr->removeEntity(ent); 
     209                mSceneMgr->destroyEntity(ent); 
    210210        } 
    211211} 
  • GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreVisibilityOctreeSceneManager.cpp

    r880 r897  
    99#include <OgreEntity.h> 
    1010#include <OgreSubEntity.h> 
     11#include <OgreMaterialManager.h> 
    1112#include <OgreIteratorWrappers.h> 
    1213#include "VspBspTree.h" 
     
    2425 
    2526//----------------------------------------------------------------------- 
    26 VisibilityOctreeSceneManager::VisibilityOctreeSceneManager( 
    27         GtpVisibility::VisibilityManager *visManager): 
    28 OctreeSceneManager(), 
     27VisibilityOctreeSceneManager::VisibilityOctreeSceneManager(const String& name,  
     28        GtpVisibility::VisibilityManager *visManager) 
     29: 
     30OctreeSceneManager(name), 
    2931mVisibilityManager(visManager),  
    3032mShowVisualization(false), 
     
    135137    } 
    136138        // add bounding boxes of rendered objects 
    137         if (0) 
     139        if (1) 
    138140        for (BoxList::iterator it = mBoxes.begin(); it != mBoxes.end(); ++it) 
    139141{ 
     
    159161                                        (*it)->getAttachedObject(0)->isVisible()) 
    160162                                { 
    161                                         getRenderQueue()->addRenderable((*it)); 
    162                                 } 
     163                                getRenderQueue()->addRenderable((*it)); 
     164                        } 
    163165                        } 
    164166                        // add renderables itself 
     
    171173} 
    172174//----------------------------------------------------------------------- 
    173 Pass *VisibilityOctreeSceneManager::setPass(Pass* pass) 
     175const Pass *VisibilityOctreeSceneManager::_setPass(Pass* pass) 
    174176{ 
    175177        if (NORMAL_RENDER_HACK) 
    176178        { 
    177                 return SceneManager::setPass(pass); 
     179                return SceneManager::_setPass(pass); 
    178180        } 
    179181 
     
    230232 
    231233        //-- set actual pass here 
    232         Pass *result = SceneManager::setPass(usedPass); 
     234        const Pass *result = SceneManager::_setPass(usedPass); 
    233235 
    234236 
     
    291293        { 
    292294                OctreeSceneManager::_renderVisibleObjects(); 
    293  
     295         
    294296                return; 
    295297        } 
     
    357359                // exclude this queues from hierarchical rendering 
    358360                setSpecialCaseRenderQueueMode(SceneManager::SCRQM_EXCLUDE); 
     361         
    359362 
    360363                // set all necessary parameters for  
     
    402405                //-- used for depth pass, transparents, overlay 
    403406                clearSpecialCaseRenderQueues(); 
    404  
     407         
     408                //-- we render all remaining queue objects 
     409                // used for depth pass, transparents, overlay  
     410                clearSpecialCaseRenderQueues(); 
    405411                OctreeSceneManager::_renderVisibleObjects(); 
    406412         
    407         } // hierarchical culling 
     413        }   // hierarchical culling 
    408414 
    409415        // reset ambient light 
     
    535541                return true; 
    536542        } 
    537  
     543         
    538544        return VisibilityOptionsManager(mVisibilityManager, mHierarchyInterface). 
    539545                setOption(key, val) || OctreeSceneManager::setOption(key, val); 
     
    593599//----------------------------------------------------------------------- 
    594600void VisibilityOctreeSceneManager::renderObjects( 
    595         const RenderPriorityGroup::TransparentRenderablePassList& objs,  
     601                        const QueuedRenderableCollection& objs,  
     602                        QueuedRenderableCollection::OrganisationMode om, 
    596603            bool doLightIteration, const LightList* manualLightList) 
    597604{ 
     
    600607        if (NORMAL_RENDER_HACK || !mSkipTransparents) 
    601608        { 
    602                 OctreeSceneManager::renderObjects(objs, doLightIteration, manualLightList); 
     609                OctreeSceneManager::renderObjects(objs, om, doLightIteration, manualLightList); 
    603610        } 
    604611} 
     
    625632} 
    626633//----------------------------------------------------------------------- 
    627 void VisibilityOctreeSceneManager::renderQueueGroupObjects(RenderQueueGroup* pGroup) 
     634void VisibilityOctreeSceneManager::_renderQueueGroupObjects( 
     635        RenderQueueGroup* pGroup, QueuedRenderableCollection::OrganisationMode om) 
    628636{ 
    629637        if (NORMAL_RENDER_HACK || !mIsItemBufferPhase) 
    630638        { 
    631                 OctreeSceneManager::renderQueueGroupObjects(pGroup); 
     639                OctreeSceneManager::_renderQueueGroupObjects(pGroup, om); 
    632640                return; 
    633641        } 
    634  
    635         //-- item buffer: render objects using false colors 
     642#ifdef ITEM_BUFFER 
     643        //-- renders item buffer 
    636644 
    637645    // Iterate through priorities 
     
    642650                RenderItemBuffer(groupIt.getNext()); 
    643651        } 
    644 } 
     652#endif // ITEM_BUFFER 
     653} 
     654#ifdef ITEM_BUFFER 
    645655//----------------------------------------------------------------------- 
    646656void VisibilityOctreeSceneManager::RenderItemBuffer(RenderPriorityGroup* pGroup) 
     
    748758        renderSingleObject(rend, usedPass, false, &nullLightList); 
    749759} 
     760#endif // ITEM_BUFFER 
    750761//----------------------------------------------------------------------- 
    751762GtpVisibility::VisibilityManager *VisibilityOctreeSceneManager::GetVisibilityManager() 
     
    789800                        mLeavePassesInQueue |= RenderPriorityGroup::TRANSPARENT_PASSES; 
    790801 
    791                         // just render ambient stuff 
    792                         mIlluminationStage = IRS_AMBIENT; 
     802                        // just render ambient passes 
     803                        /*** msz: no more IRS_AMBIENT, see OgreSceneManager.h ***/ 
     804                        // mIlluminationStage = IRS_AMBIENT; 
    793805                        getRenderQueue()->setSplitPassesByLightingType(true); 
    794806                } 
     
    821833                                                        mLeavePassesInQueue); 
    822834                 
     835        //std::stringstream d; d << "leave passes in queue: " << mLeavePassesInQueue; 
     836        //LogManager::getSingleton().logMessage(d.str()); 
    823837} 
    824838//----------------------------------------------------------------------- 
     
    845859//----------------------------------------------------------------------- 
    846860void VisibilityOctreeSceneManager::renderAdditiveStencilShadowedQueueGroupObjects( 
    847         RenderQueueGroup* pGroup) 
     861        RenderQueueGroup* pGroup, QueuedRenderableCollection::OrganisationMode om) 
    848862{ 
    849863        // only render solid passes during hierarchical culling 
     
    864878 
    865879                        // Render all the ambient passes first, no light iteration, no lights 
    866                         mIlluminationStage = IRS_AMBIENT; 
    867  
    868                         OctreeSceneManager::renderObjects(pPriorityGrp->_getSolidPasses(), false, &lightList); 
     880                        /*** msz: no more IRS_AMBIENT, see OgreSceneManager.h ***/ 
     881                        // mIlluminationStage = IRS_AMBIENT; 
     882 
     883                        OctreeSceneManager::renderObjects(pPriorityGrp->getSolidsBasic(), om, false, &lightList); 
    869884                        // Also render any objects which have receive shadows disabled 
    870                         OctreeSceneManager::renderObjects(pPriorityGrp->_getSolidPassesNoShadow(), true); 
     885                        OctreeSceneManager::renderObjects(pPriorityGrp->getSolidsNoShadowReceive(), om, true);           
    871886#if 0            
    872887                        std::stringstream d;  
     
    881896        else // render the rest of the passes 
    882897        { 
    883                 OctreeSceneManager::renderAdditiveStencilShadowedQueueGroupObjects(pGroup); 
    884         } 
    885 } 
    886 //----------------------------------------------------------------------- 
    887 void VisibilityOctreeSceneManager::renderModulativeStencilShadowedQueueGroupObjects(RenderQueueGroup* pGroup) 
     898                OctreeSceneManager::renderAdditiveStencilShadowedQueueGroupObjects(pGroup, om); 
     899        } 
     900} 
     901//----------------------------------------------------------------------- 
     902void VisibilityOctreeSceneManager::renderModulativeStencilShadowedQueueGroupObjects( 
     903        RenderQueueGroup* pGroup, QueuedRenderableCollection::OrganisationMode om) 
    888904{ 
    889905   if (mIsHierarchicalCulling) 
     
    900916 
    901917                   // Do (shadowable) solids 
    902                    OctreeSceneManager::renderObjects(pPriorityGrp->_getSolidPasses(), true); 
     918                   OctreeSceneManager::renderObjects(pPriorityGrp->getSolidsBasic(), om, true); 
    903919           } 
    904920   } 
    905921   else 
    906922   { 
    907            SceneManager::renderModulativeStencilShadowedQueueGroupObjects(pGroup); 
     923           SceneManager::renderModulativeStencilShadowedQueueGroupObjects(pGroup, om); 
    908924   } 
    909925} 
    910  
     926//------------------------------------------------------------------------- 
     927void VisibilityOctreeSceneManager::SetObjectsVisible(const bool visible) 
     928{ 
     929        GtpVisibilityPreprocessor::ObjectContainer::iterator it, it_end = mObjects.end(); 
     930 
     931        for (it = mObjects.begin(); it != it_end; ++ it) 
     932        { 
     933                OgreMeshInstance *omi = static_cast<OgreMeshInstance *>(*it); 
     934                Entity *ent = omi->GetMesh(); 
     935                ent->setVisible(visible); 
     936        } 
     937} 
     938//------------------------------------------------------------------------- 
     939void VisibilityOctreeSceneManager::loadVisibilityConfig(const String& filename) 
     940{ 
     941        // TODO matt 
     942        // Set up the options 
     943        ConfigFile config; 
     944        String val; 
     945 
     946        config.load(filename); 
     947 
     948        val = config.getSetting("Algorithm"); 
     949 
     950    if (!val.empty()) 
     951        { 
     952                 VisibilityOptionsManager(mVisibilityManager, mHierarchyInterface).setOption("Algorithm", val.c_str()); 
     953        } 
     954 
     955        val = config.getSetting("UseDepthPass"); 
     956 
     957        if (!val.empty()) 
     958        { 
     959                 setOption("UseDepthPass", val.c_str()); 
     960        } 
     961} 
     962//------------------------------------------------------------------------- 
    911963inline static AxisAlignedBox EnlargeBox(const AxisAlignedBox &box) 
    912964{ 
     
    10561108} 
    10571109//------------------------------------------------------------------------- 
    1058 void VisibilityOctreeSceneManager::SetObjectsVisible(const bool visible) 
    1059 { 
    1060         // for OGRE 1.2 
    1061 //#ifdef OGRE12 
    1062         //MovableObjectIterator mit = getMovableObjectIterator("Entity"); 
    1063 #if 0 
    1064         EntityIterator eit = getEntityIterator(); 
    1065  
    1066         // set all objects to invisible (initially); 
    1067         while (eit.hasMoreElements()) 
    1068         { 
    1069                 Entity *ent = eit.getNext(); 
    1070                 ent->setVisible(visible); 
    1071         } 
    1072  
    1073 #else 
    1074         GtpVisibilityPreprocessor::ObjectContainer::iterator it, it_end = mObjects.end(); 
    1075  
    1076         for (it = mObjects.begin(); it != it_end; ++ it) 
    1077         { 
    1078                 OgreMeshInstance *omi = static_cast<OgreMeshInstance *>(*it); 
    1079                 Entity *ent = omi->GetMesh(); 
    1080                 ent->setVisible(visible); 
    1081         } 
    1082 #endif 
    1083 } 
    1084 //------------------------------------------------------------------------- 
    1085 void VisibilityOctreeSceneManager::loadVisibilityConfig(const String &filename) 
    1086 { 
    1087         // TODO matt 
    1088         // Set up the options 
    1089         ConfigFile config; 
    1090         String val; 
    1091  
    1092         config.load(filename); 
    1093  
    1094         val = config.getSetting("Algorithm"); 
    1095  
    1096     if (!val.empty()) 
    1097         { 
    1098                  VisibilityOptionsManager(mVisibilityManager, mHierarchyInterface).setOption("Algorithm", val.c_str()); 
    1099         } 
    1100  
    1101         val = config.getSetting("UseDepthPass"); 
    1102  
    1103         if (!val.empty()) 
    1104         { 
    1105                  setOption("UseDepthPass", val.c_str()); 
    1106         } 
    1107 } 
    1108 //------------------------------------------------------------------------- 
    11091110void VisibilityOctreeSceneManager::updatePvs(Camera *cam) 
    11101111{ 
     
    11561157} 
    11571158 
     1159 
     1160 
     1161//----------------------------------------------------------------------- 
     1162const String VisibilityOctreeSceneManagerFactory::FACTORY_TYPE_NAME = "VisibilityOctreeSceneManager"; 
     1163//----------------------------------------------------------------------- 
     1164void VisibilityOctreeSceneManagerFactory::initMetaData(void) const 
     1165{ 
     1166        mMetaData.typeName = FACTORY_TYPE_NAME; 
     1167        mMetaData.description = "Scene manager organising the scene on the basis of an octree with advanced occlusion culling (TM)."; 
     1168        mMetaData.sceneTypeMask = 0xFFFF; // support all types 
     1169        mMetaData.worldGeometrySupported = false; 
     1170} 
     1171//----------------------------------------------------------------------- 
     1172SceneManager* VisibilityOctreeSceneManagerFactory::createInstance( 
     1173        const String& instanceName) 
     1174{ 
     1175        return new VisibilityOctreeSceneManager(instanceName, visManager); 
     1176} 
     1177//----------------------------------------------------------------------- 
     1178void VisibilityOctreeSceneManagerFactory::destroyInstance(SceneManager* instance) 
     1179{ 
     1180        delete instance; 
     1181} 
     1182 
    11581183}  // namespace Ogre 
  • GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreVisibilityOptionsManager.cpp

    r254 r897  
    1616        { 
    1717                // delete old queries (not needed for e.g., view frustum culling) 
    18                 mHierarchyInterface->DeleteQueries(); 
     18                mHierarchyInterface->ResetQueries(); 
    1919                mVisibilityManager->SetCullingManager(*static_cast<const  
    2020                        GtpVisibility::VisibilityEnvironment::CullingManagerType *>(val)); 
  • GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreVisibilitySceneManager.cpp

    r155 r897  
    1111 
    1212//----------------------------------------------------------------------- 
    13 VisibilitySceneManager::VisibilitySceneManager(GtpVisibility::VisibilityManager *visManager) 
    14 :mVisibilityManager(visManager), mUseDepthPass(false), mShowVisualization(false) 
     13VisibilitySceneManager::VisibilitySceneManager(const String& name,  
     14                                                                                           GtpVisibility::VisibilityManager *visManager) 
     15:SceneManager(name), mVisibilityManager(visManager), mUseDepthPass(false), mShowVisualization(false) 
    1516{ 
    1617        mHierarchyInterface =  
  • GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreVisibilitySceneManagerDll.cpp

    r870 r897  
    2828//#include <OgreVisibilityDotSceneManager.h> 
    2929 
    30 #include <OgreHeightmapTerrainPageSource.h> 
     30//#include <OgreHeightmapTerrainPageSource.h> 
    3131#include <OgreRoot.h> 
    3232#include <OgreLogManager.h> 
     33 
    3334#include "VisibilityManager.h" 
    3435#include "VisibilityEnvironment.h" 
    35  
     36                 
    3637GtpVisibility::VisibilityEnvironment *visEnv; 
    3738GtpVisibility::VisibilityManager *visManager; 
     
    3940namespace Ogre { 
    4041 
    41 VisibilityOctreeSceneManager *visibilityOctreePlugin; 
    42 VisibilityTerrainSceneManager *visibilityTerrainPlugin; 
    43 //VisibilityDotSceneManager *visibilityDotPlugin; 
    44  
    45 HeightmapTerrainPageSource *heightmapTerrainPageSource; 
     42VisibilityOctreeSceneManagerFactory *visibilityOctreePlugin; 
     43VisibilityTerrainSceneManagerFactory *visibilityTerrainPlugin; 
    4644 
    4745//----------------------------------------------------------------------- 
     
    5351 
    5452        // Create new scene manager 
    55         visibilityOctreePlugin = new VisibilityOctreeSceneManager(visManager); 
    56         visibilityTerrainPlugin = new VisibilityTerrainSceneManager(visManager); 
    57         //occlusionDotPlugin = new VisibilityDotSceneManager(); 
     53        visibilityOctreePlugin = new VisibilityOctreeSceneManagerFactory(visManager); 
     54        visibilityTerrainPlugin = new VisibilityTerrainSceneManagerFactory(visManager); 
     55        // Construct listener manager singleton 
     56        new TerrainPageSourceListenerManager(); 
    5857 
    59         heightmapTerrainPageSource = new HeightmapTerrainPageSource(); 
    60          
    6158        // Register 
    62         Root::getSingleton().setSceneManager(ST_GENERIC, visibilityOctreePlugin); 
    63         Root::getSingleton().setSceneManager(ST_EXTERIOR_CLOSE, visibilityTerrainPlugin); 
    64         //Root::getSingleton().setSceneManager(ST_GENERIC, occlusionDotPlugin); 
    65  
    66         visibilityTerrainPlugin->registerPageSource("Heightmap", heightmapTerrainPageSource); 
     59        Root::getSingleton().addSceneManagerFactory(visibilityOctreePlugin); 
     60        Root::getSingleton().addSceneManagerFactory(visibilityTerrainPlugin); 
    6761} 
    6862//----------------------------------------------------------------------- 
    6963extern "C" void __declspec(dllexport) dllShutdownPlugin() 
    7064{ 
    71         visibilityTerrainPlugin->shutdown(); 
    72         heightmapTerrainPageSource->shutdown(); 
     65        Root::getSingleton().removeSceneManagerFactory(visibilityOctreePlugin); 
     66        Root::getSingleton().removeSceneManagerFactory(visibilityTerrainPlugin); 
     67        // destroy listener manager 
     68        delete TerrainPageSourceListenerManager::getSingletonPtr(); 
    7369} 
    7470//----------------------------------------------------------------------- 
  • GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreVisibilityTerrainSceneManager.cpp

    r868 r897  
    1010#include <OgreSubEntity.h> 
    1111#include <OgreConfigFile.h> 
     12#include <OgreMaterialManager.h> 
     13#include <OgreHeightmapTerrainPageSource.h> 
    1214 
    1315// normal terrain rendering 
    14 const static NORMAL_RENDER_HACK = false; 
     16const static int NORMAL_RENDER_HACK = false; 
    1517 
    1618namespace Ogre { 
    1719 
    1820//----------------------------------------------------------------------- 
    19 VisibilityTerrainSceneManager::VisibilityTerrainSceneManager( 
     21VisibilityTerrainSceneManager::VisibilityTerrainSceneManager(const String& name,  
    2022        GtpVisibility::VisibilityManager *visManager): 
    21 TerrainSceneManager(), 
     23TerrainSceneManager(name), 
    2224mVisibilityManager(visManager),  
    2325mShowVisualization(false), 
     
    6264 
    6365        mDepthPass = depthMat->getTechnique(0)->getPass(0); 
     66 
    6467                mDepthPass->setColourWriteEnabled(false); 
    6568                mDepthPass->setDepthWriteEnabled(true); 
    6669                mDepthPass->setLightingEnabled(false); 
     70                //mDepthPass->setDepthCheckEnabled(false); 
    6771        } 
    6872        else 
     
    152156} 
    153157//----------------------------------------------------------------------- 
    154 Pass *VisibilityTerrainSceneManager::setPass(Pass* pass) 
     158const Pass *VisibilityTerrainSceneManager::_setPass(Pass* pass) 
    155159{ 
    156160        if (NORMAL_RENDER_HACK) 
    157161        { 
    158                 return SceneManager::setPass(pass); 
     162                return SceneManager::_setPass(pass); 
    159163        } 
    160164 
     
    212216 
    213217        //-- set actual pass here 
    214         Pass *result = SceneManager::setPass(usedPass); 
     218        const Pass *result = SceneManager::_setPass(usedPass); 
    215219 
    216220 
     
    391395 
    392396        getRenderQueue()->clear(); // finally clear render queue 
    393         if (1) OGRE_DELETE(mRenderQueue); // HACK: should rather only be cleared ... 
     397        if (0) OGRE_DELETE(mRenderQueue); // HACK: should rather only be cleared ... 
    394398 
    395399        if (0) WriteLog(); // write out stats 
     
    491495                if (useArbQueries) 
    492496                { 
    493                         mHierarchyInterface->DeleteQueries(); 
     497                        mHierarchyInterface->ResetQueries(); 
    494498                        mDestRenderSystem->setConfigOption("ArbQueries", "Yes"); 
    495499                } 
    496500                else 
    497501                { 
    498                         mHierarchyInterface->DeleteQueries(); 
     502                        mHierarchyInterface->ResetQueries(); 
    499503                        mDestRenderSystem->setConfigOption("ArbQueries", "No"); 
    500504                } 
     
    559563//----------------------------------------------------------------------- 
    560564void VisibilityTerrainSceneManager::renderObjects( 
    561                                                 const RenderPriorityGroup::TransparentRenderablePassList& objs,  
    562                         bool doLightIteration,  
    563                                                 const LightList* manualLightList) 
     565        const QueuedRenderableCollection& objs, 
     566        QueuedRenderableCollection::OrganisationMode om, 
     567        bool doLightIteration, const LightList* manualLightList) 
    564568{ 
    565569        // for correct rendering, transparents must be rendered after hierarchical culling 
     
    567571        if (NORMAL_RENDER_HACK || !mSkipTransparents) 
    568572        { 
    569                 SceneManager::renderObjects(objs, doLightIteration, manualLightList); 
     573                SceneManager::renderObjects(objs, om, doLightIteration, manualLightList); 
    570574        } 
    571575} 
     
    592596} 
    593597//----------------------------------------------------------------------- 
    594 void VisibilityTerrainSceneManager::renderQueueGroupObjects(RenderQueueGroup* pGroup) 
     598void VisibilityTerrainSceneManager::_renderQueueGroupObjects( 
     599        RenderQueueGroup* pGroup, QueuedRenderableCollection::OrganisationMode om) 
    595600{ 
    596601        if (NORMAL_RENDER_HACK || !mIsItemBufferPhase) 
    597602        { 
    598                 OctreeSceneManager::renderQueueGroupObjects(pGroup); 
     603                SceneManager::_renderQueueGroupObjects(pGroup, om); 
    599604                return; 
    600605        } 
    601  
     606#ifdef ITEM_BUFFER 
    602607        //-- item buffer: render objects using false colors 
    603608 
     
    609614                RenderItemBuffer(groupIt.getNext()); 
    610615        } 
    611 } 
     616#endif // ITEM_BUFFER 
     617} 
     618#ifdef ITEM_BUFFER 
    612619//----------------------------------------------------------------------- 
    613620void VisibilityTerrainSceneManager::RenderItemBuffer(RenderPriorityGroup* pGroup) 
     
    715722        renderSingleObject(rend, usedPass, false, &nullLightList); 
    716723} 
     724#endif // ITEM_BUFFER 
    717725//----------------------------------------------------------------------- 
    718726GtpVisibility::VisibilityManager *VisibilityTerrainSceneManager::GetVisibilityManager() 
     
    757765 
    758766                        // just render ambient stuff 
    759                         mIlluminationStage = IRS_AMBIENT; 
    760                         getRenderQueue()->setSplitPassesByLightingType(true); 
     767                        /*** msz: no more IRS_AMBIENT, see OgreSceneManager.h ***/ 
     768                        // mIlluminationStage = IRS_AMBIENT; 
    761769                } 
    762770         
     
    818826//----------------------------------------------------------------------- 
    819827void VisibilityTerrainSceneManager::renderAdditiveStencilShadowedQueueGroupObjects( 
    820         RenderQueueGroup* pGroup) 
     828        RenderQueueGroup* pGroup, QueuedRenderableCollection::OrganisationMode om) 
    821829{ 
    822830        // only render solid passes during hierarchical culling 
     
    837845 
    838846                        // Render all the ambient passes first, no light iteration, no lights 
    839                         mIlluminationStage = IRS_AMBIENT; 
    840  
    841                         OctreeSceneManager::renderObjects(pPriorityGrp->_getSolidPasses(), false, &lightList); 
     847                        /*** msz: no more IRS_AMBIENT, see OgreSceneManager.h ***/ 
     848                        // mIlluminationStage = IRS_AMBIENT; 
     849 
     850                        OctreeSceneManager::renderObjects(pPriorityGrp->getSolidsBasic(), om, false, &lightList); 
    842851                        // Also render any objects which have receive shadows disabled 
    843                         OctreeSceneManager::renderObjects(pPriorityGrp->_getSolidPassesNoShadow(), true); 
     852                        OctreeSceneManager::renderObjects(pPriorityGrp->getSolidsNoShadowReceive(), om, true); 
    844853                } 
    845854        } 
    846855        else // render the rest of the passes 
    847856        { 
    848                 OctreeSceneManager::renderAdditiveStencilShadowedQueueGroupObjects(pGroup); 
     857                OctreeSceneManager::renderAdditiveStencilShadowedQueueGroupObjects(pGroup, om); 
    849858        } 
    850859} 
    851860//----------------------------------------------------------------------- 
    852861void VisibilityTerrainSceneManager::renderModulativeStencilShadowedQueueGroupObjects( 
    853         RenderQueueGroup* pGroup) 
     862        RenderQueueGroup* pGroup, QueuedRenderableCollection::OrganisationMode om) 
    854863{ 
    855864   if (mIsHierarchicalCulling) 
     
    866875 
    867876                   // Do (shadowable) solids 
    868                    OctreeSceneManager::renderObjects(pPriorityGrp->_getSolidPasses(), true); 
     877                   OctreeSceneManager::renderObjects(pPriorityGrp->getSolidsBasic(), om, true); 
    869878           } 
    870879   } 
    871880   else 
    872881   { 
    873            SceneManager::renderModulativeStencilShadowedQueueGroupObjects(pGroup); 
     882           SceneManager::renderModulativeStencilShadowedQueueGroupObjects(pGroup, om); 
    874883   } 
    875884} 
    876885 
     886const String& VisibilityTerrainSceneManager::getTypeName(void) const 
     887{ 
     888        return VisibilityTerrainSceneManagerFactory::FACTORY_TYPE_NAME; 
     889} 
     890 
    877891//------------------------------------------------------------------------- 
    878 void VisibilityTerrainSceneManager::setWorldGeometry( const String& filename ) 
     892void VisibilityTerrainSceneManager::setWorldGeometry( DataStreamPtr& stream, const String& typeName ) 
    879893{ 
    880894    // Clear out any existing world resources (if not default) 
     
    885899            ResourceGroupManager::getSingleton().getWorldResourceGroupName()); 
    886900    } 
    887  
     901        destroyLevelIndexes(); 
    888902    mTerrainPages.clear(); 
    889903    // Load the configuration 
    890     loadConfig(filename); 
     904    loadConfig( stream ); 
     905        initLevelIndexes(); 
    891906 
    892907    // Resize the octree, allow for 1 page for now 
     
    895910    float max_z = mOptions.scale.z * mOptions.pageSize; 
    896911 
    897         //-- note: slows down view frustum culling! 
    898 #if 1 
    899912        float maxAxis = std::max(max_x, max_y); 
    900913        maxAxis = std::max(maxAxis, max_z); 
    901914        resize( AxisAlignedBox( 0, 0, 0, maxAxis, maxAxis, maxAxis ) ); 
    902 #else 
    903         resize( AxisAlignedBox( 0, 0, 0, max_x, max_y, max_z ) ); 
    904 #endif 
    905  
     915     
    906916    setupTerrainMaterial(); 
     917 
    907918    setupTerrainPages(); 
    908919 
    909920 } 
    910921 
     922        //----------------------------------------------------------------------- 
     923        const String VisibilityTerrainSceneManagerFactory::FACTORY_TYPE_NAME = "VisibilityTerrainSceneManager"; 
     924        //----------------------------------------------------------------------- 
     925        VisibilityTerrainSceneManagerFactory::VisibilityTerrainSceneManagerFactory( 
     926                GtpVisibility::VisibilityManager *vm) 
     927        { 
     928                visManager = vm; 
     929        } 
     930        //----------------------------------------------------------------------- 
     931        VisibilityTerrainSceneManagerFactory::~VisibilityTerrainSceneManagerFactory() 
     932        { 
     933                for (TerrainPageSources::iterator i = mTerrainPageSources.begin(); 
     934                        i != mTerrainPageSources.end(); ++i) 
     935                { 
     936                        delete *i; 
     937                } 
     938                mTerrainPageSources.clear(); 
     939        } 
     940        //----------------------------------------------------------------------- 
     941        void VisibilityTerrainSceneManagerFactory::initMetaData(void) const 
     942        { 
     943                mMetaData.typeName = FACTORY_TYPE_NAME; 
     944                mMetaData.description = "Scene manager which generally organises the scene on " 
     945                        "the basis of an octree, but also supports terrain world geometry and has awesome (TM) occlusion culling capabilities. "; 
     946                mMetaData.sceneTypeMask = ST_EXTERIOR_CLOSE; // previous compatiblity 
     947                mMetaData.worldGeometrySupported = true; 
     948        } 
     949        //----------------------------------------------------------------------- 
     950        SceneManager* VisibilityTerrainSceneManagerFactory::createInstance( 
     951                const String& instanceName) 
     952        { 
     953                VisibilityTerrainSceneManager* tsm = new VisibilityTerrainSceneManager(instanceName, visManager); 
     954                // Create & register default sources (one per manager) 
     955                HeightmapTerrainPageSource* ps = new HeightmapTerrainPageSource(); 
     956                mTerrainPageSources.push_back(ps); 
     957                tsm->registerPageSource("Heightmap", ps); 
     958 
     959                return tsm; 
     960        } 
     961        //----------------------------------------------------------------------- 
     962        void VisibilityTerrainSceneManagerFactory::destroyInstance(SceneManager* instance) 
     963        { 
     964                delete instance; 
     965        } 
     966 
    911967} // namespace Ogre 
Note: See TracChangeset for help on using the changeset viewer.