Changeset 1262


Ignore:
Timestamp:
08/23/06 00:45:59 (18 years ago)
Author:
mattausch
Message:
 
Location:
GTP/trunk/Lib/Vis/Preprocessing/src
Files:
3 edited

Legend:

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

    r1259 r1262  
    723723 
    724724        //-- the view space bounding box 
    725         stream << "<ViewSpaceBox"  
    726                    << " min=\"" << mViewSpaceBox.Min().x << " " << mViewSpaceBox.Min().y << " " << mViewSpaceBox.Min().z << "\"" 
    727                    << " max=\"" << mViewSpaceBox.Max().x << " " << mViewSpaceBox.Max().y << " " << mViewSpaceBox.Max().z << "\" />" << endl; 
    728  
    729         if (exportPvs) { 
    730         //-- export bounding boxes 
    731         stream << "<BoundingBoxes>" << endl; 
    732  
    733         ObjectContainer::const_iterator oit, oit_end = objects.end(); 
    734  
    735         for (oit = objects.begin(); oit != oit_end; ++ oit) 
    736         { 
     725        //stream << "<ViewSpaceBox"  
     726        //         << " min=\"" << mViewSpaceBox.Min().x << " " << mViewSpaceBox.Min().y << " " << mViewSpaceBox.Min().z << "\"" 
     727        //         << " max=\"" << mViewSpaceBox.Max().x << " " << mViewSpaceBox.Max().y << " " << mViewSpaceBox.Max().z << "\" />" << endl; 
     728 
     729        if (exportPvs)  
     730        { 
     731                //-- export bounding boxes 
     732                stream << "<BoundingBoxes>" << endl; 
     733 
     734                ObjectContainer::const_iterator oit, oit_end = objects.end(); 
     735 
     736                for (oit = objects.begin(); oit != oit_end; ++ oit) 
     737                { 
    737738                        MeshInstance *mi = dynamic_cast<MeshInstance *>(*oit); 
    738739                        const AxisAlignedBox3 box = mi->GetBox(); 
     
    742743                                   << " min=\"" << box.Min().x << " " << box.Min().y << " " << box.Min().z << "\"" 
    743744                                   << " max=\"" << box.Max().x << " " << box.Max().y << " " << box.Max().z << "\" />" << endl; 
    744         } 
    745  
    746         stream << "</BoundingBoxes>" << endl; 
    747         } 
     745                } 
     746 
     747                stream << "</BoundingBoxes>" << endl; 
     748        } 
     749 
     750 
     751        // the type of hierarchy: this must be known before to build  
     752        // the view cells manager 
     753        stream << "<ViewSpaceHierarchyType name=\"vspBspTree\" />" << endl; 
    748754 
    749755        //-- export the view cells and the pvs 
    750         stream << "<HierarchyType name=\"vspBspTree\" />" << endl; 
    751756 
    752757        const int numViewCells = mCurrentViewCellsStats.viewCells; 
     
    759764 
    760765 
    761         //-- export the spatial hierarchy 
    762          
    763         // the type of the view cells hierarchy 
    764         stream << "<Hierarchy>" << endl; 
     766        //-- export the view space hierarchy 
     767         
     768        stream << "<ViewSpaceHierarchy type=\"bsp\"" 
     769                   << " min=\"" << mViewSpaceBox.Min().x << " " << mViewSpaceBox.Min().y << " " << mViewSpaceBox.Min().z << "\"" 
     770                   << " max=\"" << mViewSpaceBox.Max().x << " " << mViewSpaceBox.Max().y << " " << mViewSpaceBox.Max().z << "\" />" << endl; 
     771 
    765772        mVspBspTree->Export(stream); 
    766         stream << endl << "</Hierarchy>" << endl; 
     773        stream << endl << "</ViewSpaceHierarchy>" << endl; 
    767774 
    768775        stream << "</VisibilitySolution>" << endl; 
     
    50075014 
    50085015        //-- compression 
     5016 
    50095017        if (ViewCellsTreeConstructed() && mCompressViewCells) 
    50105018        { 
     
    54695477        //-- export view space bounding box 
    54705478         
    5471         stream << "<ViewSpaceBox"  
    5472                    << " min=\"" << mViewSpaceBox.Min().x << " " << mViewSpaceBox.Min().y << " " << mViewSpaceBox.Min().z << "\"" 
    5473                    << " max=\"" << mViewSpaceBox.Max().x << " " << mViewSpaceBox.Max().y << " " << mViewSpaceBox.Max().z << "\" />" << endl; 
     5479        //stream << "<ViewSpaceBox"  
     5480        //         << " min=\"" << mViewSpaceBox.Min().x << " " << mViewSpaceBox.Min().y << " " << mViewSpaceBox.Min().z << "\"" 
     5481        //         << " max=\"" << mViewSpaceBox.Max().x << " " << mViewSpaceBox.Max().y << " " << mViewSpaceBox.Max().z << "\" />" << endl; 
    54745482 
    54755483         
     
    54935501        stream << "</BoundingBoxes>" << endl; 
    54945502 
     5503        // the type of the view space hierarchy: 
     5504        // must be known beforehand because necessary for building view cels 
     5505        //stream << "<ViewSpaceHierarchyType name=\"vspTree\" />" << endl; 
     5506 
    54955507 
    54965508        //-- export the view cells and the pvs 
    54975509 
    5498         stream << "<Hierarchy name=\"vspTree\" />" << endl; 
    54995510        const int numViewCells = mCurrentViewCellsStats.viewCells; 
    55005511 
     
    55065517        //-- export the view space hierarchy 
    55075518         
    5508         // the type of the view space partition 
    5509         stream << "<ViewSpaceHierarchy>" << endl; 
     5519        stream << "<ViewSpaceHierarchy type=\"vsp\"" 
     5520                   << " min=\"" << mViewSpaceBox.Min().x << " " << mViewSpaceBox.Min().y << " " << mViewSpaceBox.Min().z << "\"" 
     5521                   << " max=\"" << mViewSpaceBox.Max().x << " " << mViewSpaceBox.Max().y << " " << mViewSpaceBox.Max().z << "\" />" << endl; 
     5522 
    55105523        mVspTree->Export(stream); 
    5511         stream << endl << "</ViewSpacePartitioin>" << endl; 
     5524        stream << endl << "</ViewSpaceHierarchy>" << endl; 
    55125525 
    55135526         
     
    55155528         
    55165529        // the type of the view cells hierarchy 
    5517         stream << "<ObjectSpaceHierarchy>" << endl; 
    5518         mOspTree->Export(stream); 
    5519         stream << endl << "</ObjectSpaceHierarchy>" << endl; 
    5520  
     5530        if (mHierarchyManager->GetObjectSpaceSubdivisonType() ==  
     5531                HierarchyManager::KD_BASED_OBJ_SUBDIV) 
     5532        { 
     5533                stream << "<ObjectSpaceHierarchy type=\"osp\">" << endl; 
     5534                mOspTree->Export(stream); 
     5535                stream << endl << "</ObjectSpaceHierarchy>" << endl; 
     5536        } 
     5537        else if (mHierarchyManager->GetObjectSpaceSubdivisonType() ==  
     5538                 HierarchyManager::BV_BASED_OBJ_SUBDIV) 
     5539        { 
     5540                stream << "<ObjectSpaceHierarchy type=\"bvh\">" << endl; 
     5541                mBvHierarchy->Export(stream); 
     5542                stream << endl << "</ObjectSpaceHierarchy>" << endl; 
     5543        } 
    55215544 
    55225545        stream << "</VisibilitySolution>" << endl; 
  • GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsParser.cpp

    r1233 r1262  
    108108void ViewCellsParseHandlers::endElement(const XMLCh* const name) 
    109109{ 
    110   StrX lname(name); 
    111   string element(lname.LocalForm()); 
    112  
    113   if (element == "ViewCells") 
    114           EndViewCells(); 
    115  
    116   if (element == "BoundingBoxes") 
    117           EndBoundingBoxes(); 
    118  
    119   // inside the view cell description 
    120   if (mCurrentTask == PARSE_VIEWCELLS) 
    121   { 
    122           if (element == "Interior") 
    123                   EndViewCellInterior(); 
    124   } 
    125   else 
    126   { 
    127           if (element == "Interior") 
    128                   EndBspInterior(); 
    129   } 
     110        StrX lname(name); 
     111        string element(lname.LocalForm()); 
     112 
     113        if (element == "ViewCells") 
     114                EndViewCells(); 
     115 
     116        if (element == "BoundingBoxes") 
     117                EndBoundingBoxes(); 
     118 
     119        // inside the view cell description 
     120        if (mCurrentTask == PARSE_VIEWCELLS) 
     121        { 
     122                if (element == "Interior") 
     123                        EndViewCellInterior(); 
     124        } 
     125        else 
     126        { 
     127                if (element == "Interior") 
     128                        EndBspInterior(); 
     129        } 
    130130} 
    131131 
     
    150150} 
    151151 
     152 
    152153void ViewCellsParseHandlers::EndViewCellInterior() 
    153154{ 
     
    204205                        const char *ptr = attrValue.LocalForm(); 
    205206                         
    206                         //-- the view cells manager is created here 
     207                        // the view cells manager is created here 
    207208                        CreateViewCellsManager(ptr); 
    208209                } 
     
    720721                mBspTree = new BspTree(); 
    721722                mBspTree->mBox = mViewSpaceBox; 
    722                 //mCurrentBspNode = mBspTree->GetRoot(); 
    723723 
    724724                mViewCellsManager = new BspViewCellsManager(mBspTree); 
     
    729729 
    730730                mVspBspTree = new VspBspTree(); 
    731                 //mCurrentBspNode = mVspBspTree->GetRoot(); 
    732731                mViewCellsManager = new VspBspViewCellsManager(mVspBspTree); 
    733732 
     
    746745                mVspTree->mBoundingBox = mViewSpaceBox; 
    747746        } 
    748  
    749747 
    750748        mViewCellsTree = mViewCellsManager->GetViewCellsTree(); 
  • GTP/trunk/Lib/Vis/Preprocessing/src/VspTree.cpp

    r1259 r1262  
    10811081        case HierarchyManager::BV_BASED_OBJ_SUBDIV: 
    10821082                { 
    1083                         BvhLeaf *leaf = mHierarchyManager->mBvHierarchy->GetLeaf(obj, NULL); 
     1083                        BvhLeaf *leaf = mHierarchyManager->mBvHierarchy->GetLeaf(obj); 
    10841084 
    10851085                        if (!leaf->Mailed()) 
     
    10881088                                leaf->mCounter = 1; 
    10891089 
    1090                                 ++ pvsSize; 
     1090                                pvsSize += (int)leaf->mObjects.size(); 
    10911091                        } 
    10921092                        else 
     
    12661266                        { 
    12671267                                leaf->Mail(); 
    1268                                 ++ pvs; 
     1268                                pvs += (int)leaf->mObjects.size(); 
    12691269                        } 
    12701270                        break; 
     
    13111311 
    13121312                        if (-- leaf->mCounter == 0) 
    1313                                 ++ pvs; 
     1313                                pvs += (int)leaf->mObjects.size(); 
    13141314                        break; 
    13151315                } 
Note: See TracChangeset for help on using the changeset viewer.