Changeset 649


Ignore:
Timestamp:
02/16/06 18:29:36 (18 years ago)
Author:
mattausch
Message:
 
Location:
GTP/trunk/Lib/Vis/Preprocessing
Files:
6 edited

Legend:

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

    r648 r649  
    177177        Construction { 
    178178                samples 0 
    179                 samplesPerPass 500000 
     179                samplesPerPass 50000 
    180180        } 
    181181 
  • GTP/trunk/Lib/Vis/Preprocessing/src/ViewCell.cpp

    r648 r649  
    5050        return (float)pvs; 
    5151} 
    52  
    53  
    5452 
    5553 
     
    14131411 
    14141412 
     1413void ViewCellsTree::ExportStats() 
     1414{ 
     1415 
     1416} 
    14151417 
    14161418void ViewCellsTree::GetPvs(ViewCell *vc, ObjectPvs &pvs) const 
  • GTP/trunk/Lib/Vis/Preprocessing/src/ViewCell.h

    r613 r649  
    108108        int Type() const; 
    109109 
    110   void SetParent(ViewCellInterior *parent); 
     110        void SetParent(ViewCellInterior *parent); 
    111111 
    112112        /** Adds a passing ray to the passing ray container. 
     
    357357        bool Export(ofstream &stream); 
    358358 
     359        /** Export statistics of this view cell tree. 
     360        */ 
     361        void ExportStats(); 
    359362 
    360363protected: 
  • GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellBsp.cpp

    r648 r649  
    11821182        backData.mNode = interior->GetBack(); 
    11831183         
     1184        interior->mTimeStamp = leaf->mTimeStamp; 
    11841185        frontData.mNode->mTimeStamp = mTimeStamp; 
    11851186        backData.mNode->mTimeStamp = mTimeStamp ++; 
    11861187 
     1188        Debug << "time stamp: " << mTimeStamp << endl; 
    11871189        //DEL_PTR(leaf); 
    11881190        return interior; 
  • GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp

    r643 r649  
    10321032 
    10331033        // recast rest of the rays 
    1034         ComputeSampleContributions(savedRays, true, false); 
     1034        if (SAMPLE_AFTER_SUBDIVISION) 
     1035                ComputeSampleContributions(savedRays, true, false); 
    10351036 
    10361037 
     
    11431144        int merged; 
    11441145         
     1146        cout << "starting post processing using " << mPostProcessSamples << " samples ... "; 
     1147        long startTime = GetTime(); 
     1148         
     1149        VssRayContainer postProcessRays; 
     1150        GetRaySets(rays, mPostProcessSamples, postProcessRays); 
     1151 
    11451152        if (mMergeViewCells) 
    11461153        { 
    1147                 cout << "starting post processing using " << mPostProcessSamples << " samples ... "; 
    1148                 long startTime = GetTime(); 
    1149          
    1150                 VssRayContainer postProcessRays; 
    1151                 GetRaySets(rays, mPostProcessSamples, postProcessRays); 
    1152  
     1154                Debug << "constructing visibility based merge tree" << endl; 
    11531155                merged = mViewCellsTree->ConstructMergeTree(rays, objects); 
    1154  
    1155                 //-- stats and visualizations 
    1156                 cout << "finished" << endl; 
    1157                 cout << "merged " << merged << " view cells in " 
    1158                          << TimeDiff(startTime, GetTime()) *1e-3 << " secs" << endl; 
    1159  
    1160                 Debug << "Postprocessing: Merged " << merged << " view cells in " 
    1161                         << TimeDiff(startTime, GetTime()) *1e-3 << " secs" 
    1162                         << "using " << (int)rays.size() << " samples" << endl << endl; 
    1163         } 
     1156        } 
     1157        else 
     1158        { 
     1159                Debug << "constructing spatial merge tree" << endl; 
     1160                // create spatial merge hierarchy 
     1161                merged = ConstructSpatialMergeTree(); 
     1162        } 
     1163 
     1164        //-- stats and visualizations 
     1165        cout << "finished" << endl; 
     1166        cout << "merged " << merged << " view cells in " 
     1167                 << TimeDiff(startTime, GetTime()) *1e-3 << " secs" << endl; 
     1168 
     1169        Debug << "Postprocessing: Merged " << merged << " view cells in " 
     1170                << TimeDiff(startTime, GetTime()) *1e-3 << " secs" << endl << endl; 
     1171         
    11641172 
    11651173    // reset view cells and stats 
     
    16741682 
    16751683 
    1676 void BspViewCellsManager::CreateMergeHierarchy() 
     1684int BspViewCellsManager::ConstructSpatialMergeTree() 
    16771685{ 
    16781686        TraversalQueue tQueue; 
    16791687 
    16801688        tQueue.push(TraversalData(mBspTree->GetRoot(), NULL)); 
     1689 
     1690        int merged = 0; 
     1691 
     1692        int numViewCells = (int)mViewCells.size(); 
     1693 
     1694        float var = 0; 
     1695        float dev = 0; 
     1696        int totalPvs = 0; 
     1697        float totalRenderCost = 0; 
     1698        float avgRenderCost = 0; 
     1699        float expCost = 0; 
     1700 
     1701        //-- compute statistics values of initial view cells 
     1702        EvaluateRenderStatistics(totalRenderCost, 
     1703                                                     expCost, 
     1704                                                         dev, 
     1705                                                         var, 
     1706                                                         totalPvs, 
     1707                                                         avgRenderCost); 
     1708 
     1709        Debug/*mStats*/ << "#Pass\n" << 0 << endl 
     1710                   << "#Merged\n" << merged << endl  
     1711                   << "#ViewCells\n" << numViewCells << endl  
     1712                   << "#RenderCostIncrease\n" << 0 << endl 
     1713                   << "#TotalRenderCost\n" << totalRenderCost << endl 
     1714                   << "#CurrentPvs\n" << 0 << endl 
     1715                   << "#ExpectedCost\n" << expCost << endl 
     1716                   << "#AvgRenderCost\n" << avgRenderCost << endl 
     1717                   << "#Deviation\n" << dev << endl 
     1718                   << "#TotalPvs\n" << totalPvs << endl 
     1719                   << "#PvsSizeDecrease\n0" << endl 
     1720                   << "#Volume\n0" << endl 
     1721                   //<< "#Siblings\n" << mergeStats.siblings << endl 
     1722                   << endl; 
     1723         
    16811724 
    16821725        while (!tQueue.empty()) 
     
    16891732                        ViewCell *viewCell = dynamic_cast<BspLeaf *>(tData.mNode)->GetViewCell(); 
    16901733                        viewCell->SetMergeCost((float)tData.mNode->mTimeStamp); 
     1734 
     1735                        Debug << "leaf time stamp: " << tData.mNode->mTimeStamp << endl; 
    16911736 
    16921737                        if (tData.mParentViewCell) 
    16931738                        { 
    16941739                                tData.mParentViewCell->SetupChildLink(viewCell); 
    1695                                 // probagate up pvs 
     1740                                // propagate up pvs: could be redone as propagepvs, which propagates pvs up and down 
    16961741                                mViewCellsTree->PropagateUpPvs(viewCell); 
    16971742                        } 
     
    17011746                        BspInterior *interior = dynamic_cast<BspInterior *>(tData.mNode); 
    17021747                        ViewCellInterior *viewCellInterior = new ViewCellInterior(); 
     1748 
     1749                        ++ merged; 
     1750                        -- numViewCells; 
     1751 
     1752                        avgRenderCost = totalPvs / numViewCells; 
     1753 
     1754                        Debug//mStats  
     1755                                << "#Pass\n" << 0 << endl 
     1756                                << "#Merged\n" << merged << endl  
     1757                                << "#ViewCells\n" << numViewCells << endl  
     1758                << "#RenderCostIncrease\n" << 0 << endl 
     1759                                << "#TotalRenderCost\n" << totalRenderCost << endl 
     1760                                << "#CurrentPvs\n" << 0 << endl 
     1761                << "#ExpectedCost\n" << 0 << endl 
     1762                                << "#AvgRenderCost\n" << avgRenderCost << endl 
     1763                                << "#Deviation\n" << dev << endl 
     1764                                << "#TotalPvs\n" << totalPvs << endl 
     1765                                << "#PvsSizeDecrease\n" << 0 << endl 
     1766                                << "#Volume\n" << 0 << endl 
     1767                                << endl; 
     1768 
     1769                        Debug << "interior time stamp: " << tData.mNode->mTimeStamp << endl; 
     1770 
    17031771                        viewCellInterior->SetMergeCost((float)tData.mNode->mTimeStamp); 
    17041772 
     
    17111779                } 
    17121780        } 
     1781 
     1782        return merged; 
    17131783} 
    17141784 
     
    28382908 
    28392909 
    2840 void VspBspViewCellsManager::CreateMergeHierarchy() 
     2910int VspBspViewCellsManager::ConstructSpatialMergeTree() 
    28412911{ 
    28422912        TraversalQueue tQueue; 
    2843  
    28442913        tQueue.push(TraversalData(mVspBspTree->GetRoot(), NULL)); 
     2914 
     2915        int merged = 0; 
    28452916 
    28462917        while (!tQueue.empty()) 
     
    28642935                        BspInterior *interior = dynamic_cast<BspInterior *>(tData.mNode); 
    28652936                        ViewCellInterior *viewCellInterior = new ViewCellInterior(); 
    2866                          
     2937                        ++ merged; 
     2938 
    28672939                        tQueue.push(TraversalData(interior->GetBack(), viewCellInterior)); 
    28682940                        tQueue.push(TraversalData(interior->GetFront(), viewCellInterior)); 
     
    28722944                } 
    28732945        } 
     2946        return merged; 
    28742947} 
    28752948 
  • GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.h

    r610 r649  
    353353 
    354354 
    355         virtual void CreateMergeHierarchy() {}; 
     355        virtual int ConstructSpatialMergeTree() { return 0;}; 
    356356         
    357357        virtual bool EqualToSpatialNode(ViewCell *viewCell) const { return false;} 
     
    529529        bool ExportViewCells(const string filename); 
    530530 
    531         void CreateMergeHierarchy(); 
     531        int ConstructSpatialMergeTree(); 
    532532 
    533533 
     
    815815        void PrepareLoadedViewCells(); 
    816816 
    817         void CreateMergeHierarchy(); 
     817        int ConstructSpatialMergeTree(); 
     818 
    818819        /// the view space partition BSP tree. 
    819820        VspBspTree *mVspBspTree; 
Note: See TracChangeset for help on using the changeset viewer.