Changeset 2053


Ignore:
Timestamp:
01/24/07 16:35:17 (17 years ago)
Author:
mattausch
Message:
 
Location:
GTP/trunk/Lib/Vis/Preprocessing/src
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • GTP/trunk/Lib/Vis/Preprocessing/src/GlRenderer.cpp

    r2050 r2053  
    8989  mUseForcedColors = false; 
    9090  mRenderBoxes = false; 
    91   mUseGlLists = true; 
    92   //mUseGlLists = false; 
     91 // mUseGlLists = true; 
     92  mUseGlLists = false; 
    9393 
    9494  if (mViewCellsManager->GetViewCellPoints()->size()) 
     
    447447 
    448448                        if (id != 0xFFFFFF) 
     449                        { 
    449450                                ++ mObjects[id]->mCounter; 
     451                        } 
    450452                } 
    451453        } 
     
    511513 
    512514                pixelCount = mOcclusionQueries[j]->GetQueryResult(); 
     515                 
    513516                mObjects[j]->mCounter += pixelCount; 
    514517        } 
     
    554557                        //      cout <<"o="<<j+q<<" q="<<mOcclusionQueries[q]->GetQueryId()<<" pc="<<pixelCount<<" "; 
    555558                        mObjects[j + t]->mCounter += pixelCount; 
     559                 
    556560                } 
    557561 
     
    735739        { 
    736740          (*it)->mCounter = 0; 
     741          
    737742        } 
    738743 
  • GTP/trunk/Lib/Vis/Preprocessing/src/GvsPreprocessor.cpp

    r2048 r2053  
    1616{ 
    1717   
    18 #define GVS_DEBUG 0 
     18#define GVS_DEBUG 1 
    1919 
    2020struct VizStruct 
     
    140140 
    141141                // set flag for visualization 
    142                 newRay->mFlags |= VssRay::ReverseSample; 
     142                //newRay->mFlags |= VssRay::ReverseSample; 
    143143                 
    144144                // if ray is not further processed => delete ray 
     
    154154} 
    155155 
    156 // #id: 1270 
     156 
    157157bool GvsPreprocessor::HasContribution(VssRay &ray) 
    158158{ 
     
    314314        if (!newRay) return castRays; 
    315315 
    316         newRay->mFlags |= VssRay::BorderSample; 
     316        //newRay->mFlags |= VssRay::BorderSample; 
    317317 
    318318        // add new ray to queue 
     
    391391        GenerateRays(numRandomRays, vcStrat, simpleRays); 
    392392 
     393 
    393394        ///////////////////// 
    394  
    395395 
    396396        // keep origin for per view cell sampling 
     
    398398 
    399399        const int numBorderSamples = (int)vssRays.size() - numRandomRays; 
    400  
    401400        // set flags 
    402         VssRayContainer::const_iterator rit, rit_end = vssRays.end(); 
    403         int i = 0; 
    404    
     401        /*VssRayContainer::const_iterator rit, rit_end = vssRays.end(); 
    405402        for (rit = vssRays.begin(); rit != rit_end; ++ rit, ++ i) 
    406         { 
    407                 if (i < numBorderSamples) 
    408                         (*rit)->mFlags |= VssRay::BorderSample; 
    409         } 
    410  
     403                (*rit)->mFlags |= VssRay::BorderSample; 
     404                */ 
    411405        int castRays = (int)simpleRays.size(); 
    412406 
     
    429423        mGvsStats.mBorderSamples += castRays; 
    430424 
    431         CLEAR_CONTAINER(invalidSamples); 
     425        //CLEAR_CONTAINER(invalidSamples); 
    432426         
    433427        //cout << "cast rays: " << castRays << endl; 
     
    585579        EnqueueRays(samples, invalidSamples); 
    586580 
    587         CLEAR_CONTAINER(invalidSamples); 
     581        //CLEAR_CONTAINER(invalidSamples); 
    588582        //Debug << "generated " <<  numSamples << " samples in " << TimeDiff(startTime, GetTime()) * 1e-3 << " secs" << endl; 
    589583        return (int)simpleRays.size(); 
     
    599593                VssRay *ray = *vit; 
    600594 
    601                 if (!HandleRay(ray)) 
    602                         invalidSamples.push_back(ray); 
     595                HandleRay(ray); 
     596 
     597                //if (!HandleRay(ray)); 
     598                //      invalidSamples.push_back(ray); 
    603599        } 
    604600} 
     
    729725        //exporter->SetFilled(); 
    730726 
    731         DEL_PTR(exporter); 
     727        delete exporter; 
    732728} 
    733729 
     
    820816        vector<ViewCellPoints *> *vcPoints = mViewCellsManager->GetViewCellPoints(); 
    821817 
     818         
     819        int i = 0; 
    822820        if (!vcPoints->empty()) 
    823821        { 
     822                cout << "loading view cell list" << endl; 
     823                 
    824824                vector<ViewCellPoints *>::const_iterator vit, vit_end = vcPoints->end(); 
    825825 
    826826                for (vit = vcPoints->begin(); vit != vit_end; ++ vit) 
    827                 { 
     827                {//cout << i ++ << " " << (*vit)->first->GetId() << endl; 
    828828                        mViewCells.push_back((*vit)->first); 
    829829                } 
     
    913913                (*oit)->mCounter = 0; 
    914914        } 
    915 //int dummy = 0; 
     915        int dummy = 0; 
    916916        while (NextViewCell())// && (dummy < 3)) 
    917         {//++ dummy; 
     917        { 
     918                //++ dummy; 
     919                //if (mProcessedViewCells < 53) continue; 
     920         
    918921                long startTime = GetTime(); 
    919922                cout << "\n***********************\n"  
     
    969972                // is this really necessary? 
    970973                //ClearRayQueue(); 
    971  
     974                cout << "finished" << endl; 
    972975                if (mEvaluatePixelError || mExportVisibility) 
    973976                { 
     
    988991} 
    989992 
    990  
     993/* 
    991994void GvsPreprocessor::ComputeRenderError() 
    992995{ 
     
    10121015        } 
    10131016} 
    1014  
     1017*/ 
    10151018 
    10161019void GvsPreprocessor::UpdatePvs(ViewCell *currentViewCell) 
     
    10471050void GvsPreprocessor::GetObjectPvs(ObjectContainer &objectPvs) const 
    10481051{ 
     1052        objectPvs.reserve((int)mTrianglePvs.size()); 
     1053 
    10491054        BvhLeaf::NewMail(); 
    10501055 
     
    10561061         
    10571062                BvhLeaf *bv = intersect->mBvhLeaf; 
     1063 
     1064                // hack: reset counter 
     1065                (*oit)->mCounter = 0; 
    10581066 
    10591067                if (!bv || bv->Mailed()) 
     
    10631071 
    10641072                objectPvs.push_back(bv); 
    1065                 // hack: reset counter 
    1066                 (*oit)->mCounter = 0; 
    10671073        } 
    10681074} 
  • GTP/trunk/Lib/Vis/Preprocessing/src/GvsPreprocessor.h

    r2048 r2053  
    217217        void DeterminePvsObjects(VssRayContainer &rays); 
    218218 
    219         virtual void ComputeRenderError(); 
     219        //virtual void ComputeRenderError(); 
    220220 
    221221        void StorePvs(const ObjectContainer &objectPvs); 
  • GTP/trunk/Lib/Vis/Preprocessing/src/Polygon3.cpp

    r1571 r2053  
    6565        mVertices.push_back(tri.mVertices[1]); 
    6666        mVertices.push_back(tri.mVertices[2]); 
    67  
    68         VertexContainer::iterator it, it_end = mVertices.end(); 
    69  
    70         //for (it = mVertices.begin(); it != it_end;  ++ it){cout << (*it) << " ";}cout<<endl<<endl; 
    71         //cout << "poly n: " << GetNormal() << " t normal: " << tri.GetNormal() << endl; 
    7267} 
    7368 
     
    105100    Vector3 lastSplit; 
    106101                 
     102        ///////////// 
    107103        //-- find line - plane intersections 
    108104 
     
    139135                        if (sideA > 0) 
    140136                        { 
     137                                //////////// 
    141138                                //-- plane - line intersection 
     139 
    142140                                Vector3 splitPt = partition.FindIntersection(ptA, ptB); 
    143                                 // test if split point not too close to other split point 
    144                                         // test if split point not too close to previous split point 
     141                                 
     142                                // test if split point not too close to previous split point 
    145143                                if (!foundSplit || (!EpsilonEqualV3(splitPt, lastSplit, epsilon))) 
    146144                                { 
     
    153151                                }        
    154152                        } 
     153 
    155154                        back.mVertices.push_back(ptB); 
    156155                } 
     
    249248                sum += mVertices[i]; 
    250249         
    251         return sum/(float)i; 
     250        return sum / (float)i; 
    252251} 
    253252 
     
    258257        int i; 
    259258        Vector3 center = Center(); 
    260         for (i=0; i < mVertices.size(); i++) { 
    261                 mVertices[i] = center + scale*(mVertices[i] - center); 
     259         
     260        for (i=0; i < mVertices.size(); i++)  
     261        { 
     262                mVertices[i] = center + scale * (mVertices[i] - center); 
    262263        } 
    263264} 
  • GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.cpp

    r2050 r2053  
    658658   
    659659  // export the preprocessed information to a file 
    660   if (mExportVisibility) 
     660  if (1 && mExportVisibility) 
    661661  { 
    662662          ExportPreprocessedData(mVisibilityFileName); 
  • GTP/trunk/Lib/Vis/Preprocessing/src/RssTree.cpp

    r1942 r2053  
    997997                if (!object->Mailed()) { 
    998998                  object->Mail(); 
     999                   
    9991000                  object->mCounter = 1; 
    10001001                } else 
     1002                { 
     1003                         
    10011004                  object->mCounter++; 
    1002            
     1005                } 
    10031006#if EVAL_VIEWCELLS        
    10041007          // and do the same for all viewcells 
     
    10101013                  currInfo.viewCells++; 
    10111014                  viewcell->Mail(); 
     1015                   
    10121016                  viewcell->mCounter = 1; 
    10131017                } else 
     1018                { 
     1019                         
    10141020                  viewcell->mCounter++; 
     1021                } 
    10151022          } 
    10161023#endif 
     
    10591066                } 
    10601067                if (--object->mCounter == 0) 
     1068                { 
    10611069                  currInfo.pvsFront--; 
     1070                } 
    10621071          } 
    10631072 
     
    10711080                } 
    10721081                if (--viewcell->mCounter == 0) 
     1082                { 
    10731083                  currInfo.viewCellsFront--; 
     1084                } 
    10741085          } 
    10751086#endif 
     
    23862397                if (!object->Mailed()) { 
    23872398                  object->Mail(); 
     2399                   
    23882400                  object->mCounter = 1; 
    23892401                  pvs.push_back(object); 
     
    28432855                  object->mCounter = 1; 
    28442856                } else 
     2857                { 
     2858                 
    28452859                  object->mCounter++; 
     2860                } 
    28462861                samples++; 
    28472862          } 
  • GTP/trunk/Lib/Vis/Preprocessing/src/TestPreprocessor.vcproj

    r2048 r2053  
    197197                                AdditionalIncludeDirectories="..\include;..\..\..\..\..\..\NonGTP\Boost;..\src;..\..\..\..\..\..\NonGTP\Devil\include;..\..\..\..\..\..\NonGTP\Zlib\include;..\..\..\..\..\..\NonGTP\Xerces;&quot;$(QTDIR)\include\QtOpenGl&quot;;&quot;$(QTDIR)\include\Qt&quot;;&quot;$(QTDIR)\include\QtCore&quot;;&quot;$(QTDIR)\include&quot;;QtInterface" 
    198198                                PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;GTP_INTERNAL;USE_QT;USE_CG" 
     199                                ExceptionHandling="TRUE" 
    199200                                RuntimeLibrary="2" 
    200201                                EnableEnhancedInstructionSet="2" 
     
    209210                                Name="VCLinkerTool" 
    210211                                AdditionalDependencies="xerces-c_2.lib glew32.lib zdll.lib zziplib.lib devil.lib glut32.lib OpenGL32.Lib glu32.lib Preprocessor.lib RTScene.lib RTWorld.lib QtCore4.lib qtmain.lib cg.lib cgGL.lib QtOpenGL4.lib Qt3Support4.lib QtTest4.lib QtGui4.lib QtInterface.lib" 
    211                                 OutputFile="../bin/release/Preprocessor2.exe" 
     212                                OutputFile="../bin/release/Preprocessor.exe" 
    212213                                LinkIncremental="1" 
    213214                                AdditionalLibraryDirectories="..\src\GL;..\lib\release;..\..\Preprocessing\lib\release;..\..\..\..\..\..\NonGTP\Boost\lib;..\..\..\..\..\..\NonGTP\Xerces\xercesc\lib;..\..\..\..\..\..\NonGTP\Zlib\lib;..\..\..\..\..\..\NonGTP\Devil\lib;..\MultiLevelRayTracing\RTScene\Release;..\MultiLevelRayTracing\RTWorld\Release;&quot;$(QTDIR)\lib&quot;;.\QtInterface\Release;&quot;$(CG_LIB_PATH)&quot;" 
     
    217218                                OptimizeReferences="2" 
    218219                                EnableCOMDATFolding="2" 
     220                                OptimizeForWindows98="1" 
    219221                                TargetMachine="1" 
    220222                                FixedBaseAddress="1"/> 
  • GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp

    r2051 r2053  
    536536 
    537537                if (GenerateViewPoint(viewCell, pt)) 
    538                 {cout<<"here4"<<endl; 
     538                { 
    539539                        ++ generatedPts; 
    540540                        cout << "generated view point " << generatedPts << endl; 
     
    11021102                vm->mMaxPvsSize = (int)objects->size(); 
    11031103 
     1104                 
    11041105                if (finalizeViewCells) 
    11051106                { 
    11061107                        // create the meshes and compute volumes 
    1107                         vm->FinalizeViewCells(true); 
     1108                        vm->FinalizeViewCells(false); 
    11081109                        // vm->mViewCellsTree->AssignRandomColors(); 
    11091110                } 
     
    11131114                        cout << "=============== " << vm->GetViewCellById(5318)->GetPvs().GetSize() << "========" << endl; 
    11141115                } 
     1116 
     1117                cout << (int)vm->mViewCells.size() << " view cells loaded in " 
     1118                         << TimeDiff(startTime, GetTime()) * 1e-3 << " secs" << endl; 
    11151119 
    11161120                Debug << (int)vm->mViewCells.size() << " view cells loaded in " 
  • GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsParser.cpp

    r2049 r2053  
    396396{ 
    397397        //cout << "exchanging pvs" << endl; 
    398  
    399         sort(mBvhLeaves.begin(), mBvhLeaves.end(), ilt); 
    400398        ObjectPvs newPvs; 
    401399 
     
    449447{ 
    450448        ViewCellContainer::const_iterator vit, vit_end = mViewCells.end(); 
    451  
     449         
     450        sort(mBvhLeaves.begin(), mBvhLeaves.end(), ilt); 
     451 
     452        //cout << "viewcells : " << mViewCells.size() << endl; 
    452453        for (vit = mViewCells.begin(); vit != vit_end; ++ vit) 
    453         {//cout << "j"; 
     454        { 
    454455                ExchangePvs(*vit); 
    455456        } 
     
    773774                //ViewCellsMap::iterator vit = mViewCells.find(viewCellId); 
    774775//              BspViewCell *viewCell = static_cast<BspViewCell *>((*vit).second); 
     776 
    775777                BspViewCell *viewCell = static_cast<BspViewCell *>(*vit); 
    776778                if (viewCell->GetId() == viewCellId) 
     
    15081510#endif 
    15091511 
    1510         if (0 && PVS_HACK) 
     1512        if (1 && PVS_HACK) 
    15111513                handler.ExchangeElements(); 
    15121514 
  • GTP/trunk/Lib/Vis/Preprocessing/src/main.cpp

    r2049 r2053  
    366366                  new QtGlRendererBuffer(1024, 1024, 
    367367                                                                 preprocessor->mSceneGraph, 
    368                                                           preprocessor->mViewCellsManager, 
     368                                                                preprocessor->mViewCellsManager, 
    369369                                                                 preprocessor->mKdTree); 
    370370          } 
Note: See TracChangeset for help on using the changeset viewer.