Ignore:
Timestamp:
02/05/06 11:03:17 (18 years ago)
Author:
mattausch
Message:

added cutting plane and enlarging view space

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellsManager.cpp

    r597 r598  
    8585{ 
    8686        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); 
    8992 
    9093        CLEAR_CONTAINER(mMeshContainer); 
     
    689692        int axis = 0; 
    690693 
    691         Vector3 point = mViewSpaceBox.Center(); 
     694        const float factor = 0.55; 
     695        Vector3 point = mViewSpaceBox.Min() +  mViewSpaceBox.Size() * factor; 
    692696 
    693697        if (mUseCuttingPlaneForViz) 
     
    12771281        if (exporter) 
    12781282        { 
     1283                //exporter->SetFilled(); 
     1284 
     1285                if (mExportGeometry) 
     1286                        exporter->ExportGeometry(objects); 
     1287 
    12791288                Material m; 
    12801289                m.mDiffuseColor = RgbColor(1, 0, 0); 
     
    12881297                exporter->SetForcedMaterial(m); 
    12891298                //exporter->ResetForcedMaterial(); 
    1290  
    1291                 exporter->SetFilled(); 
    1292  
    1293                 if (mExportGeometry) 
    1294                         exporter->ExportGeometry(objects); 
    12951299 
    12961300                delete exporter; 
     
    14021406                                                                          ViewCell *vc) const 
    14031407{ 
    1404         if (mColorCode == 0) // Random color 
    1405         { 
    1406                 exporter->ResetForcedMaterial(); 
    1407                 return; 
    1408         } 
     1408                const bool vcValid = CheckValidity(vc, mMinPvsSize, mMaxPvsSize); 
    14091409 
    14101410        float importance = 0; 
     1411        static Material m; 
    14111412 
    14121413        switch (mColorCode) 
    14131414        { 
     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                 
    14141434        case 1: // pvs 
    14151435                { 
    14161436                        importance = (float)vc->GetPvs().GetSize() / 
    14171437                                (float)mViewCellsStats.maxPvs; 
     1438 
    14181439                } 
    14191440                break; 
    14201441        case 2: // merges 
    14211442                { 
    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; 
    14261448        case 3: // merge tree differene 
    14271449                { 
    14281450                        // TODO 
     1451                        //importance = (float)GetMaxTreeDiff(vc) / 
     1452                        //      (float)(mVspBspTree->GetStatistics().maxDepth * 2); 
     1453 
    14291454                } 
    14301455                break; 
     
    14331458        } 
    14341459 
    1435         Material m; 
    1436         m.mDiffuseColor.b = 1.0f; 
     1460        // special color code for invalid view cells 
    14371461        m.mDiffuseColor.r = importance; 
    14381462        m.mDiffuseColor.g = 1.0f - m.mDiffuseColor.r; 
    1439  
     1463        m.mDiffuseColor.b = vcValid ? 1.0f : 0.0f; 
     1464 
     1465        //Debug << "importance: " << importance << endl; 
    14401466        exporter->SetForcedMaterial(m); 
    14411467} 
     
    14661492                                                   *cuttingPlane, 
    14671493                                                   mViewSpaceBox,  
    1468                                                    0.005); 
     1494                                                   0.0001); 
    14691495 
    14701496                exporter->ExportPolygons(back.mPolys); 
     
    20492075                return; 
    20502076 
     2077        if (mExportGeometry) 
     2078                exporter->ExportGeometry(objects); 
     2079         
    20512080        //exporter->SetWireframe(); 
    20522081        //exporter->ExportVspKdTree(*mVspKdTree, mVspKdTree->GetStatistics().maxPvsSize); 
    20532082        exporter->ExportVspKdTree(*mVspKdTree); 
    2054  
    2055         if (mExportGeometry) 
    2056                 exporter->ExportGeometry(objects); 
    20572083 
    20582084        if (mExportRays) 
     
    24162442                if (exporter) 
    24172443                { 
     2444                        if (0 && mExportRays) 
     2445                                exporter->ExportRays(rays, RgbColor(1, 1, 1)); 
     2446 
     2447                        if (mExportGeometry) 
     2448                                exporter->ExportGeometry(objects); 
     2449 
    24182450                        //exporter->SetWireframe(); 
    24192451                        exporter->SetFilled(); 
    24202452                        ExportViewCellsForViz(exporter); 
    2421  
    2422                         if (0 && mExportRays) 
    2423                                 exporter->ExportRays(rays, RgbColor(1, 1, 1)); 
    2424  
    2425                         if (mExportGeometry) 
    2426                                 exporter->ExportGeometry(objects); 
    24272453 
    24282454                        delete exporter; 
     
    24972523                if (exporter) 
    24982524                { 
    2499                         if (0) 
    2500                                 exporter->SetWireframe(); 
    2501                         else 
    2502                                 exporter->SetFilled(); 
    2503                         ExportViewCellsForViz(exporter); 
    2504  
    25052525                        if (mExportGeometry) 
    25062526                        { 
     
    25132533                        } 
    25142534 
     2535                        if (0) 
     2536                                exporter->SetWireframe(); 
     2537                        else 
     2538                                exporter->SetFilled(); 
     2539 
     2540                        ExportViewCellsForViz(exporter); 
     2541 
    25152542                        delete exporter; 
    25162543                } 
     
    26002627                RefineViewCells(postProcessRays, objects); 
    26012628 
    2602         if (mCompressViewCells) 
     2629        //-- compression 
     2630 
     2631        if (ViewCellsTreeConstructed() && mCompressViewCells) 
    26032632        { 
    26042633                int pvsEntries = mViewCellsTree->GetNumPvsEntries(mViewCellsTree->GetRoot()); 
     
    26282657 
    26292658 
    2630         //-- export shuffled view cells 
     2659        //-- export refined (shuffled) view cells 
    26312660        if (0) 
    26322661        { 
     
    27012730        // real meshes are only contructed only at this stage 
    27022731        FinalizeViewCells(true); 
    2703  
    2704         // HACK: removes view cells in bsp leaves with active ones 
    2705         if (0) 
    2706                 AddCurrentViewCellsToHierarchy(); 
    2707  
    27082732 
    27092733        // write view cells to disc 
     
    30563080                        if (vcValid) 
    30573081                        { 
    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); 
    30613085                        } 
    30623086                        else 
     
    31403164                                                           *cuttingPlane, 
    31413165                                                           mViewSpaceBox,  
    3142                                                            0.005); 
     3166                                                           0.0001); 
    31433167 
    31443168                        exporter->ExportPolygons(back.mPolys); 
Note: See TracChangeset for help on using the changeset viewer.