- Timestamp:
- 04/27/06 18:42:11 (19 years ago)
- Location:
- GTP/trunk/Lib/Vis
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/scripts/Plugin_VisibilitySceneManager.vcproj
r833 r850 109 109 LinkIncremental="1" 110 110 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" 112 112 ModuleDefinitionFile="..\misc\OgreVisibilitySceneManager.def" 113 113 GenerateDebugInformation="TRUE" -
GTP/trunk/Lib/Vis/Preprocessing/src/AxisAlignedBox3.h
r697 r850 91 91 if ( (value >=mMin[axis]) && (value <= mMax[axis]) ) 92 92 if (right) 93 93 mMin[axis] = value; 94 94 else 95 95 mMax[axis] = value; -
GTP/trunk/Lib/Vis/Preprocessing/src/Containers.h
r810 r850 14 14 class Ray; 15 15 class Mesh; 16 17 struct IndexedBoundingBox; 16 18 17 19 struct VisibilityPoint; … … 52 54 typedef vector<VisibilityPoint *> VisibilityPointsContainer; 53 55 56 typedef vector<IndexedBoundingBox> IndexedBoundingBoxContainer; 57 54 58 #endif // _Container_H__ 55 59 -
GTP/trunk/Lib/Vis/Preprocessing/src/Environment.cpp
r844 r850 1328 1328 "view_cells_export_bounding_boxes=", 1329 1329 "true"); 1330 1331 1330 1332 1331 RegisterOption("ViewCells.boxesFilename", … … 1334 1333 "view_cells_boxes_filename=", 1335 1334 "boxes.out"); 1336 1337 1335 1338 1336 RegisterOption("ViewCells.PostProcess.emptyViewCellsMerge", -
GTP/trunk/Lib/Vis/Preprocessing/src/Intersectable.h
r837 r850 46 46 47 47 48 virtual AxisAlignedBox3 GetBox() = 0; 49 virtual int CastRay(Ray &ray) = 0; 48 50 49 virtual AxisAlignedBox3 GetBox() = 0; 51 virtual bool IsConvex() = 0; 52 virtual bool IsWatertight() = 0; 53 virtual float IntersectionComplexity() = 0; 50 54 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; 52 64 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 } 58 73 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 } 82 79 }; 83 80 -
GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp
r844 r850 187 187 Debug << "filter width: " << mFilterWidth << endl; 188 188 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 189 193 Debug << endl; 190 194 } … … 1896 1900 Vector3 bmin = box.Min(); 1897 1901 Vector3 bmax = box.Max(); 1898 1902 int id = mi->GetId(); 1903 1904 boxesOut.write(reinterpret_cast<char *>(&id), sizeof(int)); 1899 1905 boxesOut.write(reinterpret_cast<char *>(&bmin), sizeof(Vector3)); 1900 1906 boxesOut.write(reinterpret_cast<char *>(&bmax), sizeof(Vector3)); … … 1909 1915 1910 1916 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; 1917 bool ViewCellsManager::LoadBoundingBoxes(const string filename, 1918 IndexedBoundingBoxContainer &boxes) const 1919 { 1929 1920 // HACK: needed only for lower_bound algorithm to find the 1930 1921 // 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()); 1946 1929 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); 1949 1942 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 } 2003 1981 2004 1982 return true; 2005 } */1983 } 2006 1984 2007 1985 /**********************************************************************/ … … 3686 3664 // compute tree by merging the nodes based on cost heuristics 3687 3665 mViewCellsTree->ConstructMergeTree(rays, objects); 3688 3689 //cout << "here344" << endl;3690 //ObjectPvs pvs;3691 //UpdatePvsForEvaluation(mViewCellsTree->GetRoot(), pvs);3692 3666 } 3693 3667 else … … 3971 3945 char filename[100]; 3972 3946 environment->GetStringValue("ViewCells.boxesFilename", filename); 3947 3973 3948 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 }*/ 3974 3968 } 3975 3969 -
GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.h
r844 r850 48 48 }; 49 49 50 /** 51 Manages different higher order operations on the view cells. 50 51 struct 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. 52 62 */ 53 63 class ViewCellsManager … … 416 426 bool ExportBoundingBoxes(const string filename, const ObjectContainer &objects) const; 417 427 428 /** Load the bounding boxes into the container. 429 */ 430 bool LoadBoundingBoxes(const string filename, IndexedBoundingBoxContainer &boxes) const; 418 431 419 432 protected: -
GTP/trunk/Lib/Vis/shared/scripts/GtpVisibility.sln
r833 r850 26 26 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TestPreprocessor", "..\..\Preprocessing\scripts\TestPreprocessor.vcproj", "{69BC58F0-C7EB-4B43-B782-B6F047EF0528}" 27 27 ProjectSection(ProjectDependencies) = postProject 28 {EABCE292-D598-4600-A1C9-2591E7D62FDA} = {EABCE292-D598-4600-A1C9-2591E7D62FDA} 28 29 EndProjectSection 29 30 EndProject
Note: See TracChangeset
for help on using the changeset viewer.