Changeset 2710


Ignore:
Timestamp:
05/26/08 04:01:24 (16 years ago)
Author:
mattausch
Message:
 
Location:
GTP/trunk/Lib/Vis/Preprocessing
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • GTP/trunk/Lib/Vis/Preprocessing/scripts/run_demo_vienna

    r2709 r2710  
    1010#SCENE=../data/vienna/vienna_cropped.obj 
    1111#SCENE=../data/vienna/city_full.obj 
    12 SCENE=../data/vienna/city_full_hp.obj 
    13 #SCENE=../data/vienna/vienna_rep.obj 
     12#SCENE=../data/vienna/city_full_hp.obj 
     13SCENE=../data/vienna/vienna_rep.obj 
    1414 
    1515VIEWCELLS=../data/vienna/vienna_cropped-gradient-viewcells.xml.gz 
     
    5252-preprocessor_detect_empty_viewspace+ \ 
    5353-preprocessor_use_vbos- \ 
    54 -preprocessor_ray_cast_method=1 \ 
     54-preprocessor_ray_cast_method=3 \ 
    5555-view_cells_random_viewpoint_list=$VIEWPOINTS \ 
    5656demo1.env 
  • GTP/trunk/Lib/Vis/Preprocessing/src/HavranDynRayCaster.cpp

    r2682 r2710  
    348348        objI[i] = 0; 
    349349    } 
    350      
    351350    // Here we shoot first backward rays and forward ones 
    352351    SimpleRayContainer::iterator sit = rays.begin() + offset;  
  • GTP/trunk/Lib/Vis/Preprocessing/src/IntelRayCaster.cpp

    r2705 r2710  
    340340    { 
    341341      Intersectable *intersect = 
    342         mPreprocessor.GetParentObject(backward_hit_triangles[i]); 
     342                  mPreprocessor.GetParentObject(backward_hit_triangles[i]); 
    343343       
    344344      if (intersect) 
    345345      {  
    346         hitB.mObject = intersect; 
    347         hitB.mNormal = mPreprocessor.GetParentNormal(backward_hit_triangles[i]); 
    348          
    349         // normalB = rays[i].mDirection; // $$ temporary 
    350         hitB.mPoint = rays[k].Extrap(-backward_dist[i]); 
     346                  hitB.mObject = intersect; 
     347                  hitB.mNormal = mPreprocessor.GetParentNormal(backward_hit_triangles[i]); 
     348                   
     349                  // normalB = rays[i].mDirection; // $$ temporary 
     350                  hitB.mPoint = rays[k].Extrap(-backward_dist[i]); 
    351351      } 
    352352    } 
  • GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.cpp

    r2709 r2710  
    3636 
    3737 
     38static int sCurrentDynamicId = 0; 
     39 
     40 
    3841inline static bool ilt(Intersectable *obj1, Intersectable *obj2) 
    3942{ 
     
    329332 
    330333 
    331 Intersectable *Preprocessor::GetParentObject(const int index) const 
     334Intersectable *Preprocessor::GetParentObject(int index) const 
    332335{ 
    333336        if (index < 0) 
     
    351354        else 
    352355        { 
    353                   if (index >= (int)mObjects.size())  
    354                   { 
    355                           cerr<<"Warning: triangle index out of range! " << index << " of " << (int)mObjects.size() << endl; 
    356                           return NULL; 
    357                   } 
    358                   else 
    359                   { 
    360                           return mObjects[index]; 
    361                   } 
     356                return mObjects[index]; 
    362357        } 
    363358} 
     
    733728                } 
    734729        } 
     730 
    735731 
    736732        //////// 
     
    15941590        mDynamicObjects.push_back(leaf); 
    15951591 
     1592        const int currentId = (int)mObjects.size() + sCurrentDynamicId; 
     1593 
     1594        leaf->GetIntersectable()->SetId(currentId); 
     1595 
     1596        for (size_t i = 0; i < leaf->mGeometry.size(); ++ i) 
     1597        { 
     1598                leaf->mGeometry[i]->SetId(currentId); 
     1599        } 
     1600 
     1601        cout << "\**************\n******* new object has id " << currentId << endl; 
     1602 
     1603        ++ sCurrentDynamicId; 
     1604 
    15961605        // tell ray caster to update 
    15971606        ScheduleUpdateDynamicObjects(); 
  • GTP/trunk/Lib/Vis/Preprocessing/src/QtInterface/ObjectPlacer.cpp

    r2702 r2710  
    5858} 
    5959 
     60 
     61void ObjectPlacer::PlaceObject(SceneGraphLeaf *leaf, const Vector3 &pt) 
     62{ 
     63        AxisAlignedBox3 box = leaf->GetBox(); 
     64 
     65        Vector3 p = box.Center() - pt;; 
     66 
     67        // set pivot to ground of object 
     68        //p.y -= obj->GetOriginalBox().Min().y; 
     69        Matrix4x4 trafo = TranslationMatrix(p); 
     70 
     71        leaf->ApplyTransform(trafo); 
    6072} 
     73 
     74} 
  • GTP/trunk/Lib/Vis/Preprocessing/src/QtInterface/ObjectPlacer.h

    r2702 r2710  
    3333        */ 
    3434        void PlaceObject(const Vector3 &p); 
     35        /** Adds an object at the indicated position. 
     36        */ 
     37        void PlaceObject(SceneGraphLeaf *l, const Vector3 &p); 
    3538        /** Returns the currently active object. 
    3639        */ 
  • GTP/trunk/Lib/Vis/Preprocessing/src/QtInterface/QtGlRenderer.cpp

    r2709 r2710  
    143143    glLoadIdentity(); 
    144144    glOrtho(-1, 1, -1, 1, -99, 99); 
    145     //glTranslatef(-0.5f, -0.5f, 0.0f); 
    146145    glMatrixMode(GL_MODELVIEW); 
    147146    glLoadIdentity(); 
     
    916915                { 
    917916                        Matrix4x4 tm; 
     917 
     918                        SceneGraphLeaf *l = 
     919                          mViewCellsManager->GetPreprocessor()->mDynamicObjects[mCurrentDynamicObjectIdx]; 
    918920 
    919921                        switch (mTrafoType) 
     
    948950                                cerr << "not implemented" << endl; 
    949951                        } 
    950  
    951                         SceneGraphLeaf *l = 
    952                           mViewCellsManager->GetPreprocessor()->mDynamicObjects[mCurrentDynamicObjectIdx]; 
     952                         
    953953                        l->ApplyTransform(tm); 
    954                          
     954 
    955955                        updateGL(); 
    956956                } 
     
    11841184        mCurrentDynamicObjectIdx = -1; 
    11851185 
     1186        // export frame buffer during walkthrough 
    11861187        //mExportFrameBuffer = true; 
    11871188        mExportFrameBuffer = false; 
  • GTP/trunk/Lib/Vis/Preprocessing/src/SceneGraph.cpp

    r2709 r2710  
    281281{ 
    282282        mTrafo = IdentityMatrix(); 
    283  
    284283        mIntersectable = new SceneGraphLeafIntersectable(this, mBox); 
    285284} 
     
    289288{ 
    290289    mTrafo = IdentityMatrix(); 
     290        mIntersectable = new SceneGraphLeafIntersectable(this, mBox); 
    291291} 
    292292 
     
    336336        mTrafo = copy.mTrafo; 
    337337        mIsDynamic = copy.mIsDynamic; 
     338 
     339        mIntersectable = new SceneGraphLeafIntersectable(this, mBox); 
    338340        mHasChanged = true; 
    339341} 
  • GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp

    r2705 r2710  
    369369{ 
    370370        // dynamic objects are scene graph leaves 
    371         if (ray.mTerminationObject->Type() == Intersectable::SCENEGRAPHLEAF_INTERSECTABLE) 
     371        const int index = ray.mTerminationObject->GetId(); 
     372        if (index >= mPreprocessor->mObjects.size()) 
     373        { 
     374                for (size_t i = 0; i < mPreprocessor->mDynamicObjects.size(); ++ i) 
     375                { 
     376                        Intersectable *obj = mPreprocessor->mDynamicObjects[i]->GetIntersectable(); 
     377                        if (obj->GetId() == index) 
     378                                return obj; 
     379                } 
     380                         
    372381                return ray.mTerminationObject; 
     382        } 
    373383 
    374384        if (mUseKdPvs) 
Note: See TracChangeset for help on using the changeset viewer.