Changeset 1416


Ignore:
Timestamp:
09/19/06 09:41:23 (18 years ago)
Author:
mattausch
Message:
 
Location:
GTP/trunk/Lib/Vis/Preprocessing/src
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • GTP/trunk/Lib/Vis/Preprocessing/src/Environment.cpp

    r1415 r1416  
    2525 
    2626 
    27  
    28 //Environment *environment = NULL; 
    2927Environment *Environment::sEnvironment = NULL; 
    3028 
     
    3937        return sEnvironment; 
    4038} 
     39 
    4140 
    4241void Environment::DelSingleton() 
  • GTP/trunk/Lib/Vis/Preprocessing/src/Exporter.cpp

    r1415 r1416  
    106106bool Exporter::ExportBvHierarchy(const BvHierarchy &bvHierarchy,  
    107107                                                                 const int maxPvs, 
    108                                                                  AxisAlignedBox3 *box) 
     108                                                                 const AxisAlignedBox3 *box) 
    109109{ 
    110110        vector<BvhLeaf *> leaves; 
  • GTP/trunk/Lib/Vis/Preprocessing/src/Exporter.h

    r1415 r1416  
    4949                                  mUseForcedMaterial(false), 
    5050                                  mExportRayDensity(false) 
    51   { 
    52   } 
     51  {} 
     52 
    5353  virtual ~Exporter() {} 
    5454   
     
    117117 
    118118  virtual void 
    119   ExportGeometry(const ObjectContainer &objects, const bool exportSingleMesh = false, AxisAlignedBox3 *bbox = NULL); 
     119  ExportGeometry( 
     120        const ObjectContainer &objects,  
     121        const bool exportSingleMesh = false,  
     122        AxisAlignedBox3 *bbox = NULL); 
    120123 
    121124  virtual void 
     
    147150 
    148151  void ExportKdIntersectable(const KdIntersectable &kdObj); 
    149   bool ExportBvHierarchy(const BvHierarchy &bvHierarchy, const int maxPvs, AxisAlignedBox3 *box = NULL); 
     152 
     153  bool ExportBvHierarchy( 
     154          const BvHierarchy &bvHierarchy,  
     155          const int maxPvs,  
     156          const AxisAlignedBox3 *box = NULL); 
    150157 
    151158  virtual void ExportMeshInstance(MeshInstance *mi); 
  • GTP/trunk/Lib/Vis/Preprocessing/src/HierarchyManager.cpp

    r1415 r1416  
    143143        if (mOspTree) 
    144144                mOspTree->SetViewCellsManager(vcm); 
    145         if (mBvHierarchy) 
     145        else if (mBvHierarchy) 
    146146                mBvHierarchy->SetViewCellsManager(vcm); 
    147147} 
     
    163163{ 
    164164        return mVspTree->mBoundingBox; 
     165} 
     166 
     167 
     168AxisAlignedBox3 HierarchyManager::GetObjectSpaceBox() const 
     169{ 
     170        switch (mObjectSpaceSubdivisionType) 
     171        { 
     172        case KD_BASED_OBJ_SUBDIV: 
     173                return mOspTree->mBoundingBox; 
     174        case BV_BASED_OBJ_SUBDIV: 
     175                return mBvHierarchy->mBoundingBox; 
     176        default: 
     177                // empty box 
     178                return AxisAlignedBox3(); 
     179        } 
    165180} 
    166181 
     
    360375                { 
    361376                        KdNode *n = mOspTree->Subdivide(mTQueue, sc, globalTerminationCriteriaMet); 
    362  
    363                         if (n->IsLeaf()) // local or global termination criteria failed 
     377                        // local or global termination criteria failed 
     378                        if (n->IsLeaf())  
    364379                                return false; 
    365380                } 
     
    367382                { 
    368383                        BvhNode *n = mBvHierarchy->Subdivide(mTQueue, sc, globalTerminationCriteriaMet); 
    369  
    370                         if (n->IsLeaf()) // local or global termination criteria failed 
     384                        // local or global termination criteria failed 
     385                        if (n->IsLeaf()) 
    371386                                return false; 
    372387                } 
    373388        } 
    374389 
    375         return true;//!globalTerminationCriteriaMet; 
     390        return true; 
    376391} 
    377392 
     
    746761 
    747762void HierarchyManager::ExportObjectSpaceHierarchy(Exporter *exporter, 
    748                                                                                                   const ObjectContainer &objects) const 
     763                                                                                                  const ObjectContainer &objects, 
     764                                                                                                  const AxisAlignedBox3 *bbox) const 
    749765{ 
    750766        switch (mObjectSpaceSubdivisionType) 
     
    757773        case BV_BASED_OBJ_SUBDIV: 
    758774                { 
    759                         AxisAlignedBox3 bbox = mBvHierarchy->GetBoundingBox(); 
    760                         bbox.Scale(Vector3(0.5, 1, 0.5)); 
    761                          
    762                         ExportBvHierarchy(exporter, objects, &bbox); 
     775                        ExportBvHierarchy(exporter, objects, bbox); 
    763776                        break; 
    764777                } 
     
    771784void HierarchyManager::ExportBvHierarchy(Exporter *exporter,  
    772785                                                                                 const ObjectContainer &objects, 
    773                                                                                  AxisAlignedBox3 *bbox) const 
     786                                                                                 const AxisAlignedBox3 *bbox) const 
    774787{ 
    775788        exporter->SetWireframe(); 
  • GTP/trunk/Lib/Vis/Preprocessing/src/HierarchyManager.h

    r1415 r1416  
    201201 
    202202        AxisAlignedBox3 GetViewSpaceBox() const; 
     203        AxisAlignedBox3 GetObjectSpaceBox() const; 
    203204 
    204205        void ExportObjectSpaceHierarchy( 
    205206                Exporter *exporter,  
    206                 const ObjectContainer &objects) const; 
     207                const ObjectContainer &objects, 
     208                const AxisAlignedBox3 *bbox) const; 
    207209 
    208210 
     
    255257                Exporter *exporter,  
    256258                const ObjectContainer &objects,  
    257                 AxisAlignedBox3 *box) const; 
     259                const AxisAlignedBox3 *box) const; 
    258260 
    259261        void PrepareBvHierarchy( 
  • GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.cpp

    r1415 r1416  
    800800         
    801801        if (!loadKdTree) 
    802         { 
    803                 ///////////////// 
     802        {       ////// 
    804803                //-- build new kd tree from scene geometry 
    805  
    806804                BuildKdTree(); 
    807805                KdTreeStatistics(cout); 
     
    817815                        return false; 
    818816                } 
     817 
    819818                cout << "finished in " << TimeDiff(startTime, GetTime()) * 1e-3 << " secs" << endl; 
    820819 
  • GTP/trunk/Lib/Vis/Preprocessing/src/ViewCell.cpp

    r1311 r1416  
    974974 
    975975                        exporter->SetForcedMaterial(m); 
    976                         mViewCellsManager->ExportViewCellGeometry(exporter, *it); 
    977                 } 
     976                        mViewCellsManager->ExportViewCellGeometry(exporter, *it, NULL, NULL); 
     977                } 
     978 
    978979                delete exporter; 
    979980                cout << "finished" << endl; 
  • GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp

    r1415 r1416  
    356356         
    357357        ResetViewCells(); 
    358         if (0) Debug << "\nView cells after initial sampling:\n" << mCurrentViewCellsStats << endl; 
    359  
    360         //-- optionally export initial view cell partition 
    361         if (0)  
    362         { 
     358                 
     359        if (0) //-- optionally export initial view cell partition 
     360        { 
     361        Debug << "\nView cells after initial sampling:\n" << mCurrentViewCellsStats << endl; 
     362 
    363363                const string filename("viewcells.wrl"); 
    364364                Exporter *exporter = Exporter::GetExporter(filename.c_str()); 
     
    374374 
    375375                        exporter->SetWireframe(); 
    376                         ExportViewCellsForViz(exporter); 
     376                        ExportViewCellsForViz(exporter, NULL, GetClipPlane()); 
    377377 
    378378                        delete exporter; 
     
    429429         
    430430#if 0 
    431         //////////////////////////////////////////////// 
    432         //-- get stats after the additional sampling step 
     431        /////////////// 
     432        //-- Get stats after the additional sampling step 
    433433        //-- and before the bottom-up merge step 
    434434 
     
    445445 
    446446 
    447         /////////////////////////////////////////////// 
     447        //////////////////// 
    448448        // 
    449449        //-- post processing of the initial construction 
     
    476476 
    477477         
    478         ////////////////////////////////////////////////////////////// 
     478        //////////////// 
    479479        //-- Evaluation of the resulting view cell partition.  
    480480        //-- We cast a number of new samples and measure the render cost 
     
    486486 
    487487         
    488         /////////////////////////////////// 
     488        ///////////////// 
    489489        //-- Finally, we do some visualization 
    490490 
     
    508508 
    509509        return numSamples; 
     510} 
     511 
     512 
     513AxisAlignedPlane * ViewCellsManager::GetClipPlane() 
     514{ 
     515        return mUseClipPlaneForViz ? &mClipPlaneForViz : NULL; 
    510516} 
    511517 
     
    16921698 
    16931699        Environment::GetSingleton()->GetFloatValue("ViewCells.Visualization.clipPlanePos", pos); 
    1694  
    1695         Vector3 point = mViewSpaceBox.Min() +  mViewSpaceBox.Size() * pos; 
    1696  
    1697         if (mUseClipPlaneForViz) 
    1698         Environment::GetSingleton()->GetIntValue("ViewCells.Visualization.clipPlaneAxis", axis); 
    1699  
    1700         mClipPlane = AxisAlignedPlane(axis, point[axis]); 
     1700        Vector3 absPos = mViewSpaceBox.Min() +  mViewSpaceBox.Size() * pos; 
     1701         
     1702        Environment::GetSingleton()->GetIntValue("ViewCells.Visualization.clipPlaneAxis", axis); 
     1703 
     1704        mClipPlaneForViz = AxisAlignedPlane(axis, absPos[axis]); 
    17011705} 
    17021706 
     
    19461950} 
    19471951 
    1948 // matt: todo 
    1949 void ViewCellsManager::ExportViewCellsForViz(Exporter *exporter) const 
     1952 
     1953void ViewCellsManager::ExportViewCellsForViz(Exporter *exporter, 
     1954                                                                                         const AxisAlignedBox3 *sceneBox, 
     1955                                                                                         const AxisAlignedPlane *clipPlane 
     1956                                                                                         ) const 
    19501957{ 
    19511958        ViewCellContainer::const_iterator it, it_end = mViewCells.end(); 
     
    19561963                { 
    19571964                        ExportColor(exporter, *it);      
    1958  
    1959                         ExportViewCellGeometry(exporter, *it,  
    1960                                 mUseClipPlaneForViz ? &mClipPlane : NULL); 
     1965                        ExportViewCellGeometry(exporter, *it, sceneBox, clipPlane); 
    19611966                } 
    19621967        } 
     
    26702675        const int savedColorCode = mColorCode; 
    26712676         
    2672         //BspLeaf::NewMail(); 
    26732677        if (1) // export merged view cells 
    26742678        { 
    2675                 mColorCode = 0; 
    2676                  
     2679                mColorCode = 0; // hack color code 
    26772680                Exporter *exporter = Exporter::GetExporter("merged_view_cells.wrl"); 
    26782681                 
     
    26832686                { 
    26842687                        if (mExportGeometry) 
     2688                        { 
    26852689                                exporter->ExportGeometry(objects); 
    2686  
    2687                         //exporter->SetWireframe(); 
     2690                        } 
     2691 
    26882692                        exporter->SetFilled(); 
    2689                         ExportViewCellsForViz(exporter); 
    2690  
     2693                        ExportViewCellsForViz(exporter, NULL, GetClipPlane()); 
    26912694 
    26922695                        delete exporter; 
     
    26952698        } 
    26962699 
    2697         if (1) // export merged view cells using pvs color coding 
    2698         { 
     2700        if (1)  
     2701        { 
     2702                // export merged view cells using pvs color coding 
    26992703                mColorCode = 1; 
    27002704 
    27012705                Exporter *exporter = Exporter::GetExporter("merged_view_cells_pvs.wrl"); 
    2702          
    27032706                cout << "exporting view cells after merge (pvs size) ... ";      
    27042707 
    27052708                if (exporter) 
    27062709                { 
    2707                         //exporter->SetWireframe(); 
    2708                         //exporter->SetForcedMaterial(RandomMaterial()); 
    2709  
    27102710                        if (mExportGeometry) 
     2711                        { 
    27112712                                exporter->ExportGeometry(objects); 
    2712  
    2713                         //exporter->SetWireframe(); 
     2713                        } 
     2714                         
    27142715                        exporter->SetFilled(); 
    2715                         ExportViewCellsForViz(exporter); 
     2716                        ExportViewCellsForViz(exporter, NULL, GetClipPlane()); 
    27162717 
    27172718                        delete exporter; 
     
    27692770                if (exporter) 
    27702771                { 
    2771                         //exporter->SetWireframe(); 
    2772                          
    27732772                        if (mExportGeometry) 
     2773                        { 
    27742774                                exporter->ExportGeometry(objects); 
    2775  
    2776                         //exporter->SetFilled(); 
    2777                         const bool b = mUseClipPlaneForViz; 
    2778                         mUseClipPlaneForViz = false; 
    2779  
    2780                         ExportViewCellsForViz(exporter); 
    2781                          
    2782                         mUseClipPlaneForViz = b; 
     2775                        } 
     2776 
     2777                        ExportViewCellsForViz(exporter, NULL, GetClipPlane()); 
    27832778                        delete exporter; 
    27842779                } 
     
    27882783        mColorCode = savedColorCode; 
    27892784 
     2785 
     2786        ////////////////// 
    27902787        //-- visualization of the BSP splits 
     2788 
    27912789        bool exportSplits = false; 
    27922790        Environment::GetSingleton()->GetBoolValue("BspTree.Visualization.exportSplits", exportSplits); 
     
    28902888                exporter->SetForcedMaterial(m); 
    28912889 
    2892                 ExportViewCellGeometry(exporter, vc); 
     2890                ExportViewCellGeometry(exporter, vc, NULL, NULL); 
    28932891                 
    28942892                // export rays piercing this view cell 
     
    29622960void BspViewCellsManager::ExportViewCellGeometry(Exporter *exporter, 
    29632961                                                                                                 ViewCell *vc, 
    2964                                                                                                  const AxisAlignedPlane *clipPlane) const 
     2962                                                                                                 const AxisAlignedBox3 *sceneBox, 
     2963                                                                                                 const AxisAlignedPlane *clipPlane 
     2964                                                                                                ) const 
    29652965{ 
    29662966        // export mesh if available 
     
    34373437void KdViewCellsManager::ExportViewCellGeometry(Exporter *exporter, 
    34383438                                                                                                ViewCell *vc, 
    3439                                                                                                 const AxisAlignedPlane *clipPlane) const 
     3439                                                                                                const AxisAlignedBox3 *sceneBox, 
     3440                                                                                                const AxisAlignedPlane *clipPlane 
     3441                                                                                                ) const 
    34403442{ 
    34413443        ViewCellContainer leaves; 
    3442  
    34433444        mViewCellsTree->CollectLeaves(vc, leaves); 
    34443445        ViewCellContainer::const_iterator it, it_end = leaves.end(); 
     
    34473448        { 
    34483449                KdViewCell *kdVc = dynamic_cast<KdViewCell *>(*it); 
    3449          
    34503450                exporter->ExportBox(mKdTree->GetBox(kdVc->mLeaf)); 
    34513451        } 
     
    37183718                                exporter->SetFilled(); 
    37193719 
    3720                         ExportViewCellsForViz(exporter); 
     3720                        ExportViewCellsForViz(exporter, NULL, GetClipPlane()); 
    37213721 
    37223722                        if (mExportGeometry) 
     
    37373737        if (1)  
    37383738        { 
    3739                 mColorCode = 1; // export merged view cells using pvs coding 
     3739                // use pvs size for color coding 
     3740                mColorCode = 1; 
    37403741                Exporter *exporter = Exporter::GetExporter("merged_view_cells_pvs.wrl"); 
    37413742 
     
    37443745                if (exporter) 
    37453746                { 
    3746                         if (0) 
    3747                                 exporter->SetWireframe(); 
    3748                         else 
    3749                                 exporter->SetFilled(); 
    3750  
    3751                         ExportViewCellsForViz(exporter); 
     3747                        exporter->SetFilled(); 
     3748 
     3749                        ExportViewCellsForViz(exporter, NULL, GetClipPlane()); 
    37523750 
    37533751                        if (mExportGeometry) 
     
    40334031        GetRaySets(sampleRays, mVisualizationSamples, visRays); 
    40344032 
    4035         //-- export final view cell partition 
    4036  
     4033         
    40374034        if (0)  
    40384035        {        
    4039                 // hack pvs 
    4040                 //const int savedColorCode = mColorCode; 
    4041                 //mColorCode = 1; 
    4042          
     4036                ////////////////// 
     4037                //-- export final view cell partition 
     4038 
    40434039                Exporter *exporter = Exporter::GetExporter("final_view_cells.wrl"); 
    40444040                 
     
    40744070                        } 
    40754071 
    4076                         //exporter->SetFilled(); 
    4077  
    4078                         // HACK: export without clip plane 
    4079                         const bool b = mUseClipPlaneForViz; 
    4080                         //mUseClipPlaneForViz = false; 
    4081  
    4082                         ExportViewCellsForViz(exporter); 
    4083                          
    4084                         mUseClipPlaneForViz = b; 
     4072                        ExportViewCellsForViz(exporter, NULL, GetClipPlane()); 
     4073 
    40854074                        delete exporter; 
    4086  
    40874075                        cout << "finished" << endl; 
    40884076                } 
    4089  
    4090                 //mColorCode = savedColorCode; 
    4091         } 
    4092  
     4077        } 
    40934078 
    40944079        if (0) 
     
    43164301                } 
    43174302                 
    4318  
     4303                //////////////// 
    43194304                //-- export view cell geometry 
     4305 
    43204306                exporter->SetWireframe(); 
    43214307 
     
    43244310                exporter->SetForcedMaterial(m); 
    43254311 
    4326                 ExportViewCellGeometry(exporter, vc); 
    4327          
     4312                ExportViewCellGeometry(exporter, vc, NULL, NULL); 
    43284313                exporter->SetFilled(); 
    43294314 
    4330  
    4331                 //-- export pvs 
    43324315                if (1) 
    43334316                { 
     4317                        //////// 
     4318                        //-- export pvs 
    43344319                        ObjectPvsMap::const_iterator oit, 
    43354320                                oit_end = pvs.mEntries.end(); 
     
    43964381 
    43974382                exporter->SetForcedMaterial(RgbColor(0,1,0)); 
    4398                 ExportViewCellGeometry(exporter, GetViewCell(viewPoint)); 
     4383                ExportViewCellGeometry(exporter, GetViewCell(viewPoint), NULL, NULL); 
    43994384 
    44004385                //exporter->ResetForcedMaterial(); 
    44014386                exporter->SetForcedMaterial(RgbColor(0,0,1)); 
    4402                 ExportViewCellGeometry(exporter, testPrVs.mViewCell); 
     4387                ExportViewCellGeometry(exporter, testPrVs.mViewCell, NULL, NULL); 
    44034388 
    44044389        exporter->SetForcedMaterial(RgbColor(1,0,0)); 
     
    44914476                m.mDiffuseColor.b = 1.0f; 
    44924477                //exporter->SetForcedMaterial(m); 
    4493                 //ExportViewCellGeometry(exporter, vc, mClipPlane); 
     4478                //ExportViewCellGeometry(exporter, vc, mClipPlaneForViz); 
    44944479 
    44954480                /*      // counting the pvss 
     
    45104495 
    45114496void VspBspViewCellsManager::ExportViewCellGeometry(Exporter *exporter, 
    4512                                                     ViewCell *vc, 
    4513                                                                                                         const AxisAlignedPlane *clipPlane) const 
     4497                                                                                                        ViewCell *vc, 
     4498                                                                                                        const AxisAlignedBox3 *sceneBox, 
     4499                                                                                                        const AxisAlignedPlane *clipPlane 
     4500                                                                                                        ) const 
    45144501{ 
    45154502        if (clipPlane) 
     
    50135000void VspOspViewCellsManager::ExportViewCellGeometry(Exporter *exporter, 
    50145001                                                                                                        ViewCell *vc, 
    5015                                                                                                         const AxisAlignedPlane *clipPlane) const 
     5002                                                                                                        const AxisAlignedBox3 *sceneBox, 
     5003                                                                                                        const AxisAlignedPlane *clipPlane 
     5004                                                                                                        ) const 
    50165005{ 
    50175006        ViewCellContainer leaves; 
     
    50215010 
    50225011        Plane3 plane; 
    5023          
     5012 
    50245013        if (clipPlane) 
    5025         { 
    50265014                plane = clipPlane->GetPlane(); 
    5027         } 
    5028  
    5029         AxisAlignedBox3 bbox = GetViewSpaceBox(); 
    5030         bbox.Scale(Vector3(0.5, 1, 0.5));                        
    50315015 
    50325016        for (it = leaves.begin(); it != it_end; ++ it) 
     
    50355019                VspLeaf *l = vspVc->mLeaf; 
    50365020 
    5037                 const AxisAlignedBox3 box = mHierarchyManager->GetVspTree()->GetBoundingBox(vspVc->mLeaf); 
     5021                const AxisAlignedBox3 box =  
     5022                        mHierarchyManager->GetVspTree()->GetBoundingBox(vspVc->mLeaf); 
    50385023                 
    5039                 if (!Overlap(box, bbox)) 
     5024                if (!Overlap(*sceneBox, box)) 
    50405025                        continue; 
    50415026 
     
    50495034                        { 
    50505035                                AxisAlignedBox3 fbox, bbox; 
    5051                                 box.Split(clipPlane->mAxis, clipPlane->mPosition, fbox, bbox); 
     5036                                bbox.Split(clipPlane->mAxis, clipPlane->mPosition, fbox, bbox); 
    50525037 
    50535038                                exporter->ExportBox(bbox); 
     
    50845069        if (1)  
    50855070        {        
    5086                 ///////////////////////////// 
     5071                //////////// 
    50875072                //-- export final view cells 
    50885073 
     
    50985083                        cout << "exporting final view cells (after initial construction + post process) ... "; 
    50995084 
     5085                        // matt: hack 
     5086                        AxisAlignedBox3 bbox = mHierarchyManager->GetViewSpaceBox(); 
     5087                        bbox.Scale(Vector3(0.5, 1, 0.5)); 
     5088 
    51005089                        if (mExportGeometry) 
    51015090                        { 
    5102                                 exporter->ExportGeometry(objects, true); 
     5091                                exporter->ExportGeometry(objects, true, &bbox); 
    51035092                        } 
    51045093 
     
    51095098                        } 
    51105099 
    5111                         // HACK: export without clip plane 
    5112                         const bool b = mUseClipPlaneForViz; 
    5113                         if (0) mUseClipPlaneForViz = false; 
    5114  
    5115                         ExportViewCellsForViz(exporter); 
    5116                          
    5117                         mUseClipPlaneForViz = b; 
     5100                        ExportViewCellsForViz(exporter, &bbox, GetClipPlane()); 
     5101                 
    51185102                        delete exporter; 
    5119  
    51205103                        cout << "finished in " << TimeDiff(starttime, GetTime()) * 1e-3f << " secs" << endl; 
    51215104                } 
     
    51325115                { 
    51335116                        const long starttime = GetTime(); 
     5117                         
     5118                        // matt: hack 
     5119                        AxisAlignedBox3 bbox = mHierarchyManager->GetObjectSpaceBox(); 
     5120                        bbox.Scale(Vector3(0.5, 1, 0.5)); 
    51345121 
    51355122                        cout << "exporting object space hierarchy ... "; 
    5136                         mHierarchyManager->ExportObjectSpaceHierarchy(exporter, objects); 
     5123                        mHierarchyManager->ExportObjectSpaceHierarchy(exporter, objects, &bbox); 
    51375124                 
    51385125                        delete exporter; 
     
    51875174                mViewCellsTree->GetPvs(vc, pvs); 
    51885175 
    5189                 //bspLeaves[j]->Mail(); 
    51905176                char s[64]; sprintf(s, "bsp-pvs%04d.wrl", i); 
    51915177                Exporter *exporter = Exporter::GetExporter(s); 
     
    52665252                exporter->SetWireframe(); 
    52675253 
    5268                 Material m;//= RandomMaterial(); 
     5254                Material m; 
    52695255                m.mDiffuseColor = RgbColor(0, 1, 0); 
    52705256                exporter->SetForcedMaterial(m); 
    52715257 
    5272                 ExportViewCellGeometry(exporter, vc); 
    5273          
     5258                ExportViewCellGeometry(exporter, vc, NULL, NULL); 
    52745259                exporter->SetFilled(); 
    52755260 
  • GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.h

    r1414 r1416  
    151151    */ 
    152152    virtual bool LoadViewCellsGeometry(const string filename); 
    153  
    154          
    155         /** Constructs view cell from base triangle. The ViewCell is extruded along the normal vector. 
     153         
     154        /** Constructs view cell from base triangle.  
     155                The view cell is extruded along the normal vector. 
    156156                @param the base triangle 
    157157                @param the height of the newly created view cell 
     
    347347        */ 
    348348        int GetMinPvsSize() const; 
    349  
    350349        /** Returns maximal ratio. i.e., currentPVs / maxPvs, 
    351350                where pvs is still considered valid. 
    352351        */ 
    353352        float GetMaxPvsRatio() const; 
    354  
    355353        /** Exports view cell geometry. 
    356354        */ 
    357         virtual void ExportViewCellGeometry(Exporter *exporter,  
    358                                                                                 ViewCell *vc, 
    359                                                                                 const AxisAlignedPlane *clipPlane = NULL) const = 0; 
     355        virtual void ExportViewCellGeometry( 
     356                Exporter *exporter, 
     357                ViewCell *vc, 
     358                const AxisAlignedBox3 *box, 
     359                const AxisAlignedPlane *clipPlane = NULL 
     360                ) const = 0; 
    360361 
    361362        /** Brings the view cells into their final state, computes meshes and volume. 
     
    483484        ////////////////////////////////////////////////////////////////// 
    484485 
     486 
    485487        /** Returns true if the view cell is equivalent to a  
    486488                node of the spatial hierarchy. This function can be used for merged 
     
    553555        void EvaluateViewCellsStats(); 
    554556 
     557 
     558        /////////////////////// 
    555559        //-- helper functions for view cell visualization 
    556560 
    557561        /** Exports the view cell partition. 
    558562        */ 
    559         void ExportViewCellsForViz(Exporter *exporter) const; 
     563        void ExportViewCellsForViz( 
     564                Exporter *exporter,  
     565                const AxisAlignedBox3 *box, 
     566                const AxisAlignedPlane *clipPlane = NULL) const; 
    560567 
    561568        /** Sets exporter color. 
    562569        */ 
    563570        virtual void ExportColor(Exporter *exporter, ViewCell *vc) const; 
     571        /** Creates meshes from the view cells. 
     572        */ 
     573        void CreateViewCellMeshes(); 
     574        /** Creates clip plane for visualization. 
     575        */ 
     576        void CreateClipPlane(); 
     577 
     578        AxisAlignedPlane *GetClipPlane(); 
     579        /////////////////////// 
    564580 
    565581        /** Returns volume of the view space. 
    566582        */ 
    567583        virtual float GetViewSpaceVolume(); 
    568          
    569         /** Creates meshes from the view cells. 
    570         */ 
    571         void CreateViewCellMeshes(); 
    572  
    573         /** Takes different measures to prepares the view cells after loading them from disc. 
     584        /** Prepares the view cells for sampling after loading them from disc. 
    574585        */ 
    575586        virtual void PrepareLoadedViewCells() {}; 
    576  
    577587        /** Constructs local view cell merge hierarchy. 
    578588        */ 
     
    586596                                                                           const ViewCellContainer &viewCells); 
    587597   
    588         /** Creates clip plane for visualization. 
    589         */ 
    590         void CreateClipPlane(); 
    591  
    592598        /** Updates pvs of all view cells for statistical evaluation after some more sampling 
    593599        */ 
     
    600606        /// if bounding boxes should be exported together with the view cells 
    601607        bool mExportBboxesForPvs; 
    602                  
    603         //Environment *environment; 
    604         AxisAlignedPlane mClipPlane; 
    605  
     608        /// the clip plane for visualization 
     609        AxisAlignedPlane mClipPlaneForViz; 
     610        /// if the visualization is using the clip plane 
    606611        bool mUseClipPlaneForViz; 
    607  
    608  
    609612        /// Renders the view cells. 
    610613        Renderer *mRenderer; 
    611  
    612614        /// Loaded view cells 
    613615        ViewCellContainer mViewCells; 
    614         /// the corresponding view cell tree holding the logical description of view cells 
     616        /// the view cell hierarchy (i.e., the logical description of view cells) 
    615617        ViewCellsTree *mViewCellsTree; 
    616618         
    617         /// if the values in the view cell leaves and the interiors are up to date 
    618         /// this is meant for lazy storing of the pvs, where only a scalar indicating 
    619         /// pvs size is stored in interiors and not the pvs itself. 
     619        /** if the values in the view cell leaves and the interiors are up to date 
     620                this is meant for lazy storing of the pvs, where only a scalar indicating 
     621                pvs size is stored in interiors and not the pvs itself. 
     622        */ 
    620623        bool mViewCellPvsIsUpdated; 
    621624 
    622         /// maximum number of samples taken for construction of the view cells 
     625        /// maximum number of samples for the view cell construction 
    623626        int mConstructionSamples; 
    624627        int mSamplesPerPass; 
     
    732735        void CreateMesh(ViewCell *vc); 
    733736 
    734         void ExportViewCellGeometry(Exporter *exporter,  
    735                                                                 ViewCell *vc,  
    736                                                                 const AxisAlignedPlane *clipPlane = NULL) const; 
     737        void ExportViewCellGeometry(Exporter *exporter, 
     738                                                                ViewCell *vc, 
     739                                                                const AxisAlignedBox3 *box, 
     740                                                                const AxisAlignedPlane *clipPlane = NULL 
     741                                                                ) const; 
    737742         
    738743        void CollectMergeCandidates(const VssRayContainer &rays,  
     
    741746        void Finalize(ViewCell *viewCell, const bool createMesh); 
    742747 
    743         bool ExportViewCells(const string filename, const bool exportPvs, const ObjectContainer &objects); 
     748        bool ExportViewCells(const string filename,  
     749                                                 const bool exportPvs,  
     750                                                 const ObjectContainer &objects); 
    744751 
    745752        /** Constructs merge hierarchy which corresponds to the spatial hierarchy. 
     
    805812        */ 
    806813        //  virtual void PrintStatistics(ostream &s) const; 
    807         ViewCell *GetViewCell(const Vector3 &point, const bool active = false) const { return NULL; } 
     814        ViewCell *GetViewCell(const Vector3 &point, const bool active = false) const  
     815        { return NULL; } 
    808816 
    809817        float GetProbability(ViewCell *viewCell); 
    810818         
    811  
    812819        void CreateMesh(ViewCell *vc); 
    813820 
    814         void ExportViewCellGeometry(Exporter *exporter,  
    815                                                                 ViewCell *vc, 
    816                                                                 const AxisAlignedPlane *clipPlane = NULL) const; 
     821        void ExportViewCellGeometry( 
     822                Exporter *exporter, 
     823                ViewCell *vc, 
     824                const AxisAlignedBox3 *box, 
     825                const AxisAlignedPlane *clipPlane = NULL 
     826                ) const; 
     827 
    817828 
    818829        void CollectMergeCandidates(const VssRayContainer &rays,  
     
    879890        void CreateMesh(ViewCell *vc); 
    880891 
    881         bool ExportViewCells(const string filename, const bool exportPvs, const ObjectContainer &objects); 
     892        bool ExportViewCells( 
     893                const string filename,  
     894                const bool exportPvs,  
     895                const ObjectContainer &objects); 
    882896 
    883897        int CastBeam(Beam &beam); 
    884  
    885         void ExportViewCellGeometry(Exporter *exporter,  
    886                                                                 ViewCell *vc, 
    887                                                                 const AxisAlignedPlane *clipPlane = NULL) const; 
    888  
    889         //float GetVolume(ViewCell *viewCell) const; 
     898         
     899        void ExportViewCellGeometry( 
     900                Exporter *exporter, 
     901                ViewCell *vc, 
     902                const AxisAlignedBox3 *box, 
     903                const AxisAlignedPlane *clipPlane = NULL 
     904                ) const; 
     905 
    890906 
    891907        void Finalize(ViewCell *viewCell, const bool createMesh); 
     
    920936        */ 
    921937        int GetMaxTreeDiff(ViewCell *vc) const; 
    922          
    923938 
    924939        /** Prepare view cells for use after loading them from disc. 
     
    10391054        virtual void EvalViewCellPartition(); 
    10401055#endif 
     1056 
    10411057        /** Exports view cell geometry. 
    10421058        */ 
    1043         void ExportViewCellGeometry(Exporter *exporter,  
     1059        void ExportViewCellGeometry( 
     1060                Exporter *exporter, 
    10441061                ViewCell *vc, 
    1045                 const AxisAlignedPlane *clipPlane = NULL) const; 
    1046  
    1047         int ComputeBoxIntersections(const AxisAlignedBox3 &box,  
     1062                const AxisAlignedBox3 *box, 
     1063                const AxisAlignedPlane *clipPlane = NULL 
     1064                ) const; 
     1065 
     1066        int ComputeBoxIntersections( 
     1067                const AxisAlignedBox3 &box,  
    10481068                ViewCellContainer &viewCells) const; 
    10491069         
    10501070        void CollectViewCells(); 
    1051  
    10521071 
    10531072        /** Prepare view cells for use after loading them from disc. 
     
    10671086 
    10681087        ///////////////////////////////////////// 
    1069  
    1070         /// the view space / object partition hierarchies 
    1071         //VspTree *mVspTree; 
    1072         //OspTree *mOspTree; 
    1073         //BvHierarchy *mBvHierarchy; 
    10741088 
    10751089        HierarchyManager *mHierarchyManager; 
Note: See TracChangeset for help on using the changeset viewer.