Ignore:
Timestamp:
01/21/08 20:38:41 (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/HavranRayCaster.cpp

    r2603 r2621  
    516516 
    517517 
     518    /* 
     519  virtual void HavranRayCaster::AddDynamicObjecs(const ObjectContainer &objects, const Matrix4x4 &m); 
     520  virtual void UpdateDynamicObjects(const Matrix4x4 &m); 
     521  virtual void DeleteDynamicObjects); 
     522*/ 
    518523} // the namespace 
  • GTP/trunk/Lib/Vis/Preprocessing/src/HavranRayCaster.h

    r2602 r2621  
    3737   
    3838  int Type() const { return HAVRAN_RAYCASTER; } 
    39    
     39     
     40  virtual void AddDynamicObjecs(const ObjectContainer &objects, const Matrix4x4 &m); 
     41  virtual void UpdateDynamicObjects(const Matrix4x4 &m); 
     42  virtual void DeleteDynamicObjects); 
     43 
    4044  virtual int CastRay( 
    4145                      const SimpleRay &simpleRay, 
  • GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.cpp

    r2615 r2621  
    173173bool Preprocessor::LoadBinaryObj(const string &filename, 
    174174                                                                 SceneGraphLeaf *root, 
    175                                                                  vector<FaceParentInfo> *parents) 
     175                                                                 vector<FaceParentInfo> *parents, 
     176                                                                 float scale) 
    176177{ 
    177178        //ifstream inStream(filename, ios::binary); 
     
    202203                inStream.read(reinterpret_cast<char *>(tri.mVertices + 1), sizeof(Vector3)); 
    203204                inStream.read(reinterpret_cast<char *>(tri.mVertices + 2), sizeof(Vector3)); 
     205 
     206                if (scale > 0.0f) 
     207                { 
     208                        tri.mVertices[0] *= scale; 
     209                        tri.mVertices[1] *= scale; 
     210                        tri.mVertices[2] *= scale; 
     211                } 
    204212 
    205213                // end of file reached 
     
    12271235 
    12281236                                float maxT, minT; 
    1229                                         // test with bounding box 
     1237                                 
     1238                                // test with bounding box 
    12301239                                if (tmi->GetBox().GetMinMaxT(hRay, &minT, &maxT)) 
    12311240                                { 
     
    17001709        SceneGraphLeaf *leaf = new SceneGraphLeaf(dynamic); 
    17011710 
    1702         if (LoadBinaryObj(filename, leaf, NULL)) 
     1711        if (LoadBinaryObj(filename, leaf, NULL, 100)) 
    17031712        { 
    17041713                mDynamicObjects.push_back(leaf); 
     1714                leaf->RebuildKtbTree(); 
    17051715                mSceneGraph->GetRoot()->mChildren.push_back(leaf); 
    1706                 return true 
     1716                return true; 
    17071717        } 
    17081718 
  • GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.h

    r2615 r2621  
    275275        bool LoadBinaryObj(const std::string &filename, 
    276276                       SceneGraphLeaf *root, 
    277                                            std::vector<FaceParentInfo> *parents); 
     277                                           std::vector<FaceParentInfo> *parents, 
     278                                           float scale = -1.0f); 
    278279 
    279280        bool ExportBinaryObj(const std::string &filename, SceneGraphLeaf *root); 
  • GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.vcproj

    r2598 r2621  
    777777                        </File> 
    778778                        <File 
     779                                RelativePath=".\SimpleRay.h"> 
     780                        </File> 
     781                        <File 
    779782                                RelativePath="..\src\Statistics.h"> 
    780783                        </File> 
     
    10711074                        </File> 
    10721075                        <File 
     1076                                RelativePath=".\sparsehash\src\windows\hash_fun.h"> 
     1077                        </File> 
     1078                        <File 
    10731079                                RelativePath=".\sparsehash\src\google\sparsehash\hash_fun.h"> 
    1074                         </File> 
    1075                         <File 
    1076                                 RelativePath=".\sparsehash\src\windows\hash_fun.h"> 
    10771080                        </File> 
    10781081                        <File 
  • GTP/trunk/Lib/Vis/Preprocessing/src/QtInterface/QtGlRenderer.cpp

    r2620 r2621  
    423423                RenderIntersectable(*dit); 
    424424#else 
    425                 RenderDynamicObject(*dit); 
     425                _RenderDynamicObject(*dit); 
    426426#endif 
    427427        } 
     
    679679                { 
    680680                        Matrix4x4 tm; 
    681                         TransformedMeshInstance *tmi; 
    682 #if USE_TRANSFORMED_MESH_INSTANCE_HACK 
    683681 
    684682                        switch (mTrafoType) 
     
    687685                                { 
    688686                                        const Vector3 transl(diffx, 0, diffy); 
    689                                         tmi = mViewCellsManager->GetPreprocessor()->mDynamicObjects[mCurrentDynamicObjectIdx]; 
     687                                         
    690688                                        tm = TranslationMatrix(transl); 
    691689                                } 
     
    696694                                        if (scalef < 0.9) scalef = 0.9f; 
    697695                                        else if (scalef > 1.1f) scalef = 1.1f; 
    698                                         tmi = mViewCellsManager->GetPreprocessor()->mDynamicObjects[mCurrentDynamicObjectIdx]; 
    699696                                        tm = ScaleMatrix(scalef, scalef, scalef); 
    700697                                } 
     
    702699                        case 2: 
    703700                                { 
    704                                         tmi = mViewCellsManager->GetPreprocessor()->mDynamicObjects[mCurrentDynamicObjectIdx]; 
    705701                                        tm = RotationXMatrix(diffx) * RotationYMatrix(diffy); 
    706702                                } 
     
    710706                        } 
    711707 
     708#if USE_TRANSFORMED_MESH_INSTANCE_HACK 
     709                        TransformedMeshInstance *tmi = mViewCellsManager->GetPreprocessor()->mDynamicObjects[mCurrentDynamicObjectIdx]; 
    712710                        tmi->ApplyWorldTransform(tm); 
     711#else 
     712                        SceneGraphLeaf *l = mViewCellsManager->GetPreprocessor()->mDynamicObjects[mCurrentDynamicObjectIdx]; 
     713                        l->ApplyTransform(tm); 
    713714#endif 
    714715                        updateGL(); 
     
    14571458        ComputeMaxValues(viewcells, maxPvs, maxPiercingRays, maxRelativeRays, maxRcCost); 
    14581459        // matt: temp hack 
    1459         //maxRcCost = 200.0f; 
     1460        maxRcCost = 200.0f; 
    14601461        //cout << "maxRcCost: " << maxRcCost << endl; 
    14611462        int i; 
     
    21192120        vbox->layout()->addWidget(button); 
    21202121        connect(button, SIGNAL(clicked()), SIGNAL(StoreStatistics())); 
     2122#endif 
     2123 
     2124#if DYNAMIC_OBJECTS_HACK 
    21212125 
    21222126        button = new QPushButton("Load object", vbox); 
     
    21242128        connect(button, SIGNAL(clicked()), SIGNAL(LoadObject())); 
    21252129#endif 
     2130 
    21262131        /*cb = new QCheckBox("Stats", vbox); 
    21272132        vbox->layout()->addWidget(cb); 
  • GTP/trunk/Lib/Vis/Preprocessing/src/QtInterface/QtGlRenderer.h

    r2620 r2621  
    1515#include "LogReader.h" 
    1616#include "Material.h" 
    17  
     17#include "common.h" 
    1818 
    1919 
  • GTP/trunk/Lib/Vis/Preprocessing/src/RayCaster.h

    r2583 r2621  
    2525struct SimpleRay; 
    2626class RayPacket2x2; 
     27class Matrix4x4; 
    2728 
    2829/** This class provides an interface for ray casting. 
     
    104105 
    105106 
     107  virtual void AddDynamicObjecs(const ObjectContainer &objects, const Matrix4x4 &m) = 0; 
     108  virtual void UpdateDynamicObjects(const Matrix4x4 &m) = 0; 
     109  virtual void DeleteDynamicObjects() = 0; 
     110 
    106111  // pool of vss rays to be used in one pass of the sampling 
    107112  struct VssRayPool  
  • GTP/trunk/Lib/Vis/Preprocessing/src/SceneGraph.cpp

    r2615 r2621  
    66#include "Intersectable.h" 
    77#include "IntersectableWrapper.h" 
     8#include "ktball.h" 
    89 
    910 
     
    234235void SceneGraph::ExportScene(const string filename) 
    235236{ 
    236          
    237237} 
    238238 
     
    279279 
    280280SceneGraphLeaf::SceneGraphLeaf(): mIsDynamic(false) 
     281#if DYNAMIC_OBJECTS_HACK 
     282, mKtbTree(NULL) 
     283#endif 
    281284{ 
    282285        mTrafo = IdentityMatrix(); 
     286 
    283287#if DYNAMIC_OBJECTS_HACK 
    284288        mIntersectable = new SceneGraphLeafIntersectable(this, mBox); 
     
    288292 
    289293SceneGraphLeaf::SceneGraphLeaf(bool isDynamic): mIsDynamic(isDynamic) 
    290 { 
    291         mTrafo = IdentityMatrix(); 
     294#if DYNAMIC_OBJECTS_HACK 
     295, mKtbTree(NULL) 
     296#endif 
     297{ 
     298    mTrafo = IdentityMatrix(); 
    292299} 
    293300 
     
    316323} 
    317324 
    318 } 
     325 
     326#if DYNAMIC_OBJECTS_HACK 
     327 
     328 
     329void SceneGraphLeaf::RebuildKtbTree() 
     330{ 
     331        if (mKtbTree) 
     332                delete mKtbTree; 
     333 
     334        mKtbTree = new CKTB(); 
     335        mKtbTree->BuildUp(mGeometry); 
     336} 
     337 
     338#endif 
     339 
     340 
     341} 
  • GTP/trunk/Lib/Vis/Preprocessing/src/SceneGraph.h

    r2615 r2621  
    1010 
    1111class SceneGraphLeafIntersectable; 
     12class CKTB; 
     13 
    1214 
    1315/** Basic scene graph node, we are interested only in bounding boxes and topology 
     
    6870        virtual bool IsLeaf() const { return true; } 
    6971        virtual void UpdateBox(); 
    70 #if DYNAMIC_OBJECT_HACK 
    71         SceneGraphLeafIntersectable *GetIntersectable() { return mIntersectable;} 
     72 
     73#if DYNAMIC_OBJECTS_HACK 
     74        void RebuildKtbTree(); 
     75        SceneGraphLeafIntersectable *GetIntersectable() { return mIntersectable; } 
    7276#endif 
     77 
    7378        /// used as actual pvs entry 
    7479        ObjectContainer mGeometry; 
    7580 
    7681protected: 
    77 #if DYNAMIC_OBJECT_HACK 
     82 
     83#if DYNAMIC_OBJECTS_HACK 
     84         
    7885        SceneGraphLeafIntersectable *mIntersectable; 
     86        CKTB *mKtbTree; 
     87 
    7988#endif 
     89 
    8090        bool mIsDynamic; 
    8191        Matrix4x4 mTrafo; 
  • GTP/trunk/Lib/Vis/Preprocessing/src/common.h

    r2615 r2621  
    2323#include <vector> 
    2424 
    25 #define DYNAMIC_OBJECTS_HACK 0 
    26 #define USE_TRANSFORMED_MESH_INSTANCE_HACK 1 
     25#define DYNAMIC_OBJECTS_HACK 1 
     26#define USE_TRANSFORMED_MESH_INSTANCE_HACK 0 
    2727#define USE_HAVRAN_RAYCASTER 
    2828 
Note: See TracChangeset for help on using the changeset viewer.