Ignore:
Timestamp:
06/18/06 03:47:06 (18 years ago)
Author:
mattausch
Message:

worked on view-object space partition
fixed some loading bugs
fixeds some exporting bugs using line segments
enabling other methods for view space sampling in ViewCellsManager? OBJECT_DIRECTION_BASED_DISTRIBUTION)
added class interface for a sampling strategy

File:
1 edited

Legend:

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

    r1006 r1020  
    88#include "ViewCellBsp.h" 
    99#include "KdTree.h" 
    10 //#include "VspOspTree.h" 
     10#include "VspOspTree.h" 
    1111#include "Exporter.h" 
    1212#include "VspBspTree.h" 
     
    104104 
    105105         
     106        // sampling type for view cells construction samples 
    106107        if (strcmp(buf, "box") == 0) 
    107108        { 
     
    112113                mSamplingType = Preprocessor::DIRECTION_BASED_DISTRIBUTION; 
    113114        } 
    114         else  
     115        else if (strcmp(buf, "interior") == 0) 
     116        { 
     117                mSamplingType = Preprocessor::OBJECTS_INTERIOR_DISTRIBUTION; 
     118        } 
     119        else if (strcmp(buf, "object_directional") == 0) 
     120        { 
     121                mSamplingType = Preprocessor::OBJECT_DIRECTION_BASED_DISTRIBUTION; 
     122        } 
     123        else 
    115124        { 
    116125                Debug << "error! wrong sampling type" << endl; 
     
    118127        } 
    119128 
     129        // sampling type for evaluation samples 
    120130        Environment::GetSingleton()->GetStringValue("ViewCells.Evaluation.samplingType", buf); 
    121131         
     
    128138                mEvaluationSamplingType = Preprocessor::DIRECTION_BASED_DISTRIBUTION; 
    129139        } 
    130         else  
     140        else if (strcmp(buf, "object_directional") == 0) 
     141        { 
     142                mEvaluationSamplingType = Preprocessor::OBJECT_DIRECTION_BASED_DISTRIBUTION; 
     143        } 
     144        else if (strcmp(buf, "interior") == 0) 
     145        { 
     146                mEvaluationSamplingType = Preprocessor::OBJECTS_INTERIOR_DISTRIBUTION; 
     147        } 
     148        else 
    131149        { 
    132150                Debug << "error! wrong sampling type" << endl; 
     
    201219ViewCellsManager::~ViewCellsManager() 
    202220{ 
    203         //DEL_PTR(mRenderer); 
    204  
     221        // HACK: if view cells tree does not  
     222        // take care of view cells, we have to do it 
     223        // question: rather create view cells resource manager? 
    205224        if (!ViewCellsTreeConstructed()) 
    206225                CLEAR_CONTAINER(mViewCells); 
    207         //else 
     226         
    208227        DEL_PTR(mViewCellsTree); 
    209228} 
     
    855874        Debug << "view cell stats prefix: " << statsPrefix << endl; 
    856875 
    857          
    858876        // should directional sampling be used? 
    859877        bool dirSamples = (mEvaluationSamplingType == Preprocessor::DIRECTION_BASED_DISTRIBUTION); 
    860  
    861878 
    862879        cout << "reseting pvs ... "; 
     
    13661383        ViewCellContainer::const_iterator it, it_end = mViewCells.end(); 
    13671384 
    1368  
    13691385        //-- compute expected value 
    1370  
    13711386        totalRenderCost = 0; 
    13721387        totalPvs = 0; 
     
    24802495        if (1) // export final view cells 
    24812496        { 
    2482                 mColorCode = 1; 
    2483  
     2497                mColorCode = 1; // hack color code 
    24842498                Exporter *exporter = Exporter::GetExporter("final_view_cells.x3d"); 
    24852499         
     
    24942508 
    24952509                        //exporter->SetFilled(); 
    2496                         bool b = mUseClipPlaneForViz; 
     2510                        const bool b = mUseClipPlaneForViz; 
    24972511                        mUseClipPlaneForViz = false; 
     2512 
    24982513                        ExportViewCellsForViz(exporter); 
     2514                         
    24992515                        mUseClipPlaneForViz = b; 
    25002516                        delete exporter; 
     
    31013117} 
    31023118 
     3119 
    31033120int KdViewCellsManager::PostProcess(const ObjectContainer &objects, 
    31043121                                                                        const VssRayContainer &rays) 
     
    31063123        return 0; 
    31073124} 
     3125 
    31083126 
    31093127void KdViewCellsManager::Visualize(const ObjectContainer &objects, 
     
    39563974                mColorCode = 1; 
    39573975         
    3958                 Exporter *exporter = Exporter::GetExporter("final_view_cells.x3d"); 
     3976                Exporter *exporter = Exporter::GetExporter("final_view_cells.wrl"); 
    39593977                 
    39603978                if (exporter) 
     
    39763994 
    39773995                        // export rays 
    3978                         if (mExportRays) 
     3996                        if (1 && mExportRays) 
    39793997                        { 
    39803998                                exporter->ExportRays(visRays, RgbColor(0, 1, 0)); 
     
    39824000 
    39834001                        //exporter->SetFilled(); 
     4002 
    39844003                        // HACK: export without clip plane 
    39854004                        const bool b = mUseClipPlaneForViz; 
    39864005                        mUseClipPlaneForViz = false; 
     4006 
    39874007                        ExportViewCellsForViz(exporter); 
     4008                         
    39884009                        mUseClipPlaneForViz = b; 
    3989                  
    39904010                        delete exporter; 
     4011 
    39914012                        cout << "finished" << endl; 
    39924013                } 
     
    41074128                                                                                  const VssRayContainer &rays) 
    41084129{ 
    4109         const int leafOut = 20; 
     4130        int leafOut; 
     4131        Environment::GetSingleton()->GetIntValue("ViewCells.Visualization.maxOutput", leafOut); 
    41104132 
    41114133        ViewCell::NewMail(); 
     
    41164138 
    41174139        const bool sortViewCells = true; 
    4118          
    4119  
    41204140        // sort view cells to visualize the largest view cells 
    41214141        if (sortViewCells) 
     
    41454165 
    41464166                //bspLeaves[j]->Mail(); 
    4147                 char s[64]; sprintf(s, "bsp-pvs%04d.x3d", i); 
     4167                char s[64]; sprintf(s, "bsp-pvs%04d.wrl", i); 
    41484168                Exporter *exporter = Exporter::GetExporter(s); 
    41494169                 
     
    41514171 
    41524172                //-- export the sample rays 
    4153                 if (1 || mExportRays) 
     4173                if (mExportRays) 
    41544174                { 
    41554175                        // output rays stored with the view cells during subdivision 
     
    42194239                 
    42204240 
     4241                //-- export view cell geometry 
    42214242                exporter->SetWireframe(); 
    42224243 
     
    42284249         
    42294250                exporter->SetFilled(); 
     4251 
    42304252 
    42314253                //-- export pvs 
     
    43144336        case 1: // pvs 
    43154337                { 
    4316                         importance = (float)mViewCellsTree->GetPvsSize(vc) / (float)mCurrentViewCellsStats.maxPvs; 
     4338                        if (mCurrentViewCellsStats.maxPvs) 
     4339                                importance = (float)mViewCellsTree->GetPvsSize(vc) / (float)mCurrentViewCellsStats.maxPvs; 
    43174340                } 
    43184341                break; 
     
    44694492                        if (i != j) 
    44704493                        { 
    4471  
    44724494                                BspLeaf *leaf2 =dynamic_cast<BspViewCell *>(leaves[j])->mLeaf; 
    44734495                                 
Note: See TracChangeset for help on using the changeset viewer.