Changeset 373


Ignore:
Timestamp:
11/03/05 16:14:24 (19 years ago)
Author:
mattausch
Message:

added visualization of view cells versus leaves

Location:
trunk/VUT
Files:
2 added
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/VUT/GtpVisibility/scripts/GtpVisibility.vcproj

    r371 r373  
    103103                        UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"> 
    104104                        <File 
     105                                RelativePath="..\src\BatchedQueriesCullingManager.cpp"> 
     106                        </File> 
     107                        <File 
    105108                                RelativePath="..\src\CoherentHierarchicalCullingManager.cpp"> 
    106109                        </File> 
     
    137140                        Filter="h;hpp;hxx;hm;inl;inc;xsd" 
    138141                        UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"> 
     142                        <File 
     143                                RelativePath="..\include\BatchedQueriesCullingManager.h"> 
     144                        </File> 
    139145                        <File 
    140146                                RelativePath="..\include\CoherentHierarchicalCullingManager.h"> 
     
    183189                        </File> 
    184190                </Filter> 
     191                <File 
     192                        RelativePath=".\VTune\GtpVisibility.vpj"> 
     193                </File> 
    185194        </Files> 
    186195        <Globals> 
  • trunk/VUT/GtpVisibilityPreprocessor/scripts/Preprocessor.vcproj

    r370 r373  
    2020                                Name="VCCLCompilerTool" 
    2121                                Optimization="0" 
    22                                 AdditionalIncludeDirectories="..\include" 
     22                                AdditionalIncludeDirectories="..\support;..\support\devil\include;..\support\zlib\include;&quot;$(QTDIR)\include&quot;;&quot;$(QTDIR)\include\Qt&quot;;..\include" 
    2323                                PreprocessorDefinitions="WIN32;_DEBUG;_LIB" 
    2424                                MinimalRebuild="TRUE" 
  • trunk/VUT/GtpVisibilityPreprocessor/src/Exporter.h

    r362 r373  
    7878  ExportPolygons(const PolygonContainer &polys) = 0; 
    7979 
     80  virtual void 
     81  ExportBspViewCellPartition(const BspTree &tree) = 0; 
     82 
     83  virtual void  
     84  ExportBspLeaves(const BspTree &tree) = 0; 
     85 
    8086  void SetExportRayDensity(const bool d) { mExportRayDensity = d; } 
    8187   
  • trunk/VUT/GtpVisibilityPreprocessor/src/SamplingPreprocessor.cpp

    r372 r373  
    550550 
    551551                cout << "evaluating render time heuristics ... "; 
    552                 Real rt = EvaluateRenderHeuristics(); 
     552                Real rt = SimulateRendering(); 
    553553                cout << "finished" << endl; 
    554554 
     
    877877                                if (!objects[j]->Mailed()) 
    878878                                { 
    879                                         //if (j == 2198)m.mDiffuseColor = RgbColor(1, 0, 1); 
    880                                         //else m.mDiffuseColor = RgbColor(1, 1, 0); 
    881879                                        exporter->SetForcedMaterial(m); 
    882880                                        exporter->ExportIntersectable(objects[j]); 
     
    886884                DEL_PTR(exporter); 
    887885        } 
    888 } 
    889  
    890 Real SamplingPreprocessor::EvaluateRenderHeuristics() 
     886 
     887        if (1) // export view cells and leaves 
     888        { 
     889                Exporter *exporter = Exporter::GetExporter("viewCells.x3d"); 
     890                if (exporter) 
     891                { 
     892                        exporter->ExportBspViewCellPartition(*mBspTree); 
     893                        delete exporter; 
     894                } 
     895 
     896                exporter = Exporter::GetExporter("bspLeaves.x3d"); 
     897 
     898                if (exporter) 
     899                { 
     900                        exporter->ExportBspLeaves(*mBspTree); 
     901                        delete exporter; 
     902                } 
     903        } 
     904 
     905} 
     906 
     907 
     908 
     909Real SamplingPreprocessor::RenderPvs(ViewCell &viewCell,  
     910                                                                         const float objRenderTime) const 
     911{ 
     912        return viewCell.GetPvs().GetSize() * objRenderTime; 
     913} 
     914 
     915Real SamplingPreprocessor::SimulateRendering() 
    891916{ 
    892917        Real renderTime = 0; 
    893918 
    894         const float objRt = 1.0f; // render time for 1 object of PVS 
    895         const float vcOverhead = 1.0f; // const overhead for crossing a view cell border 
     919        // render time for 1 object of PVS 
     920        const float objRt = 1.0f;  
     921         // const overhead for crossing a view cell border 
     922        const float vcOverhead = 0.01f; 
    896923         
    897924        float totalArea = 0; 
     
    915942                        area += (*pit)->GetArea(); 
    916943                 
    917                 renderTime += area * (*it)->GetPvs().GetSize() * objRt; 
     944                renderTime += area * RenderPvs(*(*it), objRt); 
    918945                totalArea += area; 
    919946        } 
  • trunk/VUT/GtpVisibilityPreprocessor/src/SamplingPreprocessor.h

    r372 r373  
    1212class SamplingPreprocessor : public Preprocessor { 
    1313public: 
     14                 
     15  SamplingPreprocessor(); 
     16 
     17  ~SamplingPreprocessor(); 
     18 
     19  virtual bool ComputeVisibility(); 
     20 
     21protected: 
    1422        int mPass; 
    1523 
     
    2230  int mBspConstructionSamples; 
    2331  int mPostProcessSamples; 
    24          
    25   SamplingPreprocessor(); 
    2632 
    27   ~SamplingPreprocessor(); 
    28  
    29   virtual bool ComputeVisibility(); 
    3033 
    3134  void 
     
    9396        /** Post processes view cells (i.e., merges or subdivides view cells based 
    9497                on the PVS and the ray sets. 
     98                @param rays a set of rays which carries the visibility information  
     99                the merging / subdivision is based on. 
    95100                @returns number of merged view cells. 
    96101        */ 
     
    100105                quality of the view cell partition. 
    101106        */ 
    102         Real EvaluateRenderHeuristics(); 
     107        Real SimulateRendering(); 
     108        /** Simulates rendering of the pvs of one view cell, with given rendering time for an object. 
     109                @param viewCell the view cell holding the Pvs 
     110                @param objRenderTime estimated render time for one object of the Pvs 
     111        */ 
     112        Real RenderPvs(ViewCell &viewCell, const float objRenderTime) const; 
     113 
    103114}; 
    104115 
  • trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellBsp.cpp

    r372 r373  
    14861486} 
    14871487 
    1488 void BspTree::CollectLeaves(vector<BspLeaf *> &leaves) 
     1488void BspTree::CollectLeaves(vector<BspLeaf *> &leaves) const 
    14891489{ 
    14901490        stack<BspNode *> nodeStack; 
     
    14991499                if (node->IsLeaf())  
    15001500                { 
    1501                         BspLeaf *leaf = (BspLeaf *)node; 
    1502                          
     1501                        BspLeaf *leaf = (BspLeaf *)node;                 
    15031502                        leaves.push_back(leaf); 
    1504                 } else  
     1503                }  
     1504                else  
    15051505                { 
    15061506                        BspInterior *interior = dynamic_cast<BspInterior *>(node); 
  • trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellBsp.h

    r372 r373  
    341341        /** Returns list of BSP leaves. 
    342342        */ 
    343         void CollectLeaves(vector<BspLeaf *> &leaves); 
     343        void CollectLeaves(vector<BspLeaf *> &leaves) const; 
    344344 
    345345        /** Returns box which bounds the whole tree. 
  • trunk/VUT/GtpVisibilityPreprocessor/src/X3dExporter.cpp

    r372 r373  
    88#include "ViewCell.h" 
    99#include "Polygon3.h" 
    10 ViewCellContainer X3dExporter::foundViewCells; // TODO: delete later 
    1110 
    1211X3dExporter::X3dExporter(const string filename):Exporter(filename) 
     
    177176        for (it = viewCells.begin(); it != it_end; ++ it) 
    178177                ExportViewCell(*it); 
     178} 
     179 
     180void  
     181X3dExporter::ExportBspViewCellPartition(const BspTree &tree) 
     182{ 
     183        ViewCellContainer viewCells; 
     184        tree.CollectViewCells(viewCells); 
     185 
     186        ViewCellContainer::const_iterator it, it_end = viewCells.end(); 
     187 
     188        for (it = viewCells.begin(); it != it_end; ++ it) 
     189        { 
     190                if ((*it)->GetMesh()) 
     191                        ExportViewCell(*it); 
     192                else 
     193                { 
     194                        PolygonContainer cell; 
     195                        tree.ConstructGeometry(dynamic_cast<BspViewCell *>(*it), cell); 
     196                        ExportPolygons(cell); 
     197                } 
     198        } 
     199} 
     200 
     201void  
     202X3dExporter::ExportBspLeaves(const BspTree &tree) 
     203{ 
     204        vector<BspLeaf *> leaves; 
     205        tree.CollectLeaves(leaves); 
     206 
     207        vector<BspLeaf *>::const_iterator it, it_end = leaves.end(); 
     208 
     209        for (it = leaves.begin(); it != it_end; ++ it) 
     210        { 
     211                PolygonContainer cell; 
     212                tree.ConstructGeometry(*it, cell); 
     213                ExportPolygons(cell); 
     214        } 
    179215} 
    180216 
     
    477513                } 
    478514        } 
    479         else // export view cells 
    480         { 
    481                 while (!tStack.empty())  
    482                 { 
    483             BspNode *node = tStack.top(); 
    484      
    485                         tStack.pop(); 
    486          
    487                         if (node->IsLeaf())  
    488                         { 
    489                                 ViewCell *viewCell = dynamic_cast<BspLeaf *>(node)->GetViewCell(); 
    490                                 if (viewCell) 
    491                                         foundViewCells.push_back(viewCell); 
    492                         } 
    493                         else 
    494                         { 
    495                                 BspInterior *interior = dynamic_cast<BspInterior *>(node); 
    496        
    497                                 tStack.push(interior->GetFront()); 
    498                                 tStack.push(interior->GetBack()); 
    499                         } 
    500                 } 
    501  
    502                 Debug << "Number of view cells with dublicates: " << (int)foundViewCells.size() << endl; 
    503  
    504         //-- erase dublicates 
    505                 sort(foundViewCells.begin(), foundViewCells.end()); 
    506                 ViewCellContainer::iterator new_end = unique(foundViewCells.begin(), foundViewCells.end()); 
    507                 foundViewCells.erase(new_end, foundViewCells.end()); 
    508                 ExportViewCells(foundViewCells); 
    509  
    510                 Debug << "Number of view cells after erasing dublicates: " << (int)foundViewCells.size() << endl; 
    511         } 
     515        // export view cells 
     516        ExportBspViewCellPartition(tree);        
    512517 
    513518        return true; 
  • trunk/VUT/GtpVisibilityPreprocessor/src/X3dExporter.h

    r362 r373  
    8585                         const RgbColor &color = RgbColor(1,1,1)); 
    8686 
    87   static ViewCellContainer foundViewCells; // todo: remove this 
     87  virtual void 
     88  ExportBspViewCellPartition(const BspTree &tree); 
     89 
     90  virtual void  
     91  ExportBspLeaves(const BspTree &tree); 
     92 
    8893protected: 
    8994 
Note: See TracChangeset for help on using the changeset viewer.