Ignore:
Timestamp:
05/08/06 18:57:11 (18 years ago)
Author:
mattausch
Message:

added bounding boxes to xml description

File:
1 edited

Legend:

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

    r904 r931  
    1515#include "VssPreprocessor.h" 
    1616#include "RssPreprocessor.h" 
     17#include "BoundingBoxConverter.h" 
     18 
    1719 
    1820namespace GtpVisibilityPreprocessor { 
     
    18581860 
    18591861 
    1860 bool ViewCellsManager::ExportViewCells(const string filename, const bool exportPvs) 
     1862bool ViewCellsManager::ExportViewCells(const string filename, const bool exportPvs, const ObjectContainer &objects) 
    18611863{ 
    18621864        return false; 
     
    19561958                                                                                 IndexedBoundingBoxContainer &boxes) const 
    19571959{ 
    1958         // HACK: needed only for lower_bound algorithm to find the  
    1959         // intersected objects 
    1960  
    19611960        Vector3 bmin, bmax; 
    19621961        int id; 
     
    20212020} 
    20222021 
     2022 
     2023float ViewCellsManager::GetFilterWidth()  
     2024{ 
     2025        return mFilterWidth; 
     2026} 
     2027 
     2028 
     2029float ViewCellsManager::GetAbsFilterWidth()  
     2030{ 
     2031        return Magnitude(mViewSpaceBox.Size()) * mFilterWidth; 
     2032} 
     2033 
     2034 
     2035bool ViewCellsManager::ExportBoundingBoxes(ofstream &xmlstream,  
     2036                                                                                   const ObjectContainer &objects) const 
     2037{ 
     2038        //-- export the view cells and the pvs 
     2039        xmlstream << "<BoundingBoxes>" << endl; 
     2040 
     2041        ObjectContainer::const_iterator oit, oit_end = objects.end(); 
     2042 
     2043        for (oit = objects.begin(); oit != oit_end; ++ oit) 
     2044        { 
     2045                        MeshInstance *mi = dynamic_cast<MeshInstance *>(*oit); 
     2046                        const AxisAlignedBox3 box = mi->GetBox(); 
     2047 
     2048                        //-- the bounding boxes 
     2049                        xmlstream << "<BoundingBox" << " id=\"" << mi->GetId() << "\"" 
     2050                                      << " min=\"" << box.Min().x << " " << box.Min().y << " " << box.Min().z << "\"" 
     2051                                          << " max=\"" << box.Max().x << " " << box.Max().y << " " << box.Max().z << "\" />" << endl; 
     2052        } 
     2053 
     2054        xmlstream << "</BoundingBoxes>" << endl; 
     2055 
     2056        return true; 
     2057} 
     2058 
     2059 
    20232060/**********************************************************************/ 
    2024 /*                   BspViewCellsManager implementation               */ 
     2061/*                 BspViewCellsManager implementation                 */ 
    20252062/**********************************************************************/ 
    20262063 
     
    22822319                char filename[100]; 
    22832320                environment->GetStringValue("ViewCells.filename", filename); 
    2284                 ExportViewCells(filename, mExportPvs); 
     2321                ExportViewCells(filename, mExportPvs, objects); 
    22852322        } 
    22862323         
    22872324        // export bounding boxes 
    2288         if (mExportBboxesForPvs) 
     2325        if (0 && mExportBboxesForPvs) 
    22892326        { 
    22902327                char filename[100]; 
     
    27292766 
    27302767 
    2731 bool BspViewCellsManager::ExportViewCells(const string filename, const bool exportPvs) 
     2768bool BspViewCellsManager::ExportViewCells(const string filename, const bool exportPvs, const ObjectContainer &objects) 
    27322769{ 
    27332770        cout << "exporting view cells to xml ... "; 
     
    39744011                char filename[100]; 
    39754012                environment->GetStringValue("ViewCells.filename", filename); 
    3976                 ExportViewCells(filename, mExportPvs); 
     4013                ExportViewCells(filename, mExportPvs, objects); 
    39774014        } 
    39784015 
     
    46874724 
    46884725ViewCellsManager *ViewCellsManager::LoadViewCells(const string filename,  
    4689                                                                                                   ObjectContainer *objects) 
     4726                                                                                                  ObjectContainer *objects, 
     4727                                                                                                  BoundingBoxConverter *bconverter) 
    46904728{ 
    46914729        ViewCellsParser parser; 
     
    46954733        Debug << "vc filename: " << filename << endl; 
    46964734 
    4697         if (parser.ParseFile(filename, &vm, objects)) 
     4735        //BoundingBoxConverter bconverter; 
     4736 
     4737        if (parser.ParseFile(filename, &vm, objects, bconverter)) 
    46984738        { 
    46994739                //vm->PrepareLoadedViewCells(); 
     
    47194759 
    47204760 
    4721  
    4722 bool VspBspViewCellsManager::ExportViewCells(const string filename, const bool exportPvs) 
     4761bool VspBspViewCellsManager::ExportViewCells(const string filename,  
     4762                                                                                         const bool exportPvs,  
     4763                                                                                         const ObjectContainer &objects) 
    47234764{ 
    47244765        cout << "exporting view cells to xml ... "; 
     
    47374778                   << " max=\"" << mViewSpaceBox.Max().x << " " << mViewSpaceBox.Max().y << " " << mViewSpaceBox.Max().z << "\" />" << endl; 
    47384779 
    4739  
     4780        ExportBoundingBoxes(stream, objects); 
    47404781 
    47414782        //-- the type of the view cells hierarchy 
     
    47504791 
    47514792 
    4752         //-- export the hierarchy 
     4793        //-- export the spatial hierarchy 
    47534794        stream << "<Hierarchy>" << endl; 
    47544795        mVspBspTree->Export(stream); 
Note: See TracChangeset for help on using the changeset viewer.