Changeset 925


Ignore:
Timestamp:
05/08/06 06:55:17 (18 years ago)
Author:
mattausch
Message:

update for ogre 1.2
OcclusionCullingSceneManager? is the only scenemanager in the solution now

Location:
GTP/trunk/Lib/Vis
Files:
28 edited

Legend:

Unmodified
Added
Removed
  • GTP/trunk/Lib/Vis/OnlineCullingCHC/IVReader/src/ivreader.cpp

    r868 r925  
    538538 
    539539 
     540        if (0) pEntity->setRenderQueueGroup(Ogre::RENDER_QUEUE_MAIN); 
     541 
    540542        return pEntity; 
    541543} 
  • GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/include/OgreOcclusionCullingSceneManager.h

    r903 r925  
    5252        GtpVisibility::VisibilityManager *getVisibilityManager(); 
    5353 
    54         /** Render a set of objects, see renderSingleObject for param definitions  
     54        /** Render a queue group.  
    5555                Override so we can handle delayed rendering of transparent objects 
    5656        */ 
    57         virtual void renderObjects(const QueuedRenderableCollection& objs,  
    58                         QueuedRenderableCollection::OrganisationMode om,  
    59             bool doLightIteration, const LightList* manualLightList = 0); 
     57        void renderBasicQueueGroupObjects(RenderQueueGroup* pGroup,  
     58                                                                          QueuedRenderableCollection::OrganisationMode om); 
    6059 
    6160        /** Writes out stats into the Ogre log file. 
     
    103102                msz: Modified to reflect changes in Ogre::TerrainSceneManager 
    104103        */ 
     104#if 1 
    105105        virtual void setWorldGeometry( DataStreamPtr& stream, const String& typeName ); 
    106  
     106#endif 
    107107         
    108108        /** Loads view cells for this particular scene. 
     
    210210        bool mUseViewCells; 
    211211 
     212         
    212213        /// if the view cells are filtered 
    213214        bool mUseVisibilityFilter; 
     
    218219{ 
    219220protected: 
     221        typedef std::vector<TerrainPageSource*> TerrainPageSources; 
     222        TerrainPageSources mTerrainPageSources; 
    220223        void initMetaData(void) const; 
    221224        GtpVisibility::VisibilityManager *visManager; 
     
    225228                visManager = vm; 
    226229        } 
    227         ~OcclusionCullingSceneManagerFactory() {} 
     230 
    228231        /// Factory type name 
    229232        static const String FACTORY_TYPE_NAME; 
  • GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/include/OgreOcclusionQueriesQueryManager.h

    r370 r925  
    1515                on different hierarchy types, while reusing the implementation of the query methods. 
    1616    */ 
    17         OcclusionQueriesQueryManager(PlatformHierarchyInterface *hierarchyInterface, Viewport *vp, 
     17        OcclusionQueriesQueryManager(GtpVisibility::HierarchyInterface *hierarchyInterface, Viewport *vp, 
    1818                                                                 int queryModes, int itemBufferMode); 
    1919     
  • GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/include/OgrePlatformQueryManager.h

    r897 r925  
    44#include "VisibilityInfo.h" 
    55#include "QueryManager.h" 
    6 #include "OgrePlatformHierarchyInterface.h" 
     6#include "HierarchyInterface.h" 
    77 
    88namespace Ogre { 
     
    1717            on different hierarchy types, while reusing the implementation of the query methods. 
    1818    */ 
    19         PlatformQueryManager(PlatformHierarchyInterface *hierarchyInterface,  
     19        PlatformQueryManager(GtpVisibility::HierarchyInterface *hierarchyInterface,  
    2020                                 Viewport *vp, int queryModes); 
    2121     
  • GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/include/OgreVisibilityOctreeSceneManager.h

    r903 r925  
    5555        GtpVisibility::VisibilityManager *getVisibilityManager(); 
    5656         
    57         /** Render a set of objects, see renderSingleObject for param definitions  
     57        /** Render a queue group.  
    5858                Override so we can handle delayed rendering of transparent objects 
    5959        */ 
    60         virtual void renderObjects(const QueuedRenderableCollection& objs,  
    61                         QueuedRenderableCollection::OrganisationMode om,  
    62             bool doLightIteration, const LightList* manualLightList = 0); 
     60        void renderBasicQueueGroupObjects(RenderQueueGroup* pGroup,  
     61                                                                 QueuedRenderableCollection::OrganisationMode om); 
    6362 
    6463        /** Writes out stats into the Ogre log file. 
  • GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/include/OgreVisibilityTerrainSceneManager.h

    r897 r925  
    5151        GtpVisibility::VisibilityManager *getVisibilityManager(); 
    5252 
    53         /** Render a set of objects, see renderSingleObject for param definitions  
     53        /** Render a queue group.  
    5454                Override so we can handle delayed rendering of transparent objects 
    5555        */ 
    56         virtual void renderObjects(const QueuedRenderableCollection& objs,  
    57                         QueuedRenderableCollection::OrganisationMode om,  
    58             bool doLightIteration, const LightList* manualLightList = 0); 
     56        void renderBasicQueueGroupObjects(RenderQueueGroup* pGroup,  
     57                                                                 QueuedRenderableCollection::OrganisationMode om); 
    5958 
    6059        /** Writes out stats into the Ogre log file. 
  • GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/scripts/Plugin_VisibilitySceneManager.vcproj

    r897 r925  
    158158                                        RelativePath="..\include\OgreTerrainContentGenerator.h"> 
    159159                                </File> 
    160                                 <File 
    161                                         RelativePath="..\include\OgreVisibilityOctreeSceneManager.h"> 
    162                                 </File> 
    163                                 <File 
    164                                         RelativePath="..\include\OgreVisibilityTerrainSceneManager.h"> 
    165                                 </File> 
    166160                        </Filter> 
    167161                        <Filter 
     
    169163                                Filter=""> 
    170164                                <File 
    171                                         RelativePath="..\src\OgreBspHierarchyInterface.cpp"> 
    172                                 </File> 
    173                                 <File 
    174165                                        RelativePath="..\src\OgreOcclusionCullingSceneManager.cpp"> 
    175166                                </File> 
     
    179170                                <File 
    180171                                        RelativePath="..\src\OgreTerrainContentGenerator.cpp"> 
    181                                 </File> 
    182                                 <File 
    183                                         RelativePath="..\src\OgreVisibilityOctreeSceneManager.cpp"> 
    184                                 </File> 
    185                                 <File 
    186                                         RelativePath="..\src\OgreVisibilityTerrainSceneManager.cpp"> 
    187172                                </File> 
    188173                        </Filter> 
     
    195180                                Filter="h;hpp;hxx;hm;inl;inc"> 
    196181                                <File 
    197                                         RelativePath="..\include\OgreBspHierarchyInterface.h"> 
    198                                 </File> 
    199                                 <File 
    200182                                        RelativePath="..\include\OgreMeshInstance.h"> 
    201183                                </File> 
     
    229211                                <File 
    230212                                        RelativePath="..\include\OgreVisibilityOptionsManager.h"> 
    231                                 </File> 
    232                                 <File 
    233                                         RelativePath="..\include\OgreVisibilitySceneManager.h"> 
    234213                                </File> 
    235214                        </Filter> 
     
    269248                                <File 
    270249                                        RelativePath="..\src\OgreVisibilityOptionsManager.cpp"> 
    271                                 </File> 
    272                                 <File 
    273                                         RelativePath="..\src\OgreVisibilitySceneManager.cpp"> 
    274250                                </File> 
    275251                                <File 
  • GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreOcclusionCullingSceneManager.cpp

    r903 r925  
    1111#include <OgreMaterialManager.h> 
    1212#include <OgreIteratorWrappers.h> 
     13#include <OgreHeightmapTerrainPageSource.h> 
    1314#include "VspBspTree.h" 
    1415#include "Containers.h" 
     
    4445mSkipTransparents(false), 
    4546mRenderTransparentsForItemBuffer(true), 
    46 mExecuteVertexProgramForAllPasses(true), 
     47//mExecuteVertexProgramForAllPasses(true), 
     48mExecuteVertexProgramForAllPasses(false), 
    4749mIsHierarchicalCulling(false), 
    4850mViewCellsLoaded(false), 
     
    5658        if (0) 
    5759        { 
    58         mDisplayNodes = true; 
    59         mShowBoundingBoxes = true; 
    60         mShowBoxes = true; 
     60                mDisplayNodes = true; 
     61                mShowBoundingBoxes = true; 
     62                mShowBoxes = true; 
    6163        } 
    6264 
    6365        // TODO: set maxdepth to reasonable value 
    6466        mMaxDepth = 50; 
     67 
     68        //loadVisibilityConfig("GtpVisibility.cfg"); 
     69        //LoadViewCells(""); 
     70        //mViewCellsLoaded = true; 
    6571} 
    6672//----------------------------------------------------------------------- 
     
    117123} 
    118124//------------------------------------------------------------------------- 
     125#if 1 
    119126void OcclusionCullingSceneManager::setWorldGeometry( DataStreamPtr& stream, const String& typeName ) 
    120127{ 
     
    146153 
    147154 } 
    148  
     155#endif 
    149156//----------------------------------------------------------------------- 
    150157void OcclusionCullingSceneManager::PrepareVisualization(Camera *cam) 
     
    183190                        { 
    184191                                // render the leaf nodes 
    185                                 if (((*it)->numAttachedObjects() > 0) && ((*it)->numChildren() == 0) &&  
    186                                          (*it)->getAttachedObject(0)->getMovableType() == "Entity") 
     192                                if ((*it)->numAttachedObjects() &&  
     193                                        !(*it)->numChildren() &&  
     194                                        ((*it)->getAttachedObject(0)->getMovableType() == "Entity") && 
     195                                        (*it)->getAttachedObject(0)->isVisible()) 
    187196                                { 
    188197                                        getRenderQueue()->addRenderable((*it)); 
     
    217226        Pass *usedPass = useDepthPass ? mDepthPass : pass; 
    218227                 
    219         IlluminationRenderStage savedStage = mIlluminationStage;  
     228 
     229        const IlluminationRenderStage savedStage = mIlluminationStage;  
    220230         
    221231        // set illumination stage to NONE so no shadow material is used  
     
    583593                return true; 
    584594        } 
    585          
     595        if (key == "VisibilityManager") 
     596        { 
     597                * static_cast<GtpVisibility::VisibilityManager **>(val) =  
     598                        (GtpVisibility::VisibilityManager *)mVisibilityManager; 
     599                return true; 
     600        } 
     601        if (key == "HierarchInterface") 
     602        { 
     603                * static_cast<GtpVisibility::HierarchyInterface **>(val) =  
     604                        (GtpVisibility::HierarchyInterface *)mHierarchyInterface; 
     605                return true; 
     606        } 
     607 
    586608        return VisibilityOptionsManager(mVisibilityManager, mHierarchyInterface). 
    587609                getOption(key, val) && TerrainSceneManager::getOption(key, val); 
     
    630652} 
    631653//----------------------------------------------------------------------- 
    632 void OcclusionCullingSceneManager::renderObjects( 
    633         const QueuedRenderableCollection& objs, 
    634         QueuedRenderableCollection::OrganisationMode om, 
    635     bool doLightIteration, const LightList* manualLightList) 
    636 { 
    637         // for correct rendering, transparents must be rendered after hierarchical culling 
    638         // => do nothing 
    639         if (NORMAL_RENDER_HACK || !mSkipTransparents) 
    640         { 
    641                 OctreeSceneManager::renderObjects(objs, om, doLightIteration, manualLightList); 
    642         } 
    643 } 
     654void OcclusionCullingSceneManager::renderBasicQueueGroupObjects(RenderQueueGroup* pGroup,  
     655                                                                                                                                QueuedRenderableCollection::OrganisationMode om) 
     656{ 
     657    // Basic render loop 
     658    // Iterate through priorities 
     659    RenderQueueGroup::PriorityMapIterator groupIt = pGroup->getIterator(); 
     660 
     661    while (groupIt.hasMoreElements()) 
     662    { 
     663        RenderPriorityGroup* pPriorityGrp = groupIt.getNext(); 
     664 
     665        // Sort the queue first 
     666        pPriorityGrp->sort(mCameraInProgress); 
     667 
     668        // Do solids 
     669        renderObjects(pPriorityGrp->getSolidsBasic(), om, true); 
     670 
     671                // for correct rendering, transparents must be rendered after hierarchical culling 
     672                // => do nothing 
     673 
     674        // Do transparents (always descending) 
     675                if (NORMAL_RENDER_HACK || !mSkipTransparents) 
     676                { 
     677                        renderObjects(pPriorityGrp->getTransparents(),  
     678                        QueuedRenderableCollection::OM_SORT_DESCENDING, true); 
     679                } 
     680 
     681 
     682    }// for each priority 
     683} 
     684 
    644685//----------------------------------------------------------------------- 
    645686bool OcclusionCullingSceneManager::validatePassForRendering(Pass* pass) 
     
    836877                        /*** msz: no more IRS_AMBIENT, see OgreSceneManager.h ***/ 
    837878                        // mIlluminationStage = IRS_AMBIENT;  
    838                         getRenderQueue()->setSplitPassesByLightingType(true); 
     879                        //getRenderQueue()->setSplitPassesByLightingType(true); 
    839880                } 
    840881         
     
    11731214                        //-- compute new filtered cell 
    11741215                        GtpVisibilityPreprocessor::PrVs prvs; 
    1175                         mViewCellsManager->GetPrVS(viewPoint, prvs); 
     1216                        mViewCellsManager->GetPrVS(viewPoint, prvs, 5); 
    11761217                        viewCell = prvs.mViewCell; 
    11771218                } 
     
    12061247} 
    12071248//----------------------------------------------------------------------- 
    1208 SceneManager* OcclusionCullingSceneManagerFactory::createInstance( 
    1209         const String& instanceName) 
    1210 { 
    1211         return new OcclusionCullingSceneManager(instanceName, visManager); 
     1249SceneManager *OcclusionCullingSceneManagerFactory::createInstance( 
     1250                const String& instanceName) 
     1251{ 
     1252        OcclusionCullingSceneManager* tsm = new OcclusionCullingSceneManager(instanceName, visManager); 
     1253         
     1254        // Create & register default sources (one per manager) 
     1255        HeightmapTerrainPageSource* ps = new HeightmapTerrainPageSource(); 
     1256        mTerrainPageSources.push_back(ps); 
     1257        tsm->registerPageSource("Heightmap", ps); 
     1258 
     1259        return tsm; 
    12121260} 
    12131261//----------------------------------------------------------------------- 
  • GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreOcclusionQueriesQueryManager.cpp

    r726 r925  
    44#include <vector> 
    55#include <OgreSubEntity.h> 
    6  
     6#include "OgrePlatformHierarchyInterface.h" 
    77 
    88namespace Ogre { 
     
    1010//-----------------------------------------------------------------------  
    1111OcclusionQueriesQueryManager::OcclusionQueriesQueryManager( 
    12                                                         PlatformHierarchyInterface *hierarchyInterface,  
     12                                                        GtpVisibility::HierarchyInterface *hierarchyInterface,  
    1313                                                        Viewport *vp, 
    1414                                                        int queryModes, 
  • GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreOctreeHierarchyInterface.cpp

    r880 r925  
    11#include "OgreOctreeHierarchyInterface.h" 
    2 #include "OgreVisibilityOctreeSceneManager.h" 
     2//#include "OgreVisibilityOctreeSceneManager.h" 
    33#include <OgreOctree.h> 
    44#include <OgreLogManager.h> 
     
    2525                RenderNode(node); 
    2626        } 
     27         
    2728         
    2829        // if not all subtrees are empty 
     
    141142AxisAlignedBox *OctreeHierarchyInterface::GetBoundingBox(GtpVisibility::HierarchyNode *node) 
    142143{ 
    143         if (node != mSavedNode) 
     144        // reuse box if node is the same 
     145        // only create renderable bounding box for new node 
     146        if (1 || (node != mSavedNode)) 
    144147        { 
    145148                mSavedNode = node; 
  • GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgrePlatformHierarchyInterface.cpp

    r903 r925  
    123123        if (mCurrentTestIdx >= (int)mOcclusionQueries.size()) 
    124124        { 
    125                 mCurrentTestIdx == (int)mOcclusionQueries.size(); 
     125                mCurrentTestIdx = (int)mOcclusionQueries.size(); 
    126126                mOcclusionQueries.push_back(new PlatformOcclusionQuery(mRenderSystem)); 
    127127        } 
     
    139139 
    140140        mCamera = cam; 
     141        // set culling camera for visualization 
    141142        mCullCamera = cullCam ? cullCam : cam; 
    142143 
  • GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgrePlatformOcclusionQuery.cpp

    r903 r925  
    3232        bool isAvailable = true; 
    3333 
    34         /*if (!waitForResult) 
     34        if (!waitForResult) 
     35        { 
    3536                isAvailable = !mHardwareOcclusionQuery->isStillOutstanding(); 
    36         */ 
    37 //visiblePixels = 800; 
     37                //std::stringstream d; d << "available: " << isAvailable; 
     38                //Ogre::LogManager::getSingleton().logMessage(d.str()); 
     39        } 
     40 
    3841        if (isAvailable) 
    3942                return mHardwareOcclusionQuery->pullOcclusionQuery(&visiblePixels); 
    40  
    41         return isAvailable; 
     43         
     44        return false; 
    4245} 
    4346 
  • GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgrePlatformQueryManager.cpp

    r897 r925  
    66#include <vector> 
    77#include <OgreSubEntity.h> 
    8  
     8#include "OgrePlatformHierarchyInterface.h" 
    99 
    1010namespace Ogre { 
    1111 
    1212//-----------------------------------------------------------------------  
    13 PlatformQueryManager::PlatformQueryManager(PlatformHierarchyInterface *hierarchyInterface,  
     13PlatformQueryManager::PlatformQueryManager(GtpVisibility::HierarchyInterface *hierarchyInterface,  
    1414                                                                                   Viewport *vp, int queryModes): 
    1515QueryManager(hierarchyInterface, queryModes),  
     
    1919} 
    2020//----------------------------------------------------------------------- 
    21 bool PlatformQueryManager::ShootRay(const Ray &ray, std::vector<Mesh *> *visibleMeshes, bool isGlobalLine) 
     21bool PlatformQueryManager::ShootRay(const Ray &ray,  
     22                                                                        std::vector<Mesh *> *visibleMeshes,  
     23                                                                        bool isGlobalLine) 
    2224{ 
    2325    // run OGRE ray shooting query 
  • GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreSolidBoundingBox.cpp

    r903 r925  
    7474         mRenderOp.indexData->indexBuffer = ibuf; 
    7575         // set material with no lighting, no color, no depth write 
    76          //SetOcclusionQueryMaterial(); 
    77          setMaterial("BaseWhiteNoLighting"); 
     76         SetOcclusionQueryMaterial(); 
     77         //setMaterial("BaseWhiteNoLighting"); 
    7878} 
    7979//----------------------------------------------------------------------- 
  • GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreVisibilityOctreeSceneManager.cpp

    r903 r925  
    365365                InitVisibilityCulling(mCameraInProgress); 
    366366         
    367          
    368367                /**  
    369368                * the hierarchical culling algorithm 
     
    411410 
    412411        // reset ambient light 
    413         //setAmbientLight(savedAmbient); 
     412        setAmbientLight(savedAmbient); 
    414413 
    415414        getRenderQueue()->clear(); // finally clear render queue 
    416         if (0) OGRE_DELETE(mRenderQueue); // HACK: should rather only be cleared ... 
     415        if (1) OGRE_DELETE(mRenderQueue); // HACK: should rather only be cleared ... 
    417416 
    418417        if (0) WriteLog(); // write out stats 
     
    595594} 
    596595//----------------------------------------------------------------------- 
    597 void VisibilityOctreeSceneManager::renderObjects( 
    598                         const QueuedRenderableCollection& objs,  
    599                         QueuedRenderableCollection::OrganisationMode om, 
    600             bool doLightIteration, const LightList* manualLightList) 
    601 { 
    602         // for correct rendering, transparents must be rendered after hierarchical culling 
    603         // => do nothing 
    604         if (NORMAL_RENDER_HACK || !mSkipTransparents) 
    605         { 
    606                 OctreeSceneManager::renderObjects(objs, om, doLightIteration, manualLightList); 
    607         } 
    608 } 
     596void VisibilityOctreeSceneManager::renderBasicQueueGroupObjects(RenderQueueGroup* pGroup,  
     597                                                                                                                                QueuedRenderableCollection::OrganisationMode om) 
     598{ 
     599    // Basic render loop 
     600    // Iterate through priorities 
     601    RenderQueueGroup::PriorityMapIterator groupIt = pGroup->getIterator(); 
     602 
     603    while (groupIt.hasMoreElements()) 
     604    { 
     605        RenderPriorityGroup* pPriorityGrp = groupIt.getNext(); 
     606 
     607        // Sort the queue first 
     608        pPriorityGrp->sort(mCameraInProgress); 
     609 
     610        // Do solids 
     611        renderObjects(pPriorityGrp->getSolidsBasic(), om, true); 
     612 
     613                // for correct rendering, transparents must be rendered after hierarchical culling 
     614                // => do nothing 
     615 
     616        // Do transparents (always descending) 
     617                if (NORMAL_RENDER_HACK || !mSkipTransparents) 
     618                { 
     619                        renderObjects(pPriorityGrp->getTransparents(),  
     620                        QueuedRenderableCollection::OM_SORT_DESCENDING, true); 
     621                } 
     622 
     623 
     624    }// for each priority 
     625} 
     626 
    609627//----------------------------------------------------------------------- 
    610628bool VisibilityOctreeSceneManager::validatePassForRendering(Pass* pass) 
     
    770788        mIsDepthPassPhase = mUseDepthPass; 
    771789 
    772         mIsHierarchicalCulling = true; // during hierarchical culling 
     790        // from now on we are during hierarchical culling 
     791        mIsHierarchicalCulling = true;  
    773792 
    774793        // item buffer needs full ambient lighting to use item colors as unique id 
     
    828847        // possible two cameras (one for culling, one for rendering) 
    829848        mHierarchyInterface->InitTraversal(mCameraInProgress,  
    830                                                         mCullCamera ? getCamera("CullCamera") : NULL, 
    831                                                         mLeavePassesInQueue); 
     849                                                                           mCullCamera ? getCamera("CullCamera") : NULL, 
     850                                       mLeavePassesInQueue); 
    832851                 
    833852        //std::stringstream d; d << "leave passes in queue: " << mLeavePassesInQueue; 
     
    11351154                        //-- compute new filtered cell 
    11361155                        GtpVisibilityPreprocessor::PrVs prvs; 
    1137                         mViewCellsManager->GetPrVS(viewPoint, prvs); 
     1156                        mViewCellsManager->GetPrVS(viewPoint, prvs, 5); 
    11381157                        viewCell = prvs.mViewCell; 
    11391158                } 
  • GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreVisibilitySceneManager.cpp

    r897 r925  
    1313VisibilitySceneManager::VisibilitySceneManager(const String& name,  
    1414                                                                                           GtpVisibility::VisibilityManager *visManager) 
    15 :SceneManager(name), mVisibilityManager(visManager), mUseDepthPass(false), mShowVisualization(false) 
     15:SceneManager(name),  
     16mVisibilityManager(visManager),  
     17mUseDepthPass(false),  
     18mShowVisualization(false) 
    1619{ 
    17         mHierarchyInterface =  
    18                 new SceneNodeHierarchyInterface(this, mDestRenderSystem); 
     20        mHierarchyInterface = new SceneNodeHierarchyInterface(this, mDestRenderSystem); 
    1921} 
    2022//----------------------------------------------------------------------- 
  • GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreVisibilitySceneManagerDll.cpp

    r897 r925  
    2424*/ 
    2525 
    26 #include <OgreVisibilityTerrainSceneManager.h> 
    27 #include <OgreVisibilityOctreeSceneManager.h> 
    28 //#include <OgreVisibilityDotSceneManager.h> 
     26//#include <OgreVisibilityTerrainSceneManager.h> 
     27//#include <OgreVisibilityOctreeSceneManager.h> 
     28#include <OgreOcclusionCullingSceneManager.h> 
    2929 
    3030//#include <OgreHeightmapTerrainPageSource.h> 
     
    4040namespace Ogre { 
    4141 
    42 VisibilityOctreeSceneManagerFactory *visibilityOctreePlugin; 
    43 VisibilityTerrainSceneManagerFactory *visibilityTerrainPlugin; 
     42//VisibilityOctreeSceneManagerFactory *visibilityOctreePlugin; 
     43//VisibilityTerrainSceneManagerFactory *visibilityTerrainPlugin; 
     44OcclusionCullingSceneManagerFactory *occlusionCullingPlugin; 
    4445 
    4546//----------------------------------------------------------------------- 
     
    4748{ 
    4849        visEnv = new GtpVisibility::VisibilityEnvironment(); 
    49         visEnv->LoadEnvironment("vienna_simple.env"); 
     50        visEnv->LoadEnvironment("simple.env"); 
    5051        visManager = new GtpVisibility::VisibilityManager(visEnv); 
    5152 
    5253        // Create new scene manager 
    53         visibilityOctreePlugin = new VisibilityOctreeSceneManagerFactory(visManager); 
    54         visibilityTerrainPlugin = new VisibilityTerrainSceneManagerFactory(visManager); 
     54        //visibilityOctreePlugin = new VisibilityOctreeSceneManagerFactory(visManager); 
     55        //visibilityTerrainPlugin = new VisibilityTerrainSceneManagerFactory(visManager); 
     56        occlusionCullingPlugin = new OcclusionCullingSceneManagerFactory(visManager); 
    5557        // Construct listener manager singleton 
    5658        new TerrainPageSourceListenerManager(); 
    5759 
    5860        // Register 
    59         Root::getSingleton().addSceneManagerFactory(visibilityOctreePlugin); 
    60         Root::getSingleton().addSceneManagerFactory(visibilityTerrainPlugin); 
     61        //Root::getSingleton().addSceneManagerFactory(visibilityOctreePlugin); 
     62        //Root::getSingleton().addSceneManagerFactory(visibilityTerrainPlugin); 
     63        Root::getSingleton().addSceneManagerFactory(occlusionCullingPlugin); 
    6164} 
    6265//----------------------------------------------------------------------- 
    6366extern "C" void __declspec(dllexport) dllShutdownPlugin() 
    6467{ 
    65         Root::getSingleton().removeSceneManagerFactory(visibilityOctreePlugin); 
    66         Root::getSingleton().removeSceneManagerFactory(visibilityTerrainPlugin); 
     68        //Root::getSingleton().removeSceneManagerFactory(visibilityOctreePlugin); 
     69        //Root::getSingleton().removeSceneManagerFactory(visibilityTerrainPlugin); 
     70        Root::getSingleton().removeSceneManagerFactory(occlusionCullingPlugin); 
    6771        // destroy listener manager 
    6872        delete TerrainPageSourceListenerManager::getSingletonPtr(); 
     
    7579        // (HACK: crashes on delete!!!! FIX this  
    7680        //delete visibilityOctreePlugin; 
    77         //delete visibilityTerrainPlugin; 
    78         //delete occlusionDotPlugin; 
    79          
     81    //delete visibilityTerrainPlugin; 
     82        delete occlusionCullingPlugin; 
     83 
    8084        delete visManager; 
    8185        delete visEnv; 
     
    8387 
    8488 
     89 
    8590} //namespace Ogre 
  • GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreVisibilityTerrainSceneManager.cpp

    r903 r925  
    341341                setSpecialCaseRenderQueueMode(SceneManager::SCRQM_EXCLUDE); 
    342342 
     343 
    343344                // set all necessary parameters for  
    344345                // hierarchical visibility culling and rendering 
    345346                InitVisibilityCulling(mCameraInProgress); 
     347 
    346348 
    347349                /**  
     
    389391        // HACK: set the new render level index, important to avoid cracks 
    390392        // in terrain caused by LOD 
    391         TerrainRenderable::NextRenderLevelIndex(); 
     393        //TerrainRenderable::NextRenderLevelIndex(); 
    392394         
    393395        // reset ambient light 
     
    395397 
    396398        getRenderQueue()->clear(); // finally clear render queue 
    397         if (0) OGRE_DELETE(mRenderQueue); // HACK: should rather only be cleared ... 
     399        if (1) OGRE_DELETE(mRenderQueue); // HACK: should rather only be cleared ... 
    398400 
    399401        if (0) WriteLog(); // write out stats 
     
    547549} 
    548550//----------------------------------------------------------------------- 
    549 void VisibilityTerrainSceneManager::renderObjects( 
    550         const QueuedRenderableCollection& objs, 
    551         QueuedRenderableCollection::OrganisationMode om, 
    552         bool doLightIteration, const LightList* manualLightList) 
    553 { 
    554         // for correct rendering, transparents must be rendered after hierarchical culling 
    555         // => do nothing 
    556         if (NORMAL_RENDER_HACK || !mSkipTransparents) 
    557         { 
    558                 SceneManager::renderObjects(objs, om, doLightIteration, manualLightList); 
    559         } 
     551//----------------------------------------------------------------------- 
     552void VisibilityTerrainSceneManager::renderBasicQueueGroupObjects(RenderQueueGroup* pGroup,  
     553                                                                                                                                 QueuedRenderableCollection::OrganisationMode om) 
     554{ 
     555    // Basic render loop 
     556    // Iterate through priorities 
     557    RenderQueueGroup::PriorityMapIterator groupIt = pGroup->getIterator(); 
     558 
     559    while (groupIt.hasMoreElements()) 
     560    { 
     561        RenderPriorityGroup* pPriorityGrp = groupIt.getNext(); 
     562 
     563        // Sort the queue first 
     564        pPriorityGrp->sort(mCameraInProgress); 
     565 
     566        // Do solids 
     567        renderObjects(pPriorityGrp->getSolidsBasic(), om, true); 
     568 
     569                // for correct rendering, transparents must be rendered after hierarchical culling 
     570                // => do nothing 
     571 
     572        // Do transparents (always descending) 
     573                if (NORMAL_RENDER_HACK || !mSkipTransparents) 
     574                { 
     575                        renderObjects(pPriorityGrp->getTransparents(),  
     576                        QueuedRenderableCollection::OM_SORT_DESCENDING, true); 
     577                } 
     578 
     579 
     580    }// for each priority 
    560581} 
    561582//----------------------------------------------------------------------- 
  • GTP/trunk/Lib/Vis/OnlineCullingCHC/include/HierarchyInterface.h

    r897 r925  
    164164        /// the current frame number 
    165165        unsigned int mFrameId; 
    166         /// points to the last occlusion query in the query list 
     166        /// index of the lcurrent occlusion query in the array of queries 
     167        /// NOTE: should rather be iterator 
    167168        int mCurrentTestIdx; 
    168169         
  • GTP/trunk/Lib/Vis/OnlineCullingCHC/include/VisibilityEnvironment.h

    r870 r925  
    2323        */ 
    2424        void LoadEnvironment(std::string filename); 
     25        /** Returns filename of scene. 
     26        */ 
     27        std::string getSceneFileName(); 
     28        /** Returns filename of view cells file. 
     29        */ 
     30        std::string getViewCellsFileName(); 
    2531}; 
    2632} // namespace GtpVisibility 
  • GTP/trunk/Lib/Vis/OnlineCullingCHC/include/VisibilityManager.h

    r897 r925  
    6565        QueryManager *GetQueryManager(); 
    6666 
     67        VisibilityEnvironment *GetVisibilityEnvironment(); 
     68 
    6769protected: 
    6870         
  • GTP/trunk/Lib/Vis/OnlineCullingCHC/src/CoherentHierarchicalCullingManager.cpp

    r726 r925  
    2525        unsigned int visiblePixels = 0; 
    2626        bool isAvailable = false; 
    27         //Ogre::LogManager::getSingleton().logMessage("Coherent Hierarchical Culling"); 
     27         
    2828 
    2929        //-- PART 1: process finished occlusion queries 
  • GTP/trunk/Lib/Vis/OnlineCullingCHC/src/FrustumCullingManager.cpp

    r726 r925  
    77void FrustumCullingManager::RenderScene() 
    88{ 
    9         if (0) Ogre::LogManager::getSingleton().logMessage("Frustum Culling"); 
    10  
    119        while (!mHierarchyInterface->GetQueue()->empty()) 
    1210        { 
  • GTP/trunk/Lib/Vis/OnlineCullingCHC/src/HierarchyInterface.cpp

    r726 r925  
    3232 
    3333        ++ mFrameId; 
     34 
    3435        mCurrentTestIdx = 0; 
    3536        mNumTraversedNodes = 0; 
  • GTP/trunk/Lib/Vis/OnlineCullingCHC/src/StopAndWaitCullingManager.cpp

    r346 r925  
    77void StopAndWaitCullingManager::RenderScene() 
    88{ 
    9         //Ogre::LogManager::getSingleton().logMessage("Stop and Wait Culling"); 
    109        while (!mHierarchyInterface->GetQueue()->empty()) 
    1110        { 
     
    3534                } 
    3635                else 
    37                 { 
     36                {        
    3837                        ++ mNumQueriesIssued; 
    3938 
     
    4140 
    4241                        mHierarchyInterface->IssueNodeOcclusionQuery(node)->GetQueryResult(visiblePixels, true); 
    43                          
     42                 
    4443                        // node visible 
    45                         if (visiblePixels > mVisibilityThreshold) 
     44                        if (0 || visiblePixels > mVisibilityThreshold) 
    4645                        { 
    4746                                mHierarchyInterface->TraverseNode(node); 
  • GTP/trunk/Lib/Vis/OnlineCullingCHC/src/VisibilityEnvironment.cpp

    r870 r925  
    3838        //MeshKdTree::ParseEnvironment(); 
    3939} 
    40  
     40//----------------------------------------------------------------------- 
     41std::string VisibilityEnvironment::getSceneFileName() 
     42{ 
     43        char str[200]; 
     44        GtpVisibilityPreprocessor::environment->GetStringValue("Scene.filename", str); 
     45        return str; 
     46} 
     47//----------------------------------------------------------------------- 
     48std::string VisibilityEnvironment::getViewCellsFileName() 
     49{ 
     50        char str[200]; 
     51        GtpVisibilityPreprocessor::environment->GetStringValue("ViewCells.filename", str); 
     52        return str; 
     53} 
    4154 
    4255} // namespace GtpVisibility 
  • GTP/trunk/Lib/Vis/OnlineCullingCHC/src/VisibilityManager.cpp

    r726 r925  
    119119        } 
    120120} 
    121  
     121//----------------------------------------------------------------------- 
     122VisibilityEnvironment *VisibilityManager::GetVisibilityEnvironment() 
     123{ 
     124        return mVisibilityEnvironment; 
     125} 
    122126 
    123127} // namespace GtpVisibility 
  • GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.cpp

    r904 r925  
    189189Preprocessor::LoadScene(const string filename) 
    190190{ 
    191         // use leaf nodes of the original spatial hiearrchy as occludees 
     191        // use leaf nodes of the original spatial hierarchy as occludees 
    192192        mSceneGraph = new SceneGraph; 
    193193   
     
    233233 
    234234        if (result)  
    235                 { 
     235        { 
    236236                // HACK  
    237237                //AddGeometry(mSceneGraph); 
Note: See TracChangeset for help on using the changeset viewer.