Changeset 2726


Ignore:
Timestamp:
05/30/08 02:37:07 (16 years ago)
Author:
mattausch
Message:

worked on gvs efficiency

Location:
GTP/trunk/Lib/Vis/Preprocessing
Files:
14 edited

Legend:

Unmodified
Added
Removed
  • GTP/trunk/Lib/Vis/Preprocessing/scripts/run_gvs_vps.sh

    r2725 r2726  
    1313#SCENE=../data/Arena/arena-high-lods.obj 
    1414SCENE=../data/Arena/arena_trees.obj 
    15 VIEWCELLS=../data/Arena/arena-high-lods-5000-viewcells.xml.gz 
     15#VIEWCELLS=../data/Arena/arena-high-lods-5000-viewcells.xml.gz 
    1616#SCENE=../data/vienna/vienna_cropped.obj 
    1717#SCENE=../data/roofs_new.obj 
    18 #SCENE=../data/vienna/city_full_hp.obj 
     18SCENE=../data/vienna/city_full_hp.obj 
    1919#SCENE=../data/vienna/vienna_rep.obj 
    2020 
    2121#SCENE=../data/vienna/vienna_cropped.obj 
    22 #VIEWCELLS=../data/vienna/vienna_cropped-gradient-viewcells.xml.gz  
    23 #VIEWPOINTS=../data/vienna/testwalk.vp 
    24 VIEWPOINTS=../data/arena/arena_key_cropped.vp 
     22VIEWCELLS=../data/vienna/vienna_cropped-gradient-viewcells.xml.gz  
     23VIEWPOINTS=../data/vienna/testwalk.vp 
     24#VIEWPOINTS=../data/arena/arena_key_cropped.vp 
    2525 
    2626#LOG_PREFIX=../src/SG08/rebut-arena-pixel2 
    27 #LOG_PREFIX=../src/SG08/full 
     27LOG_PREFIX=../src/SG08/speedtest 
    2828LOG_PREFIX=../src/SG08/arena_trees 
    2929 
     
    4040-preprocessor_use_vbos- \ 
    4141-gvs_epsilon=0.0001 \ 
    42 -gvs_total_samples=100000 \ 
    43 -gvs_samples_per_pass=100000 \ 
    44 -gvs_initial_samples=16 \ 
    45 -gvs_max_viewcells=200000 \ 
    46 -gvs_min_contribution=2000 \ 
     42-gvs_total_samples=1000000 \ 
     43-gvs_samples_per_pass=1000000 \ 
     44-gvs_initial_samples=2000 \ 
     45-gvs_max_viewcells=1 \ 
     46-gvs_min_contribution=50 \ 
    4747-gvs_per_viewcell=true \ 
    4848-preprocessor_detect_empty_viewspace+ \ 
  • GTP/trunk/Lib/Vis/Preprocessing/src/CombinedPreprocessor.cpp

    r2723 r2726  
    9292        vssRays.clear(); 
    9393         
    94          
    95         mMixtureDistribution->GenerateSamples(mSamplesPerPass, rays); 
     94        int invalidSamples = 0; 
     95        mMixtureDistribution->GenerateSamples(mSamplesPerPass, rays, invalidSamples); 
    9696 
    9797        cerr<<"Casting rays..."<<endl; 
  • GTP/trunk/Lib/Vis/Preprocessing/src/GlRenderer.cpp

    r2725 r2726  
    15871587                mViewDirection = sray.mDirection; 
    15881588 
    1589                 cout << "handling vp " << mFrame << " " << mViewPoint << " " << mViewDirection << endl; 
     1589                //cout << "handling vp " << mFrame << " " << mViewPoint << " " << mViewDirection << endl; 
    15901590                // skip all frames which have already 0 pixel error 
    15911591                // $$ Reverted back by JB for efficiency 
    15921592                if (1)//mPvsErrorBuffer[i].mError > 0.0f)  
    15931593                { 
    1594                         cout << "here3" << endl; 
    15951594                        // compute the pixel error 
    15961595                        mPvsErrorBuffer[i].mError = GetPixelError(pvsSize, mPvsStat.pass); 
  • GTP/trunk/Lib/Vis/Preprocessing/src/GlobalLinesRenderer.cpp

    r2552 r2726  
    169169 
    170170                        SimpleRayContainer simpleRays; 
    171                         glStrategy.GenerateSamples(5, simpleRays); 
     171                        int invalidSamples = 0; 
     172                        glStrategy.GenerateSamples(5, simpleRays, invalidSamples); 
    172173 
    173174                        //cout << "simple ray: " << simpleRays[4] << endl; 
  • GTP/trunk/Lib/Vis/Preprocessing/src/GvsPreprocessor.cpp

    r2725 r2726  
    1313#include "Polygon3.h" 
    1414#include "IntersectableWrapper.h" 
    15  
     15#include "Timer/PerfTimer.h" 
    1616 
    1717 
     
    2727 
    2828static ObjectContainer myobjects; 
     29static int sInvalidSamples = 0; 
     30 
     31/////////// 
     32//-- timers 
     33 
     34 
     35static PerfTimer rayTimer; 
     36static PerfTimer kdPvsTimer; 
     37static PerfTimer gvsTimer; 
     38static PerfTimer initialTimer; 
     39static PerfTimer intersectionTimer; 
     40static PerfTimer preparationTimer; 
     41static PerfTimer mainLoopTimer; 
     42static PerfTimer contributionTimer; 
     43static PerfTimer castTimer; 
     44static PerfTimer generationTimer; 
     45 
     46 
     47///////////////////// 
    2948 
    3049 
     
    145164        const float len = Magnitude(currentRay.mTermination - currentRay.mOrigin); 
    146165         
    147 #if 1 
    148166        // distance large => this is likely to be a discontinuity 
    149         if ((predictedLen - len) > mThreshold) 
    150 #else  
     167        if ((predictedLen - len) > mThreshold)  
    151168        // q: rather use relative distance? 
    152         if ((predictedLen / len) > mThreshold) 
    153 #endif 
    154         { 
     169        //if ((predictedLen / len) > mThreshold) 
     170        { 
     171#if 0 
    155172                // apply reverse sampling to find the gap 
    156173                VssRay *newRay = ReverseSampling(currentRay, hitTriangle, oldRay); 
     
    162179                        if (0) newRay->mFlags |= VssRay::ReverseSample; 
    163180                 
     181                        rayTimer.Entry(); 
    164182                        // check if ray can be processed further 
    165183                        // note: ray deletion handled by ray pool) 
    166184                        HandleRay(newRay); 
     185                        rayTimer.Exit(); 
    167186 
    168187                        return 1; 
    169188                } 
     189#else 
     190                static VssRayContainer reverseRays; 
     191                reverseRays.clear(); 
     192 
     193                // apply reverse sampling to find the gap 
     194                ReverseSampling2(currentRay, hitTriangle, oldRay, reverseRays); 
     195 
     196                rayTimer.Entry(); 
     197 
     198                int castRays = 0; 
     199                // check if reverse sampling was successful 
     200                for (size_t i = 0; i < reverseRays.size(); ++ i) 
     201                { 
     202                        // check if ray can be processed further 
     203                        // note: ray deletion handled by ray pool) 
     204                        if (reverseRays[i]) 
     205                        { 
     206                                ++ castRays; 
     207                                HandleRay(reverseRays[i]); 
     208                        } 
     209                } 
     210                 
     211                rayTimer.Exit(); 
     212 
     213                return castRays; 
     214 
     215#endif 
    170216        } 
    171217 
     
    193239void GvsPreprocessor::UpdateStatsForVisualization(KdIntersectable *kdInt) 
    194240{ 
     241        int numObj = 0; 
     242 
    195243        // count new objects in pvs due to kd node conversion    
    196244        myobjects.clear(); 
     
    198246        mKdTree->CollectObjectsWithDublicates(kdInt->GetItem(), myobjects); 
    199247 
    200         int numObj; 
    201  
    202248        ObjectContainer::const_iterator oit, oit_end = myobjects.end(); 
    203249 
    204250        for (oit = myobjects.begin(); oit != oit_end; ++ oit) 
    205                 numObj = CountObject(*oit); 
     251                numObj += CountObject(*oit); 
    206252 
    207253        mViewCellsManager->UpdateStatsForViewCell(mCurrentViewCell, kdInt, numObj); 
     
    209255 
    210256 
     257void GvsPreprocessor::AddKdNodeToPvs(const Vector3 &termination) 
     258{ 
     259        kdPvsTimer.Entry(); 
     260 
     261        // exchange the triangle with the node in the pvs for kd pvs 
     262        KdNode *node = mKdTree->GetPvsNode(termination); 
     263 
     264        //KdNode *node = mKdTree->GetPvsNodeCheck(ray.mTermination, obj); 
     265        //if (!node) cerr << "e " << obj->GetBox() << " " << ray.mTermination << endl; else  
     266        if (!node->Mailed()) 
     267        { 
     268                // add to pvs 
     269                node->Mail(); 
     270                KdIntersectable *kdInt = mKdTree->GetOrCreateKdIntersectable(node); 
     271                mCurrentViewCell->GetPvs().AddSampleDirty(kdInt, 1.0f); 
     272 
     273                if (QT_VISUALIZATION_SHOWN) UpdateStatsForVisualization(kdInt);  
     274        } 
     275 
     276        kdPvsTimer.Exit(); 
     277} 
     278 
     279 
    211280bool GvsPreprocessor::HasContribution(VssRay &ray) 
    212281{ 
     
    214283                return false; 
    215284 
     285        contributionTimer.Entry(); 
     286 
    216287        bool result; 
    217288 
     
    219290        { 
    220291                // store the rays + the intersected view cells 
    221                 const bool storeViewCells = false; //GVS_DEBUG; 
     292                const bool storeViewCells = false; 
    222293 
    223294                mViewCellsManager->ComputeSampleContribution(ray,  
     
    230301        else // original per view cell gvs 
    231302        { 
    232                 Intersectable *obj = ray.mTerminationObject; 
    233  
    234303                // test if triangle was accounted for yet 
    235                 result = AddTriangleObject(obj); 
     304                result = AddTriangleObject(ray.mTerminationObject); 
    236305                 
    237                 if (mUseKdPvs && (1 || result)) 
    238                 { 
    239                         // exchange the triangle with the node in the pvs for kd pvs 
    240                         KdNode *node = mKdTree->GetPvsNode(ray.mTermination); 
    241  
    242                         //KdNode *node = mKdTree->GetPvsNodeCheck(ray.mTermination, obj); 
    243                         //if (!node) cerr << "e " << obj->GetBox() << " " << ray.mTermination << endl; else  
    244                         if (!node->Mailed()) 
    245                         { 
    246                                 // add to pvs 
    247                                 node->Mail(); 
    248                                 KdIntersectable *kdInt = mKdTree->GetOrCreateKdIntersectable(node); 
    249                                 mCurrentViewCell->GetPvs().AddSampleDirty(kdInt, 1.0f); 
    250  
    251                                 if (QT_VISUALIZATION_SHOWN) UpdateStatsForVisualization(kdInt);  
    252                         } 
    253                 } 
    254         } 
     306                if (mUseKdPvs) 
     307                        AddKdNodeToPvs(ray.mTermination); 
     308        } 
     309 
     310        contributionTimer.Exit(); 
    255311 
    256312        return result; 
     
    363419        const Vector3 p = (p1 + p2) * 0.5f; 
    364420        //cout << "p: " << p << " " << p1 << " " << p2 << endl; 
     421 
     422        SimpleRay sray(oldRay.mOrigin, p - oldRay.mOrigin, SamplingStrategy::GVS, 1.0f); 
     423 
     424#if 1 
     425        castTimer.Entry(); 
     426        // cast single ray to check if a triangle was missed 
     427        VssRay *newRay = mRayCaster->CastRay(sray, mViewCellsManager->GetViewSpaceBox(), !mPerViewCell); 
     428        castTimer.Exit(); 
     429        ++ castRays; 
     430 
     431        // this ray will not be further processed 
     432        // note: ray deletion is handled by ray pool 
     433        if (!newRay) return castRays; 
     434 
     435        // new triangle discovered? => add new ray to queue 
     436        rayTimer.Entry(); 
     437        HandleRay(newRay); 
     438        rayTimer.Exit(); 
     439 
     440 
     441 
     442#else 
     443 
    365444        // cast ray into the new point 
    366         SimpleRay sray(oldRay.mOrigin, p - oldRay.mOrigin, SamplingStrategy::GVS, 1.0f); 
    367  
    368         VssRay *newRay = mRayCaster->CastRay(sray, mViewCellsManager->GetViewSpaceBox(), !mPerViewCell); 
    369          
    370         ++ castRays; 
    371  
     445        static SimpleRayContainer importanceRays; 
     446        importanceRays.clear(); 
     447 
     448        generationTimer.Entry(); 
     449 
     450         
     451        importanceRays.push_back(sray); 
     452 
     453        const int numRandomRays = 15; 
     454 
     455        GenerateJitteredRays(importanceRays, sray, numRandomRays, 0); 
     456        GenerateRays(numRandomRays, *mDistribution, importanceRays, sInvalidSamples); 
     457 
     458        generationTimer.Exit(); 
     459         
     460        // for the original implementation we don't cast double rays 
     461        const bool castDoubleRays = !mPerViewCell; 
     462        // cannot prune invalid rays because we have to compare adjacent rays 
     463        const bool pruneInvalidRays = false; 
     464 
     465        static VssRayContainer vssRays; 
     466        vssRays.clear(); 
     467 
     468        castTimer.Entry(); 
     469        CastRays(importanceRays, vssRays, castDoubleRays, pruneInvalidRays); 
     470        castTimer.Exit(); 
     471 
     472        castRays += (int)vssRays.size(); 
     473 
     474        VssRay *newRay = vssRays.empty() ? NULL : vssRays[0]; 
     475 
     476        // new triangle discovered? => add new ray to queue 
     477        rayTimer.Entry(); 
     478        for (size_t i = 0; i < vssRays.size(); ++ i) 
     479        { 
     480                if (vssRays[i]) 
     481                        HandleRay(vssRays[i]); 
     482        } 
     483 
     484        rayTimer.Exit(); 
     485 
     486        // this ray will not be further processed 
     487        // note: ray deletion is handled by ray pool 
    372488        if (!newRay) return castRays; 
     489#endif 
    373490 
    374491        //newRay->mFlags |= VssRay::BorderSample; 
    375  
    376         // add new ray to queue 
    377         const bool enqueued = HandleRay(newRay); 
    378492 
    379493        // subdivide further 
    380494        castRays += SubdivideEdge(hitTriangle, p1, p, ray1, *newRay, oldRay); 
    381495        castRays += SubdivideEdge(hitTriangle, p, p2, *newRay, ray2, oldRay); 
    382  
    383         // this ray will not be further processed 
    384         // note: ray deletion is handled by ray pool 
    385  
     496         
    386497        return castRays; 
    387498} 
     
    391502{ 
    392503        Intersectable *tObj = currentRay.mTerminationObject; 
    393         // q matt: can this be possible 
     504 
     505        // question matt: can this be possible? 
    394506        if (!tObj) return 0; 
    395507 
     
    410522         
    411523        /// create rays from sample points and handle them 
    412         SimpleRayContainer simpleRays; 
    413         simpleRays.reserve(9); 
     524        static SimpleRayContainer simpleRays; 
     525        simpleRays.clear(); 
     526        //simpleRays.reserve(9); 
    414527 
    415528        VertexContainer::const_iterator vit, vit_end = enlargedTriangle.end(); 
     
    432545        } 
    433546 
    434         // cast rays to triangle vertices and determine visibility 
     547         
     548        ////////// 
     549        //-- fill up simple rays with random rays so we can cast 16 rays at a time 
     550 
     551        const int numRandomRays = 16 - (int)simpleRays.size(); 
     552        SimpleRay mainRay = SimpleRay(currentRay.GetOrigin(), currentRay.GetNormalizedDir(), SamplingStrategy::GVS, 1.0f); 
     553 
     554        GenerateJitteredRays(simpleRays, mainRay, numRandomRays, 0); 
     555        //GenerateRays(numRandomRays, *mDistribution, simpleRays, sInvalidSamples); 
     556 
     557 
     558        ///////////////////// 
     559        //-- cast rays to vertices and determine visibility 
     560         
    435561        VssRayContainer vssRays; 
    436562 
    437         // don't cast double rays as we need only the forward rays 
     563        // for the original implementation we don't cast double rays 
    438564        const bool castDoubleRays = !mPerViewCell; 
    439         // cannot prune invalid rays because we have to compare adjacent  rays. 
     565        // cannot prune invalid rays because we have to compare adjacent rays 
    440566        const bool pruneInvalidRays = false; 
    441567 
    442  
    443         ////////// 
    444         //-- fill up simple rays with random rays so we can cast 16 rays simultaniosly 
    445  
    446         //const int numRandomRays = 0; 
    447         const int numRandomRays = 16 - (int)simpleRays.size(); 
    448  
    449         GenerateRays(numRandomRays, *mDistribution, simpleRays); 
    450  
    451  
    452         ///////////////////// 
    453  
    454         // keep origin for per view cell sampling 
     568        castTimer.Entry(); 
    455569        CastRays(simpleRays, vssRays, castDoubleRays, pruneInvalidRays); 
     570        castTimer.Exit(); 
    456571 
    457572        const int numBorderSamples = (int)vssRays.size() - numRandomRays; 
    458  
     573        int castRays = (int)simpleRays.size(); 
     574 
     575        // handle cast rays 
     576        EnqueueRays(vssRays); 
     577         
    459578#if 0 
    460579        // set flags 
     
    464583#endif 
    465584 
    466         int castRays = (int)simpleRays.size(); 
    467  
    468         VssRayContainer invalidSamples; 
    469  
    470         // handle rays 
    471         EnqueueRays(vssRays, invalidSamples); 
    472585 
    473586    // recursivly subdivide each edge 
     
    483596         
    484597        mGvsStats.mBorderSamples += castRays; 
    485  
    486598         
    487599        return castRays; 
     
    546658        // other types not implemented yet 
    547659        if (tObj->Type() == Intersectable::TRIANGLE_INTERSECTABLE) 
    548         { 
    549660                occluder = static_cast<TriangleIntersectable *>(tObj)->GetItem(); 
    550         } 
    551661        else 
    552         { 
    553662                cout << "reverse sampling: " << tObj->Type() << " not yet implemented" << endl; 
    554         } 
     663         
    555664        // get a point which is passing just outside of the occluder 
    556665    Vector3 newPoint; 
     
    564673        Vector3 newDir, newOrigin; 
    565674 
     675        ////////////// 
    566676        //-- Construct the mutated ray with xnew, 
    567677        //-- dir = predicted(x)- pnew as direction vector 
     678 
    568679        newDir = predicted - newPoint; 
    569680 
     
    608719 
    609720 
     721bool GvsPreprocessor::ReverseSampling2(const VssRay &currentRay, 
     722                                                                           const Triangle3 &hitTriangle, 
     723                                                                           const VssRay &oldRay, 
     724                                                                           VssRayContainer &reverseRays) 
     725{ 
     726        // get triangle occluding the path to the hit mesh 
     727        Triangle3 occluder; 
     728        Intersectable *tObj = currentRay.mTerminationObject; 
     729 
     730        // q: why can this happen? 
     731        if (!tObj) 
     732                return NULL; 
     733 
     734        // other types not implemented yet 
     735        if (tObj->Type() == Intersectable::TRIANGLE_INTERSECTABLE) 
     736                occluder = static_cast<TriangleIntersectable *>(tObj)->GetItem(); 
     737        else 
     738                cout << "reverse sampling: " << tObj->Type() << " not yet implemented" << endl; 
     739         
     740        // get a point which is passing just outside of the occluder 
     741    Vector3 newPoint; 
     742 
     743        // q: why is there sometimes no intersecton found? 
     744        if (!GetPassingPoint(currentRay, occluder, oldRay, newPoint)) 
     745                return NULL; 
     746 
     747        const Vector3 predicted = CalcPredictedHitPoint(currentRay, hitTriangle, oldRay); 
     748 
     749        Vector3 newDir, newOrigin; 
     750 
     751        ////////////// 
     752        //-- Construct the mutated ray with xnew, 
     753        //-- dir = predicted(x)- pnew as direction vector 
     754 
     755        newDir = predicted - newPoint; 
     756 
     757        // take xnew, p = intersect(viewcell, line(pnew, predicted(x)) as origin ? 
     758        // difficult to say!! 
     759        const float offset = 0.5f; 
     760        newOrigin = newPoint - newDir * offset; 
     761         
     762 
     763        ////////////// 
     764        //-- for per view cell sampling, we must check for intersection 
     765        //-- with the current view cell 
     766 
     767    if (mPerViewCell) 
     768        { 
     769                // send ray to view cell 
     770                static Ray ray; 
     771 
     772                ray.Clear(); 
     773                ray.Init(newOrigin, -newDir, Ray::LOCAL_RAY); 
     774                 
     775                // check if ray intersects view cell 
     776                if (!mCurrentViewCell->CastRay(ray)) 
     777                        return NULL; 
     778 
     779                Ray::Intersection &hit = ray.intersections[0]; 
     780         
     781                // the ray starts from the view cell 
     782                newOrigin = ray.Extrap(hit.mT); 
     783        } 
     784 
     785        static SimpleRayContainer reverseSimpleRays; 
     786        reverseSimpleRays.clear(); 
     787 
     788        SimpleRay mainRay = SimpleRay(newOrigin, newDir, SamplingStrategy::GVS, 1.0f); 
     789 
     790        reverseSimpleRays.push_back(mainRay); 
     791        GenerateJitteredRays(reverseSimpleRays, mainRay, 15, 0); 
     792 
     793        castTimer.Entry(); 
     794        CastRays(reverseSimpleRays, reverseRays, false, false); 
     795        castTimer.Exit(); 
     796 
     797        mGvsStats.mReverseSamples += reverseRays.size(); 
     798 
     799        return true; 
     800} 
     801 
     802 
    610803int GvsPreprocessor::CastInitialSamples(int numSamples) 
    611804{        
    612         const long startTime = GetTime(); 
     805        initialTimer.Entry(); 
    613806 
    614807        // generate simple rays 
    615         SimpleRayContainer simpleRays; 
    616          
     808        static SimpleRayContainer simpleRays; 
     809        simpleRays.clear(); 
     810 
     811         
     812        generationTimer.Entry(); 
    617813        ViewCellBorderBasedDistribution vcStrat(*this, mCurrentViewCell); 
    618     GenerateRays(numSamples, *mDistribution, simpleRays); 
     814    GenerateRays(numSamples, *mDistribution, simpleRays, sInvalidSamples); 
     815        generationTimer.Exit(); 
    619816 
    620817        //cout << "sr: " << simpleRays.size() << endl; 
    621818        // generate vss rays 
    622         VssRayContainer samples; 
    623          
     819        static VssRayContainer samples; 
     820        samples.clear(); 
     821 
    624822        const bool castDoubleRays = !mPerViewCell; 
    625823        const bool pruneInvalidRays = true; 
    626824         
     825        castTimer.Entry(); 
    627826        CastRays(simpleRays, samples, castDoubleRays, pruneInvalidRays); 
    628          
    629         VssRayContainer invalidSamples; 
     827        castTimer.Exit(); 
    630828 
    631829        // add to ray queue 
    632         EnqueueRays(samples, invalidSamples); 
    633  
    634         //CLEAR_CONTAINER(invalidSamples); 
    635         //Debug << "generated " <<  numSamples << " samples in " << TimeDiff(startTime, GetTime()) * 1e-3 << " secs" << endl; 
     830        EnqueueRays(samples); 
     831 
     832        initialTimer.Exit(); 
     833 
    636834        return (int)simpleRays.size(); 
    637835} 
    638836 
    639837 
    640 void GvsPreprocessor::EnqueueRays(VssRayContainer &samples, VssRayContainer &invalidSamples) 
    641 { 
     838void GvsPreprocessor::EnqueueRays(VssRayContainer &samples) 
     839{ 
     840        rayTimer.Entry(); 
     841 
    642842        // add samples to ray queue 
    643843        VssRayContainer::const_iterator vit, vit_end = samples.end(); 
     
    645845        { 
    646846                VssRay *ray = *vit; 
    647  
    648847                HandleRay(ray); 
    649                 //if (!HandleRay(ray)) invalidSamples.push_back(ray); 
    650         } 
     848                // note: deletion of invalid samples handked by ray pool 
     849        } 
     850 
     851        rayTimer.Exit(); 
    651852} 
    652853 
     
    654855int GvsPreprocessor::ProcessQueue() 
    655856{ 
     857        gvsTimer.Entry(); 
     858 
    656859        ++ mGvsStats.mGvsRuns; 
    657860 
    658861        int castSamples = 0; 
    659862 
    660         while (!mRayQueue.empty())//&& (mGvsStats.mTotalSamples + castSamples < mTotalSamples) ) 
     863        while (!mRayQueue.empty()) 
    661864        { 
    662865                // handle next ray 
     
    664867                mRayQueue.pop(); 
    665868                 
    666                 const int newSamples = AdaptiveBorderSampling(*ray); 
    667  
    668                 castSamples += newSamples; 
     869                castSamples += AdaptiveBorderSampling(*ray); 
    669870                // note: don't have to delete because handled by ray pool 
    670871        } 
    671872 
    672         /*if (mRayCaster->mVssRayPool.mIndex > mSamplesPerPass) 
    673         { 
    674                 cout << "warning: new samples: " << castSamples << " " << "queue: "  << (int)mRayQueue.size() << endl; 
    675                 Debug << "warning: new samples: " << castSamples << " " << "queue: "  << (int)mRayQueue.size() << endl; 
    676         }*/ 
     873        gvsTimer.Exit(); 
    677874 
    678875        return castSamples; 
     
    694891                { 
    695892                        if ((*rit)->mFlags & VssRay::BorderSample) 
    696                         { 
    697893                                vcRays.push_back(*rit); 
    698                         } 
    699894                        else if ((*rit)->mFlags & VssRay::ReverseSample) 
    700                         { 
    701895                                vcRays2.push_back(*rit); 
    702                         } 
    703896                        else 
    704                         { 
    705897                                vcRays3.push_back(*rit); 
    706                         }        
    707                 } 
     898                }  
    708899        } 
    709900 
     
    719910        Material m; 
    720911         
    721         char str[64]; sprintf(str, "pass%06d.wrl", mProcessedViewCells); 
     912        char str[64]; sprintf_s(str, "pass%06d.wrl", mProcessedViewCells); 
    722913 
    723914        Exporter *exporter = Exporter::GetExporter(str); 
     
    8801071void GvsPreprocessor::ComputeViewCellGeometryIntersection() 
    8811072{ 
     1073        intersectionTimer.Entry(); 
     1074 
    8821075        AxisAlignedBox3 box = mCurrentViewCell->GetBox(); 
    8831076 
     
    9271120 
    9281121        cout << "added " << (int)mTrianglePvs.size() - oldTrianglePvs << " triangles (" << newKdObj << " objects) by intersection" << endl; 
     1122 
     1123        intersectionTimer.Exit(); 
    9291124} 
    9301125 
     
    9341129        while (mCurrentViewCell = NextViewCell()) 
    9351130        { 
    936                 // hack: reset counters 
     1131                preparationTimer.Entry(); 
     1132 
     1133                // hack: reset counters (could be done with a mailing-like approach 
    9371134                ObjectContainer::const_iterator oit, oit_end = mObjects.end(); 
    938  
    9391135                for (oit = mObjects.begin(); oit != oit_end; ++ oit) 
    9401136                        (*oit)->mCounter = NOT_ACCOUNTED_OBJECT; 
    9411137 
     1138                preparationTimer.Exit(); 
     1139 
    9421140                mDistribution->SetViewCell(mCurrentViewCell); 
     1141 
    9431142        ComputeViewCell(); 
    9441143        } 
     
    10411240{ 
    10421241        int passSamples = 0; 
     1242        int randomSamples = 0; 
     1243        int gvsSamples = 0; 
    10431244        int oldContribution = 0; 
    10441245 
     
    10461247        { 
    10471248                mRayCaster->InitPass(); 
     1249 
     1250                int newRandomSamples, newGvsSamples; 
    10481251 
    10491252                // Ray queue empty =>  
    10501253                // cast a number of uniform samples to fill ray queue 
    1051                 int newSamples = CastInitialSamples(mInitialSamples); 
    1052  
     1254                newRandomSamples = CastInitialSamples(mInitialSamples); 
     1255                 
    10531256                if (!mOnlyRandomSampling) 
    1054                         newSamples += ProcessQueue(); 
    1055  
    1056                 passSamples += newSamples; 
    1057                 mGvsStats.mTotalSamples += newSamples; 
     1257                        newGvsSamples = ProcessQueue(); 
     1258 
     1259                passSamples += newRandomSamples + newGvsSamples; 
     1260                mGvsStats.mTotalSamples += newRandomSamples + newGvsSamples; 
     1261 
     1262                mGvsStats.mRandomSamples += newRandomSamples; 
     1263                mGvsStats.mGvsSamples += newGvsSamples; 
     1264 
    10581265 
    10591266                if (passSamples % (mGvsSamplesPerPass + 1) == mGvsSamplesPerPass) 
     
    10621269 
    10631270                        mGvsStats.mPassContribution = mGvsStats.mTotalContribution - oldContribution; 
    1064  
     1271                         
    10651272                        //////// 
    10661273                        //-- stats 
     
    12201427void GvsPreprocessor::ComputeViewCell() 
    12211428{ 
    1222         //if (mCurrentViewCell->GetId() != 499) return; 
    1223  
    1224         // clean up 
     1429        const long startTime = GetTime(); 
     1430 
     1431        // initialise 
     1432        mGvsStats.mPerViewCellSamples = 0; 
     1433 
     1434        int oldContribution = 0; 
     1435        int passSamples = 0; 
     1436        for (int i = 0; i < 0; ++ i) 
     1437                mGenericStats[i] = 0; 
     1438 
    12251439        mTrianglePvs.clear(); 
    12261440 
     1441 
     1442        // hack: take bounding box of view cell as view cell bounds 
    12271443        mCurrentViewCell->GetMesh()->ComputeBoundingBox(); 
    12281444 
     1445        // use mailing for kd node pvs 
    12291446        KdNode::NewMail(); 
    1230  
    1231         const long startTime = GetTime(); 
    12321447 
    12331448        cout << "\n***********************\n"  
     
    12361451        cout << "bb: " << mCurrentViewCell->GetBox() << endl; 
    12371452 
    1238         mGvsStats.mPerViewCellSamples = 0; 
    1239  
    1240         int oldContribution = 0; 
    1241         int passSamples = 0; 
    1242          
    1243         for (int i = 0; i < 0; ++ i) 
    1244                 mGenericStats[i] = 0; 
     1453        mainLoopTimer.Entry(); 
    12451454 
    12461455        while (1) 
    12471456        { 
     1457                sInvalidSamples = 0; 
    12481458                int oldPvsSize = mCurrentViewCell->GetPvs().GetSize(); 
    12491459                 
    12501460                mRayCaster->InitPass(); 
    12511461 
     1462                int newRandomSamples, newGvsSamples, newSamples; 
     1463 
    12521464                // Ray queue empty =>  
    12531465                // cast a number of uniform samples to fill ray queue 
    1254                 int newSamples = CastInitialSamples(mInitialSamples); 
    1255  
     1466                newRandomSamples = CastInitialSamples(mInitialSamples); 
     1467                 
    12561468                if (!mOnlyRandomSampling) 
    1257                 { 
    1258                         int samplesPerRun = ProcessQueue(); 
    1259                         newSamples += samplesPerRun; 
    1260                         //if (samplesPerRun > 0) cout << "spr: " << samplesPerRun << " "; 
    1261                 } 
     1469                        newGvsSamples = ProcessQueue(); 
     1470 
     1471                newSamples = newRandomSamples + newGvsSamples; 
    12621472 
    12631473                passSamples += newSamples; 
    1264         mGvsStats.mPerViewCellSamples += newSamples; 
     1474                mGvsStats.mPerViewCellSamples += newSamples; 
     1475 
     1476                mGvsStats.mRandomSamples += newRandomSamples; 
     1477                mGvsStats.mGvsSamples += newGvsSamples; 
     1478 
    12651479 
    12661480                if (passSamples >= mGvsSamplesPerPass) 
     
    13031517        } 
    13041518         
     1519        mainLoopTimer.Exit(); 
     1520 
    13051521        // at last compute objects that directly intersect view cell 
    13061522        ComputeViewCellGeometryIntersection(); 
    1307  
    13081523                 
     1524 
    13091525        //////// 
    13101526        //-- stats 
     
    13211537        // compute pvs size using larger (bvh objects) 
    13221538        // note: for kd pvs we had to do this during gvs computation 
    1323  
    13241539        if (!mUseKdPvs) 
    13251540        { 
     
    13431558                mGvsStats.mPvsCost = 0; // todo objectPvs.EvalPvsCost(); 
    13441559        } 
    1345         else if (0) 
    1346         { 
    1347                 //KdNode::NewMail(); 
    1348  
    1349                 // compute pvs kd nodes that intersect view cell 
     1560        else if (0) // compute pvs kd nodes that intersect view cell 
     1561        { 
    13501562                ObjectContainer mykdobjects; 
    13511563 
     
    13871599        mGvsStats.mTotalSamples += mGvsStats.mPerViewCellSamples; 
    13881600 
     1601        cout << "id: " << mCurrentViewCell->GetId() << " pvs cost: "  
     1602             << mGvsStats.mPvsCost << " pvs tri: " << mTrianglePvs.size() << endl; 
     1603 
     1604        cout << "invalid samples ratio: " << (float)sInvalidSamples / mGvsStats.mPerViewCellSamples << endl; 
     1605 
     1606        float rayTime = rayTimer.TotalTime(); 
     1607        float kdPvsTime = kdPvsTimer.TotalTime(); 
     1608        float gvsTime = gvsTimer.TotalTime(); 
     1609        float initialTime = initialTimer.TotalTime(); 
     1610        float intersectionTime = intersectionTimer.TotalTime(); 
     1611        float preparationTime = preparationTimer.TotalTime(); 
     1612        float mainLoopTime = mainLoopTimer.TotalTime(); 
     1613        float contributionTime = contributionTimer.TotalTime(); 
     1614        float castTime = castTimer.TotalTime(); 
     1615        float generationTime = generationTimer.TotalTime(); 
     1616 
     1617        cout << "handleRay              : " << rayTime << endl; 
     1618        cout << "kd pvs                 : " << kdPvsTime << endl; 
     1619        cout << "gvs sampling           : " << gvsTime << endl; 
     1620        cout << "initial sampling       : " << initialTime << endl; 
     1621        cout << "view cell intersection : " << intersectionTime << endl; 
     1622        cout << "preparation            : " << preparationTime << endl; 
     1623        cout << "main loop              : " << mainLoopTime << endl; 
     1624        cout << "has contribution       : " << contributionTime << endl; 
     1625        cout << "cast time              : " << castTime << endl; 
     1626        cout << "generation time       : " << generationTime << endl; 
     1627 
     1628        float randomRaysPerSec = mGvsStats.mRandomSamples / (1e6f * initialTime); 
     1629        float gvsRaysPerSec = mGvsStats.mGvsSamples / (1e6f * gvsTime); 
     1630 
     1631        cout << "cast " << randomRaysPerSec << " M random rays/s: " << endl; 
     1632        cout << "cast " << gvsRaysPerSec << " M gvs rays/s: " << endl; 
     1633         
    13891634        mGvsStats.Stop(); 
    13901635        mGvsStats.Print(mGvsStatsStream); 
    13911636 
    1392         cout << "id: " << mCurrentViewCell->GetId() << " pvs cost: "  
    1393              << mGvsStats.mPvsCost << " pvs tri: " << mTrianglePvs.size() << endl; 
    1394 } 
    1395  
    1396  
    1397 ObjectContainer triangles; 
     1637} 
     1638 
     1639 
    13981640 
    13991641int GvsPreprocessor::ConvertObjectPvs() 
    14001642{ 
     1643        static ObjectContainer triangles; 
     1644 
    14011645        int newObjects = 0; 
    14021646 
  • GTP/trunk/Lib/Vis/Preprocessing/src/GvsPreprocessor.h

    r2705 r2726  
    3939                mGvsRuns = 0; 
    4040 
     41                mRandomSamples = 0; 
     42                mGvsSamples = 0; 
    4143                mTotalPvs = 0; 
    4244                mViewCells = 0; 
     
    5456public: 
    5557 
     58        int mRandomSamples; 
     59        int mGvsSamples; 
    5660        int mPass; 
    5761        int mTotalSamples; 
     
    141145                b) if triangle was found reverse sampling 
    142146        */ 
    143         bool HandleRay(VssRay *ray); 
     147        inline bool HandleRay(VssRay *ray); 
    144148 
    145149        /** The adaptive border sampling step. It aims to find neighbouring  
     
    157161                                                        const VssRay &oldRay); 
    158162 
     163        bool ReverseSampling2(const VssRay &currentRay, 
     164                          const Triangle3 &hitTriangle, 
     165                                                  const VssRay &oldRay, 
     166                                                  VssRayContainer &reverseRays); 
     167 
    159168        /** Returns true if we sampled a closer triangle than with the previous ray.  
    160169                Does reverse sampling if gap found. 
     
    167176                with respect to the previous ray. 
    168177        */ 
    169         void EnqueueRays(VssRayContainer &samples, VssRayContainer &invalidSamples); 
     178        void EnqueueRays(VssRayContainer &samples); 
    170179 
    171180        /** Hepler function for adaptive border sampling. It finds  
     
    239248        */ 
    240249        void UpdateStatsForVisualization(KdIntersectable *kdInt); 
     250         
     251        void CompileViewCellsFromPointList(); 
     252 
     253        void ComputeStats(); 
     254 
     255        int ConvertObjectPvs(); 
    241256        /** Keep count of new objects for stats. Returns number of new pvs entries. 
    242257        */ 
    243         int CountObject(Intersectable *triObj); 
    244  
    245         void CompileViewCellsFromPointList(); 
    246  
    247         bool AddTriangleObject(Intersectable *triObj); 
    248  
    249         void ComputeStats(); 
    250  
    251         int ConvertObjectPvs(); 
     258        inline int CountObject(Intersectable *triObj); 
     259 
     260        inline bool AddTriangleObject(Intersectable *triObj); 
     261 
     262        inline void AddKdNodeToPvs(const Vector3 &termination); 
    252263 
    253264 
  • GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.cpp

    r2724 r2726  
    966966                                                   SimpleRayContainer &rays) 
    967967{ 
    968   return strategy.GenerateSamples(number, rays); 
     968        int invalidSamples; 
     969        return strategy.GenerateSamples(number, rays, invalidSamples); 
     970} 
     971 
     972 
     973int Preprocessor::GenerateRays(const int number, 
     974                                                           SamplingStrategy &strategy, 
     975                                                           SimpleRayContainer &rays, int &invalidSamples) 
     976{ 
     977        return strategy.GenerateSamples(number, rays, invalidSamples); 
    969978} 
    970979 
     
    975984                                                   SimpleRayContainer &rays) 
    976985{ 
    977         const int startSize = (int)rays.size(); 
    978986        SamplingStrategy *strategy = GenerateSamplingStrategy(sampleType); 
     987         
     988        if (!strategy) 
     989                return 0; 
     990 
    979991        int castRays = 0; 
    980  
    981         if (!strategy) 
    982         { 
    983                 return 0; 
    984         } 
    985  
     992        int invalidSamples; 
    986993#if 1 
    987         castRays = strategy->GenerateSamples(number, rays); 
     994        castRays = strategy->GenerateSamples(number, rays, invalidSamples); 
    988995#else 
    989996        GenerateRayBundle(rays, newRay, 16, 0); 
     
    11971204 
    11981205        // !!!!!!!!!!!!!!!! VH no sorting 
    1199         if ( 
    1200                 rays.size() > 10000 
    1201                 ) 
     1206        if (rays.size() > 10000) 
    12021207        { 
    12031208                mRayCaster->SortRays(rays); 
     
    13161321 
    13171322 
    1318 bool Preprocessor::GenerateRayBundle(SimpleRayContainer &rayBundle,                                                                      
    1319                                                                          const SimpleRay &mainRay, 
    1320                                                                          const int number, 
    1321                                                                          const int pertubType) const 
    1322 { 
    1323         rayBundle.push_back(mainRay); 
    1324  
    1325         const float pertubOrigin = 0.0f; 
    1326         const float pertubDir = 0.2f; 
    1327  
    1328         for (int i = 0; i < number - 1; ++ i) 
    1329         { 
    1330                 Vector3 pertub; 
    1331  
    1332                 pertub.x = RandomValue(0.0f, pertubDir); 
    1333                 pertub.y = RandomValue(0.0f, pertubDir); 
    1334                 pertub.z = RandomValue(0.0f, pertubDir); 
    1335  
    1336                 const Vector3 newDir = mainRay.mDirection + pertub; 
     1323bool Preprocessor::GenerateJitteredRays(SimpleRayContainer &rayBundle,   
     1324                                                                                const SimpleRay &mainRay, 
     1325                                                                                int number, 
     1326                                                                                int pertubType) const 
     1327{ 
     1328        //rayBundle.push_back(mainRay); 
     1329        //const float pertubOrigin = 0.0f; 
     1330        const float pertubDir = 0.01f; 
     1331        Vector3 pertub; 
     1332 
     1333        for (int i = 0; i < number; ++ i) 
     1334        { 
     1335                pertub.x = RandomValue(-pertubDir, pertubDir); 
     1336                pertub.y = RandomValue(-pertubDir, pertubDir); 
     1337                pertub.z = RandomValue(-pertubDir, pertubDir); 
     1338 
     1339                Vector3 newDir = mainRay.mDirection + pertub; 
     1340                const float c = Magnitude(newDir); 
     1341                newDir *= 1.0f / c; 
     1342 
    13371343                //const Vector3 newDir = mainRay.mDirection; 
    1338  
     1344#if 0 
    13391345                pertub.x = RandomValue(0.0f, pertubOrigin); 
    13401346                pertub.y = RandomValue(0.0f, pertubOrigin); 
     
    13421348 
    13431349                const Vector3 newOrigin = mainRay.mOrigin + pertub; 
    1344                 //const Vector3 newOrigin = mainRay.mOrigin; 
     1350#endif 
     1351                const Vector3 newOrigin = mainRay.mOrigin; 
    13451352 
    13461353                rayBundle.push_back(SimpleRay(newOrigin, newDir, 0, 1.0f)); 
  • GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.h

    r2720 r2726  
    132132                                                         SimpleRayContainer &rays); 
    133133 
     134        virtual int     GenerateRays(const int number, 
     135                                                         SamplingStrategy &strategy, 
     136                                                         SimpleRayContainer &rays,  
     137                                                         int &invalidSamples); 
     138 
    134139        virtual int GenerateRays(const int number, 
    135140                                                         const int raysType, 
    136141                                                         SimpleRayContainer &rays); 
    137142 
    138         bool GenerateRayBundle(SimpleRayContainer &rayBundle, 
    139                                                   const SimpleRay &mainRay, 
    140                                                    const int number, 
    141                                                    const int shuffleType) const; 
     143        bool GenerateJitteredRays(SimpleRayContainer &rayBundle, 
     144                                                        const SimpleRay &mainRay, 
     145                                                        int number, 
     146                                                        int shuffleType) const; 
    142147 
    143148        virtual void CastRays(SimpleRayContainer &rays, 
  • GTP/trunk/Lib/Vis/Preprocessing/src/RssPreprocessor.cpp

    r2105 r2726  
    492492           
    493493        } else { 
     494                int invalidSamples = 0; 
    494495          for (int i=0; i < mInitialSamples; i+=batch) { 
    495496                rays.clear(); 
    496497                mVssRays.clear(); 
    497                 mMixtureDistribution->GenerateSamples(batch, rays); 
     498                mMixtureDistribution->GenerateSamples(batch, rays, invalidSamples); 
    498499                CastRays(rays, mVssRays, true, pruneInvalidRays); 
    499500                mMixtureDistribution->ComputeContributions(mVssRays); 
  • GTP/trunk/Lib/Vis/Preprocessing/src/SamplingStrategy.cpp

    r2698 r2726  
    5454 
    5555int 
    56 SamplingStrategy::GenerateSamples(const int number, 
    57                                                                   SimpleRayContainer &rays) 
     56SamplingStrategy::GenerateSamples(int number, 
     57                                                                  SimpleRayContainer &rays,  
     58                                                                  int &invalidSamples) 
    5859{ 
    5960        SimpleRay ray; 
    60         int samples = 0; 
    61         int i = 0; 
    62         const int maxTries = 20; 
     61        int oldSamples = (int)rays.size(); 
     62         
     63        static const int maxTries = 20; 
     64 
    6365        // tmp changed matt. Q: should one rejected sample  
    6466        // terminate the whole method? 
    65         for (; i < number; i++)  
     67        for (int i = 0; i < number; ++ i)  
    6668        { 
    67                 int j = 0; 
    68                 bool sampleGenerated = false; 
    69  
    70                 for (j = 0; !sampleGenerated && (j < maxTries); ++ j) 
     69                for (int j = 0; j < maxTries; ++ j) 
    7170                { 
    72                         sampleGenerated = GenerateSample(ray); 
    73  
    74                         if (sampleGenerated) 
     71                        if (GenerateSample(ray)) 
    7572                        {                
    76                                 ++ samples; 
    7773                                rays.push_back(ray); 
    78                                 //cout << "d " << ray.mDirection << " "; 
     74                                break; 
    7975                        } 
     76                        cerr<<"x"; 
     77                        ++ invalidSamples; 
    8078                } 
    8179        } 
    8280 
    83         return samples; 
     81        return (int)rays.size() - oldSamples; 
    8482} 
    8583 
     
    722720 
    723721int 
    724 MixtureDistribution::GenerateSamples(const int number, 
    725                                                                          SimpleRayContainer &rays) 
     722MixtureDistribution::GenerateSamples(int number, 
     723                                                                         SimpleRayContainer &rays, 
     724                                                                         int &invalidSamples) 
    726725{ 
    727726  for (int i=0; i < mDistributions.size(); i++)  
    728727        mDistributions[i]->mGeneratedRays = 0; 
    729728 
    730   return SamplingStrategy::GenerateSamples(number, rays); 
     729  return SamplingStrategy::GenerateSamples(number, rays, invalidSamples); 
    731730} 
    732731 
     
    804803bool ViewCellBasedDistribution::GenerateSample(SimpleRay &ray) 
    805804{ 
    806         Vector3 origin, direction;  
    807  
    808         Vector3 point; 
    809         Vector3 normal; 
    810                  
    811         float r[2]; 
    812         //for (int i=0; i < 2; i++) 
    813         // r[i] = RandomValue(0, 1); 
    814  
    815805        sHalton.GetNext(2, r); 
    816  
    817806        direction = UniformRandomVector(r[0], r[1]); 
     807         
     808#if 0 
    818809        const float c = Magnitude(direction); 
    819810 
     811        if (!((c < 1.00001f) && (c > 0.999999f))) 
     812                cerr << "len wrong" << endl; 
    820813    if (c <= Limits::Small)  
    821814                return false; 
    822815 
    823816        direction *= 1.0f / c; 
     817#endif 
    824818 
    825819        // get point on view cell surface 
    826         if (0) 
     820        if (1) 
    827821        { 
    828822                //mViewCell->GetRandomEdgePoint(origin, normal); 
    829                 mViewCell->GetRandomSurfacePoint(origin, normal); 
     823                origin = mViewCell->GetBox().GetRandomSurfacePoint(); 
    830824 
    831825                // move a little bit back to avoid piercing through walls 
    832826                // that bound the view cell 
    833                 if (0) origin -= 0.01f * normal; 
     827                //origin -= 0.01f * normal; 
    834828        } 
    835829        else 
    836830                origin = mViewCell->GetBox().GetUniformRandomSurfacePoint(); 
    837831 
    838         //direction = point - origin; 
    839  
    840         // $$ jb the pdf is yet not correct for all sampling methods! 
    841         const float pdf = 1.0f; 
     832        static const float pdf = 1.0f; 
    842833 
    843834        ray = SimpleRay(origin, direction, VIEWCELL_BASED_DISTRIBUTION, pdf); 
  • GTP/trunk/Lib/Vis/Preprocessing/src/SamplingStrategy.h

    r2694 r2726  
    77#include "common.h" 
    88#include "Halton.h" 
     9#include "Vector3.h" 
     10 
    911namespace GtpVisibilityPreprocessor { 
    1012 
     
    5961        virtual ~SamplingStrategy(); 
    6062 
     63        virtual int GenerateSamples(int number, SimpleRayContainer &rays, int &invalidSamples); 
    6164        /** Each strategy has to implement this function. 
    62         @returns true if generated valid sample. 
     65                @returns true if generated valid sample. 
    6366        */ 
    64  
    65         virtual int GenerateSamples(const int number, SimpleRayContainer &rays); 
    66  
    6767        virtual bool GenerateSample(SimpleRay &ray) = 0; 
    6868 
     
    262262 
    263263        ViewCell *mViewCell; 
     264 
     265        Vector3 origin; 
     266        Vector3 direction;  
     267        Vector3 point; 
     268        Vector3 normal; 
     269        float r[2]; 
     270 
    264271        static HaltonSequence sHalton; 
    265272}; 
     
    307314  } 
    308315   
    309   virtual int GenerateSamples(const int number, SimpleRayContainer &rays); 
     316  virtual int GenerateSamples(int number, SimpleRayContainer &rays, int &invalidSamples); 
    310317   
    311318private: 
  • GTP/trunk/Lib/Vis/Preprocessing/src/SimpleRay.h

    r2588 r2726  
    5555  SimpleRay(const Vector3 &o, 
    5656                        const Vector3 &d, 
    57                         const unsigned char distribution, 
    58                         const float weight, 
    59                         const unsigned char flags = F_BIDIRECTIONAL 
     57                        unsigned char distribution, 
     58                        float weight, 
     59                        unsigned char flags = F_BIDIRECTIONAL 
    6060                        ): 
    6161    mOrigin(o), 
  • GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp

    r2723 r2726  
    137137        //rays.clear(); 
    138138        //passSamples.clear(); 
    139          
    140         mMixtureDistribution->GenerateSamples(samplesPerPass, rays); 
     139        int invalidSamples = 0; 
     140        mMixtureDistribution->GenerateSamples(samplesPerPass, rays, invalidSamples); 
    141141         
    142142        const bool doubleRays = true; 
  • GTP/trunk/Lib/Vis/Preprocessing/src/common.h

    r2705 r2726  
    538538 
    539539 
    540 #define QT_VISUALIZATION_SHOWN 1 
    541  
    542  
    543 #endif 
    544  
    545  
    546  
    547  
    548  
    549  
    550  
    551  
     540#define QT_VISUALIZATION_SHOWN 0 
     541 
     542 
     543#endif 
     544 
     545 
     546 
     547 
     548 
     549 
     550 
     551 
Note: See TracChangeset for help on using the changeset viewer.