Ignore:
Timestamp:
01/25/06 14:35:01 (18 years ago)
Author:
bittner
Message:

rss preprocessor debugging + merge

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/VUT/GtpVisibilityPreprocessor/src/GlRenderer.cpp

    r572 r576  
    4444  mViewDirection = Vector3(0,0,1); 
    4545  //  timerId = startTimer(10); 
     46  // debug coords for atlanta 
     47  mViewPoint = Vector3(3473, 6.778, -1699); 
     48  mViewDirection = Vector3(-0.2432, 0, 0.97); 
     49   
    4650  mFrame = 0; 
    4751  mWireFrame = false; 
    4852  environment->GetBoolValue("Preprocessor.detectEmptyViewSpace", mDetectEmptyViewSpace); 
     53  mSnapErrorFrames = false; 
     54  mSnapPrefix = ""; 
    4955 
    5056} 
     
    177183  glGetOcclusionQueryuivNV = (PFNGLGETOCCLUSIONQUERYUIVNVPROC) 
    178184        wglGetProcAddress("glGetOcclusionQueryuivNV"); 
    179 } 
    180  
     185 
     186        glClearColor(0.0f, 0.0f, 0.0f, 1.0f); 
     187 
     188} 
     189 
     190void 
     191GlRendererWidget::RenderInfo() 
     192{ 
     193  QString s; 
     194  s.sprintf("frame:%04d viewpoint:(%4.1f,%4.1f,%4.1f) dir:(%4.1f,%4.1f,%4.1f)", 
     195                        mFrame, 
     196                        mViewPoint.x, 
     197                        mViewPoint.y, 
     198                        mViewPoint.z, 
     199                        mViewDirection.x, 
     200                        mViewDirection.y, 
     201                        mViewDirection.z 
     202 
     203                        ); 
     204  renderText(0,20,s); 
     205} 
    181206 
    182207 
     
    245270                                                                   KdTree *tree): 
    246271QGLPixelBuffer(QSize(w, h)), GlRenderer(sceneGraph, viewcells, tree) { 
    247   
    248272  
    249273 environment->GetIntValue("Preprocessor.pvsRenderErrorSamples", mPvsStatFrames); 
     
    256280 
    257281float 
    258 GlRenderer::GetPixelError() 
     282GlRendererBuffer::GetPixelError() 
    259283{ 
    260284  float pErrorPixels = -1.0f; 
     
    262286  glReadBuffer(GL_BACK); 
    263287   
    264   mUseFalseColors = true; 
    265    
     288  //  mUseFalseColors = true; 
     289   
     290  mUseFalseColors = false; 
    266291 
    267292  static int query = -1; 
     
    311336        glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); 
    312337 
     338        glColorMask(GL_FALSE, GL_TRUE, GL_FALSE, GL_FALSE); 
     339 
    313340        // Render PVS 
    314341        std::map<Intersectable *, 
     
    320347          RenderIntersectable(object); 
    321348        } 
     349 
     350        //      glColorMask(GL_TRUE, GL_FALSE, GL_FALSE, GL_FALSE); 
     351        glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); 
     352        mUseFalseColors = true; 
    322353 
    323354        glBeginOcclusionQueryNV(query); 
     
    337368         
    338369        pErrorPixels = ((float)pixelCount)/(GetWidth()*GetHeight()); 
     370        if (mSnapErrorFrames && pErrorPixels > 0.01) { 
     371           
     372          char filename[256]; 
     373          sprintf(filename, "error-frame-%04d-%0.5f.png", mFrame, pErrorPixels); 
     374          QImage im = toImage(); 
     375          im.save(mSnapPrefix + filename, "PNG"); 
     376          if (1) { //0 && mFrame == 1543) { 
     377                int x,y; 
     378                int lastIndex = -1; 
     379                for (y=0; y < im.height(); y++) 
     380                  for (x=0; x < im.width(); x++) { 
     381                        QRgb p = im.pixel(x,y); 
     382                        int index = qRed(p) + (qGreen(p)<<8) + (qBlue(p)<<16); 
     383                        if (qGreen(p) != 255 && index!=0) { 
     384                          if (index != lastIndex) { 
     385                                Debug<<"ei="<<index<<" "; 
     386                                lastIndex = index; 
     387                          } 
     388                        } 
     389                  } 
     390          } 
     391 
     392 
     393          mUseFalseColors = false; 
     394          glPushAttrib(GL_CURRENT_BIT); 
     395          glColor3f(0,1,0); 
     396          glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); 
     397          SetupCamera(); 
     398          glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); 
     399           
     400          // Render PVS 
     401          std::map<Intersectable *, 
     402                PvsData<Intersectable *>, 
     403                LtSample<Intersectable *> >::const_iterator it = viewcell->GetPvs().mEntries.begin(); 
     404           
     405          for (; it != viewcell->GetPvs().mEntries.end(); ++ it) { 
     406                Intersectable *object = (*it).first; 
     407                RenderIntersectable(object); 
     408          } 
     409 
     410          im = toImage(); 
     411          sprintf(filename, "error-frame-%04d-%0.5f-pvs.png", mFrame, pErrorPixels); 
     412          im.save(mSnapPrefix + filename, "PNG"); 
     413          glPopAttrib(); 
     414        } 
     415        glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); 
    339416  } 
    340417   
     
    400477                  diff.setPixel(x, y, qRgba(255,128,128,255)); 
    401478                  errorPixels++; 
     479                   
    402480                } 
    403481        pErrorPixels = ((float)errorPixels)/(im1.height()*im1.width()); 
     
    506584  for (int i=0; i < mPvsStatFrames; i++) { 
    507585        float err; 
     586        // set frame id for saving the error buffer 
     587        mFrame = i; 
    508588        RandomViewPoint(); 
     589 
     590        // atlanta problematic frames: 325 525 691 1543 
     591#if 0 
     592        if (mFrame != 325 && 
     593                mFrame != 525 && 
     594                mFrame != 691 && 
     595                mFrame != 1543) 
     596          mPvsErrorBuffer[i] = -1; 
     597        else { 
     598          Debug<<"frame ="<<mFrame<<" vp="<<mViewPoint<<" vd="<<mViewDirection<<endl; 
     599        } 
     600#endif 
    509601        if (mPvsErrorBuffer[i] > 0.0f) { 
    510602          mPvsErrorBuffer[i] = GetPixelError(); 
     
    592684GlRendererWidget::paintGL() 
    593685{ 
    594         RenderErrors(); 
    595          
    596         mFrame++; 
     686  RenderErrors(); 
     687  RenderInfo(); 
     688  mFrame++; 
    597689} 
    598690 
Note: See TracChangeset for help on using the changeset viewer.