Changeset 1626


Ignore:
Timestamp:
10/16/06 17:17:42 (18 years ago)
Author:
mattausch
Message:

added kd tree loading

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

Legend:

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

    r1625 r1626  
    273273 
    274274 
    275 void HierarchyManager::ConstructInterleaved2(const VssRayContainer &sampleRays,                                                                                   
    276                                                                                          const ObjectContainer &objects, 
    277                                                                                          AxisAlignedBox3 *forcedViewSpace) 
     275void HierarchyManager::ConstructInterleavedWithGradient(const VssRayContainer &sampleRays,                                                                                        
     276                                                                                                                const ObjectContainer &objects, 
     277                                                                                                                AxisAlignedBox3 *forcedViewSpace) 
    278278{ 
    279279        mHierarchyStats.Reset(); 
  • GTP/trunk/Lib/Vis/Preprocessing/src/HierarchyManager.h

    r1625 r1626  
    216216        /** Exports object space hierarchy for visualization. 
    217217        */ 
    218         void ExportObjectSpaceHierarchy( 
    219                 Exporter *exporter,  
    220                 const ObjectContainer &objects, 
    221                 const AxisAlignedBox3 *bbox, 
    222                 const bool exportBounds = true) const; 
     218        void ExportObjectSpaceHierarchy(Exporter *exporter,  
     219                                                                        const ObjectContainer &objects, 
     220                                                                        const AxisAlignedBox3 *bbox, 
     221                                                                        const bool exportBounds = true) const; 
    223222 
    224223        /** Returns intersectable pierced by this ray. 
    225224        */ 
    226         Intersectable *GetIntersectable( 
    227                 const VssRay &ray,  
    228                 const bool isTermination) const; 
     225        Intersectable *GetIntersectable(const VssRay &ray, const bool isTermination) const; 
     226 
     227        /** Export object space partition bounding boxes. 
     228        */ 
     229        void ExportBoundingBoxes(OUT_STREAM &stream, const ObjectContainer &objects); 
    229230 
    230231        friend ostream &operator<<(ostream &s, const HierarchyManager &hm)  
     
    233234                return s; 
    234235        }  
    235  
    236         void ExportBoundingBoxes(OUT_STREAM &stream, const ObjectContainer &objects); 
    237  
    238236 
    239237protected: 
     
    386384                for the next split. 
    387385        */ 
    388         void ConstructInterleaved( 
    389                 const VssRayContainer &sampleRays, 
    390                 const ObjectContainer &objects, 
    391                 AxisAlignedBox3 *forcedViewSpace); 
     386        void ConstructInterleaved(const VssRayContainer &sampleRays, 
     387                                                          const ObjectContainer &objects, 
     388                                                          AxisAlignedBox3 *forcedViewSpace); 
    392389 
    393390        /** Construct object space partition interleaved with view space partition. 
     
    399396                next number of split. 
    400397        */ 
    401         void ConstructInterleaved2( 
    402                 const VssRayContainer &sampleRays, 
    403                 const ObjectContainer &objects, 
    404                 AxisAlignedBox3 *forcedViewSpace); 
     398        void ConstructInterleavedWithGradient(const VssRayContainer &sampleRays, 
     399                                                                                  const ObjectContainer &objects, 
     400                                                                                  AxisAlignedBox3 *forcedViewSpace); 
    405401 
    406402        /** Use iteration to construct the object space hierarchy. 
    407403        */ 
    408         void ConstructMultiLevel( 
    409                 const VssRayContainer &sampleRays, 
    410                 const ObjectContainer &objects, 
    411                 AxisAlignedBox3 *forcedViewSpace); 
     404        void ConstructMultiLevel(const VssRayContainer &sampleRays, 
     405                                                         const ObjectContainer &objects, 
     406                                                         AxisAlignedBox3 *forcedViewSpace); 
    412407 
    413408        /** Reset the object space subdivision.  
  • GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.cpp

    r1613 r1626  
    817817bool Preprocessor::InitRayCast(const string externKdTree, const string internkdtree) 
    818818{ 
    819         bool loadKdTree; 
    820         Environment::GetSingleton()->GetBoolValue("Preprocessor.loadKdTree", loadKdTree); 
     819        bool loadKdTree = true; 
     820        //Environment::GetSingleton()->GetBoolValue("Preprocessor.loadKdTree", loadKdTree); 
     821         
    821822         
    822823        if (!loadKdTree) 
    823         {        
     824        {       ///////// 
    824825                //-- build new kd tree from scene geometry 
     826 
    825827                BuildKdTree(); 
    826828                KdTreeStatistics(cout); 
  • GTP/trunk/Lib/Vis/Preprocessing/src/main.cpp

    r1613 r1626  
    6161 
    6262 
    63  
    64  
    65 string ReplaceSuffix(string filename, 
    66                                          string a, 
    67                                          string b) 
    68 { 
    69   string result = filename; 
    70  
    71   int pos = (int)filename.rfind(a, (int)filename.size() - 1); 
    72   if (pos == filename.size() - a.size()) { 
    73         result.replace(pos, a.size(), b); 
    74   } 
    75   return result; 
    76 } 
     63static string ReplaceSuffix(string filename, string a, string b) 
     64{ 
     65        string result = filename; 
     66 
     67        int pos = (int)filename.rfind(a, (int)filename.size() - 1); 
     68        if (pos == filename.size() - a.size()) { 
     69                result.replace(pos, a.size(), b); 
     70        } 
     71        return result; 
     72} 
     73 
     74 
     75static string GetInternKdTreeName(string &filename) 
     76{ 
     77        //Environment::GetSingleton()->GetStringValue("Preprocessor.kdTreeFilename", internKdTree); 
     78         
     79        // hack! should take any extension 
     80    if (strstr(filename.c_str(), ".x3d"))  
     81        { 
     82                return ReplaceSuffix(filename, ".x3d", ".kd"); 
     83        }  
     84        else if (strstr(filename.c_str(), ".dat")) 
     85        { 
     86                return ReplaceSuffix(filename, ".dat", ".kd"); 
     87        }  
     88        else if (strstr(filename.c_str(), ".obj")) 
     89        { 
     90                return ReplaceSuffix(filename, ".dat", ".kd"); 
     91        } 
     92 
     93        cerr << "Error: Currently unsupported format for kd, filename " << filename << endl; 
     94 
     95        // return empty string 
     96        return string(); 
     97} 
     98 
    7799 
    78100int 
     
    126148        } 
    127149 
    128         string externKdTree = ReplaceSuffix(filename, ".obj", ".kdf"); 
    129         char internKdTree[100]; 
    130         Environment::GetSingleton()->GetStringValue("Preprocessor.kdTreeFilename", internKdTree); 
    131         //const string internKdTree = ReplaceSuffic(filename, ".x3d", ".kd"); 
     150        const string externKdTree = ReplaceSuffix(filename, ".obj", ".kdf"); 
     151        const string internKdTree = GetInternKdTreeName(filename); 
    132152 
    133153        //-- initialize external ray casters 
Note: See TracChangeset for help on using the changeset viewer.