Changeset 1842


Ignore:
Timestamp:
12/03/06 20:55:53 (17 years ago)
Author:
mattausch
Message:

fixed compress

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

Legend:

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

    r1841 r1842  
    667667        { 
    668668                cout << "bvh local termination criteria met:" << endl; 
    669                 cout << "objects: " << tData.mNode->mObjects.size() << " " << mTermMinObjects << endl; 
     669                cout << "objects: " << (int)tData.mNode->mObjects.size() << " " << mTermMinObjects << endl; 
    670670        } 
    671671#endif 
  • GTP/trunk/Lib/Vis/Preprocessing/src/HierarchyManager.cpp

    r1830 r1842  
    17801780 
    17811781 
    1782 void HierarchyManager::ComputePvs(const ObjectPvs &pvs, float &rc, int &pvsEntries) 
     1782void HierarchyManager::ComputePvs(const ObjectPvs &pvs,  
     1783                                                                  float &rc,  
     1784                                                                  int &pvsEntries) 
    17831785{ 
    17841786        BvhNode::NewMail(); 
     
    17881790        while (pit.HasMoreEntries()) 
    17891791        { 
    1790                 ObjectPvsEntry entry = pit.Next(); 
    1791  
     1792                const ObjectPvsEntry &entry = pit.Next(); 
     1793 
     1794                if (entry.mObject->Type() != Intersectable::BVH_INTERSECTABLE) 
     1795                        cout << "error " << entry.mObject->Type() << endl; 
     1796 
     1797                BvhNode *intersect = dynamic_cast<BvhNode *>(entry.mObject); 
    17921798                BvhNode *activeNode; 
    1793                 BvhNode *intersect = dynamic_cast<BvhNode *>(entry.mObject); 
    17941799 
    17951800                // hack for choosing which node to account for 
    17961801                if (intersect->IsLeaf()) 
    17971802                { 
    1798                         activeNode = dynamic_cast<BvhLeaf *>(intersect)->GetActiveNode(); 
     1803                        activeNode =  
     1804                                dynamic_cast<BvhLeaf *>(intersect)->GetActiveNode(); 
    17991805                } 
    18001806                else 
  • GTP/trunk/Lib/Vis/Preprocessing/src/Plane3.h

    r1500 r1842  
    6969  friend SimpleRay GetPlaneIntersection(const Plane3 &plane1, const Plane3 &plane2); 
    7070 
    71   friend ostream &operator<<(ostream &s, const Plane3 p) { 
     71  friend ostream &operator<<(ostream &s, const Plane3 &p) { 
    7272    s<<p.mNormal<<" "<<p.mD; 
    7373    return s; 
  • GTP/trunk/Lib/Vis/Preprocessing/src/Pvs.h

    r1790 r1842  
    868868 
    869869 
     870//////////// 
     871//-- typedefs 
     872 
     873typedef PvsEntry<Intersectable *, PvsData> ObjectPvsEntry; 
     874typedef std::vector<ObjectPvsEntry> ObjectPvsEntries; 
     875typedef Pvs<ViewCell *, MailablePvsData> ViewCellPvs; 
     876typedef PvsIterator<Intersectable *, PvsData> ObjectPvsIterator; 
     877 
     878 
    870879class ObjectPvs: public Pvs<Intersectable *, PvsData> 
    871880{ 
     
    876885        */ 
    877886        float EvalPvsCost() const; 
     887 
     888        friend ostream &operator<<(ostream &s, const ObjectPvs &p)  
     889        { 
     890                ObjectPvsIterator pit = p.GetIterator(); 
     891 
     892                while (pit.HasMoreEntries()) 
     893                {                
     894                        const ObjectPvsEntry &entry = pit.Next(); 
     895                        Intersectable *obj = entry.mObject; 
     896 
     897                        cout << (int)obj << " "; 
     898                } 
     899                 
     900                return s; 
     901        } 
     902 
    878903}; 
    879904 
    880905 
    881 //////////// 
    882 //-- typedefs 
    883  
    884 typedef PvsEntry<Intersectable *, PvsData> ObjectPvsEntry; 
    885 typedef std::vector<ObjectPvsEntry> ObjectPvsEntries; 
    886 typedef Pvs<ViewCell *, MailablePvsData> ViewCellPvs; 
    887 typedef PvsIterator<Intersectable *, PvsData> ObjectPvsIterator; 
     906 
    888907} 
    889908 
  • GTP/trunk/Lib/Vis/Preprocessing/src/QtPreprocessorThread.h

    r1613 r1842  
    22#define __QT_PREPROCESSOR_THREAD_H 
    33 
    4  
     4#ifndef NO_QT 
    55#include <QThread> 
    66#include "PreprocessorThread.h" 
     
    2929 
    3030} 
    31  
    3231#endif 
     32#endif 
  • GTP/trunk/Lib/Vis/Preprocessing/src/TestPreprocessor.vcproj

    r1841 r1842  
    2121                                Optimization="0" 
    2222                                AdditionalIncludeDirectories="..\include;..\src;..\..\..\..\..\..\NonGTP\Devil\include;..\..\..\..\..\..\NonGTP\Zlib\include;..\..\..\..\..\..\NonGTP\Xerces;..\..\..\..\..\..\NonGTP\Boost" 
    23                                 PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE" 
     23                                PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;NO_QT" 
    2424                                MinimalRebuild="TRUE" 
    2525                                BasicRuntimeChecks="3" 
     
    3535                                Name="VCLinkerTool" 
    3636                                AdditionalDependencies="xerces-c_2D.lib zdll.lib zziplibd.lib devil.lib glut32.lib OpenGL32.Lib glu32.lib Preprocessor.lib glew32.lib" 
    37                                 OutputFile="$(OutDir)/Preprocessor.exe2" 
     37                                OutputFile="$(OutDir)/Preprocessor.exe" 
    3838                                LinkIncremental="2" 
    3939                                AdditionalLibraryDirectories="..\include;..\src\GL;&quot;..\lib\$(ConfigurationName)&quot;;..\..\..\..\..\..\NonGTP\Boost\lib;..\..\..\..\..\..\NonGTP\Xerces\xercesc\lib;..\..\..\..\..\..\NonGTP\Zlib\lib;..\..\..\..\..\..\NonGTP\Devil\lib" 
     
    7979                                OptimizeForWindowsApplication="TRUE" 
    8080                                AdditionalIncludeDirectories="..\include;..\..\..\..\..\..\NonGTP\Boost;..\..\..\..\..\..\NonGTP\Devil\include;..\..\..\..\..\..\NonGTP\Zlib\include;..\..\..\..\..\..\NonGTP\Xerces;..\..\MultiLevelRayTracing" 
    81                                 PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE" 
     81                                PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;NO_QT" 
    8282                                RuntimeLibrary="2" 
    8383                                RuntimeTypeInfo="TRUE" 
  • GTP/trunk/Lib/Vis/Preprocessing/src/ViewCell.cpp

    r1789 r1842  
    14881488                } 
    14891489 
     1490                /*cout << "***************\nbefore pulling up:\n"; 
     1491                for (it = interior->mChildren.begin(); it != it_end; ++ it) 
     1492                { 
     1493                        cout << "vc:\n" << (*it)->GetPvs() << endl; 
     1494                }*/ 
     1495 
    14901496                // compress root node 
    14911497                PullUpVisibility(interior); 
     1498 
     1499                /*cout << "after pulling up:\n"; 
     1500                cout << "interior:\n" << interior->GetPvs() << endl; 
     1501 
     1502                for (it = interior->mChildren.begin(); it != it_end; ++ it) 
     1503                { 
     1504                        cout << "vc:\n" << (*it)->GetPvs() << endl; 
     1505                }*/ 
    14921506        } 
    14931507} 
     
    16501664void ViewCellsTree::PullUpVisibility(ViewCellInterior *interior) 
    16511665{ 
    1652         Intersectable::NewMail((int)interior->mChildren.size()); 
     1666        const int mail = (int)interior->mChildren.size(); 
     1667        Intersectable::NewMail(mail); 
    16531668 
    16541669        ViewCellContainer::const_iterator cit, cit_end = interior->mChildren.end(); 
    16551670 
    1656         // mail all objects in the leaf sets 
     1671    // mail all objects in the leaf sets 
    16571672        // we are interested in the objects which are present in all leaves 
    16581673        // => count how often an object is part of a child set 
     
    16601675        { 
    16611676                ViewCell *vc = *cit; 
    1662  
    16631677                ObjectPvsIterator pit = vc->GetPvs().GetIterator(); 
    16641678 
    16651679                while (pit.HasMoreEntries()) 
    16661680                {                
    1667                         ObjectPvsEntry entry = pit.Next(); 
     1681                        const ObjectPvsEntry &entry = pit.Next(); 
    16681682                        Intersectable *obj = entry.mObject; 
    1669  
    1670                         if ((cit == interior->mChildren.begin()) && !obj->Mailed()) 
    1671                         { 
    1672                                 obj->Mail(); 
    1673                         } 
    1674  
    1675                         int incm = obj->IncMail(); 
    1676                 } 
    1677         } 
    1678  
    1679         interior->GetPvs().Clear(); 
     1683                        obj->Mail(); 
     1684                } 
     1685        } 
     1686 
     1687        for (cit = interior->mChildren.begin(); cit != cit_end; ++ cit) 
     1688        { 
     1689                ViewCell *vc = *cit; 
     1690 
     1691                ObjectPvsIterator pit = vc->GetPvs().GetIterator(); 
     1692 
     1693                while (pit.HasMoreEntries()) 
     1694                {                
     1695                        const ObjectPvsEntry &entry = pit.Next(); 
     1696                        Intersectable *obj = entry.mObject; 
     1697 
     1698                        obj->IncMail(); 
     1699                } 
     1700        } 
     1701 
     1702        // reset pvs 
     1703    interior->GetPvs().Clear(false); 
    16801704                 
    16811705        // only the objects which are present in all leaf pvs  
     
    16921716                        ObjectPvsEntry entry = pit.Next(); 
    16931717 
    1694                         if (entry.mObject->Mailed((int)interior->mChildren.size())) 
     1718                        if (entry.mObject->Mailed(mail)) 
    16951719                        {        
    16961720                                interior->GetPvs().AddSample(entry.mObject, entry.mData.mSumPdf); 
     
    16991723        } 
    17001724 
    1701         // delete all the objects from the leaf sets which were moved to parent pvs 
    1702         ObjectPvsIterator pit = interior->GetPvs().GetIterator(); 
    1703  
    1704         while (pit.HasMoreEntries()) 
    1705         {                
    1706                 ObjectPvsEntry entry = pit.Next(); 
    1707  
    1708                 for (cit = interior->mChildren.begin(); cit != cit_end; ++ cit) 
    1709                 { 
    1710                         if (!(*cit)->GetPvs().RemoveSample(entry.mObject, Limits::Infinity)) 
     1725        // delete entries which are pulled up 
     1726        // note: could be inefficent, rather gather unmailed pvs and reassign 
     1727        for (cit = interior->mChildren.begin(); cit != cit_end; ++ cit) 
     1728        { 
     1729                ViewCell *vc = *cit; 
     1730                ObjectPvsIterator pit = vc->GetPvs().GetIterator(); 
     1731 
     1732                ObjectPvs newPvs; 
     1733 
     1734                while (pit.HasMoreEntries()) 
     1735                {                
     1736                        const ObjectPvsEntry &entry = pit.Next(); 
     1737                        Intersectable *obj = entry.mObject; 
     1738 
     1739                        /*if (obj->Mailed(mail)) 
    17111740                        { 
    1712                                 Debug << "should not come here!" << endl; 
     1741                                vc->GetPvs().RemoveSample(entry.mObject, Limits::Infinity)) 
     1742                        }*/ 
     1743                        if (!obj->Mailed(mail)) 
     1744                        { 
     1745                                newPvs.AddSampleDirty(obj, entry.mData.mSumPdf); 
    17131746                        } 
    17141747                } 
     1748 
     1749                vc->SetPvs(newPvs); 
    17151750        } 
    17161751} 
     
    24652500 
    24662501 
     2502 
    24672503/**************************************************************************/ 
    24682504/*                     MergeCandidate implementation                      */ 
  • GTP/trunk/Lib/Vis/Preprocessing/src/ViewCell.h

    r1771 r1842  
    228228        */ 
    229229        bool AddPvsSample(Intersectable *sample, const float pdf, float &contribution); 
    230    
    231         /// Rays piercing this view cell. 
    232         //RayContainer mPiercingRays; 
    233230 
    234231        /** if this is a view cell correspending to a leaf in a hierarchy. 
     
    705702                                         const ViewCellsTreeStats &vcStats); 
    706703 
     704         
    707705 
    708706        ////////////////////////////////////// 
     
    721719        /// if merged view cells are refined. 
    722720        bool mRefineViewCells; 
    723         /// weights between variance and render cost increase (must be between zero and one) 
     721        /// weights between variance and render cost increase in the range [0 .. 1]. 
    724722        float mRenderCostWeight; 
    725723 
  • GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp

    r1841 r1842  
    3232 
    3333// $$JB HACK 
    34 #define USE_KD_PVS 1 
     34#define USE_KD_PVS 0 
    3535 
    3636#define KD_PVS_AREA (1e-5f) 
     
    45884588        { 
    45894589                int pvsEntries = mViewCellsTree->CountStoredPvsEntries(mViewCellsTree->GetRoot()); 
     4590                 
     4591                cout << "number of entries before compress: " << pvsEntries << endl; 
    45904592                Debug << "number of entries before compress: " << pvsEntries << endl; 
    45914593 
     
    45934595 
    45944596                pvsEntries = mViewCellsTree->CountStoredPvsEntries(mViewCellsTree->GetRoot()); 
     4597                 
    45954598                Debug << "number of entries after compress: " << pvsEntries << endl; 
     4599                cout << "number of entries after compress: " << pvsEntries << endl; 
    45964600        } 
    45974601 
     
    54325436        if (!ViewCellsConstructed()) 
    54335437        { 
    5434                 Debug << "postprocess error: no view cells constructed" << endl; 
     5438                Debug << "post process error: no view cells constructed" << endl; 
    54355439                return 0; 
    54365440        } 
     
    55025506        { 
    55035507                int pvsEntries = mViewCellsTree->CountStoredPvsEntries(mViewCellsTree->GetRoot()); 
     5508                 
     5509                cout << "number of entries before compress: " << pvsEntries << endl; 
    55045510                Debug << "number of entries before compress: " << pvsEntries << endl; 
    55055511 
     
    55075513 
    55085514                pvsEntries = mViewCellsTree->CountStoredPvsEntries(mViewCellsTree->GetRoot()); 
     5515                 
    55095516                Debug << "number of entries after compress: " << pvsEntries << endl; 
     5517                cout << "number of entries after compress: " << pvsEntries << endl; 
    55105518        } 
    55115519 
  • GTP/trunk/Lib/Vis/Preprocessing/src/main.cpp

    r1841 r1842  
    3737#include "GlRenderer.h" 
    3838 
    39 //#if USE_QT 
     39#ifndef NO_QT 
    4040#include "QtPreprocessorThread.h" 
    4141#include "QtGlRenderer.h" 
    4242#include "QtGlViewer.h" 
    43 //#endif 
     43#endif 
    4444 
    4545#define USE_EXE_PATH false 
Note: See TracChangeset for help on using the changeset viewer.