Changeset 1625 for GTP/trunk/Lib/Vis/Preprocessing/src/HierarchyManager.h
- Timestamp:
- 10/16/06 15:11:13 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/Preprocessing/src/HierarchyManager.h
r1624 r1625 239 239 protected: 240 240 241 /** Returns true if the global termination criteria were met. 242 */ 241 243 bool GlobalTerminationCriteriaMet(SubdivisionCandidate *candidate) const; 242 244 … … 244 246 first split candidates. 245 247 */ 246 void PrepareObjectSpaceSubdivision( 247 const VssRayContainer &sampleRays, 248 const ObjectContainer &objects); 249 250 void RunConstruction( 251 const bool repairQueue, 252 const VssRayContainer &sampleRays, 253 const ObjectContainer &objects, 254 AxisAlignedBox3 *forcedViewSpace); 255 248 SubdivisionCandidate *PrepareObjectSpaceSubdivision(const VssRayContainer &sampleRays, 249 const ObjectContainer &objects); 250 251 252 ////////////////////////////// 253 // the main loop 254 ////////////////////// 255 256 /** This is for interleaved construction / sequential construction. 257 */ 258 void RunConstruction(const bool repairQueue, 259 const VssRayContainer &sampleRays, 260 const ObjectContainer &objects, 261 AxisAlignedBox3 *forcedViewSpace); 262 263 /** This is for interleaved construction using some objects 264 and some view space splits. 265 */ 266 int RunConstruction(SplitQueue &splitQueue, 267 SubdivisionCandidateContainer &chosenCandidates, 268 const float minRenderCostDecr, 269 const int maxSteps); 270 271 /** Default subdivision method. 272 */ 256 273 void RunConstruction(const bool repairQueue); 257 274 275 //////////////////////////////////////////////// 276 258 277 /** Evaluates the subdivision candidate and executes the split. 259 278 */ 260 bool ApplySubdivisionCandidate(SubdivisionCandidate *sc, const bool repairQueue); 261 279 bool ApplySubdivisionCandidate(SubdivisionCandidate *sc, 280 SplitQueue &splitQueue, 281 const bool repairQueue); 282 283 /** Tests if hierarchy construction is finished. 284 */ 262 285 bool FinishedConstruction() const; 263 286 264 SubdivisionCandidate *NextSubdivisionCandidate(); 265 266 /** Repairs the dirty entries of the candidate queue. 267 */ 268 void RepairQueue(SubdivisionCandidate *sc); 287 /** Returns next subdivision candidate from the split queue. 288 */ 289 SubdivisionCandidate *NextSubdivisionCandidate(SplitQueue &splitQueue); 290 291 /** Repairs the dirty entries of the subdivision candidate queue. The 292 list of entries is given in the dirty list. 293 */ 294 void RepairQueue(const vector<SubdivisionCandidate *> &dirtyList, SplitQueue &splitQueue); 295 296 /** Collect subdivision candidates which were affected by the splits from the 297 chosenCandidates list. 298 */ 299 void CollectDirtyCandidates(const SubdivisionCandidateContainer &chosenCandidates, 300 SubdivisionCandidateContainer &dirtyList); 269 301 270 302 /** Collect the list of dirty candidates after the current 271 303 subdivision candidate split. 272 304 */ 273 void CollectDirtyCandidates( 274 SubdivisionCandidate *sc, 275 vector<SubdivisionCandidate *> &dirtyList); 305 void CollectDirtyCandidates(SubdivisionCandidate *sc, 306 vector<SubdivisionCandidate *> &dirtyList); 276 307 277 308 /** Evaluate subdivision stats for log. … … 279 310 void EvalSubdivisionStats(); 280 311 281 void AddSubdivisionStats( 282 const int splits, 283 const float renderCostDecr, 284 const float totalRenderCost, 285 const int totalPvsEntries); 286 287 bool AddSampleToPvs( 288 Intersectable *obj, 289 const float pdf, 290 float &contribution) const; 291 292 void CollectViewSpaceDirtyList( 293 SubdivisionCandidate *sc, 294 SubdivisionCandidateContainer &dirtyList); 295 296 void CollectObjectSpaceDirtyList( 297 SubdivisionCandidate *sc, 298 SubdivisionCandidateContainer &dirtyList); 312 void AddSubdivisionStats(const int splits, 313 const float renderCostDecr, 314 const float totalRenderCost, 315 const int totalPvsEntries, 316 const int memory, 317 const float renderCostPerStorage); 318 319 bool AddSampleToPvs(Intersectable *obj, 320 const float pdf, 321 float &contribution) const; 322 323 /** Collect affected view space candidates. 324 */ 325 void CollectViewSpaceDirtyList(SubdivisionCandidate *sc, 326 SubdivisionCandidateContainer &dirtyList); 327 328 /** Collect affected object space candidates. 329 */ 330 void CollectObjectSpaceDirtyList(SubdivisionCandidate *sc, 331 SubdivisionCandidateContainer &dirtyList); 299 332 300 void ExportOspTree( 301 Exporter *exporter, 302 const ObjectContainer &objects) const; 303 333 /** Export object space partition tree. 334 */ 335 void ExportOspTree(Exporter *exporter, 336 const ObjectContainer &objects) const; 337 338 /** Parse the environment variables. 339 */ 304 340 void ParseEnvironment(); 305 341 … … 307 343 bool StartViewSpaceSubdivision() const; 308 344 309 void PrepareBvHierarchy( 310 const VssRayContainer &sampleRays, 311 const ObjectContainer &objects); 312 313 void PrepareOspTree( 314 const VssRayContainer &sampleRays, 315 const ObjectContainer &objects); 316 317 void PrepareViewSpaceSubdivision( 318 const VssRayContainer &sampleRays, 319 const ObjectContainer &objects); 320 345 //////////////////////////// 346 // Helper function for preparation of subdivision 347 /////// 348 349 /** Prepare bv hierarchy for subdivision 350 */ 351 SubdivisionCandidate *PrepareBvHierarchy(const VssRayContainer &sampleRays, 352 const ObjectContainer &objects); 353 354 /** Prepare object space kd tree for subdivision. 355 */ 356 SubdivisionCandidate *PrepareOspTree(const VssRayContainer &sampleRays, 357 const ObjectContainer &objects); 358 359 /** Prepare view space subdivision and add candidate to queue. 360 */ 361 SubdivisionCandidate *PrepareViewSpaceSubdivision(const VssRayContainer &sampleRays, 362 const ObjectContainer &objects); 363 364 /** Was object space subdivision already constructed? 365 */ 321 366 bool ObjectSpaceSubdivisionConstructed() const; 367 368 /** Was view space subdivision already constructed? 369 */ 322 370 bool ViewSpaceSubdivisionConstructed() const; 323 371 372 /** Reset the split queue, i.e., reevaluate the split candidates. 373 */ 324 374 void ResetQueue(); 325 375 376 /** After the suddivision has ended, do some final tasks. 377 */ 326 378 void FinishObjectSpaceSubdivision(const ObjectContainer &objects) const; 327 379 380 /** Returns depth of object space subdivision. 381 */ 328 382 int GetObjectSpaceSubdivisionDepth() const; 329 383 384 /** Construct object space partition interleaved with view space partition. 385 Each time the best object or view space candidate is selected 386 for the next split. 387 */ 330 388 void ConstructInterleaved( 331 389 const VssRayContainer &sampleRays, … … 333 391 AxisAlignedBox3 *forcedViewSpace); 334 392 393 /** Construct object space partition interleaved with view space partition. 394 The method chooses a number candidates of each type for subdivision. 395 The number is determined by the "gradient", i.e., the render cost decrease. 396 Once this render cost decrease is lower than the render cost decrease 397 for the splits of previous type, the method will stop current subdivision and 398 evaluate if view space or object space would be the beneficial for the 399 next number of split. 400 */ 335 401 void ConstructInterleaved2( 336 402 const VssRayContainer &sampleRays, … … 349 415 so construction can be restarted. 350 416 */ 351 void ResetObjectSpaceSubdivision( 352 const VssRayContainer &rays, 353 const ObjectContainer &objects); 354 355 void HierarchyManager::ResetViewSpaceSubdivision( 356 const VssRayContainer &rays, 357 const ObjectContainer &objects); 417 SubdivisionCandidate *ResetObjectSpaceSubdivision(const VssRayContainer &rays, 418 const ObjectContainer &objects); 419 420 SubdivisionCandidate *ResetViewSpaceSubdivision(const VssRayContainer &rays, 421 const ObjectContainer &objects); 358 422 359 423 … … 390 454 /// object space partition kd tree 391 455 OspTree *mOspTree; 456 392 457 public: 393 458 /// bounding volume hierarchy … … 409 474 //////////////////// 410 475 411 /// keeps track of cost during subdivision412 //float mTotalCost;413 476 /// statistics about the hierarchy 414 477 HierarchyStatistics mHierarchyStats; … … 417 480 int mMinDepthForViewSpaceSubdivion; 418 481 419 int mMinRenderCostDecrease;482 //int mMinRenderCostDecrease; 420 483 421 484 ofstream mSubdivisionStats;
Note: See TracChangeset
for help on using the changeset viewer.