Changeset 2743 for GTP


Ignore:
Timestamp:
06/09/08 10:36:36 (16 years ago)
Author:
mattausch
Message:
 
Location:
GTP/trunk/Lib/Vis/Preprocessing
Files:
18 edited

Legend:

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

    r2742 r2743  
    1818SCENE=../data/vienna/city_full_hp.obj 
    1919#SCENE=../data/vienna/vienna_rep.obj 
    20 SCENE=../data/vienna/vienna_cropped.obj 
     20#SCENE=../data/vienna/vienna_cropped.obj 
    2121 
    2222VIEWCELLS=../data/vienna/vienna_cropped-gradient-viewcells.xml.gz  
     
    3838-preprocessor=gvs \ 
    3939-preprocessor_use_vbos- \ 
    40 -gvs_epsilon=0.0001 \ 
     40-gvs_epsilon=0.001 \ 
    4141-gvs_total_samples=1000000 \ 
    4242-gvs_samples_per_pass=1000000 \ 
    43 -gvs_initial_samples=16 \ 
     43-gvs_initial_samples=128 \ 
    4444-gvs_max_viewcells=1 \ 
    45 -gvs_min_contribution=20 \ 
     45-gvs_min_contribution=200 \ 
    4646-gvs_per_viewcell=true \ 
     47-gvs_threshold=0.5 \ 
    4748-gvs_radius_of_influence=5.0 \ 
    48 -gvs_use_deterministic_gvs+ \ 
     49-gvs_use_deterministic_gvs- \ 
    4950-gvs_initial_jitter=0.1 \ 
    5051-preprocessor_detect_empty_viewspace+ \ 
  • GTP/trunk/Lib/Vis/Preprocessing/src/Exporter.h

    r2176 r2743  
    3939protected: 
    4040  std::string mFilename; 
    41   bool mWireframe; 
     41  bool mWireFrame; 
    4242  bool mUseForcedMaterial; 
    4343  Material mForcedMaterial; 
     
    4949  Exporter(const std::string filename):  
    5050                                  mFilename(filename), 
    51                                   mWireframe(false), 
     51                                  mWireFrame(false), 
    5252                                  mUseForcedMaterial(false), 
    5353                                  mExportRayDensity(false), 
     
    139139  void SetExportRayDensity(const bool d) { mExportRayDensity = d; } 
    140140   
    141   void SetWireframe() { mWireframe = true; } 
    142   void SetFilled() { mWireframe = false; } 
     141  void SetWireframe() { mWireFrame = true; } 
     142  void SetFilled() { mWireFrame = false; } 
    143143   
    144144  void SetForcedMaterial(const Material &m)  
  • GTP/trunk/Lib/Vis/Preprocessing/src/GlRenderer.cpp

    r2742 r2743  
    432432        } 
    433433} 
     434 
    434435         
    435436void GlRenderer::InitGL() 
     
    465466 
    466467        for (; ni != interior->mChildren.end(); ni++)  
    467         { 
    468468                CreateVertexArrays(static_cast<SceneGraphLeaf *>(*ni)); 
    469         } 
    470469} 
    471470 
     
    474473GlRenderer::SetupProjection(const int w, const int h, const float angle) 
    475474{ 
    476   glViewport(0, 0, w, h); 
    477   glMatrixMode(GL_PROJECTION); 
    478   glLoadIdentity(); 
    479   gluPerspective(angle, 1.0, 0.1, 2.0*Magnitude(mSceneGraph->GetBox().Diagonal())); 
    480   glMatrixMode(GL_MODELVIEW); 
     475        glViewport(0, 0, w, h); 
     476        glMatrixMode(GL_PROJECTION); 
     477        glLoadIdentity(); 
     478        gluPerspective(angle, 1.0, 1.0f, 2.0 * Magnitude(mSceneGraph->GetBox().Diagonal())); 
     479        glMatrixMode(GL_MODELVIEW); 
    481480} 
    482481 
     
    592591        ++ mCurrentFrame; 
    593592 
    594         Intersectable::NewMail(); 
     593        //Intersectable::NewMail(); 
    595594 
    596595        Preprocessor *p = mViewCellsManager->GetPreprocessor(); 
     
    600599 
    601600        for (dit = p->mDynamicObjects.begin(); dit != dit_end; ++ dit) 
    602         { 
    603601                _RenderDynamicObject(*dit); 
    604         } 
    605602 
    606603        _RenderSceneTrianglesWithDrawArrays(); 
     
    16761673        glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); 
    16771674        glDepthMask(GL_TRUE); 
    1678         glEnable( GL_CULL_FACE ); 
     1675        glEnable(GL_CULL_FACE); 
    16791676 
    16801677        //      int wait = 0; 
     
    17041701void GlRenderer::RenderViewPoint() 
    17051702{ 
    1706         mWireFrame = true; 
     1703        //mWireFrame = true; 
    17071704        glPushMatrix(); 
    17081705        glTranslatef(mViewPoint.x, mViewPoint.y, mViewPoint.z); 
     
    17141711        glPopAttrib(); 
    17151712        glPopMatrix(); 
    1716         mWireFrame = false; 
     1713        //mWireFrame = false; 
    17171714} 
    17181715 
     
    18011798        glNormalPointer(GL_FLOAT, 0, (char *)arrayPtr + offset * sizeof(Vector3)); 
    18021799         
    1803         glDrawElements(GL_TRIANGLES, leaf->mIndexBufferSize, GL_UNSIGNED_INT, mIndices + leaf->mIndexBufferStart); 
     1800        glDrawElements(GL_TRIANGLES, leaf->mIndexBufferSize, GL_UNSIGNED_INT,  
     1801                           mIndices + leaf->mIndexBufferStart); 
    18041802} 
    18051803 
    18061804#endif 
    1807  
    18081805 
    18091806 
  • GTP/trunk/Lib/Vis/Preprocessing/src/GlRenderer.h

    r2736 r2743  
    247247 
    248248        Preprocessor *GetPreprocessor(); 
    249  
     249        /** quick hack in order to be able to render gvs based triangle pvs. 
     250        */ 
     251        void RenderTrianglePvs(); 
     252 
     253        void RenderVisTriangles(); 
     254 
     255 
     256        /////////////////// 
    250257 
    251258        vector<PvsErrorEntry> mPvsErrorBuffer; 
  • GTP/trunk/Lib/Vis/Preprocessing/src/GtpVisibility05.vcproj

    r2729 r2743  
    318318                </Filter> 
    319319                <Filter 
    320                         Name="Renderer" 
     320                        Name="renderer" 
    321321                        > 
    322322                        <File 
     
    342342                </Filter> 
    343343                <Filter 
    344                         Name="Loader" 
     344                        Name="loader" 
    345345                        > 
    346346                        <File 
     
    438438                </Filter> 
    439439                <Filter 
    440                         Name="Preprocessors" 
     440                        Name="preprocessors" 
    441441                        > 
    442442                        <File 
     
    502502                </Filter> 
    503503                <Filter 
    504                         Name="Exporters" 
     504                        Name="exporters" 
    505505                        > 
    506506                        <File 
  • GTP/trunk/Lib/Vis/Preprocessing/src/GvsPreprocessor.cpp

    r2742 r2743  
    2222{ 
    2323   
    24 #define GVS_DEBUG 0 
     24#define GVS_DEBUG 1 
    2525#define NOT_ACCOUNTED_OBJECT 0 
    2626#define ACCOUNTED_OBJECT 2 
    27  
    28  
    29 static const float MIN_DIST = 0.001f; 
     27#define USE_REVERSE_SAMPLING 1 
     28#define USE_SUBDIVISION 1 
     29 
     30static const float MIN_DIST = 1e-8f; 
    3031 
    3132static ObjectContainer myobjects; 
    3233static int sInvalidSamples = 0; 
    33  
     34static VizStruct currentViz; 
    3435 
    3536 
     
    5354 
    5455 
    55 /** Visualization structure for the GVS algorithm. 
    56 */ 
    57 struct VizStruct 
    58 { 
    59         Polygon3 *enlargedTriangle; 
    60         Triangle3 originalTriangle; 
    61         VssRay *ray; 
    62 }; 
    63  
    64 static vector<VizStruct> vizContainer; 
    65  
    6656 
    6757 
     
    216206 
    217207 
    218 int GvsPreprocessor::CheckDiscontinuity2(const VssRay &currentRay, 
    219                                                                                  const Triangle3 &hitTriangle, 
    220                                                                                  const VssRay &oldRay) 
     208bool GvsPreprocessor::CheckDiscontinuity2(const VssRay &currentRay, 
     209                                                                                  const Triangle3 &hitTriangle, 
     210                                                                                  const VssRay &oldRay, 
     211                                                                                  SimpleRay &reverseRay) 
    221212{ 
    222213        // the predicted hitpoint is the point where the ray would have intersected the hit triangle 
     
    229220        // => this is likely to be a discontinuity 
    230221        if (fabs(predictedLen - len) < mThreshold) 
    231                 return 0; 
    232  
    233         static SimpleRayContainer simpleRays; 
    234         simpleRays.clear(); 
    235  
    236         CreateRandomizedReverseRays(currentRay, predictedHit, simpleRays, 16, hitTriangle); 
    237  
    238         static VssRayContainer reverseRays; 
    239         reverseRays.clear(); 
    240         CastRays(simpleRays, reverseRays, false, false); 
    241  
    242         mGvsStats.mReverseSamples += (int)reverseRays.size(); 
    243  
    244         EnqueueRays(reverseRays); 
    245  
    246         return (int)reverseRays.size(); 
     222                return false; 
     223 
     224        return CreateRandomizedReverseRay(currentRay, predictedHit, reverseRay, hitTriangle); 
    247225} 
    248226 
     
    353331        } 
    354332         
    355         if (0 && GVS_DEBUG) 
    356                 mVssRays.push_back(new VssRay(*vssRay)); 
     333        if (GVS_DEBUG) 
     334        { 
     335                if (mVssRays.size() < 1000) 
     336                        mVssRays.push_back(new VssRay(*vssRay)); 
     337        } 
    357338 
    358339        // add new ray to ray queue 
     
    361342        ++ mGvsStats.mTotalContribution; 
    362343 
    363         if (mRayQueue.size() % 10000 == 0) 
     344        if (mRayQueue.size() % 50000 == 0) 
    364345                cout << "ray queue size: " << mRayQueue.size() << endl; 
    365346 
     
    376357                                                                                          const Triangle3 &hitTriangle, 
    377358                                                                                          const VssRay &ray,  
    378                                                                                           const int index) const 
     359                                                                                          int index) const 
    379360{ 
    380361        const int indexU = (index + 1) % 3; 
    381         const int indexL = (index == 0) ? 2 : index - 1; 
    382  
    383         const Vector3 a = hitTriangle.mVertices[index] - ray.GetOrigin(); 
    384         const Vector3 b = hitTriangle.mVertices[indexU] - hitTriangle.mVertices[index]; 
    385         const Vector3 c = hitTriangle.mVertices[index] - hitTriangle.mVertices[indexL]; 
     362        const int indexL = (index - 1) % 3; //(index == 0) ? 2 : index - 1; 
     363 
     364        const Vector3 v  = hitTriangle.mVertices[index]; 
     365        const Vector3 vu = hitTriangle.mVertices[indexU]; 
     366        const Vector3 vl = hitTriangle.mVertices[indexL]; 
     367 
     368        const Vector3 a = v - ray.GetOrigin(); 
     369        const Vector3 b = vu - v; 
     370        const Vector3 c = v - vl; 
    386371         
    387372        const float len = Magnitude(a); 
    388          
    389         const Vector3 dir1 = Normalize(CrossProd(a, b)); //N((pi-xp)×(pi+1- pi)); 
    390         const Vector3 dir2 = Normalize(CrossProd(a, c)); // N((pi-xp)×(pi- pi-1)) 
     373        //if (len > Limits::Small) a /= len; 
     374 
     375        const Vector3 dir1 = Normalize(CrossProd(a, b)); // N((pi-xp)×(pi+1 - pi)); 
     376        const Vector3 dir2 = Normalize(CrossProd(a, c)); // N((pi-xp)×(pi - pi-1)) 
    391377        const Vector3 dir3 = DotProd(dir2, dir1) > 0 ? // N((pi-xp)×di,i-1+di,i+1×(pi-xp)) 
    392378                Normalize(dir2 + dir1) : Normalize(CrossProd(a, dir1) + CrossProd(dir2, a));  
     379#if 1 
    393380 
    394381        // compute the new three hit points 
    395         // pi, i + 1:  pi+ e·|pi-xp|·di, j 
    396         const Vector3 pt1 = hitTriangle.mVertices[index] + mEps * len * dir1; 
    397         // pi, i - 1:  pi+ e·|pi-xp|·di, j 
    398     const Vector3 pt2 = hitTriangle.mVertices[index] + mEps * len * dir2; 
    399         // pi, i:  pi+ e·|pi-xp|·di, j 
    400         const Vector3 pt3 = hitTriangle.mVertices[index] + mEps * len * dir3; 
    401          
     382        // pi, i + 1:  pi + e·|pi-xp|·di, j 
     383        const Vector3 pt1 = v + mEps * len * dir1; 
     384        // pi, i - 1:  pi + e·|pi-xp|·di, j 
     385    const Vector3 pt2 = v + mEps * len * dir2; 
     386        // pi, i:      pi + e·|pi-xp|·di, j 
     387        const Vector3 pt3 = v + mEps * len * dir3; 
     388 
     389#else 
     390 
     391        const Vector3 pt1 = v + mEps * dir1; 
     392        // pi, i - 1:  pi + e·|pi-xp|·di, j 
     393    const Vector3 pt2 = v + mEps * dir2; 
     394        // pi, i:      pi + e·|pi-xp|·di, j 
     395        const Vector3 pt3 = v + mEps * dir3; 
     396 
     397#endif 
     398 
    402399        vertices.push_back(pt2); 
    403400        vertices.push_back(pt3); 
     
    431428 
    432429 
    433 static bool EqualVisibility(const VssRay &a, const VssRay &b) 
     430bool EqualVisibility(const VssRay &a, const VssRay &b) 
    434431{ 
    435432        return a.mTerminationObject == b.mTerminationObject; 
     
    442439                                                                   const VssRay &ray1,  
    443440                                                                   const VssRay &ray2, 
    444                                                                    const VssRay &oldRay) 
    445 { 
    446         //cout <<"y"<<Magnitude(p1 - p2) << " "; 
     441                                                                   const VssRay &oldRay, 
     442                                                                   int level) 
     443{ 
    447444        int castRays = 0; 
    448  
    449         if (EqualVisibility(ray1, ray2) || (SqrMagnitude(p1 - p2) <= MIN_DIST)) 
     445         
     446        if (EqualVisibility(ray1, ray2) || (SqrDistance(p1, p2) <= MIN_DIST)  || (level ++ > 10)) 
     447        { 
     448                //if (SqrMagnitude(p1 - p2) <= MIN_DIST) 
     449                //      cerr << "min dist reached!! " << SqrMagnitude(p1 - p2) << " " << MIN_DIST << " " << ray1.mTerminationObject << " " << ray2.mTerminationObject << " level: " << level << " " << EqualVisibility(ray1, ray2) << endl; 
     450 
    450451                return castRays; 
    451          
     452        } 
    452453 
    453454        // the new subdivision point 
    454455        const Vector3 p = (p1 + p2) * 0.5f; 
    455         //cout << "p: " << p << " " << p1 << " " << p2 << endl; 
    456  
     456         
    457457        SimpleRay sray(oldRay.mOrigin, p - oldRay.mOrigin, SamplingStrategy::GVS, 1.0f); 
    458458 
     
    469469 
    470470        if (!newRay) 
     471        { 
     472                //cout<<"w"; 
    471473                return castRays; 
     474        } 
    472475 
    473476        //newRay->mFlags |= VssRay::BorderSample; 
    474477 
    475478        // cast reverse rays if necessary 
    476         castRays += CheckDiscontinuity(*newRay, hitTriangle, oldRay); 
    477          
     479        if (USE_REVERSE_SAMPLING) castRays += CheckDiscontinuity(*newRay, hitTriangle, oldRay); 
     480         
     481        if (GVS_DEBUG) 
     482                currentViz.enlargedTriangle.push_back(p); 
     483 
    478484        // subdivide further 
    479         castRays += SubdivideEdge(hitTriangle, p1, p, ray1, *newRay, oldRay); 
    480         castRays += SubdivideEdge(hitTriangle, p, p2, *newRay, ray2, oldRay); 
     485        castRays += SubdivideEdge(hitTriangle, p1, p, ray1, *newRay, oldRay, level); 
     486        castRays += SubdivideEdge(hitTriangle, p, p2, *newRay, ray2, oldRay, level); 
    481487 
    482488        rayTimer.Entry(); 
     
    526532 
    527533                SimpleRay sr(currentRay.GetOrigin(), rayDir, SamplingStrategy::GVS, 1.0f); 
    528                 simpleRays.AddRay(sr);   
    529         } 
     534                simpleRays.AddRay(sr); 
     535        } 
     536 
     537        //if (rand() < RAND_MAX / 10)   cout << "o: " << currentRay.GetOrigin() << endl; 
    530538 
    531539        ////////// 
     
    560568        int castRays = (int)simpleRays.size(); 
    561569 
    562         if (0) 
    563         { 
    564                 // visualize enlarged triangles 
    565                 VizStruct dummy; 
    566                 dummy.enlargedTriangle = new Polygon3(enlargedTriangle); 
    567                 dummy.originalTriangle = hitTriangle; 
    568          
    569                 vizContainer.push_back(dummy); 
    570          
     570        if (GVS_DEBUG) 
     571        { 
     572                /*visTriangles.push_back(tObj); 
     573 
     574                for (int i = 0; i < 3; ++ i) 
     575                { 
     576                        Triangle3 t1(hitTriangle.mVertices[i], enlargedTriangle[3 * i + 0], enlargedTriangle[3 * i + 1]); 
     577                        Triangle3 t2(hitTriangle.mVertices[i], enlargedTriangle[3 * i + 1], enlargedTriangle[3 * i + 2]); 
     578 
     579                        TriangleIntersectable *to1 = new TriangleIntersectable(t1); to1->SetId(tObj->GetId()); 
     580                        TriangleIntersectable *to2 = new TriangleIntersectable(t2); to2->SetId(tObj->GetId()); 
     581 
     582                        visTriangles.push_back(to1); 
     583                        visTriangles.push_back(to2); 
     584                } 
     585                 
    571586                // set flags 
    572587                VssRayContainer::const_iterator rit, rit_end = vssRays.end(); 
    573          
     588 
    574589                for (rit = vssRays.begin(); rit != rit_end; ++ rit) 
    575590                        (*rit)->mFlags |= VssRay::BorderSample; 
    576         } 
    577 #if 0 
    578     // recursivly subdivide each edge 
    579         for (int i = 0; i < numBorderSamples; ++ i) 
    580         { 
    581                 castRays += CheckDiscontinuity(*vssRays[i], hitTriangle, currentRay); 
    582  
    583                 castRays += SubdivideEdge(hitTriangle, 
    584                                                                   enlargedTriangle[i],  
    585                                                                   enlargedTriangle[(i + 1) % numBorderSamples],  
    586                                                                   *vssRays[i],  
    587                                                                   *vssRays[(i + 1) % numBorderSamples], 
    588                                                                   currentRay); 
    589         } 
    590 #endif   
     591                */ 
     592 
     593                // visualize enlarged triangles 
     594                currentViz.enlargedTriangle = enlargedTriangle; 
     595                currentViz.originalTriangle = static_cast<TriangleIntersectable *>(tObj); 
     596        } 
     597         
     598        if (USE_SUBDIVISION) 
     599        { 
     600                //int oldsize = mTrianglePvs.size(); 
     601 
     602                // recursivly subdivide each edge 
     603                for (int i = 0; i < numBorderSamples; ++ i) 
     604                { 
     605                        if (USE_REVERSE_SAMPLING) 
     606                                castRays += CheckDiscontinuity(*vssRays[i], hitTriangle, currentRay); 
     607 
     608                        castRays += SubdivideEdge(hitTriangle, 
     609                                                      enlargedTriangle[i],  
     610                                                                          enlargedTriangle[(i + 1) % numBorderSamples],  
     611                                                                          *vssRays[i],  
     612                                                                          *vssRays[(i + 1) % numBorderSamples], 
     613                                                                          currentRay, 
     614                                                                          0); 
     615                } 
     616 
     617                //int newsize = mTrianglePvs.size();if(newsize - oldsize) mcout<<"found with subdiv: " << newsize - oldsize << endl; 
     618        } 
     619 
     620        if (GVS_DEBUG) 
     621                visTriangles.push_back(currentViz); 
     622 
    591623        mGvsStats.mBorderSamples += castRays; 
    592624         
     
    652684 
    653685#endif   
     686 
    654687        ////////// 
    655688        //-- fill up simple rays with random rays so we can cast 16 rays at a time 
    656689 
    657         const int numRandomRays = 16 - ((int)simpleRays.size() % 16); 
     690        const int numRandomRays = 128;//16 - ((int)simpleRays.size() % 16); 
    658691 
    659692        GenerateImportanceSamples(currentRay, hitTriangle, numRandomRays, simpleRays); 
     
    687720        int castRays = (int)simpleRays.size(); 
    688721 
    689 #if 0 
    690         for (size_t i = 0; i < vssRays.size(); ++ i) 
    691         { 
    692                 // check for discontinuity and cast reverse rays if necessary 
    693                 castRays += CheckDiscontinuity2(*vssRays[i], hitTriangle, currentRay); 
    694         } 
    695 #endif 
     722        mGvsStats.mBorderSamples += castRays; 
     723 
     724        if (USE_REVERSE_SAMPLING) 
     725        { 
     726                static SimpleRayContainer simpleRays; 
     727                simpleRays.clear(); 
     728 
     729                SimpleRay simpleRay; 
     730                for (size_t i = 0; i < vssRays.size(); ++ i) 
     731                { 
     732                        // check for discontinuity and cast reverse rays if necessary 
     733                        //castRays += CheckDiscontinuity2(*vssRays[i], hitTriangle, currentRay); 
     734                        if (CheckDiscontinuity2(*vssRays[i], hitTriangle, currentRay, simpleRay)) 
     735                                simpleRays.push_back(simpleRay); 
     736                } 
     737                 
     738                static VssRayContainer reverseRays; 
     739                reverseRays.clear(); 
     740                CastRays(simpleRays, reverseRays, false, false); 
     741 
     742                mGvsStats.mReverseSamples += (int)reverseRays.size(); 
     743         
     744                castRays +=(int)reverseRays.size(); 
     745        } 
     746 
    696747#if 0 
    697748 
     
    704755                                                                  *vssRays[i],  
    705756                                                                  *vssRays[(i + 1) % numBorderSamples], 
    706                                                                   currentRay); 
     757                                                                  currentRay, 0); 
    707758        } 
    708759         
    709760#endif 
    710  
    711  
    712         mGvsStats.mBorderSamples += castRays; 
    713761 
    714762        // handle cast rays 
     
    886934 
    887935        castTimer.Exit(); 
     936//for (int i = 0; i< simpleRays.size();++ i) 
     937//      if (rand() < RAND_MAX / 10)     cout << "o: " << simpleRays[i].mOrigin << endl; 
    888938 
    889939        // add to ray queue 
     
    922972        while (!mRayQueue.empty()) 
    923973        { 
     974                size_t oldContri = mTrianglePvs.size(); 
    924975                // handle next ray 
    925976                VssRay *ray = mRayQueue.top(); 
     
    927978                 
    928979                if (mUseDeterministicGvs) 
     980                { 
    929981                        castSamples += AdaptiveBorderSampling(*ray); 
     982                        mRayCaster->SheduleRayForDeletion(ray); 
     983                } 
    930984                else 
     985                { 
    931986                        castSamples += AdaptiveBorderSamplingOpt(*ray); 
     987 
     988                        // ray still gives contribution => enqeue again 
     989                        if ((mTrianglePvs.size() - oldContri) > 0) 
     990                        { 
     991                                mRayQueue.push(ray); 
     992                        } 
     993                        else 
     994                        { 
     995                                mRayCaster->SheduleRayForDeletion(ray); 
     996                        } 
     997                } 
     998 
     999 
    9321000        } 
    9331001 
     
    13741442                // provide list of view cells to compute 
    13751443                CompileViewCellsList(); 
    1376  
    13771444                // start per view cell gvs 
    13781445                PerViewCellComputation(); 
     
    13911458        if (GVS_DEBUG) 
    13921459        { 
    1393                 Visualize(); 
    13941460                CLEAR_CONTAINER(mVssRays); 
    13951461        } 
     
    14111477        // store triangle directly 
    14121478        mViewCellsManager->DeterminePvsObjects(rays, true); 
    1413 } 
    1414  
    1415  
    1416 void GvsPreprocessor::Visualize() 
    1417 { 
    1418         Exporter *exporter = Exporter::GetExporter("gvs.wrl"); 
    1419  
    1420         if (!exporter) 
    1421                 return; 
    1422          
    1423         vector<VizStruct>::const_iterator vit, vit_end = vizContainer.end(); 
    1424          
    1425         for (vit = vizContainer.begin(); vit != vit_end; ++ vit) 
    1426         { 
    1427                 exporter->SetWireframe(); 
    1428                 exporter->ExportPolygon((*vit).enlargedTriangle); 
    1429                 //Material m; 
    1430                 exporter->SetFilled(); 
    1431                 Polygon3 poly = Polygon3((*vit).originalTriangle); 
    1432                 exporter->ExportPolygon(&poly); 
    1433         } 
    1434  
    1435         VssRayContainer::const_iterator rit, rit_end = mVssRays.end(); 
    1436  
    1437         for (rit = mVssRays.begin(); rit != rit_end; ++ rit) 
    1438         { 
    1439                 Intersectable *obj = (*rit)->mTerminationObject; 
    1440                 exporter->ExportIntersectable(obj); 
    1441         } 
    1442  
    1443         ExportVssRays(exporter, mVssRays); 
    1444          
    1445         delete exporter; 
    14461479} 
    14471480 
     
    15451578                if (passSamples >= mGvsSamplesPerPass) 
    15461579                { 
    1547                         if (GVS_DEBUG) VisualizeViewCell(mTrianglePvs); 
     1580                        if (0 && GVS_DEBUG) VisualizeViewCell(mTrianglePvs); 
    15481581 
    15491582                        //const bool convertPerPass = true; 
     
    20492082 
    20502083 
     2084void GvsPreprocessor::CollectProbablyVisibleItems(ProbablyVisibleQueue &vqueue) 
     2085{ 
     2086        ObjectPvsIterator pit = mCurrentViewCell->GetPvs().GetIterator(); 
     2087        static ObjectContainer tmpTriangles; 
     2088 
     2089        while (pit.HasMoreEntries()) 
     2090        { 
     2091                tmpTriangles.clear(); 
     2092 
     2093                Intersectable::NewMail(); 
     2094 
     2095                ProbablyVisibleItem *item = new ProbablyVisibleItem(); 
     2096 
     2097                KdIntersectable *kdObj = static_cast<KdIntersectable *>(pit.Next()); 
     2098                mKdTree->CollectObjects(kdObj->GetItem(), tmpTriangles); 
     2099                item->mNode = kdObj->GetItem(); 
     2100 
     2101                ObjectContainer::const_iterator oit, oit_end = tmpTriangles.end(); 
     2102 
     2103                for (oit = tmpTriangles.begin(); oit != oit_end; ++ oit) 
     2104                { 
     2105                        TriangleIntersectable *triObj = static_cast<TriangleIntersectable *>(*oit); 
     2106 
     2107                        // find objects which are not yet accounted for yet contained in kd pvs objects 
     2108                        if (triObj->mCounter < ACCOUNTED_OBJECT) 
     2109                        { 
     2110                                item->mTriangles.push_back(triObj); 
     2111                        } 
     2112                } 
     2113        } 
     2114} 
     2115 
     2116 
    20512117void GvsPreprocessor::CreateRandomizedReverseRays(const VssRay &ray,  
    20522118                                                                                                  const Vector3 &predictedPoint,  
  • GTP/trunk/Lib/Vis/Preprocessing/src/GvsPreprocessor.h

    r2742 r2743  
    9999 
    100100 
    101 struct ProbablyVisibleTriangleContainer 
     101struct ProbablyVisibleItem 
    102102{ 
    103         KdNode *node; 
     103        KdNode *mNode; 
    104104        ObjectContainer mTriangles; 
    105105}; 
    106106 
    107107 
    108 typedef FlexibleHeap<ProbablyVisibleTriangleContainer *> ProbablyVisibleTriangleQueue; 
     108typedef FlexibleHeap<ProbablyVisibleItem *> ProbablyVisibleQueue; 
    109109 
    110110 
     
    172172                Does reverse sampling if gap found. 
    173173        */ 
    174         int CheckDiscontinuity2(const VssRay &currentRay,  
    175                                     const Triangle3 &hitTriangle, 
    176                                                         const VssRay &oldRay); 
     174        bool CheckDiscontinuity2(const VssRay &currentRay,  
     175                                     const Triangle3 &hitTriangle, 
     176                                                         const VssRay &oldRay, 
     177                                                         SimpleRay &simpleRay); 
    177178        /** Adds new samples to the ray queue and classifies them 
    178179                with respect to the previous ray. 
     
    191192                                          const VssRay &ray1, 
    192193                      const VssRay &ray2, 
    193                                           const VssRay &oldRay); 
    194  
    195         void Visualize(); 
     194                                          const VssRay &oldRay, 
     195                                          int level); 
    196196 
    197197        void CreateDisplacedVertices(VertexContainer &vertices, 
     
    310310        inline bool IntersectsViewCell(Vector3 &origin, const Vector3 &dir) const; 
    311311 
    312         void DeleteOldRays(); 
    313  
    314  
     312        void CollectProbablyVisibleItems(ProbablyVisibleQueue &vqueue); 
    315313 
    316314        ////////////////////// 
  • GTP/trunk/Lib/Vis/Preprocessing/src/IntelRayCaster.cpp

    r2729 r2743  
    120120 
    121121  //cout << "intel ray" << endl; 
    122   VssRay *vssRay  = NULL; 
     122  VssRay *vssRay = NULL; 
    123123  int hits = 0; 
    124124  int hittriangle; 
     
    126126   
    127127  float dist; 
    128   float dist1, dist2; 
    129128  double normal[3]; 
    130129 
     
    138137 
    139138  rawCastTimer.Exit(); 
    140   dist1 = dist; 
     139   
    141140   
    142141  if (hittriangle != -1 ) { 
     
    145144    if (intersect) 
    146145    { 
    147       hitA.mObject = intersect; 
    148       hitA.mNormal = Vector3(normal[0], normal[1], normal[2]); 
    149       // Get the normal of that face 
    150       //                Mesh *mesh = ((MeshInstance *)objectA)->GetMesh(); 
    151       //                normalA = mesh->GetFacePlane(mFaceParents[forward_hit_triangles[i]].mFaceIndex).mNormal; 
    152       //-rays[index+i].mDirection; // $$ temporary 
    153       hitA.mPoint = simpleRay.Extrap(dist); 
     146                hitA.mObject = intersect; 
     147                hitA.mNormal = Vector3(normal[0], normal[1], normal[2]); 
     148 
     149                // Get the normal of that face 
     150                // Mesh *mesh = ((MeshInstance *)objectA)->GetMesh(); 
     151                // normalA = mesh->GetFacePlane(mFaceParents[forward_hit_triangles[i]].mFaceIndex).mNormal; 
     152                // -rays[index+i].mDirection; // $$ temporary 
     153                hitA.mPoint = simpleRay.Extrap(dist); 
    154154    } 
    155155  } 
     
    169169        rawCastTimer.Exit(); 
    170170 
    171     dist2 = dist; 
    172  
    173     Intersectable *intersect = mPreprocessor.GetParentObject(hittriangle); 
     171        Intersectable *intersect = mPreprocessor.GetParentObject(hittriangle); 
    174172                 
    175173    if (intersect) 
    176174    { 
    177       hitB.mObject = intersect; 
    178       hitB.mNormal = Vector3(normal[0], normal[1], normal[2]); 
    179       // Get the normal of that face 
    180       //                Mesh *mesh = ((MeshInstance *)objectB)->GetMesh(); 
    181       //                normalA = mesh->GetFacePlane(mFaceParents[forward_hit_triangles[i]].mFaceIndex).mNormal; 
    182       //-rays[index+i].mDirection; // $$ temporary 
    183       hitB.mPoint = simpleRay.Extrap(dist); 
    184     } 
    185   } 
    186  
     175                hitB.mObject = intersect; 
     176                hitB.mNormal = Vector3(normal[0], normal[1], normal[2]); 
     177                // Get the normal of that face 
     178                // Mesh *mesh = ((MeshInstance *)objectB)->GetMesh(); 
     179        //  normalA = mesh->GetFacePlane(mFaceParents[forward_hit_triangles[i]].mFaceIndex).mNormal; 
     180                //-rays[index+i].mDirection; // $$ temporary 
     181                hitB.mPoint = simpleRay.Extrap(dist); 
     182    } 
     183  } 
     184/* 
    187185  if (saveRays && preprocessor->mTotalRaysCast > saveRaysStart) {     
    188186    if (castDoubleRay) 
     
    221219    } 
    222220  }       
    223    
     221  */ 
    224222  return ProcessRay( 
    225223                    simpleRay, 
  • GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.h

    r2736 r2743  
    99#include "SimpleRay.h" 
    1010 
     11#define USE_RAY_POOL 
    1112 
    1213namespace GtpVisibilityPreprocessor { 
     
    3435class GlRendererWidget; 
    3536class IntersectableGroup; 
     37class TriangleIntersectable; 
     38 
     39 
     40/** Hack: Visualization structure for the GVS algorithm. 
     41*/ 
     42struct VizStruct 
     43{ 
     44        VertexContainer enlargedTriangle; 
     45        TriangleIntersectable *originalTriangle; 
     46        VssRay *ray; 
     47}; 
    3648 
    3749 
     
    299311        // out here for visualization purpose 
    300312        ObjectContainer mTrianglePvs; 
     313        vector<VizStruct> visTriangles; 
    301314 
    302315        // generic stats vector that can be used for anything 
  • GTP/trunk/Lib/Vis/Preprocessing/src/QtInterface/QtGlRenderer.cpp

    r2741 r2743  
    128128                                                                           KdTree *tree): 
    129129QGLPixelBuffer(QSize(w, h),  
    130                            QGLFormat(QGL::SampleBuffers) 
    131                            /*,| 
    132                                                  QGL::StencilBuffer |  
     130                           QGLFormat(QGL::StencilBuffer |  
    133131                                                 QGL::DepthBuffer |  
    134132                                                 QGL::DoubleBuffer | 
    135133                                                 QGL::Rgba) 
    136                                                  */), 
     134                                                 ), 
    137135GlRendererBuffer(sceneGraph, viewcells, tree) 
    138136{ 
     
    172170 
    173171 
    174 void QtGlRendererBuffer::RenderTrianglePvs() 
    175 { 
    176         //Intersectable::NewMail; 
    177  
    178         ObjectContainer::const_iterator oit, oit_end =  
    179                 mViewCellsManager->GetPreprocessor()->mTrianglePvs.end(); 
    180  
    181         //int sz = mViewCellsManager->GetPreprocessor()->mDummyBuffer.size(); 
    182  
    183         for (oit = mViewCellsManager->GetPreprocessor()->mTrianglePvs.begin(); 
    184                  oit != oit_end; ++ oit) 
     172void GlRenderer::RenderVisTriangles() 
     173{ 
     174        DisableDrawArrays(); 
     175 
     176        vector<VizStruct>::const_iterator oit, oit_end = GetPreprocessor()->visTriangles.end(); 
     177        int currentId = 0; 
     178        //glEnable(GL_POINT_SMOOTH); 
     179        for (oit = GetPreprocessor()->visTriangles.begin(); oit != oit_end; ++ oit) 
     180        { 
     181                VizStruct viz = *oit; 
     182                TriangleIntersectable *triObj = viz.originalTriangle; 
     183 
     184                glColor3f(RandomValue(0.3f, 1.0f), RandomValue(0.3f, 1.0f), RandomValue(0.3f, 1.0f)); 
     185                RenderIntersectable(triObj); 
     186 
     187                glColor3f(1, 0, 0); 
     188                glPointSize(1.0); 
     189                 
     190                glBegin(GL_POINTS); 
     191                 
     192                VertexContainer::const_iterator vit, vit_end = viz.enlargedTriangle.end(); 
     193 
     194                for (vit = viz.enlargedTriangle.begin(); vit != vit_end; ++ vit) 
     195                { 
     196                        Vector3 v = *vit; 
     197                        glVertex3f(v.x, v.y, v.z); 
     198                } 
     199 
     200                glEnd(); 
     201        } 
     202} 
     203 
     204 
     205#if 0 
     206 
     207void GlRenderer::RenderTrianglePvs() 
     208{ 
     209        DisableDrawArrays(); 
     210 
     211        ObjectContainer::const_iterator oit, oit_end = GetPreprocessor()->mTrianglePvs.end(); 
     212 
     213        for (oit = GetPreprocessor()->mTrianglePvs.begin(); oit != oit_end; ++ oit) 
    185214        { 
    186215                TriangleIntersectable *triObj = static_cast<TriangleIntersectable *>(*oit); 
    187  
    188                 //int dum = mViewCellsManager->GetPreprocessor()->mDummyBuffer[i]; 
    189                 //glColor3f(0, (float)dum / 20.0f, 1); 
     216                glColor3f(RandomValue(0.3f, 1.0f), RandomValue(0.3f, 1.0f), RandomValue(0.3f, 1.0f)); 
    190217                if (mUseFalseColors) SetupFalseColor(triObj->mId); 
    191218 
    192219                RenderIntersectable(triObj); 
    193  
    194                 /*if (!triObj->Mailed()) 
    195                         triObj->Mail(); 
    196                 else 
    197                         cerr << "böser fehler" << endl; 
    198                 */ 
    199         } 
    200 } 
    201  
    202  
     220        } 
     221} 
     222 
     223#else 
     224 
     225void GlRenderer::RenderTrianglePvs() 
     226{ 
     227        if (GetPreprocessor()->mTrianglePvs.empty()) 
     228                return; 
     229 
     230        EnableDrawArrays(); 
     231 
     232        if (mUseVbos) 
     233                glBindBufferARB(GL_ARRAY_BUFFER_ARB, mVboId); 
     234 
     235        unsigned int bufferSize = GetPreprocessor()->mTrianglePvs.size() * 3; 
     236        unsigned int *indices = new unsigned int[bufferSize]; 
     237 
     238        for (unsigned int i = 0; i < GetPreprocessor()->mTrianglePvs.size(); ++ i) 
     239        { 
     240                const int id = GetPreprocessor()->mTrianglePvs[i]->GetId() * 3; 
     241 
     242                indices[i * 3 + 0] = id + 0; 
     243                indices[i * 3 + 1] = id + 1; 
     244                indices[i * 3 + 2] = id + 2; 
     245        } 
     246 
     247        size_t offset = mObjects.size() * 3; 
     248        char *arrayPtr = mUseVbos ? NULL : (char *)mData; 
     249         
     250        glVertexPointer(3, GL_FLOAT, 0, (char *)arrayPtr); 
     251        glNormalPointer(GL_FLOAT, 0, (char *)arrayPtr + offset * sizeof(Vector3)); 
     252         
     253        glDrawElements(GL_TRIANGLES, bufferSize, GL_UNSIGNED_INT, indices); 
     254 
     255        DisableDrawArrays(); 
     256        delete [] indices; 
     257} 
     258 
     259#endif 
    203260 
    204261// reimplemented here so that we can snap the error windows 
     
    247304                return 0.0f; 
    248305 
     306        //mTopView = false; 
     307        SetupProjection(GetWidth(), GetHeight()); 
    249308        SetupCamera(); 
    250309 
     
    257316                GLfloat mat_ambient[] = {0.5f, 0.5f, 0.5f, 1.0f}; 
    258317                GLfloat mat_diffuse[] = {1.0f, 1.0f, 1.0f, 1.0f}; 
    259                 GLfloat mat_specular[] = {0.5f, 0.5f, 0.5f, 1.0f}; 
    260                 GLfloat mat_shininess[] = {1.0f}; 
     318                GLfloat mat_specular[] = {0.3f, 0.3f, 0.3f, 1.0f}; 
     319                GLfloat mat_shininess[] = {8.0f}; 
    261320 
    262321                glMaterialfv(GL_FRONT, GL_AMBIENT, mat_ambient); 
     
    266325                 
    267326                GLfloat light_ambient[] = {0.3, 0.3, 0.3, 1.0}; 
    268                 //GLfloat light_diffuse[] = {0.6, 0.6, 0.6, 1.0}; 
    269327                GLfloat light_diffuse[] = {0.6, 0.6, 0.6, 1.0}; 
    270                 GLfloat light_specular[] = {1.0, 1.0, 1.0, 1.0}; 
     328                GLfloat light_specular[] = {0.6, 0.6, 0.6, 1.0}; 
    271329 
    272330                glEnable(GL_LIGHTING); 
     
    293351        glDisable(GL_ALPHA_TEST); 
    294352                 
     353        glClearDepth(1.0f); 
     354 
    295355        glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); 
    296356        glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); 
     
    302362        glDepthMask(GL_TRUE); 
    303363        glEnable(GL_DEPTH_TEST); 
    304  
     364         
     365        if (mDetectEmptyViewSpace)  
     366                glEnable(GL_CULL_FACE); 
     367        else 
     368                glDisable(GL_CULL_FACE); 
     369         
    305370        glFrontFace(GL_CCW); 
    306371        glCullFace(GL_BACK); 
     
    308373        glStencilFunc(GL_EQUAL, 0x0, 0x1); 
    309374        glStencilOp(GL_KEEP, GL_KEEP, GL_INCR);  
     375        glDisable(GL_STENCIL_TEST);  
    310376 
    311377        KdNode::NewMail2(); 
    312         //Intersectable::NewMail(); 
    313  
     378         
     379        DisableDrawArrays(); 
     380         
    314381        //mUseFalseColors = true; 
    315382        // hack for gvs 
     
    322389        glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); 
    323390 
    324         glEnable(GL_STENCIL_TEST);  
     391        //glEnable(GL_STENCIL_TEST);  
    325392 
    326393        // errors in red 
     
    332399 
    333400        KdNode::NewMail2(); 
    334         //Intersectable::NewMail(); 
    335  
     401         
    336402        query->BeginQuery(); 
    337403 
     
    340406 
    341407        RenderScene(); 
    342  
    343408        glFlush(); 
    344409 
    345410        query->EndQuery(); 
     411         
    346412        glDisable(GL_STENCIL_TEST);  
    347413         
     
    396462                                // render pvs once 
    397463                                //RenderPvs(pvs); 
    398                                 EnableDrawArrays(); 
    399  
     464                                //EnableDrawArrays(); 
     465                                //glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); 
    400466                                // prepare pvs for rendering 
    401                                 PreparePvs(pvs); 
    402                                 _RenderColoredPvs(pvs); 
     467                                //PreparePvs(pvs); 
     468                                //_RenderColoredPvs(pvs); 
     469                                //glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); 
    403470                                // hack for gvs visualization 
    404471                                //RenderTrianglePvs(); 
     472                                RenderVisTriangles(); 
    405473 
    406474                                glFlush(); 
     
    591659#if 0 
    592660        for (dit = mDynamicPvsObjects.begin(); dit != dit_end; ++ dit) 
    593         { 
    594661                _RenderDynamicObject(*dit); 
    595         } 
    596662#endif 
    597663        //glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); 
    598664 
    599665        // show placed dynamic objects as wireframe 
    600         Preprocessor *p = mViewCellsManager->GetPreprocessor(); 
     666        Preprocessor *p = GetPreprocessor(); 
    601667        dit_end = p->mDynamicObjects.end(); 
    602668 
     
    722788                if (mRenderFilter)  
    723789                { 
     790                        bool oldWireFrame = mWireFrame; 
    724791                        mWireFrame = true; 
    725792                        RenderIntersectable(viewcell); 
    726793                         
    727                         mWireFrame = false; 
     794                        mWireFrame = oldWireFrame; 
    728795                } 
    729796        }  
     
    10131080        { 
    10141081                glColor3f(0.6f, 0.6f, 0.6f); 
     1082 
     1083                if (mWireFrame) 
     1084                        glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); 
     1085                else 
     1086                        glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); 
     1087 
    10151088                VisualizePvs(); 
     1089 
     1090                glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); 
    10161091        } 
    10171092 
     
    10681143 
    10691144void 
    1070 QtGlRendererWidget::keyPressEvent ( QKeyEvent * e ) 
     1145QtGlRendererWidget::keyPressEvent(QKeyEvent *e) 
    10711146{ 
    10721147        switch (e->key())  
     
    10771152                break; 
    10781153        case Qt::Key_R: 
    1079                 mUseRandomColorPerPvsObject = !mUseRandomColorPerPvsObject;; 
     1154                mUseRandomColorPerPvsObject = !mUseRandomColorPerPvsObject; 
     1155                updateGL(); 
     1156                break; 
     1157        case Qt::Key_W: 
     1158                mWireFrame = !mWireFrame; 
    10801159                updateGL(); 
    10811160                break; 
     
    10941173                updateGL(); 
    10951174                break; 
    1096         case Qt::Key_S: { 
    1097                 // set view poitn and direction 
    1098                 QString text; 
    1099                 bool ok; 
    1100                 text.sprintf("%f %f %f", mViewPoint.x, mViewPoint.y, mViewPoint.z); 
    1101                 text = QInputDialog::getText(this, 
    1102                         "Enter a view point", 
    1103                         "", 
    1104                         QLineEdit::Normal, 
    1105                         text, 
    1106                         &ok); 
    1107                 if (!ok) 
    1108                         break; 
    1109  
    1110                 if (sscanf_s(text.toAscii(), "%f %f %f", &mViewPoint.x, &mViewPoint.y, &mViewPoint.z) == 3) { 
    1111                         text.sprintf("%f %f %f", mViewDirection.x, mViewDirection.y, mViewDirection.z); 
     1175        case Qt::Key_S:  
     1176                { 
     1177                        // set view poitn and direction 
     1178                        QString text; 
     1179                        bool ok; 
     1180                        text.sprintf("%f %f %f", mViewPoint.x, mViewPoint.y, mViewPoint.z); 
    11121181                        text = QInputDialog::getText(this, 
    1113                                 "Enter a direction", 
     1182                                "Enter a view point", 
    11141183                                "", 
    11151184                                QLineEdit::Normal, 
    11161185                                text, 
    11171186                                &ok); 
     1187 
    11181188                        if (!ok) 
    11191189                                break; 
    1120                         if (sscanf_s(text.toAscii(), "%f %f %f", &mViewDirection.x, 
    1121                                 &mViewDirection.y, &mViewDirection.z) == 3) { 
    1122                                         updateGL(); 
     1190 
     1191                        if (sscanf_s(text.toAscii(), "%f %f %f", &mViewPoint.x, &mViewPoint.y, &mViewPoint.z) == 3)  
     1192                        { 
     1193                                text.sprintf("%f %f %f", mViewDirection.x, mViewDirection.y, mViewDirection.z); 
     1194                                text = QInputDialog::getText(this, 
     1195                                        "Enter a direction", 
     1196                                        "", 
     1197                                        QLineEdit::Normal, 
     1198                                        text, 
     1199                                        &ok); 
     1200                                if (!ok) 
     1201                                        break; 
     1202                                if (sscanf_s(text.toAscii(), "%f %f %f", &mViewDirection.x, 
     1203                                        &mViewDirection.y, &mViewDirection.z) == 3) { 
     1204                                                updateGL(); 
     1205                                } 
     1206                                break; 
    11231207                        } 
    1124                         break; 
    1125                 } 
    1126                                         } 
     1208 
     1209                } 
    11271210        default: 
    11281211                cerr << "unknown key" << endl; 
     
    11561239        //mRenderVisibilityEstimates = true; 
    11571240 
     1241        mWireFrame = false; 
    11581242        mComputeGVS = false; 
    11591243        mUseRandomColorPerPvsObject = false; 
     
    13121396{ 
    13131397        cerr<<"stop computation called!\n"<<endl; 
    1314         mViewCellsManager->GetPreprocessor()->mStopComputation = true; 
     1398        GetPreprocessor()->mStopComputation = true; 
    13151399} 
    13161400 
     
    17871871        } 
    17881872 
    1789         //mWireFrame = true; 
    17901873                 
    1791         // normal rendering 
     1874        // default rendering 
    17921875        //if (!mShowPvsSizes && !mShowPiercingRays && !mShowWeightedRays && !mShowWeightedCost && !mShowComparison) 
    17931876        if (mUseStandardColors) 
     
    18351918 
    18361919        mUseFalseColors = false; 
    1837         mWireFrame = false; 
     1920        //mWireFrame = false; 
    18381921 
    18391922        glPopAttrib(); 
     
    27112794int QtGlRendererWidget::FindDynamicObject(float x, float y)  
    27122795{  
    2713  
    27142796        if (GetPreprocessor()->mDynamicObjects.empty()) 
    27152797                return -1; 
  • GTP/trunk/Lib/Vis/Preprocessing/src/QtInterface/QtGlRenderer.h

    r2736 r2743  
    7676        int ComputePvs(ObjectContainer &objects, ObjectContainer &pvs) const; 
    7777 
    78         /** quick hack in order to be able to render gvs based triangle pvs. 
    79         */ 
    80         void RenderTrianglePvs(); 
    8178 
    8279         
  • GTP/trunk/Lib/Vis/Preprocessing/src/QtInterface/QtGlViewer.cpp

    r2709 r2743  
    2828{ 
    2929        scale = 1.0f; 
    30         mWireframe = false; 
     30        mWireFrame = false; 
    3131        mModelMatrix = IdentityMatrix(); 
    3232 
     
    235235 
    236236  case Qt::Key_W: 
    237                 mWireframe = !mWireframe; 
     237                mWireFrame = !mWireFrame; 
    238238                updateGL(); 
    239239                break; 
  • GTP/trunk/Lib/Vis/Preprocessing/src/QtInterface/QtGlViewer.h

    r2657 r2743  
    4545        void keyPressEvent(QKeyEvent * e); 
    4646 
    47         bool mWireframe; 
     47 
     48        /////////////// 
     49 
     50        bool mWireFrame; 
    4851 
    4952        int timerId; 
  • GTP/trunk/Lib/Vis/Preprocessing/src/RayCaster.cpp

    r2742 r2743  
    3232{ 
    3333        VssRayContainer rays; 
    34         CastRay(simpleRay, rays, box, castDoubleRay, true); 
     34        //CastRay(simpleRay, rays, box, castDoubleRay, true); 
     35        CastRay(simpleRay, rays, box, castDoubleRay, false); 
    3536     
    3637        if (!rays.empty()) 
     
    409410 
    410411 
    411 /*void RayCaster::DeleteOldRays() 
    412 { 
    413         CLEAR_CONTAINER(mOldRays); 
    414 }*/ 
    415  
    416  
    417412int 
    418413RayCaster::ProcessRay(const SimpleRay &simpleRay, 
     
    443438         
    444439        // regardless of the pruneInvalidRays setting reject  
    445         // rays whic degenerate to a point 
     440        // rays which degenerate to a point 
    446441        if (EpsilonEqualV3(hitA.mPoint, hitB.mPoint, Limits::Small)) { 
    447442#if DEBUG_PROCESS_RAY 
     
    462457        // reset both contributions 
    463458        if (!validA || !validB) { 
    464           if (0 || pruneInvalidRays) 
     459          if (pruneInvalidRays) 
    465460                return 0; 
    466461 
  • GTP/trunk/Lib/Vis/Preprocessing/src/SamplingStrategy.cpp

    r2742 r2743  
    830830        { 
    831831                //mViewCell->GetRandomEdgePoint(origin, normal); 
    832                 //origin = mViewCell->GetBox().GetRandomSurfacePoint(); 
    833                 origin = mViewCell->GetBox().GetRandomPoint(); 
    834 //origin = Vector3(680.682, 189.552, -278.177); 
     832                origin = mViewCell->GetBox().GetRandomSurfacePoint(); 
     833                //origin = mViewCell->GetBox().GetRandomPoint(); 
     834                //origin = Vector3(680.682, 189.552, -278.177); 
    835835                // move a little bit back to avoid piercing through walls 
    836836                // that bound the view cell 
  • GTP/trunk/Lib/Vis/Preprocessing/src/VrmlExporter.cpp

    r2601 r2743  
    296296 
    297297        // wireframe modes => set indexed lines 
    298         if (mWireframe) 
     298        if (mWireFrame) 
    299299        { 
    300300                stream << "geometry IndexedLineSet {" << endl; 
     
    324324                } 
    325325           
    326                 if (mWireframe) // final line to finish polygon 
     326                if (mWireFrame) // final line to finish polygon 
    327327                { 
    328328                        stream << (*face->mVertexIndices.begin()) << " "; 
     
    390390 
    391391        // wireframe modes => set indexed lines 
    392         if (mWireframe) 
     392        if (mWireFrame) 
    393393        { 
    394394                stream << "geometry IndexedLineSet {" << endl; 
     
    413413        } 
    414414 
    415         if (mWireframe) // final line to finish polygon 
     415        if (mWireFrame) // final line to finish polygon 
    416416        { 
    417417                stream << "0 "; 
     
    470470 
    471471        // wireframe modes => set indexed lines 
    472         if (mWireframe) 
     472        if (mWireFrame) 
    473473        { 
    474474                stream << "geometry IndexedLineSet {" << endl; 
     
    562562        } 
    563563   
    564         bool savedWireframe = mWireframe; 
     564        bool savedWireframe = mWireFrame; 
    565565 
    566566        SetWireframe(); 
  • GTP/trunk/Lib/Vis/Preprocessing/src/X3dExporter.cpp

    r2601 r2743  
    311311 
    312312 
    313   if (mWireframe) 
     313  if (mWireFrame) 
    314314    stream<<"<IndexedLineSet coordIndex=\""<<endl; 
    315315  else 
     
    326326    for (; vi != face->mVertexIndices.end(); vi++) 
    327327      stream<<*vi<<" "; 
    328         if (mWireframe) // final line to finish polygon 
     328        if (mWireFrame) // final line to finish polygon 
    329329                stream << (*face->mVertexIndices.begin()) << " "; 
    330330 
     
    344344  stream<<"</Coordinate>"<<endl; 
    345345 
    346   if (mWireframe) 
     346  if (mWireFrame) 
    347347    stream<<"</IndexedLineSet>"<<endl; 
    348348  else 
     
    388388 
    389389        //-- create and write indices 
    390         if (mWireframe) 
     390        if (mWireFrame) 
    391391                stream<<"<IndexedLineSet coordIndex=\""<<endl; 
    392392        else 
     
    400400                stream << index << " "; 
    401401         
    402         if (mWireframe) // final line to finish polygon 
     402        if (mWireFrame) // final line to finish polygon 
    403403                stream << "0 "; 
    404404 
     
    417417        stream << "</Coordinate>" << endl; 
    418418 
    419         if (mWireframe) 
     419        if (mWireFrame) 
    420420                stream << "</IndexedLineSet>" << endl; 
    421421        else 
     
    456456 
    457457        //-- create and write indices 
    458         if (mWireframe) 
     458        if (mWireFrame) 
    459459                stream<<"<IndexedLineSet coordIndex=\""<<endl; 
    460460        else 
     
    496496        stream << "</Coordinate>" << endl; 
    497497 
    498         if (mWireframe) 
     498        if (mWireFrame) 
    499499                stream << "</IndexedLineSet>" << endl; 
    500500        else 
     
    539539        } 
    540540   
    541         bool savedWireframe = mWireframe; 
     541        bool savedWireframe = mWireFrame; 
    542542 
    543543        SetWireframe(); 
  • GTP/trunk/Lib/Vis/Preprocessing/src/main.cpp

    r2718 r2743  
    333333                // NOTE: render texture should be power of 2 and square 
    334334                // renderer must be initialised 
    335                 const float w = 1024; 
    336                 const float h = 1024; 
     335                const float w = 2048;//1024; 
     336                const float h = 2048;//1024; 
    337337 
    338338                QtGlRendererBuffer *glbuf =  
Note: See TracChangeset for help on using the changeset viewer.