Ignore:
Timestamp:
01/14/08 18:25:44 (16 years ago)
Author:
mattausch
Message:
 
Location:
GTP/trunk/Lib/Vis/Preprocessing/src
Files:
12 edited

Legend:

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

    r2586 r2593  
    6767 
    6868  int lastEvaluation = 0; 
    69   //  int totalVssRays = 0; 
     69  
    7070  mPass = 0; 
    7171   
  • GTP/trunk/Lib/Vis/Preprocessing/src/GlRenderer.cpp

    r2591 r2593  
    1414#include "KdTree.h" 
    1515#include "SamplingStrategy.h" 
     16#include "Preprocessor.h" 
    1617 
    1718 
     
    145146void GlRenderer::RenderIntersectable(Intersectable *object) 
    146147{ 
    147         if (!object) 
     148        if (!object || (object->mRenderedFrame == mCurrentFrame)) 
    148149                return; 
    149150 
    150         if (object->mRenderedFrame == mCurrentFrame) 
    151                 return; 
    152  
    153151        object->mRenderedFrame = mCurrentFrame; 
    154  
    155         //if (object->Mailed()) return; 
    156         //object->Mail(); 
    157152 
    158153        glPushAttrib(GL_CURRENT_BIT); 
     
    205200 
    206201 
    207 void GlRenderer::RenderRays(const VssRayContainer &rays, int colorType, int showDistribution) 
    208 { 
     202void GlRenderer::RenderRays(const VssRayContainer &rays, int colorType, int showDistribution, int maxAge) 
     203{ 
     204        float importance; 
     205 
     206        glBegin(GL_LINES); 
     207 
    209208        VssRayContainer::const_iterator it = rays.begin(), it_end = rays.end(); 
    210  
    211         glBegin(GL_LINES); 
    212          
    213         float importance; 
    214209 
    215210        for (; it != it_end; ++it)  
     
    221216                        ((ray->mDistribution == SamplingStrategy::SPATIAL_BOX_BASED_DISTRIBUTION) && ((showDistribution & 2) == 0)) || 
    222217                        ((ray->mDistribution == SamplingStrategy::OBJECT_DIRECTION_BASED_DISTRIBUTION) && ((showDistribution & 4) == 0)) || 
    223                         ((ray->mDistribution == SamplingStrategy::MUTATION_BASED_DISTRIBUTION) && ((showDistribution & 8) == 0))) 
     218                        ((ray->mDistribution == SamplingStrategy::MUTATION_BASED_DISTRIBUTION) && ((showDistribution & 8) == 0)) || 
     219                        ((mViewCellsManager->GetPreprocessor()->mPass - ray->mPass) >= maxAge)) 
    224220                { 
    225221                        continue; 
  • GTP/trunk/Lib/Vis/Preprocessing/src/GlRenderer.h

    r2591 r2593  
    3030 
    3131struct VssRayContainer; 
    32  
    33   struct GLUquadric; 
    34    
    35 struct PvsRenderStatistics { 
    36    
     32struct GLUquadric; 
     33 
     34 
     35struct PvsRenderStatistics  
     36{  
    3737  float maxError; 
    3838  float sumError; 
     
    4343  PvsRenderStatistics() { Reset(); } 
    4444   
    45   void Reset() { 
     45  void Reset()  
     46  { 
    4647        maxError = 0.0f; 
    4748        sumError = 0.0f; 
     
    5859}; 
    5960 
    60         struct PvsCache { 
    61                  
    62                 PvsCache():mViewCell(NULL), mUnfilteredPvsSize(0) {} 
    63  
    64                 void Reset() 
    65                 {  
    66                         mViewCell = NULL; mPvs.Clear();  
    67                         filteredBoxes.clear();  
    68                         mUnfilteredPvsSize = 0; 
    69                 } 
    70                  
    71                 ViewCell *mViewCell; 
    72                 ObjectPvs mPvs; 
    73                 int mUnfilteredPvsSize; 
    74                 vector<AxisAlignedBox3> filteredBoxes; 
    75         }; 
     61 
     62struct PvsCache  
     63{ 
     64 
     65        PvsCache():mViewCell(NULL), mUnfilteredPvsSize(0) {} 
     66 
     67        void Reset() 
     68        {  
     69                mViewCell = NULL; mPvs.Clear();  
     70                filteredBoxes.clear();  
     71                mUnfilteredPvsSize = 0; 
     72        } 
     73 
     74        ViewCell *mViewCell; 
     75        ObjectPvs mPvs; 
     76        int mUnfilteredPvsSize; 
     77        vector<AxisAlignedBox3> filteredBoxes; 
     78}; 
    7679 
    7780 
     
    129132 
    130133  void 
    131   RenderRays(const VssRayContainer &rays, int colorType = 0, int showDistribution = 15); 
     134  RenderRays(const VssRayContainer &rays, int colorType = 0, int showDistribution = 15, int maxAge = 9999999); 
    132135 
    133136  void 
  • GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.cpp

    r2592 r2593  
    670670                cout << "loading objects from " << buf << endl; 
    671671 
    672                 // load objects which will be used as pvs entries 
     672                // load scene objects used as pvs entries 
    673673                ObjectContainer pvsObjects; 
    674674                if (0) LoadObjects(buf, pvsObjects, mObjects); 
     
    731731                        { 
    732732                                if (!mViewCellsManager->LoadViewCellsGeometry(vcGeomFilename, extrudeBaseTriangles)) 
    733                                 { 
    734733                                        cerr << "loading view cells geometry failed" << endl; 
    735                                 } 
    736734                        } 
    737735                        else 
     
    16161614 
    16171615 
    1618 } 
     1616bool Preprocessor::AddGeometry(const string &filename, 
     1617                                                           ObjectContainer &pvsObjects,  
     1618                                                           const ObjectContainer &preprocessorObjects) 
     1619{ 
     1620//      bool success = LoadBinaryObj(filename, mSceneGraph->GetRoot(), &mFaseParents); 
     1621        bool success = LoadBinaryObj(filename, mSceneGraph->GetRoot(), NULL); 
     1622 
     1623        return success; 
     1624} 
     1625 
     1626} 
  • GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.h

    r2588 r2593  
    179179        Vector3 GetParentNormal(const int index) const; 
    180180 
    181         /** Sets a Preprocessor thread. 
     181        /** Sets a preprocessor thread. 
    182182        */ 
    183183        void SetThread(PreprocessorThread *t); 
    184184 
    185         /** Returns a Preprocessor thread. 
     185        /** Returns a preprocessor thread. 
    186186        */ 
    187187        PreprocessorThread *GetThread() const; 
     
    194194 
    195195        static bool LoadObjects(const string &filename, 
    196                                 ObjectContainer &pvsObjects,  
    197                                 const ObjectContainer &preprocessorObject); 
    198  
     196                                                        ObjectContainer &pvsObjects,  
     197                                                        const ObjectContainer &preprocessorObject); 
     198 
     199        /** Adds new geometry to the existing one. 
     200        */ 
     201        bool AddGeometry(const string &filename, ObjectContainer &pvsObjects, const ObjectContainer &prepObjects); 
    199202 
    200203        ///////////////////////// 
  • GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.vcproj

    r2587 r2593  
    366366                        <File 
    367367                                RelativePath="..\src\Exporter.h"> 
     368                        </File> 
     369                        <File 
     370                                RelativePath=".\FilterBasedDistribution.cpp"> 
     371                        </File> 
     372                        <File 
     373                                RelativePath=".\FilterBasedDistribution.h"> 
    368374                        </File> 
    369375                        <File 
     
    10591065                        </File> 
    10601066                        <File 
     1067                                RelativePath=".\sparsehash\src\windows\hash_fun.h"> 
     1068                        </File> 
     1069                        <File 
    10611070                                RelativePath=".\sparsehash\src\google\sparsehash\hash_fun.h"> 
    1062                         </File> 
    1063                         <File 
    1064                                 RelativePath=".\sparsehash\src\windows\hash_fun.h"> 
    10651071                        </File> 
    10661072                        <File 
  • GTP/trunk/Lib/Vis/Preprocessing/src/QtInterface/QtGlRenderer.cpp

    r2591 r2593  
    717717                if (1 && mShowRays)  
    718718                { 
    719                         RenderRays(mViewCellsManager->mVizBuffer.GetRays(), mRayVisualizationMethod, mShowDistribution); 
     719                        RenderRays(mViewCellsManager->mVizBuffer.GetRays(), mRayVisualizationMethod, mShowDistribution, 1); 
    720720                } 
    721721        } 
     
    731731        if (!mTopView) 
    732732                GlRenderer::SetupCamera(); 
    733         else { 
    734                 if (0) { 
     733        else  
     734        { 
     735                if (0)  
     736                { 
    735737                        float dist = Magnitude(mSceneGraph->GetBox().Diagonal())*0.05; 
    736738                        Vector3 pos = mViewPoint - dist*Vector3(mViewDirection.x, 
     
    940942        connect(mControlWidget, SIGNAL(SetShowRays(bool)), this, SLOT(SetShowRays(bool))); 
    941943 
    942         resize(1000, 500); 
     944        // setting the size here 
     945        resize(800, 600); 
    943946        mControlWidget->show(); 
    944947} 
     
    15251528                const float importance = (vcRatio - minRatio) * scale; 
    15261529         
    1527                 if (i < 20) 
     1530                if (0 && (i < 20)) 
    15281531                { 
    15291532                        cout << "pvs1: " << vc->GetPvs().GetSize() << " pvs2: " << compareInfo[i].mPvsSize << " importance: " << importance << endl; 
  • GTP/trunk/Lib/Vis/Preprocessing/src/QtInterface/QtGlViewer.cpp

    r2573 r2593  
    4646QSize QtGlViewer::sizeHint() const  
    4747{ 
    48         return QSize(500, 500); 
     48        return QSize(640, 480); 
    4949} 
    5050   
  • GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp

    r2588 r2593  
    27352735#endif 
    27362736 
    2737         bool hasContri = false; 
    27382737        // if ray not outside of view space 
    27392738        float relContribution = 0.0f; 
     
    27462745                hasAbsContribution = viewCell->GetPvs().AddSampleDirtyCheck(obj, ray.mPdf); 
    27472746                //hasAbsContribution = viewCell->GetPvs().AddSample(obj,ray.mPdf); 
    2748 #if MYSTATS 
    27492747                 
    27502748                if (hasAbsContribution) 
    27512749                { 
    27522750                        UpdateStatsForViewCell(viewCell, obj); 
    2753                         hasContri = true; 
    2754                 } 
    2755 #endif 
    2756  
     2751                } 
    27572752        } 
    27582753        else  
     
    27962791#endif 
    27972792 
    2798         return hasContri; 
     2793        return hasAbsContribution; 
    27992794} 
    28002795 
  • GTP/trunk/Lib/Vis/Preprocessing/src/VssRay.cpp

    r2176 r2593  
    6868        else 
    6969        { 
    70                 mTermination = ray.Extrap(1e6);//TODO: should be Limits::Infinity 
     70                mTermination = ray.Extrap(1e6); //TODO: should be Limits::Infinity 
    7171                mTerminationObject = NULL; 
    7272        } 
     
    8080        mFlags = 0; 
    8181        Vector3 dir = GetDir(); 
    82 //mFlags |= BorderSample; 
    8382#define BIDIRECTIONAL_RAY 0 
    8483#if BIDIRECTIONAL_RAY 
  • GTP/trunk/Lib/Vis/Preprocessing/src/VssRay.h

    r2575 r2593  
    4444  int mMailbox; 
    4545         
    46   // side of the ray - used for the ray classification 
    47   //  char mSide; 
    48          
    49   // computed t 
    50   //  float mT; 
    51  
    5246  // inverse of the ray size 
    5347  float mInvSize; 
     
    7670  short mPass; 
    7771 
    78   // Distribution used to generate this ray 
     72  /// Distribution used to generate this ray 
    7973  short mDistribution; 
    8074   
    81   // number of cells where this ray made a contribution to the PVS 
     75  /// number of cells where this ray made a contribution to the PVS 
    8276  int mPvsContribution; 
    8377   
    84   // sum of relative ray contributions per object 
     78  /// sum of relative ray contributions per object 
    8579  float mRelativePvsContribution; 
    8680 
    87   // weighted contribution to the pvs (based on the pass the ray was casted at) 
    88   // computed by the prperocessor 
     81  /// weighted contribution to the pvs (based on the pass the ray was casted at) 
     82  /// computed by the prperocessor 
    8983  float mWeightedPvsContribution; 
    9084 
    91   // probability of this ray 
     85  /// probability of this ray 
    9286  float mPdf; 
    9387   
  • GTP/trunk/Lib/Vis/Preprocessing/src/main.cpp

    r2582 r2593  
    338338                // $$matt 
    339339                preprocessor->renderer =  
    340                         new QtGlRendererBuffer(1024, 1024, 
     340                        new QtGlRendererBuffer(512, 512, 
    341341                        preprocessor->mSceneGraph, 
    342342                        preprocessor->mViewCellsManager, 
Note: See TracChangeset for help on using the changeset viewer.