Changeset 1845


Ignore:
Timestamp:
12/04/06 23:32:28 (17 years ago)
Author:
mattausch
Message:

improved object pvs

Location:
GTP/trunk/Lib/Vis/Preprocessing/src
Files:
8 edited

Legend:

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

    r1844 r1845  
    23542354 
    23552355 
    2356 void HierarchyManager::CompressObjectSpace() 
     2356int HierarchyManager::CompressObjectSpace() 
    23572357{ 
    23582358        //mBvHierarchy->Compress(); 
    2359         mVspTree->CompressObjects(); 
     2359        return mVspTree->CompressObjects(); 
     2360} 
     2361 
    23602362 
    23612363void HierarchyManager::CreateUniqueObjectIds() 
  • GTP/trunk/Lib/Vis/Preprocessing/src/HierarchyManager.h

    r1844 r1845  
    292292        void CollectObjects(const AxisAlignedBox3 &box, ObjectContainer &objects); 
    293293 
    294         void CompressObjectSpace(); 
     294        int CompressObjectSpace(); 
    295295        void CreateUniqueObjectIds(); 
    296296 
  • GTP/trunk/Lib/Vis/Preprocessing/src/Pvs.h

    r1844 r1845  
    889889                        Intersectable *obj = entry.mObject; 
    890890 
    891                         cout << (int)obj << " "; 
     891                        cout << obj << " "; 
    892892                } 
    893893                 
  • GTP/trunk/Lib/Vis/Preprocessing/src/TestPreprocessor.vcproj

    r1842 r1845  
    206206                                Name="VCLinkerTool" 
    207207                                AdditionalDependencies="xerces-c_2.lib glew32.lib zdll.lib zziplib.lib devil.lib glut32.lib OpenGL32.Lib glu32.lib Preprocessor.lib RTScene.lib RTWorld.lib QtCore4.lib qtmain.lib QtOpenGL4.lib Qt3Support4.lib QtTest4.lib QtGui4.lib QtGlRenderer.lib" 
    208                                 OutputFile="../bin/release/Preprocessor2.exe" 
     208                                OutputFile="../bin/release/Preprocessor.exe" 
    209209                                LinkIncremental="1" 
    210210                                AdditionalLibraryDirectories="..\src\GL;..\lib\release;..\..\Preprocessing\lib\release;..\..\..\..\..\..\NonGTP\Boost\lib;..\..\..\..\..\..\NonGTP\Xerces\xercesc\lib;..\..\..\..\..\..\NonGTP\Zlib\lib;..\..\..\..\..\..\NonGTP\Devil\lib;..\MultiLevelRayTracing\RTScene\Release;..\MultiLevelRayTracing\RTWorld\Release;&quot;$(QTDIR)\lib&quot;;.\QtGlRenderer\Release" 
  • GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp

    r1843 r1845  
    46054605        cout << ss << endl; 
    46064606         
    4607  
    46084607        if (0) CompressViewCells(); 
    46094608         
     
    61626161 
    61636162 
     6163void VspOspViewCellsManager::CompressViewCells() 
     6164{ 
     6165        ViewCellsManager::CompressViewCells(); 
     6166        return; 
     6167        //////////// 
     6168        //-- compression 
     6169 
     6170        if (ViewCellsTreeConstructed() && mCompressViewCells) 
     6171        { 
     6172                int pvsEntries = mViewCellsTree->CountStoredPvsEntries(mViewCellsTree->GetRoot()); 
     6173                 
     6174                cout << "compressing in the objects" << endl; 
     6175                cout << "number of entries before compress: " << pvsEntries << endl; 
     6176                Debug << "number of entries before compress: " << pvsEntries << endl; 
     6177 
     6178                pvsEntries = mHierarchyManager->CompressObjectSpace(); 
     6179                 
     6180                Debug << "number of entries after compress: " << pvsEntries << endl; 
     6181                cout << "number of entries after compress: " << pvsEntries << endl; 
     6182        } 
     6183} 
     6184 
     6185 
    61646186ViewCellsManager *VspOspViewCellsManager::LoadViewCells(const string &filename,  
    61656187                                                                                                                ObjectContainer *objects, 
  • GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.h

    r1843 r1845  
    467467                                                                  const ViewCellContainer &viewCells) const; 
    468468 
    469         void CompressViewCells(); 
     469        virtual void CompressViewCells(); 
     470 
    470471        ///////////////////////////// 
    471472        // static members 
     
    11631164        void CollectViewCells(); 
    11641165 
     1166        virtual void CompressViewCells(); 
     1167 
    11651168        /** Prepare view cells for use after loading them from disc. 
    11661169        */ 
     
    11831186        ///////////////////////////////////////// 
    11841187 
    1185     /** collect objects intersecting a given spatial box */ 
    1186   virtual void CollectObjects(const AxisAlignedBox3 &box, ObjectContainer &objects); 
     1188    /** collect objects intersecting a given spatial box  
     1189        */ 
     1190        virtual void CollectObjects(const AxisAlignedBox3 &box, ObjectContainer &objects); 
    11871191 
    11881192        HierarchyManager *mHierarchyManager; 
  • GTP/trunk/Lib/Vis/Preprocessing/src/VspTree.cpp

    r1844 r1845  
    33893389 
    33903390 
    3391 void VspTree::CompressObjects(VspLeaf *leaf) 
     3391int VspTree::CompressObjects(VspLeaf *leaf) 
    33923392{ 
    33933393        bool compressed = true; 
    33943394 
    3395         Intersectable::NewMail(2); 
    3396  
    33973395        while (compressed) 
    33983396        { 
     3397                BvhNode::NewMail(2); 
     3398 
    33993399                ObjectPvsIterator oit = leaf->GetViewCell()->GetPvs().GetIterator(); 
    34003400                vector<BvhNode *> parents; 
     
    34143414                                if (!parent->Mailed()) 
    34153415                                { 
     3416                                        if (parent->Mailed(1)) 
     3417                                                cout << "error!!" << endl; 
    34163418                                        parent->Mail(); 
    34173419                                } 
     
    34223424                                        parents.push_back(parent); 
    34233425                                        parent->Mail(1); 
     3426                 
    34243427                                        compressed = true; 
    34253428                                } 
     
    34393442 
    34403443                                // add only entries that cannot be exchaned with the parent 
    3441                                 if (parent->Mailed(1)) 
     3444                                if (!parent->Mailed(1)) 
    34423445                                { 
    34433446                                        newPvs.AddSampleDirty(obj, entry.mData.mSumPdf); 
     
    34483451                // add parents 
    34493452                vector<BvhNode *>::const_iterator bit, bit_end = parents.end(); 
     3453 
    34503454                for (bit = parents.begin(); bit != bit_end; ++ bit) 
    34513455                { 
     
    34533457                } 
    34543458 
     3459                //cout << "size " << newPvs.GetSize() << endl; 
    34553460                leaf->GetViewCell()->SetPvs(newPvs); 
    34563461        } 
    3457 } 
    3458  
    3459  
    3460 void VspTree::CompressObjects() 
     3462 
     3463        return leaf->GetViewCell()->GetPvs().GetSize(); 
     3464} 
     3465 
     3466 
     3467int VspTree::CompressObjects() 
    34613468{ 
    34623469        vector<VspLeaf *> leaves; 
    34633470        CollectLeaves(leaves); 
    34643471 
     3472        int numEntries = 0; 
     3473 
    34653474        vector<VspLeaf *>::const_iterator lit, lit_end = leaves.end(); 
    34663475 
    34673476        for (lit = leaves.begin(); lit != lit_end; ++ lit) 
    34683477        { 
    3469                 CompressObjects(*lit); 
    3470         } 
    3471 } 
    3472  
    3473 } 
     3478                numEntries += CompressObjects(*lit); 
     3479        } 
     3480 
     3481        return numEntries; 
     3482} 
     3483 
     3484} 
  • GTP/trunk/Lib/Vis/Preprocessing/src/VspTree.h

    r1844 r1845  
    10281028                                        AxisAlignedBox3 *forcedBoundingBox); 
    10291029 
    1030         void CompressObjects(); 
    1031  
    1032         void CompressObjects(VspLeaf *leaf); 
     1030        int CompressObjects(); 
     1031 
     1032        int CompressObjects(VspLeaf *leaf); 
    10331033 
    10341034protected: 
Note: See TracChangeset for help on using the changeset viewer.