Changeset 2686


Ignore:
Timestamp:
05/18/08 00:30:13 (16 years ago)
Author:
mattausch
Message:

fixed several problems

Location:
GTP/trunk/Lib/Vis/Preprocessing
Files:
19 edited

Legend:

Unmodified
Added
Removed
  • GTP/trunk/Lib/Vis/Preprocessing/scripts/demo1.env

    r2677 r2686  
    7575        visibilityFile visibility.xml 
    7676        loadMeshes false 
    77         loadKdTree      false 
     77        loadKdTree false 
    7878        exportKdTree false 
    7979 
     
    177177                maxCostRatio 0.98 
    178178                ct_div_ci 0.5 
    179                 maxNodes 50000 
    180 #500000  
    181         } 
    182  
    183         splitMethod spatialMedian 
    184 #       splitMethod SAH 
     179                maxNodes 100000 
     180        } 
     181 
     182#       splitMethod spatialMedian 
     183        splitMethod SAH 
    185184        splitBorder 0.01 
    186185} 
  • GTP/trunk/Lib/Vis/Preprocessing/scripts/run_demo_vienna

    r2682 r2686  
    55 
    66#COMMAND="./release/preprocessor.exe -preprocessor_quit_on_finish+" 
    7 COMMAND="../scripts/preprocessor.sh -preprocessor_quit_on_finish- -preprocessor_use_gl_renderer+ -preprocessor_evaluate_filter- -samples_per_evaluation=5000000 -samples_per_pass=500000 -total_samples=100000000" 
     7COMMAND="../scripts/preprocessor.sh -preprocessor_quit_on_finish- -preprocessor_use_gl_renderer+ -preprocessor_evaluate_filter- -samples_per_evaluation=5000000 -samples_per_pass=500000 -total_samples=100000000 -view_cells_import_random_viewcells+" 
    88 
    99 
    10 SCENE=../data/vienna/vienna_cropped.obj 
    11 #SCENE=../data/vienna/city_full.obj 
     10#SCENE=../data/vienna/vienna_cropped.obj 
     11SCENE=../data/vienna/city_full.obj 
    1212 
    13 VIEWCELLS=../data/vienna/vienna_cropped-seq-3000-false-20-viewcells.xml.gz 
     13VIEWCELLS=../data/vienna/vienna_cropped-gradient-viewcells.xml.gz 
     14#VIEWCELLS=../data/vienna/vienna_cropped-seq-3000-false-20-viewcells.xml.gz 
    1415#VIEWCELLS=../data/vienna/vienna_cropped-57000-viewcells.xml.gz 
     16VIEWPOINTS=../data/vienna/change.vp 
    1517 
    1618 
     
    2426 
    2527DISTRIBUTIONS=mutation+object_direction+spatial 
     28#DISTRIBUTIONS=spatial 
    2629 
    2730$COMMAND -preprocessor=combined \ 
     
    3235-preprocessor_visibility_file=$PREFIX-i-mixed-b1-n4a.xml \ 
    3336-preprocessor_stats=$PREFIX-i-mixed-b1-n4a.log \ 
     37-preprocessor_detect_empty_viewspace- \ 
    3438-preprocessor_histogram_file=$PREFIX-i-mixed-b1-n4a.hlog \ 
     39-view_cells_random_viewpoint_list=$VIEWPOINTS \ 
    3540demo1.env 
    3641 
  • GTP/trunk/Lib/Vis/Preprocessing/src/AxisAlignedBox3.cpp

    r2609 r2686  
    24822482} 
    24832483 
    2484 } 
    2485  
     2484 
     2485void AxisAlignedBox3::ClampToBox(Vector3 &pt) const 
     2486{ 
     2487        if (pt.x > mMax.x) pt.x = mMax.x; 
     2488        if (pt.y > mMax.y) pt.y = mMax.y; 
     2489        if (pt.z > mMax.z) pt.z = mMax.z; 
     2490 
     2491        if (pt.x < mMin.x) pt.x = mMin.x; 
     2492        if (pt.y < mMin.y) pt.y = mMin.y; 
     2493        if (pt.z < mMin.z) pt.z = mMin.z; 
     2494} 
     2495 
     2496} 
     2497 
  • GTP/trunk/Lib/Vis/Preprocessing/src/AxisAlignedBox3.h

    r2575 r2686  
    8181  float SqrRadius() const { return 0.5f*SqrMagnitude(Size()); } 
    8282   
     83  /** Clamps the point to the box. 
     84  */ 
     85  void ClampToBox(Vector3 &pt) const; 
     86 
    8387  // Return whether the box is unbounded.  Unbounded boxes appear 
    8488  // when unbounded objects such as quadric surfaces are included. 
  • GTP/trunk/Lib/Vis/Preprocessing/src/Environment.cpp

    r2647 r2686  
    16941694                                   "view_cells_import_random_viewcells",  
    16951695                                   "false"); 
     1696         
     1697        RegisterOption("ViewCells.randomViewPointsList", 
     1698                optString, 
     1699                "view_cells_random_viewpoint_list=", 
     1700                ""); 
     1701 
    16961702 
    16971703        RegisterOption("ViewCells.exportRandomViewCells", 
  • GTP/trunk/Lib/Vis/Preprocessing/src/GlRenderer.cpp

    r2685 r2686  
    9090        mSceneGraph->CollectObjects(mObjects); 
    9191 
    92 #if 1 
    93         viewCellsManager->GetViewPoint(mViewPoint); 
    94         mViewDirection = Vector3(0,0,1); 
    95 #else 
    96  
    97         // for sg snapshot 
    98         mViewPoint = Vector3(32.8596, 9.86079, -1023.79); 
    99         mViewDirection = Vector3(-0.92196, 0, 0.387286); 
    100  
    101         // inside 
    102         mViewPoint = Vector3(14.1254, 10.9818, -1032.75); 
    103         mViewDirection = Vector3(-0.604798, 0, 0.796379); 
    104  
    105         // outside 
    106         mViewPoint = Vector3(35.092, 17.7078, -857.966); 
    107         mViewDirection = Vector3(-0.411287, 0, -0.911506); 
    108  
    109         // strange viewcell for error measurements (id 534) 
    110         mViewPoint = Vector3(1405.9, 218.284, -736.785); 
    111         mViewDirection = Vector3(0.989155, 0, 0.146877); 
    112  
    113 #endif 
     92        if (0) 
     93        { 
     94                viewCellsManager->GetViewPoint(mViewPoint); 
     95                mViewDirection = Vector3(0,0,1); 
     96        } 
     97        else 
     98        { 
     99 
     100                // for sg snapshot 
     101                mViewPoint = Vector3(32.8596, 9.86079, -1023.79); 
     102                mViewDirection = Vector3(-0.92196, 0, 0.387286); 
     103 
     104                // inside 
     105                mViewPoint = Vector3(14.1254, 10.9818, -1032.75); 
     106                mViewDirection = Vector3(-0.604798, 0, 0.796379); 
     107 
     108                // outside 
     109                mViewPoint = Vector3(35.092, 17.7078, -857.966); 
     110                mViewDirection = Vector3(-0.411287, 0, -0.911506); 
     111 
     112                // strange viewcell for error measurements (id 534) 
     113                mViewPoint = Vector3(1405.9, 218.284, -736.785); 
     114                mViewDirection = Vector3(0.989155, 0, 0.146877); 
     115 
     116                // high error for city_full 
     117                mViewPoint = Vector3(842.521, 194.708, -136.708); 
     118                mViewDirection = Vector3(0.730514, 0, -0.682897); 
     119 
     120                // also high error for city_full 
     121                mViewPoint = Vector3(1038.7f, 192.4f, -471.0f); 
     122                mViewDirection = Vector3(-0.8f, 0.0f, -0.6f); 
     123        } 
    114124 
    115125        mFrame = 0; 
     
    118128                                                      mDetectEmptyViewSpace); 
    119129 
    120         mSnapErrorFrames = false; 
    121         //mSnapErrorFrames = true; 
     130        //mSnapErrorFrames = false; 
     131        mSnapErrorFrames = true; 
    122132 
    123133        mSnapPrefix = "snap/"; 
     
    15321542 
    15331543        static bool first = true; 
     1544 
    15341545        if (first) { 
    1535  
    15361546 
    15371547                bool exportRandomViewCells; 
     
    19001910                TriangleIntersectable *obj = static_cast<TriangleIntersectable *>(leaf->mGeometry[i]); 
    19011911 
     1912                if (obj->GetId() != i) 
     1913                        cerr << "****\n****riesenfehler" << endl; 
    19021914                Triangle3 tri = obj->GetItem(); 
    19031915                const Vector3 n = tri.GetNormal(); 
     
    19161928        } 
    19171929 
     1930        cout << "\n******** created vertex arrays **********" << endl;   
     1931 
    19181932        if (mUseVbos) 
    19191933        { 
     
    19331947                delete [] mData; 
    19341948                mData = NULL; 
    1935         } 
    1936  
    1937         cout << "\n******** created vertex buffer objects **********" << endl;   
     1949 
     1950                cout << "\n******** created vertex buffer objects **********" << endl;   
     1951        } 
    19381952} 
    19391953 
  • GTP/trunk/Lib/Vis/Preprocessing/src/GlRenderer.h

    r2677 r2686  
    212212  Vector3 GetViewPoint() const { return mViewPoint; } 
    213213 
     214  bool GetUseVbos() const { return mUseVbos; } 
     215 
    214216 
    215217public: 
     
    245247        void RenderKdLeaf(KdLeaf *leaf); 
    246248 
    247  
     249         
    248250        ////////////////// 
    249251 
  • GTP/trunk/Lib/Vis/Preprocessing/src/GvsPreprocessor.cpp

    r2677 r2686  
    226226                        mTrianglePvs.push_back(obj); 
    227227                 
    228                         mGenericStats = mTrianglePvs.size(); 
     228                        mGenericStats = (int)mTrianglePvs.size(); 
    229229 
    230230                        // exchange the triangle with the node in the pvs for kd pvs 
     
    971971 
    972972        ComputeViewCell(vc); 
    973                 // $$ JB HACK compute just first viewcell 
    974                 //              break; 
    975973        } 
    976974} 
     
    979977void GvsPreprocessor::PerViewCellComputation2() 
    980978{ 
    981         ViewCell *vc; 
    982  
    983979        while (1) 
    984980        { 
     
    11381134                // provide list of view cells to compute 
    11391135                CompileViewCellsList(); 
     1136 
    11401137                // start per view cell gvs 
    11411138                PerViewCellComputation(); 
  • GTP/trunk/Lib/Vis/Preprocessing/src/HavranRayCaster.cpp

    r2662 r2686  
    392392#ifdef USE_HAVRAN_RAYCASTER 
    393393 
    394   int hit_triangles[16]; 
    395   float dist[16]; 
     394  //int hit_triangles[16]; 
     395  //float dist[16]; 
    396396  Vector3 normals[16]; 
    397397  Vector3 min = sbox.Min(); 
     
    400400  int packets = rays.size() / 16; 
    401401   
    402   int i, j, k = 0; 
     402  int i, k = 0; 
    403403  Vector3 dir; 
    404404   
     
    413413 
    414414  for (; k < rays.size(); k++) { 
    415     double normal[3]; 
     415    //double normal[3]; 
    416416    mKtbtree->FindNearestI(rays[k]); 
    417417    // ??? What to do with the results ? These are 
  • GTP/trunk/Lib/Vis/Preprocessing/src/Mutation.cpp

    r2606 r2686  
    186186        float importance = 1.0f; 
    187187        if (mUsePassImportance)  
    188           importance = 1.0f/(pContributingRays + 1e-5); 
     188          importance = 1.0f/(pContributingRays + 1e-5f); 
    189189        // set this values for last contributingRays 
    190190        int index = mBufferStart - 1; 
  • GTP/trunk/Lib/Vis/Preprocessing/src/QtInterface/QtGlRenderer.cpp

    r2685 r2686  
    3030 
    3131#include <QVBoxLayout> 
    32 static GLint cubeArray[][3] = { 
    33     {0, 0, 0}, {0, 1, 0}, {1, 1, 0}, {1, 0, 0}, 
    34     {0, 0, 1}, {1, 0, 1}, {1, 1, 1}, {0, 1, 1}, 
    35     {0, 0, 0}, {1, 0, 0}, {1, 0, 1}, {0, 0, 1}, 
    36     {0, 1, 0}, {0, 1, 1}, {1, 1, 1}, {1, 1, 0}, 
    37     {0, 1, 0}, {0, 0, 0}, {0, 0, 1}, {0, 1, 1}, 
    38     {1, 0, 0}, {1, 1, 0}, {1, 1, 1}, {1, 0, 1} 
    39 }; 
    40  
    41 static GLint cubeTextureArray[][2] = { 
    42     {0, 0}, {1, 0}, {1, 1}, {0, 1}, 
    43     {0, 0}, {0, 1}, {1, 1}, {1, 0}, 
    44     {0, 0}, {1, 0}, {1, 1}, {0, 1}, 
    45     {1, 0}, {0, 0}, {0, 1}, {1, 1}, 
    46     {0, 0}, {1, 0}, {1, 1}, {0, 1}, 
    47     {1, 0}, {0, 0}, {0, 1}, {1, 1} 
    48 }; 
    49  
    50 static GLint faceArray[][2] = { 
    51     {1, -1}, {1, 1}, {-1, 1}, {-1, -1} 
    52 }; 
    53  
    54 static GLubyte colorArray[][4] = { 
    55     {170, 202, 0, 255}, 
    56     {120, 143, 0, 255}, 
    57     {83, 102, 0, 255}, 
    58     {120, 143, 0, 255} 
    59 }; 
    60  
    61  
     32 
     33 
     34using namespace std; 
    6235 
    6336 
     
    7952 
    8053 
     54static SimpleRayContainer sViewPointsList; 
     55static SimpleRayContainer::const_iterator sViewPointsListIt; 
     56 
     57 
    8158 
    8259static inline bool ilt(Intersectable *obj1, Intersectable *obj2) 
     
    9976} 
    10077#endif 
    101  
    102  
    103 void QtGlRendererBuffer::dummyBuffer() 
    104 {  
    105         //QGLPixelBuffer *dummy = new QGLPixelBuffer(QSize(256, 256), format(), this); 
    106      
    107         // set up the pbuffer context 
    108     makeCurrent(); 
    109      
    110         glEnableClientState(GL_VERTEX_ARRAY); 
    111     glEnableClientState(GL_TEXTURE_COORD_ARRAY); 
    112     glVertexPointer(3, GL_INT, 0, cubeArray); 
    113     glTexCoordPointer(2, GL_INT, 0, cubeTextureArray); 
    114     glColorPointer(4, GL_UNSIGNED_BYTE, 0, colorArray); 
    115  
    116     glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); 
    117     glEnable(GL_BLEND); 
    118     glEnable(GL_TEXTURE_2D); 
    119     glEnable(GL_DEPTH_TEST); 
    120  
    121     glClearColor(1.0f, 1.0f, 1.0f, 1.0f); 
    122  
    123     glViewport(0, 0, size().width(), size().height()); 
    124     glMatrixMode(GL_PROJECTION); 
    125     glLoadIdentity(); 
    126     glOrtho(-1, 1, -1, 1, -99, 99); 
    127     glTranslatef(-0.5f, -0.5f, 0.0f); 
    128     glMatrixMode(GL_MODELVIEW); 
    129     glLoadIdentity(); 
    130  
    131     
    132         glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT); 
    133  
    134         // draw cube background 
    135         glPushMatrix(); 
    136         glLoadIdentity(); 
    137         glTranslatef(0.5f, 0.5f, -2.0f); 
    138         glDisable(GL_TEXTURE_2D); 
    139         glEnableClientState(GL_COLOR_ARRAY); 
    140         glVertexPointer(2, GL_INT, 0, faceArray); 
    141         glDrawArrays(GL_QUADS, 0, 4); 
    142         glVertexPointer(3, GL_INT, 0, cubeArray); 
    143         glDisableClientState(GL_COLOR_ARRAY); 
    144         glEnable(GL_TEXTURE_2D); 
    145         glPopMatrix(); 
    146  
    147         // draw cube 
    148         glTranslatef(0.5f, 0.5f, 0.5f); 
    149         glRotatef(3.0f, 1.0f, 1.0f, 1.0f); 
    150         glTranslatef(-0.5f, -0.5f, -0.5f); 
    151         glColor4f(0.9f, 0.9f, 0.9f, 1.0f); 
    152         glDrawArrays(GL_QUADS, 0, 24); 
    153  
    154         QImage im = toImage(); 
    155         QString qstr("test.png"); 
    156  
    157         im.save(qstr, "PNG"); 
    158  
    159         doneCurrent(); 
    160 } 
    16178 
    16279 
     
    210127{ 
    211128        EnableDrawArrays(); 
     129         
     130        // prepare pvs for rendering 
    212131        PreparePvs(pvs); 
    213132 
     
    348267        pErrorPixels = (float)pixelCount / (GetWidth() * GetHeight()); 
    349268 
     269        const int pixelThres = 100000; 
     270 
    350271        // some error happened 
    351         if (pixelCount > 0)  
    352         { 
    353                 cout << "frame " << mFrame << " vc id: " << viewcell->GetId() << " pvs: " << pvsSize << " pc: " << pixelCount << endl; 
     272        if (pixelCount > pixelThres)  
     273        { 
     274                cout << "frame " << mFrame << " vc id: " << viewcell->GetId() << " pvs: " << pvsSize << " pc: " << pixelCount << " vp: " << mViewPoint << endl; 
    354275         
    355276                if (mSnapErrorFrames)  
     
    611532        { 
    612533                Intersectable *obj = it.Next(); 
     534 
    613535                switch (obj->Type()) 
    614536                { 
     
    620542                        break; 
    621543#if DYNAMIC_OBJECTS_HACK 
    622 #if USE_TRANSFORMED_MESH_INSTANCE_HACK 
    623  
    624                 case Intersectable::TRANSFORMED_MESH_INSTANCE: 
    625                         mDynamicObjects.push_back(static_cast<TransformedMeshInstance *>(obj)); 
    626                         break; 
    627  
    628 #else 
     544 
    629545                case Intersectable::SCENEGRAPHLEAF_INTERSECTABLE: 
    630546                        mDynamicObjects.push_back(static_cast<SceneGraphLeafIntersectable *>(obj)->GetItem()); 
    631547                        break; 
    632 #endif 
    633548#endif 
    634549                default: 
     
    660575        if (viewcell)  
    661576        { 
    662 #if 0 
     577#if 1 
    663578                // copy the pvs so that it can be filtered ... 
    664579                if (PvsChanged(viewcell))  
     
    689604                        PreparePvs(mPvsCache.mPvs); 
    690605                        emit PvsUpdated(); 
     606 
    691607                        mCurrentPvsCost = mPvsCache.mPvs.EvalPvsCost(); 
    692608                } 
    693609#else 
    694610         
     611                // update the indices for rendering 
    695612                PreparePvs(viewcell->GetPvs()); 
    696613                emit PvsUpdated(); 
     
    721638                        mWireFrame = false; 
    722639                } 
    723                 mCurrentPvsCost = viewcell->GetPvs().EvalPvsCost(); 
     640                 
     641                //mCurrentPvsCost = viewcell->GetPvs().EvalPvsCost(); 
    724642        }  
    725643        else  
     
    797715 
    798716 
    799 void QtGlRendererWidget::timerEvent(QTimerEvent *event)  
    800 { 
    801         //std::cout << "Timer ID:" << event->timerId(); 
    802         update(); 
     717void QtGlRendererWidget::timerEvent(QTimerEvent *timerEvent)  
     718{ 
     719        if (mReplayMode && (timerEvent->timerId() == mReplayTimerId)) 
     720        { 
     721                if (sViewPointsListIt == sViewPointsList.end()) 
     722                { 
     723                        cout << "stopping replay" << endl; 
     724                        mReplayMode = false; 
     725                } 
     726                else 
     727                { 
     728                        SimpleRay sray = *sViewPointsListIt; 
     729 
     730                        mViewPoint = sray.mOrigin; 
     731                        mViewDirection = sray.mDirection; 
     732 
     733                        ++ sViewPointsListIt; 
     734                } 
     735 
     736 
     737                updateGL(); 
     738        } 
     739 
     740        if (timerEvent->timerId() == mUpdateTimerId) 
     741                update(); 
    803742} 
    804743 
     
    826765QtGlRendererWidget::mouseMoveEvent(QMouseEvent *e) 
    827766{ 
     767        if (mReplayMode) 
     768                return; 
     769 
    828770        float MOVE_SENSITIVITY = Magnitude(mSceneGraph->GetBox().Diagonal())*1e-3; 
    829771        float TURN_SENSITIVITY = 0.1f; 
     
    838780 
    839781        const float t = 1.0f; 
    840  
    841782        if (e->modifiers() & Qt::ControlModifier)  
    842783        { 
     
    10791020        mComputeGVS = false; 
    10801021        mUseRandomColorPerPvsObject = false; 
     1022        //mUseRandomColorPerPvsObject = true; 
    10811023 
    10821024        mHideByCost = false; 
     
    10871029 
    10881030        const int delay = 250; // in milliseconds 
    1089         timerId = startTimer(delay); 
     1031        mUpdateTimerId = startTimer(delay); 
     1032        mReplayTimerId = startTimer(1); // use fastest replay rate 
    10901033 
    10911034        bool tmp; 
     
    11211064        mShowRays = false; 
    11221065 
     1066        mReplayMode = false; 
     1067 
    11231068        SetSceneCut(1000); 
    11241069        mControlWidget = new QtRendererControlWidget(NULL); 
     
    11331078        connect(mControlWidget, SIGNAL(StoreStatistics(void)), this, SLOT(StoreStatistics(void))); 
    11341079        connect(mControlWidget, SIGNAL(ComputeGVS(void)), this, SLOT(ComputeGVS(void))); 
     1080        connect(mControlWidget, SIGNAL(ReplayViewPoints(void)), this, SLOT(ReplayViewPoints(void))); 
    11351081        connect(mControlWidget, SIGNAL(LoadObject(void)), this, SLOT(LoadObject(void))); 
    11361082 
     
    23032249        connect(cb, SIGNAL(toggled(bool)), SIGNAL(SetRenderFilter(bool))); 
    23042250 
    2305  
    23062251        /*vbox = new QGroupBox("PVS Errors", this); 
    23072252        layout()->addWidget(vbox); 
     
    23282273#endif 
    23292274 
     2275#if 0 
     2276         
    23302277        button = new QPushButton("Compute GVS", vbox); 
    23312278        vbox->layout()->addWidget(button); 
    23322279        connect(button, SIGNAL(clicked()), SIGNAL(ComputeGVS())); 
     2280 
     2281#else 
     2282         
     2283        button = new QPushButton("Replay view points", vbox); 
     2284        vbox->layout()->addWidget(button); 
     2285        connect(button, SIGNAL(clicked()), SIGNAL(ReplayViewPoints())); 
     2286 
     2287#endif 
    23332288 
    23342289#if DYNAMIC_OBJECTS_HACK 
     
    24102365        // create the pbuffer 
    24112366        //pbuffer = new QGLPixelBuffer(QSize(512, 512), format(), this); 
    2412         timerId = startTimer(20); 
     2367        //mUpdateTimerId = startTimer(20); 
    24132368        setWindowTitle(("OpenGL pbuffers")); 
    24142369} 
     
    25142469        while (it.HasMoreEntries()) 
    25152470        { 
    2516                 Intersectable *object = it.Next(pvsData); 
     2471                Intersectable *obj = it.Next(pvsData); 
    25172472 
    25182473                RgbColor color; 
    25192474 
    2520                 //float visibility = mTransferFunction*log10(entry.mData.mSumPdf + 1); // /5.0f 
    2521                 // glColor3f(visibility, 0.0f, 0.0f); 
    25222475                //cerr << "sumpdf: " << pvsData.mSumPdf << endl; 
    25232476                if (mUseRandomColorPerPvsObject) 
    25242477                { 
    2525                         KdIntersectable *kdint = static_cast<KdIntersectable *>(object); 
     2478                        KdIntersectable *kdint = static_cast<KdIntersectable *>(obj); 
    25262479 
    25272480                        if (kdint->mGenericIdx == -1) 
    25282481                        { 
    25292482                                kdint->mGenericIdx = (int)mColors.size(); 
    2530                                 mColors.push_back(RandomColor()); 
     2483                                mColors.push_back(RandomColor(0, 1)); 
    25312484                        } 
    25322485                        color = mColors[kdint->mGenericIdx]; 
     
    25402493 
    25412494                mUseForcedColors = true; 
    2542                 RenderIntersectable(object); 
     2495                RenderIntersectable(obj); 
    25432496                mUseForcedColors = false; 
    25442497        } 
    25452498} 
    25462499 
    2547 void 
    2548 QtGlRendererWidget::UpdateDynamicObjects() 
    2549 { 
    2550   preprocessor->ScheduleUpdateDynamicObjects(); 
    2551    
    2552 } 
    2553  
    2554 } 
     2500 
     2501void QtGlRendererWidget::UpdateDynamicObjects() 
     2502{ 
     2503        preprocessor->ScheduleUpdateDynamicObjects();   
     2504} 
     2505 
     2506 
     2507void QtGlRendererWidget::ReplayViewPoints() 
     2508{ 
     2509        ViewCellPointsList *vcPoints = mViewCellsManager->GetViewCellPointsList(); 
     2510 
     2511        ViewCellPointsList::const_iterator vit, vit_end = vcPoints->end(); 
     2512 
     2513        sViewPointsList.clear(); 
     2514 
     2515        for (vit = vcPoints->begin(); vit != vit_end; ++ vit)  
     2516        { 
     2517                ViewCellPoints *vp = *vit; 
     2518 
     2519                SimpleRayContainer::const_iterator rit, rit_end = vp->second.end(); 
     2520         
     2521                for (rit = vp->second.begin(); rit != rit_end; ++ rit) 
     2522                { 
     2523                        sViewPointsList.push_back(*rit); 
     2524                } 
     2525        } 
     2526 
     2527        if (!sViewPointsList.empty()) 
     2528        { 
     2529                cout << "replaying " << (int)sViewPointsList.size() << " view points " << endl; 
     2530 
     2531                mReplayMode = true; 
     2532                sViewPointsListIt = sViewPointsList.begin(); 
     2533        } 
     2534} 
     2535 
     2536} 
  • GTP/trunk/Lib/Vis/Preprocessing/src/QtInterface/QtGlRenderer.h

    r2679 r2686  
    7575        int ComputePvs(ObjectContainer &objects, ObjectContainer &pvs) const; 
    7676 
    77         unsigned int mydynamicTexture; 
    78 void dummyBuffer(); 
     77 
    7978public: 
    8079 
     
    107106 
    108107  signals: 
     108   
     109  void ReplayViewPoints(); 
    109110  void UpdateDynamicObjects(); 
    110111  void ComputeVisibility(); 
     
    195196        float mSpatialFilterSize; 
    196197 
    197         //LogWriter *mLogWriter; 
    198198        Plane3 mSceneCutPlane; 
    199199        float mHidingCost; 
     
    213213 
    214214        int mCurrentDynamicObjectIdx; 
     215 
     216        bool mReplayMode; 
    215217 
    216218        // some statistics 
     
    236238 
    237239        bool mUseRandomColorPerPvsObject; 
     240 
     241        int mUpdateTimerId; 
     242        int mReplayTimerId; 
    238243 
    239244#if DYNAMIC_OBJECTS_HACK 
     
    281286        virtual int GetHeight() const { return height(); } 
    282287 
    283         virtual void 
    284                 SetupCameraProjection(const int w, const int h, const float angle = 70.0f); 
     288        virtual void SetupCameraProjection(const int w,  
     289                                                                           const int h,  
     290                                                                           const float angle = 70.0f); 
    285291 
    286292        void RenderViewCells(); 
     
    303309 
    304310        void AssignColorByComparison(const ViewCellContainer &viewcells, 
    305                                                                  //const ViewCellInfoContainer &info1,  
    306311                                                                 const ViewCellInfoContainer &compareInfo); 
    307312 
    308313        void WriteViewCellInfos(); 
    309314 
    310  
    311         ///////// 
    312         //QMutex mMutex; 
    313  
     315         
    314316 
    315317public slots: 
    316318         
     319        /** Replay the view points stored in the view points list. 
     320        */ 
     321        void ReplayViewPoints(); 
    317322        void UpdateDynamicObjects(); 
    318323        void UpdateAllPvs(); 
     
    553558        } 
    554559 
    555  
     560         
    556561        /** Prepare pvs for rendering. 
    557562        */ 
     
    565570 
    566571        float ComputeRenderCost(ViewCell *vc); 
    567  
    568572 
    569573 
  • GTP/trunk/Lib/Vis/Preprocessing/src/QtInterface/QtGlViewer.cpp

    r2670 r2686  
    6767        GLfloat mat_shininess[] = {  1.0  }; 
    6868 
    69         GLfloat light_ambient[]  = {  0.2, 0.2, 0.2, 1.0  }; 
    70         GLfloat light_diffuse[]  = {  0.4, 0.4, 0.4, 1.0  }; 
    71         GLfloat light_specular[] = {  0.3, 0.3, 0.3, 1.0 }; 
    72  
    73         GLfloat lmodel_ambient[] = {0.3, 0.3, 0.3, 1.0}; 
     69        GLfloat light_ambient[]  = {  0.2f, 0.2f, 0.2f, 1.0f  }; 
     70        GLfloat light_diffuse[]  = {  0.4f, 0.4f, 0.4f, 1.0f  }; 
     71        GLfloat light_specular[] = {  0.3f, 0.3f, 0.3f, 1.0f }; 
     72 
     73        GLfloat lmodel_ambient[] = {0.3f, 0.3f, 0.3f, 1.0f}; 
    7474 
    7575 
  • GTP/trunk/Lib/Vis/Preprocessing/src/RandomViewCellsHandler.cpp

    r2648 r2686  
    136136 
    137137        ViewCellPoints *currentViewCell = NULL; 
    138         int i = 0; 
    139         int j = 0; 
     138 
     139        AxisAlignedBox3 bbox = mViewCellsManager->GetViewSpaceBox(); 
    140140 
    141141        string buf; 
     
    152152                                currentViewCell->first = mViewCellsManager->GetViewCellById(id); 
    153153                                         
    154                                 if (1)//i ++ < 5) 
    155                                 { 
    156                                         viewCells.push_back(currentViewCell); 
    157                                         j = 0; 
    158                                 } 
     154                                viewCells.push_back(currentViewCell); 
     155 
    159156                                break; 
    160157                        } 
     
    164161                                sscanf(buf.c_str(), "p %f %f %f %f %f %f", &pt.x, &pt.y, &pt.z, &dir.x, &dir.y, &dir.z); 
    165162                                 
     163                                if (0) 
     164                                { 
     165                                        // add new point to view space box 
     166                                        if (!bbox.IsInside(pt)) 
     167                                                bbox.Include(pt); 
     168                                } 
     169                                else 
     170                                { 
     171                                        // other variant: clamp to box 
     172                                        bbox.ClampToBox(pt); 
     173                                } 
     174 
    166175                                SimpleRay ray(pt, dir, 0, 1); 
    167176 
    168                                 if (1)//j ++ < 5) 
    169                                         currentViewCell->second.push_back(ray); 
     177                                // no view cell specified => create dummy view cell 
     178                                if (!currentViewCell) 
     179                                { 
     180                                        currentViewCell = new ViewCellPoints(); 
     181                                        viewCells.push_back(currentViewCell); 
     182                                        currentViewCell->first = NULL; 
     183                                } 
     184 
     185                                currentViewCell->second.push_back(ray); 
    170186 
    171187                                break; 
     
    175191                } 
    176192        } 
     193 
     194        // set updated view space box containing all view points 
     195        mViewCellsManager->SetViewSpaceBox(bbox); 
    177196 
    178197        return true; 
  • GTP/trunk/Lib/Vis/Preprocessing/src/ReverseGvs.cpp

    r2584 r2686  
    175175        float importance = 1.0f; 
    176176        if (mUsePassImportance)  
    177           importance = 1.0f/(pContributingRays + 1e-5); 
     177          importance = 1.0f/(pContributingRays + 1e-5f); 
    178178        // set this values for last contributingRays 
    179179        int index = mBufferStart - 1; 
  • GTP/trunk/Lib/Vis/Preprocessing/src/TestPreprocessor05.vcproj

    r2685 r2686  
    157157                                LinkIncremental="1" 
    158158                                AdditionalLibraryDirectories="&quot;$(QTDIR)\lib&quot;;..\src\GL;&quot;..\lib05\$(ConfigurationName)&quot;;..\..\..\..\..\..\NonGTP\Boost\lib;..\..\..\..\..\..\NonGTP\Zlib\lib;..\..\..\..\..\..\NonGTP\Devil\lib;&quot;..\MultiLevelRayTracing\RTScene\$(ConfigurationName)&quot;;&quot;..\MultiLevelRayTracing\RTWorld\$(ConfigurationName)&quot;;&quot;QtInterface\$(ConfigurationName)&quot;;&quot;..\..\..\..\..\..\NonGTP\Xerces\xerces-c_2_8_0\lib&quot;;&quot;$(CG_LIB_PATH)&quot;" 
    159                                 GenerateDebugInformation="false" 
     159                                GenerateDebugInformation="true" 
    160160                                SubSystem="1" 
    161161                                LargeAddressAware="2" 
  • GTP/trunk/Lib/Vis/Preprocessing/src/havran/ktball.cpp

    r2629 r2686  
    462462  stack[stackTop].depth = 0; 
    463463  stack[stackTop].bbox = bbox; 
    464   int tmpdir; 
     464  //int tmpdir; 
    465465#ifdef __TAGGED_KDR 
    466466  int taggedLists = 0; 
  • GTP/trunk/Lib/Vis/Preprocessing/src/havran/ktbs.cpp

    r2632 r2686  
    189189CKTBSBuildUp::ProvideID(ostream &app) 
    190190{ 
    191   bool tempvar; 
     191  //bool tempvar; 
    192192   
    193193  string termCrit; 
  • GTP/trunk/Lib/Vis/Preprocessing/src/main.cpp

    r2681 r2686  
    5959 
    6060 
     61static string GetViewPointsListName(const string &filename) 
     62{ 
     63        string viewCellPointsFile; 
     64 
     65        char buff[200]; 
     66        Environment::GetSingleton()->GetStringValue("ViewCells.randomViewPointsList", buff); 
     67 
     68        string vpList(buff); 
     69 
     70        if (vpList == "") 
     71        { 
     72                // if not specified, take file that has same prefix as scene file 
     73                if (strstr(filename.c_str(), ".obj")) 
     74                        viewCellPointsFile = ReplaceSuffix(filename, ".obj", ".vc"); 
     75                else if (strstr(filename.c_str(), ".dat")) 
     76                        viewCellPointsFile = ReplaceSuffix(filename, ".dat", ".vc"); 
     77                else if (strstr(filename.c_str(), ".x3d")) 
     78                        viewCellPointsFile = ReplaceSuffix(filename, ".x3d", ".vc"); 
     79        } 
     80        else 
     81        { 
     82                viewCellPointsFile = vpList; 
     83        } 
     84 
     85        return viewCellPointsFile; 
     86} 
     87 
    6188 
    6289void Cleanup() 
     
    240267                cout << "view cells successfully loaded" << endl; 
    241268 
    242         string viewCellPointsFile; 
    243  
    244         if (strstr(filename.c_str(), ".obj")) 
    245                 viewCellPointsFile = ReplaceSuffix(filename, ".obj", ".vc"); 
    246         else if (strstr(filename.c_str(), ".dat")) 
    247                 viewCellPointsFile = ReplaceSuffix(filename, ".dat", ".vc"); 
    248         else if (strstr(filename.c_str(), ".x3d")) 
    249                 viewCellPointsFile = ReplaceSuffix(filename, ".x3d", ".vc"); 
     269 
     270        const string viewCellPointsFile = GetViewPointsListName(filename); 
    250271 
    251272        bool importRandomViewCells; 
    252         Environment::GetSingleton()->GetBoolValue("ViewCells.importRandomViewCells", 
    253                 importRandomViewCells); 
     273        Environment::GetSingleton()->GetBoolValue("ViewCells.importRandomViewCells", importRandomViewCells); 
    254274 
    255275        if (importRandomViewCells) 
    256276        { 
    257                 cout << "importing random view cells" << endl; 
     277                cout << "importing random view points" << endl; 
     278 
    258279                if (preprocessor->mViewCellsManager->ImportViewCellsList(viewCellPointsFile)) 
    259280                        cout << "successfully loaded " << viewCellPointsFile << endl; 
    260281                else 
    261                         cerr << "error: file << " << viewCellPointsFile << " not found, generating random view points!" << endl; 
     282                        cerr << "error: file << " << viewCellPointsFile << " not found" << endl; 
    262283        } 
    263284 
     
    369390                        //rendererWidget->SetWindowTitle("Global Visualization"); 
    370391 
    371                         if (1) // not working with vbo 
     392                        if (0 && !rendererWidget->GetUseVbos()) // viewer not working with vbo 
    372393                        { 
    373394                                cout << "starting the qt viewer" << endl; 
Note: See TracChangeset for help on using the changeset viewer.