Changeset 1264 for GTP/trunk


Ignore:
Timestamp:
08/23/06 19:19:26 (18 years ago)
Author:
mattausch
Message:
 
Location:
GTP/trunk/Lib/Vis
Files:
24 edited

Legend:

Unmodified
Added
Removed
  • GTP/trunk/Lib/Vis/GtpVisibility.sln

    r1251 r1264  
    1010Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "IVReader", "OnlineCullingCHC\IVReader\src\IVReader.vcproj", "{7319E499-473D-4CE5-9983-725D6E68A55D}" 
    1111        ProjectSection(ProjectDependencies) = postProject 
     12                {80DECC17-BDDD-4412-8CF8-F7C1C17A7436} = {80DECC17-BDDD-4412-8CF8-F7C1C17A7436} 
    1213        EndProjectSection 
    1314EndProject 
    1415Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Plugin_VisibilitySceneManager", "OnlineCullingCHC\OGRE\src\Plugin_VisibilitySceneManager.vcproj", "{80DECC17-BDDD-4412-8CF8-F7C1C17A7436}" 
    1516        ProjectSection(ProjectDependencies) = postProject 
     17                {101A7691-74F3-48B4-96A3-CF35578F5900} = {101A7691-74F3-48B4-96A3-CF35578F5900} 
    1618                {EABCE292-D598-4600-A1C9-2591E7D62FDA} = {EABCE292-D598-4600-A1C9-2591E7D62FDA} 
    17                 {101A7691-74F3-48B4-96A3-CF35578F5900} = {101A7691-74F3-48B4-96A3-CF35578F5900} 
    1819        EndProjectSection 
    1920EndProject 
     
    3031        ProjectSection(ProjectDependencies) = postProject 
    3132                {80DECC17-BDDD-4412-8CF8-F7C1C17A7436} = {80DECC17-BDDD-4412-8CF8-F7C1C17A7436} 
    32                 {7319E499-473D-4CE5-9983-725D6E68A55D} = {7319E499-473D-4CE5-9983-725D6E68A55D} 
     33                {101A7691-74F3-48B4-96A3-CF35578F5900} = {101A7691-74F3-48B4-96A3-CF35578F5900} 
    3334        EndProjectSection 
    3435EndProject 
     
    3637        ProjectSection(ProjectDependencies) = postProject 
    3738                {80DECC17-BDDD-4412-8CF8-F7C1C17A7436} = {80DECC17-BDDD-4412-8CF8-F7C1C17A7436} 
    38                 {7319E499-473D-4CE5-9983-725D6E68A55D} = {7319E499-473D-4CE5-9983-725D6E68A55D} 
    3939        EndProjectSection 
    4040EndProject 
  • GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreKdTreeSceneManager.cpp

    r1258 r1264  
    685685                else //-- the hierarchical culling algorithm 
    686686                { 
    687                         // this is also called in TerrainSceneManager: really 
    688                         // necessary? 
     687                        // this is also called in TerrainSceneManager: really necessary? 
    689688                        //mDestRenderSystem -> setLightingEnabled(false); 
    690689 
     
    697696 
    698697                        //-- hierarchical culling 
     698 
    699699                        // the objects of different layers (e.g., background, scene,  
    700700                        // overlay) must be identified and rendered one after another 
     
    781781} 
    782782 
    783 //void KdTreeSceneManager::_renderNodes(const KdRenderableList& nodelist, Camera * cam,  
    784 //      bool onlyShadowCasters, int leavePassesInQueue) 
     783 
    785784void KdTreeSceneManager::_renderNode(KdTree::NodePtr node, Camera * cam,  
    786785                                                                         bool onlyShadowCasters, int leavePassesInQueue) 
  • GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreOcclusionCullingSceneManager.cpp

    r1251 r1264  
    4040mIsDepthPassPhase(false), 
    4141mUseItemBuffer(false), 
    42 //mUseItemBuffer(true), 
    4342mIsItemBufferPhase(false), 
    4443mCurrentEntityId(1), 
     
    4645mSkipTransparents(false), 
    4746mRenderTransparentsForItemBuffer(true), 
    48 //mExecuteVertexProgramForAllPasses(true), 
    4947mExecuteVertexProgramForAllPasses(false), 
    5048mIsHierarchicalCulling(false), 
     
    5654mDeleteQueueAfterRendering(true) 
    5755{ 
     56        Ogre::LogManager::getSingleton().logMessage("creating occlusion culling scene manager"); 
     57 
    5858        mHierarchyInterface = new OctreeHierarchyInterface(this, mDestRenderSystem); 
    5959         
     
    321321         
    322322         
    323         // -- delete lists stored for visualization 
     323        // lists only used for visualization 
    324324        mVisible.clear(); 
    325325        mBoxes.clear(); 
     
    331331        { 
    332332                OctreeSceneManager::_renderVisibleObjects(); 
    333  
    334333                return; 
    335334        } 
     
    457456                OGRE_DELETE(mRenderQueue); // HACK: should rather only be cleared ... 
    458457 
    459         if (0) WriteLog(); // write out stats 
     458        if (1) WriteLog(); // write out stats 
    460459} 
    461460 
  • GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreSceneContentGenerator.cpp

    r897 r1264  
    6565                createChildSceneNode(String(name) + "Node", position); 
    6666 
    67         //std::stringstream d; d << "new node: " << name << "Node"; 
    68         //Ogre::LogManager::getSingleton().logMessage(d.str()); 
    69  
    7067        //ent->setCastShadows(false); 
    7168        node->attachObject(ent); 
  • GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreVisibilitySceneManagerDll.cpp

    r1165 r1264  
    2424*/ 
    2525 
    26 //#include <OgreVisibilityTerrainSceneManager.h> 
    2726#include <OgreOcclusionCullingSceneManager.h> 
    2827#include <OgreKdTreeSceneManager.h> 
    29  
    30 //#include <OgreHeightmapTerrainPageSource.h> 
    3128#include <OgreRoot.h> 
    3229#include <OgreLogManager.h> 
     
    4037namespace Ogre { 
    4138 
    42 //VisibilityTerrainSceneManagerFactory *visibilityTerrainPlugin; 
     39 
    4340OcclusionCullingSceneManagerFactory *occlusionCullingPlugin; 
    4441KdTreeSceneManagerFactory *kdTreeFactory; 
     
    5249 
    5350        // Create new scene manager 
    54         //visibilityTerrainPlugin = new VisibilityTerrainSceneManagerFactory(visManager); 
    5551        occlusionCullingPlugin = new OcclusionCullingSceneManagerFactory(visManager); 
    5652        kdTreeFactory = new KdTreeSceneManagerFactory(visManager); 
     53 
    5754        // Construct listener manager singleton 
    5855        new TerrainPageSourceListenerManager(); 
    5956 
    6057        // Register 
    61         //Root::getSingleton().addSceneManagerFactory(visibilityTerrainPlugin); 
    6258        Root::getSingleton().addSceneManagerFactory(occlusionCullingPlugin); 
    6359        Root::getSingleton().addSceneManagerFactory(kdTreeFactory); 
     
    6662extern "C" void __declspec(dllexport) dllShutdownPlugin() 
    6763{ 
    68         //Root::getSingleton().removeSceneManagerFactory(visibilityTerrainPlugin); 
    6964        Root::getSingleton().removeSceneManagerFactory(occlusionCullingPlugin); 
    7065        Root::getSingleton().removeSceneManagerFactory(kdTreeFactory); 
     66 
    7167        // destroy listener manager 
    7268        delete TerrainPageSourceListenerManager::getSingletonPtr(); 
     
    7773        //delete heightmapTerrainPageSource; 
    7874        // BUG: crashes on delete!!!! FIX this  
    79  
    80         //delete visibilityTerrainPlugin; 
    8175        delete occlusionCullingPlugin; 
    8276        delete kdTreeFactory; 
  • GTP/trunk/Lib/Vis/OnlineCullingCHC/scripts/terrainCulling.cfg

    r1261 r1264  
     1###################################################################### 
     2 
     3# 
     4#  Settings for vienna scene 
     5# 
     6 
     7# 
     8# The scene geometry 
     9# 
     10 
     11 
    112#Scene=../../../../../resources/media/house_test1.iv 
    2 #Scene=../../../../../resources/media/city1500_flat_1.iv;../../../../../resources/media/roofs_1500.iv;../../../../../resources/media/CityRoads60.iv 
    3 Scene=terrain 
     13Scene=../../../../../resources/media/city1500_flat_1.iv;../../../../../resources/media/roofs_1500.iv;../../../../../resources/media/CityRoads60.iv 
     14#Scene=../../../../../resources/media/city1.iv;../../../../../resources/media/roofs_1500.iv;../../../../../resources/media/CityRoads60.iv 
    415 
    516# current view point 
    6 #ViewX=830 
    7 #ViewY=300 
    8 #ViewZ=-540 
     17ViewX=830 
     18ViewY=300 
     19ViewZ=-540 
    920 
    10 ViewX=707 
    11 ViewY=5000 
    12 ViewZ=528 
     21# 
     22# The visibility environment: load the view cells from there 
     23# 
    1324 
    14 #VisibilityEnvironment=D:/svn/gametools/GTP/trunk/Lib/Vis/Preprocessing/scripts/generate_viewcells.env 
     25VisibilityEnvironment=D:/svn/gametools/GTP/trunk/Lib/Vis/Preprocessing/scripts/generate_viewcells.env 
    1526#VisibilityEnvironment=../../../../../../../GTP/trunk/Lib/Vis/Preprocessing/scripts/generate_viewcells.env 
     27 
     28 
     29 
     30###################################################################### 
     31 
     32# 
     33#  Settings for terrain scene 
     34# 
     35 
     36#Scene=terrain 
     37 
     38# 
     39# current view point 
     40# 
     41 
     42#ViewX=707 
     43#ViewY=5000 
     44#ViewZ=528 
  • GTP/trunk/Lib/Vis/Preprocessing/src/GzBinFileInputStream.cpp

    r1001 r1264  
    8080{ 
    8181        // Try to open the file 
    82     //fSource = XMLPlatformUtils::openFile(fileName, manager); 
    83         // todo: delete xmlstring 
    8482        char *myFileName = XMLString::transcode(fileName); 
    85         //mStream.open(myFileName, ios::binary); 
     83        //fSource = XMLPlatformUtils::openFile(fileName, manager); 
     84 
    8685        mStream.open(myFileName); 
    8786 
     
    9594{ 
    9695    // Try to open the file 
    97         //mStream.open(fileName, ios::binary); 
    9896        mStream.open(fileName); 
    9997} 
     
    143141    //unsigned int result = XMLPlatformUtils::readFileBuffer(fSource, maxToRead, toFill, fMemoryManager); 
    144142        mStream.read((char *)toFill, maxToRead); 
    145          
     143        //cout << "\n\n tofill: " << toFill << endl << endl; 
     144 
    146145        unsigned int result = mStream.gcount(); 
    147146        mCurrentPos = mStream.tellg(); 
    148         //GtpVisibilityPreprocessor::Debug << "stream: " << maxToRead << " " << toFill << " " << result << endl; 
    149147 
    150148        return result; 
  • GTP/trunk/Lib/Vis/Preprocessing/src/GzBinFileInputStream.h

    r975 r1264  
    106106 
    107107        unsigned int mCurrentPos; 
     108 
    108109private : 
    109110    // ----------------------------------------------------------------------- 
     
    130131inline bool GzBinFileInputStream::getIsOpen() const 
    131132{ 
    132     return (fSource != 0); 
     133        return (mStream.is_open());//(fSource != 0); 
    133134} 
    134135 
  • GTP/trunk/Lib/Vis/Preprocessing/src/HierarchyManager.cpp

    r1259 r1264  
    270270        mOspTree->mOspStats.Stop(); 
    271271 
    272         float rc = mOspTree->EvalRenderCost(sampleRays); 
    273  
    274         Debug << "here47 My render cost evalulation: " << rc << endl; 
     272        ////////////////////////// 
     273        // matt: only for debugging purpose 
     274 
     275        const float rc = mOspTree->EvalRenderCost(sampleRays); 
     276 
     277        Debug << "My render cost evalulation: " << rc << endl; 
    275278 
    276279#if 0 
  • GTP/trunk/Lib/Vis/Preprocessing/src/OspTree.cpp

    r1259 r1264  
    10801080        float nPosition[3]; 
    10811081        float nCostRatio[3]; 
    1082         float nProbFront[3]; 
    1083         float nProbBack[3]; 
    10841082 
    10851083        // create bounding box of node geometry 
     
    25332531        ObjectContainer::const_iterator oit, oit_end = leaf->mObjects.end(); 
    25342532 
    2535         //Debug << "here53 " << touchedViewCells.size() << endl; 
    25362533        for (oit = leaf->mObjects.begin(); oit != oit_end; ++ oit) 
    25372534        { 
  • GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.cpp

    r1251 r1264  
    1616#include "OspTree.h" 
    1717#include "ObjParser.h" 
     18#include "BvHierarchy.h" 
     19 
    1820#ifdef GTP_INTERNAL 
    1921#include "ArchModeler2MLRT.hxx" 
     
    122124mBspTree(NULL), 
    123125mVspBspTree(NULL), 
     126mVspTree(NULL), 
     127mOspTree(NULL), 
     128mBvHierarchy(NULL), 
    124129mViewCellsManager(NULL), 
    125130mRenderSimulator(NULL), 
     
    394399        {        
    395400                Environment::GetSingleton()->GetStringValue("ViewCells.filename", buf); 
     401                cout << "loading view cells from " << buf << endl; 
    396402                mViewCellsManager = ViewCellsManager::LoadViewCells(buf, &mObjects, true); 
    397403        } 
     
    399405        { 
    400406                //-- parse type of view cell container 
     407 
    401408                Environment::GetSingleton()->GetStringValue("ViewCells.type", buf);              
    402409            mViewCellsManager = CreateViewCellsManager(buf); 
     
    437444ViewCellsManager *Preprocessor::CreateViewCellsManager(const char *name) 
    438445{ 
     446        ViewCellsTree *vcTree = new ViewCellsTree; 
     447 
    439448        if (strcmp(name, "kdTree") == 0) 
    440449        { 
    441                 mViewCellsManager = new KdViewCellsManager(mKdTree); 
     450                mViewCellsManager = new KdViewCellsManager(vcTree, mKdTree); 
    442451        } 
    443452        else if (strcmp(name, "bspTree") == 0) 
     
    446455 
    447456                mBspTree = new BspTree(); 
    448                 mViewCellsManager = new BspViewCellsManager(mBspTree); 
     457                mViewCellsManager = new BspViewCellsManager(vcTree, mBspTree); 
    449458        } 
    450459        else if (strcmp(name, "vspBspTree") == 0) 
     
    453462 
    454463                mVspBspTree = new VspBspTree(); 
    455                 mViewCellsManager = new VspBspViewCellsManager(mVspBspTree); 
     464                mViewCellsManager = new VspBspViewCellsManager(vcTree, mVspBspTree); 
    456465        } 
    457466        else if (strcmp(name, "vspOspTree") == 0) 
    458467        { 
    459468                mVspTree = new VspTree(); 
    460                 mOspTree = new OspTree(); 
     469                //mOspTree = new OspTree(); 
    461470                 
    462471                // HACK for testing if per kd evaluation works!! 
    463472                mOspTree = new OspTree(*mKdTree); 
    464473 
    465                 mViewCellsManager = new VspOspViewCellsManager(mVspTree, mOspTree); 
     474                mViewCellsManager = new VspOspViewCellsManager(vcTree, mVspTree, mOspTree); 
    466475        } 
    467476        else if (strcmp(name, "sceneDependent") == 0) 
     
    471480                //TODO 
    472481                mBspTree = new BspTree(); 
    473                 mViewCellsManager = new BspViewCellsManager(mBspTree); 
     482                mViewCellsManager = new BspViewCellsManager(vcTree, mBspTree); 
    474483        } 
    475484        else 
     
    479488        } 
    480489 
     490        //vcTree->SetViewCellsManager(mViewCellsManager); 
    481491        return mViewCellsManager; 
    482492} 
     
    841851        float pforg[3]; 
    842852        float pfdir[3]; 
    843         double pfnorm[3]; 
     853        //double pfnorm[3]; 
    844854 
    845855        pforg[0] = viewPoint[0]; pforg[1] = viewPoint[1]; pforg[2] = viewPoint[2]; 
  • GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.h

    r1251 r1264  
    2626class VspTree; 
    2727class OspTree; 
     28class BvHierarchy; 
    2829class Intersectable; 
    2930 
     
    182183  BspTree *mBspTree; 
    183184 
    184  
     185  BvHierarchy *mBvHierarchy; 
     186   
    185187  /// list of all loaded occluders 
    186188  ObjectContainer mOccluders; 
  • GTP/trunk/Lib/Vis/Preprocessing/src/QtGlRenderer/QtGlRenderer.vcproj

    r1252 r1264  
    2020                                Name="VCCLCompilerTool" 
    2121                                Optimization="0" 
    22                                 AdditionalIncludeDirectories="&quot;$(QTDIR)\include\QtCore&quot;;&quot;$(QTDIR)\include\QtGui&quot;;&quot;$(QTDIR)\include&quot;;&quot;$(QTDIR)\include\QtOpenGl&quot;;..\src;..\..\..\..\..\..\NonGTP\Zlib\include;&quot;$(CG_INC_PATH)&quot;" 
     22                                AdditionalIncludeDirectories="&quot;$(QTDIR)\include\QtCore&quot;;&quot;$(QTDIR)\include\QtGui&quot;;&quot;$(QTDIR)\include&quot;;&quot;$(QTDIR)\include\QtOpenGl&quot;;..\..\src;&quot;$(CG_INC_PATH)&quot;;..\..\..\..\..\..\..\NonGTP\Zlib\include" 
    2323                                PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;QTGLRENDERER_EXPORTS" 
    2424                                MinimalRebuild="TRUE" 
  • GTP/trunk/Lib/Vis/Preprocessing/src/SamplingStrategy.cpp

    r1201 r1264  
    5151        Vector3 origin, direction;  
    5252 
    53     const int i = (int)RandomValue(0, (int)mPreprocessor.mObjects.size() - 1); 
     53    const int i = (int)RandomValue(0, (Real)((int)mPreprocessor.mObjects.size() - 1)); 
    5454 
    5555        Intersectable *object = mPreprocessor.mObjects[i]; 
  • GTP/trunk/Lib/Vis/Preprocessing/src/TestPreprocessor.vcproj

    r1261 r1264  
    3636                                OutputFile="$(OutDir)/Preprocessor.exe" 
    3737                                LinkIncremental="2" 
    38                                 AdditionalLibraryDirectories="..\src\GL;..\lib\debug;..\..\..\..\..\..\NonGTP\Boost\lib;..\..\..\..\..\..\NonGTP\Xerces\xercesc\lib;..\..\..\..\..\..\NonGTP\Zlib\lib;..\..\..\..\..\..\NonGTP\Devil\lib" 
     38                                AdditionalLibraryDirectories="..\include;..\src\GL;&quot;..\lib\$(ConfigurationName)&quot;;..\..\..\..\..\..\NonGTP\Boost\lib;..\..\..\..\..\..\NonGTP\Xerces\xercesc\lib;..\..\..\..\..\..\NonGTP\Zlib\lib;..\..\..\..\..\..\NonGTP\Devil\lib" 
    3939                                GenerateDebugInformation="TRUE" 
    4040                                ProgramDatabaseFile="$(OutDir)/TestPreprocessor.pdb" 
  • GTP/trunk/Lib/Vis/Preprocessing/src/ViewCell.cpp

    r1233 r1264  
    361361#endif 
    362362{ 
     363        ReadEnvironment(); 
     364        MergeCandidate::sRenderCostWeight = mRenderCostWeight; 
     365} 
     366 
     367 
     368ViewCellsTree::ViewCellsTree(): 
     369mRoot(NULL), 
     370mUseAreaForPvs(false), 
     371mViewCellsManager(NULL), 
     372#if 0 
     373mViewCellsStorage(PVS_IN_INTERIORS) 
     374#else 
     375mViewCellsStorage(PVS_IN_LEAVES) 
     376#endif 
     377{ 
     378        ReadEnvironment(); 
     379        MergeCandidate::sRenderCostWeight = mRenderCostWeight; 
     380} 
     381 
     382 
     383void ViewCellsTree::ReadEnvironment() 
     384{ 
    363385        Environment::GetSingleton()->GetBoolValue("ViewCells.Visualization.exportMergedViewCells", mExportMergedViewCells); 
    364386        Environment::GetSingleton()->GetFloatValue("ViewCells.maxStaticMemory", mMaxMemory); 
     
    379401        Debug << "refining view cells: " << mRefineViewCells << endl; 
    380402        Debug << "=========== end view cell tree options ===============\n"; 
    381  
    382         MergeCandidate::sRenderCostWeight = mRenderCostWeight; 
    383403} 
    384404 
  • GTP/trunk/Lib/Vis/Preprocessing/src/ViewCell.h

    r1263 r1264  
    2323class ViewCellsManager; 
    2424class ViewCellLeaf; 
    25 //class Environment; 
     25 
    2626 
    2727 
     
    391391 
    392392public: 
     393        ViewCellsTree(); 
    393394        /** View cells tree constructor taking a view cell mnanager as parameter 
    394395        */ 
     
    511512        int CountKdPvs(const ViewCellLeaf *vc) const; 
    512513 
     514        void SetViewCellsManager(ViewCellsManager *vcm) 
     515        { 
     516                mViewCellsManager = vcm; 
     517        } 
     518 
    513519protected: 
    514520 
     521        void ReadEnvironment(); 
    515522 
    516523        ///////////////////////////////////////////////////////////////// 
  • GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp

    r1263 r1264  
    4545 
    4646 
    47 ViewCellsManager::ViewCellsManager(): 
     47ViewCellsManager::ViewCellsManager(ViewCellsTree *viewCellsTree): 
    4848mRenderer(NULL), 
    4949mInitialSamples(0), 
     
    5858mMaxPvsRatio(1.0), 
    5959mViewCellPvsIsUpdated(false), 
    60 mPreprocessor(NULL) 
     60mPreprocessor(NULL), 
     61mViewCellsTree(viewCellsTree) 
    6162{ 
    6263        mViewSpaceBox.Initialize(); 
    6364        ParseEnvironment(); 
    6465 
    65         mViewCellsTree = new ViewCellsTree(this); 
     66        mViewCellsTree->SetViewCellsManager(this); 
     67        //mViewCellsTree = new ViewCellsTree(this); 
    6668} 
    6769 
     
    226228{ 
    227229        // HACK: if view cells tree does not  
    228         // take care of view cells, we have to do it 
     230        // handle view cells, we have to do it here 
    229231        // question: rather create view cells resource manager? 
    230232        if (!ViewCellsTreeConstructed()) 
     
    232234                CLEAR_CONTAINER(mViewCells); 
    233235        } 
    234  
    235         DEL_PTR(mViewCellsTree); 
     236        //DEL_PTR(mViewCellsTree); 
    236237} 
    237238 
     
    412413        cout << "finished in " << TimeDiff(startTime, GetTime()) * 1e-3 << " secs" << endl; 
    413414 
    414          
     415 
    415416        // construct view cells 
    416417        ConstructSubdivision(preprocessor->mObjects, initialSamples); 
     
    526527        cout << "starting post processing and visualization" << endl; 
    527528 
    528  
    529529        // store view cells for postprocessing 
    530530        const bool storeViewCells = true; 
    531  
    532531 
    533532        if (SAMPLE_AFTER_SUBDIVISION) 
     
    713712 
    714713        cout << "exporting view cells to xml ... "; 
    715          
     714 
    716715        OUT_STREAM stream(filename.c_str()); 
    717716 
     
    722721        stream << "<VisibilitySolution>" << endl; 
    723722 
    724         //-- 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  
    729723        if (exportPvs)  
    730724        { 
    731725                //-- export bounding boxes 
     726 
    732727                stream << "<BoundingBoxes>" << endl; 
    733728 
     
    748743        } 
    749744 
    750  
    751         // the type of hierarchy: this must be known before to build the view cells manager 
    752         //stream << "<ViewSpaceHierarchyType name=\"vspBspTree\" />" << endl; 
    753  
     745         
    754746        //-- export the view cells and the pvs 
    755747 
     
    767759        stream << "<ViewSpaceHierarchy type=\"bsp\"" 
    768760                   << " min=\"" << mViewSpaceBox.Min().x << " " << mViewSpaceBox.Min().y << " " << mViewSpaceBox.Min().z << "\"" 
    769                    << " max=\"" << mViewSpaceBox.Max().x << " " << mViewSpaceBox.Max().y << " " << mViewSpaceBox.Max().z << "\" />" << endl; 
     761                   << " max=\"" << mViewSpaceBox.Max().x << " " << mViewSpaceBox.Max().y << " " << mViewSpaceBox.Max().z << "\">" << endl; 
    770762 
    771763        mVspBspTree->Export(stream); 
     
    773765 
    774766        stream << "</VisibilitySolution>" << endl; 
    775  
    776767 
    777768        stream.close(); 
     
    25482539 
    25492540 
    2550 BspViewCellsManager::BspViewCellsManager(BspTree *bspTree): 
    2551 ViewCellsManager(), mBspTree(bspTree) 
     2541BspViewCellsManager::BspViewCellsManager(ViewCellsTree *vcTree, BspTree *bspTree): 
     2542ViewCellsManager(vcTree), mBspTree(bspTree) 
    25522543{ 
    25532544        Environment::GetSingleton()->GetIntValue("BspTree.Construction.samples", mInitialSamples); 
     
    26912682 
    26922683        //-- merge view cells 
     2684 
    26932685        cout << "starting post processing using " << mPostProcessSamples << " samples ... "; 
    26942686        long startTime = GetTime(); 
     
    32763268 
    32773269 
    3278 KdViewCellsManager::KdViewCellsManager(KdTree *kdTree): 
    3279 ViewCellsManager(), mKdTree(kdTree), mKdPvsDepth(100) 
     3270KdViewCellsManager::KdViewCellsManager(ViewCellsTree *vcTree, KdTree *kdTree): 
     3271ViewCellsManager(vcTree), mKdTree(kdTree), mKdPvsDepth(100) 
    32803272{ 
    32813273} 
     
    35783570 
    35793571 
    3580 VspBspViewCellsManager::VspBspViewCellsManager(VspBspTree *vspBspTree): 
    3581 ViewCellsManager(), mVspBspTree(vspBspTree) 
     3572VspBspViewCellsManager::VspBspViewCellsManager(ViewCellsTree *vcTree, VspBspTree *vspBspTree): 
     3573ViewCellsManager(vcTree), mVspBspTree(vspBspTree) 
    35823574{ 
    35833575        Environment::GetSingleton()->GetIntValue("VspBspTree.Construction.samples", mInitialSamples); 
     
    36093601        } 
    36103602        else  
    3611         {       // we can use the view cells tree hierarchy to get the right set 
     3603        {        
     3604                // we can use the view cells tree hierarchy to get the right set 
    36123605                mViewCellsTree->CollectBestViewCellSet(mViewCells, mNumActiveViewCells); 
    36133606        } 
     
    48104803 
    48114804 
    4812 VspOspViewCellsManager::VspOspViewCellsManager(VspTree *vspTree, OspTree *ospTree): 
    4813 ViewCellsManager(), mVspTree(vspTree), mOspTree(ospTree) 
     4805VspOspViewCellsManager::VspOspViewCellsManager(ViewCellsTree *vcTree, VspTree *vspTree, OspTree *ospTree): 
     4806ViewCellsManager(vcTree), mVspTree(vspTree), mOspTree(ospTree) 
    48144807{ 
    48154808        mHierarchyManager = new HierarchyManager(*vspTree, *ospTree); 
     
    54745467        stream << "<VisibilitySolution>" << endl; 
    54755468 
    5476         //-- export view space bounding box 
    5477          
    5478         //stream << "<ViewSpaceBox"  
    5479         //         << " min=\"" << mViewSpaceBox.Min().x << " " << mViewSpaceBox.Min().y << " " << mViewSpaceBox.Min().z << "\"" 
    5480         //         << " max=\"" << mViewSpaceBox.Max().x << " " << mViewSpaceBox.Max().y << " " << mViewSpaceBox.Max().z << "\" />" << endl; 
    5481  
    5482          
     5469 
    54835470        //-- export bounding boxes 
    54845471 
     
    54995486 
    55005487        stream << "</BoundingBoxes>" << endl; 
    5501  
    5502         // the type of the view space hierarchy: 
    5503         // must be known beforehand because necessary for building view cels 
    5504         //stream << "<ViewSpaceHierarchyType name=\"vspTree\" />" << endl; 
    55055488 
    55065489 
  • GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.h

    r1259 r1264  
    3737class HierarchyManager; 
    3838class BvHierarchy; 
     39class ViewCellsTree; 
    3940 
    4041struct AxisAlignedPlane; 
     
    7980        /** Default constructor. 
    8081        */ 
    81         ViewCellsManager(); 
     82        ViewCellsManager(ViewCellsTree *viewCellsTree); 
    8283 
    8384        virtual ~ViewCellsManager(); 
     
    9091        /** Constructs view cell container with a given number of samples. 
    9192        */ 
    92         virtual int ConstructSubdivision(const ObjectContainer &objects,  
    93                                                   const VssRayContainer &rays) = 0; 
     93        virtual int ConstructSubdivision( 
     94                const ObjectContainer &objects,  
     95                const VssRayContainer &rays) = 0; 
    9496 
    9597        /** Computes sample contributions of the rays to the view cells PVS. 
     
    696698                used to construct the bsp tree. 
    697699        */ 
    698         BspViewCellsManager(BspTree *tree); 
     700        BspViewCellsManager(ViewCellsTree *viewCellsTree, BspTree *tree); 
    699701 
    700702        ~BspViewCellsManager(); 
     
    779781public: 
    780782 
    781         KdViewCellsManager(KdTree *tree); 
     783        KdViewCellsManager(ViewCellsTree *viewCellsTree, KdTree *tree); 
    782784 
    783785        int ConstructSubdivision(const ObjectContainer &objects,  
     
    844846public: 
    845847 
    846         VspBspViewCellsManager(VspBspTree *tree); 
     848        VspBspViewCellsManager(ViewCellsTree *viewCellsTree, VspBspTree *tree); 
    847849        ~VspBspViewCellsManager(); 
    848850 
     
    972974public: 
    973975 
    974         VspOspViewCellsManager(VspTree *tree, OspTree *ospTree); 
     976        VspOspViewCellsManager(ViewCellsTree *viewCellsTree, VspTree *tree, OspTree *ospTree); 
    975977        ~VspOspViewCellsManager(); 
    976978 
  • GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsParser.cpp

    r1263 r1264  
    111111        string element(lname.LocalForm()); 
    112112 
     113        if (element == "BoundingBoxes") 
     114                EndBoundingBoxes(); 
     115 
    113116        if (element == "ViewCells") 
    114117                EndViewCells(); 
    115118 
    116         if (element == "BoundingBoxes") 
    117                 EndBoundingBoxes(); 
    118  
    119119        // inside the view cell description 
    120120        if (mCurrentState == PARSE_VIEWCELLS) 
     
    128128                        EndBspInterior(); 
    129129        } 
     130 
     131        // finished, create view cells manager 
     132        if (element == "VisibilitySolution") 
     133                CreateViewCellsManager(); 
    130134} 
    131135 
     
    135139        // go one up in the tree 
    136140        if (mCurrentBspNode->GetParent()) 
    137         {       Debug << "]"; 
     141        {       cout << "]"; 
    138142                mCurrentBspNode = mCurrentBspNode->GetParent(); 
    139143        } 
     
    145149        // go one up in the tree 
    146150        if (mCurrentVspNode->GetParent()) 
    147         {       Debug << "]"; 
     151        {       cout << "]"; 
    148152                mCurrentVspNode = mCurrentVspNode->GetParent(); 
    149153        } 
     
    155159        // go one up in the tree 
    156160        if (mCurrentViewCell->GetParent()) 
    157         {       Debug << "]"; 
     161        {       cout << "]"; 
    158162                mCurrentViewCell = mCurrentViewCell->GetParent(); 
    159163        } 
     
    217221        if (element == "Interior")  
    218222        { 
    219                 Debug << "["; 
     223                cout << "["; 
    220224                StartBspInterior(attributes); 
    221225        } 
     
    223227        if (element == "Leaf")  
    224228        { 
    225                 Debug << "l"; 
     229                cout << "l"; 
    226230                StartBspLeaf(attributes); 
    227231        } 
     
    234238        if (element == "Interior")  
    235239        { 
    236                 Debug << "["; 
     240                cout << "["; 
    237241                StartVspInterior(attributes); 
    238242        } 
     
    240244        if (element == "Leaf")  
    241245        { 
    242                 Debug << "l"; 
     246                cout << "l"; 
    243247                StartVspLeaf(attributes); 
    244248        } 
     
    251255        if (element == "Interior")  
    252256        { 
    253                 Debug << "["; 
     257                cout << "["; 
    254258                StartOspInterior(attributes); 
    255259        } 
     
    257261        if (element == "Leaf")  
    258262        { 
    259                 Debug << "l"; 
     263                cout << "l"; 
    260264                StartOspLeaf(attributes); 
    261265        } 
    262266} 
     267 
     268 
     269void ViewCellsParseHandlers::StartBvhElement(string element, 
     270                                                                                         AttributeList& attributes) 
     271{ 
     272        if (element == "Interior")  
     273        { 
     274                cout << "["; 
     275                StartBvhInterior(attributes); 
     276        } 
     277 
     278        if (element == "Leaf")  
     279        { 
     280                cout << "l"; 
     281                StartBvhLeaf(attributes); 
     282        } 
     283} 
     284 
    263285 
    264286void ViewCellsParseHandlers::StartViewSpaceHierarchyElement(const std::string &element, 
    265287                                                                                                                        AttributeList& attributes) 
    266288{ 
    267         if (!mViewCellsManager) 
    268                 return; 
    269  
    270         //-- use cell type according to the chosen view cell manager 
    271         switch (mViewCellsManager->GetType()) 
    272         { 
    273                 case ViewCellsManager::BSP: 
    274                 case ViewCellsManager::VSP_BSP: 
     289        //if (!mViewCellsManager)return; 
     290 
     291        //-- use cell type according to the chosen method 
     292 
     293        switch (mViewSpaceHierarchyType) 
     294        { 
     295                case BSP: 
    275296                        StartBspElement(element, attributes); 
    276297                        break; 
    277                 case ViewCellsManager::VSP_OSP: 
     298                case VSP: 
    278299                        StartVspElement(element, attributes); 
    279300                        break; 
     
    288309                                                                                                                          AttributeList& attributes) 
    289310{ 
    290         if (!mViewCellsManager) 
    291                 return; 
    292  
    293         //-- use cell type according to the chosen view cell manager 
    294         switch (mViewCellsManager->GetType()) 
    295         { 
    296                 case ViewCellsManager::VSP_OSP: 
     311        //if (!mViewCellsManager)return; 
     312 
     313        //-- use cell type according to the chosen method 
     314 
     315        switch (mObjectSpaceHierarchyType) 
     316        { 
     317                case OSP: 
    297318                        StartOspElement(element, attributes); 
     319                        break; 
     320                case BVH: 
     321                        StartBvhElement(element, attributes); 
    298322                        break; 
    299323                default: 
     
    331355        { 
    332356                cout << "parsing view cells" << endl; 
     357                 
    333358                mCurrentState = PARSE_VIEWCELLS; 
     359 
     360                // create new view cells hierarchy 
     361                mViewCellsTree = new ViewCellsTree(); 
    334362        } 
    335363 
     
    343371        // decides about the view cell hierarchy 
    344372        if (element == "ViewSpaceHierarchy") 
    345         { 
    346                 //StartViewSpaceHierarchy(attributes); 
    347                 cout << "parsing view space partition" << endl; 
    348                 mCurrentState = PARSE_VSP; 
     373        {                
     374                cout << "parsing view space hierarchy" << endl; 
     375                mCurrentState = PARSE_VIEWSPACE_HIERARCHY; 
     376                StartViewSpaceHierarchy(attributes); 
    349377        } 
    350378 
     
    352380        if (element == "ObjectSpaceHierarchy") 
    353381        { 
    354                 //StartObjectSpaceHierarchy(attributes); 
    355                 cout << "parsing object space partition" << endl; 
    356                 mCurrentState = PARSE_OSP; 
    357         } 
    358          
    359         // decides the used view cell hierarchy 
    360         if (element == "ViewSpaceBox") 
    361         { 
    362                 Debug << "v"; 
    363                 StartViewSpaceBox(attributes); 
    364         } 
    365  
     382                cout << "parsing object space hierarchy" << endl; 
     383                mCurrentState = PARSE_OBJECTSPACE_HIERARCHY; 
     384                StartObjectSpaceHierarchy(attributes); 
     385        } 
     386         
    366387        // decides the used view cell hierarchy 
    367388        if (element == "BoundingBox") 
     
    371392        } 
    372393 
    373         // parse view space partition 
     394        // parse view space hierarchy 
    374395        switch (mCurrentState) 
    375396        { 
    376         case PARSE_VSP: 
     397        case PARSE_VIEWSPACE_HIERARCHY: 
    377398                StartViewSpaceHierarchyElement(element, attributes); 
    378399                break; 
    379         case PARSE_OSP: 
     400        case PARSE_OBJECTSPACE_HIERARCHY: 
    380401                StartObjectSpaceHierarchyElement(element, attributes); 
    381402                break; 
     
    484505 
    485506 
    486 void ViewCellsParseHandlers::StartViewSpaceBox(AttributeList& attributes) 
     507void ViewCellsParseHandlers::StartViewSpaceHierarchy(AttributeList& attributes) 
    487508{ 
    488509        int len = attributes.getLength(); 
     
    496517                const char *ptr = attrValue.LocalForm(); 
    497518 
    498                 if (attrName == "min")  
     519                // hierarchy type 
     520                if (attrName == "type") 
     521                { 
     522                        if (strcmp(ptr, "bsp") == 0) 
     523                        { 
     524                                cout << "view space hierarchy: Bsp" << endl; 
     525                                mViewSpaceHierarchyType = BSP; 
     526                        } 
     527                        else if (strcmp(ptr, "vsp") == 0) 
     528                        { 
     529                                Debug << "view space hierarchy: Vsp" << endl; 
     530                                mViewSpaceHierarchyType = VSP; 
     531                        } 
     532                } 
     533                else if (attrName == "min") // the view space extent 
    499534                { 
    500535                        sscanf(ptr, "%f %f %f", 
     
    510545        mViewSpaceBox = AxisAlignedBox3(bmin, bmax); 
    511546 
    512         Debug << "\nview space box: " << mViewSpaceBox << endl; 
    513 } 
    514  
    515  
    516 void ViewCellsParseHandlers::StartBoundingBox(AttributeList& attributes) 
     547        // create the hierarchy based on this information 
     548        CreateViewSpaceHierarchy(); 
     549} 
     550 
     551 
     552void ViewCellsParseHandlers::StartObjectSpaceHierarchy(AttributeList& attributes) 
    517553{ 
    518554        int len = attributes.getLength(); 
    519555 
    520556        Vector3 bmin, bmax; 
    521         int id; 
    522557 
    523558        for (int i = 0; i < len; ++ i)  
     
    527562                const char *ptr = attrValue.LocalForm(); 
    528563 
     564                // hierarchy type 
     565                if (attrName == "type") 
     566                { 
     567                        if (strcmp(ptr, "bsp") == 0) 
     568                        { 
     569                                Debug << "view space hierarchy: Bsp" << endl; 
     570                                mViewSpaceHierarchyType = BSP; 
     571                        } 
     572                        else if (strcmp(ptr, "vsp") == 0) 
     573                        { 
     574                                Debug << "view space hierarchy: Vsp" << endl; 
     575                                mViewSpaceHierarchyType = VSP; 
     576                        } 
     577                } 
     578        } 
     579} 
     580 
     581 
     582 
     583void ViewCellsParseHandlers::StartBoundingBox(AttributeList& attributes) 
     584{ 
     585        int len = attributes.getLength(); 
     586 
     587        Vector3 bmin, bmax; 
     588        int id; 
     589 
     590        for (int i = 0; i < len; ++ i)  
     591        { 
     592                string attrName(StrX(attributes.getName(i)).LocalForm()); 
     593                StrX attrValue(attributes.getValue(i)); 
     594                const char *ptr = attrValue.LocalForm(); 
     595 
    529596 
    530597                if (attrName == "id") 
     
    532599                        sscanf(ptr, "%d", &id); 
    533600                } 
    534  
    535601                if (attrName == "min")  
    536602                { 
    537                         sscanf(ptr, "%f %f %f", 
    538                                    &bmin.x, &bmin.y, &bmin.z); 
     603                        sscanf(ptr, "%f %f %f", &bmin.x, &bmin.y, &bmin.z); 
    539604                } 
    540605                else if (attrName == "max")  
    541606                { 
    542                         sscanf(ptr, "%f %f %f", 
    543                                    &bmax.x, &bmax.y, &bmax.z); 
     607                        sscanf(ptr, "%f %f %f", &bmax.x, &bmax.y, &bmax.z); 
    544608                } 
    545609        } 
     
    547611        AxisAlignedBox3 box(bmin, bmax); 
    548612        mIBoundingBoxes.push_back(IndexedBoundingBox(id, box)); 
    549  
    550         //Debug << "bbox: " << box << endl; 
     613        //cout << "bbox: " << box << endl; 
    551614} 
    552615 
     
    563626        else 
    564627        { 
    565                 if (mViewCellsManager->GetType() == ViewCellsManager::BSP) 
    566                 { 
    567                         mBspTree->mRoot = leaf; 
    568                 } 
    569                 else if (mViewCellsManager->GetType() == ViewCellsManager::VSP_BSP) 
    570                 { 
    571                         mVspBspTree->mRoot = leaf; 
    572                 } 
     628                mVspBspTree->mRoot = leaf; 
    573629        } 
    574630 
    575631        //-- find associated view cell 
     632 
    576633        int viewCellId; 
    577634         
     
    593650 
    594651         
    595         if (viewCellId >= 0) // valid view cell 
     652        if (viewCellId >= 0) // valid view cell found 
    596653        { 
    597654                // TODO: get view cell with specified id 
     
    617674        { 
    618675                // add to invalid view space 
    619                 if (mViewCellsManager->GetType() == ViewCellsManager::VSP_BSP) 
     676                if (mViewSpaceHierarchyType== ViewCellsManager::VSP_BSP) 
    620677                { 
    621678                        leaf->SetViewCell(mVspBspTree->GetOrCreateOutOfBoundsCell()); 
     
    656713        else 
    657714        { 
    658                 if (mViewCellsManager->GetType() == ViewCellsManager::BSP) 
    659                 { 
    660                         mBspTree->mRoot = interior; 
    661                 } 
    662                 else 
    663                 { 
    664                         mVspBspTree->mRoot = interior; 
    665                 } 
     715                mVspBspTree->mRoot = interior; 
    666716        } 
    667717 
     
    712762 
    713763 
     764void ViewCellsParseHandlers::CreateViewSpaceHierarchy() 
     765{ 
     766        if (mViewSpaceHierarchyType == BSP) 
     767        { 
     768                cout << "hierarchy type: Bsp" << endl; 
     769 
     770                mVspBspTree = new VspBspTree(); 
     771 
     772                // set view space box 
     773                mVspBspTree->mBox = mViewSpaceBox; 
     774        } 
     775        else if (mViewSpaceHierarchyType == VSP)  
     776        { 
     777                cout << "hierarchy type: Vsp" << endl; 
     778 
     779                mVspTree = new VspTree(); 
     780                // set view space box 
     781                mVspTree->mBoundingBox = mViewSpaceBox; 
     782        } 
     783         
     784        cout << "\nview space box: " << mViewSpaceBox << endl; 
     785} 
     786 
     787 
     788void ViewCellsParseHandlers::CreateObjectSpaceHierarchy() 
     789{ 
     790        if (mViewSpaceHierarchyType == OSP) 
     791        { 
     792                Debug << "object hierarchy type: Osp" << endl; 
     793 
     794                mOspTree = new OspTree(); 
     795        } 
     796        else if (mViewSpaceHierarchyType == VSP)  
     797        { 
     798                Debug << "object hierarchy type: Vsp" << endl; 
     799 
     800                mVspTree = new VspTree(); 
     801        } 
     802} 
     803 
    714804 
    715805void ViewCellsParseHandlers::CreateViewCellsManager(/*const char *name*/) 
    716806{ 
    717         /*if (strcmp(name, "bsp") == 0) 
    718         { 
    719                 Debug << "view cell type: Bsp" << endl; 
    720  
    721                 mBspTree = new BspTree(); 
    722                 mBspTree->mBox = mViewSpaceBox; 
    723  
    724                 mViewCellsManager = new BspViewCellsManager(mBspTree); 
    725         }*/ 
    726807        if (mViewSpaceHierarchyType == BSP) //  
    727808        { 
    728                 Debug << "view cell type: VspBsp" << endl; 
    729  
    730                 mVspBspTree = new VspBspTree(); 
    731                 mViewCellsManager = new VspBspViewCellsManager(mVspBspTree); 
    732  
    733                 mVspBspTree->mBox = mViewSpaceBox; 
    734                 mVspBspTree->mRoot = mBspRoot; 
     809                Debug << "creating view cells manager: VspBsp" << endl; 
     810 
     811                //mVspBspTree = new VspBspTree(); 
     812                mViewCellsManager = new VspBspViewCellsManager(mViewCellsTree, mVspBspTree); 
    735813        } 
    736814        else if (mViewSpaceHierarchyType == VSP)  
    737815        { 
    738                 Debug << "view cell type: Vsp" << endl; 
    739  
    740                 mVspTree = new VspTree(); 
    741  
    742                 if (mObjectSpaceHierarchyType == OSP)  
    743                         mOspTree = new OspTree(); 
    744                 else 
    745                         mBvHierarchy = new BvHierarchy(); 
     816                Debug << "vcreating view cells manager: VsOspp" << endl; 
    746817 
    747818                // hack 
    748                 mViewCellsManager = new VspOspViewCellsManager(mVspTree, mOspTree); 
    749  
    750                 mVspTree->mBoundingBox = mViewSpaceBox; 
    751         } 
    752  
    753         mViewCellsTree = mViewCellsManager->GetViewCellsTree(); 
    754         mViewCellsTree->mRoot = mViewCellRoot; 
     819                mViewCellsManager = new VspOspViewCellsManager(mViewCellsTree, mVspTree, mOspTree); 
     820        } 
    755821 
    756822        mViewCellsManager->SetViewSpaceBox(mViewSpaceBox); 
     
    9341000} 
    9351001 
     1002 
     1003void ViewCellsParseHandlers::StartBvhLeaf(AttributeList& attributes) 
     1004{ 
     1005        KdLeaf * leaf =  
     1006                new KdLeaf(dynamic_cast<KdInterior *>(mCurrentKdNode), NULL); 
     1007 
     1008        if (mCurrentKdNode) // replace front or (if not NULL) back child 
     1009        { 
     1010                dynamic_cast<KdInterior *>(mCurrentKdNode)->ReplaceChildLink(NULL, leaf); 
     1011        } 
     1012        else 
     1013        { 
     1014                mOspTree->mRoot = leaf; 
     1015        } 
     1016} 
     1017 
     1018 
     1019void ViewCellsParseHandlers::StartBvhInterior(AttributeList& attributes) 
     1020{ 
     1021        AxisAlignedPlane plane; 
     1022        int len = attributes.getLength(); 
     1023 
     1024        for (int i = 0; i < len; ++ i)  
     1025        { 
     1026                string attrName(StrX(attributes.getName(i)).LocalForm()); 
     1027                StrX attrValue(attributes.getValue(i)); 
     1028                const char *ptr = attrValue.LocalForm(); 
     1029 
     1030                if (attrName == "plane")  
     1031                { 
     1032                        sscanf(ptr, "%d %f", 
     1033                                   &plane.mAxis, &plane.mPosition); 
     1034                } 
     1035        } 
     1036 
     1037        KdInterior* interior = new KdInterior(NULL); 
     1038         
     1039        interior->mAxis = plane.mAxis; 
     1040        interior->mPosition = plane.mPosition; 
     1041 
     1042        if (mCurrentKdNode) // replace NULL child of parent with current node 
     1043        { 
     1044                KdInterior *parent = dynamic_cast<KdInterior *>(mCurrentKdNode); 
     1045                parent->ReplaceChildLink(NULL, interior); 
     1046                interior->mParent = parent; 
     1047        } 
     1048        else 
     1049        { 
     1050                mOspTree->mRoot = interior; 
     1051        } 
     1052 
     1053        mCurrentKdNode = interior; 
     1054} 
    9361055 
    9371056 
     
    10191138    //    StdInInputSource src; 
    10201139    try 
    1021       { 
     1140        { 
    10221141        const unsigned long startMillis = XMLPlatformUtils::getCurrentMillis(); 
     1142 
    10231143#if USE_GZLIB 
    10241144        XMLCh *myFilePath = XMLString::transcode(filename.c_str()); 
     
    10261146        GzFileInputSource isource(myFilePath); 
    10271147        parser->parse(isource); 
    1028  
    10291148#else 
    10301149        parser->parse(filename.c_str()); 
  • GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsParserXerces.h

    r1263 r1264  
    9999  int mCurrentState; 
    100100   
    101   enum {PARSE_OPTIONS, PARSE_VIEWCELLS, PARSE_VSP, PARSE_OSP}; 
     101  enum {PARSE_OPTIONS, PARSE_VIEWCELLS, PARSE_VIEWSPACE_HIERARCHY, PARSE_OBJECTSPACE_HIERARCHY}; 
    102102 
    103103  /// view space / object space hierarchy types 
     
    125125  void StartVspElement(string element, AttributeList& attributes); 
    126126 
    127   void StartViewSpaceBox(AttributeList&  attributes); 
     127  void StartViewSpaceHierarchy(AttributeList& attributes); 
     128  void StartObjectSpaceHierarchy(AttributeList& attributes); 
    128129 
    129130  void StartBoundingBox(AttributeList& attributes); 
     
    140141  void StartOspLeaf(AttributeList& attributes); 
    141142  void StartOspInterior(AttributeList& attributes); 
     143 
     144  void CreateObjectSpaceHierarchy(); 
     145  void CreateViewSpaceHierarchy(); 
     146 
     147  void StartBvhLeaf(AttributeList& attributes); 
     148  void StartBvhInterior(AttributeList& attributes); 
     149  void StartBvhElement(string element, AttributeList& attributes); 
    142150 
    143151 
  • GTP/trunk/Lib/Vis/Preprocessing/src/VssPreprocessor.cpp

    r1251 r1264  
    488488 
    489489                          Vector3 size = mViewSpaceBox->Size(); 
    490                           tbox.SetMax(0, mViewSpaceBox->Max(0) + size[0] * 0.5); 
     490                          tbox.SetMax(0, mViewSpaceBox->Max(0) + size[0] * 0.5f); 
    491491                          tbox.SetMin(0, mViewSpaceBox->Min(0) + size[0]); 
    492492                          *mViewSpaceBox = tbox; 
     
    514514  mSceneGraph->CollectObjects(&mObjects); 
    515515 
    516   //-- load view cells from file if requested 
     516  //-- load view cells from file or reconstruct them 
    517517  if (!mLoadViewCells) 
    518518  { 
     
    525525          mViewCellsManager->PrintStatistics(Debug); 
    526526  } 
    527   else 
     527#if 1 // test successful view cells loading by exporting them again 
     528  else  
    528529  {       
    529530          VssRayContainer dummies; 
    530531          mViewCellsManager->Visualize(mObjects, dummies); 
    531           mViewCellsManager->ExportViewCells("test.xml", mViewCellsManager->GetExportPvs(), mObjects); 
    532   } 
    533  
     532          mViewCellsManager->ExportViewCells("test.xml.zip", mViewCellsManager->GetExportPvs(), mObjects); 
     533  } 
     534#endif 
    534535  VssTree *vssTree = NULL; 
    535536   
  • GTP/trunk/Lib/Vis/Preprocessing/src/gzstream.h

    r1201 r1264  
    7777        // ASSERT: both input & output capabilities will not be used together 
    7878    } 
    79     int is_open() { return opened; } 
     79    int is_open() const { return opened; } 
    8080    gzstreambuf* open( const char* name, int open_mode); 
    8181    gzstreambuf* close(); 
     
    9999  void close(); 
    100100  gzstreambuf* rdbuf() { return &buf; } 
    101   int is_open() { return buf.is_open(); } 
     101  int is_open() const { return buf.is_open(); } 
    102102}; 
    103103 
  • GTP/trunk/Lib/Vis/Preprocessing/src/main.cpp

    r1248 r1264  
    212212        } 
    213213 
    214  
    215214        // create a preprocessor thread (note: capsulates calls to boost fuctions!) 
     215        BoostPreprocessorThread pt(preprocessor); 
    216216 
    217217        //PreprocessorThread *pt = PreprocessorThreadFactory::Create(preprocessor); 
    218         BoostPreprocessorThread pt(preprocessor); 
    219218 
    220219        bool guiSupported = false; 
Note: See TracChangeset for help on using the changeset viewer.