Ignore:
Timestamp:
11/18/05 16:29:31 (19 years ago)
Author:
mattausch
Message:

worded on vspkdtree

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/VUT/GtpVisibilityPreprocessor/src/SamplingPreprocessor.cpp

    r421 r422  
    7373                mBspTree->Construct(objects); 
    7474                break; 
    75         case BspTree::FROM_RAYS: 
     75        case BspTree::FROM_SAMPLES: 
    7676                DeleteViewCells(); // we generate new view cells 
    7777                mBspTree->SetGenerateViewCells(true); 
     
    490490                                                                                        passSampleContributions); 
    491491 
    492                                                 //mVspKdTree->Construct(mSampleRays, mBoundingBox); 
    493492                                        } 
    494493                                        else if (ViewCell::sHierarchy == ViewCell::VSP) 
     
    555554   
    556555        //-- render simulation 
    557         cout << "\nevaluating bsp view cells render time before merge ... "; 
    558         GetRenderSimulator()->SimulateRendering(); 
    559          
    560         cout << " finished" << endl; 
    561  
    562         cout << GetRenderSimulator()->mStat << endl; 
    563         Debug << GetRenderSimulator()->mStat << endl; 
    564  
     556        RenderSimulator *rs = GetRenderSimulator(); 
     557 
     558        if (rs) 
     559        { 
     560                cout << "\nevaluating bsp view cells render time before merge ... "; 
     561 
     562                rs->SimulateRendering(); 
     563         
     564                cout << " finished" << endl; 
     565 
     566                cout << GetRenderSimulator()->mStat << endl; 
     567                Debug << GetRenderSimulator()->mStat << endl; 
     568        } 
    565569 
    566570        if (mBspTree) 
     
    618622 
    619623                //-- render simulation 
    620                 cout << "\nevaluating render time after merge ... "; 
    621                          
    622                 GetRenderSimulator()->SimulateRendering(); 
    623                 cout << " finished" << endl; 
    624  
    625                 cout << GetRenderSimulator()->mStat << endl; 
    626                 Debug << GetRenderSimulator()->mStat << endl; 
     624                 
     625                RenderSimulator *rs = GetRenderSimulator(); 
     626 
     627                if (rs) 
     628                { 
     629                        cout << "\nevaluating render time after merge ... "; 
     630                         
     631                        rs->SimulateRendering(); 
     632 
     633                        cout << " finished" << endl; 
     634 
     635                        cout << GetRenderSimulator()->mStat << endl; 
     636                        Debug << GetRenderSimulator()->mStat << endl; 
     637                } 
    627638 
    628639                if (1) // export view cells 
     
    659670                exporter->SetExportRayDensity(true); 
    660671                exporter->ExportKdTree(*mKdTree); 
    661  
    662                 if (mBspTree && (ViewCell::sHierarchy == ViewCell::VSP)) 
    663                         exporter->ExportVspKdTree(*mVspKdTree); 
    664  
     672                delete exporter; 
     673        } 
     674 
     675        if (mVspKdTree) 
     676        { 
     677                Exporter *exporter = Exporter::GetExporter("vspkdtree.x3d");  
     678                exporter->SetWireframe(); 
     679                exporter->ExportVspKdTree(*mVspKdTree); 
    665680                delete exporter; 
    666681        } 
     
    732747                                                                                           int &sampleContributions) 
    733748{ 
    734         // save rays for bsp tree construction 
    735749        if (!mVspKdTree) 
    736750        { 
     751                // store samples for vsp kd tree construction 
    737752                if ((int)mVspSampleRays.size() < mVspConstructionSamples) 
    738753                { 
    739                         MeshInstance *mi = dynamic_cast<MeshInstance *>(object); 
    740                          
    741754                        VssRay *sRay = new VssRay(ray); 
    742                         mVspSampleRays.push_back(sRay); 
     755                 
     756            mVspSampleRays.push_back(sRay); 
    743757                 
    744758                        // also add origin to sample 
     
    749763                        // construct VSP tree using the collected samples 
    750764                        cout << "building VSP tree from " << (int)mVspSampleRays.size() << " samples " << endl; 
     765                        mVspKdTree = new VspKdTree(); 
    751766                        mVspKdTree->Construct(mVspSampleRays); 
    752767                 
     
    779794        if (!mBspTree) 
    780795        { 
    781                 if ((BspTree::sConstructionMethod == BspTree::FROM_RAYS) && 
     796                if ((BspTree::sConstructionMethod == BspTree::FROM_SAMPLES) && 
    782797                        ((int)mSampleRays.size() < mBspConstructionSamples)) 
    783798                { 
     
    889904                                        outRays.push_back(mSampleRays[i]); 
    890905                        } 
    891                         if (BspTree::sConstructionMethod == BspTree::FROM_RAYS) 
     906                        if (BspTree::sConstructionMethod == BspTree::FROM_SAMPLES) 
    892907                        { 
    893908                                // export rays  
Note: See TracChangeset for help on using the changeset viewer.