Changeset 1983


Ignore:
Timestamp:
01/15/07 21:46:52 (17 years ago)
Author:
bittner
Message:

merge

Location:
GTP/trunk/Lib/Vis/Preprocessing/src
Files:
13 edited

Legend:

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

    r1972 r1983  
    8080  mFrame = 0; 
    8181  mWireFrame = false; 
    82   Environment::GetSingleton()->GetBoolValue("Preprocessor.detectEmptyViewSpace", mDetectEmptyViewSpace); 
     82  Environment::GetSingleton()->GetBoolValue("Preprocessor.detectEmptyViewSpace", 
     83                                                                                        mDetectEmptyViewSpace); 
    8384  mSnapErrorFrames = true; 
    8485  mSnapPrefix = "snap/"; 
    8586  mUseForcedColors = false; 
    8687  mRenderBoxes = false; 
    87   mUseGlLists = true; 
    88   //mUseGlLists = false; 
     88  //mUseGlLists = true; 
     89  mUseGlLists = false; 
    8990 
    9091  Environment::GetSingleton()->GetIntValue("Preprocessor.pvsRenderErrorSamples", mPvsStatFrames); 
     
    683684          glCallList(leaf->mGlList); 
    684685#else 
    685           for (int i=0; i < leaf->mObjects.size(); i++) 
    686                 RenderIntersectable(leaf->mObjects[i]); 
     686        for (int i=0; i < leaf->mObjects.size(); i++) 
     687          RenderIntersectable(leaf->mObjects[i]); 
    687688#endif 
    688689  } else { 
     
    15401541} 
    15411542 
    1542  
    1543  
    1544  
    1545  
    1546  
    1547  
    1548 } 
     1543void 
     1544GlRenderer::RenderViewPoint() 
     1545{ 
     1546  mWireFrame = true; 
     1547  glPushMatrix(); 
     1548  glTranslatef(mViewPoint.x, mViewPoint.y, mViewPoint.z); 
     1549  glScalef(5.0f,5.0f,5.0f); 
     1550  glPushAttrib(GL_CURRENT_BIT); 
     1551  glColor3f(1.0f, 0.0f, 0.0f); 
     1552  gluSphere((::GLUquadric *)mSphere, 
     1553                        1e-3*Magnitude(mViewCellsManager->GetViewSpaceBox().Size()), 6, 6); 
     1554  glPopAttrib(); 
     1555  glPopMatrix(); 
     1556  mWireFrame = false; 
     1557} 
     1558 
     1559 
     1560 
     1561 
     1562} 
  • GTP/trunk/Lib/Vis/Preprocessing/src/GlRenderer.h

    r1968 r1983  
    136136  _RenderScene(); 
    137137 
     138  void 
     139  RenderViewPoint(); 
    138140 
    139141  virtual void 
  • GTP/trunk/Lib/Vis/Preprocessing/src/IntelRayCaster.cpp

    r1972 r1983  
    118118#if DEBUG_RAYCAST 
    119119        Debug<<"C16 "<<flush; 
     120        static int counter=0; 
     121        Debug<<counter++<<endl; 
    120122#endif 
    121123 
     
    131133 
    132134        for (i=0; i < num; i++) { 
     135#if DEBUG_RAYCAST 
     136          if (counter == 43964) { 
     137                Debug<<rays[i].mOrigin<<" "<<rays[i].mDirection<<endl; 
     138          } 
     139#endif 
    133140          mlrtaStoreRayAS16(&rays[i].mOrigin.x, 
    134141                                                &rays[i].mDirection.x, 
     
    137144 
    138145#if DEBUG_RAYCAST 
    139                 Debug<<"TA\n"<<flush; 
     146        Debug<<"TA\n"<<flush; 
    140147#endif 
    141148 
     
    144151                                                   forward_hit_triangles, 
    145152                                                   forward_dist); 
    146          
    147         if (castDoubleRay) 
    148           { 
    149                 for (i=0; i < num; i++)  
    150                   { 
    151                         Vector3 dir = -rays[i].mDirection; 
    152                         mlrtaStoreRayAS16(&rays[i].mOrigin.x, 
    153                                                           &dir.x, 
    154                                                           i); 
    155                   } 
    156  
    157 #if DEBUG_RAYCAST 
    158                 Debug<<"TB\n"<<flush; 
    159 #endif 
    160  
    161                 mlrtaTraverseGroupAS16(&min.x, 
    162                                                            &max.x, 
    163                                                            backward_hit_triangles, 
    164                                                            backward_dist); 
     153 
     154#if DEBUG_RAYCAST 
     155        Debug<<"TAB\n"<<flush; 
     156#endif 
     157 
     158        if (castDoubleRay) { 
     159          for (i=0; i < num; i++)  { 
     160                Vector3 dir = -rays[i].mDirection; 
     161                mlrtaStoreRayAS16(&rays[i].mOrigin.x, 
     162                                                  &dir.x, 
     163                                                  i); 
    165164          } 
    166  
     165           
     166#if DEBUG_RAYCAST 
     167          Debug<<"TB\n"<<flush; 
     168#endif 
     169           
     170          mlrtaTraverseGroupAS16(&min.x, 
     171                                                         &max.x, 
     172                                                         backward_hit_triangles, 
     173                                                         backward_dist); 
     174        } 
     175         
    167176#if DEBUG_RAYCAST 
    168177        Debug<<"BBB\n"<<flush; 
  • GTP/trunk/Lib/Vis/Preprocessing/src/Makefile

    r1974 r1983  
    11############################################################################# 
    22# Makefile for building: preprocessor 
    3 # Generated by qmake (2.00a) (Qt 4.1.2) on: ne 14. I 01:57:15 2007 
     3# Generated by qmake (2.00a) (Qt 4.1.2) on: po 15. I 15:33:12 2007 
    44# Project:  preprocessor.pro 
    55# Template: app 
  • GTP/trunk/Lib/Vis/Preprocessing/src/QtInterface/QtGlRenderer.cpp

    r1967 r1983  
    338338  ViewCell *viewcell = NULL; 
    339339 
    340   PrVs prvs; 
    341    
    342   if (1 || !mUseFilter) { 
    343         viewcell = mViewCellsManager->GetViewCell(mViewPoint, true); 
    344   } else { 
    345         //  mViewCellsManager->SetMaxFilterSize(1); 
    346         mViewCellsManager->GetPrVS(mViewPoint, prvs, mViewCellsManager->GetFilterWidth()); 
    347         viewcell = prvs.mViewCell; 
    348   } 
     340  if (mDetectEmptyViewSpace)  
     341        glEnable( GL_CULL_FACE ); 
     342  else 
     343        glDisable( GL_CULL_FACE ); 
     344   
     345  viewcell = mViewCellsManager->GetViewCell(mViewPoint, true); 
    349346   
    350347  if (viewcell) { 
     
    379376        } 
    380377 
     378        Intersectable::NewMail(); 
     379 
    381380        // Render PVS 
    382381        if (mUseSpatialFilter && mRenderBoxes) { 
    383                 for (int i=0; i < mPvsCache.filteredBoxes.size(); i++) 
    384                         RenderBox(mPvsCache.filteredBoxes[i]); 
     382          for (int i=0; i < mPvsCache.filteredBoxes.size(); i++) 
     383                RenderBox(mPvsCache.filteredBoxes[i]); 
    385384        } else { 
    386                 ObjectPvsIterator it = mPvsCache.mPvs.GetIterator(); 
     385          ObjectPvsIterator it = mPvsCache.mPvs.GetIterator(); 
     386           
     387          mPvsSize = mPvsCache.mPvs.GetSize(); 
     388          for (; it.HasMoreEntries(); ) { 
     389                ObjectPvsEntry entry = it.Next(); 
     390                Intersectable *object = entry.mObject; 
    387391                 
    388                 mPvsSize = mPvsCache.mPvs.GetSize(); 
    389                 for (; it.HasMoreEntries(); ) { 
    390                         ObjectPvsEntry entry = it.Next(); 
    391                         Intersectable *object = entry.mObject; 
    392                          
    393                         if (mRenderVisibilityEstimates) { 
    394                                  
    395                                 float visibility = mTransferFunction*log10(entry.mData.mSumPdf + 1); // /5.0f 
    396                                 glColor3f(visibility, 0.0f, 0.0f); 
    397                                 mUseForcedColors = true; 
    398                                 RenderIntersectable(object); 
    399                                 mUseForcedColors = false; 
    400                         } else { 
    401                                 mUseForcedColors = false; 
    402                                 RenderIntersectable(object); 
    403                         } 
     392                if (mRenderVisibilityEstimates) { 
     393                  float visibility = mTransferFunction*log10(entry.mData.mSumPdf + 1); // /5.0f 
     394                  glColor3f(visibility, 0.0f, 0.0f); 
     395                  mUseForcedColors = true; 
     396                  RenderIntersectable(object); 
     397                  mUseForcedColors = false; 
     398                } else { 
     399                  mUseForcedColors = false; 
     400                  RenderIntersectable(object); 
    404401                } 
     402          } 
    405403        } 
    406  
     404         
    407405        if (mRenderFilter) { 
    408406          mWireFrame = true; 
     
    413411          glPushAttrib(GL_CURRENT_BIT); 
    414412          glColor3f(1.0f, 0.0f, 0.0f); 
    415           gluSphere((::GLUquadric *)mSphere, 
    416                                                         1e-3*Magnitude(mViewCellsManager->GetViewSpaceBox().Size()), 6, 6); 
     413          //      gluSphere((::GLUquadric *)mSphere, 
     414          //                            1e-3*Magnitude(mViewCellsManager->GetViewSpaceBox().Size()), 6, 6); 
    417415          glPopAttrib(); 
    418416          glPopMatrix(); 
    419417          mWireFrame = false; 
    420418        } 
    421          
    422         if (0 && mUseFilter) 
    423           mViewCellsManager->DeleteLocalMergeTree(viewcell); 
    424  
    425419  } else { 
    426                 ObjectContainer::const_iterator oi = mObjects.begin(); 
    427                 for (; oi != mObjects.end(); oi++) 
    428                         RenderIntersectable(*oi); 
     420        ObjectContainer::const_iterator oi = mObjects.begin(); 
     421        for (; oi != mObjects.end(); oi++) 
     422          RenderIntersectable(*oi); 
    429423  } 
    430424} 
     
    625619          RenderPvs(); 
    626620        } 
    627          
    628621  } 
    629622 
     
    947940  if (mViewCellsManager) 
    948941        vc = mViewCellsManager->GetViewCells().size(); 
     942 
    949943  int filter = 0; 
    950944  if (mViewCellsManager) 
     
    985979  if (mViewCellsManager) { 
    986980        //      mViewCellsManager->SetMaxFilterSize(number); 
    987     mViewCellsManager->CollectViewCells(number); 
     981 
     982        // $$ tmp off 
     983        mViewCellsManager->CollectViewCells(number); 
    988984 
    989985        // $$ does not work so far:( 
  • GTP/trunk/Lib/Vis/Preprocessing/src/QtInterface/QtGlViewer.cpp

    r1972 r1983  
    5454         
    5555        mRenderer->RenderPvs(); 
     56 
     57        mRenderer->RenderViewPoint(); 
     58 
    5659         
    5760//      if (mRenderer->mShowRays) { 
  • GTP/trunk/Lib/Vis/Preprocessing/src/QtInterface/QtGlViewer.h

    r1969 r1983  
    1111class QtGlViewer : public QGLWidget 
    1212{ 
    13   //Q_OBJECT 
     13  Q_OBJECT 
    1414 
    1515        friend class QtGlRendererWidget; 
  • GTP/trunk/Lib/Vis/Preprocessing/src/SamplingStrategy.cpp

    r1976 r1983  
    1010 
    1111namespace GtpVisibilityPreprocessor { 
     12 
     13#define MUTATION_USE_CDF 0 
    1214 
    1315 
     
    729731   
    730732  float pContributingRays = contributingRays/(float)vssRays.size(); 
    731   float importance = 1.0f/(pContributingRays + 1e-5); 
     733  float importance = sqr(1.0f/(pContributingRays + 1e-5)); 
    732734  // set this values for last contributingRays 
    733735  int index = mBufferStart - 1; 
     
    739741  } 
    740742 
    741    
     743#if MUTATION_USE_CDF 
    742744  // compute cdf 
    743745  mRays[0].mCdf = mRays[0].mImportance/(mRays[0].mSamples+1); 
     
    749751        mRays[i].mCdf *= scale; 
    750752  } 
    751  
     753#endif 
     754   
    752755  cout<<"Importance = "<< 
    753756        GetEntry(0).mImportance<<" "<< 
     
    888891 
    889892  int index; 
    890 #if 1 
     893 
     894#if !MUTATION_USE_CDF 
    891895  // get tail of the buffer 
    892896  index = (mLastIndex+1)%mRays.size(); 
  • GTP/trunk/Lib/Vis/Preprocessing/src/SamplingStrategy.h

    r1974 r1983  
    55using namespace std; 
    66 
     7#include "common.h" 
    78#include "Halton.h" 
    89namespace GtpVisibilityPreprocessor { 
  • GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp

    r1982 r1983  
    8080 
    8181        mViewCellsTree->SetViewCellsManager(this); 
     82        mSamplesStat.Reset(); 
    8283} 
    8384 
     
    20762077        stat.avgPvs/=stat.viewcells; 
    20772078        stat.avgPvsEntries/=stat.viewcells; 
     2079        stat.avgFilteredPvsEntries/=stat.viewcells; 
    20782080        stat.avgFilteredPvs/=stat.viewcells; 
    20792081        stat.avgFilterContribution/=stat.viewcells; 
     
    21092111  s<<"#AVG_REL_PVS_INCREASE\n"<<pvsStat.avgRelPvsIncrease<<endl; 
    21102112  s<<"#DEV_REL_PVS_INCREASE\n"<<pvsStat.devRelPvsIncrease<<endl; 
     2113 
     2114  s<<"#CONTRIBUTING_RAYS\n"<<mSamplesStat.mContributingRays<<endl; 
     2115 
     2116  if (mSamplesStat.mRays) { 
     2117        s<<"#AVG_VIEWCELLS_PER_RAY\n"<<mSamplesStat.mViewCells/(float)mSamplesStat.mRays<<endl; 
     2118  } else { 
     2119        s<<"#AVG_VIEWCELLS_PER_RAY\n 1 \n"; 
     2120  } 
     2121  mSamplesStat.Reset(); 
    21112122} 
    21122123 
     
    23292340        ray.mRelativePvsContribution = 0.0f; 
    23302341 
     2342        mSamplesStat.mRays++; 
     2343         
    23312344        if (!ray.mTerminationObject) 
    23322345                return 0.0f; 
     
    23522365        CastLineSegment(origin, termination, viewCells); 
    23532366 
    2354          
     2367        mSamplesStat.mViewCells+=viewCells.size(); 
     2368 
    23552369        if (storeViewCells) 
    23562370        {        
     
    23792393        } 
    23802394 
     2395        mSamplesStat.mPvsContributions += ray.mPvsContribution; 
     2396        if (ray.mPvsContribution) 
     2397          mSamplesStat.mContributingRays++; 
     2398         
    23812399#if AVG_RAY_CONTRIBUTIONS 
    23822400        ray.mRelativePvsContribution /= (float)viewCells.size(); 
  • GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.h

    r1982 r1983  
    8181{ 
    8282public: 
    83  
     83   
    8484  struct PerViewCellStat { 
    8585        float pvsSize; 
    8686        float relPvsIncrease; 
    8787  }; 
    88    
     88 
     89  struct SamplesStatistics { 
     90        int mRays; 
     91        int mViewCells; 
     92        int mContributingRays; 
     93        int mPvsContributions; 
     94        void Reset() { 
     95          mRays = 0; 
     96          mViewCells = 0; 
     97          mContributingRays = 0; 
     98          mPvsContributions = 0; 
     99        }; 
     100  }; 
     101 
    89102  struct PvsStatistics  
    90103        { 
     
    811824   
    812825  vector<PerViewCellStat> mPerViewCellStat; 
    813  
     826  SamplesStatistics mSamplesStat; 
    814827}; 
    815828 
  • GTP/trunk/Lib/Vis/Preprocessing/src/default.env

    r1974 r1983  
    172172                maxCostRatio 0.98 
    173173                ct_div_ci 0.5 
    174                 maxNodes 500000 
     174                maxNodes 200000 
    175175#500000  
    176176        } 
     
    205205 
    206206        #number of active view cells 
    207         active 20000 
    208         maxViewCells 20000 
     207        active 200000 
     208        maxViewCells 200000 
    209209 
    210210        maxStaticMemory 40 
  • GTP/trunk/Lib/Vis/Preprocessing/src/preprocessor.pro

    r1974 r1983  
    111111Trackball.cpp ObjExporter.cpp SubdivisionCandidate.cpp \ 
    112112Mailable.cpp \ 
    113 CombinedPreprocessor.cpp Vector2.cpp 
     113CombinedPreprocessor.cpp Vector2.cpp GlobalLinesRenderer.cpp \ 
     114RenderTexture.cpp 
    114115 
    115116SOURCES += BoostPreprocessorThread.cpp  
Note: See TracChangeset for help on using the changeset viewer.