Changeset 414


Ignore:
Timestamp:
11/15/05 15:57:15 (19 years ago)
Author:
mattausch
Message:
 
Location:
trunk/VUT/GtpVisibilityPreprocessor
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/VUT/GtpVisibilityPreprocessor/scripts/default.env

    r411 r414  
    2424 
    2525Preprocessor { 
    26 #       type sampling 
    27         type vss 
     26        type sampling 
     27#       type exact 
     28#       type vss 
    2829} 
    2930 
     
    7879                minPvsDif 100 
    7980                minPvs 10 
    80                 maxPvs 300 
    81                 samples 0 
     81                maxPvs 150 
     82                samples 100000 
    8283        } 
    8384 
     
    9495        #       input fromViewCells 
    9596        #       input fromSceneGeometry 
    96                 samples 200000 
     97                samples 100000 
    9798                sideTolerance 0.005 
    9899        } 
     
    132133        #splitPlaneStrategy 130 
    133134         
    134         splitPlaneStrategy 1024 
     135        splitPlaneStrategy 12 
    135136         
    136137        maxPolyCandidates 50 
     
    166167                exportSplits true 
    167168                # how much samples should be used in visualization 
    168                 samples 1000 
     169                samples 20000 
    169170        } 
    170171} 
  • trunk/VUT/GtpVisibilityPreprocessor/src/Environment.cpp

    r411 r414  
    13361336 
    13371337 
    1338   RegisterOption("VspKdTree.Construction.Samples", 
     1338  RegisterOption("VspKdTree.Construction.samples", 
    13391339                 optInt, 
    13401340                 "-vsp_construction_samples=", 
     
    13431343  RegisterOption("VspKdTree.Termination.maxDepth",  
    13441344                optInt,  
    1345                 "vsp_depth=", "30"); 
     1345                "vsp_term_maxdepth=", "30"); 
    13461346 
    13471347  RegisterOption("VspKdTree.Termination.minPvs",  
     
    13521352  RegisterOption("VspKdTree.Termination.minRays",  
    13531353          optInt,  
    1354           "vsp_minrays=",  
     1354          "vsp_term_minrays=",  
    13551355          "10"); 
    13561356 
    1357   RegisterOption("VspKdTree.maxCostRatio",  
     1357  RegisterOption("VspKdTree.Termination.minSize",  
    13581358          optFloat,  
    1359           "vsp_maxcost=",  
     1359          "vsp_term_minsize=",  
     1360          "0.001"); 
     1361 
     1362  RegisterOption("VspKdTree.Termination.maxCostRatio",  
     1363          optFloat,  
     1364          "vsp_term_maxcost=",  
    13601365          "0.95"); 
    13611366 
    1362   RegisterOption("VspKdTree.maxRayContribution",  
     1367  RegisterOption("VspKdTree.Termination.maxRayContribution",  
    13631368          optFloat,  
    1364           "vsp_max_ray_contrib=",  
     1369          "vsp_term_max_ray_contrib=",  
    13651370          "0.5"); 
    13661371 
     
    13831388          "endpoints=",  
    13841389          "10000"); 
    1385  
    1386   RegisterOption("VspKdTree.minSize",  
    1387           optFloat,  
    1388           "minsize=",  
    1389           "0.001"); 
    13901390 
    13911391  RegisterOption("VspKdTree.maxTotalMemory",  
  • trunk/VUT/GtpVisibilityPreprocessor/src/RenderSimulator.cpp

    r410 r414  
    33#include "ViewCellBsp.h" 
    44#include "ViewCell.h" 
     5 
     6void SimulationStatistics::Print(ostream &app) const 
     7{ 
     8        app << "===== Simulation statistics ===============\n"; 
     9 
     10        app << setprecision(4); 
     11 
     12        app << "#N_CTIME  ( Simulation time [s] )\n" << Time() << " \n"; 
     13 
     14        app << "#MAX_COST ( maximal cost of a view cell )\n" << maxCost << "\n"; 
     15 
     16        app << "#MIN_COST ( minimal cost of a view cell )\n" << minCost << "\n"; 
     17 
     18        app << "#AVG_RENDER_TIME ( average render time )\n" << avgRenderTime << "\n"; 
     19 
     20        app << "#AVG_RENDER_TIME_NO_OVERHEAD ( average render time without overhead )\n" << avgRtWithoutOverhead << "\n"; 
     21         
     22        app << "===== END OF Simulation statistics ==========\n"; 
     23} 
    524 
    625RenderSimulator::RenderSimulator() 
     
    2645Real BspViewCellRenderSimulator::SimulateRendering() 
    2746{ 
     47        mStat.Reset(); 
     48        mStat.Start(); 
     49 
    2850        Real renderTime = 0; 
    29  
     51         
    3052        // overhead for loading the PVS of the view cells 
    3153        float loadPvsOverhead = 0; 
    32  
    3354        // probability that view point lies in a view cell 
    3455        float pInVcTotal = 0; 
    35  
    3656        // total probability that a view cell border is crossed 
    3757        float pCrossVcTotal = 0; 
     
    5777                                 
    5878                // compute render time of PVS times probability that view point is in view cell 
    59                 renderTime += pInVc * RenderPvs(*(*it), mObjRenderCost); 
     79                float vcCost = pInVc * RenderPvs(*(*it), mObjRenderCost); 
    6080                 
     81                renderTime += vcCost; 
     82 
     83                if (vcCost > mStat.maxCost) 
     84                        mStat.maxCost = vcCost; 
     85                else if (vcCost < mStat.minCost) 
     86                        mStat.minCost = vcCost; 
     87 
    6188                // probability that a view cell border is crossed 
    6289                float pCrossVc = area; 
    6390 
     91                // crossing the border of a view cell is also depending on the move speed 
    6492                loadPvsOverhead += pCrossVc * mVcOverhead * mMoveSpeed; 
    6593 
     
    72100        loadPvsOverhead /= pCrossVcTotal; 
    73101 
    74         //Debug << "render time without overhead: " << renderTime * 1e-3 << endl; 
    75          
     102        mStat.avgRtWithoutOverhead = renderTime; 
     103        mStat.avgRenderTime = renderTime + loadPvsOverhead; 
     104         
     105        mStat.Stop(); 
     106 
    76107        return renderTime + loadPvsOverhead; 
    77108} 
     
    98129{ 
    99130        //mKdTree->CollectLeavesPvs(); 
     131        mStat.Reset(); 
     132        mStat.Start(); 
    100133 
    101134        // total render time 
     
    132165                const float pCrossVc = box.SurfaceArea(); 
    133166 
    134                 renderTime += pInVc * RenderPvs(*it, mObjRenderCost); 
     167                float vcCost = pInVc * RenderPvs(*it, mObjRenderCost); 
     168                renderTime += vcCost; 
     169 
     170                if (vcCost > mStat.maxCost) 
     171                        mStat.maxCost = vcCost; 
     172                else if (vcCost < mStat.minCost) 
     173                        mStat.minCost = vcCost; 
     174 
    135175                loadPvsOverhead += pCrossVc * mVcOverhead * mMoveSpeed; 
    136176 
     
    139179        } 
    140180 
     181        Debug << "RT: " << renderTime << endl; 
     182        Debug << "pvsOverhead: " << loadPvsOverhead << endl; 
     183 
     184 
    141185        renderTime /= pInVcTotal; 
    142186        loadPvsOverhead /= pCrossVcTotal; 
    143187 
     188    mStat.avgRtWithoutOverhead = renderTime; 
     189        mStat.avgRenderTime = renderTime + loadPvsOverhead; 
     190         
     191        mStat.Stop(); 
     192 
    144193        return renderTime + loadPvsOverhead; 
    145194} 
  • trunk/VUT/GtpVisibilityPreprocessor/src/RenderSimulator.h

    r411 r414  
    33 
    44#include "common.h" 
     5#include "Statistics.h" 
    56 
    67class BspTree; 
     
    910class KdLeaf; 
    1011 
     12class SimulationStatistics: public StatisticsBase 
     13{ 
     14public: 
     15        /// view cell with the biggest "cost" 
     16        float maxCost; 
     17        /// view cell with the minimal "cost" 
     18    float minCost; 
     19        /// average render time 
     20        float avgRenderTime; 
     21        /// average render time with the overhead when crossing view cells 
     22        float avgRtWithoutOverhead; 
     23   
     24        void Reset()  
     25        { 
     26                maxCost = 0; 
     27                minCost = 999999; 
     28                avgRenderTime = 0; 
     29                avgRtWithoutOverhead = 0; 
     30        } 
     31 
     32        void Print(ostream &app) const; 
     33 
     34        friend ostream &operator<<(ostream &s, const SimulationStatistics &stat)  
     35        { 
     36                stat.Print(s); 
     37                return s; 
     38        }   
     39}; 
     40 
    1141/** Simulated rendering using a simple render heuristics. Used to evaluate the  
    1242        quality of the view cell partition. 
     
    1444class RenderSimulator 
    1545{ 
     46 
    1647public: 
    1748        RenderSimulator(); 
     
    2556        /// move speed of player 
    2657        float mMoveSpeed; 
     58 
     59        SimulationStatistics mStat; 
    2760}; 
    2861 
  • trunk/VUT/GtpVisibilityPreprocessor/src/SamplingPreprocessor.cpp

    r412 r414  
    1515  environment->GetIntValue("Sampling.totalSamples", mTotalSamples); 
    1616  environment->GetIntValue("BspTree.Construction.samples", mBspConstructionSamples); 
    17   environment->GetIntValue("VspTree.Construction.samples", mVspConstructionSamples); 
    18  
     17  environment->GetIntValue("VspKdTree.Construction.samples", mVspConstructionSamples); 
    1918  environment->GetIntValue("ViewCells.PostProcessing.samples", mPostProcessSamples); 
    2019  environment->GetIntValue("BspTree.Visualization.samples", mVisualizationSamples); 
     
    389388 
    390389  int pvsOut = Min((int)objects.size(), 10); 
     390  int pvsSize = 0; 
    391391 
    392392  RayContainer rays[10]; 
     
    509509     
    510510                mPass++; 
    511  
    512                 int pvsSize = 0; 
    513511         
    514                 if (ViewCell::sHierarchy == ViewCell::BSP) { 
    515                         for (i=0; i < mViewCells.size(); i++) { 
    516                                 ViewCell *vc = mViewCells[i]; 
    517                                 pvsSize += vc->GetPvs().GetSize(); 
    518                         } 
    519                 } else  { 
     512                if (ViewCell::sHierarchy == ViewCell::KD) 
     513                { 
     514                        pvsSize = 0; 
     515 
    520516                        for (i=0; i < objects.size(); i++) { 
    521517                                Intersectable *object = objects[i]; 
     
    523519                        } 
    524520                } 
    525  
     521                else 
     522                { 
     523                        Debug << "contr: " << passSampleContributions << " pvs: " << pvsSize << " objects: " << objects.size() << endl; 
     524                        pvsSize += passSampleContributions; 
     525                } 
    526526                float avgRayContrib = (passContributingSamples > 0) ?  
    527527                        passSampleContributions/(float)passContributingSamples : 0; 
     
    531531                                 << "k   #SampleContributions=" << passSampleContributions << " ("  
    532532                                 << 100*passContributingSamples/(float)passSamples<<"%)" << " avgPVS=" 
    533                                  << pvsSize /(float)objects.size() << endl  
     533                                 << (float)pvsSize /(float)objects.size() << endl  
    534534                                 << "avg ray contrib=" << avgRayContrib << endl 
    535535                                 << "reverse samples [%]" << reverseSamples/(float)passSamples*100.0f << endl; 
     
    552552                //-- render simulation 
    553553                cout << "\nevaluating bsp view cells render time before merge ... "; 
    554                 Real rt = GetRenderSimulator()->SimulateRendering(); 
    555                  
    556                 cout << "avg render time: " << rt * 1e-3 << endl; 
    557                 Debug << "avg render time: " << rt * 1e-3 << endl; 
     554                GetRenderSimulator()->SimulateRendering(); 
     555                 
     556                cout << "avg render time: " <<  GetRenderSimulator()->mStat << endl; 
     557                Debug << "avg render time: " << GetRenderSimulator()->mStat << endl; 
    558558 
    559559                //-- post processing of bsp view cells 
     
    574574                        if (exporter) 
    575575                        { 
    576                                 exporter->ExportBspLeaves(*mBspTree, stat.maxPvs); 
     576                                exporter->ExportBspLeaves(*mBspTree, 350/*stat.maxPvs*/); 
    577577                                //exporter->ExportBspViewCellPartition(*mBspTree, 0); 
    578578                                delete exporter; 
     
    598598                cout << "\nevaluating render time after merge ... "; 
    599599                         
    600                 rt = GetRenderSimulator()->SimulateRendering(); 
    601  
    602                 cout << "render time: " << rt * 1e-3 << endl; 
    603                 Debug << "render time: " << rt * 1e-3 << endl; 
     600                GetRenderSimulator()->SimulateRendering(); 
     601 
     602                cout << "render time: " << GetRenderSimulator()->mStat << endl; 
     603                Debug << "render time: " << GetRenderSimulator()->mStat << endl; 
    604604 
    605605                if (1) // export view cells 
     
    609609                        if (exporter) 
    610610                        { 
    611                                 exporter->ExportBspViewCellPartition(*mBspTree, stat.maxPvs); 
     611                                exporter->ExportBspViewCellPartition(*mBspTree, 350/*stat.maxPvs*/); 
    612612                                //exporter->ExportBspViewCellPartition(*mBspTree, 0); 
    613613                                delete exporter; 
     
    813813        int limit = min((int)mSampleRays.size(), mPostProcessSamples); 
    814814 
    815         for (int i = 0; i < limit; ++i) 
     815        for (int i = 0; i < limit; ++ i) 
    816816        {   
    817817                Ray *ray = mSampleRays[i]; 
     
    819819                // traverse leaves stored in the rays and compare and merge consecutive 
    820820                // leaves (i.e., the neighbors in the tree) 
    821                 if (ray->bspIntersections.empty()) 
     821                if (ray->bspIntersections.size() < 2) 
    822822                        continue; 
    823823 
     
    827827                ++ iit; 
    828828                 
    829                 for (; iit != (*rit)->bspIntersections.end(); ++ iit) 
     829                for (; iit != ray->bspIntersections.end(); ++ iit) 
    830830                { 
    831831                        BspLeaf *leaf = (*iit).mLeaf; 
     
    837837                                ++ merged; 
    838838                        } 
     839                 
    839840                        previousLeaf = leaf; 
    840841                } 
     
    882883 
    883884                // export scene geometry 
    884                 if (0) 
     885                if (1) 
    885886                { 
    886887                        Material m;//= RandomMaterial(); 
  • trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellBsp.cpp

    r411 r414  
    285285                         
    286286                if (!ray->intersections.empty()) 
    287                 {        
    288             contribution += mViewCell->GetPvs().AddSample(ray->intersections[0].mObject); 
    289                 } 
    290  
     287                        contribution += mViewCell->GetPvs().AddSample(ray->intersections[0].mObject); 
     288                 
    291289                if (ray->sourceObject.mObject) 
    292290                        contribution += mViewCell->GetPvs().AddSample(ray->sourceObject.mObject); 
     
    297295                        ++ contributingSamples; 
    298296                } 
     297                 
    299298                if (BspTree::sStoreLeavesWithRays) 
    300299                        // warning: intersections not ordered 
     
    320319} 
    321320 
    322 void BspViewCellsStatistics::Print(ostream &app) const 
    323 { 
    324         app << "===== BspViewCells statistics ===============\n"; 
     321void BspTreeStatistics::Print(ostream &app) const 
     322{ 
     323        app << "===== BspTree statistics ===============\n"; 
    325324 
    326325        app << setprecision(4); 
    327326 
    328         app << "#N_OVERALLPVS ( objects in PVS )\n" << pvs << endl; 
    329  
    330         app << "#N_PMAXPVS ( largest PVS )\n" << maxPvs << endl; 
    331  
    332         app << "#N_PMINPVS ( smallest PVS )\n" << minPvs << endl; 
    333  
    334         app << "#N_PAVGPVS ( average PVS )\n" << AvgPvs() << endl; 
    335  
    336         app << "#N_PEMPTYPVS ( view cells with PVS smaller 2 )\n" << emptyPvs << endl; 
    337  
    338         app << "#N_VIEWCELLS ( number of view cells)\n" << viewCells << endl; 
    339  
    340         app << "#N_AVGBSPLEAVES (average number of BSP leaves per view cell )\n" << AvgBspLeaves() << endl; 
    341  
    342         app << "#N_MAXBSPLEAVES ( maximal number of BSP leaves per view cell )\n" << maxBspLeaves << endl; 
    343          
    344         app << "===== END OF BspViewCells statistics ==========\n"; 
    345 } 
    346  
    347 void BspTreeStatistics::Print(ostream &app) const 
    348 { 
    349         app << "===== BspTree statistics ===============\n"; 
    350  
    351         app << setprecision(4); 
     327        app << "#N_CTIME  ( Construction time [s] )\n" << Time() << " \n"; 
    352328 
    353329        app << "#N_NODES ( Number of nodes )\n" << nodes << "\n"; 
     
    586562void BspTree::Construct(const RayContainer &sampleRays) 
    587563{ 
    588         mStat.nodes = 1; 
     564    mStat.nodes = 1; 
    589565        mBox.Initialize();      // initialise BSP tree bounding box 
    590566         
     
    673649        tStack.push(tData); 
    674650 
    675         long startTime = GetTime(); 
     651        mStat.Start(); 
    676652        cout << "**** Contructing bsp tree ****\n"; 
    677653 
     
    685661        } 
    686662 
    687         cout << "**** Finished tree construction ****\n"; 
    688         Debug << "BSP tree contruction time: " << TimeDiff(startTime, GetTime())*1e-3 << "s" << endl; 
     663        mStat.Stop(); 
    689664} 
    690665 
     
    898873        backData.mNode = interior->mBack; 
    899874         
     875        //DEL_PTR(leaf); 
    900876        return interior; 
    901877} 
     
    19411917                                 
    19421918                                ++ stat.viewCells; 
    1943                                 int pvsSize = viewCell->GetPvs().GetSize(); 
     1919                                const int pvsSize = viewCell->GetPvs().GetSize(); 
    19441920 
    19451921                stat.pvs += pvsSize; 
    19461922 
    1947                                 if (pvsSize < 2) 
     1923                                if (pvsSize < 1) 
    19481924                                        ++ stat.emptyPvs; 
    19491925 
     
    25552531        return planePoly; 
    25562532} 
     2533 
     2534void BspViewCellsStatistics::Print(ostream &app) const 
     2535{ 
     2536        app << "===== BspViewCells statistics ===============\n"; 
     2537 
     2538        app << setprecision(4); 
     2539 
     2540        //app << "#N_CTIME  ( Construction time [s] )\n" << Time() << " \n"; 
     2541 
     2542        app << "#N_OVERALLPVS ( objects in PVS )\n" << pvs << endl; 
     2543 
     2544        app << "#N_PMAXPVS ( largest PVS )\n" << maxPvs << endl; 
     2545 
     2546        app << "#N_PMINPVS ( smallest PVS )\n" << minPvs << endl; 
     2547 
     2548        app << "#N_PAVGPVS ( average PVS )\n" << AvgPvs() << endl; 
     2549 
     2550        app << "#N_PEMPTYPVS ( view cells with PVS smaller 2 )\n" << emptyPvs << endl; 
     2551 
     2552        app << "#N_VIEWCELLS ( number of view cells)\n" << viewCells << endl; 
     2553 
     2554        app << "#N_AVGBSPLEAVES (average number of BSP leaves per view cell )\n" << AvgBspLeaves() << endl; 
     2555 
     2556        app << "#N_MAXBSPLEAVES ( maximal number of BSP leaves per view cell )\n" << maxBspLeaves << endl; 
     2557         
     2558        app << "===== END OF BspViewCells statistics ==========\n"; 
     2559} 
  • trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellBsp.h

    r412 r414  
    66#include "Polygon3.h" 
    77#include <stack> 
     8#include "Statistics.h" 
    89 
    910class ViewCell; 
     
    7172typedef vector<BoundedRay *> BoundedRayContainer; 
    7273 
    73 class BspTreeStatistics 
     74class BspTreeStatistics: public StatisticsBase 
    7475{ 
    7576public: 
    76   // total number of nodes 
    77   int nodes; 
    78   // number of splits 
    79   int splits; 
    80   // totals number of rays 
    81   int rays; 
    82   // maximal reached depth 
    83   int maxDepth; 
    84   // minimal depth 
    85   int minDepth; 
    86   // max depth nodes 
    87   int maxDepthNodes; 
    88   // max number of rays per node 
    89   int maxObjectRefs; 
    90    // accumulated depth (used to compute average) 
    91   int accumDepth; 
    92   // number of initial polygons 
    93   int polys; 
    94   /// samples contributing to pvs 
    95   int contributingSamples; 
    96    /// sample contributions to pvs 
    97   int sampleContributions; 
    98   /// largest pvs 
    99   int largestPvs; 
    100  
    101   // Constructor 
    102   BspTreeStatistics()  
    103   { 
    104           Reset(); 
    105   } 
    106  
    107   int Nodes() const {return nodes;} 
    108   int Interior() const { return nodes / 2; } 
    109   int Leaves() const { return (nodes / 2) + 1; } 
    110   // TODO: computation wrong 
    111   double AvgDepth() const { return accumDepth / (double)Leaves();};  
     77        // total number of nodes 
     78        int nodes; 
     79        // number of splits 
     80        int splits; 
     81        // totals number of rays 
     82        int rays; 
     83        // maximal reached depth 
     84        int maxDepth; 
     85        // minimal depth 
     86        int minDepth; 
     87        // max depth nodes 
     88        int maxDepthNodes; 
     89        // max number of rays per node 
     90        int maxObjectRefs; 
     91        // accumulated depth (used to compute average) 
     92        int accumDepth; 
     93        // number of initial polygons 
     94        int polys; 
     95        /// samples contributing to pvs 
     96        int contributingSamples; 
     97        /// sample contributions to pvs 
     98        int sampleContributions; 
     99        /// largest pvs 
     100        int largestPvs; 
     101 
     102        // Constructor 
     103        BspTreeStatistics()  
     104        { 
     105                Reset(); 
     106        } 
     107 
     108        int Nodes() const {return nodes;} 
     109        int Interior() const { return nodes / 2; } 
     110        int Leaves() const { return (nodes / 2) + 1; } 
     111         
     112        // TODO: computation wrong 
     113        double AvgDepth() const { return accumDepth / (double)Leaves();};  
    112114   
    113   void Reset()  
    114   { 
    115           nodes = 0; 
    116           splits = 0; 
    117       maxDepthNodes = 0; 
    118           maxDepth = 0; 
    119           minDepth = 99999; 
    120           polys = 0; 
    121           accumDepth = 0; 
    122                  
    123           contributingSamples = 0; 
    124           sampleContributions = 0; 
    125   } 
    126  
    127   void 
    128   Print(ostream &app) const; 
    129  
    130   friend ostream &operator<<(ostream &s, const BspTreeStatistics &stat) { 
    131     stat.Print(s); 
    132     return s; 
    133   } 
    134    
     115        void Reset()  
     116        { 
     117                nodes = 0; 
     118                splits = 0; 
     119                maxDepthNodes = 0; 
     120                maxDepth = 0; 
     121                minDepth = 99999; 
     122                polys = 0; 
     123                accumDepth = 0; 
     124         
     125                contributingSamples = 0; 
     126                sampleContributions = 0; 
     127        } 
     128 
     129        void Print(ostream &app) const; 
     130 
     131        friend ostream &operator<<(ostream &s, const BspTreeStatistics &stat)  
     132        { 
     133                stat.Print(s); 
     134                return s; 
     135        }  
    135136}; 
    136137 
    137 class BspViewCellsStatistics 
     138class BspViewCellsStatistics: public StatisticsBase 
    138139{ 
    139140public: 
     141 
     142        /// number of view cells 
     143        int viewCells; 
     144 
     145        /// size of the PVS 
     146        int pvs; 
    140147   
    141   /// number of view cells 
    142   int viewCells; 
    143  
    144   /// size of the PVS 
    145   int pvs; 
     148        /// largest PVS of all view cells 
     149        int maxPvs; 
     150 
     151        /// smallest PVS of all view cells 
     152        int minPvs; 
     153 
     154        /// view cells with empty PVS 
     155        int emptyPvs; 
     156 
     157        /// number of bsp leaves covering the view space 
     158        int bspLeaves; 
     159 
     160        /// largest number of leaves covered by one view cell   
     161        int maxBspLeaves; 
     162 
     163    // Constructor 
     164        BspViewCellsStatistics()  
     165        { 
     166                Reset(); 
     167        } 
     168 
     169        double AvgBspLeaves() const {return (double)bspLeaves / (double)viewCells;}; 
     170        double AvgPvs() const {return (double)pvs / (double)viewCells;}; 
    146171   
    147   /// largest PVS of all view cells 
    148   int maxPvs; 
    149  
    150   /// smallest PVS of all view cells 
    151   int minPvs; 
    152  
    153   /// view cells with empty PVS 
    154   int emptyPvs; 
    155  
    156   /// number of bsp leaves covering the view space 
    157   int bspLeaves; 
    158  
    159   /// largest number of leaves covered by one view cell 
    160   int maxBspLeaves; 
    161  
    162    
    163   // Constructor 
    164   BspViewCellsStatistics()  
    165   { 
    166           Reset(); 
    167   } 
    168  
    169   double AvgBspLeaves() const {return (double)bspLeaves / (double)viewCells;}; 
    170   double AvgPvs() const {return (double)pvs / (double)viewCells;}; 
    171    
    172    
    173   void Reset()  
    174   { 
    175           viewCells = 0; 
    176           pvs = 0; 
    177           maxPvs = 0; 
    178           minPvs = 999999; 
    179           emptyPvs = 0; 
    180           bspLeaves = 0; 
    181           maxBspLeaves = 0; 
    182   } 
    183  
    184   void 
    185   Print(ostream &app) const; 
    186  
    187   friend ostream &operator<<(ostream &s, const BspViewCellsStatistics &stat) { 
    188     stat.Print(s); 
    189     return s; 
    190   } 
    191    
     172        void Reset()  
     173        { 
     174                viewCells = 0;   
     175                pvs = 0;   
     176                maxPvs = 0; 
     177 
     178                minPvs = 999999; 
     179                emptyPvs = 0; 
     180                bspLeaves = 0; 
     181                maxBspLeaves = 0; 
     182        } 
     183 
     184        void Print(ostream &app) const; 
     185 
     186        friend ostream &operator<<(ostream &s, const BspViewCellsStatistics &stat)  
     187        { 
     188                stat.Print(s); 
     189                return s; 
     190        }   
    192191}; 
    193192 
  • trunk/VUT/GtpVisibilityPreprocessor/src/VspKdTree.cpp

    r413 r414  
    241241                                         AxisAlignedBox3 *forcedBoundingBox) 
    242242{ 
    243         stat.Start(); 
     243        mStat.Start(); 
    244244   
    245245        maxMemory = maxStaticMemory; 
     
    254254 
    255255         
    256         stat.nodes = 1; 
     256        mStat.nodes = 1; 
    257257         
    258258        bbox.Initialize(); 
     
    276276        cout<<"Dirr Bbox = "<<dirBBox<<endl; 
    277277 
    278         stat.rays = leaf->rays.size(); 
     278        mStat.rays = leaf->rays.size(); 
    279279        leaf->UpdatePvsSize(); 
    280280         
    281         stat.initialPvsSize = leaf->GetPvsSize(); 
     281        mStat.initialPvsSize = leaf->GetPvsSize(); 
    282282         
    283283        // Subdivide(); 
     
    291291        } 
    292292   
    293         stat.Stop(); 
    294  
    295         stat.Print(cout); 
     293        mStat.Stop(); 
     294 
     295        mStat.Print(cout); 
    296296        cout<<"#Total memory=" << GetMemUsage() << endl; 
    297297} 
     
    899899         
    900900        // update stats 
    901         stat.rayRefs -= (int)leaf->rays.size(); 
    902         stat.rayRefs += raysBack + raysFront; 
     901        mStat.rayRefs -= (int)leaf->rays.size(); 
     902        mStat.rayRefs += raysBack + raysFront; 
    903903 
    904904        delete leaf; 
     
    10661066                                                        while (tail >= i && leaf->rays[tail].mRay->ScheduledForRemoval())  
    10671067                                                        { 
    1068                                                                 ++ stat.removedRayRefs; 
     1068                                                                ++ mStat.removedRayRefs; 
    10691069                                                                leaf->rays[tail].mRay->Unref(); 
    10701070                                                                leaf->rays.pop_back(); 
     
    10761076                                                                break; 
    10771077               
    1078                                                         ++ stat.removedRayRefs; 
     1078                                                        ++ mStat.removedRayRefs; 
    10791079               
    10801080                                                        leaf->rays[i].mRay->Unref(); 
     
    10921092                                        if (leaf->rays[i].mRay == ray)  
    10931093                                        { 
    1094                                                 ++ stat.removedRayRefs; 
     1094                                                ++ mStat.removedRayRefs; 
    10951095                                                ray->Unref(); 
    10961096                                                leaf->rays[i] = leaf->rays[leaf->rays.size() - 1]; 
     
    12961296#endif 
    12971297 
    1298         stat.nodes -= collapsedNodes - 1; 
    1299         stat.rayRefs -= totalRayCount - rayCount; 
     1298        mStat.nodes -= collapsedNodes - 1; 
     1299        mStat.rayRefs -= totalRayCount - rayCount; 
    13001300   
    13011301#if DEBUG_COLLAPSE 
  • trunk/VUT/GtpVisibilityPreprocessor/src/VspKdTree.h

    r413 r414  
    371371        virtual void Print(ostream &s) const  
    372372        { 
    373                 s << endl << "L: r = " << rays.size() << endl; 
     373                s << endl << "L: r = " << (int)rays.size() << endl; 
    374374        }; 
    375375   
     
    620620         
    621621        ///////////////////////////// 
    622         VspKdStatistics mstat; 
     622        VspKdStatistics mStat; 
    623623         
    624624        VspKdTree(); 
Note: See TracChangeset for help on using the changeset viewer.