Changeset 1616


Ignore:
Timestamp:
10/13/06 03:28:42 (18 years ago)
Author:
mattausch
Message:

some shit happen

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

Legend:

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

    r1595 r1616  
    77#include "BoundingBoxConverter.h" 
    88#include "Containers.h" 
     9#include "IntersectableWrapper.h" 
     10//#include "KdTree.h" 
     11 
    912 
    1013namespace Ogre { 
    1114 
     15#define USE_KD_PVS 1 
    1216class Entity; 
    1317class OctreeSceneManager; 
     
    1519class BvHierarchySceneManager; 
    1620 
     21typedef vector<Entity *> EntityContainer; 
     22 
     23class ObjectsIntersectable: public GtpVisibilityPreprocessor::IntersectableWrapper<EntityContainer *> 
     24{ 
     25public: 
     26        ObjectsIntersectable(EntityContainer *item): 
     27        GtpVisibilityPreprocessor::IntersectableWrapper<EntityContainer *>(item) {} 
     28 
     29        // hack 
     30        ObjectsIntersectable::~ObjectsIntersectable()  
     31        { 
     32                //CLEAR_CONTAINER(*mItem); 
     33                delete mItem; 
     34        } 
     35 
     36        int Type() const 
     37        { 
     38                return Intersectable::OBJECTS_INTERSECTABLE; 
     39        } 
     40}; 
    1741 
    1842/**     Class which converts preprocessor types to OGRE types 
     
    4266        } 
    4367         
     68        /** find object which fits best to this bounding box 
     69        */ 
    4470        Entity *FindBestFittingObject(const AxisAlignedBox &box) const; 
     71         
     72        /** find objects which are intersected by this box 
     73        */ 
     74        void FindIntersectingObjects(const AxisAlignedBox &box, 
     75                                                                 vector<Entity *> &objects) const; 
    4576 
    4677        T *mSceneMgr; 
     
    74105        list<SceneNode *>::const_iterator sit, sit_end = sceneNodeList.end(); 
    75106        // find the bbox which is closest to the current bbox 
     107        for (sit = sceneNodeList.begin(); sit != sceneNodeList.end(); ++ sit) 
     108        { 
     109                SceneNode *sn = *sit; 
     110                SceneNode::ObjectIterator oit = sn->getAttachedObjectIterator(); 
     111 
     112        while (oit.hasMoreElements()) 
     113                { 
     114                        MovableObject *mo = oit.getNext(); 
     115 
     116                        // we are only interested in scene entities 
     117                        if (mo->getMovableType() != "Entity") 
     118                        { 
     119                                continue; 
     120                        } 
     121                         mo-> 
     122                        const AxisAlignedBox bbox = EnlargeBox(mo->getWorldBoundingBox()); 
     123                                         
     124                        // compute measure how much aabbs overlap 
     125                        overlap = RatioOfOverlap(OgreTypeConverter::ConvertFromOgre(mybox), 
     126                                                                         OgreTypeConverter::ConvertFromOgre(bbox)); 
     127         
     128                         if (overlap > bestFit) 
     129                         { 
     130                                 bestFit = overlap; 
     131                                 bestFittingObj = static_cast<Entity *>(mo); 
     132 
     133                                 // perfect fit => object found, early exit 
     134                                 if (overlap >= thresh) 
     135                                 { 
     136                                         return bestFittingObj;  
     137                                 } 
     138                         } 
     139                } 
     140        } 
     141 
     142        if (0) 
     143        { 
     144                std::stringstream d;  
     145                if (bestFittingObj) 
     146                        d << "best fit: " << bestFit;      
     147                else 
     148                        d << "warning, no best fitting object\n" << box; 
     149         
     150                Ogre::LogManager::getSingleton().logMessage(d.str()); 
     151        } 
     152 
     153        return bestFittingObj; 
     154} 
     155//----------------------------------------------------------------------- 
     156template<typename T> 
     157void PlatFormBoundingBoxConverter<T>::FindIntersectingObjects(const AxisAlignedBox &box, 
     158                                                                                                                          EntityContainer &objects) const 
     159{ 
     160        list<SceneNode *> sceneNodeList; 
     161                         
     162        // get intersecting scene nodes (= candidates) 
     163        //AxisAlignedBox mybox = EnlargeBox(box); 
     164        //mSceneMgr->findNodesIn(mybox, sceneNodeList, NULL); 
     165        mSceneMgr->findNodesIn(box, sceneNodeList, NULL); 
     166 
     167        list<SceneNode *>::const_iterator sit, sit_end = sceneNodeList.end(); 
     168 
     169        //GtpVisibilityPreprocessor::AxisAlignedBox nodeBox = OgreTypeConverter::ConvertFromOgre(mybox); 
     170        GtpVisibilityPreprocessor::AxisAlignedBox3 nodeBox = OgreTypeConverter::ConvertFromOgre(box); 
     171 
     172        // find really intersecting objects 
    76173        for (sit = sceneNodeList.begin(); sit != sceneNodeList.end(); ++ sit) 
    77174        { 
     
    89186                        } 
    90187                          
    91                         const AxisAlignedBox bbox = EnlargeBox(mo->getWorldBoundingBox()); 
    92                                          
    93                         // compute measure how much aabbs overlap 
    94                         overlap = RatioOfOverlap(OgreTypeConverter::ConvertFromOgre(mybox), 
    95                                                                          OgreTypeConverter::ConvertFromOgre(bbox)); 
    96          
    97                          if (overlap > bestFit) 
     188                        //const AxisAlignedBox bbox = EnlargeBox(mo->getWorldBoundingBox()); 
     189                        const AxisAlignedBox bbox = mo->getWorldBoundingBox(); 
     190 
     191                        const bool overlaps = Overlap(nodeBox, 
     192                                                                                  OgreTypeConverter::ConvertFromOgre(bbox) 
     193                                                                                  ); 
     194                                                                                  //,0.00001); 
     195         
     196                         if (overlaps) 
    98197                         { 
    99                                  bestFit = overlap; 
    100                                  bestFittingObj = static_cast<Entity *>(mo); 
    101  
    102                                  // perfect fit => object found, early exit 
    103                                  if (overlap >= thresh) 
    104                                  { 
    105                                          return bestFittingObj;  
    106                                  } 
     198                                 objects.push_back(static_cast<Entity *>(mo)); 
    107199                         } 
    108200                } 
    109201        } 
    110  
    111         if (0) 
    112         { 
    113                 std::stringstream d;  
    114                 if (bestFittingObj) 
    115                         d << "best fit: " << bestFit;      
    116                 else 
    117                         d << "warning, no best fitting object\n" << box; 
    118          
    119                 Ogre::LogManager::getSingleton().logMessage(d.str()); 
    120         } 
    121  
    122         return bestFittingObj; 
    123 } 
     202} 
     203 
     204#if USE_KD_PVS 
     205//------------------------------------------------------------------------- 
     206template<typename T> 
     207bool PlatFormBoundingBoxConverter<T>::IdentifyObjects( 
     208        const GtpVisibilityPreprocessor::IndexedBoundingBoxContainer &iboxes, 
     209        GtpVisibilityPreprocessor::ObjectContainer &objects) const 
     210{ 
     211        Ogre::LogManager().logMessage("pvs: intersecting objects"); 
     212        const long startTime = GtpVisibilityPreprocessor::GetTime(); 
     213 
     214        GtpVisibilityPreprocessor::IndexedBoundingBoxContainer:: 
     215                const_iterator iit, iit_end = iboxes.end(); 
     216   
     217        int i = 0; 
     218 
     219        for (iit = iboxes.begin(); iit != iit_end; ++ iit, ++ i) 
     220        { 
     221                if ((i % 1000) == 0) 
     222                { 
     223                        std::stringstream d; d << "found " << i << " objects"; 
     224                        Ogre::LogManager().getSingleton().logMessage(d.str()); 
     225                } 
     226 
     227                const AxisAlignedBox box = OgreTypeConverter::ConvertToOgre((*iit).second); 
     228                 
     229                //GtpVisibilityPreprocessor::ObjectContainer *entryObjects = new EntityContainer(); 
     230                EntityContainer *entryObjects = new EntityContainer(); 
     231 
     232                // find all objects that intersect the bounding box 
     233                FindIntersectingObjects(box, *entryObjects); 
     234 
     235                /*vector<Entity *>::const_iterator mit, mit_end = sceneObjects.end(); 
     236                 
     237                for (mit = sceneObjects.begin(); mit != mit_end; ++ mit) 
     238                { 
     239                        Entity *ent = *mit; 
     240                        // create new mesh instance 
     241                        OgreMeshInstance *omi = new OgreGetOrCreateOgreMeshInstance(ent); 
     242                        //omi->SetId((*iit).first); 
     243                        entryObjects->push_back(omi); 
     244                }*/ 
     245 
     246                ObjectsIntersectable *entry =  
     247                        new ObjectsIntersectable(entryObjects); 
     248                entry->SetId((*iit).first); 
     249                //kdObj->mBbox = (*iit).second; 
     250                objects.push_back(entry); 
     251        } 
     252 
     253        std::stringstream d; d << "finished object intersection in " << GtpVisibilityPreprocessor::TimeDiff(startTime, GtpVisibilityPreprocessor::GetTime()) * 1e-3 << "secs"; 
     254        Ogre::LogManager().logMessage(d.str()); 
     255 
     256        return true; 
     257} 
     258#else 
    124259//------------------------------------------------------------------------- 
    125260template<typename T> 
     
    138273                Entity *ent = FindBestFittingObject(currentBox); 
    139274 
    140                 // create new mesh instance 
    141275                if (ent) 
    142276                { 
     277                        // create new mesh instance 
    143278                        OgreMeshInstance *omi = new OgreMeshInstance(ent); 
    144279                        omi->SetId((*iit).first); 
     
    149284        return true; 
    150285} 
    151  
     286#endif 
    152287 
    153288typedef PlatFormBoundingBoxConverter<OctreeSceneManager> OctreeBoundingBoxConverter; 
  • GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/include/OgreOcclusionCullingSceneManager.h

    r1606 r1616  
    225225        int mCurrentEntityId; 
    226226 
    227         typedef map<int, MovableObject *> MovableObjectsMap; 
     227        typedef map<int, MovableObject *> MovableMap; 
    228228 
    229229        /// hash table for view cells geometry 
    230     MovableObjectsMap mViewCellsGeometry; 
     230    MovableMap mViewCellsGeometry; 
     231 
     232        bool mViewCellsGeometryLoaded; 
    231233}; 
    232234 
  • GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreOcclusionCullingSceneManager.cpp

    r1610 r1616  
    2121#include "OgreBoundingBoxConverter.h" 
    2222#include <OgreManualObject.h> 
    23  
     23#include "IntersectableWrapper.h" 
    2424 
    2525namespace Ogre { 
     
    5353mDeleteQueueAfterRendering(true), 
    5454mNormalExecution(false), 
    55 mShowViewCells(false) 
     55mShowViewCells(false), 
     56mViewCellsGeometryLoaded(false) 
    5657{ 
    5758        Ogre::LogManager::getSingleton().logMessage("creating occlusion culling scene manager"); 
     
    179180                getRenderQueue()->addRenderable(*it); 
    180181        } 
    181  
     182/* 
    182183        // set old view cell geometry to invisible 
    183     if (mCurrentViewCell && mCurrentViewCell->GetMesh()) 
     184    if (mCurrentViewCell //&& mCurrentViewCell->GetMesh()) 
    184185        { 
    185186                //const bool showSingleViewCell = true; 
    186                 if (!mShowViewCells) 
    187                 { 
    188                         const int id = mCurrentViewCell->GetId(); 
    189                         mViewCellsGeometry[id]->_updateRenderQueue(getRenderQueue()); 
    190                 } 
    191                 else 
    192                 { 
    193                         MovableObjectsMap::const_iterator mit, mit_end = mViewCellsGeometry.end(); 
    194                          
    195                         for (mit = mViewCellsGeometry.begin(); mit != mit_end; ++ mit) 
     187                if (mViewCellsGeometryLoaded) 
     188                { 
     189                        if (!mShowViewCells) 
    196190                        { 
    197                                 (*mit).second->_updateRenderQueue(getRenderQueue()); 
    198                         }        
    199                 } 
    200  
     191                                const int id = mCurrentViewCell->GetId(); 
     192 
     193                                MovableMap::iterator fit = mViewCellsGeometry.find(id); 
     194                                if ((fit != mViewCellsGeometry.end()) && (*fit).second) 
     195                                        (*fit).second->_updateRenderQueue(getRenderQueue()); 
     196                        } 
     197                        else 
     198                        { 
     199                                MovableMap::const_iterator mit, mit_end = mViewCellsGeometry.end(); 
     200 
     201                                for (mit = mViewCellsGeometry.begin(); mit != mit_end; ++ mit) 
     202                                { 
     203                                        if ((*mit).second) 
     204                                                (*mit).second->_updateRenderQueue(getRenderQueue()); 
     205                                }        
     206                        } 
     207                } 
     208                 
    201209                GtpVisibilityPreprocessor::ObjectPvsMap::const_iterator  
    202210                        oit, oit_end = mCurrentViewCell->GetPvs().mEntries.end(); 
     
    204212                for (oit = mCurrentViewCell->GetPvs().mEntries.begin(); oit != oit_end; ++ oit) 
    205213                { 
    206                         OgreMeshInstance *obj = static_cast<OgreMeshInstance *>((*oit).first); 
    207                         obj->GetEntity()->_updateRenderQueue(getRenderQueue()); 
     214                        GtpVisibilityPreprocessor::Intersectable *entry = (*oit).first; 
     215 
     216                        if (entry->Type() == GtpVisibilityPreprocessor::Intersectable::OBJECTS_INTERSECTABLE) 
     217                        { 
     218                                ObjectsIntersectable *oi = dynamic_cast<ObjectsIntersectable *>(entry); 
     219                                 
     220                                EntityContainer *entries = oi->GetItem(); 
     221                                 
     222                                EntityContainer::const_iterator eit, eit_end = entries->end(); 
     223                                                 
     224                                for (eit = entries->begin(); eit != eit_end; ++ eit) 
     225                                { 
     226                                        (*eit)->setUserAny(Any((int)0)); 
     227                                } 
     228                        } 
     229                } 
     230 
     231                for (oit = mCurrentViewCell->GetPvs().mEntries.begin(); oit != oit_end; ++ oit) 
     232                { 
     233                        GtpVisibilityPreprocessor::Intersectable *entry = (*oit).first; 
     234                 
     235                        switch (entry->Type()) 
     236                        {        
     237                                case GtpVisibilityPreprocessor::Intersectable::OGRE_MESH_INSTANCE: 
     238                                        { 
     239                                                OgreMeshInstance *omi = dynamic_cast<OgreMeshInstance *>(entry); 
     240                                                omi->GetEntity()->_updateRenderQueue(getRenderQueue()); 
     241                                        } 
     242                                        break; 
     243                                case GtpVisibilityPreprocessor::Intersectable::OBJECTS_INTERSECTABLE: 
     244                                        { 
     245                                                ObjectsIntersectable *oi = dynamic_cast<ObjectsIntersectable *>(entry); 
     246                                         
     247                                                EntityContainer *entries = oi->GetItem(); 
     248                                                EntityContainer::const_iterator eit, eit_end = entries->end(); 
     249                                                 
     250                                                for (eit = entries->begin(); eit != eit_end; ++ eit) 
     251                                                { 
     252                                                        //OgreMeshInstance *omi = dynamic_cast<OgreMeshInstance *>(*eit); 
     253                                                        Entity *ent = *eit; 
     254                                                        Any newAny = ent->getUserAny(); 
     255 
     256                                                        int flt = any_cast<int>(newAny); 
     257                                                        //std::stringstream d; d << "any: " << flt << " "; 
     258                                                        //Ogre::LogManager::getSingleton().logMessage(d.str()); 
     259                                                        if (any_cast<int>(newAny) == 0) 
     260                                                        { 
     261                                                                ent->setUserAny(Any((int)1)); 
     262                                                                ent->_updateRenderQueue(getRenderQueue()); 
     263                                                        } 
     264 
     265                                                        //GtpVisibilityPreprocessor::Debug << "assigned id " << omi->GetId() << endl; 
     266                                                } 
     267                                        } 
     268                                        break; 
     269                                default: 
     270                                        break; 
     271                        } 
    208272                }        
    209273        } 
    210 /* 
     274*/ 
     275 
    211276    if (mRenderNodesForViz || mRenderNodesContentForViz) 
    212277        { 
     
    242307                        } 
    243308                } 
    244         }*/ 
     309        } 
    245310} 
    246311//----------------------------------------------------------------------- 
     
    635700                        // all objects are set to invisible per default 
    636701                        SetObjectsVisible(!mUseViewCells); 
     702 
     703                        /*MovableObjectIterator movit = getMovableObjectIterator("Entity"); 
     704                        while (movit.hasMoreElements()) 
     705                        { 
     706                                Entity *ent = static_cast<Entity *>(movit.getNext()); 
     707                                ent->setVisible(!mUseViewCells); 
     708                        }*/ 
    637709                } 
    638710 
     
    10901162        for (it = mObjects.begin(); it != it_end; ++ it) 
    10911163        { 
    1092                 OgreMeshInstance *omi = static_cast<OgreMeshInstance *>(*it); 
    1093                 Entity *ent = omi->GetEntity(); 
    1094                  
    1095                 ent->setVisible(visible); 
     1164                GtpVisibilityPreprocessor::Intersectable *entry = *it; 
     1165 
     1166                switch (entry->Type()) 
     1167                { 
     1168                        case GtpVisibilityPreprocessor::Intersectable::OGRE_MESH_INSTANCE: 
     1169                                { 
     1170                                        OgreMeshInstance *omi = dynamic_cast<OgreMeshInstance *>(entry); 
     1171                                        omi->GetEntity()->setVisible(visible); 
     1172                                        //GtpVisibilityPreprocessor::Debug << "assigned id " << omi->GetId() << endl; 
     1173                                } 
     1174                                break; 
     1175                        case GtpVisibilityPreprocessor::Intersectable::OBJECTS_INTERSECTABLE: 
     1176                                { 
     1177                                        //GtpVisibilityPreprocessor::ObjectsIntersectable *oi =  
     1178                                        //      dynamic_cast<GtpVisibilityPreprocessor::ObjectsIntersectable *>(entry); 
     1179                                        ObjectsIntersectable *oi = dynamic_cast<ObjectsIntersectable *>(entry); 
     1180 
     1181                                        //GtpVisibilityPreprocessor::ObjectContainer *entries = oi->GetItem(); 
     1182                                        EntityContainer *entries = oi->GetItem(); 
     1183                                        EntityContainer::const_iterator eit, 
     1184                                                eit_end = entries->end(); 
     1185                                        for (eit = entries->begin(); eit != eit_end; ++ eit) 
     1186                                        { 
     1187                                                //OgreMeshInstance *omi = dynamic_cast<OgreMeshInstance *>(*eit); 
     1188                                                Entity *ent = *eit; 
     1189                                                ent->setVisible(visible); 
     1190                                                //GtpVisibilityPreprocessor::Debug << "assigned id " << omi->GetId() << endl; 
     1191                                        } 
     1192                                } 
     1193                                break; 
     1194                        default: 
     1195                                break; 
     1196                } 
    10961197        } 
    10971198} 
     
    10991200bool OcclusionCullingSceneManager::LoadViewCells(const String &filename) 
    11001201{ 
    1101         // objects are set to invisible initially 
    1102         SetObjectsVisible(false); 
    1103          
    11041202        // converter between view cell ids and Ogre entites  
    11051203        GtpVisibilityPreprocessor::IndexedBoundingBoxContainer iboxes; 
     
    11101208        mViewCellsManager =  
    11111209                GtpVisibilityPreprocessor::ViewCellsManager::LoadViewCells(filename, &mObjects, true, &bconverter); 
     1210 
     1211        Ogre::LogManager().getSingleton().logMessage("view cells loaded"); 
     1212        //Ogre::LogManager().getSingleton().flush(); 
     1213        // objects are set to invisible initially 
     1214        SetObjectsVisible(false); 
    11121215 
    11131216        if (finalizeViewCells) 
     
    11261229        {        
    11271230                // if no there is no view cell, set everything visible 
    1128                 SetObjectsVisible(true); 
    1129  
     1231                //SetObjectsVisible(true); 
     1232SetObjectsVisible(false); 
    11301233                return; 
    11311234        } 
     
    11391242        for (oit = vc->GetPvs().mEntries.begin(); oit != oit_end; ++ oit) 
    11401243        { 
     1244                GtpVisibilityPreprocessor::Intersectable *entry = (*oit).first; 
    11411245                // no associated geometry found 
    1142                 if (!(*oit).first) continue; 
    1143  
    1144                 OgreMeshInstance *omi = dynamic_cast<OgreMeshInstance *>((*oit).first); 
    1145                 omi->GetEntity()->setVisible(load); 
    1146                 //GtpVisibilityPreprocessor::Debug << "assigned id " << omi->GetId() << endl; 
     1246                if (!entry) continue; 
     1247         
     1248                switch (entry->Type()) 
     1249                { 
     1250                        case GtpVisibilityPreprocessor::Intersectable::OGRE_MESH_INSTANCE: 
     1251                                { 
     1252                                        OgreMeshInstance *omi = dynamic_cast<OgreMeshInstance *>(entry); 
     1253                                        omi->GetEntity()->setVisible(load); 
     1254                                        //GtpVisibilityPreprocessor::Debug << "assigned id " << omi->GetId() << endl; 
     1255                                } 
     1256                                break; 
     1257                        case GtpVisibilityPreprocessor::Intersectable::OBJECTS_INTERSECTABLE: 
     1258                                { 
     1259                                        //GtpVisibilityPreprocessor::ObjectsIntersectable *oi =  
     1260                                        //      dynamic_cast<GtpVisibilityPreprocessor::ObjectsIntersectable *>(entry); 
     1261                                        ObjectsIntersectable *oi = dynamic_cast<ObjectsIntersectable *>(entry); 
     1262 
     1263                                        //GtpVisibilityPreprocessor::ObjectContainer *entries = oi->GetItem(); 
     1264                                        EntityContainer *entries = oi->GetItem(); 
     1265 
     1266                                        EntityContainer::const_iterator eit, 
     1267                                                eit_end = entries->end(); 
     1268                                        for (eit = entries->begin(); eit != eit_end; ++ eit) 
     1269                                        { 
     1270                                                //OgreMeshInstance *omi = dynamic_cast<OgreMeshInstance *>(*eit); 
     1271                                                //omi->GetEntity()->setVisible(load); 
     1272                                                Entity *ent = *eit; 
     1273                                                ent->setVisible(load);                                   
     1274                                                //GtpVisibilityPreprocessor::Debug << "assigned id " << omi->GetId() << endl; 
     1275                                        } 
     1276                                } 
     1277                                break; 
     1278                        default: 
     1279                                break; 
     1280                } 
    11471281        } 
    11481282} 
     
    12081342void OcclusionCullingSceneManager::CreateViewCellsGeometry() 
    12091343{ 
    1210         LogManager::getSingleton().logMessage("creating view cells geometry"); 
     1344        //LogManager::getSingleton().logMessage("creating view cells geometry"); 
    12111345 
    12121346        GtpVisibilityPreprocessor::ViewCellContainer viewCells = mViewCellsManager->GetViewCells(); 
     
    12171351                GtpVisibilityPreprocessor::ViewCell *viewCell = *it; 
    12181352 
    1219                 std::stringstream str; 
    1220                 str << "processing view cell with id : " << viewCell->GetId(); 
    1221                 LogManager::getSingleton().logMessage(str.str()); 
     1353                //std::stringstream str; 
     1354                //str << "processing view cell with id : " << viewCell->GetId(); 
     1355                //LogManager::getSingleton().logMessage(str.str()); 
    12221356                ManualObject *manual = OgreTypeConverter::ConvertToOgre(viewCell->GetMesh(), this); 
    1223                 mViewCellsGeometry[viewCell->GetId()] = manual; 
    1224  
    1225                 // attach to scene node 
    1226                 getRootSceneNode()->createChildSceneNode()->attachObject(manual); 
    1227                 manual->setQueryFlags(0); // returned by no query 
    1228          
    1229                 // initialy set to invisible 
    1230                 manual->setVisible(false); 
    1231         } 
     1357                 
     1358                if (manual) 
     1359                { 
     1360                        mViewCellsGeometry[viewCell->GetId()] = manual; 
     1361 
     1362                        // attach to scene node 
     1363                        getRootSceneNode()->createChildSceneNode()->attachObject(manual); 
     1364                        manual->setQueryFlags(0); // returned by no query 
     1365         
     1366                        // initialy set to invisible 
     1367                        manual->setVisible(false); 
     1368                } 
     1369        } 
     1370         
     1371        mViewCellsGeometryLoaded = true; 
    12321372} 
    12331373//------------------------------------------------------------------------- 
    12341374void OcclusionCullingSceneManager::VisualizeViewCells(const bool visualize) 
    12351375{ 
    1236         MovableObjectsMap::const_iterator mit, mit_end = mViewCellsGeometry.end(); 
     1376        MovableMap::const_iterator mit, mit_end = mViewCellsGeometry.end(); 
    12371377                         
    12381378        for (mit = mViewCellsGeometry.begin(); mit != mit_end; ++ mit) 
    12391379        { 
    1240                 (*mit).second->setVisible(visualize); 
     1380                if ((*mit).second) 
     1381                        (*mit).second->setVisible(visualize); 
    12411382        }        
    12421383} 
  • GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreTypeConverter.cpp

    r1602 r1616  
    4040ManualObject *OgreTypeConverter::ConvertToOgre(GtpVisibilityPreprocessor::Mesh *mesh, SceneManager *sceneMgr) 
    4141{ 
     42        if (!mesh) 
     43                return NULL; 
     44 
    4245        char name[100]; 
    43         sprintf(name, "mesh%04d", mesh->GetId()); 
     46        sprintf(name, "mesh%06d", mesh->GetId()); 
    4447 
    4548        ManualObject* manual = sceneMgr->createManualObject(name); 
  • GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp

    r1614 r1616  
    608608        ViewCellsManager *vm = NULL; 
    609609 
    610         if (parser.ParseViewCellsFile(filename, &vm, objects, bconverter)) 
    611         { 
    612                 const long startTime = GetTime(); 
    613  
     610        const long startTime = GetTime(); 
     611        bool success = parser.ParseViewCellsFile(filename, &vm, objects, bconverter); 
     612 
     613        if (success) 
     614        { 
    614615                vm->ResetViewCells(); 
    615616 
     
    621622                        // create the meshes and compute volumes 
    622623                        vm->FinalizeViewCells(true); 
    623                         //                      vm->mViewCellsTree->AssignRandomColors(); 
     624                        // vm->mViewCellsTree->AssignRandomColors(); 
    624625                } 
    625626 
     
    39093910        Debug << "\nView cells after merge:\n" << mCurrentViewCellsStats << endl; 
    39103911         
    3911         if (1) // export merged view cells 
     3912        if (mShowVisualization) // export merged view cells 
    39123913        { 
    39133914                mColorCode = 0; 
     
    39403941        } 
    39413942 
    3942         if (1)  
     3943        if (mShowVisualization)  
    39433944        { 
    39443945                // use pvs size for color coding 
     
    39773978{ 
    39783979        mRenderer->RenderScene(); 
     3980 
    39793981        SimulationStatistics ss; 
    39803982        dynamic_cast<RenderSimulator *>(mRenderer)->GetStatistics(ss); 
     
    47034705                volume += lVol; 
    47044706 
    4705         CreateMesh(*it); 
     4707                if (createMesh) 
     4708                        CreateMesh(*it); 
    47064709        } 
    47074710 
  • GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsParser.cpp

    r1595 r1616  
    271271        // all bounding boxes gathered in this step =>  
    272272        // associate object ids with bounding boxes 
    273         long startTime = GetTime(); 
     273        const long startTime = GetTime(); 
    274274         
    275275        if (mBoundingBoxConverter) 
Note: See TracChangeset for help on using the changeset viewer.