Changeset 903


Ignore:
Timestamp:
05/05/06 07:44:20 (18 years ago)
Author:
mattausch
Message:
 
Location:
GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE
Files:
9 edited

Legend:

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

    r897 r903  
    9797        void renderModulativeStencilShadowedQueueGroupObjects(RenderQueueGroup* pGroup, 
    9898                QueuedRenderableCollection::OrganisationMode om); 
    99  
     99        void loadVisibilityConfig(const String& filename); 
    100100        /** Override standard function so octree boxes are always of equal side length. 
    101101                This has advantages for CHC, because terrain tiles are in different octree nodes 
     
    127127        /** Finds object corresponding to this bounding box in the scene. 
    128128        */ 
    129         MovableObject *FindCorrespondingObject(const AxisAlignedBox &box); 
     129        Entity *FindCorrespondingObject(const AxisAlignedBox &box); 
    130130 
    131131        /** Identifies objects in the scene and gives them unique ids that 
     
    133133        */ 
    134134        void IdentifyObjects(GtpVisibilityPreprocessor::ObjectContainer &objects); 
     135 
     136        /** Loads / unloads pvs of the view cell to set the visibility in the scene. 
     137        */ 
     138        void applyViewCellPvs(GtpVisibilityPreprocessor::ViewCell *vc, const bool load); 
     139 
     140        /** updates pvs in current frame. 
     141        */ 
     142        void updatePvs(Camera *cam); 
     143 
     144        /** Sets all objects invisible. 
     145        */ 
     146        void SetObjectsVisible(const bool visible); 
    135147 
    136148        /// the interface to the scene hierarchy. 
     
    150162        bool mRenderNodesContentForViz; 
    151163 
    152         /// if we render transparents after the hierarchical traversal 
     164        /// render transparents after the hierarchical traversal 
    153165        bool mDelayRenderTransparents; 
    154166 
    155         /// if we use a depth pass (i.e., fill only the depth buffer in the first pass) 
     167        /// use a depth pass (i.e., fill only the depth buffer in the first pass) 
    156168        bool mUseDepthPass; 
    157         /// if we currently rendering the depth pass 
     169        /// flag indicating if we currently render the depth pass 
    158170        bool mIsDepthPassPhase; 
    159171         
     
    185197        bool mIsHierarchicalCulling; 
    186198 
     199        bool mViewCellsLoaded; 
    187200        GtpVisibilityPreprocessor::ViewCellsManager *mViewCellsManager; 
     201 
     202 
     203        /// Used to assign Ogre meshes to view cell entries. 
     204        GtpVisibilityPreprocessor::ObjectContainer mObjects; 
     205 
     206        GtpVisibilityPreprocessor::ViewCell *mElementaryViewCell; 
     207        GtpVisibilityPreprocessor::ViewCell *mCurrentViewCell; 
     208 
     209        /// If view cells are used. 
     210        bool mUseViewCells; 
     211 
     212        /// if the view cells are filtered 
     213        bool mUseVisibilityFilter; 
    188214}; 
    189215 
     216/// Factory for VisibilityOctreeSceneManager 
     217class OcclusionCullingSceneManagerFactory : public SceneManagerFactory 
     218{ 
     219protected: 
     220        void initMetaData(void) const; 
     221        GtpVisibility::VisibilityManager *visManager; 
     222public: 
     223        OcclusionCullingSceneManagerFactory(GtpVisibility::VisibilityManager *vm) 
     224        { 
     225                visManager = vm; 
     226        } 
     227        ~OcclusionCullingSceneManagerFactory() {} 
     228        /// Factory type name 
     229        static const String FACTORY_TYPE_NAME; 
     230        SceneManager* createInstance(const String& instanceName); 
     231        void destroyInstance(SceneManager* instance); 
     232}; 
     233 
    190234} // namespace Ogre 
    191235 
    192 #endif // CullingTerrainSceneManager_H 
     236#endif // OcclusionCullingSceneManager_H 
  • GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/include/OgreVisibilityOctreeSceneManager.h

    r897 r903  
    1111#include "OgrePlatformQueryManager.h" 
    1212#include "VisibilityManager.h" 
     13#include "Containers.h" 
    1314#include "ViewCellsManager.h" 
    1415 
     
    7677        void RenderSingleObjectForItemBuffer(Renderable *rend, Pass *pass); 
    7778#endif // ITEM_BUFFER 
    78         void _renderQueueGroupObjects(RenderQueueGroup* pGroup, QueuedRenderableCollection::OrganisationMode om); 
     79        void _renderQueueGroupObjects(RenderQueueGroup* pGroup, 
     80                QueuedRenderableCollection::OrganisationMode om); 
    7981 
    8082        /** Override from SceneManager so that sub entities can be assigned an id for item buffer. 
     
    191193        bool mViewCellsLoaded; 
    192194        GtpVisibilityPreprocessor::ViewCellsManager *mViewCellsManager; 
     195 
    193196 
    194197        /// Used to assign Ogre meshes to view cell entries. 
  • GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreOcclusionCullingSceneManager.cpp

    r897 r903  
    11#include "OgreOcclusionCullingSceneManager.h" 
    22#include "OgreVisibilityOptionsManager.h" 
    3 #include "OgreTypeConverter.h" 
    43#include <OgreMath.h> 
    54#include <OgreIteratorWrappers.h> 
     
    1514#include "Containers.h" 
    1615#include "ViewCellsManager.h" 
    17  
     16#include <OgreConfigFile.h> 
     17#include "OgreTypeConverter.h" 
     18#include "OgreMeshInstance.h" 
     19#include "common.h" 
    1820 
    1921// normal terrain rendering 
     
    4345mRenderTransparentsForItemBuffer(true), 
    4446mExecuteVertexProgramForAllPasses(true), 
    45 mIsHierarchicalCulling(false) 
     47mIsHierarchicalCulling(false), 
     48mViewCellsLoaded(false), 
     49mUseViewCells(false), 
     50mUseVisibilityFilter(false), 
     51mCurrentViewCell(NULL), 
     52mElementaryViewCell(NULL) 
    4653{ 
    4754        mHierarchyInterface = new OctreeHierarchyInterface(this, mDestRenderSystem); 
     
    8289{ 
    8390        OGRE_DELETE(mHierarchyInterface); 
     91        CLEAR_CONTAINER(mObjects); 
     92        OGRE_DELETE(mCurrentViewCell); 
    8493} 
    8594//----------------------------------------------------------------------- 
     
    155164    } 
    156165        // add bounding boxes of rendered objects 
     166        if (1) 
    157167        for (BoxList::iterator it = mBoxes.begin(); it != mBoxes.end(); ++it) 
    158168        { 
     
    182192                                //(*it)->_addBoundingBoxToQueue(getRenderQueue()); 
    183193                        } 
     194                        // add renderables itself 
    184195                        if (mRenderNodesContentForViz)  
    185196                        { 
     
    274285        } 
    275286 
     287 
    276288        //-- show visible scene nodes and octree bounding boxes from last frame 
    277289        if (mShowVisualization) 
     
    291303                        OctreeSceneManager::_findVisibleObjects(cam, onlyShadowCasters); 
    292304                } 
     305 
    293306                // only shadow casters will be rendered in shadow texture pass 
    294307                if (0) mHierarchyInterface->SetOnlyShadowCasters(onlyShadowCasters); 
     308 
     309 
     310                //-- apply view cell pvs 
     311                updatePvs(cam); 
    295312        } 
    296313         
     
    372389                // exclude this queues from hierarchical rendering 
    373390                setSpecialCaseRenderQueueMode(SceneManager::SCRQM_EXCLUDE); 
     391 
    374392 
    375393                // set all necessary parameters for  
     
    522540                return true; 
    523541        } 
    524  
    525         if (key == "UseArbQueries") 
    526         { 
    527                 bool useArbQueries = (*static_cast<const bool *>(val)); 
    528  
    529                 if (useArbQueries) 
    530                 { 
    531                         mHierarchyInterface->ResetQueries(); 
    532                         mDestRenderSystem->setConfigOption("ArbQueries", "Yes"); 
    533                 } 
    534                 else 
    535                 { 
    536                         mHierarchyInterface->ResetQueries(); 
    537                         mDestRenderSystem->setConfigOption("ArbQueries", "No"); 
    538                 } 
    539         } 
     542        if (key == "LoadViewCells") 
     543        {  
     544                if (!mViewCellsLoaded) 
     545                { 
     546                        LoadViewCells(static_cast<const char *>(val)); 
     547                        mViewCellsLoaded = true;         
     548                } 
     549 
     550                return true; 
     551        } 
     552        if (key == "UseViewCells") 
     553        {  
     554                mUseViewCells = *static_cast<const bool *>(val); 
     555 
     556                // reset view cell 
     557                OGRE_DELETE(mCurrentViewCell); 
     558                if (mUseViewCells) 
     559                        mCurrentViewCell =  mViewCellsManager->GenerateViewCell(); 
     560                mElementaryViewCell = NULL; 
     561                // if using view cells, all objects are set to false initially 
     562                SetObjectsVisible(!mUseViewCells); 
     563                 
     564                return true; 
     565        } 
     566        if (key == "UseVisibilityFilter") 
     567        { 
     568                mUseVisibilityFilter = *static_cast<const bool *>(val); 
     569                // set null =>recomputation of the pvs 
     570        mElementaryViewCell = NULL; 
     571                return true; 
     572        } 
     573 
    540574        return VisibilityOptionsManager(mVisibilityManager, mHierarchyInterface). 
    541575                setOption(key, val) || TerrainSceneManager::setOption(key, val); 
     
    753787 
    754788 
    755         // Render a single object, this will set up auto params if required 
     789        // render a single object, this will set up auto params if required 
    756790        renderSingleObject(rend, usedPass, false, &nullLightList); 
    757791} 
     
    799833                        mLeavePassesInQueue |= RenderPriorityGroup::TRANSPARENT_PASSES; 
    800834 
    801                         // just render ambient stuff 
     835                        // just render ambient passes 
    802836                        /*** msz: no more IRS_AMBIENT, see OgreSceneManager.h ***/ 
    803837                        // mIlluminationStage = IRS_AMBIENT;  
     838                        getRenderQueue()->setSplitPassesByLightingType(true); 
    804839                } 
    805840         
     
    885920                        // Also render any objects which have receive shadows disabled 
    886921                        OctreeSceneManager::renderObjects(pPriorityGrp->getSolidsNoShadowReceive(), om, true); 
    887                 } 
    888         } 
    889         else 
     922#if 0            
     923                        std::stringstream d;  
     924                        d << " solid size: " << (int)pPriorityGrp->_getSolidPasses().size() 
     925                                << " solid no shadow size: " << (int)pPriorityGrp->_getSolidPassesNoShadow().size() 
     926                                << "difspec size: " << (int)pPriorityGrp->_getSolidPassesDiffuseSpecular().size() 
     927                                << " decal size: " << (int)pPriorityGrp->_getSolidPassesDecal().size(); 
     928                        LogManager::getSingleton().logMessage(d.str()); 
     929#endif 
     930                } 
     931        } 
     932        else // render the rest of the passes 
    890933        { 
    891934                OctreeSceneManager::renderAdditiveStencilShadowedQueueGroupObjects(pGroup, om); 
     
    917960   } 
    918961} 
    919  
    920962//------------------------------------------------------------------------- 
    921 MovableObject *OcclusionCullingSceneManager::FindCorrespondingObject(const AxisAlignedBox &box) 
     963void OcclusionCullingSceneManager::SetObjectsVisible(const bool visible) 
     964{ 
     965        GtpVisibilityPreprocessor::ObjectContainer::iterator it, it_end = mObjects.end(); 
     966 
     967        for (it = mObjects.begin(); it != it_end; ++ it) 
     968        { 
     969                OgreMeshInstance *omi = static_cast<OgreMeshInstance *>(*it); 
     970                Entity *ent = omi->GetMesh(); 
     971                ent->setVisible(visible); 
     972        } 
     973} 
     974//------------------------------------------------------------------------- 
     975void OcclusionCullingSceneManager::loadVisibilityConfig(const String& filename) 
     976{ 
     977        // TODO matt 
     978        // Set up the options 
     979        ConfigFile config; 
     980        String val; 
     981 
     982        config.load(filename); 
     983 
     984        val = config.getSetting("Algorithm"); 
     985 
     986    if (!val.empty()) 
     987        { 
     988                 VisibilityOptionsManager(mVisibilityManager, mHierarchyInterface).setOption("Algorithm", val.c_str()); 
     989        } 
     990 
     991        val = config.getSetting("UseDepthPass"); 
     992 
     993        if (!val.empty()) 
     994        { 
     995                 setOption("UseDepthPass", val.c_str()); 
     996        } 
     997} 
     998//------------------------------------------------------------------------- 
     999inline static AxisAlignedBox EnlargeBox(const AxisAlignedBox &box) 
     1000{ 
     1001        const float eps = 1e-3f; 
     1002        const Vector3 veps(eps, eps, eps); 
     1003        Vector3 max = box.getMaximum(); 
     1004        Vector3 min = box.getMinimum(); 
     1005 
     1006        return AxisAlignedBox(min - veps, max + veps); 
     1007} 
     1008//----------------------------------------------------------------------- 
     1009Entity *OcclusionCullingSceneManager::FindCorrespondingObject(const AxisAlignedBox &box) 
    9221010{ 
    9231011        list<SceneNode *> sceneNodeList; 
    924  
    925         findNodesIn(box, sceneNodeList, NULL); 
     1012        AxisAlignedBox mybox = EnlargeBox(box); 
     1013        //AxisAlignedBox dummy(Vector3(-50000, -50000, -50000), Vector3(50000, 50000, 50000)); 
     1014         
     1015        // get intersecting scene nodes 
     1016        findNodesIn(mybox, sceneNodeList, NULL); 
     1017         
    9261018 
    9271019        list<SceneNode *>::const_iterator sit, sit_end = sceneNodeList.end(); 
    9281020 
    929         bool overlap = false; 
    930  
    931         MovableObject *bestFittingObj = NULL; 
    932         float bestFit = 0.0; 
    933          
     1021        float overlap = 0;//GtpVisibilityPreprocessor::Limits::Small; 
     1022 
     1023        Entity *bestFittingObj = NULL; 
     1024        float bestFit = overlap; 
     1025 
     1026        // perfect fit threshold 
     1027        const float thresh = 1.0 - GtpVisibilityPreprocessor::Limits::Small; 
     1028 
     1029 
    9341030        // find the bbox which is closest to the current bbox 
    935         for (sit = sceneNodeList.begin(); sit != sceneNodeList.end(), !overlap; ++ sit) 
     1031        for (sit = sceneNodeList.begin(); sit != sceneNodeList.end(); ++ sit) 
    9361032        { 
    9371033                SceneNode *sn = *sit; 
     
    9401036        while (oit.hasMoreElements()) 
    9411037                { 
    942                          MovableObject *mo = oit.getNext(); 
    943                          const AxisAlignedBox bbox = mo->getWorldBoundingBox(); 
     1038                        MovableObject *mo = oit.getNext(); 
     1039 
     1040                        // we are only interested in scene entities 
     1041                        if (mo->getMovableType() != "Entity") 
     1042                        { 
     1043                                continue; 
     1044                        } 
    9441045                          
    945                          const float overlap = GtpVisibilityPreprocessor::RatioOfOverlap( 
    946                                  OgreTypeConverter::ConvertFromOgre(bbox),  
    947                                  OgreTypeConverter::ConvertFromOgre(box)); 
    948  
     1046                        const AxisAlignedBox bbox = EnlargeBox(mo->getWorldBoundingBox()); 
     1047                                         
     1048 
     1049                        // compute measure how much aabbs overlap 
     1050                        overlap = RatioOfOverlap(OgreTypeConverter::ConvertFromOgre(mybox), 
     1051                                                                         OgreTypeConverter::ConvertFromOgre(bbox)); 
     1052         
    9491053                         if (overlap > bestFit) 
    9501054                         { 
    9511055                                 bestFit = overlap; 
    952                                  bestFittingObj = mo; 
    953                                          
    954                                  // perfect fit => object found 
    955                                  if (overlap > (1.0 - GtpVisibilityPreprocessor::Limits::Small)) 
    956                                         break; 
     1056                         
     1057                                 bestFittingObj = static_cast<Entity *>(mo); 
     1058 
     1059                                 // perfect fit => object found, eraly exit 
     1060                                 if (overlap >= thresh) 
     1061                                         return bestFittingObj;                          
    9571062                         } 
    9581063                } 
    9591064        } 
    9601065 
     1066        if (0) 
     1067        { 
     1068                std::stringstream d;  
     1069                if (bestFittingObj) 
     1070                        d << "best fit: " << bestFit;      
     1071                else 
     1072                        d << "warning, objects do not fit\n" << box; 
     1073         
     1074                Ogre::LogManager::getSingleton().logMessage(d.str()); 
     1075        } 
     1076 
    9611077        return bestFittingObj; 
    9621078} 
    963  
    964  
     1079//----------------------------------------------------------------------- 
    9651080void OcclusionCullingSceneManager::LoadViewCells(string filename) 
    9661081{ 
    967         GtpVisibilityPreprocessor::ObjectContainer objects; 
     1082        // the objects are set to invisible a prioriy 
     1083        SetObjectsVisible(false); 
     1084 
    9681085        // identify the corresponding Ogre meshes using the bounding boxes 
    969         IdentifyObjects(objects); 
    970          
     1086        IdentifyObjects(mObjects); 
     1087 
    9711088        // load the view cells assigning the found objects to the pvss 
    972         mViewCellsManager->LoadViewCells(filename, &objects); 
    973 } 
    974  
    975  
     1089        mViewCellsManager =  
     1090                GtpVisibilityPreprocessor::ViewCellsManager::LoadViewCells(filename, &mObjects); 
     1091 
     1092        std::stringstream d; 
     1093        d << "view cells loaded" << endl; 
     1094        Ogre::LogManager::getSingleton().logMessage(d.str()); 
     1095} 
     1096//----------------------------------------------------------------------- 
    9761097void OcclusionCullingSceneManager::IdentifyObjects(GtpVisibilityPreprocessor::ObjectContainer &objects) 
    9771098{ 
     
    9881109                  const GtpVisibilityPreprocessor::AxisAlignedBox3 box = (*iit).second; 
    9891110                  const AxisAlignedBox currentBox = OgreTypeConverter::ConvertToOgre(box); 
     1111                  
     1112                  Entity *ent = FindCorrespondingObject(currentBox); 
     1113 
     1114                  // create new mesh instance 
     1115                  OgreMeshInstance *omi = new OgreMeshInstance(ent); 
     1116                  omi->SetId((*iit).first); 
     1117                  objects.push_back(omi); 
     1118        } 
     1119} 
     1120//------------------------------------------------------------------------- 
     1121void OcclusionCullingSceneManager::applyViewCellPvs(GtpVisibilityPreprocessor::ViewCell *vc,  
     1122                                                                                                        const bool load) 
     1123{       // NOTE: should not happen, rather apply view cell representing unbounded space then 
     1124        if (!vc)  
     1125        {        
     1126                // set everything visible for savety 
     1127                SetObjectsVisible(true); 
     1128 
     1129                return; 
     1130        } 
    9901131                   
    991                   MovableObject *mo = FindCorrespondingObject(currentBox); 
    992                   //objects.push_back(mi); 
    993         } 
     1132        GtpVisibilityPreprocessor::ObjectPvsMap::const_iterator oit, 
     1133                        oit_end = vc->GetPvs().mEntries.end(); 
     1134 
     1135        //-- PVS of view cell 
     1136        for (oit = vc->GetPvs().mEntries.begin(); oit != oit_end; ++ oit) 
     1137        { 
     1138                if (!(*oit).first) continue; 
     1139 
     1140                OgreMeshInstance *omi = dynamic_cast<OgreMeshInstance*>((*oit).first); 
     1141                omi->GetMesh()->setVisible(load); 
     1142                //GtpVisibilityPreprocessor::Debug << "here45 " << omi->GetId() << endl; 
     1143        } 
     1144} 
     1145//------------------------------------------------------------------------- 
     1146void OcclusionCullingSceneManager::updatePvs(Camera *cam) 
     1147{ 
     1148        if (mViewCellsLoaded && mUseViewCells) 
     1149        { 
     1150                const GtpVisibilityPreprocessor::Vector3 viewPoint =  
     1151                        OgreTypeConverter::ConvertFromOgre(cam->getDerivedPosition()); 
     1152 
     1153                GtpVisibilityPreprocessor::ViewCell *newElementary =  
     1154                        mViewCellsManager->GetViewCell(viewPoint); 
     1155 
     1156                // elementary view cell did not change => apply same pvs 
     1157                if (mElementaryViewCell == newElementary) 
     1158                        return; 
     1159 
     1160                mElementaryViewCell = newElementary; 
     1161 
     1162                //-- unload old pvs 
     1163                applyViewCellPvs(mCurrentViewCell, false); 
     1164 
     1165 
     1166                //-- the new view cell 
     1167                 
     1168                GtpVisibilityPreprocessor::ViewCell *viewCell; 
     1169 
     1170                 
     1171                if (mUseVisibilityFilter) 
     1172                { 
     1173                        //-- compute new filtered cell 
     1174                        GtpVisibilityPreprocessor::PrVs prvs; 
     1175                        mViewCellsManager->GetPrVS(viewPoint, prvs); 
     1176                        viewCell = prvs.mViewCell; 
     1177                } 
     1178                else 
     1179                { 
     1180                        viewCell = newElementary; 
     1181                } 
     1182                         
     1183                //-- load new pvs 
     1184                applyViewCellPvs(viewCell, true); 
     1185 
     1186                // store pvs 
     1187                mCurrentViewCell->SetPvs(viewCell->GetPvs()); 
     1188 
     1189                // delete merge tree of filtered view cell 
     1190                if (mUseVisibilityFilter) 
     1191                        mViewCellsManager->DeleteLocalMergeTree(viewCell); 
     1192        } 
     1193} 
     1194 
     1195 
     1196 
     1197//----------------------------------------------------------------------- 
     1198const String OcclusionCullingSceneManagerFactory::FACTORY_TYPE_NAME = "OcclusionCullingSceneManager"; 
     1199//----------------------------------------------------------------------- 
     1200void OcclusionCullingSceneManagerFactory::initMetaData(void) const 
     1201{ 
     1202        mMetaData.typeName = FACTORY_TYPE_NAME; 
     1203        mMetaData.description = "Scene manager organising the scene on the basis of an octree with advanced occlusion culling (TM)."; 
     1204        mMetaData.sceneTypeMask = 0xFFFF; // support all types 
     1205        mMetaData.worldGeometrySupported = false; 
     1206} 
     1207//----------------------------------------------------------------------- 
     1208SceneManager* OcclusionCullingSceneManagerFactory::createInstance( 
     1209        const String& instanceName) 
     1210{ 
     1211        return new OcclusionCullingSceneManager(instanceName, visManager); 
     1212} 
     1213//----------------------------------------------------------------------- 
     1214void OcclusionCullingSceneManagerFactory::destroyInstance(SceneManager* instance) 
     1215{ 
     1216        delete instance; 
    9941217} 
    9951218 
  • GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgrePlatformHierarchyInterface.cpp

    r897 r903  
    8181void PlatformHierarchyInterface::ResetQueries() 
    8282{ 
    83 //      for (int i = 0; i < (int)mOcclusionQueries.size(); ++ i) OGRE_DELETE(mOcclusionQueries[i]); 
     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) 
    100         mSceneManager->_setPass(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) 
    101101        //SetOcclusionPass(); 
    102102 
     
    121121{ 
    122122        // create new query if there is no query left 
    123         if (mCurrentTestIdx == (int)mOcclusionQueries.size()) 
    124         { 
     123        if (mCurrentTestIdx >= (int)mOcclusionQueries.size()) 
     124        { 
     125                mCurrentTestIdx == (int)mOcclusionQueries.size(); 
    125126                mOcclusionQueries.push_back(new PlatformOcclusionQuery(mRenderSystem)); 
    126127        } 
  • GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgrePlatformOcclusionQuery.cpp

    r897 r903  
    1212PlatformOcclusionQuery::~PlatformOcclusionQuery() 
    1313{ 
    14         delete mHardwareOcclusionQuery; 
     14        //delete mHardwareOcclusionQuery; 
    1515} 
    1616//----------------------------------------------------------------------- 
     
    3232        bool isAvailable = true; 
    3333 
    34         if (!waitForResult) 
     34        /*if (!waitForResult) 
    3535                isAvailable = !mHardwareOcclusionQuery->isStillOutstanding(); 
    36  
     36        */ 
     37//visiblePixels = 800; 
    3738        if (isAvailable) 
    3839                return mHardwareOcclusionQuery->pullOcclusionQuery(&visiblePixels); 
  • GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreSolidBoundingBox.cpp

    r736 r903  
    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

    r897 r903  
    404404                //-- now we can render all remaining queue objects 
    405405                //-- used for depth pass, transparents, overlay 
     406 
    406407                clearSpecialCaseRenderQueues(); 
    407408         
    408                 //-- we render all remaining queue objects 
    409                 // used for depth pass, transparents, overlay  
    410                 clearSpecialCaseRenderQueues(); 
    411409                OctreeSceneManager::_renderVisibleObjects(); 
    412          
    413410        }   // hierarchical culling 
    414411 
    415412        // reset ambient light 
    416         setAmbientLight(savedAmbient); 
     413        //setAmbientLight(savedAmbient); 
    417414 
    418415        getRenderQueue()->clear(); // finally clear render queue 
     
    641638        } 
    642639#ifdef ITEM_BUFFER 
    643         //-- renders item buffer 
     640        //-- item buffer 
     641        //-- item buffer: render objects using false colors 
    644642 
    645643    // Iterate through priorities 
     
    657655{ 
    658656        // Do solids 
    659         RenderPriorityGroup::SolidRenderablePassMap solidObjs = pGroup->_getSolidPasses(); 
     657        QueuedRenderableCollection solidObjs = pGroup->getSolidsBasic();//msz 
    660658 
    661659        // ----- SOLIDS LOOP ----- 
     
    697695        if (mRenderTransparentsForItemBuffer) 
    698696        { 
    699                 RenderPriorityGroup::TransparentRenderablePassList transpObjs =  
    700                         pGroup->_getTransparentPasses(); 
     697                QueuedRenderableCollection transpObjs = pGroup->getTransparents(); //msz 
    701698                RenderPriorityGroup::TransparentRenderablePassList::const_iterator  
    702699                        itrans, itransend; 
     
    752749        } 
    753750 
    754         Pass *usedPass = setPass(mItemBufferPass);  
     751        const Pass *usedPass = _setPass(mItemBufferPass);  
    755752 
    756753 
     
    789786        mLeavePassesInQueue = 0; 
    790787 
    791         if (!mUseDepthPass && !mUseItemBuffer) 
     788        // if we have the depth pass or use an item buffer, no passes are left in the queue 
     789        if (1 && !mUseDepthPass && !mUseItemBuffer) 
    792790        { 
    793791                if (mShadowTechnique == SHADOWTYPE_STENCIL_ADDITIVE) 
  • GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreVisibilityOptionsManager.cpp

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

    r897 r903  
    489489        } 
    490490 
    491         if (key == "UseArbQueries") 
    492         { 
    493                 bool useArbQueries = (*static_cast<const bool *>(val)); 
    494  
    495                 if (useArbQueries) 
    496                 { 
    497                         mHierarchyInterface->ResetQueries(); 
    498                         mDestRenderSystem->setConfigOption("ArbQueries", "Yes"); 
    499                 } 
    500                 else 
    501                 { 
    502                         mHierarchyInterface->ResetQueries(); 
    503                         mDestRenderSystem->setConfigOption("ArbQueries", "No"); 
    504                 } 
    505         } 
    506491        return VisibilityOptionsManager(mVisibilityManager, mHierarchyInterface). 
    507492                setOption(key, val) || TerrainSceneManager::setOption(key, val); 
Note: See TracChangeset for help on using the changeset viewer.