Changeset 840 for GTP/trunk/Lib
- Timestamp:
- 04/27/06 11:57:28 (19 years ago)
- Location:
- GTP/trunk/Lib/Vis
- Files:
-
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/Preprocessing/src/Beam.cpp
r704 r840 202 202 if (poly) 203 203 { 204 poly->AddToMesh(*mMesh);204 IncludePolyInMesh(*poly, *mMesh); 205 205 } 206 206 } -
GTP/trunk/Lib/Vis/Preprocessing/src/Environment.cpp
r837 r840 1319 1319 "false"); 1320 1320 1321 RegisterOption("ViewCells.pvsExportMode", 1322 optInt, 1323 "view_cells_export_bounding_boxes=", 1324 "2"); 1321 RegisterOption("ViewCells.exportBboxesForPvs", 1322 optBool, 1323 "view_cells_export_bboxes=", 1324 "true"); 1325 1326 1327 RegisterOption("ViewCells.boxesFilename", 1328 optString, 1329 "view_cells_boxes_filename=", 1330 "boxes.out"); 1331 1325 1332 1326 1333 RegisterOption("ViewCells.PostProcess.emptyViewCellsMerge", -
GTP/trunk/Lib/Vis/Preprocessing/src/FromPointVisibilityTree.cpp
r822 r840 1954 1954 1955 1955 #if 1 1956 // take render cost of node into account 1956 // also take render cost of node into account to avoid unsubdivided regions which 1957 // could reduce the render cost after some subdivisions 1957 1958 const float normalizedOldRenderCost = oldRenderCost / mBox.GetVolume(); 1958 //Debug << "rendercostdecr: " << 0.99f * renderCostDecrease << " old render cost: " << 0.01f * normalizedOldRenderCost << endl;1959 //return 0.5f * renderCostDecrease + 0.5f * normalizedOldRenderCost;1960 1959 return 0.99f * renderCostDecrease + 0.01f * normalizedOldRenderCost; 1961 1960 #else -
GTP/trunk/Lib/Vis/Preprocessing/src/Polygon3.cpp
r683 r840 498 498 499 499 500 void Polygon3::Triangulate(vector<Triangle3> &triangles) 500 void Polygon3::Triangulate(vector<Triangle3> &triangles) const 501 501 { 502 502 int i = 1; … … 517 517 518 518 519 void Polygon3::Triangulate(VertexIndexContainer &indices) 519 void Polygon3::Triangulate(VertexIndexContainer &indices) const 520 520 { 521 521 int i = 1; … … 539 539 540 540 541 void Polygon3::AddToMesh(Mesh &mesh)541 void IncludePolyInMesh(const Polygon3 &poly, Mesh &mesh) 542 542 { 543 543 const int n = (int)mesh.mVertices.size(); 544 544 545 545 //-- add the vertices 546 VertexContainer::const_iterator vit, vit_end = mVertices.end();547 for (vit = mVertices.begin(); vit != vit_end; ++ vit)546 VertexContainer::const_iterator vit, vit_end = poly.mVertices.end(); 547 for (vit = poly.mVertices.begin(); vit != vit_end; ++ vit) 548 548 { 549 549 mesh.mVertices.push_back(*vit); … … 551 551 552 552 // one quad => no triangulation necessary 553 if ( (int)mVertices.size() == 4)553 if (poly.mVertices.size() == 4) 554 554 { 555 555 mesh.AddFace(new Face(n, n + 1, n + 2, n + 3)); 556 } 557 else 558 { 559 VertexIndexContainer indices; 560 Triangulate(indices); 561 562 // add indices of triangle strip 563 for (int i = 0; i < (int)indices.size(); i += 3) 564 { 565 Face *face = new Face(n + indices[i], 566 n + indices[i + 1], 567 n + indices[i + 2]); 568 mesh.AddFace(face); 569 } 570 } 571 } 556 return; 557 } 558 559 VertexIndexContainer indices; 560 poly.Triangulate(indices); 561 562 // add indices of triangle strip 563 for (int i = 0; i < (int)indices.size(); i += 3) 564 { 565 Face *face = new Face(n + indices[i], 566 n + indices[i + 1], 567 n + indices[i + 2]); 568 mesh.AddFace(face); 569 } 570 } -
GTP/trunk/Lib/Vis/Preprocessing/src/Polygon3.h
r752 r840 100 100 /** The polygon is converted to triangles. 101 101 */ 102 void Triangulate(vector<Triangle3> &triangles); 103 /** 104 Adds polygon to mesh description as a face 105 */ 106 void AddToMesh(Mesh &mesh); 102 void Triangulate(vector<Triangle3> &triangles) const; 103 107 104 /** 108 105 Triangle strip indices are created from this polgon. 109 106 */ 110 void Triangulate(VertexIndexContainer &indices) ;107 void Triangulate(VertexIndexContainer &indices) const; 111 108 112 109 /** The piercing rays of the polygon are inherited by the child fragments … … 153 150 */ 154 151 static float GetArea(const PolygonContainer &cell); 152 153 /** 154 Adds polygon to mesh description as a face 155 */ 156 friend void IncludePolyInMesh(const Polygon3 &poly, Mesh &mesh); 155 157 }; 156 158 -
GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.cpp
r837 r840 17 17 18 18 19 // HACK 19 20 static void AddGeometry(SceneGraph *scene) 20 21 { … … 26 27 27 28 if (0){ 28 // form gr rid of meshes29 // form grid of boxes 29 30 for (int i = 0; i < n; ++ i) 30 31 { … … 33 34 const Vector3 scale2((float)j * 0.8 / n + 0.1, 0.05, (float)i * 0.8 / (float)n + 0.1); 34 35 35 Vector3 pt2 = sceneBox.Min() + scale2 * (sceneBox.Max() - sceneBox.Min());36 37 Vector3 boxSize = sceneBox.Size() * Vector3(0.0025, 0.01, 0.0025);36 const Vector3 pt2 = sceneBox.Min() + scale2 * (sceneBox.Max() - sceneBox.Min()); 37 38 const Vector3 boxSize = sceneBox.Size() * Vector3(0.0025f, 0.01f, 0.0025f); 38 39 AxisAlignedBox3 box(pt2, pt2 + boxSize); 39 40 Mesh *mesh = CreateBox(box); … … 84 85 scene->mRoot->UpdateBox(); 85 86 } 86 // plane separating areas 87 if(1) 88 { 89 const Vector3 scale(1.0, 0.0, 0); 90 91 Vector3 pt = sceneBox.Min() + scale * (sceneBox.Max() - sceneBox.Min()); 92 93 Plane3 cuttingPlane(Vector3(1, 0, 0), pt); 94 95 Mesh *planeMesh = new Mesh(); 96 97 Polygon3 *poly = sceneBox.CrossSection(cuttingPlane); 98 99 poly->AddToMesh(*planeMesh); 100 101 planeMesh->Preprocess(); 102 103 MeshInstance *planeMi = new MeshInstance(planeMesh); 104 scene->mRoot->mGeometry.push_back(planeMi); 105 } 87 88 // plane separating view space regions 89 if (1) 90 { 91 const Vector3 scale(1.0, 0.0, 0); 92 93 Vector3 pt = sceneBox.Min() + scale * (sceneBox.Max() - sceneBox.Min()); 94 95 Plane3 cuttingPlane(Vector3(1, 0, 0), pt); 96 Mesh *planeMesh = new Mesh(); 97 98 Polygon3 *poly = sceneBox.CrossSection(cuttingPlane); 99 IncludePolyInMesh(*poly, *planeMesh); 100 101 planeMesh->Preprocess(); 102 103 MeshInstance *planeMi = new MeshInstance(planeMesh); 104 scene->mRoot->mGeometry.push_back(planeMi); 105 } 106 106 } 107 107 … … 114 114 mViewCellsManager(NULL) 115 115 { 116 116 environment->GetBoolValue("Preprocessor.useGlRenderer", mUseGlRenderer); 117 117 118 119 118 // renderer will be constructed when the scene graph and viewcell manager will be known 119 renderer = NULL; 120 120 121 environment->GetBoolValue("Preprocessor.useGlDebugger", mUseGlDebugger); 122 environment->GetBoolValue("Preprocessor.loadPolygonsAsMeshes", mLoadPolygonsAsMeshes); 123 environment->GetBoolValue("Preprocessor.quitOnFinish", mQuitOnFinish); 124 environment->GetBoolValue("Preprocessor.computeVisibility", mComputeVisibility); 125 environment->GetBoolValue("Preprocessor.detectEmptyViewSpace", mDetectEmptyViewSpace); 126 127 Debug << "detect empty view space=" << mDetectEmptyViewSpace << endl; 128 Debug << "load polygons as meshes: " << mLoadPolygonsAsMeshes << endl; 129 121 environment->GetBoolValue("Preprocessor.useGlDebugger", mUseGlDebugger); 122 environment->GetBoolValue("Preprocessor.loadPolygonsAsMeshes", mLoadPolygonsAsMeshes); 123 environment->GetBoolValue("Preprocessor.quitOnFinish", mQuitOnFinish); 124 environment->GetBoolValue("Preprocessor.computeVisibility", mComputeVisibility); 125 environment->GetBoolValue("Preprocessor.detectEmptyViewSpace", mDetectEmptyViewSpace); 126 127 Debug << "detect empty view space=" << mDetectEmptyViewSpace << endl; 128 Debug << "load polygons as meshes: " << mLoadPolygonsAsMeshes << endl; 130 129 } 131 130 … … 143 142 cout << "done.\n"; 144 143 145 cout <<"Deleting kd tree...\n";144 cout << "Deleting kd tree...\n"; 146 145 DEL_PTR(mKdTree); 147 cout <<"done.\n";146 cout << "done.\n"; 148 147 149 cout <<"Deleting vspkd tree...\n";148 cout << "Deleting vspkd tree...\n"; 150 149 DEL_PTR(mVspKdTree); 151 cout <<"done.\n";152 153 cout <<"Deleting vspbsp tree...\n";150 cout << "done.\n"; 151 152 cout << "Deleting vspbsp tree...\n"; 154 153 DEL_PTR(mVspBspTree); 155 cout <<"done.\n";154 cout << "done.\n"; 156 155 } 157 156 -
GTP/trunk/Lib/Vis/Preprocessing/src/ViewCell.cpp
r837 r840 1959 1959 1960 1960 1961 bool ViewCellsTree::Export(ofstream &stream , const int pvsType)1962 { 1963 // export recur vivly all view cells from the root1964 ExportViewCell(mRoot, stream , pvsType);1961 bool ViewCellsTree::Export(ofstream &stream) 1962 { 1963 // export recursivly all view cells from the root 1964 ExportViewCell(mRoot, stream); 1965 1965 1966 1966 return true; … … 1996 1996 1997 1997 1998 void ViewCellsTree::ExportPvs(ViewCell *viewCell, ofstream &stream , const int pvsType)1998 void ViewCellsTree::ExportPvs(ViewCell *viewCell, ofstream &stream) 1999 1999 { 2000 2000 ObjectPvsMap::iterator it, it_end = viewCell->GetPvs().mEntries.end(); … … 2002 2002 for (it = viewCell->GetPvs().mEntries.begin(); it != it_end; ++ it) 2003 2003 { 2004 switch (pvsType) 2005 { 2006 case EXPORT_IDS: 2007 { 2008 stream << (*it).first->GetId() << " "; 2009 } 2010 break; 2011 case EXPORT_BBOXES: 2012 { 2013 Debug << "here24 " << pvsType << endl; 2014 MeshInstance *mi = dynamic_cast<MeshInstance *>((*it).first); 2015 AxisAlignedBox3 box = mi->GetBox(); 2016 stream << "<BoundingBox" 2017 << " min=\"" << box.Min().x << " " << box.Min().y << " " << box.Min().z << "\"" 2018 << " max=\"" << box.Max().x << " " << box.Max().y << " " << box.Max().z << "\" />" << endl; 2019 } 2020 break; 2021 case EXPORT_EMPTY_PVS: 2022 default: 2023 break; 2024 } 2025 } 2026 } 2027 2028 2029 void ViewCellsTree::ExportViewCell(ViewCell *viewCell, ofstream &stream, const int pvsType) 2004 stream << (*it).first->GetId() << " "; 2005 } 2006 } 2007 2008 2009 void ViewCellsTree::ExportViewCell(ViewCell *viewCell, ofstream &stream) 2030 2010 { 2031 2011 if (viewCell->IsLeaf()) … … 2038 2018 2039 2019 //-- export pvs 2040 Debug << "here66 " << pvsType << endl;2041 ExportPvs(viewCell, stream, pvsType);2020 if (0) 2021 ExportPvs(viewCell, stream); 2042 2022 2043 2023 stream << "\" />" << endl; … … 2058 2038 { 2059 2039 stream << "pvs=\""; 2060 ExportPvs(viewCell, stream , pvsType);2040 ExportPvs(viewCell, stream); 2061 2041 } 2062 2042 … … 2068 2048 for (it = interior->mChildren.begin(); it != it_end; ++ it) 2069 2049 { 2070 ExportViewCell(*it, stream , pvsType);2050 ExportViewCell(*it, stream); 2071 2051 } 2072 2052 -
GTP/trunk/Lib/Vis/Preprocessing/src/ViewCell.h
r837 r840 388 388 enum {PVS_IN_INTERIORS, COMPRESSED, PVS_IN_LEAVES}; 389 389 390 enum {EXPORT_EMPTY_PVS, EXPORT_IDS, EXPORT_BBOXES}; 391 390 392 391 /** If view cells in this tree have compressed pvs. 393 392 */ … … 408 407 /** Exports view cells to file. 409 408 */ 410 bool Export(ofstream &stream , const int pvsType = EXPORT_EMPTY_PVS);409 bool Export(ofstream &stream); 411 410 412 411 /** Export statistics of this view cell tree. … … 512 511 NOTE: should be in exporter!! 513 512 */ 514 void ExportViewCell(ViewCell *viewCell, ofstream &stream , const int pvsType);513 void ExportViewCell(ViewCell *viewCell, ofstream &stream); 515 514 516 515 /** Exports pvs of a view cell. 517 516 */ 518 void ExportPvs(ViewCell *viewCell, ofstream &stream , const int pvsType);517 void ExportPvs(ViewCell *viewCell, ofstream &stream); 519 518 520 519 -
GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellBsp.cpp
r744 r840 3075 3075 } 3076 3076 3077 3078 void BspNodeGeometry::AddToMesh(Mesh &mesh) 3079 { 3080 PolygonContainer::const_iterator it, it_end = mPolys.end(); 3081 3082 for (it = mPolys.begin(); it != mPolys.end(); ++ it) 3083 { 3084 (*it)->AddToMesh(mesh); 3077 void IncludeNodeGeomInMesh(const BspNodeGeometry &geom, Mesh &mesh) 3078 { 3079 // add single polygons to mesh 3080 PolygonContainer::const_iterator it, it_end = geom.mPolys.end(); 3081 3082 for (it = geom.mPolys.begin(); it != geom.mPolys.end(); ++ it) 3083 { 3084 Polygon3 *poly = (*it); 3085 IncludePolyInMesh(*poly, mesh); 3085 3086 } 3086 3087 } -
GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellBsp.h
r748 r840 82 82 Polygon3 *SplitPolygon(Polygon3 *poly, const float epsilon) const; 83 83 84 /** Adds node geometry to mesh.85 @note the mesh vertices will not be connected86 */87 void AddToMesh(Mesh &mesh);88 89 84 /** Computes mass center of bsp node geometry. 90 85 */ … … 109 104 */ 110 105 void Add(Polygon3 *p, const Plane3 &plane); 106 107 /** Adds node geometry to mesh. 108 @note the mesh vertices will not be connected 109 */ 110 friend void IncludeNodeGeomInMesh(const BspNodeGeometry &geom, Mesh &mesh); 111 111 112 112 protected: -
GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp
r837 r840 93 93 environment->GetIntValue("ViewCells.renderCostEvaluationType", mRenderCostEvaluationType); 94 94 95 environment->Get IntValue("ViewCells.pvsExportMode", mPvsExportMode);95 environment->GetBoolValue("ViewCells.exportBboxesForPvs", mExportBboxesForPvs); 96 96 97 97 char buf[100]; … … 1677 1677 if (viewcell->GetValid()) 1678 1678 { 1679 // HACK1680 #if TEST_EMPTY_VIEW_CELLS1681 for (int i = 0; i < mEmptyViewCells.size(); ++i)1682 {1683 if (viewcell == mEmptyViewCells[i])1684 {1685 viewcell->mPiercingRays.push_back(new Ray(ray));1686 Debug << "empty view cell ray found: " << ray.mOriginObject << ", " << ray.mTerminationObject << endl;1687 }1688 }1689 #endif1690 1679 // if ray not outside of view space 1691 1680 float contribution; … … 1699 1688 } 1700 1689 1701 // for directional sampling it is important to count only contributions1690 // for directional sampling it is important to count only contributions 1702 1691 // made in one direction!!! 1703 1692 // the other contributions of this sample will be counted for the oposite ray! … … 1858 1847 } 1859 1848 1849 1850 int ViewCellsManager::GetMaxFilterSize() const 1851 { 1852 return mMaxFilterSize; 1853 } 1854 1855 static const bool USE_ASCII = true; 1856 1857 bool ViewCellsManager::ExportBoundingBoxes(const string filename, 1858 const ObjectContainer &objects) const 1859 { 1860 ObjectContainer::const_iterator it, it_end = objects.end(); 1861 1862 if (USE_ASCII) 1863 { 1864 ofstream boxesOut(filename.c_str()); 1865 if (!boxesOut.is_open()) 1866 return false; 1867 1868 for (it = objects.begin(); it != it_end; ++ it) 1869 { 1870 MeshInstance *mi = dynamic_cast<MeshInstance *>(*it); 1871 const AxisAlignedBox3 box = mi->GetBox(); 1872 1873 boxesOut << mi->GetId() << " " 1874 << box.Min().x << " " 1875 << box.Min().y << " " 1876 << box.Min().z << " " 1877 << box.Max().x << " " 1878 << box.Max().y << " " 1879 << box.Max().z << endl; 1880 } 1881 1882 boxesOut.close(); 1883 } 1884 else 1885 { 1886 ofstream boxesOut(filename.c_str(), ios::binary); 1887 1888 if (!boxesOut.is_open()) 1889 return false; 1890 1891 for (it = objects.begin(); it != it_end; ++ it) 1892 { 1893 MeshInstance *mi = dynamic_cast<MeshInstance *>(*it); 1894 const AxisAlignedBox3 box = mi->GetBox(); 1895 Vector3 bmin = box.Min(); 1896 Vector3 bmax = box.Max(); 1897 1898 boxesOut.write(reinterpret_cast<char *>(&bmin), sizeof(Vector3)); 1899 boxesOut.write(reinterpret_cast<char *>(&bmax), sizeof(Vector3)); 1900 } 1901 1902 boxesOut.close(); 1903 } 1904 1905 1906 return true; 1907 } 1908 1909 1910 // use ascii format to store rays 1911 #define USE_ASCII 0 1912 1913 1914 inline bool ilt(Intersectable *obj1, Intersectable *obj2) 1915 { 1916 return obj1->mId < obj2->mId; 1917 } 1918 1919 /* 1920 bool Preprocessor::LoadBoundingBoxes(const string filename, 1921 const ObjectContainer &objects) const 1922 { 1923 std::stable_sort(objects.begin(), objects.end(), ilt); 1924 char fileName[100]; 1925 environment->GetStringValue("Preprocessor.samplesFilename", fileName); 1926 1927 Vector3 origin, termination; 1928 // HACK: needed only for lower_bound algorithm to find the 1929 // intersected objects 1930 MeshInstance sObj(NULL); 1931 MeshInstance tObj(NULL); 1932 1933 #if USE_ASCII 1934 ifstream samplesIn(fileName); 1935 if (!samplesIn.is_open()) 1936 return false; 1937 1938 string buf; 1939 while (!(getline(samplesIn, buf)).eof()) 1940 { 1941 sscanf(buf.c_str(), "%f %f %f %f %f %f %d %d", 1942 &origin.x, &origin.y, &origin.z, 1943 &termination.x, &termination.y, &termination.z, 1944 &(sObj.mId), &(tObj.mId)); 1945 1946 Intersectable *sourceObj = NULL; 1947 Intersectable *termObj = NULL; 1948 1949 if (sObj.mId >= 0) 1950 { 1951 ObjectContainer::iterator oit = 1952 lower_bound(objects.begin(), objects.end(), &sObj, ilt); 1953 sourceObj = *oit; 1954 } 1955 1956 if (tObj.mId >= 0) 1957 { 1958 ObjectContainer::iterator oit = 1959 lower_bound(objects.begin(), objects.end(), &tObj, ilt); 1960 termObj = *oit; 1961 } 1962 1963 samples.push_back(new VssRay(origin, termination, sourceObj, termObj)); 1964 } 1965 #else 1966 ifstream samplesIn(fileName, ios::binary); 1967 if (!samplesIn.is_open()) 1968 return false; 1969 1970 while (1) 1971 { 1972 samplesIn.read(reinterpret_cast<char *>(&origin), sizeof(Vector3)); 1973 samplesIn.read(reinterpret_cast<char *>(&termination), sizeof(Vector3)); 1974 samplesIn.read(reinterpret_cast<char *>(&(sObj.mId)), sizeof(int)); 1975 samplesIn.read(reinterpret_cast<char *>(&(tObj.mId)), sizeof(int)); 1976 1977 if (samplesIn.eof()) 1978 break; 1979 1980 Intersectable *sourceObj = NULL; 1981 Intersectable *termObj = NULL; 1982 1983 if (sObj.mId >= 0) 1984 { 1985 ObjectContainer::iterator oit = 1986 lower_bound(objects.begin(), objects.end(), &sObj, ilt); 1987 sourceObj = *oit; 1988 } 1989 1990 if (tObj.mId >= 0) 1991 { 1992 ObjectContainer::iterator oit = 1993 lower_bound(objects.begin(), objects.end(), &tObj, ilt); 1994 termObj = *oit; 1995 } 1996 1997 samples.push_back(new VssRay(origin, termination, sourceObj, termObj)); 1998 } 1999 2000 #endif 2001 samplesIn.close(); 2002 2003 return true; 2004 }*/ 2005 1860 2006 /**********************************************************************/ 1861 2007 /* BspViewCellsManager implementation */ … … 2117 2263 if (mExportViewCells) 2118 2264 { 2119 char buff[100]; 2120 environment->GetStringValue("ViewCells.filename", buff); 2121 string vcFilename(buff); 2122 2123 ExportViewCells(buff); 2124 } 2265 char filename[100]; 2266 environment->GetStringValue("ViewCells.filename", filename); 2267 ExportViewCells(filename); 2268 } 2269 2270 // export bounding boxes 2271 if (mExportBboxesForPvs) 2272 { 2273 char filename[100]; 2274 environment->GetStringValue("ViewCells.boxesFilename", filename); 2275 ExportBoundingBoxes(filename, objects); 2276 } 2277 2125 2278 2126 2279 return 0; … … 2484 2637 Mesh *mesh = new Mesh(); 2485 2638 2486 geom.AddToMesh(*mesh);2639 IncludeNodeGeomInMesh(geom, *mesh); 2487 2640 vc->SetMesh(mesh); 2641 2488 2642 // put mesh into mesh container so we can savely delete it 2489 2643 mMeshContainer.push_back(mesh); … … 2578 2732 //-- the type of the view cells hierarchy 2579 2733 //stream << "<Hierarchy name=\"bspTree\" />" << endl; 2580 stream << "<Hierarchy name=\"vspBspTree\" />" << endl; // write vsp bsp here because can use same tree and is bug free 2734 // NOTE: load in vsp bsp here because bsp and vsp bsp can use same tree and vsp bsp is bug free 2735 stream << "<Hierarchy name=\"vspBspTree\" />" << endl; 2736 2581 2737 //-- load the view cells itself, i.e., the ids and the pvs 2582 2738 stream << "<ViewCells>" << endl; 2583 2739 2584 mViewCellsTree->Export(stream , mPvsExportMode);2740 mViewCellsTree->Export(stream); 2585 2741 2586 2742 stream << "</ViewCells>" << endl; … … 2597 2753 2598 2754 return true; 2599 }2600 2601 2602 void BspViewCellsManager::AddCurrentViewCellsToHierarchy()2603 {2604 ViewCellContainer::const_iterator it, it_end = mViewCells.end();2605 for (it = mViewCells.begin(); it != it_end; ++ it)2606 {2607 ViewCell *vc = *it;2608 ViewCellContainer leaves;2609 mViewCellsTree->CollectLeaves(vc, leaves);2610 2611 ViewCellContainer::const_iterator lit, lit_end = leaves.end();2612 2613 for (lit = leaves.begin(); lit != lit_end; ++ lit)2614 {2615 BspViewCell *bspVc = dynamic_cast<BspViewCell *>(*lit);2616 bspVc->mLeaf->SetViewCell(vc);2617 }2618 }2619 2755 } 2620 2756 … … 3723 3859 int VspBspViewCellsManager::PostProcess(const ObjectContainer &objects, 3724 3860 const VssRayContainer &rays) 3725 { Debug << "here8773" << endl;3861 { 3726 3862 if (!ViewCellsConstructed()) 3727 3863 { … … 3812 3948 3813 3949 // collapse sibling leaves that share the same view cell 3814 if (0) 3815 mVspBspTree->CollapseTree(); 3950 if (0) mVspBspTree->CollapseTree(); 3816 3951 3817 3952 // recompute view cell list and statistics … … 3821 3956 if (1) FinalizeViewCells(true); 3822 3957 3823 3824 Debug << "here3" << endl;3825 3958 // write view cells to disc 3826 3959 if (mExportViewCells) 3827 3960 { 3828 Debug << "here4" << endl; 3829 char buff[100]; 3830 environment->GetStringValue("ViewCells.filename", buff); 3831 string vcFilename(buff); 3832 3833 ExportViewCells(buff); 3961 char filename[100]; 3962 environment->GetStringValue("ViewCells.filename", filename); 3963 ExportViewCells(filename); 3964 } 3965 3966 3967 // export bounding boxes 3968 if (mExportBboxesForPvs) 3969 { 3970 char filename[100]; 3971 environment->GetStringValue("ViewCells.boxesFilename", filename); 3972 ExportBoundingBoxes(filename, objects); 3834 3973 } 3835 3974 … … 4506 4645 4507 4646 Mesh *mesh = new Mesh(); 4508 geom.AddToMesh(*mesh); 4647 IncludeNodeGeomInMesh(geom, *mesh); 4648 4509 4649 vc->SetMesh(mesh); 4510 4650 // put mesh into mesh container so we can savely delete it … … 4543 4683 } 4544 4684 4545 4546 inline bool ilt(Intersectable *obj1, Intersectable *obj2)4547 {4548 return obj1->mId < obj2->mId;4549 }4550 4685 4551 4686 … … 4567 4702 << " max=\"" << mViewSpaceBox.Max().x << " " << mViewSpaceBox.Max().y << " " << mViewSpaceBox.Max().z << "\" />" << endl; 4568 4703 4704 4705 4569 4706 //-- the type of the view cells hierarchy 4570 4707 stream << "<Hierarchy name=\"vspBspTree\" />" << endl; 4571 4708 4572 //-- export the view cells itself, i.e., the idsand the pvs4709 //-- export the view cells and the pvs 4573 4710 stream << "<ViewCells>" << endl; 4574 Debug << "**************************** mode: " << mPvsExportMode << endl;4575 mViewCellsTree->Export(stream , mPvsExportMode);4711 4712 mViewCellsTree->Export(stream); 4576 4713 4577 4714 stream << "</ViewCells>" << endl; 4715 4578 4716 4579 4717 //-- export the hierarchy … … 4581 4719 mVspBspTree->Export(stream); 4582 4720 stream << endl << "</Hierarchy>" << endl; 4721 4722 4583 4723 4584 4724 stream << "</Visibility_Solution>" << endl; … … 4734 4874 4735 4875 4736 void VspBspViewCellsManager::AddCurrentViewCellsToHierarchy()4737 {4738 ViewCellContainer::const_iterator it, it_end = mViewCells.end();4739 for (it = mViewCells.begin(); it != it_end; ++ it)4740 {4741 }4742 }4743 4744 4876 ////////////////////////////////// 4745 4877 ViewCellsManager *ViewCellsManagerFactory::Create(const string mName) -
GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.h
r837 r840 392 392 void SetMaxFilterSize(const int size); 393 393 394 int GetMaxFilterSize() { 395 return mMaxFilterSize; 396 } 397 398 /** deletes interior nodes from the tree which have negative merge cost set (local merge) */ 399 void 400 DeleteLocalMergeTree(ViewCell *vc 401 ) const; 394 /** Returns maximal filter size. 395 */ 396 int GetMaxFilterSize() const; 397 398 /** Deletes interior nodes from the tree which have negative merge cost set (local merge). 399 */ 400 void DeleteLocalMergeTree(ViewCell *vc) const; 402 401 403 402 /** Evaluautes histogram for a given number of view cells. … … 412 411 */ 413 412 float EvalRenderCost(Intersectable *obj) const; 413 414 /** Exports bounding boxes of objects to file. 415 */ 416 bool ExportBoundingBoxes(const string filename, const ObjectContainer &objects) const; 417 414 418 415 419 protected: … … 499 503 500 504 501 int mPvsExportMode; 505 506 507 508 /// if bounding boxes should also be exported 509 bool mExportBboxesForPvs; 510 502 511 503 512 Plane3 mClipPlane; … … 645 654 646 655 647 /** HACK648 */649 void AddCurrentViewCellsToHierarchy();650 651 656 void CollectViewCells(); 652 657 653 658 void ExportColor(Exporter *exporter, ViewCell *vc) const; 654 659 655 656 657 660 /// the BSP tree. 658 661 BspTree *mBspTree; … … 873 876 BspNode *GetSpatialNode(ViewCell *viewCell) const; 874 877 875 /** HACK876 */877 void AddCurrentViewCellsToHierarchy();878 879 878 /** Merges the view cells. 880 879 */ -
GTP/trunk/Lib/Vis/Preprocessing/src/VrmlExporter.cpp
r712 r840 1238 1238 for (pit = polys.begin(); pit != pit_end; ++ pit) 1239 1239 { 1240 (*pit)->AddToMesh(dummyMesh); 1240 Polygon3 *poly = (*pit); 1241 IncludePolyInMesh(*poly, dummyMesh); 1241 1242 } 1242 1243 -
GTP/trunk/Lib/Vis/Preprocessing/src/X3dExporter.cpp
r726 r840 1167 1167 for (pit = polys.begin(); pit != pit_end; ++ pit) 1168 1168 { 1169 (*pit)->AddToMesh(dummyMesh); 1169 Polygon3 *poly = (*pit); 1170 IncludePolyInMesh(*poly, dummyMesh); 1170 1171 } 1171 1172 -
GTP/trunk/Lib/Vis/Preprocessing/src/main.cpp
r822 r840 136 136 137 137 // clean up 138 // DEL_PTR(p); 139 // DEL_PTR(environment); 138 DEL_PTR(p); 139 DEL_PTR(environment); 140 140 141 if (app) 141 142 return app->exec();
Note: See TracChangeset
for help on using the changeset viewer.