- Timestamp:
- 02/03/06 17:48:15 (19 years ago)
- Location:
- trunk/VUT/GtpVisibilityPreprocessor/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/VUT/GtpVisibilityPreprocessor/src/ViewCell.cpp
r584 r585 50 50 51 51 return (float)pvs; 52 } 53 54 55 56 57 inline int CountDiffPvs(ViewCell *vc) 58 { 59 int count = 0; 60 61 ObjectPvsMap::const_iterator it, it_end = vc->GetPvs().mEntries.end(); 62 for (it = vc->GetPvs().mEntries.begin(); it != it_end; ++ it) 63 { 64 if (!(*it).first->Mailed()) 65 { 66 (*it).first->Mail(); 67 ++ count; 68 } 69 } 70 71 return count; 52 72 } 53 73 … … 1257 1277 1258 1278 ViewCellContainer::const_iterator it, it_end = interior->mChildren.end(); 1279 1259 1280 // compress child sets first 1260 1281 for (it = interior->mChildren.begin(); it != it_end; ++ it) … … 1263 1284 } 1264 1285 1286 // compress root node 1265 1287 PropagateUpVisibility(interior); 1266 1288 } … … 1341 1363 1342 1364 for (oit = vc->GetPvs().mEntries.begin(); oit != oit_end; ++ oit) 1343 { 1344 Debug << "mail: " << (*oit).first->mMailbox << endl; 1345 1365 { 1346 1366 if ((*oit).first->Mailed((int)interior->mChildren.size())) 1347 1367 { 1348 //Debug << "adding sample" << endl;1349 1368 interior->GetPvs().AddSample((*oit).first, (*oit).second.mSumPdf); 1350 //(*oit)->remove();1351 1369 } 1352 1370 } … … 1366 1384 } 1367 1385 } 1368 } 1386 1387 int dummy = interior->GetPvs().GetSize(); 1388 1389 for (cit = interior->mChildren.begin(); cit != cit_end; ++ cit) 1390 { 1391 dummy += (*cit)->GetPvs().GetSize(); 1392 } 1393 1394 } 1395 1369 1396 1370 1397 1371 1398 void ViewCellsTree::GetPvs(ViewCell *vc, ObjectPvs &pvs) const 1372 1399 { 1373 if (mIsCompressed) 1374 { 1375 ObjectPvsMap::const_iterator oit, oit_end = vc->GetPvs().mEntries.end(); 1376 1377 for (oit = vc->GetPvs().mEntries.begin(); oit != oit_end; ++ oit) 1378 { 1379 pvs.AddSample((*oit).first, (*oit).second.mSumPdf); 1380 } 1400 Intersectable::NewMail(); 1401 1402 if (!mIsCompressed) 1403 pvs = vc->GetPvs(); 1404 1405 int pvsSize = 0; 1406 ViewCell *root = vc; 1407 1408 // also add pvs from this view cell to root 1409 while (root->GetParent()) 1410 { 1411 root = root->GetParent(); 1412 pvs.AddPvs(root->GetPvs()); 1413 } 1414 1415 stack<ViewCell *> tstack; 1416 tstack.push(vc); 1417 1418 while (!tstack.empty()) 1419 { 1420 vc = tstack.top(); 1421 tstack.pop(); 1422 1423 pvs.AddPvs(vc->GetPvs()); 1381 1424 1382 1425 if (!vc->IsLeaf()) 1383 1426 { 1384 1427 ViewCellInterior *interior = dynamic_cast<ViewCellInterior *>(vc); 1428 1385 1429 ViewCellContainer::const_iterator it, it_end = interior->mChildren.end(); 1386 1430 1387 1431 for (it = interior->mChildren.begin(); it != it_end; ++ it) 1388 1432 { 1389 GetPvs(*it, pvs); 1390 } 1391 } 1392 } 1393 else 1394 { 1395 pvs = vc->GetPvs(); 1433 tstack.push(*it); 1434 } 1435 } 1396 1436 } 1397 1437 } … … 1400 1440 int ViewCellsTree::GetPvsSize(ViewCell *vc) const 1401 1441 { 1402 int pvsSize = vc->GetPvs().GetSize(); 1403 1404 //Debug << "current size: " << pvsSize << endl; 1405 if (mIsCompressed && !vc->IsLeaf()) 1406 { 1407 ViewCellInterior *interior = dynamic_cast<ViewCellInterior *>(vc); 1408 1409 ViewCellContainer::const_iterator it, it_end = interior->mChildren.end(); 1410 1411 for (it = interior->mChildren.begin(); it != it_end; ++ it) 1412 { 1413 pvsSize += GetPvsSize(*it); 1442 Intersectable::NewMail(); 1443 1444 if (!mIsCompressed) 1445 return vc->GetPvs().GetSize(); 1446 1447 int pvsSize = 0; 1448 ViewCell *root = vc; 1449 1450 // also add pvs from this view cell to root 1451 while (root->GetParent()) 1452 { 1453 root = root->GetParent(); 1454 pvsSize += CountDiffPvs(root); 1455 } 1456 1457 stack<ViewCell *> tstack; 1458 tstack.push(vc); 1459 1460 Debug << "current size: " << pvsSize << endl; 1461 1462 while (!tstack.empty()) 1463 { 1464 vc = tstack.top(); 1465 tstack.pop(); 1466 1467 pvsSize += CountDiffPvs(vc); 1468 1469 if (!vc->IsLeaf()) 1470 { 1471 ViewCellInterior *interior = dynamic_cast<ViewCellInterior *>(vc); 1472 1473 ViewCellContainer::const_iterator it, it_end = interior->mChildren.end(); 1474 1475 for (it = interior->mChildren.begin(); it != it_end; ++ it) 1476 { 1477 tstack.push(*it); 1478 } 1414 1479 } 1415 1480 } -
trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellsManager.cpp
r584 r585 2366 2366 RefineViewCells(postProcessRays, objects); 2367 2367 2368 ViewCellContainer::const_iterator vit, vit_end = mViewCells.end(); 2369 2370 int pvsSize = 0; 2371 int numPvsEntries = 0; 2372 2373 int vidx = 0; 2374 for (vit = mViewCells.begin(); vit != vit_end; ++ vit) 2375 { 2376 const int vcPvs = mViewCellsTree->GetPvsSize(*vit); 2377 const int pvsEntries = mViewCellsTree->GetNumPvsEntries(*vit); 2378 2379 pvsSize += vcPvs; 2380 numPvsEntries += pvsEntries; 2381 Debug << "Viewcell " << vidx ++ << ": " << vcPvs << endl; 2382 } 2383 2384 Debug << "pvs size before compress: " << pvsSize << endl; 2385 Debug << "number of entries before compress: " << numPvsEntries << endl; 2368 int pvsEntries = mViewCellsTree->GetNumPvsEntries(mViewCellsTree->GetRoot()); 2369 Debug << "number of entries before compress: " << pvsEntries << endl; 2386 2370 2387 2371 mViewCellsTree->CompressViewCellsPvs(); 2388 2372 2389 pvsSize = numPvsEntries = vidx = 0; 2390 2391 for (vit = mViewCells.begin(); vit != vit_end; ++ vit) 2392 { 2393 const int vcPvs = mViewCellsTree->GetPvsSize(*vit); 2394 const int pvsEntries = mViewCellsTree->GetNumPvsEntries(*vit); 2395 2396 pvsSize += vcPvs; 2397 numPvsEntries += pvsEntries; 2398 Debug << "Viewcell " << vidx ++ << ": " << vcPvs << endl; 2399 } 2400 2401 Debug << "pvs size after compress: " << pvsSize << endl; 2402 Debug << "number of entries after compress: " << numPvsEntries << endl; 2373 pvsEntries = mViewCellsTree->GetNumPvsEntries(mViewCellsTree->GetRoot()); 2374 Debug << "number of entries after compress: " << pvsEntries << endl; 2403 2375 2404 2376 if (1)
Note: See TracChangeset
for help on using the changeset viewer.