Changeset 2183 for GTP/trunk/Lib/Vis/Preprocessing/src
- Timestamp:
- 03/02/07 13:13:24 (18 years ago)
- Location:
- GTP/trunk/Lib/Vis/Preprocessing/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/Preprocessing/src/Polygon3.cpp
r2116 r2183 283 283 if (GetArea() < AREA_LIMIT) 284 284 { 285 Debug << "area too small: " << GetArea() << endl;285 Debug << "area too small: " << GetArea() << std::endl; 286 286 return false; 287 287 } -
GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.cpp
r2172 r2183 22 22 #include "InternalRayCaster.h" 23 23 #include "GlobalLinesRenderer.h" 24 #include "ObjectsParser.h" 24 25 25 26 … … 27 28 #define SHOW_RAYCAST_TIMING 1 28 29 30 using namespace std; 29 31 30 32 namespace GtpVisibilityPreprocessor { … … 265 267 266 268 267 bool Preprocessor::LoadBinaryObj(const string filename,269 bool Preprocessor::LoadBinaryObj(const string &filename, 268 270 SceneGraphNode *root, 269 271 vector<FaceParentInfo> *parents) … … 277 279 cout << "binary obj dump available, loading " << filename.c_str() << endl; 278 280 279 // table for vertices280 VertexContainer vertices;281 282 if (parents)283 cout << "using face parents" << endl;284 else285 cout << "not using face parents" << endl;286 287 281 // read in triangle size 288 282 int numTriangles; … … 309 303 root->mGeometry.push_back(obj); 310 304 311 i ++; 312 313 if (i % 500000 == 499999) 305 if ((i ++) % 500000 == 499999) 314 306 cout<<"\r"<<i<<"/"<<numTriangles<<"\r"; 315 307 } … … 488 480 const int files = SplitFilenames(filename, filenames); 489 481 cout << "number of input files: " << files << endl; 482 490 483 bool result = false; 491 484 bool isObj = false; … … 547 540 548 541 cout << "loaded " << (int)mSceneGraph->GetRoot()->mGeometry.size() << " entities" << endl; 542 549 543 // only works for triangles 550 544 if (result && !mLoadMeshes) 551 545 { 552 546 cout << "exporting binary obj to " << bnFile << "... " << endl; 547 553 548 ExportBinaryObj(bnFile, mSceneGraph->GetRoot()); 549 554 550 cout << "finished" << endl; 555 551 } 556 552 557 553 delete parser; 558 }559 else if (0)560 {561 ExportBinaryObj("../data/test.bn", mSceneGraph->GetRoot());562 554 } 563 555 } … … 740 732 if (mLoadViewCells) 741 733 { 734 735 #ifdef USE_BIT_PVS 736 // HACK: for kd pvs, set pvs size to maximal number of kd nodes 737 vector<KdLeaf *> leaves; 738 preprocessor->mKdTree->CollectLeaves(leaves); 739 740 ObjectPvs::SetPvsSize((int)leaves.size()); 741 #endif 742 742 743 Environment::GetSingleton()->GetStringValue("ViewCells.filename", buf); 743 cout << "loading view cells from " << buf << endl<<flush; 744 745 mViewCellsManager = ViewCellsManager::LoadViewCells(buf, &mObjects, true, NULL); 744 cout << "loading objects from " << buf << endl; 745 746 // load objects which will be used as pvs entries 747 ObjectContainer pvsObjects; 748 if (0) LoadObjects(buf, pvsObjects, mObjects); 749 750 const bool finalizeViewCells = true; 751 cout << "loading view cells from " << buf << endl; 752 753 mViewCellsManager = ViewCellsManager::LoadViewCells(buf, 754 pvsObjects, 755 mObjects, 756 finalizeViewCells, 757 NULL); 746 758 747 759 cout << "view cells loaded." << endl<<flush; … … 1262 1274 const long t1 = GetTime(); 1263 1275 1264 if ( 0 &&(int)rays.size() > 10000) {1276 if ((int)rays.size() > 10000) { 1265 1277 1266 1278 mRayCaster->SortRays(rays); … … 1356 1368 1357 1369 if ((int)rays.size() > 100000 && i % 100000 == 0) 1358 //cout << "here2 " << vssRays.size()<<endl;1359 1370 cout<<"\r"<<i<<"/"<<(int)rays.size()<<"\r"; 1360 1371 } … … 1632 1643 1633 1644 1634 } 1645 bool Preprocessor::LoadObjects(const string &filename, 1646 ObjectContainer &pvsObjects, 1647 const ObjectContainer &preprocessorObjects) 1648 { 1649 ObjectsParser parser; 1650 1651 const bool success = parser.ParseObjects(filename, 1652 pvsObjects, 1653 preprocessorObjects); 1654 1655 if (!success) 1656 { 1657 Debug << "Error: loading objects failed!" << endl; 1658 } 1659 1660 // hack: no bvh object could be found => take preprocessor objects 1661 if (pvsObjects.empty()) 1662 { 1663 Debug << "no objects" << endl; 1664 pvsObjects = preprocessorObjects; 1665 } 1666 1667 return success; 1668 } 1669 1670 1671 } -
GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.h
r2176 r2183 263 263 protected: 264 264 265 bool LoadBinaryObj(const st ring &filename,265 bool LoadBinaryObj(const std::string &filename, 266 266 SceneGraphNode *root, 267 vector<FaceParentInfo> *parents);268 269 bool ExportBinaryObj(const st ring filename, SceneGraphNode *root);267 std::vector<FaceParentInfo> *parents); 268 269 bool ExportBinaryObj(const std::string filename, SceneGraphNode *root); 270 270 271 271 void SetupRay(Ray &ray, const Vector3 &point, const Vector3 &direction) const;
Note: See TracChangeset
for help on using the changeset viewer.