Ignore:
Timestamp:
09/18/06 18:57:34 (18 years ago)
Author:
mattausch
Message:
 
File:
1 edited

Legend:

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

    r1414 r1415  
    19461946} 
    19471947 
    1948  
     1948// matt: todo 
    19491949void ViewCellsManager::ExportViewCellsForViz(Exporter *exporter) const 
    19501950{ 
     
    26402640                mViewCellsTree->SetRoot(root); 
    26412641 
    2642                 // compute pvs 
     2642                // recompute pvs in the whole hierarchy 
    26432643                ObjectPvs pvs; 
    26442644                UpdatePvsForEvaluation(root, pvs); 
    26452645        } 
     2646 
     2647        cout << "finished" << endl; 
     2648        cout << "merged view cells in " 
     2649                 << TimeDiff(startTime, GetTime()) * 1e-3 << " secs" << endl; 
     2650 
     2651        Debug << "Postprocessing: Merged view cells in " 
     2652                << TimeDiff(startTime, GetTime()) * 1e-3 << " secs" << endl << endl; 
     2653 
     2654         
     2655        ///////////////////////////////////////// 
     2656        //-- visualization and statistics 
    26462657 
    26472658        // export statistics after merge 
     
    26532664        } 
    26542665 
    2655         //-- stats and visualizations 
    2656         cout << "finished" << endl; 
    2657         cout << "merged view cells in " 
    2658                  << TimeDiff(startTime, GetTime()) * 1e-3 << " secs" << endl; 
    2659  
    2660         Debug << "Postprocessing: Merged view cells in " 
    2661                 << TimeDiff(startTime, GetTime()) * 1e-3 << " secs" << endl << endl; 
    2662          
    2663  
    2664         //-- visualization and statistics 
    2665     // reset view cells and stats 
    2666         ResetViewCells(); 
     2666        ResetViewCells(); // reset view cells 
    26672667        Debug << "\nView cells after merge:\n" << mCurrentViewCellsStats << endl; 
    26682668 
     
    27632763        { 
    27642764                mColorCode = 1; // hack color code 
    2765                 Exporter *exporter = Exporter::GetExporter("final_view_cells.x3d"); 
     2765                Exporter *exporter = Exporter::GetExporter("final_view_cells.wrl"); 
    27662766         
    27672767                cout << "exporting view cells after merge (pvs size) ... ";      
     
    38153815        SimulationStatistics ss; 
    38163816        dynamic_cast<RenderSimulator *>(mRenderer)->GetStatistics(ss); 
    3817     Debug << "render time before refine\n" << ss << endl; 
     3817    Debug << "render time before refine\n\n" << ss << endl; 
    38183818 
    38193819        const long startTime = GetTime(); 
     
    38983898        //-- render simulation after merge + refine 
    38993899 
    3900         cout << "\nview cells partition render time before compress"; 
     3900        cout << "\nview cells partition render time before compress" << endl << endl;; 
    39013901        dynamic_cast<RenderSimulator *>(mRenderer)->RenderScene(); 
    39023902        SimulationStatistics ss; 
     
    44494449        //    find view cells associated with the samples 
    44504450        //    store the sample pvs with the pvs associated with the view cell 
     4451        // 
    44514452        // for each view cell: 
    44524453        //    compute difference point sampled pvs - view cell pvs 
     
    44904491                m.mDiffuseColor.b = 1.0f; 
    44914492                //exporter->SetForcedMaterial(m); 
    4492  
    4493 //              ExportViewCellGeometry(exporter, vc, mClipPlane); 
    4494  
    4495 /*      // counting the pvss 
    4496         for (rit = samples.begin(); rit != rit_end; ++ rit) 
    4497         { 
    4498                 RenderCostSample sample = *rit; 
    4499  
    4500                 ViewCell *vc = GetViewCell(sample.mPosition); 
    4501                  
    4502                 AxisAlignedBox3 box(sample.mPosition - Vector3(1, 1, 1), sample.mPosition + Vector3(1, 1, 1)); 
    4503                 Mesh *hMesh = CreateMeshFromBox(box); 
    4504                  
    4505                 DEL_PTR(hMesh); 
    4506  
    4507 */ 
     4493                //ExportViewCellGeometry(exporter, vc, mClipPlane); 
     4494 
     4495                /*      // counting the pvss 
     4496                for (rit = samples.begin(); rit != rit_end; ++ rit) 
     4497                { 
     4498                        RenderCostSample sample = *rit; 
     4499                        ViewCell *vc = GetViewCell(sample.mPosition); 
     4500 
     4501                        AxisAlignedBox3 box(sample.mPosition - Vector3(1, 1, 1), sample.mPosition + Vector3(1, 1, 1)); 
     4502                        Mesh *hMesh = CreateMeshFromBox(box); 
     4503 
     4504                        DEL_PTR(hMesh); 
     4505                } 
     4506                */ 
    45084507        } 
    45094508} 
     
    48014800 
    48024801        // print subdivision statistics 
     4802        Debug << endl << endl; 
    48034803        mHierarchyManager->PrintHierarchyStatistics(Debug); 
    48044804 
     
    48154815 
    48164816        const long startTime = GetTime(); 
    4817  
    48184817        cout << "Computing remaining ray contributions ... "; 
    48194818 
     
    48224821                ComputeSampleContributions(savedRays, true, false); 
    48234822 
    4824         cout << "finished" << endl; 
    4825  
    4826         Debug << "Computed remaining ray contribution in " << TimeDiff(startTime, GetTime()) * 1e-3 
     4823        Debug << "finished computing remaining ray contribution in " << TimeDiff(startTime, GetTime()) * 1e-3 
    48274824                  << " secs" << endl; 
    48284825 
    4829         cout << "construction finished" << endl; 
    4830  
    4831         // real meshes are contructed at this stage 
    48324826        if (0) 
    48334827        { 
     4828                // real meshes are constructed at this stage 
    48344829                cout << "finalizing view cells ... "; 
    48354830                FinalizeViewCells(true); 
     
    49084903        //-- render simulation after merge + refine 
    49094904 
    4910         cout << "\nview cells partition render time before compress"; 
     4905        cout << "\nview cells partition render time before compress" << endl << endl; 
    49114906        dynamic_cast<RenderSimulator *>(mRenderer)->RenderScene(); 
    49124907        SimulationStatistics ss; 
     
    50285023         
    50295024        if (clipPlane) 
     5025        { 
    50305026                plane = clipPlane->GetPlane(); 
     5027        } 
     5028 
     5029        AxisAlignedBox3 bbox = GetViewSpaceBox(); 
     5030        bbox.Scale(Vector3(0.5, 1, 0.5));                        
    50315031 
    50325032        for (it = leaves.begin(); it != it_end; ++ it) 
     
    50375037                const AxisAlignedBox3 box = mHierarchyManager->GetVspTree()->GetBoundingBox(vspVc->mLeaf); 
    50385038                 
     5039                if (!Overlap(box, bbox)) 
     5040                        continue; 
     5041 
    50395042                if (clipPlane) 
    50405043                { 
     
    50815084        if (1)  
    50825085        {        
     5086                ///////////////////////////// 
    50835087                //-- export final view cells 
    50845088 
    5085                 // hack pvs 
     5089                // hack color code (show pvs size) 
    50865090                const int savedColorCode = mColorCode; 
    50875091                mColorCode = 0; 
     
    50915095                if (exporter) 
    50925096                { 
    5093                         cout << "exporting view cells after post process ... "; 
     5097                        const long starttime = GetTime(); 
     5098                        cout << "exporting final view cells (after initial construction + post process) ... "; 
    50945099 
    50955100                        if (mExportGeometry) 
     
    51135118                        delete exporter; 
    51145119 
    5115                         cout << "finished" << endl; 
     5120                        cout << "finished in " << TimeDiff(starttime, GetTime()) * 1e-3f << " secs" << endl; 
    51165121                } 
    51175122 
     
    51265131                if (exporter) 
    51275132                { 
     5133                        const long starttime = GetTime(); 
     5134 
    51285135                        cout << "exporting object space hierarchy ... "; 
    51295136                        mHierarchyManager->ExportObjectSpaceHierarchy(exporter, objects); 
    51305137                 
    51315138                        delete exporter; 
    5132                         cout << "finished" << endl; 
     5139                        cout << "finished in " << TimeDiff(starttime, GetTime()) * 1e-3f << " secs" << endl; 
    51335140                } 
    51345141        } 
     
    51535160        const bool sortViewCells = true; 
    51545161 
    5155         // sort view cells to visualize the largest view cells 
    51565162        if (sortViewCells) 
    51575163        { 
    51585164                //stable_sort(mViewCells.begin(), mViewCells.end(), ViewCell::SmallerPvs); 
     5165                // sort view cells to visualize the view cells with highest render cost 
    51595166                stable_sort(mViewCells.begin(), mViewCells.end(), ViewCell::LargerRenderCost); 
    51605167        } 
    51615168 
    51625169        int limit = min(leafOut, (int)mViewCells.size()); 
    5163  
    51645170        int raysOut = 0; 
    51655171 
    5166  
     5172        /////////////////////////// 
    51675173        //-- some rays for output 
    51685174         
     
    52495255                                }        
    52505256                                 
    5251                                 //-- export rays piercing this view cell 
     5257                                // export rays piercing this view cell 
    52525258                                exporter->ExportRays(vcRays, RgbColor(1, 1, 0)); 
    52535259                        } 
    52545260                } 
    52555261 
     5262 
     5263                ///////////////// 
    52565264                //-- export view cell geometry 
    52575265 
     
    52675275 
    52685276#if 0    
     5277                ////////// 
    52695278                //-- export pvs 
    52705279 
     
    53365345                return false; 
    53375346 
     5347        const long starttime = GetTime(); 
    53385348        cout << "exporting view cells to xml ... "; 
    53395349         
     
    53495359        ////////////////////////////////////////////////////////////// 
    53505360        //-- export bounding boxes 
     5361        //-- The bounding boxes are used to identify  
     5362        //-- the objects in the rendering engine 
    53515363 
    53525364        stream << "<BoundingBoxes>" << endl; 
     
    53565368        { 
    53575369                        const AxisAlignedBox3 box = (*oit)->GetBox(); 
    5358  
    5359                         //-- the bounding boxes 
    53605370                        stream << "<BoundingBox" << " id=\"" << (*oit)->GetId() << "\"" 
    53615371                                   << " min=\"" << box.Min().x << " " << box.Min().y << " " << box.Min().z << "\"" 
    53625372                                   << " max=\"" << box.Max().x << " " << box.Max().y << " " << box.Max().z << "\" />" << endl; 
    53635373        } 
    5364  
    53655374        stream << "</BoundingBoxes>" << endl; 
    53665375 
    5367         //////////////////////////////////////////////////////////////// 
     5376 
     5377        ////////////////////////// 
    53685378        //-- export the view cells and the pvs 
    53695379 
     
    53745384        stream << "</ViewCells>" << endl; 
    53755385 
    5376  
     5386        ////////////////////// 
    53775387        //-- export the view space hierarchy 
    53785388         
     
    53845394        stream << "</ViewSpaceHierarchy>" << endl; 
    53855395 
    5386          
     5396        //////////////////////   
    53875397        //-- export the object space partition 
    53885398         
     
    53925402        stream.close(); 
    53935403         
    5394         cout << "finished" << endl; 
    5395  
     5404        cout << "finished in " << TimeDiff(starttime, GetTime()) * 1e-3 << " secs" << endl; 
    53965405        return true; 
    53975406} 
Note: See TracChangeset for help on using the changeset viewer.