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

Legend:

Unmodified
Added
Removed
  • 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 
Note: See TracChangeset for help on using the changeset viewer.