Changeset 938


Ignore:
Timestamp:
05/10/06 08:05:24 (18 years ago)
Author:
mattausch
Message:
 
Location:
GTP/trunk/Lib/Vis
Files:
26 edited

Legend:

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

    r931 r938  
    108108        /** Loads view cells for this particular scene. 
    109109        */ 
    110         void LoadViewCells(std::string filename); 
     110        bool LoadViewCells(const String &filename); 
    111111 
    112112protected: 
     
    210210        bool mUseViewCells; 
    211211 
    212          
    213212        /// if the view cells are filtered 
    214213        bool mUseVisibilityFilter; 
  • GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/include/OgrePlatformHierarchyInterface.h

    r897 r938  
    2020        @remark also provides methods for using occlusion queries on the hierarchy nodes 
    2121*/ 
     22typedef std::vector<PlatformOcclusionQuery *> OcclusionQueryContainer; 
     23 
    2224class PlatformHierarchyInterface: public GtpVisibility::HierarchyInterface 
    2325{ 
     
    151153        AxisAlignedBox mBox; 
    152154         
    153         std::vector<PlatformOcclusionQuery *> mOcclusionQueries; 
     155        OcclusionQueryContainer mOcclusionQueries; 
    154156 
    155157        Vector3 mCameraPosition; 
  • GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreBoundingBoxConverter.cpp

    r933 r938  
    1919        GtpVisibilityPreprocessor::IndexedBoundingBoxContainer:: 
    2020                const_iterator iit, iit_end = iboxes.end(); 
    21  
     21std::stringstream d; d << "here75557\n"; 
     22   LogManager::getSingleton().logMessage(d.str()); 
    2223        for (iit = iboxes.begin(); iit != iit_end; ++ iit) 
    2324        { 
    2425                const GtpVisibilityPreprocessor::AxisAlignedBox3 box = (*iit).second; 
    2526                const AxisAlignedBox currentBox = OgreTypeConverter::ConvertToOgre(box); 
    26          
     27std::stringstream d; d << "here77\n"; 
     28   LogManager::getSingleton().logMessage(d.str()); 
    2729                Entity *ent = FindCorrespondingObject(currentBox); 
    2830 
     
    5153        AxisAlignedBox mybox = EnlargeBox(box); 
    5254        //AxisAlignedBox dummy(Vector3(-50000, -50000, -50000), Vector3(50000, 50000, 50000)); 
    53          
     55        std::stringstream d; d << "here3 idenbtiy 8888\n"; 
     56        LogManager::getSingleton().logMessage(d.str()); 
    5457        //-- get intersecting scene nodes 
    5558        mSceneMgr->findNodesIn(mybox, sceneNodeList, NULL); 
     
    5861        list<SceneNode *>::const_iterator sit, sit_end = sceneNodeList.end(); 
    5962 
    60         float overlap = 0;//GtpVisibilityPreprocessor::Limits::Small; 
     63        // minimal overlap 
     64        float overlap = 0;//1e-6; 
    6165 
    6266        Entity *bestFittingObj = NULL; 
  • GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreOcclusionCullingSceneManager.cpp

    r931 r938  
    6666        // TODO: set maxdepth to reasonable value 
    6767        mMaxDepth = 50; 
    68  
    69         //loadVisibilityConfig("GtpVisibility.cfg"); 
    70         //LoadViewCells(""); 
    71         //mViewCellsLoaded = true; 
    7268} 
    7369//----------------------------------------------------------------------- 
     
    137133    mTerrainPages.clear(); 
    138134    // Load the configuration 
    139     loadConfig( stream ); 
     135    loadConfig(stream); 
    140136        initLevelIndexes(); 
    141137 
     
    555551                if (!mViewCellsLoaded) 
    556552                { 
    557                         LoadViewCells(static_cast<const char *>(val)); 
    558                         mViewCellsLoaded = true;         
    559                 } 
    560  
    561                 return true; 
     553                        String filename(static_cast<const char *>(val)); 
     554                        mViewCellsLoaded = LoadViewCells(filename);      
     555                } 
     556 
     557                return mViewCellsLoaded; 
    562558        } 
    563559        if (key == "UseViewCells") 
    564560        {  
    565                 mUseViewCells = *static_cast<const bool *>(val); 
    566  
    567                 // reset view cell 
    568                 OGRE_DELETE(mCurrentViewCell); 
    569                 if (mUseViewCells) 
    570                         mCurrentViewCell =  mViewCellsManager->GenerateViewCell(); 
    571                 mElementaryViewCell = NULL; 
    572                 // if using view cells, all objects are set to false initially 
    573                 SetObjectsVisible(!mUseViewCells); 
    574                  
     561                if (mViewCellsLoaded) 
     562                { 
     563                        LogManager::getSingleton().logMessage("here3"); 
     564                        mUseViewCells = *static_cast<const bool *>(val); 
     565 
     566                        // reset view cell 
     567                        OGRE_DELETE(mCurrentViewCell); 
     568 
     569                        if (mUseViewCells) 
     570                                mCurrentViewCell = mViewCellsManager->GenerateViewCell(); 
     571 
     572                        mElementaryViewCell = NULL; 
     573 
     574                        // if using view cells, all objects are set to false initially 
     575                        SetObjectsVisible(!mUseViewCells); 
     576                } 
     577 
    575578                return true; 
    576579        } 
     
    10111014                OgreMeshInstance *omi = static_cast<OgreMeshInstance *>(*it); 
    10121015                Entity *ent = omi->GetMesh(); 
     1016                LogManager::getSingleton().logMessage("here999"); 
    10131017                ent->setVisible(visible); 
    10141018        } 
    10151019} 
    10161020//----------------------------------------------------------------------- 
    1017 void OcclusionCullingSceneManager::LoadViewCells(string filename) 
    1018 { 
    1019         // the objects are set to invisible a prioriy 
     1021bool OcclusionCullingSceneManager::LoadViewCells(const String &filename) 
     1022{ 
     1023        // objects are set to invisible initially 
    10201024        SetObjectsVisible(false); 
    1021  
     1025         
    10221026        const string bboxesFilename = mVisibilityManager->GetVisibilityEnvironment()->getViewCellsFileName(); 
    10231027 
     1028        // converter between view cell ids and Ogre entites  
    10241029        GtpVisibilityPreprocessor::IndexedBoundingBoxContainer iboxes; 
    10251030        OgreBoundingBoxConverter bconverter(this); 
    10261031 
     1032         
     1033        GtpVisibilityPreprocessor::Environment *env =  
     1034                mVisibilityManager->GetVisibilityEnvironment()->GetPreprocessorEnvironment(); 
     1035 
    10271036        // load the view cells assigning the found objects to the pvss 
    10281037        mViewCellsManager =  
    1029                 GtpVisibilityPreprocessor::ViewCellsManager::LoadViewCells(filename, &mObjects, &bconverter); 
    1030  
    1031         std::stringstream d; 
    1032         d << "view cells loaded" << endl; 
    1033         Ogre::LogManager::getSingleton().logMessage(d.str()); 
     1038                GtpVisibilityPreprocessor::ViewCellsManager::LoadViewCells(filename, &mObjects, env, &bconverter); 
     1039 
     1040        if (!mViewCellsManager) 
     1041        { 
     1042                std::stringstream d; 
     1043                d << "error loading view cells" << endl; 
     1044                LogManager::getSingleton().logMessage(d.str()); 
     1045        } 
     1046 
     1047        return (mViewCellsManager != NULL); 
    10341048} 
    10351049//------------------------------------------------------------------------- 
     
    10411055                // set everything visible for savety 
    10421056                SetObjectsVisible(true); 
    1043  
     1057LogManager::getSingleton().logMessage("here7"); 
    10441058                return; 
    10451059        } 
    1046                    
     1060                  LogManager::getSingleton().logMessage("here8"); 
    10471061        GtpVisibilityPreprocessor::ObjectPvsMap::const_iterator oit, 
    10481062                        oit_end = vc->GetPvs().mEntries.end(); 
     
    10551069                OgreMeshInstance *omi = dynamic_cast<OgreMeshInstance*>((*oit).first); 
    10561070                omi->GetMesh()->setVisible(load); 
    1057                 //GtpVisibilityPreprocessor::Debug << "here45 " << omi->GetId() << endl; 
     1071                GtpVisibilityPreprocessor::Debug << "here45 " << omi->GetId() << endl; 
    10581072        } 
    10591073} 
     
    10611075void OcclusionCullingSceneManager::updatePvs(Camera *cam) 
    10621076{ 
    1063         if (mViewCellsLoaded && mUseViewCells) 
    1064         { 
    1065                 const GtpVisibilityPreprocessor::Vector3 viewPoint =  
    1066                         OgreTypeConverter::ConvertFromOgre(cam->getDerivedPosition()); 
    1067  
    1068                 GtpVisibilityPreprocessor::ViewCell *newElementary =  
    1069                         mViewCellsManager->GetViewCell(viewPoint); 
    1070  
    1071                 // elementary view cell did not change => apply same pvs 
    1072                 if (mElementaryViewCell == newElementary) 
    1073                         return; 
    1074  
    1075                 mElementaryViewCell = newElementary; 
    1076  
    1077                 //-- unload old pvs 
    1078                 applyViewCellPvs(mCurrentViewCell, false); 
    1079  
    1080  
    1081                 //-- the new view cell 
     1077        if (!(mViewCellsLoaded && mUseViewCells)) 
     1078                return; 
     1079 
     1080        const GtpVisibilityPreprocessor::Vector3 viewPoint =  
     1081                OgreTypeConverter::ConvertFromOgre(cam->getDerivedPosition()); 
     1082 
     1083        GtpVisibilityPreprocessor::ViewCell *newElementary =  
     1084                mViewCellsManager->GetViewCell(viewPoint); 
     1085 
     1086        // elementary view cell did not change => apply same pvs 
     1087        if (mElementaryViewCell == newElementary) 
     1088                return; 
     1089 
     1090        mElementaryViewCell = newElementary; 
     1091        LogManager::getSingleton().logMessage("unloading"); 
     1092        //-- unload old pvs 
     1093        applyViewCellPvs(mCurrentViewCell, false); 
     1094 
     1095 
     1096        //-- the new view cell 
    10821097                 
    1083                 GtpVisibilityPreprocessor::ViewCell *viewCell; 
     1098        GtpVisibilityPreprocessor::ViewCell *viewCell; 
    10841099 
    10851100                 
    1086                 if (mUseVisibilityFilter) 
    1087                 { 
    1088                         //-- compute new filtered cell 
    1089                         GtpVisibilityPreprocessor::PrVs prvs; 
    1090                         mViewCellsManager->GetPrVS(viewPoint, prvs, 5); 
    1091                         viewCell = prvs.mViewCell; 
    1092                 } 
    1093                 else 
    1094                 { 
    1095                         viewCell = newElementary; 
    1096                 } 
    1097                          
    1098                 //-- load new pvs 
    1099                 applyViewCellPvs(viewCell, true); 
    1100  
    1101                 // store pvs 
    1102                 mCurrentViewCell->SetPvs(viewCell->GetPvs()); 
    1103  
    1104                 // delete merge tree of filtered view cell 
    1105                 if (mUseVisibilityFilter) 
    1106                         mViewCellsManager->DeleteLocalMergeTree(viewCell); 
    1107         } 
     1101        if (mUseVisibilityFilter) 
     1102        { 
     1103                //-- compute new filtered cell 
     1104                GtpVisibilityPreprocessor::PrVs prvs; 
     1105                mViewCellsManager->GetPrVS(viewPoint, prvs, 5); 
     1106                viewCell = prvs.mViewCell; 
     1107        } 
     1108        else 
     1109        { 
     1110                viewCell = newElementary; 
     1111        } 
     1112        LogManager::getSingleton().logMessage("loading"); 
     1113        //-- load new pvs 
     1114        if (0)applyViewCellPvs(viewCell, true); 
     1115 
     1116        // store pvs 
     1117        mCurrentViewCell->SetPvs(viewCell->GetPvs()); 
     1118 
     1119        // delete merge tree of filtered view cell 
     1120        if (mUseVisibilityFilter) 
     1121                mViewCellsManager->DeleteLocalMergeTree(viewCell); 
    11081122} 
    11091123 
  • GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreOctreeHierarchyInterface.cpp

    r925 r938  
    112112                octant->setLastRendered(mFrameId); 
    113113                OctreeSceneManager *ocm =  
    114                         //dynamic_cast<OctreeSceneManager *>(mSceneManager); 
    115114                        dynamic_cast<OctreeSceneManager *>(mSceneManager); 
     115 
    116116                ocm->_renderOctant(mCamera, octant, mOnlyShadowCasters, mLeavePassesInQueue); 
    117117 
     
    144144        // reuse box if node is the same 
    145145        // only create renderable bounding box for new node 
    146         if (1 || (node != mSavedNode)) 
     146        if (node != mSavedNode) 
    147147        { 
    148148                mSavedNode = node; 
  • GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgrePlatformHierarchyInterface.cpp

    r925 r938  
    8181void PlatformHierarchyInterface::ResetQueries() 
    8282{ 
    83         for (int i = 0; i < (int)mOcclusionQueries.size(); ++ i) OGRE_DELETE(mOcclusionQueries[i]); 
     83        OcclusionQueryContainer::iterator it, it_end = mOcclusionQueries.end(); 
     84        for (it = mOcclusionQueries.begin(); it != it_end; ++ it) 
     85        { 
     86                PlatformOcclusionQuery *query = *it; 
     87                OGRE_DELETE(query); 
     88        } 
    8489 
    8590        mCurrentTestIdx = 0; 
     
    121126{ 
    122127        // create new query if there is no query left 
    123         if (mCurrentTestIdx >= (int)mOcclusionQueries.size()) 
    124         { 
    125                 mCurrentTestIdx = (int)mOcclusionQueries.size(); 
     128        if (mCurrentTestIdx == mOcclusionQueries.size()) 
     129        { 
    126130                mOcclusionQueries.push_back(new PlatformOcclusionQuery(mRenderSystem)); 
    127131        } 
  • GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgrePlatformOcclusionQuery.cpp

    r925 r938  
    3535        { 
    3636                isAvailable = !mHardwareOcclusionQuery->isStillOutstanding(); 
    37                 //std::stringstream d; d << "available: " << isAvailable; 
    38                 //Ogre::LogManager::getSingleton().logMessage(d.str()); 
    3937        } 
     38 
     39//std::stringstream d; d << mHardwareOcclusionQuery << ", available: " << isAvailable << ", waitforresult: " << waitForResult; 
     40//              Ogre::LogManager::getSingleton().logMessage(d.str()); 
    4041 
    4142        if (isAvailable) 
  • GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreVisibilitySceneManagerDll.cpp

    r925 r938  
    4747extern "C" void __declspec(dllexport) dllStartPlugin(void) 
    4848{ 
     49        // load visibility environment 
    4950        visEnv = new GtpVisibility::VisibilityEnvironment(); 
    50         visEnv->LoadEnvironment("simple.env"); 
     51        //visEnv->LoadEnvironment("simple.env"); 
    5152        visManager = new GtpVisibility::VisibilityManager(visEnv); 
    5253 
  • GTP/trunk/Lib/Vis/OnlineCullingCHC/include/VisibilityEnvironment.h

    r925 r938  
    33 
    44#include <string> 
     5 
     6 
     7namespace GtpVisibilityPreprocessor { 
     8class Environment; 
     9} 
    510 
    611namespace GtpVisibility { 
     
    2025                                                         NUM_CULLING_MANAGERS}; 
    2126 
     27         
    2228        /** Loads an environment from disk. 
    2329        */ 
    24         void LoadEnvironment(std::string filename); 
     30        bool LoadEnvironment(std::string filename); 
    2531        /** Returns filename of scene. 
    2632        */ 
     
    2935        */ 
    3036        std::string getViewCellsFileName(); 
     37 
     38        GtpVisibilityPreprocessor::Environment *GetPreprocessorEnvironment(); 
     39 
     40 
     41protected: 
     42        GtpVisibilityPreprocessor::Environment *mEnvironment; 
    3143}; 
    3244} // namespace GtpVisibility 
  • GTP/trunk/Lib/Vis/OnlineCullingCHC/scripts/GtpVisibility.vcproj

    r897 r938  
    139139                                RelativePath="..\src\VisibilityManager.cpp"> 
    140140                        </File> 
    141                         <Filter 
    142                                 Name="Header Files" 
    143                                 Filter="h;hpp;hxx;hm;inl;inc;xsd" 
    144                                 UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"> 
    145                                 <File 
    146                                         RelativePath="..\include\BatchedQueriesCullingManager.h"> 
    147                                 </File> 
    148                                 <File 
    149                                         RelativePath="..\include\CoherentHierarchicalCullingManager.h"> 
    150                                 </File> 
    151                                 <File 
    152                                         RelativePath="..\include\CullingManager.h"> 
    153                                 </File> 
    154                                 <File 
    155                                         RelativePath="..\include\DistanceQueue.h"> 
    156                                 </File> 
    157                                 <File 
    158                                         RelativePath="..\include\DummyPreprocessingManager.h"> 
    159                                 </File> 
    160                                 <File 
    161                                         RelativePath="..\include\DummyQueryManager.h"> 
    162                                 </File> 
    163                                 <File 
    164                                         RelativePath="..\include\FrustumCullingManager.h"> 
    165                                 </File> 
    166                                 <File 
    167                                         RelativePath="..\include\HierarchyInterface.h"> 
    168                                 </File> 
    169                                 <File 
    170                                         RelativePath="..\include\OcclusionQuery.h"> 
    171                                 </File> 
    172                                 <File 
    173                                         RelativePath="..\include\PreprocessingManager.h"> 
    174                                 </File> 
    175                                 <File 
    176                                         RelativePath="..\include\StopAndWaitCullingManager.h"> 
    177                                 </File> 
    178                                 <File 
    179                                         RelativePath="..\include\VisibilityEnvironment.h"> 
    180                                 </File> 
    181                                 <File 
    182                                         RelativePath="..\include\VisibilityInfo.h"> 
    183                                 </File> 
    184                                 <File 
    185                                         RelativePath="..\include\VisibilityManager.h"> 
    186                                 </File> 
    187                                 <File 
    188                                         RelativePath="..\include\VisibilityMesh.h"> 
    189                                 </File> 
    190                         </Filter> 
     141                </Filter> 
     142                <Filter 
     143                        Name="Header Files" 
     144                        Filter="h;hpp;hxx;hm;inl;inc;xsd" 
     145                        UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"> 
     146                        <File 
     147                                RelativePath="..\include\BatchedQueriesCullingManager.h"> 
     148                        </File> 
     149                        <File 
     150                                RelativePath="..\include\CoherentHierarchicalCullingManager.h"> 
     151                        </File> 
     152                        <File 
     153                                RelativePath="..\include\CullingManager.h"> 
     154                        </File> 
     155                        <File 
     156                                RelativePath="..\include\DistanceQueue.h"> 
     157                        </File> 
     158                        <File 
     159                                RelativePath="..\include\DummyPreprocessingManager.h"> 
     160                        </File> 
     161                        <File 
     162                                RelativePath="..\include\DummyQueryManager.h"> 
     163                        </File> 
     164                        <File 
     165                                RelativePath="..\include\FrustumCullingManager.h"> 
     166                        </File> 
     167                        <File 
     168                                RelativePath="..\include\HierarchyInterface.h"> 
     169                        </File> 
     170                        <File 
     171                                RelativePath="..\include\OcclusionQuery.h"> 
     172                        </File> 
     173                        <File 
     174                                RelativePath="..\include\PreprocessingManager.h"> 
     175                        </File> 
     176                        <File 
     177                                RelativePath="..\include\StopAndWaitCullingManager.h"> 
     178                        </File> 
     179                        <File 
     180                                RelativePath="..\include\VisibilityEnvironment.h"> 
     181                        </File> 
     182                        <File 
     183                                RelativePath="..\include\VisibilityInfo.h"> 
     184                        </File> 
     185                        <File 
     186                                RelativePath="..\include\VisibilityManager.h"> 
     187                        </File> 
     188                        <File 
     189                                RelativePath="..\include\VisibilityMesh.h"> 
     190                        </File> 
    191191                </Filter> 
    192192                <File 
  • GTP/trunk/Lib/Vis/OnlineCullingCHC/src/BatchedQueriesCullingManager.cpp

    r726 r938  
    2121        QueryQueue queryQueue; 
    2222        unsigned int visiblePixels = 0; 
    23         bool isAvailable = false; 
    2423 
    2524        //Ogre::LogManager::getSingleton().logMessage("Batched Culling"); 
     
    131130                        } 
    132131                } 
    133                 // add rest of queries 
     132 
     133                // issue rest of queries 
    134134                IssueMultipleQueries(pendingQueue, queryQueue); 
    135135        } 
  • GTP/trunk/Lib/Vis/OnlineCullingCHC/src/CoherentHierarchicalCullingManager.cpp

    r925 r938  
    2424        QueryQueue queryQueue; 
    2525        unsigned int visiblePixels = 0; 
    26         bool isAvailable = false; 
    2726         
    28  
     27        //Ogre::LogManager::getSingleton().logMessage("chc"); 
    2928        //-- PART 1: process finished occlusion queries 
    3029        while (!mHierarchyInterface->GetQueue()->empty() || !queryQueue.empty()) 
    3130        { 
    32                 // only wait for result if queue is empty 
     31                //if (mHierarchyInterface->GetQueue()->empty()) 
     32                //      Ogre::LogManager::getSingleton().logMessage("distance queue empty!!"); 
     33 
     34                // only wait for result if there are no nodes to process 
    3335                while (!queryQueue.empty() &&  
    3436                           queryQueue.front().second->GetQueryResult(visiblePixels,  
     
    6567                if (!mHierarchyInterface->GetQueue()->empty()) 
    6668                { 
     69                        //Ogre::LogManager::getSingleton().logMessage("traversal"); 
    6770                        HierarchyNode *node = mHierarchyInterface->GetQueue()->top(); 
    6871                        mHierarchyInterface->GetQueue()->pop(); 
     
    141144        if (mAssumedVisibility > 0) 
    142145        { 
    143                 mThreshold =  RAND_MAX - RAND_MAX / mAssumedVisibility; 
     146                mThreshold = RAND_MAX - RAND_MAX / mAssumedVisibility; 
     147                if (mAssumedVisibility > 100) // fix visibility 
     148                        mThreshold = RAND_MAX; 
    144149        } 
    145150        //std::stringstream d; d << "*** setting assumed vis: " << mAssumedVisibility; Ogre::LogManager::getSingleton().logMessage(d.str()); 
  • GTP/trunk/Lib/Vis/OnlineCullingCHC/src/HierarchyInterface.cpp

    r925 r938  
    2929void HierarchyInterface::InitTraversal() 
    3030{ 
    31         // initialise for front-to-back rendering 
     31        //-- initialise for front-to-back rendering 
    3232 
    3333        ++ mFrameId; 
  • GTP/trunk/Lib/Vis/OnlineCullingCHC/src/VisibilityEnvironment.cpp

    r925 r938  
    1111        // load debug stream 
    1212        GtpVisibilityPreprocessor::Debug.open("debug.log"); 
    13           
     13 
     14        // load environment 
     15        mEnvironment = new GtpVisibilityPreprocessor::Environment();      
    1416} 
     17//----------------------------------------------------------------------- 
    1518VisibilityEnvironment::~VisibilityEnvironment() 
    1619{ 
    17         // load debug stream 
    18         DEL_PTR(GtpVisibilityPreprocessor::environment); 
    19           
     20        DEL_PTR(mEnvironment);    
    2021} 
    2122//----------------------------------------------------------------------- 
    22 void VisibilityEnvironment::LoadEnvironment(string filename) 
    23 { 
    24         // todo matt: 
    25         GtpVisibilityPreprocessor::environment = new GtpVisibilityPreprocessor::Environment; 
    26          
    27         char argc = 2; 
     23bool VisibilityEnvironment::LoadEnvironment(string filename) 
     24{        
     25        //-- parse filename into c-style argument list 
     26        /*char argc = 2; 
    2827        char *argv[2]; 
    2928        argv[0] = ""; 
     
    3332        argv[1] = fname; 
    3433 
    35         GtpVisibilityPreprocessor::Debug << "filename: " << argv[1] << endl; 
    36  
    37         GtpVisibilityPreprocessor::environment->Parse(argc, argv, false); 
    38         //MeshKdTree::ParseEnvironment(); 
     34        GtpVisibilityPreprocessor::Debug << "here4 loading environment from: " << argv[1] << endl; 
     35*/ 
     36                //-- parse environment 
     37        return mEnvironment->ReadEnvFile(filename.c_str()); 
     38        //return GtpVisibilityPreprocessor::environment->Parse(argc, argv, false); 
    3939} 
    4040//----------------------------------------------------------------------- 
     
    4242{ 
    4343        char str[200]; 
    44         GtpVisibilityPreprocessor::environment->GetStringValue("Scene.filename", str); 
     44        mEnvironment->GetStringValue("Scene.filename", str); 
    4545        return str; 
    4646} 
     
    4949{ 
    5050        char str[200]; 
    51         GtpVisibilityPreprocessor::environment->GetStringValue("ViewCells.filename", str); 
     51        mEnvironment->GetStringValue("ViewCells.filename", str); 
    5252        return str; 
    5353} 
    54  
     54//----------------------------------------------------------------------- 
     55GtpVisibilityPreprocessor::Environment *VisibilityEnvironment::GetPreprocessorEnvironment() 
     56{ 
     57        return mEnvironment; 
     58} 
    5559} // namespace GtpVisibility 
  • GTP/trunk/Lib/Vis/Preprocessing/scripts/TestPreprocessor.vcproj

    r833 r938  
    8080                        <Tool 
    8181                                Name="VCLinkerTool" 
    82                                 AdditionalDependencies="xerces-c_2.lib zdll.lib zziplibd.lib devil.lib qtmain.lib QtOpenGL4.lib QtCored4.lib QtGuid4.lib Qt3Support4.lib QAxContainer.lib glut32.lib OpenGL32.Lib glu32.lib cg.lib cgGL.lib Preprocessor.lib" 
     82                                AdditionalDependencies="xerces-c_2.lib zdll.lib zziplib.lib devil.lib qtmain.lib QtOpenGL4.lib QtCored4.lib QtGuid4.lib Qt3Support4.lib QAxContainer.lib glut32.lib OpenGL32.Lib glu32.lib cg.lib cgGL.lib Preprocessor.lib" 
    8383                                OutputFile="$(OutDir)/Preprocessor.exe" 
    8484                                LinkIncremental="1" 
  • GTP/trunk/Lib/Vis/Preprocessing/src/Environment.cpp

    r904 r938  
    4949   
    5050  if (optionalParams != NULL) 
    51     delete optionalParams; 
     51    DEL_PTR(optionalParams); 
    5252} 
    5353 
     
    312312 
    313313int 
    314 Environment::FindOption(const char *name, 
    315                         const bool isFatal) const 
     314Environment::FindOption(const char *name, const bool isFatal) const 
    316315{ 
    317316  int i; 
     
    21832182} 
    21842183 
    2185 void 
     2184bool 
    21862185Environment::Parse(const int argc, char **argv, bool useExePath) 
    21872186{ 
    2188    
     2187  bool result = true; 
    21892188  // Read the names of the scene, environment and output files 
    21902189  ReadCmdlineParams(argc, argv, ""); 
     
    22172216    // error - bad input file name specified ? 
    22182217    cerr<<"Error parsing environment file "<<envFilename<<endl; 
     2218        result = false; 
    22192219  } 
    22202220  delete envFilename; 
     
    22312231    exit(0); 
    22322232  } 
    2233  
    2234 } 
    2235  
    2236 } 
     2233   
     2234  return true; 
     2235} 
     2236 
     2237} 
  • GTP/trunk/Lib/Vis/Preprocessing/src/Environment.h

    r860 r938  
    336336  //@} 
    337337 
    338   void Parse(const int argc, char **argv, bool useExePath); 
     338  bool Parse(const int argc, char **argv, bool useExePath); 
    339339 
    340340  void 
  • GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.cpp

    r931 r938  
    356356        { 
    357357                environment->GetStringValue("ViewCells.filename", buf); 
    358                 mViewCellsManager = ViewCellsManager::LoadViewCells(buf, &mObjects); 
     358                mViewCellsManager = ViewCellsManager::LoadViewCells(buf, &mObjects, environment); 
    359359        } 
    360360        else 
     
    395395        if (strcmp(name, "kdTree") == 0) 
    396396        { 
    397                 mViewCellsManager = new KdViewCellsManager(mKdTree); 
     397                mViewCellsManager = new KdViewCellsManager(mKdTree, environment); 
    398398        } 
    399399        else if (strcmp(name, "bspTree") == 0) 
     
    402402 
    403403                mBspTree = new BspTree(); 
    404                 mViewCellsManager = new BspViewCellsManager(mBspTree); 
     404                mViewCellsManager = new BspViewCellsManager(mBspTree, environment); 
    405405        } 
    406406        else if (strcmp(name, "vspBspTree") == 0) 
     
    409409 
    410410                mVspBspTree = new VspBspTree(environment); 
    411                 mViewCellsManager = new VspBspViewCellsManager(mVspBspTree); 
     411                mViewCellsManager = new VspBspViewCellsManager(mVspBspTree, environment); 
    412412        } 
    413413        else if (strcmp(name, "vspKdTree") == 0) 
     
    415415                mVspKdTree = new VspKdTree();            
    416416         
    417                 mViewCellsManager = new VspKdViewCellsManager(mVspKdTree); 
     417                mViewCellsManager = new VspKdViewCellsManager(mVspKdTree, environment); 
    418418        } 
    419419        else if (strcmp(name, "sceneDependent") == 0) 
     
    424424                Debug << "view cell type: Bsp" << endl; 
    425425                 
    426                 mViewCellsManager = new BspViewCellsManager(mBspTree); 
     426                mViewCellsManager = new BspViewCellsManager(mBspTree, environment); 
    427427        } 
    428428        else 
  • GTP/trunk/Lib/Vis/Preprocessing/src/ViewCell.cpp

    r883 r938  
    371371 
    372372 
    373 ViewCellsTree::ViewCellsTree(ViewCellsManager *vcm): 
     373ViewCellsTree::ViewCellsTree(ViewCellsManager *vcm, Environment *env): 
    374374mRoot(NULL), 
    375375mUseAreaForPvs(false), 
     
    381381#endif 
    382382{ 
    383         environment->GetBoolValue("ViewCells.Visualization.exportMergedViewCells", mExportMergedViewCells); 
    384         environment->GetFloatValue("ViewCells.maxStaticMemory", mMaxMemory); 
     383        env->GetBoolValue("ViewCells.Visualization.exportMergedViewCells", mExportMergedViewCells); 
     384        env->GetFloatValue("ViewCells.maxStaticMemory", mMaxMemory); 
    385385 
    386386        //-- merge options 
    387         environment->GetFloatValue("ViewCells.PostProcess.renderCostWeight", mRenderCostWeight); 
    388         environment->GetIntValue("ViewCells.PostProcess.minViewCells", mMergeMinViewCells); 
    389         environment->GetFloatValue("ViewCells.PostProcess.maxCostRatio", mMergeMaxCostRatio); 
    390         environment->GetBoolValue("ViewCells.PostProcess.refine", mRefineViewCells);     
    391  
    392  
    393         Debug << "========= view cell tree options ================\n"; 
     387        env->GetFloatValue("ViewCells.PostProcess.renderCostWeight", mRenderCostWeight); 
     388        env->GetIntValue("ViewCells.PostProcess.minViewCells", mMergeMinViewCells); 
     389        env->GetFloatValue("ViewCells.PostProcess.maxCostRatio", mMergeMaxCostRatio); 
     390        env->GetBoolValue("ViewCells.PostProcess.refine", mRefineViewCells);     
     391 
     392        env->GetIntValue("ViewCells.PostProcess.maxMergesPerPass", mMaxMergesPerPass); 
     393        env->GetFloatValue("ViewCells.PostProcess.avgCostMaxDeviation", mAvgCostMaxDeviation); 
     394 
     395        Debug << "============= view cell tree options ================\n"; 
    394396        Debug << "minimum view cells: " << mMergeMinViewCells << endl; 
    395397        Debug << "max cost ratio: " << mMergeMaxCostRatio << endl; 
    396398        Debug << "max memory: " << mMaxMemory << endl; 
    397399        Debug << "refining view cells: " << mRefineViewCells << endl; 
    398         Debug << "********* view cell tree options ***************\n"; 
     400        Debug << "============= view cell tree options ================\n"; 
    399401 
    400402        MergeCandidate::sRenderCostWeight = mRenderCostWeight; 
     
    555557        // maximal ratio of old expected render cost to expected render 
    556558        // when the the render queue has to be reset. 
    557         float avgCostMaxDeviation; 
    558         int maxMergesPerPass; 
    559559        int numMergedViewCells = 0; 
    560          
    561         environment->GetIntValue("ViewCells.PostProcess.maxMergesPerPass", maxMergesPerPass); 
    562         environment->GetFloatValue("ViewCells.PostProcess.avgCostMaxDeviation", avgCostMaxDeviation); 
     560                 
    563561 
    564562        cout << "actual merge starts now ... " << endl; 
     
    570568                //-- reset merge queue if the ratio of current expected cost / real expected cost 
    571569                //   too small or after a given number of merges 
    572                 if ((mergedPerPass > maxMergesPerPass) || 
    573                         (avgCostMaxDeviation > mAvgRenderCost / realAvgRenderCost)) 
     570                if ((mergedPerPass > mMaxMergesPerPass) || 
     571                        (mAvgCostMaxDeviation > mAvgRenderCost / realAvgRenderCost)) 
    574572                { 
    575573                        Debug << "************ reset queue *****************\n" 
    576                                   << "ratios: " << avgCostMaxDeviation  
     574                                  << "ratios: " << mAvgCostMaxDeviation  
    577575                                  << " real avg render cost " << realAvgRenderCost << " average render cost " << mAvgRenderCost 
    578                                   << " merged per pass : " << mergedPerPass << " of maximal " << maxMergesPerPass << endl; 
     576                                  << " merged per pass : " << mergedPerPass << " of maximal " << mMaxMergesPerPass << endl; 
    579577 
    580578                        Debug << "Values before reset: "   
  • GTP/trunk/Lib/Vis/Preprocessing/src/ViewCell.h

    r881 r938  
    2323class ViewCellsManager; 
    2424class ViewCellLeaf; 
     25class Environment; 
    2526 
    2627/** Statistics for a view cell partition. 
     
    346347 
    347348public: 
    348         ViewCellsTree(ViewCellsManager *vcm); 
     349        ViewCellsTree(ViewCellsManager *vcm, Environment *env); 
    349350        ~ViewCellsTree(); 
    350351 
     
    588589        float mMaxMemory; 
    589590 
     591        int mMaxMergesPerPass; 
     592        float mAvgCostMaxDeviation; 
    590593}; 
    591594 
  • GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp

    r931 r938  
    4141 
    4242 
    43 ViewCellsManager::ViewCellsManager(): 
     43ViewCellsManager::ViewCellsManager(Environment *env): 
    4444mRenderer(NULL), 
    4545mInitialSamples(0), 
     
    5454mMaxPvsRatio(1.0), 
    5555mViewCellPvsIsUpdated(false) 
     56,mEnvironment(env) 
    5657{ 
    5758        mViewSpaceBox.Initialize(); 
    5859        ParseEnvironment(); 
    5960 
    60         mViewCellsTree = new ViewCellsTree(this); 
     61        mViewCellsTree = new ViewCellsTree(this, env); 
    6162} 
    6263 
     
    6566{ 
    6667        // visualization stuff 
    67         environment->GetBoolValue("ViewCells.Visualization.exportRays", mExportRays); 
    68         environment->GetBoolValue("ViewCells.Visualization.exportGeometry", mExportGeometry); 
    69         environment->GetFloatValue("ViewCells.maxPvsRatio", mMaxPvsRatio); 
    70          
    71         environment->GetBoolValue("ViewCells.pruneEmptyViewCells", mPruneEmptyViewCells); 
     68        mEnvironment->GetBoolValue("ViewCells.Visualization.exportRays", mExportRays); 
     69        mEnvironment->GetBoolValue("ViewCells.Visualization.exportGeometry", mExportGeometry); 
     70        mEnvironment->GetFloatValue("ViewCells.maxPvsRatio", mMaxPvsRatio); 
     71         
     72        mEnvironment->GetBoolValue("ViewCells.pruneEmptyViewCells", mPruneEmptyViewCells); 
    7273 
    7374        // HACK 
     
    7778                mMinPvsSize = 0; 
    7879 
    79         environment->GetBoolValue("ViewCells.processOnlyValidViewCells", mOnlyValidViewCells); 
    80  
    81         environment->GetIntValue("ViewCells.Construction.samples", mConstructionSamples); 
    82         environment->GetIntValue("ViewCells.PostProcess.samples", mPostProcessSamples); 
    83         environment->GetBoolValue("ViewCells.PostProcess.useRaysForMerge", mUseRaysForMerge); 
    84  
    85         environment->GetIntValue("ViewCells.Visualization.samples", mVisualizationSamples); 
    86  
    87         environment->GetIntValue("ViewCells.Construction.samplesPerPass", mSamplesPerPass); 
    88         environment->GetBoolValue("ViewCells.exportToFile", mExportViewCells); 
    89          
    90         environment->GetIntValue("ViewCells.active", mNumActiveViewCells); 
    91         environment->GetBoolValue("ViewCells.PostProcess.compress", mCompressViewCells); 
    92         environment->GetBoolValue("ViewCells.Visualization.useClipPlane", mUseClipPlaneForViz); 
    93         environment->GetBoolValue("ViewCells.PostProcess.merge", mMergeViewCells); 
    94         environment->GetBoolValue("ViewCells.evaluateViewCells", mEvaluateViewCells); 
    95         environment->GetBoolValue("ViewCells.showVisualization", mShowVisualization); 
    96         environment->GetIntValue("ViewCells.Filter.maxSize", mMaxFilterSize); 
    97         environment->GetFloatValue("ViewCells.Filter.width", mFilterWidth); 
    98         environment->GetIntValue("ViewCells.renderCostEvaluationType", mRenderCostEvaluationType); 
    99  
    100         environment->GetBoolValue("ViewCells.exportBboxesForPvs", mExportBboxesForPvs); 
    101         environment->GetBoolValue("ViewCells.exportPvs", mExportPvs); 
     80        mEnvironment->GetBoolValue("ViewCells.processOnlyValidViewCells", mOnlyValidViewCells); 
     81 
     82        mEnvironment->GetIntValue("ViewCells.Construction.samples", mConstructionSamples); 
     83        mEnvironment->GetIntValue("ViewCells.PostProcess.samples", mPostProcessSamples); 
     84        mEnvironment->GetBoolValue("ViewCells.PostProcess.useRaysForMerge", mUseRaysForMerge); 
     85 
     86        mEnvironment->GetIntValue("ViewCells.Visualization.samples", mVisualizationSamples); 
     87 
     88        mEnvironment->GetIntValue("ViewCells.Construction.samplesPerPass", mSamplesPerPass); 
     89        mEnvironment->GetBoolValue("ViewCells.exportToFile", mExportViewCells); 
     90         
     91        mEnvironment->GetIntValue("ViewCells.active", mNumActiveViewCells); 
     92        mEnvironment->GetBoolValue("ViewCells.PostProcess.compress", mCompressViewCells); 
     93        mEnvironment->GetBoolValue("ViewCells.Visualization.useClipPlane", mUseClipPlaneForViz); 
     94        mEnvironment->GetBoolValue("ViewCells.PostProcess.merge", mMergeViewCells); 
     95        mEnvironment->GetBoolValue("ViewCells.evaluateViewCells", mEvaluateViewCells); 
     96        mEnvironment->GetBoolValue("ViewCells.showVisualization", mShowVisualization); 
     97        mEnvironment->GetIntValue("ViewCells.Filter.maxSize", mMaxFilterSize); 
     98        mEnvironment->GetFloatValue("ViewCells.Filter.width", mFilterWidth); 
     99        mEnvironment->GetIntValue("ViewCells.renderCostEvaluationType", mRenderCostEvaluationType); 
     100 
     101        mEnvironment->GetBoolValue("ViewCells.exportBboxesForPvs", mExportBboxesForPvs); 
     102        mEnvironment->GetBoolValue("ViewCells.exportPvs", mExportPvs); 
    102103 
    103104        char buf[100]; 
    104         environment->GetStringValue("ViewCells.samplingType", buf); 
     105        mEnvironment->GetStringValue("ViewCells.samplingType", buf); 
    105106 
    106107         
     
    119120        } 
    120121 
    121         environment->GetStringValue("ViewCells.Evaluation.samplingType", buf); 
     122        mEnvironment->GetStringValue("ViewCells.Evaluation.samplingType", buf); 
    122123         
    123124        if (strcmp(buf, "box") == 0) 
     
    135136        } 
    136137 
    137         environment->GetStringValue("ViewCells.renderCostEvaluationType", buf); 
     138        mEnvironment->GetStringValue("ViewCells.renderCostEvaluationType", buf); 
    138139         
    139140        if (strcmp(buf, "perobject") == 0) 
     
    151152        } 
    152153 
    153     environment->GetStringValue("ViewCells.Visualization.colorCode", buf); 
     154    mEnvironment->GetStringValue("ViewCells.Visualization.colorCode", buf); 
    154155 
    155156        if (strcmp(buf, "PVS") == 0) 
     
    719720        char s[64];  
    720721 
    721         environment->GetIntValue("ViewCells.Evaluation.samplesPerPass", samplesPerPass); 
    722         environment->GetIntValue("ViewCells.Evaluation.samples", numSamples); 
     722        mEnvironment->GetIntValue("ViewCells.Evaluation.samplesPerPass", samplesPerPass); 
     723        mEnvironment->GetIntValue("ViewCells.Evaluation.samples", numSamples); 
    723724 
    724725        char statsPrefix[100]; 
    725         environment->GetStringValue("ViewCells.Evaluation.statsPrefix", statsPrefix); 
     726        mEnvironment->GetStringValue("ViewCells.Evaluation.statsPrefix", statsPrefix); 
    726727 
    727728        Debug << "view cell evaluation samples per pass: " << samplesPerPass << endl; 
     
    813814        int histoPasses; 
    814815 
    815         environment->GetBoolValue("ViewCells.Evaluation.histogram", useHisto); 
    816         environment->GetIntValue("ViewCells.Evaluation.histoPasses", histoPasses); 
     816        mEnvironment->GetBoolValue("ViewCells.Evaluation.histogram", useHisto); 
     817        mEnvironment->GetIntValue("ViewCells.Evaluation.histoPasses", histoPasses); 
    817818 
    818819        const int numLeaves = mViewCellsTree->GetNumInitialViewCells(mViewCellsTree->GetRoot()); 
     
    11621163        X3dParser parser; 
    11631164 
    1164         environment->GetFloatValue("ViewCells.height", parser.mViewCellHeight); 
     1165        mEnvironment->GetFloatValue("ViewCells.height", parser.mViewCellHeight); 
    11651166 
    11661167        bool success = parser.ParseFile(filename, *this); 
     
    15881589        float pos; 
    15891590 
    1590         environment->GetFloatValue("ViewCells.Visualization.clipPlanePos", pos); 
     1591        mEnvironment->GetFloatValue("ViewCells.Visualization.clipPlanePos", pos); 
    15911592 
    15921593        Vector3 point = mViewSpaceBox.Min() +  mViewSpaceBox.Size() * pos; 
    15931594 
    15941595        if (mUseClipPlaneForViz) 
    1595         environment->GetIntValue("ViewCells.Visualization.clipPlaneAxis", axis); 
     1596        mEnvironment->GetIntValue("ViewCells.Visualization.clipPlaneAxis", axis); 
    15961597 
    15971598        Vector3 normal(0,0,0); 
     
    20632064 
    20642065 
    2065 BspViewCellsManager::BspViewCellsManager(BspTree *bspTree): 
    2066 ViewCellsManager(), mBspTree(bspTree) 
    2067 { 
    2068         environment->GetIntValue("BspTree.Construction.samples", mInitialSamples); 
     2066BspViewCellsManager::BspViewCellsManager(BspTree *bspTree, Environment *env): 
     2067ViewCellsManager(env), mBspTree(bspTree) 
     2068{ 
     2069        mEnvironment->GetIntValue("BspTree.Construction.samples", mInitialSamples); 
    20692070        mBspTree->SetViewCellsManager(this); 
    20702071        mBspTree->mViewCellsTree = mViewCellsTree; 
     
    22342235        { 
    22352236                char mstats[100]; 
    2236                 environment->GetStringValue("ViewCells.mergeStats", mstats); 
     2237                mEnvironment->GetStringValue("ViewCells.mergeStats", mstats); 
    22372238                mViewCellsTree->ExportStats(mstats); 
    22382239        } 
     
    23182319        { 
    23192320                char filename[100]; 
    2320                 environment->GetStringValue("ViewCells.filename", filename); 
     2321                mEnvironment->GetStringValue("ViewCells.filename", filename); 
    23212322                ExportViewCells(filename, mExportPvs, objects); 
    23222323        } 
     
    23262327        { 
    23272328                char filename[100]; 
    2328                 environment->GetStringValue("ViewCells.boxesFilename", filename); 
     2329                mEnvironment->GetStringValue("ViewCells.boxesFilename", filename); 
    23292330                ExportBoundingBoxes(filename, objects); 
    23302331        } 
     
    23862387        //-- visualization of the BSP splits 
    23872388        bool exportSplits = false; 
    2388         environment->GetBoolValue("BspTree.Visualization.exportSplits", exportSplits); 
     2389        mEnvironment->GetBoolValue("BspTree.Visualization.exportSplits", exportSplits); 
    23892390 
    23902391        if (exportSplits) 
     
    29332934 
    29342935 
    2935 KdViewCellsManager::KdViewCellsManager(KdTree *kdTree): 
    2936 ViewCellsManager(), mKdTree(kdTree), mKdPvsDepth(100) 
     2936KdViewCellsManager::KdViewCellsManager(KdTree *kdTree, Environment *env): 
     2937ViewCellsManager(env), mKdTree(kdTree), mKdPvsDepth(100) 
    29372938{ 
    29382939} 
     
    32373238 
    32383239 
    3239 VspKdViewCellsManager::VspKdViewCellsManager(VspKdTree *vspKdTree): 
    3240 ViewCellsManager(), mVspKdTree(vspKdTree) 
    3241 { 
    3242         environment->GetIntValue("VspKdTree.Construction.samples", mInitialSamples); 
     3240VspKdViewCellsManager::VspKdViewCellsManager(VspKdTree *vspKdTree, Environment *env): 
     3241ViewCellsManager(env), mVspKdTree(vspKdTree) 
     3242{ 
     3243        mEnvironment->GetIntValue("VspKdTree.Construction.samples", mInitialSamples); 
    32433244        mVspKdTree->SetViewCellsManager(this); 
    32443245} 
     
    35983599 
    35993600 
    3600 VspBspViewCellsManager::VspBspViewCellsManager(VspBspTree *vspBspTree): 
    3601 ViewCellsManager(), mVspBspTree(vspBspTree) 
    3602 { 
    3603         environment->GetIntValue("VspBspTree.Construction.samples", mInitialSamples); 
     3601VspBspViewCellsManager::VspBspViewCellsManager(VspBspTree *vspBspTree, Environment *env): 
     3602ViewCellsManager(env), mVspBspTree(vspBspTree) 
     3603{ 
     3604        mEnvironment->GetIntValue("VspBspTree.Construction.samples", mInitialSamples); 
    36043605        mVspBspTree->SetViewCellsManager(this); 
    36053606        mVspBspTree->mViewCellsTree = mViewCellsTree; 
     
    37563757                ObjectPvs pvs; 
    37573758 
    3758                 environment->GetStringValue("ViewCells.mergeStats", mstats); 
     3759                mEnvironment->GetStringValue("ViewCells.mergeStats", mstats); 
    37593760                mViewCellsTree->ExportStats(mstats); 
    37603761        } 
     
    40104011        { 
    40114012                char filename[100]; 
    4012                 environment->GetStringValue("ViewCells.filename", filename); 
     4013                mEnvironment->GetStringValue("ViewCells.filename", filename); 
    40134014                ExportViewCells(filename, mExportPvs, objects); 
    40144015        } 
     
    40194020        { 
    40204021                char filename[100]; 
    4021                 environment->GetStringValue("ViewCells.boxesFilename", filename); 
     4022                mEnvironment->GetStringValue("ViewCells.boxesFilename", filename); 
    40224023         
    40234024                ExportBoundingBoxes(filename, objects); 
     
    43204321        //-- visualization of the BSP splits 
    43214322        bool exportSplits = false; 
    4322         environment->GetBoolValue("VspBspTree.Visualization.exportSplits", exportSplits); 
     4323        mEnvironment->GetBoolValue("VspBspTree.Visualization.exportSplits", exportSplits); 
    43234324 
    43244325        if (exportSplits) 
     
    47234724 
    47244725 
    4725 ViewCellsManager *ViewCellsManager::LoadViewCells(const string filename,  
     4726ViewCellsManager *ViewCellsManager::LoadViewCells(const string &filename,  
    47264727                                                                                                  ObjectContainer *objects, 
     4728                                                                                                  Environment *env, 
    47274729                                                                                                  BoundingBoxConverter *bconverter) 
    47284730{ 
     
    47314733        ViewCellsManager *vm = NULL; 
    47324734 
    4733         Debug << "vc filename: " << filename << endl; 
    4734  
     4735        Debug << "here23 filename: " << filename << endl; 
    47354736        //BoundingBoxConverter bconverter; 
    47364737 
    4737         if (parser.ParseFile(filename, &vm, objects, bconverter)) 
    4738         { 
     4738        if (parser.ParseFile(filename, &vm, objects, bconverter, env)) 
     4739        {Debug << "here25 filename: " << filename << endl; 
    47394740                //vm->PrepareLoadedViewCells(); 
    47404741                vm->ResetViewCells(); 
  • GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.h

    r931 r938  
    3333class MergeCandidate; 
    3434class BoundingBoxConverter; 
    35  
     35class Environment; 
    3636 
    3737struct BspRay; 
     
    7272        enum {PER_OBJECT, PER_TRIANGLE}; 
    7373 
    74         /** Constructor taking the initial and construction samples. 
    75                 @param initialSamples the maximal number of samples used for creating the hierarchy 
    76                 of view cells 
    77                 @param constructionSamples the maximal number of samples used for construction 
    78         */ 
    79         ViewCellsManager(const int initialSamples, const int constructionSamples); 
    80  
    81         ViewCellsManager(); 
     74        /** default constructor taking an environment file. 
     75        */ 
     76        ViewCellsManager(Environment *env); 
    8277 
    8378        virtual ~ViewCellsManager(); 
     
    434429                @returns the view cells manager if loading was successful, false otherwise 
    435430        */ 
    436         static ViewCellsManager *LoadViewCells(const string filename,  
     431        static ViewCellsManager *LoadViewCells(const string &filename,  
    437432                                                                                   ObjectContainer *objects,  
     433                                                                                   Environment *env, 
    438434                                                                                   BoundingBoxConverter *bconverter = NULL); 
    439435 
     
    559555        bool mExportBboxesForPvs; 
    560556                 
    561  
     557        Environment *environment; 
    562558        Plane3 mClipPlane; 
    563559 
     
    638634        /// if pvs should be exported with view cells 
    639635        bool mExportPvs; 
     636 
     637        Environment *mEnvironment; 
    640638}; 
    641639 
     
    652650                used to construct the bsp tree. 
    653651        */ 
    654         BspViewCellsManager(BspTree *tree); 
     652        BspViewCellsManager(BspTree *tree, Environment *env); 
    655653 
    656654        ~BspViewCellsManager(); 
     
    739737public: 
    740738 
    741         KdViewCellsManager(KdTree *tree); 
     739        KdViewCellsManager(KdTree *tree, Environment *env); 
    742740 
    743741        int ConstructSubdivision(const ObjectContainer &objects,  
     
    795793        /// depth of the KD tree nodes with represent the view cells 
    796794        int mKdPvsDepth; 
     795 
     796 
    797797}; 
    798798 
     
    806806public: 
    807807 
    808         VspKdViewCellsManager(VspKdTree *vspKdTree); 
     808        VspKdViewCellsManager(VspKdTree *vspKdTree, Environment *env); 
    809809 
    810810        int ConstructSubdivision(const ObjectContainer &objects,  
     
    870870public: 
    871871 
    872         VspBspViewCellsManager(VspBspTree *tree); 
     872        VspBspViewCellsManager(VspBspTree *tree, Environment *env); 
    873873        ~VspBspViewCellsManager(); 
    874874 
  • GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsParser.cpp

    r931 r938  
    6565//  StdInParseHandlers: Constructors and Destructor 
    6666// --------------------------------------------------------------------------- 
    67 ViewCellsParseHandlers::ViewCellsParseHandlers(ObjectContainer *objects, BoundingBoxConverter *bconverter): 
     67ViewCellsParseHandlers::ViewCellsParseHandlers(ObjectContainer *objects,  
     68                                                                                           BoundingBoxConverter *bconverter, 
     69                                                                                           Environment *env): 
    6870  mElementCount(0) 
    6971  , mAttrCount(0) 
     
    7981  , mObjects(objects) 
    8082  , mBoundingBoxConverter(bconverter) 
     83  , mEnvironment(env) 
    8184{ 
    8285        // mObjects = objects; 
     
    102105          EndViewCells(); 
    103106 
     107  if (element == "BoundingBoxes") 
     108          EndBoundingBoxes(); 
     109 
     110  // inside the view cell description 
    104111  if (mParseViewCells) 
    105112  { 
     
    150157void ViewCellsParseHandlers::EndBoundingBoxes() 
    151158{ 
    152         // bounding boxes gathered: associate object ids with bounding boxes 
     159        // all bounding boxes gathered in this step =>  
     160        // associate object ids with bounding boxes 
    153161        if (mBoundingBoxConverter) 
    154162                mBoundingBoxConverter->IdentifyObjects(mIBoundingBoxes, *mObjects); 
     
    605613                //mCurrentBspNode = mBspTree->GetRoot(); 
    606614 
    607                 mViewCellsManager = new BspViewCellsManager(mBspTree); 
     615                mViewCellsManager = new BspViewCellsManager(mBspTree, mEnvironment); 
    608616        } 
    609617        else if (strcmp(name, "vspBspTree") == 0) 
     
    613621                mVspBspTree = new VspBspTree(); 
    614622                //mCurrentBspNode = mVspBspTree->GetRoot(); 
    615                 mViewCellsManager = new VspBspViewCellsManager(mVspBspTree); 
     623                mViewCellsManager = new VspBspViewCellsManager(mVspBspTree, mEnvironment); 
    616624 
    617625                mVspBspTree->mBox = mViewSpaceBox; 
     
    622630                // TODO 
    623631                mVspKdTree = new VspKdTree();    
    624                 mViewCellsManager = new VspKdViewCellsManager(mVspKdTree); 
     632                mViewCellsManager = new VspKdViewCellsManager(mVspKdTree, mEnvironment); 
    625633        } 
    626634        else 
     
    692700                                                                ViewCellsManager **viewCells, 
    693701                                                                ObjectContainer *objects, 
    694                                                                 BoundingBoxConverter *bconverter) 
     702                                                                BoundingBoxConverter *bconverter, 
     703                                                                Environment *env) 
    695704{ 
    696705  // Initialize the XML4C system 
     
    724733  //  to do. 
    725734  // 
    726   ViewCellsParseHandlers handler(objects, bconverter); 
     735  ViewCellsParseHandlers handler(objects, bconverter, env); 
    727736  parser->setDocumentHandler(&handler); 
    728737  parser->setErrorHandler(&handler); 
  • GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsParser.h

    r931 r938  
    1010class VspBspTree; 
    1111class BoundingBoxConverter; 
     12class Environment; 
    1213 
    1314class ViewCellsParser : public Parser 
     
    2021                                 ViewCellsManager **viewCells, 
    2122                                 ObjectContainer *objectsm, 
    22                                  BoundingBoxConverter *bconverter); 
     23                                 BoundingBoxConverter *bconverter, 
     24                                 Environment *env); 
    2325}; 
    2426 
  • GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsParserXerces.h

    r931 r938  
    2828  //  Constructors and Destructor 
    2929  // ----------------------------------------------------------------------- 
    30   ViewCellsParseHandlers(ObjectContainer *objects, BoundingBoxConverter *bconverter); 
     30  ViewCellsParseHandlers(ObjectContainer *objects, BoundingBoxConverter *bconverter, Environment *env); 
    3131  ~ViewCellsParseHandlers(); 
    3232   
     
    8484 
    8585  IndexedBoundingBoxContainer mIBoundingBoxes; 
     86  Environment *mEnvironment; 
    8687 
    8788  bool mParseViewCells; 
Note: See TracChangeset for help on using the changeset viewer.