- Timestamp:
- 02/05/06 11:03:17 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellsManager.cpp
r597 r598 85 85 { 86 86 DEL_PTR(mRenderer); 87 //CLEAR_CONTAINER(mViewCells); 88 DEL_PTR(mViewCellsTree); 87 88 if (!ViewCellsTreeConstructed()) 89 CLEAR_CONTAINER(mViewCells); 90 else 91 DEL_PTR(mViewCellsTree); 89 92 90 93 CLEAR_CONTAINER(mMeshContainer); … … 689 692 int axis = 0; 690 693 691 Vector3 point = mViewSpaceBox.Center(); 694 const float factor = 0.55; 695 Vector3 point = mViewSpaceBox.Min() + mViewSpaceBox.Size() * factor; 692 696 693 697 if (mUseCuttingPlaneForViz) … … 1277 1281 if (exporter) 1278 1282 { 1283 //exporter->SetFilled(); 1284 1285 if (mExportGeometry) 1286 exporter->ExportGeometry(objects); 1287 1279 1288 Material m; 1280 1289 m.mDiffuseColor = RgbColor(1, 0, 0); … … 1288 1297 exporter->SetForcedMaterial(m); 1289 1298 //exporter->ResetForcedMaterial(); 1290 1291 exporter->SetFilled();1292 1293 if (mExportGeometry)1294 exporter->ExportGeometry(objects);1295 1299 1296 1300 delete exporter; … … 1402 1406 ViewCell *vc) const 1403 1407 { 1404 if (mColorCode == 0) // Random color 1405 { 1406 exporter->ResetForcedMaterial(); 1407 return; 1408 } 1408 const bool vcValid = CheckValidity(vc, mMinPvsSize, mMaxPvsSize); 1409 1409 1410 1410 float importance = 0; 1411 static Material m; 1411 1412 1412 1413 switch (mColorCode) 1413 1414 { 1415 case 0: // Random 1416 { 1417 if (vcValid) 1418 { 1419 m.mDiffuseColor.r = 0.5f + RandomValue(0.0f, 0.5f); 1420 m.mDiffuseColor.g = 0.5f + RandomValue(0.0f, 0.5f); 1421 m.mDiffuseColor.b = 0.5f + RandomValue(0.f, 0.5f); 1422 } 1423 else 1424 { 1425 m.mDiffuseColor.r = 0.0f; 1426 m.mDiffuseColor.g = 1.0f; 1427 m.mDiffuseColor.b = 0.0f; 1428 } 1429 1430 exporter->SetForcedMaterial(m); 1431 return; 1432 } 1433 1414 1434 case 1: // pvs 1415 1435 { 1416 1436 importance = (float)vc->GetPvs().GetSize() / 1417 1437 (float)mViewCellsStats.maxPvs; 1438 1418 1439 } 1419 1440 break; 1420 1441 case 2: // merges 1421 1442 { 1422 importance = (float)mViewCellsTree->GetSize(vc) / 1423 (float)mViewCellsStats.maxLeaves; 1424 } 1425 break; 1443 int lSize = mViewCellsTree->GetSize(vc); 1444 1445 importance = (float)lSize / (float)mViewCellsStats.maxLeaves; 1446 } 1447 //break; 1426 1448 case 3: // merge tree differene 1427 1449 { 1428 1450 // TODO 1451 //importance = (float)GetMaxTreeDiff(vc) / 1452 // (float)(mVspBspTree->GetStatistics().maxDepth * 2); 1453 1429 1454 } 1430 1455 break; … … 1433 1458 } 1434 1459 1435 Material m; 1436 m.mDiffuseColor.b = 1.0f; 1460 // special color code for invalid view cells 1437 1461 m.mDiffuseColor.r = importance; 1438 1462 m.mDiffuseColor.g = 1.0f - m.mDiffuseColor.r; 1439 1463 m.mDiffuseColor.b = vcValid ? 1.0f : 0.0f; 1464 1465 //Debug << "importance: " << importance << endl; 1440 1466 exporter->SetForcedMaterial(m); 1441 1467 } … … 1466 1492 *cuttingPlane, 1467 1493 mViewSpaceBox, 1468 0.00 5);1494 0.0001); 1469 1495 1470 1496 exporter->ExportPolygons(back.mPolys); … … 2049 2075 return; 2050 2076 2077 if (mExportGeometry) 2078 exporter->ExportGeometry(objects); 2079 2051 2080 //exporter->SetWireframe(); 2052 2081 //exporter->ExportVspKdTree(*mVspKdTree, mVspKdTree->GetStatistics().maxPvsSize); 2053 2082 exporter->ExportVspKdTree(*mVspKdTree); 2054 2055 if (mExportGeometry)2056 exporter->ExportGeometry(objects);2057 2083 2058 2084 if (mExportRays) … … 2416 2442 if (exporter) 2417 2443 { 2444 if (0 && mExportRays) 2445 exporter->ExportRays(rays, RgbColor(1, 1, 1)); 2446 2447 if (mExportGeometry) 2448 exporter->ExportGeometry(objects); 2449 2418 2450 //exporter->SetWireframe(); 2419 2451 exporter->SetFilled(); 2420 2452 ExportViewCellsForViz(exporter); 2421 2422 if (0 && mExportRays)2423 exporter->ExportRays(rays, RgbColor(1, 1, 1));2424 2425 if (mExportGeometry)2426 exporter->ExportGeometry(objects);2427 2453 2428 2454 delete exporter; … … 2497 2523 if (exporter) 2498 2524 { 2499 if (0)2500 exporter->SetWireframe();2501 else2502 exporter->SetFilled();2503 ExportViewCellsForViz(exporter);2504 2505 2525 if (mExportGeometry) 2506 2526 { … … 2513 2533 } 2514 2534 2535 if (0) 2536 exporter->SetWireframe(); 2537 else 2538 exporter->SetFilled(); 2539 2540 ExportViewCellsForViz(exporter); 2541 2515 2542 delete exporter; 2516 2543 } … … 2600 2627 RefineViewCells(postProcessRays, objects); 2601 2628 2602 if (mCompressViewCells) 2629 //-- compression 2630 2631 if (ViewCellsTreeConstructed() && mCompressViewCells) 2603 2632 { 2604 2633 int pvsEntries = mViewCellsTree->GetNumPvsEntries(mViewCellsTree->GetRoot()); … … 2628 2657 2629 2658 2630 //-- export shuffledview cells2659 //-- export refined (shuffled) view cells 2631 2660 if (0) 2632 2661 { … … 2701 2730 // real meshes are only contructed only at this stage 2702 2731 FinalizeViewCells(true); 2703 2704 // HACK: removes view cells in bsp leaves with active ones2705 if (0)2706 AddCurrentViewCellsToHierarchy();2707 2708 2732 2709 2733 // write view cells to disc … … 3056 3080 if (vcValid) 3057 3081 { 3058 m.mDiffuseColor.r = RandomValue(0.3f, 1.0f);3059 m.mDiffuseColor.g = RandomValue(0.3f, 1.0f);3060 m.mDiffuseColor.b = RandomValue(0.3f, 1.0f);3082 m.mDiffuseColor.r = 0.5f + RandomValue(0.0f, 0.5f); 3083 m.mDiffuseColor.g = 0.5f + RandomValue(0.0f, 0.5f); 3084 m.mDiffuseColor.b = 0.5f + RandomValue(0.f, 0.5f); 3061 3085 } 3062 3086 else … … 3140 3164 *cuttingPlane, 3141 3165 mViewSpaceBox, 3142 0.00 5);3166 0.0001); 3143 3167 3144 3168 exporter->ExportPolygons(back.mPolys);
Note: See TracChangeset
for help on using the changeset viewer.