Changeset 1745


Ignore:
Timestamp:
11/13/06 23:41:00 (18 years ago)
Author:
mattausch
Message:
 
Location:
GTP/trunk/Lib/Vis/Preprocessing
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • GTP/trunk/Lib/Vis/Preprocessing/scripts/generate_viewcells.env

    r1744 r1745  
    281281                maxLeaves 100000 
    282282                # maximal memory in MB 
    283                 maxMemory 20 
     283                maxMemory 18 
    284284                # minimum ratio of global cost decrease 
    285285                minGlobalCostRatio -1 
  • GTP/trunk/Lib/Vis/Preprocessing/src/HierarchyManager.cpp

    r1744 r1745  
    737737 
    738738        if (sc->IsDirty()) 
    739                 cout << "*******************************error!" << endl; 
     739                cerr << "Error: Should never come here!" << endl; 
    740740 
    741741        if (!success) // split was not taken 
    742742        { 
    743                 cout << "x"; 
    744743                return false; 
    745744        } 
     
    988987                if ((steps >= maxSteps) || ((priority < threshold) && !(steps < minSteps))) 
    989988                { 
    990                         cout << "\n**************** breaking on " << priority  
    991                                  << " smaller than " << threshold << endl; 
     989                        cout << "\nbreaking on " << priority << " smaller than " << threshold << endl; 
    992990                        break; 
    993991                } 
     
    18311829 
    18321830 
     1831void HierarchyManager::ComputePvs(const ObjectPvs &pvs, float &rc, int &pvsEntries) 
     1832{ 
     1833        BvhNode::NewMail(); 
     1834 
     1835        ObjectPvsIterator pit = pvs.GetIterator(); 
     1836 
     1837        while (pit.HasMoreEntries()) 
     1838        { 
     1839                ObjectPvsEntry entry = pit.Next(); 
     1840 
     1841                BvhIntersectable *intersect = dynamic_cast<BvhIntersectable *>(entry.mObject); 
     1842 
     1843                BvhLeaf *leaf = intersect->GetItem(); 
     1844                BvhNode *activeNode = leaf->GetActiveNode(); 
     1845 
     1846                if (!activeNode->Mailed()) 
     1847                { 
     1848                        activeNode->Mail(); 
     1849 
     1850                        ObjectContainer objects; 
     1851                        activeNode->CollectObjects(objects); 
     1852 
     1853                        ++ pvsEntries; 
     1854                        rc += mBvHierarchy->EvalAbsCost(objects); 
     1855                        //cout << " pvs: " << mBvHierarchy->EvalAbsCost(leaf->mObjects); 
     1856                } 
     1857        } 
     1858} 
     1859 
     1860 
    18331861int HierarchyManager::ExtractStatistics(const int maxSplits, 
    18341862                                                                                const float maxMemoryCost, 
     
    18371865                                                                                int &pvsEntries, 
    18381866                                                                                int &viewSpaceSplits, 
    1839                                                                                 int &objectSpaceSplits) 
     1867                                                                                int &objectSpaceSplits, 
     1868                                                                                const bool useFilter) 
    18401869{ 
    18411870        ViewCellContainer viewCells; 
     
    18581887        renderCost = 0.0f; 
    18591888 
    1860         //BvhNode::NewMail(); 
    1861         //int dummy = 0; 
    18621889        for (vit = viewCells.begin(); vit != vit_end; ++ vit) 
    18631890        { 
    18641891                float rc = 0; 
    18651892                ViewCell *vc = *vit; 
     1893 
    18661894                ObjectPvs pvs; 
    18671895                mVspTree->mViewCellsTree->GetPvs(vc, pvs); 
    1868                 //dummy+=pvs.GetSize(); 
    1869                 BvhNode::NewMail(); 
    1870  
    1871                 // hack: should not be done here 
    1872                 ObjectPvsIterator pit = pvs.GetIterator(); 
    1873  
    1874                 while (pit.HasMoreEntries()) 
    1875                 { 
    1876                         ObjectPvsEntry entry = pit.Next(); 
    1877  
    1878                         BvhIntersectable *intersect = dynamic_cast<BvhIntersectable *>(entry.mObject); 
    1879  
    1880                         BvhLeaf *leaf = intersect->GetItem(); 
    1881                         BvhNode *activeNode = leaf->GetActiveNode(); 
    1882  
    1883                         if (!activeNode->Mailed()) 
    1884                         { 
    1885                                 activeNode->Mail(); 
    1886  
    1887                                 ObjectContainer objects; 
    1888                                 activeNode->CollectObjects(objects); 
    1889  
    1890                                 ++ pvsEntries; 
    1891                                 rc += mBvHierarchy->EvalAbsCost(objects); 
    1892                                 //cout << " pvs: " << mBvHierarchy->EvalAbsCost(leaf->mObjects); 
    1893                         } 
    1894                 } 
     1896 
     1897                if (useFilter) 
     1898                { 
     1899                        ObjectPvs filteredPvs; 
     1900                        mVspTree->mViewCellsManager->ApplyFilter2(vc, false, 1.0f, filteredPvs); 
     1901                        ComputePvs(filteredPvs, rc, pvsEntries); 
     1902                } 
     1903                else 
     1904                { 
     1905                        ComputePvs(pvs, rc, pvsEntries); 
     1906                }                
    18951907 
    18961908                rc *= vc->GetVolume(); 
     
    20822094 
    20832095void HierarchyManager::EvaluateSubdivision2(ofstream &splitsStats, 
    2084                                                                                         const int splitsStepSize) 
     2096                                                                                        const int splitsStepSize, 
     2097                                                                                        const bool useFilter) 
    20852098{ 
    20862099        HierarchySubdivisionStats subStats; 
     
    20962109                                                                                                subStats.mEntriesInPvs, 
    20972110                                                                                                subStats.mViewSpaceSplits, 
    2098                                                                                                 subStats.mObjectSpaceSplits); 
     2111                                                                                                subStats.mObjectSpaceSplits, 
     2112                                                                                                useFilter); 
    20992113 
    21002114                 
     
    21232137                cout << subStats.mNumSplits << " "; 
    21242138        } 
     2139 
    21252140        cout << endl; 
    21262141} 
  • GTP/trunk/Lib/Vis/Preprocessing/src/HierarchyManager.h

    r1744 r1745  
    288288 
    289289        inline bool ConsiderMemory() const { return mConsiderMemory; } 
    290         //inline float GetMemoryConst() const { return mMemoryConst; } 
    291290         
    292291        void EvaluateSubdivision(const VssRayContainer &sampleRays,                                                                                       
     
    295294 
    296295        void EvaluateSubdivision2(ofstream &splitsStats, 
    297                                                           const int splitsStepSize); 
     296                                                          const int splitsStepSize, 
     297                                                          const bool useFilter); 
    298298 
    299299 
     
    523523                                                  int &pvsEntries, 
    524524                                                  int &viewSpaceSplits, 
    525                                                   int &objectSpaceSplits); 
    526  
     525                                                  int &objectSpaceSplits, 
     526                                                  const bool useFilter); 
     527 
     528        void ComputePvs(const ObjectPvs &pvs, float &rc, int &pvsEntries); 
    527529 
    528530protected: 
  • GTP/trunk/Lib/Vis/Preprocessing/src/Pvs.h

    r1744 r1745  
    441441 
    442442 
    443 /*template <typename T, typename S> void Pvs<T, S>::QuickMerge(const Pvs<T, S> &a) 
    444 { 
    445         const int samples = mSamples + a.mSamples; 
    446  
    447         std::vector<PvsEntry<T, S>> >::const_iterator it; 
    448  
    449         for (it = mEntries.begin(); it != mEntries.end(); ++ it) 
    450         { 
    451                 it->first->Mail(); 
    452         } 
    453  
    454     for (it = a.mEntries.begin(); it != a.mEntries.end(); ++ it) 
    455         { 
    456                 if (!it->first->Mailed()) 
    457                 { 
    458                         mEntries.push_back(*it); 
    459                 } 
    460         } 
    461  
    462         mSamples = samples; 
    463 }*/ 
    464  
    465  
    466443template <typename T, typename S> void Pvs<T, S>::Clear() 
    467444{ 
  • GTP/trunk/Lib/Vis/Preprocessing/src/TestPreprocessor.vcproj

    r1740 r1745  
    206206                                Name="VCLinkerTool" 
    207207                                AdditionalDependencies="xerces-c_2.lib glew32.lib zdll.lib zziplib.lib devil.lib glut32.lib OpenGL32.Lib glu32.lib Preprocessor.lib RTScene.lib RTWorld.lib QtCore4.lib qtmain.lib QtOpenGL4.lib Qt3Support4.lib QtTest4.lib QtGui4.lib QtGlRenderer.lib" 
    208                                 OutputFile="../bin/release/Preprocessor.exe" 
     208                                OutputFile="../bin/release/Preprocessor2.exe" 
    209209                                LinkIncremental="1" 
    210210                                AdditionalLibraryDirectories="..\src\GL;..\lib\release;..\..\Preprocessing\lib\release;..\..\..\..\..\..\NonGTP\Boost\lib;..\..\..\..\..\..\NonGTP\Xerces\xercesc\lib;..\..\..\..\..\..\NonGTP\Zlib\lib;..\..\..\..\..\..\NonGTP\Devil\lib;..\MultiLevelRayTracing\RTScene\Release;..\MultiLevelRayTracing\RTWorld\Release;&quot;$(QTDIR)\lib&quot;;.\QtGlRenderer\Release" 
  • GTP/trunk/Lib/Vis/Preprocessing/src/ViewCell.cpp

    r1742 r1745  
    17481748         
    17491749                // add newly found pvs to merged pvs 
    1750                 ObjectPvs interPvs; 
     1750                //cout << "samples vc: " << vc->GetPvs().GetSamples() << " samples pvs: " << pvs.GetSamples() << endl; 
    17511751                pvs.MergeInPlace(vc->GetPvs()); 
    1752  
     1752                //cout << "new samples: " << pvs.GetSamples() << endl; 
    17531753                if (!vc->IsLeaf()) // interior cells: go down to leaf level 
    17541754                { 
  • GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp

    r1744 r1745  
    60556055 
    60566056                        ofstream ofstr(filename.c_str()); 
    6057                         mHierarchyManager->EvaluateSubdivision2(ofstr, splitsStepSize); 
     6057                        mHierarchyManager->EvaluateSubdivision2(ofstr, splitsStepSize, false); 
    60586058 
    60596059                        timeDiff = TimeDiff(startTime, GetTime()); 
     
    60626062 
    60636063                        Debug << "statistics computed in " << timeDiff * 1e-3 << " secs" << endl; 
     6064 
     6065#if 0 
     6066                        //////////////////////////// 
     6067                        // filtered stats 
     6068                        sprintf(suffix, "-%09d-eval-filter.log", castSamples); 
     6069                        const string filename2 = string(statsPrefix) + string(suffix); 
     6070 
     6071                        startTime = GetTime(); 
     6072                         
     6073                        cout << "compute new statistics for filtered pvs ... " << endl; 
     6074 
     6075                        ofstream ofstr2(filename2.c_str()); 
     6076                        mHierarchyManager->EvaluateSubdivision2(ofstr2, splitsStepSize, true); 
     6077 
     6078                        timeDiff = TimeDiff(startTime, GetTime()); 
     6079                        cout << "finished in " << timeDiff * 1e-3 << " secs" << endl; 
     6080                        cout << "*************************************" << endl; 
     6081 
     6082                        Debug << "statistics computed in " << timeDiff * 1e-3 << " secs" << endl; 
     6083#endif 
    60646084 
    60656085                        // only for debugging purpose 
Note: See TracChangeset for help on using the changeset viewer.