Changeset 575 for trunk/VUT/GtpVisibilityPreprocessor
- Timestamp:
- 01/25/06 11:08:35 (19 years ago)
- Location:
- trunk/VUT/GtpVisibilityPreprocessor
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/VUT/GtpVisibilityPreprocessor/scripts/default.env
r574 r575 13 13 #;../data/vienna/vienna-plane.x3d 14 14 # filename ../data/vienna/viewcells-25-sel.x3d 15 #filename ../data/atlanta/atlanta2.x3d15 filename ../data/atlanta/atlanta2.x3d 16 16 # filename ../data/soda/soda.dat 17 filename ../data/soda/soda5.dat17 # filename ../data/soda/soda5.dat 18 18 } 19 19 … … 23 23 useGlRenderer false 24 24 # type sampling 25 type vss26 #type rss27 detectEmptyViewSpace true25 # type vss 26 type rss 27 detectEmptyViewSpace false 28 28 } 29 29 … … 303 303 Termination { 304 304 # parameters used for autopartition 305 minRays 300305 minRays 150 306 306 minPolygons -1 307 307 maxDepth 30 … … 309 309 #minProbability 0.0001 310 310 minProbability -1 311 maxRayContribution 0. 1311 maxRayContribution 0.3 312 312 maxCostRatio 0.9 313 313 missTolerance 3 314 314 #maxAccRayLength 100 315 315 316 maxViewCells 5000 316 maxViewCells 50000 317 317 318 318 # used for pvs criterium … … 335 335 PostProcess { 336 336 maxCostRatio 0.1 337 minViewCells 110337 minViewCells 5000 338 338 useRaysForMerge false 339 339 exportMergeStats false -
trunk/VUT/GtpVisibilityPreprocessor/src/Preprocessor.cpp
r574 r575 194 194 environment->GetStringValue("ViewCells.type", viewCellsStr); 195 195 196 int initialSamples = 0; 197 198 if (strcmp(viewCellsStr, "kdTree") == 0) 199 { 200 mViewCellsManager = new KdViewCellsManager(mKdTree); 201 } 202 else if (strcmp(viewCellsStr, "bspTree") == 0) 203 { 204 mBspTree = new BspTree(); 205 206 Debug << "view cell type: Bsp" << endl; 207 208 mViewCellsManager = new BspViewCellsManager(mBspTree); 209 } 210 else if (strcmp(viewCellsStr, "vspBspTree") == 0) 211 { 212 mVspBspTree = new VspBspTree(); 213 214 Debug << "view cell type: VspBsp" << endl; 215 216 mViewCellsManager = new VspBspViewCellsManager(mVspBspTree); 217 } 218 else if (strcmp(viewCellsStr, "vspKdTree") == 0) 219 { 220 mVspKdTree = new VspKdTree(); 221 222 mViewCellsManager = new VspKdViewCellsManager(mVspKdTree); 223 } 224 else if (strcmp(viewCellsStr, "sceneDependent") == 0) 225 { 226 //TODO 227 mBspTree = new BspTree(); 228 229 Debug << "view cell type: Bsp" << endl; 230 231 mViewCellsManager = new BspViewCellsManager(mBspTree); 232 } 233 else 234 { 235 cerr<<"Wrong view cells type" << viewCellsStr << endl; 236 exit(1); 237 } 196 mViewCellsManager = CreateViewCellsManager(viewCellsStr); 238 197 239 198 float objRenderCost = 0, vcOverhead = 0, moveSpeed = 0; … … 272 231 273 232 return true; 233 } 234 235 236 ViewCellsManager *Preprocessor::CreateViewCellsManager(const char *name) 237 { 238 if (strcmp(name, "kdTree") == 0) 239 { 240 mViewCellsManager = new KdViewCellsManager(mKdTree); 241 } 242 else if (strcmp(name, "bspTree") == 0) 243 { 244 mBspTree = new BspTree(); 245 246 Debug << "view cell type: Bsp" << endl; 247 248 mViewCellsManager = new BspViewCellsManager(mBspTree); 249 } 250 else if (strcmp(name, "vspBspTree") == 0) 251 { 252 mVspBspTree = new VspBspTree(); 253 254 Debug << "view cell type: VspBsp" << endl; 255 256 mViewCellsManager = new VspBspViewCellsManager(mVspBspTree); 257 } 258 else if (strcmp(name, "vspKdTree") == 0) 259 { 260 mVspKdTree = new VspKdTree(); 261 262 mViewCellsManager = new VspKdViewCellsManager(mVspKdTree); 263 } 264 else if (strcmp(name, "sceneDependent") == 0) 265 { 266 //TODO 267 mBspTree = new BspTree(); 268 269 Debug << "view cell type: Bsp" << endl; 270 271 mViewCellsManager = new BspViewCellsManager(mBspTree); 272 } 273 else 274 { 275 cerr<<"Wrong view cells type" << name << endl; 276 exit(1); 277 } 278 279 return mViewCellsManager; 274 280 } 275 281 -
trunk/VUT/GtpVisibilityPreprocessor/src/Preprocessor.h
r573 r575 121 121 VssRayContainer &vssRays) {}; 122 122 123 ViewCellsManager *CreateViewCellsManager(const char *name); 124 123 125 /// scene graph loaded from file 124 126 SceneGraph *mSceneGraph; -
trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellBsp.h
r574 r575 356 356 class BspTree 357 357 { 358 friend class ViewCellsParseHandlers; 359 358 360 public: 359 361 -
trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellsManager.cpp
r574 r575 126 126 //-- construction rays => we use uniform samples for this 127 127 CastPassSamples(mInitialSamples, 128 Preprocessor::DIRECTION_BASED_DISTRIBUTION,129 //Preprocessor::SPATIAL_BOX_BASED_DISTRIBUTION,128 //Preprocessor::DIRECTION_BASED_DISTRIBUTION, 129 Preprocessor::SPATIAL_BOX_BASED_DISTRIBUTION, 130 130 initialSamples); 131 131 … … 157 157 Preprocessor::SPATIAL_BOX_BASED_DISTRIBUTION; 158 158 159 dirSamples = !dirSamples; // toggle sampling 159 dirSamples = !dirSamples; // toggle sampling method 160 160 numSamples += CastPassSamples(mSamplesPerPass, 161 161 samplingType, … … 2679 2679 mVspBspTree = new VspBspTree(); 2680 2680 2681 bool success = parser.ParseFile(filename, mVspBspTree,this, objects);2681 bool success ;//= parser.ParseFile(filename, &this, objects); 2682 2682 mVspBspTree->RepairViewCellsLeafLists(); 2683 2683 mVspBspTree->mBox = GetViewSpaceBox(); … … 2764 2764 viewCell->SetArea(area); 2765 2765 } 2766 2767 2768 2769 ViewCellsManager *ViewCellsManagerFactory::Create(const string mName) 2770 { 2771 //TODO 2772 return NULL;// new VspBspViewCellsManager(); 2773 } -
trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellsManager.h
r574 r575 688 688 }; 689 689 690 691 class ViewCellsManagerFactory 692 { 693 694 public: 695 696 ViewCellsManager *Create(const string mName); 697 698 }; 699 690 700 #endif -
trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellsParser.cpp
r556 r575 61 61 // StdInParseHandlers: Constructors and Destructor 62 62 // --------------------------------------------------------------------------- 63 ViewCellsParseHandlers::ViewCellsParseHandlers(VspBspTree *tree, 64 ViewCellsManager *viewCells, 63 ViewCellsParseHandlers::ViewCellsParseHandlers(ViewCellsManager **viewCells, 65 64 ObjectContainer *objects): 66 65 mElementCount(0) … … 69 68 , mSpaceCount(0) 70 69 { 71 mVspBspTree = tree;72 mCurrentNode = tree->GetRoot();73 mViewCellsManager = viewCells;74 70 mObjects = objects; 75 } 71 viewCells = &mViewCellsManager; 72 //mPreprocessor = preprocessor; 73 } 74 76 75 77 76 ViewCellsParseHandlers::~ViewCellsParseHandlers() … … 90 89 string element(lname.LocalForm()); 91 90 if (element == "Interior") 92 End Interior();91 EndBspInterior(); 93 92 if (element == "ViewCells") 94 93 EndViewCells(); … … 96 95 97 96 98 void ViewCellsParseHandlers::End Interior()97 void ViewCellsParseHandlers::EndBspInterior() 99 98 { 100 99 // go one up in the tree … … 114 113 void ViewCellsParseHandlers::EndViewCells() 115 114 { 116 // sort view cells for easily findingid115 // sort view cells to help associating view cells according to their id 117 116 stable_sort(mViewCells.begin(), mViewCells.end(), vlt); 117 } 118 119 120 121 void ViewCellsParseHandlers::StartHierarchy(AttributeList& attributes) 122 { 123 int len = attributes.getLength(); 124 125 for (int i = 0; i < len; ++ i) 126 { 127 string attrName(StrX(attributes.getName(i)).LocalForm()); 128 129 if (attrName == "name") 130 { 131 StrX attrValue(attributes.getValue(i)); 132 133 const char *ptr = attrValue.LocalForm(); 134 135 CreateViewCellsManager(ptr); 136 } 137 } 138 } 139 140 141 void ViewCellsParseHandlers::startBspElement(string element, 142 AttributeList& attributes) 143 { 144 if (element == "ViewCell") 145 { 146 cout << "v"; 147 StartViewCell(attributes); 148 } 149 150 if (element == "Interior") 151 { 152 cout << "["; 153 StartBspInterior(attributes); 154 } 155 156 if (element == "Leaf") 157 { 158 StartBspLeaf(attributes); 159 } 118 160 } 119 161 … … 125 167 string element(lname.LocalForm()); 126 168 127 if (element == "ViewCell") 128 { 129 cout << "v"; 130 StartViewCell(attributes); 131 } 132 133 if (element == "Interior") 134 { 135 cout << "["; 136 StartInterior(attributes); 137 } 138 139 if (element == "Leaf") 140 { 141 StartLeaf(attributes); 142 } 143 169 if (element == "Hierarchy") 170 { 171 cout << "h"; 172 StartHierarchy(attributes); 173 } 174 175 switch (mViewCellsManager->GetType()) 176 { 177 case ViewCellsManager::BSP: 178 case ViewCellsManager::VSP_BSP: 179 startBspElement(element, attributes); 180 break; 181 182 default: 183 Debug << "not implemented" << endl; 184 break; 185 186 } 187 144 188 ++ mElementCount; 145 189 mAttrCount += attributes.getLength(); … … 228 272 229 273 230 void ViewCellsParseHandlers::Start Leaf(AttributeList& attributes)274 void ViewCellsParseHandlers::StartBspLeaf(AttributeList& attributes) 231 275 { 232 276 BspLeaf * leaf = … … 239 283 else 240 284 { 241 mVspBspTree->mRoot = leaf; 285 if (mViewCellsManager->GetType() == ViewCellsManager::BSP) 286 mBspTree->mRoot = leaf; 287 else 288 mVspBspTree->mRoot = leaf; 242 289 } 243 290 … … 282 329 else 283 330 { 284 leaf->SetViewCell(mVspBspTree->GetOrCreateOutOfBoundsCell()); 285 leaf->SetTreeValid(false); 286 mVspBspTree->PropagateUpValidity(leaf); 287 } 288 } 289 290 291 void ViewCellsParseHandlers::StartInterior(AttributeList& attributes) 331 if (mViewCellsManager->GetType() == ViewCellsManager::VSP_BSP) 332 { 333 leaf->SetViewCell(mVspBspTree->GetOrCreateOutOfBoundsCell()); 334 leaf->SetTreeValid(false); 335 mVspBspTree->PropagateUpValidity(leaf); 336 } 337 } 338 } 339 340 341 void ViewCellsParseHandlers::StartBspInterior(AttributeList& attributes) 292 342 { 293 343 Plane3 plane; … … 318 368 else 319 369 { 320 mVspBspTree->mRoot = interior; 370 if (mViewCellsManager->GetType() == ViewCellsManager::BSP) 371 mBspTree->mRoot = interior; 372 else 373 mVspBspTree->mRoot = interior; 321 374 } 322 375 323 376 mCurrentNode = interior; 377 } 378 379 380 381 void ViewCellsParseHandlers::CreateViewCellsManager(const char *name) 382 { 383 384 if (strcmp(name, "bspTree") == 0) 385 { 386 mBspTree = new BspTree(); 387 388 Debug << "view cell type: Bsp" << endl; 389 390 mCurrentNode = mBspTree->GetRoot(); 391 392 mViewCellsManager = new BspViewCellsManager(mBspTree); 393 } 394 else if (strcmp(name, "vspBspTree") == 0) 395 { 396 mVspBspTree = new VspBspTree(); 397 398 Debug << "view cell type: VspBsp" << endl; 399 mCurrentNode = mVspBspTree->GetRoot(); 400 401 mViewCellsManager = new VspBspViewCellsManager(mVspBspTree); 402 } 403 /*else if (strcmp(name, "vspKdTree") == 0) 404 { 405 mVspKdTree = new VspKdTree(); 406 407 mViewCellsManager = VspKdViewCellsManager(mVspKdTree); 408 }*/ 409 else 410 { 411 cerr<<"Wrong view cells type" << name << endl; 412 exit(1); 413 } 324 414 } 325 415 … … 380 470 381 471 bool ViewCellsParser::ParseFile(const string filename, 382 VspBspTree *tree, 383 ViewCellsManager *viewCells, 472 ViewCellsManager **viewCells, 384 473 ObjectContainer *objects) 385 474 { … … 414 503 // to do. 415 504 // 416 ViewCellsParseHandlers handler( tree,viewCells, objects);505 ViewCellsParseHandlers handler(viewCells, objects); 417 506 parser->setDocumentHandler(&handler); 418 507 parser->setErrorHandler(&handler); -
trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellsParser.h
r508 r575 15 15 //bool ParseFile(const string filename, ViewCellsManager &viewCells); 16 16 bool ParseFile(const string filename, 17 VspBspTree *tree, 18 ViewCellsManager *viewCells, 17 ViewCellsManager **viewCells, 19 18 ObjectContainer *objects); 20 19 }; -
trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellsParserXerces.h
r508 r575 14 14 15 15 class VspBspTree; 16 class BspTree; 16 17 class ViewCellsManager; 17 18 … … 22 23 // Constructors and Destructor 23 24 // ----------------------------------------------------------------------- 24 ViewCellsParseHandlers(VspBspTree *tree, 25 ViewCellsManager *viewCellsManager, 25 ViewCellsParseHandlers(ViewCellsManager **viewCellsManager, 26 26 ObjectContainer *objects); 27 27 ~ViewCellsParseHandlers(); … … 61 61 void resetDocument(); 62 62 63 void CreateViewCellsManager(const char *name); 64 65 63 66 VspBspTree *mVspBspTree; 67 BspTree *mBspTree; 68 64 69 BspNode *mCurrentNode; 65 70 ViewCellContainer mViewCells; … … 68 73 69 74 // Handlers for X3D 70 void Start Leaf(AttributeList& attributes);71 void Start Interior(AttributeList& attributes);72 void End Interior();75 void StartBspLeaf(AttributeList& attributes); 76 void StartBspInterior(AttributeList& attributes); 77 void EndBspInterior(); 73 78 74 79 void StartViewCell(AttributeList& attributes); 75 80 void EndViewCells(); 76 81 82 void StartHierarchy(AttributeList& attributes); 83 84 void startBspElement(string element, AttributeList& attributes); 77 85 // ----------------------------------------------------------------------- 78 86 // Handlers for the SAX ErrorHandler interface
Note: See TracChangeset
for help on using the changeset viewer.