Changeset 2547 for GTP/trunk/Lib/Vis/Preprocessing
- Timestamp:
- 08/22/07 14:27:41 (17 years ago)
- Location:
- GTP/trunk/Lib/Vis/Preprocessing/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp
r2544 r2547 1021 1021 if (!Debug.is_open()) Debug.open("debug.log"); 1022 1022 1023 // give just an empty container as parameter: 1024 // this loading function is used in the engine, thus it 1025 // does not need to load the entities the preprocessor works on 1026 ObjectContainer preprocessorObjects; 1027 1028 return LoadViewCells(filename, 1029 pvsObjects, 1030 preprocessorObjects, 1031 finalizeViewCells, 1032 bconverter); 1033 } 1034 1023 1024 if (strstr(filename.c_str(), ".bn")) 1025 { 1026 Debug << "binary view cells format detected" << endl; 1027 1028 return LoadViewCellsBinary(filename, 1029 pvsObjects, 1030 finalizeViewCells, 1031 bconverter); 1032 } 1033 else 1034 { 1035 Debug << "xml view cells format detected" << endl; 1036 1037 // give just an empty container as parameter: 1038 // this loading function is used in the engine, thus it 1039 // does not need to load the entities the preprocessor works on 1040 ObjectContainer preprocessorObjects; 1041 1042 return LoadViewCells(filename, 1043 pvsObjects, 1044 preprocessorObjects, 1045 finalizeViewCells, 1046 bconverter); 1047 } 1048 } 1035 1049 1036 1050 void ViewCellsManager::LoadIndexedBoundingBoxesBinary(IN_STREAM &stream, IndexedBoundingBoxContainer &iboxes) … … 7110 7124 7111 7125 7112 7113 ViewCellsManager *LoadViewCellsBinary(const string &filename, 7114 ObjectContainer &pvsObjects, 7115 bool finalizeViewCells, 7116 BoundingBoxConverter *bconverter) 7117 { 7118 if (!Debug.is_open()) Debug.open("debug.log"); 7119 7126 ViewCellsManager *ViewCellsManager::LoadViewCellsBinary(const string &filename, 7127 ObjectContainer &pvsObjects, 7128 bool finalizeViewCells, 7129 BoundingBoxConverter *bconverter) 7130 { 7120 7131 IN_STREAM stream(filename.c_str()); 7121 7132 … … 7142 7153 } 7143 7154 7144 // sort objects by id7145 //sort(pvsObjects.begin(), pvsObjects.end(), ilt);7146 7147 7155 7148 7156 ObjectContainer pvsLookup; … … 7188 7196 7189 7197 Debug << "loading the view space partition tree" << endl; 7190 VspTree *vspTree = new VspTree(); 7191 7192 vspTree->mBoundingBox = viewSpaceBox; 7198 VspTree *vspTree = new VspTree(viewSpaceBox); 7193 7199 7194 7200 if (!vspTree->ImportBinary(stream)) -
GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.h
r2543 r2547 715 715 */ 716 716 virtual void ExportStats(const string &mergeStats); 717 718 friend ViewCellsManager *LoadViewCellsBinary(const string &filename, 717 /** Loads view cells in binary mode. 718 */ 719 static ViewCellsManager *LoadViewCellsBinary(const string &filename, 719 720 ObjectContainer &pvsObjects, 720 721 bool finalizeViewCells, … … 722 723 /** This helper function loads the bounding boxes for a binary solution. 723 724 */ 724 static void LoadIndexedBoundingBoxesBinary(IN_STREAM &stream, IndexedBoundingBoxContainer &iboxes); 725 static void LoadIndexedBoundingBoxesBinary(IN_STREAM &stream, 726 IndexedBoundingBoxContainer &iboxes); 725 727 726 728 … … 1270 1272 /** Fast view cell loader in binary mode. 1271 1273 */ 1272 friend ViewCellsManager *LoadViewCellsBinary(const string &filename, 1273 ObjectContainer &pvsObjects, 1274 bool finalizeViewCells, 1275 BoundingBoxConverter *bconverter); 1274 friend ViewCellsManager *ViewCellsManager:: 1275 LoadViewCellsBinary(const std::string &filename, 1276 ObjectContainer &pvsObjects, 1277 bool finalizeViewCells, 1278 BoundingBoxConverter *bconverter); 1279 1276 1280 1277 1281 /** Print statistics about the view cells compression. … … 1282 1286 //////////////////// 1283 1287 1284 /// if we should compress the objects after view cell evaluation: this makes1285 /// only sense for testing purpose1288 /// if we the objects are compressed after evaluation 1289 /// this makes only sense for testing purpose 1286 1290 bool mCompressObjects; 1287 /// pointer to the hierarchy manager responsible for view space / object spacesubdivision.1291 /// hierarchy manager managing view space / object subdivision. 1288 1292 HierarchyManager *mHierarchyManager; 1289 1293 }; -
GTP/trunk/Lib/Vis/Preprocessing/src/VspTree.cpp
r2546 r2547 387 387 mOutOfBoundsCell(NULL), 388 388 mStoreRays(false), 389 //mStoreRays(true),390 389 mTimeStamp(1), 391 390 mHierarchyManager(NULL) 392 391 { 393 392 mLocalSubdivisionCandidates = new vector<SortableEntry>; 394 395 bool randomize = false; 396 Environment::GetSingleton()->GetBoolValue("VspTree.Construction.randomize", randomize); 397 if (randomize) 398 Randomize(); // initialise random generator for heuristics 393 ParseEnvironment(); 394 } 395 396 397 VspTree::VspTree(const AxisAlignedBox3 &bbox): 398 mRoot(NULL), 399 mOutOfBoundsCell(NULL), 400 mStoreRays(false), 401 mTimeStamp(1), 402 mHierarchyManager(NULL), 403 mBoundingBox(bbox) 404 { 405 mLocalSubdivisionCandidates = new vector<SortableEntry>; 406 ParseEnvironment(); 407 } 408 409 410 411 void VspTree::ParseEnvironment() 412 { 413 // initialise random generator for heuristics 414 bool randomize; 415 Environment::GetSingleton()->GetBoolValue("VspTree.Construction.randomize", randomize); 416 if (randomize) Randomize(); 399 417 400 418 char subdivisionStatsLog[100]; 401 419 Environment::GetSingleton()->GetStringValue("VspTree.subdivisionStats", subdivisionStatsLog); 402 420 mSubdivisionStats.open(subdivisionStatsLog); 421 403 422 404 423 ///////////// … … 410 429 Environment::GetSingleton()->GetFloatValue("VspTree.Termination.minProbability", mTermMinProbability); 411 430 Environment::GetSingleton()->GetFloatValue("VspTree.Termination.maxRayContribution", mTermMaxRayContribution); 412 431 413 432 Environment::GetSingleton()->GetIntValue("VspTree.Termination.missTolerance", mTermMissTolerance); 414 433 Environment::GetSingleton()->GetIntValue("VspTree.Termination.maxViewCells", mMaxViewCells); … … 432 451 433 452 Environment::GetSingleton()->GetFloatValue("VspTree.Construction.renderCostDecreaseWeight", mRenderCostDecreaseWeight); 434 453 435 454 // if only the driving axis is used for axis aligned split 436 455 Environment::GetSingleton()->GetBoolValue("VspTree.splitUseOnlyDrivingAxis", mOnlyDrivingAxis); … … 439 458 440 459 //mMemoryConst = (float)(sizeof(VspLeaf) + sizeof(VspViewCell)); 441 //mMemoryConst = 50;//(float)(sizeof(VspViewCell));442 460 //mMemoryConst = (float)(sizeof(VspLeaf) + sizeof(ObjectPvs)); 443 444 mMemoryConst = 16;//(float)sizeof(ObjectPvs); 445 461 //mMemoryConst = (float)sizeof(ObjectPvs); 462 463 // hack 464 mMemoryConst = 16; 465 446 466 447 467 ////////////// … … 450 470 Debug << "******* VSP options ********" << endl; 451 471 452 472 Debug << "max depth: " << mTermMaxDepth << endl; 453 473 Debug << "min PVS: " << mTermMinPvs << endl; 454 474 Debug << "min probabiliy: " << mTermMinProbability << endl; … … 458 478 Debug << "miss tolerance: " << mTermMissTolerance << endl; 459 479 Debug << "max view cells: " << mMaxViewCells << endl; 480 460 481 Debug << "randomize: " << randomize << endl; 461 462 482 Debug << "min global cost ratio: " << mTermMinGlobalCostRatio << endl; 463 483 Debug << "global cost miss tolerance: " << mTermGlobalCostMissTolerance << endl; -
GTP/trunk/Lib/Vis/Preprocessing/src/VspTree.h
r2544 r2547 550 550 */ 551 551 VspTree(); 552 /** Constructor just setting the bounds of the tree. 553 */ 554 VspTree(const AxisAlignedBox3 &bbox); 552 555 /** Default destructor. 553 556 */ … … 706 709 } 707 710 }; 708 711 /** Parse the environment settings. 712 */ 713 void ParseEnvironment(); 709 714 /** faster evaluation of split plane cost for kd axis aligned cells. 710 715 */ … … 754 759 */ 755 760 void EvaluateLeafStats(const VspTraversalData &data); 756 757 761 /** Subdivides node using a best split priority queue. 758 762 @param tQueue the best split priority queue … … 804 808 */ 805 809 float EvalPvsCost(const RayInfoContainer &rays) const; 806 810 /** Helper function for split cost evaluation. 811 */ 807 812 int EvalPvsEntriesIncr(VspSubdivisionCandidate &splitCandidate, 808 813 const SplitData &sData) const; … … 1084 1089 1085 1090 #endif 1086 1087 1088 friend ViewCellsManager *LoadViewCellsBinary(const std::string &filename, 1089 ObjectContainer &pvsObjects, 1090 bool finalizeViewCells, 1091 BoundingBoxConverter *bconverter); 1091 1092 1092 1093 1093 protected:
Note: See TracChangeset
for help on using the changeset viewer.