Changeset 2636


Ignore:
Timestamp:
01/23/08 06:32:46 (16 years ago)
Author:
bittner
Message:

moving objects partially functional

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

Legend:

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

    r2634 r2636  
    152152  tStack.push(tdata); 
    153153  AxisAlignedBox3 backBox, frontBox; 
    154  
     154   
    155155  while (!tStack.empty()) { 
    156156        //      cout<<mStat.Nodes()<<" "<<mTermMaxNodes<<endl; 
  • GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.cpp

    r2634 r2636  
    12351235                        pruneInvalidRays); 
    12361236 
    1237 #if DYNAMIC_OBJECTS_HACK 
     1237                //#if DYNAMIC_OBJECTS_HACK 
     1238                // disabled not neccessary 
     1239                UpdateDynamicObjects(); 
     1240#if 0 
    12381241                static Ray hRay; 
    12391242                VssRayContainer::iterator vit, vit_end = vssRays.end(); 
     
    17221725 
    17231726                mDynamicObjects.push_back(tmi); 
     1727                 
    17241728                return true; 
    17251729        } 
     
    17331737                leaf->RebuildKtbTree(); 
    17341738                mSceneGraph->GetRoot()->mChildren.push_back(leaf); 
     1739 
     1740                if (mRayCaster) 
     1741                  mRayCaster->AddDynamicObjecs(leaf->mGeometry, leaf->GetTransformation()); 
     1742 
     1743 
    17351744                return true; 
    17361745        } 
     
    17411750} 
    17421751 
    1743 } 
     1752 
     1753void 
     1754Preprocessor::ObjectMoved(SceneGraphLeaf *object) 
     1755{ 
     1756  // first invalidate all PVS from which this object is visible 
     1757  ViewCellContainer::const_iterator vit, vit_end = mViewCellsManager->GetViewCells().end(); 
     1758   
     1759  AxisAlignedBox3 box = object->GetBox(); 
     1760 
     1761  KdNode::NewMail(); 
     1762 
     1763  ObjectContainer objects; 
     1764  // first mail all kDObjects which are intersected by the object 
     1765  preprocessor->mKdTree->CollectKdObjects(box, 
     1766                                                                                  objects); 
     1767   
     1768  // now search for pvss which contained any mailed node 
     1769  for (vit = mViewCellsManager->GetViewCells().begin(); vit != vit_end; ++ vit) { 
     1770        ObjectPvs &pvs = (*vit)->GetPvs(); 
     1771        for (int i=0; i < objects.size(); i++) { 
     1772          vector<PvsEntry<Intersectable *,PvsData> >::iterator v; 
     1773          //      ObjectPvsIterator it; 
     1774          if (pvs.Find(objects[i], v)) { 
     1775                // clear the pvs 
     1776                pvs.Clear(); 
     1777                break; 
     1778          } 
     1779        } 
     1780  } 
     1781   
     1782} 
     1783 
     1784void 
     1785Preprocessor::UpdateDynamicObjects() 
     1786{ 
     1787  if (mUpdateDynamicObjects) { 
     1788        preprocessor->mRayCaster->DeleteDynamicObjects(); 
     1789         
     1790        for (int i=0; i < mDynamicObjects.size(); i++) { 
     1791          SceneGraphLeaf *l = mDynamicObjects[i]; 
     1792          mRayCaster->AddDynamicObjecs(l->mGeometry, l->GetTransformation()); 
     1793          preprocessor->ObjectMoved(l); 
     1794        } 
     1795        mUpdateDynamicObjects = false; 
     1796  } 
     1797} 
     1798 
     1799} 
  • GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.h

    r2633 r2636  
    273273 
    274274 
    275         int mGenericStats; 
     275  int mGenericStats; 
     276 
     277  void ScheduleUpdateDynamicObjects() { 
     278        mUpdateDynamicObjects = true; 
     279  } 
     280 
     281  void UpdateDynamicObjects(); 
    276282 
    277283protected: 
     
    291297        virtual void EvalViewCellHistogram(); 
    292298 
    293  
     299  virtual void ObjectMoved(SceneGraphLeaf *object); 
    294300        ///////////////////////// 
    295301 
     
    309315 
    310316        PreprocessorThread *mThread; 
     317 
     318  bool mUpdateDynamicObjects; 
    311319}; 
    312320 
  • GTP/trunk/Lib/Vis/Preprocessing/src/Pvs.h

    r2582 r2636  
    446446bool VerbosePvs<T, S>::RemoveSample(T sample, const float pdf) 
    447447{ 
    448         -- mSamples; 
    449448         
    450449        typename vector<PvsEntry<T, S> >::iterator it; 
     
    453452        if (!entryFound) 
    454453                return false; 
     454 
     455        // $$JB decrement only if the sample found 
     456        -- mSamples; 
    455457 
    456458        S &data = (*it).mData; 
  • GTP/trunk/Lib/Vis/Preprocessing/src/QtInterface/QtGlRenderer.cpp

    r2635 r2636  
    1717#include "IntersectableWrapper.h" 
    1818#include "LogWriter.h" 
    19  
     19#include "RayCaster.h" 
    2020 
    2121 
     
    664664} 
    665665 
     666void QtGlRendererWidget::mouseReleaseEvent(QMouseEvent *e) 
     667{ 
     668 
     669  if (e->modifiers() & Qt::AltModifier)  
     670        if (mCurrentDynamicObjectIdx >= 0) { 
     671          //      preprocessor->ScheduleUpdateDynamicObjects(); 
     672        } 
     673} 
     674 
    666675void 
    667676QtGlRendererWidget::mouseMoveEvent(QMouseEvent *e) 
     
    722731                        tmi->ApplyWorldTransform(tm); 
    723732#else 
    724                         SceneGraphLeaf *l = mViewCellsManager->GetPreprocessor()->mDynamicObjects[mCurrentDynamicObjectIdx]; 
     733                        SceneGraphLeaf *l = 
     734                          mViewCellsManager->GetPreprocessor()->mDynamicObjects[mCurrentDynamicObjectIdx]; 
    725735                        l->ApplyTransform(tm); 
     736                         
    726737#endif 
    727738                        updateGL(); 
     
    744755} 
    745756 
    746 void 
    747 QtGlRendererWidget::mouseReleaseEvent(QMouseEvent *) 
    748 { 
    749 } 
    750757 
    751758void 
     
    10211028        connect(mControlWidget, SIGNAL(SetRotation(bool)), this, SLOT(SetRotation(bool))); 
    10221029        connect(mControlWidget, SIGNAL(SetScale(bool)), this, SLOT(SetScale(bool))); 
    1023          
     1030 
     1031        connect(mControlWidget, SIGNAL(UpdateDynamicObjects()), this, SLOT(UpdateDynamicObjects())); 
     1032 
    10241033        setWindowTitle("PVS Visualization"); 
    10251034 
     
    10911100        ++ mCurrentDynamicObjectIdx; 
    10921101 
    1093         if (mViewCellsManager->GetPreprocessor()->LoadDynamicGeometry(filename)) 
    1094                 cout << "Loading finished" << endl; 
    1095         else 
    1096                 cerr << "Loading failed" << endl; 
    1097  
     1102        if (mViewCellsManager->GetPreprocessor()->LoadDynamicGeometry(filename)) { 
     1103           
     1104          cout << "Loading finished" << endl; 
     1105        } else 
     1106          cerr << "Loading failed" << endl; 
     1107         
    10981108    updateGL(); 
    10991109} 
     
    17421752 
    17431753        vbox2->addStretch(1); 
     1754 
     1755 
     1756        QPushButton *button = new QPushButton("Update", groupBox); 
     1757        vbox2->addWidget(button); 
     1758        connect(button, SIGNAL(clicked()), SIGNAL(UpdateDynamicObjects())); 
     1759         
     1760         
    17441761        groupBox->setLayout(vbox2); 
    1745  
     1762         
    17461763        return groupBox; 
    17471764} 
    1748  
    17491765 
    17501766 
     
    23732389} 
    23742390 
    2375 } 
     2391void 
     2392QtGlRendererWidget::UpdateDynamicObjects() 
     2393{ 
     2394  preprocessor->ScheduleUpdateDynamicObjects(); 
     2395   
     2396} 
     2397 
     2398} 
  • GTP/trunk/Lib/Vis/Preprocessing/src/QtInterface/QtGlRenderer.h

    r2633 r2636  
    108108 
    109109  signals: 
    110  
     110  void UpdateDynamicObjects(); 
    111111  void ComputeVisibility(); 
    112112  void StopComputation(); 
     
    310310 
    311311public slots: 
    312  
     312void UpdateDynamicObjects(); 
    313313        void UpdateAllPvs(); 
    314314        void ComputeVisibility(); 
  • GTP/trunk/Lib/Vis/Preprocessing/src/SceneGraph.h

    r2621 r2636  
    7878        /// used as actual pvs entry 
    7979        ObjectContainer mGeometry; 
    80  
     80  const Matrix4x4 &GetTransformation() const { return mTrafo; } 
    8181protected: 
    8282 
  • GTP/trunk/Lib/Vis/Preprocessing/src/run_test2

    r2635 r2636  
    44 
    55#COMMAND="./release/preprocessor.exe -preprocessor_quit_on_finish+" 
    6 COMMAND="../scripts/preprocessor.sh -preprocessor_quit_on_finish- -preprocessor_use_gl_renderer+ -preprocessor_evaluate_filter- -samples_per_evaluation=5000000 -samples_per_pass=1000000 -total_samples=20000000 -mutation_use_pass_importance- -mutation_silhouette_search_steps=3 -preprocessor_ray_cast_method=1 -preprocessor_detect_empty_viewspace+" 
     6COMMAND="../scripts/preprocessor.sh -preprocessor_quit_on_finish- -preprocessor_use_gl_renderer+ -preprocessor_evaluate_filter- -samples_per_evaluation=5000000 -samples_per_pass=500000 -total_samples=20000000 -mutation_use_pass_importance- -mutation_silhouette_search_steps=3 -preprocessor_ray_cast_method=3 -preprocessor_detect_empty_viewspace+" 
    77 
    88#SCENE="../data/vienna/vienna-buildings.x3d;../data/vienna/vienna-roofs.x3d;../data/vienna/vienna-roads.x3d" 
Note: See TracChangeset for help on using the changeset viewer.