Changeset 850


Ignore:
Timestamp:
04/27/06 18:42:11 (18 years ago)
Author:
mattausch
Message:
 
Location:
GTP/trunk/Lib/Vis
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/scripts/Plugin_VisibilitySceneManager.vcproj

    r833 r850  
    109109                                LinkIncremental="1" 
    110110                                SuppressStartupBanner="TRUE" 
    111                                 AdditionalLibraryDirectories=""$(OGRE_PATH)\PlugIns\OctreeSceneManager\bin\$(ConfigurationName)";"$(OGRE_PATH)\OgreMain\lib\$(ConfigurationName)";"$(OGRE_PATH)\Samples\Common\CEGUIRenderer\lib";"..\..\GtpVisibility\lib\$(ConfigurationName)";"..\..\lib\$(ConfigurationName)";"..\lib\$(ConfigurationName)";"$(OGRE_PATH)\Dependencies\lib\$(ConfigurationName)";"..\..\..\Preprocessing\lib\$(ConfigurationName)";..\support\xercesc\lib\;..\..\..\..\..\..\..\NonGTP\Xerces;..\..\..\..\..\..\..\NonGTP\Xerces\xercesc\lib;..\..\..\..\..\..\..\NonGTP\zlib\lib;..\..\..\..\..\..\..\NonGTP\Devil\lib;"$(QTDIR)\lib";"$(CG_LIB_PATH)"" 
     111                                AdditionalLibraryDirectories=""$(OGRE_PATH)\PlugIns\OctreeSceneManager\bin\$(ConfigurationName)";"$(OGRE_PATH)\OgreMain\lib\$(ConfigurationName)";"$(OGRE_PATH)\Samples\Common\CEGUIRenderer\lib";"..\..\GtpVisibility\lib\$(ConfigurationName)";"..\..\lib\$(ConfigurationName)";"..\lib\$(ConfigurationName)";"$(OGRE_PATH)\Dependencies\lib\$(ConfigurationName)";"..\..\..\Preprocessing\lib\$(ConfigurationName)";..\support\xercesc\lib\;..\..\..\..\..\..\..\NonGTP\Xerces;..\..\..\..\..\..\..\NonGTP\Xerces\xercesc\lib;..\..\..\..\..\..\..\NonGTP\zlib\lib;..\..\..\..\..\..\..\NonGTP\Devil\lib;"$(QTDIR)\lib";"$(CG_LIB_PATH)";..\..\..\Preprocessing\src\GL" 
    112112                                ModuleDefinitionFile="..\misc\OgreVisibilitySceneManager.def" 
    113113                                GenerateDebugInformation="TRUE" 
  • GTP/trunk/Lib/Vis/Preprocessing/src/AxisAlignedBox3.h

    r697 r850  
    9191    if ( (value >=mMin[axis]) && (value <= mMax[axis]) ) 
    9292      if (right) 
    93                                 mMin[axis] = value; 
     93                mMin[axis] = value; 
    9494      else 
    9595        mMax[axis] = value; 
  • GTP/trunk/Lib/Vis/Preprocessing/src/Containers.h

    r810 r850  
    1414class Ray; 
    1515class Mesh; 
     16 
     17struct IndexedBoundingBox; 
    1618 
    1719struct VisibilityPoint; 
     
    5254typedef vector<VisibilityPoint *> VisibilityPointsContainer; 
    5355 
     56typedef vector<IndexedBoundingBox> IndexedBoundingBoxContainer; 
     57 
    5458#endif // _Container_H__ 
    5559 
  • GTP/trunk/Lib/Vis/Preprocessing/src/Environment.cpp

    r844 r850  
    13281328                                        "view_cells_export_bounding_boxes=", 
    13291329                                        "true"); 
    1330  
    13311330         
    13321331        RegisterOption("ViewCells.boxesFilename", 
     
    13341333                                        "view_cells_boxes_filename=", 
    13351334                                        "boxes.out"); 
    1336  
    13371335 
    13381336        RegisterOption("ViewCells.PostProcess.emptyViewCellsMerge", 
  • GTP/trunk/Lib/Vis/Preprocessing/src/Intersectable.h

    r837 r850  
    4646 
    4747 
     48    virtual AxisAlignedBox3 GetBox() = 0; 
     49        virtual int CastRay(Ray &ray) = 0; 
    4850         
    49   virtual AxisAlignedBox3 GetBox() = 0; 
     51        virtual bool IsConvex() = 0; 
     52        virtual bool IsWatertight() = 0; 
     53        virtual float IntersectionComplexity() = 0; 
    5054   
    51   virtual int CastRay(Ray &ray) = 0; 
     55        virtual int NumberOfFaces() const = 0; 
     56        virtual int Type() const = 0; 
     57 
     58        virtual int GetRandomSurfacePoint(Vector3 &point, Vector3 &normal) = 0; 
     59 
     60        virtual int GetRandomVisibleSurfacePoint(Vector3 &point, 
     61                                                                                         Vector3 &normal, 
     62                                                                                         const Vector3 &viewpoint, 
     63                                                                                         const int maxTries) = 0; 
    5264   
    53   virtual bool IsConvex() = 0; 
    54   virtual bool IsWatertight() = 0; 
    55   virtual float IntersectionComplexity() = 0; 
    56    
    57   virtual int NumberOfFaces() const = 0; 
     65        virtual ostream &Describe(ostream &s) = 0; 
     66         
     67        virtual int GenerateSilhouetteRays(const int nrays, 
     68                                                                           const AxisAlignedBox3 &originBox, 
     69                                                                           const AxisAlignedBox3 &directionBox, VssRayContainer &rays)  
     70        { 
     71                return 0; 
     72        } 
    5873 
    59   virtual int Type() const = 0; 
    60    
    61   virtual int GetRandomSurfacePoint(Vector3 &point, Vector3 &normal) = 0; 
    62    
    63   virtual int 
    64   GetRandomVisibleSurfacePoint(Vector3 &point, 
    65                                                            Vector3 &normal, 
    66                                                            const Vector3 &viewpoint, 
    67                                                            const int maxTries 
    68                                                            ) = 0; 
    69    
    70   virtual ostream &Describe(ostream &s) = 0; 
    71    
    72   virtual int GenerateSilhouetteRays(const int nrays, 
    73                                                                          const AxisAlignedBox3 &originBox, 
    74                                                                          const AxisAlignedBox3 &directionBox, 
    75                                                                          VssRayContainer &rays 
    76                                                                          ) {return 0;} 
    77  
    78   static bool GreaterCounter(const Intersectable *a, 
    79                                                          const Intersectable *b) { 
    80         return a->mCounter > b->mCounter; 
    81   } 
     74        static bool GreaterCounter(const Intersectable *a, 
     75                                                         const Intersectable *b)  
     76        { 
     77                return a->mCounter > b->mCounter; 
     78        } 
    8279}; 
    8380 
  • GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp

    r844 r850  
    187187        Debug << "filter width: " << mFilterWidth << endl; 
    188188        Debug << "sample after subdivision: " << SAMPLE_AFTER_SUBDIVISION << endl; 
     189 
     190        Debug << "export bounding boxes: " << mExportBboxesForPvs << endl; 
     191        Debug << "export pvs for view cells: " << mExportPvs << endl; 
     192 
    189193        Debug << endl; 
    190194} 
     
    18961900                        Vector3 bmin = box.Min(); 
    18971901                        Vector3 bmax = box.Max(); 
    1898  
     1902                        int id = mi->GetId(); 
     1903 
     1904                        boxesOut.write(reinterpret_cast<char *>(&id), sizeof(int)); 
    18991905                        boxesOut.write(reinterpret_cast<char *>(&bmin), sizeof(Vector3)); 
    19001906                        boxesOut.write(reinterpret_cast<char *>(&bmax), sizeof(Vector3)); 
     
    19091915 
    19101916 
    1911 // use ascii format to store rays 
    1912 #define USE_ASCII 0 
    1913  
    1914  
    1915 inline bool ilt(Intersectable *obj1, Intersectable *obj2) 
    1916 { 
    1917         return obj1->mId < obj2->mId; 
    1918 } 
    1919  
    1920 /* 
    1921 bool Preprocessor::LoadBoundingBoxes(const string filename,  
    1922                                                                          const ObjectContainer &objects) const 
    1923 { 
    1924         std::stable_sort(objects.begin(), objects.end(), ilt); 
    1925         char fileName[100]; 
    1926         environment->GetStringValue("Preprocessor.samplesFilename", fileName); 
    1927          
    1928     Vector3 origin, termination; 
     1917bool ViewCellsManager::LoadBoundingBoxes(const string filename,  
     1918                                                                                 IndexedBoundingBoxContainer &boxes) const 
     1919{ 
    19291920        // HACK: needed only for lower_bound algorithm to find the  
    19301921        // intersected objects 
    1931         MeshInstance sObj(NULL); 
    1932         MeshInstance tObj(NULL); 
    1933  
    1934 #if USE_ASCII 
    1935         ifstream samplesIn(fileName); 
    1936         if (!samplesIn.is_open()) 
    1937                 return false; 
    1938  
    1939         string buf; 
    1940         while (!(getline(samplesIn, buf)).eof()) 
    1941         { 
    1942                 sscanf(buf.c_str(), "%f %f %f %f %f %f %d %d",  
    1943                            &origin.x, &origin.y, &origin.z, 
    1944                            &termination.x, &termination.y, &termination.z,  
    1945                            &(sObj.mId), &(tObj.mId)); 
     1922 
     1923        Vector3 bmin, bmax; 
     1924        int id; 
     1925 
     1926        if (USE_ASCII) 
     1927        { 
     1928                ifstream boxesIn(filename.c_str()); 
    19461929                 
    1947                 Intersectable *sourceObj = NULL; 
    1948                 Intersectable *termObj = NULL; 
     1930                if (!boxesIn.is_open()) 
     1931                { 
     1932                        cout << "failed to open file " << filename << endl; 
     1933                        return false; 
     1934                } 
     1935 
     1936                string buf; 
     1937                while (!(getline(boxesIn, buf)).eof()) 
     1938                { 
     1939                        sscanf(buf.c_str(), "%d %f %f %f %f %f %f",  
     1940                                   &id, &bmin.x, &bmin.y, &bmin.z, 
     1941                                   &bmax.x, &bmax.y, &bmax.z); 
    19491942                 
    1950                 if (sObj.mId >= 0) 
    1951                 { 
    1952                         ObjectContainer::iterator oit = 
    1953                                 lower_bound(objects.begin(), objects.end(), &sObj, ilt); 
    1954                         sourceObj = *oit; 
    1955                 } 
    1956                  
    1957                 if (tObj.mId >= 0) 
    1958                 { 
    1959                         ObjectContainer::iterator oit = 
    1960                                 lower_bound(objects.begin(), objects.end(), &tObj, ilt); 
    1961                         termObj = *oit; 
    1962                 } 
    1963  
    1964                 samples.push_back(new VssRay(origin, termination, sourceObj, termObj)); 
    1965         } 
    1966 #else 
    1967         ifstream samplesIn(fileName, ios::binary); 
    1968         if (!samplesIn.is_open()) 
    1969                 return false; 
    1970  
    1971         while (1) 
    1972         { 
    1973                  samplesIn.read(reinterpret_cast<char *>(&origin), sizeof(Vector3)); 
    1974                  samplesIn.read(reinterpret_cast<char *>(&termination), sizeof(Vector3)); 
    1975                  samplesIn.read(reinterpret_cast<char *>(&(sObj.mId)), sizeof(int)); 
    1976                  samplesIn.read(reinterpret_cast<char *>(&(tObj.mId)), sizeof(int)); 
    1977                  
    1978                  if (samplesIn.eof()) 
    1979                         break; 
    1980  
    1981                 Intersectable *sourceObj = NULL; 
    1982                 Intersectable *termObj = NULL; 
    1983                  
    1984                 if (sObj.mId >= 0) 
    1985                 { 
    1986                         ObjectContainer::iterator oit = 
    1987                                 lower_bound(objects.begin(), objects.end(), &sObj, ilt); 
    1988                         sourceObj = *oit; 
    1989                 } 
    1990                  
    1991                 if (tObj.mId >= 0) 
    1992                 { 
    1993                         ObjectContainer::iterator oit = 
    1994                                 lower_bound(objects.begin(), objects.end(), &tObj, ilt); 
    1995                         termObj = *oit; 
    1996                 } 
    1997  
    1998                 samples.push_back(new VssRay(origin, termination, sourceObj, termObj)); 
    1999         } 
    2000  
    2001 #endif 
    2002         samplesIn.close(); 
     1943                        AxisAlignedBox3 box(bmin, bmax); 
     1944                        //      MeshInstance *mi = new MeshInstance(); 
     1945                        // HACK: set bounding box to new box 
     1946                        //mi->mBox = box; 
     1947 
     1948                        boxes.push_back(IndexedBoundingBox(id, box)); 
     1949                } 
     1950 
     1951                boxesIn.close(); 
     1952        } 
     1953        else 
     1954        { 
     1955                ifstream boxesIn(filename.c_str(), ios::binary); 
     1956 
     1957                if (!boxesIn.is_open()) 
     1958                        return false; 
     1959 
     1960                while (1) 
     1961                { 
     1962                        boxesIn.read(reinterpret_cast<char *>(&id), sizeof(Vector3)); 
     1963                        boxesIn.read(reinterpret_cast<char *>(&bmin), sizeof(Vector3)); 
     1964                        boxesIn.read(reinterpret_cast<char *>(&bmax), sizeof(Vector3)); 
     1965                         
     1966                        if (boxesIn.eof()) 
     1967                                break; 
     1968 
     1969                         
     1970                        AxisAlignedBox3 box(bmin, bmax); 
     1971                        MeshInstance *mi = new MeshInstance(NULL); 
     1972 
     1973                        // HACK: set bounding box to new box 
     1974                        //mi->mBox = box; 
     1975                        //boxes.push_back(mi); 
     1976                        boxes.push_back(IndexedBoundingBox(id, box)); 
     1977                } 
     1978 
     1979                boxesIn.close(); 
     1980        } 
    20031981 
    20041982        return true; 
    2005 }*/ 
     1983} 
    20061984 
    20071985/**********************************************************************/ 
     
    36863664                // compute tree by merging the nodes based on cost heuristics 
    36873665                mViewCellsTree->ConstructMergeTree(rays, objects); 
    3688  
    3689         //cout << "here344" << endl; 
    3690                 //ObjectPvs pvs; 
    3691                 //UpdatePvsForEvaluation(mViewCellsTree->GetRoot(), pvs); 
    36923666        } 
    36933667        else 
     
    39713945                char filename[100]; 
    39723946                environment->GetStringValue("ViewCells.boxesFilename", filename); 
     3947         
    39733948                ExportBoundingBoxes(filename, objects); 
     3949/* 
     3950                IndexedBoundingBoxContainer boxes; 
     3951                LoadBoundingBoxes(filename, boxes); 
     3952 
     3953                IndexedBoundingBoxContainer::const_iterator it, it_end = boxes.end(); 
     3954 
     3955                for (it = boxes.begin(); it != it_end; ++ it) 
     3956                { 
     3957                        IndexedBoundingBox ibox = *it; 
     3958                        AxisAlignedBox3 box = ibox.second; 
     3959 
     3960                        Debug << ibox.first << " "  
     3961                                  << box.Min().x << " "  
     3962                                  << box.Min().y << " "  
     3963                                  << box.Min().z << " "  
     3964                                  << box.Max().x << " "  
     3965                                  << box.Max().y << " "  
     3966                  << box.Max().z << endl;        
     3967                }*/ 
    39743968        } 
    39753969 
  • GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.h

    r844 r850  
    4848}; 
    4949 
    50 /** 
    51         Manages different higher order operations on the view cells. 
     50 
     51struct IndexedBoundingBox: public std::pair<int, AxisAlignedBox3> 
     52{ 
     53        typedef std::pair<int, AxisAlignedBox3> IndexedBoundingBoxParent; 
     54 
     55        IndexedBoundingBox(int idx, const AxisAlignedBox3 &box): IndexedBoundingBoxParent(idx, box) 
     56        { 
     57 
     58        } 
     59}; 
     60 
     61/**     Manages different higher order operations on the view cells. 
    5262*/ 
    5363class ViewCellsManager 
     
    416426        bool ExportBoundingBoxes(const string filename, const ObjectContainer &objects) const; 
    417427 
     428        /** Load the bounding boxes into the container. 
     429        */ 
     430        bool LoadBoundingBoxes(const string filename, IndexedBoundingBoxContainer &boxes) const; 
    418431 
    419432protected: 
  • GTP/trunk/Lib/Vis/shared/scripts/GtpVisibility.sln

    r833 r850  
    2626Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TestPreprocessor", "..\..\Preprocessing\scripts\TestPreprocessor.vcproj", "{69BC58F0-C7EB-4B43-B782-B6F047EF0528}" 
    2727        ProjectSection(ProjectDependencies) = postProject 
     28                {EABCE292-D598-4600-A1C9-2591E7D62FDA} = {EABCE292-D598-4600-A1C9-2591E7D62FDA} 
    2829        EndProjectSection 
    2930EndProject 
Note: See TracChangeset for help on using the changeset viewer.