Changeset 944


Ignore:
Timestamp:
05/10/06 18:33:35 (18 years ago)
Author:
mattausch
Message:
 
Location:
GTP/trunk/Lib/Vis
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreBoundingBoxConverter.cpp

    r938 r944  
    1919        GtpVisibilityPreprocessor::IndexedBoundingBoxContainer:: 
    2020                const_iterator iit, iit_end = iboxes.end(); 
    21 std::stringstream d; d << "here75557\n"; 
    22    LogManager::getSingleton().logMessage(d.str()); 
     21 
     22   
    2323        for (iit = iboxes.begin(); iit != iit_end; ++ iit) 
    2424        { 
    2525                const GtpVisibilityPreprocessor::AxisAlignedBox3 box = (*iit).second; 
    2626                const AxisAlignedBox currentBox = OgreTypeConverter::ConvertToOgre(box); 
    27 std::stringstream d; d << "here77\n"; 
    28    LogManager::getSingleton().logMessage(d.str()); 
     27 
     28    
    2929                Entity *ent = FindCorrespondingObject(currentBox); 
    3030 
     
    5353        AxisAlignedBox mybox = EnlargeBox(box); 
    5454        //AxisAlignedBox dummy(Vector3(-50000, -50000, -50000), Vector3(50000, 50000, 50000)); 
    55         std::stringstream d; d << "here3 idenbtiy 8888\n"; 
    56         LogManager::getSingleton().logMessage(d.str()); 
     55         
    5756        //-- get intersecting scene nodes 
    5857        mSceneMgr->findNodesIn(mybox, sceneNodeList, NULL); 
  • GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreOcclusionCullingSceneManager.cpp

    r938 r944  
    168168    } 
    169169        // add bounding boxes of rendered objects 
    170         if (1) 
     170        if (0) 
    171171        for (BoxList::iterator it = mBoxes.begin(); it != mBoxes.end(); ++it) 
    172172        { 
     
    561561                if (mViewCellsLoaded) 
    562562                { 
    563                         LogManager::getSingleton().logMessage("here3"); 
    564563                        mUseViewCells = *static_cast<const bool *>(val); 
    565564 
     
    10141013                OgreMeshInstance *omi = static_cast<OgreMeshInstance *>(*it); 
    10151014                Entity *ent = omi->GetMesh(); 
    1016                 LogManager::getSingleton().logMessage("here999"); 
     1015                 
    10171016                ent->setVisible(visible); 
    10181017        } 
     
    10361035        // load the view cells assigning the found objects to the pvss 
    10371036        mViewCellsManager =  
    1038                 GtpVisibilityPreprocessor::ViewCellsManager::LoadViewCells(filename, &mObjects, env, &bconverter); 
     1037                GtpVisibilityPreprocessor::ViewCellsManager::LoadViewCells(filename, &mObjects, env, false, &bconverter); 
    10391038 
    10401039        if (!mViewCellsManager) 
     
    10551054                // set everything visible for savety 
    10561055                SetObjectsVisible(true); 
    1057 LogManager::getSingleton().logMessage("here7"); 
     1056 
    10581057                return; 
    10591058        } 
    1060                   LogManager::getSingleton().logMessage("here8"); 
     1059                 
    10611060        GtpVisibilityPreprocessor::ObjectPvsMap::const_iterator oit, 
    10621061                        oit_end = vc->GetPvs().mEntries.end(); 
     
    10691068                OgreMeshInstance *omi = dynamic_cast<OgreMeshInstance*>((*oit).first); 
    10701069                omi->GetMesh()->setVisible(load); 
    1071                 GtpVisibilityPreprocessor::Debug << "here45 " << omi->GetId() << endl; 
     1070                //GtpVisibilityPreprocessor::Debug << "assigned id " << omi->GetId() << endl; 
    10721071        } 
    10731072} 
     
    10891088 
    10901089        mElementaryViewCell = newElementary; 
    1091         LogManager::getSingleton().logMessage("unloading"); 
     1090        //LogManager::getSingleton().logMessage("unloading"); 
    10921091        //-- unload old pvs 
    10931092        applyViewCellPvs(mCurrentViewCell, false); 
     
    11101109                viewCell = newElementary; 
    11111110        } 
    1112         LogManager::getSingleton().logMessage("loading"); 
     1111        //LogManager::getSingleton().logMessage("loading"); 
    11131112        //-- load new pvs 
    1114         if (0)applyViewCellPvs(viewCell, true); 
     1113        applyViewCellPvs(viewCell, true); 
    11151114 
    11161115        // store pvs 
  • GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreOctreeHierarchyInterface.cpp

    r938 r944  
    5454{ 
    5555        Octree *octree = static_cast<Octree *>(node); 
     56 
    5657        // HACK: if there are subtrees, they are empty => we are not interested in them 
    5758        return octree->numNodes() == (int)octree->mNodes.size(); 
     
    7071        const Vector3 pos = (bmax - bmin) * 0.5 + bmin; 
    7172         
     73/*      std::stringstream d;  
     74        d << "a: " << (mCameraPosition - pos).squaredLength()  
     75          << " b: " << (mCullCamera->getDerivedPosition() - pos).squaredLength(); 
     76        LogManager::getSingleton().logMessage(d.str());*/ 
    7277        return (mCameraPosition - pos).squaredLength(); 
    73         //return (mCullCamera->getDerivedPosition() - pos).squaredLength(); 
    7478} 
    7579//----------------------------------------------------------------------- 
  • GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgrePlatformOcclusionQuery.cpp

    r938 r944  
    1212PlatformOcclusionQuery::~PlatformOcclusionQuery() 
    1313{ 
     14        // hardwareocclusion query is deleted by Ogre 
    1415        //delete mHardwareOcclusionQuery; 
    1516} 
  • GTP/trunk/Lib/Vis/OnlineCullingCHC/src/VisibilityEnvironment.cpp

    r938 r944  
    3232        argv[1] = fname; 
    3333 
    34         GtpVisibilityPreprocessor::Debug << "here4 loading environment from: " << argv[1] << endl; 
     34        GtpVisibilityPreprocessor::Debug << "loading environment from: " << argv[1] << endl; 
     35        return GtpVisibilityPreprocessor::environment->Parse(argc, argv, false); 
    3536*/ 
    36                 //-- parse environment 
     37        //-- parse environment 
    3738        return mEnvironment->ReadEnvFile(filename.c_str()); 
    38         //return GtpVisibilityPreprocessor::environment->Parse(argc, argv, false); 
    3939} 
    4040//----------------------------------------------------------------------- 
  • GTP/trunk/Lib/Vis/Preprocessing/scripts/generate_viewcells

    r942 r944  
    4242-view_cells_evaluation_samples_per_pass=1000000 \ 
    4343-vsp_bsp_node_queue_type=2 \ 
    44 -view_cells_filename=$LOG_PREFIX/vienna-visibility.xml 
     44-view_cells_filename=$LOG_PREFIX-visibility.xml 
    4545 
    4646mv debug.log $LOG_PREFIX-$METHOD-debug.log 
  • GTP/trunk/Lib/Vis/Preprocessing/scripts/generate_viewcells.env

    r942 r944  
    259259#       filename ../data/vienna/viewcells-large-sel.x3d 
    260260#       filename ../scripts/viewcells_vienna.xml 
    261         filename D:/svn/gametools/GTP/trunk/Lib/Vis/Preprocessing/scripts/vienna_visibility.xml 
     261        filename D:/svn/gametools/GTP/trunk/Lib/Vis/Preprocessing/scripts/vienna-visibility.xml 
    262262} 
    263263 
  • GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.cpp

    r938 r944  
    356356        { 
    357357                environment->GetStringValue("ViewCells.filename", buf); 
    358                 mViewCellsManager = ViewCellsManager::LoadViewCells(buf, &mObjects, environment); 
     358                mViewCellsManager = ViewCellsManager::LoadViewCells(buf, &mObjects, environment, true); 
    359359        } 
    360360        else 
  • GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp

    r938 r944  
    18611861 
    18621862 
    1863 bool ViewCellsManager::ExportViewCells(const string filename, const bool exportPvs, const ObjectContainer &objects) 
     1863bool ViewCellsManager::ExportViewCells(const string filename,  
     1864                                                                           const bool exportPvs,  
     1865                                                                           const ObjectContainer &objects) 
    18641866{ 
    18651867        return false; 
     
    18801882        // active view cells 
    18811883        ViewCellContainer::const_iterator it, it_end = mViewCells.end(); 
     1884 
    18821885        for (it = mViewCells.begin(); it != it_end; ++ it) 
    18831886        { 
     
    47274730                                                                                                  ObjectContainer *objects, 
    47284731                                                                                                  Environment *env, 
     4732                                                                                                  const bool finalizeViewCells, 
    47294733                                                                                                  BoundingBoxConverter *bconverter) 
     4734                                                                                                  
    47304735{ 
    47314736        ViewCellsParser parser; 
     
    47334738        ViewCellsManager *vm = NULL; 
    47344739 
    4735         Debug << "here23 filename: " << filename << endl; 
    4736         //BoundingBoxConverter bconverter; 
    4737  
    47384740        if (parser.ParseFile(filename, &vm, objects, bconverter, env)) 
    4739         {Debug << "here25 filename: " << filename << endl; 
     4741        { 
     4742                long startTime = GetTime(); 
     4743 
    47404744                //vm->PrepareLoadedViewCells(); 
    47414745                vm->ResetViewCells(); 
     
    47454749 
    47464750                // create the meshes and compute volumes 
    4747                 vm->FinalizeViewCells(true); 
    4748  
    4749                 vm->mViewCellsTree->AssignRandomColors(); 
    4750                 Debug << (int)vm->mViewCells.size() << " view cells loaded" << endl; 
     4751                if (finalizeViewCells) 
     4752                { 
     4753                        vm->FinalizeViewCells(true); 
     4754                        vm->mViewCellsTree->AssignRandomColors(); 
     4755                } 
     4756 
     4757                Debug << (int)vm->mViewCells.size() << " view cells loaded in " 
     4758                          << TimeDiff(startTime, GetTime()) * 1e-3 << " secs" << endl; 
    47514759        } 
    47524760        else 
     
    47854793 
    47864794        //-- export the view cells and the pvs 
    4787         stream << "<ViewCells>" << endl; 
     4795        const int numViewCells = mCurrentViewCellsStats.viewCells; 
     4796 
     4797        stream << "<ViewCells number=\"" << numViewCells << "\" />" << endl; 
    47884798         
    47894799        mViewCellsTree->Export(stream, exportPvs); 
  • GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.h

    r938 r944  
    432432                                                                                   ObjectContainer *objects,  
    433433                                                                                   Environment *env, 
     434                                                                                   const bool finalizeViewCells, 
    434435                                                                                   BoundingBoxConverter *bconverter = NULL); 
    435436 
  • GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsParser.cpp

    r938 r944  
    126126        // go one up in the tree 
    127127        if (mCurrentBspNode->GetParent()) 
    128         {       Debug << "]"; 
     128        {       cout << "]"; 
    129129                mCurrentBspNode = mCurrentBspNode->GetParent(); 
    130130        } 
     
    136136        // go one up in the tree 
    137137        if (mCurrentViewCell->GetParent()) 
    138         {       Debug << "]"; 
     138        {       cout << "]"; 
    139139                mCurrentViewCell = mCurrentViewCell->GetParent(); 
    140140        } 
     
    159159        // all bounding boxes gathered in this step =>  
    160160        // associate object ids with bounding boxes 
     161        long startTime = GetTime(); 
     162         
    161163        if (mBoundingBoxConverter) 
    162164                mBoundingBoxConverter->IdentifyObjects(mIBoundingBoxes, *mObjects); 
     165 
     166        Debug << "\nconverted bounding boxes to objects in" 
     167                  << TimeDiff(startTime, GetTime()) * 1e-3 << " secs" << endl; 
    163168} 
    164169 
     
    190195        if (element == "Interior")  
    191196        { 
    192                 Debug << "["; 
     197                cout << "["; 
    193198                StartBspInterior(attributes); 
    194199        } 
     
    196201        if (element == "Leaf")  
    197202        { 
    198                 Debug << "l"; 
    199                 Debug << "leaf" << endl; 
     203                cout << "l"; 
    200204                StartBspLeaf(attributes); 
    201205        } 
     
    212216        if (element == "ViewCells") 
    213217        { 
    214                 Debug << "parsing view cells" << endl; 
     218                cout << "parsing view cells" << endl; 
    215219                mParseViewCells = true; 
    216220        } 
     
    218222        if (element == "Hierarchy") 
    219223        { 
    220                 Debug << "parsing spatial hierarchy" << endl; 
     224                cout << "parsing spatial hierarchy" << endl; 
    221225                mParseViewCells = false; 
    222226                StartHierarchy(attributes); 
     
    226230        if (element == "ViewSpaceBox") 
    227231        { 
    228                 Debug << "v"; 
     232                cout << "v"; 
    229233                StartViewSpaceBox(attributes); 
    230234        } 
     
    233237        if (element == "BoundingBox") 
    234238        { 
    235                 Debug << "b"; 
     239                cout << "b"; 
    236240                StartBoundingBox(attributes); 
    237241        } 
     
    259263                if (element == "Interior")  
    260264                { 
    261                         Debug << "["; 
     265                        cout << "["; 
    262266                        StartViewCellInterior(attributes); 
    263267                } 
     
    265269                if (element == "Leaf")  
    266270                { 
    267                         Debug << "l"; 
     271                        cout << "l"; 
    268272                        StartViewCellLeaf(attributes); 
    269273                } 
     
    399403        mViewSpaceBox = AxisAlignedBox3(bmin, bmax); 
    400404 
    401         Debug << "view space box: " << mViewSpaceBox << endl; 
     405        Debug << "\nview space box: " << mViewSpaceBox << endl; 
    402406} 
    403407 
     
    437441        mIBoundingBoxes.push_back(IndexedBoundingBox(id, box)); 
    438442 
    439         Debug << "view space box: " << mViewSpaceBox << endl; 
     443        //Debug << "bbox: " << box << endl; 
    440444} 
    441445 
     
    624628 
    625629                mVspBspTree->mBox = mViewSpaceBox; 
    626                 Debug << "creating vsp bsp view cells manager" << endl; 
    627630        } 
    628631        else if (strcmp(name, "vspKdTree") == 0) 
    629632        { 
    630633                // TODO 
     634                Debug << "view cell type: VspKd" << endl; 
    631635                mVspKdTree = new VspKdTree();    
    632636                mViewCellsManager = new VspKdViewCellsManager(mVspKdTree, mEnvironment); 
  • GTP/trunk/Lib/Vis/README_ONLINE_MODULE.txt

    r902 r944  
    44ONLINE VISIBILITY (CHC + VIEW CELLS) 
    55 
    6 1) Requirements:  
    7    WindowsXP 
    8    svn 
     61)  
     7 
     8Requirements:  
     9 
     10WindowsXP 
     11svn 
    912 
    10132) check out gametools repository 
    11    in the following it is assumed that your repository is located in d:\svn\gametools (not required, just replace your path) 
     14    
     15in the following it is assumed that your repository is located in d:\svn\gametools (not required, just replace your path) 
    1216 
    13 3) add following environment variables: 
     173)  
    1418 
    15    OGRE_PATH: points to directory where ogre.sln is located (i.e., the 
     19add following environment variables: 
     20 
     21OGRE_PATH: points to directory where ogre.sln is located (i.e., the 
    1622directory OGRE), e.g. D:\svn\gametools\OGRE\trunk\ogrenew 
    1723 
    18 4) copy the ogre_dependencies and ogre_changes_12 into the ogrenew directory 
     244)  
     25 
     26copy the directories  
     27 
     28D:\svn\gametools\OGRE\trunk\ogre_dependencies  
     29D:\svn\gametools\OGRE\trunk\ogre_changes\Ogre1.2  
     30 
     31into the ogrenew directory.  
     32 
     33Further copy the files 
     34 
     35D:\svn\gametools\OGRE\trunk\resources\terrain.cfg 
     36D:\svn\gametools\OGRE\trunk\resources\terrainCulling.cfg into the  
     37 
     38D:\svn\gametools\OGRE\trunk\ogrenew\Samples\Common\bin\Release 
     39 
     40directory.  
     41 
     42The absolute filenames in terrainCulling.cfg must be 
     43changed accordingly 
     44 
     455) add following directories to  
     46 
     47D:\svn\gametools\OGRE\trunk\ogrenew\Samples\Common\bin\Release\resources.cfg 
     48 
     49FileSystem=d:/svn/gametools/OGRE/trunk/resources/materials/textures 
     50FileSystem=d:/svn/gametools/OGRE/trunk/resources/materials/scripts 
     51FileSystem=d:/svn/gametools/OGRE/trunk/resources/overlays 
     52FileSystem=d:/svn/gametools/OGRE/trunk/resources/models 
     53FileSystem=d:/svn/gametools/OGRE/trunk/resources/models/trees 
     54 
    1955 
    20565) Set preprocessor flag GTP_VISIBILITY_MODIFIED_OGRE to the example projects you want to use 
    2157 
    22 5) open scripts GTP\trunk\Lib\Vis\shared\GtpVisibility.sln and build all 
     586) open scripts GTP\trunk\Lib\Vis\shared\GtpVisibility.sln and build all 
    2359 
    2460 
    25 6) start TerrainExampleApplication for testing 
    26  
    27  
    28  
    29  
    30  
    31  
    32  
    33 //////////////////////////////////////////////////////////////////////////////////////////////////////////////// 
    34  
    35 FOR USING THE PREPROCESSED VIEW CELLS: 
    36  
    37 the same as above, before step 6) change in the code:  
    38  
    39 in  
    40  
    41 D:\svn\gametools\GTP\trunk\App\Demos\Vis\HillyTerrain\OGRE\TestCullingTerrainApplication.cpp 
    42  
    43 replace  
    44  
    45 bool TestCullingTerrainApplication::msShowHillyTerrain = true; 
    46  
    47 with  
    48  
    49 bool TestCullingTerrainApplication::msShowHillyTerrain = false; 
    50  
    51  
    52 Then the vienna model is loaded together with the view cells. The 
    53 usage of the view cells is toggled using key "V". 
     617) start TerrainExampleApplication for testing 
Note: See TracChangeset for help on using the changeset viewer.