Ignore:
Timestamp:
05/23/08 05:19:59 (16 years ago)
Author:
mattausch
Message:
 
Location:
GTP/trunk/Lib/Vis/Preprocessing/src
Files:
11 edited

Legend:

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

    r2695 r2696  
    132132                mViewPoint = Vector3(1189.54, 220.087, -462.869); 
    133133                mViewDirection = Vector3(-0.996972, -0, -0.0776569); 
     134 
     135                mViewPoint = Vector3(1199.53, 257.677, -457.145); 
     136                mViewDirection = Vector3(-0.71206, -0, -0.702108); 
    134137        } 
    135138 
  • GTP/trunk/Lib/Vis/Preprocessing/src/GvsPreprocessor.cpp

    r2695 r2696  
    12121212void GvsPreprocessor::ComputeViewCell() 
    12131213{ 
    1214         if (mCurrentViewCell->GetId() != 499) return; 
     1214        //if (mCurrentViewCell->GetId() != 499) return; 
    12151215 
    12161216        // clean up 
  • GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.cpp

    r2695 r2696  
    254254                { 
    255255                        Triangle3 tri = static_cast<TriangleIntersectable *>(obj)->GetItem(); 
     256                        //tri.mVertices[0] *= 10; tri.mVertices[1] *= 10; tri.mVertices[2] *= 10; 
    256257 
    257258                        samplesOut.write(reinterpret_cast<char *>(tri.mVertices + 0), sizeof(Vector3)); 
  • GTP/trunk/Lib/Vis/Preprocessing/src/PvsBase.h

    r2582 r2696  
    304304                const double LOG2E = 1.442695040f; 
    305305 
    306                 const float logN = log((float) Max(1, n))/LOG2E; 
    307                 const float logS = log((float) Max(1, mLastSorted))/LOG2E; 
    308                 const float logD = log((float) Max(1, dirtySize))/LOG2E; 
     306                const float logN = (float)log((float) Max(1, n))/LOG2E; 
     307                const float logS = (float)log((float) Max(1, mLastSorted))/LOG2E; 
     308                const float logD = (float)log((float) Max(1, dirtySize))/LOG2E; 
    309309 
    310310                if (8*(n + 2*dirtySize*logD) < 
  • GTP/trunk/Lib/Vis/Preprocessing/src/QtInterface/QtGlRenderer.cpp

    r2695 r2696  
    290290 
    291291        // some error happened 
    292         if (1)//pixelCount > pixelThres)  
     292        if (pixelCount > pixelThres)  
    293293        { 
    294294                cout << "f " << mFrame << " id " << viewcell->GetId() << " pvs " << pvsSize  
     
    313313                        im.save(qstr, "PNG"); 
    314314 
    315 #if 1 
    316                         /////////// 
    317                         //-- output computed pvs 
    318                          
    319                         //mUseFalseColors = false; 
    320                         mUseFalseColors = true; 
    321                         glPushAttrib(GL_CURRENT_BIT); 
    322                         glColor3f(0, 1, 0); 
    323  
    324                         glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); 
    325                         glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); 
    326  
    327                         KdNode::NewMail2(); 
    328                         Intersectable::NewMail(); 
    329  
    330                         ++ mCurrentFrame; 
    331  
    332                         // render pvs once 
    333                         //RenderPvs(pvs); 
    334                         RenderTrianglePvs(); 
    335  
    336                         glFlush(); 
    337  
    338                         mUseFalseColors = false; 
    339  
    340                         im = toImage(); 
    341                         sprintf(filename, "error-frame-%04d-%04d-%08d-pvs.png", mFrame, viewcell->GetId(), pixelCount); 
    342                         str = mSnapPrefix + filename; 
    343                         qstr = str.c_str(); 
    344                         im.save(qstr, "PNG"); 
    345  
    346                         glPopAttrib(); 
    347 #endif 
     315                        if (0) 
     316                        { 
     317                                /////////// 
     318                                //-- output computed pvs 
     319 
     320                                //mUseFalseColors = false; 
     321                                mUseFalseColors = true; 
     322                                glPushAttrib(GL_CURRENT_BIT); 
     323                                glColor3f(0, 1, 0); 
     324 
     325                                glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); 
     326                                glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); 
     327 
     328                                KdNode::NewMail2(); 
     329                                Intersectable::NewMail(); 
     330 
     331                                ++ mCurrentFrame; 
     332 
     333                                // render pvs once 
     334                                //RenderPvs(pvs); 
     335                                RenderTrianglePvs(); 
     336 
     337                                glFlush(); 
     338 
     339                                mUseFalseColors = false; 
     340 
     341                                im = toImage(); 
     342                                sprintf(filename, "error-frame-%04d-%04d-%08d-pvs.png", mFrame, viewcell->GetId(), pixelCount); 
     343                                str = mSnapPrefix + filename; 
     344                                qstr = str.c_str(); 
     345                                im.save(qstr, "PNG"); 
     346 
     347                                glPopAttrib(); 
     348                        } 
    348349                } 
    349350        } 
     
    26022603} 
    26032604 
    2604 /* 
    2605  
    2606 int ExampleRenderThread::faceAtPosition(const QPoint &pos)  
     2605 
     2606int QtGlRendererWidget::FindDynamicObject(const Vector3 &pos)  
    26072607{  
    26082608        // we need to lock the rendering context  
    2609         glw.lockGLContext();  
     2609        //glw.lockGLContext();  
     2610         
    26102611        // this is the same as in every OpenGL picking example  
    2611         const int MaxSize = 512;  
     2612        const int maxSize = 512;  
     2613         
    26122614        // see below for an explanation on the buffer content  
    2613         GLuint buffer[MaxSize];  
     2615        GLuint buffer[maxSize];  
    26142616        GLint viewport[4]; 
     2617 
    26152618        glGetIntegerv(GL_VIEWPORT, viewport);  
    2616         glSelectBuffer(MaxSize, buffer);  
     2619        glSelectBuffer(maxSize, buffer);  
     2620         
    26172621        // enter select mode  
    26182622        glRenderMode(GL_SELECT);  
    26192623        glInitNames();  
    26202624        glPushName(0);  
     2625         
    26212626        glMatrixMode(GL_PROJECTION);  
    26222627        glPushMatrix();  
    26232628        glLoadIdentity();  
    2624         gluPickMatrix((GLdouble)pos.x(), 215 (GLdouble)(viewport[3] - pos.y()), 216 5.0, 5.0, viewport);  
    2625         GLfloat x = (GLfloat)viewport_size.width() / viewport_size.height();  
     2629        gluPickMatrix((GLdouble)pos.x, (GLdouble)(viewport[3] - pos.y), 5.0f, 5.0f, viewport);  
     2630         
     2631        GLfloat x = (GLfloat)width() / height();  
    26262632        glFrustum(-x, x, -1.0, 1.0, 4.0, 15.0);  
    2627         draw();  
     2633         
     2634         glLoadName(1); 
     2635 
     2636        _RenderDynamicObject(mPendingDynamicObject); 
     2637 
    26282638        glMatrixMode(GL_PROJECTION);  
    26292639        glPopMatrix(); 
     2640 
    26302641        // finally release the rendering context again  
    26312642        if (!glRenderMode(GL_RENDER))  
    26322643        {  
    2633                 glw.unlockGLContext();  
     2644                //glw.unlockGLContext();  
    26342645                return -1;  
    26352646        }  
    26362647         
    2637         glw.unlockGLContext();  
     2648        //glw.unlockGLContext();  
    26382649         
    26392650        // Each hit takes 4 items in the buffer.  
     
    26492660        return buffer[3];  
    26502661} 
    2651 */ 
    2652 } 
     2662 
     2663void processHits (GLint hits, GLuint buffer[]) 
     2664{ 
     2665   unsigned int i, j; 
     2666   GLuint names, *ptr; 
     2667 
     2668   cout << "hits = %d" << endl;; 
     2669   ptr = (GLuint *) buffer; 
     2670 
     2671   for (i = 0; i < hits; i++)  
     2672   { 
     2673           /*  for each hit  */ 
     2674           names = *ptr; 
     2675 
     2676           printf (" number of names for hit = %d\n", names); ptr++; 
     2677           printf("  z1 is %g;", (float) *ptr/0x7fffffff); ptr++; 
     2678           printf(" z2 is %g\n", (float) *ptr/0x7fffffff); ptr++; 
     2679           printf ("   the name is "); 
     2680 
     2681           for (j = 0; j < names; j++) {     /*  for each name */ 
     2682                   printf ("%d ", *ptr); ptr++; 
     2683           } 
     2684           printf ("\n"); 
     2685   } 
     2686} 
     2687 
     2688} 
  • GTP/trunk/Lib/Vis/Preprocessing/src/QtInterface/QtGlRenderer.h

    r2695 r2696  
    8080        void RenderTrianglePvs(); 
    8181 
     82         
    8283public: 
    8384 
     
    248249 
    249250#if DYNAMIC_OBJECTS_HACK 
    250          
     251 
    251252        SceneGraphLeaf *mPendingDynamicObject; 
    252  
    253253        DynamicObjectsContainer mDynamicObjects; 
     254 
    254255#endif 
    255256 
     
    324325 
    325326        void WriteViewCellInfos(); 
    326  
    327327        /** Unproject x/y screen coordinates. 
    328328        */ 
    329329        Vector3 Unproject(int x, int y); 
    330330         
     331        int FindDynamicObject(const Vector3 &pos); 
     332 
    331333 
    332334public slots: 
  • GTP/trunk/Lib/Vis/Preprocessing/src/RandomViewCellsHandler.cpp

    r2695 r2696  
    139139        AxisAlignedBox3 bbox = mViewCellsManager->GetViewSpaceBox(); 
    140140 
    141         cout << "old view space box: " << bbox << endl; 
    142  
    143141        string buf; 
    144142 
     
    164162                                sscanf(buf.c_str(), "p %f %f %f %f %f %f", &pt.x, &pt.y, &pt.z, &dir.x, &dir.y, &dir.z); 
    165163                                 
    166                                 if (1) 
    167                                 { 
    168                                         // include new point into view space box 
    169                                         if (!bbox.IsInside(pt)) 
    170                                                 bbox.Include(pt); 
    171                                 } 
    172                                 else 
    173                                 { 
    174                                         // other variant: clamp to box 
    175                                         bbox.ClampToBox(pt); 
    176                                 } 
    177  
     164                                // other variant: clamp to box 
     165                                bbox.ClampToBox(pt); 
     166                                 
    178167                                SimpleRay ray(pt, dir, 0, 1); 
    179168 
     
    194183                } 
    195184        } 
    196  
    197         // set updated view space box containing all view points 
    198         mViewCellsManager->SetViewSpaceBox(bbox); 
    199  
    200         cout << "new view space box: " << mViewCellsManager->GetViewSpaceBox() << endl; 
    201185 
    202186        return true; 
  • GTP/trunk/Lib/Vis/Preprocessing/src/SamplingStrategy.cpp

    r2695 r2696  
    822822 
    823823        // get point on view cell surface 
    824         if (1) 
     824        if (0) 
    825825        { 
    826826                //mViewCell->GetRandomEdgePoint(origin, normal); 
     
    829829                // move a little bit back to avoid piercing through walls 
    830830                // that bound the view cell 
    831                 if (1) origin -= 0.01f * normal; 
     831                if (0) origin -= 0.01f * normal; 
    832832        } 
    833833        else 
  • GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp

    r2695 r2696  
    22772277 
    22782278 
    2279 void VspOspViewCellsManager::SetViewSpaceBox(const AxisAlignedBox3 &box) 
    2280 { 
    2281         mViewSpaceBox = box; 
    2282         mHierarchyManager->mVspTree->mBoundingBox = box; 
    2283  
    2284         cout << "vsp bounding box: " << box << endl; 
    2285         // hack: create clip plane relative to new view space box 
    2286         CreateClipPlane(); 
    2287         // the total area of the view space has changed 
    2288         mTotalAreaValid = false; 
    2289 } 
    2290  
    2291  
    22922279void ViewCellsManager::CreateClipPlane() 
    22932280{ 
  • GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.h

    r2695 r2696  
    12481248                                                           const ObjectContainer &objects); 
    12491249 
    1250         /** Sets a view space boundary. 
    1251         */ 
    1252         virtual void SetViewSpaceBox(const AxisAlignedBox3 &box); 
     1250         
    12531251 
    12541252#if TEST_PACKETS 
  • GTP/trunk/Lib/Vis/Preprocessing/src/VspTree.h

    r2695 r2696  
    354354        friend class ViewCellsParseHandlers; 
    355355        friend class HierarchyManager; 
    356         friend class VspOspViewCellsManager; 
     356        //friend class VspOspViewCellsManager; 
    357357 
    358358public: 
Note: See TracChangeset for help on using the changeset viewer.