Ignore:
Timestamp:
06/21/06 18:26:17 (18 years ago)
Author:
mattausch
Message:

fixed vsp part of vsp osp tree

File:
1 edited

Legend:

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

    r1027 r1047  
    17471747        Environment::GetSingleton()->GetIntValue("ViewCells.Visualization.clipPlaneAxis", axis); 
    17481748 
    1749         Vector3 normal(0,0,0); 
    1750         normal[axis] = 1; 
    1751  
    1752         mClipPlane = Plane3(normal, point); 
     1749        mClipPlane = AxisAlignedPlane(axis, point[axis]); 
    17531750} 
    17541751 
     
    24282425} 
    24292426 
     2427 
     2428 
    24302429/**********************************************************************/ 
    24312430/*                 BspViewCellsManager implementation                 */ 
     
    29272926void BspViewCellsManager::ExportViewCellGeometry(Exporter *exporter, 
    29282927                                                                                                 ViewCell *vc, 
    2929                                                                                                  const Plane3 *clipPlane) const 
     2928                                                                                                 const AxisAlignedPlane *clipPlane) const 
    29302929{ 
    29312930        // export mesh if available 
     
    29382937        if (clipPlane) 
    29392938        { 
     2939                const Plane3 plane = clipPlane->GetPlane(); 
     2940 
    29402941                ViewCellContainer leaves; 
    29412942                mViewCellsTree->CollectLeaves(vc, leaves); 
     
    29532954 
    29542955                        const float eps = 0.00000001f; 
    2955                         const int cf = geom.Side(*clipPlane, eps); 
     2956                        const int cf = geom.Side(plane, eps); 
    29562957 
    29572958                        if (cf == -1) 
     
    29632964                                geom.SplitGeometry(front, 
    29642965                                                                   back, 
    2965                                                                    *clipPlane, 
     2966                                                                   plane, 
    29662967                                                                   mViewSpaceBox,  
    29672968                                                                   eps); 
     
    30673068 
    30683069 
    3069 bool BspViewCellsManager::ExportViewCells(const string filename, const bool exportPvs, const ObjectContainer &objects) 
     3070bool BspViewCellsManager::ExportViewCells(const string filename,  
     3071                                                                                  const bool exportPvs,  
     3072                                                                                  const ObjectContainer &objects) 
    30703073{ 
    30713074#if STILL_HAS_TODO 
     
    34723475void KdViewCellsManager::ExportViewCellGeometry(Exporter *exporter, 
    34733476                                                                                                ViewCell *vc, 
    3474                                                                                                 const Plane3 *clipPlane) const 
     3477                                                                                                const AxisAlignedPlane *clipPlane) const 
    34753478{ 
    34763479        ViewCellContainer leaves; 
     
    41544157        //-- export view cells 
    41554158        if (1)  
    4156         {       // hack pvs 
     4159        {        
     4160                // hack pvs 
    41574161                const int savedColorCode = mColorCode; 
    41584162                mColorCode = 1; 
     
    41784182 
    41794183                        // export rays 
    4180                         if (1 && mExportRays) 
     4184                        if (0 && mExportRays) 
    41814185                        { 
    41824186                                exporter->ExportRays(visRays, RgbColor(0, 1, 0)); 
     
    43594363                { 
    43604364                        // output rays stored with the view cells during subdivision 
    4361                         if (0) 
     4365                        if (1) 
    43624366                        { 
    43634367                                VssRayContainer vcRays; 
     
    43944398                                } 
    43954399 
     4400                                Debug << "here233 " << (int)vcRays.size() << endl; 
     4401 
    43964402                                //-- export rays piercing this view cell 
    43974403                                exporter->ExportRays(vcRays, RgbColor(1, 1, 1)); 
     
    43994405                 
    44004406                        // associate new rays with output view cell 
    4401                         if (1) 
     4407                        if (0) 
    44024408                        { 
    44034409                                VssRayContainer vcRays; 
     
    45804586void VspBspViewCellsManager::ExportViewCellGeometry(Exporter *exporter, 
    45814587                                                    ViewCell *vc, 
    4582                                                                                                         const Plane3 *clipPlane) const 
     4588                                                                                                        const AxisAlignedPlane *clipPlane) const 
    45834589{ 
    45844590        if (clipPlane) 
    45854591        { 
     4592                const Plane3 plane = clipPlane->GetPlane(); 
     4593 
    45864594                ViewCellContainer leaves; 
    45874595                mViewCellsTree->CollectLeaves(vc, leaves); 
     
    45994607 
    46004608                        const float eps = 0.00000001f; 
    4601                         const int cf = geom.Side(*clipPlane, eps); 
     4609                        const int cf = geom.Side(plane, eps); 
    46024610 
    46034611                        if (cf == -1) 
     
    46094617                                geom.SplitGeometry(front, 
    46104618                                                                   back, 
    4611                                                                    *clipPlane, 
     4619                                                                   plane, 
    46124620                                                                   mViewSpaceBox,  
    46134621                                                                   eps); 
     
    47804788 
    47814789/**************************************************************************/ 
    4782 /*                   VspBspViewCellsManager implementation                */ 
     4790/*                   VspOspViewCellsManager implementation                */ 
    47834791/**************************************************************************/ 
    47844792 
     
    51365144        { 
    51375145                viewPoint = mViewSpaceBox.GetRandomPoint(); 
     5146 
    51385147                if (mVspTree->ViewPointValid(viewPoint)) 
    51395148                { 
     
    51495158void VspOspViewCellsManager::ExportViewCellGeometry(Exporter *exporter, 
    51505159                                                                                                        ViewCell *vc, 
    5151                                                                                                         const Plane3 *clipPlane) const 
     5160                                                                                                        const AxisAlignedPlane *clipPlane) const 
    51525161{ 
    51535162        ViewCellContainer leaves; 
     
    51565165        ViewCellContainer::const_iterator it, it_end = leaves.end(); 
    51575166 
     5167        Plane3 plane; 
     5168         
     5169        if (clipPlane) 
     5170                plane = clipPlane->GetPlane(); 
     5171 
    51585172        for (it = leaves.begin(); it != it_end; ++ it) 
    51595173        { 
     
    51625176 
    51635177                const AxisAlignedBox3 box = mVspTree->GetBBox(vspVc->mLeaf); 
    5164  
    5165                 if (!clipPlane || !box.Side(*clipPlane)) 
     5178                 
     5179                if (clipPlane) 
     5180                { 
     5181                        if (box.Side(plane) == -1) 
     5182                                exporter->ExportBox(box); 
     5183                        else if (box.Side(plane) == 0) 
     5184                        { 
     5185                                AxisAlignedBox3 fbox, bbox; 
     5186 
     5187                                box.Split(clipPlane->mAxis, clipPlane->mPosition, fbox, bbox); 
     5188 
     5189                                exporter->ExportBox(bbox); 
     5190                        } 
     5191                } 
     5192                else 
     5193                { 
    51665194                        exporter->ExportBox(box); 
     5195                } 
    51675196        } 
    51685197} 
     
    51915220        //-- export view cells 
    51925221        if (1)  
    5193         {       // hack pvs 
     5222        {        
     5223                // hack pvs 
    51945224                const int savedColorCode = mColorCode; 
    5195                 mColorCode = 1; 
     5225                mColorCode = 0; 
    51965226         
    51975227                Exporter *exporter = Exporter::GetExporter("final_view_cells.wrl"); 
     
    52155245 
    52165246                        // export rays 
    5217                         if (1 && mExportRays) 
     5247                        if (0 && mExportRays) 
    52185248                        { 
    52195249                                exporter->ExportRays(visRays, RgbColor(0, 1, 0)); 
     
    52925322                { 
    52935323                        // output rays stored with the view cells during subdivision 
    5294                         if (0) 
     5324                        if (1) 
    52955325                        { 
    52965326                                VssRayContainer vcRays; 
     
    52985328 
    52995329                                raysOut = min((int)rays.size(), 100); 
     5330 
     5331                                Debug  << "here12 " << raysOut << endl; 
    53005332 
    53015333                                // collect intial view cells 
     
    53075339                                for (vit = leaves.begin(); vit != vit_end; ++ vit) 
    53085340                                { 
    5309                                         BspLeaf *vcLeaf = dynamic_cast<BspViewCell *>(*vit)->mLeaf; 
     5341                                        VspLeaf *vcLeaf = dynamic_cast<VspViewCell *>(*vit)->mLeaf; 
    53105342                                 
    53115343                                        VssRayContainer::const_iterator rit, rit_end = vcLeaf->mVssRays.end(); 
     
    53325364                 
    53335365                        // associate new rays with output view cell 
    5334                         if (1) 
     5366                        if (0) 
    53355367                        { 
    53365368                                VssRayContainer vcRays; 
Note: See TracChangeset for help on using the changeset viewer.